From 316601ba4c046af176a5172e29dcc38b5f700d96 Mon Sep 17 00:00:00 2001 From: attente Date: Tue, 5 Nov 2024 17:30:20 +0000 Subject: [PATCH] Build: (4a3c53d) load balances on removal --- .../{index-DZHWH4bK.js => index-BHJ6sBpm.js} | 2 +- .../{index-Bq8MMoYt.js => index-BTMLuAci.js} | 30 +++++++++---------- .../{index-BqUc7-Na.js => index-Mx8kZtbv.js} | 4 +-- index.html | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) rename assets/{index-DZHWH4bK.js => index-BHJ6sBpm.js} (99%) rename assets/{index-Bq8MMoYt.js => index-BTMLuAci.js} (94%) rename assets/{index-BqUc7-Na.js => index-Mx8kZtbv.js} (98%) diff --git a/assets/index-DZHWH4bK.js b/assets/index-BHJ6sBpm.js similarity index 99% rename from assets/index-DZHWH4bK.js rename to assets/index-BHJ6sBpm.js index 397a15f..f136f40 100644 --- a/assets/index-DZHWH4bK.js +++ b/assets/index-BHJ6sBpm.js @@ -1,4 +1,4 @@ -import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-BqUc7-Na.js";import"./index-Bq8MMoYt.js";/** +import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-Mx8kZtbv.js";import"./index-BTMLuAci.js";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/assets/index-Bq8MMoYt.js b/assets/index-BTMLuAci.js similarity index 94% rename from assets/index-Bq8MMoYt.js rename to assets/index-BTMLuAci.js index b4ce9cc..4d4b219 100644 --- a/assets/index-Bq8MMoYt.js +++ b/assets/index-BTMLuAci.js @@ -37,7 +37,7 @@ var tce=Object.defineProperty;var jO=t=>{throw TypeError(t)};var rce=(t,e,r)=>e `+i[o].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=o&&0<=a);break}}}finally{ZC=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?$m(t):""}function Mce(t){switch(t.tag){case 5:return $m(t.type);case 16:return $m("Lazy");case 13:return $m("Suspense");case 19:return $m("SuspenseList");case 0:case 2:case 15:return t=XC(t.type,!1),t;case 11:return t=XC(t.type.render,!1),t;case 1:return t=XC(t.type,!0),t;default:return""}}function pS(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 Q1:return"Fragment";case Y1:return"Portal";case uS:return"Profiler";case BI:return"StrictMode";case dS:return"Suspense";case hS:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case aq:return(t.displayName||"Context")+".Consumer";case oq:return(t._context.displayName||"Context")+".Provider";case LI:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case FI:return e=t.displayName||null,e!==null?e:pS(t.type)||"Memo";case ad:e=t._payload,t=t._init;try{return pS(t(e))}catch{}}return null}function Rce(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 pS(e);case 8:return e===BI?"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 rh(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function lq(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Oce(t){var e=lq(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,s=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function L2(t){t._valueTracker||(t._valueTracker=Oce(t))}function fq(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=lq(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function $3(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 vS(t,e){var r=e.checked;return Ln({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function GO(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=rh(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 uq(t,e){e=e.checked,e!=null&&NI(t,"checked",e,!1)}function gS(t,e){uq(t,e);var r=rh(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")?yS(t,e.type,r):e.hasOwnProperty("defaultValue")&&yS(t,e.type,rh(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function WO(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 yS(t,e,r){(e!=="number"||$3(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var qm=Array.isArray;function wv(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=F2.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function $b(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ub={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},Dce=["Webkit","ms","Moz","O"];Object.keys(ub).forEach(function(t){Dce.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ub[e]=ub[t]})});function vq(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ub.hasOwnProperty(t)&&ub[t]?(""+e).trim():e+"px"}function gq(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=vq(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Nce=Ln({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 wS(t,e){if(e){if(Nce[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Xe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Xe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Xe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Xe(62))}}function xS(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 ES=null;function jI(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var CS=null,xv=null,Ev=null;function QO(t){if(t=ex(t)){if(typeof CS!="function")throw Error(Xe(280));var e=t.stateNode;e&&(e=T4(e),CS(t.stateNode,t.type,e))}}function yq(t){xv?Ev?Ev.push(t):Ev=[t]:xv=t}function mq(){if(xv){var t=xv,e=Ev;if(Ev=xv=null,QO(t),e)for(t=0;t>>=0,t===0?32:31-(Gce(t)/Wce|0)|0}var j2=64,U2=4194304;function Vm(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 H3(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,s=t.pingedLanes,o=r&268435455;if(o!==0){var a=o&~i;a!==0?n=Vm(a):(s&=o,s!==0&&(n=Vm(s)))}else o=r&~i,o!==0?n=Vm(o):s!==0&&(n=Vm(s));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,s=e&-e,i>=s||i===16&&(s&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 Zw(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Gc(e),t[e]=r}function Jce(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=hb),sD=" ",oD=!1;function Fq(t,e){switch(t){case"keyup":return Sle.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jq(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var J1=!1;function Ile(t,e){switch(t){case"compositionend":return jq(e);case"keypress":return e.which!==32?null:(oD=!0,sD);case"textInput":return t=e.data,t===sD&&oD?null:t;default:return null}}function Tle(t,e){if(J1)return t==="compositionend"||!WI&&Fq(t,e)?(t=Bq(),q6=zI=Dd=null,J1=!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=fD(r)}}function Vq(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Vq(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function zq(){for(var t=window,e=$3();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=$3(t.document)}return e}function KI(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 Lle(t){var e=zq(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Vq(r.ownerDocument.documentElement,r)){if(n!==null&&KI(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,s=Math.min(n.start,i);n=n.end===void 0?s:Math.min(n.end,i),!t.extend&&s>n&&(i=n,n=s,s=i),i=uD(r,s);var o=uD(r,n);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>n?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.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,Z1=null,PS=null,vb=null,kS=!1;function dD(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;kS||Z1==null||Z1!==$3(n)||(n=Z1,"selectionStart"in n&&KI(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}),vb&&Wb(vb,n)||(vb=n,n=K3(PS,"onSelect"),0tv||(t.current=BS[tv],BS[tv]=null,tv--)}function bn(t,e){tv++,BS[tv]=t.current,t.current=e}var nh={},Os=wh(nh),ko=wh(!1),mp=nh;function Ng(t,e){var r=t.type.contextTypes;if(!r)return nh;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in r)i[s]=e[s];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Mo(t){return t=t.childContextTypes,t!=null}function Q3(){An(ko),An(Os)}function bD(t,e,r){if(Os.current!==nh)throw Error(Xe(168));bn(Os,e),bn(ko,r)}function Xq(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(Xe(108,Rce(t)||"Unknown",i));return Ln({},r,n)}function J3(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||nh,mp=Os.current,bn(Os,t),bn(ko,ko.current),!0}function wD(t,e,r){var n=t.stateNode;if(!n)throw Error(Xe(169));r?(t=Xq(t,e,mp),n.__reactInternalMemoizedMergedChildContext=t,An(ko),An(Os),bn(Os,t)):An(ko),bn(ko,r)}var Df=null,P4=!1,hA=!1;function eV(t){Df===null?Df=[t]:Df.push(t)}function Yle(t){P4=!0,eV(t)}function xh(){if(!hA&&Df!==null){hA=!0;var t=0,e=sn;try{var r=Df;for(sn=1;t>=o,i-=o,Qf=1<<32-Gc(e)+i|r<$?(ie=_,_=null):ie=_.sibling;var ce=p(C,_,O[$],L);if(ce===null){_===null&&(_=ie);break}t&&_&&ce.alternate===null&&e(C,_),S=s(ce,S,$),z===null?F=ce:z.sibling=ce,z=ce,_=ie}if($===O.length)return r(C,_),Tn&&f0(C,$),F;if(_===null){for(;$$?(ie=_,_=null):ie=_.sibling;var K=p(C,_,ce.value,L);if(K===null){_===null&&(_=ie);break}t&&_&&K.alternate===null&&e(C,_),S=s(K,S,$),z===null?F=K:z.sibling=K,z=K,_=ie}if(ce.done)return r(C,_),Tn&&f0(C,$),F;if(_===null){for(;!ce.done;$++,ce=O.next())ce=u(C,ce.value,L),ce!==null&&(S=s(ce,S,$),z===null?F=ce:z.sibling=ce,z=ce);return Tn&&f0(C,$),F}for(_=n(C,_);!ce.done;$++,ce=O.next())ce=g(_,C,$,ce.value,L),ce!==null&&(t&&ce.alternate!==null&&_.delete(ce.key===null?$:ce.key),S=s(ce,S,$),z===null?F=ce:z.sibling=ce,z=ce);return t&&_.forEach(function(P){return e(C,P)}),Tn&&f0(C,$),F}function I(C,S,O,L){if(typeof O=="object"&&O!==null&&O.type===Q1&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case B2:e:{for(var F=O.key,z=S;z!==null;){if(z.key===F){if(F=O.type,F===Q1){if(z.tag===7){r(C,z.sibling),S=i(z,O.props.children),S.return=C,C=S;break e}}else if(z.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===ad&&CD(F)===z.type){r(C,z.sibling),S=i(z,O.props),S.ref=mm(C,z,O),S.return=C,C=S;break e}r(C,z);break}else e(C,z);z=z.sibling}O.type===Q1?(S=op(O.props.children,C.mode,L,O.key),S.return=C,C=S):(L=Q6(O.type,O.key,O.props,null,C.mode,L),L.ref=mm(C,S,O),L.return=C,C=L)}return o(C);case Y1:e:{for(z=O.key;S!==null;){if(S.key===z)if(S.tag===4&&S.stateNode.containerInfo===O.containerInfo&&S.stateNode.implementation===O.implementation){r(C,S.sibling),S=i(S,O.children||[]),S.return=C,C=S;break e}else{r(C,S);break}else e(C,S);S=S.sibling}S=xA(O,C.mode,L),S.return=C,C=S}return o(C);case ad:return z=O._init,I(C,S,z(O._payload),L)}if(qm(O))return y(C,S,O,L);if(hm(O))return b(C,S,O,L);W2(C,O)}return typeof O=="string"&&O!==""||typeof O=="number"?(O=""+O,S!==null&&S.tag===6?(r(C,S.sibling),S=i(S,O),S.return=C,C=S):(r(C,S),S=wA(O,C.mode,L),S.return=C,C=S),o(C)):r(C,S)}return I}var Lg=iV(!0),sV=iV(!1),e5=wh(null),t5=null,iv=null,ZI=null;function XI(){ZI=iv=t5=null}function eT(t){var e=e5.current;An(e5),t._currentValue=e}function jS(t,e,r){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===r)break;t=t.return}}function Av(t,e){t5=t,ZI=iv=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Po=!0),t.firstContext=null)}function rc(t){var e=t._currentValue;if(ZI!==t)if(t={context:t,memoizedValue:e,next:null},iv===null){if(t5===null)throw Error(Xe(308));iv=t,t5.dependencies={lanes:0,firstContext:t}}else iv=iv.next=t;return e}var _0=null;function tT(t){_0===null?_0=[t]:_0.push(t)}function oV(t,e,r,n){var i=e.interleaved;return i===null?(r.next=r,tT(e)):(r.next=i.next,i.next=r),e.interleaved=r,du(t,n)}function du(t,e){t.lanes|=e;var r=t.alternate;for(r!==null&&(r.lanes|=e),r=t,t=t.return;t!==null;)t.childLanes|=e,r=t.alternate,r!==null&&(r.childLanes|=e),r=t,t=t.return;return r.tag===3?r.stateNode:null}var cd=!1;function rT(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function aV(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ru(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Hd(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,Lr&2){var i=n.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),n.pending=e,du(t,r)}return i=n.interleaved,i===null?(e.next=e,tT(n)):(e.next=i.next,i.next=e),n.interleaved=e,du(t,r)}function z6(t,e,r){if(e=e.updateQueue,e!==null&&(e=e.shared,(r&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,$I(t,r)}}function AD(t,e){var r=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,s=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};s===null?i=s=o:s=s.next=o,r=r.next}while(r!==null);s===null?i=s=e:s=s.next=e}else i=s=e;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=e:t.next=e,r.lastBaseUpdate=e}function r5(t,e,r,n){var i=t.updateQueue;cd=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var c=a,l=c.next;c.next=null,o===null?s=l:o.next=l,o=c;var f=t.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=c))}if(s!==null){var u=i.baseState;o=0,f=l=c=null,a=s;do{var p=a.lane,g=a.eventTime;if((n&p)===p){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=t,b=a;switch(p=e,g=r,b.tag){case 1:if(y=b.payload,typeof y=="function"){u=y.call(g,u,p);break e}u=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=b.payload,p=typeof y=="function"?y.call(g,u,p):y,p==null)break e;u=Ln({},u,p);break e;case 2:cd=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else g={eventTime:g,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(l=f=g,c=u):f=f.next=g,o|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(f===null&&(c=u),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=f,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);xp|=o,t.lanes=o,t.memoizedState=u}}function SD(t,e,r){if(t=e.effects,e.effects=null,t!==null)for(e=0;er?r:4,t(!0);var n=vA.transition;vA.transition={};try{t(!1),e()}finally{sn=r,vA.transition=n}}function AV(){return nc().memoizedState}function Xle(t,e,r){var n=Wd(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},SV(t))_V(e,r);else if(r=oV(t,e,r,n),r!==null){var i=Zs();Wc(r,t,n,i),IV(r,e,n)}}function efe(t,e,r){var n=Wd(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(SV(t))_V(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,Yc(a,o)){var c=e.interleaved;c===null?(i.next=i,tT(e)):(i.next=c.next,c.next=i),e.interleaved=i;return}}catch{}finally{}r=oV(t,e,i,n),r!==null&&(i=Zs(),Wc(r,t,n,i),IV(r,e,n))}}function SV(t){var e=t.alternate;return t===Bn||e!==null&&e===Bn}function _V(t,e){gb=i5=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function IV(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,$I(t,r)}}var s5={readContext:rc,useCallback:gs,useContext:gs,useEffect:gs,useImperativeHandle:gs,useInsertionEffect:gs,useLayoutEffect:gs,useMemo:gs,useReducer:gs,useRef:gs,useState:gs,useDebugValue:gs,useDeferredValue:gs,useTransition:gs,useMutableSource:gs,useSyncExternalStore:gs,useId:gs,unstable_isNewReconciler:!1},tfe={readContext:rc,useCallback:function(t,e){return wl().memoizedState=[t,e===void 0?null:e],t},useContext:rc,useEffect:ID,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,G6(4194308,4,bV.bind(null,e,t),r)},useLayoutEffect:function(t,e){return G6(4194308,4,t,e)},useInsertionEffect:function(t,e){return G6(4,2,t,e)},useMemo:function(t,e){var r=wl();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=wl();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=Xle.bind(null,Bn,t),[n.memoizedState,t]},useRef:function(t){var e=wl();return t={current:t},e.memoizedState=t},useState:_D,useDebugValue:fT,useDeferredValue:function(t){return wl().memoizedState=t},useTransition:function(){var t=_D(!1),e=t[0];return t=Zle.bind(null,t[1]),wl().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=Bn,i=wl();if(Tn){if(r===void 0)throw Error(Xe(407));r=r()}else{if(r=e(),Fi===null)throw Error(Xe(349));wp&30||uV(n,e,r)}i.memoizedState=r;var s={value:r,getSnapshot:e};return i.queue=s,ID(hV.bind(null,n,s,t),[t]),n.flags|=2048,tw(9,dV.bind(null,n,s,r,e),void 0,null),r},useId:function(){var t=wl(),e=Fi.identifierPrefix;if(Tn){var r=Jf,n=Qf;r=(n&~(1<<32-Gc(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Xb++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[Ol]=e,t[Qb]=n,LV(t,e,!1,!1),e.stateNode=t;e:{switch(o=xS(r,n),r){case"dialog":xn("cancel",t),xn("close",t),i=n;break;case"iframe":case"object":case"embed":xn("load",t),i=n;break;case"video":case"audio":for(i=0;iUg&&(e.flags|=128,n=!0,bm(s,!1),e.lanes=4194304)}else{if(!n)if(t=n5(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),bm(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Tn)return ys(e),null}else 2*oi()-s.renderingStartTime>Ug&&r!==1073741824&&(e.flags|=128,n=!0,bm(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=oi(),e.sibling=null,r=Mn.current,bn(Mn,n?r&1|2:r&1),e):(ys(e),null);case 22:case 23:return gT(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?na&1073741824&&(ys(e),e.subtreeFlags&6&&(e.flags|=8192)):ys(e),null;case 24:return null;case 25:return null}throw Error(Xe(156,e.tag))}function lfe(t,e){switch(QI(e),e.tag){case 1:return Mo(e.type)&&Q3(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Fg(),An(ko),An(Os),sT(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return iT(e),null;case 13:if(An(Mn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Xe(340));Bg()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return An(Mn),null;case 4:return Fg(),null;case 10:return eT(e.type._context),null;case 22:case 23:return gT(),null;case 24:return null;default:return null}}var Y2=!1,Ss=!1,ffe=typeof WeakSet=="function"?WeakSet:Set,_t=null;function sv(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Hn(t,e,n)}else r.current=null}function KS(t,e,r){try{r()}catch(n){Hn(t,e,n)}}var FD=!1;function ufe(t,e){if(MS=G3,t=zq(),KI(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,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,c=-1,l=0,f=0,u=t,p=null;t:for(;;){for(var g;u!==r||i!==0&&u.nodeType!==3||(a=o+i),u!==s||n!==0&&u.nodeType!==3||(c=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(g=u.firstChild)!==null;)p=u,u=g;for(;;){if(u===t)break t;if(p===r&&++l===i&&(a=o),p===s&&++f===n&&(c=o),(g=u.nextSibling)!==null)break;u=p,p=u.parentNode}u=g}r=a===-1||c===-1?null:{start:a,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(RS={focusedElem:t,selectionRange:r},G3=!1,_t=e;_t!==null;)if(e=_t,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,_t=t;else for(;_t!==null;){e=_t;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,I=y.memoizedState,C=e.stateNode,S=C.getSnapshotBeforeUpdate(e.elementType===e.type?b:Rc(e.type,b),I);C.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var O=e.stateNode.containerInfo;O.nodeType===1?O.textContent="":O.nodeType===9&&O.documentElement&&O.removeChild(O.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Xe(163))}}catch(L){Hn(e,e.return,L)}if(t=e.sibling,t!==null){t.return=e.return,_t=t;break}_t=e.return}return y=FD,FD=!1,y}function yb(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 s=i.destroy;i.destroy=void 0,s!==void 0&&KS(e,r,s)}i=i.next}while(i!==n)}}function R4(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 YS(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 UV(t){var e=t.alternate;e!==null&&(t.alternate=null,UV(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ol],delete e[Qb],delete e[NS],delete e[Wle],delete e[Kle])),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 $V(t){return t.tag===5||t.tag===3||t.tag===4}function jD(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||$V(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 QS(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=Y3));else if(n!==4&&(t=t.child,t!==null))for(QS(t,e,r),t=t.sibling;t!==null;)QS(t,e,r),t=t.sibling}function JS(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(JS(t,e,r),t=t.sibling;t!==null;)JS(t,e,r),t=t.sibling}var Qi=null,Uc=!1;function Zu(t,e,r){for(r=r.child;r!==null;)qV(t,e,r),r=r.sibling}function qV(t,e,r){if(Ul&&typeof Ul.onCommitFiberUnmount=="function")try{Ul.onCommitFiberUnmount(A4,r)}catch{}switch(r.tag){case 5:Ss||sv(r,e);case 6:var n=Qi,i=Uc;Qi=null,Zu(t,e,r),Qi=n,Uc=i,Qi!==null&&(Uc?(t=Qi,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Qi.removeChild(r.stateNode));break;case 18:Qi!==null&&(Uc?(t=Qi,r=r.stateNode,t.nodeType===8?dA(t.parentNode,r):t.nodeType===1&&dA(t,r),Hb(t)):dA(Qi,r.stateNode));break;case 4:n=Qi,i=Uc,Qi=r.stateNode.containerInfo,Uc=!0,Zu(t,e,r),Qi=n,Uc=i;break;case 0:case 11:case 14:case 15:if(!Ss&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&KS(r,e,o),i=i.next}while(i!==n)}Zu(t,e,r);break;case 1:if(!Ss&&(sv(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){Hn(r,e,a)}Zu(t,e,r);break;case 21:Zu(t,e,r);break;case 22:r.mode&1?(Ss=(n=Ss)||r.memoizedState!==null,Zu(t,e,r),Ss=n):Zu(t,e,r);break;default:Zu(t,e,r)}}function UD(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new ffe),e.forEach(function(n){var i=wfe.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function xc(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=oi()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*hfe(n/1960))-n,10t?16:t,Nd===null)var n=!1;else{if(t=Nd,Nd=null,c5=0,Lr&6)throw Error(Xe(331));var i=Lr;for(Lr|=4,_t=t.current;_t!==null;){var s=_t,o=s.child;if(_t.flags&16){var a=s.deletions;if(a!==null){for(var c=0;coi()-pT?sp(t,0):hT|=r),Ro(t,e)}function QV(t,e){e===0&&(t.mode&1?(e=U2,U2<<=1,!(U2&130023424)&&(U2=4194304)):e=1);var r=Zs();t=du(t,e),t!==null&&(Zw(t,e,r),Ro(t,r))}function bfe(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),QV(t,r)}function wfe(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(Xe(314))}n!==null&&n.delete(e),QV(t,r)}var JV;JV=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||ko.current)Po=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Po=!1,afe(t,e,r);Po=!!(t.flags&131072)}else Po=!1,Tn&&e.flags&1048576&&tV(e,X3,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;W6(t,e),t=e.pendingProps;var i=Ng(e,Os.current);Av(e,r),i=aT(null,e,n,t,i,r);var s=cT();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,Mo(n)?(s=!0,J3(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,rT(e),i.updater=M4,e.stateNode=i,i._reactInternals=e,$S(e,n,t,r),e=zS(null,e,n,!0,s,r)):(e.tag=0,Tn&&s&&YI(e),Ks(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(W6(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=Efe(n),t=Rc(n,t),i){case 0:e=VS(null,e,n,t,r);break e;case 1:e=ND(null,e,n,t,r);break e;case 11:e=OD(null,e,n,t,r);break e;case 14:e=DD(null,e,n,Rc(n.type,t),r);break e}throw Error(Xe(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),VS(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),ND(t,e,n,i,r);case 3:e:{if(DV(e),t===null)throw Error(Xe(387));n=e.pendingProps,s=e.memoizedState,i=s.element,aV(t,e),r5(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=jg(Error(Xe(423)),e),e=BD(t,e,n,r,i);break e}else if(n!==i){i=jg(Error(Xe(424)),e),e=BD(t,e,n,r,i);break e}else for(aa=zd(e.stateNode.containerInfo.firstChild),fa=e,Tn=!0,qc=null,r=sV(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Bg(),n===i){e=hu(t,e,r);break e}Ks(t,e,n,r)}e=e.child}return e;case 5:return cV(e),t===null&&FS(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,OS(n,i)?o=null:s!==null&&OS(n,s)&&(e.flags|=32),OV(t,e),Ks(t,e,o,r),e.child;case 6:return t===null&&FS(e),null;case 13:return NV(t,e,r);case 4:return nT(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Lg(e,null,n,r):Ks(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),OD(t,e,n,i,r);case 7:return Ks(t,e,e.pendingProps,r),e.child;case 8:return Ks(t,e,e.pendingProps.children,r),e.child;case 12:return Ks(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,bn(e5,n._currentValue),n._currentValue=o,s!==null)if(Yc(s.value,o)){if(s.children===i.children&&!ko.current){e=hu(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var c=a.firstContext;c!==null;){if(c.context===n){if(s.tag===1){c=ru(-1,r&-r),c.tag=2;var l=s.updateQueue;if(l!==null){l=l.shared;var f=l.pending;f===null?c.next=c:(c.next=f.next,f.next=c),l.pending=c}}s.lanes|=r,c=s.alternate,c!==null&&(c.lanes|=r),jS(s.return,r,e),a.lanes|=r;break}c=c.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Xe(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),jS(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ks(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Av(e,r),i=rc(i),n=n(i),e.flags|=1,Ks(t,e,n,r),e.child;case 14:return n=e.type,i=Rc(n,e.pendingProps),i=Rc(n.type,i),DD(t,e,n,i,r);case 15:return MV(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),W6(t,e),e.tag=1,Mo(n)?(t=!0,J3(e)):t=!1,Av(e,r),TV(e,n,i),$S(e,n,i,r),zS(null,e,n,!0,t,r);case 19:return BV(t,e,r);case 22:return RV(t,e,r)}throw Error(Xe(156,e.tag))};function ZV(t,e){return Sq(t,e)}function xfe(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 Ja(t,e,r,n){return new xfe(t,e,r,n)}function mT(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Efe(t){if(typeof t=="function")return mT(t)?1:0;if(t!=null){if(t=t.$$typeof,t===LI)return 11;if(t===FI)return 14}return 2}function Kd(t,e){var r=t.alternate;return r===null?(r=Ja(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 Q6(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")mT(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Q1:return op(r.children,i,s,e);case BI:o=8,i|=8;break;case uS:return t=Ja(12,r,e,i|2),t.elementType=uS,t.lanes=s,t;case dS:return t=Ja(13,r,e,i),t.elementType=dS,t.lanes=s,t;case hS:return t=Ja(19,r,e,i),t.elementType=hS,t.lanes=s,t;case cq:return D4(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case oq:o=10;break e;case aq:o=9;break e;case LI:o=11;break e;case FI:o=14;break e;case ad:o=16,n=null;break e}throw Error(Xe(130,t==null?t:typeof t,""))}return e=Ja(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function op(t,e,r,n){return t=Ja(7,t,n,e),t.lanes=r,t}function D4(t,e,r,n){return t=Ja(22,t,n,e),t.elementType=cq,t.lanes=r,t.stateNode={isHidden:!1},t}function wA(t,e,r){return t=Ja(6,t,null,e),t.lanes=r,t}function xA(t,e,r){return e=Ja(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Cfe(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=tA(0),this.expirationTimes=tA(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tA(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function bT(t,e,r,n,i,s,o,a,c){return t=new Cfe(t,e,r,a,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Ja(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},rT(s),t}function Afe(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rz)}catch(t){console.error(t)}}rz(),rq.exports=ga;var Eh=rq.exports;const Pfe=_u(Eh),CT=D.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),j4=D.createContext({}),U4=D.createContext(null),AT=typeof window<"u",nz=AT?D.useLayoutEffect:D.useEffect,iz=D.createContext({strict:!1}),$4=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),kfe="framerAppearId",sz="data-"+$4(kfe),Mfe={skipAnimations:!1,useManualTiming:!1};function Rfe(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(c.schedule(l),t()),l(o)}const c={schedule:(l,f=!1,u=!1)=>{const g=u&&n?e:r;return f&&s.add(l),g.has(l)||g.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,c.process(l))}};return c}const Z2=["read","resolveKeyframes","update","preRender","render","postRender"],Ofe=40;function oz(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=Z2.reduce((C,S)=>(C[S]=Rfe(s),C),{}),{read:a,resolveKeyframes:c,update:l,preRender:f,render:u,postRender:p}=o,g=()=>{const C=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(C-i.timestamp,Ofe),1),i.timestamp=C,i.isProcessing=!0,a.process(i),c.process(i),l.process(i),f.process(i),u.process(i),p.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(g))},y=()=>{r=!0,n=!0,i.isProcessing||t(g)};return{schedule:Z2.reduce((C,S)=>{const O=o[S];return C[S]=(L,F=!1,z=!1)=>(r||y(),O.schedule(L,F,z)),C},{}),cancel:C=>{for(let S=0;S{u&&u.update(r,c)});const g=r[sz],y=D.useRef(!!g&&!window.MotionHandoffIsComplete&&((s=window.MotionHasOptimisedAnimation)===null||s===void 0?void 0:s.call(window,g)));return nz(()=>{u&&(u.updateFeatures(),ST.render(u.render),y.current&&u.animationState&&u.animationState.animateChanges())}),D.useEffect(()=>{u&&(!y.current&&u.animationState&&u.animationState.animateChanges(),y.current=!1,KD||(KD=!0,queueMicrotask(Nfe)))}),u}function Nfe(){window.MotionHandoffIsComplete=!0}function Bfe(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:c,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:cz(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&av(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:c,layoutRoot:l})}function cz(t){if(t)return t.options.allowProjection!==!1?t.projection:cz(t.parent)}function Lfe(t,e,r){return D.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):av(r)&&(r.current=n))},[e])}function nw(t){return typeof t=="string"||Array.isArray(t)}function iw(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const _T=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],IT=["initial",..._T];function q4(t){return iw(t.animate)||IT.some(e=>nw(t[e]))}function lz(t){return!!(q4(t)||t.variants)}function Ffe(t,e){if(q4(t)){const{initial:r,animate:n}=t;return{initial:r===!1||nw(r)?r:void 0,animate:nw(n)?n:void 0}}return t.inherit!==!1?e:{}}function jfe(t){const{initial:e,animate:r}=Ffe(t,D.useContext(j4));return D.useMemo(()=>({initial:e,animate:r}),[YD(e),YD(r)])}function YD(t){return Array.isArray(t)?t.join(" "):t}const QD={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},$g={};for(const t in QD)$g[t]={isEnabled:e=>QD[t].some(r=>!!e[r])};function Ufe(t){for(const e in t)$g[e]={...$g[e],...t[e]}}const TT=D.createContext({}),$fe=Symbol.for("motionComponentSymbol"),Ts=t=>t;let r7=Ts;function qfe({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&Ufe(t);function s(a,c){let l;const f={...D.useContext(CT),...a,layoutId:Vfe(a)},{isStatic:u}=f,p=jfe(a),g=n(a,u);if(!u&&AT){zfe();const y=Hfe(f);l=y.MeasureLayout,p.visualElement=Dfe(i,g,f,e,y.ProjectionNode)}return W.jsxs(j4.Provider,{value:p,children:[l&&p.visualElement?W.jsx(l,{visualElement:p.visualElement,...f}):null,r(i,a,Lfe(g,p.visualElement,c),g,u,p.visualElement)]})}const o=D.forwardRef(s);return o[$fe]=i,o}function Vfe({layoutId:t}){const e=D.useContext(TT).id;return e&&t!==void 0?e+"-"+t:t}function zfe(t,e){D.useContext(iz).strict}function Hfe(t){const{drag:e,layout:r}=$g;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function Gfe(t){function e(n,i={}){return qfe(t(n,i))}if(typeof Proxy>"u")return e;const r=new Map;return new Proxy(e,{get:(n,i)=>(r.has(i)||r.set(i,e(i)),r.get(i))})}const Wfe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function PT(t){return typeof t!="string"||t.includes("-")?!1:!!(Wfe.indexOf(t)>-1||/[A-Z]/u.test(t))}const u5={};function Kfe(t){Object.assign(u5,t)}const rx=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ch=new Set(rx);function fz(t,{layout:e,layoutId:r}){return Ch.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!u5[t]||t==="opacity")}const _s=t=>!!(t&&t.getVelocity),uz=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ih=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},wb={...hy,transform:t=>ih(0,1,t)},X2={...hy,default:1},xb=t=>Math.round(t*1e5)/1e5,kT=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Yfe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Qfe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function nx(t){return typeof t=="string"}function Jfe(t){return t==null}const ix=t=>({test:e=>nx(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),id=ix("deg"),ql=ix("%"),Yt=ix("px"),Zfe=ix("vh"),Xfe=ix("vw"),JD={...ql,parse:t=>ql.parse(t)/100,transform:t=>ql.transform(t*100)},ZD={...hy,transform:Math.round},MT={borderWidth:Yt,borderTopWidth:Yt,borderRightWidth:Yt,borderBottomWidth:Yt,borderLeftWidth:Yt,borderRadius:Yt,radius:Yt,borderTopLeftRadius:Yt,borderTopRightRadius:Yt,borderBottomRightRadius:Yt,borderBottomLeftRadius:Yt,width:Yt,maxWidth:Yt,height:Yt,maxHeight:Yt,size:Yt,top:Yt,right:Yt,bottom:Yt,left:Yt,padding:Yt,paddingTop:Yt,paddingRight:Yt,paddingBottom:Yt,paddingLeft:Yt,margin:Yt,marginTop:Yt,marginRight:Yt,marginBottom:Yt,marginLeft:Yt,rotate:id,rotateX:id,rotateY:id,rotateZ:id,scale:X2,scaleX:X2,scaleY:X2,scaleZ:X2,skew:id,skewX:id,skewY:id,distance:Yt,translateX:Yt,translateY:Yt,translateZ:Yt,x:Yt,y:Yt,z:Yt,perspective:Yt,transformPerspective:Yt,opacity:wb,originX:JD,originY:JD,originZ:Yt,zIndex:ZD,backgroundPositionX:Yt,backgroundPositionY:Yt,fillOpacity:wb,strokeOpacity:wb,numOctaves:ZD},eue={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tue=rx.length;function rue(t,e,r){let n="",i=!0;for(let s=0;se=>typeof e=="string"&&e.startsWith(t),hz=dz("--"),nue=dz("var(--"),RT=t=>nue(t)?iue.test(t.split("/*")[0].trim()):!1,iue=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function OT(t,e,r){const{style:n,vars:i,transformOrigin:s}=t;let o=!1,a=!1;for(const c in e){const l=e[c];if(Ch.has(c)){o=!0;continue}else if(hz(c)){i[c]=l;continue}else{const f=uz(l,MT[c]);c.startsWith("origin")?(a=!0,s[c]=f):n[c]=f}}if(e.transform||(o||r?n.transform=rue(e,t.transform,r):n.transform&&(n.transform="none")),a){const{originX:c="50%",originY:l="50%",originZ:f=0}=s;n.transformOrigin=`${c} ${l} ${f}`}}const DT=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function pz(t,e,r){for(const n in e)!_s(e[n])&&!fz(n,r)&&(t[n]=e[n])}function sue({transformTemplate:t},e){return D.useMemo(()=>{const r=DT();return OT(r,e,t),Object.assign({},r.vars,r.style)},[e])}function oue(t,e){const r=t.style||{},n={};return pz(n,r,t),Object.assign(n,sue(t,e)),n}function aue(t,e){const r={},n=oue(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const cue=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function d5(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||cue.has(t)}let vz=t=>!d5(t);function lue(t){t&&(vz=e=>e.startsWith("on")?!d5(e):t(e))}try{lue(require("@emotion/is-prop-valid").default)}catch{}function fue(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(vz(i)||r===!0&&d5(i)||!e&&!d5(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function XD(t,e,r){return typeof t=="string"?t:Yt.transform(e+r*t)}function uue(t,e,r){const n=XD(e,t.x,t.width),i=XD(r,t.y,t.height);return`${n} ${i}`}const due={offset:"stroke-dashoffset",array:"stroke-dasharray"},hue={offset:"strokeDashoffset",array:"strokeDasharray"};function pue(t,e,r=1,n=0,i=!0){t.pathLength=1;const s=i?due:hue;t[s.offset]=Yt.transform(-n);const o=Yt.transform(e),a=Yt.transform(r);t[s.array]=`${o} ${a}`}function NT(t,{attrX:e,attrY:r,attrScale:n,originX:i,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:c=0,...l},f,u){if(OT(t,l,u),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:p,style:g,dimensions:y}=t;p.transform&&(y&&(g.transform=p.transform),delete p.transform),y&&(i!==void 0||s!==void 0||g.transform)&&(g.transformOrigin=uue(y,i!==void 0?i:.5,s!==void 0?s:.5)),e!==void 0&&(p.x=e),r!==void 0&&(p.y=r),n!==void 0&&(p.scale=n),o!==void 0&&pue(p,o,a,c,!1)}const gz=()=>({...DT(),attrs:{}}),BT=t=>typeof t=="string"&&t.toLowerCase()==="svg";function vue(t,e,r,n){const i=D.useMemo(()=>{const s=gz();return NT(s,e,BT(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};pz(s,t.style,t),i.style={...s,...i.style}}return i}function gue(t=!1){return(r,n,i,{latestValues:s},o)=>{const c=(PT(r)?vue:aue)(n,s,o,r),l=fue(n,typeof r=="string",t),f=r!==D.Fragment?{...l,...c,ref:i}:{},{children:u}=n,p=D.useMemo(()=>_s(u)?u.get():u,[u]);return D.createElement(r,{...f,children:p})}}function yz(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const mz=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function bz(t,e,r,n){yz(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(mz.has(i)?i:$4(i),e.attrs[i])}function LT(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(_s(i[o])||e.style&&_s(e.style[o])||fz(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return r&&i&&typeof i.willChange=="string"&&(r.applyWillChange=!1),s}function wz(t,e,r){const n=LT(t,e,r);for(const i in t)if(_s(t[i])||_s(e[i])){const s=rx.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function eN(t){const e=[{},{}];return t==null||t.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function FT(t,e,r,n){if(typeof e=="function"){const[i,s]=eN(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=eN(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function jT(t){const e=D.useRef(null);return e.current===null&&(e.current=t()),e.current}const n7=t=>Array.isArray(t),yue=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),mue=t=>n7(t)?t[t.length-1]||0:t;function J6(t){const e=_s(t)?t.get():t;return yue(e)?e.toValue():e}const xz=new Set(["opacity","clipPath","filter","transform"]);function Ez(t){if(Ch.has(t))return"transform";if(xz.has(t))return $4(t)}function V4(t,e){t.indexOf(e)===-1&&t.push(e)}function z4(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}function bue({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:r,onMount:n},i,s,o,a){const c={latestValues:xue(i,s,o,a?!1:t,e),renderState:r()};return n&&(c.mount=l=>n(i,l,c)),c}const Cz=t=>(e,r)=>{const n=D.useContext(j4),i=D.useContext(U4),s=()=>bue(t,e,n,i,r);return r?s():jT(s)};function wue(t,e){const r=Ez(e);r&&V4(t,r)}function tN(t,e,r){const n=Array.isArray(e)?e:[e];for(let i=0;i{for(const S in I){let O=I[S];if(Array.isArray(O)){const L=y?O.length-1:0;O=O[L]}O!==null&&(o[S]=O)}for(const S in C)o[S]=C[S]}),c&&(u&&f!==!1&&!iw(u)&&tN(t,u,I=>{for(const C in I)wue(a,C)}),a.length&&(o.willChange=a.join(","))),o}const{schedule:nn,cancel:pu,state:Ji,steps:EA}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ts,!0),Eue={useVisualState:Cz({scrapeMotionValuesFromProps:wz,createRenderState:gz,onMount:(t,e,{renderState:r,latestValues:n})=>{nn.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),nn.render(()=>{NT(r,n,BT(e.tagName),t.transformTemplate),bz(e,r)})}})},Cue={useVisualState:Cz({applyWillChange:!0,scrapeMotionValuesFromProps:LT,createRenderState:DT})};function Aue(t,{forwardMotionProps:e=!1},r,n){return{...PT(t)?Eue:Cue,preloadedFeatures:r,useRender:gue(e),createVisualElement:n,Component:t}}function Zf(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}const Az=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function H4(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Sue=t=>e=>Az(e)&&t(e,H4(e));function nu(t,e,r,n){return Zf(t,e,Sue(r),n)}const _ue=(t,e)=>r=>e(t(r)),iu=(...t)=>t.reduce(_ue);function Sz(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const rN=Sz("dragHorizontal"),nN=Sz("dragVertical");function _z(t){let e=!1;if(t==="y")e=nN();else if(t==="x")e=rN();else{const r=rN(),n=nN();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function Iz(){const t=_z(!0);return t?(t(),!1):!0}class Ah{constructor(e){this.isMounted=!1,this.node=e}update(){}}function iN(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||Iz())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const c=a[n];c&&nn.postRender(()=>c(s,o))};return nu(t.current,r,i,{passive:!t.getProps()[n]})}class Iue extends Ah{mount(){this.unmount=iu(iN(this.node,!0),iN(this.node,!1))}unmount(){}}class Tue extends Ah{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=iu(Zf(this.node.current,"focus",()=>this.onFocus()),Zf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Tz=(t,e)=>e?t===e?!0:Tz(t,e.parentElement):!1;function CA(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,H4(r))}class Pue extends Ah{constructor(){super(...arguments),this.removeStartListeners=Ts,this.removeEndListeners=Ts,this.removeAccessibleListeners=Ts,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=nu(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:f,globalTapTarget:u}=this.node.getProps(),p=!u&&!Tz(this.node.current,a.target)?f:l;p&&nn.update(()=>p(a,c))},{passive:!(n.onTap||n.onPointerUp)}),o=nu(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=iu(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||CA("up",(c,l)=>{const{onTap:f}=this.node.getProps();f&&nn.postRender(()=>f(c,l))})};this.removeEndListeners(),this.removeEndListeners=Zf(this.node.current,"keyup",o),CA("down",(a,c)=>{this.startPress(a,c)})},r=Zf(this.node.current,"keydown",e),n=()=>{this.isPressing&&CA("cancel",(s,o)=>this.cancelPress(s,o))},i=Zf(this.node.current,"blur",n);this.removeAccessibleListeners=iu(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&nn.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Iz()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&nn.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=nu(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Zf(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=iu(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const i7=new WeakMap,AA=new WeakMap,kue=t=>{const e=i7.get(t.target);e&&e(t)},Mue=t=>{t.forEach(kue)};function Rue({root:t,...e}){const r=t||document;AA.has(r)||AA.set(r,{});const n=AA.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(Mue,{root:t,...e})),n[i]}function Oue(t,e,r){const n=Rue(e);return i7.set(t,r),n.observe(t),()=>{i7.delete(t),n.unobserve(t)}}const Due={some:0,all:1};class Nue extends Ah{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:Due[i]},a=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:f,onViewportLeave:u}=this.node.getProps(),p=l?f:u;p&&p(c)};return Oue(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(Bue(e,r))&&this.startObserver()}unmount(){}}function Bue({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const Lue={inView:{Feature:Nue},tap:{Feature:Pue},focus:{Feature:Tue},hover:{Feature:Iue}};function Pz(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;nt*1e3,ou=t=>t/1e3,Fue={type:"spring",stiffness:500,damping:25,restSpeed:10},jue=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Uue={type:"keyframes",duration:.8},$ue={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},que=(t,{keyframes:e})=>e.length>2?Uue:Ch.has(t)?t.startsWith("scale")?jue(e[1]):Fue:$ue;function Vue({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:c,elapsed:l,...f}){return!!Object.keys(f).length}function UT(t,e){return t[e]||t.default||t}const zue=t=>t!==null;function W4(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(zue),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const kz=t=>/^0[^.\s]+$/u.test(t);function Hue(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||kz(t):!0}const Mz=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Gue=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Wue(t){const e=Gue.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}function Rz(t,e,r=1){const[n,i]=Wue(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return Mz(o)?parseFloat(o):o}return RT(i)?Rz(i,e,r+1):i}const Kue=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),sN=t=>t===hy||t===Yt,oN=(t,e)=>parseFloat(t.split(", ")[e]),aN=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return oN(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?oN(s[1],t):0}},Yue=new Set(["x","y","z"]),Que=rx.filter(t=>!Yue.has(t));function Jue(t){const e=[];return Que.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const qg={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:aN(4,13),y:aN(5,14)};qg.translateX=qg.x;qg.translateY=qg.y;const Oz=t=>e=>e.test(t),Zue={test:t=>t==="auto",parse:t=>t},Dz=[hy,Yt,ql,id,Xfe,Zfe,Zue],cN=t=>Dz.find(Oz(t)),ap=new Set;let s7=!1,o7=!1;function Nz(){if(o7){const t=Array.from(ap).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=Jue(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}o7=!1,s7=!1,ap.forEach(t=>t.complete()),ap.clear()}function Bz(){ap.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(o7=!0)})}function Xue(){Bz(),Nz()}class $T{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ap.add(this),s7||(s7=!0,nn.read(Bz),nn.resolveKeyframes(Nz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sr=>!!(nx(r)&&Qfe.test(r)&&r.startsWith(t)||e&&!Jfe(r)&&Object.prototype.hasOwnProperty.call(r,e)),Lz=(t,e,r)=>n=>{if(!nx(n))return n;const[i,s,o,a]=n.match(kT);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},ede=t=>ih(0,255,t),SA={...hy,transform:t=>Math.round(ede(t))},T0={test:qT("rgb","red"),parse:Lz("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+SA.transform(t)+", "+SA.transform(e)+", "+SA.transform(r)+", "+xb(wb.transform(n))+")"};function tde(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const a7={test:qT("#"),parse:tde,transform:T0.transform},cv={test:qT("hsl","hue"),parse:Lz("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+ql.transform(xb(e))+", "+ql.transform(xb(r))+", "+xb(wb.transform(n))+")"},Cs={test:t=>T0.test(t)||a7.test(t)||cv.test(t),parse:t=>T0.test(t)?T0.parse(t):cv.test(t)?cv.parse(t):a7.parse(t),transform:t=>nx(t)?t:t.hasOwnProperty("red")?T0.transform(t):cv.transform(t)};function rde(t){var e,r;return isNaN(t)&&nx(t)&&(((e=t.match(kT))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(Yfe))===null||r===void 0?void 0:r.length)||0)>0}const Fz="number",jz="color",nde="var",ide="var(",lN="${}",sde=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sw(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(sde,c=>(Cs.test(c)?(n.color.push(s),i.push(jz),r.push(Cs.parse(c))):c.startsWith(ide)?(n.var.push(s),i.push(nde),r.push(c)):(n.number.push(s),i.push(Fz),r.push(parseFloat(c))),++s,lN)).split(lN);return{values:r,split:a,indexes:n,types:i}}function Uz(t){return sw(t).values}function $z(t){const{split:e,types:r}=sw(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function ade(t){const e=Uz(t);return $z(t)(e.map(ode))}const sh={test:rde,parse:Uz,createTransformer:$z,getAnimatableNone:ade},cde=new Set(["brightness","contrast","saturate","opacity"]);function lde(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(kT)||[];if(!n)return t;const i=r.replace(n,"");let s=cde.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const fde=/\b([a-z-]*)\(.*?\)/gu,c7={...sh,getAnimatableNone:t=>{const e=t.match(fde);return e?e.map(lde).join(" "):t}},ude={...MT,color:Cs,backgroundColor:Cs,outlineColor:Cs,fill:Cs,stroke:Cs,borderColor:Cs,borderTopColor:Cs,borderRightColor:Cs,borderBottomColor:Cs,borderLeftColor:Cs,filter:c7,WebkitFilter:c7},VT=t=>ude[t];function qz(t,e){let r=VT(t);return r!==c7&&(r=sh),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const dde=new Set(["auto","none","0"]);function hde(t,e,r){let n=0,i;for(;n{r.getValue(c).set(l)}),this.resolveNoneKeyframes()}}function zz(t){let e;return()=>(e===void 0&&(e=t()),e)}let Z6;function pde(){Z6=void 0}const au={now:()=>(Z6===void 0&&au.set(Ji.isProcessing||Mfe.useManualTiming?Ji.timestamp:performance.now()),Z6),set:t=>{Z6=t,queueMicrotask(pde)}},fN=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(sh.test(t)||t==="0")&&!t.startsWith("url("));function vde(t){const e=t[0];if(t.length===1)return!0;for(let r=0;ryde?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Xue(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=au.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:c,isGenerator:l}=this.options;if(!l&&!gde(e,n,i,s))if(o)this.options.duration=0;else{c==null||c(W4(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const f=this.initPlayback(e,r);f!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...f},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Gz(t,e){return e?t*(1e3/e):0}const mde=5;function Wz(t,e,r){const n=Math.max(e-mde,0);return Gz(r-t(n),e-n)}const _A=.001,bde=.01,wde=10,xde=.05,Ede=1;function Cde({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s,o=1-e;o=ih(xde,Ede,o),t=ih(bde,wde,ou(t)),o<1?(i=l=>{const f=l*o,u=f*t,p=f-r,g=l7(l,o),y=Math.exp(-u);return _A-p/g*y},s=l=>{const u=l*o*t,p=u*r+r,g=Math.pow(o,2)*Math.pow(l,2)*t,y=Math.exp(-u),b=l7(Math.pow(l,2),o);return(-i(l)+_A>0?-1:1)*((p-g)*y)/b}):(i=l=>{const f=Math.exp(-l*t),u=(l-r)*t+1;return-_A+f*u},s=l=>{const f=Math.exp(-l*t),u=(r-l)*(t*t);return f*u});const a=5/t,c=Sde(i,s,a);if(t=su(t),isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const Ade=12;function Sde(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function Tde(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!uN(t,Ide)&&uN(t,_de)){const r=Cde(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Kz({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:c,mass:l,duration:f,velocity:u,isResolvedFromDuration:p}=Tde({...n,velocity:-ou(n.velocity||0)}),g=u||0,y=c/(2*Math.sqrt(a*l)),b=s-i,I=ou(Math.sqrt(a/l)),C=Math.abs(b)<5;r||(r=C?.01:2),e||(e=C?.005:.5);let S;if(y<1){const O=l7(I,y);S=L=>{const F=Math.exp(-y*I*L);return s-F*((g+y*I*b)/O*Math.sin(O*L)+b*Math.cos(O*L))}}else if(y===1)S=O=>s-Math.exp(-I*O)*(b+(g+I*b)*O);else{const O=I*Math.sqrt(y*y-1);S=L=>{const F=Math.exp(-y*I*L),z=Math.min(O*L,300);return s-F*((g+y*I*b)*Math.sinh(z)+O*b*Math.cosh(z))/O}}return{calculatedDuration:p&&f||null,next:O=>{const L=S(O);if(p)o.done=O>=f;else{let F=0;y<1&&(F=O===0?su(g):Wz(S,O,L));const z=Math.abs(F)<=r,_=Math.abs(s-L)<=e;o.done=z&&_}return o.value=o.done?s:L,o}}}function dN({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:c,restDelta:l=.5,restSpeed:f}){const u=t[0],p={done:!1,value:u},g=$=>a!==void 0&&$c,y=$=>a===void 0?c:c===void 0||Math.abs(a-$)-b*Math.exp(-$/n),O=$=>C+S($),L=$=>{const ie=S($),ce=O($);p.done=Math.abs(ie)<=l,p.value=p.done?C:ce};let F,z;const _=$=>{g(p.value)&&(F=$,z=Kz({keyframes:[p.value,y(p.value)],velocity:Wz(O,$,p.value),damping:i,stiffness:s,restDelta:l,restSpeed:f}))};return _(0),{calculatedDuration:null,next:$=>{let ie=!1;return!z&&F===void 0&&(ie=!0,L($),_($)),F!==void 0&&$>=F?z.next($-F):(!ie&&L($),p)}}}const Yz=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,Pde=1e-7,kde=12;function Mde(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=Yz(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>Pde&&++aMde(s,0,1,t,r);return s=>s===0||s===1?s:Yz(i(s),e,n)}const Rde=sx(.42,0,1,1),Ode=sx(0,0,.58,1),Qz=sx(.42,0,.58,1),Dde=t=>Array.isArray(t)&&typeof t[0]!="number",Jz=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Zz=t=>e=>1-t(1-e),zT=t=>1-Math.sin(Math.acos(t)),Xz=Zz(zT),Nde=Jz(zT),eH=sx(.33,1.53,.69,.99),HT=Zz(eH),Bde=Jz(HT),Lde=t=>(t*=2)<1?.5*HT(t):.5*(2-Math.pow(2,-10*(t-1))),hN={linear:Ts,easeIn:Rde,easeInOut:Qz,easeOut:Ode,circIn:zT,circInOut:Nde,circOut:Xz,backIn:HT,backInOut:Bde,backOut:eH,anticipate:Lde},pN=t=>{if(Array.isArray(t)){r7(t.length===4);const[e,r,n,i]=t;return sx(e,r,n,i)}else if(typeof t=="string")return r7(hN[t]!==void 0),hN[t];return t},ow=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},On=(t,e,r)=>t+(e-t)*r;function IA(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function Fde({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,c=2*r-a;i=IA(c,a,t+1/3),s=IA(c,a,t),o=IA(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function h5(t,e){return r=>r>0?e:t}const TA=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},jde=[a7,T0,cv],Ude=t=>jde.find(e=>e.test(t));function vN(t){const e=Ude(t);if(!e)return!1;let r=e.parse(t);return e===cv&&(r=Fde(r)),r}const gN=(t,e)=>{const r=vN(t),n=vN(e);if(!r||!n)return h5(t,e);const i={...r};return s=>(i.red=TA(r.red,n.red,s),i.green=TA(r.green,n.green,s),i.blue=TA(r.blue,n.blue,s),i.alpha=On(r.alpha,n.alpha,s),T0.transform(i))},f7=new Set(["none","hidden"]);function $de(t,e){return f7.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function qde(t,e){return r=>On(t,e,r)}function GT(t){return typeof t=="number"?qde:typeof t=="string"?RT(t)?h5:Cs.test(t)?gN:Hde:Array.isArray(t)?tH:typeof t=="object"?Cs.test(t)?gN:Vde:h5}function tH(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>GT(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function zde(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=sh.createTransformer(e),n=sw(t),i=sw(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?f7.has(t)&&!i.values.length||f7.has(e)&&!n.values.length?$de(t,e):iu(tH(zde(n,i),i.values),r):h5(t,e)};function rH(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?On(t,e,r):GT(t)(t,e)}function Gde(t,e,r){const n=[],i=r||rH,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=Gde(e,n,i),a=o.length,c=l=>{let f=0;if(a>1)for(;fc(ih(t[0],t[s-1],l)):c}function Kde(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ow(0,e,n);t.push(On(r,1,i))}}function Yde(t){const e=[0];return Kde(e,t.length-1),e}function Qde(t,e){return t.map(r=>r*e)}function Jde(t,e){return t.map(()=>e||Qz).splice(0,t.length-1)}function p5({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=Dde(n)?n.map(pN):pN(n),s={done:!1,value:e[0]},o=Qde(r&&r.length===e.length?r:Yde(e),t),a=Wde(o,e,{ease:Array.isArray(i)?i:Jde(e,i)});return{calculatedDuration:t,next:c=>(s.value=a(c),s.done=c>=t,s)}}const yN=2e4;function Zde(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=yN?1/0:e}const Xde=t=>{const e=({timestamp:r})=>t(r);return{start:()=>nn.update(e,!0),stop:()=>pu(e),now:()=>Ji.isProcessing?Ji.timestamp:au.now()}},ehe={decay:dN,inertia:dN,tween:p5,keyframes:p5,spring:Kz},the=t=>t/100;class WT extends Hz{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||$T,a=(c,l)=>this.onKeyframesResolved(c,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=ehe[r]||p5;let c,l;a!==p5&&typeof e[0]!="number"&&(c=iu(the,rH(e[0],e[1])),e=[0,100]);const f=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=Zde(f));const{calculatedDuration:u}=f,p=u+i,g=p*(n+1)-i;return{generator:f,mirroredGenerator:l,mapPercentToKeyframes:c,calculatedDuration:u,resolvedDuration:p,totalDuration:g}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:$}=this.options;return{done:!0,value:$[$.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:c,calculatedDuration:l,totalDuration:f,resolvedDuration:u}=n;if(this.startTime===null)return s.next(0);const{delay:p,repeat:g,repeatType:y,repeatDelay:b,onUpdate:I}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-f/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const C=this.currentTime-p*(this.speed>=0?1:-1),S=this.speed>=0?C<0:C>f;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let O=this.currentTime,L=s;if(g){const $=Math.min(this.currentTime,f)/u;let ie=Math.floor($),ce=$%1;!ce&&$>=1&&(ce=1),ce===1&&ie--,ie=Math.min(ie,g+1),!!(ie%2)&&(y==="reverse"?(ce=1-ce,b&&(ce-=b/u)):y==="mirror"&&(L=o)),O=ih(0,1,ce)*u}const F=S?{done:!1,value:c[0]}:L.next(O);a&&(F.value=a(F.value));let{done:z}=F;!S&&l!==null&&(z=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return _&&i!==void 0&&(F.value=W4(c,this.options,i)),I&&I(F.value),_&&this.finish(),F}get duration(){const{resolved:e}=this;return e?ou(e.calculatedDuration):0}get time(){return ou(this.currentTime)}set time(e){e=su(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=ou(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Xde,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const nH=t=>Array.isArray(t)&&typeof t[0]=="number";function iH(t){return!!(!t||typeof t=="string"&&t in KT||nH(t)||Array.isArray(t)&&t.every(iH))}const Hm=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,KT={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Hm([0,.65,.55,1]),circOut:Hm([.55,0,1,.45]),backIn:Hm([.31,.01,.66,-.59]),backOut:Hm([.33,1.53,.69,.99])};function rhe(t){return sH(t)||KT.easeOut}function sH(t){if(t)return nH(t)?Hm(t):Array.isArray(t)?t.map(rhe):KT[t]}function nhe(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a,times:c}={}){const l={[e]:r};c&&(l.offset=c);const f=sH(a);return Array.isArray(f)&&(l.easing=f),t.animate(l,{delay:n,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}const ihe=zz(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),v5=10,she=2e4;function ohe(t){return t.type==="spring"||!iH(t.ease)}function ahe(t,e){const r=new WT({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:c,name:l,startTime:f}=this.options;if(!(!((n=c.owner)===null||n===void 0)&&n.current))return!1;if(ohe(this.options)){const{onComplete:p,onUpdate:g,motionValue:y,element:b,...I}=this.options,C=ahe(e,I);e=C.keyframes,e.length===1&&(e[1]=e[0]),i=C.duration,s=C.times,o=C.ease,a="keyframes"}const u=nhe(c.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return u.startTime=f??this.calcStartTime(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:p}=this.options;c.set(W4(e,this.options,r)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return ou(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return ou(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=su(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Ts;const{animation:n}=r;n.timeline=e,n.onfinish=null}return Ts}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:f,onComplete:u,element:p,...g}=this.options,y=new WT({...g,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),b=su(this.time);l.setWithVelocity(y.sample(b-v5).value,y.sample(b).value,v5)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return ihe()&&n&&xz.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}function che(t,e){let r;const n=()=>{const{currentTime:i}=e,o=(i===null?0:i.value)/100;r!==o&&t(o),r=o};return nn.update(n,!0),()=>pu(n)}const lhe=zz(()=>window.ScrollTimeline!==void 0);class fhe{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;n{if(lhe()&&n.attachTimeline)n.attachTimeline(e);else return n.pause(),che(i=>{n.time=n.duration*i},e)});return()=>{r.forEach((n,i)=>{n&&n(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const YT=(t,e,r,n={},i,s,o)=>a=>{const c=UT(n,t)||{},l=c.delay||n.delay||0;let{elapsed:f=0}=n;f=f-su(l);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...c,delay:-f,onUpdate:g=>{e.set(g),c.onUpdate&&c.onUpdate(g)},onComplete:()=>{a(),c.onComplete&&c.onComplete(),o&&o()},onStop:o,name:t,motionValue:e,element:s?void 0:i};Vue(c)||(u={...u,...que(t,u)}),u.duration&&(u.duration=su(u.duration)),u.repeatDelay&&(u.repeatDelay=su(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let p=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const g=W4(u.keyframes,c);if(g!==void 0)return nn.update(()=>{u.onUpdate(g),u.onComplete()}),new fhe([])}return!s&&mN.supports(u)?new mN(u):new WT(u)};class QT{constructor(){this.subscriptions=[]}add(e){return V4(this.subscriptions,e),()=>z4(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class oH{constructor(e,r={}){this.version="11.3.31",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=au.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=au.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=uhe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new QT);const n=this.events[e].add(r);return e==="change"?()=>{n(),nn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=au.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>bN)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,bN);return Gz(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function aw(t,e){return new oH(t,e)}function dhe(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,aw(r))}function hhe(t,e){const r=G4(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=mue(s[o]);dhe(t,o,a)}}function aH(t){return t.props[sz]}class phe extends oH{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(e){const r=Ez(e);if(!r)return;const n=this.counts.get(r)||0;this.counts.set(r,n+1),n===0&&(this.output.push(r),this.update());let i=!1;return()=>{if(i)return;i=!0;const s=this.counts.get(r)-1;this.counts.set(r,s),s===0&&(z4(this.output,r),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}function vhe(t){return!!(_s(t)&&t.add)}function u7(t,e){var r;if(!t.applyWillChange)return;let n=t.getValue("willChange");if(!n&&!(!((r=t.props.style)===null||r===void 0)&&r.willChange)&&(n=new phe("auto"),t.addValue("willChange",n)),vhe(n))return n.add(e)}function ghe({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function cH(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...c}=e;n&&(o=n);const l=[],f=i&&t.animationState&&t.animationState.getState()[i];for(const u in c){const p=t.getValue(u,(s=t.latestValues[u])!==null&&s!==void 0?s:null),g=c[u];if(g===void 0||f&&ghe(f,u))continue;const y={delay:r,...UT(o||{},u)};let b=!1;if(window.MotionHandoffAnimation){const C=aH(t);if(C){const S=window.MotionHandoffAnimation(C,u,nn);S!==null&&(y.startTime=S,b=!0)}}p.start(YT(u,p,g,t.shouldReduceMotion&&Ch.has(u)?{type:!1}:y,t,b,u7(t,u)));const I=p.animation;I&&l.push(I)}return a&&Promise.all(l).then(()=>{nn.update(()=>{a&&hhe(t,a)})}),l}function d7(t,e,r={}){var n;const i=G4(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(cH(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:f=0,staggerChildren:u,staggerDirection:p}=s;return yhe(t,e,f+l,u,p,r)}:()=>Promise.resolve(),{when:c}=s;if(c){const[l,f]=c==="beforeChildren"?[o,a]:[a,o];return l().then(()=>f())}else return Promise.all([o(),a(r.delay)])}function yhe(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,c=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(mhe).forEach((l,f)=>{l.notify("AnimationStart",e),o.push(d7(l,e,{...s,delay:r+c(f)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function mhe(t,e){return t.sortNodePosition(e)}function bhe(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>d7(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=d7(t,e,r);else{const i=typeof e=="function"?G4(t,e,r.custom):e;n=Promise.all(cH(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const whe=[..._T].reverse(),xhe=_T.length;function Ehe(t){return e=>Promise.all(e.map(({animation:r,options:n})=>bhe(t,r,n)))}function Che(t){let e=Ehe(t),r=wN(),n=!0;const i=c=>(l,f)=>{var u;const p=G4(t,f,c==="exit"?(u=t.presenceContext)===null||u===void 0?void 0:u.custom:void 0);if(p){const{transition:g,transitionEnd:y,...b}=p;l={...l,...b,...y}}return l};function s(c){e=c(t)}function o(c){const l=t.getProps(),f=t.getVariantContext(!0)||{},u=[],p=new Set;let g={},y=1/0;for(let I=0;Iy&&L,ie=!1;const ce=Array.isArray(O)?O:[O];let K=ce.reduce(i(C),{});F===!1&&(K={});const{prevResolvedValues:P={}}=S,M={...P,...K},v=m=>{$=!0,p.has(m)&&(ie=!0,p.delete(m)),S.needsAnimating[m]=!0;const R=t.getValue(m);R&&(R.liveStyle=!1)};for(const m in M){const R=K[m],B=P[m];if(g.hasOwnProperty(m))continue;let E=!1;n7(R)&&n7(B)?E=!Pz(R,B):E=R!==B,E?R!=null?v(m):p.add(m):R!==void 0&&p.has(m)?v(m):S.protectedKeys[m]=!0}S.prevProp=O,S.prevResolvedValues=K,S.isActive&&(g={...g,...K}),n&&t.blockInitialAnimation&&($=!1),$&&(!z||ie)&&u.push(...ce.map(m=>({animation:m,options:{type:C}})))}if(p.size){const I={};p.forEach(C=>{const S=t.getBaseTarget(C),O=t.getValue(C);O&&(O.liveStyle=!0),I[C]=S??null}),u.push({animation:I})}let b=!!u.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(b=!1),n=!1,b?e(u):Promise.resolve()}function a(c,l){var f;if(r[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(p=>{var g;return(g=p.animationState)===null||g===void 0?void 0:g.setActive(c,l)}),r[c].isActive=l;const u=o(c);for(const p in r)r[p].protectedKeys={};return u}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=wN(),n=!0}}}function Ahe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Pz(e,t):!1}function r0(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wN(){return{animate:r0(!0),whileInView:r0(),whileHover:r0(),whileTap:r0(),whileDrag:r0(),whileFocus:r0(),exit:r0()}}class She extends Ah{constructor(e){super(e),e.animationState||(e.animationState=Che(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();iw(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let _he=0;class Ihe extends Ah{constructor(){super(...arguments),this.id=_he++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const The={animation:{Feature:She},exit:{Feature:Ihe}},xN=(t,e)=>Math.abs(t-e);function Phe(t,e){const r=xN(t.x,e.x),n=xN(t.y,e.y);return Math.sqrt(r**2+n**2)}class lH{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=kA(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=Phe(u.offset,{x:0,y:0})>=3;if(!p&&!g)return;const{point:y}=u,{timestamp:b}=Ji;this.history.push({...y,timestamp:b});const{onStart:I,onMove:C}=this.handlers;p||(I&&I(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,u)},this.handlePointerMove=(u,p)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=PA(p,this.transformPagePoint),nn.update(this.updatePoint,!0)},this.handlePointerUp=(u,p)=>{this.end();const{onEnd:g,onSessionEnd:y,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const I=kA(u.type==="pointercancel"?this.lastMoveEventInfo:PA(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(u,I),y&&y(u,I)},!Az(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=H4(e),a=PA(o,this.transformPagePoint),{point:c}=a,{timestamp:l}=Ji;this.history=[{...c,timestamp:l}];const{onSessionStart:f}=r;f&&f(e,kA(a,this.history)),this.removeListeners=iu(nu(this.contextWindow,"pointermove",this.handlePointerMove),nu(this.contextWindow,"pointerup",this.handlePointerUp),nu(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),pu(this.updatePoint)}}function PA(t,e){return e?{point:e(t.point)}:t}function EN(t,e){return{x:t.x-e.x,y:t.y-e.y}}function kA({point:t},e){return{point:t,delta:EN(t,fH(e)),offset:EN(t,khe(e)),velocity:Mhe(e,.1)}}function khe(t){return t[0]}function fH(t){return t[t.length-1]}function Mhe(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=fH(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>su(e)));)r--;if(!n)return{x:0,y:0};const s=ou(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const uH=1e-4,Rhe=1-uH,Ohe=1+uH,dH=.01,Dhe=0-dH,Nhe=0+dH;function pa(t){return t.max-t.min}function Bhe(t,e,r){return Math.abs(t-e)<=r}function CN(t,e,r,n=.5){t.origin=n,t.originPoint=On(e.min,e.max,t.origin),t.scale=pa(r)/pa(e),t.translate=On(r.min,r.max,t.origin)-t.originPoint,(t.scale>=Rhe&&t.scale<=Ohe||isNaN(t.scale))&&(t.scale=1),(t.translate>=Dhe&&t.translate<=Nhe||isNaN(t.translate))&&(t.translate=0)}function Eb(t,e,r,n){CN(t.x,e.x,r.x,n?n.originX:void 0),CN(t.y,e.y,r.y,n?n.originY:void 0)}function AN(t,e,r){t.min=r.min+e.min,t.max=t.min+pa(e)}function Lhe(t,e,r){AN(t.x,e.x,r.x),AN(t.y,e.y,r.y)}function SN(t,e,r){t.min=e.min-r.min,t.max=t.min+pa(e)}function Cb(t,e,r){SN(t.x,e.x,r.x),SN(t.y,e.y,r.y)}function Fhe(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?On(r,t,n.max):Math.min(t,r)),t}function _N(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function jhe(t,{top:e,left:r,bottom:n,right:i}){return{x:_N(t.x,r,i),y:_N(t.y,e,n)}}function IN(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ow(e.min,e.max-n,t.min):n>i&&(r=ow(t.min,t.max-i,e.min)),ih(0,1,r)}function qhe(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const h7=.35;function Vhe(t=h7){return t===!1?t=0:t===!0&&(t=h7),{x:TN(t,"left","right"),y:TN(t,"top","bottom")}}function TN(t,e,r){return{min:PN(t,e),max:PN(t,r)}}function PN(t,e){return typeof t=="number"?t:t[e]||0}const kN=()=>({translate:0,scale:1,origin:0,originPoint:0}),lv=()=>({x:kN(),y:kN()}),MN=()=>({min:0,max:0}),ti=()=>({x:MN(),y:MN()});function Fa(t){return[t("x"),t("y")]}function hH({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function zhe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Hhe(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function MA(t){return t===void 0||t===1}function p7({scale:t,scaleX:e,scaleY:r}){return!MA(t)||!MA(e)||!MA(r)}function d0(t){return p7(t)||pH(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function pH(t){return RN(t.x)||RN(t.y)}function RN(t){return t&&t!=="0%"}function g5(t,e,r){const n=t-r,i=e*n;return r+i}function ON(t,e,r,n,i){return i!==void 0&&(t=g5(t,i,n)),g5(t,r,n)+e}function v7(t,e=0,r=1,n,i){t.min=ON(t.min,e,r,n,i),t.max=ON(t.max,e,r,n,i)}function vH(t,{x:e,y:r}){v7(t.x,e.translate,e.scale,e.originPoint),v7(t.y,r.translate,r.scale,r.originPoint)}const DN=.999999999999,NN=1.0000000000001;function Ghe(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aDN&&(e.x=1),e.yDN&&(e.y=1)}function fv(t,e){t.min=t.min+e,t.max=t.max+e}function BN(t,e,r,n,i=.5){const s=On(t.min,t.max,i);v7(t,e,r,s,n)}function uv(t,e){BN(t.x,e.x,e.scaleX,e.scale,e.originX),BN(t.y,e.y,e.scaleY,e.scale,e.originY)}function gH(t,e){return hH(Hhe(t.getBoundingClientRect(),e))}function Whe(t,e,r){const n=gH(t,r),{scroll:i}=e;return i&&(fv(n.x,i.offset.x),fv(n.y,i.offset.y)),n}const yH=({current:t})=>t?t.ownerDocument.defaultView:null,Khe=new WeakMap;class Yhe{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ti(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=f=>{const{dragSnapToOrigin:u}=this.getProps();u?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(H4(f,"page").point)},s=(f,u)=>{var p;const{drag:g,dragPropagation:y,onDragStart:b}=this.getProps();if(g&&!y&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=_z(g),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Fa(C=>{let S=this.getAxisMotionValue(C).get()||0;if(ql.test(S)){const{projection:O}=this.visualElement;if(O&&O.layout){const L=O.layout.layoutBox[C];L&&(S=pa(L)*(parseFloat(S)/100))}}this.originPoint[C]=S}),b&&nn.postRender(()=>b(f,u)),(p=this.removeWillChange)===null||p===void 0||p.call(this),this.removeWillChange=u7(this.visualElement,"transform");const{animationState:I}=this.visualElement;I&&I.setActive("whileDrag",!0)},o=(f,u)=>{const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:y,onDrag:b}=this.getProps();if(!p&&!this.openGlobalLock)return;const{offset:I}=u;if(g&&this.currentDirection===null){this.currentDirection=Qhe(I),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",u.point,I),this.updateAxis("y",u.point,I),this.visualElement.render(),b&&b(f,u)},a=(f,u)=>this.stop(f,u),c=()=>Fa(f=>{var u;return this.getAnimationState(f)==="paused"&&((u=this.getAxisMotionValue(f).animation)===null||u===void 0?void 0:u.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new lH(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:yH(this.visualElement)})}stop(e,r){var n;(n=this.removeWillChange)===null||n===void 0||n.call(this);const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&nn.postRender(()=>o(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!e6(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=Fhe(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&av(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=jhe(i.layoutBox,r):this.constraints=!1,this.elastic=Vhe(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Fa(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=qhe(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!av(e))return!1;const n=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=Whe(n,i.root,this.visualElement.getTransformPagePoint());let o=Uhe(i.layout.layoutBox,s);if(r){const a=r(zhe(o));this.hasMutatedConstraints=!!a,a&&(o=hH(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=Fa(f=>{if(!e6(f,r,this.currentDirection))return;let u=c&&c[f]||{};o&&(u={min:0,max:0});const p=i?200:1e6,g=i?40:1e7,y={type:"inertia",velocity:n?e[f]:0,bounceStiffness:p,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...s,...u};return this.startAxisValueAnimation(f,y)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return n.start(YT(e,n,0,r,this.visualElement,!1,u7(this.visualElement,e)))}stopAnimation(){Fa(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Fa(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Fa(r=>{const{drag:n}=this.getProps();if(!e6(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-On(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!av(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Fa(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const c=a.get();i[o]=$he({min:c,max:c},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Fa(o=>{if(!e6(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(On(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Khe.set(this.visualElement,this);const e=this.visualElement.current,r=nu(e,"pointerdown",c=>{const{drag:l,dragListener:f=!0}=this.getProps();l&&f&&this.start(c)}),n=()=>{const{dragConstraints:c}=this.getProps();av(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),nn.read(n);const o=Zf(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(Fa(f=>{const u=this.getAxisMotionValue(f);u&&(this.originPoint[f]+=c[f].translate,u.set(u.get()+c[f].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=h7,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function e6(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function Qhe(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class Jhe extends Ah{constructor(e){super(e),this.removeGroupControls=Ts,this.removeListeners=Ts,this.controls=new Yhe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ts}unmount(){this.removeGroupControls(),this.removeListeners()}}const LN=t=>(e,r)=>{t&&nn.postRender(()=>t(e,r))};class Zhe extends Ah{constructor(){super(...arguments),this.removePointerDownListener=Ts}onPointerDown(e){this.session=new lH(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:yH(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:LN(e),onStart:LN(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&nn.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=nu(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Xhe(){const t=D.useContext(U4);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=D.useId();D.useEffect(()=>n(i),[]);const s=D.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const X6={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function FN(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const xm={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Yt.test(t))t=parseFloat(t);else return t;const r=FN(t,e.target.x),n=FN(t,e.target.y);return`${r}% ${n}%`}},e0e={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=sh.parse(t);if(i.length>5)return n;const s=sh.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,c=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=c;const l=On(a,c,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}};class t0e extends D.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;Kfe(r0e),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),X6.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||nn.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ST.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function mH(t){const[e,r]=Xhe(),n=D.useContext(TT);return W.jsx(t0e,{...t,layoutGroup:n,switchLayoutGroup:D.useContext(az),isPresent:e,safeToRemove:r})}const r0e={borderRadius:{...xm,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:xm,borderTopRightRadius:xm,borderBottomLeftRadius:xm,borderBottomRightRadius:xm,boxShadow:e0e},bH=["TopLeft","TopRight","BottomLeft","BottomRight"],n0e=bH.length,jN=t=>typeof t=="string"?parseFloat(t):t,UN=t=>typeof t=="number"||Yt.test(t);function i0e(t,e,r,n,i,s){i?(t.opacity=On(0,r.opacity!==void 0?r.opacity:1,s0e(n)),t.opacityExit=On(e.opacity!==void 0?e.opacity:1,0,o0e(n))):s&&(t.opacity=On(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ow(t,e,n))}function qN(t,e){t.min=e.min,t.max=e.max}function Ma(t,e){qN(t.x,e.x),qN(t.y,e.y)}function VN(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function zN(t,e,r,n,i){return t-=e,t=g5(t,1/r,n),i!==void 0&&(t=g5(t,1/i,n)),t}function a0e(t,e=0,r=1,n=.5,i,s=t,o=t){if(ql.test(e)&&(e=parseFloat(e),e=On(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=On(s.min,s.max,n);t===s&&(a-=e),t.min=zN(t.min,e,r,a,i),t.max=zN(t.max,e,r,a,i)}function HN(t,e,[r,n,i],s,o){a0e(t,e[r],e[n],e[i],e.scale,s,o)}const c0e=["x","scaleX","originX"],l0e=["y","scaleY","originY"];function GN(t,e,r,n){HN(t.x,e,c0e,r?r.x:void 0,n?n.x:void 0),HN(t.y,e,l0e,r?r.y:void 0,n?n.y:void 0)}function WN(t){return t.translate===0&&t.scale===1}function xH(t){return WN(t.x)&&WN(t.y)}function KN(t,e){return t.min===e.min&&t.max===e.max}function f0e(t,e){return KN(t.x,e.x)&&KN(t.y,e.y)}function YN(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function EH(t,e){return YN(t.x,e.x)&&YN(t.y,e.y)}function QN(t){return pa(t.x)/pa(t.y)}function JN(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class u0e{constructor(){this.members=[]}add(e){V4(this.members,e),e.scheduleRender()}remove(e){if(z4(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function d0e(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:f,rotateX:u,rotateY:p,skewX:g,skewY:y}=r;l&&(n=`perspective(${l}px) ${n}`),f&&(n+=`rotate(${f}deg) `),u&&(n+=`rotateX(${u}deg) `),p&&(n+=`rotateY(${p}deg) `),g&&(n+=`skewX(${g}deg) `),y&&(n+=`skewY(${y}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return(a!==1||c!==1)&&(n+=`scale(${a}, ${c})`),n||"none"}const h0e=(t,e)=>t.depth-e.depth;class p0e{constructor(){this.children=[],this.isDirty=!1}add(e){V4(this.children,e),this.isDirty=!0}remove(e){z4(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(h0e),this.isDirty=!1,this.children.forEach(e)}}function v0e(t,e){const r=au.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(pu(n),t(s-e))};return nn.read(n,!0),()=>pu(n)}function g0e(t){return t instanceof SVGElement&&t.tagName!=="svg"}function y0e(t,e,r){const n=_s(t)?t:aw(t);return n.start(YT("",n,e,r)),n.animation}const h0={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Gm=typeof window<"u"&&window.MotionDebug!==void 0,RA=["","X","Y","Z"],m0e={visibility:"hidden"},ZN=1e3;let b0e=0;function OA(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function CH(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=aH(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",nn,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&CH(n)}function AH({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=b0e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Gm&&(h0.totalNodes=h0.resolvedTargetDeltas=h0.recalculatedProjection=0),this.nodes.forEach(E0e),this.nodes.forEach(I0e),this.nodes.forEach(T0e),this.nodes.forEach(C0e),Gm&&window.MotionDebug.record(h0)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,u&&u(),u=v0e(p,250),X6.hasAnimatedSinceResize&&(X6.hasAnimatedSinceResize=!1,this.nodes.forEach(eB))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&f&&(c||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:p,hasRelativeTargetChanged:g,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||f.getDefaultTransition()||O0e,{onLayoutAnimationStart:I,onLayoutAnimationComplete:C}=f.getProps(),S=!this.targetLayout||!EH(this.targetLayout,y)||g,O=!p&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||O||p&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(u,O);const L={...UT(b,"layout"),onPlay:I,onComplete:C};(f.shouldReduceMotion||this.options.layoutRoot)&&(L.delay=0,L.type=!1),this.startAnimation(L)}else p||eB(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,pu(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(P0e),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&CH(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const F=L/1e3;tB(u.x,o.x,F),tB(u.y,o.y,F),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cb(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),M0e(this.relativeTarget,this.relativeTargetOrigin,p,F),O&&f0e(this.relativeTarget,O)&&(this.isProjectionDirty=!1),O||(O=ti()),Ma(O,this.relativeTarget)),b&&(this.animationValues=f,i0e(f,l,this.latestValues,F,S,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=F},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(pu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=nn.update(()=>{X6.hasAnimatedSinceResize=!0,this.currentAnimation=y0e(0,ZN,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ZN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:f}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&SH(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||ti();const u=pa(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+u;const p=pa(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+p}Ma(a,c),uv(a,f),Eb(this.projectionDeltaWithTransform,this.layoutCorrected,a,f)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new u0e),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const l={};c.z&&OA("z",o,l,this.animationValues);for(let f=0;f{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(XN),this.root.sharedNodes.clear()}}}function w0e(t){t.updateLayout()}function x0e(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?Fa(u=>{const p=o?r.measuredBox[u]:r.layoutBox[u],g=pa(p);p.min=n[u].min,p.max=p.min+g}):SH(s,r.layoutBox,n)&&Fa(u=>{const p=o?r.measuredBox[u]:r.layoutBox[u],g=pa(n[u]);p.max=p.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+g)});const a=lv();Eb(a,n,r.layoutBox);const c=lv();o?Eb(c,t.applyTransform(i,!0),r.measuredBox):Eb(c,n,r.layoutBox);const l=!xH(a);let f=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:p,layout:g}=u;if(p&&g){const y=ti();Cb(y,r.layoutBox,p.layoutBox);const b=ti();Cb(b,n,g.layoutBox),EH(y,b)||(f=!0),u.options.layoutRoot&&(t.relativeTarget=b,t.relativeTargetOrigin=y,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:f})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function E0e(t){Gm&&h0.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function C0e(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function A0e(t){t.clearSnapshot()}function XN(t){t.clearMeasurements()}function S0e(t){t.isLayoutDirty=!1}function _0e(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function eB(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function I0e(t){t.resolveTargetDelta()}function T0e(t){t.calcProjection()}function P0e(t){t.resetSkewAndRotation()}function k0e(t){t.removeLeadSnapshot()}function tB(t,e,r){t.translate=On(e.translate,0,r),t.scale=On(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function rB(t,e,r,n){t.min=On(e.min,r.min,n),t.max=On(e.max,r.max,n)}function M0e(t,e,r,n){rB(t.x,e.x,r.x,n),rB(t.y,e.y,r.y,n)}function R0e(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const O0e={duration:.45,ease:[.4,0,.1,1]},nB=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),iB=nB("applewebkit/")&&!nB("chrome/")?Math.round:Ts;function sB(t){t.min=iB(t.min),t.max=iB(t.max)}function D0e(t){sB(t.x),sB(t.y)}function SH(t,e,r){return t==="position"||t==="preserve-aspect"&&!Bhe(QN(e),QN(r),.2)}function N0e(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const B0e=AH({attachResizeListener:(t,e)=>Zf(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),DA={current:void 0},_H=AH({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!DA.current){const t=new B0e({});t.mount(window),t.setOptions({layoutScroll:!0}),DA.current=t}return DA.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),L0e={pan:{Feature:Zhe},drag:{Feature:Jhe,ProjectionNode:_H,MeasureLayout:mH}},g7={current:null},IH={current:!1};function F0e(){if(IH.current=!0,!!AT)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>g7.current=t.matches;t.addListener(e),e()}else g7.current=!1}function j0e(t,e,r){for(const n in e){const i=e[n],s=r[n];if(_s(i))t.addValue(n,i);else if(_s(s))t.addValue(n,aw(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,aw(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const oB=new WeakMap,U0e=[...Dz,Cs,sh],$0e=t=>U0e.find(Oz(t)),aB=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],q0e=IT.length;class V0e{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=$T,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,nn.render(this.render,!1,!0))};const{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=r.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=q4(r),this.isVariantNode=lz(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:f,...u}=this.scrapeMotionValuesFromProps(r,{},this);for(const p in u){const g=u[p];c[p]!==void 0&&_s(g)&&g.set(c[p],!1)}}mount(e){this.current=e,oB.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),IH.current||F0e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:g7.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){oB.delete(this.current),this.projection&&this.projection.unmount(),pu(this.notifyUpdate),pu(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Ch.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&nn.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in $g){const r=$g[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ti()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=aw(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(Mz(i)||kz(i))?i=parseFloat(i):!$0e(i)&&sh.test(r)&&(i=qz(e,r)),this.setBaseTarget(e,_s(i)?i.get():i)),_s(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=FT(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!_s(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new QT),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class TH extends V0e{constructor(){super(...arguments),this.KeyframeResolver=Vz}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function z0e(t){return window.getComputedStyle(t)}class H0e extends TH{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=yz}readValueFromInstance(e,r){if(Ch.has(r)){const n=VT(r);return n&&n.default||0}else{const n=z0e(e),i=(hz(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return gH(e,r)}build(e,r,n){OT(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return LT(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;_s(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class G0e extends TH{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ti}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Ch.has(r)){const n=VT(r);return n&&n.default||0}return r=mz.has(r)?r:$4(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return wz(e,r,n)}build(e,r,n){NT(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){bz(e,r,n,i)}mount(e){this.isSVGTag=BT(e.tagName),super.mount(e)}}const W0e=(t,e)=>PT(t)?new G0e(e):new H0e(e,{allowProjection:t!==D.Fragment}),K0e={layout:{ProjectionNode:_H,MeasureLayout:mH}},Y0e={...The,...Lue,...L0e,...K0e},cp=Gfe((t,e)=>Aue(t,e,Y0e,W0e));class Q0e extends D.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function J0e({children:t,isPresent:e}){const r=D.useId(),n=D.useRef(null),i=D.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=D.useContext(CT);return D.useInsertionEffect(()=>{const{width:o,height:a,top:c,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const f=document.createElement("style");return s&&(f.nonce=s),document.head.appendChild(f),f.sheet&&f.sheet.insertRule(` +`+s.stack}return{value:t,source:e,stack:i,digest:null}}function mA(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function qS(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var ife=typeof WeakMap=="function"?WeakMap:Map;function PV(t,e,r){r=ru(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){a5||(a5=!0,ZS=n),qS(t,e)},r}function kV(t,e,r){r=ru(-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(){qS(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(r.callback=function(){qS(t,e),typeof n!="function"&&(Gd===null?Gd=new Set([this]):Gd.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),r}function kD(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new ife;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=mfe.bind(null,t,e,r),e.then(t,t))}function MD(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 RD(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=ru(-1,1),e.tag=2,Hd(r,e,1))),r.lanes|=1),t)}var sfe=Iu.ReactCurrentOwner,Po=!1;function Ks(t,e,r,n){e.child=t===null?sV(e,null,r,n):Lg(e,t.child,r,n)}function OD(t,e,r,n,i){r=r.render;var s=e.ref;return Av(e,i),n=aT(t,e,r,n,s,i),r=cT(),t!==null&&!Po?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,hu(t,e,i)):(Tn&&r&&YI(e),e.flags|=1,Ks(t,e,n,i),e.child)}function DD(t,e,r,n,i){if(t===null){var s=r.type;return typeof s=="function"&&!mT(s)&&s.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=s,MV(t,e,s,n,i)):(t=Q6(r.type,null,n,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var o=s.memoizedProps;if(r=r.compare,r=r!==null?r:Wb,r(o,n)&&t.ref===e.ref)return hu(t,e,i)}return e.flags|=1,t=Kd(s,n),t.ref=e.ref,t.return=e,e.child=t}function MV(t,e,r,n,i){if(t!==null){var s=t.memoizedProps;if(Wb(s,n)&&t.ref===e.ref)if(Po=!1,e.pendingProps=n=s,(t.lanes&i)!==0)t.flags&131072&&(Po=!0);else return e.lanes=t.lanes,hu(t,e,i)}return VS(t,e,r,n,i)}function RV(t,e,r){var n=e.pendingProps,i=n.children,s=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},bn(ov,na),na|=r;else{if(!(r&1073741824))return t=s!==null?s.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,bn(ov,na),na|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=s!==null?s.baseLanes:r,bn(ov,na),na|=n}else s!==null?(n=s.baseLanes|r,e.memoizedState=null):n=r,bn(ov,na),na|=n;return Ks(t,e,i,r),e.child}function OV(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function VS(t,e,r,n,i){var s=Mo(r)?mp:Os.current;return s=Ng(e,s),Av(e,i),r=aT(t,e,r,n,s,i),n=cT(),t!==null&&!Po?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,hu(t,e,i)):(Tn&&n&&YI(e),e.flags|=1,Ks(t,e,r,i),e.child)}function ND(t,e,r,n,i){if(Mo(r)){var s=!0;J3(e)}else s=!1;if(Av(e,i),e.stateNode===null)W6(t,e),TV(e,r,n),$S(e,r,n,i),n=!0;else if(t===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var c=o.context,l=r.contextType;typeof l=="object"&&l!==null?l=rc(l):(l=Mo(r)?mp:Os.current,l=Ng(e,l));var f=r.getDerivedStateFromProps,u=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==n||c!==l)&&PD(e,o,n,l),cd=!1;var p=e.memoizedState;o.state=p,r5(e,n,o,i),c=e.memoizedState,a!==n||p!==c||ko.current||cd?(typeof f=="function"&&(US(e,r,f,n),c=e.memoizedState),(a=cd||TD(e,r,a,n,p,c,l))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=c),o.props=n,o.state=c,o.context=l,n=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{o=e.stateNode,aV(t,e),a=e.memoizedProps,l=e.type===e.elementType?a:Rc(e.type,a),o.props=l,u=e.pendingProps,p=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=rc(c):(c=Mo(r)?mp:Os.current,c=Ng(e,c));var g=r.getDerivedStateFromProps;(f=typeof g=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||p!==c)&&PD(e,o,n,c),cd=!1,p=e.memoizedState,o.state=p,r5(e,n,o,i);var y=e.memoizedState;a!==u||p!==y||ko.current||cd?(typeof g=="function"&&(US(e,r,g,n),y=e.memoizedState),(l=cd||TD(e,r,l,n,p,y,c)||!1)?(f||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,y,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,y,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=y),o.props=n,o.state=y,o.context=c,n=l):(typeof o.componentDidUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),n=!1)}return zS(t,e,r,n,s,i)}function zS(t,e,r,n,i,s){OV(t,e);var o=(e.flags&128)!==0;if(!n&&!o)return i&&wD(e,r,!1),hu(t,e,s);n=e.stateNode,sfe.current=e;var a=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&o?(e.child=Lg(e,t.child,null,s),e.child=Lg(e,null,a,s)):Ks(t,e,a,s),e.memoizedState=n.state,i&&wD(e,r,!0),e.child}function DV(t){var e=t.stateNode;e.pendingContext?bD(t,e.pendingContext,e.pendingContext!==e.context):e.context&&bD(t,e.context,!1),nT(t,e.containerInfo)}function BD(t,e,r,n,i){return Bg(),JI(i),e.flags|=256,Ks(t,e,r,n),e.child}var HS={dehydrated:null,treeContext:null,retryLane:0};function GS(t){return{baseLanes:t,cachePool:null,transitions:null}}function NV(t,e,r){var n=e.pendingProps,i=Mn.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=t!==null&&t.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),bn(Mn,i&1),t===null)return FS(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):(o=n.children,t=n.fallback,s?(n=e.mode,s=e.child,o={mode:"hidden",children:o},!(n&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=D4(o,n,0,null),t=op(t,n,r,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=GS(r),e.memoizedState=HS,t):uT(e,o));if(i=t.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return ofe(t,e,o,n,a,i,r);if(s){s=n.fallback,o=e.mode,i=t.child,a=i.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=c,e.deletions=null):(n=Kd(i,c),n.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Kd(a,s):(s=op(s,o,r,null),s.flags|=2),s.return=e,n.return=e,n.sibling=s,e.child=n,n=s,s=e.child,o=t.child.memoizedState,o=o===null?GS(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=t.childLanes&~r,e.memoizedState=HS,n}return s=t.child,t=s.sibling,n=Kd(s,{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 uT(t,e){return e=D4({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function K2(t,e,r,n){return n!==null&&JI(n),Lg(e,t.child,null,r),t=uT(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function ofe(t,e,r,n,i,s,o){if(r)return e.flags&256?(e.flags&=-257,n=mA(Error(Xe(422))),K2(t,e,o,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=n.fallback,i=e.mode,n=D4({mode:"visible",children:n.children},i,0,null),s=op(s,i,o,null),s.flags|=2,n.return=e,s.return=e,n.sibling=s,e.child=n,e.mode&1&&Lg(e,t.child,null,o),e.child.memoizedState=GS(o),e.memoizedState=HS,s);if(!(e.mode&1))return K2(t,e,o,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var a=n.dgst;return n=a,s=Error(Xe(419)),n=mA(s,n,void 0),K2(t,e,o,n)}if(a=(o&t.childLanes)!==0,Po||a){if(n=Fi,n!==null){switch(o&-o){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|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,du(t,i),Wc(n,t,i,-1))}return yT(),n=mA(Error(Xe(421))),K2(t,e,o,n)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=bfe.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,aa=zd(i.nextSibling),fa=e,Tn=!0,qc=null,t!==null&&(Ka[Ya++]=Qf,Ka[Ya++]=Jf,Ka[Ya++]=bp,Qf=t.id,Jf=t.overflow,bp=e),e=uT(e,n.children),e.flags|=4096,e)}function LD(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),jS(t.return,e,r)}function bA(t,e,r,n,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function BV(t,e,r){var n=e.pendingProps,i=n.revealOrder,s=n.tail;if(Ks(t,e,n.children,r),n=Mn.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&&LD(t,r,e);else if(t.tag===19)LD(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(bn(Mn,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&&n5(t)===null&&(i=r),r=r.sibling;r=i,r===null?(i=e.child,e.child=null):(i=r.sibling,r.sibling=null),bA(e,!1,i,r,s);break;case"backwards":for(r=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&n5(t)===null){e.child=i;break}t=i.sibling,i.sibling=r,r=i,i=t}bA(e,!0,r,null,s);break;case"together":bA(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function W6(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function hu(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),xp|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Xe(153));if(e.child!==null){for(t=e.child,r=Kd(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=Kd(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function afe(t,e,r){switch(e.tag){case 3:DV(e),Bg();break;case 5:cV(e);break;case 1:Mo(e.type)&&J3(e);break;case 4:nT(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;bn(e5,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(bn(Mn,Mn.current&1),e.flags|=128,null):r&e.child.childLanes?NV(t,e,r):(bn(Mn,Mn.current&1),t=hu(t,e,r),t!==null?t.sibling:null);bn(Mn,Mn.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return BV(t,e,r);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),bn(Mn,Mn.current),n)break;return null;case 22:case 23:return e.lanes=0,RV(t,e,r)}return hu(t,e,r)}var LV,WS,FV,jV;LV=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}};WS=function(){};FV=function(t,e,r,n){var i=t.memoizedProps;if(i!==n){t=e.stateNode,I0($l.current);var s=null;switch(r){case"input":i=vS(t,i),n=vS(t,n),s=[];break;case"select":i=Ln({},i,{value:void 0}),n=Ln({},n,{value:void 0}),s=[];break;case"textarea":i=mS(t,i),n=mS(t,n),s=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Y3)}wS(r,n);var o;r=null;for(l in i)if(!n.hasOwnProperty(l)&&i.hasOwnProperty(l)&&i[l]!=null)if(l==="style"){var a=i[l];for(o in a)a.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else l!=="dangerouslySetInnerHTML"&&l!=="children"&&l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(Ub.hasOwnProperty(l)?s||(s=[]):(s=s||[]).push(l,null));for(l in n){var c=n[l];if(a=i!=null?i[l]:void 0,n.hasOwnProperty(l)&&c!==a&&(c!=null||a!=null))if(l==="style")if(a){for(o in a)!a.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&a[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(s||(s=[]),s.push(l,r)),r=c;else l==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,a=a?a.__html:void 0,c!=null&&a!==c&&(s=s||[]).push(l,c)):l==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(l,""+c):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&(Ub.hasOwnProperty(l)?(c!=null&&l==="onScroll"&&xn("scroll",t),s||a===c||(s=[])):(s=s||[]).push(l,c))}r&&(s=s||[]).push("style",r);var l=s;(e.updateQueue=l)&&(e.flags|=4)}};jV=function(t,e,r,n){r!==n&&(e.flags|=4)};function bm(t,e){if(!Tn)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 ys(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 cfe(t,e,r){var n=e.pendingProps;switch(QI(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ys(e),null;case 1:return Mo(e.type)&&Q3(),ys(e),null;case 3:return n=e.stateNode,Fg(),An(ko),An(Os),sT(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(G2(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,qc!==null&&(t7(qc),qc=null))),WS(t,e),ys(e),null;case 5:iT(e);var i=I0(Zb.current);if(r=e.type,t!==null&&e.stateNode!=null)FV(t,e,r,n,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(Xe(166));return ys(e),null}if(t=I0($l.current),G2(e)){n=e.stateNode,r=e.type;var s=e.memoizedProps;switch(n[Ol]=e,n[Qb]=s,t=(e.mode&1)!==0,r){case"dialog":xn("cancel",n),xn("close",n);break;case"iframe":case"object":case"embed":xn("load",n);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=o.createElement(r,{is:n.is}):(t=o.createElement(r),r==="select"&&(o=t,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):t=o.createElementNS(t,r),t[Ol]=e,t[Qb]=n,LV(t,e,!1,!1),e.stateNode=t;e:{switch(o=xS(r,n),r){case"dialog":xn("cancel",t),xn("close",t),i=n;break;case"iframe":case"object":case"embed":xn("load",t),i=n;break;case"video":case"audio":for(i=0;iUg&&(e.flags|=128,n=!0,bm(s,!1),e.lanes=4194304)}else{if(!n)if(t=n5(o),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),bm(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Tn)return ys(e),null}else 2*oi()-s.renderingStartTime>Ug&&r!==1073741824&&(e.flags|=128,n=!0,bm(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(r=s.last,r!==null?r.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=oi(),e.sibling=null,r=Mn.current,bn(Mn,n?r&1|2:r&1),e):(ys(e),null);case 22:case 23:return gT(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?na&1073741824&&(ys(e),e.subtreeFlags&6&&(e.flags|=8192)):ys(e),null;case 24:return null;case 25:return null}throw Error(Xe(156,e.tag))}function lfe(t,e){switch(QI(e),e.tag){case 1:return Mo(e.type)&&Q3(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Fg(),An(ko),An(Os),sT(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return iT(e),null;case 13:if(An(Mn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Xe(340));Bg()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return An(Mn),null;case 4:return Fg(),null;case 10:return eT(e.type._context),null;case 22:case 23:return gT(),null;case 24:return null;default:return null}}var Y2=!1,Ss=!1,ffe=typeof WeakSet=="function"?WeakSet:Set,_t=null;function sv(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Hn(t,e,n)}else r.current=null}function KS(t,e,r){try{r()}catch(n){Hn(t,e,n)}}var FD=!1;function ufe(t,e){if(MS=G3,t=zq(),KI(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,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var o=0,a=-1,c=-1,l=0,f=0,u=t,p=null;t:for(;;){for(var g;u!==r||i!==0&&u.nodeType!==3||(a=o+i),u!==s||n!==0&&u.nodeType!==3||(c=o+n),u.nodeType===3&&(o+=u.nodeValue.length),(g=u.firstChild)!==null;)p=u,u=g;for(;;){if(u===t)break t;if(p===r&&++l===i&&(a=o),p===s&&++f===n&&(c=o),(g=u.nextSibling)!==null)break;u=p,p=u.parentNode}u=g}r=a===-1||c===-1?null:{start:a,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(RS={focusedElem:t,selectionRange:r},G3=!1,_t=e;_t!==null;)if(e=_t,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,_t=t;else for(;_t!==null;){e=_t;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,I=y.memoizedState,C=e.stateNode,S=C.getSnapshotBeforeUpdate(e.elementType===e.type?b:Rc(e.type,b),I);C.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var O=e.stateNode.containerInfo;O.nodeType===1?O.textContent="":O.nodeType===9&&O.documentElement&&O.removeChild(O.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Xe(163))}}catch(L){Hn(e,e.return,L)}if(t=e.sibling,t!==null){t.return=e.return,_t=t;break}_t=e.return}return y=FD,FD=!1,y}function yb(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 s=i.destroy;i.destroy=void 0,s!==void 0&&KS(e,r,s)}i=i.next}while(i!==n)}}function R4(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 YS(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 UV(t){var e=t.alternate;e!==null&&(t.alternate=null,UV(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ol],delete e[Qb],delete e[NS],delete e[Wle],delete e[Kle])),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 $V(t){return t.tag===5||t.tag===3||t.tag===4}function jD(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||$V(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 QS(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=Y3));else if(n!==4&&(t=t.child,t!==null))for(QS(t,e,r),t=t.sibling;t!==null;)QS(t,e,r),t=t.sibling}function JS(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(JS(t,e,r),t=t.sibling;t!==null;)JS(t,e,r),t=t.sibling}var Qi=null,Uc=!1;function Zu(t,e,r){for(r=r.child;r!==null;)qV(t,e,r),r=r.sibling}function qV(t,e,r){if(Ul&&typeof Ul.onCommitFiberUnmount=="function")try{Ul.onCommitFiberUnmount(A4,r)}catch{}switch(r.tag){case 5:Ss||sv(r,e);case 6:var n=Qi,i=Uc;Qi=null,Zu(t,e,r),Qi=n,Uc=i,Qi!==null&&(Uc?(t=Qi,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Qi.removeChild(r.stateNode));break;case 18:Qi!==null&&(Uc?(t=Qi,r=r.stateNode,t.nodeType===8?dA(t.parentNode,r):t.nodeType===1&&dA(t,r),Hb(t)):dA(Qi,r.stateNode));break;case 4:n=Qi,i=Uc,Qi=r.stateNode.containerInfo,Uc=!0,Zu(t,e,r),Qi=n,Uc=i;break;case 0:case 11:case 14:case 15:if(!Ss&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&KS(r,e,o),i=i.next}while(i!==n)}Zu(t,e,r);break;case 1:if(!Ss&&(sv(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){Hn(r,e,a)}Zu(t,e,r);break;case 21:Zu(t,e,r);break;case 22:r.mode&1?(Ss=(n=Ss)||r.memoizedState!==null,Zu(t,e,r),Ss=n):Zu(t,e,r);break;default:Zu(t,e,r)}}function UD(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new ffe),e.forEach(function(n){var i=wfe.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function xc(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~s}if(n=i,n=oi()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*hfe(n/1960))-n,10t?16:t,Nd===null)var n=!1;else{if(t=Nd,Nd=null,c5=0,Lr&6)throw Error(Xe(331));var i=Lr;for(Lr|=4,_t=t.current;_t!==null;){var s=_t,o=s.child;if(_t.flags&16){var a=s.deletions;if(a!==null){for(var c=0;coi()-pT?sp(t,0):hT|=r),Ro(t,e)}function QV(t,e){e===0&&(t.mode&1?(e=U2,U2<<=1,!(U2&130023424)&&(U2=4194304)):e=1);var r=Zs();t=du(t,e),t!==null&&(Zw(t,e,r),Ro(t,r))}function bfe(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),QV(t,r)}function wfe(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(Xe(314))}n!==null&&n.delete(e),QV(t,r)}var JV;JV=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||ko.current)Po=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Po=!1,afe(t,e,r);Po=!!(t.flags&131072)}else Po=!1,Tn&&e.flags&1048576&&tV(e,X3,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;W6(t,e),t=e.pendingProps;var i=Ng(e,Os.current);Av(e,r),i=aT(null,e,n,t,i,r);var s=cT();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,Mo(n)?(s=!0,J3(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,rT(e),i.updater=M4,e.stateNode=i,i._reactInternals=e,$S(e,n,t,r),e=zS(null,e,n,!0,s,r)):(e.tag=0,Tn&&s&&YI(e),Ks(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(W6(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=Efe(n),t=Rc(n,t),i){case 0:e=VS(null,e,n,t,r);break e;case 1:e=ND(null,e,n,t,r);break e;case 11:e=OD(null,e,n,t,r);break e;case 14:e=DD(null,e,n,Rc(n.type,t),r);break e}throw Error(Xe(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),VS(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),ND(t,e,n,i,r);case 3:e:{if(DV(e),t===null)throw Error(Xe(387));n=e.pendingProps,s=e.memoizedState,i=s.element,aV(t,e),r5(e,n,null,r);var o=e.memoizedState;if(n=o.element,s.isDehydrated)if(s={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=jg(Error(Xe(423)),e),e=BD(t,e,n,r,i);break e}else if(n!==i){i=jg(Error(Xe(424)),e),e=BD(t,e,n,r,i);break e}else for(aa=zd(e.stateNode.containerInfo.firstChild),fa=e,Tn=!0,qc=null,r=sV(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Bg(),n===i){e=hu(t,e,r);break e}Ks(t,e,n,r)}e=e.child}return e;case 5:return cV(e),t===null&&FS(e),n=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,OS(n,i)?o=null:s!==null&&OS(n,s)&&(e.flags|=32),OV(t,e),Ks(t,e,o,r),e.child;case 6:return t===null&&FS(e),null;case 13:return NV(t,e,r);case 4:return nT(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Lg(e,null,n,r):Ks(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),OD(t,e,n,i,r);case 7:return Ks(t,e,e.pendingProps,r),e.child;case 8:return Ks(t,e,e.pendingProps.children,r),e.child;case 12:return Ks(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,bn(e5,n._currentValue),n._currentValue=o,s!==null)if(Yc(s.value,o)){if(s.children===i.children&&!ko.current){e=hu(t,e,r);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var c=a.firstContext;c!==null;){if(c.context===n){if(s.tag===1){c=ru(-1,r&-r),c.tag=2;var l=s.updateQueue;if(l!==null){l=l.shared;var f=l.pending;f===null?c.next=c:(c.next=f.next,f.next=c),l.pending=c}}s.lanes|=r,c=s.alternate,c!==null&&(c.lanes|=r),jS(s.return,r,e),a.lanes|=r;break}c=c.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Xe(341));o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),jS(o,r,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ks(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Av(e,r),i=rc(i),n=n(i),e.flags|=1,Ks(t,e,n,r),e.child;case 14:return n=e.type,i=Rc(n,e.pendingProps),i=Rc(n.type,i),DD(t,e,n,i,r);case 15:return MV(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Rc(n,i),W6(t,e),e.tag=1,Mo(n)?(t=!0,J3(e)):t=!1,Av(e,r),TV(e,n,i),$S(e,n,i,r),zS(null,e,n,!0,t,r);case 19:return BV(t,e,r);case 22:return RV(t,e,r)}throw Error(Xe(156,e.tag))};function ZV(t,e){return Sq(t,e)}function xfe(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 Ja(t,e,r,n){return new xfe(t,e,r,n)}function mT(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Efe(t){if(typeof t=="function")return mT(t)?1:0;if(t!=null){if(t=t.$$typeof,t===LI)return 11;if(t===FI)return 14}return 2}function Kd(t,e){var r=t.alternate;return r===null?(r=Ja(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 Q6(t,e,r,n,i,s){var o=2;if(n=t,typeof t=="function")mT(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Q1:return op(r.children,i,s,e);case BI:o=8,i|=8;break;case uS:return t=Ja(12,r,e,i|2),t.elementType=uS,t.lanes=s,t;case dS:return t=Ja(13,r,e,i),t.elementType=dS,t.lanes=s,t;case hS:return t=Ja(19,r,e,i),t.elementType=hS,t.lanes=s,t;case cq:return D4(r,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case oq:o=10;break e;case aq:o=9;break e;case LI:o=11;break e;case FI:o=14;break e;case ad:o=16,n=null;break e}throw Error(Xe(130,t==null?t:typeof t,""))}return e=Ja(o,r,e,i),e.elementType=t,e.type=n,e.lanes=s,e}function op(t,e,r,n){return t=Ja(7,t,n,e),t.lanes=r,t}function D4(t,e,r,n){return t=Ja(22,t,n,e),t.elementType=cq,t.lanes=r,t.stateNode={isHidden:!1},t}function wA(t,e,r){return t=Ja(6,t,null,e),t.lanes=r,t}function xA(t,e,r){return e=Ja(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Cfe(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=tA(0),this.expirationTimes=tA(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tA(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function bT(t,e,r,n,i,s,o,a,c){return t=new Cfe(t,e,r,a,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Ja(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},rT(s),t}function Afe(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rz)}catch(t){console.error(t)}}rz(),rq.exports=ga;var Eh=rq.exports;const Pfe=_u(Eh),CT=D.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),j4=D.createContext({}),U4=D.createContext(null),AT=typeof window<"u",nz=AT?D.useLayoutEffect:D.useEffect,iz=D.createContext({strict:!1}),$4=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),kfe="framerAppearId",sz="data-"+$4(kfe),Mfe={skipAnimations:!1,useManualTiming:!1};function Rfe(t){let e=new Set,r=new Set,n=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(l){s.has(l)&&(c.schedule(l),t()),l(o)}const c={schedule:(l,f=!1,u=!1)=>{const g=u&&n?e:r;return f&&s.add(l),g.has(l)||g.add(l),l},cancel:l=>{r.delete(l),s.delete(l)},process:l=>{if(o=l,n){i=!0;return}n=!0,[e,r]=[r,e],r.clear(),e.forEach(a),n=!1,i&&(i=!1,c.process(l))}};return c}const Z2=["read","resolveKeyframes","update","preRender","render","postRender"],Ofe=40;function oz(t,e){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,o=Z2.reduce((C,S)=>(C[S]=Rfe(s),C),{}),{read:a,resolveKeyframes:c,update:l,preRender:f,render:u,postRender:p}=o,g=()=>{const C=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(C-i.timestamp,Ofe),1),i.timestamp=C,i.isProcessing=!0,a.process(i),c.process(i),l.process(i),f.process(i),u.process(i),p.process(i),i.isProcessing=!1,r&&e&&(n=!1,t(g))},y=()=>{r=!0,n=!0,i.isProcessing||t(g)};return{schedule:Z2.reduce((C,S)=>{const O=o[S];return C[S]=(L,F=!1,z=!1)=>(r||y(),O.schedule(L,F,z)),C},{}),cancel:C=>{for(let S=0;S{u&&u.update(r,c)});const g=r[sz],y=D.useRef(!!g&&!window.MotionHandoffIsComplete&&((s=window.MotionHasOptimisedAnimation)===null||s===void 0?void 0:s.call(window,g)));return nz(()=>{u&&(u.updateFeatures(),ST.render(u.render),y.current&&u.animationState&&u.animationState.animateChanges())}),D.useEffect(()=>{u&&(!y.current&&u.animationState&&u.animationState.animateChanges(),y.current=!1,KD||(KD=!0,queueMicrotask(Nfe)))}),u}function Nfe(){window.MotionHandoffIsComplete=!0}function Bfe(t,e,r,n){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:c,layoutRoot:l}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:cz(t.parent)),t.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&av(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,layoutScroll:c,layoutRoot:l})}function cz(t){if(t)return t.options.allowProjection!==!1?t.projection:cz(t.parent)}function Lfe(t,e,r){return D.useCallback(n=>{n&&t.mount&&t.mount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):av(r)&&(r.current=n))},[e])}function nw(t){return typeof t=="string"||Array.isArray(t)}function iw(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const _T=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],IT=["initial",..._T];function q4(t){return iw(t.animate)||IT.some(e=>nw(t[e]))}function lz(t){return!!(q4(t)||t.variants)}function Ffe(t,e){if(q4(t)){const{initial:r,animate:n}=t;return{initial:r===!1||nw(r)?r:void 0,animate:nw(n)?n:void 0}}return t.inherit!==!1?e:{}}function jfe(t){const{initial:e,animate:r}=Ffe(t,D.useContext(j4));return D.useMemo(()=>({initial:e,animate:r}),[YD(e),YD(r)])}function YD(t){return Array.isArray(t)?t.join(" "):t}const QD={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},$g={};for(const t in QD)$g[t]={isEnabled:e=>QD[t].some(r=>!!e[r])};function Ufe(t){for(const e in t)$g[e]={...$g[e],...t[e]}}const TT=D.createContext({}),$fe=Symbol.for("motionComponentSymbol"),Ts=t=>t;let r7=Ts;function qfe({preloadedFeatures:t,createVisualElement:e,useRender:r,useVisualState:n,Component:i}){t&&Ufe(t);function s(a,c){let l;const f={...D.useContext(CT),...a,layoutId:Vfe(a)},{isStatic:u}=f,p=jfe(a),g=n(a,u);if(!u&&AT){zfe();const y=Hfe(f);l=y.MeasureLayout,p.visualElement=Dfe(i,g,f,e,y.ProjectionNode)}return W.jsxs(j4.Provider,{value:p,children:[l&&p.visualElement?W.jsx(l,{visualElement:p.visualElement,...f}):null,r(i,a,Lfe(g,p.visualElement,c),g,u,p.visualElement)]})}const o=D.forwardRef(s);return o[$fe]=i,o}function Vfe({layoutId:t}){const e=D.useContext(TT).id;return e&&t!==void 0?e+"-"+t:t}function zfe(t,e){D.useContext(iz).strict}function Hfe(t){const{drag:e,layout:r}=$g;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e!=null&&e.isEnabled(t)||r!=null&&r.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function Gfe(t){function e(n,i={}){return qfe(t(n,i))}if(typeof Proxy>"u")return e;const r=new Map;return new Proxy(e,{get:(n,i)=>(r.has(i)||r.set(i,e(i)),r.get(i))})}const Wfe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function PT(t){return typeof t!="string"||t.includes("-")?!1:!!(Wfe.indexOf(t)>-1||/[A-Z]/u.test(t))}const u5={};function Kfe(t){Object.assign(u5,t)}const rx=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ch=new Set(rx);function fz(t,{layout:e,layoutId:r}){return Ch.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!u5[t]||t==="opacity")}const _s=t=>!!(t&&t.getVelocity),uz=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ih=(t,e,r)=>r>e?e:rtypeof t=="number",parse:parseFloat,transform:t=>t},wb={...hy,transform:t=>ih(0,1,t)},X2={...hy,default:1},xb=t=>Math.round(t*1e5)/1e5,kT=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Yfe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Qfe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function nx(t){return typeof t=="string"}function Jfe(t){return t==null}const ix=t=>({test:e=>nx(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),id=ix("deg"),ql=ix("%"),Yt=ix("px"),Zfe=ix("vh"),Xfe=ix("vw"),JD={...ql,parse:t=>ql.parse(t)/100,transform:t=>ql.transform(t*100)},ZD={...hy,transform:Math.round},MT={borderWidth:Yt,borderTopWidth:Yt,borderRightWidth:Yt,borderBottomWidth:Yt,borderLeftWidth:Yt,borderRadius:Yt,radius:Yt,borderTopLeftRadius:Yt,borderTopRightRadius:Yt,borderBottomRightRadius:Yt,borderBottomLeftRadius:Yt,width:Yt,maxWidth:Yt,height:Yt,maxHeight:Yt,size:Yt,top:Yt,right:Yt,bottom:Yt,left:Yt,padding:Yt,paddingTop:Yt,paddingRight:Yt,paddingBottom:Yt,paddingLeft:Yt,margin:Yt,marginTop:Yt,marginRight:Yt,marginBottom:Yt,marginLeft:Yt,rotate:id,rotateX:id,rotateY:id,rotateZ:id,scale:X2,scaleX:X2,scaleY:X2,scaleZ:X2,skew:id,skewX:id,skewY:id,distance:Yt,translateX:Yt,translateY:Yt,translateZ:Yt,x:Yt,y:Yt,z:Yt,perspective:Yt,transformPerspective:Yt,opacity:wb,originX:JD,originY:JD,originZ:Yt,zIndex:ZD,backgroundPositionX:Yt,backgroundPositionY:Yt,fillOpacity:wb,strokeOpacity:wb,numOctaves:ZD},eue={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tue=rx.length;function rue(t,e,r){let n="",i=!0;for(let s=0;se=>typeof e=="string"&&e.startsWith(t),hz=dz("--"),nue=dz("var(--"),RT=t=>nue(t)?iue.test(t.split("/*")[0].trim()):!1,iue=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function OT(t,e,r){const{style:n,vars:i,transformOrigin:s}=t;let o=!1,a=!1;for(const c in e){const l=e[c];if(Ch.has(c)){o=!0;continue}else if(hz(c)){i[c]=l;continue}else{const f=uz(l,MT[c]);c.startsWith("origin")?(a=!0,s[c]=f):n[c]=f}}if(e.transform||(o||r?n.transform=rue(e,t.transform,r):n.transform&&(n.transform="none")),a){const{originX:c="50%",originY:l="50%",originZ:f=0}=s;n.transformOrigin=`${c} ${l} ${f}`}}const DT=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function pz(t,e,r){for(const n in e)!_s(e[n])&&!fz(n,r)&&(t[n]=e[n])}function sue({transformTemplate:t},e){return D.useMemo(()=>{const r=DT();return OT(r,e,t),Object.assign({},r.vars,r.style)},[e])}function oue(t,e){const r=t.style||{},n={};return pz(n,r,t),Object.assign(n,sue(t,e)),n}function aue(t,e){const r={},n=oue(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const cue=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function d5(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||cue.has(t)}let vz=t=>!d5(t);function lue(t){t&&(vz=e=>e.startsWith("on")?!d5(e):t(e))}try{lue(require("@emotion/is-prop-valid").default)}catch{}function fue(t,e,r){const n={};for(const i in t)i==="values"&&typeof t.values=="object"||(vz(i)||r===!0&&d5(i)||!e&&!d5(i)||t.draggable&&i.startsWith("onDrag"))&&(n[i]=t[i]);return n}function XD(t,e,r){return typeof t=="string"?t:Yt.transform(e+r*t)}function uue(t,e,r){const n=XD(e,t.x,t.width),i=XD(r,t.y,t.height);return`${n} ${i}`}const due={offset:"stroke-dashoffset",array:"stroke-dasharray"},hue={offset:"strokeDashoffset",array:"strokeDasharray"};function pue(t,e,r=1,n=0,i=!0){t.pathLength=1;const s=i?due:hue;t[s.offset]=Yt.transform(-n);const o=Yt.transform(e),a=Yt.transform(r);t[s.array]=`${o} ${a}`}function NT(t,{attrX:e,attrY:r,attrScale:n,originX:i,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:c=0,...l},f,u){if(OT(t,l,u),f){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:p,style:g,dimensions:y}=t;p.transform&&(y&&(g.transform=p.transform),delete p.transform),y&&(i!==void 0||s!==void 0||g.transform)&&(g.transformOrigin=uue(y,i!==void 0?i:.5,s!==void 0?s:.5)),e!==void 0&&(p.x=e),r!==void 0&&(p.y=r),n!==void 0&&(p.scale=n),o!==void 0&&pue(p,o,a,c,!1)}const gz=()=>({...DT(),attrs:{}}),BT=t=>typeof t=="string"&&t.toLowerCase()==="svg";function vue(t,e,r,n){const i=D.useMemo(()=>{const s=gz();return NT(s,e,BT(n),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};pz(s,t.style,t),i.style={...s,...i.style}}return i}function gue(t=!1){return(r,n,i,{latestValues:s},o)=>{const c=(PT(r)?vue:aue)(n,s,o,r),l=fue(n,typeof r=="string",t),f=r!==D.Fragment?{...l,...c,ref:i}:{},{children:u}=n,p=D.useMemo(()=>_s(u)?u.get():u,[u]);return D.createElement(r,{...f,children:p})}}function yz(t,{style:e,vars:r},n,i){Object.assign(t.style,e,i&&i.getProjectionStyles(n));for(const s in r)t.style.setProperty(s,r[s])}const mz=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function bz(t,e,r,n){yz(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(mz.has(i)?i:$4(i),e.attrs[i])}function LT(t,e,r){var n;const{style:i}=t,s={};for(const o in i)(_s(i[o])||e.style&&_s(e.style[o])||fz(o,t)||((n=r==null?void 0:r.getValue(o))===null||n===void 0?void 0:n.liveStyle)!==void 0)&&(s[o]=i[o]);return r&&i&&typeof i.willChange=="string"&&(r.applyWillChange=!1),s}function wz(t,e,r){const n=LT(t,e,r);for(const i in t)if(_s(t[i])||_s(e[i])){const s=rx.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;n[s]=t[i]}return n}function eN(t){const e=[{},{}];return t==null||t.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function FT(t,e,r,n){if(typeof e=="function"){const[i,s]=eN(n);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,s]=eN(n);e=e(r!==void 0?r:t.custom,i,s)}return e}function jT(t){const e=D.useRef(null);return e.current===null&&(e.current=t()),e.current}const n7=t=>Array.isArray(t),yue=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),mue=t=>n7(t)?t[t.length-1]||0:t;function J6(t){const e=_s(t)?t.get():t;return yue(e)?e.toValue():e}const xz=new Set(["opacity","clipPath","filter","transform"]);function Ez(t){if(Ch.has(t))return"transform";if(xz.has(t))return $4(t)}function V4(t,e){t.indexOf(e)===-1&&t.push(e)}function z4(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}function bue({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:r,onMount:n},i,s,o,a){const c={latestValues:xue(i,s,o,a?!1:t,e),renderState:r()};return n&&(c.mount=l=>n(i,l,c)),c}const Cz=t=>(e,r)=>{const n=D.useContext(j4),i=D.useContext(U4),s=()=>bue(t,e,n,i,r);return r?s():jT(s)};function wue(t,e){const r=Ez(e);r&&V4(t,r)}function tN(t,e,r){const n=Array.isArray(e)?e:[e];for(let i=0;i{for(const S in I){let O=I[S];if(Array.isArray(O)){const L=y?O.length-1:0;O=O[L]}O!==null&&(o[S]=O)}for(const S in C)o[S]=C[S]}),c&&(u&&f!==!1&&!iw(u)&&tN(t,u,I=>{for(const C in I)wue(a,C)}),a.length&&(o.willChange=a.join(","))),o}const{schedule:nn,cancel:pu,state:Ji,steps:EA}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ts,!0),Eue={useVisualState:Cz({scrapeMotionValuesFromProps:wz,createRenderState:gz,onMount:(t,e,{renderState:r,latestValues:n})=>{nn.read(()=>{try{r.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),nn.render(()=>{NT(r,n,BT(e.tagName),t.transformTemplate),bz(e,r)})}})},Cue={useVisualState:Cz({applyWillChange:!0,scrapeMotionValuesFromProps:LT,createRenderState:DT})};function Aue(t,{forwardMotionProps:e=!1},r,n){return{...PT(t)?Eue:Cue,preloadedFeatures:r,useRender:gue(e),createVisualElement:n,Component:t}}function Zf(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}const Az=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function H4(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Sue=t=>e=>Az(e)&&t(e,H4(e));function nu(t,e,r,n){return Zf(t,e,Sue(r),n)}const _ue=(t,e)=>r=>e(t(r)),iu=(...t)=>t.reduce(_ue);function Sz(t){let e=null;return()=>{const r=()=>{e=null};return e===null?(e=t,r):!1}}const rN=Sz("dragHorizontal"),nN=Sz("dragVertical");function _z(t){let e=!1;if(t==="y")e=nN();else if(t==="x")e=rN();else{const r=rN(),n=nN();r&&n?e=()=>{r(),n()}:(r&&r(),n&&n())}return e}function Iz(){const t=_z(!0);return t?(t(),!1):!0}class Ah{constructor(e){this.isMounted=!1,this.node=e}update(){}}function iN(t,e){const r=e?"pointerenter":"pointerleave",n=e?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||Iz())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const c=a[n];c&&nn.postRender(()=>c(s,o))};return nu(t.current,r,i,{passive:!t.getProps()[n]})}class Iue extends Ah{mount(){this.unmount=iu(iN(this.node,!0),iN(this.node,!1))}unmount(){}}class Tue extends Ah{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=iu(Zf(this.node.current,"focus",()=>this.onFocus()),Zf(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Tz=(t,e)=>e?t===e?!0:Tz(t,e.parentElement):!1;function CA(t,e){if(!e)return;const r=new PointerEvent("pointer"+t);e(r,H4(r))}class Pue extends Ah{constructor(){super(...arguments),this.removeStartListeners=Ts,this.removeEndListeners=Ts,this.removeAccessibleListeners=Ts,this.startPointerPress=(e,r)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),s=nu(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:f,globalTapTarget:u}=this.node.getProps(),p=!u&&!Tz(this.node.current,a.target)?f:l;p&&nn.update(()=>p(a,c))},{passive:!(n.onTap||n.onPointerUp)}),o=nu(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=iu(s,o),this.startPress(e,r)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||CA("up",(c,l)=>{const{onTap:f}=this.node.getProps();f&&nn.postRender(()=>f(c,l))})};this.removeEndListeners(),this.removeEndListeners=Zf(this.node.current,"keyup",o),CA("down",(a,c)=>{this.startPress(a,c)})},r=Zf(this.node.current,"keydown",e),n=()=>{this.isPressing&&CA("cancel",(s,o)=>this.cancelPress(s,o))},i=Zf(this.node.current,"blur",n);this.removeAccessibleListeners=iu(r,i)}}startPress(e,r){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&nn.postRender(()=>n(e,r))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Iz()}cancelPress(e,r){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&nn.postRender(()=>n(e,r))}mount(){const e=this.node.getProps(),r=nu(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Zf(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=iu(r,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const i7=new WeakMap,AA=new WeakMap,kue=t=>{const e=i7.get(t.target);e&&e(t)},Mue=t=>{t.forEach(kue)};function Rue({root:t,...e}){const r=t||document;AA.has(r)||AA.set(r,{});const n=AA.get(r),i=JSON.stringify(e);return n[i]||(n[i]=new IntersectionObserver(Mue,{root:t,...e})),n[i]}function Oue(t,e,r){const n=Rue(e);return i7.set(t,r),n.observe(t),()=>{i7.delete(t),n.unobserve(t)}}const Due={some:0,all:1};class Nue extends Ah{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:i="some",once:s}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof i=="number"?i:Due[i]},a=c=>{const{isIntersecting:l}=c;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:f,onViewportLeave:u}=this.node.getProps(),p=l?f:u;p&&p(c)};return Oue(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(Bue(e,r))&&this.startObserver()}unmount(){}}function Bue({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const Lue={inView:{Feature:Nue},tap:{Feature:Pue},focus:{Feature:Tue},hover:{Feature:Iue}};function Pz(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;nt*1e3,ou=t=>t/1e3,Fue={type:"spring",stiffness:500,damping:25,restSpeed:10},jue=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Uue={type:"keyframes",duration:.8},$ue={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},que=(t,{keyframes:e})=>e.length>2?Uue:Ch.has(t)?t.startsWith("scale")?jue(e[1]):Fue:$ue;function Vue({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:c,elapsed:l,...f}){return!!Object.keys(f).length}function UT(t,e){return t[e]||t.default||t}const zue=t=>t!==null;function W4(t,{repeat:e,repeatType:r="loop"},n){const i=t.filter(zue),s=e&&r!=="loop"&&e%2===1?0:i.length-1;return!s||n===void 0?i[s]:n}const kz=t=>/^0[^.\s]+$/u.test(t);function Hue(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||kz(t):!0}const Mz=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Gue=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Wue(t){const e=Gue.exec(t);if(!e)return[,];const[,r,n,i]=e;return[`--${r??n}`,i]}function Rz(t,e,r=1){const[n,i]=Wue(t);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const o=s.trim();return Mz(o)?parseFloat(o):o}return RT(i)?Rz(i,e,r+1):i}const Kue=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),sN=t=>t===hy||t===Yt,oN=(t,e)=>parseFloat(t.split(", ")[e]),aN=(t,e)=>(r,{transform:n})=>{if(n==="none"||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/u);if(i)return oN(i[1],e);{const s=n.match(/^matrix\((.+)\)$/u);return s?oN(s[1],t):0}},Yue=new Set(["x","y","z"]),Que=rx.filter(t=>!Yue.has(t));function Jue(t){const e=[];return Que.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const qg={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:aN(4,13),y:aN(5,14)};qg.translateX=qg.x;qg.translateY=qg.y;const Oz=t=>e=>e.test(t),Zue={test:t=>t==="auto",parse:t=>t},Dz=[hy,Yt,ql,id,Xfe,Zfe,Zue],cN=t=>Dz.find(Oz(t)),ap=new Set;let s7=!1,o7=!1;function Nz(){if(o7){const t=Array.from(ap).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const i=Jue(n);i.length&&(r.set(n,i),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const i=r.get(n);i&&i.forEach(([s,o])=>{var a;(a=n.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}o7=!1,s7=!1,ap.forEach(t=>t.complete()),ap.clear()}function Bz(){ap.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(o7=!0)})}function Xue(){Bz(),Nz()}class $T{constructor(e,r,n,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ap.add(this),s7||(s7=!0,nn.read(Bz),nn.resolveKeyframes(Nz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:i}=this;for(let s=0;sr=>!!(nx(r)&&Qfe.test(r)&&r.startsWith(t)||e&&!Jfe(r)&&Object.prototype.hasOwnProperty.call(r,e)),Lz=(t,e,r)=>n=>{if(!nx(n))return n;const[i,s,o,a]=n.match(kT);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},ede=t=>ih(0,255,t),SA={...hy,transform:t=>Math.round(ede(t))},T0={test:qT("rgb","red"),parse:Lz("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+SA.transform(t)+", "+SA.transform(e)+", "+SA.transform(r)+", "+xb(wb.transform(n))+")"};function tde(t){let e="",r="",n="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,n+=n,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}}const a7={test:qT("#"),parse:tde,transform:T0.transform},cv={test:qT("hsl","hue"),parse:Lz("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+ql.transform(xb(e))+", "+ql.transform(xb(r))+", "+xb(wb.transform(n))+")"},Cs={test:t=>T0.test(t)||a7.test(t)||cv.test(t),parse:t=>T0.test(t)?T0.parse(t):cv.test(t)?cv.parse(t):a7.parse(t),transform:t=>nx(t)?t:t.hasOwnProperty("red")?T0.transform(t):cv.transform(t)};function rde(t){var e,r;return isNaN(t)&&nx(t)&&(((e=t.match(kT))===null||e===void 0?void 0:e.length)||0)+(((r=t.match(Yfe))===null||r===void 0?void 0:r.length)||0)>0}const Fz="number",jz="color",nde="var",ide="var(",lN="${}",sde=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function sw(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},i=[];let s=0;const a=e.replace(sde,c=>(Cs.test(c)?(n.color.push(s),i.push(jz),r.push(Cs.parse(c))):c.startsWith(ide)?(n.var.push(s),i.push(nde),r.push(c)):(n.number.push(s),i.push(Fz),r.push(parseFloat(c))),++s,lN)).split(lN);return{values:r,split:a,indexes:n,types:i}}function Uz(t){return sw(t).values}function $z(t){const{split:e,types:r}=sw(t),n=e.length;return i=>{let s="";for(let o=0;otypeof t=="number"?0:t;function ade(t){const e=Uz(t);return $z(t)(e.map(ode))}const sh={test:rde,parse:Uz,createTransformer:$z,getAnimatableNone:ade},cde=new Set(["brightness","contrast","saturate","opacity"]);function lde(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(kT)||[];if(!n)return t;const i=r.replace(n,"");let s=cde.has(e)?1:0;return n!==r&&(s*=100),e+"("+s+i+")"}const fde=/\b([a-z-]*)\(.*?\)/gu,c7={...sh,getAnimatableNone:t=>{const e=t.match(fde);return e?e.map(lde).join(" "):t}},ude={...MT,color:Cs,backgroundColor:Cs,outlineColor:Cs,fill:Cs,stroke:Cs,borderColor:Cs,borderTopColor:Cs,borderRightColor:Cs,borderBottomColor:Cs,borderLeftColor:Cs,filter:c7,WebkitFilter:c7},VT=t=>ude[t];function qz(t,e){let r=VT(t);return r!==c7&&(r=sh),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const dde=new Set(["auto","none","0"]);function hde(t,e,r){let n=0,i;for(;n{r.getValue(c).set(l)}),this.resolveNoneKeyframes()}}function zz(t){let e;return()=>(e===void 0&&(e=t()),e)}let Z6;function pde(){Z6=void 0}const au={now:()=>(Z6===void 0&&au.set(Ji.isProcessing||Mfe.useManualTiming?Ji.timestamp:performance.now()),Z6),set:t=>{Z6=t,queueMicrotask(pde)}},fN=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(sh.test(t)||t==="0")&&!t.startsWith("url("));function vde(t){const e=t[0];if(t.length===1)return!0;for(let r=0;ryde?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Xue(),this._resolved}onKeyframesResolved(e,r){this.resolvedAt=au.now(),this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:o,onComplete:a,onUpdate:c,isGenerator:l}=this.options;if(!l&&!gde(e,n,i,s))if(o)this.options.duration=0;else{c==null||c(W4(e,this.options,r)),a==null||a(),this.resolveFinishedPromise();return}const f=this.initPlayback(e,r);f!==!1&&(this._resolved={keyframes:e,finalKeyframe:r,...f},this.onPostResolved())}onPostResolved(){}then(e,r){return this.currentFinishedPromise.then(e,r)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function Gz(t,e){return e?t*(1e3/e):0}const mde=5;function Wz(t,e,r){const n=Math.max(e-mde,0);return Gz(r-t(n),e-n)}const _A=.001,bde=.01,wde=10,xde=.05,Ede=1;function Cde({duration:t=800,bounce:e=.25,velocity:r=0,mass:n=1}){let i,s,o=1-e;o=ih(xde,Ede,o),t=ih(bde,wde,ou(t)),o<1?(i=l=>{const f=l*o,u=f*t,p=f-r,g=l7(l,o),y=Math.exp(-u);return _A-p/g*y},s=l=>{const u=l*o*t,p=u*r+r,g=Math.pow(o,2)*Math.pow(l,2)*t,y=Math.exp(-u),b=l7(Math.pow(l,2),o);return(-i(l)+_A>0?-1:1)*((p-g)*y)/b}):(i=l=>{const f=Math.exp(-l*t),u=(l-r)*t+1;return-_A+f*u},s=l=>{const f=Math.exp(-l*t),u=(r-l)*(t*t);return f*u});const a=5/t,c=Sde(i,s,a);if(t=su(t),isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*n;return{stiffness:l,damping:o*2*Math.sqrt(n*l),duration:t}}}const Ade=12;function Sde(t,e,r){let n=r;for(let i=1;it[r]!==void 0)}function Tde(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!uN(t,Ide)&&uN(t,_de)){const r=Cde(t);e={...e,...r,mass:1},e.isResolvedFromDuration=!0}return e}function Kz({keyframes:t,restDelta:e,restSpeed:r,...n}){const i=t[0],s=t[t.length-1],o={done:!1,value:i},{stiffness:a,damping:c,mass:l,duration:f,velocity:u,isResolvedFromDuration:p}=Tde({...n,velocity:-ou(n.velocity||0)}),g=u||0,y=c/(2*Math.sqrt(a*l)),b=s-i,I=ou(Math.sqrt(a/l)),C=Math.abs(b)<5;r||(r=C?.01:2),e||(e=C?.005:.5);let S;if(y<1){const O=l7(I,y);S=L=>{const F=Math.exp(-y*I*L);return s-F*((g+y*I*b)/O*Math.sin(O*L)+b*Math.cos(O*L))}}else if(y===1)S=O=>s-Math.exp(-I*O)*(b+(g+I*b)*O);else{const O=I*Math.sqrt(y*y-1);S=L=>{const F=Math.exp(-y*I*L),z=Math.min(O*L,300);return s-F*((g+y*I*b)*Math.sinh(z)+O*b*Math.cosh(z))/O}}return{calculatedDuration:p&&f||null,next:O=>{const L=S(O);if(p)o.done=O>=f;else{let F=0;y<1&&(F=O===0?su(g):Wz(S,O,L));const z=Math.abs(F)<=r,_=Math.abs(s-L)<=e;o.done=z&&_}return o.value=o.done?s:L,o}}}function dN({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:c,restDelta:l=.5,restSpeed:f}){const u=t[0],p={done:!1,value:u},g=$=>a!==void 0&&$c,y=$=>a===void 0?c:c===void 0||Math.abs(a-$)-b*Math.exp(-$/n),O=$=>C+S($),L=$=>{const ie=S($),ce=O($);p.done=Math.abs(ie)<=l,p.value=p.done?C:ce};let F,z;const _=$=>{g(p.value)&&(F=$,z=Kz({keyframes:[p.value,y(p.value)],velocity:Wz(O,$,p.value),damping:i,stiffness:s,restDelta:l,restSpeed:f}))};return _(0),{calculatedDuration:null,next:$=>{let ie=!1;return!z&&F===void 0&&(ie=!0,L($),_($)),F!==void 0&&$>=F?z.next($-F):(!ie&&L($),p)}}}const Yz=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,Pde=1e-7,kde=12;function Mde(t,e,r,n,i){let s,o,a=0;do o=e+(r-e)/2,s=Yz(o,n,i)-t,s>0?r=o:e=o;while(Math.abs(s)>Pde&&++aMde(s,0,1,t,r);return s=>s===0||s===1?s:Yz(i(s),e,n)}const Rde=sx(.42,0,1,1),Ode=sx(0,0,.58,1),Qz=sx(.42,0,.58,1),Dde=t=>Array.isArray(t)&&typeof t[0]!="number",Jz=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Zz=t=>e=>1-t(1-e),zT=t=>1-Math.sin(Math.acos(t)),Xz=Zz(zT),Nde=Jz(zT),eH=sx(.33,1.53,.69,.99),HT=Zz(eH),Bde=Jz(HT),Lde=t=>(t*=2)<1?.5*HT(t):.5*(2-Math.pow(2,-10*(t-1))),hN={linear:Ts,easeIn:Rde,easeInOut:Qz,easeOut:Ode,circIn:zT,circInOut:Nde,circOut:Xz,backIn:HT,backInOut:Bde,backOut:eH,anticipate:Lde},pN=t=>{if(Array.isArray(t)){r7(t.length===4);const[e,r,n,i]=t;return sx(e,r,n,i)}else if(typeof t=="string")return r7(hN[t]!==void 0),hN[t];return t},ow=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n},On=(t,e,r)=>t+(e-t)*r;function IA(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function Fde({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let i=0,s=0,o=0;if(!e)i=s=o=r;else{const a=r<.5?r*(1+e):r+e-r*e,c=2*r-a;i=IA(c,a,t+1/3),s=IA(c,a,t),o=IA(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}function h5(t,e){return r=>r>0?e:t}const TA=(t,e,r)=>{const n=t*t,i=r*(e*e-n)+n;return i<0?0:Math.sqrt(i)},jde=[a7,T0,cv],Ude=t=>jde.find(e=>e.test(t));function vN(t){const e=Ude(t);if(!e)return!1;let r=e.parse(t);return e===cv&&(r=Fde(r)),r}const gN=(t,e)=>{const r=vN(t),n=vN(e);if(!r||!n)return h5(t,e);const i={...r};return s=>(i.red=TA(r.red,n.red,s),i.green=TA(r.green,n.green,s),i.blue=TA(r.blue,n.blue,s),i.alpha=On(r.alpha,n.alpha,s),T0.transform(i))},f7=new Set(["none","hidden"]);function $de(t,e){return f7.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function qde(t,e){return r=>On(t,e,r)}function GT(t){return typeof t=="number"?qde:typeof t=="string"?RT(t)?h5:Cs.test(t)?gN:Hde:Array.isArray(t)?tH:typeof t=="object"?Cs.test(t)?gN:Vde:h5}function tH(t,e){const r=[...t],n=r.length,i=t.map((s,o)=>GT(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in n)r[s]=n[s](i);return r}}function zde(t,e){var r;const n=[],i={color:0,var:0,number:0};for(let s=0;s{const r=sh.createTransformer(e),n=sw(t),i=sw(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?f7.has(t)&&!i.values.length||f7.has(e)&&!n.values.length?$de(t,e):iu(tH(zde(n,i),i.values),r):h5(t,e)};function rH(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?On(t,e,r):GT(t)(t,e)}function Gde(t,e,r){const n=[],i=r||rH,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=Gde(e,n,i),a=o.length,c=l=>{let f=0;if(a>1)for(;fc(ih(t[0],t[s-1],l)):c}function Kde(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=ow(0,e,n);t.push(On(r,1,i))}}function Yde(t){const e=[0];return Kde(e,t.length-1),e}function Qde(t,e){return t.map(r=>r*e)}function Jde(t,e){return t.map(()=>e||Qz).splice(0,t.length-1)}function p5({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const i=Dde(n)?n.map(pN):pN(n),s={done:!1,value:e[0]},o=Qde(r&&r.length===e.length?r:Yde(e),t),a=Wde(o,e,{ease:Array.isArray(i)?i:Jde(e,i)});return{calculatedDuration:t,next:c=>(s.value=a(c),s.done=c>=t,s)}}const yN=2e4;function Zde(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e=yN?1/0:e}const Xde=t=>{const e=({timestamp:r})=>t(r);return{start:()=>nn.update(e,!0),stop:()=>pu(e),now:()=>Ji.isProcessing?Ji.timestamp:au.now()}},ehe={decay:dN,inertia:dN,tween:p5,keyframes:p5,spring:Kz},the=t=>t/100;class WT extends Hz{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:r,motionValue:n,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||$T,a=(c,l)=>this.onKeyframesResolved(c,l);this.resolver=new o(s,a,r,n,i),this.resolver.scheduleResolve()}initPlayback(e){const{type:r="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=ehe[r]||p5;let c,l;a!==p5&&typeof e[0]!="number"&&(c=iu(the,rH(e[0],e[1])),e=[0,100]);const f=a({...this.options,keyframes:e});s==="mirror"&&(l=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=Zde(f));const{calculatedDuration:u}=f,p=u+i,g=p*(n+1)-i;return{generator:f,mirroredGenerator:l,mapPercentToKeyframes:c,calculatedDuration:u,resolvedDuration:p,totalDuration:g}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,r=!1){const{resolved:n}=this;if(!n){const{keyframes:$}=this.options;return{done:!0,value:$[$.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:c,calculatedDuration:l,totalDuration:f,resolvedDuration:u}=n;if(this.startTime===null)return s.next(0);const{delay:p,repeat:g,repeatType:y,repeatDelay:b,onUpdate:I}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-f/this.speed,this.startTime)),r?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const C=this.currentTime-p*(this.speed>=0?1:-1),S=this.speed>=0?C<0:C>f;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let O=this.currentTime,L=s;if(g){const $=Math.min(this.currentTime,f)/u;let ie=Math.floor($),ce=$%1;!ce&&$>=1&&(ce=1),ce===1&&ie--,ie=Math.min(ie,g+1),!!(ie%2)&&(y==="reverse"?(ce=1-ce,b&&(ce-=b/u)):y==="mirror"&&(L=o)),O=ih(0,1,ce)*u}const F=S?{done:!1,value:c[0]}:L.next(O);a&&(F.value=a(F.value));let{done:z}=F;!S&&l!==null&&(z=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const _=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&z);return _&&i!==void 0&&(F.value=W4(c,this.options,i)),I&&I(F.value),_&&this.finish(),F}get duration(){const{resolved:e}=this;return e?ou(e.calculatedDuration):0}get time(){return ou(this.currentTime)}set time(e){e=su(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=ou(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Xde,onPlay:r,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),r&&r();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=n??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const nH=t=>Array.isArray(t)&&typeof t[0]=="number";function iH(t){return!!(!t||typeof t=="string"&&t in KT||nH(t)||Array.isArray(t)&&t.every(iH))}const Hm=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,KT={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Hm([0,.65,.55,1]),circOut:Hm([.55,0,1,.45]),backIn:Hm([.31,.01,.66,-.59]),backOut:Hm([.33,1.53,.69,.99])};function rhe(t){return sH(t)||KT.easeOut}function sH(t){if(t)return nH(t)?Hm(t):Array.isArray(t)?t.map(rhe):KT[t]}function nhe(t,e,r,{delay:n=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a,times:c}={}){const l={[e]:r};c&&(l.offset=c);const f=sH(a);return Array.isArray(f)&&(l.easing=f),t.animate(l,{delay:n,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}const ihe=zz(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),v5=10,she=2e4;function ohe(t){return t.type==="spring"||!iH(t.ease)}function ahe(t,e){const r=new WT({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let n={done:!1,value:t[0]};const i=[];let s=0;for(;!n.done&&sthis.onKeyframesResolved(o,a),r,n,i),this.resolver.scheduleResolve()}initPlayback(e,r){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:c,name:l,startTime:f}=this.options;if(!(!((n=c.owner)===null||n===void 0)&&n.current))return!1;if(ohe(this.options)){const{onComplete:p,onUpdate:g,motionValue:y,element:b,...I}=this.options,C=ahe(e,I);e=C.keyframes,e.length===1&&(e[1]=e[0]),i=C.duration,s=C.times,o=C.ease,a="keyframes"}const u=nhe(c.owner.current,l,e,{...this.options,duration:i,times:s,ease:o});return u.startTime=f??this.calcStartTime(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:p}=this.options;c.set(W4(e,this.options,r)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:r}=e;return ou(r)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:r}=e;return ou(r.currentTime||0)}set time(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.currentTime=su(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:r}=e;return r.playbackRate}set speed(e){const{resolved:r}=this;if(!r)return;const{animation:n}=r;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:r}=e;return r.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:r}=e;return r.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:r}=this;if(!r)return Ts;const{animation:n}=r;n.timeline=e,n.onfinish=null}return Ts}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.playState==="finished"&&this.updateFinishedPromise(),r.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:r}=e;r.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:r,keyframes:n,duration:i,type:s,ease:o,times:a}=e;if(r.playState==="idle"||r.playState==="finished")return;if(this.time){const{motionValue:l,onUpdate:f,onComplete:u,element:p,...g}=this.options,y=new WT({...g,keyframes:n,duration:i,type:s,ease:o,times:a,isGenerator:!0}),b=su(this.time);l.setWithVelocity(y.sample(b-v5).value,y.sample(b).value,v5)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:r,name:n,repeatDelay:i,repeatType:s,damping:o,type:a}=e;return ihe()&&n&&xz.has(n)&&r&&r.owner&&r.owner.current instanceof HTMLElement&&!r.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}function che(t,e){let r;const n=()=>{const{currentTime:i}=e,o=(i===null?0:i.value)/100;r!==o&&t(o),r=o};return nn.update(n,!0),()=>pu(n)}const lhe=zz(()=>window.ScrollTimeline!==void 0);class fhe{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,r){return Promise.all(this.animations).then(e).catch(r)}getAll(e){return this.animations[0][e]}setAll(e,r){for(let n=0;n{if(lhe()&&n.attachTimeline)n.attachTimeline(e);else return n.pause(),che(i=>{n.time=n.duration*i},e)});return()=>{r.forEach((n,i)=>{n&&n(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let r=0;rr[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const YT=(t,e,r,n={},i,s,o)=>a=>{const c=UT(n,t)||{},l=c.delay||n.delay||0;let{elapsed:f=0}=n;f=f-su(l);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...c,delay:-f,onUpdate:g=>{e.set(g),c.onUpdate&&c.onUpdate(g)},onComplete:()=>{a(),c.onComplete&&c.onComplete(),o&&o()},onStop:o,name:t,motionValue:e,element:s?void 0:i};Vue(c)||(u={...u,...que(t,u)}),u.duration&&(u.duration=su(u.duration)),u.repeatDelay&&(u.repeatDelay=su(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let p=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(p=!0)),p&&!s&&e.get()!==void 0){const g=W4(u.keyframes,c);if(g!==void 0)return nn.update(()=>{u.onUpdate(g),u.onComplete()}),new fhe([])}return!s&&mN.supports(u)?new mN(u):new WT(u)};class QT{constructor(){this.subscriptions=[]}add(e){return V4(this.subscriptions,e),()=>z4(this.subscriptions,e)}notify(e,r,n){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,n);else for(let s=0;s!isNaN(parseFloat(t));class oH{constructor(e,r={}){this.version="11.3.31",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(n,i=!0)=>{const s=au.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=au.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=uhe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new QT);const n=this.events[e].add(r);return e==="change"?()=>{n(),nn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e,r=!0){!r||!this.passiveEffect?this.updateAndNotify(e,r):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=au.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>bN)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,bN);return Gz(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function aw(t,e){return new oH(t,e)}function dhe(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,aw(r))}function hhe(t,e){const r=G4(t,e);let{transitionEnd:n={},transition:i={},...s}=r||{};s={...s,...n};for(const o in s){const a=mue(s[o]);dhe(t,o,a)}}function aH(t){return t.props[sz]}class phe extends oH{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(e){const r=Ez(e);if(!r)return;const n=this.counts.get(r)||0;this.counts.set(r,n+1),n===0&&(this.output.push(r),this.update());let i=!1;return()=>{if(i)return;i=!0;const s=this.counts.get(r)-1;this.counts.set(r,s),s===0&&(z4(this.output,r),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}function vhe(t){return!!(_s(t)&&t.add)}function u7(t,e){var r;if(!t.applyWillChange)return;let n=t.getValue("willChange");if(!n&&!(!((r=t.props.style)===null||r===void 0)&&r.willChange)&&(n=new phe("auto"),t.addValue("willChange",n)),vhe(n))return n.add(e)}function ghe({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function cH(t,e,{delay:r=0,transitionOverride:n,type:i}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...c}=e;n&&(o=n);const l=[],f=i&&t.animationState&&t.animationState.getState()[i];for(const u in c){const p=t.getValue(u,(s=t.latestValues[u])!==null&&s!==void 0?s:null),g=c[u];if(g===void 0||f&&ghe(f,u))continue;const y={delay:r,...UT(o||{},u)};let b=!1;if(window.MotionHandoffAnimation){const C=aH(t);if(C){const S=window.MotionHandoffAnimation(C,u,nn);S!==null&&(y.startTime=S,b=!0)}}p.start(YT(u,p,g,t.shouldReduceMotion&&Ch.has(u)?{type:!1}:y,t,b,u7(t,u)));const I=p.animation;I&&l.push(I)}return a&&Promise.all(l).then(()=>{nn.update(()=>{a&&hhe(t,a)})}),l}function d7(t,e,r={}){var n;const i=G4(t,e,r.type==="exit"?(n=t.presenceContext)===null||n===void 0?void 0:n.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};r.transitionOverride&&(s=r.transitionOverride);const o=i?()=>Promise.all(cH(t,i,r)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:f=0,staggerChildren:u,staggerDirection:p}=s;return yhe(t,e,f+l,u,p,r)}:()=>Promise.resolve(),{when:c}=s;if(c){const[l,f]=c==="beforeChildren"?[o,a]:[a,o];return l().then(()=>f())}else return Promise.all([o(),a(r.delay)])}function yhe(t,e,r=0,n=0,i=1,s){const o=[],a=(t.variantChildren.size-1)*n,c=i===1?(l=0)=>l*n:(l=0)=>a-l*n;return Array.from(t.variantChildren).sort(mhe).forEach((l,f)=>{l.notify("AnimationStart",e),o.push(d7(l,e,{...s,delay:r+c(f)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function mhe(t,e){return t.sortNodePosition(e)}function bhe(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const i=e.map(s=>d7(t,s,r));n=Promise.all(i)}else if(typeof e=="string")n=d7(t,e,r);else{const i=typeof e=="function"?G4(t,e,r.custom):e;n=Promise.all(cH(t,i,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}const whe=[..._T].reverse(),xhe=_T.length;function Ehe(t){return e=>Promise.all(e.map(({animation:r,options:n})=>bhe(t,r,n)))}function Che(t){let e=Ehe(t),r=wN(),n=!0;const i=c=>(l,f)=>{var u;const p=G4(t,f,c==="exit"?(u=t.presenceContext)===null||u===void 0?void 0:u.custom:void 0);if(p){const{transition:g,transitionEnd:y,...b}=p;l={...l,...b,...y}}return l};function s(c){e=c(t)}function o(c){const l=t.getProps(),f=t.getVariantContext(!0)||{},u=[],p=new Set;let g={},y=1/0;for(let I=0;Iy&&L,ie=!1;const ce=Array.isArray(O)?O:[O];let K=ce.reduce(i(C),{});F===!1&&(K={});const{prevResolvedValues:P={}}=S,M={...P,...K},v=m=>{$=!0,p.has(m)&&(ie=!0,p.delete(m)),S.needsAnimating[m]=!0;const R=t.getValue(m);R&&(R.liveStyle=!1)};for(const m in M){const R=K[m],B=P[m];if(g.hasOwnProperty(m))continue;let E=!1;n7(R)&&n7(B)?E=!Pz(R,B):E=R!==B,E?R!=null?v(m):p.add(m):R!==void 0&&p.has(m)?v(m):S.protectedKeys[m]=!0}S.prevProp=O,S.prevResolvedValues=K,S.isActive&&(g={...g,...K}),n&&t.blockInitialAnimation&&($=!1),$&&(!z||ie)&&u.push(...ce.map(m=>({animation:m,options:{type:C}})))}if(p.size){const I={};p.forEach(C=>{const S=t.getBaseTarget(C),O=t.getValue(C);O&&(O.liveStyle=!0),I[C]=S??null}),u.push({animation:I})}let b=!!u.length;return n&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(b=!1),n=!1,b?e(u):Promise.resolve()}function a(c,l){var f;if(r[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(p=>{var g;return(g=p.animationState)===null||g===void 0?void 0:g.setActive(c,l)}),r[c].isActive=l;const u=o(c);for(const p in r)r[p].protectedKeys={};return u}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>r,reset:()=>{r=wN(),n=!0}}}function Ahe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Pz(e,t):!1}function r0(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wN(){return{animate:r0(!0),whileInView:r0(),whileHover:r0(),whileTap:r0(),whileDrag:r0(),whileFocus:r0(),exit:r0()}}class She extends Ah{constructor(e){super(e),e.animationState||(e.animationState=Che(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();iw(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let _he=0;class Ihe extends Ah{constructor(){super(...arguments),this.id=_he++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);r&&!e&&i.then(()=>r(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const The={animation:{Feature:She},exit:{Feature:Ihe}},xN=(t,e)=>Math.abs(t-e);function Phe(t,e){const r=xN(t.x,e.x),n=xN(t.y,e.y);return Math.sqrt(r**2+n**2)}class lH{constructor(e,r,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=kA(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=Phe(u.offset,{x:0,y:0})>=3;if(!p&&!g)return;const{point:y}=u,{timestamp:b}=Ji;this.history.push({...y,timestamp:b});const{onStart:I,onMove:C}=this.handlers;p||(I&&I(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,u)},this.handlePointerMove=(u,p)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=PA(p,this.transformPagePoint),nn.update(this.updatePoint,!0)},this.handlePointerUp=(u,p)=>{this.end();const{onEnd:g,onSessionEnd:y,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const I=kA(u.type==="pointercancel"?this.lastMoveEventInfo:PA(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(u,I),y&&y(u,I)},!Az(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=n,this.contextWindow=i||window;const o=H4(e),a=PA(o,this.transformPagePoint),{point:c}=a,{timestamp:l}=Ji;this.history=[{...c,timestamp:l}];const{onSessionStart:f}=r;f&&f(e,kA(a,this.history)),this.removeListeners=iu(nu(this.contextWindow,"pointermove",this.handlePointerMove),nu(this.contextWindow,"pointerup",this.handlePointerUp),nu(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),pu(this.updatePoint)}}function PA(t,e){return e?{point:e(t.point)}:t}function EN(t,e){return{x:t.x-e.x,y:t.y-e.y}}function kA({point:t},e){return{point:t,delta:EN(t,fH(e)),offset:EN(t,khe(e)),velocity:Mhe(e,.1)}}function khe(t){return t[0]}function fH(t){return t[t.length-1]}function Mhe(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const i=fH(t);for(;r>=0&&(n=t[r],!(i.timestamp-n.timestamp>su(e)));)r--;if(!n)return{x:0,y:0};const s=ou(i.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-n.x)/s,y:(i.y-n.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const uH=1e-4,Rhe=1-uH,Ohe=1+uH,dH=.01,Dhe=0-dH,Nhe=0+dH;function pa(t){return t.max-t.min}function Bhe(t,e,r){return Math.abs(t-e)<=r}function CN(t,e,r,n=.5){t.origin=n,t.originPoint=On(e.min,e.max,t.origin),t.scale=pa(r)/pa(e),t.translate=On(r.min,r.max,t.origin)-t.originPoint,(t.scale>=Rhe&&t.scale<=Ohe||isNaN(t.scale))&&(t.scale=1),(t.translate>=Dhe&&t.translate<=Nhe||isNaN(t.translate))&&(t.translate=0)}function Eb(t,e,r,n){CN(t.x,e.x,r.x,n?n.originX:void 0),CN(t.y,e.y,r.y,n?n.originY:void 0)}function AN(t,e,r){t.min=r.min+e.min,t.max=t.min+pa(e)}function Lhe(t,e,r){AN(t.x,e.x,r.x),AN(t.y,e.y,r.y)}function SN(t,e,r){t.min=e.min-r.min,t.max=t.min+pa(e)}function Cb(t,e,r){SN(t.x,e.x,r.x),SN(t.y,e.y,r.y)}function Fhe(t,{min:e,max:r},n){return e!==void 0&&tr&&(t=n?On(r,t,n.max):Math.min(t,r)),t}function _N(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function jhe(t,{top:e,left:r,bottom:n,right:i}){return{x:_N(t.x,r,i),y:_N(t.y,e,n)}}function IN(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.minn?r=ow(e.min,e.max-n,t.min):n>i&&(r=ow(t.min,t.max-i,e.min)),ih(0,1,r)}function qhe(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const h7=.35;function Vhe(t=h7){return t===!1?t=0:t===!0&&(t=h7),{x:TN(t,"left","right"),y:TN(t,"top","bottom")}}function TN(t,e,r){return{min:PN(t,e),max:PN(t,r)}}function PN(t,e){return typeof t=="number"?t:t[e]||0}const kN=()=>({translate:0,scale:1,origin:0,originPoint:0}),lv=()=>({x:kN(),y:kN()}),MN=()=>({min:0,max:0}),ti=()=>({x:MN(),y:MN()});function Fa(t){return[t("x"),t("y")]}function hH({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function zhe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Hhe(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function MA(t){return t===void 0||t===1}function p7({scale:t,scaleX:e,scaleY:r}){return!MA(t)||!MA(e)||!MA(r)}function d0(t){return p7(t)||pH(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function pH(t){return RN(t.x)||RN(t.y)}function RN(t){return t&&t!=="0%"}function g5(t,e,r){const n=t-r,i=e*n;return r+i}function ON(t,e,r,n,i){return i!==void 0&&(t=g5(t,i,n)),g5(t,r,n)+e}function v7(t,e=0,r=1,n,i){t.min=ON(t.min,e,r,n,i),t.max=ON(t.max,e,r,n,i)}function vH(t,{x:e,y:r}){v7(t.x,e.translate,e.scale,e.originPoint),v7(t.y,r.translate,r.scale,r.originPoint)}const DN=.999999999999,NN=1.0000000000001;function Ghe(t,e,r,n=!1){const i=r.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;aDN&&(e.x=1),e.yDN&&(e.y=1)}function fv(t,e){t.min=t.min+e,t.max=t.max+e}function BN(t,e,r,n,i=.5){const s=On(t.min,t.max,i);v7(t,e,r,s,n)}function uv(t,e){BN(t.x,e.x,e.scaleX,e.scale,e.originX),BN(t.y,e.y,e.scaleY,e.scale,e.originY)}function gH(t,e){return hH(Hhe(t.getBoundingClientRect(),e))}function Whe(t,e,r){const n=gH(t,r),{scroll:i}=e;return i&&(fv(n.x,i.offset.x),fv(n.y,i.offset.y)),n}const yH=({current:t})=>t?t.ownerDocument.defaultView:null,Khe=new WeakMap;class Yhe{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ti(),this.visualElement=e}start(e,{snapToCursor:r=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;const i=f=>{const{dragSnapToOrigin:u}=this.getProps();u?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(H4(f,"page").point)},s=(f,u)=>{var p;const{drag:g,dragPropagation:y,onDragStart:b}=this.getProps();if(g&&!y&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=_z(g),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Fa(C=>{let S=this.getAxisMotionValue(C).get()||0;if(ql.test(S)){const{projection:O}=this.visualElement;if(O&&O.layout){const L=O.layout.layoutBox[C];L&&(S=pa(L)*(parseFloat(S)/100))}}this.originPoint[C]=S}),b&&nn.postRender(()=>b(f,u)),(p=this.removeWillChange)===null||p===void 0||p.call(this),this.removeWillChange=u7(this.visualElement,"transform");const{animationState:I}=this.visualElement;I&&I.setActive("whileDrag",!0)},o=(f,u)=>{const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:y,onDrag:b}=this.getProps();if(!p&&!this.openGlobalLock)return;const{offset:I}=u;if(g&&this.currentDirection===null){this.currentDirection=Qhe(I),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",u.point,I),this.updateAxis("y",u.point,I),this.visualElement.render(),b&&b(f,u)},a=(f,u)=>this.stop(f,u),c=()=>Fa(f=>{var u;return this.getAnimationState(f)==="paused"&&((u=this.getAxisMotionValue(f).animation)===null||u===void 0?void 0:u.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new lH(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:yH(this.visualElement)})}stop(e,r){var n;(n=this.removeWillChange)===null||n===void 0||n.call(this);const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&nn.postRender(()=>o(e,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:i}=this.getProps();if(!n||!e6(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=Fhe(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:r,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;r&&av(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&i?this.constraints=jhe(i.layoutBox,r):this.constraints=!1,this.elastic=Vhe(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Fa(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=qhe(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!av(e))return!1;const n=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=Whe(n,i.root,this.visualElement.getTransformPagePoint());let o=Uhe(i.layout.layoutBox,s);if(r){const a=r(zhe(o));this.hasMutatedConstraints=!!a,a&&(o=hH(a))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=Fa(f=>{if(!e6(f,r,this.currentDirection))return;let u=c&&c[f]||{};o&&(u={min:0,max:0});const p=i?200:1e6,g=i?40:1e7,y={type:"inertia",velocity:n?e[f]:0,bounceStiffness:p,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...s,...u};return this.startAxisValueAnimation(f,y)});return Promise.all(l).then(a)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return n.start(YT(e,n,0,r,this.visualElement,!1,u7(this.visualElement,e)))}stopAnimation(){Fa(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Fa(e=>{var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.pause()})}getAnimationState(e){var r;return(r=this.getAxisMotionValue(e).animation)===null||r===void 0?void 0:r.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),i=n[r];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Fa(r=>{const{drag:n}=this.getProps();if(!e6(r,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(r);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[r];s.set(e[r]-On(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!av(r)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Fa(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const c=a.get();i[o]=$he({min:c,max:c},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),Fa(o=>{if(!e6(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(On(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Khe.set(this.visualElement,this);const e=this.visualElement.current,r=nu(e,"pointerdown",c=>{const{drag:l,dragListener:f=!0}=this.getProps();l&&f&&this.start(c)}),n=()=>{const{dragConstraints:c}=this.getProps();av(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",n);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),nn.read(n);const o=Zf(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(Fa(f=>{const u=this.getAxisMotionValue(f);u&&(this.originPoint[f]+=c[f].translate,u.set(u.get()+c[f].translate))}),this.visualElement.render())});return()=>{o(),r(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=h7,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function e6(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function Qhe(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class Jhe extends Ah{constructor(e){super(e),this.removeGroupControls=Ts,this.removeListeners=Ts,this.controls=new Yhe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ts}unmount(){this.removeGroupControls(),this.removeListeners()}}const LN=t=>(e,r)=>{t&&nn.postRender(()=>t(e,r))};class Zhe extends Ah{constructor(){super(...arguments),this.removePointerDownListener=Ts}onPointerDown(e){this.session=new lH(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:yH(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:LN(e),onStart:LN(r),onMove:n,onEnd:(s,o)=>{delete this.session,i&&nn.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=nu(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Xhe(){const t=D.useContext(U4);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:r,register:n}=t,i=D.useId();D.useEffect(()=>n(i),[]);const s=D.useCallback(()=>r&&r(i),[i,r]);return!e&&r?[!1,s]:[!0]}const X6={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function FN(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const xm={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Yt.test(t))t=parseFloat(t);else return t;const r=FN(t,e.target.x),n=FN(t,e.target.y);return`${r}% ${n}%`}},e0e={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,i=sh.parse(t);if(i.length>5)return n;const s=sh.createTransformer(t),o=typeof i[0]!="number"?1:0,a=r.x.scale*e.x,c=r.y.scale*e.y;i[0+o]/=a,i[1+o]/=c;const l=On(a,c,.5);return typeof i[2+o]=="number"&&(i[2+o]/=l),typeof i[3+o]=="number"&&(i[3+o]/=l),s(i)}};class t0e extends D.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;Kfe(r0e),s&&(r.group&&r.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),X6.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:i,isPresent:s}=this.props,o=n.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==r||r===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||nn.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ST.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function mH(t){const[e,r]=Xhe(),n=D.useContext(TT);return W.jsx(t0e,{...t,layoutGroup:n,switchLayoutGroup:D.useContext(az),isPresent:e,safeToRemove:r})}const r0e={borderRadius:{...xm,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:xm,borderTopRightRadius:xm,borderBottomLeftRadius:xm,borderBottomRightRadius:xm,boxShadow:e0e},bH=["TopLeft","TopRight","BottomLeft","BottomRight"],n0e=bH.length,jN=t=>typeof t=="string"?parseFloat(t):t,UN=t=>typeof t=="number"||Yt.test(t);function i0e(t,e,r,n,i,s){i?(t.opacity=On(0,r.opacity!==void 0?r.opacity:1,s0e(n)),t.opacityExit=On(e.opacity!==void 0?e.opacity:1,0,o0e(n))):s&&(t.opacity=On(e.opacity!==void 0?e.opacity:1,r.opacity!==void 0?r.opacity:1,n));for(let o=0;one?1:r(ow(t,e,n))}function qN(t,e){t.min=e.min,t.max=e.max}function Ma(t,e){qN(t.x,e.x),qN(t.y,e.y)}function VN(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function zN(t,e,r,n,i){return t-=e,t=g5(t,1/r,n),i!==void 0&&(t=g5(t,1/i,n)),t}function a0e(t,e=0,r=1,n=.5,i,s=t,o=t){if(ql.test(e)&&(e=parseFloat(e),e=On(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=On(s.min,s.max,n);t===s&&(a-=e),t.min=zN(t.min,e,r,a,i),t.max=zN(t.max,e,r,a,i)}function HN(t,e,[r,n,i],s,o){a0e(t,e[r],e[n],e[i],e.scale,s,o)}const c0e=["x","scaleX","originX"],l0e=["y","scaleY","originY"];function GN(t,e,r,n){HN(t.x,e,c0e,r?r.x:void 0,n?n.x:void 0),HN(t.y,e,l0e,r?r.y:void 0,n?n.y:void 0)}function WN(t){return t.translate===0&&t.scale===1}function xH(t){return WN(t.x)&&WN(t.y)}function KN(t,e){return t.min===e.min&&t.max===e.max}function f0e(t,e){return KN(t.x,e.x)&&KN(t.y,e.y)}function YN(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function EH(t,e){return YN(t.x,e.x)&&YN(t.y,e.y)}function QN(t){return pa(t.x)/pa(t.y)}function JN(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class u0e{constructor(){this.members=[]}add(e){V4(this.members,e),e.scheduleRender()}remove(e){if(z4(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(i=>e===i);if(r===0)return!1;let n;for(let i=r;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){n=s;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function d0e(t,e,r){let n="";const i=t.x.translate/e.x,s=t.y.translate/e.y,o=(r==null?void 0:r.z)||0;if((i||s||o)&&(n=`translate3d(${i}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:l,rotate:f,rotateX:u,rotateY:p,skewX:g,skewY:y}=r;l&&(n=`perspective(${l}px) ${n}`),f&&(n+=`rotate(${f}deg) `),u&&(n+=`rotateX(${u}deg) `),p&&(n+=`rotateY(${p}deg) `),g&&(n+=`skewX(${g}deg) `),y&&(n+=`skewY(${y}deg) `)}const a=t.x.scale*e.x,c=t.y.scale*e.y;return(a!==1||c!==1)&&(n+=`scale(${a}, ${c})`),n||"none"}const h0e=(t,e)=>t.depth-e.depth;class p0e{constructor(){this.children=[],this.isDirty=!1}add(e){V4(this.children,e),this.isDirty=!0}remove(e){z4(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(h0e),this.isDirty=!1,this.children.forEach(e)}}function v0e(t,e){const r=au.now(),n=({timestamp:i})=>{const s=i-r;s>=e&&(pu(n),t(s-e))};return nn.read(n,!0),()=>pu(n)}function g0e(t){return t instanceof SVGElement&&t.tagName!=="svg"}function y0e(t,e,r){const n=_s(t)?t:aw(t);return n.start(YT("",n,e,r)),n.animation}const h0={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Gm=typeof window<"u"&&window.MotionDebug!==void 0,RA=["","X","Y","Z"],m0e={visibility:"hidden"},ZN=1e3;let b0e=0;function OA(t,e,r,n){const{latestValues:i}=e;i[t]&&(r[t]=i[t],e.setStaticValue(t,0),n&&(n[t]=0))}function CH(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=aH(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:i,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",nn,!(i||s))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&CH(n)}function AH({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:i}){return class{constructor(o={},a=e==null?void 0:e()){this.id=b0e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Gm&&(h0.totalNodes=h0.resolvedTargetDeltas=h0.recalculatedProjection=0),this.nodes.forEach(E0e),this.nodes.forEach(I0e),this.nodes.forEach(T0e),this.nodes.forEach(C0e),Gm&&window.MotionDebug.record(h0)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,u&&u(),u=v0e(p,250),X6.hasAnimatedSinceResize&&(X6.hasAnimatedSinceResize=!1,this.nodes.forEach(eB))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&f&&(c||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:p,hasRelativeTargetChanged:g,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||f.getDefaultTransition()||O0e,{onLayoutAnimationStart:I,onLayoutAnimationComplete:C}=f.getProps(),S=!this.targetLayout||!EH(this.targetLayout,y)||g,O=!p&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||O||p&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(u,O);const L={...UT(b,"layout"),onPlay:I,onComplete:C};(f.shouldReduceMotion||this.options.layoutRoot)&&(L.delay=0,L.type=!1),this.startAnimation(L)}else p||eB(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,pu(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(P0e),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&CH(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const F=L/1e3;tB(u.x,o.x,F),tB(u.y,o.y,F),this.setTargetDelta(u),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cb(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),M0e(this.relativeTarget,this.relativeTargetOrigin,p,F),O&&f0e(this.relativeTarget,O)&&(this.isProjectionDirty=!1),O||(O=ti()),Ma(O,this.relativeTarget)),b&&(this.animationValues=f,i0e(f,l,this.latestValues,F,S,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=F},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(pu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=nn.update(()=>{X6.hasAnimatedSinceResize=!0,this.currentAnimation=y0e(0,ZN,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ZN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:f}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&SH(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||ti();const u=pa(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+u;const p=pa(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+p}Ma(a,c),uv(a,f),Eb(this.projectionDeltaWithTransform,this.layoutCorrected,a,f)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new u0e),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;const l={};c.z&&OA("z",o,l,this.animationValues);for(let f=0;f{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(XN),this.root.sharedNodes.clear()}}}function w0e(t){t.updateLayout()}function x0e(t){var e;const r=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&r&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=r.source!==t.layout.source;s==="size"?Fa(u=>{const p=o?r.measuredBox[u]:r.layoutBox[u],g=pa(p);p.min=n[u].min,p.max=p.min+g}):SH(s,r.layoutBox,n)&&Fa(u=>{const p=o?r.measuredBox[u]:r.layoutBox[u],g=pa(n[u]);p.max=p.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+g)});const a=lv();Eb(a,n,r.layoutBox);const c=lv();o?Eb(c,t.applyTransform(i,!0),r.measuredBox):Eb(c,n,r.layoutBox);const l=!xH(a);let f=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:p,layout:g}=u;if(p&&g){const y=ti();Cb(y,r.layoutBox,p.layoutBox);const b=ti();Cb(b,n,g.layoutBox),EH(y,b)||(f=!0),u.options.layoutRoot&&(t.relativeTarget=b,t.relativeTargetOrigin=y,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:f})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function E0e(t){Gm&&h0.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function C0e(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function A0e(t){t.clearSnapshot()}function XN(t){t.clearMeasurements()}function S0e(t){t.isLayoutDirty=!1}function _0e(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function eB(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function I0e(t){t.resolveTargetDelta()}function T0e(t){t.calcProjection()}function P0e(t){t.resetSkewAndRotation()}function k0e(t){t.removeLeadSnapshot()}function tB(t,e,r){t.translate=On(e.translate,0,r),t.scale=On(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function rB(t,e,r,n){t.min=On(e.min,r.min,n),t.max=On(e.max,r.max,n)}function M0e(t,e,r,n){rB(t.x,e.x,r.x,n),rB(t.y,e.y,r.y,n)}function R0e(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const O0e={duration:.45,ease:[.4,0,.1,1]},nB=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),iB=nB("applewebkit/")&&!nB("chrome/")?Math.round:Ts;function sB(t){t.min=iB(t.min),t.max=iB(t.max)}function D0e(t){sB(t.x),sB(t.y)}function SH(t,e,r){return t==="position"||t==="preserve-aspect"&&!Bhe(QN(e),QN(r),.2)}function N0e(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const B0e=AH({attachResizeListener:(t,e)=>Zf(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),DA={current:void 0},_H=AH({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!DA.current){const t=new B0e({});t.mount(window),t.setOptions({layoutScroll:!0}),DA.current=t}return DA.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),L0e={pan:{Feature:Zhe},drag:{Feature:Jhe,ProjectionNode:_H,MeasureLayout:mH}},g7={current:null},IH={current:!1};function F0e(){if(IH.current=!0,!!AT)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>g7.current=t.matches;t.addListener(e),e()}else g7.current=!1}function j0e(t,e,r){for(const n in e){const i=e[n],s=r[n];if(_s(i))t.addValue(n,i);else if(_s(s))t.addValue(n,aw(i,{owner:t}));else if(s!==i)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(n);t.addValue(n,aw(o!==void 0?o:i,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const oB=new WeakMap,U0e=[...Dz,Cs,sh],$0e=t=>U0e.find(Oz(t)),aB=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],q0e=IT.length;class V0e{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=$T,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,nn.render(this.render,!1,!0))};const{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=r.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=q4(r),this.isVariantNode=lz(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:f,...u}=this.scrapeMotionValuesFromProps(r,{},this);for(const p in u){const g=u[p];c[p]!==void 0&&_s(g)&&g.set(c[p],!1)}}mount(e){this.current=e,oB.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),IH.current||F0e(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:g7.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){oB.delete(this.current),this.projection&&this.projection.unmount(),pu(this.notifyUpdate),pu(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Ch.has(e),i=r.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&nn.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),s=r.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{i(),s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in $g){const r=$g[e];if(!r)continue;const{isEnabled:n,Feature:i}=r;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ti()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;nr.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=aw(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){var n;let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(Mz(i)||kz(i))?i=parseFloat(i):!$0e(i)&&sh.test(r)&&(i=qz(e,r)),this.setBaseTarget(e,_s(i)?i.get():i)),_s(i)?i.get():i}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var r;const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const o=FT(this.props,n,(r=this.presenceContext)===null||r===void 0?void 0:r.custom);o&&(i=o[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!_s(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new QT),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}}class TH extends V0e{constructor(){super(...arguments),this.KeyframeResolver=Vz}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}}function z0e(t){return window.getComputedStyle(t)}class H0e extends TH{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=yz}readValueFromInstance(e,r){if(Ch.has(r)){const n=VT(r);return n&&n.default||0}else{const n=z0e(e),i=(hz(r)?n.getPropertyValue(r):n[r])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:r}){return gH(e,r)}build(e,r,n){OT(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return LT(e,r,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;_s(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class G0e extends TH{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ti}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Ch.has(r)){const n=VT(r);return n&&n.default||0}return r=mz.has(r)?r:$4(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return wz(e,r,n)}build(e,r,n){NT(e,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,r,n,i){bz(e,r,n,i)}mount(e){this.isSVGTag=BT(e.tagName),super.mount(e)}}const W0e=(t,e)=>PT(t)?new G0e(e):new H0e(e,{allowProjection:t!==D.Fragment}),K0e={layout:{ProjectionNode:_H,MeasureLayout:mH}},Y0e={...The,...Lue,...L0e,...K0e},cp=Gfe((t,e)=>Aue(t,e,Y0e,W0e));class Q0e extends D.Component{getSnapshotBeforeUpdate(e){const r=this.props.childRef.current;if(r&&e.isPresent&&!this.props.isPresent){const n=this.props.sizeRef.current;n.height=r.offsetHeight||0,n.width=r.offsetWidth||0,n.top=r.offsetTop,n.left=r.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function J0e({children:t,isPresent:e}){const r=D.useId(),n=D.useRef(null),i=D.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=D.useContext(CT);return D.useInsertionEffect(()=>{const{width:o,height:a,top:c,left:l}=i.current;if(e||!n.current||!o||!a)return;n.current.dataset.motionPopId=r;const f=document.createElement("style");return s&&(f.nonce=s),document.head.appendChild(f),f.sheet&&f.sheet.insertRule(` [data-motion-pop-id="${r}"] { position: absolute !important; width: ${o}px !important; @@ -124,7 +124,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function dw(){return dw=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function HK(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Fxe(){return Math.random().toString(36).substr(2,8)}function eL(t,e){return{usr:t.state,key:t.key,idx:e}}function j7(t,e,r,n){return r===void 0&&(r=null),dw({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?wy(e):e,{state:r,key:e&&e.key||n||Fxe()})}function _5(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 wy(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 jxe(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,a=Bd.Pop,c=null,l=f();l==null&&(l=0,o.replaceState(dw({},o.state,{idx:l}),""));function f(){return(o.state||{idx:null}).idx}function u(){a=Bd.Pop;let I=f(),C=I==null?null:I-l;l=I,c&&c({action:a,location:b.location,delta:C})}function p(I,C){a=Bd.Push;let S=j7(b.location,I,C);l=f()+1;let O=eL(S,l),L=b.createHref(S);try{o.pushState(O,"",L)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;i.location.assign(L)}s&&c&&c({action:a,location:b.location,delta:1})}function g(I,C){a=Bd.Replace;let S=j7(b.location,I,C);l=f();let O=eL(S,l),L=b.createHref(S);o.replaceState(O,"",L),s&&c&&c({action:a,location:b.location,delta:0})}function y(I){let C=i.location.origin!=="null"?i.location.origin:i.location.href,S=typeof I=="string"?I:_5(I);return S=S.replace(/ $/,"%20"),li(C,"No window.location.(origin|href) available to create URL for href: "+S),new URL(S,C)}let b={get action(){return a},get location(){return t(i,o)},listen(I){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(XB,u),c=I,()=>{i.removeEventListener(XB,u),c=null}},createHref(I){return e(i,I)},createURL:y,encodeLocation(I){let C=y(I);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:p,replace:g,go(I){return o.go(I)}};return b}var tL;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(tL||(tL={}));function Uxe(t,e,r){return r===void 0&&(r="/"),$xe(t,e,r,!1)}function $xe(t,e,r,n){let i=typeof e=="string"?wy(e):e,s=ZP(i.pathname||"/",r);if(s==null)return null;let o=GK(t);qxe(o);let a=null;for(let c=0;a==null&&c{let c={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(li(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let l=Yd([n,c.relativePath]),f=r.concat(c);s.children&&s.children.length>0&&(li(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+l+'".')),GK(s.children,e,f,l)),!(s.path==null&&!s.index)&&e.push({path:l,score:Yxe(l,s.index),routesMeta:f})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let c of WK(s.path))i(s,o,c)}),e}function WK(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=WK(n.join("/")),a=[];return a.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&a.push(...o),a.map(c=>t.startsWith("/")&&c===""?"/":c)}function qxe(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Qxe(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Vxe=/^:[\w-]+$/,zxe=3,Hxe=2,Gxe=1,Wxe=10,Kxe=-2,rL=t=>t==="*";function Yxe(t,e){let r=t.split("/"),n=r.length;return r.some(rL)&&(n+=Kxe),e&&(n+=Hxe),r.filter(i=>!rL(i)).reduce((i,s)=>i+(Vxe.test(s)?zxe:s===""?Gxe:Wxe),n)}function Qxe(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 Jxe(t,e,r){let{routesMeta:n}=t,i={},s="/",o=[];for(let a=0;a{let{paramName:p,isOptional:g}=f;if(p==="*"){let b=a[u]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const y=a[u];return g&&!y?l[p]=void 0:l[p]=(y||"").replace(/%2F/g,"/"),l},{}),pathname:s,pathnameBase:o,pattern:t}}function Zxe(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),HK(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,(o,a,c)=>(n.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function Xxe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return HK(!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 ZP(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 e2e(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?wy(t):t;return{pathname:r?r.startsWith("/")?r:t2e(r,e):e,search:i2e(n),hash:s2e(i)}}function t2e(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 QA(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 r2e(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XP(t,e){let r=r2e(t);return e?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ek(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=wy(t):(i=dw({},t),li(!i.pathname||!i.pathname.includes("?"),QA("?","pathname","search",i)),li(!i.pathname||!i.pathname.includes("#"),QA("#","pathname","hash",i)),li(!i.search||!i.search.includes("#"),QA("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=r;else{let u=e.length-1;if(!n&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),u-=1;i.pathname=p.join("/")}a=u>=0?e[u]:"/"}let c=e2e(i,a),l=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(l||f)&&(c.pathname+="/"),c}const Yd=t=>t.join("/").replace(/\/\/+/g,"/"),n2e=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),i2e=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,s2e=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function o2e(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const KK=["post","put","patch","delete"];new Set(KK);const a2e=["get",...KK];new Set(a2e);/** + */function dw(){return dw=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function HK(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Fxe(){return Math.random().toString(36).substr(2,8)}function eL(t,e){return{usr:t.state,key:t.key,idx:e}}function j7(t,e,r,n){return r===void 0&&(r=null),dw({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?wy(e):e,{state:r,key:e&&e.key||n||Fxe()})}function _5(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 wy(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 jxe(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:s=!1}=n,o=i.history,a=Bd.Pop,c=null,l=f();l==null&&(l=0,o.replaceState(dw({},o.state,{idx:l}),""));function f(){return(o.state||{idx:null}).idx}function u(){a=Bd.Pop;let I=f(),C=I==null?null:I-l;l=I,c&&c({action:a,location:b.location,delta:C})}function p(I,C){a=Bd.Push;let S=j7(b.location,I,C);l=f()+1;let O=eL(S,l),L=b.createHref(S);try{o.pushState(O,"",L)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;i.location.assign(L)}s&&c&&c({action:a,location:b.location,delta:1})}function g(I,C){a=Bd.Replace;let S=j7(b.location,I,C);l=f();let O=eL(S,l),L=b.createHref(S);o.replaceState(O,"",L),s&&c&&c({action:a,location:b.location,delta:0})}function y(I){let C=i.location.origin!=="null"?i.location.origin:i.location.href,S=typeof I=="string"?I:_5(I);return S=S.replace(/ $/,"%20"),fi(C,"No window.location.(origin|href) available to create URL for href: "+S),new URL(S,C)}let b={get action(){return a},get location(){return t(i,o)},listen(I){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(XB,u),c=I,()=>{i.removeEventListener(XB,u),c=null}},createHref(I){return e(i,I)},createURL:y,encodeLocation(I){let C=y(I);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:p,replace:g,go(I){return o.go(I)}};return b}var tL;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(tL||(tL={}));function Uxe(t,e,r){return r===void 0&&(r="/"),$xe(t,e,r,!1)}function $xe(t,e,r,n){let i=typeof e=="string"?wy(e):e,s=ZP(i.pathname||"/",r);if(s==null)return null;let o=GK(t);qxe(o);let a=null;for(let c=0;a==null&&c{let c={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(fi(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let l=Yd([n,c.relativePath]),f=r.concat(c);s.children&&s.children.length>0&&(fi(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+l+'".')),GK(s.children,e,f,l)),!(s.path==null&&!s.index)&&e.push({path:l,score:Yxe(l,s.index),routesMeta:f})};return t.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let c of WK(s.path))i(s,o,c)}),e}function WK(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),s=r.replace(/\?$/,"");if(n.length===0)return i?[s,""]:[s];let o=WK(n.join("/")),a=[];return a.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&a.push(...o),a.map(c=>t.startsWith("/")&&c===""?"/":c)}function qxe(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:Qxe(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Vxe=/^:[\w-]+$/,zxe=3,Hxe=2,Gxe=1,Wxe=10,Kxe=-2,rL=t=>t==="*";function Yxe(t,e){let r=t.split("/"),n=r.length;return r.some(rL)&&(n+=Kxe),e&&(n+=Hxe),r.filter(i=>!rL(i)).reduce((i,s)=>i+(Vxe.test(s)?zxe:s===""?Gxe:Wxe),n)}function Qxe(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 Jxe(t,e,r){let{routesMeta:n}=t,i={},s="/",o=[];for(let a=0;a{let{paramName:p,isOptional:g}=f;if(p==="*"){let b=a[u]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const y=a[u];return g&&!y?l[p]=void 0:l[p]=(y||"").replace(/%2F/g,"/"),l},{}),pathname:s,pathnameBase:o,pattern:t}}function Zxe(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),HK(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,(o,a,c)=>(n.push({paramName:a,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function Xxe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return HK(!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 ZP(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 e2e(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?wy(t):t;return{pathname:r?r.startsWith("/")?r:t2e(r,e):e,search:i2e(n),hash:s2e(i)}}function t2e(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 QA(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 r2e(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XP(t,e){let r=r2e(t);return e?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ek(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=wy(t):(i=dw({},t),fi(!i.pathname||!i.pathname.includes("?"),QA("?","pathname","search",i)),fi(!i.pathname||!i.pathname.includes("#"),QA("#","pathname","hash",i)),fi(!i.search||!i.search.includes("#"),QA("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=r;else{let u=e.length-1;if(!n&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),u-=1;i.pathname=p.join("/")}a=u>=0?e[u]:"/"}let c=e2e(i,a),l=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(l||f)&&(c.pathname+="/"),c}const Yd=t=>t.join("/").replace(/\/\/+/g,"/"),n2e=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),i2e=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,s2e=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function o2e(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const KK=["post","put","patch","delete"];new Set(KK);const a2e=["get",...KK];new Set(a2e);/** * React Router v6.26.1 * * Copyright (c) Remix Software Inc. @@ -133,7 +133,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function hw(){return hw=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),D.useCallback(function(l,f){if(f===void 0&&(f={}),!a.current)return;if(typeof l=="number"){n.go(l);return}let u=ek(l,JSON.parse(o),s,f.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:Yd([e,u.pathname])),(f.replace?n.replace:n.push)(u,f.state,f)},[e,n,o,s,t])}function JK(t,e){let{relative:r}=e===void 0?{}:e,{future:n}=D.useContext(Th),{matches:i}=D.useContext(Ph),{pathname:s}=px(),o=JSON.stringify(XP(i,n.v7_relativeSplatPath));return D.useMemo(()=>ek(t,JSON.parse(o),s,r==="path"),[t,o,s,r])}function u2e(t,e){return d2e(t,e)}function d2e(t,e,r,n){xy()||li(!1);let{navigator:i}=D.useContext(Th),{matches:s}=D.useContext(Ph),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let l=px(),f;if(e){var u;let I=typeof e=="string"?wy(e):e;c==="/"||(u=I.pathname)!=null&&u.startsWith(c)||li(!1),f=I}else f=l;let p=f.pathname||"/",g=p;if(c!=="/"){let I=c.replace(/^\//,"").split("/");g="/"+p.replace(/^\//,"").split("/").slice(I.length).join("/")}let y=Uxe(t,{pathname:g}),b=y2e(y&&y.map(I=>Object.assign({},I,{params:Object.assign({},a,I.params),pathname:Yd([c,i.encodeLocation?i.encodeLocation(I.pathname).pathname:I.pathname]),pathnameBase:I.pathnameBase==="/"?c:Yd([c,i.encodeLocation?i.encodeLocation(I.pathnameBase).pathname:I.pathnameBase])})),s,r,n);return e&&b?D.createElement(T8.Provider,{value:{location:hw({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Bd.Pop}},b):b}function h2e(){let t=x2e(),e=o2e(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)"};return D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},e),r?D.createElement("pre",{style:i},r):null,null)}const p2e=D.createElement(h2e,null);class v2e extends D.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?D.createElement(Ph.Provider,{value:this.props.routeContext},D.createElement(YK.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function g2e(t){let{routeContext:e,match:r,children:n}=t,i=D.useContext(tk);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),D.createElement(Ph.Provider,{value:e},n)}function y2e(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,a=(i=r)==null?void 0:i.errors;if(a!=null){let f=o.findIndex(u=>u.route.id&&(a==null?void 0:a[u.route.id])!==void 0);f>=0||li(!1),o=o.slice(0,Math.min(o.length,f+1))}let c=!1,l=-1;if(r&&n&&n.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,l+1):o=[o[0]];break}}}return o.reduceRight((f,u,p)=>{let g,y=!1,b=null,I=null;r&&(g=a&&u.route.id?a[u.route.id]:void 0,b=u.route.errorElement||p2e,c&&(l<0&&p===0?(y=!0,I=null):l===p&&(y=!0,I=u.route.hydrateFallbackElement||null)));let C=e.concat(o.slice(0,p+1)),S=()=>{let O;return g?O=b:y?O=I:u.route.Component?O=D.createElement(u.route.Component,null):u.route.element?O=u.route.element:O=f,D.createElement(g2e,{match:u,routeContext:{outlet:f,matches:C,isDataRoute:r!=null},children:O})};return r&&(u.route.ErrorBoundary||u.route.errorElement||p===0)?D.createElement(v2e,{location:r.location,revalidation:r.revalidation,component:b,error:g,children:S(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):S()},null)}var ZK=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ZK||{}),I5=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}(I5||{});function m2e(t){let e=D.useContext(tk);return e||li(!1),e}function b2e(t){let e=D.useContext(c2e);return e||li(!1),e}function w2e(t){let e=D.useContext(Ph);return e||li(!1),e}function XK(t){let e=w2e(),r=e.matches[e.matches.length-1];return r.route.id||li(!1),r.route.id}function x2e(){var t;let e=D.useContext(YK),r=b2e(I5.UseRouteError),n=XK(I5.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function E2e(){let{router:t}=m2e(ZK.UseNavigateStable),e=XK(I5.UseNavigateStable),r=D.useRef(!1);return QK(()=>{r.current=!0}),D.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,hw({fromRouteId:e},s)))},[t,e])}function JA(t){let{to:e,replace:r,state:n,relative:i}=t;xy()||li(!1);let{future:s,static:o}=D.useContext(Th),{matches:a}=D.useContext(Ph),{pathname:c}=px(),l=rk(),f=ek(e,XP(a,s.v7_relativeSplatPath),c,i==="path"),u=JSON.stringify(f);return D.useEffect(()=>l(JSON.parse(u),{replace:r,state:n,relative:i}),[l,u,i,r,n]),null}function i3(t){li(!1)}function C2e(t){let{basename:e="/",children:r=null,location:n,navigationType:i=Bd.Pop,navigator:s,static:o=!1,future:a}=t;xy()&&li(!1);let c=e.replace(/^\/*/,"/"),l=D.useMemo(()=>({basename:c,navigator:s,static:o,future:hw({v7_relativeSplatPath:!1},a)}),[c,a,s,o]);typeof n=="string"&&(n=wy(n));let{pathname:f="/",search:u="",hash:p="",state:g=null,key:y="default"}=n,b=D.useMemo(()=>{let I=ZP(f,c);return I==null?null:{location:{pathname:I,search:u,hash:p,state:g,key:y},navigationType:i}},[c,f,u,p,g,y,i]);return b==null?null:D.createElement(Th.Provider,{value:l},D.createElement(T8.Provider,{children:r,value:b}))}function A2e(t){let{children:e,location:r}=t;return u2e(U7(e),r)}new Promise(()=>{});function U7(t,e){e===void 0&&(e=[]);let r=[];return D.Children.forEach(t,(n,i)=>{if(!D.isValidElement(n))return;let s=[...e,i];if(n.type===D.Fragment){r.push.apply(r,U7(n.props.children,s));return}n.type!==i3&&li(!1),!n.props.index||!n.props.children||li(!1);let o={id:n.props.id||s.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&&(o.children=U7(n.props.children,s)),r.push(o)}),r}/** + */function hw(){return hw=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),D.useCallback(function(l,f){if(f===void 0&&(f={}),!a.current)return;if(typeof l=="number"){n.go(l);return}let u=ek(l,JSON.parse(o),s,f.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:Yd([e,u.pathname])),(f.replace?n.replace:n.push)(u,f.state,f)},[e,n,o,s,t])}function JK(t,e){let{relative:r}=e===void 0?{}:e,{future:n}=D.useContext(Th),{matches:i}=D.useContext(Ph),{pathname:s}=px(),o=JSON.stringify(XP(i,n.v7_relativeSplatPath));return D.useMemo(()=>ek(t,JSON.parse(o),s,r==="path"),[t,o,s,r])}function u2e(t,e){return d2e(t,e)}function d2e(t,e,r,n){xy()||fi(!1);let{navigator:i}=D.useContext(Th),{matches:s}=D.useContext(Ph),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let l=px(),f;if(e){var u;let I=typeof e=="string"?wy(e):e;c==="/"||(u=I.pathname)!=null&&u.startsWith(c)||fi(!1),f=I}else f=l;let p=f.pathname||"/",g=p;if(c!=="/"){let I=c.replace(/^\//,"").split("/");g="/"+p.replace(/^\//,"").split("/").slice(I.length).join("/")}let y=Uxe(t,{pathname:g}),b=y2e(y&&y.map(I=>Object.assign({},I,{params:Object.assign({},a,I.params),pathname:Yd([c,i.encodeLocation?i.encodeLocation(I.pathname).pathname:I.pathname]),pathnameBase:I.pathnameBase==="/"?c:Yd([c,i.encodeLocation?i.encodeLocation(I.pathnameBase).pathname:I.pathnameBase])})),s,r,n);return e&&b?D.createElement(T8.Provider,{value:{location:hw({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Bd.Pop}},b):b}function h2e(){let t=x2e(),e=o2e(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)"};return D.createElement(D.Fragment,null,D.createElement("h2",null,"Unexpected Application Error!"),D.createElement("h3",{style:{fontStyle:"italic"}},e),r?D.createElement("pre",{style:i},r):null,null)}const p2e=D.createElement(h2e,null);class v2e extends D.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?D.createElement(Ph.Provider,{value:this.props.routeContext},D.createElement(YK.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function g2e(t){let{routeContext:e,match:r,children:n}=t,i=D.useContext(tk);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),D.createElement(Ph.Provider,{value:e},n)}function y2e(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var s;if(!r)return null;if(r.errors)t=r.matches;else if((s=n)!=null&&s.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let o=t,a=(i=r)==null?void 0:i.errors;if(a!=null){let f=o.findIndex(u=>u.route.id&&(a==null?void 0:a[u.route.id])!==void 0);f>=0||fi(!1),o=o.slice(0,Math.min(o.length,f+1))}let c=!1,l=-1;if(r&&n&&n.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,l+1):o=[o[0]];break}}}return o.reduceRight((f,u,p)=>{let g,y=!1,b=null,I=null;r&&(g=a&&u.route.id?a[u.route.id]:void 0,b=u.route.errorElement||p2e,c&&(l<0&&p===0?(y=!0,I=null):l===p&&(y=!0,I=u.route.hydrateFallbackElement||null)));let C=e.concat(o.slice(0,p+1)),S=()=>{let O;return g?O=b:y?O=I:u.route.Component?O=D.createElement(u.route.Component,null):u.route.element?O=u.route.element:O=f,D.createElement(g2e,{match:u,routeContext:{outlet:f,matches:C,isDataRoute:r!=null},children:O})};return r&&(u.route.ErrorBoundary||u.route.errorElement||p===0)?D.createElement(v2e,{location:r.location,revalidation:r.revalidation,component:b,error:g,children:S(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):S()},null)}var ZK=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ZK||{}),I5=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}(I5||{});function m2e(t){let e=D.useContext(tk);return e||fi(!1),e}function b2e(t){let e=D.useContext(c2e);return e||fi(!1),e}function w2e(t){let e=D.useContext(Ph);return e||fi(!1),e}function XK(t){let e=w2e(),r=e.matches[e.matches.length-1];return r.route.id||fi(!1),r.route.id}function x2e(){var t;let e=D.useContext(YK),r=b2e(I5.UseRouteError),n=XK(I5.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function E2e(){let{router:t}=m2e(ZK.UseNavigateStable),e=XK(I5.UseNavigateStable),r=D.useRef(!1);return QK(()=>{r.current=!0}),D.useCallback(function(i,s){s===void 0&&(s={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,hw({fromRouteId:e},s)))},[t,e])}function JA(t){let{to:e,replace:r,state:n,relative:i}=t;xy()||fi(!1);let{future:s,static:o}=D.useContext(Th),{matches:a}=D.useContext(Ph),{pathname:c}=px(),l=rk(),f=ek(e,XP(a,s.v7_relativeSplatPath),c,i==="path"),u=JSON.stringify(f);return D.useEffect(()=>l(JSON.parse(u),{replace:r,state:n,relative:i}),[l,u,i,r,n]),null}function i3(t){fi(!1)}function C2e(t){let{basename:e="/",children:r=null,location:n,navigationType:i=Bd.Pop,navigator:s,static:o=!1,future:a}=t;xy()&&fi(!1);let c=e.replace(/^\/*/,"/"),l=D.useMemo(()=>({basename:c,navigator:s,static:o,future:hw({v7_relativeSplatPath:!1},a)}),[c,a,s,o]);typeof n=="string"&&(n=wy(n));let{pathname:f="/",search:u="",hash:p="",state:g=null,key:y="default"}=n,b=D.useMemo(()=>{let I=ZP(f,c);return I==null?null:{location:{pathname:I,search:u,hash:p,state:g,key:y},navigationType:i}},[c,f,u,p,g,y,i]);return b==null?null:D.createElement(Th.Provider,{value:l},D.createElement(T8.Provider,{children:r,value:b}))}function A2e(t){let{children:e,location:r}=t;return u2e(U7(e),r)}new Promise(()=>{});function U7(t,e){e===void 0&&(e=[]);let r=[];return D.Children.forEach(t,(n,i)=>{if(!D.isValidElement(n))return;let s=[...e,i];if(n.type===D.Fragment){r.push.apply(r,U7(n.props.children,s));return}n.type!==i3&&fi(!1),!n.props.index||!n.props.children||fi(!1);let o={id:n.props.id||s.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&&(o.children=U7(n.props.children,s)),r.push(o)}),r}/** * React Router DOM v6.26.1 * * Copyright (c) Remix Software Inc. @@ -142,8 +142,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function $7(){return $7=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(r[i]=t[i]);return r}function _2e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function I2e(t,e){return t.button===0&&(!e||e==="_self")&&!_2e(t)}const T2e=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],P2e="6";try{window.__reactRouterVersion=P2e}catch{}const k2e="startTransition",iL=eq[k2e];function M2e(t){let{basename:e,children:r,future:n,window:i}=t,s=D.useRef();s.current==null&&(s.current=Lxe({window:i,v5Compat:!0}));let o=s.current,[a,c]=D.useState({action:o.action,location:o.location}),{v7_startTransition:l}=n||{},f=D.useCallback(u=>{l&&iL?iL(()=>c(u)):c(u)},[c,l]);return D.useLayoutEffect(()=>o.listen(f),[o,f]),D.createElement(C2e,{basename:e,children:r,location:a.location,navigationType:a.action,navigator:o,future:n})}const R2e=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",O2e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eY=D.forwardRef(function(e,r){let{onClick:n,relative:i,reloadDocument:s,replace:o,state:a,target:c,to:l,preventScrollReset:f,unstable_viewTransition:u}=e,p=S2e(e,T2e),{basename:g}=D.useContext(Th),y,b=!1;if(typeof l=="string"&&O2e.test(l)&&(y=l,R2e))try{let O=new URL(window.location.href),L=l.startsWith("//")?new URL(O.protocol+l):new URL(l),F=ZP(L.pathname,g);L.origin===O.origin&&F!=null?l=F+L.search+L.hash:b=!0}catch{}let I=l2e(l,{relative:i}),C=D2e(l,{replace:o,state:a,target:c,preventScrollReset:f,relative:i,unstable_viewTransition:u});function S(O){n&&n(O),O.defaultPrevented||C(O)}return D.createElement("a",$7({},p,{href:y||I,onClick:b||s?n:S,ref:r,target:c}))});var sL;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(sL||(sL={}));var oL;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(oL||(oL={}));function D2e(t,e){let{target:r,replace:n,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a}=e===void 0?{}:e,c=rk(),l=px(),f=JK(t,{relative:o});return D.useCallback(u=>{if(I2e(u,r)){u.preventDefault();let p=n!==void 0?n:_5(l)===_5(f);c(t,{replace:p,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a})}},[l,c,f,n,i,r,t,s,o,a])}const N2e=[{inputs:[{internalType:"bytes32",type:"bytes32"}],name:"getAlternativeSignature",outputs:[{internalType:"string",type:"string"}],stateMutability:"view",type:"function"}];var B2e=Object.freeze({__proto__:null,abi:N2e});const L2e=[{type:"function",name:"isValidSignature",constant:!0,inputs:[{type:"bytes32"},{type:"bytes"}],outputs:[{type:"bytes4"}],payable:!1,stateMutability:"view"}],F2e={isValidSignatureBytes32:"0x1626ba7e"};var j2e=Object.freeze({__proto__:null,abi:L2e,returns:F2e});const U2e=[{inputs:[{internalType:"bytes",name:"error",type:"bytes"}],name:"ERC1271Revert",type:"error"},{inputs:[{internalType:"bytes",name:"error",type:"bytes"}],name:"ERC6492DeployFailed",type:"error"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSig",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"allowSideEffects",type:"bool"},{internalType:"bool",name:"deployAlreadyDeployed",type:"bool"}],name:"isValidSigImpl",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSigNoThrow",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSigWithSideEffects",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSigWithSideEffectsNoThrow",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];var $2e=Object.freeze({__proto__:null,abi:U2e});const q2e=[{type:"function",name:"deploy",constant:!1,inputs:[{type:"address"},{type:"bytes32"}],outputs:[],payable:!0,stateMutability:"payable"}];var V2e=Object.freeze({__proto__:null,abi:q2e});const z2e=[{type:"function",name:"nonce",constant:!0,inputs:[],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"readNonce",constant:!0,inputs:[{type:"uint256"}],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"updateImplementation",constant:!1,inputs:[{type:"address"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"selfExecute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"execute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"},{type:"uint256"},{type:"bytes"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"createContract",inputs:[{type:"bytes"}],payable:!0,stateMutability:"payable"},{type:"function",name:"setExtraImageHash",constant:!1,inputs:[{type:"bytes32",name:"imageHash"},{type:"uint256",name:"expiration"}],outputs:[],payable:!1,stateMutability:"nonpayable"}];var H2e=Object.freeze({__proto__:null,abi:z2e});const G2e=[{type:"function",name:"updateImageHash",constant:!0,inputs:[{type:"bytes32"}],outputs:[],payable:!1,stateMutability:"view"},{type:"function",name:"imageHash",constant:!0,inputs:[],outputs:[{type:"bytes32"}],payable:!1,stateMutability:"view"}];var W2e=Object.freeze({__proto__:null,abi:G2e});const K2e=[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_mainModule",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"bytes32",name:"_imageHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"_threshold",type:"uint256"},{indexed:!1,internalType:"bytes",name:"_signers",type:"bytes"}],name:"RequiredConfig",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"address",name:"_signer",type:"address"}],name:"RequiredSigner",type:"event"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callBalanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callBlockNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_i",type:"uint256"}],name:"callBlockhash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"callChainId",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCode",outputs:[{internalType:"bytes",name:"code",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeHash",outputs:[{internalType:"bytes32",name:"codeHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeSize",outputs:[{internalType:"uint256",name:"size",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callCoinbase",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callDifficulty",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLeft",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLimit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callOrigin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"knownImageHashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"lastImageHashUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastSignerUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastWalletUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bool",name:"delegateCall",type:"bool"},{internalType:"bool",name:"revertOnError",type:"bool"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct IModuleCalls.Transaction[]",name:"_txs",type:"tuple[]"}],name:"multiCall",outputs:[{internalType:"bool[]",name:"_successes",type:"bool[]"},{internalType:"bytes[]",name:"_results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_threshold",type:"uint256"},{components:[{internalType:"uint256",name:"weight",type:"uint256"},{internalType:"address",name:"signer",type:"address"}],internalType:"struct RequireUtils.Member[]",name:"_members",type:"tuple[]"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishConfig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"uint256",name:"_sizeMembers",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishInitialSigners",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_nonce",type:"uint256"}],name:"requireMinNonce",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_expiration",type:"uint256"}],name:"requireNonExpired",outputs:[],stateMutability:"view",type:"function"}];var Y2e=Object.freeze({__proto__:null,abi:K2e});const Q2e=[{inputs:[{internalType:"address",name:"",type:"address"}],name:"requireFreshSigner",outputs:[],stateMutability:"nonpayable",type:"function"}];var J2e=Object.freeze({__proto__:null,abi:Q2e});const Ps={erc6492:$2e,erc5719:B2e,erc1271:j2e,factory:V2e,mainModule:H2e,mainModuleUpgradable:W2e,sequenceUtils:Y2e,requireFreshSigner:J2e},tY="6.13.2";function Z2e(t,e,r){const n=e.split("|").map(s=>s.trim());for(let s=0;sPromise.resolve(t[n])))).reduce((n,i,s)=>(n[e[s]]=i,n),{})}function Ot(t,e,r){for(let n in e){let i=e[n];const s=r?r[n]:null;s&&Z2e(i,s,n),Object.defineProperty(t,n,{enumerable:!0,value:i,writable:!1})}}function dv(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(dv).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let n=0;n>4],r+=e[t[n]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return dv(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(r=>`${dv(r)}: ${dv(t[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Is(t,e){return t&&t.code===e}function nk(t){return Is(t,"CALL_EXCEPTION")}function zn(t,e,r){let n=t;{const s=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${dv(r)}`);for(const o in r){if(o==="shortMessage")continue;const a=r[o];s.push(o+"="+dv(a))}}s.push(`code=${e}`),s.push(`version=${tY}`),s.length&&(t+=" ("+s.join(", ")+")")}let i;switch(e){case"INVALID_ARGUMENT":i=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(t);break;default:i=new Error(t)}return Ot(i,{code:e}),r&&Object.assign(i,r),i.shortMessage==null&&Ot(i,{shortMessage:n}),i}function Le(t,e,r,n){if(!t)throw zn(e,r,n)}function ve(t,e,r,n){Le(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function rY(t,e,r){r==null&&(r=""),r&&(r=": "+r),Le(t>=e,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),Le(t<=e,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const X2e=["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function nY(t){Le(X2e.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function kh(t,e,r){if(r==null&&(r=""),t!==e){let n=r,i="new";r&&(n+=".",i+=" "+r),Le(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function iY(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((t.length-2)/2);let i=2;for(let s=0;s>4]+aL[i&15]}return r}function qr(t){return"0x"+t.map(e=>Me(e).substring(2)).join("")}function fp(t){return Gr(t,!0)?(t.length-2)/2:Ue(t).length}function mn(t,e,r){const n=Ue(t);return r!=null&&r>n.length&&Le(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),Me(n.slice(e??0,r??n.length))}function sY(t,e,r){const n=Ue(t);Le(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),r?i.set(n,e-n.length):i.set(n,0),Me(i)}function Kc(t,e){return sY(t,e,!0)}function oY(t,e){return sY(t,e,!1)}const P8=BigInt(0),Vc=BigInt(1),hv=9007199254740991;function T5(t,e){const r=k8(t,"value"),n=BigInt(or(e,"width"));if(Le(r>>n===P8,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-Vc){const i=(Vc<=-hv&&t<=hv,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){ve(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}ve(!1,"invalid BigNumberish value",e||"value",t)}function k8(t,e){const r=Pt(t,e);return Le(r>=P8,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const cL="0123456789abcdef";function vx(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=cL[r>>4],e+=cL[r&15];return BigInt(e)}return Pt(t)}function or(t,e){switch(typeof t){case"bigint":return ve(t>=-hv&&t<=hv,"overflow",e||"value",t),Number(t);case"number":return ve(Number.isInteger(t),"underflow",e||"value",t),ve(t>=-hv&&t<=hv,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return or(BigInt(t),e)}catch(r){ve(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}ve(!1,"invalid numeric value",e||"value",t)}function e6e(t){return or(vx(t))}function tc(t,e){let n=k8(t,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const i=or(e,"width");for(Le(i*2>=n.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length>6===2;o++)s++;return s}return t==="OVERRUN"?r.length-e-1:0}function a6e(t,e,r,n,i){return t==="OVERLONG"?(ve(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),lY(t,e,r))}const c6e=Object.freeze({error:o6e,ignore:lY,replace:a6e});function l6e(t,e){e==null&&(e=c6e.error);const r=Ue(t,"bytes"),n=[];let i=0;for(;i>7)){n.push(s);continue}let o=null,a=null;if((s&224)===192)o=1,a=127;else if((s&240)===224)o=2,a=2047;else if((s&248)===240)o=3,a=65535;else{(s&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,r,n):i+=e("BAD_PREFIX",i-1,r,n);continue}if(i-1+o>=r.length){i+=e("OVERRUN",i-1,r,n);continue}let c=s&(1<<8-o-1)-1;for(let l=0;l1114111){i+=e("OUT_OF_RANGE",i-1-o,r,n,c);continue}if(c>=55296&&c<=57343){i+=e("UTF16_SURROGATE",i-1-o,r,n,c);continue}if(c<=a){i+=e("OVERLONG",i-1-o,r,n,c);continue}n.push(c)}}return n}function Ii(t,e){ve(typeof t=="string","invalid string value","str",t),e!=null&&(nY(e),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 s=t.charCodeAt(n);ve(n>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return new Uint8Array(r)}function f6e(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Ip(t,e){return f6e(l6e(t,e))}function fY(t){async function e(r,n){Le(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const i=r.url.split(":")[0].toLowerCase();Le(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),Le(i==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s=null;const o=new AbortController,a=setTimeout(()=>{s=zn("request timeout","TIMEOUT"),o.abort()},r.timeout);n&&n.addListener(()=>{s=zn("request cancelled","CANCELLED"),o.abort()});const c={method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:o.signal};let l;try{l=await fetch(r.url,c)}catch(g){throw clearTimeout(a),s||g}clearTimeout(a);const f={};l.headers.forEach((g,y)=>{f[y.toLowerCase()]=g});const u=await l.arrayBuffer(),p=u==null?null:new Uint8Array(u);return{statusCode:l.status,statusMessage:l.statusText,headers:f,body:p}}return e}const u6e=12,d6e=250;let lL=fY();const h6e=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),p6e=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let ZA=!1;async function uY(t,e){try{const r=t.match(h6e);if(!r)throw new Error("invalid data");return new Qd(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?i6e(r[3]):g6e(r[3]))}catch{return new Qd(599,"BAD REQUEST (invalid data: URI)",{},null,new Jl(t))}}function dY(t){async function e(r,n){try{const i=r.match(p6e);if(!i)throw new Error("invalid link");return new Jl(`${t}${i[2]}`)}catch{return new Qd(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Jl(r))}}return e}const h6={data:uY,ipfs:dY("https://gateway.ipfs.io/ipfs/")},hY=new WeakMap;var L0,yd;class v6e{constructor(e){Ie(this,L0);Ie(this,yd);ue(this,L0,[]),ue(this,yd,!1),hY.set(e,()=>{if(!Q(this,yd)){ue(this,yd,!0);for(const r of Q(this,L0))setTimeout(()=>{r()},0);ue(this,L0,[])}})}addListener(e){Le(!Q(this,yd),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),Q(this,L0).push(e)}get cancelled(){return Q(this,yd)}checkSignal(){Le(!this.cancelled,"cancelled","CANCELLED",{})}}L0=new WeakMap,yd=new WeakMap;function p6(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var Wv,Kv,Nc,Lf,Yv,Qv,Ri,Xo,Ff,F0,j0,U0,Sl,Bc,md,$0,Qm;const g4=class g4{constructor(e){Ie(this,$0);Ie(this,Wv);Ie(this,Kv);Ie(this,Nc);Ie(this,Lf);Ie(this,Yv);Ie(this,Qv);Ie(this,Ri);Ie(this,Xo);Ie(this,Ff);Ie(this,F0);Ie(this,j0);Ie(this,U0);Ie(this,Sl);Ie(this,Bc);Ie(this,md);ue(this,Qv,String(e)),ue(this,Wv,!1),ue(this,Kv,!0),ue(this,Nc,{}),ue(this,Lf,""),ue(this,Yv,3e5),ue(this,Bc,{slotInterval:d6e,maxAttempts:u6e}),ue(this,md,null)}get url(){return Q(this,Qv)}set url(e){ue(this,Qv,String(e))}get body(){return Q(this,Ri)==null?null:new Uint8Array(Q(this,Ri))}set body(e){if(e==null)ue(this,Ri,void 0),ue(this,Xo,void 0);else if(typeof e=="string")ue(this,Ri,Ii(e)),ue(this,Xo,"text/plain");else if(e instanceof Uint8Array)ue(this,Ri,e),ue(this,Xo,"application/octet-stream");else if(typeof e=="object")ue(this,Ri,Ii(JSON.stringify(e))),ue(this,Xo,"application/json");else throw new Error("invalid body")}hasBody(){return Q(this,Ri)!=null}get method(){return Q(this,Lf)?Q(this,Lf):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),ue(this,Lf,String(e).toUpperCase())}get headers(){const e=Object.assign({},Q(this,Nc));return Q(this,Ff)&&(e.authorization=`Basic ${s6e(Ii(Q(this,Ff)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&Q(this,Xo)&&(e["content-type"]=Q(this,Xo)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){Q(this,Nc)[String(e).toLowerCase()]=String(r)}clearHeaders(){ue(this,Nc,{})}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",e),ue(this,Yv,e)}get preflightFunc(){return Q(this,F0)||null}set preflightFunc(e){ue(this,F0,e)}get processFunc(){return Q(this,j0)||null}set processFunc(e){ue(this,j0,e)}get retryFunc(){return Q(this,U0)||null}set retryFunc(e){ue(this,U0,e)}get getUrlFunc(){return Q(this,md)||lL}set getUrlFunc(e){ue(this,md,e)}toString(){return``}setThrottleParams(e){e.slotInterval!=null&&(Q(this,Bc).slotInterval=e.slotInterval),e.maxAttempts!=null&&(Q(this,Bc).maxAttempts=e.maxAttempts)}send(){return Le(Q(this,Sl)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),ue(this,Sl,new v6e(this)),qe(this,$0,Qm).call(this,0,fL()+this.timeout,0,this,new Qd(0,"",{},null,this))}cancel(){Le(Q(this,Sl)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=hY.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();Le(this.method==="GET"&&(r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new g4(e);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,ue(i,Nc,Object.assign({},Q(this,Nc))),Q(this,Ri)&&ue(i,Ri,new Uint8Array(Q(this,Ri))),ue(i,Xo,Q(this,Xo)),i}clone(){const e=new g4(this.url);return ue(e,Lf,Q(this,Lf)),Q(this,Ri)&&ue(e,Ri,Q(this,Ri)),ue(e,Xo,Q(this,Xo)),ue(e,Nc,Object.assign({},Q(this,Nc))),ue(e,Ff,Q(this,Ff)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),ue(e,F0,Q(this,F0)),ue(e,j0,Q(this,j0)),ue(e,U0,Q(this,U0)),ue(e,Bc,Object.assign({},Q(this,Bc))),ue(e,md,Q(this,md)),e}static lockConfig(){ZA=!0}static getGateway(e){return h6[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(ZA)throw new Error("gateways locked");h6[e]=r}static registerGetUrl(e){if(ZA)throw new Error("gateways locked");lL=e}static createGetUrlFunc(e){return fY()}static createDataGateway(){return uY}static createIpfsGatewayFunc(e){return dY(e)}};Wv=new WeakMap,Kv=new WeakMap,Nc=new WeakMap,Lf=new WeakMap,Yv=new WeakMap,Qv=new WeakMap,Ri=new WeakMap,Xo=new WeakMap,Ff=new WeakMap,F0=new WeakMap,j0=new WeakMap,U0=new WeakMap,Sl=new WeakMap,Bc=new WeakMap,md=new WeakMap,$0=new WeakSet,Qm=async function(e,r,n,i,s){var f,u,p;if(e>=Q(this,Bc).maxAttempts)return s.makeServerError("exceeded maximum retry limit");Le(fL()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),n>0&&await y6e(n);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in h6){const g=await h6[a](o.url,p6(Q(i,Sl)));if(g instanceof Qd){let y=g;if(this.processFunc){p6(Q(i,Sl));try{y=await this.processFunc(o,y)}catch(b){(b.throttle==null||typeof b.stall!="number")&&y.makeServerError("error in post-processing function",b).assertOk()}}return y}o=g}this.preflightFunc&&(o=await this.preflightFunc(o));const c=await this.getUrlFunc(o,p6(Q(i,Sl)));let l=new Qd(c.statusCode,c.statusMessage,c.headers,c.body,i);if(l.statusCode===301||l.statusCode===302){try{const g=l.headers.location||"";return qe(f=o.redirect(g),$0,Qm).call(f,e+1,r,0,i,l)}catch{}return l}else if(l.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,l,e))){const g=l.headers["retry-after"];let y=Q(this,Bc).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof g=="string"&&g.match(/^[1-9][0-9]*$/)&&(y=parseInt(g)),qe(u=o.clone(),$0,Qm).call(u,e+1,r,y,i,l)}if(this.processFunc){p6(Q(i,Sl));try{l=await this.processFunc(o,l)}catch(g){(g.throttle==null||typeof g.stall!="number")&&l.makeServerError("error in post-processing function",g).assertOk();let y=Q(this,Bc).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return g.stall>=0&&(y=g.stall),qe(p=o.clone(),$0,Qm).call(p,e+1,r,y,i,l)}}return l};let Jl=g4;var Nw,Bw,Lw,ea,Jv,q0;const ZM=class ZM{constructor(e,r,n,i,s){Ie(this,Nw);Ie(this,Bw);Ie(this,Lw);Ie(this,ea);Ie(this,Jv);Ie(this,q0);ue(this,Nw,e),ue(this,Bw,r),ue(this,Lw,Object.keys(n).reduce((o,a)=>(o[a.toLowerCase()]=String(n[a]),o),{})),ue(this,ea,i==null?null:new Uint8Array(i)),ue(this,Jv,s||null),ue(this,q0,{message:""})}toString(){return``}get statusCode(){return Q(this,Nw)}get statusMessage(){return Q(this,Bw)}get headers(){return Object.assign({},Q(this,Lw))}get body(){return Q(this,ea)==null?null:new Uint8Array(Q(this,ea))}get bodyText(){try{return Q(this,ea)==null?"":Ip(Q(this,ea))}catch{Le(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Le(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw Ot(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return Q(this,ea)!=null}get request(){return Q(this,Jv)}ok(){return Q(this,q0).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:r}=Q(this,q0);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let i=null;try{Q(this,ea)&&(i=Ip(Q(this,ea)))}catch{}Le(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r,info:{requestUrl:n,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};Nw=new WeakMap,Bw=new WeakMap,Lw=new WeakMap,ea=new WeakMap,Jv=new WeakMap,q0=new WeakMap;let Qd=ZM;function fL(){return new Date().getTime()}function g6e(t){return Ii(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function y6e(t){return new Promise(e=>setTimeout(e,t))}const m6e=BigInt(-1),kc=BigInt(0),pv=BigInt(1),b6e=BigInt(5),R1={};let kv="0000";for(;kv.length<80;)kv+=kv;function i0(t){let e=kv;for(;e.length=-i&&tkc?t=T5(P0(t,n),n):t=-T5(P0(-t,n),n)}else{const i=pv<=0&&ts[a]==null?l:(ve(typeof s[a]===c,"invalid fixed format ("+a+" not "+c+")","format."+a,s[a]),s[a]);e=o("signed","boolean",e),r=o("width","number",r),n=o("decimals","number",n)}ve(r%8===0,"invalid FixedNumber width (not byte aligned)","format.width",r),ve(n<=80,"invalid FixedNumber decimals (too large)","format.decimals",n);const i=(e?"":"u")+"fixed"+String(r)+"x"+String(n);return{signed:e,width:r,decimals:n,name:i}}function w6e(t,e){let r="";t0?n*=i0(i):i<0&&(r*=i0(-i)),rn?1:0}eq(e){return this.cmp(e)===0}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=Q(this,an);return Q(this,an)kc&&(e+=Q(this,Gs)-pv),e=Q(this,an)/Q(this,Gs)*Q(this,Gs),qe(this,Xr,Sf).call(this,e,"ceiling")}round(e){if(e==null&&(e=0),e>=this.decimals)return this;const r=this.decimals-e,n=b6e*i0(r-1);let i=this.value+n;const s=i0(r);return i=i/s*s,Sm(i,Q(this,Lc),"round"),new hd(R1,i,Q(this,Lc))}isZero(){return Q(this,an)===kc}isNegative(){return Q(this,an)0){const c=i0(a);Le(o%c===kc,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),o/=c}else a<0&&(o*=i0(-a));return Sm(o,s,"fromValue"),new hd(R1,o,s)}static fromString(e,r){const n=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);ve(n&&n[2].length+n[3].length>0,"invalid FixedNumber string value","value",e);const i=XA(r);let s=n[2]||"0",o=n[3]||"";for(;o.length{Le(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const i=uL(t,e+1,n);return r(e+1+n+i),dL(t,e,e+1+n,n+i)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),dL(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const i=uL(t,e+1,n);r(e+1+n+i);const s=Me(t.slice(e+1+n,e+1+n+i));return{consumed:1+n+i,result:s}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const i=Me(t.slice(e+1,e+1+n));return{consumed:1+n,result:i}}return{consumed:1,result:x6e(t[e])}}function M8(t){const e=Ue(t,"data"),r=pY(e,0);return ve(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function hL(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function vY(t){if(Array.isArray(t)){let n=[];if(t.forEach(function(s){n=n.concat(vY(s))}),n.length<=55)return n.unshift(192+n.length),n;const i=hL(n.length);return i.unshift(247+i.length),i.concat(n)}const e=Array.prototype.slice.call(Ue(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=hL(e.length);return r.unshift(183+r.length),r.concat(e)}const pL="0123456789abcdef";function Tp(t){let e="0x";for(const r of vY(t))e+=pL[r>>4],e+=pL[r&15];return e}const gY=["wei","kwei","mwei","gwei","szabo","finney","ether"];function fh(t,e){let r=18;if(typeof e=="string"){const n=gY.indexOf(e);ve(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=or(e,"unit"));return k5.fromValue(t,r,{decimals:r,width:512}).toString()}function W7(t,e){ve(typeof t=="string","value must be a string","value",t);let r=18;if(typeof e=="string"){const n=gY.indexOf(e);ve(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=or(e,"unit"));return k5.fromString(t,{decimals:r,width:512}).value}function E6e(t){return W7(t,18)}function C6e(t){const e=Ue(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=Me(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const Qs=32,K7=new Uint8Array(Qs),A6e=["then"],v6={},yY=new WeakMap;function m0(t){return yY.get(t)}function vL(t,e){yY.set(t,e)}function _m(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}function Y7(t,e,r){return t.indexOf(null)>=0?e.map((n,i)=>n instanceof Gg?Y7(m0(n),n,r):n):t.reduce((n,i,s)=>{let o=e.getValue(i);return i in n||(r&&o instanceof Gg&&(o=Y7(m0(o),o,r)),n[i]=o),n},{})}var Zv;const yv=class yv extends Array{constructor(...r){const n=r[0];let i=r[1],s=(r[2]||[]).slice(),o=!0;n!==v6&&(i=r,s=[],o=!1);super(i.length);Ie(this,Zv);i.forEach((l,f)=>{this[f]=l});const a=s.reduce((l,f)=>(typeof f=="string"&&l.set(f,(l.get(f)||0)+1),l),new Map);if(vL(this,Object.freeze(i.map((l,f)=>{const u=s[f];return u!=null&&a.get(u)===1?u:null}))),ue(this,Zv,[]),Q(this,Zv)==null&&Q(this,Zv),!o)return;Object.freeze(this);const c=new Proxy(this,{get:(l,f,u)=>{if(typeof f=="string"){if(f.match(/^[0-9]+$/)){const g=or(f,"%index");if(g<0||g>=this.length)throw new RangeError("out of result range");const y=l[g];return y instanceof Error&&_m(`index ${g}`,y),y}if(A6e.indexOf(f)>=0)return Reflect.get(l,f,u);const p=l[f];if(p instanceof Function)return function(...g){return p.apply(this===u?l:this,g)};if(!(f in l))return l.getValue.apply(this===u?l:this,[f])}return Reflect.get(l,f,u)}});return vL(c,m0(this)),c}toArray(r){const n=[];return this.forEach((i,s)=>{i instanceof Error&&_m(`index ${s}`,i),r&&i instanceof yv&&(i=i.toArray(r)),n.push(i)}),n}toObject(r){const n=m0(this);return n.reduce((i,s,o)=>(Le(s!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Y7(n,this,r)),{})}slice(r,n){r==null&&(r=0),r<0&&(r+=this.length,r<0&&(r=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const i=m0(this),s=[],o=[];for(let a=r;a{Q(this,jf)[e]=gL(r)}}}jf=new WeakMap,V0=new WeakMap,Xv=new WeakSet,s3=function(e){return Q(this,jf).push(e),ue(this,V0,Q(this,V0)+e.length),e.length};var Eo,ta,z0,H0,bd,Up,Z7,mY;const XM=class XM{constructor(e,r,n){Ie(this,Up);de(this,"allowLoose");Ie(this,Eo);Ie(this,ta);Ie(this,z0);Ie(this,H0);Ie(this,bd);Ot(this,{allowLoose:!!r}),ue(this,Eo,es(e)),ue(this,z0,0),ue(this,H0,null),ue(this,bd,n??1024),ue(this,ta,0)}get data(){return Me(Q(this,Eo))}get dataLength(){return Q(this,Eo).length}get consumed(){return Q(this,ta)}get bytes(){return new Uint8Array(Q(this,Eo))}subReader(e){const r=new XM(Q(this,Eo).slice(Q(this,ta)+e),this.allowLoose,Q(this,bd));return ue(r,H0,this),r}readBytes(e,r){let n=qe(this,Up,mY).call(this,0,e,!!r);return qe(this,Up,Z7).call(this,e),ue(this,ta,Q(this,ta)+n.length),n.slice(0,e)}readValue(){return vx(this.readBytes(Qs))}readIndex(){return e6e(this.readBytes(Qs))}};Eo=new WeakMap,ta=new WeakMap,z0=new WeakMap,H0=new WeakMap,bd=new WeakMap,Up=new WeakSet,Z7=function(e){var r;if(Q(this,H0))return qe(r=Q(this,H0),Up,Z7).call(r,e);ue(this,z0,Q(this,z0)+e),Le(Q(this,bd)<1||Q(this,z0)<=Q(this,bd)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${Q(this,bd)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:es(Q(this,Eo)),offset:Q(this,ta),length:e,info:{bytesRead:Q(this,z0),dataLength:this.dataLength}})},mY=function(e,r,n){let i=Math.ceil(r/Qs)*Qs;return Q(this,ta)+i>Q(this,Eo).length&&(this.allowLoose&&n&&Q(this,ta)+r<=Q(this,Eo).length?i=r:Le(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:es(Q(this,Eo)),length:Q(this,Eo).length,offset:Q(this,ta)+i})),Q(this,Eo).slice(Q(this,ta),Q(this,ta)+i)};let J7=XM;function oa(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function sk(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function bY(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");oa(t.outputLen),oa(t.blockLen)}function Wg(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function wY(t,e){sk(t);const r=e.outputLen;if(t.lengtht instanceof Uint8Array,o3=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),a3=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),hl=(t,e)=>t<<32-e|t>>>e,S6e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!S6e)throw new Error("Non little-endian hardware is not supported");const _6e=async()=>{};async function yL(t,e,r){let n=Date.now();for(let i=0;i=0&&sn+i.length,0));let r=0;return t.forEach(n=>{if(!xY(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}class ok{clone(){return this._cloneInto()}}const P6e={}.toString;function EY(t,e){if(e!==void 0&&P6e.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function R8(t){const e=n=>t().update(Kg(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function k6e(t=32){if(e9&&typeof e9.getRandomValues=="function")return e9.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}let CY=class extends ok{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,bY(e);const n=Kg(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew CY(t,e).update(r).digest();O8.create=(t,e)=>new CY(t,e);function M6e(t,e,r,n){bY(t);const i=EY({dkLen:32,asyncTick:10},n),{c:s,dkLen:o,asyncTick:a}=i;if(oa(s),oa(o),oa(a),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=Kg(e),l=Kg(r),f=new Uint8Array(o),u=O8.create(t,c),p=u._cloneInto().update(l);return{c:s,dkLen:o,asyncTick:a,DK:f,PRF:u,PRFSalt:p}}function R6e(t,e,r,n,i){return t.destroy(),e.destroy(),n&&n.destroy(),i.fill(0),r}function ak(t,e,r,n){const{c:i,dkLen:s,DK:o,PRF:a,PRFSalt:c}=M6e(t,e,r,n);let l;const f=new Uint8Array(4),u=a3(f),p=new Uint8Array(a.outputLen);for(let g=1,y=0;y>i&s),a=Number(r&s),c=n?4:0,l=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+l,a,n)}class ck extends ok{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=a3(this.buffer)}update(e){Wg(this);const{view:r,buffer:n,blockLen:i}=this;e=Kg(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let u=o;uf.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;ut&e^~t&r,N6e=(t,e,r)=>t&e^t&r^e&r,B6e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Xu=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ed=new Uint32Array(64);let L6e=class extends ck{constructor(){super(64,32,8,!1),this.A=Xu[0]|0,this.B=Xu[1]|0,this.C=Xu[2]|0,this.D=Xu[3]|0,this.E=Xu[4]|0,this.F=Xu[5]|0,this.G=Xu[6]|0,this.H=Xu[7]|0}get(){const{A:e,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[e,r,n,i,s,o,a,c]}set(e,r,n,i,s,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let u=0;u<16;u++,r+=4)ed[u]=e.getUint32(r,!1);for(let u=16;u<64;u++){const p=ed[u-15],g=ed[u-2],y=hl(p,7)^hl(p,18)^p>>>3,b=hl(g,17)^hl(g,19)^g>>>10;ed[u]=b+ed[u-7]+y+ed[u-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:l,H:f}=this;for(let u=0;u<64;u++){const p=hl(a,6)^hl(a,11)^hl(a,25),g=f+p+D6e(a,c,l)+B6e[u]+ed[u]|0,b=(hl(n,2)^hl(n,13)^hl(n,22))+N6e(n,i,s)|0;f=l,l=c,c=a,a=o+g|0,o=s,s=i,i=n,n=g+b|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,i,s,o,a,c,l,f)}roundClean(){ed.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Ey=R8(()=>new L6e),g6=BigInt(2**32-1),X7=BigInt(32);function AY(t,e=!1){return e?{h:Number(t&g6),l:Number(t>>X7&g6)}:{h:Number(t>>X7&g6)|0,l:Number(t&g6)|0}}function SY(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;iBigInt(t>>>0)<>>0),j6e=(t,e,r)=>t>>>r,U6e=(t,e,r)=>t<<32-r|e>>>r,$6e=(t,e,r)=>t>>>r|e<<32-r,q6e=(t,e,r)=>t<<32-r|e>>>r,V6e=(t,e,r)=>t<<64-r|e>>>r-32,z6e=(t,e,r)=>t>>>r-32|e<<64-r,H6e=(t,e)=>e,G6e=(t,e)=>t,_Y=(t,e,r)=>t<>>32-r,IY=(t,e,r)=>e<>>32-r,TY=(t,e,r)=>e<>>64-r,PY=(t,e,r)=>t<>>64-r;function W6e(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const K6e=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Y6e=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Q6e=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),J6e=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Z6e=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),X6e=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0,dr={fromBig:AY,split:SY,toBig:F6e,shrSH:j6e,shrSL:U6e,rotrSH:$6e,rotrSL:q6e,rotrBH:V6e,rotrBL:z6e,rotr32H:H6e,rotr32L:G6e,rotlSH:_Y,rotlSL:IY,rotlBH:TY,rotlBL:PY,add:W6e,add3L:K6e,add3H:Y6e,add4L:Q6e,add4H:J6e,add5H:X6e,add5L:Z6e},[e3e,t3e]=dr.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),td=new Uint32Array(80),rd=new Uint32Array(80);let r3e=class extends ck{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:l,El:f,Fh:u,Fl:p,Gh:g,Gl:y,Hh:b,Hl:I}=this;return[e,r,n,i,s,o,a,c,l,f,u,p,g,y,b,I]}set(e,r,n,i,s,o,a,c,l,f,u,p,g,y,b,I){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=f|0,this.Fh=u|0,this.Fl=p|0,this.Gh=g|0,this.Gl=y|0,this.Hh=b|0,this.Hl=I|0}process(e,r){for(let O=0;O<16;O++,r+=4)td[O]=e.getUint32(r),rd[O]=e.getUint32(r+=4);for(let O=16;O<80;O++){const L=td[O-15]|0,F=rd[O-15]|0,z=dr.rotrSH(L,F,1)^dr.rotrSH(L,F,8)^dr.shrSH(L,F,7),_=dr.rotrSL(L,F,1)^dr.rotrSL(L,F,8)^dr.shrSL(L,F,7),$=td[O-2]|0,ie=rd[O-2]|0,ce=dr.rotrSH($,ie,19)^dr.rotrBH($,ie,61)^dr.shrSH($,ie,6),K=dr.rotrSL($,ie,19)^dr.rotrBL($,ie,61)^dr.shrSL($,ie,6),P=dr.add4L(_,K,rd[O-7],rd[O-16]),M=dr.add4H(P,z,ce,td[O-7],td[O-16]);td[O]=M|0,rd[O]=P|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:l,Dl:f,Eh:u,El:p,Fh:g,Fl:y,Gh:b,Gl:I,Hh:C,Hl:S}=this;for(let O=0;O<80;O++){const L=dr.rotrSH(u,p,14)^dr.rotrSH(u,p,18)^dr.rotrBH(u,p,41),F=dr.rotrSL(u,p,14)^dr.rotrSL(u,p,18)^dr.rotrBL(u,p,41),z=u&g^~u&b,_=p&y^~p&I,$=dr.add5L(S,F,_,t3e[O],rd[O]),ie=dr.add5H($,C,L,z,e3e[O],td[O]),ce=$|0,K=dr.rotrSH(n,i,28)^dr.rotrBH(n,i,34)^dr.rotrBH(n,i,39),P=dr.rotrSL(n,i,28)^dr.rotrBL(n,i,34)^dr.rotrBL(n,i,39),M=n&s^n&a^s&a,v=i&o^i&c^o&c;C=b|0,S=I|0,b=g|0,I=y|0,g=u|0,y=p|0,{h:u,l:p}=dr.add(l|0,f|0,ie|0,ce|0),l=a|0,f=c|0,a=s|0,c=o|0,s=n|0,o=i|0;const m=dr.add3L(ce,P,v);n=dr.add3H(m,ie,K,M),i=m|0}({h:n,l:i}=dr.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=dr.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=dr.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:f}=dr.add(this.Dh|0,this.Dl|0,l|0,f|0),{h:u,l:p}=dr.add(this.Eh|0,this.El|0,u|0,p|0),{h:g,l:y}=dr.add(this.Fh|0,this.Fl|0,g|0,y|0),{h:b,l:I}=dr.add(this.Gh|0,this.Gl|0,b|0,I|0),{h:C,l:S}=dr.add(this.Hh|0,this.Hl|0,C|0,S|0),this.set(n,i,s,o,a,c,l,f,u,p,g,y,b,I,C,S)}roundClean(){td.fill(0),rd.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const lk=R8(()=>new r3e);function n3e(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const mL=n3e(),bL=mL.crypto||mL.msCrypto;function i3e(t){switch(t){case"sha256":return Ey.create();case"sha512":return lk.create()}ve(!1,"invalid hashing algorithm name","algorithm",t)}function s3e(t,e){const r={sha256:Ey,sha512:lk}[t];return ve(r!=null,"invalid hmac algorithm","algorithm",t),O8.create(r,e)}function o3e(t,e,r,n,i){const s={sha256:Ey,sha512:lk}[i];return ve(s!=null,"invalid pbkdf2 algorithm","algorithm",i),ak(s,t,e,{c:r,dkLen:n})}function a3e(t){Le(bL!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),ve(Number.isInteger(t)&&t>0&&t<=1024,"invalid length","length",t);const e=new Uint8Array(t);return bL.getRandomValues(e),e}let kY=!1;const MY=function(t,e,r){return s3e(t,e).update(r).digest()};let RY=MY;function Cy(t,e,r){const n=Ue(e,"key"),i=Ue(r,"data");return Me(RY(t,n,i))}Cy._=MY;Cy.lock=function(){kY=!0};Cy.register=function(t){if(kY)throw new Error("computeHmac is locked");RY=t};Object.freeze(Cy);const[OY,DY,NY]=[[],[],[]],c3e=BigInt(0),Im=BigInt(1),l3e=BigInt(2),f3e=BigInt(7),u3e=BigInt(256),d3e=BigInt(113);for(let t=0,e=Im,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],OY.push(2*(5*n+r)),DY.push((t+1)*(t+2)/2%64);let i=c3e;for(let s=0;s<7;s++)e=(e<>f3e)*d3e)%u3e,e&l3e&&(i^=Im<<(Im<r>32?TY(t,e,r):_Y(t,e,r),xL=(t,e,r)=>r>32?PY(t,e,r):IY(t,e,r);function v3e(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=r[c],f=r[c+1],u=wL(l,f,1)^r[a],p=xL(l,f,1)^r[a+1];for(let g=0;g<50;g+=10)t[o+g]^=u,t[o+g+1]^=p}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=DY[o],c=wL(i,s,a),l=xL(i,s,a),f=OY[o];i=t[f],s=t[f+1],t[f]=c,t[f+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=h3e[n],t[1]^=p3e[n]}r.fill(0)}class fk extends ok{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,oa(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=o3(this.state)}keccak(){v3e(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Wg(this);const{blockLen:r,state:n}=this;e=Kg(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return oa(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(wY(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new fk(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const g3e=(t,e,r)=>R8(()=>new fk(e,t,r)),y3e=g3e(1,136,256/8);let BY=!1;const LY=function(t){return y3e(t)};let FY=LY;function gr(t){const e=Ue(t,"data");return Me(FY(e))}gr._=LY;gr.lock=function(){BY=!0};gr.register=function(t){if(BY)throw new TypeError("keccak256 is locked");FY=t};Object.freeze(gr);const m3e=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),jY=Uint8Array.from({length:16},(t,e)=>e),b3e=jY.map(t=>(9*t+5)%16);let uk=[jY],dk=[b3e];for(let t=0;t<4;t++)for(let e of[uk,dk])e.push(e[t].map(r=>m3e[r]));const UY=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),w3e=uk.map((t,e)=>t.map(r=>UY[e][r])),x3e=dk.map((t,e)=>t.map(r=>UY[e][r])),E3e=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),C3e=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),y6=(t,e)=>t<>>32-e;function EL(t,e,r,n){return t===0?e^r^n:t===1?e&r|~e&n:t===2?(e|~r)^n:t===3?e&n|r&~n:e^(r|~n)}const m6=new Uint32Array(16);let A3e=class extends ck{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:r,h2:n,h3:i,h4:s}=this;return[e,r,n,i,s]}set(e,r,n,i,s){this.h0=e|0,this.h1=r|0,this.h2=n|0,this.h3=i|0,this.h4=s|0}process(e,r){for(let g=0;g<16;g++,r+=4)m6[g]=e.getUint32(r,!0);let n=this.h0|0,i=n,s=this.h1|0,o=s,a=this.h2|0,c=a,l=this.h3|0,f=l,u=this.h4|0,p=u;for(let g=0;g<5;g++){const y=4-g,b=E3e[g],I=C3e[g],C=uk[g],S=dk[g],O=w3e[g],L=x3e[g];for(let F=0;F<16;F++){const z=y6(n+EL(g,s,a,l)+m6[C[F]]+b,O[F])+u|0;n=u,u=l,l=y6(a,10)|0,a=s,s=z}for(let F=0;F<16;F++){const z=y6(i+EL(y,o,c,f)+m6[S[F]]+I,L[F])+p|0;i=p,p=f,f=y6(c,10)|0,c=o,o=z}}this.set(this.h1+a+f|0,this.h2+l+p|0,this.h3+u+i|0,this.h4+n+o|0,this.h0+s+c|0)}roundClean(){m6.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}};const S3e=R8(()=>new A3e);let $Y=!1;const qY=function(t){return S3e(t)};let VY=qY;function Ay(t){const e=Ue(t,"data");return Me(VY(e))}Ay._=qY;Ay.lock=function(){$Y=!0};Ay.register=function(t){if($Y)throw new TypeError("ripemd160 is locked");VY=t};Object.freeze(Ay);let zY=!1;const HY=function(t,e,r,n,i){return o3e(t,e,r,n,i)};let GY=HY;function Mh(t,e,r,n,i){const s=Ue(t,"password"),o=Ue(e,"salt");return Me(GY(s,o,r,n,i))}Mh._=HY;Mh.lock=function(){zY=!0};Mh.register=function(t){if(zY)throw new Error("pbkdf2 is locked");GY=t};Object.freeze(Mh);let WY=!1;const KY=function(t){return new Uint8Array(a3e(t))};let YY=KY;function da(t){return YY(t)}da._=KY;da.lock=function(){WY=!0};da.register=function(t){if(WY)throw new Error("randomBytes is locked");YY=t};Object.freeze(da);const Fr=(t,e)=>t<>>32-e;function CL(t,e,r,n,i,s){let o=t[e++]^r[n++],a=t[e++]^r[n++],c=t[e++]^r[n++],l=t[e++]^r[n++],f=t[e++]^r[n++],u=t[e++]^r[n++],p=t[e++]^r[n++],g=t[e++]^r[n++],y=t[e++]^r[n++],b=t[e++]^r[n++],I=t[e++]^r[n++],C=t[e++]^r[n++],S=t[e++]^r[n++],O=t[e++]^r[n++],L=t[e++]^r[n++],F=t[e++]^r[n++],z=o,_=a,$=c,ie=l,ce=f,K=u,P=p,M=g,v=y,m=b,R=I,B=C,E=S,x=O,w=L,T=F;for(let k=0;k<8;k+=2)ce^=Fr(z+E|0,7),v^=Fr(ce+z|0,9),E^=Fr(v+ce|0,13),z^=Fr(E+v|0,18),m^=Fr(K+_|0,7),x^=Fr(m+K|0,9),_^=Fr(x+m|0,13),K^=Fr(_+x|0,18),w^=Fr(R+P|0,7),$^=Fr(w+R|0,9),P^=Fr($+w|0,13),R^=Fr(P+$|0,18),ie^=Fr(T+B|0,7),M^=Fr(ie+T|0,9),B^=Fr(M+ie|0,13),T^=Fr(B+M|0,18),_^=Fr(z+ie|0,7),$^=Fr(_+z|0,9),ie^=Fr($+_|0,13),z^=Fr(ie+$|0,18),P^=Fr(K+ce|0,7),M^=Fr(P+K|0,9),ce^=Fr(M+P|0,13),K^=Fr(ce+M|0,18),B^=Fr(R+m|0,7),v^=Fr(B+R|0,9),m^=Fr(v+B|0,13),R^=Fr(m+v|0,18),E^=Fr(T+w|0,7),x^=Fr(E+T|0,9),w^=Fr(x+E|0,13),T^=Fr(w+x|0,18);i[s++]=o+z|0,i[s++]=a+_|0,i[s++]=c+$|0,i[s++]=l+ie|0,i[s++]=f+ce|0,i[s++]=u+K|0,i[s++]=p+P|0,i[s++]=g+M|0,i[s++]=y+v|0,i[s++]=b+m|0,i[s++]=I+R|0,i[s++]=C+B|0,i[s++]=S+E|0,i[s++]=O+x|0,i[s++]=L+w|0,i[s++]=F+T|0}function Mv(t,e,r,n,i){let s=n+0,o=n+16*i;for(let a=0;a<16;a++)r[o+a]=t[e+(2*i-1)*16+a];for(let a=0;a0&&(o+=16),CL(r,s,t,e+=16,r,o)}function QY(t,e,r){const n=EY({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:i,r:s,p:o,dkLen:a,asyncTick:c,maxmem:l,onProgress:f}=n;if(oa(i),oa(s),oa(o),oa(a),oa(c),oa(l),f!==void 0&&typeof f!="function")throw new Error("progressCb should be function");const u=128*s,p=u/4;if(i<=1||i&i-1||i>=2**(u/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(o<0||o>(2**32-1)*32/u)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(a<0||a>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const g=u*(i+o);if(g>l)throw new Error(`Scrypt: parameters too large, ${g} (128 * r * (N + p)) > ${l} (maxmem)`);const y=ak(Ey,t,e,{c:1,dkLen:u*o}),b=o3(y),I=o3(new Uint8Array(u*i)),C=o3(new Uint8Array(u));let S=()=>{};if(f){const O=2*i*o,L=Math.max(Math.floor(O/1e4),1);let F=0;S=()=>{F++,f&&(!(F%L)||F===O)&&f(F/O)}}return{N:i,r:s,p:o,dkLen:a,blockSize32:p,V:I,B32:b,B:y,tmp:C,blockMixCb:S,asyncTick:c}}function JY(t,e,r,n,i){const s=ak(Ey,t,r,{c:1,dkLen:e});return r.fill(0),n.fill(0),i.fill(0),s}function _3e(t,e,r){const{N:n,r:i,p:s,dkLen:o,blockSize32:a,V:c,B32:l,B:f,tmp:u,blockMixCb:p}=QY(t,e,r);for(let g=0;g{Mv(c,I,c,I+=a,i),p()}),Mv(c,(n-1)*a,l,b,i),p(),await yL(n,g,()=>{const C=l[b+a-16]%n;for(let S=0;St instanceof Uint8Array,P3e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Yg(t){if(!N8(t))throw new Error("Uint8Array expected");let e="";for(let r=0;rn+i.length,0));let r=0;return t.forEach(n=>{if(!N8(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function M3e(t,e){if(t.length!==e.length)return!1;for(let r=0;raQ;t>>=D8,e+=1);return e}function D3e(t,e){return t>>BigInt(e)&D8}const N3e=(t,e,r)=>t|(r?D8:aQ)<(T3e<new Uint8Array(t),AL=t=>Uint8Array.from(t);function lQ(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=t9(t),i=t9(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...u)=>r(i,n,...u),c=(u=t9())=>{i=a(AL([0]),u),n=a(),u.length!==0&&(i=a(AL([1]),u),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const p=[];for(;u{o(),c(u);let g;for(;!(g=p(l()));)c();return o(),g}}const B3e={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function gx(t,e,r={}){const n=(i,s,o)=>{const a=B3e[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const L3e=Object.freeze(Object.defineProperty({__proto__:null,bitGet:D3e,bitLen:O3e,bitMask:gk,bitSet:N3e,bytesToHex:Yg,bytesToNumberBE:up,bytesToNumberLE:pk,concatBytes:pw,createHmacDrbg:lQ,ensureBytes:Oc,equalBytes:M3e,hexToBytes:Qg,hexToNumber:hk,numberToBytesBE:Jg,numberToBytesLE:vk,numberToHexUnpadded:cQ,numberToVarBytesBE:k3e,utf8ToBytes:R3e,validateObject:gx},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bi=BigInt(0),ai=BigInt(1),b0=BigInt(2),F3e=BigInt(3),e_=BigInt(4),SL=BigInt(5),_L=BigInt(8);BigInt(9);BigInt(16);function So(t,e){const r=t%e;return r>=Bi?r:e+r}function j3e(t,e,r){if(r<=Bi||e 0");if(r===ai)return Bi;let n=ai;for(;e>Bi;)e&ai&&(n=n*t%r),t=t*t%r,e>>=ai;return n}function Ra(t,e,r){let n=t;for(;e-- >Bi;)n*=n,n%=r;return n}function t_(t,e){if(t===Bi||e<=Bi)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=So(t,e),n=e,i=Bi,s=ai;for(;r!==Bi;){const a=n/r,c=n%r,l=i-s*a;n=r,r=c,i=s,s=l}if(n!==ai)throw new Error("invert: does not exist");return So(i,e)}function U3e(t){const e=(t-ai)/b0;let r,n,i;for(r=t-ai,n=0;r%b0===Bi;r/=b0,n++);for(i=b0;i(n[i]="function",n),e);return gx(t,r)}function z3e(t,e,r){if(r 0");if(r===Bi)return t.ONE;if(r===ai)return e;let n=t.ONE,i=e;for(;r>Bi;)r&ai&&(n=t.mul(n,i)),i=t.sqr(i),r>>=ai;return n}function H3e(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function fQ(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function G3e(t,e,r=!1,n={}){if(t<=Bi)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=fQ(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=$3e(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:gk(i),ZERO:Bi,ONE:ai,create:c=>So(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Bi<=c&&cc===Bi,isOdd:c=>(c&ai)===ai,neg:c=>So(-c,t),eql:(c,l)=>c===l,sqr:c=>So(c*c,t),add:(c,l)=>So(c+l,t),sub:(c,l)=>So(c-l,t),mul:(c,l)=>So(c*l,t),pow:(c,l)=>z3e(a,c,l),div:(c,l)=>So(c*t_(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>t_(c,t),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>H3e(a,c),cmov:(c,l,f)=>f?l:c,toBytes:c=>r?vk(c,s):Jg(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?pk(c):up(c)}});return Object.freeze(a)}function uQ(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function dQ(t){const e=uQ(t);return e+Math.ceil(e/2)}function W3e(t,e,r=!1){const n=t.length,i=uQ(e),s=dQ(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?up(t):pk(t),a=So(o,e-ai)+ai;return r?vk(a,i):Jg(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const K3e=BigInt(0),r9=BigInt(1);function Y3e(t,e){const r=(i,s)=>{const o=s.negate();return i?o:s},n=i=>{const s=Math.ceil(e/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=t.ZERO,a=i;for(;s>K3e;)s&r9&&(o=o.add(a)),a=a.double(),s>>=r9;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=n(s),c=[];let l=i,f=l;for(let u=0;u>=g,I>c&&(I-=p,o+=r9);const C=b,S=b+Math.abs(I)-1,O=y%2!==0,L=I<0;I===0?f=f.add(r(O,s[C])):l=l.add(r(L,s[S]))}return{p:l,f}},wNAFCached(i,s,o,a){const c=i._WINDOW_SIZE||1;let l=s.get(i);return l||(l=this.precomputeWindow(i,c),c!==1&&s.set(i,a(l))),this.wNAF(c,l,o)}}}function hQ(t){return V3e(t.Fp),gx(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...fQ(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Q3e(t){const e=hQ(t);gx(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:J3e,hexToBytes:Z3e}=L3e,k0={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=k0;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:J3e(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=k0,r=typeof t=="string"?Z3e(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=k0._parseInt(r.subarray(2)),{d:o,l:a}=k0._parseInt(s);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:o}},hexFromSig(t){const e=l=>Number.parseInt(l[0],16)&8?"00"+l:l,r=l=>{const f=l.toString(16);return f.length&1?`0${f}`:f},n=e(r(t.s)),i=e(r(t.r)),s=n.length/2,o=i.length/2,a=r(s),c=r(o);return`30${r(o+s+4)}02${c}${i}02${a}${n}`}},Yf=BigInt(0),Ga=BigInt(1);BigInt(2);const IL=BigInt(3);BigInt(4);function X3e(t){const e=Q3e(t),{Fp:r}=e,n=e.toBytes||((y,b,I)=>{const C=b.toAffine();return pw(Uint8Array.from([4]),r.toBytes(C.x),r.toBytes(C.y))}),i=e.fromBytes||(y=>{const b=y.subarray(1),I=r.fromBytes(b.subarray(0,r.BYTES)),C=r.fromBytes(b.subarray(r.BYTES,2*r.BYTES));return{x:I,y:C}});function s(y){const{a:b,b:I}=e,C=r.sqr(y),S=r.mul(C,y);return r.add(r.add(S,r.mul(y,b)),I)}if(!r.eql(r.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(y){return typeof y=="bigint"&&Yfr.eql(O,r.ZERO);return S(I)&&S(C)?u.ZERO:new u(I,C,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const I=r.invertBatch(b.map(C=>C.pz));return b.map((C,S)=>C.toAffine(I[S])).map(u.fromAffine)}static fromHex(b){const I=u.fromAffine(i(Oc("pointHex",b)));return I.assertValidity(),I}static fromPrivateKey(b){return u.BASE.multiply(c(b))}_setWindowSize(b){this._WINDOW_SIZE=b,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:b,y:I}=this.toAffine();if(!r.isValid(b)||!r.isValid(I))throw new Error("bad point: x or y not FE");const C=r.sqr(I),S=s(b);if(!r.eql(C,S))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:b}=this.toAffine();if(r.isOdd)return!r.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){f(b);const{px:I,py:C,pz:S}=this,{px:O,py:L,pz:F}=b,z=r.eql(r.mul(I,F),r.mul(O,S)),_=r.eql(r.mul(C,F),r.mul(L,S));return z&&_}negate(){return new u(this.px,r.neg(this.py),this.pz)}double(){const{a:b,b:I}=e,C=r.mul(I,IL),{px:S,py:O,pz:L}=this;let F=r.ZERO,z=r.ZERO,_=r.ZERO,$=r.mul(S,S),ie=r.mul(O,O),ce=r.mul(L,L),K=r.mul(S,O);return K=r.add(K,K),_=r.mul(S,L),_=r.add(_,_),F=r.mul(b,_),z=r.mul(C,ce),z=r.add(F,z),F=r.sub(ie,z),z=r.add(ie,z),z=r.mul(F,z),F=r.mul(K,F),_=r.mul(C,_),ce=r.mul(b,ce),K=r.sub($,ce),K=r.mul(b,K),K=r.add(K,_),_=r.add($,$),$=r.add(_,$),$=r.add($,ce),$=r.mul($,K),z=r.add(z,$),ce=r.mul(O,L),ce=r.add(ce,ce),$=r.mul(ce,K),F=r.sub(F,$),_=r.mul(ce,ie),_=r.add(_,_),_=r.add(_,_),new u(F,z,_)}add(b){f(b);const{px:I,py:C,pz:S}=this,{px:O,py:L,pz:F}=b;let z=r.ZERO,_=r.ZERO,$=r.ZERO;const ie=e.a,ce=r.mul(e.b,IL);let K=r.mul(I,O),P=r.mul(C,L),M=r.mul(S,F),v=r.add(I,C),m=r.add(O,L);v=r.mul(v,m),m=r.add(K,P),v=r.sub(v,m),m=r.add(I,S);let R=r.add(O,F);return m=r.mul(m,R),R=r.add(K,M),m=r.sub(m,R),R=r.add(C,S),z=r.add(L,F),R=r.mul(R,z),z=r.add(P,M),R=r.sub(R,z),$=r.mul(ie,m),z=r.mul(ce,M),$=r.add(z,$),z=r.sub(P,$),$=r.add(P,$),_=r.mul(z,$),P=r.add(K,K),P=r.add(P,K),M=r.mul(ie,M),m=r.mul(ce,m),P=r.add(P,M),M=r.sub(K,M),M=r.mul(ie,M),m=r.add(m,M),K=r.mul(P,m),_=r.add(_,K),K=r.mul(R,m),z=r.mul(v,z),z=r.sub(z,K),K=r.mul(v,P),$=r.mul(R,$),$=r.add($,K),new u(z,_,$)}subtract(b){return this.add(b.negate())}is0(){return this.equals(u.ZERO)}wNAF(b){return g.wNAFCached(this,l,b,I=>{const C=r.invertBatch(I.map(S=>S.pz));return I.map((S,O)=>S.toAffine(C[O])).map(u.fromAffine)})}multiplyUnsafe(b){const I=u.ZERO;if(b===Yf)return I;if(a(b),b===Ga)return this;const{endo:C}=e;if(!C)return g.unsafeLadder(this,b);let{k1neg:S,k1:O,k2neg:L,k2:F}=C.splitScalar(b),z=I,_=I,$=this;for(;O>Yf||F>Yf;)O&Ga&&(z=z.add($)),F&Ga&&(_=_.add($)),$=$.double(),O>>=Ga,F>>=Ga;return S&&(z=z.negate()),L&&(_=_.negate()),_=new u(r.mul(_.px,C.beta),_.py,_.pz),z.add(_)}multiply(b){a(b);let I=b,C,S;const{endo:O}=e;if(O){const{k1neg:L,k1:F,k2neg:z,k2:_}=O.splitScalar(I);let{p:$,f:ie}=this.wNAF(F),{p:ce,f:K}=this.wNAF(_);$=g.constTimeNegate(L,$),ce=g.constTimeNegate(z,ce),ce=new u(r.mul(ce.px,O.beta),ce.py,ce.pz),C=$.add(ce),S=ie.add(K)}else{const{p:L,f:F}=this.wNAF(I);C=L,S=F}return u.normalizeZ([C,S])[0]}multiplyAndAddUnsafe(b,I,C){const S=u.BASE,O=(F,z)=>z===Yf||z===Ga||!F.equals(S)?F.multiplyUnsafe(z):F.multiply(z),L=O(this,I).add(O(b,C));return L.is0()?void 0:L}toAffine(b){const{px:I,py:C,pz:S}=this,O=this.is0();b==null&&(b=O?r.ONE:r.inv(S));const L=r.mul(I,b),F=r.mul(C,b),z=r.mul(S,b);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(z,r.ONE))throw new Error("invZ was invalid");return{x:L,y:F}}isTorsionFree(){const{h:b,isTorsionFree:I}=e;if(b===Ga)return!0;if(I)return I(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:I}=e;return b===Ga?this:I?I(u,this):this.multiplyUnsafe(e.h)}toRawBytes(b=!0){return this.assertValidity(),n(u,this,b)}toHex(b=!0){return Yg(this.toRawBytes(b))}}u.BASE=new u(e.Gx,e.Gy,r.ONE),u.ZERO=new u(r.ZERO,r.ONE,r.ZERO);const p=e.nBitLength,g=Y3e(u,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function e5e(t){const e=hQ(t);return gx(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function t5e(t){const e=e5e(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(m){return YfYg(Jg(m,e.nByteLength));function y(m){const R=n>>Ga;return m>R}function b(m){return y(m)?a(-m):m}const I=(m,R,B)=>up(m.slice(R,B));class C{constructor(R,B,E){this.r=R,this.s=B,this.recovery=E,this.assertValidity()}static fromCompact(R){const B=e.nByteLength;return R=Oc("compactSignature",R,B*2),new C(I(R,0,B),I(R,B,2*B))}static fromDER(R){const{r:B,s:E}=k0.toSig(Oc("DER",R));return new C(B,E)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(R){return new C(this.r,this.s,R)}recoverPublicKey(R){const{r:B,s:E,recovery:x}=this,w=_(Oc("msgHash",R));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const T=x===2||x===3?B+e.n:B;if(T>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const k=x&1?"03":"02",H=l.fromHex(k+g(T)),oe=c(T),j=a(-w*oe),X=a(E*oe),G=l.BASE.multiplyAndAddUnsafe(H,j,X);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new C(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Qg(this.toDERHex())}toDERHex(){return k0.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Qg(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const S={isValidPrivateKey(m){try{return f(m),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const m=dQ(e.n);return W3e(e.randomBytes(m),e.n)},precompute(m=8,R=l.BASE){return R._setWindowSize(m),R.multiply(BigInt(3)),R}};function O(m,R=!0){return l.fromPrivateKey(m).toRawBytes(R)}function L(m){const R=m instanceof Uint8Array,B=typeof m=="string",E=(R||B)&&m.length;return R?E===i||E===s:B?E===2*i||E===2*s:m instanceof l}function F(m,R,B=!0){if(L(m))throw new Error("first arg must be private key");if(!L(R))throw new Error("second arg must be public key");return l.fromHex(R).multiply(f(m)).toRawBytes(B)}const z=e.bits2int||function(m){const R=up(m),B=m.length*8-e.nBitLength;return B>0?R>>BigInt(B):R},_=e.bits2int_modN||function(m){return a(z(m))},$=gk(e.nBitLength);function ie(m){if(typeof m!="bigint")throw new Error("bigint expected");if(!(Yf<=m&&m<$))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Jg(m,e.nByteLength)}function ce(m,R,B=K){if(["recovered","canonical"].some(ee=>ee in B))throw new Error("sign() legacy options not supported");const{hash:E,randomBytes:x}=e;let{lowS:w,prehash:T,extraEntropy:k}=B;w==null&&(w=!0),m=Oc("msgHash",m),T&&(m=Oc("prehashed msgHash",E(m)));const H=_(m),oe=f(R),j=[ie(oe),ie(H)];if(k!=null){const ee=k===!0?x(r.BYTES):k;j.push(Oc("extraEntropy",ee))}const X=pw(...j),G=H;function Z(ee){const N=z(ee);if(!p(N))return;const te=c(N),fe=l.BASE.multiply(N).toAffine(),Ee=a(fe.x);if(Ee===Yf)return;const _e=a(te*a(G+Ee*oe));if(_e===Yf)return;let Re=(fe.x===Ee?0:2)|Number(fe.y&Ga),Te=_e;return w&&y(_e)&&(Te=b(_e),Re^=1),new C(Ee,Te,Re)}return{seed:X,k2sig:Z}}const K={lowS:e.lowS,prehash:!1},P={lowS:e.lowS,prehash:!1};function M(m,R,B=K){const{seed:E,k2sig:x}=ce(m,R,B),w=e;return lQ(w.hash.outputLen,w.nByteLength,w.hmac)(E,x)}l.BASE._setWindowSize(8);function v(m,R,B,E=P){var fe;const x=m;if(R=Oc("msgHash",R),B=Oc("publicKey",B),"strict"in E)throw new Error("options.strict was renamed to lowS");const{lowS:w,prehash:T}=E;let k,H;try{if(typeof x=="string"||x instanceof Uint8Array)try{k=C.fromDER(x)}catch(Ee){if(!(Ee instanceof k0.Err))throw Ee;k=C.fromCompact(x)}else if(typeof x=="object"&&typeof x.r=="bigint"&&typeof x.s=="bigint"){const{r:Ee,s:_e}=x;k=new C(Ee,_e)}else throw new Error("PARSE");H=l.fromHex(B)}catch(Ee){if(Ee.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(w&&k.hasHighS())return!1;T&&(R=e.hash(R));const{r:oe,s:j}=k,X=_(R),G=c(j),Z=a(X*G),ee=a(oe*G),N=(fe=l.BASE.multiplyAndAddUnsafe(H,Z,ee))==null?void 0:fe.toAffine();return N?a(N.x)===oe:!1}return{CURVE:e,getPublicKey:O,getSharedSecret:F,sign:M,verify:v,ProjectivePoint:l,Signature:C,utils:S}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function r5e(t){return{hash:t,hmac:(e,...r)=>O8(t,e,T6e(...r)),randomBytes:k6e}}function n5e(t,e){const r=n=>t5e({...t,...r5e(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const pQ=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),TL=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),i5e=BigInt(1),r_=BigInt(2),PL=(t,e)=>(t+e/r_)/e;function s5e(t){const e=pQ,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=t*t*t%e,f=l*l*t%e,u=Ra(f,r,e)*f%e,p=Ra(u,r,e)*f%e,g=Ra(p,r_,e)*l%e,y=Ra(g,i,e)*g%e,b=Ra(y,s,e)*y%e,I=Ra(b,a,e)*b%e,C=Ra(I,c,e)*I%e,S=Ra(C,a,e)*b%e,O=Ra(S,r,e)*f%e,L=Ra(O,o,e)*y%e,F=Ra(L,n,e)*l%e,z=Ra(F,r_,e);if(!n_.eql(n_.sqr(z),t))throw new Error("Cannot find square root");return z}const n_=G3e(pQ,void 0,void 0,{sqrt:s5e}),od=n5e({a:BigInt(0),b:BigInt(7),Fp:n_,n:TL,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=TL,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-i5e*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=PL(s*t,e),c=PL(-n*t,e);let l=So(t-a*r-c*i,e),f=So(-a*n-c*s,e);const u=l>o,p=f>o;if(u&&(l=e-l),p&&(f=e-f),l>o||f>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:u,k1:l,k2neg:p,k2:f}}}},Ey);BigInt(0);od.ProjectivePoint;const bu="0x0000000000000000000000000000000000000000",Zg="0x0000000000000000000000000000000000000000000000000000000000000000",o5e=`Ethereum Signed Message: -`,kL=BigInt(0),ML=BigInt(1),RL=BigInt(2),OL=BigInt(27),DL=BigInt(28),b6=BigInt(35),O1={};function NL(t){return Kc(ts(t),32)}var eg,tg,rg,G0,Ao;let wu=(Ao=class{constructor(e,r,n,i){Ie(this,eg);Ie(this,tg);Ie(this,rg);Ie(this,G0);kh(e,O1,"Signature"),ue(this,eg,r),ue(this,tg,n),ue(this,rg,i),ue(this,G0,null)}get r(){return Q(this,eg)}set r(e){ve(fp(e)===32,"invalid r","value",e),ue(this,eg,Me(e))}get s(){return Q(this,tg)}set s(e){ve(fp(e)===32,"invalid s","value",e);const r=Me(e);ve(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),ue(this,tg,r)}get v(){return Q(this,rg)}set v(e){const r=or(e,"value");ve(r===27||r===28,"invalid v","v",e),ue(this,rg,r)}get networkV(){return Q(this,G0)}get legacyChainId(){const e=this.networkV;return e==null?null:Ao.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=Ue(this.s);return this.yParity&&(e[0]|=128),Me(e)}get compactSerialized(){return qr([this.r,this.yParityAndS])}get serialized(){return qr([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Ao(O1,this.r,this.s,this.v);return this.networkV&&ue(e,G0,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const r=Pt(e,"v");return r==OL||r==DL?kL:(ve(r>=b6,"invalid EIP-155 v","v",e),(r-b6)/RL)}static getChainIdV(e,r){return Pt(e)*RL+BigInt(35+r-27)}static getNormalizedV(e){const r=Pt(e);return r===kL||r===OL?27:r===ML||r===DL?28:(ve(r>=b6,"invalid v","v",e),r&ML?27:28)}static from(e){function r(l,f){ve(l,f,"signature",e)}if(e==null)return new Ao(O1,Zg,Zg,27);if(typeof e=="string"){const l=Ue(e,"signature");if(l.length===64){const f=Me(l.slice(0,32)),u=l.slice(32,64),p=u[0]&128?28:27;return u[0]&=127,new Ao(O1,f,Me(u),p)}if(l.length===65){const f=Me(l.slice(0,32)),u=l.slice(32,64);r((u[0]&128)===0,"non-canonical s");const p=Ao.getNormalizedV(l[64]);return new Ao(O1,f,Me(u),p)}r(!1,"invalid raw signature length")}if(e instanceof Ao)return e.clone();const n=e.r;r(n!=null,"missing r");const i=NL(n),s=function(l,f){if(l!=null)return NL(l);if(f!=null){r(Gr(f,32),"invalid yParityAndS");const u=Ue(f);return u[0]&=127,Me(u)}r(!1,"missing s")}(e.s,e.yParityAndS);r((Ue(s)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(l,f,u){if(l!=null){const p=Pt(l);return{networkV:p>=b6?p:void 0,v:Ao.getNormalizedV(p)}}if(f!=null)return r(Gr(f,32),"invalid yParityAndS"),{v:Ue(f)[0]&128?28:27};if(u!=null){switch(or(u,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new Ao(O1,i,s,a);return o&&ue(c,G0,o),r(e.yParity==null||or(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}},eg=new WeakMap,tg=new WeakMap,rg=new WeakMap,G0=new WeakMap,Ao);var Uf,Ll;let Jd=(Ll=class{constructor(e){Ie(this,Uf);ve(fp(e)===32,"invalid private key","privateKey","[REDACTED]"),ue(this,Uf,Me(e))}get privateKey(){return Q(this,Uf)}get publicKey(){return Ll.computePublicKey(Q(this,Uf))}get compressedPublicKey(){return Ll.computePublicKey(Q(this,Uf),!0)}sign(e){ve(fp(e)===32,"invalid digest length","digest",e);const r=od.sign(es(e),es(Q(this,Uf)),{lowS:!0});return wu.from({r:tc(r.r,32),s:tc(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=Ll.computePublicKey(e);return Me(od.getSharedSecret(es(Q(this,Uf)),Ue(r),!1))}static computePublicKey(e,r){let n=Ue(e,"key");if(n.length===32){const s=od.getPublicKey(n,!!r);return Me(s)}if(n.length===64){const s=new Uint8Array(65);s[0]=4,s.set(n,1),n=s}const i=od.ProjectivePoint.fromHex(n);return Me(i.toRawBytes(r))}static recoverPublicKey(e,r){ve(fp(e)===32,"invalid digest length","digest",e);const n=wu.from(r);let i=od.Signature.fromCompact(es(qr([n.r,n.s])));i=i.addRecoveryBit(n.yParity);const s=i.recoverPublicKey(es(e));return ve(s!=null,"invalid signautre for digest","signature",r),"0x"+s.toHex(!1)}static addPoints(e,r,n){const i=od.ProjectivePoint.fromHex(Ll.computePublicKey(e).substring(2)),s=od.ProjectivePoint.fromHex(Ll.computePublicKey(r).substring(2));return"0x"+i.add(s).toHex(!!n)}},Uf=new WeakMap,Ll);const a5e=BigInt(0),c5e=BigInt(36);function BL(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=Ue(gr(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 yk={};for(let t=0;t<10;t++)yk[String(t)]=String(t);for(let t=0;t<26;t++)yk[String.fromCharCode(65+t)]=String(10+t);const LL=15;function l5e(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>yk[n]).join("");for(;e.length>=LL;){let n=e.substring(0,LL);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}const f5e=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function u5e(t){t=t.toLowerCase();let e=a5e;for(let r=0;re.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return Q(this,W0)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return Q(this,W0)===!0?-1:Q(this,W0)===!1?this.value.length:null}static from(e,r){return new Rf(Mf,e,r)}static uint8(e){return St(e,8)}static uint16(e){return St(e,16)}static uint24(e){return St(e,24)}static uint32(e){return St(e,32)}static uint40(e){return St(e,40)}static uint48(e){return St(e,48)}static uint56(e){return St(e,56)}static uint64(e){return St(e,64)}static uint72(e){return St(e,72)}static uint80(e){return St(e,80)}static uint88(e){return St(e,88)}static uint96(e){return St(e,96)}static uint104(e){return St(e,104)}static uint112(e){return St(e,112)}static uint120(e){return St(e,120)}static uint128(e){return St(e,128)}static uint136(e){return St(e,136)}static uint144(e){return St(e,144)}static uint152(e){return St(e,152)}static uint160(e){return St(e,160)}static uint168(e){return St(e,168)}static uint176(e){return St(e,176)}static uint184(e){return St(e,184)}static uint192(e){return St(e,192)}static uint200(e){return St(e,200)}static uint208(e){return St(e,208)}static uint216(e){return St(e,216)}static uint224(e){return St(e,224)}static uint232(e){return St(e,232)}static uint240(e){return St(e,240)}static uint248(e){return St(e,248)}static uint256(e){return St(e,256)}static uint(e){return St(e,256)}static int8(e){return St(e,-8)}static int16(e){return St(e,-16)}static int24(e){return St(e,-24)}static int32(e){return St(e,-32)}static int40(e){return St(e,-40)}static int48(e){return St(e,-48)}static int56(e){return St(e,-56)}static int64(e){return St(e,-64)}static int72(e){return St(e,-72)}static int80(e){return St(e,-80)}static int88(e){return St(e,-88)}static int96(e){return St(e,-96)}static int104(e){return St(e,-104)}static int112(e){return St(e,-112)}static int120(e){return St(e,-120)}static int128(e){return St(e,-128)}static int136(e){return St(e,-136)}static int144(e){return St(e,-144)}static int152(e){return St(e,-152)}static int160(e){return St(e,-160)}static int168(e){return St(e,-168)}static int176(e){return St(e,-176)}static int184(e){return St(e,-184)}static int192(e){return St(e,-192)}static int200(e){return St(e,-200)}static int208(e){return St(e,-208)}static int216(e){return St(e,-216)}static int224(e){return St(e,-224)}static int232(e){return St(e,-232)}static int240(e){return St(e,-240)}static int248(e){return St(e,-248)}static int256(e){return St(e,-256)}static int(e){return St(e,-256)}static bytes1(e){return jr(e,1)}static bytes2(e){return jr(e,2)}static bytes3(e){return jr(e,3)}static bytes4(e){return jr(e,4)}static bytes5(e){return jr(e,5)}static bytes6(e){return jr(e,6)}static bytes7(e){return jr(e,7)}static bytes8(e){return jr(e,8)}static bytes9(e){return jr(e,9)}static bytes10(e){return jr(e,10)}static bytes11(e){return jr(e,11)}static bytes12(e){return jr(e,12)}static bytes13(e){return jr(e,13)}static bytes14(e){return jr(e,14)}static bytes15(e){return jr(e,15)}static bytes16(e){return jr(e,16)}static bytes17(e){return jr(e,17)}static bytes18(e){return jr(e,18)}static bytes19(e){return jr(e,19)}static bytes20(e){return jr(e,20)}static bytes21(e){return jr(e,21)}static bytes22(e){return jr(e,22)}static bytes23(e){return jr(e,23)}static bytes24(e){return jr(e,24)}static bytes25(e){return jr(e,25)}static bytes26(e){return jr(e,26)}static bytes27(e){return jr(e,27)}static bytes28(e){return jr(e,28)}static bytes29(e){return jr(e,29)}static bytes30(e){return jr(e,30)}static bytes31(e){return jr(e,31)}static bytes32(e){return jr(e,32)}static address(e){return new Rf(Mf,"address",e)}static bool(e){return new Rf(Mf,"bool",!!e)}static bytes(e){return new Rf(Mf,"bytes",e)}static string(e){return new Rf(Mf,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new Rf(Mf,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===FL}static dereference(e,r){if(Rf.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};W0=new WeakMap;let ks=Rf;class h5e extends Pu{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=ks.dereference(r,"string");try{n=Qt(n)}catch(i){return this._throwError(i.message,r)}return e.writeValue(n)}decode(e){return Qt(tc(e.readValue(),20))}}class p5e extends Pu{constructor(r){super(r.name,r.type,"_",r.dynamic);de(this,"coder");this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function gQ(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(l=>{const f=l.localName;return Le(f,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),Le(!c[f],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),c[f]=!0,r[f]})}else ve(!1,"invalid tuple value","tuple",r);ve(e.length===n.length,"types/value length mismatch","tuple",r);let i=new Q7,s=new Q7,o=[];e.forEach((c,l)=>{let f=n[l];if(c.dynamic){let u=s.length;c.encode(s,f);let p=i.writeUpdatableValue();o.push(g=>{p(g+u)})}else c.encode(i,f)}),o.forEach(c=>{c(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function yQ(t,e){let r=[],n=[],i=t.subReader(0);return e.forEach(s=>{let o=null;if(s.dynamic){let a=t.readIndex(),c=i.subReader(a);try{o=s.decode(c)}catch(l){if(Is(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(t)}catch(a){if(Is(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");r.push(o),n.push(s.localName||null)}),Gg.fromItems(r,n)}class v5e extends Pu{constructor(r,n,i){const s=r.type+"["+(n>=0?n:"")+"]",o=n===-1||r.dynamic;super("array",s,i,o);de(this,"coder");de(this,"length");Ot(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let i=0;io||i<-(o+E5e))&&this._throwError("value out-of-bounds",n),i=ik(i,8*Qs)}else(iP0(s,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(i)}decode(r){let n=P0(r.readValue(),this.size*8);return this.signed&&(n=T5(n,this.size*8)),n}}class S5e extends mQ{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,Ii(ks.dereference(r,"string")))}decode(e){return Ip(super.decode(e))}}class w6 extends Pu{constructor(r,n){let i=!1;const s=[];r.forEach(a=>{a.dynamic&&(i=!0),s.push(a.type)});const o="tuple("+s.join(",")+")";super("tuple",o,n,i);de(this,"coders");Ot(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];this.coders.forEach(i=>{r.push(i.defaultValue())});const n=this.coders.reduce((i,s)=>{const o=s.localName;return o&&(i[o]||(i[o]=0),i[o]++),i},{});return this.coders.forEach((i,s)=>{let o=i.localName;!o||n[o]!==1||(o==="length"&&(o="_length"),r[o]==null&&(r[o]=r[s]))}),Object.freeze(r)}encode(r,n){const i=ks.dereference(n,"tuple");return gQ(r,this.coders,i)}decode(r){return yQ(r,this.coders)}}function Oo(t){return gr(Ii(t))}var _5e="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";const jL=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),UL=4;function I5e(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let F=1;F>--c&1}const u=31,p=2**u,g=p>>>1,y=g>>1,b=p-1;let I=0;for(let F=0;F1;){let ce=z+_>>>1;F>>1|f(),$=$<<1^g,ie=(ie^g)<<1|g|1;S=$,O=1+ie-$}let L=n-4;return C.map(F=>{switch(F-L){case 3:return L+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return L+256+(t[a++]<<8|t[a++]);case 1:return L+t[a++];default:return F-1}})}function T5e(t){let e=0;return()=>t[e++]}function bQ(t){return T5e(I5e(P5e(t)))}function P5e(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,s=0,o=0,a=0;i=8&&(n[s++]=a>>(o-=8));return n}function k5e(t){return t&1?~t>>1:t>>1}function M5e(t,e){let r=Array(t);for(let n=0,i=0;n{let e=gw(t);if(e.length)return e})}function xQ(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(R5e(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(O5e(r,t))}return e.flat()}function yw(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function EQ(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;in[o].push(s));return n}function R5e(t,e){let r=1+e(),n=e(),i=yw(e);return EQ(i.length,1+t,e).flatMap((o,a)=>{let[c,...l]=o;return Array(i[a]).fill().map((f,u)=>{let p=u*n;return[c+u*r,l.map(g=>g+p)]})})}function O5e(t,e){let r=1+e();return EQ(r,1+t,e).map(i=>[i[0],i.slice(1)])}function D5e(t){let e=[],r=gw(t);return i(n([]),[]),e;function n(s){let o=t(),a=yw(()=>{let c=gw(t).map(l=>r[l]);if(c.length)return n(c)});return{S:o,B:a,Q:s}}function i({S:s,B:o},a,c){if(!(s&4&&c===a[a.length-1])){s&2&&(c=a[a.length-1]),s&1&&e.push(a);for(let l of o)for(let f of l.Q)i(l,[...a,f],c)}}}function N5e(t){return t.toString(16).toUpperCase().padStart(2,"0")}function CQ(t){return`{${N5e(t)}}`}function B5e(t){let e=[];for(let r=0,n=t.length;r>24&255}function _Q(t){return t&16777215}let i_,$L,s_,c3;function z5e(){let t=bQ(F5e);i_=new Map(wQ(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),$L=new Set(gw(t)),s_=new Map,c3=new Map;for(let[e,r]of xQ(t)){if(!$L.has(e)&&r.length==2){let[n,i]=r,s=c3.get(n);s||(s=new Map,c3.set(n,s)),s.set(i,e)}s_.set(e,r.reverse())}}function IQ(t){return t>=mw&&t=M5&&t<$5e&&e>=R5&&eO5&&e0&&i(O5+l)}else{let o=s_.get(s);o?r.push(...o):i(s)}if(!r.length)break;s=r.pop()}if(n&&e.length>1){let s=Jm(e[0]);for(let o=1;o0&&i>=o)o==0?(e.push(n,...r),r.length=0,n=a):r.push(a),i=o;else{let c=H5e(n,a);c>=0?n=c:i==0&&o==0?(e.push(n),n=a):(r.push(a),i=o)}}return n>=0&&e.push(n,...r),e}function PQ(t){return TQ(t).map(_Q)}function W5e(t){return G5e(TQ(t))}const qL=45,kQ=".",MQ=65039,RQ=1,N5=t=>Array.from(t);function bw(t,e){return t.P.has(e)||t.Q.has(e)}class K5e extends Array{get is_emoji(){return!0}}let o_,OQ,M0,a_,DQ,Rv,i9,q1,v0,VL,c_;function mk(){if(o_)return;let t=bQ(_5e);const e=()=>gw(t),r=()=>new Set(e()),n=(f,u)=>u.forEach(p=>f.add(p));o_=new Map(xQ(t)),OQ=r(),M0=e(),a_=new Set(e().map(f=>M0[f])),M0=new Set(M0),DQ=r(),r();let i=wQ(t),s=t();const o=()=>{let f=new Set;return e().forEach(u=>n(f,i[u])),n(f,e()),f};Rv=yw(f=>{let u=yw(t).map(p=>p+96);if(u.length){let p=f>=s;u[0]-=32,u=Xg(u),p&&(u=`Restricted[${u}]`);let g=o(),y=o(),b=!t();return{N:u,P:g,Q:y,M:b,R:p}}}),i9=r(),q1=new Map;let a=e().concat(N5(i9)).sort((f,u)=>f-u);a.forEach((f,u)=>{let p=t(),g=a[u]=p?a[u-p]:{V:[],M:new Map};g.V.push(f),i9.has(f)||q1.set(f,g)});for(let{V:f,M:u}of new Set(q1.values())){let p=[];for(let y of f){let b=Rv.filter(C=>bw(C,y)),I=p.find(({G:C})=>b.some(S=>C.has(S)));I||(I={G:new Set,V:[]},p.push(I)),I.V.push(y),n(I.G,b)}let g=p.flatMap(y=>N5(y.G));for(let{G:y,V:b}of p){let I=new Set(g.filter(C=>!y.has(C)));for(let C of b)u.set(C,I)}}v0=new Set;let c=new Set;const l=f=>v0.has(f)?c.add(f):v0.add(f);for(let f of Rv){for(let u of f.P)l(u);for(let u of f.Q)l(u)}for(let f of v0)!q1.has(f)&&!c.has(f)&&q1.set(f,RQ);n(v0,PQ(v0)),VL=D5e(t).map(f=>K5e.from(f)).sort(L5e),c_=new Map;for(let f of VL){let u=[c_];for(let p of f){let g=u.map(y=>{let b=y.get(p);return b||(b=new Map,y.set(p,b)),b});p===MQ?u.push(...g):u=g}for(let p of u)p.V=f}}function bk(t){return(NQ(t)?"":`${wk(B8([t]))} `)+CQ(t)}function wk(t){return`"${t}"‎`}function Y5e(t){if(t.length>=4&&t[2]==qL&&t[3]==qL)throw new Error(`invalid label extension: "${Xg(t.slice(0,4))}"`)}function Q5e(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function J5e(t){let e=t[0],r=jL.get(e);if(r)throw Ab(`leading ${r}`);let n=t.length,i=-1;for(let s=1;se&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,s=t.length;for(let o=0;o{let s=B5e(i),o={input:s,offset:n};n+=s.length+1;try{let a=o.tokens=s4e(s,e,r),c=a.length,l;if(!c)throw new Error("empty label");let f=o.output=a.flat();if(Q5e(f),!(o.emoji=c>1||a[0].is_emoji)&&f.every(p=>p<128))Y5e(f),l="ASCII";else{let p=a.flatMap(g=>g.is_emoji?[]:g);if(!p.length)l="Emoji";else{if(M0.has(f[0]))throw Ab("leading combining mark");for(let b=1;bo.has(a)):N5(o),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(s=>bw(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function r4e(t){let e=Rv;for(let r of t){let n=e.filter(i=>bw(i,r));if(!n.length)throw Rv.some(i=>bw(i,r))?LQ(e[0],r):BQ(r);if(e=n,n.length==1)break}return e}function n4e(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${wk(B8(e,63))}: ${i}`)}return Xg(n)}).join(kQ)}function BQ(t){return new Error(`disallowed character: ${bk(t)}`)}function LQ(t,e){let r=bk(e),n=Rv.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function Ab(t){return new Error(`illegal placement: ${t}`)}function i4e(t,e){for(let r of e)if(!bw(t,r))throw LQ(t,r);if(t.M){let r=PQ(e);for(let n=1,i=r.length;nUL)throw new Error(`excessive non-spacing marks: ${wk(B8(r.slice(n-1,s)))} (${s-n}/${UL})`);n=s}}}function s4e(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let s=a4e(t);if(s)i.length&&(n.push(e(i)),i=[]),n.push(r(s));else{let o=t.pop();if(v0.has(o))i.push(o);else{let a=o_.get(o);if(a)i.push(...a);else if(!OQ.has(o))throw BQ(o)}}}return i.length&&n.push(e(i)),n}function o4e(t){return t.filter(e=>e!=MQ)}function a4e(t,e){let r=c_,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:s}=r;s&&(n=s,t.length=i)}return n}const FQ=new Uint8Array(32);FQ.fill(0);function zL(t){return ve(t.length!==0,"invalid ENS name; empty component","comp",t),t}function jQ(t){const e=Ii(c4e(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i{ve(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const i=new Uint8Array(n.length+1);return i.set(n,1),i[0]=i.length-1,i})))+"00"}function s9(t,e){return{address:Qt(t),storageKeys:e.map((r,n)=>(ve(Gr(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function Wp(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(ve(r.length===2,"invalid slot set",`value[${n}]`,r),s9(r[0],r[1])):(ve(r!=null&&typeof r=="object","invalid address-slot set","value",t),s9(r.address,r.storageKeys)));ve(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return s9(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function yx(t){let e;return typeof t=="string"?e=Jd.computePublicKey(t,!1):e=t.publicKey,Qt(gr("0x"+e.substring(4)).substring(26))}function B5(t,e){return yx(Jd.recoverPublicKey(t,e))}const Di=BigInt(0),f4e=BigInt(2),u4e=BigInt(27),d4e=BigInt(28),h4e=BigInt(35),p4e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),o9=4096*32;function HL(t,e){let r=t.toString(16);for(;r.length<2;)r="0"+r;return r+=sc(e).substring(4),"0x"+r}function L8(t){return t==="0x"?null:Qt(t)}function xk(t,e){try{return Wp(t)}catch(r){ve(!1,r.message,e,t)}}function mx(t,e){return t==="0x"?0:or(t,e)}function ci(t,e){if(t==="0x")return Di;const r=Pt(t,e);return ve(r<=p4e,"value exceeds uint size",e,r),r}function Cn(t,e){const r=Pt(t,"value"),n=ts(r);return ve(n.length<=32,"value too large",`tx.${e}`,r),n}function Ek(t){return Wp(t).map(e=>[e.address,e.storageKeys])}function v4e(t,e){ve(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;ri.data),r.map(i=>i.commitment),r.map(i=>i.proof)])]):qr(["0x03",Tp(n)])}var _l,ng,ig,sg,og,ag,cg,lg,fg,ug,dg,hg,K0,wd,$f,xd,pg,l3;const Of=class Of{constructor(){Ie(this,pg);Ie(this,_l);Ie(this,ng);Ie(this,ig);Ie(this,sg);Ie(this,og);Ie(this,ag);Ie(this,cg);Ie(this,lg);Ie(this,fg);Ie(this,ug);Ie(this,dg);Ie(this,hg);Ie(this,K0);Ie(this,wd);Ie(this,$f);Ie(this,xd);ue(this,_l,null),ue(this,ng,null),ue(this,sg,0),ue(this,og,Di),ue(this,ag,null),ue(this,cg,null),ue(this,lg,null),ue(this,ig,"0x"),ue(this,fg,Di),ue(this,ug,Di),ue(this,dg,null),ue(this,hg,null),ue(this,K0,null),ue(this,wd,null),ue(this,xd,null),ue(this,$f,null)}get type(){return Q(this,_l)}set type(e){switch(e){case null:ue(this,_l,null);break;case 0:case"legacy":ue(this,_l,0);break;case 1:case"berlin":case"eip-2930":ue(this,_l,1);break;case 2:case"london":case"eip-1559":ue(this,_l,2);break;case 3:case"cancun":case"eip-4844":ue(this,_l,3);break;default:ve(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=Q(this,ng);return e==null&&this.type===3?bu:e}set to(e){ue(this,ng,e==null?null:Qt(e))}get nonce(){return Q(this,sg)}set nonce(e){ue(this,sg,or(e,"value"))}get gasLimit(){return Q(this,og)}set gasLimit(e){ue(this,og,Pt(e))}get gasPrice(){const e=Q(this,ag);return e==null&&(this.type===0||this.type===1)?Di:e}set gasPrice(e){ue(this,ag,e==null?null:Pt(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=Q(this,cg);return e??(this.type===2||this.type===3?Di:null)}set maxPriorityFeePerGas(e){ue(this,cg,e==null?null:Pt(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=Q(this,lg);return e??(this.type===2||this.type===3?Di:null)}set maxFeePerGas(e){ue(this,lg,e==null?null:Pt(e,"maxFeePerGas"))}get data(){return Q(this,ig)}set data(e){ue(this,ig,Me(e))}get value(){return Q(this,fg)}set value(e){ue(this,fg,Pt(e,"value"))}get chainId(){return Q(this,ug)}set chainId(e){ue(this,ug,Pt(e))}get signature(){return Q(this,dg)||null}set signature(e){ue(this,dg,e==null?null:wu.from(e))}get accessList(){const e=Q(this,hg)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){ue(this,hg,e==null?null:Wp(e))}get maxFeePerBlobGas(){const e=Q(this,K0);return e==null&&this.type===3?Di:e}set maxFeePerBlobGas(e){ue(this,K0,e==null?null:Pt(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=Q(this,wd);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){ve(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let r=0;rObject.assign({},e))}set blobs(e){if(e==null){ue(this,xd,null);return}const r=[],n=[];for(let i=0;i=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,i=Q(this,K0)!=null||Q(this,wd);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&Le(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Le(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Le(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return this.type!=null?s.push(this.type):r?s.push(2):e?(s.push(1),n||s.push(0)):n?(s.push(1),s.push(2)):(i&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Of.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Of;if(typeof e=="string"){const n=Ue(e);if(n[0]>=127)return Of.from(g4e(n));switch(n[0]){case 1:return Of.from(w4e(n));case 2:return Of.from(m4e(n));case 3:return Of.from(E4e(n))}Le(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new Of;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=wu.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(r.kzg=e.kzg),e.blobs!=null&&(r.blobs=e.blobs),e.hash!=null&&(ve(r.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),ve(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(ve(r.isSigned(),"unsigned transaction cannot define '.from'","tx",e),ve(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};_l=new WeakMap,ng=new WeakMap,ig=new WeakMap,sg=new WeakMap,og=new WeakMap,ag=new WeakMap,cg=new WeakMap,lg=new WeakMap,fg=new WeakMap,ug=new WeakMap,dg=new WeakMap,hg=new WeakMap,K0=new WeakMap,wd=new WeakMap,$f=new WeakMap,xd=new WeakMap,pg=new WeakSet,l3=function(e,r){Le(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return y4e(this,n);case 1:return x4e(this,n);case 2:return b4e(this,n);case 3:return C4e(this,n,r?this.blobs:null)}Le(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let ww=Of;function Ak(t){return typeof t=="string"&&(t=Ii(t)),gr(qr([Ii(o5e),Ii(String(t.length)),t]))}function A4e(t,e){const r=Ak(t);return B5(r,e)}const S4e=new RegExp("^bytes([0-9]+)$"),_4e=new RegExp("^(u?int)([0-9]*)$"),I4e=new RegExp("^(.*)\\[([0-9]*)\\]$");function UQ(t,e,r){switch(t){case"address":return Ue(r?Kc(e,32):Qt(e));case"string":return Ii(e);case"bytes":return Ue(e);case"bool":return e=e?"0x01":"0x00",Ue(r?Kc(e,32):e)}let n=t.match(_4e);if(n){let i=n[1]==="int",s=parseInt(n[2]||"256");return ve((!n[2]||n[2]===String(s))&&s%8===0&&s!==0&&s<=256,"invalid number type","type",t),r&&(s=256),i&&(e=ik(e,s)),Ue(Kc(ts(e),s/8))}if(n=t.match(S4e),n){const i=parseInt(n[1]);return ve(String(i)===n[1]&&i!==0&&i<=32,"invalid bytes type","type",t),ve(fp(e)===i,`invalid value for ${t}`,"value",e),r?Ue(oY(e,32)):e}if(n=t.match(I4e),n&&Array.isArray(e)){const i=n[1],s=parseInt(n[2]||String(e.length));ve(s===e.length,`invalid array length for ${t}`,"value",e);const o=[];return e.forEach(function(a){o.push(UQ(i,a,!0))}),Ue(qr(o))}ve(!1,"invalid type","type",t)}function Cr(t,e){ve(t.length===e.length,"wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(UQ(n,e[i]))}),Me(qr(r))}function dp(t,e){return gr(Cr(t,e))}const $Q=new Uint8Array(32);$Q.fill(0);const T4e=BigInt(-1),qQ=BigInt(0),VQ=BigInt(1),P4e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function k4e(t){const e=Ue(t),r=e.length%32;return r?qr([e,$Q.slice(r)]):Me(e)}const M4e=tc(VQ,32),R4e=tc(qQ,32),GL={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},a9=["name","version","chainId","verifyingContract","salt"];function WL(t){return function(e){return ve(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const O4e={name:WL("name"),version:WL("version"),chainId:function(t){const e=Pt(t,"domain.chainId");return ve(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):zc(e)},verifyingContract:function(t){try{return Qt(t).toLowerCase()}catch{}ve(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=Ue(t,"domain.salt");return ve(e.length===32,'invalid domain value "salt"',"domain.salt",t),Me(e)}};function c9(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);ve(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const i=P0(P4e,r?n-1:n),s=r?(i+VQ)*T4e:qQ;return function(o){const a=Pt(o,"value");return ve(a>=s&&a<=i,`value out-of-bounds for ${t}`,"value",a),tc(r?ik(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return ve(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const i=Ue(n);return ve(i.length===r,`invalid length for ${t}`,"value",n),k4e(n)}}}switch(t){case"address":return function(e){return Kc(Qt(e),32)};case"bool":return function(e){return e?M4e:R4e};case"bytes":return function(e){return gr(e)};case"string":return function(e){return Oo(e)}}return null}function KL(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function x6(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var Fw,qf,vg,y4,zQ;const Ua=class Ua{constructor(e){Ie(this,y4);de(this,"primaryType");Ie(this,Fw);Ie(this,qf);Ie(this,vg);ue(this,qf,new Map),ue(this,vg,new Map);const r=new Map,n=new Map,i=new Map,s={};Object.keys(e).forEach(c=>{s[c]=e[c].map(({name:l,type:f})=>{let{base:u,index:p}=x6(f);return u==="int"&&!e.int&&(u="int256"),u==="uint"&&!e.uint&&(u="uint256"),{name:l,type:u+(p||"")}}),r.set(c,new Set),n.set(c,[]),i.set(c,new Set)}),ue(this,Fw,JSON.stringify(s));for(const c in s){const l=new Set;for(const f of s[c]){ve(!l.has(f.name),`duplicate variable name ${JSON.stringify(f.name)} in ${JSON.stringify(c)}`,"types",e),l.add(f.name);const u=x6(f.type).base;ve(u!==c,`circular type reference to ${JSON.stringify(u)}`,"types",e),!c9(u)&&(ve(n.has(u),`unknown type ${JSON.stringify(u)}`,"types",e),n.get(u).push(c),r.get(c).add(u))}}const o=Array.from(n.keys()).filter(c=>n.get(c).length===0);ve(o.length!==0,"missing primary type","types",e),ve(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),Ot(this,{primaryType:o[0]});function a(c,l){ve(!l.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),l.add(c);for(const f of r.get(c))if(n.has(f)){a(f,l);for(const u of l)i.get(u).add(f)}l.delete(c)}a(this.primaryType,new Set);for(const[c,l]of i){const f=Array.from(l);f.sort(),Q(this,qf).set(c,KL(c,s[c])+f.map(u=>KL(u,s[u])).join(""))}}get types(){return JSON.parse(Q(this,Fw))}getEncoder(e){let r=Q(this,vg).get(e);return r||(r=qe(this,y4,zQ).call(this,e),Q(this,vg).set(e,r)),r}encodeType(e){const r=Q(this,qf).get(e);return ve(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return gr(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(c9(e))return n(e,r);const i=x6(e).array;if(i)return ve(i.count===-1||i.count===r.length,`array length mismatch; expected length ${i.count}`,"value",r),r.map(o=>this._visit(i.prefix,o,n));const s=this.types[e];if(s)return s.reduce((o,{name:a,type:c})=>(o[a]=this._visit(c,r[a],n),o),{});ve(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new Ua(e)}static getPrimaryType(e){return Ua.from(e).primaryType}static hashStruct(e,r,n){return Ua.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const i=GL[n];ve(i,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>a9.indexOf(n.name)-a9.indexOf(i.name)),Ua.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return qr(["0x1901",Ua.hashDomain(e),Ua.from(r).hash(n)])}static hash(e,r,n){return gr(Ua.encode(e,r,n))}static async resolveNames(e,r,n,i){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const s={};e.verifyingContract&&!Gr(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=Ua.from(r);o.visit(n,(a,c)=>(a==="address"&&!Gr(c,20)&&(s[c]="0x"),c));for(const a in s)s[a]=await i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=o.visit(n,(a,c)=>a==="address"&&s[c]?s[c]:c),{domain:e,value:n}}static getPayload(e,r,n){Ua.hashDomain(e);const i={},s=[];a9.forEach(c=>{const l=e[c];l!=null&&(i[c]=O4e[c](l),s.push({name:c,type:GL[c]}))});const o=Ua.from(r);r=o.types;const a=Object.assign({},r);return ve(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),a.EIP712Domain=s,o.encode(n),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(n,(c,l)=>{if(c.match(/^bytes(\d*)/))return Me(Ue(l));if(c.match(/^u?int/))return Pt(l).toString();switch(c){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return ve(typeof l=="string","invalid string","value",l),l}ve(!1,"unsupported type","type",c)})}}};Fw=new WeakMap,qf=new WeakMap,vg=new WeakMap,y4=new WeakSet,zQ=function(e){{const i=c9(e);if(i)return i}const r=x6(e).array;if(r){const i=r.prefix,s=this.getEncoder(i);return o=>{ve(r.count===-1||r.count===o.length,`array length mismatch; expected length ${r.count}`,"value",o);let a=o.map(s);return Q(this,qf).has(i)&&(a=a.map(gr)),gr(qr(a))}}const n=this.types[e];if(n){const i=Oo(Q(this,qf).get(e));return s=>{const o=n.map(({name:a,type:c})=>{const l=this.getEncoder(c)(s[a]);return Q(this,qf).has(c)?gr(l):l});return o.unshift(i),qr(o)}}ve(!1,`unknown type: ${e}`,"type",e)};let uh=Ua;function Js(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const D4e="external public payable override",N4e=Js(D4e.split(" ")),HQ="constant external internal payable private public pure view override",B4e=Js(HQ.split(" ")),GQ="constructor error event fallback function receive struct",WQ=Js(GQ.split(" ")),KQ="calldata memory storage payable indexed",L4e=Js(KQ.split(" ")),F4e="tuple returns",j4e=[GQ,KQ,F4e,HQ].join(" "),U4e=Js(j4e.split(" ")),$4e={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},q4e=new RegExp("^(\\s*)"),V4e=new RegExp("^([0-9]+)"),z4e=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),YQ=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),QQ=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Yi,Fc,jw,f_;const m4=class m4{constructor(e){Ie(this,jw);Ie(this,Yi);Ie(this,Fc);ue(this,Yi,0),ue(this,Fc,e.slice())}get offset(){return Q(this,Yi)}get length(){return Q(this,Fc).length-Q(this,Yi)}clone(){return new m4(Q(this,Fc))}reset(){ue(this,Yi,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=qe(this,jw,f_).call(this,Q(this,Yi)+1,e.match+1);return ue(this,Yi,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;Q(this,Yi)=Q(this,Fc).length)throw new Error("out-of-bounds");return Q(this,Fc)[Q(this,Yi)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return dm(this,Yi)._++,e}toString(){const e=[];for(let r=Q(this,Yi);r`}};Yi=new WeakMap,Fc=new WeakMap,jw=new WeakSet,f_=function(e=0,r=0){return new m4(Q(this,Fc).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Jc=m4;function Rh(t){const e=[],r=o=>{const a=s0&&e[e.length-1].type==="NUMBER"){const u=e.pop().text;f=u+f,e[e.length-1].value=or(u)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=f}continue}if(a=o.match(z4e),a){if(c.text=a[1],s+=c.text.length,U4e.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(QQ)){c.type="TYPE";continue}c.type="ID";continue}if(a=o.match(V4e),a){c.text=a[1],c.type="NUMBER",s+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Jc(e.map(o=>Object.freeze(o)))}function YL(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function F8(t,e){if(e.peekKeyword(WQ)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function xu(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function JQ(t){let e=xu(t,B4e);return YL(e,Js("constant payable nonpayable".split(" "))),YL(e,Js("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function cu(t,e){return t.popParams().map(r=>ss.from(r,e))}function ZQ(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Pt(t.pop().text);throw new Error("invalid gas")}return null}function Pp(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const H4e=new RegExp(/^(.*)\[([0-9]*)\]$/);function QL(t){const e=t.match(QQ);if(ve(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);ve(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);ve(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const Rn={},Do=Symbol.for("_ethers_internal"),JL="_ParamTypeInternal",ZL="_ErrorInternal",XL="_EventInternal",eF="_ConstructorInternal",tF="_FallbackInternal",rF="_FunctionInternal",nF="_StructInternal";var gg,f3;const $a=class $a{constructor(e,r,n,i,s,o,a,c){Ie(this,gg);de(this,"name");de(this,"type");de(this,"baseType");de(this,"indexed");de(this,"components");de(this,"arrayLength");de(this,"arrayChildren");if(kh(e,Rn,"ParamType"),Object.defineProperty(this,Do,{value:JL}),o&&(o=Object.freeze(o.slice())),i==="array"){if(a==null||c==null)throw new Error("")}else if(a!=null||c!=null)throw new Error("");if(i==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");Ot(this,{name:r,type:n,baseType:i,indexed:s,components:o,arrayLength:a,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=n,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(i=>n.arrayChildren.walk(i,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((i,s)=>n.components[s].walk(i,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],i=[e];return qe(this,gg,f3).call(this,n,e,r,s=>{i[0]=s}),n.length&&await Promise.all(n),i[0]}static from(e,r){if($a.isParamType(e))return e;if(typeof e=="string")try{return $a.from(Rh(e),r)}catch{ve(!1,"invalid param type","obj",e)}else if(e instanceof Jc){let a="",c="",l=null;xu(e,Js(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",l=e.popParams().map(b=>$a.from(b)),a=`tuple(${l.map(b=>b.format()).join(",")})`):(a=QL(e.popType("TYPE")),c=a);let f=null,u=null;for(;e.length&&e.peekType("BRACKET");){const b=e.pop();f=new $a(Rn,"",a,c,null,l,u,f),u=b.value,a+=b.text,c="array",l=null}let p=null;if(xu(e,L4e).has("indexed")){if(!r)throw new Error("");p=!0}const y=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new $a(Rn,y,a,c,p,l,u,f)}const n=e.name;ve(!n||typeof n=="string"&&n.match(YQ),"invalid name","obj.name",n);let i=e.indexed;i!=null&&(ve(r,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let s=e.type,o=s.match(H4e);if(o){const a=parseInt(o[2]||"-1"),c=$a.from({type:o[1],components:e.components});return new $a(Rn,n||"",s,"array",i,null,a,c)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const a=e.components!=null?e.components.map(l=>$a.from(l)):null;return new $a(Rn,n||"",s,"tuple",i,a,null,null)}return s=QL(e.type),new $a(Rn,n||"",s,s,i,null,null,null)}static isParamType(e){return e&&e[Do]===JL}};gg=new WeakSet,f3=function(e,r,n,i){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=r.slice();a.forEach((c,l)=>{var f;qe(f=o,gg,f3).call(f,e,c,n,u=>{a[l]=u})}),i(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(r))a=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");a=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((c,l)=>{var f;qe(f=o[l],gg,f3).call(f,e,c,n,u=>{a[l]=u})}),i(a);return}const s=n(this.type,r);s.then?e.push(async function(){i(await s)}()):i(s)};let ss=$a;class kp{constructor(e,r,n){de(this,"type");de(this,"inputs");kh(e,Rn,"Fragment"),n=Object.freeze(n.slice()),Ot(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{kp.from(JSON.parse(e))}catch{}return kp.from(Rh(e))}if(e instanceof Jc)switch(e.peekKeyword(WQ)){case"constructor":return Xf.from(e);case"error":return Io.from(e);case"event":return Nl.from(e);case"fallback":case"receive":return Nf.from(e);case"function":return Bl.from(e);case"struct":return hp.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Xf.from(e);case"error":return Io.from(e);case"event":return Nl.from(e);case"fallback":case"receive":return Nf.from(e);case"function":return Bl.from(e);case"struct":return hp.from(e)}Le(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}ve(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Xf.isFragment(e)}static isError(e){return Io.isFragment(e)}static isEvent(e){return Nl.isFragment(e)}static isFunction(e){return Bl.isFragment(e)}static isStruct(e){return hp.isFragment(e)}}class j8 extends kp{constructor(r,n,i,s){super(r,n,s);de(this,"name");ve(typeof i=="string"&&i.match(YQ),"invalid identifier","name",i),s=Object.freeze(s.slice()),Ot(this,{name:i})}}function xw(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class Io extends j8{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,Do,{value:ZL})}get selector(){return Oo(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+xw(e,this.inputs)),r.join(" ")}static from(e){if(Io.isFragment(e))return e;if(typeof e=="string")return Io.from(Rh(e));if(e instanceof Jc){const r=F8("error",e),n=cu(e);return Pp(e),new Io(Rn,r,n)}return new Io(Rn,e.name,e.inputs?e.inputs.map(ss.from):[])}static isFragment(e){return e&&e[Do]===ZL}}class Nl extends j8{constructor(r,n,i,s){super(r,"event",n,i);de(this,"anonymous");Object.defineProperty(this,Do,{value:XL}),Ot(this,{anonymous:s})}get topicHash(){return Oo(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+xw(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(s=>ss.from(s)),new Nl(Rn,r,n,!1).topicHash}static from(r){if(Nl.isFragment(r))return r;if(typeof r=="string")try{return Nl.from(Rh(r))}catch{ve(!1,"invalid event fragment","obj",r)}else if(r instanceof Jc){const n=F8("event",r),i=cu(r,!0),s=!!xu(r,Js(["anonymous"])).has("anonymous");return Pp(r),new Nl(Rn,n,i,s)}return new Nl(Rn,r.name,r.inputs?r.inputs.map(n=>ss.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[Do]===XL}}class Xf extends kp{constructor(r,n,i,s,o){super(r,n,i);de(this,"payable");de(this,"gas");Object.defineProperty(this,Do,{value:eF}),Ot(this,{payable:s,gas:o})}format(r){if(Le(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[`constructor${xw(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(Xf.isFragment(r))return r;if(typeof r=="string")try{return Xf.from(Rh(r))}catch{ve(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Jc){xu(r,Js(["constructor"]));const n=cu(r),i=!!xu(r,N4e).has("payable"),s=ZQ(r);return Pp(r),new Xf(Rn,"constructor",n,i,s)}return new Xf(Rn,"constructor",r.inputs?r.inputs.map(ss.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Do]===eF}}class Nf extends kp{constructor(r,n,i){super(r,"fallback",n);de(this,"payable");Object.defineProperty(this,Do,{value:tF}),Ot(this,{payable:i})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const i=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:i})}return`${n}()${this.payable?" payable":""}`}static from(r){if(Nf.isFragment(r))return r;if(typeof r=="string")try{return Nf.from(Rh(r))}catch{ve(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Jc){const n=r.toString(),i=r.peekKeyword(Js(["fallback","receive"]));if(ve(i,"type must be fallback or receive","obj",n),r.popKeyword(Js(["fallback","receive"]))==="receive"){const c=cu(r);return ve(c.length===0,"receive cannot have arguments","obj.inputs",c),xu(r,Js(["payable"])),Pp(r),new Nf(Rn,[],!0)}let o=cu(r);o.length?ve(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[ss.from("bytes")];const a=JQ(r);if(ve(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),xu(r,Js(["returns"])).has("returns")){const c=cu(r);ve(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(l=>l.format("minimal")).join(", "))}return Pp(r),new Nf(Rn,o,a==="payable")}if(r.type==="receive")return new Nf(Rn,[],!0);if(r.type==="fallback"){const n=[ss.from("bytes")],i=r.stateMutability==="payable";return new Nf(Rn,n,i)}ve(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[Do]===tF}}class Bl extends j8{constructor(r,n,i,s,o,a){super(r,"function",n,s);de(this,"constant");de(this,"outputs");de(this,"stateMutability");de(this,"payable");de(this,"gas");Object.defineProperty(this,Do,{value:rF}),o=Object.freeze(o.slice()),Ot(this,{constant:i==="view"||i==="pure",gas:a,outputs:o,payable:i==="payable",stateMutability:i})}get selector(){return Oo(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="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!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r))),outputs:this.outputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+xw(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(xw(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(s=>ss.from(s)),new Bl(Rn,r,"view",n,[],null).selector}static from(r){if(Bl.isFragment(r))return r;if(typeof r=="string")try{return Bl.from(Rh(r))}catch{ve(!1,"invalid function fragment","obj",r)}else if(r instanceof Jc){const i=F8("function",r),s=cu(r),o=JQ(r);let a=[];xu(r,Js(["returns"])).has("returns")&&(a=cu(r));const c=ZQ(r);return Pp(r),new Bl(Rn,i,o,s,a,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new Bl(Rn,r.name,n,r.inputs?r.inputs.map(ss.from):[],r.outputs?r.outputs.map(ss.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Do]===rF}}class hp extends j8{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,Do,{value:nF})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return hp.from(Rh(e))}catch{ve(!1,"invalid struct fragment","obj",e)}else if(e instanceof Jc){const r=F8("struct",e),n=cu(e);return Pp(e),new hp(Rn,r,n)}return new hp(Rn,e.name,e.inputs?e.inputs.map(ss.from):[])}static isFragment(e){return e&&e[Do]===nF}}const tl=new Map;tl.set(0,"GENERIC_PANIC");tl.set(1,"ASSERT_FALSE");tl.set(17,"OVERFLOW");tl.set(18,"DIVIDE_BY_ZERO");tl.set(33,"ENUM_RANGE_ERROR");tl.set(34,"BAD_STORAGE_DATA");tl.set(49,"STACK_UNDERFLOW");tl.set(50,"ARRAY_RANGE_ERROR");tl.set(65,"OUT_OF_MEMORY");tl.set(81,"UNINITIALIZED_FUNCTION_CALL");const G4e=new RegExp(/^bytes([0-9]*)$/),W4e=new RegExp(/^(u?int)([0-9]*)$/);let l9=null,iF=1024;function K4e(t,e,r,n){let i="missing revert data",s=null;const o=null;let a=null;if(r){i="execution reverted";const l=Ue(r);if(r=Me(r),l.length===0)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(l.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(Me(l.slice(0,4))==="0x08c379a0")try{s=n.decode(["string"],l.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[s]},i+=`: ${JSON.stringify(s)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(Me(l.slice(0,4))==="0x4e487b71")try{const f=Number(n.decode(["uint256"],l.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[f]},s=`Panic due to ${tl.get(f)||"UNKNOWN"}(${f})`,i+=`: ${s}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const c={to:e.to?Qt(e.to):null,data:e.data||"0x"};return e.from&&(c.from=Qt(e.from)),zn(i,"CALL_EXCEPTION",{action:t,data:r,reason:s,transaction:c,invocation:o,revert:a})}var Ed,V1;const b4=class b4{constructor(){Ie(this,Ed)}getDefaultValue(e){const r=e.map(i=>qe(this,Ed,V1).call(this,ss.from(i)));return new w6(r,"_").defaultValue()}encode(e,r){rY(r.length,e.length,"types/values length mismatch");const n=e.map(o=>qe(this,Ed,V1).call(this,ss.from(o))),i=new w6(n,"_"),s=new Q7;return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(o=>qe(this,Ed,V1).call(this,ss.from(o)));return new w6(i,"_").decode(new J7(r,n,iF))}static _setDefaultMaxInflation(e){ve(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),iF=e}static defaultAbiCoder(){return l9==null&&(l9=new b4),l9}static getBuiltinCallException(e,r,n){return K4e(e,r,n,b4.defaultAbiCoder())}};Ed=new WeakSet,V1=function(e){if(e.isArray())return new v5e(qe(this,Ed,V1).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new w6(e.components.map(n=>qe(this,Ed,V1).call(this,n)),e.name);switch(e.baseType){case"address":return new h5e(e.name);case"bool":return new g5e(e.name);case"string":return new S5e(e.name);case"bytes":return new y5e(e.name);case"":return new w5e(e.name)}let r=e.type.match(W4e);if(r){let n=parseInt(r[2]||"256");return ve(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new A5e(n/8,r[1]==="int",e.name)}if(r=e.type.match(G4e),r){let n=parseInt(r[1]);return ve(n!==0&&n<=32,"invalid bytes length","param",e),new m5e(n,e.name)}ve(!1,"invalid type","type",e.type)};let Ns=b4;class Y4e{constructor(e,r,n){de(this,"fragment");de(this,"name");de(this,"signature");de(this,"topic");de(this,"args");const i=e.name,s=e.format();Ot(this,{fragment:e,name:i,signature:s,topic:r,args:n})}}class Q4e{constructor(e,r,n,i){de(this,"fragment");de(this,"name");de(this,"args");de(this,"signature");de(this,"selector");de(this,"value");const s=e.name,o=e.format();Ot(this,{fragment:e,name:s,args:n,signature:o,selector:r,value:i})}}class J4e{constructor(e,r,n){de(this,"fragment");de(this,"name");de(this,"args");de(this,"signature");de(this,"selector");const i=e.name,s=e.format();Ot(this,{fragment:e,name:i,args:n,signature:s,selector:r})}}class sF{constructor(e){de(this,"hash");de(this,"_isIndexed");Ot(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const oF={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},aF={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&oF[t.toString()]&&(e=oF[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var Il,Tl,Pl,ws,Kl,u3,d3;const A0=class A0{constructor(e){Ie(this,Kl);de(this,"fragments");de(this,"deploy");de(this,"fallback");de(this,"receive");Ie(this,Il);Ie(this,Tl);Ie(this,Pl);Ie(this,ws);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,ue(this,Pl,new Map),ue(this,Il,new Map),ue(this,Tl,new Map);const n=[];for(const o of r)try{n.push(kp.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Ot(this,{fragments:Object.freeze(n)});let i=null,s=!1;ue(this,ws,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ot(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(ve(!i||o.payable!==i.payable,"conflicting fallback fragments",`fragments[${a}]`,o),i=o,s=i.payable);return;case"function":c=Q(this,Pl);break;case"event":c=Q(this,Tl);break;case"error":c=Q(this,Il);break;default:return}const l=o.format();c.has(l)||c.set(l,o)}),this.deploy||Ot(this,{deploy:Xf.from("constructor()")}),Ot(this,{fallback:i,receive:s})}format(e){const r=e?"minimal":"full";return this.fragments.map(i=>i.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return Ns.defaultAbiCoder()}getFunctionName(e){const r=qe(this,Kl,u3).call(this,e,null,!1);return ve(r,"no matching function","key",e),r.name}hasFunction(e){return!!qe(this,Kl,u3).call(this,e,null,!1)}getFunction(e,r){return qe(this,Kl,u3).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from(Q(this,Pl).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;nn.localeCompare(i));for(let n=0;n1){const s=i.map(o=>JSON.stringify(o.format())).join(", ");ve(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return i[0]}if(e=Io.from(e).format(),e==="Error(string)")return Io.from("error Error(string)");if(e==="Panic(uint256)")return Io.from("error Panic(uint256)");const n=Q(this,Il).get(e);return n||null}forEachError(e){const r=Array.from(Q(this,Il).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;ns.type==="string"?Oo(o):s.type==="bytes"?gr(Me(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=tc(o):s.type.match(/^bytes/)?o=oY(o,32):s.type==="address"&&Q(this,ws).encode(["address"],[o]),Kc(Me(o),32));for(r.forEach((s,o)=>{const a=e.inputs[o];if(!a.indexed){ve(s==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?ve(!1,"filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?n.push(s.map(c=>i(a,c))):n.push(i(a,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const o=this.getEvent(e);ve(o,"unknown event","eventFragment",e),e=o}const n=[],i=[],s=[];return e.anonymous||n.push(e.topicHash),ve(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const c=r[a];if(o.indexed)if(o.type==="string")n.push(Oo(c));else if(o.type==="bytes")n.push(gr(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(Q(this,ws).encode([o.type],[c]))}else i.push(o),s.push(c)}),{data:Q(this,ws).encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const g=this.getEvent(e);ve(g,"unknown event","eventFragment",e),e=g}if(n!=null&&!e.anonymous){const g=e.topicHash;ve(Gr(n[0],32)&&n[0].toLowerCase()===g,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const i=[],s=[],o=[];e.inputs.forEach((g,y)=>{g.indexed?g.type==="string"||g.type==="bytes"||g.baseType==="tuple"||g.baseType==="array"?(i.push(ss.from({type:"bytes32",name:g.name})),o.push(!0)):(i.push(g),o.push(!1)):(s.push(g),o.push(!1))});const a=n!=null?Q(this,ws).decode(i,qr(n)):null,c=Q(this,ws).decode(s,r,!0),l=[],f=[];let u=0,p=0;return e.inputs.forEach((g,y)=>{let b=null;if(g.indexed)if(a==null)b=new sF(null);else if(o[y])b=new sF(a[p++]);else try{b=a[p++]}catch(I){b=I}else try{b=c[u++]}catch(I){b=I}l.push(b),f.push(g.name||null)}),Gg.fromItems(l,f)}parseTransaction(e){const r=Ue(e.data,"tx.data"),n=Pt(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(Me(r.slice(0,4)));if(!i)return null;const s=Q(this,ws).decode(i.inputs,r.slice(4));return new Q4e(i,i.selector,s,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new Y4e(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=Me(e),n=this.getError(mn(r,0,4));if(!n)return null;const i=Q(this,ws).decode(n.inputs,mn(r,4));return new J4e(n,n.selector,i)}static from(e){return e instanceof A0?e:typeof e=="string"?new A0(JSON.parse(e)):typeof e.formatJson=="function"?new A0(e.formatJson()):typeof e.format=="function"?new A0(e.format("json")):new A0(e)}};Il=new WeakMap,Tl=new WeakMap,Pl=new WeakMap,ws=new WeakMap,Kl=new WeakSet,u3=function(e,r,n){if(Gr(e)){const s=e.toLowerCase();for(const o of Q(this,Pl).values())if(s===o.selector)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of Q(this,Pl))o.split("(")[0]===e&&s.push(a);if(r){const o=r.length>0?r[r.length-1]:null;let a=r.length,c=!0;ks.isTyped(o)&&o.type==="overrides"&&(c=!1,a--);for(let l=s.length-1;l>=0;l--){const f=s[l].inputs.length;f!==a&&(!c||f!==a-1)&&s.splice(l,1)}for(let l=s.length-1;l>=0;l--){const f=s[l].inputs;for(let u=0;u=f.length){if(r[u].type==="overrides")continue;s.splice(l,1);break}if(r[u].type!==f[u].baseType){s.splice(l,1);break}}}}if(s.length===1&&r&&r.length!==s[0].inputs.length){const o=r[r.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&n){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ve(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return s[0]}const i=Q(this,Pl).get(Bl.from(e).format());return i||null},d3=function(e,r,n){if(Gr(e)){const s=e.toLowerCase();for(const o of Q(this,Tl).values())if(s===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of Q(this,Tl))o.split("(")[0]===e&&s.push(a);if(r){for(let o=s.length-1;o>=0;o--)s[o].inputs.length=0;o--){const a=s[o].inputs;for(let c=0;c1&&n){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ve(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return s[0]}const i=Q(this,Tl).get(Nl.from(e).format());return i||null};let $i=A0;const XQ=BigInt(0);function Ov(t){return t??null}function si(t){return t==null?null:t.toString()}class cF{constructor(e,r,n){de(this,"gasPrice");de(this,"maxFeePerGas");de(this,"maxPriorityFeePerGas");Ot(this,{gasPrice:Ov(e),maxFeePerGas:Ov(r),maxPriorityFeePerGas:Ov(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:si(e),maxFeePerGas:si(r),maxPriorityFeePerGas:si(n)}}}function Ew(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Me(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=Pt(t[i],`request.${i}`));const n="type,nonce".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=or(t[i],`request.${i}`));return t.accessList&&(e.accessList=Wp(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(i=>mu(i)?Me(i):Object.assign({},i))),e}var Vf;class Z4e{constructor(e,r){de(this,"provider");de(this,"number");de(this,"hash");de(this,"timestamp");de(this,"parentHash");de(this,"parentBeaconBlockRoot");de(this,"nonce");de(this,"difficulty");de(this,"gasLimit");de(this,"gasUsed");de(this,"stateRoot");de(this,"receiptsRoot");de(this,"blobGasUsed");de(this,"excessBlobGas");de(this,"miner");de(this,"prevRandao");de(this,"extraData");de(this,"baseFeePerGas");Ie(this,Vf);ue(this,Vf,e.transactions.map(n=>typeof n!="string"?new Cw(n,r):n)),Ot(this,{provider:r,hash:Ov(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Ov(e.prevRandao),extraData:e.extraData,baseFeePerGas:Ov(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return Q(this,Vf).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=Q(this,Vf).slice();return e.length===0?[]:(Le(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:i,gasUsed:s,hash:o,miner:a,prevRandao:c,nonce:l,number:f,parentHash:u,parentBeaconBlockRoot:p,stateRoot:g,receiptsRoot:y,timestamp:b,transactions:I}=this;return{_type:"Block",baseFeePerGas:si(e),difficulty:si(r),extraData:n,gasLimit:si(i),gasUsed:si(s),blobGasUsed:si(this.blobGasUsed),excessBlobGas:si(this.excessBlobGas),hash:o,miner:a,prevRandao:c,nonce:l,number:f,parentHash:u,timestamp:b,parentBeaconBlockRoot:p,stateRoot:g,receiptsRoot:y,transactions:I}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>enew bx(i,r))));let n=XQ;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Ot(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return Q(this,Uw)}toJSON(){const{to:e,from:r,contractAddress:n,hash:i,index:s,blockHash:o,blockNumber:a,logsBloom:c,logs:l,status:f,root:u}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:n,cumulativeGasUsed:si(this.cumulativeGasUsed),from:r,gasPrice:si(this.gasPrice),blobGasUsed:si(this.blobGasUsed),blobGasPrice:si(this.blobGasPrice),gasUsed:si(this.gasUsed),hash:i,index:s,logs:l,logsBloom:c,root:u,status:f,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(a)return null;const{blockNumber:p,nonce:g}=await pi({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(g{if(p==null||p.status!==0)return p;Le(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:p.to,from:p.from,data:""},receipt:p})},f=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(f);if(f){if(await f.confirmations()>=n)return l(f)}else if(await c(),n===0)return null;return await new Promise((p,g)=>{const y=[],b=()=>{y.forEach(C=>C())};if(y.push(()=>{a=!0}),i>0){const C=setTimeout(()=>{b(),g(zn("wait for transaction timeout","TIMEOUT"))},i);y.push(()=>{clearTimeout(C)})}const I=async C=>{if(await C.confirmations()>=n){b();try{p(l(C))}catch(S){g(S)}}};if(y.push(()=>{this.provider.off(this.hash,I)}),this.provider.on(this.hash,I),s>=0){const C=async()=>{try{await c()}catch(S){if(Is(S,"TRANSACTION_REPLACED")){b(),g(S);return}}a||this.provider.once("block",C)};y.push(()=>{this.provider.off("block",C)}),this.provider.once("block",C)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return Le(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),rJ(this)}reorderedEvent(e){return Le(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Le(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),tJ(this,e)}replaceableTransaction(e){ve(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new eR(this,this.provider);return ue(r,Cd,e),r}};Cd=new WeakMap;let Cw=eR;function X4e(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function tJ(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function rJ(t){return{orphan:"drop-transaction",tx:t}}function e8e(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class Sk extends bx{constructor(r,n,i){super(r,r.provider);de(this,"interface");de(this,"fragment");de(this,"args");const s=n.decodeEventLog(i,r.data,r.topics);Ot(this,{args:s,fragment:i,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class nJ extends bx{constructor(r,n){super(r,r.provider);de(this,"error");Ot(this,{error:n})}}var yg;class t8e extends eJ{constructor(r,n,i){super(i,n);Ie(this,yg);ue(this,yg,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?Q(this,yg).getEvent(r.topics[0]):null;if(n)try{return new Sk(r,Q(this,yg),n)}catch(i){return new nJ(r,i)}return r})}}yg=new WeakMap;var $w;class _k extends Cw{constructor(r,n,i){super(i,n);Ie(this,$w);ue(this,$w,r)}async wait(r,n){const i=await super.wait(r,n);return i==null?null:new t8e(Q(this,$w),this.provider,i)}}$w=new WeakMap;class iJ extends cY{constructor(r,n,i,s){super(r,n,i);de(this,"log");Ot(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class r8e extends iJ{constructor(e,r,n,i,s){super(e,r,n,new Sk(s,e.interface,i));const o=e.interface.decodeEventLog(i,this.log.data,this.log.topics);Ot(this,{args:o,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const lF=BigInt(0);function sJ(t){return t&&typeof t.call=="function"}function oJ(t){return t&&typeof t.estimateGas=="function"}function U8(t){return t&&typeof t.resolveName=="function"}function aJ(t){return t&&typeof t.sendTransaction=="function"}function cJ(t){if(t!=null){if(U8(t))return t;if(t.provider)return t.provider}}var qw;class n8e{constructor(e,r,n){Ie(this,qw);de(this,"fragment");if(Ot(this,{fragment:r}),r.inputs.lengthn[c]==null?null:a.walkAsync(n[c],(f,u)=>f==="address"?Array.isArray(u)?Promise.all(u.map(p=>rs(p,s))):rs(u,s):u)));return e.interface.encodeFilterTopics(r,o)}())}getTopicFilter(){return Q(this,qw)}}qw=new WeakMap;function Mp(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function R0(t){return t==null?null:t.provider||null}async function lJ(t,e){const r=ks.dereference(t,"overrides");ve(typeof r=="object","invalid overrides parameter","overrides",t);const n=Ew(r);return ve(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),ve(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function i8e(t,e,r){const n=Mp(t,"resolveName"),i=U8(n)?n:null;return await Promise.all(e.map((s,o)=>s.walkAsync(r[o],(a,c)=>(c=ks.dereference(c,a),a==="address"?rs(c,i):c))))}function s8e(t){const e=async function(o){const a=await lJ(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await rs(a.from,cJ(t.runner)));const c=t.interface,l=Pt(a.value||lF,"overrides.value")===lF,f=(a.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!f&&!l&&ve(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),ve(c.fallback||f,"cannot send data to receive-only contract","overrides.data",a.data);const u=c.receive||c.fallback&&c.fallback.payable;return ve(u||l,"cannot send value to non-payable fallback","overrides.value",a.value),ve(c.fallback||f,"cannot send data to receive-only contract","overrides.data",a.data),a},r=async function(o){const a=Mp(t.runner,"call");Le(sJ(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(o);try{return await a.call(c)}catch(l){throw nk(l)&&l.data?t.interface.makeError(l.data,c):l}},n=async function(o){const a=t.runner;Le(aJ(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await a.sendTransaction(await e(o)),l=R0(t.runner);return new _k(t.interface,l,c)},i=async function(o){const a=Mp(t.runner,"estimateGas");return Le(oJ(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},s=async o=>await n(o);return Ot(s,{_contract:t,estimateGas:i,populateTransaction:e,send:n,staticCall:r}),s}function o8e(t,e){const r=function(...l){const f=t.interface.getFunction(e,l);return Le(f,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:l}}),f},n=async function(...l){const f=r(...l);let u={};if(f.inputs.length+1===l.length&&(u=await lJ(l.pop()),u.from&&(u.from=await rs(u.from,cJ(t.runner)))),f.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const p=await i8e(t.runner,f.inputs,l);return Object.assign({},u,await pi({to:t.getAddress(),data:t.interface.encodeFunctionData(f,p)}))},i=async function(...l){const f=await a(...l);return f.length===1?f[0]:f},s=async function(...l){const f=t.runner;Le(aJ(f),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const u=await f.sendTransaction(await n(...l)),p=R0(t.runner);return new _k(t.interface,p,u)},o=async function(...l){const f=Mp(t.runner,"estimateGas");return Le(oJ(f),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await f.estimateGas(await n(...l))},a=async function(...l){const f=Mp(t.runner,"call");Le(sJ(f),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const u=await n(...l);let p="0x";try{p=await f.call(u)}catch(y){throw nk(y)&&y.data?t.interface.makeError(y.data,u):y}const g=r(...l);return t.interface.decodeFunctionResult(g,p)},c=async(...l)=>r(...l).constant?await i(...l):await s(...l);return Ot(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:o,populateTransaction:n,send:s,staticCall:i,staticCallResult:a}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=t.interface.getFunction(e);return Le(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),l}}),c}function a8e(t,e){const r=function(...i){const s=t.interface.getEvent(e,i);return Le(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),s},n=function(...i){return new n8e(t,r(...i),i)};return Ot(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return Le(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),n}const L5=Symbol.for("_ethersInternal_contract"),fJ=new WeakMap;function c8e(t,e){fJ.set(t[L5],e)}function Zo(t){return fJ.get(t[L5])}function l8e(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function Ik(t,e){let r,n=null;if(Array.isArray(e)){const s=function(o){if(Gr(o,32))return o;const a=t.interface.getEvent(o);return ve(a,"unknown fragment","name",o),a.topicHash};r=e.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else e==="*"?r=[null]:typeof e=="string"?Gr(e,32)?r=[e]:(n=t.interface.getEvent(e),ve(n,"unknown fragment","event",e),r=[n.topicHash]):l8e(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):ve(!1,"unknown event name","event",e);r=r.map(s=>{if(s==null)return null;if(Array.isArray(s)){const o=Array.from(new Set(s.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});const i=r.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:n,tag:i,topics:r}}async function Zm(t,e){const{subs:r}=Zo(t);return r.get((await Ik(t,e)).tag)||null}async function fF(t,e,r){const n=R0(t.runner);Le(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:o}=await Ik(t,r),{addr:a,subs:c}=Zo(t);let l=c.get(s);if(!l){const u={address:a||t,topics:o},p=I=>{let C=i;if(C==null)try{C=t.interface.getEvent(I.topics[0])}catch{}if(C){const S=C,O=i?t.interface.decodeEventLog(i,I.data,I.topics):[];d_(t,r,O,L=>new r8e(t,L,r,S,I))}else d_(t,r,[],S=>new iJ(t,S,r,I))};let g=[];l={tag:s,listeners:[],start:()=>{g.length||g.push(n.on(u,p))},stop:async()=>{if(g.length==0)return;let I=g;g=[],await Promise.all(I),n.off(u,p)}},c.set(s,l)}return l}let u_=Promise.resolve();async function f8e(t,e,r,n){await u_;const i=await Zm(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter(({listener:o,once:a})=>{const c=Array.from(r);n&&c.push(n(a?null:o));try{o.call(t,...c)}catch{}return!a}),i.listeners.length===0&&(i.stop(),Zo(t).subs.delete(i.tag)),s>0}async function d_(t,e,r,n){try{await u_}catch{}const i=f8e(t,e,r,n);return u_=i,await i}const E6=["then"];var $$;$$=L5;const jb=class jb{constructor(e,r,n,i){de(this,"target");de(this,"interface");de(this,"runner");de(this,"filters");de(this,$$);de(this,"fallback");ve(typeof e=="string"||vQ(e),"invalid value for Contract target","target",e),n==null&&(n=null);const s=$i.from(r);Ot(this,{target:e,runner:n,interface:s}),Object.defineProperty(this,L5,{value:{}});let o,a=null,c=null;if(i){const u=R0(n);c=new _k(this.interface,u,i)}let l=new Map;if(typeof e=="string")if(Gr(e))a=e,o=Promise.resolve(e);else{const u=Mp(n,"resolveName");if(!U8(u))throw zn("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=u.resolveName(e).then(p=>{if(p==null)throw zn("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Zo(this).addr=p,p})}else o=e.getAddress().then(u=>{if(u==null)throw new Error("TODO");return Zo(this).addr=u,u});c8e(this,{addrPromise:o,addr:a,deployTx:c,subs:l});const f=new Proxy({},{get:(u,p,g)=>{if(typeof p=="symbol"||E6.indexOf(p)>=0)return Reflect.get(u,p,g);try{return this.getEvent(p)}catch(y){if(!Is(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(u,p)=>E6.indexOf(p)>=0?Reflect.has(u,p):Reflect.has(u,p)||this.interface.hasEvent(String(p))});return Ot(this,{filters:f}),Ot(this,{fallback:s.receive||s.fallback?s8e(this):null}),new Proxy(this,{get:(u,p,g)=>{if(typeof p=="symbol"||p in u||E6.indexOf(p)>=0)return Reflect.get(u,p,g);try{return u.getFunction(p)}catch(y){if(!Is(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(u,p)=>typeof p=="symbol"||p in u||E6.indexOf(p)>=0?Reflect.has(u,p):u.interface.hasFunction(p)})}connect(e){return new jb(this.target,this.interface,e)}attach(e){return new jb(e,this.interface,this.runner)}async getAddress(){return await Zo(this).addrPromise}async getDeployedCode(){const e=R0(this.runner);Le(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=R0(this.runner);return Le(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,s)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);n.once("block",o)}catch(a){s(a)}};o()})}deploymentTransaction(){return Zo(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),o8e(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),a8e(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:i,addrPromise:s}=Zo(this),o=i||await s,{fragment:a,topics:c}=await Ik(this,e),l={address:o,topics:c,fromBlock:r,toBlock:n},f=R0(this.runner);return Le(f,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await f.getLogs(l)).map(u=>{let p=a;if(p==null)try{p=this.interface.getEvent(u.topics[0])}catch{}if(p)try{return new Sk(u,this.interface,p)}catch(g){return new nJ(u,g)}return new bx(u,f)})}async on(e,r){const n=await fF(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await fF(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await d_(this,e,r,null)}async listenerCount(e){if(e){const i=await Zm(this,e);return i?i.listeners.length:0}const{subs:r}=Zo(this);let n=0;for(const{listeners:i}of r.values())n+=i.length;return n}async listeners(e){if(e){const i=await Zm(this,e);return i?i.listeners.map(({listener:s})=>s):[]}const{subs:r}=Zo(this);let n=[];for(const{listeners:i}of r.values())n=n.concat(i.map(({listener:s})=>s));return n}async off(e,r){const n=await Zm(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(r==null||n.listeners.length===0)&&(n.stop(),Zo(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await Zm(this,e);if(!r)return this;r.stop(),Zo(this).subs.delete(r.tag)}else{const{subs:r}=Zo(this);for(const{tag:n,stop:i}of r.values())i(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends jb{constructor(i,s=null){super(i,e,s)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};let h_=jb;function u8e(){return h_}class Dn extends u8e(){}function f9(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):ve(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class d8e{constructor(e){de(this,"name");Ot(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const uJ=new RegExp("^(ipfs)://(.*)$","i"),uF=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),uJ,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Ad,Y0,Sd,z1,w4,dJ;const mv=class mv{constructor(e,r,n){Ie(this,Sd);de(this,"provider");de(this,"address");de(this,"name");Ie(this,Ad);Ie(this,Y0);Ot(this,{provider:e,address:r,name:n}),ue(this,Ad,null),ue(this,Y0,new Dn(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return Q(this,Ad)==null&&ue(this,Ad,(async()=>{try{return await Q(this,Y0).supportsInterface("0x9061b923")}catch(e){if(Is(e,"CALL_EXCEPTION"))return!1;throw ue(this,Ad,null),e}})()),await Q(this,Ad)}async getAddress(e){if(e==null&&(e=60),e===60)try{const s=await qe(this,Sd,z1).call(this,"addr(bytes32)");return s==null||s===bu?null:s}catch(s){if(Is(s,"CALL_EXCEPTION"))return null;throw s}if(e>=0&&e<2147483648){let s=e+2147483648;const o=await qe(this,Sd,z1).call(this,"addr(bytes32,uint)",[s]);if(Gr(o,20))return Qt(o)}let r=null;for(const s of this.provider.plugins)if(s instanceof d8e&&s.supportsCoinType(e)){r=s;break}if(r==null)return null;const n=await qe(this,Sd,z1).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const i=await r.decodeAddress(e,n);if(i!=null)return i;Le(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await qe(this,Sd,z1).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await qe(this,Sd,z1).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const i=r[1]==="e3010170"?"ipfs":"ipns",s=parseInt(r[4],16);if(r[5].length===s*2)return`${i}://${aY("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;Le(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))}}function wx(t,e){return r=>{const n={};for(const i in t){let s=i;if(e&&i in e&&!(s in r)){for(const o of e[i])if(o in r){s=o;break}}try{const o=t[i](r[s]);o!==void 0&&(n[i]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";Le(!1,`invalid value for value.${i} (${a})`,"BAD_DATA",{value:r})}}return n}}function h8e(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}ve(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function ty(t){return ve(Gr(t,!0),"invalid data","value",t),t}function Xi(t){return ve(Gr(t,32),"invalid hash","value",t),t}const p8e=wx({address:Qt,blockHash:Xi,blockNumber:or,data:ty,index:or,removed:Dr(h8e,!1),topics:$8(Xi),transactionHash:Xi,transactionIndex:or},{index:["logIndex"]});function v8e(t){return p8e(t)}const g8e=wx({hash:Dr(Xi),parentHash:Xi,parentBeaconBlockRoot:Dr(Xi,null),number:or,timestamp:or,nonce:Dr(ty),difficulty:Pt,gasLimit:Pt,gasUsed:Pt,stateRoot:Dr(Xi,null),receiptsRoot:Dr(Xi,null),blobGasUsed:Dr(Pt,null),excessBlobGas:Dr(Pt,null),miner:Dr(Qt),prevRandao:Dr(Xi,null),extraData:ty,baseFeePerGas:Dr(Pt)},{prevRandao:["mixHash"]});function y8e(t){const e=g8e(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:hJ(r)),e}const m8e=wx({transactionIndex:or,blockNumber:or,transactionHash:Xi,address:Qt,topics:$8(Xi),data:ty,index:or,blockHash:Xi},{index:["logIndex"]});function b8e(t){return m8e(t)}const w8e=wx({to:Dr(Qt,null),from:Dr(Qt,null),contractAddress:Dr(Qt,null),index:or,root:Dr(Me),gasUsed:Pt,blobGasUsed:Dr(Pt,null),logsBloom:Dr(ty),blockHash:Xi,hash:Xi,logs:$8(b8e),blockNumber:or,cumulativeGasUsed:Pt,effectiveGasPrice:Dr(Pt),blobGasPrice:Dr(Pt,null),status:Dr(or),type:Dr(or,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function x8e(t){return w8e(t)}function hJ(t){t.to&&Pt(t.to)===dF&&(t.to="0x0000000000000000000000000000000000000000");const e=wx({hash:Xi,index:Dr(or,void 0),type:r=>r==="0x"||r==null?0:or(r),accessList:Dr(Wp,null),blobVersionedHashes:Dr($8(Xi,!0),null),blockHash:Dr(Xi,null),blockNumber:Dr(or,null),transactionIndex:Dr(or,null),from:Qt,gasPrice:Dr(Pt),maxPriorityFeePerGas:Dr(Pt),maxFeePerGas:Dr(Pt),maxFeePerBlobGas:Dr(Pt,null),gasLimit:Pt,to:Dr(Qt,null),value:Pt,nonce:or,data:ty,creates:Dr(Qt,null),chainId:Dr(Pt,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=d5e(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=wu.from(t.signature):e.signature=wu.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&Pt(e.blockHash)===dF&&(e.blockHash=null),e}const E8e="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class xx{constructor(e){de(this,"name");Ot(this,{name:e})}clone(){return new xx(this.name)}}class q8 extends xx{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);de(this,"effectiveBlock");de(this,"txBase");de(this,"txCreate");de(this,"txDataZero");de(this,"txDataNonzero");de(this,"txAccessListStorageKey");de(this,"txAccessListAddress");const i={effectiveBlock:r};function s(o,a){let c=(n||{})[o];c==null&&(c=a),ve(typeof c=="number",`invalud value for ${o}`,"costs",n),i[o]=c}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),Ot(this,i)}clone(){return new q8(this.effectiveBlock,this)}}class V8 extends xx{constructor(r,n){super("org.ethers.plugins.network.Ens");de(this,"address");de(this,"targetNetwork");Ot(this,{address:r||E8e,targetNetwork:n??1})}clone(){return new V8(this.address,this.targetNetwork)}}var Vw,zw;class C8e extends xx{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");Ie(this,Vw);Ie(this,zw);ue(this,Vw,r),ue(this,zw,n)}get url(){return Q(this,Vw)}get processFunc(){return Q(this,zw)}clone(){return this}}Vw=new WeakMap,zw=new WeakMap;const u9=new Map;var mg,bg,_d;const bv=class bv{constructor(e,r){Ie(this,mg);Ie(this,bg);Ie(this,_d);ue(this,mg,e),ue(this,bg,Pt(r)),ue(this,_d,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return Q(this,mg)}set name(e){ue(this,mg,e)}get chainId(){return Q(this,bg)}set chainId(e){ue(this,bg,Pt(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Pt(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Pt(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Pt(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(Q(this,_d).values())}attachPlugin(e){if(Q(this,_d).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Q(this,_d).set(e.name,e.clone()),this}getPlugin(e){return Q(this,_d).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new bv(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new q8;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let i=2;i9){let i=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||i++,n[1]=i.toString()}return BigInt(n[0]+n[1])}function pF(t){return new C8e(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let i;try{const[s,o]=await Promise.all([n.send(),e()]);i=s;const a=i.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:hF(a.maxFee,9),maxPriorityFeePerGas:hF(a.maxPriorityFee,9)}}catch(s){Le(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:i,error:s})}})}let vF=!1;function A8e(){if(vF)return;vF=!0;function t(e,r,n){const i=function(){const s=new ca(e,r);return n.ensNetwork!=null&&s.attachPlugin(new V8(null,n.ensNetwork)),s.attachPlugin(new q8),(n.plugins||[]).forEach(o=>{s.attachPlugin(o)}),s};ca.register(e,i),ca.register(r,i),n.altNames&&n.altNames.forEach(s=>{ca.register(s,i)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[pF("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[pF("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function p_(t){return JSON.parse(JSON.stringify(t))}var zf,qa,Id,kl,wg,h3;class S8e{constructor(e){Ie(this,wg);Ie(this,zf);Ie(this,qa);Ie(this,Id);Ie(this,kl);ue(this,zf,e),ue(this,qa,null),ue(this,Id,4e3),ue(this,kl,-2)}get pollingInterval(){return Q(this,Id)}set pollingInterval(e){ue(this,Id,e)}start(){Q(this,qa)||(ue(this,qa,Q(this,zf)._setTimeout(qe(this,wg,h3).bind(this),Q(this,Id))),qe(this,wg,h3).call(this))}stop(){Q(this,qa)&&(Q(this,zf)._clearTimeout(Q(this,qa)),ue(this,qa,null))}pause(e){this.stop(),e&&ue(this,kl,-2)}resume(){this.start()}}zf=new WeakMap,qa=new WeakMap,Id=new WeakMap,kl=new WeakMap,wg=new WeakSet,h3=async function(){try{const e=await Q(this,zf).getBlockNumber();if(Q(this,kl)===-2){ue(this,kl,e);return}if(e!==Q(this,kl)){for(let r=Q(this,kl)+1;r<=e;r++){if(Q(this,qa)==null)return;await Q(this,zf).emit("block",r)}ue(this,kl,e)}}catch{}Q(this,qa)!=null&&ue(this,qa,Q(this,zf)._setTimeout(qe(this,wg,h3).bind(this),Q(this,Id)))};var Q0,J0,Td;class Tk{constructor(e){Ie(this,Q0);Ie(this,J0);Ie(this,Td);ue(this,Q0,e),ue(this,Td,!1),ue(this,J0,r=>{this._poll(r,Q(this,Q0))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){Q(this,Td)||(ue(this,Td,!0),Q(this,J0).call(this,-2),Q(this,Q0).on("block",Q(this,J0)))}stop(){Q(this,Td)&&(ue(this,Td,!1),Q(this,Q0).off("block",Q(this,J0)))}pause(e){this.stop()}resume(){this.start()}}Q0=new WeakMap,J0=new WeakMap,Td=new WeakMap;var xg,Hf;class _8e extends Tk{constructor(r,n){super(r);Ie(this,xg);Ie(this,Hf);ue(this,xg,n),ue(this,Hf,-2)}pause(r){r&&ue(this,Hf,-2),super.pause(r)}async _poll(r,n){const i=await n.getBlock(Q(this,xg));i!=null&&(Q(this,Hf)===-2?ue(this,Hf,i.number):i.number>Q(this,Hf)&&(n.emit(Q(this,xg),i.number),ue(this,Hf,i.number)))}}xg=new WeakMap,Hf=new WeakMap;var x4;class I8e extends Tk{constructor(r,n){super(r);Ie(this,x4);ue(this,x4,p_(n))}async _poll(r,n){throw new Error("@TODO")}}x4=new WeakMap;var Eg;class T8e extends Tk{constructor(r,n){super(r);Ie(this,Eg);ue(this,Eg,n)}async _poll(r,n){const i=await n.getTransactionReceipt(Q(this,Eg));i&&n.emit(Q(this,Eg),i)}}Eg=new WeakMap;var Gf,Cg,Ag,Pd,Va,E4,pJ;class Pk{constructor(e,r){Ie(this,E4);Ie(this,Gf);Ie(this,Cg);Ie(this,Ag);Ie(this,Pd);Ie(this,Va);ue(this,Gf,e),ue(this,Cg,p_(r)),ue(this,Ag,qe(this,E4,pJ).bind(this)),ue(this,Pd,!1),ue(this,Va,-2)}start(){Q(this,Pd)||(ue(this,Pd,!0),Q(this,Va)===-2&&Q(this,Gf).getBlockNumber().then(e=>{ue(this,Va,e)}),Q(this,Gf).on("block",Q(this,Ag)))}stop(){Q(this,Pd)&&(ue(this,Pd,!1),Q(this,Gf).off("block",Q(this,Ag)))}pause(e){this.stop(),e&&ue(this,Va,-2)}resume(){this.start()}}Gf=new WeakMap,Cg=new WeakMap,Ag=new WeakMap,Pd=new WeakMap,Va=new WeakMap,E4=new WeakSet,pJ=async function(e){if(Q(this,Va)===-2)return;const r=p_(Q(this,Cg));r.fromBlock=Q(this,Va)+1,r.toBlock=e;const n=await Q(this,Gf).getLogs(r);if(n.length===0){Q(this,Va){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const i=Object.keys(n);return i.sort(),i.reduce((s,o)=>(s[o]=n[o],s),{})}return n})}class vJ{constructor(e){de(this,"name");Ot(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function M8e(t){return JSON.parse(JSON.stringify(t))}function v_(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function d9(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(Gr(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:p3("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:p3("orphan",r),filter:M8e(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(i=>i==null?null:Array.isArray(i)?v_(i.map(s=>s.toLowerCase())):i.toLowerCase())};if(r.address){const i=[],s=[],o=a=>{Gr(a)?i.push(a):s.push((async()=>{i.push(await rs(a,e))})())};Array.isArray(r.address)?r.address.forEach(o):o(r.address),s.length&&await Promise.all(s),n.address=v_(i.map(a=>a.toLowerCase()))}return{filter:n,tag:p3("event",n),type:"event"}}ve(!1,"unknown ProviderEvent","event",t)}function h9(){return new Date().getTime()}const R8e={cacheTimeout:250,pollingInterval:4e3};var xs,kd,Es,Sg,ra,Z0,Md,Wf,Hw,za,_g,Ig,br,Jo,g_,y_,Xm,m_,eb,v3;class gJ{constructor(e,r){Ie(this,br);Ie(this,xs);Ie(this,kd);Ie(this,Es);Ie(this,Sg);Ie(this,ra);Ie(this,Z0);Ie(this,Md);Ie(this,Wf);Ie(this,Hw);Ie(this,za);Ie(this,_g);Ie(this,Ig);if(ue(this,Ig,Object.assign({},R8e,r||{})),e==="any")ue(this,Z0,!0),ue(this,ra,null);else if(e){const n=ca.from(e);ue(this,Z0,!1),ue(this,ra,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else ue(this,Z0,!1),ue(this,ra,null);ue(this,Wf,-1),ue(this,Md,new Map),ue(this,xs,new Map),ue(this,kd,new Map),ue(this,Es,null),ue(this,Sg,!1),ue(this,Hw,1),ue(this,za,new Map),ue(this,_g,!1)}get pollingInterval(){return Q(this,Ig).pollingInterval}get provider(){return this}get plugins(){return Array.from(Q(this,kd).values())}attachPlugin(e){if(Q(this,kd).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Q(this,kd).set(e.name,e.connect(this)),this}getPlugin(e){return Q(this,kd).get(e)||null}get disableCcipRead(){return Q(this,_g)}set disableCcipRead(e){ue(this,_g,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),o=[];for(let a=0;a=500,`response not found during CCIP fetch: ${u}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:u}}),o.push(u)}Le(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:o}})}_wrapBlock(e,r){return new Z4e(y8e(e),this)}_wrapLog(e,r){return new bx(v8e(e),this)}_wrapTransactionReceipt(e,r){return new eJ(x8e(e),this)}_wrapTransactionResponse(e,r){return new Cw(hJ(e),this)}_detectNetwork(){Le(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Le(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=or(await qe(this,br,Jo).call(this,{method:"getBlockNumber"}),"%response");return Q(this,Wf)>=0&&ue(this,Wf,e),e}_getAddress(e){return rs(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Gr(e))return Gr(e,32)?e:zc(e);if(typeof e=="bigint"&&(e=or(e,"blockTag")),typeof e=="number")return e>=0?zc(e):Q(this,Wf)>=0?zc(Q(this,Wf)+e):this.getBlockNumber().then(r=>zc(r+e));ve(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?v_(c.map(l=>l.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,i=(c,l,f)=>{let u;switch(c.length){case 0:break;case 1:u=c[0];break;default:c.sort(),u=c}if(n&&(l!=null||f!=null))throw new Error("invalid filter");const p={};return u&&(p.address=u),r.length&&(p.topics=r),l&&(p.fromBlock=l),f&&(p.toBlock=f),n&&(p.blockHash=n),p};let s=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)s.push(this._getAddress(c));else s.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),s.filter(c=>typeof c!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(s),o,a]).then(c=>i(c[0],c[1],c[2])):i(s,o,a)}_getTransactionRequest(e){const r=Ew(e),n=[];if(["to","from"].forEach(i=>{if(r[i]==null)return;const s=rs(r[i],this);C6(s)?n.push(async function(){r[i]=await s}()):r[i]=s}),r.blockTag!=null){const i=this._getBlockTag(r.blockTag);C6(i)?n.push(async function(){r.blockTag=await i}()):r.blockTag=i}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if(Q(this,ra)==null){const i=(async()=>{try{const s=await this._detectNetwork();return this.emit("network",s,null),s}catch(s){throw Q(this,ra)===i&&ue(this,ra,null),s}})();return ue(this,ra,i),(await i).clone()}const e=Q(this,ra),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(Q(this,Z0)?(this.emit("network",n,r),Q(this,ra)===e&&ue(this,ra,Promise.resolve(n))):Le(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:i,gasPrice:s,priorityFee:o}=await pi({_block:qe(this,br,m_).call(this,"latest",!1),gasPrice:(async()=>{try{const f=await qe(this,br,Jo).call(this,{method:"getGasPrice"});return Pt(f,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const f=await qe(this,br,Jo).call(this,{method:"getPriorityFee"});return Pt(f,"%response")}catch{}return null})()});let a=null,c=null;const l=this._wrapBlock(i,e);return l&&l.baseFeePerGas&&(c=o??BigInt("1000000000"),a=l.baseFeePerGas*P8e+c),new cF(s,a,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const i=new Jl(n.url),s=await n.processFunc(r,this,i);return new cF(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return C6(r)&&(r=await r),Pt(await qe(this,br,Jo).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await pi({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await qe(this,br,y_).call(this,qe(this,br,g_).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return Pt(await qe(this,br,Xm).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return or(await qe(this,br,Xm).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return Me(await qe(this,br,Xm).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const i=Pt(r,"position");return Me(await qe(this,br,Xm).call(this,{method:"getStorage",position:i},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:i}=await pi({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=ww.from(e);if(s.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,i).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:i}=await pi({network:this.getNetwork(),params:qe(this,br,m_).call(this,e,!!r)});return i==null?null:this._wrapBlock(i,n)}async getTransaction(e){const{network:r,params:n}=await pi({network:this.getNetwork(),params:qe(this,br,Jo).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await pi({network:this.getNetwork(),params:qe(this,br,Jo).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const i=await qe(this,br,Jo).call(this,{method:"getTransaction",hash:e});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await pi({network:this.getNetwork(),result:qe(this,br,Jo).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:Me(r)}async getLogs(e){let r=this._getFilter(e);C6(r)&&(r=await r);const{network:n,params:i}=await pi({network:this.getNetwork(),params:qe(this,br,Jo).call(this,{method:"getLogs",filter:r})});return i.map(s=>this._wrapLog(s,n))}_getProvider(e){Le(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await F5.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=Qt(e);const r=l_(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await F5.getEnsAddress(this),s=await new Dn(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(s==null||s===bu)return null;const a=await new Dn(s,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(a)!==e?null:a}catch(n){if(Is(n,"BAD_DATA")&&n.value==="0x"||Is(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const i=r??1;return i===0?this.getTransactionReceipt(e):new Promise(async(s,o)=>{let a=null;const c=async l=>{try{const f=await this.getTransactionReceipt(e);if(f!=null&&l-f.blockNumber+1>=i){s(f),a&&(clearTimeout(a),a=null);return}}catch(f){console.log("EEE",f)}this.once("block",c)};n!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",c),o(zn("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){Le(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=Q(this,za).get(e);r&&(r.timer&&clearTimeout(r.timer),Q(this,za).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=dm(this,Hw)._++,i=()=>{Q(this,za).delete(n),e()};if(this.paused)Q(this,za).set(n,{timer:null,func:i,time:r});else{const s=setTimeout(i,r);Q(this,za).set(n,{timer:s,func:i,time:h9()})}return n}_forEachSubscriber(e){for(const r of Q(this,xs).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new vJ(e.type);case"block":{const r=new S8e(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new _8e(this,e.type);case"event":return new Pk(this,e.filter);case"transaction":return new T8e(this,e.hash);case"orphan":return new I8e(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of Q(this,xs).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),Q(this,Es)!=null&&r.pause(Q(this,Es));break}}async on(e,r){const n=await qe(this,br,v3).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,Q(this,Es)!=null&&n.subscriber.pause(Q(this,Es))),this}async once(e,r){const n=await qe(this,br,v3).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,Q(this,Es)!=null&&n.subscriber.pause(Q(this,Es))),this}async emit(e,...r){const n=await qe(this,br,eb).call(this,e,r);if(!n||n.listeners.length===0)return!1;const i=n.listeners.length;return n.listeners=n.listeners.filter(({listener:s,once:o})=>{const a=new cY(this,o?null:s,e);try{s.call(this,...r,a)}catch{}return!o}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),Q(this,xs).delete(n.tag)),i>0}async listenerCount(e){if(e){const n=await qe(this,br,eb).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of Q(this,xs).values())r+=n.length;return r}async listeners(e){if(e){const n=await qe(this,br,eb).call(this,e);return n?n.listeners.map(({listener:i})=>i):[]}let r=[];for(const{listeners:n}of Q(this,xs).values())r=r.concat(n.map(({listener:i})=>i));return r}async off(e,r){const n=await qe(this,br,eb).call(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),Q(this,xs).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:i}=await qe(this,br,v3).call(this,e);n&&i.stop(),Q(this,xs).delete(r)}else for(const[r,{started:n,subscriber:i}]of Q(this,xs))n&&i.stop(),Q(this,xs).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return Q(this,Sg)}destroy(){this.removeAllListeners();for(const e of Q(this,za).keys())this._clearTimeout(e);ue(this,Sg,!0)}get paused(){return Q(this,Es)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(ue(this,Wf,-1),Q(this,Es)!=null){if(Q(this,Es)==!!e)return;Le(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),ue(this,Es,!!e);for(const r of Q(this,za).values())r.timer&&clearTimeout(r.timer),r.time=h9()-r.time}resume(){if(Q(this,Es)!=null){this._forEachSubscriber(e=>e.resume()),ue(this,Es,null);for(const e of Q(this,za).values()){let r=e.time;r<0&&(r=0),e.time=h9(),setTimeout(e.func,r)}}}}xs=new WeakMap,kd=new WeakMap,Es=new WeakMap,Sg=new WeakMap,ra=new WeakMap,Z0=new WeakMap,Md=new WeakMap,Wf=new WeakMap,Hw=new WeakMap,za=new WeakMap,_g=new WeakMap,Ig=new WeakMap,br=new WeakSet,Jo=async function(e){const r=Q(this,Ig).cacheTimeout;if(r<0)return await this._perform(e);const n=p3(e.method,e);let i=Q(this,Md).get(n);return i||(i=this._perform(e),Q(this,Md).set(n,i),setTimeout(()=>{Q(this,Md).get(n)===i&&Q(this,Md).delete(n)},r)),await i},g_=async function(e,r,n){Le(n=0&&r==="latest"&&i.to!=null&&mn(s.data,0,4)==="0x556f1830"){const o=s.data,a=await rs(i.to,this);let c;try{c=L8e(mn(s.data,4))}catch(u){Le(!1,u.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:o}})}Le(c.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const l=await this.ccipReadFetch(i,c.calldata,c.urls);Le(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:s.data,errorArgs:c.errorArgs}});const f={to:a,data:qr([c.selector,B8e([l,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:f});try{const u=await qe(this,br,g_).call(this,f,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},f),result:u}),u}catch(u){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},f),error:u}),u}}throw s}},y_=async function(e){const{value:r}=await pi({network:this.getNetwork(),value:e});return r},Xm=async function(e,r,n){let i=this._getAddress(r),s=this._getBlockTag(n);return(typeof i!="string"||typeof s!="string")&&([i,s]=await Promise.all([i,s])),await qe(this,br,y_).call(this,qe(this,br,Jo).call(this,Object.assign(e,{address:i,blockTag:s})))},m_=async function(e,r){if(Gr(e,32))return await qe(this,br,Jo).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await qe(this,br,Jo).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},eb=async function(e,r){let n=await d9(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await d9({orphan:"drop-log",log:r[0]},this)),Q(this,xs).get(n.tag)||null},v3=async function(e){const r=await d9(e,this),n=r.tag;let i=Q(this,xs).get(n);return i||(i={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},Q(this,xs).set(n,i)),i};function O8e(t,e){try{const r=b_(t,e);if(r)return Ip(r)}catch{}return null}function b_(t,e){if(t==="0x")return null;try{const r=or(mn(t,e,e+32)),n=or(mn(t,r,r+32));return mn(t,r+32,r+32+n)}catch{}return null}function gF(t){const e=ts(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 D8e(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const N8e=new Uint8Array([]);function B8e(t){const e=[];let r=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=mn(t,0,32);Le(mn(r,0,12)===mn(yF,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=mn(r,12);try{const n=[],i=or(mn(t,32,64)),s=or(mn(t,i,i+32)),o=mn(t,i+32);for(let a=0;ae[n]),e}function D1(t,e){if(t.provider)return t.provider;Le(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function mF(t,e){let r=Ew(e);if(r.to!=null&&(r.to=rs(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),rs(n,t)]).then(([i,s])=>(ve(i.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),i))}else r.from=t.getAddress();return await pi(r)}class z8{constructor(e){de(this,"provider");Ot(this,{provider:e||null})}async getNonce(e){return D1(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await mF(this,e)}async populateTransaction(e){const r=D1(this,"populateTransaction"),n=await mF(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const i=await this.provider.getNetwork();if(n.chainId!=null){const o=Pt(n.chainId);ve(o===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=i.chainId;const s=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||s)?ve(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&s&&ve(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const o=await r.getFeeData();Le(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice)}else{const o=await r.getFeeData();if(n.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const a=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=a,n.maxPriorityFeePerGas=a}else n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(Le(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice),n.type=0):Le(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await pi(n)}async estimateGas(e){return D1(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return D1(this,"call").call(await this.populateCall(e))}async resolveName(e){return await D1(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=D1(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const i=ww.from(n);return await r.broadcastTransaction(await this.signTransaction(i))}}var Tg,g3;const tR=class tR extends z8{constructor(r,n){super(n);Ie(this,Tg);de(this,"address");Ot(this,{address:r})}async getAddress(){return this.address}connect(r){return new tR(this.address,r)}async signTransaction(r){qe(this,Tg,g3).call(this,"transactions","signTransaction")}async signMessage(r){qe(this,Tg,g3).call(this,"messages","signMessage")}async signTypedData(r,n,i){qe(this,Tg,g3).call(this,"typed-data","signTypedData")}};Tg=new WeakSet,g3=function(r,n){Le(!1,`VoidSigner cannot sign ${r}`,"UNSUPPORTED_OPERATION",{operation:n})};let w_=tR;function F8e(t){return JSON.parse(JSON.stringify(t))}var Ws,Ml,X0,Rd,ep,Pg,mh,x_,E_;class yJ{constructor(e){Ie(this,mh);Ie(this,Ws);Ie(this,Ml);Ie(this,X0);Ie(this,Rd);Ie(this,ep);Ie(this,Pg);ue(this,Ws,e),ue(this,Ml,null),ue(this,X0,qe(this,mh,x_).bind(this)),ue(this,Rd,!1),ue(this,ep,null),ue(this,Pg,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){Q(this,Rd)||(ue(this,Rd,!0),qe(this,mh,x_).call(this,-2))}stop(){Q(this,Rd)&&(ue(this,Rd,!1),ue(this,Pg,!0),qe(this,mh,E_).call(this),Q(this,Ws).off("block",Q(this,X0)))}pause(e){e&&qe(this,mh,E_).call(this),Q(this,Ws).off("block",Q(this,X0))}resume(){this.start()}}Ws=new WeakMap,Ml=new WeakMap,X0=new WeakMap,Rd=new WeakMap,ep=new WeakMap,Pg=new WeakMap,mh=new WeakSet,x_=async function(e){try{Q(this,Ml)==null&&ue(this,Ml,this._subscribe(Q(this,Ws)));let r=null;try{r=await Q(this,Ml)}catch(s){if(!Is(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(r==null){ue(this,Ml,null),Q(this,Ws)._recoverSubscriber(this,this._recover(Q(this,Ws)));return}const n=await Q(this,Ws).getNetwork();if(Q(this,ep)||ue(this,ep,n),Q(this,ep).chainId!==n.chainId)throw new Error("chaid changed");if(Q(this,Pg))return;const i=await Q(this,Ws).send("eth_getFilterChanges",[r]);await this._emitResults(Q(this,Ws),i)}catch(r){console.log("@TODO",r)}Q(this,Ws).once("block",Q(this,X0))},E_=function(){const e=Q(this,Ml);e&&(ue(this,Ml,null),e.then(r=>{Q(this,Ws).destroyed||Q(this,Ws).send("eth_uninstallFilter",[r])}))};var tp;class j8e extends yJ{constructor(r,n){super(r);Ie(this,tp);ue(this,tp,F8e(n))}_recover(r){return new Pk(r,Q(this,tp))}async _subscribe(r){return await r.send("eth_newFilter",[Q(this,tp)])}async _emitResults(r,n){for(const i of n)r.emit(Q(this,tp),r._wrapLog(i,r._network))}}tp=new WeakMap;class U8e extends yJ{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const $8e="bigint,boolean,function,number,string,symbol".split(/,/g);function y3(t){if(t==null||$8e.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(y3);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function q8e(t){return new Promise(e=>{setTimeout(e,t)})}function N1(t){return t&&t.toLowerCase()}function bF(t){return t&&typeof t.pollingInterval=="number"}const mJ={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class p9 extends z8{constructor(r,n){super(r);de(this,"address");n=Qt(n),Ot(this,{address:n})}connect(r){Le(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=y3(r),i=[];if(n.from){const o=n.from;i.push((async()=>{const a=await rs(o,this.provider);ve(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=a})())}else n.from=this.address;if(n.gasLimit==null&&i.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const o=n.to;i.push((async()=>{n.to=await rs(o,this.provider)})())}i.length&&await Promise.all(i);const s=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),i=await this.sendUncheckedTransaction(r);return await new Promise((s,o)=>{const a=[1e3,100];let c=0;const l=async()=>{try{const f=await this.provider.getTransaction(i);if(f!=null){s(f.replaceableTransaction(n));return}}catch(f){if(Is(f,"CANCELLED")||Is(f,"BAD_DATA")||Is(f,"NETWORK_ERROR")){f.info==null&&(f.info={}),f.info.sendTransactionHash=i,o(f);return}if(Is(f,"INVALID_ARGUMENT")&&(c++,f.info==null&&(f.info={}),f.info.sendTransactionHash=i,c>10)){o(f);return}this.provider.emit("error",zn("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:f}))}this.provider._setTimeout(()=>{l()},a.pop()||4e3)};l()})}async signTransaction(r){const n=y3(r);if(n.from){const s=await rs(n.from,this.provider);ve(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=s}else n.from=this.address;const i=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[i])}async signMessage(r){const n=typeof r=="string"?Ii(r):r;return await this.provider.send("personal_sign",[Me(n),this.address.toLowerCase()])}async signTypedData(r,n,i){const s=y3(i),o=await uh.resolveNames(r,n,s,async a=>{const c=await rs(a);return ve(c!=null,"TypedData does not support null address","value",a),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(uh.getPayload(o.domain,n,o.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?Ii(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Me(n)])}}var rp,kg,Kf,Rl,jc,Ha,Co,Gw,C_;class V8e extends gJ{constructor(r,n){super(r,n);Ie(this,Gw);Ie(this,rp);Ie(this,kg);Ie(this,Kf);Ie(this,Rl);Ie(this,jc);Ie(this,Ha);Ie(this,Co);ue(this,kg,1),ue(this,rp,Object.assign({},mJ,n||{})),ue(this,Kf,[]),ue(this,Rl,null),ue(this,Ha,null),ue(this,Co,null);{let s=null;const o=new Promise(a=>{s=a});ue(this,jc,{promise:o,resolve:s})}const i=this._getOption("staticNetwork");typeof i=="boolean"?(ve(!i||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),i&&r!=null&&ue(this,Ha,ca.from(r))):i&&(ve(r==null||i.matches(r),"staticNetwork MUST match network object","options",n),ue(this,Ha,i))}_getOption(r){return Q(this,rp)[r]}get _network(){return Le(Q(this,Ha),"network is not available yet","NETWORK_ERROR"),Q(this,Ha)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let i=r.transaction;if(i&&i.type!=null&&Pt(i.type)&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},i,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if(Q(this,Ha))return Q(this,Ha)}else return r;return Q(this,Co)?await Q(this,Co):this.ready?(ue(this,Co,(async()=>{try{const n=ca.from(Pt(await this.send("eth_chainId",[])));return ue(this,Co,null),n}catch(n){throw ue(this,Co,null),n}})()),await Q(this,Co)):(ue(this,Co,(async()=>{const n={id:dm(this,kg)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let i;try{i=(await this._send(n))[0],ue(this,Co,null)}catch(s){throw ue(this,Co,null),this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:i}),"result"in i)return ca.from(Pt(i.result));throw this.getRpcError(n,i)})()),await Q(this,Co))}_start(){Q(this,jc)==null||Q(this,jc).resolve==null||(Q(this,jc).resolve(),ue(this,jc,null),(async()=>{for(;Q(this,Ha)==null&&!this.destroyed;)try{ue(this,Ha,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",zn("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await q8e(1e3)}qe(this,Gw,C_).call(this)})())}async _waitUntilReady(){if(Q(this,jc)!=null)return await Q(this,jc).promise}_getSubscriber(r){return r.type==="pending"?new U8e(this):r.type==="event"?this._getOption("polling")?new Pk(this,r.filter):new j8e(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new vJ("orphan"):super._getSubscriber(r)}get ready(){return Q(this,jc)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(i=>{if(r[i]==null)return;let s=i;i==="gasLimit"&&(s="gas"),n[s]=zc(Pt(r[i],`tx.${i}`))}),["from","to","data"].forEach(i=>{r[i]!=null&&(n[i]=Me(r[i]))}),r.accessList&&(n.accessList=Wp(r.accessList)),r.blobVersionedHashes&&(n.blobVersionedHashes=r.blobVersionedHashes.map(i=>i.toLowerCase())),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[N1(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[N1(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[N1(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[N1(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(N1):r.filter.address=N1(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:i}=r,{error:s}=n;if(i==="eth_estimateGas"&&s.message){const c=s.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return zn("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:s}})}if(i==="eth_call"||i==="eth_estimateGas"){const c=A_(s),l=Ns.getBuiltinCallException(i==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return l.info={error:s,payload:r},l}const o=JSON.stringify(H8e(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return zn("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[i]||"unknown",reason:"rejected",info:{payload:r,error:s}});if(i==="eth_sendRawTransaction"||i==="eth_sendTransaction"){const c=r.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return zn("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return zn("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:s}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return zn("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:s}});if(o.match(/only replay-protected/i))return zn("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:i,info:{transaction:c,info:{error:s}}})}let a=!!o.match(/the method .* does not exist/i);return a||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(a=!0),a?zn("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:s,payload:r}}):zn("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(zn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const i=dm(this,kg)._++,s=new Promise((o,a)=>{Q(this,Kf).push({resolve:o,reject:a,payload:{method:r,params:n,id:i,jsonrpc:"2.0"}})});return qe(this,Gw,C_).call(this),s}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const s=await n;if(r>=s.length)throw new Error("no such account");return new p9(this,s[r])}const{accounts:i}=await pi({network:this.getNetwork(),accounts:n});r=Qt(r);for(const s of i)if(Qt(s)===r)return new p9(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new p9(this,n))}destroy(){Q(this,Rl)&&(clearTimeout(Q(this,Rl)),ue(this,Rl,null));for(const{payload:r,reject:n}of Q(this,Kf))n(zn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));ue(this,Kf,[]),super.destroy()}}rp=new WeakMap,kg=new WeakMap,Kf=new WeakMap,Rl=new WeakMap,jc=new WeakMap,Ha=new WeakMap,Co=new WeakMap,Gw=new WeakSet,C_=function(){if(Q(this,Rl))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");ue(this,Rl,setTimeout(()=>{ue(this,Rl,null);const n=Q(this,Kf);for(ue(this,Kf,[]);n.length;){const i=[n.shift()];for(;n.length&&i.length!==Q(this,rp).batchMaxCount;)if(i.push(n.shift()),JSON.stringify(i.map(o=>o.payload)).length>Q(this,rp).batchMaxSize){n.unshift(i.pop());break}(async()=>{const s=i.length===1?i[0].payload:i.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const o=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:c,payload:l}of i){if(this.destroyed){c(zn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const f=o.filter(u=>u.id===l.id)[0];if(f==null){const u=zn("missing response for request","BAD_DATA",{value:o,info:{payload:l}});this.emit("error",u),c(u);continue}if("error"in f){c(this.getRpcError(l,f));continue}a(f.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of i)a(o)}})()}},r))};var Od;class z8e extends V8e{constructor(r,n){super(r,n);Ie(this,Od);let i=this._getOption("pollingInterval");i==null&&(i=mJ.pollingInterval),ue(this,Od,i)}_getSubscriber(r){const n=super._getSubscriber(r);return bF(n)&&(n.pollingInterval=Q(this,Od)),n}get pollingInterval(){return Q(this,Od)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");ue(this,Od,r),this._forEachSubscriber(n=>{bF(n)&&(n.pollingInterval=Q(this,Od))})}}Od=new WeakMap;var Mg,q$;let Iy=(q$=class extends z8e{constructor(r,n,i){r==null&&(r="http://localhost:8545");super(n,i);Ie(this,Mg);typeof r=="string"?ue(this,Mg,new Jl(r)):ue(this,Mg,r.clone())}_getConnection(){return Q(this,Mg).clone()}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){const n=this._getConnection();n.body=JSON.stringify(r),n.setHeader("content-type","application/json");const i=await n.send();i.assertOk();let s=i.bodyJson;return Array.isArray(s)||(s=[s]),s}},Mg=new WeakMap,q$);function A_(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&Gr(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=A_(t[e]);if(r)return r}return null}if(typeof t=="string")try{return A_(JSON.parse(t))}catch{}return null}function S_(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)S_(t[r],e);if(typeof t=="string")try{return S_(JSON.parse(t),e)}catch{}}}function H8e(t){const e=[];return S_(t,e),e}var Rg;const rR=class rR extends z8{constructor(r,n){super(n);de(this,"address");Ie(this,Rg);ve(r&&typeof r.sign=="function","invalid private key","privateKey","[ REDACTED ]"),ue(this,Rg,r);const i=yx(this.signingKey.publicKey);Ot(this,{address:i})}get signingKey(){return Q(this,Rg)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(r){return new rR(Q(this,Rg),r)}async signTransaction(r){r=Ew(r);const{to:n,from:i}=await pi({to:r.to?rs(r.to,this.provider):void 0,from:r.from?rs(r.from,this.provider):void 0});n!=null&&(r.to=n),i!=null&&(r.from=i),r.from!=null&&(ve(Qt(r.from)===this.address,"transaction from address mismatch","tx.from",r.from),delete r.from);const s=ww.from(r);return s.signature=this.signingKey.sign(s.unsignedHash),s.serialized}async signMessage(r){return this.signMessageSync(r)}signMessageSync(r){return this.signingKey.sign(Ak(r)).serialized}async signTypedData(r,n,i){const s=await uh.resolveNames(r,n,i,async o=>{Le(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:o}});const a=await this.provider.resolveName(o);return Le(a!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),a});return this.signingKey.sign(uh.hash(s.domain,n,s.value)).serialized}};Rg=new WeakMap;let j5=rR;const U5=" !#$%&'()*+,-./<=>?@[]^_`{|}~",G8e=/^[a-z]*$/i;function wF(t,e){let r=97;return t.reduce((n,i)=>(i===e?r++:i.match(G8e)?n.push(String.fromCharCode(r)+i):(r=97,n.push(i)),n),[])}function W8e(t,e){for(let i=U5.length-1;i>=0;i--)t=t.split(U5[i]).join(e.substring(2*i,2*i+2));const r=[],n=t.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(i,s,o,a)=>{if(o)for(let c=parseInt(o);c>=0;c--)r.push(";");else r.push(s.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return wF(wF(r,";"),":")}function K8e(t){return ve(t[0]==="0","unsupported auwl data","data",t),W8e(t.substring(1+2*U5.length),t.substring(1,1+2*U5.length))}class Y8e{constructor(e){de(this,"locale");Ot(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}var Og,Ww,np,Kw,__;class Q8e extends Y8e{constructor(r,n,i){super(r);Ie(this,Kw);Ie(this,Og);Ie(this,Ww);Ie(this,np);ue(this,Og,n),ue(this,Ww,i),ue(this,np,null)}get _data(){return Q(this,Og)}_decodeWords(){return K8e(Q(this,Og))}getWord(r){const n=qe(this,Kw,__).call(this);return ve(r>=0&&r=0)&&(r[i]=t[i]);return r}function _2e(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function I2e(t,e){return t.button===0&&(!e||e==="_self")&&!_2e(t)}const T2e=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],P2e="6";try{window.__reactRouterVersion=P2e}catch{}const k2e="startTransition",iL=eq[k2e];function M2e(t){let{basename:e,children:r,future:n,window:i}=t,s=D.useRef();s.current==null&&(s.current=Lxe({window:i,v5Compat:!0}));let o=s.current,[a,c]=D.useState({action:o.action,location:o.location}),{v7_startTransition:l}=n||{},f=D.useCallback(u=>{l&&iL?iL(()=>c(u)):c(u)},[c,l]);return D.useLayoutEffect(()=>o.listen(f),[o,f]),D.createElement(C2e,{basename:e,children:r,location:a.location,navigationType:a.action,navigator:o,future:n})}const R2e=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",O2e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eY=D.forwardRef(function(e,r){let{onClick:n,relative:i,reloadDocument:s,replace:o,state:a,target:c,to:l,preventScrollReset:f,unstable_viewTransition:u}=e,p=S2e(e,T2e),{basename:g}=D.useContext(Th),y,b=!1;if(typeof l=="string"&&O2e.test(l)&&(y=l,R2e))try{let O=new URL(window.location.href),L=l.startsWith("//")?new URL(O.protocol+l):new URL(l),F=ZP(L.pathname,g);L.origin===O.origin&&F!=null?l=F+L.search+L.hash:b=!0}catch{}let I=l2e(l,{relative:i}),C=D2e(l,{replace:o,state:a,target:c,preventScrollReset:f,relative:i,unstable_viewTransition:u});function S(O){n&&n(O),O.defaultPrevented||C(O)}return D.createElement("a",$7({},p,{href:y||I,onClick:b||s?n:S,ref:r,target:c}))});var sL;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(sL||(sL={}));var oL;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(oL||(oL={}));function D2e(t,e){let{target:r,replace:n,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a}=e===void 0?{}:e,c=rk(),l=px(),f=JK(t,{relative:o});return D.useCallback(u=>{if(I2e(u,r)){u.preventDefault();let p=n!==void 0?n:_5(l)===_5(f);c(t,{replace:p,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a})}},[l,c,f,n,i,r,t,s,o,a])}const N2e=[{inputs:[{internalType:"bytes32",type:"bytes32"}],name:"getAlternativeSignature",outputs:[{internalType:"string",type:"string"}],stateMutability:"view",type:"function"}];var B2e=Object.freeze({__proto__:null,abi:N2e});const L2e=[{type:"function",name:"isValidSignature",constant:!0,inputs:[{type:"bytes32"},{type:"bytes"}],outputs:[{type:"bytes4"}],payable:!1,stateMutability:"view"}],F2e={isValidSignatureBytes32:"0x1626ba7e"};var j2e=Object.freeze({__proto__:null,abi:L2e,returns:F2e});const U2e=[{inputs:[{internalType:"bytes",name:"error",type:"bytes"}],name:"ERC1271Revert",type:"error"},{inputs:[{internalType:"bytes",name:"error",type:"bytes"}],name:"ERC6492DeployFailed",type:"error"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSig",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"allowSideEffects",type:"bool"},{internalType:"bool",name:"deployAlreadyDeployed",type:"bool"}],name:"isValidSigImpl",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSigNoThrow",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSigWithSideEffects",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],name:"isValidSigWithSideEffectsNoThrow",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];var $2e=Object.freeze({__proto__:null,abi:U2e});const q2e=[{type:"function",name:"deploy",constant:!1,inputs:[{type:"address"},{type:"bytes32"}],outputs:[],payable:!0,stateMutability:"payable"}];var V2e=Object.freeze({__proto__:null,abi:q2e});const z2e=[{type:"function",name:"nonce",constant:!0,inputs:[],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"readNonce",constant:!0,inputs:[{type:"uint256"}],outputs:[{type:"uint256"}],payable:!1,stateMutability:"view"},{type:"function",name:"updateImplementation",constant:!1,inputs:[{type:"address"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"selfExecute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"execute",constant:!1,inputs:[{components:[{type:"bool",name:"delegateCall"},{type:"bool",name:"revertOnError"},{type:"uint256",name:"gasLimit"},{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}],type:"tuple[]"},{type:"uint256"},{type:"bytes"}],outputs:[],payable:!1,stateMutability:"nonpayable"},{type:"function",name:"createContract",inputs:[{type:"bytes"}],payable:!0,stateMutability:"payable"},{type:"function",name:"setExtraImageHash",constant:!1,inputs:[{type:"bytes32",name:"imageHash"},{type:"uint256",name:"expiration"}],outputs:[],payable:!1,stateMutability:"nonpayable"}];var H2e=Object.freeze({__proto__:null,abi:z2e});const G2e=[{type:"function",name:"updateImageHash",constant:!0,inputs:[{type:"bytes32"}],outputs:[],payable:!1,stateMutability:"view"},{type:"function",name:"imageHash",constant:!0,inputs:[],outputs:[{type:"bytes32"}],payable:!1,stateMutability:"view"}];var W2e=Object.freeze({__proto__:null,abi:G2e});const K2e=[{inputs:[{internalType:"address",name:"_factory",type:"address"},{internalType:"address",name:"_mainModule",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"bytes32",name:"_imageHash",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"_threshold",type:"uint256"},{indexed:!1,internalType:"bytes",name:"_signers",type:"bytes"}],name:"RequiredConfig",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"_wallet",type:"address"},{indexed:!0,internalType:"address",name:"_signer",type:"address"}],name:"RequiredSigner",type:"event"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callBalanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callBlockNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_i",type:"uint256"}],name:"callBlockhash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"callChainId",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCode",outputs:[{internalType:"bytes",name:"code",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeHash",outputs:[{internalType:"bytes32",name:"codeHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_addr",type:"address"}],name:"callCodeSize",outputs:[{internalType:"uint256",name:"size",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callCoinbase",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callDifficulty",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLeft",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasLimit",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callGasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"callOrigin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"callTimestamp",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"knownImageHashes",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"lastImageHashUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastSignerUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"lastWalletUpdate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"bool",name:"delegateCall",type:"bool"},{internalType:"bool",name:"revertOnError",type:"bool"},{internalType:"uint256",name:"gasLimit",type:"uint256"},{internalType:"address",name:"target",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct IModuleCalls.Transaction[]",name:"_txs",type:"tuple[]"}],name:"multiCall",outputs:[{internalType:"bool[]",name:"_successes",type:"bool[]"},{internalType:"bytes[]",name:"_results",type:"bytes[]"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_threshold",type:"uint256"},{components:[{internalType:"uint256",name:"weight",type:"uint256"},{internalType:"address",name:"signer",type:"address"}],internalType:"struct RequireUtils.Member[]",name:"_members",type:"tuple[]"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishConfig",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"uint256",name:"_sizeMembers",type:"uint256"},{internalType:"bytes",name:"_signature",type:"bytes"},{internalType:"bool",name:"_index",type:"bool"}],name:"publishInitialSigners",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_wallet",type:"address"},{internalType:"uint256",name:"_nonce",type:"uint256"}],name:"requireMinNonce",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_expiration",type:"uint256"}],name:"requireNonExpired",outputs:[],stateMutability:"view",type:"function"}];var Y2e=Object.freeze({__proto__:null,abi:K2e});const Q2e=[{inputs:[{internalType:"address",name:"",type:"address"}],name:"requireFreshSigner",outputs:[],stateMutability:"nonpayable",type:"function"}];var J2e=Object.freeze({__proto__:null,abi:Q2e});const Ps={erc6492:$2e,erc5719:B2e,erc1271:j2e,factory:V2e,mainModule:H2e,mainModuleUpgradable:W2e,sequenceUtils:Y2e,requireFreshSigner:J2e},tY="6.13.2";function Z2e(t,e,r){const n=e.split("|").map(s=>s.trim());for(let s=0;sPromise.resolve(t[n])))).reduce((n,i,s)=>(n[e[s]]=i,n),{})}function Ot(t,e,r){for(let n in e){let i=e[n];const s=r?r[n]:null;s&&Z2e(i,s,n),Object.defineProperty(t,n,{enumerable:!0,value:i,writable:!1})}}function dv(t){if(t==null)return"null";if(Array.isArray(t))return"[ "+t.map(dv).join(", ")+" ]";if(t instanceof Uint8Array){const e="0123456789abcdef";let r="0x";for(let n=0;n>4],r+=e[t[n]&15];return r}if(typeof t=="object"&&typeof t.toJSON=="function")return dv(t.toJSON());switch(typeof t){case"boolean":case"symbol":return t.toString();case"bigint":return BigInt(t).toString();case"number":return t.toString();case"string":return JSON.stringify(t);case"object":{const e=Object.keys(t);return e.sort(),"{ "+e.map(r=>`${dv(r)}: ${dv(t[r])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Is(t,e){return t&&t.code===e}function nk(t){return Is(t,"CALL_EXCEPTION")}function zn(t,e,r){let n=t;{const s=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${dv(r)}`);for(const o in r){if(o==="shortMessage")continue;const a=r[o];s.push(o+"="+dv(a))}}s.push(`code=${e}`),s.push(`version=${tY}`),s.length&&(t+=" ("+s.join(", ")+")")}let i;switch(e){case"INVALID_ARGUMENT":i=new TypeError(t);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":i=new RangeError(t);break;default:i=new Error(t)}return Ot(i,{code:e}),r&&Object.assign(i,r),i.shortMessage==null&&Ot(i,{shortMessage:n}),i}function Le(t,e,r,n){if(!t)throw zn(e,r,n)}function ve(t,e,r,n){Le(t,e,"INVALID_ARGUMENT",{argument:r,value:n})}function rY(t,e,r){r==null&&(r=""),r&&(r=": "+r),Le(t>=e,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:t,expectedCount:e}),Le(t<=e,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:t,expectedCount:e})}const X2e=["NFD","NFC","NFKD","NFKC"].reduce((t,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");t.push(e)}catch{}return t},[]);function nY(t){Le(X2e.indexOf(t)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:t}})}function kh(t,e,r){if(r==null&&(r=""),t!==e){let n=r,i="new";r&&(n+=".",i+=" "+r),Le(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:i})}}function iY(t,e,r){if(t instanceof Uint8Array)return r?new Uint8Array(t):t;if(typeof t=="string"&&t.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((t.length-2)/2);let i=2;for(let s=0;s>4]+aL[i&15]}return r}function qr(t){return"0x"+t.map(e=>Me(e).substring(2)).join("")}function fp(t){return Gr(t,!0)?(t.length-2)/2:Ue(t).length}function mn(t,e,r){const n=Ue(t);return r!=null&&r>n.length&&Le(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),Me(n.slice(e??0,r??n.length))}function sY(t,e,r){const n=Ue(t);Le(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const i=new Uint8Array(e);return i.fill(0),r?i.set(n,e-n.length):i.set(n,0),Me(i)}function Kc(t,e){return sY(t,e,!0)}function oY(t,e){return sY(t,e,!1)}const P8=BigInt(0),Vc=BigInt(1),hv=9007199254740991;function T5(t,e){const r=k8(t,"value"),n=BigInt(or(e,"width"));if(Le(r>>n===P8,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:t}),r>>n-Vc){const i=(Vc<=-hv&&t<=hv,"overflow",e||"value",t),BigInt(t);case"string":try{if(t==="")throw new Error("empty string");return t[0]==="-"&&t[1]!=="-"?-BigInt(t.substring(1)):BigInt(t)}catch(r){ve(!1,`invalid BigNumberish string: ${r.message}`,e||"value",t)}}ve(!1,"invalid BigNumberish value",e||"value",t)}function k8(t,e){const r=Pt(t,e);return Le(r>=P8,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:t}),r}const cL="0123456789abcdef";function vx(t){if(t instanceof Uint8Array){let e="0x0";for(const r of t)e+=cL[r>>4],e+=cL[r&15];return BigInt(e)}return Pt(t)}function or(t,e){switch(typeof t){case"bigint":return ve(t>=-hv&&t<=hv,"overflow",e||"value",t),Number(t);case"number":return ve(Number.isInteger(t),"underflow",e||"value",t),ve(t>=-hv&&t<=hv,"overflow",e||"value",t),t;case"string":try{if(t==="")throw new Error("empty string");return or(BigInt(t),e)}catch(r){ve(!1,`invalid numeric string: ${r.message}`,e||"value",t)}}ve(!1,"invalid numeric value",e||"value",t)}function e6e(t){return or(vx(t))}function tc(t,e){let n=k8(t,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const i=or(e,"width");for(Le(i*2>=n.length,`value exceeds width (${i} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:t});n.length>6===2;o++)s++;return s}return t==="OVERRUN"?r.length-e-1:0}function a6e(t,e,r,n,i){return t==="OVERLONG"?(ve(typeof i=="number","invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),lY(t,e,r))}const c6e=Object.freeze({error:o6e,ignore:lY,replace:a6e});function l6e(t,e){e==null&&(e=c6e.error);const r=Ue(t,"bytes"),n=[];let i=0;for(;i>7)){n.push(s);continue}let o=null,a=null;if((s&224)===192)o=1,a=127;else if((s&240)===224)o=2,a=2047;else if((s&248)===240)o=3,a=65535;else{(s&192)===128?i+=e("UNEXPECTED_CONTINUE",i-1,r,n):i+=e("BAD_PREFIX",i-1,r,n);continue}if(i-1+o>=r.length){i+=e("OVERRUN",i-1,r,n);continue}let c=s&(1<<8-o-1)-1;for(let l=0;l1114111){i+=e("OUT_OF_RANGE",i-1-o,r,n,c);continue}if(c>=55296&&c<=57343){i+=e("UTF16_SURROGATE",i-1-o,r,n,c);continue}if(c<=a){i+=e("OVERLONG",i-1-o,r,n,c);continue}n.push(c)}}return n}function Ii(t,e){ve(typeof t=="string","invalid string value","str",t),e!=null&&(nY(e),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 s=t.charCodeAt(n);ve(n>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return new Uint8Array(r)}function f6e(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Ip(t,e){return f6e(l6e(t,e))}function fY(t){async function e(r,n){Le(n==null||!n.cancelled,"request cancelled before sending","CANCELLED");const i=r.url.split(":")[0].toLowerCase();Le(i==="http"||i==="https",`unsupported protocol ${i}`,"UNSUPPORTED_OPERATION",{info:{protocol:i},operation:"request"}),Le(i==="https"||!r.credentials||r.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s=null;const o=new AbortController,a=setTimeout(()=>{s=zn("request timeout","TIMEOUT"),o.abort()},r.timeout);n&&n.addListener(()=>{s=zn("request cancelled","CANCELLED"),o.abort()});const c={method:r.method,headers:new Headers(Array.from(r)),body:r.body||void 0,signal:o.signal};let l;try{l=await fetch(r.url,c)}catch(g){throw clearTimeout(a),s||g}clearTimeout(a);const f={};l.headers.forEach((g,y)=>{f[y.toLowerCase()]=g});const u=await l.arrayBuffer(),p=u==null?null:new Uint8Array(u);return{statusCode:l.status,statusMessage:l.statusText,headers:f,body:p}}return e}const u6e=12,d6e=250;let lL=fY();const h6e=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),p6e=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let ZA=!1;async function uY(t,e){try{const r=t.match(h6e);if(!r)throw new Error("invalid data");return new Qd(200,"OK",{"content-type":r[1]||"text/plain"},r[2]?i6e(r[3]):g6e(r[3]))}catch{return new Qd(599,"BAD REQUEST (invalid data: URI)",{},null,new Jl(t))}}function dY(t){async function e(r,n){try{const i=r.match(p6e);if(!i)throw new Error("invalid link");return new Jl(`${t}${i[2]}`)}catch{return new Qd(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Jl(r))}}return e}const h6={data:uY,ipfs:dY("https://gateway.ipfs.io/ipfs/")},hY=new WeakMap;var L0,yd;class v6e{constructor(e){Ie(this,L0);Ie(this,yd);ue(this,L0,[]),ue(this,yd,!1),hY.set(e,()=>{if(!Q(this,yd)){ue(this,yd,!0);for(const r of Q(this,L0))setTimeout(()=>{r()},0);ue(this,L0,[])}})}addListener(e){Le(!Q(this,yd),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),Q(this,L0).push(e)}get cancelled(){return Q(this,yd)}checkSignal(){Le(!this.cancelled,"cancelled","CANCELLED",{})}}L0=new WeakMap,yd=new WeakMap;function p6(t){if(t==null)throw new Error("missing signal; should not happen");return t.checkSignal(),t}var Wv,Kv,Nc,Lf,Yv,Qv,Ri,Xo,Ff,F0,j0,U0,Sl,Bc,md,$0,Qm;const g4=class g4{constructor(e){Ie(this,$0);Ie(this,Wv);Ie(this,Kv);Ie(this,Nc);Ie(this,Lf);Ie(this,Yv);Ie(this,Qv);Ie(this,Ri);Ie(this,Xo);Ie(this,Ff);Ie(this,F0);Ie(this,j0);Ie(this,U0);Ie(this,Sl);Ie(this,Bc);Ie(this,md);ue(this,Qv,String(e)),ue(this,Wv,!1),ue(this,Kv,!0),ue(this,Nc,{}),ue(this,Lf,""),ue(this,Yv,3e5),ue(this,Bc,{slotInterval:d6e,maxAttempts:u6e}),ue(this,md,null)}get url(){return Q(this,Qv)}set url(e){ue(this,Qv,String(e))}get body(){return Q(this,Ri)==null?null:new Uint8Array(Q(this,Ri))}set body(e){if(e==null)ue(this,Ri,void 0),ue(this,Xo,void 0);else if(typeof e=="string")ue(this,Ri,Ii(e)),ue(this,Xo,"text/plain");else if(e instanceof Uint8Array)ue(this,Ri,e),ue(this,Xo,"application/octet-stream");else if(typeof e=="object")ue(this,Ri,Ii(JSON.stringify(e))),ue(this,Xo,"application/json");else throw new Error("invalid body")}hasBody(){return Q(this,Ri)!=null}get method(){return Q(this,Lf)?Q(this,Lf):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),ue(this,Lf,String(e).toUpperCase())}get headers(){const e=Object.assign({},Q(this,Nc));return Q(this,Ff)&&(e.authorization=`Basic ${s6e(Ii(Q(this,Ff)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&Q(this,Xo)&&(e["content-type"]=Q(this,Xo)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,r){Q(this,Nc)[String(e).toLowerCase()]=String(r)}clearHeaders(){ue(this,Nc,{})}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"timeout must be non-zero","timeout",e),ue(this,Yv,e)}get preflightFunc(){return Q(this,F0)||null}set preflightFunc(e){ue(this,F0,e)}get processFunc(){return Q(this,j0)||null}set processFunc(e){ue(this,j0,e)}get retryFunc(){return Q(this,U0)||null}set retryFunc(e){ue(this,U0,e)}get getUrlFunc(){return Q(this,md)||lL}set getUrlFunc(e){ue(this,md,e)}toString(){return``}setThrottleParams(e){e.slotInterval!=null&&(Q(this,Bc).slotInterval=e.slotInterval),e.maxAttempts!=null&&(Q(this,Bc).maxAttempts=e.maxAttempts)}send(){return Le(Q(this,Sl)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),ue(this,Sl,new v6e(this)),qe(this,$0,Qm).call(this,0,fL()+this.timeout,0,this,new Qd(0,"",{},null,this))}cancel(){Le(Q(this,Sl)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=hY.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const r=this.url.split(":")[0].toLowerCase(),n=e.split(":")[0].toLowerCase();Le(this.method==="GET"&&(r!=="https"||n!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const i=new g4(e);return i.method="GET",i.allowGzip=this.allowGzip,i.timeout=this.timeout,ue(i,Nc,Object.assign({},Q(this,Nc))),Q(this,Ri)&&ue(i,Ri,new Uint8Array(Q(this,Ri))),ue(i,Xo,Q(this,Xo)),i}clone(){const e=new g4(this.url);return ue(e,Lf,Q(this,Lf)),Q(this,Ri)&&ue(e,Ri,Q(this,Ri)),ue(e,Xo,Q(this,Xo)),ue(e,Nc,Object.assign({},Q(this,Nc))),ue(e,Ff,Q(this,Ff)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),ue(e,F0,Q(this,F0)),ue(e,j0,Q(this,j0)),ue(e,U0,Q(this,U0)),ue(e,Bc,Object.assign({},Q(this,Bc))),ue(e,md,Q(this,md)),e}static lockConfig(){ZA=!0}static getGateway(e){return h6[e.toLowerCase()]||null}static registerGateway(e,r){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(ZA)throw new Error("gateways locked");h6[e]=r}static registerGetUrl(e){if(ZA)throw new Error("gateways locked");lL=e}static createGetUrlFunc(e){return fY()}static createDataGateway(){return uY}static createIpfsGatewayFunc(e){return dY(e)}};Wv=new WeakMap,Kv=new WeakMap,Nc=new WeakMap,Lf=new WeakMap,Yv=new WeakMap,Qv=new WeakMap,Ri=new WeakMap,Xo=new WeakMap,Ff=new WeakMap,F0=new WeakMap,j0=new WeakMap,U0=new WeakMap,Sl=new WeakMap,Bc=new WeakMap,md=new WeakMap,$0=new WeakSet,Qm=async function(e,r,n,i,s){var f,u,p;if(e>=Q(this,Bc).maxAttempts)return s.makeServerError("exceeded maximum retry limit");Le(fL()<=r,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:i}),n>0&&await y6e(n);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in h6){const g=await h6[a](o.url,p6(Q(i,Sl)));if(g instanceof Qd){let y=g;if(this.processFunc){p6(Q(i,Sl));try{y=await this.processFunc(o,y)}catch(b){(b.throttle==null||typeof b.stall!="number")&&y.makeServerError("error in post-processing function",b).assertOk()}}return y}o=g}this.preflightFunc&&(o=await this.preflightFunc(o));const c=await this.getUrlFunc(o,p6(Q(i,Sl)));let l=new Qd(c.statusCode,c.statusMessage,c.headers,c.body,i);if(l.statusCode===301||l.statusCode===302){try{const g=l.headers.location||"";return qe(f=o.redirect(g),$0,Qm).call(f,e+1,r,0,i,l)}catch{}return l}else if(l.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,l,e))){const g=l.headers["retry-after"];let y=Q(this,Bc).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof g=="string"&&g.match(/^[1-9][0-9]*$/)&&(y=parseInt(g)),qe(u=o.clone(),$0,Qm).call(u,e+1,r,y,i,l)}if(this.processFunc){p6(Q(i,Sl));try{l=await this.processFunc(o,l)}catch(g){(g.throttle==null||typeof g.stall!="number")&&l.makeServerError("error in post-processing function",g).assertOk();let y=Q(this,Bc).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return g.stall>=0&&(y=g.stall),qe(p=o.clone(),$0,Qm).call(p,e+1,r,y,i,l)}}return l};let Jl=g4;var Nw,Bw,Lw,ea,Jv,q0;const ZM=class ZM{constructor(e,r,n,i,s){Ie(this,Nw);Ie(this,Bw);Ie(this,Lw);Ie(this,ea);Ie(this,Jv);Ie(this,q0);ue(this,Nw,e),ue(this,Bw,r),ue(this,Lw,Object.keys(n).reduce((o,a)=>(o[a.toLowerCase()]=String(n[a]),o),{})),ue(this,ea,i==null?null:new Uint8Array(i)),ue(this,Jv,s||null),ue(this,q0,{message:""})}toString(){return``}get statusCode(){return Q(this,Nw)}get statusMessage(){return Q(this,Bw)}get headers(){return Object.assign({},Q(this,Lw))}get body(){return Q(this,ea)==null?null:new Uint8Array(Q(this,ea))}get bodyText(){try{return Q(this,ea)==null?"":Ip(Q(this,ea))}catch{Le(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Le(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,r=Object.keys(e);let n=0;return{next:()=>{if(n=0,"invalid stall timeout","stall",r);const n=new Error(e||"throttling requests");throw Ot(n,{stall:r,throttle:!0}),n}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return Q(this,ea)!=null}get request(){return Q(this,Jv)}ok(){return Q(this,q0).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:r}=Q(this,q0);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let n=null;this.request&&(n=this.request.url);let i=null;try{Q(this,ea)&&(i=Ip(Q(this,ea)))}catch{}Le(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:r,info:{requestUrl:n,responseBody:i,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};Nw=new WeakMap,Bw=new WeakMap,Lw=new WeakMap,ea=new WeakMap,Jv=new WeakMap,q0=new WeakMap;let Qd=ZM;function fL(){return new Date().getTime()}function g6e(t){return Ii(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function y6e(t){return new Promise(e=>setTimeout(e,t))}const m6e=BigInt(-1),kc=BigInt(0),pv=BigInt(1),b6e=BigInt(5),R1={};let kv="0000";for(;kv.length<80;)kv+=kv;function i0(t){let e=kv;for(;e.length=-i&&tkc?t=T5(P0(t,n),n):t=-T5(P0(-t,n),n)}else{const i=pv<=0&&ts[a]==null?l:(ve(typeof s[a]===c,"invalid fixed format ("+a+" not "+c+")","format."+a,s[a]),s[a]);e=o("signed","boolean",e),r=o("width","number",r),n=o("decimals","number",n)}ve(r%8===0,"invalid FixedNumber width (not byte aligned)","format.width",r),ve(n<=80,"invalid FixedNumber decimals (too large)","format.decimals",n);const i=(e?"":"u")+"fixed"+String(r)+"x"+String(n);return{signed:e,width:r,decimals:n,name:i}}function w6e(t,e){let r="";t0?n*=i0(i):i<0&&(r*=i0(-i)),rn?1:0}eq(e){return this.cmp(e)===0}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=Q(this,an);return Q(this,an)kc&&(e+=Q(this,Gs)-pv),e=Q(this,an)/Q(this,Gs)*Q(this,Gs),qe(this,Xr,Sf).call(this,e,"ceiling")}round(e){if(e==null&&(e=0),e>=this.decimals)return this;const r=this.decimals-e,n=b6e*i0(r-1);let i=this.value+n;const s=i0(r);return i=i/s*s,Sm(i,Q(this,Lc),"round"),new hd(R1,i,Q(this,Lc))}isZero(){return Q(this,an)===kc}isNegative(){return Q(this,an)0){const c=i0(a);Le(o%c===kc,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),o/=c}else a<0&&(o*=i0(-a));return Sm(o,s,"fromValue"),new hd(R1,o,s)}static fromString(e,r){const n=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);ve(n&&n[2].length+n[3].length>0,"invalid FixedNumber string value","value",e);const i=XA(r);let s=n[2]||"0",o=n[3]||"";for(;o.length{Le(n<=t.length,"data short segment too short","BUFFER_OVERRUN",{buffer:t,length:t.length,offset:n})};if(t[e]>=248){const n=t[e]-247;r(e+1+n);const i=uL(t,e+1,n);return r(e+1+n+i),dL(t,e,e+1+n,n+i)}else if(t[e]>=192){const n=t[e]-192;return r(e+1+n),dL(t,e,e+1,n)}else if(t[e]>=184){const n=t[e]-183;r(e+1+n);const i=uL(t,e+1,n);r(e+1+n+i);const s=Me(t.slice(e+1+n,e+1+n+i));return{consumed:1+n+i,result:s}}else if(t[e]>=128){const n=t[e]-128;r(e+1+n);const i=Me(t.slice(e+1,e+1+n));return{consumed:1+n,result:i}}return{consumed:1,result:x6e(t[e])}}function M8(t){const e=Ue(t,"data"),r=pY(e,0);return ve(r.consumed===e.length,"unexpected junk after rlp payload","data",t),r.result}function hL(t){const e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function vY(t){if(Array.isArray(t)){let n=[];if(t.forEach(function(s){n=n.concat(vY(s))}),n.length<=55)return n.unshift(192+n.length),n;const i=hL(n.length);return i.unshift(247+i.length),i.concat(n)}const e=Array.prototype.slice.call(Ue(t,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const r=hL(e.length);return r.unshift(183+r.length),r.concat(e)}const pL="0123456789abcdef";function Tp(t){let e="0x";for(const r of vY(t))e+=pL[r>>4],e+=pL[r&15];return e}const gY=["wei","kwei","mwei","gwei","szabo","finney","ether"];function fh(t,e){let r=18;if(typeof e=="string"){const n=gY.indexOf(e);ve(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=or(e,"unit"));return k5.fromValue(t,r,{decimals:r,width:512}).toString()}function W7(t,e){ve(typeof t=="string","value must be a string","value",t);let r=18;if(typeof e=="string"){const n=gY.indexOf(e);ve(n>=0,"invalid unit","unit",e),r=3*n}else e!=null&&(r=or(e,"unit"));return k5.fromString(t,{decimals:r,width:512}).value}function E6e(t){return W7(t,18)}function C6e(t){const e=Ue(t,"randomBytes");e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=Me(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}const Qs=32,K7=new Uint8Array(Qs),A6e=["then"],v6={},yY=new WeakMap;function m0(t){return yY.get(t)}function vL(t,e){yY.set(t,e)}function _m(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);throw r.error=e,r}function Y7(t,e,r){return t.indexOf(null)>=0?e.map((n,i)=>n instanceof Gg?Y7(m0(n),n,r):n):t.reduce((n,i,s)=>{let o=e.getValue(i);return i in n||(r&&o instanceof Gg&&(o=Y7(m0(o),o,r)),n[i]=o),n},{})}var Zv;const yv=class yv extends Array{constructor(...r){const n=r[0];let i=r[1],s=(r[2]||[]).slice(),o=!0;n!==v6&&(i=r,s=[],o=!1);super(i.length);Ie(this,Zv);i.forEach((l,f)=>{this[f]=l});const a=s.reduce((l,f)=>(typeof f=="string"&&l.set(f,(l.get(f)||0)+1),l),new Map);if(vL(this,Object.freeze(i.map((l,f)=>{const u=s[f];return u!=null&&a.get(u)===1?u:null}))),ue(this,Zv,[]),Q(this,Zv)==null&&Q(this,Zv),!o)return;Object.freeze(this);const c=new Proxy(this,{get:(l,f,u)=>{if(typeof f=="string"){if(f.match(/^[0-9]+$/)){const g=or(f,"%index");if(g<0||g>=this.length)throw new RangeError("out of result range");const y=l[g];return y instanceof Error&&_m(`index ${g}`,y),y}if(A6e.indexOf(f)>=0)return Reflect.get(l,f,u);const p=l[f];if(p instanceof Function)return function(...g){return p.apply(this===u?l:this,g)};if(!(f in l))return l.getValue.apply(this===u?l:this,[f])}return Reflect.get(l,f,u)}});return vL(c,m0(this)),c}toArray(r){const n=[];return this.forEach((i,s)=>{i instanceof Error&&_m(`index ${s}`,i),r&&i instanceof yv&&(i=i.toArray(r)),n.push(i)}),n}toObject(r){const n=m0(this);return n.reduce((i,s,o)=>(Le(s!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Y7(n,this,r)),{})}slice(r,n){r==null&&(r=0),r<0&&(r+=this.length,r<0&&(r=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const i=m0(this),s=[],o=[];for(let a=r;a{Q(this,jf)[e]=gL(r)}}}jf=new WeakMap,V0=new WeakMap,Xv=new WeakSet,s3=function(e){return Q(this,jf).push(e),ue(this,V0,Q(this,V0)+e.length),e.length};var Eo,ta,z0,H0,bd,Up,Z7,mY;const XM=class XM{constructor(e,r,n){Ie(this,Up);de(this,"allowLoose");Ie(this,Eo);Ie(this,ta);Ie(this,z0);Ie(this,H0);Ie(this,bd);Ot(this,{allowLoose:!!r}),ue(this,Eo,es(e)),ue(this,z0,0),ue(this,H0,null),ue(this,bd,n??1024),ue(this,ta,0)}get data(){return Me(Q(this,Eo))}get dataLength(){return Q(this,Eo).length}get consumed(){return Q(this,ta)}get bytes(){return new Uint8Array(Q(this,Eo))}subReader(e){const r=new XM(Q(this,Eo).slice(Q(this,ta)+e),this.allowLoose,Q(this,bd));return ue(r,H0,this),r}readBytes(e,r){let n=qe(this,Up,mY).call(this,0,e,!!r);return qe(this,Up,Z7).call(this,e),ue(this,ta,Q(this,ta)+n.length),n.slice(0,e)}readValue(){return vx(this.readBytes(Qs))}readIndex(){return e6e(this.readBytes(Qs))}};Eo=new WeakMap,ta=new WeakMap,z0=new WeakMap,H0=new WeakMap,bd=new WeakMap,Up=new WeakSet,Z7=function(e){var r;if(Q(this,H0))return qe(r=Q(this,H0),Up,Z7).call(r,e);ue(this,z0,Q(this,z0)+e),Le(Q(this,bd)<1||Q(this,z0)<=Q(this,bd)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${Q(this,bd)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:es(Q(this,Eo)),offset:Q(this,ta),length:e,info:{bytesRead:Q(this,z0),dataLength:this.dataLength}})},mY=function(e,r,n){let i=Math.ceil(r/Qs)*Qs;return Q(this,ta)+i>Q(this,Eo).length&&(this.allowLoose&&n&&Q(this,ta)+r<=Q(this,Eo).length?i=r:Le(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:es(Q(this,Eo)),length:Q(this,Eo).length,offset:Q(this,ta)+i})),Q(this,Eo).slice(Q(this,ta),Q(this,ta)+i)};let J7=XM;function oa(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function sk(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function bY(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");oa(t.outputLen),oa(t.blockLen)}function Wg(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function wY(t,e){sk(t);const r=e.outputLen;if(t.lengtht instanceof Uint8Array,o3=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),a3=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),hl=(t,e)=>t<<32-e|t>>>e,S6e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!S6e)throw new Error("Non little-endian hardware is not supported");const _6e=async()=>{};async function yL(t,e,r){let n=Date.now();for(let i=0;i=0&&sn+i.length,0));let r=0;return t.forEach(n=>{if(!xY(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}class ok{clone(){return this._cloneInto()}}const P6e={}.toString;function EY(t,e){if(e!==void 0&&P6e.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(t,e)}function R8(t){const e=n=>t().update(Kg(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function k6e(t=32){if(e9&&typeof e9.getRandomValues=="function")return e9.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}let CY=class extends ok{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,bY(e);const n=Kg(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;onew CY(t,e).update(r).digest();O8.create=(t,e)=>new CY(t,e);function M6e(t,e,r,n){bY(t);const i=EY({dkLen:32,asyncTick:10},n),{c:s,dkLen:o,asyncTick:a}=i;if(oa(s),oa(o),oa(a),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=Kg(e),l=Kg(r),f=new Uint8Array(o),u=O8.create(t,c),p=u._cloneInto().update(l);return{c:s,dkLen:o,asyncTick:a,DK:f,PRF:u,PRFSalt:p}}function R6e(t,e,r,n,i){return t.destroy(),e.destroy(),n&&n.destroy(),i.fill(0),r}function ak(t,e,r,n){const{c:i,dkLen:s,DK:o,PRF:a,PRFSalt:c}=M6e(t,e,r,n);let l;const f=new Uint8Array(4),u=a3(f),p=new Uint8Array(a.outputLen);for(let g=1,y=0;y>i&s),a=Number(r&s),c=n?4:0,l=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+l,a,n)}class ck extends ok{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=a3(this.buffer)}update(e){Wg(this);const{view:r,buffer:n,blockLen:i}=this;e=Kg(e);const s=e.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let u=o;uf.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;ut&e^~t&r,N6e=(t,e,r)=>t&e^t&r^e&r,B6e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Xu=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ed=new Uint32Array(64);let L6e=class extends ck{constructor(){super(64,32,8,!1),this.A=Xu[0]|0,this.B=Xu[1]|0,this.C=Xu[2]|0,this.D=Xu[3]|0,this.E=Xu[4]|0,this.F=Xu[5]|0,this.G=Xu[6]|0,this.H=Xu[7]|0}get(){const{A:e,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[e,r,n,i,s,o,a,c]}set(e,r,n,i,s,o,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,r){for(let u=0;u<16;u++,r+=4)ed[u]=e.getUint32(r,!1);for(let u=16;u<64;u++){const p=ed[u-15],g=ed[u-2],y=hl(p,7)^hl(p,18)^p>>>3,b=hl(g,17)^hl(g,19)^g>>>10;ed[u]=b+ed[u-7]+y+ed[u-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:l,H:f}=this;for(let u=0;u<64;u++){const p=hl(a,6)^hl(a,11)^hl(a,25),g=f+p+D6e(a,c,l)+B6e[u]+ed[u]|0,b=(hl(n,2)^hl(n,13)^hl(n,22))+N6e(n,i,s)|0;f=l,l=c,c=a,a=o+g|0,o=s,s=i,i=n,n=g+b|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,i,s,o,a,c,l,f)}roundClean(){ed.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Ey=R8(()=>new L6e),g6=BigInt(2**32-1),X7=BigInt(32);function AY(t,e=!1){return e?{h:Number(t&g6),l:Number(t>>X7&g6)}:{h:Number(t>>X7&g6)|0,l:Number(t&g6)|0}}function SY(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;iBigInt(t>>>0)<>>0),j6e=(t,e,r)=>t>>>r,U6e=(t,e,r)=>t<<32-r|e>>>r,$6e=(t,e,r)=>t>>>r|e<<32-r,q6e=(t,e,r)=>t<<32-r|e>>>r,V6e=(t,e,r)=>t<<64-r|e>>>r-32,z6e=(t,e,r)=>t>>>r-32|e<<64-r,H6e=(t,e)=>e,G6e=(t,e)=>t,_Y=(t,e,r)=>t<>>32-r,IY=(t,e,r)=>e<>>32-r,TY=(t,e,r)=>e<>>64-r,PY=(t,e,r)=>t<>>64-r;function W6e(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const K6e=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Y6e=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Q6e=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),J6e=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Z6e=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),X6e=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0,dr={fromBig:AY,split:SY,toBig:F6e,shrSH:j6e,shrSL:U6e,rotrSH:$6e,rotrSL:q6e,rotrBH:V6e,rotrBL:z6e,rotr32H:H6e,rotr32L:G6e,rotlSH:_Y,rotlSL:IY,rotlBH:TY,rotlBL:PY,add:W6e,add3L:K6e,add3H:Y6e,add4L:Q6e,add4H:J6e,add5H:X6e,add5L:Z6e},[e3e,t3e]=dr.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),td=new Uint32Array(80),rd=new Uint32Array(80);let r3e=class extends ck{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:l,El:f,Fh:u,Fl:p,Gh:g,Gl:y,Hh:b,Hl:I}=this;return[e,r,n,i,s,o,a,c,l,f,u,p,g,y,b,I]}set(e,r,n,i,s,o,a,c,l,f,u,p,g,y,b,I){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=f|0,this.Fh=u|0,this.Fl=p|0,this.Gh=g|0,this.Gl=y|0,this.Hh=b|0,this.Hl=I|0}process(e,r){for(let O=0;O<16;O++,r+=4)td[O]=e.getUint32(r),rd[O]=e.getUint32(r+=4);for(let O=16;O<80;O++){const L=td[O-15]|0,F=rd[O-15]|0,z=dr.rotrSH(L,F,1)^dr.rotrSH(L,F,8)^dr.shrSH(L,F,7),_=dr.rotrSL(L,F,1)^dr.rotrSL(L,F,8)^dr.shrSL(L,F,7),$=td[O-2]|0,ie=rd[O-2]|0,ce=dr.rotrSH($,ie,19)^dr.rotrBH($,ie,61)^dr.shrSH($,ie,6),K=dr.rotrSL($,ie,19)^dr.rotrBL($,ie,61)^dr.shrSL($,ie,6),P=dr.add4L(_,K,rd[O-7],rd[O-16]),M=dr.add4H(P,z,ce,td[O-7],td[O-16]);td[O]=M|0,rd[O]=P|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:l,Dl:f,Eh:u,El:p,Fh:g,Fl:y,Gh:b,Gl:I,Hh:C,Hl:S}=this;for(let O=0;O<80;O++){const L=dr.rotrSH(u,p,14)^dr.rotrSH(u,p,18)^dr.rotrBH(u,p,41),F=dr.rotrSL(u,p,14)^dr.rotrSL(u,p,18)^dr.rotrBL(u,p,41),z=u&g^~u&b,_=p&y^~p&I,$=dr.add5L(S,F,_,t3e[O],rd[O]),ie=dr.add5H($,C,L,z,e3e[O],td[O]),ce=$|0,K=dr.rotrSH(n,i,28)^dr.rotrBH(n,i,34)^dr.rotrBH(n,i,39),P=dr.rotrSL(n,i,28)^dr.rotrBL(n,i,34)^dr.rotrBL(n,i,39),M=n&s^n&a^s&a,v=i&o^i&c^o&c;C=b|0,S=I|0,b=g|0,I=y|0,g=u|0,y=p|0,{h:u,l:p}=dr.add(l|0,f|0,ie|0,ce|0),l=a|0,f=c|0,a=s|0,c=o|0,s=n|0,o=i|0;const m=dr.add3L(ce,P,v);n=dr.add3H(m,ie,K,M),i=m|0}({h:n,l:i}=dr.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=dr.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=dr.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:f}=dr.add(this.Dh|0,this.Dl|0,l|0,f|0),{h:u,l:p}=dr.add(this.Eh|0,this.El|0,u|0,p|0),{h:g,l:y}=dr.add(this.Fh|0,this.Fl|0,g|0,y|0),{h:b,l:I}=dr.add(this.Gh|0,this.Gl|0,b|0,I|0),{h:C,l:S}=dr.add(this.Hh|0,this.Hl|0,C|0,S|0),this.set(n,i,s,o,a,c,l,f,u,p,g,y,b,I,C,S)}roundClean(){td.fill(0),rd.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const lk=R8(()=>new r3e);function n3e(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const mL=n3e(),bL=mL.crypto||mL.msCrypto;function i3e(t){switch(t){case"sha256":return Ey.create();case"sha512":return lk.create()}ve(!1,"invalid hashing algorithm name","algorithm",t)}function s3e(t,e){const r={sha256:Ey,sha512:lk}[t];return ve(r!=null,"invalid hmac algorithm","algorithm",t),O8.create(r,e)}function o3e(t,e,r,n,i){const s={sha256:Ey,sha512:lk}[i];return ve(s!=null,"invalid pbkdf2 algorithm","algorithm",i),ak(s,t,e,{c:r,dkLen:n})}function a3e(t){Le(bL!=null,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),ve(Number.isInteger(t)&&t>0&&t<=1024,"invalid length","length",t);const e=new Uint8Array(t);return bL.getRandomValues(e),e}let kY=!1;const MY=function(t,e,r){return s3e(t,e).update(r).digest()};let RY=MY;function Cy(t,e,r){const n=Ue(e,"key"),i=Ue(r,"data");return Me(RY(t,n,i))}Cy._=MY;Cy.lock=function(){kY=!0};Cy.register=function(t){if(kY)throw new Error("computeHmac is locked");RY=t};Object.freeze(Cy);const[OY,DY,NY]=[[],[],[]],c3e=BigInt(0),Im=BigInt(1),l3e=BigInt(2),f3e=BigInt(7),u3e=BigInt(256),d3e=BigInt(113);for(let t=0,e=Im,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],OY.push(2*(5*n+r)),DY.push((t+1)*(t+2)/2%64);let i=c3e;for(let s=0;s<7;s++)e=(e<>f3e)*d3e)%u3e,e&l3e&&(i^=Im<<(Im<r>32?TY(t,e,r):_Y(t,e,r),xL=(t,e,r)=>r>32?PY(t,e,r):IY(t,e,r);function v3e(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=r[c],f=r[c+1],u=wL(l,f,1)^r[a],p=xL(l,f,1)^r[a+1];for(let g=0;g<50;g+=10)t[o+g]^=u,t[o+g+1]^=p}let i=t[2],s=t[3];for(let o=0;o<24;o++){const a=DY[o],c=wL(i,s,a),l=xL(i,s,a),f=OY[o];i=t[f],s=t[f+1],t[f]=c,t[f+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}t[0]^=h3e[n],t[1]^=p3e[n]}r.fill(0)}class fk extends ok{constructor(e,r,n,i=!1,s=24){if(super(),this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,oa(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=o3(this.state)}keccak(){v3e(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Wg(this);const{blockLen:r,state:n}=this;e=Kg(e);const i=e.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);e.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return oa(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(wY(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return e||(e=new fk(r,n,i,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const g3e=(t,e,r)=>R8(()=>new fk(e,t,r)),y3e=g3e(1,136,256/8);let BY=!1;const LY=function(t){return y3e(t)};let FY=LY;function gr(t){const e=Ue(t,"data");return Me(FY(e))}gr._=LY;gr.lock=function(){BY=!0};gr.register=function(t){if(BY)throw new TypeError("keccak256 is locked");FY=t};Object.freeze(gr);const m3e=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),jY=Uint8Array.from({length:16},(t,e)=>e),b3e=jY.map(t=>(9*t+5)%16);let uk=[jY],dk=[b3e];for(let t=0;t<4;t++)for(let e of[uk,dk])e.push(e[t].map(r=>m3e[r]));const UY=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(t=>new Uint8Array(t)),w3e=uk.map((t,e)=>t.map(r=>UY[e][r])),x3e=dk.map((t,e)=>t.map(r=>UY[e][r])),E3e=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),C3e=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),y6=(t,e)=>t<>>32-e;function EL(t,e,r,n){return t===0?e^r^n:t===1?e&r|~e&n:t===2?(e|~r)^n:t===3?e&n|r&~n:e^(r|~n)}const m6=new Uint32Array(16);let A3e=class extends ck{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:r,h2:n,h3:i,h4:s}=this;return[e,r,n,i,s]}set(e,r,n,i,s){this.h0=e|0,this.h1=r|0,this.h2=n|0,this.h3=i|0,this.h4=s|0}process(e,r){for(let g=0;g<16;g++,r+=4)m6[g]=e.getUint32(r,!0);let n=this.h0|0,i=n,s=this.h1|0,o=s,a=this.h2|0,c=a,l=this.h3|0,f=l,u=this.h4|0,p=u;for(let g=0;g<5;g++){const y=4-g,b=E3e[g],I=C3e[g],C=uk[g],S=dk[g],O=w3e[g],L=x3e[g];for(let F=0;F<16;F++){const z=y6(n+EL(g,s,a,l)+m6[C[F]]+b,O[F])+u|0;n=u,u=l,l=y6(a,10)|0,a=s,s=z}for(let F=0;F<16;F++){const z=y6(i+EL(y,o,c,f)+m6[S[F]]+I,L[F])+p|0;i=p,p=f,f=y6(c,10)|0,c=o,o=z}}this.set(this.h1+a+f|0,this.h2+l+p|0,this.h3+u+i|0,this.h4+n+o|0,this.h0+s+c|0)}roundClean(){m6.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}};const S3e=R8(()=>new A3e);let $Y=!1;const qY=function(t){return S3e(t)};let VY=qY;function Ay(t){const e=Ue(t,"data");return Me(VY(e))}Ay._=qY;Ay.lock=function(){$Y=!0};Ay.register=function(t){if($Y)throw new TypeError("ripemd160 is locked");VY=t};Object.freeze(Ay);let zY=!1;const HY=function(t,e,r,n,i){return o3e(t,e,r,n,i)};let GY=HY;function Mh(t,e,r,n,i){const s=Ue(t,"password"),o=Ue(e,"salt");return Me(GY(s,o,r,n,i))}Mh._=HY;Mh.lock=function(){zY=!0};Mh.register=function(t){if(zY)throw new Error("pbkdf2 is locked");GY=t};Object.freeze(Mh);let WY=!1;const KY=function(t){return new Uint8Array(a3e(t))};let YY=KY;function da(t){return YY(t)}da._=KY;da.lock=function(){WY=!0};da.register=function(t){if(WY)throw new Error("randomBytes is locked");YY=t};Object.freeze(da);const Fr=(t,e)=>t<>>32-e;function CL(t,e,r,n,i,s){let o=t[e++]^r[n++],a=t[e++]^r[n++],c=t[e++]^r[n++],l=t[e++]^r[n++],f=t[e++]^r[n++],u=t[e++]^r[n++],p=t[e++]^r[n++],g=t[e++]^r[n++],y=t[e++]^r[n++],b=t[e++]^r[n++],I=t[e++]^r[n++],C=t[e++]^r[n++],S=t[e++]^r[n++],O=t[e++]^r[n++],L=t[e++]^r[n++],F=t[e++]^r[n++],z=o,_=a,$=c,ie=l,ce=f,K=u,P=p,M=g,v=y,m=b,R=I,B=C,E=S,x=O,w=L,T=F;for(let k=0;k<8;k+=2)ce^=Fr(z+E|0,7),v^=Fr(ce+z|0,9),E^=Fr(v+ce|0,13),z^=Fr(E+v|0,18),m^=Fr(K+_|0,7),x^=Fr(m+K|0,9),_^=Fr(x+m|0,13),K^=Fr(_+x|0,18),w^=Fr(R+P|0,7),$^=Fr(w+R|0,9),P^=Fr($+w|0,13),R^=Fr(P+$|0,18),ie^=Fr(T+B|0,7),M^=Fr(ie+T|0,9),B^=Fr(M+ie|0,13),T^=Fr(B+M|0,18),_^=Fr(z+ie|0,7),$^=Fr(_+z|0,9),ie^=Fr($+_|0,13),z^=Fr(ie+$|0,18),P^=Fr(K+ce|0,7),M^=Fr(P+K|0,9),ce^=Fr(M+P|0,13),K^=Fr(ce+M|0,18),B^=Fr(R+m|0,7),v^=Fr(B+R|0,9),m^=Fr(v+B|0,13),R^=Fr(m+v|0,18),E^=Fr(T+w|0,7),x^=Fr(E+T|0,9),w^=Fr(x+E|0,13),T^=Fr(w+x|0,18);i[s++]=o+z|0,i[s++]=a+_|0,i[s++]=c+$|0,i[s++]=l+ie|0,i[s++]=f+ce|0,i[s++]=u+K|0,i[s++]=p+P|0,i[s++]=g+M|0,i[s++]=y+v|0,i[s++]=b+m|0,i[s++]=I+R|0,i[s++]=C+B|0,i[s++]=S+E|0,i[s++]=O+x|0,i[s++]=L+w|0,i[s++]=F+T|0}function Mv(t,e,r,n,i){let s=n+0,o=n+16*i;for(let a=0;a<16;a++)r[o+a]=t[e+(2*i-1)*16+a];for(let a=0;a0&&(o+=16),CL(r,s,t,e+=16,r,o)}function QY(t,e,r){const n=EY({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:i,r:s,p:o,dkLen:a,asyncTick:c,maxmem:l,onProgress:f}=n;if(oa(i),oa(s),oa(o),oa(a),oa(c),oa(l),f!==void 0&&typeof f!="function")throw new Error("progressCb should be function");const u=128*s,p=u/4;if(i<=1||i&i-1||i>=2**(u/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(o<0||o>(2**32-1)*32/u)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(a<0||a>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const g=u*(i+o);if(g>l)throw new Error(`Scrypt: parameters too large, ${g} (128 * r * (N + p)) > ${l} (maxmem)`);const y=ak(Ey,t,e,{c:1,dkLen:u*o}),b=o3(y),I=o3(new Uint8Array(u*i)),C=o3(new Uint8Array(u));let S=()=>{};if(f){const O=2*i*o,L=Math.max(Math.floor(O/1e4),1);let F=0;S=()=>{F++,f&&(!(F%L)||F===O)&&f(F/O)}}return{N:i,r:s,p:o,dkLen:a,blockSize32:p,V:I,B32:b,B:y,tmp:C,blockMixCb:S,asyncTick:c}}function JY(t,e,r,n,i){const s=ak(Ey,t,r,{c:1,dkLen:e});return r.fill(0),n.fill(0),i.fill(0),s}function _3e(t,e,r){const{N:n,r:i,p:s,dkLen:o,blockSize32:a,V:c,B32:l,B:f,tmp:u,blockMixCb:p}=QY(t,e,r);for(let g=0;g{Mv(c,I,c,I+=a,i),p()}),Mv(c,(n-1)*a,l,b,i),p(),await yL(n,g,()=>{const C=l[b+a-16]%n;for(let S=0;St instanceof Uint8Array,P3e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Yg(t){if(!N8(t))throw new Error("Uint8Array expected");let e="";for(let r=0;rn+i.length,0));let r=0;return t.forEach(n=>{if(!N8(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function M3e(t,e){if(t.length!==e.length)return!1;for(let r=0;raQ;t>>=D8,e+=1);return e}function D3e(t,e){return t>>BigInt(e)&D8}const N3e=(t,e,r)=>t|(r?D8:aQ)<(T3e<new Uint8Array(t),AL=t=>Uint8Array.from(t);function lQ(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=t9(t),i=t9(t),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...u)=>r(i,n,...u),c=(u=t9())=>{i=a(AL([0]),u),n=a(),u.length!==0&&(i=a(AL([1]),u),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const p=[];for(;u{o(),c(u);let g;for(;!(g=p(l()));)c();return o(),g}}const B3e={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function gx(t,e,r={}){const n=(i,s,o)=>{const a=B3e[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=t[i];if(!(o&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(e))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return t}const L3e=Object.freeze(Object.defineProperty({__proto__:null,bitGet:D3e,bitLen:O3e,bitMask:gk,bitSet:N3e,bytesToHex:Yg,bytesToNumberBE:up,bytesToNumberLE:pk,concatBytes:pw,createHmacDrbg:lQ,ensureBytes:Oc,equalBytes:M3e,hexToBytes:Qg,hexToNumber:hk,numberToBytesBE:Jg,numberToBytesLE:vk,numberToHexUnpadded:cQ,numberToVarBytesBE:k3e,utf8ToBytes:R3e,validateObject:gx},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Bi=BigInt(0),ai=BigInt(1),b0=BigInt(2),F3e=BigInt(3),e_=BigInt(4),SL=BigInt(5),_L=BigInt(8);BigInt(9);BigInt(16);function So(t,e){const r=t%e;return r>=Bi?r:e+r}function j3e(t,e,r){if(r<=Bi||e 0");if(r===ai)return Bi;let n=ai;for(;e>Bi;)e&ai&&(n=n*t%r),t=t*t%r,e>>=ai;return n}function Ra(t,e,r){let n=t;for(;e-- >Bi;)n*=n,n%=r;return n}function t_(t,e){if(t===Bi||e<=Bi)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=So(t,e),n=e,i=Bi,s=ai;for(;r!==Bi;){const a=n/r,c=n%r,l=i-s*a;n=r,r=c,i=s,s=l}if(n!==ai)throw new Error("invert: does not exist");return So(i,e)}function U3e(t){const e=(t-ai)/b0;let r,n,i;for(r=t-ai,n=0;r%b0===Bi;r/=b0,n++);for(i=b0;i(n[i]="function",n),e);return gx(t,r)}function z3e(t,e,r){if(r 0");if(r===Bi)return t.ONE;if(r===ai)return e;let n=t.ONE,i=e;for(;r>Bi;)r&ai&&(n=t.mul(n,i)),i=t.sqr(i),r>>=ai;return n}function H3e(t,e){const r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function fQ(t,e){const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function G3e(t,e,r=!1,n={}){if(t<=Bi)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:s}=fQ(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=$3e(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:gk(i),ZERO:Bi,ONE:ai,create:c=>So(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Bi<=c&&cc===Bi,isOdd:c=>(c&ai)===ai,neg:c=>So(-c,t),eql:(c,l)=>c===l,sqr:c=>So(c*c,t),add:(c,l)=>So(c+l,t),sub:(c,l)=>So(c-l,t),mul:(c,l)=>So(c*l,t),pow:(c,l)=>z3e(a,c,l),div:(c,l)=>So(c*t_(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>t_(c,t),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>H3e(a,c),cmov:(c,l,f)=>f?l:c,toBytes:c=>r?vk(c,s):Jg(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?pk(c):up(c)}});return Object.freeze(a)}function uQ(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function dQ(t){const e=uQ(t);return e+Math.ceil(e/2)}function W3e(t,e,r=!1){const n=t.length,i=uQ(e),s=dQ(e);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?up(t):pk(t),a=So(o,e-ai)+ai;return r?vk(a,i):Jg(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const K3e=BigInt(0),r9=BigInt(1);function Y3e(t,e){const r=(i,s)=>{const o=s.negate();return i?o:s},n=i=>{const s=Math.ceil(e/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=t.ZERO,a=i;for(;s>K3e;)s&r9&&(o=o.add(a)),a=a.double(),s>>=r9;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=n(s),c=[];let l=i,f=l;for(let u=0;u>=g,I>c&&(I-=p,o+=r9);const C=b,S=b+Math.abs(I)-1,O=y%2!==0,L=I<0;I===0?f=f.add(r(O,s[C])):l=l.add(r(L,s[S]))}return{p:l,f}},wNAFCached(i,s,o,a){const c=i._WINDOW_SIZE||1;let l=s.get(i);return l||(l=this.precomputeWindow(i,c),c!==1&&s.set(i,a(l))),this.wNAF(c,l,o)}}}function hQ(t){return V3e(t.Fp),gx(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...fQ(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Q3e(t){const e=hQ(t);gx(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:J3e,hexToBytes:Z3e}=L3e,k0={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=k0;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:J3e(n),l:t.subarray(r+2)}},toSig(t){const{Err:e}=k0,r=typeof t=="string"?Z3e(t):t;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:i,l:s}=k0._parseInt(r.subarray(2)),{d:o,l:a}=k0._parseInt(s);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:o}},hexFromSig(t){const e=l=>Number.parseInt(l[0],16)&8?"00"+l:l,r=l=>{const f=l.toString(16);return f.length&1?`0${f}`:f},n=e(r(t.s)),i=e(r(t.r)),s=n.length/2,o=i.length/2,a=r(s),c=r(o);return`30${r(o+s+4)}02${c}${i}02${a}${n}`}},Yf=BigInt(0),Ga=BigInt(1);BigInt(2);const IL=BigInt(3);BigInt(4);function X3e(t){const e=Q3e(t),{Fp:r}=e,n=e.toBytes||((y,b,I)=>{const C=b.toAffine();return pw(Uint8Array.from([4]),r.toBytes(C.x),r.toBytes(C.y))}),i=e.fromBytes||(y=>{const b=y.subarray(1),I=r.fromBytes(b.subarray(0,r.BYTES)),C=r.fromBytes(b.subarray(r.BYTES,2*r.BYTES));return{x:I,y:C}});function s(y){const{a:b,b:I}=e,C=r.sqr(y),S=r.mul(C,y);return r.add(r.add(S,r.mul(y,b)),I)}if(!r.eql(r.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(y){return typeof y=="bigint"&&Yfr.eql(O,r.ZERO);return S(I)&&S(C)?u.ZERO:new u(I,C,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const I=r.invertBatch(b.map(C=>C.pz));return b.map((C,S)=>C.toAffine(I[S])).map(u.fromAffine)}static fromHex(b){const I=u.fromAffine(i(Oc("pointHex",b)));return I.assertValidity(),I}static fromPrivateKey(b){return u.BASE.multiply(c(b))}_setWindowSize(b){this._WINDOW_SIZE=b,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:b,y:I}=this.toAffine();if(!r.isValid(b)||!r.isValid(I))throw new Error("bad point: x or y not FE");const C=r.sqr(I),S=s(b);if(!r.eql(C,S))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:b}=this.toAffine();if(r.isOdd)return!r.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){f(b);const{px:I,py:C,pz:S}=this,{px:O,py:L,pz:F}=b,z=r.eql(r.mul(I,F),r.mul(O,S)),_=r.eql(r.mul(C,F),r.mul(L,S));return z&&_}negate(){return new u(this.px,r.neg(this.py),this.pz)}double(){const{a:b,b:I}=e,C=r.mul(I,IL),{px:S,py:O,pz:L}=this;let F=r.ZERO,z=r.ZERO,_=r.ZERO,$=r.mul(S,S),ie=r.mul(O,O),ce=r.mul(L,L),K=r.mul(S,O);return K=r.add(K,K),_=r.mul(S,L),_=r.add(_,_),F=r.mul(b,_),z=r.mul(C,ce),z=r.add(F,z),F=r.sub(ie,z),z=r.add(ie,z),z=r.mul(F,z),F=r.mul(K,F),_=r.mul(C,_),ce=r.mul(b,ce),K=r.sub($,ce),K=r.mul(b,K),K=r.add(K,_),_=r.add($,$),$=r.add(_,$),$=r.add($,ce),$=r.mul($,K),z=r.add(z,$),ce=r.mul(O,L),ce=r.add(ce,ce),$=r.mul(ce,K),F=r.sub(F,$),_=r.mul(ce,ie),_=r.add(_,_),_=r.add(_,_),new u(F,z,_)}add(b){f(b);const{px:I,py:C,pz:S}=this,{px:O,py:L,pz:F}=b;let z=r.ZERO,_=r.ZERO,$=r.ZERO;const ie=e.a,ce=r.mul(e.b,IL);let K=r.mul(I,O),P=r.mul(C,L),M=r.mul(S,F),v=r.add(I,C),m=r.add(O,L);v=r.mul(v,m),m=r.add(K,P),v=r.sub(v,m),m=r.add(I,S);let R=r.add(O,F);return m=r.mul(m,R),R=r.add(K,M),m=r.sub(m,R),R=r.add(C,S),z=r.add(L,F),R=r.mul(R,z),z=r.add(P,M),R=r.sub(R,z),$=r.mul(ie,m),z=r.mul(ce,M),$=r.add(z,$),z=r.sub(P,$),$=r.add(P,$),_=r.mul(z,$),P=r.add(K,K),P=r.add(P,K),M=r.mul(ie,M),m=r.mul(ce,m),P=r.add(P,M),M=r.sub(K,M),M=r.mul(ie,M),m=r.add(m,M),K=r.mul(P,m),_=r.add(_,K),K=r.mul(R,m),z=r.mul(v,z),z=r.sub(z,K),K=r.mul(v,P),$=r.mul(R,$),$=r.add($,K),new u(z,_,$)}subtract(b){return this.add(b.negate())}is0(){return this.equals(u.ZERO)}wNAF(b){return g.wNAFCached(this,l,b,I=>{const C=r.invertBatch(I.map(S=>S.pz));return I.map((S,O)=>S.toAffine(C[O])).map(u.fromAffine)})}multiplyUnsafe(b){const I=u.ZERO;if(b===Yf)return I;if(a(b),b===Ga)return this;const{endo:C}=e;if(!C)return g.unsafeLadder(this,b);let{k1neg:S,k1:O,k2neg:L,k2:F}=C.splitScalar(b),z=I,_=I,$=this;for(;O>Yf||F>Yf;)O&Ga&&(z=z.add($)),F&Ga&&(_=_.add($)),$=$.double(),O>>=Ga,F>>=Ga;return S&&(z=z.negate()),L&&(_=_.negate()),_=new u(r.mul(_.px,C.beta),_.py,_.pz),z.add(_)}multiply(b){a(b);let I=b,C,S;const{endo:O}=e;if(O){const{k1neg:L,k1:F,k2neg:z,k2:_}=O.splitScalar(I);let{p:$,f:ie}=this.wNAF(F),{p:ce,f:K}=this.wNAF(_);$=g.constTimeNegate(L,$),ce=g.constTimeNegate(z,ce),ce=new u(r.mul(ce.px,O.beta),ce.py,ce.pz),C=$.add(ce),S=ie.add(K)}else{const{p:L,f:F}=this.wNAF(I);C=L,S=F}return u.normalizeZ([C,S])[0]}multiplyAndAddUnsafe(b,I,C){const S=u.BASE,O=(F,z)=>z===Yf||z===Ga||!F.equals(S)?F.multiplyUnsafe(z):F.multiply(z),L=O(this,I).add(O(b,C));return L.is0()?void 0:L}toAffine(b){const{px:I,py:C,pz:S}=this,O=this.is0();b==null&&(b=O?r.ONE:r.inv(S));const L=r.mul(I,b),F=r.mul(C,b),z=r.mul(S,b);if(O)return{x:r.ZERO,y:r.ZERO};if(!r.eql(z,r.ONE))throw new Error("invZ was invalid");return{x:L,y:F}}isTorsionFree(){const{h:b,isTorsionFree:I}=e;if(b===Ga)return!0;if(I)return I(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:I}=e;return b===Ga?this:I?I(u,this):this.multiplyUnsafe(e.h)}toRawBytes(b=!0){return this.assertValidity(),n(u,this,b)}toHex(b=!0){return Yg(this.toRawBytes(b))}}u.BASE=new u(e.Gx,e.Gy,r.ONE),u.ZERO=new u(r.ZERO,r.ONE,r.ZERO);const p=e.nBitLength,g=Y3e(u,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function e5e(t){const e=hQ(t);return gx(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function t5e(t){const e=e5e(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(m){return YfYg(Jg(m,e.nByteLength));function y(m){const R=n>>Ga;return m>R}function b(m){return y(m)?a(-m):m}const I=(m,R,B)=>up(m.slice(R,B));class C{constructor(R,B,E){this.r=R,this.s=B,this.recovery=E,this.assertValidity()}static fromCompact(R){const B=e.nByteLength;return R=Oc("compactSignature",R,B*2),new C(I(R,0,B),I(R,B,2*B))}static fromDER(R){const{r:B,s:E}=k0.toSig(Oc("DER",R));return new C(B,E)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(R){return new C(this.r,this.s,R)}recoverPublicKey(R){const{r:B,s:E,recovery:x}=this,w=_(Oc("msgHash",R));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const T=x===2||x===3?B+e.n:B;if(T>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const k=x&1?"03":"02",H=l.fromHex(k+g(T)),oe=c(T),j=a(-w*oe),X=a(E*oe),G=l.BASE.multiplyAndAddUnsafe(H,j,X);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new C(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Qg(this.toDERHex())}toDERHex(){return k0.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Qg(this.toCompactHex())}toCompactHex(){return g(this.r)+g(this.s)}}const S={isValidPrivateKey(m){try{return f(m),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const m=dQ(e.n);return W3e(e.randomBytes(m),e.n)},precompute(m=8,R=l.BASE){return R._setWindowSize(m),R.multiply(BigInt(3)),R}};function O(m,R=!0){return l.fromPrivateKey(m).toRawBytes(R)}function L(m){const R=m instanceof Uint8Array,B=typeof m=="string",E=(R||B)&&m.length;return R?E===i||E===s:B?E===2*i||E===2*s:m instanceof l}function F(m,R,B=!0){if(L(m))throw new Error("first arg must be private key");if(!L(R))throw new Error("second arg must be public key");return l.fromHex(R).multiply(f(m)).toRawBytes(B)}const z=e.bits2int||function(m){const R=up(m),B=m.length*8-e.nBitLength;return B>0?R>>BigInt(B):R},_=e.bits2int_modN||function(m){return a(z(m))},$=gk(e.nBitLength);function ie(m){if(typeof m!="bigint")throw new Error("bigint expected");if(!(Yf<=m&&m<$))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Jg(m,e.nByteLength)}function ce(m,R,B=K){if(["recovered","canonical"].some(ee=>ee in B))throw new Error("sign() legacy options not supported");const{hash:E,randomBytes:x}=e;let{lowS:w,prehash:T,extraEntropy:k}=B;w==null&&(w=!0),m=Oc("msgHash",m),T&&(m=Oc("prehashed msgHash",E(m)));const H=_(m),oe=f(R),j=[ie(oe),ie(H)];if(k!=null){const ee=k===!0?x(r.BYTES):k;j.push(Oc("extraEntropy",ee))}const X=pw(...j),G=H;function Z(ee){const N=z(ee);if(!p(N))return;const te=c(N),fe=l.BASE.multiply(N).toAffine(),Ee=a(fe.x);if(Ee===Yf)return;const _e=a(te*a(G+Ee*oe));if(_e===Yf)return;let Re=(fe.x===Ee?0:2)|Number(fe.y&Ga),Te=_e;return w&&y(_e)&&(Te=b(_e),Re^=1),new C(Ee,Te,Re)}return{seed:X,k2sig:Z}}const K={lowS:e.lowS,prehash:!1},P={lowS:e.lowS,prehash:!1};function M(m,R,B=K){const{seed:E,k2sig:x}=ce(m,R,B),w=e;return lQ(w.hash.outputLen,w.nByteLength,w.hmac)(E,x)}l.BASE._setWindowSize(8);function v(m,R,B,E=P){var fe;const x=m;if(R=Oc("msgHash",R),B=Oc("publicKey",B),"strict"in E)throw new Error("options.strict was renamed to lowS");const{lowS:w,prehash:T}=E;let k,H;try{if(typeof x=="string"||x instanceof Uint8Array)try{k=C.fromDER(x)}catch(Ee){if(!(Ee instanceof k0.Err))throw Ee;k=C.fromCompact(x)}else if(typeof x=="object"&&typeof x.r=="bigint"&&typeof x.s=="bigint"){const{r:Ee,s:_e}=x;k=new C(Ee,_e)}else throw new Error("PARSE");H=l.fromHex(B)}catch(Ee){if(Ee.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(w&&k.hasHighS())return!1;T&&(R=e.hash(R));const{r:oe,s:j}=k,X=_(R),G=c(j),Z=a(X*G),ee=a(oe*G),N=(fe=l.BASE.multiplyAndAddUnsafe(H,Z,ee))==null?void 0:fe.toAffine();return N?a(N.x)===oe:!1}return{CURVE:e,getPublicKey:O,getSharedSecret:F,sign:M,verify:v,ProjectivePoint:l,Signature:C,utils:S}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function r5e(t){return{hash:t,hmac:(e,...r)=>O8(t,e,T6e(...r)),randomBytes:k6e}}function n5e(t,e){const r=n=>t5e({...t,...r5e(n)});return Object.freeze({...r(e),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const pQ=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),TL=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),i5e=BigInt(1),r_=BigInt(2),PL=(t,e)=>(t+e/r_)/e;function s5e(t){const e=pQ,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=t*t*t%e,f=l*l*t%e,u=Ra(f,r,e)*f%e,p=Ra(u,r,e)*f%e,g=Ra(p,r_,e)*l%e,y=Ra(g,i,e)*g%e,b=Ra(y,s,e)*y%e,I=Ra(b,a,e)*b%e,C=Ra(I,c,e)*I%e,S=Ra(C,a,e)*b%e,O=Ra(S,r,e)*f%e,L=Ra(O,o,e)*y%e,F=Ra(L,n,e)*l%e,z=Ra(F,r_,e);if(!n_.eql(n_.sqr(z),t))throw new Error("Cannot find square root");return z}const n_=G3e(pQ,void 0,void 0,{sqrt:s5e}),od=n5e({a:BigInt(0),b:BigInt(7),Fp:n_,n:TL,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=TL,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-i5e*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=PL(s*t,e),c=PL(-n*t,e);let l=So(t-a*r-c*i,e),f=So(-a*n-c*s,e);const u=l>o,p=f>o;if(u&&(l=e-l),p&&(f=e-f),l>o||f>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:u,k1:l,k2neg:p,k2:f}}}},Ey);BigInt(0);od.ProjectivePoint;const bu="0x0000000000000000000000000000000000000000",Zg="0x0000000000000000000000000000000000000000000000000000000000000000",o5e=`Ethereum Signed Message: +`,kL=BigInt(0),ML=BigInt(1),RL=BigInt(2),OL=BigInt(27),DL=BigInt(28),b6=BigInt(35),O1={};function NL(t){return Kc(ts(t),32)}var eg,tg,rg,G0,Ao;let wu=(Ao=class{constructor(e,r,n,i){Ie(this,eg);Ie(this,tg);Ie(this,rg);Ie(this,G0);kh(e,O1,"Signature"),ue(this,eg,r),ue(this,tg,n),ue(this,rg,i),ue(this,G0,null)}get r(){return Q(this,eg)}set r(e){ve(fp(e)===32,"invalid r","value",e),ue(this,eg,Me(e))}get s(){return Q(this,tg)}set s(e){ve(fp(e)===32,"invalid s","value",e);const r=Me(e);ve(parseInt(r.substring(0,3))<8,"non-canonical s","value",r),ue(this,tg,r)}get v(){return Q(this,rg)}set v(e){const r=or(e,"value");ve(r===27||r===28,"invalid v","v",e),ue(this,rg,r)}get networkV(){return Q(this,G0)}get legacyChainId(){const e=this.networkV;return e==null?null:Ao.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=Ue(this.s);return this.yParity&&(e[0]|=128),Me(e)}get compactSerialized(){return qr([this.r,this.yParityAndS])}get serialized(){return qr([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Ao(O1,this.r,this.s,this.v);return this.networkV&&ue(e,G0,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const r=Pt(e,"v");return r==OL||r==DL?kL:(ve(r>=b6,"invalid EIP-155 v","v",e),(r-b6)/RL)}static getChainIdV(e,r){return Pt(e)*RL+BigInt(35+r-27)}static getNormalizedV(e){const r=Pt(e);return r===kL||r===OL?27:r===ML||r===DL?28:(ve(r>=b6,"invalid v","v",e),r&ML?27:28)}static from(e){function r(l,f){ve(l,f,"signature",e)}if(e==null)return new Ao(O1,Zg,Zg,27);if(typeof e=="string"){const l=Ue(e,"signature");if(l.length===64){const f=Me(l.slice(0,32)),u=l.slice(32,64),p=u[0]&128?28:27;return u[0]&=127,new Ao(O1,f,Me(u),p)}if(l.length===65){const f=Me(l.slice(0,32)),u=l.slice(32,64);r((u[0]&128)===0,"non-canonical s");const p=Ao.getNormalizedV(l[64]);return new Ao(O1,f,Me(u),p)}r(!1,"invalid raw signature length")}if(e instanceof Ao)return e.clone();const n=e.r;r(n!=null,"missing r");const i=NL(n),s=function(l,f){if(l!=null)return NL(l);if(f!=null){r(Gr(f,32),"invalid yParityAndS");const u=Ue(f);return u[0]&=127,Me(u)}r(!1,"missing s")}(e.s,e.yParityAndS);r((Ue(s)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(l,f,u){if(l!=null){const p=Pt(l);return{networkV:p>=b6?p:void 0,v:Ao.getNormalizedV(p)}}if(f!=null)return r(Gr(f,32),"invalid yParityAndS"),{v:Ue(f)[0]&128?28:27};if(u!=null){switch(or(u,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}r(!1,"invalid yParity")}r(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),c=new Ao(O1,i,s,a);return o&&ue(c,G0,o),r(e.yParity==null||or(e.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),r(e.yParityAndS==null||e.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}},eg=new WeakMap,tg=new WeakMap,rg=new WeakMap,G0=new WeakMap,Ao);var Uf,Ll;let Jd=(Ll=class{constructor(e){Ie(this,Uf);ve(fp(e)===32,"invalid private key","privateKey","[REDACTED]"),ue(this,Uf,Me(e))}get privateKey(){return Q(this,Uf)}get publicKey(){return Ll.computePublicKey(Q(this,Uf))}get compressedPublicKey(){return Ll.computePublicKey(Q(this,Uf),!0)}sign(e){ve(fp(e)===32,"invalid digest length","digest",e);const r=od.sign(es(e),es(Q(this,Uf)),{lowS:!0});return wu.from({r:tc(r.r,32),s:tc(r.s,32),v:r.recovery?28:27})}computeSharedSecret(e){const r=Ll.computePublicKey(e);return Me(od.getSharedSecret(es(Q(this,Uf)),Ue(r),!1))}static computePublicKey(e,r){let n=Ue(e,"key");if(n.length===32){const s=od.getPublicKey(n,!!r);return Me(s)}if(n.length===64){const s=new Uint8Array(65);s[0]=4,s.set(n,1),n=s}const i=od.ProjectivePoint.fromHex(n);return Me(i.toRawBytes(r))}static recoverPublicKey(e,r){ve(fp(e)===32,"invalid digest length","digest",e);const n=wu.from(r);let i=od.Signature.fromCompact(es(qr([n.r,n.s])));i=i.addRecoveryBit(n.yParity);const s=i.recoverPublicKey(es(e));return ve(s!=null,"invalid signautre for digest","signature",r),"0x"+s.toHex(!1)}static addPoints(e,r,n){const i=od.ProjectivePoint.fromHex(Ll.computePublicKey(e).substring(2)),s=od.ProjectivePoint.fromHex(Ll.computePublicKey(r).substring(2));return"0x"+i.add(s).toHex(!!n)}},Uf=new WeakMap,Ll);const a5e=BigInt(0),c5e=BigInt(36);function BL(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=Ue(gr(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 yk={};for(let t=0;t<10;t++)yk[String(t)]=String(t);for(let t=0;t<26;t++)yk[String.fromCharCode(65+t)]=String(10+t);const LL=15;function l5e(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>yk[n]).join("");for(;e.length>=LL;){let n=e.substring(0,LL);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}const f5e=function(){const t={};for(let e=0;e<36;e++){const r="0123456789abcdefghijklmnopqrstuvwxyz"[e];t[r]=BigInt(e)}return t}();function u5e(t){t=t.toLowerCase();let e=a5e;for(let r=0;re.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return Q(this,W0)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return Q(this,W0)===!0?-1:Q(this,W0)===!1?this.value.length:null}static from(e,r){return new Rf(Mf,e,r)}static uint8(e){return St(e,8)}static uint16(e){return St(e,16)}static uint24(e){return St(e,24)}static uint32(e){return St(e,32)}static uint40(e){return St(e,40)}static uint48(e){return St(e,48)}static uint56(e){return St(e,56)}static uint64(e){return St(e,64)}static uint72(e){return St(e,72)}static uint80(e){return St(e,80)}static uint88(e){return St(e,88)}static uint96(e){return St(e,96)}static uint104(e){return St(e,104)}static uint112(e){return St(e,112)}static uint120(e){return St(e,120)}static uint128(e){return St(e,128)}static uint136(e){return St(e,136)}static uint144(e){return St(e,144)}static uint152(e){return St(e,152)}static uint160(e){return St(e,160)}static uint168(e){return St(e,168)}static uint176(e){return St(e,176)}static uint184(e){return St(e,184)}static uint192(e){return St(e,192)}static uint200(e){return St(e,200)}static uint208(e){return St(e,208)}static uint216(e){return St(e,216)}static uint224(e){return St(e,224)}static uint232(e){return St(e,232)}static uint240(e){return St(e,240)}static uint248(e){return St(e,248)}static uint256(e){return St(e,256)}static uint(e){return St(e,256)}static int8(e){return St(e,-8)}static int16(e){return St(e,-16)}static int24(e){return St(e,-24)}static int32(e){return St(e,-32)}static int40(e){return St(e,-40)}static int48(e){return St(e,-48)}static int56(e){return St(e,-56)}static int64(e){return St(e,-64)}static int72(e){return St(e,-72)}static int80(e){return St(e,-80)}static int88(e){return St(e,-88)}static int96(e){return St(e,-96)}static int104(e){return St(e,-104)}static int112(e){return St(e,-112)}static int120(e){return St(e,-120)}static int128(e){return St(e,-128)}static int136(e){return St(e,-136)}static int144(e){return St(e,-144)}static int152(e){return St(e,-152)}static int160(e){return St(e,-160)}static int168(e){return St(e,-168)}static int176(e){return St(e,-176)}static int184(e){return St(e,-184)}static int192(e){return St(e,-192)}static int200(e){return St(e,-200)}static int208(e){return St(e,-208)}static int216(e){return St(e,-216)}static int224(e){return St(e,-224)}static int232(e){return St(e,-232)}static int240(e){return St(e,-240)}static int248(e){return St(e,-248)}static int256(e){return St(e,-256)}static int(e){return St(e,-256)}static bytes1(e){return jr(e,1)}static bytes2(e){return jr(e,2)}static bytes3(e){return jr(e,3)}static bytes4(e){return jr(e,4)}static bytes5(e){return jr(e,5)}static bytes6(e){return jr(e,6)}static bytes7(e){return jr(e,7)}static bytes8(e){return jr(e,8)}static bytes9(e){return jr(e,9)}static bytes10(e){return jr(e,10)}static bytes11(e){return jr(e,11)}static bytes12(e){return jr(e,12)}static bytes13(e){return jr(e,13)}static bytes14(e){return jr(e,14)}static bytes15(e){return jr(e,15)}static bytes16(e){return jr(e,16)}static bytes17(e){return jr(e,17)}static bytes18(e){return jr(e,18)}static bytes19(e){return jr(e,19)}static bytes20(e){return jr(e,20)}static bytes21(e){return jr(e,21)}static bytes22(e){return jr(e,22)}static bytes23(e){return jr(e,23)}static bytes24(e){return jr(e,24)}static bytes25(e){return jr(e,25)}static bytes26(e){return jr(e,26)}static bytes27(e){return jr(e,27)}static bytes28(e){return jr(e,28)}static bytes29(e){return jr(e,29)}static bytes30(e){return jr(e,30)}static bytes31(e){return jr(e,31)}static bytes32(e){return jr(e,32)}static address(e){return new Rf(Mf,"address",e)}static bool(e){return new Rf(Mf,"bool",!!e)}static bytes(e){return new Rf(Mf,"bytes",e)}static string(e){return new Rf(Mf,"string",e)}static array(e,r){throw new Error("not implemented yet")}static tuple(e,r){throw new Error("not implemented yet")}static overrides(e){return new Rf(Mf,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===FL}static dereference(e,r){if(Rf.isTyped(e)){if(e.type!==r)throw new Error(`invalid type: expecetd ${r}, got ${e.type}`);return e.value}return e}};W0=new WeakMap;let ks=Rf;class h5e extends Pu{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){let n=ks.dereference(r,"string");try{n=Qt(n)}catch(i){return this._throwError(i.message,r)}return e.writeValue(n)}decode(e){return Qt(tc(e.readValue(),20))}}class p5e extends Pu{constructor(r){super(r.name,r.type,"_",r.dynamic);de(this,"coder");this.coder=r}defaultValue(){return this.coder.defaultValue()}encode(r,n){return this.coder.encode(r,n)}decode(r){return this.coder.decode(r)}}function gQ(t,e,r){let n=[];if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let c={};n=e.map(l=>{const f=l.localName;return Le(f,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),Le(!c[f],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:r}),c[f]=!0,r[f]})}else ve(!1,"invalid tuple value","tuple",r);ve(e.length===n.length,"types/value length mismatch","tuple",r);let i=new Q7,s=new Q7,o=[];e.forEach((c,l)=>{let f=n[l];if(c.dynamic){let u=s.length;c.encode(s,f);let p=i.writeUpdatableValue();o.push(g=>{p(g+u)})}else c.encode(i,f)}),o.forEach(c=>{c(i.length)});let a=t.appendWriter(i);return a+=t.appendWriter(s),a}function yQ(t,e){let r=[],n=[],i=t.subReader(0);return e.forEach(s=>{let o=null;if(s.dynamic){let a=t.readIndex(),c=i.subReader(a);try{o=s.decode(c)}catch(l){if(Is(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(t)}catch(a){if(Is(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");r.push(o),n.push(s.localName||null)}),Gg.fromItems(r,n)}class v5e extends Pu{constructor(r,n,i){const s=r.type+"["+(n>=0?n:"")+"]",o=n===-1||r.dynamic;super("array",s,i,o);de(this,"coder");de(this,"length");Ot(this,{coder:r,length:n})}defaultValue(){const r=this.coder.defaultValue(),n=[];for(let i=0;io||i<-(o+E5e))&&this._throwError("value out-of-bounds",n),i=ik(i,8*Qs)}else(iP0(s,this.size*8))&&this._throwError("value out-of-bounds",n);return r.writeValue(i)}decode(r){let n=P0(r.readValue(),this.size*8);return this.signed&&(n=T5(n,this.size*8)),n}}class S5e extends mQ{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,Ii(ks.dereference(r,"string")))}decode(e){return Ip(super.decode(e))}}class w6 extends Pu{constructor(r,n){let i=!1;const s=[];r.forEach(a=>{a.dynamic&&(i=!0),s.push(a.type)});const o="tuple("+s.join(",")+")";super("tuple",o,n,i);de(this,"coders");Ot(this,{coders:Object.freeze(r.slice())})}defaultValue(){const r=[];this.coders.forEach(i=>{r.push(i.defaultValue())});const n=this.coders.reduce((i,s)=>{const o=s.localName;return o&&(i[o]||(i[o]=0),i[o]++),i},{});return this.coders.forEach((i,s)=>{let o=i.localName;!o||n[o]!==1||(o==="length"&&(o="_length"),r[o]==null&&(r[o]=r[s]))}),Object.freeze(r)}encode(r,n){const i=ks.dereference(n,"tuple");return gQ(r,this.coders,i)}decode(r){return yQ(r,this.coders)}}function Oo(t){return gr(Ii(t))}var _5e="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";const jL=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),UL=4;function I5e(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let F=1;F>--c&1}const u=31,p=2**u,g=p>>>1,y=g>>1,b=p-1;let I=0;for(let F=0;F1;){let ce=z+_>>>1;F>>1|f(),$=$<<1^g,ie=(ie^g)<<1|g|1;S=$,O=1+ie-$}let L=n-4;return C.map(F=>{switch(F-L){case 3:return L+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return L+256+(t[a++]<<8|t[a++]);case 1:return L+t[a++];default:return F-1}})}function T5e(t){let e=0;return()=>t[e++]}function bQ(t){return T5e(I5e(P5e(t)))}function P5e(t){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((i,s)=>e[i.charCodeAt(0)]=s);let r=t.length,n=new Uint8Array(6*r>>3);for(let i=0,s=0,o=0,a=0;i=8&&(n[s++]=a>>(o-=8));return n}function k5e(t){return t&1?~t>>1:t>>1}function M5e(t,e){let r=Array(t);for(let n=0,i=0;n{let e=gw(t);if(e.length)return e})}function xQ(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(R5e(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(O5e(r,t))}return e.flat()}function yw(t){let e=[];for(;;){let r=t(e.length);if(!r)break;e.push(r)}return e}function EQ(t,e,r){let n=Array(t).fill().map(()=>[]);for(let i=0;in[o].push(s));return n}function R5e(t,e){let r=1+e(),n=e(),i=yw(e);return EQ(i.length,1+t,e).flatMap((o,a)=>{let[c,...l]=o;return Array(i[a]).fill().map((f,u)=>{let p=u*n;return[c+u*r,l.map(g=>g+p)]})})}function O5e(t,e){let r=1+e();return EQ(r,1+t,e).map(i=>[i[0],i.slice(1)])}function D5e(t){let e=[],r=gw(t);return i(n([]),[]),e;function n(s){let o=t(),a=yw(()=>{let c=gw(t).map(l=>r[l]);if(c.length)return n(c)});return{S:o,B:a,Q:s}}function i({S:s,B:o},a,c){if(!(s&4&&c===a[a.length-1])){s&2&&(c=a[a.length-1]),s&1&&e.push(a);for(let l of o)for(let f of l.Q)i(l,[...a,f],c)}}}function N5e(t){return t.toString(16).toUpperCase().padStart(2,"0")}function CQ(t){return`{${N5e(t)}}`}function B5e(t){let e=[];for(let r=0,n=t.length;r>24&255}function _Q(t){return t&16777215}let i_,$L,s_,c3;function z5e(){let t=bQ(F5e);i_=new Map(wQ(t).flatMap((e,r)=>e.map(n=>[n,r+1<<24]))),$L=new Set(gw(t)),s_=new Map,c3=new Map;for(let[e,r]of xQ(t)){if(!$L.has(e)&&r.length==2){let[n,i]=r,s=c3.get(n);s||(s=new Map,c3.set(n,s)),s.set(i,e)}s_.set(e,r.reverse())}}function IQ(t){return t>=mw&&t=M5&&t<$5e&&e>=R5&&eO5&&e0&&i(O5+l)}else{let o=s_.get(s);o?r.push(...o):i(s)}if(!r.length)break;s=r.pop()}if(n&&e.length>1){let s=Jm(e[0]);for(let o=1;o0&&i>=o)o==0?(e.push(n,...r),r.length=0,n=a):r.push(a),i=o;else{let c=H5e(n,a);c>=0?n=c:i==0&&o==0?(e.push(n),n=a):(r.push(a),i=o)}}return n>=0&&e.push(n,...r),e}function PQ(t){return TQ(t).map(_Q)}function W5e(t){return G5e(TQ(t))}const qL=45,kQ=".",MQ=65039,RQ=1,N5=t=>Array.from(t);function bw(t,e){return t.P.has(e)||t.Q.has(e)}class K5e extends Array{get is_emoji(){return!0}}let o_,OQ,M0,a_,DQ,Rv,i9,q1,v0,VL,c_;function mk(){if(o_)return;let t=bQ(_5e);const e=()=>gw(t),r=()=>new Set(e()),n=(f,u)=>u.forEach(p=>f.add(p));o_=new Map(xQ(t)),OQ=r(),M0=e(),a_=new Set(e().map(f=>M0[f])),M0=new Set(M0),DQ=r(),r();let i=wQ(t),s=t();const o=()=>{let f=new Set;return e().forEach(u=>n(f,i[u])),n(f,e()),f};Rv=yw(f=>{let u=yw(t).map(p=>p+96);if(u.length){let p=f>=s;u[0]-=32,u=Xg(u),p&&(u=`Restricted[${u}]`);let g=o(),y=o(),b=!t();return{N:u,P:g,Q:y,M:b,R:p}}}),i9=r(),q1=new Map;let a=e().concat(N5(i9)).sort((f,u)=>f-u);a.forEach((f,u)=>{let p=t(),g=a[u]=p?a[u-p]:{V:[],M:new Map};g.V.push(f),i9.has(f)||q1.set(f,g)});for(let{V:f,M:u}of new Set(q1.values())){let p=[];for(let y of f){let b=Rv.filter(C=>bw(C,y)),I=p.find(({G:C})=>b.some(S=>C.has(S)));I||(I={G:new Set,V:[]},p.push(I)),I.V.push(y),n(I.G,b)}let g=p.flatMap(y=>N5(y.G));for(let{G:y,V:b}of p){let I=new Set(g.filter(C=>!y.has(C)));for(let C of b)u.set(C,I)}}v0=new Set;let c=new Set;const l=f=>v0.has(f)?c.add(f):v0.add(f);for(let f of Rv){for(let u of f.P)l(u);for(let u of f.Q)l(u)}for(let f of v0)!q1.has(f)&&!c.has(f)&&q1.set(f,RQ);n(v0,PQ(v0)),VL=D5e(t).map(f=>K5e.from(f)).sort(L5e),c_=new Map;for(let f of VL){let u=[c_];for(let p of f){let g=u.map(y=>{let b=y.get(p);return b||(b=new Map,y.set(p,b)),b});p===MQ?u.push(...g):u=g}for(let p of u)p.V=f}}function bk(t){return(NQ(t)?"":`${wk(B8([t]))} `)+CQ(t)}function wk(t){return`"${t}"‎`}function Y5e(t){if(t.length>=4&&t[2]==qL&&t[3]==qL)throw new Error(`invalid label extension: "${Xg(t.slice(0,4))}"`)}function Q5e(t){for(let r=t.lastIndexOf(95);r>0;)if(t[--r]!==95)throw new Error("underscore allowed only at start")}function J5e(t){let e=t[0],r=jL.get(e);if(r)throw Ab(`leading ${r}`);let n=t.length,i=-1;for(let s=1;se&&(e>>=1,t=[...t.slice(0,e),8230,...t.slice(-e)]);let i=0,s=t.length;for(let o=0;o{let s=B5e(i),o={input:s,offset:n};n+=s.length+1;try{let a=o.tokens=s4e(s,e,r),c=a.length,l;if(!c)throw new Error("empty label");let f=o.output=a.flat();if(Q5e(f),!(o.emoji=c>1||a[0].is_emoji)&&f.every(p=>p<128))Y5e(f),l="ASCII";else{let p=a.flatMap(g=>g.is_emoji?[]:g);if(!p.length)l="Emoji";else{if(M0.has(f[0]))throw Ab("leading combining mark");for(let b=1;bo.has(a)):N5(o),!r.length)return}else n.push(i)}if(r){for(let i of r)if(n.every(s=>bw(i,s)))throw new Error(`whole-script confusable: ${t.N}/${i.N}`)}}function r4e(t){let e=Rv;for(let r of t){let n=e.filter(i=>bw(i,r));if(!n.length)throw Rv.some(i=>bw(i,r))?LQ(e[0],r):BQ(r);if(e=n,n.length==1)break}return e}function n4e(t){return t.map(({input:e,error:r,output:n})=>{if(r){let i=r.message;throw new Error(t.length==1?i:`Invalid label ${wk(B8(e,63))}: ${i}`)}return Xg(n)}).join(kQ)}function BQ(t){return new Error(`disallowed character: ${bk(t)}`)}function LQ(t,e){let r=bk(e),n=Rv.find(i=>i.P.has(e));return n&&(r=`${n.N} ${r}`),new Error(`illegal mixture: ${t.N} + ${r}`)}function Ab(t){return new Error(`illegal placement: ${t}`)}function i4e(t,e){for(let r of e)if(!bw(t,r))throw LQ(t,r);if(t.M){let r=PQ(e);for(let n=1,i=r.length;nUL)throw new Error(`excessive non-spacing marks: ${wk(B8(r.slice(n-1,s)))} (${s-n}/${UL})`);n=s}}}function s4e(t,e,r){let n=[],i=[];for(t=t.slice().reverse();t.length;){let s=a4e(t);if(s)i.length&&(n.push(e(i)),i=[]),n.push(r(s));else{let o=t.pop();if(v0.has(o))i.push(o);else{let a=o_.get(o);if(a)i.push(...a);else if(!OQ.has(o))throw BQ(o)}}}return i.length&&n.push(e(i)),n}function o4e(t){return t.filter(e=>e!=MQ)}function a4e(t,e){let r=c_,n,i=t.length;for(;i&&(r=r.get(t[--i]),!!r);){let{V:s}=r;s&&(n=s,t.length=i)}return n}const FQ=new Uint8Array(32);FQ.fill(0);function zL(t){return ve(t.length!==0,"invalid ENS name; empty component","comp",t),t}function jQ(t){const e=Ii(c4e(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i{ve(n.length<=r,`label ${JSON.stringify(t)} exceeds ${r} bytes`,"name",t);const i=new Uint8Array(n.length+1);return i.set(n,1),i[0]=i.length-1,i})))+"00"}function s9(t,e){return{address:Qt(t),storageKeys:e.map((r,n)=>(ve(Gr(r,32),"invalid slot",`storageKeys[${n}]`,r),r.toLowerCase()))}}function Wp(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(ve(r.length===2,"invalid slot set",`value[${n}]`,r),s9(r[0],r[1])):(ve(r!=null&&typeof r=="object","invalid address-slot set","value",t),s9(r.address,r.storageKeys)));ve(t!=null&&typeof t=="object","invalid access list","value",t);const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,s)=>(i[s]=!0,i),{});return s9(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function yx(t){let e;return typeof t=="string"?e=Jd.computePublicKey(t,!1):e=t.publicKey,Qt(gr("0x"+e.substring(4)).substring(26))}function B5(t,e){return yx(Jd.recoverPublicKey(t,e))}const Di=BigInt(0),f4e=BigInt(2),u4e=BigInt(27),d4e=BigInt(28),h4e=BigInt(35),p4e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),o9=4096*32;function HL(t,e){let r=t.toString(16);for(;r.length<2;)r="0"+r;return r+=sc(e).substring(4),"0x"+r}function L8(t){return t==="0x"?null:Qt(t)}function xk(t,e){try{return Wp(t)}catch(r){ve(!1,r.message,e,t)}}function mx(t,e){return t==="0x"?0:or(t,e)}function ci(t,e){if(t==="0x")return Di;const r=Pt(t,e);return ve(r<=p4e,"value exceeds uint size",e,r),r}function Cn(t,e){const r=Pt(t,"value"),n=ts(r);return ve(n.length<=32,"value too large",`tx.${e}`,r),n}function Ek(t){return Wp(t).map(e=>[e.address,e.storageKeys])}function v4e(t,e){ve(Array.isArray(t),`invalid ${e}`,"value",t);for(let r=0;ri.data),r.map(i=>i.commitment),r.map(i=>i.proof)])]):qr(["0x03",Tp(n)])}var _l,ng,ig,sg,og,ag,cg,lg,fg,ug,dg,hg,K0,wd,$f,xd,pg,l3;const Of=class Of{constructor(){Ie(this,pg);Ie(this,_l);Ie(this,ng);Ie(this,ig);Ie(this,sg);Ie(this,og);Ie(this,ag);Ie(this,cg);Ie(this,lg);Ie(this,fg);Ie(this,ug);Ie(this,dg);Ie(this,hg);Ie(this,K0);Ie(this,wd);Ie(this,$f);Ie(this,xd);ue(this,_l,null),ue(this,ng,null),ue(this,sg,0),ue(this,og,Di),ue(this,ag,null),ue(this,cg,null),ue(this,lg,null),ue(this,ig,"0x"),ue(this,fg,Di),ue(this,ug,Di),ue(this,dg,null),ue(this,hg,null),ue(this,K0,null),ue(this,wd,null),ue(this,xd,null),ue(this,$f,null)}get type(){return Q(this,_l)}set type(e){switch(e){case null:ue(this,_l,null);break;case 0:case"legacy":ue(this,_l,0);break;case 1:case"berlin":case"eip-2930":ue(this,_l,1);break;case 2:case"london":case"eip-1559":ue(this,_l,2);break;case 3:case"cancun":case"eip-4844":ue(this,_l,3);break;default:ve(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=Q(this,ng);return e==null&&this.type===3?bu:e}set to(e){ue(this,ng,e==null?null:Qt(e))}get nonce(){return Q(this,sg)}set nonce(e){ue(this,sg,or(e,"value"))}get gasLimit(){return Q(this,og)}set gasLimit(e){ue(this,og,Pt(e))}get gasPrice(){const e=Q(this,ag);return e==null&&(this.type===0||this.type===1)?Di:e}set gasPrice(e){ue(this,ag,e==null?null:Pt(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=Q(this,cg);return e??(this.type===2||this.type===3?Di:null)}set maxPriorityFeePerGas(e){ue(this,cg,e==null?null:Pt(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=Q(this,lg);return e??(this.type===2||this.type===3?Di:null)}set maxFeePerGas(e){ue(this,lg,e==null?null:Pt(e,"maxFeePerGas"))}get data(){return Q(this,ig)}set data(e){ue(this,ig,Me(e))}get value(){return Q(this,fg)}set value(e){ue(this,fg,Pt(e,"value"))}get chainId(){return Q(this,ug)}set chainId(e){ue(this,ug,Pt(e))}get signature(){return Q(this,dg)||null}set signature(e){ue(this,dg,e==null?null:wu.from(e))}get accessList(){const e=Q(this,hg)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){ue(this,hg,e==null?null:Wp(e))}get maxFeePerBlobGas(){const e=Q(this,K0);return e==null&&this.type===3?Di:e}set maxFeePerBlobGas(e){ue(this,K0,e==null?null:Pt(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=Q(this,wd);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){ve(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let r=0;rObject.assign({},e))}set blobs(e){if(e==null){ue(this,xd,null);return}const r=[],n=[];for(let i=0;i=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,r=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,i=Q(this,K0)!=null||Q(this,wd);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&Le(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Le(!r||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Le(this.type!==0||!n,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return this.type!=null?s.push(this.type):r?s.push(2):e?(s.push(1),n||s.push(0)):n?(s.push(1),s.push(2)):(i&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Of.from(this)}toJSON(){const e=r=>r==null?null:r.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Of;if(typeof e=="string"){const n=Ue(e);if(n[0]>=127)return Of.from(g4e(n));switch(n[0]){case 1:return Of.from(w4e(n));case 2:return Of.from(m4e(n));case 3:return Of.from(E4e(n))}Le(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const r=new Of;return e.type!=null&&(r.type=e.type),e.to!=null&&(r.to=e.to),e.nonce!=null&&(r.nonce=e.nonce),e.gasLimit!=null&&(r.gasLimit=e.gasLimit),e.gasPrice!=null&&(r.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(r.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(r.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(r.data=e.data),e.value!=null&&(r.value=e.value),e.chainId!=null&&(r.chainId=e.chainId),e.signature!=null&&(r.signature=wu.from(e.signature)),e.accessList!=null&&(r.accessList=e.accessList),e.blobVersionedHashes!=null&&(r.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(r.kzg=e.kzg),e.blobs!=null&&(r.blobs=e.blobs),e.hash!=null&&(ve(r.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),ve(r.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(ve(r.isSigned(),"unsigned transaction cannot define '.from'","tx",e),ve(r.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),r}};_l=new WeakMap,ng=new WeakMap,ig=new WeakMap,sg=new WeakMap,og=new WeakMap,ag=new WeakMap,cg=new WeakMap,lg=new WeakMap,fg=new WeakMap,ug=new WeakMap,dg=new WeakMap,hg=new WeakMap,K0=new WeakMap,wd=new WeakMap,$f=new WeakMap,xd=new WeakMap,pg=new WeakSet,l3=function(e,r){Le(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const n=e?this.signature:null;switch(this.inferType()){case 0:return y4e(this,n);case 1:return x4e(this,n);case 2:return b4e(this,n);case 3:return C4e(this,n,r?this.blobs:null)}Le(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let ww=Of;function Ak(t){return typeof t=="string"&&(t=Ii(t)),gr(qr([Ii(o5e),Ii(String(t.length)),t]))}function A4e(t,e){const r=Ak(t);return B5(r,e)}const S4e=new RegExp("^bytes([0-9]+)$"),_4e=new RegExp("^(u?int)([0-9]*)$"),I4e=new RegExp("^(.*)\\[([0-9]*)\\]$");function UQ(t,e,r){switch(t){case"address":return Ue(r?Kc(e,32):Qt(e));case"string":return Ii(e);case"bytes":return Ue(e);case"bool":return e=e?"0x01":"0x00",Ue(r?Kc(e,32):e)}let n=t.match(_4e);if(n){let i=n[1]==="int",s=parseInt(n[2]||"256");return ve((!n[2]||n[2]===String(s))&&s%8===0&&s!==0&&s<=256,"invalid number type","type",t),r&&(s=256),i&&(e=ik(e,s)),Ue(Kc(ts(e),s/8))}if(n=t.match(S4e),n){const i=parseInt(n[1]);return ve(String(i)===n[1]&&i!==0&&i<=32,"invalid bytes type","type",t),ve(fp(e)===i,`invalid value for ${t}`,"value",e),r?Ue(oY(e,32)):e}if(n=t.match(I4e),n&&Array.isArray(e)){const i=n[1],s=parseInt(n[2]||String(e.length));ve(s===e.length,`invalid array length for ${t}`,"value",e);const o=[];return e.forEach(function(a){o.push(UQ(i,a,!0))}),Ue(qr(o))}ve(!1,"invalid type","type",t)}function Cr(t,e){ve(t.length===e.length,"wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(UQ(n,e[i]))}),Me(qr(r))}function dp(t,e){return gr(Cr(t,e))}const $Q=new Uint8Array(32);$Q.fill(0);const T4e=BigInt(-1),qQ=BigInt(0),VQ=BigInt(1),P4e=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function k4e(t){const e=Ue(t),r=e.length%32;return r?qr([e,$Q.slice(r)]):Me(e)}const M4e=tc(VQ,32),R4e=tc(qQ,32),GL={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},a9=["name","version","chainId","verifyingContract","salt"];function WL(t){return function(e){return ve(typeof e=="string",`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const O4e={name:WL("name"),version:WL("version"),chainId:function(t){const e=Pt(t,"domain.chainId");return ve(e>=0,"invalid chain ID","domain.chainId",t),Number.isSafeInteger(e)?Number(e):zc(e)},verifyingContract:function(t){try{return Qt(t).toLowerCase()}catch{}ve(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){const e=Ue(t,"domain.salt");return ve(e.length===32,'invalid domain value "salt"',"domain.salt",t),Me(e)}};function c9(t){{const e=t.match(/^(u?)int(\d+)$/);if(e){const r=e[1]==="",n=parseInt(e[2]);ve(n%8===0&&n!==0&&n<=256&&e[2]===String(n),"invalid numeric width","type",t);const i=P0(P4e,r?n-1:n),s=r?(i+VQ)*T4e:qQ;return function(o){const a=Pt(o,"value");return ve(a>=s&&a<=i,`value out-of-bounds for ${t}`,"value",a),tc(r?ik(a,256):a,32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return ve(r!==0&&r<=32&&e[1]===String(r),"invalid bytes width","type",t),function(n){const i=Ue(n);return ve(i.length===r,`invalid length for ${t}`,"value",n),k4e(n)}}}switch(t){case"address":return function(e){return Kc(Qt(e),32)};case"bool":return function(e){return e?M4e:R4e};case"bytes":return function(e){return gr(e)};case"string":return function(e){return Oo(e)}}return null}function KL(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}function x6(t){const e=t.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:t}}var Fw,qf,vg,y4,zQ;const Ua=class Ua{constructor(e){Ie(this,y4);de(this,"primaryType");Ie(this,Fw);Ie(this,qf);Ie(this,vg);ue(this,qf,new Map),ue(this,vg,new Map);const r=new Map,n=new Map,i=new Map,s={};Object.keys(e).forEach(c=>{s[c]=e[c].map(({name:l,type:f})=>{let{base:u,index:p}=x6(f);return u==="int"&&!e.int&&(u="int256"),u==="uint"&&!e.uint&&(u="uint256"),{name:l,type:u+(p||"")}}),r.set(c,new Set),n.set(c,[]),i.set(c,new Set)}),ue(this,Fw,JSON.stringify(s));for(const c in s){const l=new Set;for(const f of s[c]){ve(!l.has(f.name),`duplicate variable name ${JSON.stringify(f.name)} in ${JSON.stringify(c)}`,"types",e),l.add(f.name);const u=x6(f.type).base;ve(u!==c,`circular type reference to ${JSON.stringify(u)}`,"types",e),!c9(u)&&(ve(n.has(u),`unknown type ${JSON.stringify(u)}`,"types",e),n.get(u).push(c),r.get(c).add(u))}}const o=Array.from(n.keys()).filter(c=>n.get(c).length===0);ve(o.length!==0,"missing primary type","types",e),ve(o.length===1,`ambiguous primary types or unused types: ${o.map(c=>JSON.stringify(c)).join(", ")}`,"types",e),Ot(this,{primaryType:o[0]});function a(c,l){ve(!l.has(c),`circular type reference to ${JSON.stringify(c)}`,"types",e),l.add(c);for(const f of r.get(c))if(n.has(f)){a(f,l);for(const u of l)i.get(u).add(f)}l.delete(c)}a(this.primaryType,new Set);for(const[c,l]of i){const f=Array.from(l);f.sort(),Q(this,qf).set(c,KL(c,s[c])+f.map(u=>KL(u,s[u])).join(""))}}get types(){return JSON.parse(Q(this,Fw))}getEncoder(e){let r=Q(this,vg).get(e);return r||(r=qe(this,y4,zQ).call(this,e),Q(this,vg).set(e,r)),r}encodeType(e){const r=Q(this,qf).get(e);return ve(r,`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return gr(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(c9(e))return n(e,r);const i=x6(e).array;if(i)return ve(i.count===-1||i.count===r.length,`array length mismatch; expected length ${i.count}`,"value",r),r.map(o=>this._visit(i.prefix,o,n));const s=this.types[e];if(s)return s.reduce((o,{name:a,type:c})=>(o[a]=this._visit(c,r[a],n),o),{});ve(!1,`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new Ua(e)}static getPrimaryType(e){return Ua.from(e).primaryType}static hashStruct(e,r,n){return Ua.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){if(e[n]==null)continue;const i=GL[n];ve(i,`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>a9.indexOf(n.name)-a9.indexOf(i.name)),Ua.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return qr(["0x1901",Ua.hashDomain(e),Ua.from(r).hash(n)])}static hash(e,r,n){return gr(Ua.encode(e,r,n))}static async resolveNames(e,r,n,i){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const s={};e.verifyingContract&&!Gr(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=Ua.from(r);o.visit(n,(a,c)=>(a==="address"&&!Gr(c,20)&&(s[c]="0x"),c));for(const a in s)s[a]=await i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),n=o.visit(n,(a,c)=>a==="address"&&s[c]?s[c]:c),{domain:e,value:n}}static getPayload(e,r,n){Ua.hashDomain(e);const i={},s=[];a9.forEach(c=>{const l=e[c];l!=null&&(i[c]=O4e[c](l),s.push({name:c,type:GL[c]}))});const o=Ua.from(r);r=o.types;const a=Object.assign({},r);return ve(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",r),a.EIP712Domain=s,o.encode(n),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(n,(c,l)=>{if(c.match(/^bytes(\d*)/))return Me(Ue(l));if(c.match(/^u?int/))return Pt(l).toString();switch(c){case"address":return l.toLowerCase();case"bool":return!!l;case"string":return ve(typeof l=="string","invalid string","value",l),l}ve(!1,"unsupported type","type",c)})}}};Fw=new WeakMap,qf=new WeakMap,vg=new WeakMap,y4=new WeakSet,zQ=function(e){{const i=c9(e);if(i)return i}const r=x6(e).array;if(r){const i=r.prefix,s=this.getEncoder(i);return o=>{ve(r.count===-1||r.count===o.length,`array length mismatch; expected length ${r.count}`,"value",o);let a=o.map(s);return Q(this,qf).has(i)&&(a=a.map(gr)),gr(qr(a))}}const n=this.types[e];if(n){const i=Oo(Q(this,qf).get(e));return s=>{const o=n.map(({name:a,type:c})=>{const l=this.getEncoder(c)(s[a]);return Q(this,qf).has(c)?gr(l):l});return o.unshift(i),qr(o)}}ve(!1,`unknown type: ${e}`,"type",e)};let uh=Ua;function Js(t){const e=new Set;return t.forEach(r=>e.add(r)),Object.freeze(e)}const D4e="external public payable override",N4e=Js(D4e.split(" ")),HQ="constant external internal payable private public pure view override",B4e=Js(HQ.split(" ")),GQ="constructor error event fallback function receive struct",WQ=Js(GQ.split(" ")),KQ="calldata memory storage payable indexed",L4e=Js(KQ.split(" ")),F4e="tuple returns",j4e=[GQ,KQ,F4e,HQ].join(" "),U4e=Js(j4e.split(" ")),$4e={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},q4e=new RegExp("^(\\s*)"),V4e=new RegExp("^([0-9]+)"),z4e=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),YQ=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),QQ=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var Yi,Fc,jw,f_;const m4=class m4{constructor(e){Ie(this,jw);Ie(this,Yi);Ie(this,Fc);ue(this,Yi,0),ue(this,Fc,e.slice())}get offset(){return Q(this,Yi)}get length(){return Q(this,Fc).length-Q(this,Yi)}clone(){return new m4(Q(this,Fc))}reset(){ue(this,Yi,0)}popKeyword(e){const r=this.peek();if(r.type!=="KEYWORD"||!e.has(r.text))throw new Error(`expected keyword ${r.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const r=this.peek();throw new Error(`expected ${e}; got ${r.type} ${JSON.stringify(r.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=qe(this,jw,f_).call(this,Q(this,Yi)+1,e.match+1);return ue(this,Yi,e.match+1),r}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const r=[];for(;Q(this,Yi)=Q(this,Fc).length)throw new Error("out-of-bounds");return Q(this,Fc)[Q(this,Yi)]}peekKeyword(e){const r=this.peekType("KEYWORD");return r!=null&&e.has(r)?r:null}peekType(e){if(this.length===0)return null;const r=this.peek();return r.type===e?r.text:null}pop(){const e=this.peek();return dm(this,Yi)._++,e}toString(){const e=[];for(let r=Q(this,Yi);r`}};Yi=new WeakMap,Fc=new WeakMap,jw=new WeakSet,f_=function(e=0,r=0){return new m4(Q(this,Fc).slice(e,r).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let Jc=m4;function Rh(t){const e=[],r=o=>{const a=s0&&e[e.length-1].type==="NUMBER"){const u=e.pop().text;f=u+f,e[e.length-1].value=or(u)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=f}continue}if(a=o.match(z4e),a){if(c.text=a[1],s+=c.text.length,U4e.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(QQ)){c.type="TYPE";continue}c.type="ID";continue}if(a=o.match(V4e),a){c.text=a[1],c.type="NUMBER",s+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Jc(e.map(o=>Object.freeze(o)))}function YL(t,e){let r=[];for(const n in e.keys())t.has(n)&&r.push(n);if(r.length>1)throw new Error(`conflicting types: ${r.join(", ")}`)}function F8(t,e){if(e.peekKeyword(WQ)){const r=e.pop().text;if(r!==t)throw new Error(`expected ${t}, got ${r}`)}return e.popType("ID")}function xu(t,e){const r=new Set;for(;;){const n=t.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(t.pop(),r.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);r.add(n)}return Object.freeze(r)}function JQ(t){let e=xu(t,B4e);return YL(e,Js("constant payable nonpayable".split(" "))),YL(e,Js("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function cu(t,e){return t.popParams().map(r=>ss.from(r,e))}function ZQ(t){if(t.peekType("AT")){if(t.pop(),t.peekType("NUMBER"))return Pt(t.pop().text);throw new Error("invalid gas")}return null}function Pp(t){if(t.length)throw new Error(`unexpected tokens at offset ${t.offset}: ${t.toString()}`)}const H4e=new RegExp(/^(.*)\[([0-9]*)\]$/);function QL(t){const e=t.match(QQ);if(ve(e,"invalid type","type",t),t==="uint")return"uint256";if(t==="int")return"int256";if(e[2]){const r=parseInt(e[2]);ve(r!==0&&r<=32,"invalid bytes length","type",t)}else if(e[3]){const r=parseInt(e[3]);ve(r!==0&&r<=256&&r%8===0,"invalid numeric width","type",t)}return t}const Rn={},Do=Symbol.for("_ethers_internal"),JL="_ParamTypeInternal",ZL="_ErrorInternal",XL="_EventInternal",eF="_ConstructorInternal",tF="_FallbackInternal",rF="_FunctionInternal",nF="_StructInternal";var gg,f3;const $a=class $a{constructor(e,r,n,i,s,o,a,c){Ie(this,gg);de(this,"name");de(this,"type");de(this,"baseType");de(this,"indexed");de(this,"components");de(this,"arrayLength");de(this,"arrayChildren");if(kh(e,Rn,"ParamType"),Object.defineProperty(this,Do,{value:JL}),o&&(o=Object.freeze(o.slice())),i==="array"){if(a==null||c==null)throw new Error("")}else if(a!=null||c!=null)throw new Error("");if(i==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");Ot(this,{name:r,type:n,baseType:i,indexed:s,components:o,arrayLength:a,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=n,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const i={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.isTuple()&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.isArray()?(r+=this.arrayChildren.format(e),r+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?r+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":r+=this.type,e!=="sighash"&&(this.indexed===!0&&(r+=" indexed"),e==="full"&&this.name&&(r+=" "+this.name)),r}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,r){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(i=>n.arrayChildren.walk(i,r))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((i,s)=>n.components[s].walk(i,r))}return r(this.type,e)}async walkAsync(e,r){const n=[],i=[e];return qe(this,gg,f3).call(this,n,e,r,s=>{i[0]=s}),n.length&&await Promise.all(n),i[0]}static from(e,r){if($a.isParamType(e))return e;if(typeof e=="string")try{return $a.from(Rh(e),r)}catch{ve(!1,"invalid param type","obj",e)}else if(e instanceof Jc){let a="",c="",l=null;xu(e,Js(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",l=e.popParams().map(b=>$a.from(b)),a=`tuple(${l.map(b=>b.format()).join(",")})`):(a=QL(e.popType("TYPE")),c=a);let f=null,u=null;for(;e.length&&e.peekType("BRACKET");){const b=e.pop();f=new $a(Rn,"",a,c,null,l,u,f),u=b.value,a+=b.text,c="array",l=null}let p=null;if(xu(e,L4e).has("indexed")){if(!r)throw new Error("");p=!0}const y=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new $a(Rn,y,a,c,p,l,u,f)}const n=e.name;ve(!n||typeof n=="string"&&n.match(YQ),"invalid name","obj.name",n);let i=e.indexed;i!=null&&(ve(r,"parameter cannot be indexed","obj.indexed",e.indexed),i=!!i);let s=e.type,o=s.match(H4e);if(o){const a=parseInt(o[2]||"-1"),c=$a.from({type:o[1],components:e.components});return new $a(Rn,n||"",s,"array",i,null,a,c)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const a=e.components!=null?e.components.map(l=>$a.from(l)):null;return new $a(Rn,n||"",s,"tuple",i,a,null,null)}return s=QL(e.type),new $a(Rn,n||"",s,s,i,null,null,null)}static isParamType(e){return e&&e[Do]===JL}};gg=new WeakSet,f3=function(e,r,n,i){if(this.isArray()){if(!Array.isArray(r))throw new Error("invalid array value");if(this.arrayLength!==-1&&r.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=r.slice();a.forEach((c,l)=>{var f;qe(f=o,gg,f3).call(f,e,c,n,u=>{a[l]=u})}),i(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(r))a=r.slice();else{if(r==null||typeof r!="object")throw new Error("invalid tuple value");a=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in r))throw new Error(`missing value for component ${c.name}`);return r[c.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((c,l)=>{var f;qe(f=o[l],gg,f3).call(f,e,c,n,u=>{a[l]=u})}),i(a);return}const s=n(this.type,r);s.then?e.push(async function(){i(await s)}()):i(s)};let ss=$a;class kp{constructor(e,r,n){de(this,"type");de(this,"inputs");kh(e,Rn,"Fragment"),n=Object.freeze(n.slice()),Ot(this,{type:r,inputs:n})}static from(e){if(typeof e=="string"){try{kp.from(JSON.parse(e))}catch{}return kp.from(Rh(e))}if(e instanceof Jc)switch(e.peekKeyword(WQ)){case"constructor":return Xf.from(e);case"error":return Io.from(e);case"event":return Nl.from(e);case"fallback":case"receive":return Nf.from(e);case"function":return Bl.from(e);case"struct":return hp.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Xf.from(e);case"error":return Io.from(e);case"event":return Nl.from(e);case"fallback":case"receive":return Nf.from(e);case"function":return Bl.from(e);case"struct":return hp.from(e)}Le(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}ve(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Xf.isFragment(e)}static isError(e){return Io.isFragment(e)}static isEvent(e){return Nl.isFragment(e)}static isFunction(e){return Bl.isFragment(e)}static isStruct(e){return hp.isFragment(e)}}class j8 extends kp{constructor(r,n,i,s){super(r,n,s);de(this,"name");ve(typeof i=="string"&&i.match(YQ),"invalid identifier","name",i),s=Object.freeze(s.slice()),Ot(this,{name:i})}}function xw(t,e){return"("+e.map(r=>r.format(t)).join(t==="full"?", ":",")+")"}class Io extends j8{constructor(e,r,n){super(e,"error",r,n),Object.defineProperty(this,Do,{value:ZL})}get selector(){return Oo(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const r=[];return e!=="sighash"&&r.push("error"),r.push(this.name+xw(e,this.inputs)),r.join(" ")}static from(e){if(Io.isFragment(e))return e;if(typeof e=="string")return Io.from(Rh(e));if(e instanceof Jc){const r=F8("error",e),n=cu(e);return Pp(e),new Io(Rn,r,n)}return new Io(Rn,e.name,e.inputs?e.inputs.map(ss.from):[])}static isFragment(e){return e&&e[Do]===ZL}}class Nl extends j8{constructor(r,n,i,s){super(r,"event",n,i);de(this,"anonymous");Object.defineProperty(this,Do,{value:XL}),Ot(this,{anonymous:s})}get topicHash(){return Oo(this.format("sighash"))}format(r){if(r==null&&(r="sighash"),r==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("event"),n.push(this.name+xw(r,this.inputs)),r!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(r,n){return n=(n||[]).map(s=>ss.from(s)),new Nl(Rn,r,n,!1).topicHash}static from(r){if(Nl.isFragment(r))return r;if(typeof r=="string")try{return Nl.from(Rh(r))}catch{ve(!1,"invalid event fragment","obj",r)}else if(r instanceof Jc){const n=F8("event",r),i=cu(r,!0),s=!!xu(r,Js(["anonymous"])).has("anonymous");return Pp(r),new Nl(Rn,n,i,s)}return new Nl(Rn,r.name,r.inputs?r.inputs.map(n=>ss.from(n,!0)):[],!!r.anonymous)}static isFragment(r){return r&&r[Do]===XL}}class Xf extends kp{constructor(r,n,i,s,o){super(r,n,i);de(this,"payable");de(this,"gas");Object.defineProperty(this,Do,{value:eF}),Ot(this,{payable:s,gas:o})}format(r){if(Le(r!=null&&r!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),r==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r)))});const n=[`constructor${xw(r,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(r){if(Xf.isFragment(r))return r;if(typeof r=="string")try{return Xf.from(Rh(r))}catch{ve(!1,"invalid constuctor fragment","obj",r)}else if(r instanceof Jc){xu(r,Js(["constructor"]));const n=cu(r),i=!!xu(r,N4e).has("payable"),s=ZQ(r);return Pp(r),new Xf(Rn,"constructor",n,i,s)}return new Xf(Rn,"constructor",r.inputs?r.inputs.map(ss.from):[],!!r.payable,r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Do]===eF}}class Nf extends kp{constructor(r,n,i){super(r,"fallback",n);de(this,"payable");Object.defineProperty(this,Do,{value:tF}),Ot(this,{payable:i})}format(r){const n=this.inputs.length===0?"receive":"fallback";if(r==="json"){const i=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:i})}return`${n}()${this.payable?" payable":""}`}static from(r){if(Nf.isFragment(r))return r;if(typeof r=="string")try{return Nf.from(Rh(r))}catch{ve(!1,"invalid fallback fragment","obj",r)}else if(r instanceof Jc){const n=r.toString(),i=r.peekKeyword(Js(["fallback","receive"]));if(ve(i,"type must be fallback or receive","obj",n),r.popKeyword(Js(["fallback","receive"]))==="receive"){const c=cu(r);return ve(c.length===0,"receive cannot have arguments","obj.inputs",c),xu(r,Js(["payable"])),Pp(r),new Nf(Rn,[],!0)}let o=cu(r);o.length?ve(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(c=>c.format("minimal")).join(", ")):o=[ss.from("bytes")];const a=JQ(r);if(ve(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),xu(r,Js(["returns"])).has("returns")){const c=cu(r);ve(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(l=>l.format("minimal")).join(", "))}return Pp(r),new Nf(Rn,o,a==="payable")}if(r.type==="receive")return new Nf(Rn,[],!0);if(r.type==="fallback"){const n=[ss.from("bytes")],i=r.stateMutability==="payable";return new Nf(Rn,n,i)}ve(!1,"invalid fallback description","obj",r)}static isFragment(r){return r&&r[Do]===tF}}class Bl extends j8{constructor(r,n,i,s,o,a){super(r,"function",n,s);de(this,"constant");de(this,"outputs");de(this,"stateMutability");de(this,"payable");de(this,"gas");Object.defineProperty(this,Do,{value:rF}),o=Object.freeze(o.slice()),Ot(this,{constant:i==="view"||i==="pure",gas:a,outputs:o,payable:i==="payable",stateMutability:i})}get selector(){return Oo(this.format("sighash")).substring(0,10)}format(r){if(r==null&&(r="sighash"),r==="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!=null?this.gas:void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(r))),outputs:this.outputs.map(i=>JSON.parse(i.format(r)))});const n=[];return r!=="sighash"&&n.push("function"),n.push(this.name+xw(r,this.inputs)),r!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(xw(r,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(r,n){return n=(n||[]).map(s=>ss.from(s)),new Bl(Rn,r,"view",n,[],null).selector}static from(r){if(Bl.isFragment(r))return r;if(typeof r=="string")try{return Bl.from(Rh(r))}catch{ve(!1,"invalid function fragment","obj",r)}else if(r instanceof Jc){const i=F8("function",r),s=cu(r),o=JQ(r);let a=[];xu(r,Js(["returns"])).has("returns")&&(a=cu(r));const c=ZQ(r);return Pp(r),new Bl(Rn,i,o,s,a,c)}let n=r.stateMutability;return n==null&&(n="payable",typeof r.constant=="boolean"?(n="view",r.constant||(n="payable",typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable"))):typeof r.payable=="boolean"&&!r.payable&&(n="nonpayable")),new Bl(Rn,r.name,n,r.inputs?r.inputs.map(ss.from):[],r.outputs?r.outputs.map(ss.from):[],r.gas!=null?r.gas:null)}static isFragment(r){return r&&r[Do]===rF}}class hp extends j8{constructor(e,r,n){super(e,"struct",r,n),Object.defineProperty(this,Do,{value:nF})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return hp.from(Rh(e))}catch{ve(!1,"invalid struct fragment","obj",e)}else if(e instanceof Jc){const r=F8("struct",e),n=cu(e);return Pp(e),new hp(Rn,r,n)}return new hp(Rn,e.name,e.inputs?e.inputs.map(ss.from):[])}static isFragment(e){return e&&e[Do]===nF}}const tl=new Map;tl.set(0,"GENERIC_PANIC");tl.set(1,"ASSERT_FALSE");tl.set(17,"OVERFLOW");tl.set(18,"DIVIDE_BY_ZERO");tl.set(33,"ENUM_RANGE_ERROR");tl.set(34,"BAD_STORAGE_DATA");tl.set(49,"STACK_UNDERFLOW");tl.set(50,"ARRAY_RANGE_ERROR");tl.set(65,"OUT_OF_MEMORY");tl.set(81,"UNINITIALIZED_FUNCTION_CALL");const G4e=new RegExp(/^bytes([0-9]*)$/),W4e=new RegExp(/^(u?int)([0-9]*)$/);let l9=null,iF=1024;function K4e(t,e,r,n){let i="missing revert data",s=null;const o=null;let a=null;if(r){i="execution reverted";const l=Ue(r);if(r=Me(r),l.length===0)i+=" (no data present; likely require(false) occurred",s="require(false)";else if(l.length%32!==4)i+=" (could not decode reason; invalid data length)";else if(Me(l.slice(0,4))==="0x08c379a0")try{s=n.decode(["string"],l.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[s]},i+=`: ${JSON.stringify(s)}`}catch{i+=" (could not decode reason; invalid string data)"}else if(Me(l.slice(0,4))==="0x4e487b71")try{const f=Number(n.decode(["uint256"],l.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[f]},s=`Panic due to ${tl.get(f)||"UNKNOWN"}(${f})`,i+=`: ${s}`}catch{i+=" (could not decode panic code)"}else i+=" (unknown custom error)"}const c={to:e.to?Qt(e.to):null,data:e.data||"0x"};return e.from&&(c.from=Qt(e.from)),zn(i,"CALL_EXCEPTION",{action:t,data:r,reason:s,transaction:c,invocation:o,revert:a})}var Ed,V1;const b4=class b4{constructor(){Ie(this,Ed)}getDefaultValue(e){const r=e.map(i=>qe(this,Ed,V1).call(this,ss.from(i)));return new w6(r,"_").defaultValue()}encode(e,r){rY(r.length,e.length,"types/values length mismatch");const n=e.map(o=>qe(this,Ed,V1).call(this,ss.from(o))),i=new w6(n,"_"),s=new Q7;return i.encode(s,r),s.data}decode(e,r,n){const i=e.map(o=>qe(this,Ed,V1).call(this,ss.from(o)));return new w6(i,"_").decode(new J7(r,n,iF))}static _setDefaultMaxInflation(e){ve(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),iF=e}static defaultAbiCoder(){return l9==null&&(l9=new b4),l9}static getBuiltinCallException(e,r,n){return K4e(e,r,n,b4.defaultAbiCoder())}};Ed=new WeakSet,V1=function(e){if(e.isArray())return new v5e(qe(this,Ed,V1).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new w6(e.components.map(n=>qe(this,Ed,V1).call(this,n)),e.name);switch(e.baseType){case"address":return new h5e(e.name);case"bool":return new g5e(e.name);case"string":return new S5e(e.name);case"bytes":return new y5e(e.name);case"":return new w5e(e.name)}let r=e.type.match(W4e);if(r){let n=parseInt(r[2]||"256");return ve(n!==0&&n<=256&&n%8===0,"invalid "+r[1]+" bit length","param",e),new A5e(n/8,r[1]==="int",e.name)}if(r=e.type.match(G4e),r){let n=parseInt(r[1]);return ve(n!==0&&n<=32,"invalid bytes length","param",e),new m5e(n,e.name)}ve(!1,"invalid type","type",e.type)};let Ns=b4;class Y4e{constructor(e,r,n){de(this,"fragment");de(this,"name");de(this,"signature");de(this,"topic");de(this,"args");const i=e.name,s=e.format();Ot(this,{fragment:e,name:i,signature:s,topic:r,args:n})}}class Q4e{constructor(e,r,n,i){de(this,"fragment");de(this,"name");de(this,"args");de(this,"signature");de(this,"selector");de(this,"value");const s=e.name,o=e.format();Ot(this,{fragment:e,name:s,args:n,signature:o,selector:r,value:i})}}class J4e{constructor(e,r,n){de(this,"fragment");de(this,"name");de(this,"args");de(this,"signature");de(this,"selector");const i=e.name,s=e.format();Ot(this,{fragment:e,name:i,args:n,signature:s,selector:r})}}class sF{constructor(e){de(this,"hash");de(this,"_isIndexed");Ot(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const oF={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},aF={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:t=>`reverted with reason string ${JSON.stringify(t)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:t=>{let e="unknown panic code";return t>=0&&t<=255&&oF[t.toString()]&&(e=oF[t.toString()]),`reverted with panic code 0x${t.toString(16)} (${e})`}}};var Il,Tl,Pl,ws,Kl,u3,d3;const A0=class A0{constructor(e){Ie(this,Kl);de(this,"fragments");de(this,"deploy");de(this,"fallback");de(this,"receive");Ie(this,Il);Ie(this,Tl);Ie(this,Pl);Ie(this,ws);let r=[];typeof e=="string"?r=JSON.parse(e):r=e,ue(this,Pl,new Map),ue(this,Il,new Map),ue(this,Tl,new Map);const n=[];for(const o of r)try{n.push(kp.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Ot(this,{fragments:Object.freeze(n)});let i=null,s=!1;ue(this,ws,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ot(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(ve(!i||o.payable!==i.payable,"conflicting fallback fragments",`fragments[${a}]`,o),i=o,s=i.payable);return;case"function":c=Q(this,Pl);break;case"event":c=Q(this,Tl);break;case"error":c=Q(this,Il);break;default:return}const l=o.format();c.has(l)||c.set(l,o)}),this.deploy||Ot(this,{deploy:Xf.from("constructor()")}),Ot(this,{fallback:i,receive:s})}format(e){const r=e?"minimal":"full";return this.fragments.map(i=>i.format(r))}formatJson(){const e=this.fragments.map(r=>r.format("json"));return JSON.stringify(e.map(r=>JSON.parse(r)))}getAbiCoder(){return Ns.defaultAbiCoder()}getFunctionName(e){const r=qe(this,Kl,u3).call(this,e,null,!1);return ve(r,"no matching function","key",e),r.name}hasFunction(e){return!!qe(this,Kl,u3).call(this,e,null,!1)}getFunction(e,r){return qe(this,Kl,u3).call(this,e,r||null,!0)}forEachFunction(e){const r=Array.from(Q(this,Pl).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;nn.localeCompare(i));for(let n=0;n1){const s=i.map(o=>JSON.stringify(o.format())).join(", ");ve(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return i[0]}if(e=Io.from(e).format(),e==="Error(string)")return Io.from("error Error(string)");if(e==="Panic(uint256)")return Io.from("error Panic(uint256)");const n=Q(this,Il).get(e);return n||null}forEachError(e){const r=Array.from(Q(this,Il).keys());r.sort((n,i)=>n.localeCompare(i));for(let n=0;ns.type==="string"?Oo(o):s.type==="bytes"?gr(Me(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=tc(o):s.type.match(/^bytes/)?o=oY(o,32):s.type==="address"&&Q(this,ws).encode(["address"],[o]),Kc(Me(o),32));for(r.forEach((s,o)=>{const a=e.inputs[o];if(!a.indexed){ve(s==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?n.push(null):a.baseType==="array"||a.baseType==="tuple"?ve(!1,"filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?n.push(s.map(c=>i(a,c))):n.push(i(a,s))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){if(typeof e=="string"){const o=this.getEvent(e);ve(o,"unknown event","eventFragment",e),e=o}const n=[],i=[],s=[];return e.anonymous||n.push(e.topicHash),ve(r.length===e.inputs.length,"event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{const c=r[a];if(o.indexed)if(o.type==="string")n.push(Oo(c));else if(o.type==="bytes")n.push(gr(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(Q(this,ws).encode([o.type],[c]))}else i.push(o),s.push(c)}),{data:Q(this,ws).encode(i,s),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"){const g=this.getEvent(e);ve(g,"unknown event","eventFragment",e),e=g}if(n!=null&&!e.anonymous){const g=e.topicHash;ve(Gr(n[0],32)&&n[0].toLowerCase()===g,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const i=[],s=[],o=[];e.inputs.forEach((g,y)=>{g.indexed?g.type==="string"||g.type==="bytes"||g.baseType==="tuple"||g.baseType==="array"?(i.push(ss.from({type:"bytes32",name:g.name})),o.push(!0)):(i.push(g),o.push(!1)):(s.push(g),o.push(!1))});const a=n!=null?Q(this,ws).decode(i,qr(n)):null,c=Q(this,ws).decode(s,r,!0),l=[],f=[];let u=0,p=0;return e.inputs.forEach((g,y)=>{let b=null;if(g.indexed)if(a==null)b=new sF(null);else if(o[y])b=new sF(a[p++]);else try{b=a[p++]}catch(I){b=I}else try{b=c[u++]}catch(I){b=I}l.push(b),f.push(g.name||null)}),Gg.fromItems(l,f)}parseTransaction(e){const r=Ue(e.data,"tx.data"),n=Pt(e.value!=null?e.value:0,"tx.value"),i=this.getFunction(Me(r.slice(0,4)));if(!i)return null;const s=Q(this,ws).decode(i.inputs,r.slice(4));return new Q4e(i,i.selector,s,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new Y4e(r,r.topicHash,this.decodeEventLog(r,e.data,e.topics))}parseError(e){const r=Me(e),n=this.getError(mn(r,0,4));if(!n)return null;const i=Q(this,ws).decode(n.inputs,mn(r,4));return new J4e(n,n.selector,i)}static from(e){return e instanceof A0?e:typeof e=="string"?new A0(JSON.parse(e)):typeof e.formatJson=="function"?new A0(e.formatJson()):typeof e.format=="function"?new A0(e.format("json")):new A0(e)}};Il=new WeakMap,Tl=new WeakMap,Pl=new WeakMap,ws=new WeakMap,Kl=new WeakSet,u3=function(e,r,n){if(Gr(e)){const s=e.toLowerCase();for(const o of Q(this,Pl).values())if(s===o.selector)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of Q(this,Pl))o.split("(")[0]===e&&s.push(a);if(r){const o=r.length>0?r[r.length-1]:null;let a=r.length,c=!0;ks.isTyped(o)&&o.type==="overrides"&&(c=!1,a--);for(let l=s.length-1;l>=0;l--){const f=s[l].inputs.length;f!==a&&(!c||f!==a-1)&&s.splice(l,1)}for(let l=s.length-1;l>=0;l--){const f=s[l].inputs;for(let u=0;u=f.length){if(r[u].type==="overrides")continue;s.splice(l,1);break}if(r[u].type!==f[u].baseType){s.splice(l,1);break}}}}if(s.length===1&&r&&r.length!==s[0].inputs.length){const o=r[r.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&n){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ve(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return s[0]}const i=Q(this,Pl).get(Bl.from(e).format());return i||null},d3=function(e,r,n){if(Gr(e)){const s=e.toLowerCase();for(const o of Q(this,Tl).values())if(s===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of Q(this,Tl))o.split("(")[0]===e&&s.push(a);if(r){for(let o=s.length-1;o>=0;o--)s[o].inputs.length=0;o--){const a=s[o].inputs;for(let c=0;c1&&n){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ve(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return s[0]}const i=Q(this,Tl).get(Nl.from(e).format());return i||null};let $i=A0;const XQ=BigInt(0);function Ov(t){return t??null}function si(t){return t==null?null:t.toString()}class cF{constructor(e,r,n){de(this,"gasPrice");de(this,"maxFeePerGas");de(this,"maxPriorityFeePerGas");Ot(this,{gasPrice:Ov(e),maxFeePerGas:Ov(r),maxPriorityFeePerGas:Ov(n)})}toJSON(){const{gasPrice:e,maxFeePerGas:r,maxPriorityFeePerGas:n}=this;return{_type:"FeeData",gasPrice:si(e),maxFeePerGas:si(r),maxPriorityFeePerGas:si(n)}}}function Ew(t){const e={};t.to&&(e.to=t.to),t.from&&(e.from=t.from),t.data&&(e.data=Me(t.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const i of r)!(i in t)||t[i]==null||(e[i]=Pt(t[i],`request.${i}`));const n="type,nonce".split(/,/);for(const i of n)!(i in t)||t[i]==null||(e[i]=or(t[i],`request.${i}`));return t.accessList&&(e.accessList=Wp(t.accessList)),"blockTag"in t&&(e.blockTag=t.blockTag),"enableCcipRead"in t&&(e.enableCcipRead=!!t.enableCcipRead),"customData"in t&&(e.customData=t.customData),"blobVersionedHashes"in t&&t.blobVersionedHashes&&(e.blobVersionedHashes=t.blobVersionedHashes.slice()),"kzg"in t&&(e.kzg=t.kzg),"blobs"in t&&t.blobs&&(e.blobs=t.blobs.map(i=>mu(i)?Me(i):Object.assign({},i))),e}var Vf;class Z4e{constructor(e,r){de(this,"provider");de(this,"number");de(this,"hash");de(this,"timestamp");de(this,"parentHash");de(this,"parentBeaconBlockRoot");de(this,"nonce");de(this,"difficulty");de(this,"gasLimit");de(this,"gasUsed");de(this,"stateRoot");de(this,"receiptsRoot");de(this,"blobGasUsed");de(this,"excessBlobGas");de(this,"miner");de(this,"prevRandao");de(this,"extraData");de(this,"baseFeePerGas");Ie(this,Vf);ue(this,Vf,e.transactions.map(n=>typeof n!="string"?new Cw(n,r):n)),Ot(this,{provider:r,hash:Ov(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Ov(e.prevRandao),extraData:e.extraData,baseFeePerGas:Ov(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return Q(this,Vf).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=Q(this,Vf).slice();return e.length===0?[]:(Le(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:r,extraData:n,gasLimit:i,gasUsed:s,hash:o,miner:a,prevRandao:c,nonce:l,number:f,parentHash:u,parentBeaconBlockRoot:p,stateRoot:g,receiptsRoot:y,timestamp:b,transactions:I}=this;return{_type:"Block",baseFeePerGas:si(e),difficulty:si(r),extraData:n,gasLimit:si(i),gasUsed:si(s),blobGasUsed:si(this.blobGasUsed),excessBlobGas:si(this.excessBlobGas),hash:o,miner:a,prevRandao:c,nonce:l,number:f,parentHash:u,timestamp:b,parentBeaconBlockRoot:p,stateRoot:g,receiptsRoot:y,transactions:I}}[Symbol.iterator](){let e=0;const r=this.transactions;return{next:()=>enew bx(i,r))));let n=XQ;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),Ot(this,{provider:r,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return Q(this,Uw)}toJSON(){const{to:e,from:r,contractAddress:n,hash:i,index:s,blockHash:o,blockNumber:a,logsBloom:c,logs:l,status:f,root:u}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:n,cumulativeGasUsed:si(this.cumulativeGasUsed),from:r,gasPrice:si(this.gasPrice),blobGasUsed:si(this.blobGasUsed),blobGasPrice:si(this.blobGasPrice),gasUsed:si(this.gasUsed),hash:i,index:s,logs:l,logsBloom:c,root:u,status:f,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(a)return null;const{blockNumber:p,nonce:g}=await vi({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(g{if(p==null||p.status!==0)return p;Le(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:p.to,from:p.from,data:""},receipt:p})},f=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(f);if(f){if(await f.confirmations()>=n)return l(f)}else if(await c(),n===0)return null;return await new Promise((p,g)=>{const y=[],b=()=>{y.forEach(C=>C())};if(y.push(()=>{a=!0}),i>0){const C=setTimeout(()=>{b(),g(zn("wait for transaction timeout","TIMEOUT"))},i);y.push(()=>{clearTimeout(C)})}const I=async C=>{if(await C.confirmations()>=n){b();try{p(l(C))}catch(S){g(S)}}};if(y.push(()=>{this.provider.off(this.hash,I)}),this.provider.on(this.hash,I),s>=0){const C=async()=>{try{await c()}catch(S){if(Is(S,"TRANSACTION_REPLACED")){b(),g(S);return}}a||this.provider.once("block",C)};y.push(()=>{this.provider.off("block",C)}),this.provider.once("block",C)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return Le(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),rJ(this)}reorderedEvent(e){return Le(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Le(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),tJ(this,e)}replaceableTransaction(e){ve(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const r=new eR(this,this.provider);return ue(r,Cd,e),r}};Cd=new WeakMap;let Cw=eR;function X4e(t){return{orphan:"drop-block",hash:t.hash,number:t.number}}function tJ(t,e){return{orphan:"reorder-transaction",tx:t,other:e}}function rJ(t){return{orphan:"drop-transaction",tx:t}}function e8e(t){return{orphan:"drop-log",log:{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,address:t.address,data:t.data,topics:Object.freeze(t.topics.slice()),index:t.index}}}class Sk extends bx{constructor(r,n,i){super(r,r.provider);de(this,"interface");de(this,"fragment");de(this,"args");const s=n.decodeEventLog(i,r.data,r.topics);Ot(this,{args:s,fragment:i,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class nJ extends bx{constructor(r,n){super(r,r.provider);de(this,"error");Ot(this,{error:n})}}var yg;class t8e extends eJ{constructor(r,n,i){super(i,n);Ie(this,yg);ue(this,yg,r)}get logs(){return super.logs.map(r=>{const n=r.topics.length?Q(this,yg).getEvent(r.topics[0]):null;if(n)try{return new Sk(r,Q(this,yg),n)}catch(i){return new nJ(r,i)}return r})}}yg=new WeakMap;var $w;class _k extends Cw{constructor(r,n,i){super(i,n);Ie(this,$w);ue(this,$w,r)}async wait(r,n){const i=await super.wait(r,n);return i==null?null:new t8e(Q(this,$w),this.provider,i)}}$w=new WeakMap;class iJ extends cY{constructor(r,n,i,s){super(r,n,i);de(this,"log");Ot(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class r8e extends iJ{constructor(e,r,n,i,s){super(e,r,n,new Sk(s,e.interface,i));const o=e.interface.decodeEventLog(i,this.log.data,this.log.topics);Ot(this,{args:o,fragment:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const lF=BigInt(0);function sJ(t){return t&&typeof t.call=="function"}function oJ(t){return t&&typeof t.estimateGas=="function"}function U8(t){return t&&typeof t.resolveName=="function"}function aJ(t){return t&&typeof t.sendTransaction=="function"}function cJ(t){if(t!=null){if(U8(t))return t;if(t.provider)return t.provider}}var qw;class n8e{constructor(e,r,n){Ie(this,qw);de(this,"fragment");if(Ot(this,{fragment:r}),r.inputs.lengthn[c]==null?null:a.walkAsync(n[c],(f,u)=>f==="address"?Array.isArray(u)?Promise.all(u.map(p=>rs(p,s))):rs(u,s):u)));return e.interface.encodeFilterTopics(r,o)}())}getTopicFilter(){return Q(this,qw)}}qw=new WeakMap;function Mp(t,e){return t==null?null:typeof t[e]=="function"?t:t.provider&&typeof t.provider[e]=="function"?t.provider:null}function R0(t){return t==null?null:t.provider||null}async function lJ(t,e){const r=ks.dereference(t,"overrides");ve(typeof r=="object","invalid overrides parameter","overrides",t);const n=Ew(r);return ve(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),ve(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function i8e(t,e,r){const n=Mp(t,"resolveName"),i=U8(n)?n:null;return await Promise.all(e.map((s,o)=>s.walkAsync(r[o],(a,c)=>(c=ks.dereference(c,a),a==="address"?rs(c,i):c))))}function s8e(t){const e=async function(o){const a=await lJ(o,["data"]);a.to=await t.getAddress(),a.from&&(a.from=await rs(a.from,cJ(t.runner)));const c=t.interface,l=Pt(a.value||lF,"overrides.value")===lF,f=(a.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!f&&!l&&ve(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),ve(c.fallback||f,"cannot send data to receive-only contract","overrides.data",a.data);const u=c.receive||c.fallback&&c.fallback.payable;return ve(u||l,"cannot send value to non-payable fallback","overrides.value",a.value),ve(c.fallback||f,"cannot send data to receive-only contract","overrides.data",a.data),a},r=async function(o){const a=Mp(t.runner,"call");Le(sJ(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(o);try{return await a.call(c)}catch(l){throw nk(l)&&l.data?t.interface.makeError(l.data,c):l}},n=async function(o){const a=t.runner;Le(aJ(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await a.sendTransaction(await e(o)),l=R0(t.runner);return new _k(t.interface,l,c)},i=async function(o){const a=Mp(t.runner,"estimateGas");return Le(oJ(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},s=async o=>await n(o);return Ot(s,{_contract:t,estimateGas:i,populateTransaction:e,send:n,staticCall:r}),s}function o8e(t,e){const r=function(...l){const f=t.interface.getFunction(e,l);return Le(f,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:l}}),f},n=async function(...l){const f=r(...l);let u={};if(f.inputs.length+1===l.length&&(u=await lJ(l.pop()),u.from&&(u.from=await rs(u.from,cJ(t.runner)))),f.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const p=await i8e(t.runner,f.inputs,l);return Object.assign({},u,await vi({to:t.getAddress(),data:t.interface.encodeFunctionData(f,p)}))},i=async function(...l){const f=await a(...l);return f.length===1?f[0]:f},s=async function(...l){const f=t.runner;Le(aJ(f),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const u=await f.sendTransaction(await n(...l)),p=R0(t.runner);return new _k(t.interface,p,u)},o=async function(...l){const f=Mp(t.runner,"estimateGas");return Le(oJ(f),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await f.estimateGas(await n(...l))},a=async function(...l){const f=Mp(t.runner,"call");Le(sJ(f),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const u=await n(...l);let p="0x";try{p=await f.call(u)}catch(y){throw nk(y)&&y.data?t.interface.makeError(y.data,u):y}const g=r(...l);return t.interface.decodeFunctionResult(g,p)},c=async(...l)=>r(...l).constant?await i(...l):await s(...l);return Ot(c,{name:t.interface.getFunctionName(e),_contract:t,_key:e,getFragment:r,estimateGas:o,populateTransaction:n,send:s,staticCall:i,staticCallResult:a}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const l=t.interface.getFunction(e);return Le(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),l}}),c}function a8e(t,e){const r=function(...i){const s=t.interface.getEvent(e,i);return Le(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:i}}),s},n=function(...i){return new n8e(t,r(...i),i)};return Ot(n,{name:t.interface.getEventName(e),_contract:t,_key:e,getFragment:r}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const i=t.interface.getEvent(e);return Le(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),i}}),n}const L5=Symbol.for("_ethersInternal_contract"),fJ=new WeakMap;function c8e(t,e){fJ.set(t[L5],e)}function Zo(t){return fJ.get(t[L5])}function l8e(t){return t&&typeof t=="object"&&"getTopicFilter"in t&&typeof t.getTopicFilter=="function"&&t.fragment}async function Ik(t,e){let r,n=null;if(Array.isArray(e)){const s=function(o){if(Gr(o,32))return o;const a=t.interface.getEvent(o);return ve(a,"unknown fragment","name",o),a.topicHash};r=e.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else e==="*"?r=[null]:typeof e=="string"?Gr(e,32)?r=[e]:(n=t.interface.getEvent(e),ve(n,"unknown fragment","event",e),r=[n.topicHash]):l8e(e)?r=await e.getTopicFilter():"fragment"in e?(n=e.fragment,r=[n.topicHash]):ve(!1,"unknown event name","event",e);r=r.map(s=>{if(s==null)return null;if(Array.isArray(s)){const o=Array.from(new Set(s.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});const i=r.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:n,tag:i,topics:r}}async function Zm(t,e){const{subs:r}=Zo(t);return r.get((await Ik(t,e)).tag)||null}async function fF(t,e,r){const n=R0(t.runner);Le(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:i,tag:s,topics:o}=await Ik(t,r),{addr:a,subs:c}=Zo(t);let l=c.get(s);if(!l){const u={address:a||t,topics:o},p=I=>{let C=i;if(C==null)try{C=t.interface.getEvent(I.topics[0])}catch{}if(C){const S=C,O=i?t.interface.decodeEventLog(i,I.data,I.topics):[];d_(t,r,O,L=>new r8e(t,L,r,S,I))}else d_(t,r,[],S=>new iJ(t,S,r,I))};let g=[];l={tag:s,listeners:[],start:()=>{g.length||g.push(n.on(u,p))},stop:async()=>{if(g.length==0)return;let I=g;g=[],await Promise.all(I),n.off(u,p)}},c.set(s,l)}return l}let u_=Promise.resolve();async function f8e(t,e,r,n){await u_;const i=await Zm(t,e);if(!i)return!1;const s=i.listeners.length;return i.listeners=i.listeners.filter(({listener:o,once:a})=>{const c=Array.from(r);n&&c.push(n(a?null:o));try{o.call(t,...c)}catch{}return!a}),i.listeners.length===0&&(i.stop(),Zo(t).subs.delete(i.tag)),s>0}async function d_(t,e,r,n){try{await u_}catch{}const i=f8e(t,e,r,n);return u_=i,await i}const E6=["then"];var $$;$$=L5;const jb=class jb{constructor(e,r,n,i){de(this,"target");de(this,"interface");de(this,"runner");de(this,"filters");de(this,$$);de(this,"fallback");ve(typeof e=="string"||vQ(e),"invalid value for Contract target","target",e),n==null&&(n=null);const s=$i.from(r);Ot(this,{target:e,runner:n,interface:s}),Object.defineProperty(this,L5,{value:{}});let o,a=null,c=null;if(i){const u=R0(n);c=new _k(this.interface,u,i)}let l=new Map;if(typeof e=="string")if(Gr(e))a=e,o=Promise.resolve(e);else{const u=Mp(n,"resolveName");if(!U8(u))throw zn("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=u.resolveName(e).then(p=>{if(p==null)throw zn("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Zo(this).addr=p,p})}else o=e.getAddress().then(u=>{if(u==null)throw new Error("TODO");return Zo(this).addr=u,u});c8e(this,{addrPromise:o,addr:a,deployTx:c,subs:l});const f=new Proxy({},{get:(u,p,g)=>{if(typeof p=="symbol"||E6.indexOf(p)>=0)return Reflect.get(u,p,g);try{return this.getEvent(p)}catch(y){if(!Is(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(u,p)=>E6.indexOf(p)>=0?Reflect.has(u,p):Reflect.has(u,p)||this.interface.hasEvent(String(p))});return Ot(this,{filters:f}),Ot(this,{fallback:s.receive||s.fallback?s8e(this):null}),new Proxy(this,{get:(u,p,g)=>{if(typeof p=="symbol"||p in u||E6.indexOf(p)>=0)return Reflect.get(u,p,g);try{return u.getFunction(p)}catch(y){if(!Is(y,"INVALID_ARGUMENT")||y.argument!=="key")throw y}},has:(u,p)=>typeof p=="symbol"||p in u||E6.indexOf(p)>=0?Reflect.has(u,p):u.interface.hasFunction(p)})}connect(e){return new jb(this.target,this.interface,e)}attach(e){return new jb(e,this.interface,this.runner)}async getAddress(){return await Zo(this).addrPromise}async getDeployedCode(){const e=R0(this.runner);Le(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const r=await e.getCode(await this.getAddress());return r==="0x"?null:r}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=R0(this.runner);return Le(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((i,s)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return i(this);n.once("block",o)}catch(a){s(a)}};o()})}deploymentTransaction(){return Zo(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),o8e(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),a8e(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,r,n){r==null&&(r=0),n==null&&(n="latest");const{addr:i,addrPromise:s}=Zo(this),o=i||await s,{fragment:a,topics:c}=await Ik(this,e),l={address:o,topics:c,fromBlock:r,toBlock:n},f=R0(this.runner);return Le(f,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await f.getLogs(l)).map(u=>{let p=a;if(p==null)try{p=this.interface.getEvent(u.topics[0])}catch{}if(p)try{return new Sk(u,this.interface,p)}catch(g){return new nJ(u,g)}return new bx(u,f)})}async on(e,r){const n=await fF(this,"on",e);return n.listeners.push({listener:r,once:!1}),n.start(),this}async once(e,r){const n=await fF(this,"once",e);return n.listeners.push({listener:r,once:!0}),n.start(),this}async emit(e,...r){return await d_(this,e,r,null)}async listenerCount(e){if(e){const i=await Zm(this,e);return i?i.listeners.length:0}const{subs:r}=Zo(this);let n=0;for(const{listeners:i}of r.values())n+=i.length;return n}async listeners(e){if(e){const i=await Zm(this,e);return i?i.listeners.map(({listener:s})=>s):[]}const{subs:r}=Zo(this);let n=[];for(const{listeners:i}of r.values())n=n.concat(i.map(({listener:s})=>s));return n}async off(e,r){const n=await Zm(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(r==null||n.listeners.length===0)&&(n.stop(),Zo(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const r=await Zm(this,e);if(!r)return this;r.stop(),Zo(this).subs.delete(r.tag)}else{const{subs:r}=Zo(this);for(const{tag:n,stop:i}of r.values())i(),r.delete(n)}return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return await this.off(e,r)}static buildClass(e){class r extends jb{constructor(i,s=null){super(i,e,s)}}return r}static from(e,r,n){return n==null&&(n=null),new this(e,r,n)}};let h_=jb;function u8e(){return h_}class Dn extends u8e(){}function f9(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):ve(!1,"unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}class d8e{constructor(e){de(this,"name");Ot(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,r){throw new Error("unsupported coin")}async decodeAddress(e,r){throw new Error("unsupported coin")}}const uJ=new RegExp("^(ipfs)://(.*)$","i"),uF=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),uJ,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var Ad,Y0,Sd,z1,w4,dJ;const mv=class mv{constructor(e,r,n){Ie(this,Sd);de(this,"provider");de(this,"address");de(this,"name");Ie(this,Ad);Ie(this,Y0);Ot(this,{provider:e,address:r,name:n}),ue(this,Ad,null),ue(this,Y0,new Dn(r,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return Q(this,Ad)==null&&ue(this,Ad,(async()=>{try{return await Q(this,Y0).supportsInterface("0x9061b923")}catch(e){if(Is(e,"CALL_EXCEPTION"))return!1;throw ue(this,Ad,null),e}})()),await Q(this,Ad)}async getAddress(e){if(e==null&&(e=60),e===60)try{const s=await qe(this,Sd,z1).call(this,"addr(bytes32)");return s==null||s===bu?null:s}catch(s){if(Is(s,"CALL_EXCEPTION"))return null;throw s}if(e>=0&&e<2147483648){let s=e+2147483648;const o=await qe(this,Sd,z1).call(this,"addr(bytes32,uint)",[s]);if(Gr(o,20))return Qt(o)}let r=null;for(const s of this.provider.plugins)if(s instanceof d8e&&s.supportsCoinType(e)){r=s;break}if(r==null)return null;const n=await qe(this,Sd,z1).call(this,"addr(bytes32,uint)",[e]);if(n==null||n==="0x")return null;const i=await r.decodeAddress(e,n);if(i!=null)return i;Le(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:n}})}async getText(e){const r=await qe(this,Sd,z1).call(this,"text(bytes32,string)",[e]);return r==null||r==="0x"?null:r}async getContentHash(){const e=await qe(this,Sd,z1).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const r=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const i=r[1]==="e3010170"?"ipfs":"ipns",s=parseInt(r[4],16);if(r[5].length===s*2)return`${i}://${aY("0x"+r[2])}`}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===64)return`bzz://${n[1]}`;Le(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const r=await this.getText("avatar");if(r==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:r});for(let n=0;n{if(e&&r==null)return null;if(!Array.isArray(r))throw new Error("not an array");return r.map(n=>t(n))}}function wx(t,e){return r=>{const n={};for(const i in t){let s=i;if(e&&i in e&&!(s in r)){for(const o of e[i])if(o in r){s=o;break}}try{const o=t[i](r[s]);o!==void 0&&(n[i]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";Le(!1,`invalid value for value.${i} (${a})`,"BAD_DATA",{value:r})}}return n}}function h8e(t){switch(t){case!0:case"true":return!0;case!1:case"false":return!1}ve(!1,`invalid boolean; ${JSON.stringify(t)}`,"value",t)}function ty(t){return ve(Gr(t,!0),"invalid data","value",t),t}function Xi(t){return ve(Gr(t,32),"invalid hash","value",t),t}const p8e=wx({address:Qt,blockHash:Xi,blockNumber:or,data:ty,index:or,removed:Dr(h8e,!1),topics:$8(Xi),transactionHash:Xi,transactionIndex:or},{index:["logIndex"]});function v8e(t){return p8e(t)}const g8e=wx({hash:Dr(Xi),parentHash:Xi,parentBeaconBlockRoot:Dr(Xi,null),number:or,timestamp:or,nonce:Dr(ty),difficulty:Pt,gasLimit:Pt,gasUsed:Pt,stateRoot:Dr(Xi,null),receiptsRoot:Dr(Xi,null),blobGasUsed:Dr(Pt,null),excessBlobGas:Dr(Pt,null),miner:Dr(Qt),prevRandao:Dr(Xi,null),extraData:ty,baseFeePerGas:Dr(Pt)},{prevRandao:["mixHash"]});function y8e(t){const e=g8e(t);return e.transactions=t.transactions.map(r=>typeof r=="string"?r:hJ(r)),e}const m8e=wx({transactionIndex:or,blockNumber:or,transactionHash:Xi,address:Qt,topics:$8(Xi),data:ty,index:or,blockHash:Xi},{index:["logIndex"]});function b8e(t){return m8e(t)}const w8e=wx({to:Dr(Qt,null),from:Dr(Qt,null),contractAddress:Dr(Qt,null),index:or,root:Dr(Me),gasUsed:Pt,blobGasUsed:Dr(Pt,null),logsBloom:Dr(ty),blockHash:Xi,hash:Xi,logs:$8(b8e),blockNumber:or,cumulativeGasUsed:Pt,effectiveGasPrice:Dr(Pt),blobGasPrice:Dr(Pt,null),status:Dr(or),type:Dr(or,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function x8e(t){return w8e(t)}function hJ(t){t.to&&Pt(t.to)===dF&&(t.to="0x0000000000000000000000000000000000000000");const e=wx({hash:Xi,index:Dr(or,void 0),type:r=>r==="0x"||r==null?0:or(r),accessList:Dr(Wp,null),blobVersionedHashes:Dr($8(Xi,!0),null),blockHash:Dr(Xi,null),blockNumber:Dr(or,null),transactionIndex:Dr(or,null),from:Qt,gasPrice:Dr(Pt),maxPriorityFeePerGas:Dr(Pt),maxFeePerGas:Dr(Pt),maxFeePerBlobGas:Dr(Pt,null),gasLimit:Pt,to:Dr(Qt,null),value:Pt,nonce:or,data:ty,creates:Dr(Qt,null),chainId:Dr(Pt,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(t);if(e.to==null&&e.creates==null&&(e.creates=d5e(e)),(t.type===1||t.type===2)&&t.accessList==null&&(e.accessList=[]),t.signature?e.signature=wu.from(t.signature):e.signature=wu.from(t),e.chainId==null){const r=e.signature.legacyChainId;r!=null&&(e.chainId=r)}return e.blockHash&&Pt(e.blockHash)===dF&&(e.blockHash=null),e}const E8e="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class xx{constructor(e){de(this,"name");Ot(this,{name:e})}clone(){return new xx(this.name)}}class q8 extends xx{constructor(r,n){r==null&&(r=0);super(`org.ethers.network.plugins.GasCost#${r||0}`);de(this,"effectiveBlock");de(this,"txBase");de(this,"txCreate");de(this,"txDataZero");de(this,"txDataNonzero");de(this,"txAccessListStorageKey");de(this,"txAccessListAddress");const i={effectiveBlock:r};function s(o,a){let c=(n||{})[o];c==null&&(c=a),ve(typeof c=="number",`invalud value for ${o}`,"costs",n),i[o]=c}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),Ot(this,i)}clone(){return new q8(this.effectiveBlock,this)}}class V8 extends xx{constructor(r,n){super("org.ethers.plugins.network.Ens");de(this,"address");de(this,"targetNetwork");Ot(this,{address:r||E8e,targetNetwork:n??1})}clone(){return new V8(this.address,this.targetNetwork)}}var Vw,zw;class C8e extends xx{constructor(r,n){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");Ie(this,Vw);Ie(this,zw);ue(this,Vw,r),ue(this,zw,n)}get url(){return Q(this,Vw)}get processFunc(){return Q(this,zw)}clone(){return this}}Vw=new WeakMap,zw=new WeakMap;const u9=new Map;var mg,bg,_d;const bv=class bv{constructor(e,r){Ie(this,mg);Ie(this,bg);Ie(this,_d);ue(this,mg,e),ue(this,bg,Pt(r)),ue(this,_d,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return Q(this,mg)}set name(e){ue(this,mg,e)}get chainId(){return Q(this,bg)}set chainId(e){ue(this,bg,Pt(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===Pt(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===Pt(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===Pt(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(Q(this,_d).values())}attachPlugin(e){if(Q(this,_d).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Q(this,_d).set(e.name,e.clone()),this}getPlugin(e){return Q(this,_d).get(e)||null}getPlugins(e){return this.plugins.filter(r=>r.name.split("#")[0]===e)}clone(){const e=new bv(this.name,this.chainId);return this.plugins.forEach(r=>{e.attachPlugin(r.clone())}),e}computeIntrinsicGas(e){const r=this.getPlugin("org.ethers.plugins.network.GasCost")||new q8;let n=r.txBase;if(e.to==null&&(n+=r.txCreate),e.data)for(let i=2;i9){let i=BigInt(n[1].substring(0,9));n[1].substring(9).match(/^0+$/)||i++,n[1]=i.toString()}return BigInt(n[0]+n[1])}function pF(t){return new C8e(t,async(e,r,n)=>{n.setHeader("User-Agent","ethers");let i;try{const[s,o]=await Promise.all([n.send(),e()]);i=s;const a=i.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:hF(a.maxFee,9),maxPriorityFeePerGas:hF(a.maxPriorityFee,9)}}catch(s){Le(!1,`error encountered with polygon gas station (${JSON.stringify(n.url)})`,"SERVER_ERROR",{request:n,response:i,error:s})}})}let vF=!1;function A8e(){if(vF)return;vF=!0;function t(e,r,n){const i=function(){const s=new ca(e,r);return n.ensNetwork!=null&&s.attachPlugin(new V8(null,n.ensNetwork)),s.attachPlugin(new q8),(n.plugins||[]).forEach(o=>{s.attachPlugin(o)}),s};ca.register(e,i),ca.register(r,i),n.altNames&&n.altNames.forEach(s=>{ca.register(s,i)})}t("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),t("ropsten",3,{ensNetwork:3}),t("rinkeby",4,{ensNetwork:4}),t("goerli",5,{ensNetwork:5}),t("kovan",42,{ensNetwork:42}),t("sepolia",11155111,{ensNetwork:11155111}),t("holesky",17e3,{ensNetwork:17e3}),t("classic",61,{}),t("classicKotti",6,{}),t("arbitrum",42161,{ensNetwork:1}),t("arbitrum-goerli",421613,{}),t("arbitrum-sepolia",421614,{}),t("base",8453,{ensNetwork:1}),t("base-goerli",84531,{}),t("base-sepolia",84532,{}),t("bnb",56,{ensNetwork:1}),t("bnbt",97,{}),t("linea",59144,{ensNetwork:1}),t("linea-goerli",59140,{}),t("linea-sepolia",59141,{}),t("matic",137,{ensNetwork:1,plugins:[pF("https://gasstation.polygon.technology/v2")]}),t("matic-amoy",80002,{}),t("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[pF("https://gasstation-testnet.polygon.technology/v2")]}),t("optimism",10,{ensNetwork:1,plugins:[]}),t("optimism-goerli",420,{}),t("optimism-sepolia",11155420,{}),t("xdai",100,{ensNetwork:1})}function p_(t){return JSON.parse(JSON.stringify(t))}var zf,qa,Id,kl,wg,h3;class S8e{constructor(e){Ie(this,wg);Ie(this,zf);Ie(this,qa);Ie(this,Id);Ie(this,kl);ue(this,zf,e),ue(this,qa,null),ue(this,Id,4e3),ue(this,kl,-2)}get pollingInterval(){return Q(this,Id)}set pollingInterval(e){ue(this,Id,e)}start(){Q(this,qa)||(ue(this,qa,Q(this,zf)._setTimeout(qe(this,wg,h3).bind(this),Q(this,Id))),qe(this,wg,h3).call(this))}stop(){Q(this,qa)&&(Q(this,zf)._clearTimeout(Q(this,qa)),ue(this,qa,null))}pause(e){this.stop(),e&&ue(this,kl,-2)}resume(){this.start()}}zf=new WeakMap,qa=new WeakMap,Id=new WeakMap,kl=new WeakMap,wg=new WeakSet,h3=async function(){try{const e=await Q(this,zf).getBlockNumber();if(Q(this,kl)===-2){ue(this,kl,e);return}if(e!==Q(this,kl)){for(let r=Q(this,kl)+1;r<=e;r++){if(Q(this,qa)==null)return;await Q(this,zf).emit("block",r)}ue(this,kl,e)}}catch{}Q(this,qa)!=null&&ue(this,qa,Q(this,zf)._setTimeout(qe(this,wg,h3).bind(this),Q(this,Id)))};var Q0,J0,Td;class Tk{constructor(e){Ie(this,Q0);Ie(this,J0);Ie(this,Td);ue(this,Q0,e),ue(this,Td,!1),ue(this,J0,r=>{this._poll(r,Q(this,Q0))})}async _poll(e,r){throw new Error("sub-classes must override this")}start(){Q(this,Td)||(ue(this,Td,!0),Q(this,J0).call(this,-2),Q(this,Q0).on("block",Q(this,J0)))}stop(){Q(this,Td)&&(ue(this,Td,!1),Q(this,Q0).off("block",Q(this,J0)))}pause(e){this.stop()}resume(){this.start()}}Q0=new WeakMap,J0=new WeakMap,Td=new WeakMap;var xg,Hf;class _8e extends Tk{constructor(r,n){super(r);Ie(this,xg);Ie(this,Hf);ue(this,xg,n),ue(this,Hf,-2)}pause(r){r&&ue(this,Hf,-2),super.pause(r)}async _poll(r,n){const i=await n.getBlock(Q(this,xg));i!=null&&(Q(this,Hf)===-2?ue(this,Hf,i.number):i.number>Q(this,Hf)&&(n.emit(Q(this,xg),i.number),ue(this,Hf,i.number)))}}xg=new WeakMap,Hf=new WeakMap;var x4;class I8e extends Tk{constructor(r,n){super(r);Ie(this,x4);ue(this,x4,p_(n))}async _poll(r,n){throw new Error("@TODO")}}x4=new WeakMap;var Eg;class T8e extends Tk{constructor(r,n){super(r);Ie(this,Eg);ue(this,Eg,n)}async _poll(r,n){const i=await n.getTransactionReceipt(Q(this,Eg));i&&n.emit(Q(this,Eg),i)}}Eg=new WeakMap;var Gf,Cg,Ag,Pd,Va,E4,pJ;class Pk{constructor(e,r){Ie(this,E4);Ie(this,Gf);Ie(this,Cg);Ie(this,Ag);Ie(this,Pd);Ie(this,Va);ue(this,Gf,e),ue(this,Cg,p_(r)),ue(this,Ag,qe(this,E4,pJ).bind(this)),ue(this,Pd,!1),ue(this,Va,-2)}start(){Q(this,Pd)||(ue(this,Pd,!0),Q(this,Va)===-2&&Q(this,Gf).getBlockNumber().then(e=>{ue(this,Va,e)}),Q(this,Gf).on("block",Q(this,Ag)))}stop(){Q(this,Pd)&&(ue(this,Pd,!1),Q(this,Gf).off("block",Q(this,Ag)))}pause(e){this.stop(),e&&ue(this,Va,-2)}resume(){this.start()}}Gf=new WeakMap,Cg=new WeakMap,Ag=new WeakMap,Pd=new WeakMap,Va=new WeakMap,E4=new WeakSet,pJ=async function(e){if(Q(this,Va)===-2)return;const r=p_(Q(this,Cg));r.fromBlock=Q(this,Va)+1,r.toBlock=e;const n=await Q(this,Gf).getLogs(r);if(n.length===0){Q(this,Va){if(n==null)return"null";if(typeof n=="bigint")return`bigint:${n.toString()}`;if(typeof n=="string")return n.toLowerCase();if(typeof n=="object"&&!Array.isArray(n)){const i=Object.keys(n);return i.sort(),i.reduce((s,o)=>(s[o]=n[o],s),{})}return n})}class vJ{constructor(e){de(this,"name");Ot(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function M8e(t){return JSON.parse(JSON.stringify(t))}function v_(t){return t=Array.from(new Set(t).values()),t.sort(),t}async function d9(t,e){if(t==null)throw new Error("invalid event");if(Array.isArray(t)&&(t={topics:t}),typeof t=="string")switch(t){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:t,tag:t}}if(Gr(t,32)){const r=t.toLowerCase();return{type:"transaction",tag:p3("tx",{hash:r}),hash:r}}if(t.orphan){const r=t;return{type:"orphan",tag:p3("orphan",r),filter:M8e(r)}}if(t.address||t.topics){const r=t,n={topics:(r.topics||[]).map(i=>i==null?null:Array.isArray(i)?v_(i.map(s=>s.toLowerCase())):i.toLowerCase())};if(r.address){const i=[],s=[],o=a=>{Gr(a)?i.push(a):s.push((async()=>{i.push(await rs(a,e))})())};Array.isArray(r.address)?r.address.forEach(o):o(r.address),s.length&&await Promise.all(s),n.address=v_(i.map(a=>a.toLowerCase()))}return{filter:n,tag:p3("event",n),type:"event"}}ve(!1,"unknown ProviderEvent","event",t)}function h9(){return new Date().getTime()}const R8e={cacheTimeout:250,pollingInterval:4e3};var xs,kd,Es,Sg,ra,Z0,Md,Wf,Hw,za,_g,Ig,br,Jo,g_,y_,Xm,m_,eb,v3;class gJ{constructor(e,r){Ie(this,br);Ie(this,xs);Ie(this,kd);Ie(this,Es);Ie(this,Sg);Ie(this,ra);Ie(this,Z0);Ie(this,Md);Ie(this,Wf);Ie(this,Hw);Ie(this,za);Ie(this,_g);Ie(this,Ig);if(ue(this,Ig,Object.assign({},R8e,r||{})),e==="any")ue(this,Z0,!0),ue(this,ra,null);else if(e){const n=ca.from(e);ue(this,Z0,!1),ue(this,ra,Promise.resolve(n)),setTimeout(()=>{this.emit("network",n,null)},0)}else ue(this,Z0,!1),ue(this,ra,null);ue(this,Wf,-1),ue(this,Md,new Map),ue(this,xs,new Map),ue(this,kd,new Map),ue(this,Es,null),ue(this,Sg,!1),ue(this,Hw,1),ue(this,za,new Map),ue(this,_g,!1)}get pollingInterval(){return Q(this,Ig).pollingInterval}get provider(){return this}get plugins(){return Array.from(Q(this,kd).values())}attachPlugin(e){if(Q(this,kd).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return Q(this,kd).set(e.name,e.connect(this)),this}getPlugin(e){return Q(this,kd).get(e)||null}get disableCcipRead(){return Q(this,_g)}set disableCcipRead(e){ue(this,_g,!!e)}async ccipReadFetch(e,r,n){if(this.disableCcipRead||n.length===0||e.to==null)return null;const i=e.to.toLowerCase(),s=r.toLowerCase(),o=[];for(let a=0;a=500,`response not found during CCIP fetch: ${u}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:c,errorMessage:u}}),o.push(u)}Le(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:n,errorMessages:o}})}_wrapBlock(e,r){return new Z4e(y8e(e),this)}_wrapLog(e,r){return new bx(v8e(e),this)}_wrapTransactionReceipt(e,r){return new eJ(x8e(e),this)}_wrapTransactionResponse(e,r){return new Cw(hJ(e),this)}_detectNetwork(){Le(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Le(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=or(await qe(this,br,Jo).call(this,{method:"getBlockNumber"}),"%response");return Q(this,Wf)>=0&&ue(this,Wf,e),e}_getAddress(e){return rs(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Gr(e))return Gr(e,32)?e:zc(e);if(typeof e=="bigint"&&(e=or(e,"blockTag")),typeof e=="number")return e>=0?zc(e):Q(this,Wf)>=0?zc(Q(this,Wf)+e):this.getBlockNumber().then(r=>zc(r+e));ve(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const r=(e.topics||[]).map(c=>c==null?null:Array.isArray(c)?v_(c.map(l=>l.toLowerCase())):c.toLowerCase()),n="blockHash"in e?e.blockHash:void 0,i=(c,l,f)=>{let u;switch(c.length){case 0:break;case 1:u=c[0];break;default:c.sort(),u=c}if(n&&(l!=null||f!=null))throw new Error("invalid filter");const p={};return u&&(p.address=u),r.length&&(p.topics=r),l&&(p.fromBlock=l),f&&(p.toBlock=f),n&&(p.blockHash=n),p};let s=[];if(e.address)if(Array.isArray(e.address))for(const c of e.address)s.push(this._getAddress(c));else s.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),s.filter(c=>typeof c!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(s),o,a]).then(c=>i(c[0],c[1],c[2])):i(s,o,a)}_getTransactionRequest(e){const r=Ew(e),n=[];if(["to","from"].forEach(i=>{if(r[i]==null)return;const s=rs(r[i],this);C6(s)?n.push(async function(){r[i]=await s}()):r[i]=s}),r.blockTag!=null){const i=this._getBlockTag(r.blockTag);C6(i)?n.push(async function(){r.blockTag=await i}()):r.blockTag=i}return n.length?async function(){return await Promise.all(n),r}():r}async getNetwork(){if(Q(this,ra)==null){const i=(async()=>{try{const s=await this._detectNetwork();return this.emit("network",s,null),s}catch(s){throw Q(this,ra)===i&&ue(this,ra,null),s}})();return ue(this,ra,i),(await i).clone()}const e=Q(this,ra),[r,n]=await Promise.all([e,this._detectNetwork()]);return r.chainId!==n.chainId&&(Q(this,Z0)?(this.emit("network",n,r),Q(this,ra)===e&&ue(this,ra,Promise.resolve(n))):Le(!1,`network changed: ${r.chainId} => ${n.chainId} `,"NETWORK_ERROR",{event:"changed"})),r.clone()}async getFeeData(){const e=await this.getNetwork(),r=async()=>{const{_block:i,gasPrice:s,priorityFee:o}=await vi({_block:qe(this,br,m_).call(this,"latest",!1),gasPrice:(async()=>{try{const f=await qe(this,br,Jo).call(this,{method:"getGasPrice"});return Pt(f,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const f=await qe(this,br,Jo).call(this,{method:"getPriorityFee"});return Pt(f,"%response")}catch{}return null})()});let a=null,c=null;const l=this._wrapBlock(i,e);return l&&l.baseFeePerGas&&(c=o??BigInt("1000000000"),a=l.baseFeePerGas*P8e+c),new cF(s,a,c)},n=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(n){const i=new Jl(n.url),s=await n.processFunc(r,this,i);return new cF(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await r()}async estimateGas(e){let r=this._getTransactionRequest(e);return C6(r)&&(r=await r),Pt(await qe(this,br,Jo).call(this,{method:"estimateGas",transaction:r}),"%response")}async call(e){const{tx:r,blockTag:n}=await vi({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await qe(this,br,y_).call(this,qe(this,br,g_).call(this,r,n,e.enableCcipRead?0:-1))}async getBalance(e,r){return Pt(await qe(this,br,Xm).call(this,{method:"getBalance"},e,r),"%response")}async getTransactionCount(e,r){return or(await qe(this,br,Xm).call(this,{method:"getTransactionCount"},e,r),"%response")}async getCode(e,r){return Me(await qe(this,br,Xm).call(this,{method:"getCode"},e,r))}async getStorage(e,r,n){const i=Pt(r,"position");return Me(await qe(this,br,Xm).call(this,{method:"getStorage",position:i},e,n))}async broadcastTransaction(e){const{blockNumber:r,hash:n,network:i}=await vi({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=ww.from(e);if(s.hash!==n)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,i).replaceableTransaction(r)}async getBlock(e,r){const{network:n,params:i}=await vi({network:this.getNetwork(),params:qe(this,br,m_).call(this,e,!!r)});return i==null?null:this._wrapBlock(i,n)}async getTransaction(e){const{network:r,params:n}=await vi({network:this.getNetwork(),params:qe(this,br,Jo).call(this,{method:"getTransaction",hash:e})});return n==null?null:this._wrapTransactionResponse(n,r)}async getTransactionReceipt(e){const{network:r,params:n}=await vi({network:this.getNetwork(),params:qe(this,br,Jo).call(this,{method:"getTransactionReceipt",hash:e})});if(n==null)return null;if(n.gasPrice==null&&n.effectiveGasPrice==null){const i=await qe(this,br,Jo).call(this,{method:"getTransaction",hash:e});if(i==null)throw new Error("report this; could not find tx or effectiveGasPrice");n.effectiveGasPrice=i.gasPrice}return this._wrapTransactionReceipt(n,r)}async getTransactionResult(e){const{result:r}=await vi({network:this.getNetwork(),result:qe(this,br,Jo).call(this,{method:"getTransactionResult",hash:e})});return r==null?null:Me(r)}async getLogs(e){let r=this._getFilter(e);C6(r)&&(r=await r);const{network:n,params:i}=await vi({network:this.getNetwork(),params:qe(this,br,Jo).call(this,{method:"getLogs",filter:r})});return i.map(s=>this._wrapLog(s,n))}_getProvider(e){Le(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await F5.fromName(this,e)}async getAvatar(e){const r=await this.getResolver(e);return r?await r.getAvatar():null}async resolveName(e){const r=await this.getResolver(e);return r?await r.getAddress():null}async lookupAddress(e){e=Qt(e);const r=l_(e.substring(2).toLowerCase()+".addr.reverse");try{const n=await F5.getEnsAddress(this),s=await new Dn(n,["function resolver(bytes32) view returns (address)"],this).resolver(r);if(s==null||s===bu)return null;const a=await new Dn(s,["function name(bytes32) view returns (string)"],this).name(r);return await this.resolveName(a)!==e?null:a}catch(n){if(Is(n,"BAD_DATA")&&n.value==="0x"||Is(n,"CALL_EXCEPTION"))return null;throw n}return null}async waitForTransaction(e,r,n){const i=r??1;return i===0?this.getTransactionReceipt(e):new Promise(async(s,o)=>{let a=null;const c=async l=>{try{const f=await this.getTransactionReceipt(e);if(f!=null&&l-f.blockNumber+1>=i){s(f),a&&(clearTimeout(a),a=null);return}}catch(f){console.log("EEE",f)}this.once("block",c)};n!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",c),o(zn("timeout","TIMEOUT",{reason:"timeout"})))},n)),c(await this.getBlockNumber())})}async waitForBlock(e){Le(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const r=Q(this,za).get(e);r&&(r.timer&&clearTimeout(r.timer),Q(this,za).delete(e))}_setTimeout(e,r){r==null&&(r=0);const n=dm(this,Hw)._++,i=()=>{Q(this,za).delete(n),e()};if(this.paused)Q(this,za).set(n,{timer:null,func:i,time:r});else{const s=setTimeout(i,r);Q(this,za).set(n,{timer:s,func:i,time:h9()})}return n}_forEachSubscriber(e){for(const r of Q(this,xs).values())e(r.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new vJ(e.type);case"block":{const r=new S8e(this);return r.pollingInterval=this.pollingInterval,r}case"safe":case"finalized":return new _8e(this,e.type);case"event":return new Pk(this,e.filter);case"transaction":return new T8e(this,e.hash);case"orphan":return new I8e(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,r){for(const n of Q(this,xs).values())if(n.subscriber===e){n.started&&n.subscriber.stop(),n.subscriber=r,n.started&&r.start(),Q(this,Es)!=null&&r.pause(Q(this,Es));break}}async on(e,r){const n=await qe(this,br,v3).call(this,e);return n.listeners.push({listener:r,once:!1}),n.started||(n.subscriber.start(),n.started=!0,Q(this,Es)!=null&&n.subscriber.pause(Q(this,Es))),this}async once(e,r){const n=await qe(this,br,v3).call(this,e);return n.listeners.push({listener:r,once:!0}),n.started||(n.subscriber.start(),n.started=!0,Q(this,Es)!=null&&n.subscriber.pause(Q(this,Es))),this}async emit(e,...r){const n=await qe(this,br,eb).call(this,e,r);if(!n||n.listeners.length===0)return!1;const i=n.listeners.length;return n.listeners=n.listeners.filter(({listener:s,once:o})=>{const a=new cY(this,o?null:s,e);try{s.call(this,...r,a)}catch{}return!o}),n.listeners.length===0&&(n.started&&n.subscriber.stop(),Q(this,xs).delete(n.tag)),i>0}async listenerCount(e){if(e){const n=await qe(this,br,eb).call(this,e);return n?n.listeners.length:0}let r=0;for(const{listeners:n}of Q(this,xs).values())r+=n.length;return r}async listeners(e){if(e){const n=await qe(this,br,eb).call(this,e);return n?n.listeners.map(({listener:i})=>i):[]}let r=[];for(const{listeners:n}of Q(this,xs).values())r=r.concat(n.map(({listener:i})=>i));return r}async off(e,r){const n=await qe(this,br,eb).call(this,e);if(!n)return this;if(r){const i=n.listeners.map(({listener:s})=>s).indexOf(r);i>=0&&n.listeners.splice(i,1)}return(!r||n.listeners.length===0)&&(n.started&&n.subscriber.stop(),Q(this,xs).delete(n.tag)),this}async removeAllListeners(e){if(e){const{tag:r,started:n,subscriber:i}=await qe(this,br,v3).call(this,e);n&&i.stop(),Q(this,xs).delete(r)}else for(const[r,{started:n,subscriber:i}]of Q(this,xs))n&&i.stop(),Q(this,xs).delete(r);return this}async addListener(e,r){return await this.on(e,r)}async removeListener(e,r){return this.off(e,r)}get destroyed(){return Q(this,Sg)}destroy(){this.removeAllListeners();for(const e of Q(this,za).keys())this._clearTimeout(e);ue(this,Sg,!0)}get paused(){return Q(this,Es)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(ue(this,Wf,-1),Q(this,Es)!=null){if(Q(this,Es)==!!e)return;Le(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(r=>r.pause(e)),ue(this,Es,!!e);for(const r of Q(this,za).values())r.timer&&clearTimeout(r.timer),r.time=h9()-r.time}resume(){if(Q(this,Es)!=null){this._forEachSubscriber(e=>e.resume()),ue(this,Es,null);for(const e of Q(this,za).values()){let r=e.time;r<0&&(r=0),e.time=h9(),setTimeout(e.func,r)}}}}xs=new WeakMap,kd=new WeakMap,Es=new WeakMap,Sg=new WeakMap,ra=new WeakMap,Z0=new WeakMap,Md=new WeakMap,Wf=new WeakMap,Hw=new WeakMap,za=new WeakMap,_g=new WeakMap,Ig=new WeakMap,br=new WeakSet,Jo=async function(e){const r=Q(this,Ig).cacheTimeout;if(r<0)return await this._perform(e);const n=p3(e.method,e);let i=Q(this,Md).get(n);return i||(i=this._perform(e),Q(this,Md).set(n,i),setTimeout(()=>{Q(this,Md).get(n)===i&&Q(this,Md).delete(n)},r)),await i},g_=async function(e,r,n){Le(n=0&&r==="latest"&&i.to!=null&&mn(s.data,0,4)==="0x556f1830"){const o=s.data,a=await rs(i.to,this);let c;try{c=L8e(mn(s.data,4))}catch(u){Le(!1,u.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:i,info:{data:o}})}Le(c.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:i,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:c.errorArgs}});const l=await this.ccipReadFetch(i,c.calldata,c.urls);Le(l!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:i,info:{data:s.data,errorArgs:c.errorArgs}});const f={to:a,data:qr([c.selector,B8e([l,c.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:f});try{const u=await qe(this,br,g_).call(this,f,r,n+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},f),result:u}),u}catch(u){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},f),error:u}),u}}throw s}},y_=async function(e){const{value:r}=await vi({network:this.getNetwork(),value:e});return r},Xm=async function(e,r,n){let i=this._getAddress(r),s=this._getBlockTag(n);return(typeof i!="string"||typeof s!="string")&&([i,s]=await Promise.all([i,s])),await qe(this,br,y_).call(this,qe(this,br,Jo).call(this,Object.assign(e,{address:i,blockTag:s})))},m_=async function(e,r){if(Gr(e,32))return await qe(this,br,Jo).call(this,{method:"getBlock",blockHash:e,includeTransactions:r});let n=this._getBlockTag(e);return typeof n!="string"&&(n=await n),await qe(this,br,Jo).call(this,{method:"getBlock",blockTag:n,includeTransactions:r})},eb=async function(e,r){let n=await d9(e,this);return n.type==="event"&&r&&r.length>0&&r[0].removed===!0&&(n=await d9({orphan:"drop-log",log:r[0]},this)),Q(this,xs).get(n.tag)||null},v3=async function(e){const r=await d9(e,this),n=r.tag;let i=Q(this,xs).get(n);return i||(i={subscriber:this._getSubscriber(r),tag:n,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},Q(this,xs).set(n,i)),i};function O8e(t,e){try{const r=b_(t,e);if(r)return Ip(r)}catch{}return null}function b_(t,e){if(t==="0x")return null;try{const r=or(mn(t,e,e+32)),n=or(mn(t,r,r+32));return mn(t,r+32,r+32+n)}catch{}return null}function gF(t){const e=ts(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 D8e(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}const N8e=new Uint8Array([]);function B8e(t){const e=[];let r=0;for(let n=0;n=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const r=mn(t,0,32);Le(mn(r,0,12)===mn(yF,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=mn(r,12);try{const n=[],i=or(mn(t,32,64)),s=or(mn(t,i,i+32)),o=mn(t,i+32);for(let a=0;ae[n]),e}function D1(t,e){if(t.provider)return t.provider;Le(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function mF(t,e){let r=Ew(e);if(r.to!=null&&(r.to=rs(r.to,t)),r.from!=null){const n=r.from;r.from=Promise.all([t.getAddress(),rs(n,t)]).then(([i,s])=>(ve(i.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),i))}else r.from=t.getAddress();return await vi(r)}class z8{constructor(e){de(this,"provider");Ot(this,{provider:e||null})}async getNonce(e){return D1(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await mF(this,e)}async populateTransaction(e){const r=D1(this,"populateTransaction"),n=await mF(this,e);n.nonce==null&&(n.nonce=await this.getNonce("pending")),n.gasLimit==null&&(n.gasLimit=await this.estimateGas(n));const i=await this.provider.getNetwork();if(n.chainId!=null){const o=Pt(n.chainId);ve(o===i.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else n.chainId=i.chainId;const s=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||s)?ve(!1,"eip-1559 transaction do not support gasPrice","tx",e):(n.type===0||n.type===1)&&s&&ve(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){const o=await r.getFeeData();Le(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice)}else{const o=await r.getFeeData();if(n.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const a=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=a,n.maxPriorityFeePerGas=a}else n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(Le(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=o.gasPrice),n.type=0):Le(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(n.type===2||n.type===3)&&(n.maxFeePerGas==null&&(n.maxFeePerGas=o.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await vi(n)}async estimateGas(e){return D1(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return D1(this,"call").call(await this.populateCall(e))}async resolveName(e){return await D1(this,"resolveName").resolveName(e)}async sendTransaction(e){const r=D1(this,"sendTransaction"),n=await this.populateTransaction(e);delete n.from;const i=ww.from(n);return await r.broadcastTransaction(await this.signTransaction(i))}}var Tg,g3;const tR=class tR extends z8{constructor(r,n){super(n);Ie(this,Tg);de(this,"address");Ot(this,{address:r})}async getAddress(){return this.address}connect(r){return new tR(this.address,r)}async signTransaction(r){qe(this,Tg,g3).call(this,"transactions","signTransaction")}async signMessage(r){qe(this,Tg,g3).call(this,"messages","signMessage")}async signTypedData(r,n,i){qe(this,Tg,g3).call(this,"typed-data","signTypedData")}};Tg=new WeakSet,g3=function(r,n){Le(!1,`VoidSigner cannot sign ${r}`,"UNSUPPORTED_OPERATION",{operation:n})};let w_=tR;function F8e(t){return JSON.parse(JSON.stringify(t))}var Ws,Ml,X0,Rd,ep,Pg,mh,x_,E_;class yJ{constructor(e){Ie(this,mh);Ie(this,Ws);Ie(this,Ml);Ie(this,X0);Ie(this,Rd);Ie(this,ep);Ie(this,Pg);ue(this,Ws,e),ue(this,Ml,null),ue(this,X0,qe(this,mh,x_).bind(this)),ue(this,Rd,!1),ue(this,ep,null),ue(this,Pg,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,r){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){Q(this,Rd)||(ue(this,Rd,!0),qe(this,mh,x_).call(this,-2))}stop(){Q(this,Rd)&&(ue(this,Rd,!1),ue(this,Pg,!0),qe(this,mh,E_).call(this),Q(this,Ws).off("block",Q(this,X0)))}pause(e){e&&qe(this,mh,E_).call(this),Q(this,Ws).off("block",Q(this,X0))}resume(){this.start()}}Ws=new WeakMap,Ml=new WeakMap,X0=new WeakMap,Rd=new WeakMap,ep=new WeakMap,Pg=new WeakMap,mh=new WeakSet,x_=async function(e){try{Q(this,Ml)==null&&ue(this,Ml,this._subscribe(Q(this,Ws)));let r=null;try{r=await Q(this,Ml)}catch(s){if(!Is(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(r==null){ue(this,Ml,null),Q(this,Ws)._recoverSubscriber(this,this._recover(Q(this,Ws)));return}const n=await Q(this,Ws).getNetwork();if(Q(this,ep)||ue(this,ep,n),Q(this,ep).chainId!==n.chainId)throw new Error("chaid changed");if(Q(this,Pg))return;const i=await Q(this,Ws).send("eth_getFilterChanges",[r]);await this._emitResults(Q(this,Ws),i)}catch(r){console.log("@TODO",r)}Q(this,Ws).once("block",Q(this,X0))},E_=function(){const e=Q(this,Ml);e&&(ue(this,Ml,null),e.then(r=>{Q(this,Ws).destroyed||Q(this,Ws).send("eth_uninstallFilter",[r])}))};var tp;class j8e extends yJ{constructor(r,n){super(r);Ie(this,tp);ue(this,tp,F8e(n))}_recover(r){return new Pk(r,Q(this,tp))}async _subscribe(r){return await r.send("eth_newFilter",[Q(this,tp)])}async _emitResults(r,n){for(const i of n)r.emit(Q(this,tp),r._wrapLog(i,r._network))}}tp=new WeakMap;class U8e extends yJ{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,r){for(const n of r)e.emit("pending",n)}}const $8e="bigint,boolean,function,number,string,symbol".split(/,/g);function y3(t){if(t==null||$8e.indexOf(typeof t)>=0||typeof t.getAddress=="function")return t;if(Array.isArray(t))return t.map(y3);if(typeof t=="object")return Object.keys(t).reduce((e,r)=>(e[r]=t[r],e),{});throw new Error(`should not happen: ${t} (${typeof t})`)}function q8e(t){return new Promise(e=>{setTimeout(e,t)})}function N1(t){return t&&t.toLowerCase()}function bF(t){return t&&typeof t.pollingInterval=="number"}const mJ={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class p9 extends z8{constructor(r,n){super(r);de(this,"address");n=Qt(n),Ot(this,{address:n})}connect(r){Le(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(r){return await this.populateCall(r)}async sendUncheckedTransaction(r){const n=y3(r),i=[];if(n.from){const o=n.from;i.push((async()=>{const a=await rs(o,this.provider);ve(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=a})())}else n.from=this.address;if(n.gasLimit==null&&i.push((async()=>{n.gasLimit=await this.provider.estimateGas({...n,from:this.address})})()),n.to!=null){const o=n.to;i.push((async()=>{n.to=await rs(o,this.provider)})())}i.length&&await Promise.all(i);const s=this.provider.getRpcTransaction(n);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(r){const n=await this.provider.getBlockNumber(),i=await this.sendUncheckedTransaction(r);return await new Promise((s,o)=>{const a=[1e3,100];let c=0;const l=async()=>{try{const f=await this.provider.getTransaction(i);if(f!=null){s(f.replaceableTransaction(n));return}}catch(f){if(Is(f,"CANCELLED")||Is(f,"BAD_DATA")||Is(f,"NETWORK_ERROR")){f.info==null&&(f.info={}),f.info.sendTransactionHash=i,o(f);return}if(Is(f,"INVALID_ARGUMENT")&&(c++,f.info==null&&(f.info={}),f.info.sendTransactionHash=i,c>10)){o(f);return}this.provider.emit("error",zn("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:f}))}this.provider._setTimeout(()=>{l()},a.pop()||4e3)};l()})}async signTransaction(r){const n=y3(r);if(n.from){const s=await rs(n.from,this.provider);ve(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",r),n.from=s}else n.from=this.address;const i=this.provider.getRpcTransaction(n);return await this.provider.send("eth_signTransaction",[i])}async signMessage(r){const n=typeof r=="string"?Ii(r):r;return await this.provider.send("personal_sign",[Me(n),this.address.toLowerCase()])}async signTypedData(r,n,i){const s=y3(i),o=await uh.resolveNames(r,n,s,async a=>{const c=await rs(a);return ve(c!=null,"TypedData does not support null address","value",a),c});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(uh.getPayload(o.domain,n,o.value))])}async unlock(r){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),r,null])}async _legacySignMessage(r){const n=typeof r=="string"?Ii(r):r;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Me(n)])}}var rp,kg,Kf,Rl,jc,Ha,Co,Gw,C_;class V8e extends gJ{constructor(r,n){super(r,n);Ie(this,Gw);Ie(this,rp);Ie(this,kg);Ie(this,Kf);Ie(this,Rl);Ie(this,jc);Ie(this,Ha);Ie(this,Co);ue(this,kg,1),ue(this,rp,Object.assign({},mJ,n||{})),ue(this,Kf,[]),ue(this,Rl,null),ue(this,Ha,null),ue(this,Co,null);{let s=null;const o=new Promise(a=>{s=a});ue(this,jc,{promise:o,resolve:s})}const i=this._getOption("staticNetwork");typeof i=="boolean"?(ve(!i||r!=="any","staticNetwork cannot be used on special network 'any'","options",n),i&&r!=null&&ue(this,Ha,ca.from(r))):i&&(ve(r==null||i.matches(r),"staticNetwork MUST match network object","options",n),ue(this,Ha,i))}_getOption(r){return Q(this,rp)[r]}get _network(){return Le(Q(this,Ha),"network is not available yet","NETWORK_ERROR"),Q(this,Ha)}async _perform(r){if(r.method==="call"||r.method==="estimateGas"){let i=r.transaction;if(i&&i.type!=null&&Pt(i.type)&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(r=Object.assign({},r,{transaction:Object.assign({},i,{type:void 0})}))}}const n=this.getRpcRequest(r);return n!=null?await this.send(n.method,n.args):super._perform(r)}async _detectNetwork(){const r=this._getOption("staticNetwork");if(r)if(r===!0){if(Q(this,Ha))return Q(this,Ha)}else return r;return Q(this,Co)?await Q(this,Co):this.ready?(ue(this,Co,(async()=>{try{const n=ca.from(Pt(await this.send("eth_chainId",[])));return ue(this,Co,null),n}catch(n){throw ue(this,Co,null),n}})()),await Q(this,Co)):(ue(this,Co,(async()=>{const n={id:dm(this,kg)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:n});let i;try{i=(await this._send(n))[0],ue(this,Co,null)}catch(s){throw ue(this,Co,null),this.emit("debug",{action:"receiveRpcError",error:s}),s}if(this.emit("debug",{action:"receiveRpcResult",result:i}),"result"in i)return ca.from(Pt(i.result));throw this.getRpcError(n,i)})()),await Q(this,Co))}_start(){Q(this,jc)==null||Q(this,jc).resolve==null||(Q(this,jc).resolve(),ue(this,jc,null),(async()=>{for(;Q(this,Ha)==null&&!this.destroyed;)try{ue(this,Ha,await this._detectNetwork())}catch(r){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",zn("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:r}})),await q8e(1e3)}qe(this,Gw,C_).call(this)})())}async _waitUntilReady(){if(Q(this,jc)!=null)return await Q(this,jc).promise}_getSubscriber(r){return r.type==="pending"?new U8e(this):r.type==="event"?this._getOption("polling")?new Pk(this,r.filter):new j8e(this,r.filter):r.type==="orphan"&&r.filter.orphan==="drop-log"?new vJ("orphan"):super._getSubscriber(r)}get ready(){return Q(this,jc)==null}getRpcTransaction(r){const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(i=>{if(r[i]==null)return;let s=i;i==="gasLimit"&&(s="gas"),n[s]=zc(Pt(r[i],`tx.${i}`))}),["from","to","data"].forEach(i=>{r[i]!=null&&(n[i]=Me(r[i]))}),r.accessList&&(n.accessList=Wp(r.accessList)),r.blobVersionedHashes&&(n.blobVersionedHashes=r.blobVersionedHashes.map(i=>i.toLowerCase())),n}getRpcRequest(r){switch(r.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[N1(r.address),r.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[N1(r.address),r.blockTag]};case"getCode":return{method:"eth_getCode",args:[N1(r.address),r.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[N1(r.address),"0x"+r.position.toString(16),r.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[r.signedTransaction]};case"getBlock":if("blockTag"in r)return{method:"eth_getBlockByNumber",args:[r.blockTag,!!r.includeTransactions]};if("blockHash"in r)return{method:"eth_getBlockByHash",args:[r.blockHash,!!r.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[r.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[r.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(r.transaction),r.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(r.transaction)]};case"getLogs":return r.filter&&r.filter.address!=null&&(Array.isArray(r.filter.address)?r.filter.address=r.filter.address.map(N1):r.filter.address=N1(r.filter.address)),{method:"eth_getLogs",args:[r.filter]}}return null}getRpcError(r,n){const{method:i}=r,{error:s}=n;if(i==="eth_estimateGas"&&s.message){const c=s.message;if(!c.match(/revert/i)&&c.match(/insufficient funds/i))return zn("insufficient funds","INSUFFICIENT_FUNDS",{transaction:r.params[0],info:{payload:r,error:s}})}if(i==="eth_call"||i==="eth_estimateGas"){const c=A_(s),l=Ns.getBuiltinCallException(i==="eth_call"?"call":"estimateGas",r.params[0],c?c.data:null);return l.info={error:s,payload:r},l}const o=JSON.stringify(H8e(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return zn("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[i]||"unknown",reason:"rejected",info:{payload:r,error:s}});if(i==="eth_sendRawTransaction"||i==="eth_sendTransaction"){const c=r.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return zn("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:c,info:{error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return zn("nonce has already been used","NONCE_EXPIRED",{transaction:c,info:{error:s}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return zn("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:c,info:{error:s}});if(o.match(/only replay-protected/i))return zn("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:i,info:{transaction:c,info:{error:s}}})}let a=!!o.match(/the method .* does not exist/i);return a||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(a=!0),a?zn("unsupported operation","UNSUPPORTED_OPERATION",{operation:r.method,info:{error:s,payload:r}}):zn("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:r})}send(r,n){if(this.destroyed)return Promise.reject(zn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r}));const i=dm(this,kg)._++,s=new Promise((o,a)=>{Q(this,Kf).push({resolve:o,reject:a,payload:{method:r,params:n,id:i,jsonrpc:"2.0"}})});return qe(this,Gw,C_).call(this),s}async getSigner(r){r==null&&(r=0);const n=this.send("eth_accounts",[]);if(typeof r=="number"){const s=await n;if(r>=s.length)throw new Error("no such account");return new p9(this,s[r])}const{accounts:i}=await vi({network:this.getNetwork(),accounts:n});r=Qt(r);for(const s of i)if(Qt(s)===r)return new p9(this,r);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(n=>new p9(this,n))}destroy(){Q(this,Rl)&&(clearTimeout(Q(this,Rl)),ue(this,Rl,null));for(const{payload:r,reject:n}of Q(this,Kf))n(zn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:r.method}));ue(this,Kf,[]),super.destroy()}}rp=new WeakMap,kg=new WeakMap,Kf=new WeakMap,Rl=new WeakMap,jc=new WeakMap,Ha=new WeakMap,Co=new WeakMap,Gw=new WeakSet,C_=function(){if(Q(this,Rl))return;const r=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");ue(this,Rl,setTimeout(()=>{ue(this,Rl,null);const n=Q(this,Kf);for(ue(this,Kf,[]);n.length;){const i=[n.shift()];for(;n.length&&i.length!==Q(this,rp).batchMaxCount;)if(i.push(n.shift()),JSON.stringify(i.map(o=>o.payload)).length>Q(this,rp).batchMaxSize){n.unshift(i.pop());break}(async()=>{const s=i.length===1?i[0].payload:i.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const o=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:c,payload:l}of i){if(this.destroyed){c(zn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:l.method}));continue}const f=o.filter(u=>u.id===l.id)[0];if(f==null){const u=zn("missing response for request","BAD_DATA",{value:o,info:{payload:l}});this.emit("error",u),c(u);continue}if("error"in f){c(this.getRpcError(l,f));continue}a(f.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of i)a(o)}})()}},r))};var Od;class z8e extends V8e{constructor(r,n){super(r,n);Ie(this,Od);let i=this._getOption("pollingInterval");i==null&&(i=mJ.pollingInterval),ue(this,Od,i)}_getSubscriber(r){const n=super._getSubscriber(r);return bF(n)&&(n.pollingInterval=Q(this,Od)),n}get pollingInterval(){return Q(this,Od)}set pollingInterval(r){if(!Number.isInteger(r)||r<0)throw new Error("invalid interval");ue(this,Od,r),this._forEachSubscriber(n=>{bF(n)&&(n.pollingInterval=Q(this,Od))})}}Od=new WeakMap;var Mg,q$;let Iy=(q$=class extends z8e{constructor(r,n,i){r==null&&(r="http://localhost:8545");super(n,i);Ie(this,Mg);typeof r=="string"?ue(this,Mg,new Jl(r)):ue(this,Mg,r.clone())}_getConnection(){return Q(this,Mg).clone()}async send(r,n){return await this._start(),await super.send(r,n)}async _send(r){const n=this._getConnection();n.body=JSON.stringify(r),n.setHeader("content-type","application/json");const i=await n.send();i.assertOk();let s=i.bodyJson;return Array.isArray(s)||(s=[s]),s}},Mg=new WeakMap,q$);function A_(t){if(t==null)return null;if(typeof t.message=="string"&&t.message.match(/revert/i)&&Gr(t.data))return{message:t.message,data:t.data};if(typeof t=="object"){for(const e in t){const r=A_(t[e]);if(r)return r}return null}if(typeof t=="string")try{return A_(JSON.parse(t))}catch{}return null}function S_(t,e){if(t!=null){if(typeof t.message=="string"&&e.push(t.message),typeof t=="object")for(const r in t)S_(t[r],e);if(typeof t=="string")try{return S_(JSON.parse(t),e)}catch{}}}function H8e(t){const e=[];return S_(t,e),e}var Rg;const rR=class rR extends z8{constructor(r,n){super(n);de(this,"address");Ie(this,Rg);ve(r&&typeof r.sign=="function","invalid private key","privateKey","[ REDACTED ]"),ue(this,Rg,r);const i=yx(this.signingKey.publicKey);Ot(this,{address:i})}get signingKey(){return Q(this,Rg)}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(r){return new rR(Q(this,Rg),r)}async signTransaction(r){r=Ew(r);const{to:n,from:i}=await vi({to:r.to?rs(r.to,this.provider):void 0,from:r.from?rs(r.from,this.provider):void 0});n!=null&&(r.to=n),i!=null&&(r.from=i),r.from!=null&&(ve(Qt(r.from)===this.address,"transaction from address mismatch","tx.from",r.from),delete r.from);const s=ww.from(r);return s.signature=this.signingKey.sign(s.unsignedHash),s.serialized}async signMessage(r){return this.signMessageSync(r)}signMessageSync(r){return this.signingKey.sign(Ak(r)).serialized}async signTypedData(r,n,i){const s=await uh.resolveNames(r,n,i,async o=>{Le(this.provider!=null,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:o}});const a=await this.provider.resolveName(o);return Le(a!=null,"unconfigured ENS name","UNCONFIGURED_NAME",{value:o}),a});return this.signingKey.sign(uh.hash(s.domain,n,s.value)).serialized}};Rg=new WeakMap;let j5=rR;const U5=" !#$%&'()*+,-./<=>?@[]^_`{|}~",G8e=/^[a-z]*$/i;function wF(t,e){let r=97;return t.reduce((n,i)=>(i===e?r++:i.match(G8e)?n.push(String.fromCharCode(r)+i):(r=97,n.push(i)),n),[])}function W8e(t,e){for(let i=U5.length-1;i>=0;i--)t=t.split(U5[i]).join(e.substring(2*i,2*i+2));const r=[],n=t.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(i,s,o,a)=>{if(o)for(let c=parseInt(o);c>=0;c--)r.push(";");else r.push(s.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return wF(wF(r,";"),":")}function K8e(t){return ve(t[0]==="0","unsupported auwl data","data",t),W8e(t.substring(1+2*U5.length),t.substring(1,1+2*U5.length))}class Y8e{constructor(e){de(this,"locale");Ot(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}var Og,Ww,np,Kw,__;class Q8e extends Y8e{constructor(r,n,i){super(r);Ie(this,Kw);Ie(this,Og);Ie(this,Ww);Ie(this,np);ue(this,Og,n),ue(this,Ww,i),ue(this,np,null)}get _data(){return Q(this,Og)}_decodeWords(){return K8e(Q(this,Og))}getWord(r){const n=qe(this,Kw,__).call(this);return ve(r>=0&&r=12&&r.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const n=new Uint8Array(Math.ceil(11*r.length/8));let i=0;for(let l=0;l=0,`invalid mnemonic word at index ${l}`,"mnemonic","[ REDACTED ]");for(let u=0;u<11;u++)f&1<<10-u&&(n[i>>3]|=1<<7-i%8),i++}const s=32*r.length/3,o=r.length/3,a=bJ(o),c=Ue(sc(n.slice(0,s/8)))[0]&a;return ve(c===(n[n.length-1]&a),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),Me(n.slice(0,s/8))}function y9(t,e){ve(t.length%4===0&&t.length>=16&&t.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),e==null&&(e=Rp.wordlist());const r=[0];let n=11;for(let o=0;o8?(r[r.length-1]<<=8,r[r.length-1]|=t[o],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=t[o]>>8-n,r.push(t[o]&X8e(8-n)),n+=3);const i=t.length/4,s=parseInt(sc(t).substring(2,4),16)&bJ(i);return r[r.length-1]<<=i,r[r.length-1]|=s>>8-i,e.join(r.map(o=>e.getWord(o)))}const m9={};class ry{constructor(e,r,n,i,s){de(this,"phrase");de(this,"password");de(this,"wordlist");de(this,"entropy");i==null&&(i=""),s==null&&(s=Rp.wordlist()),kh(e,m9,"Mnemonic"),Ot(this,{phrase:n,password:i,wordlist:s,entropy:r})}computeSeed(){const e=Ii("mnemonic"+this.password,"NFKD");return Mh(Ii(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,r,n){const i=g9(e,n);return e=y9(Ue(i),n),new ry(m9,i,e,r,n)}static fromEntropy(e,r,n){const i=Ue(e,"entropy"),s=y9(i,n);return new ry(m9,Me(i),s,r,n)}static entropyToPhrase(e,r){const n=Ue(e,"entropy");return y9(n,r)}static phraseToEntropy(e,r){return g9(e,r)}static isValidMnemonic(e,r){try{return g9(e,r),!0}catch{}return!1}}/*! MIT License. Copyright 2015-2022 Richard Moore . See LICENSE.txt. */var Ki=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},b9=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},m3,Ba,gl;const eEe={16:10,24:12,32:14},tEe=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Oa=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],A6=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],rEe=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],nEe=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],iEe=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],sEe=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],oEe=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],aEe=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],cEe=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],lEe=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],fEe=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],uEe=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],dEe=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],hEe=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function w9(t){const e=[];for(let r=0;r>2,Ki(this,gl,"f")[o][f%4]=s[f],Ki(this,Ba,"f")[r-o][f%4]=s[f];let a=0,c=i,l;for(;c>16&255]<<24^Oa[l>>8&255]<<16^Oa[l&255]<<8^Oa[l>>24&255]^tEe[a]<<24,a+=1,i!=8)for(let g=1;g>8&255]<<8^Oa[l>>16&255]<<16^Oa[l>>24&255]<<24;for(let g=i/2+1;g>2,p=c%4,Ki(this,gl,"f")[u][p]=s[f],Ki(this,Ba,"f")[r-u][p]=s[f++],c++}for(let f=1;f>24&255]^uEe[l>>16&255]^dEe[l>>8&255]^hEe[l&255]}encrypt(e){if(e.length!=16)throw new TypeError("invalid plaintext size (must be 16 bytes)");const r=Ki(this,gl,"f").length-1,n=[0,0,0,0];let i=w9(e);for(let a=0;a<4;a++)i[a]^=Ki(this,gl,"f")[0][a];for(let a=1;a>24&255]^nEe[i[(c+1)%4]>>16&255]^iEe[i[(c+2)%4]>>8&255]^sEe[i[(c+3)%4]&255]^Ki(this,gl,"f")[a][c];i=n.slice()}const s=new Uint8Array(16);let o=0;for(let a=0;a<4;a++)o=Ki(this,gl,"f")[r][a],s[4*a]=(Oa[i[a]>>24&255]^o>>24)&255,s[4*a+1]=(Oa[i[(a+1)%4]>>16&255]^o>>16)&255,s[4*a+2]=(Oa[i[(a+2)%4]>>8&255]^o>>8)&255,s[4*a+3]=(Oa[i[(a+3)%4]&255]^o)&255;return s}decrypt(e){if(e.length!=16)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const r=Ki(this,Ba,"f").length-1,n=[0,0,0,0];let i=w9(e);for(let a=0;a<4;a++)i[a]^=Ki(this,Ba,"f")[0][a];for(let a=1;a>24&255]^aEe[i[(c+3)%4]>>16&255]^cEe[i[(c+2)%4]>>8&255]^lEe[i[(c+1)%4]&255]^Ki(this,Ba,"f")[a][c];i=n.slice()}const s=new Uint8Array(16);let o=0;for(let a=0;a<4;a++)o=Ki(this,Ba,"f")[r][a],s[4*a]=(A6[i[a]>>24&255]^o>>24)&255,s[4*a+1]=(A6[i[(a+3)%4]>>16&255]^o>>16)&255,s[4*a+2]=(A6[i[(a+2)%4]>>8&255]^o>>8)&255,s[4*a+3]=(A6[i[(a+1)%4]&255]^o)&255;return s}}m3=new WeakMap,Ba=new WeakMap,gl=new WeakMap;class wJ{constructor(e,r,n){if(n&&!(this instanceof n))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new kk(r)},name:{enumerable:!0,value:e}})}}var S6=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},B1=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},tb,_f;class Mk extends wJ{constructor(e,r){if(super("ECC",e,Mk),tb.set(this,void 0),_f.set(this,void 0),r){if(r.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");S6(this,tb,new Uint8Array(r),"f")}else S6(this,tb,new Uint8Array(16),"f");S6(this,_f,this.iv,"f")}get iv(){return new Uint8Array(B1(this,tb,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const r=new Uint8Array(e.length);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let r=15;r>=0;--r)Da(this,La,"f")[r]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(e.length!==16)throw new TypeError("invalid counter initial Uint8Array value length");Da(this,La,"f").set(e)}increment(){for(let e=15;e>=0;e--)if(Da(this,La,"f")[e]===255)Da(this,La,"f")[e]=0;else{Da(this,La,"f")[e]++;break}}encrypt(e){var r,n;const i=new Uint8Array(e);for(let s=0;s16)throw new TypeError("PKCS#7 padding byte out of range");const r=t.length-e;for(let n=0;n0&&(n&n-1)===0,"invalid kdf.N","kdf.N",n),ve(i>0&&s>0,"invalid kdf","kdf",e);const o=ni(t,"crypto.kdfparams.dklen:int!");return ve(o===32,"invalid kdf.dklen","kdf.dflen",o),{name:"scrypt",salt:r,N:n,r:i,p:s,dkLen:64}}else if(e.toLowerCase()==="pbkdf2"){const r=ni(t,"crypto.kdfparams.salt:data!"),n=ni(t,"crypto.kdfparams.prf:string!"),i=n.split("-").pop();ve(i==="sha256"||i==="sha512","invalid kdf.pdf","kdf.pdf",n);const s=ni(t,"crypto.kdfparams.c:int!"),o=ni(t,"crypto.kdfparams.dklen:int!");return ve(o===32,"invalid kdf.dklen","kdf.dklen",o),{name:"pbkdf2",salt:r,count:s,dkLen:o,algorithm:i}}}ve(!1,"unsupported key-derivation function","kdf",e)}function gEe(t,e){const r=JSON.parse(t),n=Ex(e),i=CJ(r);if(i.name==="pbkdf2"){const{salt:u,count:p,dkLen:g,algorithm:y}=i,b=Mh(n,u,p,g,y);return $5(r,b)}Le(i.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:o,r:a,p:c,dkLen:l}=i,f=_y(n,s,o,a,c,l);return $5(r,f)}function EF(t){return new Promise(e=>{setTimeout(()=>{e()},t)})}async function yEe(t,e,r){const n=JSON.parse(t),i=Ex(e),s=CJ(n);if(s.name==="pbkdf2"){r&&(r(0),await EF(0));const{salt:p,count:g,dkLen:y,algorithm:b}=s,I=Mh(i,p,g,y,b);return r&&(r(1),await EF(0)),$5(n,I)}Le(s.name==="scrypt","cannot be reached","UNKNOWN_ERROR",{params:s});const{salt:o,N:a,r:c,p:l,dkLen:f}=s,u=await Sy(i,o,a,c,l,f,r);return $5(n,u)}function AJ(t){const e=t.salt!=null?Ue(t.salt,"options.salt"):da(32);let r=1<<17,n=8,i=1;return t.scrypt&&(t.scrypt.N&&(r=t.scrypt.N),t.scrypt.r&&(n=t.scrypt.r),t.scrypt.p&&(i=t.scrypt.p)),ve(typeof r=="number"&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),ve(typeof n=="number"&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),ve(typeof i=="number"&&i>0&&Number.isSafeInteger(i),"invalid scrypt p parameter","options.p",i),{name:"scrypt",dkLen:32,salt:e,N:r,r:n,p:i}}function SJ(t,e,r,n){const i=Ue(r.privateKey,"privateKey"),s=n.iv!=null?Ue(n.iv,"options.iv"):da(16);ve(s.length===16,"invalid options.iv length","options.iv",n.iv);const o=n.uuid!=null?Ue(n.uuid,"options.uuid"):da(16);ve(o.length===16,"invalid options.uuid length","options.uuid",n.iv);const a=t.slice(0,16),c=t.slice(16,32),l=new ny(a,s),f=Ue(l.encrypt(i)),u=gr(qr([c,f])),p={address:r.address.substring(2).toLowerCase(),id:C6e(o),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Me(s).substring(2)},ciphertext:Me(f).substring(2),kdf:"scrypt",kdfparams:{salt:Me(e.salt).substring(2),n:e.N,dklen:32,p:e.p,r:e.r},mac:u.substring(2)}};if(r.mnemonic){const g=n.client!=null?n.client:`ethers/${tY}`,y=r.mnemonic.path||EJ,b=r.mnemonic.locale||"en",I=t.slice(32,64),C=Ue(r.mnemonic.entropy,"account.mnemonic.entropy"),S=da(16),O=new ny(I,S),L=Ue(O.encrypt(C)),F=new Date,_="UTC--"+(F.getUTCFullYear()+"-"+Tm(F.getUTCMonth()+1,2)+"-"+Tm(F.getUTCDate(),2)+"T"+Tm(F.getUTCHours(),2)+"-"+Tm(F.getUTCMinutes(),2)+"-"+Tm(F.getUTCSeconds(),2)+".0Z")+"--"+p.address;p["x-ethers"]={client:g,gethFilename:_,path:y,locale:b,mnemonicCounter:Me(S).substring(2),mnemonicCiphertext:Me(L).substring(2),version:"0.1"}}return JSON.stringify(p)}function _J(t,e,r){r==null&&(r={});const n=Ex(e),i=AJ(r),s=_y(n,i.salt,i.N,i.r,i.p,64);return SJ(Ue(s),i,t,r)}async function IJ(t,e,r){r==null&&(r={});const n=Ex(e),i=AJ(r),s=await Sy(n,i.salt,i.N,i.r,i.p,64,r.progressCallback);return SJ(Ue(s),i,t,r)}const x9="m/44'/60'/0'/0/0",mEe=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),Zd=2147483648,bEe=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),wEe="0123456789abcdef";function q5(t,e){let r="";for(;t;)r=wEe[t%16]+r,t=Math.trunc(t/16);for(;r.length=0;o-=8)i[33+(o>>3)]=t>>24-o&255;const s=Ue(Cy("sha512",e,i));return{IL:s.slice(0,32),IR:s.slice(32)}}function PJ(t,e){const r=e.split("/");ve(r.length>0,"invalid path","path",e),r[0]==="m"&&(ve(t.depth===0,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${t.depth}`,"path",e),r.shift());let n=t;for(let i=0;i=16&&i.length<=64,"invalid seed","seed","[REDACTED]");const s=Ue(Cy("sha512",mEe,i)),o=new Jd(Me(s.slice(0,32)));return new Mc(Cl,o,"0x00000000",Me(s.slice(32)),"m",0,0,n,null)},Ie(Mc,ip);let Sb=Mc;class Aw extends w_{constructor(r,n,i,s,o,a,c,l,f){super(n,f);de(this,"publicKey");de(this,"fingerprint");de(this,"parentFingerprint");de(this,"chainCode");de(this,"path");de(this,"index");de(this,"depth");kh(r,Cl,"HDNodeVoidWallet"),Ot(this,{publicKey:i});const u=mn(Ay(sc(i)),0,4);Ot(this,{publicKey:i,fingerprint:u,parentFingerprint:s,chainCode:o,path:a,index:c,depth:l})}connect(r){return new Aw(Cl,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,r)}get extendedKey(){return Le(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),I_(qr(["0x0488B21E",q5(this.depth,1),this.parentFingerprint,q5(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return this.path!=null}deriveChild(r){const n=or(r,"index");ve(n<=4294967295,"invalid index","index",n);let i=this.path;i&&(i+="/"+(n&~Zd),n&Zd&&(i+="'"));const{IR:s,IL:o}=TJ(n,this.chainCode,this.publicKey,null),a=Jd.addPoints(o,this.publicKey,!0),c=yx(a);return new Aw(Cl,c,a,this.fingerprint,Me(s),i,n,this.depth+1,this.provider)}derivePath(r){return PJ(this,r)}}function CF(t){try{if(JSON.parse(t).encseed)return!0}catch{}return!1}function AF(t,e){const r=JSON.parse(t),n=Ex(e),i=Qt(ni(r,"ethaddr:string!")),s=xJ(ni(r,"encseed:string!"));ve(s&&s.length%16===0,"invalid encseed","json",t);const o=Ue(Mh(n,n,2e3,32,"sha256")).slice(0,16),a=s.slice(0,16),c=s.slice(16),l=new Mk(o,a),f=pEe(Ue(l.decrypt(c)));let u="";for(let p=0;p{setTimeout(()=>{e()},t)})}var Qw,jl,P_;let V5=(jl=class extends j5{constructor(e,r){typeof e=="string"&&!e.startsWith("0x")&&(e="0x"+e);let n=typeof e=="string"?new Jd(e):e;super(n,r)}connect(e){return new jl(this.signingKey,e)}async encrypt(e,r){const n={address:this.address,privateKey:this.privateKey};return await IJ(n,e,{progressCallback:r})}encryptSync(e){const r={address:this.address,privateKey:this.privateKey};return _J(r,e)}static async fromEncryptedJson(e,r,n){var s;let i=null;return xF(e)?i=await yEe(e,r,n):CF(e)&&(n&&(n(0),await SF(0)),i=AF(e,r),n&&(n(1),await SF(0))),qe(s=jl,Qw,P_).call(s,i)}static fromEncryptedJsonSync(e,r){var i;let n=null;return xF(e)?n=gEe(e,r):CF(e)?n=AF(e,r):ve(!1,"invalid JSON wallet","json","[ REDACTED ]"),qe(i=jl,Qw,P_).call(i,n)}static createRandom(e){const r=Sb.createRandom();return e?r.connect(e):r}static fromPhrase(e,r){const n=Sb.fromPhrase(e);return r?n.connect(r):n}},Qw=new WeakSet,P_=function(e){if(ve(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&e.mnemonic.locale==="en"){const n=ry.fromEntropy(e.mnemonic.entropy),i=Sb.fromMnemonic(n,e.mnemonic.path);if(i.address===e.address&&i.privateKey===e.privateKey)return i;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const r=new jl(e.privateKey);return ve(r.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),r},Ie(jl,Qw),jl);const kJ="3.7.7",xEe=kJ,Ty=typeof Buffer=="function",_F=typeof TextDecoder=="function"?new TextDecoder:void 0,IF=typeof TextEncoder=="function"?new TextEncoder:void 0,EEe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ib=Array.prototype.slice.call(EEe),_6=(t=>{let e={};return t.forEach((r,n)=>e[r]=n),e})(ib),CEe=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Zi=String.fromCharCode.bind(String),TF=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),MJ=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),RJ=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),OJ=t=>{let e,r,n,i,s="";const o=t.length%3;for(let a=0;a255||(n=t.charCodeAt(a++))>255||(i=t.charCodeAt(a++))>255)throw new TypeError("invalid character found");e=r<<16|n<<8|i,s+=ib[e>>18&63]+ib[e>>12&63]+ib[e>>6&63]+ib[e&63]}return o?s.slice(0,o-3)+"===".substring(o):s},Rk=typeof btoa=="function"?t=>btoa(t):Ty?t=>Buffer.from(t,"binary").toString("base64"):OJ,k_=Ty?t=>Buffer.from(t).toString("base64"):t=>{let r=[];for(let n=0,i=t.length;ne?MJ(k_(t)):k_(t),AEe=t=>{if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?Zi(192|e>>>6)+Zi(128|e&63):Zi(224|e>>>12&15)+Zi(128|e>>>6&63)+Zi(128|e&63)}else{var e=65536+(t.charCodeAt(0)-55296)*1024+(t.charCodeAt(1)-56320);return Zi(240|e>>>18&7)+Zi(128|e>>>12&63)+Zi(128|e>>>6&63)+Zi(128|e&63)}},SEe=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,DJ=t=>t.replace(SEe,AEe),PF=Ty?t=>Buffer.from(t,"utf8").toString("base64"):IF?t=>k_(IF.encode(t)):t=>Rk(DJ(t)),Dv=(t,e=!1)=>e?MJ(PF(t)):PF(t),kF=t=>Dv(t,!0),_Ee=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,IEe=t=>{switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),r=e-65536;return Zi((r>>>10)+55296)+Zi((r&1023)+56320);case 3:return Zi((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return Zi((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},NJ=t=>t.replace(_Ee,IEe),BJ=t=>{if(t=t.replace(/\s+/g,""),!CEe.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(t.length&3));let e,r="",n,i;for(let s=0;s>16&255):i===64?Zi(e>>16&255,e>>8&255):Zi(e>>16&255,e>>8&255,e&255);return r},Ok=typeof atob=="function"?t=>atob(RJ(t)):Ty?t=>Buffer.from(t,"base64").toString("binary"):BJ,LJ=Ty?t=>TF(Buffer.from(t,"base64")):t=>TF(Ok(t).split("").map(e=>e.charCodeAt(0))),FJ=t=>LJ(jJ(t)),TEe=Ty?t=>Buffer.from(t,"base64").toString("utf8"):_F?t=>_F.decode(LJ(t)):t=>NJ(Ok(t)),jJ=t=>RJ(t.replace(/[-_]/g,e=>e=="-"?"+":"/")),M_=t=>TEe(jJ(t)),PEe=t=>{if(typeof t!="string")return!1;const e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},UJ=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),$J=function(){const t=(e,r)=>Object.defineProperty(String.prototype,e,UJ(r));t("fromBase64",function(){return M_(this)}),t("toBase64",function(e){return Dv(this,e)}),t("toBase64URI",function(){return Dv(this,!0)}),t("toBase64URL",function(){return Dv(this,!0)}),t("toUint8Array",function(){return FJ(this)})},qJ=function(){const t=(e,r)=>Object.defineProperty(Uint8Array.prototype,e,UJ(r));t("toBase64",function(e){return b3(this,e)}),t("toBase64URI",function(){return b3(this,!0)}),t("toBase64URL",function(){return b3(this,!0)})},kEe=()=>{$J(),qJ()},MF={version:kJ,VERSION:xEe,atob:Ok,atobPolyfill:BJ,btoa:Rk,btoaPolyfill:OJ,fromBase64:M_,toBase64:Dv,encode:Dv,encodeURI:kF,encodeURL:kF,utob:DJ,btou:NJ,decode:M_,isValid:PEe,fromUint8Array:b3,toUint8Array:FJ,extendString:$J,extendUint8Array:qJ,extendBuiltins:kEe},MEe=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),REe=t=>t!=null&&(typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Gr(t)||typeof t=="bigint"),Nv=t=>{const e=t.toString(16);return`${e.length%2===0?"0x":"0x0"}${e}`},sb=(t,e)=>typeof e=="bigint"?{$bigint:e.toString()}:e,OEe=t=>Ue(typeof t=="string"?Oo(t):gr(t)),DEe=(t,e,r)=>Cr(["string","uint256","address","bytes32"],["",e,t,r]),RF=(t,e,r)=>gr(DEe(t,e,r));function z5(){return z5=Object.assign?Object.assign.bind():function(t){for(var e=1;e{const n=new Jl(t);return r&&n.setHeader("Authorization",`BEARER ${r}`),e&&n.setHeader("X-Access-Key",e),n},BEe=t=>{const e=z5({},t.types);return delete e.EIP712Domain,uh.hash(t.domain,e,t.message)},Dk=t=>Ue(BEe(t));function ns(){return ns=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(Bk(i))return Cr(["uint8","uint8","address"],[pp.Address,i.weight,i.address]);if(i.isDynamic){const s=Ue(i.signature);return Cr(["uint8","uint8","address","uint16","bytes"],[pp.DynamicSignature,i.weight,i.address,s.length,s])}return Cr(["uint8","uint8","bytes"],[pp.EOASignature,i.weight,i.signature])});return Cr(["uint16",...new Array(n.length).fill("bytes")],[r,...n])}async function YJ(t,e,r){const n=Cx(e),i=await Promise.all(t.signers.map(async s=>{if(Bk(s))return s;if(s.isDynamic){if(!s.address)throw new Error("Dynamic signature part must have address");if(!Nk(s.address,n,s.signature,r))throw new Error(`Invalid dynamic signature part ${s.address}`);return{address:s.address,weight:s.weight,signature:s.signature}}else return{address:Ax(n,s.signature),weight:s.weight,signature:s.signature}}));return{version:1,payload:e,subdigest:n,config:{version:1,threshold:t.threshold,signers:i}}}function _b(t,e,r,n){if(r.length!==0)throw new Error("Explicit subdigests not supported on v1");let i=0n;const s=t.signers.map(a=>{if(!e.has(a.address))return a;const c=e.get(a.address),l=Ue(c.signature);return i+=BigInt(a.weight),c.isDynamic||l.length!==66?ns({},a,{isDynamic:!0,signature:c.signature,address:a.address}):ns({},a,{isDynamic:!1,signature:c.signature})});return{encoded:Lk({version:1,threshold:t.threshold,signers:s}),weight:i}}const Fk={decode:t=>KJ(t),encode:t=>Lk(t),trim:async t=>t,supportsNoChainId:!0,recover:(t,e,r)=>YJ(t,e,r),encodeSigners:(t,e,r,n)=>_b(t,e,r),hasEnoughSigningPower:(t,e)=>{const{weight:r}=Fk.encodeSigners(t,e,[],0);return r>=BigInt(t.threshold)},chainSignatures:(t,e)=>{throw new Error("Signature chaining not supported on v1")},hashSetImageHash:function(t){throw new Error("Image hash not supported on v1")},signaturesOf(t){return t.signers.filter(e=>e.signature!==void 0).map(e=>({address:e.address,signature:e.signature}))},signaturesOfDecoded:function(t){return t.signers.map(e=>e.signature).filter(e=>e!==void 0)}};var zEe=Object.freeze({__proto__:null,SignaturePartType:pp,isAddressMember:Bk,isUnrecoveredSignatureMember:GJ,isUnrecoveredSignature:WJ,decodeSignature:KJ,encodeSignature:Lk,recoverSignature:YJ,encodeSigners:_b,SignatureCoder:Fk});const jk={isWalletConfig:t=>t.version===1&&t.threshold!==void 0&&t.signers!==void 0,imageHashOf:t=>t.signers.reduce((e,r)=>gr(Ns.defaultAbiCoder().encode(["bytes32","uint8","address"],[e,r.weight,r.address])),Cr(["uint256"],[t.threshold])),hasSubdigest:(t,e)=>!1,isComplete:t=>!0,checkpointOf:t=>0n,signersOf:t=>t.signers.map(e=>({address:e.address,weight:Number(e.weight)})),fromSimple:t=>{if(BigInt(t.checkpoint)!==0n)throw new Error("v1 wallet config does not support checkpoint");if(t.subdigests&&t.subdigests.length>0)throw new Error("v1 wallet config does not support subdigests");return{version:1,threshold:t.threshold,signers:t.signers}},update:{isKindUsed:!0,buildTransaction:(t,e,r,n)=>{const i=new $i([...Ps.mainModule.abi,...Ps.mainModuleUpgradable.abi]),s=[];return(!n||n==="first")&&s.push({to:t,data:i.encodeFunctionData(i.getFunction("updateImplementation"),[r.mainModuleUpgradable]),gasLimit:0,delegateCall:!1,revertOnError:!0,value:0}),s.push({to:t,data:i.encodeFunctionData(i.getFunction("updateImageHash"),[jk.imageHashOf(e)]),gasLimit:0,delegateCall:!1,revertOnError:!0,value:0}),{entrypoint:t,transactions:s}},decodeTransaction:function(t){throw new Error("Function not implemented.")}},toJSON:function(t){const e=t.signers.map(r=>({weight:BigInt(r.weight).toString(),address:r.address}));return JSON.stringify({version:t.version,threshold:BigInt(t.threshold).toString(),signers:e})},fromJSON:function(t){const e=JSON.parse(t),r=e.signers.map(n=>({weight:BigInt(n.weight),address:n.address}));return{version:e.version,threshold:BigInt(e.threshold),signers:r}},editConfig:function(t,e){var r;const n=t.signers.slice();if(e.checkpoint&&BigInt(e.checkpoint)!==0n)throw new Error("v1 wallet config does not support checkpoint");if(e.add)for(const i of e.add)n.find(s=>s.address===i.address)||n.push({weight:i.weight,address:i.address});if(e.remove)for(const i of e.remove){const s=n.findIndex(o=>o.address===i);s>=0&&n.splice(s,1)}return{version:t.version,threshold:(r=e.threshold)!=null?r:t.threshold,signers:n}},buildStubSignature:function(t,e){const r=new Map;for(const[i,s]of e.entries()){r.set(i,{signature:s,isDynamic:!0});const{encoded:o,weight:a}=_b(t,r,[]);if(a>=BigInt(t.threshold))return o}const n=t.signers;for(const{address:i}of n.sort(({weight:s},{weight:o})=>Number(s)-Number(o))){r.set(i,{signature:"0x4e82f02f388a12b5f9d29eaf2452dd040c0ee5804b4e504b4dd64e396c6c781f2c7624195acba242dd825bfd25a290912e3c230841fd55c9a734c4de8d9899451b02",isDynamic:!1});const{encoded:o,weight:a}=_b(t,r,[]);if(a>=BigInt(t.threshold))return o}return _b(t,r,[]).encoded}};var HEe=Object.freeze({__proto__:null,ConfigCoder:jk}),GEe=Object.freeze({__proto__:null});const QJ=1,JJ={version:QJ,factory:"0xf9D09D634Fb818b05149329C1dcCFAeA53639d96",guestModule:"0x02390F3E6E5FD1C6786CB78FD3027C117a9955A7",mainModule:"0xd01F11855bCcb95f88D7A48492F66410d4637313",mainModuleUpgradable:"0x7EFE6cE415956c5f80C6530cC6cc81b4808F6118",walletCreationCode:"0x603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3"};var w0=Object.freeze({__proto__:null,config:HEe,context:GEe,signature:zEe,version:QJ,DeployedWalletContext:JJ});const Uk="0x8713a7c4465f6fbee2b6e9d6646d1d9f83fec929edfc4baf661f3c865bdd04d1";function ZJ(t){return gr(XJ(t))}function XJ(t){return Cr(["bytes32","bytes32"],[Uk,t])}function eZ(t){const e=Ue(t);if(e.length===64&&Me(e.slice(0,32))===Uk)return Me(e.slice(32,64))}function WEe(t){return eZ(t)!==void 0}var KEe=Object.freeze({__proto__:null,SetImageHashPrefix:Uk,hashSetImageHash:ZJ,messageSetImageHash:XJ,decodeMessageSetImageHash:eZ,isMessageSetImageHash:WEe});let Ni=function(t){return t[t.Legacy=0]="Legacy",t[t.Dynamic=1]="Dynamic",t[t.NoChainIdDynamic=2]="NoChainIdDynamic",t[t.Chained=3]="Chained",t}({}),Gn=function(t){return t[t.Signature=0]="Signature",t[t.Address=1]="Address",t[t.DynamicSignature=2]="DynamicSignature",t[t.Node=3]="Node",t[t.Branch=4]="Branch",t[t.Subdigest=5]="Subdigest",t[t.Nested=6]="Nested",t}({});const H5=66;function Op(t){return t.left!==void 0&&t.right!==void 0}function Py(t){return t.tree!==void 0}function Sx(t){return t.unrecovered&&t.signature!==void 0&&t.isDynamic!==void 0}function G5(t){let e=Ue(t),r;const n=(i,s)=>i?i.right?{left:i,right:s}:{left:i.left,right:s}:{left:s};for(;e.length>0;){const i=e[0];switch(e=e.slice(1),i){case Gn.Signature:{const s=e[0],o=Me(e.slice(1,H5+1));r=n(r,{signature:o,weight:s,unrecovered:!0,isDynamic:!1}),e=e.slice(H5+1)}break;case Gn.Address:{const s=e[0],o=Qt(Me(e.slice(1,21)));r=n(r,{address:o,weight:s}),e=e.slice(21)}break;case Gn.DynamicSignature:{const s=e[0],o=Qt(Me(e.slice(1,21))),a=e[21]<<16|e[22]<<8|e[23],c=Me(e.slice(24,24+a));r=n(r,{address:o,signature:c,weight:s,unrecovered:!0,isDynamic:!0}),e=e.slice(24+a)}break;case Gn.Node:{const s=Me(e.slice(0,32));r=n(r,{nodeHash:s}),e=e.slice(32)}break;case Gn.Branch:{const s=e[0]<<16|e[1]<<8|e[2],o=G5(e.slice(3,3+s));r=n(r,o),e=e.slice(3+s)}break;case Gn.Subdigest:{const s=Me(e.slice(0,32));r=n(r,{subdigest:s}),e=e.slice(32)}break;case Gn.Nested:{const s=e[0],o=e[1]<<8|e[2],a=e[3]<<16|e[4]<<8|e[5],c=G5(e.slice(6,6+a));r=n(r,{weight:s,threshold:o,tree:c}),e=e.slice(6+a)}break;default:throw new Error(`Unknown signature part type: ${i}: ${Me(e)}`)}}if(!r)throw new Error("Empty signature tree");return r.right?r:r.left}class tZ extends Error{constructor(e){super(`Invalid signature leaf: ${JSON.stringify(e)}`),this.leaf=e}}async function vp(t,e,r){if(Op(t)){const[n,i]=await Promise.all([vp(t.left,e,r),vp(t.right,e,r)]);return{left:n,right:i}}if(Py(t))return{weight:t.weight,threshold:t.threshold,tree:await vp(t.tree,e,r)};if(Sx(t))if(t.isDynamic){if(!t.address)throw new Error("Dynamic signature leaf without address");if(!await Nk(t.address,e,t.signature,r))throw new tZ(t);return{weight:t.weight,address:t.address,signature:t.signature,subdigest:e}}else return{weight:t.weight,address:Ax(e,t.signature),signature:t.signature,subdigest:e};return t}const bs={concat:(t,e)=>Cr(["bytes","bytes"],[t,e]),node:t=>Cr(["uint8","bytes32"],[Gn.Node,t]),branch:t=>{const e=Ue(t);return Cr(["uint8","uint24","bytes"],[Gn.Branch,e.length,e])},nested:(t,e,r)=>{const n=Ue(r);return Cr(["uint8","uint8","uint16","uint24","bytes"],[Gn.Nested,t,e,n.length,n])},subdigest:t=>Cr(["uint8","bytes32"],[Gn.Subdigest,t]),signature:(t,e)=>Cr(["uint8","uint8","bytes"],[Gn.Signature,t,e]),dynamicSignature:(t,e,r)=>{const n=Ue(r);return Cr(["uint8","uint8","address","uint24","bytes"],[Gn.DynamicSignature,t,e,n.length,n])},address:(t,e)=>Cr(["uint8","uint8","address"],[Gn.Address,t,e])};function Ib(t,e,r,n,i={}){const s=Tb(t.tree,e,r,i);return BigInt(n)===0n?{encoded:Cr(["uint8","uint16","uint32","bytes"],[Ni.NoChainIdDynamic,t.threshold,t.checkpoint,s.encoded]),weight:s.weight}:BigInt(t.threshold)>255n?{encoded:Cr(["uint8","uint16","uint32","bytes"],[Ni.Dynamic,t.threshold,t.checkpoint,s.encoded]),weight:s.weight}:{encoded:Cr(["uint8","uint8","uint32","bytes"],[Ni.Legacy,t.threshold,t.checkpoint,s.encoded]),weight:s.weight}}function Tb(t,e,r,n={}){const i=!n.disableTrim;if(Zc(t)){const s=Tb(t.left,e,r),o=Tb(t.right,e,r),a=Xs(t.left),c=Xs(t.right);return i&&s.weight===0n&&o.weight===0n&&!a&&!c?{encoded:bs.node(Qa(t)),weight:0n}:i&&o.weight===0n&&!c?{encoded:bs.concat(s.encoded,bs.node(Qa(t.right))),weight:s.weight}:i&&s.weight===0n&&!a?{encoded:bs.concat(bs.node(Qa(t.left)),bs.branch(o.encoded)),weight:o.weight}:{encoded:bs.concat(s.encoded,bs.branch(o.encoded)),weight:s.weight+o.weight}}if(Mu(t)){const s=Tb(t.tree,e,r);return i&&s.weight===0n?{encoded:bs.node(Qa(t)),weight:0n}:{encoded:bs.nested(t.weight,t.threshold,s.encoded),weight:s.weight}}if(Ru(t))return{encoded:bs.node(Qa(t)),weight:0n};if(ku(t)){const s=r.includes(t.subdigest);return{encoded:bs.subdigest(t.subdigest),weight:s?MEe:0n}}if(Xs(t))if(e.has(t.address)){const o=e.get(t.address),a=o.signature;return n.forceDynamicEncoding||o.isDynamic?{encoded:bs.dynamicSignature(t.weight,t.address,a),weight:BigInt(t.weight)}:{encoded:bs.signature(t.weight,a),weight:BigInt(t.weight)}}else return{encoded:bs.address(t.weight,t.address),weight:0n};throw new Error(`Invalid topology - unknown error: ${JSON.stringify(t)}`)}function $k(t){return Vk(t)?$k(t.suffix[t.suffix.length-1]):t.config}function qk(t){return t.type!==void 0&&t.decoded!==void 0&&t.version!==void 0&&t.version===2}function _x(t){return t.suffix!==void 0&&Array.isArray(t.suffix)&&t.suffix.every(qk)}function rZ(t){return t.type!==void 0&&t.config!==void 0&&t.digest!==void 0&&t.version!==void 0&&t.version===2}function Vk(t){return t.chain!==void 0&&Array.isArray(t.chain)&&t.chain.every(rZ)}function H8(t){const e=Ue(t),r=e[0];switch(r){case Ni.Legacy:return{version:2,type:Ni.Legacy,decoded:w3(e)};case Ni.Dynamic:return{version:2,type:Ni.Dynamic,decoded:w3(e.slice(1))};case Ni.NoChainIdDynamic:return{version:2,type:Ni.NoChainIdDynamic,decoded:w3(e.slice(1))};case Ni.Chained:return nZ(e);default:throw new Error(`Invalid signature type: ${r}`)}}function w3(t){const e=Ue(t),r=e[0]<<8|e[1],n=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i=G5(e.slice(6));return{threshold:r,checkpoint:n,tree:i}}function nZ(t){const e=Ue(t),r=e[0];if(r!==Ni.Chained)throw new Error(`Expected chained signature type: ${r}`);const n=[];let i=1;for(;iUe(eh(s))),i=Cr(n.map(()=>["uint24","bytes"]).flat(),n.map(s=>[s.length,s]).flat());return Cr(["uint8","bytes"],[Ni.Chained,i])}function eh(t){if(mu(t))return Me(t);if(_x(t)||Vk(t))return G8(eh(t),(t.suffix||[]).map(eh));const e=qk(t)?t.decoded:t.config;switch(t.type){case Ni.Legacy:if(BigInt(e.threshold)>255n)throw new Error(`Legacy signature threshold is too large: ${e.threshold} (max 255)`);return R_(e);case Ni.NoChainIdDynamic:case Ni.Dynamic:return Cr(["uint8","bytes"],[t.type,R_(e)]);case Ni.Chained:throw new Error("Unreachable code: Chained signature should be handled above");default:throw new Error(`Invalid signature type: ${t.type}`)}}function R_(t){return Cr(["uint16","uint32","bytes"],[t.threshold,t.checkpoint,Pb(t.tree)])}function Pb(t){if(Zc(t)||Op(t)){const e=Ue(Pb(t.right)),r=Ue(Pb(t.left));return Zc(t.right)||Op(t.right)?Cr(["bytes","uint8","uint24","bytes"],[r,Gn.Branch,e.length,e]):Cr(["bytes","bytes"],[r,e])}if(Mu(t)||Py(t)){const e=Ue(Pb(t.tree));return Cr(["uint8","uint8","uint16","uint24","bytes"],[Gn.Nested,t.weight,t.threshold,e.length,e])}if(Sx(t)||Xs(t)&&t.signature!==void 0){const e=Ue(t.signature);if(t.isDynamic||e.length!==H5){if(!t.address)throw new Error("Dynamic signature leaf must have address");return Cr(["uint8","uint8","address","uint24","bytes"],[Gn.DynamicSignature,t.weight,t.address,e.length,e])}else return Cr(["uint8","uint8","bytes"],[Gn.Signature,t.weight,e])}if(Xs(t))return Cr(["uint8","uint8","address"],[Gn.Address,t.weight,t.address]);if(Ru(t))return Cr(["uint8","bytes32"],[Gn.Node,t.nodeHash]);if(ku(t))return Cr(["uint8","bytes32"],[Gn.Subdigest,t.subdigest]);throw new Error(`Unknown signature tree type: ${t}`)}function kb(t){return Zc(t)?[...kb(t.left),...kb(t.right)]:Mu(t)?kb(t.tree):Xs(t)&&t.signature?[{address:t.address,signature:t.signature}]:[]}function Mb(t){return Op(t)?[...Mb(t.left),...Mb(t.right)]:Py(t)?Mb(t.tree):Sx(t)?[t.signature]:[]}function x3(t){return Op(t)?[...x3(t.left),...x3(t.right)]:Py(t)?x3(t.tree):ku(t)?[t.subdigest]:[]}async function W5(t){const e=typeof t=="string"?H8(t):t;if(_x(e)){const n=await Promise.all([W5(ns({},e,{suffix:void 0})),...e.suffix.map(i=>W5(i))]);return G8(n[0],n.slice(1))}const{trimmed:r}=await Rb(e.decoded.tree);return eh(ns({},e,{decoded:ns({},e.decoded,{tree:r})}))}async function Rb(t,e=!0){if(Op(t)){const[r,n]=await Promise.all([Rb(t.left),Rb(t.right)]);if(r.weight===0&&n.weight===0)try{const i=await vp(t,Zg,void 0);return{weight:0,trimmed:{nodeHash:Qa(i)}}}catch{}else return{weight:r.weight+n.weight,trimmed:{left:r.trimmed,right:n.trimmed}}}if(Py(t)){const r=await Rb(t.tree);if(r.weight===0)try{const n=await vp(t,Zg,void 0);return{weight:0,trimmed:{nodeHash:Qa(n)}}}catch{}return{weight:r.weight,trimmed:{weight:t.weight,threshold:t.threshold,tree:r.trimmed}}}return Ru(t)&&aZ(t.nodeHash)?{weight:0,trimmed:ns({},oZ(t.nodeHash))}:Sx(t)||Xs(t)&&t.signature!==void 0?{weight:Number(t.weight),trimmed:t}:!e&&ku(t)?{weight:1/0,trimmed:t}:{weight:0,trimmed:t}}const W8={decode:t=>H8(t),encode:t=>eh(t),trim:t=>W5(t),supportsNoChainId:!0,recover:(t,e,r)=>zk(t,e,r),encodeSigners:(t,e,r,n)=>Ib(t,e,r,n),hasEnoughSigningPower:(t,e)=>{const{weight:r}=W8.encodeSigners(t,e,[],0);return r>=BigInt(t.threshold)},chainSignatures:(t,e)=>{const r=e.reverse(),n=mu(t)?t:eh(t),i=r.map(s=>mu(s)?s:eh(s));return G8(n,i)},hashSetImageHash:function(t){return ZJ(t)},signaturesOf(t){return kb(t.tree)},signaturesOfDecoded:function(t){return Mb(t.decoded.tree)}};var YEe=Object.freeze({__proto__:null,SignatureType:Ni,SignaturePartType:Gn,SignaturePartTypeLength:H5,isUnrecoveredNode:Op,isUnrecoveredNestedLeaf:Py,isUnrecoveredSignatureLeaf:Sx,decodeSignatureTree:G5,InvalidSignatureLeafError:tZ,recoverTopology:vp,partEncoder:bs,encodeSigners:Ib,encodeTree:Tb,deepestConfigOfSignature:$k,isUnrecoveredSignature:qk,isUnrecoveredChainedSignature:_x,isSignature:rZ,isChainedSignature:Vk,decodeSignature:H8,decodeSignatureBody:w3,decodeChainedSignature:nZ,setImageHashStruct:iZ,recoverSignature:zk,encodeChain:G8,encodeSignature:eh,encodeSignatureBody:R_,encodeSignatureTree:Pb,signaturesOf:kb,signaturesOfDecoded:Mb,subdigestsOfDecoded:x3,trimSignature:W5,trimUnrecoveredTree:Rb,SignatureCoder:W8});function Xs(t){return t.address!==void 0&&t.weight!==void 0}function ku(t){return t.subdigest!==void 0&&t.address===void 0}function Ob(t){return Zc(t)?JSON.stringify({left:Ob(t.left),right:Ob(t.right)}):Mu(t)?JSON.stringify({weight:BigInt(t.weight).toString(),threshold:BigInt(t.threshold).toString(),tree:Ob(t.tree)}):Xs(t)?JSON.stringify({address:t.address,weight:BigInt(t.weight).toString()}):JSON.stringify(t)}function Db(t){const e=typeof t=="string"?JSON.parse(t):t;return e.left!==void 0&&e.right!==void 0?{left:Db(e.left),right:Db(e.right)}:e.weight!==void 0&&e.threshold!==void 0&&e.tree!==void 0?{weight:BigInt(e.weight),threshold:BigInt(e.threshold),tree:Db(e.tree)}:e.address!==void 0&&e.weight!==void 0?{address:e.address,weight:BigInt(e.weight)}:e}function Mu(t){return t.tree!==void 0&&t.weight!==void 0&&t.threshold!==void 0}function Ru(t){return t.nodeHash!==void 0}function Hk(t){return Xs(t)||ku(t)||Mu(t)||Ru(t)}function Zc(t){return t.left!==void 0&&t.right!==void 0}function QEe(t){return Zc(t)||Hk(t)}function sZ(t){return Cr(["uint96","address"],[t.weight,t.address])}function oZ(t){const e=Ue(t);if(e.length!==32)throw new Error("Invalid encoded string length");const r=BigInt(Me(e.slice(0,12))),n=Qt(Me(e.slice(12)));return{weight:r,address:n}}function aZ(t){const e=Ue(t);return e.length!==32?!1:e.slice(0,11).every(n=>n===0)}function Qa(t){if(Xs(t))return sZ(t);if(ku(t))return dp(["string","bytes32"],[`Sequence static digest: `,t.subdigest]);if(Mu(t)){const e=Qa(t.tree);return dp(["string","bytes32","uint256","uint256"],[`Sequence nested config: @@ -161,7 +161,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho address target, uint256 value, bytes data -)[]`,B_=(t,e)=>{const r=[],n=new $i(Ps.mainModule.abi);for(const i of e){const s=Ue(i.data||"0x");if(i.to===t&&Me(s.slice(0,4))===bZ){const o=s.slice(4),a=Ns.defaultAbiCoder().decode([wZ],o)[0];r.push(...B_(i.to,a.map(c=>ns({},c,{to:c.target}))))}else try{const o=n.decodeFunctionData("execute",s)[0],a=B_(t,o.map(c=>ns({},c.toObject(),{to:c.target})));r.push(...a)}catch{r.push(i)}}return r},Nb=t=>t==null;var bCe=Object.freeze({__proto__:null,MetaTransactionsType:Y8,intendTransactionBundle:lCe,intendedTransactionID:fCe,unpackMetaTransactionsData:uCe,packMetaTransactionsData:hZ,digestOfTransactions:pZ,subdigestOfTransactions:dCe,subdigestOfGuestModuleTransactions:hCe,toSequenceTransactions:vZ,toSequenceTransaction:Qk,isSequenceTransaction:Q8,hasSequenceTransactions:gZ,sequenceTxAbiEncode:Sw,fromTxAbiEncode:pCe,encodeNonce:vCe,decodeNonce:gCe,fromTransactionish:yCe,isTransactionBundle:yZ,isSignedTransactionBundle:mZ,encodeBundleExecData:mCe,selfExecuteSelector:bZ,selfExecuteAbi:wZ,unwind:B_});const xZ="0x608060405234801561001057600080fd5b5060405161124a38038061124a83398101604081905261002f91610124565b600060405161003d906100dd565b604051809103906000f080158015610059573d6000803e3d6000fd5b5090506000816001600160a01b0316638f0684308686866040518463ffffffff1660e01b815260040161008e939291906101fb565b6020604051808303816000875af11580156100ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100d19190610244565b9050806000526001601ff35b610fdc8061026e83390190565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561011b578181015183820152602001610103565b50506000910152565b60008060006060848603121561013957600080fd5b83516001600160a01b038116811461015057600080fd5b6020850151604086015191945092506001600160401b038082111561017457600080fd5b818601915086601f83011261018857600080fd5b81518181111561019a5761019a6100ea565b604051601f8201601f19908116603f011681019083821181831017156101c2576101c26100ea565b816040528281528960208487010111156101db57600080fd5b6101ec836020830160208801610100565b80955050505050509250925092565b60018060a01b0384168152826020820152606060408201526000825180606084015261022e816080850160208701610100565b601f01601f191691909101608001949350505050565b60006020828403121561025657600080fd5b8151801515811461026657600080fd5b939250505056fe608060405234801561001057600080fd5b50610fbc806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c806376be4cea1161005057806376be4cea146100a65780638f068430146100b957806398ef1ed8146100cc57600080fd5b80631c6453271461006c5780633d787b6314610093575b600080fd5b61007f61007a366004610ad4565b6100df565b604051901515815260200160405180910390f35b61007f6100a1366004610ad4565b61023d565b61007f6100b4366004610b3e565b61031e565b61007f6100c7366004610ad4565b6108e1565b61007f6100da366004610ad4565b61096e565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea9061012890889088908890889088908190600401610bc3565b6020604051808303816000875af1925050508015610181575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261017e91810190610c45565b60015b610232573d8080156101af576040519150601f19603f3d011682016040523d82523d6000602084013e6101b4565b606091505b508051600181900361022757816000815181106101d3576101d3610c69565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f0100000000000000000000000000000000000000000000000000000000000000149250610235915050565b600092505050610235565b90505b949350505050565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea906102879088908890889088906001908990600401610bc3565b6020604051808303816000875af19250505080156102e0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526102dd91810190610c45565b60015b610232573d80801561030e576040519150601f19603f3d011682016040523d82523d6000602084013e610313565b606091505b506000915050610235565b600073ffffffffffffffffffffffffffffffffffffffff87163b6060827f64926492649264926492649264926492649264926492649264926492649264928888610369602082610c98565b610375928b9290610cd8565b61037e91610d02565b1490508015610484576000606089828a610399602082610c98565b926103a693929190610cd8565b8101906103b39190610e18565b955090925090508415806103c45750865b1561047d576000808373ffffffffffffffffffffffffffffffffffffffff16836040516103f19190610eb2565b6000604051808303816000865af19150503d806000811461042e576040519150601f19603f3d011682016040523d82523d6000602084013e610433565b606091505b50915091508161047a57806040517f9d0d6e2d0000000000000000000000000000000000000000000000000000000081526004016104719190610f18565b60405180910390fd5b50505b50506104be565b87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294505050505b80806104ca5750600083115b156106bb576040517f1626ba7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b1690631626ba7e90610523908c908690600401610f2b565b602060405180830381865afa92505050801561057a575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261057791810190610f44565b60015b61060f573d8080156105a8576040519150601f19603f3d011682016040523d82523d6000602084013e6105ad565b606091505b50851580156105bc5750600084115b156105db576105d08b8b8b8b8b600161031e565b9450505050506108d7565b806040517f6f2a95990000000000000000000000000000000000000000000000000000000081526004016104719190610f18565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f1626ba7e000000000000000000000000000000000000000000000000000000001480158161065f575086155b801561066b5750600085115b1561068b5761067f8c8c8c8c8c600161031e565b955050505050506108d7565b841580156106965750825b80156106a0575087155b156106af57806000526001601ffd5b94506108d79350505050565b6041871461074b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f5369676e617475726556616c696461746f72237265636f7665725369676e657260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610471565b600061075a6020828a8c610cd8565b61076391610d02565b90506000610775604060208b8d610cd8565b61077e91610d02565b905060008a8a604081811061079557610795610c69565b919091013560f81c915050601b81148015906107b557508060ff16601c14155b15610842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5369676e617475726556616c696461746f723a20696e76616c6964207369676e60448201527f617475726520762076616c7565000000000000000000000000000000000000006064820152608401610471565b6040805160008152602081018083528e905260ff831691810191909152606081018490526080810183905273ffffffffffffffffffffffffffffffffffffffff8e169060019060a0016020604051602081039080840390855afa1580156108ad573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff161496505050505050505b9695505050505050565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea9061092b9088908890889088906001908990600401610bc3565b6020604051808303816000875af115801561094a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102329190610c45565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea906109b790889088908890889088908190600401610bc3565b6020604051808303816000875af1925050508015610a10575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610a0d91810190610c45565b60015b610232573d808015610a3e576040519150601f19603f3d011682016040523d82523d6000602084013e610a43565b606091505b5080516001819003610a6257816000815181106101d3576101d3610c69565b8082fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a8857600080fd5b50565b60008083601f840112610a9d57600080fd5b50813567ffffffffffffffff811115610ab557600080fd5b602083019150836020828501011115610acd57600080fd5b9250929050565b60008060008060608587031215610aea57600080fd5b8435610af581610a66565b935060208501359250604085013567ffffffffffffffff811115610b1857600080fd5b610b2487828801610a8b565b95989497509550505050565b8015158114610a8857600080fd5b60008060008060008060a08789031215610b5757600080fd5b8635610b6281610a66565b955060208701359450604087013567ffffffffffffffff811115610b8557600080fd5b610b9189828a01610a8b565b9095509350506060870135610ba581610b30565b91506080870135610bb581610b30565b809150509295509295509295565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a060408201528360a0820152838560c0830137600060c085830181019190915292151560608201529015156080820152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016909101019392505050565b600060208284031215610c5757600080fd5b8151610c6281610b30565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b81810381811115610cd2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b60008085851115610ce857600080fd5b83861115610cf557600080fd5b5050820193919092039150565b80356020831015610cd2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610d7e57600080fd5b813567ffffffffffffffff80821115610d9957610d99610d3e565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715610ddf57610ddf610d3e565b81604052838152866020858801011115610df857600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215610e2d57600080fd5b8335610e3881610a66565b9250602084013567ffffffffffffffff80821115610e5557600080fd5b610e6187838801610d6d565b93506040860135915080821115610e7757600080fd5b50610e8486828701610d6d565b9150509250925092565b60005b83811015610ea9578181015183820152602001610e91565b50506000910152565b60008251610ec4818460208701610e8e565b9190910192915050565b60008151808452610ee6816020860160208601610e8e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610c626020830184610ece565b8281526040602082015260006102356040830184610ece565b600060208284031215610f5657600080fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c6257600080fdfea26469706673582212201a72aed4b15ffb05b6502997a9bb655992e06590bd26b336dfbb153d7ff6f34b64736f6c63430008120033",wCe="0x6492649264926492649264926492649264926492649264926492649264926492";async function EZ(t,e,r,n){try{return await t.call({data:qr([xZ,Ns.defaultAbiCoder().encode(["address","bytes32","bytes"],[e,r,n])])})==="0x01"}catch{return!1}}var xCe=Object.freeze({__proto__:null,EIP_6492_OFFCHAIN_DEPLOY_CODE:xZ,EIP_6492_SUFFIX:wCe,validateEIP6492Offchain:EZ});class ECe{constructor(e){this.provider=e,this.isDeployedCache=new Set}module(e){return new Dn(e,[...Ps.mainModuleUpgradable.abi,...Ps.mainModule.abi,...Ps.erc1271.abi],this.provider)}async isDeployed(e){if(this.isDeployedCache.has(e))return!0;const n=(await this.provider.getCode(e).then(i=>Ue(i))).length!==0;return n&&this.isDeployedCache.add(e),n}async implementation(e){const r=Ns.defaultAbiCoder().encode(["address"],[e]),n=await this.provider.getStorage(e,r).then(i=>Ue(i));if(n.length===20)return Qt(Me(n));if(n.length===32)return Ns.defaultAbiCoder().decode(["address"],n)[0]}async imageHash(e){try{return await this.module(e).imageHash()}catch{}}async nonce(e,r=0){try{return await this.module(e).readNonce(r)}catch(n){if(!await this.isDeployed(e))return 0;throw n}}async isValidSignature(e,r,n){return EZ(this.provider,e,r,n)}}var CCe=Object.freeze({__proto__:null,OnChainReader:ECe});function ACe(t){return t&&t.address&&t.digest&&t.chainId!==void 0&&t.config}var mt=Object.freeze({__proto__:null,config:nCe,signature:LEe,context:cCe,signer:VEe,EIP1271:UEe,transaction:bCe,reader:CCe,EIP6492:xCe,isWalletSignRequestMetadata:ACe});const L_=[{config:jk,signature:Fk},{config:K8,signature:W8}];function CZ(t){const e=t-1;if(e<0||e>=L_.length)throw new Error(`No coder for version: ${t}`);return L_[e]}function SCe(t){return CZ(t)}var As=Object.freeze({__proto__:null,ALL_CODERS:L_,coderFor:CZ,genericCoderFor:SCe});const _Ce=[w0,ir];function ICe(t,e,r){for(let n=0;ne.version)&&(e=r);if(e===void 0)throw new Error("No migrations");return e}async getAllMigratePresignedTransaction(e){const{address:r,fromImageHash:n,fromVersion:i,chainId:s}=e;let o=n,a=i;const c=Object.values(this.contexts),l=[];for(let f=1;fUe(s).length===0))return NF;if(!n.provider)throw new Error("signer.provider is not set, but is required");return n.provider.estimateGas({from:e,to:i.to,data:i.data,value:i.value})}))).map(i=>({executed:!0,succeeded:!0,gasUsed:Number(i),gasLimit:Number(i)}))}async getNonce(e,r,n){if(!this.provider)throw new Error("provider is not set");if(await this.provider.getCode(e)==="0x")return 0;r===void 0&&(r=0);const s=await new Dn(e,Ps.mainModule.abi,this.provider).readNonce(r,{blockTag:n});return mt.transaction.encodeNonce(r,s)}async wait(e,r,n=this.waitPollRate,i=5){var s=this;typeof e!="string"&&(e=mt.transaction.intendedTransactionID(e));let o=!1;const a=async function(f,u){let p=0;for(;!o;){try{return await f()}catch(g){if(p++,i!==void 0&&p>=i)throw Ci.error(`giving up after ${p} failed attempts${u?`: ${u}`:""}`,g),g;Ci.warn(`attempt #${p} failed${u?`: ${u}`:""}`,g)}n>0&&await new Promise(g=>setTimeout(g,n))}throw new Error(`timed out after ${p} failed attempts${u?`: ${u}`:""}`)},c=async function(){let f=s.fromBlockLog;if(f<0&&(f=await a(()=>s.provider.getBlockNumber(),"unable to get latest block number")+f),typeof e!="string")throw new Error("impossible");const u=e.replace("0x","");for(;!o;){const p=await a(()=>s.provider.getBlockNumber(),"unable to get latest block number"),g=await a(()=>s.provider.getLogs({fromBlock:Math.max(0,f-s.deltaBlocksLog),toBlock:p,topics:["0x1f180c27086c7a39ea2a7b25239d1ab92348f07ca7bb59d1438fcf527568f881"]}),`unable to get NonceChange logs for blocks ${Math.max(0,f-s.deltaBlocksLog)} to ${p}`);f=p;const b=(await Promise.all(g.map(I=>a(()=>s.provider.getTransactionReceipt(I.transactionHash),`unable to get receipt for transaction ${I.transactionHash}`)))).find(I=>I==null?void 0:I.logs.find(C=>C.topics.length===0&&C.data.replace("0x","")===u||C.topics.length===1&&C.topics[0]==="0x3dbd1590ea96dd3253a91f24e64e3a502e1225d602a5731357bc12643070ccd7"&&C.data.length>=64&&C.data.replace("0x","").startsWith(u)));if(b){const I=await a(()=>s.provider.getTransaction(b.hash),`unable to get transaction ${b.hash}`);if(!I)throw new Error(`Transaction response not found for ${e}`);const C=I;return C.receipt=b,C}o||await new Promise(I=>setTimeout(I,n))}throw new Error(`Timeout waiting for transaction receipt ${e}`)};return r!==void 0?Promise.race([c(),new Promise((l,f)=>setTimeout(()=>{o=!0,f(`Timeout waiting for transaction receipt ${e}`)},r))]):c()}}class BF extends NCe{constructor(e){if(super(LF(e)?{provider:e.provider}:Dp({},e,{provider:e.signer.provider})),this.signer=void 0,this.txnOptions=void 0,this.signer=LF(e)?e:e.signer,!this.signer.provider)throw new Error("Signer must have a provider")}async getFeeOptions(e,...r){return{options:[]}}async getFeeOptionsRaw(e,r,n){return{options:[]}}async gasRefundOptions(e,...r){const{options:n}=await this.getFeeOptions(e,...r);return n}setTransactionOptions(e){this.txnOptions=e}async relay(e,r,n=!0){r!==void 0&&Ci.warn("LocalRelayer doesn't accept fee quotes");const i=mt.transaction.encodeBundleExecData(e),s=this.signer.sendTransaction(Dp({to:e.entrypoint,data:i},this.txnOptions,{gasLimit:9e6}));if(n){const o=await s;return o.receipt=await o.wait(),o}else return s}}function LF(t){return t&&typeof t=="object"&&typeof t.provider=="object"&&typeof t.getAddress=="function"&&typeof t.connect=="function"}const BCe="v1",LCe="v0.4.1",FCe="1e27d0fd295aa5897878939595ef0c6adc54b1a3";let Ld=function(t){return t.UNKNOWN="UNKNOWN",t.DROPPED="DROPPED",t.QUEUED="QUEUED",t.SENT="SENT",t.SUCCEEDED="SUCCEEDED",t.PARTIALLY_FAILED="PARTIALLY_FAILED",t.FAILED="FAILED",t}({}),jCe=function(t){return t.SEND="SEND",t.RECEIVE="RECEIVE",t.BRIDGE_DEPOSIT="BRIDGE_DEPOSIT",t.BRIDGE_WITHDRAW="BRIDGE_WITHDRAW",t.BURN="BURN",t.UNKNOWN="UNKNOWN",t}({}),UCe=function(t){return t.UNKNOWN="UNKNOWN",t.ERC20_TOKEN="ERC20_TOKEN",t.ERC1155_TOKEN="ERC1155_TOKEN",t}({}),$Ce=function(t){return t.DESC="DESC",t.ASC="ASC",t}({});class SZ{constructor(e,r){this.hostname=void 0,this.fetch=void 0,this.path="/rpc/Relayer/",this.ping=(n,i)=>this.fetch(this.url("Ping"),Qr({},n,i)).then(s=>Jr(s).then(o=>({status:o.status})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.version=(n,i)=>this.fetch(this.url("Version"),Qr({},n,i)).then(s=>Jr(s).then(o=>({version:o.version})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.runtimeStatus=(n,i)=>this.fetch(this.url("RuntimeStatus"),Qr({},n,i)).then(s=>Jr(s).then(o=>({status:o.status})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.getSequenceContext=(n,i)=>this.fetch(this.url("GetSequenceContext"),Qr({},n,i)).then(s=>Jr(s).then(o=>({data:o.data})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.getChainID=(n,i)=>this.fetch(this.url("GetChainID"),Qr({},n,i)).then(s=>Jr(s).then(o=>({chainID:o.chainID})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.sendMetaTxn=(n,i,s)=>this.fetch(this.url("SendMetaTxn"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,txnHash:a.txnHash})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTxnNonce=(n,i,s)=>this.fetch(this.url("GetMetaTxnNonce"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({nonce:a.nonce})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTxnReceipt=(n,i,s)=>this.fetch(this.url("GetMetaTxnReceipt"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({receipt:a.receipt})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.simulate=(n,i,s)=>this.fetch(this.url("Simulate"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({results:a.results})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.updateMetaTxnGasLimits=(n,i,s)=>this.fetch(this.url("UpdateMetaTxnGasLimits"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({payload:a.payload})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.feeTokens=(n,i)=>this.fetch(this.url("FeeTokens"),Qr({},n,i)).then(s=>Jr(s).then(o=>({isFeeRequired:o.isFeeRequired,tokens:o.tokens})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.feeOptions=(n,i,s)=>this.fetch(this.url("FeeOptions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({options:a.options,sponsored:a.sponsored,quote:a.quote})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTxnNetworkFeeOptions=(n,i,s)=>this.fetch(this.url("GetMetaTxnNetworkFeeOptions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({options:a.options})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTransactions=(n,i,s)=>this.fetch(this.url("GetMetaTransactions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.sentTransactions=(n,i,s)=>this.fetch(this.url("SentTransactions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.pendingTransactions=(n,i,s)=>this.fetch(this.url("PendingTransactions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getGasTank=(n,i,s)=>this.fetch(this.url("GetGasTank"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({gasTank:a.gasTank})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.addGasTank=(n,i,s)=>this.fetch(this.url("AddGasTank"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasTank:a.gasTank})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.updateGasTank=(n,i,s)=>this.fetch(this.url("UpdateGasTank"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasTank:a.gasTank})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getGasSponsor=(n,i,s)=>this.fetch(this.url("GetGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({gasSponsor:a.gasSponsor})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.addressGasSponsors=(n,i,s)=>this.fetch(this.url("AddressGasSponsors"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,gasSponsors:a.gasSponsors})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.listGasSponsors=(n,i,s)=>this.fetch(this.url("ListGasSponsors"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,gasSponsors:a.gasSponsors})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.addGasSponsor=(n,i,s)=>this.fetch(this.url("AddGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasSponsor:a.gasSponsor})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.updateGasSponsor=(n,i,s)=>this.fetch(this.url("UpdateGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasSponsor:a.gasSponsor})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.removeGasSponsor=(n,i,s)=>this.fetch(this.url("RemoveGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.reportGasSponsorUsage=(n,i,s)=>this.fetch(this.url("ReportGasSponsorUsage"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({gasSponsorUsage:a.gasSponsorUsage})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.nextGasTankBalanceAdjustmentNonce=(n,i,s)=>this.fetch(this.url("NextGasTankBalanceAdjustmentNonce"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({nonce:a.nonce})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.adjustGasTankBalance=(n,i,s)=>this.fetch(this.url("AdjustGasTankBalance"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,adjustment:a.adjustment})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getGasTankBalanceAdjustment=(n,i,s)=>this.fetch(this.url("GetGasTankBalanceAdjustment"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({adjustment:a.adjustment})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.listGasTankBalanceAdjustments=(n,i,s)=>this.fetch(this.url("ListGasTankBalanceAdjustments"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,adjustments:a.adjustments})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.hostname=e,this.fetch=(n,i)=>r(n,i)}url(e){return this.hostname+this.path+e}}const Qr=(t={},e={},r=null)=>({method:"POST",headers:Dp({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),Jr=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let i="";throw n instanceof Error&&(i=n.message),Jk.new({status:t.status,cause:`JSON.parse(): ${i}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(VCe[n]||fi).new(r)}return r});let fi=class _Z extends Error{constructor(e,r,n,i,s){super(n),this.name=void 0,this.code=void 0,this.message=void 0,this.status=void 0,this.cause=void 0,this.msg=void 0,this.name=e||"WebrpcError",this.code=typeof r=="number"?r:0,this.message=n||`endpoint error ${this.code}`,this.msg=this.message,this.status=typeof i=="number"?i:0,this.cause=s,Object.setPrototypeOf(this,_Z.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}},IZ=class TZ extends fi{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,TZ.prototype)}},Ur=class PZ extends fi{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,PZ.prototype)}},kZ=class MZ extends fi{constructor(e="WebrpcBadRoute",r=-2,n="bad route",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,MZ.prototype)}},RZ=class OZ extends fi{constructor(e="WebrpcBadMethod",r=-3,n="bad method",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,OZ.prototype)}},DZ=class NZ extends fi{constructor(e="WebrpcBadRequest",r=-4,n="bad request",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,NZ.prototype)}},Jk=class BZ extends fi{constructor(e="WebrpcBadResponse",r=-5,n="bad response",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,BZ.prototype)}},LZ=class FZ extends fi{constructor(e="WebrpcServerPanic",r=-6,n="server panic",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,FZ.prototype)}},jZ=class UZ extends fi{constructor(e="WebrpcInternalError",r=-7,n="internal error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,UZ.prototype)}},$Z=class qZ extends fi{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,qZ.prototype)}},VZ=class zZ extends fi{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,zZ.prototype)}},HZ=class GZ extends fi{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,GZ.prototype)}};class J8 extends fi{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,J8.prototype)}}class Z8 extends fi{constructor(e="PermissionDenied",r=1001,n="Permission denied",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Z8.prototype)}}class X8 extends fi{constructor(e="MethodNotFound",r=1003,n="Method not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,X8.prototype)}}class eE extends fi{constructor(e="Aborted",r=1005,n="Request aborted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,eE.prototype)}}let WZ=class KZ extends fi{constructor(e="InvalidArgument",r=2001,n="Invalid argument",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,KZ.prototype)}};class tE extends fi{constructor(e="Unavailable",r=2002,n="Unavailable resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,tE.prototype)}}class rE extends fi{constructor(e="QueryFailed",r=2003,n="Query failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,rE.prototype)}}let YZ=class QZ extends fi{constructor(e="NotFound",r=3e3,n="Resource not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,QZ.prototype)}},qCe=function(t){return t.WebrpcEndpoint="WebrpcEndpoint",t.WebrpcRequestFailed="WebrpcRequestFailed",t.WebrpcBadRoute="WebrpcBadRoute",t.WebrpcBadMethod="WebrpcBadMethod",t.WebrpcBadRequest="WebrpcBadRequest",t.WebrpcBadResponse="WebrpcBadResponse",t.WebrpcServerPanic="WebrpcServerPanic",t.WebrpcInternalError="WebrpcInternalError",t.WebrpcClientDisconnected="WebrpcClientDisconnected",t.WebrpcStreamLost="WebrpcStreamLost",t.WebrpcStreamFinished="WebrpcStreamFinished",t.Unauthorized="Unauthorized",t.PermissionDenied="PermissionDenied",t.MethodNotFound="MethodNotFound",t.Aborted="Aborted",t.InvalidArgument="InvalidArgument",t.Unavailable="Unavailable",t.QueryFailed="QueryFailed",t.NotFound="NotFound",t}({});const VCe={0:IZ,[-1]:Ur,[-2]:kZ,[-3]:RZ,[-4]:DZ,[-5]:Jk,[-6]:LZ,[-7]:jZ,[-8]:$Z,[-9]:VZ,[-10]:HZ,1e3:J8,1001:Z8,1003:X8,1005:eE,2001:WZ,2002:tE,2003:rE,3e3:YZ};var Q5=Object.freeze({__proto__:null,WebRPCVersion:BCe,WebRPCSchemaVersion:LCe,WebRPCSchemaHash:FCe,ETHTxnStatus:Ld,TransferType:jCe,FeeTokenType:UCe,SortOrder:$Ce,Relayer:SZ,WebrpcError:fi,WebrpcEndpointError:IZ,WebrpcRequestFailedError:Ur,WebrpcBadRouteError:kZ,WebrpcBadMethodError:RZ,WebrpcBadRequestError:DZ,WebrpcBadResponseError:Jk,WebrpcServerPanicError:LZ,WebrpcInternalErrorError:jZ,WebrpcClientDisconnectedError:$Z,WebrpcStreamLostError:VZ,WebrpcStreamFinishedError:HZ,UnauthorizedError:J8,PermissionDeniedError:Z8,MethodNotFoundError:X8,AbortedError:eE,InvalidArgumentError:WZ,UnavailableError:tE,QueryFailedError:rE,NotFoundError:YZ,errors:qCe});const zCe=[Ld.DROPPED,Ld.SUCCEEDED,Ld.PARTIALLY_FAILED,Ld.FAILED],HCe=[Ld.DROPPED,Ld.PARTIALLY_FAILED,Ld.FAILED],GCe=globalThis.fetch;class WCe{constructor(e){if(this.options=e,this.service=void 0,this.provider=void 0,this._fetch=(r,n)=>{const i={},{jwtAuth:s,projectAccessKey:o}=this.options;return s&&s.length>0&&(i.Authorization=`BEARER ${s}`),o&&o.length>0&&(i["X-Access-Key"]=o),n.headers=Dp({},n.headers,i),GCe(r,n)},this.service=new SZ(e.url,this._fetch),YCe(e.provider))this.provider=e.provider;else{const{jwtAuth:r,projectAccessKey:n}=this.options,i=VJ(e.provider.url,n,r);this.provider=new Iy(i,void 0,{staticNetwork:!0})}}async waitReceipt(e,r=1e3,n=5,i){typeof e!="string"&&(e=mt.transaction.intendedTransactionID(e)),Ci.info(`[rpc-relayer/waitReceipt] waiting for ${e}`);let s=0;for(;i===void 0||!i();){try{const{receipt:o}=await this.service.getMetaTxnReceipt({metaTxID:e});if(o&&o.txnReceipt&&o.txnReceipt!=="null"&&zCe.includes(o.status))return{receipt:o}}catch(o){if(s++,s===n)throw o}(i===void 0||!i())&&await new Promise(o=>setTimeout(o,r))}throw new Error(`Cancelled waiting for transaction receipt ${e}`)}async simulate(e,...r){const i=Ns.defaultAbiCoder().encode([mt.transaction.MetaTransactionsType],[mt.transaction.sequenceTxAbiEncode(r)]);return(await this.service.simulate({wallet:e,transactions:i})).results}async getFeeOptions(e,...r){const n=await this.service.feeTokens();if(n.isFeeRequired){const i=n.tokens.map(c=>c.symbol).join(", ");Ci.info(`[rpc-relayer/getFeeOptions] relayer fees are required, accepted tokens are ${i}`);const s=await this.getNonce(e);if(!this.provider)throw Ci.warn("[rpc-relayer/getFeeOptions] provider not set, needed for stub signature"),new Error("provider is not set");const{options:o,quote:a}=await this.service.feeOptions({wallet:e,to:e,data:mt.transaction.encodeBundleExecData({entrypoint:e,transactions:r,nonce:s})});return Ci.info(`[rpc-relayer/getFeeOptions] got refund options ${JSON.stringify(o,sb)}`),{options:o,quote:{_tag:"FeeQuote",_quote:a}}}else return Ci.info("[rpc-relayer/getFeeOptions] relayer fees are not required"),{options:[]}}async getFeeOptionsRaw(e,r,n){const{options:i,quote:s}=await this.service.feeOptions({wallet:e,to:e,data:Me(r),simulate:n==null?void 0:n.simulate});return{options:i,quote:{_tag:"FeeQuote",_quote:s}}}async gasRefundOptions(e,...r){const{options:n}=await this.getFeeOptions(e,...r);return n}async getNonce(e,r){Ci.info(`[rpc-relayer/getNonce] get nonce for wallet ${e} space: ${r}`);const n=r!==void 0?Nv(BigInt(r)):void 0,i=await this.service.getMetaTxnNonce({walletContractAddress:e,space:n}),s=BigInt(i.nonce),[o,a]=mt.transaction.decodeNonce(s);return Ci.info(`[rpc-relayer/getNonce] got next nonce for wallet ${e} ${a} space: ${o}`),s}async relay(e,r,n=!0){var i=this;Ci.info(`[rpc-relayer/relay] relaying signed meta-transactions ${JSON.stringify(e,sb)} with quote ${JSON.stringify(r,sb)}`);let s;if(r!==void 0&&(typeof r._quote=="string"?s=r._quote:Ci.warn("[rpc-relayer/relay] ignoring invalid fee quote")),!this.provider)throw Ci.warn("[rpc-relayer/relay] provider not set, failed relay"),new Error("provider is not set");const o=mt.transaction.encodeBundleExecData(e),a=await this.service.sendMetaTxn({call:{walletAddress:e.intent.wallet,contract:e.entrypoint,input:o},quote:s});if(Ci.info(`[rpc-relayer/relay] got relay result ${JSON.stringify(a,sb)}`),n)return this.wait(e.intent.id);{const c={hash:e.intent.id,confirmations:0,from:e.intent.wallet,wait:f=>Promise.reject(new Error("impossible"))},l=async function(u){var p;if(!i.provider)throw new Error("cannot wait for receipt, relayer has no provider set");const g=await i.wait(e.intent.id),y=(p=g.receipt)==null?void 0:p.transactionHash;if(!y)throw new Error("cannot wait for receipt, unknown native transaction hash");return Object.assign(c,g),i.provider.waitForTransaction(y,u)};return c.wait=l,c}}async wait(e,r,n=1e3,i=5){var s=this;let o=!1;const{receipt:a}=await(r!==void 0?Promise.race([this.waitReceipt(e,n,i,()=>o),new Promise((l,f)=>setTimeout(()=>{o=!0,f(`Timeout waiting for transaction receipt ${e}`)},r))]):this.waitReceipt(e,n,i));if(!a.txnReceipt||HCe.includes(a.status))throw new KCe(a);const c=JSON.parse(a.txnReceipt);return{blockHash:c.blockHash,blockNumber:Number(c.blockNumber),confirmations:1,from:typeof e=="string"?void 0:e.intent.wallet,hash:c.transactionHash,raw:a.txnReceipt,receipt:c,wait:async function(l){return s.provider.waitForTransaction(c.transactionHash,l)}}}}class KCe{constructor(e){this.receipt=e}}function YCe(t){return t&&typeof t=="object"&&typeof t.getNetwork=="function"&&typeof t.getBlockNumber=="function"}function QCe(t){return typeof t=="object"&&typeof t.simulate=="function"&&typeof t.getFeeOptions=="function"&&typeof t.gasRefundOptions=="function"&&typeof t.getNonce=="function"&&typeof t.relay=="function"&&typeof t.wait=="function"}function JCe(t){return t.getAddress!==void 0&&t.buildDeployTransaction!==void 0&&t.predecorateSignedTransactions!==void 0&&t.decorateTransactions!==void 0&&t.sign!==void 0&&t.notifyStatusChange!==void 0}class ZCe{constructor(e,r=!0){this.signer=e,this.eoa=r}getAddress(){return this.signer.getAddress()}async buildDeployTransaction(e){}async predecorateSignedTransactions(e){return[]}async decorateTransactions(e,r){return e}sign(e){return this.signer.signMessage(e)}notifyStatusChange(e,r,n){}suffix(){return new Uint8Array([2])}}let O0=function(t){return t[t.INITIAL=0]="INITIAL",t[t.SIGNING=1]="SIGNING",t[t.SIGNED=2]="SIGNED",t[t.ERROR=3]="ERROR",t}({});function XCe(t){return t===void 0||t.state===O0.INITIAL||t.state===O0.SIGNING}class nE{constructor(e,r=nE.randomTag()){this.tag=r,this.observers=[],this.signers=[],this.count=0,this.setSigners(e)}static randomTag(){return`default-${Me(da(8)).slice(2)}`}pullId(){return`${this.tag}-${this.count++}`}setSigners(e){this.signers=e.map(r=>JCe(r)?r:new ZCe(r))}async getSigners(){return Promise.all(this.signers.map(async function(e){return e.getAddress()}))}subscribe(e){return this.observers.push(e),()=>{this.observers=this.observers.filter(r=>r!==e)}}async notifyObservers(e,r,n){await Promise.all([...this.signers.map(async function(i){return i.notifyStatusChange(e,r,n)}),...this.observers.map(async function(i){return i(r,n)})])}async buildDeployTransaction(e){let r;for(const n of this.signers){const i=await n.buildDeployTransaction(e);r===void 0?r=i:i!=null&&i.transactions&&(r.transactions=i.transactions.concat(r.transactions))}return r}async predecorateSignedTransactions(e){const r=[];for(const n of this.signers)r.push(...await n.predecorateSignedTransactions(e??{}));return r}async decorateTransactions(e,r){for(const n of this.signers)e=await n.decorateTransactions(e,r??{});return e}signMessage(e){var r=this;const n=this.pullId();return new Promise(async function(i){const{message:s,metadata:o,callback:a,candidates:c}=e,l={ended:!1,message:s,signers:{}};let f=o??{};const u=b=>{f=b,r.notifyObservers(n,l,f)},p=()=>{try{r.notifyObservers(n,l,f);const b=Object.entries(l.signers).filter(([I,C])=>XCe(C));if(a&&a(l,u)||b.length===0){l.ended=!0,i(l),r.notifyObservers(n,l,f);return}}catch(b){console.error("Error while notifying observers",b)}};let g=r.signers;if(c){const b=await Promise.all(r.signers.map(async function(I){return I.getAddress()}));g=r.signers.filter((I,C)=>c.includes(b[C]))}const y=await Promise.allSettled(g.map(async function(b){const I=await b.getAddress();l.signers[I]={state:O0.SIGNING,request:b.sign(s,o??{}).then(C=>{const S=b.suffix();return l.signers[I]={state:O0.SIGNED,signature:C,suffix:S},p(),C}).catch(C=>{throw l.signers[I]={state:O0.ERROR,error:C},p(),C})}}));for(let b=0;bpi(e))):pi(t)}const jF=t=>{const e=new Map;for(const r of Object.keys(t.signers)){const n=t.signers[r];if(n.state===O0.SIGNED){const i=Ue(n.suffix),s=Cr(["bytes","bytes"],[n.signature,i]);e.set(r,{signature:s,isDynamic:i.length!==1||i[0]!==2})}}return e};let UF=class E3 extends z8{constructor(e){var r;if(BigInt(e.chainId)===0n&&!e.coders.signature.supportsNoChainId)throw new Error(`Sequence version ${e.config.version} doesn't support chainId 0`);super((r=e.provider)!=null?r:null),this.context=void 0,this.config=void 0,this.address=void 0,this.chainId=void 0,this.relayer=void 0,this.coders=void 0,this.orchestrator=void 0,this._reader=void 0,this.context=e.context,this.config=e.config,this.orchestrator=e.orchestrator,this.coders=e.coders,this.address=e.address,this.chainId=e.chainId,this.relayer=e.relayer,this._reader=e.reader}static newWallet(e){const r=mt.context.addressOf(e.context,e.coders.config.imageHashOf(e.config));return new E3(ld({},e,{address:r}))}reader(){if(this._reader)return this._reader;if(!this.provider)throw new Error("Wallet status provider requires a provider");return new mt.reader.OnChainReader(this.provider)}setConfig(e){this.config=e}setOrchestrator(e){this.orchestrator=e}setAddress(e){this.address=e}getSigners(){return this.orchestrator.getSigners()}async getAddress(){return this.address}async decorateTransactions(e){const r=await this.orchestrator.decorateTransactions(e);if(await this.reader().isDeployed(this.address))return r;const n=[{to:r.entrypoint,data:mt.transaction.encodeBundleExecData(r),revertOnError:!0}],i=await this.buildDeployTransaction();return i&&n.unshift(...i.transactions),{entrypoint:this.context.guestModule,chainId:this.chainId,intent:r.intent,transactions:n}}async buildDeployTransaction(e){if(e!=null&&e.ignoreDeployed&&await this.reader().isDeployed(this.address))return;const r=this.coders.config.imageHashOf(this.config);if(mt.context.addressOf(this.context,r)!==this.address)throw new Error(`First address of config ${r} doesn't match wallet address ${this.address}`);const n=E3.buildDeployTransaction(this.context,r);if(e!=null&&e.includeChildren){const i=await this.orchestrator.buildDeployTransaction(e);i&&(n.transactions=i.transactions.concat(n.transactions))}return n}async deploy(e){const r=await this.buildDeployTransaction(e);if(r!==void 0){if(!this.relayer)throw new Error("Wallet deploy requires a relayer");return this.relayer.relay(ld({},r,{chainId:this.chainId,intent:{id:Me(da(32)),wallet:this.address}}))}}static buildDeployTransaction(e,r){const n=new $i(Ps.factory.abi);return{entrypoint:e.guestModule,transactions:[{to:e.factory,data:n.encodeFunctionData(n.getFunction("deploy"),[e.mainModule,r]),gasLimit:1e5,delegateCall:!1,revertOnError:!0,value:0}]}}async buildUpdateConfigurationTransaction(e){if(this.coders.config.update.isKindUsed){const r=await this.reader().implementation(this.address),n=r&&r===this.context.mainModuleUpgradable;return this.coders.config.update.buildTransaction(this.address,e,this.context,n?"later":"first")}return this.coders.config.update.buildTransaction(this.address,e,this.context)}async getNonce(e=0){const r=await this.reader().nonce(this.address,e);if(r===void 0)throw new Error("Unable to determine nonce");return Number(r)}async signDigest(e,r){const n=RF(this.address,this.chainId,e);if(this.coders.config.hasSubdigest(this.config,n))return this.coders.signature.encodeSigners(this.config,new Map,[n],this.chainId).encoded;const i=ld({},r,{digest:e,chainId:this.chainId,address:this.address,config:this.config}),s=Ue(n),o=await this.orchestrator.signMessage({candidates:this.coders.config.signersOf(this.config).map(c=>c.address),message:s,metadata:i,callback:(c,l)=>{const f=jF(c),u=ld({},i,{parts:f});return l(u),this.coders.signature.hasEnoughSigningPower(this.config,f)}}),a=jF(o);return this.coders.signature.encodeSigners(this.config,a,[],this.chainId).encoded}signMessage(e){return this.signDigest(gr(e),{message:e})}signTypedData(e,r,n){const i=Dk({domain:e,types:r,message:n});return this.signDigest(i)}signTransactionBundle(e){if(e.entrypoint!==this.address)throw new Error(`Invalid entrypoint: ${e.entrypoint} !== ${this.address}`);return this.signTransactions(e.transactions,e.nonce)}async fetchNonceOrSpace(e){let r;if(e&&e.space!==void 0)r=BigInt(e.space);else{if(e===void 0)return this.randomNonce();if(e&&e.serial===!0)r=0;else return e}const n=await this.reader().nonce(this.address,r);if(n===void 0)throw new Error("Unable to determine nonce");return mt.transaction.encodeNonce(r,n)}randomNonce(){const e=BigInt(Me(da(12)));return mt.transaction.encodeNonce(e,0)}async signTransactions(e,r,n){const i=await FF(e),s=mt.transaction.fromTransactionish(this.address,i);s.length===0&&s.push({to:this.address,data:"0x",value:0,gasLimit:0,delegateCall:!1,revertOnError:!0});const o=await this.fetchNonceOrSpace(r),a=mt.transaction.digestOfTransactions(o,s),c=ld({digest:a,transactions:s},n),l=await this.signDigest(a,c);return{intent:{id:RF(this.address,this.chainId,a),wallet:this.address},chainId:this.chainId,transactions:s,entrypoint:this.address,nonce:o,signature:l}}async sendSignedTransaction(e,r){if(!this.relayer)throw new Error("Wallet sendTransaction requires a relayer");return this.relayer.relay(e,r)}async sendTransaction(e,r){let n;(r==null?void 0:r.nonce)!==void 0?n=r.nonce:r!=null&&r.serial?n={serial:!0}:n=this.randomNonce();const i=await this.signTransactions(e,n),s=await this.decorateTransactions(i);return this.sendSignedTransaction(s,r==null?void 0:r.quote)}async fillGasLimits(e){const r=await FF(e),n=mt.transaction.fromTransactionish(this.address,r),i=this.relayer;if(!i)throw new Error("Wallet fillGasLimits requires a relayer");const s=await i.simulate(this.address,...n);return n.map((o,a)=>{const c=o.gasLimit?Number(o.gasLimit):s[a].gasLimit;return ld({},o,s[a],{gasLimit:c})})}connect(e,r){return new E3({coders:this.coders,context:this.context,config:this.config,chainId:this.chainId,address:this.address,orchestrator:this.orchestrator,reader:this._reader,provider:e,relayer:r??this.relayer})}signTransaction(e){throw new Error("Method not implemented.")}};function Al(){return Al=Object.assign?Object.assign.bind():function(t){for(var e=1;e=BigInt(i.value))return i}else if(i.token.contractAddress&&i.token.type===Q5.FeeTokenType.ERC20_TOKEN&&await new Dn(i.token.contractAddress,n,this.provider).balanceOf(this.account.address)>=BigInt(i.value))return i;throw new Error("No fee option available - not enough balance")}async sendTransaction(e,r){var n,i,s,o,a;const c=await this.account.prepareTransactions({txs:e,chainId:this.chainId,stubSignatureOverrides:(n=(i=this.options)==null?void 0:i.stubSignatureOverrides)!=null?n:new Map,simulateForFeeOptions:r==null?void 0:r.simulateForFeeOptions}),f=await((s=(o=this.options)==null?void 0:o.selectFee)!=null?s:this.defaultSelectFee.bind(this))(e,c.feeOptions),u=[...c.transactions,...eAe(f)];return this.account.sendTransaction(u,this.chainId,c.feeQuote,void 0,void 0,((a=this.options)==null?void 0:a.nonceSpace)!==void 0?{nonceSpace:this.options.nonceSpace}:void 0)}getBalance(e){return this.provider.getBalance(this.account.address,e)}call(e,r){return this.provider.call(Al({},e,{blockTag:r}))}async resolveName(e){const r=await this.provider.resolveName(e);if(!r)throw new Error(`Could not resolve name ${e}`);return r}connect(e){throw new Error("Method not implemented.")}signTransaction(e){throw new Error("Method not implemented.")}getTransactionCount(e){throw new Error("Method not implemented.")}estimateGas(e){throw new Error("Method not implemented.")}getChainId(){return Promise.resolve(Number(this.chainId))}getGasPrice(){throw new Error("Method not implemented.")}getFeeData(){throw new Error("Method not implemented.")}getNonce(e){throw new Error("Method not implemented.")}populateCall(e){throw new Error("Method not implemented.")}checkTransaction(e){throw new Error("Method not implemented.")}async populateTransaction(e){throw new Error("Method not implemented.")}_checkProvider(e){throw new Error("Method not implemented.")}}class rAe{async isDeployed(e){return!1}async implementation(e){}async imageHash(e){}async nonce(e,r){return 0n}async isValidSignature(e,r,n){throw new Error("Method not supported.")}}class Ix{constructor(e){this.address=void 0,this.networks=void 0,this.tracker=void 0,this.contexts=void 0,this.migrator=void 0,this.migrations=void 0,this.orchestrator=void 0,this.jwt=void 0,this.projectAccessKey=void 0,this.address=Qt(e.address),this.contexts=e.contexts,this.tracker=e.tracker,this.networks=e.networks,this.orchestrator=e.orchestrator,this.jwt=e.jwt,this.projectAccessKey=e.projectAccessKey,this.migrations=e.migrations||DF.DefaultMigrations,this.migrator=new OF.Migrator(e.tracker,this.migrations,this.contexts)}getSigner(e,r){return new tAe(this,e,r)}static async new(e){var r;const i=new OF.Migrator(e.tracker,(r=e.migrations)!=null?r:DF.DefaultMigrations,e.contexts).lastMigration(),s=i.configCoder,o=s.fromSimple(e.config),a=s.imageHashOf(o),c=e.contexts[i.version],l=mt.context.addressOf(c,a);return await e.tracker.saveCounterfactualWallet({config:o,context:Object.values(e.contexts)}),new Ix({address:l,tracker:e.tracker,contexts:e.contexts,networks:e.networks,orchestrator:e.orchestrator,migrations:e.migrations,projectAccessKey:e.projectAccessKey})}getAddress(){return Promise.resolve(this.address)}get version(){return this.migrator.lastMigration().version}get coders(){const e=this.migrator.lastMigration();return{signature:e.signatureCoder,config:e.configCoder}}network(e){const r=BigInt(e),n=this.networks.find(i=>r===BigInt(i.chainId));if(!n)throw new Error(`Network not found for chainId ${e}`);return n}providerFor(e){const r=this.network(e);if(!r.provider&&!r.rpcUrl)throw new Error(`Provider not found for chainId ${e}`);const n=new ca(r.name,r.chainId);return r.provider||new Iy(VJ(r.rpcUrl,this.projectAccessKey,this.jwt),n,{staticNetwork:n})}reader(e){return BigInt(e)===0n?new rAe:new mt.reader.OnChainReader(this.providerFor(e))}relayer(e){const r=this.network(e);if(!r.relayer)throw new Error(`Relayer not found for chainId ${e}`);return QCe(r.relayer)?r.relayer:new WCe(Al({},r.relayer,this.projectAccessKey?{projectAccessKey:this.projectAccessKey}:{jwtAuth:this.jwt}))}setOrchestrator(e){this.orchestrator=e}setJwt(e){this.jwt=e}contextFor(e){const r=this.contexts[e];if(!r)throw new Error(`Context not found for version ${e}`);return r}walletForStatus(e,r){const n=As.coderFor(r.version);return this.walletFor(e,this.contextFor(r.version),r.config,n)}walletFor(e,r,n,i){const s=BigInt(e)===0n;return new UF({config:n,context:r,chainId:e,coders:i,relayer:s?void 0:this.relayer(e),address:this.address,orchestrator:this.orchestrator,reader:this.reader(e)})}async status(e,r=!1){var n=this;const i=this.reader(e).isDeployed(this.address),s=this.tracker.imageHashOfCounterfactualWallet({wallet:this.address}).then(F=>{if(!F)throw new Error(`Counterfactual imageHash not found for wallet ${this.address}`);return F}),o=s.then(F=>TCe.counterfactualVersion(this.address,F.imageHash,Object.values(this.contexts))),a=async function(){if(!await i)return o;const z=await n.reader(e).implementation(n.address);if(!z)throw new Error(`Implementation not found for wallet ${n.address}`);const _=Object.values(n.contexts);for(let $=0;$<_.length;$++)if(_[$].mainModule===z||_[$].mainModuleUpgradable===z)return _[$].version;throw new Error(`Version not found for implementation ${z}`)}(),c=async function(){const F=await n.reader(e).imageHash(n.address);if(F)return F;const z=await s;if(z)return z.imageHash;throw new Error(`On-chain imageHash not found for wallet ${n.address}`)}(),l=async function(){const F=await c,z=await n.tracker.configOfImageHash({imageHash:F});if(z)return z;throw new Error(`On-chain config not found for imageHash ${F}`)}(),f=await a,u=await c;let p=u,g=f,y=[];if(f!==this.version){const F=await this.migrator.getAllMigratePresignedTransaction({address:this.address,fromImageHash:u,fromVersion:f,chainId:e});p=F.lastImageHash,g=F.lastVersion,y=F.signedMigrations}const b=await this.tracker.loadPresignedConfiguration({wallet:this.address,fromImageHash:p,longestPath:r}),I=b&&b.length>0?b[b.length-1].nextImageHash:p,C=await this.tracker.configOfImageHash({imageHash:I});if(!C)throw new Error(`Config not found for imageHash ${I}`);const S=await i,O=await s,L=As.coderFor(g).config.checkpointOf(C);return{original:Al({},O,{version:await o}),onChain:{imageHash:u,config:await l,version:f,deployed:S},fullyMigrated:g===this.version,signedMigrations:y,version:g,presignedConfigurations:b,imageHash:I,config:C,checkpoint:L,canOnchainValidate:f===this.version&&S}}mustBeFullyMigrated(e){if(!e.fullyMigrated)throw new Error(`Wallet ${this.address} is not fully migrated`)}async predecorateSignedTransactions(e,r){const n=await this.orchestrator.predecorateSignedTransactions({chainId:r}),i=await this.predecorateTransactions([],e,r);return mt.transaction.fromTransactionish(this.address,i).length>0&&n.push(await this.signTransactions(i,r)),n}async predecorateTransactions(e,r,n){if(r.onChain.imageHash!==r.imageHash){const s=await this.walletForStatus(n,r).buildUpdateConfigurationTransaction(r.config);return[Array.isArray(e)?e:[e],s.transactions].flat()}return e}async decorateTransactions(e,r,n){var i,s;if(!Array.isArray(e))return this.decorateTransactions([e],r,n);n=(i=n)!=null?i:e[0].chainId;const o=await this.buildBootstrapTransactions(r,n),a=o.transactions.length>0;if(!a&&e.length===1)return e[0];const{entrypoint:c}=a?o:e[0],l={entrypoint:c,chainId:n,intent:(s=e[0])==null?void 0:s.intent,transactions:[...o.transactions,...e.map(f=>({to:f.entrypoint,data:mt.transaction.encodeBundleExecData(f),gasLimit:0,delegateCall:!1,revertOnError:!0,value:0}))]};if(!r.onChain.deployed){const f=mt.transaction.subdigestOfGuestModuleTransactions(this.contexts[this.version].guestModule,n,l.transactions);l.intent===void 0?l.intent={id:f,wallet:this.address}:l.intent.id=f}return l}async decorateSignature(e,r){if(!r.presignedConfigurations||r.presignedConfigurations.length===0)return e;const n=this.coders.signature,i=r.presignedConfigurations.map(o=>o.signature),s=n.chainSignatures(e,i);return n.trim(s)}async publishWitnessFor(e,r=0){const n=Oo(`This is a Sequence account woo! ${Date.now()}`),i=await this.status(r),s=this.coders.config.fromSimple({threshold:e.length,checkpoint:0,signers:e.map(f=>({address:f,weight:1}))}),a=await this.walletFor(r,i.original.context,s,this.coders).signDigest(n),c=this.coders.signature.decode(a),l=this.coders.signature.signaturesOfDecoded(c);if(l.length===0)throw new Error("No signatures found");return this.tracker.saveWitnesses({wallet:this.address,digest:n,chainId:r,signatures:l})}async publishWitness(){const e=Oo(`This is a Sequence account woo! ${Date.now()}`),r=await this.signDigest(e,0,!1),n=this.coders.signature.decode(r),i=this.coders.signature.signaturesOfDecoded(n);return this.tracker.saveWitnesses({wallet:this.address,digest:e,chainId:0,signatures:i})}async signDigest(e,r,n=!0,i="ignore",s){const o=BigInt(r)===0n?this.networks[0].chainId:r,a=await this.status(o);if(this.mustBeFullyMigrated(a),!a.canOnchainValidate&&i==="throw")throw new Error("Wallet cannot validate onchain");const l=await this.walletForStatus(r,a).signDigest(e,s),f=n?this.decorateSignature(l,a):l;if(!a.canOnchainValidate)switch(i){case"ignore":return f;case"eip6492":return this.buildEIP6492Signature(await f,a,r)}return f}buildOnChainSignature(e){const r=mt.signature.subdigestOf({digest:Me(e),chainId:0,address:this.address}),n=Me(r),i=this.coders.config.fromSimple({threshold:32768,checkpoint:0,signers:[],subdigests:[n]}),s=new $i(Ps.mainModule.abi),o={entrypoint:this.address,transactions:[{to:this.address,data:s.encodeFunctionData("setExtraImageHash",[this.coders.config.imageHashOf(i),"57896044618658097711785492504343953926634992332820282019728792003956564819968"]),gasLimit:25e4}]};this.tracker.saveWalletConfig({config:i});const a=this.coders.signature.encodeSigners(i,new Map,[n],0).encoded;return{bundle:o,signature:a}}async buildEIP6492Signature(e,r,n){const i=await this.buildBootstrapTransactions(r,n);if(i.transactions.length===0)throw new Error("Cannot build EIP-6492 signature without bootstrap transactions");const s=Ns.defaultAbiCoder().encode(["address","bytes","bytes"],[i.entrypoint,mt.transaction.encodeBundleExecData(i),e]);return Cr(["bytes","bytes32"],[s,mt.EIP6492.EIP_6492_SUFFIX])}async editConfig(e){const r=await this.status(0).then(i=>i.config),n=this.coders.config.editConfig(r,Al({},e,{checkpoint:this.coders.config.checkpointOf(r)+1n}));return this.updateConfig(n)}async updateConfig(e){if(!this.coders.config.isWalletConfig(e))throw new Error(`Invalid config for wallet ${this.address}`);const r=this.coders.config.imageHashOf(e),n=this.coders.signature.hashSetImageHash(r),i=await this.signDigest(n,0,!1);await this.tracker.savePresignedConfiguration({wallet:this.address,nextConfig:e,signature:i});const s=await this.tracker.configOfImageHash({imageHash:r,noCache:!0});if(!s||this.coders.config.imageHashOf(s)!==r)throw Error(`Reverse lookup failed for imageHash ${r}`)}async buildBootstrapTransactions(e,r){var n;const i=await this.orchestrator.buildDeployTransaction({chainId:r}),s=(n=i==null?void 0:i.transactions)!=null?n:[];if(!e.onChain.deployed){const c=UF.buildDeployTransaction(e.original.context,e.original.imageHash);s.push(...c.transactions)}s.push(...e.signedMigrations.map(c=>({to:c.tx.entrypoint,data:mt.transaction.encodeBundleExecData(c.tx),value:0,gasLimit:0,revertOnError:!0,delegateCall:!1})));const o=e.signedMigrations.length>0?e.signedMigrations[0].tx.intent.id:mt.transaction.subdigestOfGuestModuleTransactions(this.contexts[this.version].guestModule,r,s),{guestModule:a}=this.contextFor(e.version);return{entrypoint:a,transactions:s,chainId:r,intent:{id:o,wallet:this.address}}}async bootstrapTransactions(e,r){const n=r||await this.status(e);return this.buildBootstrapTransactions(n,e)}async doBootstrap(e,r,n){const i=await this.bootstrapTransactions(e,n);return this.relayer(e).relay(Al({},i,{chainId:e}),r)}signMessage(e,r,n="ignore"){return this.signDigest(gr(e),r,!0,n)}async signTransactions(e,r,n,i){const s=n||await this.status(r);this.mustBeFullyMigrated(s);const o=this.walletForStatus(r,s),a={address:this.address,digest:"",chainId:r,config:{version:this.version},decorate:!0,cantValidateBehavior:"ignore"},c=i!=null&&i.serial?{serial:!0}:(i==null?void 0:i.nonceSpace)!==void 0?{space:i.nonceSpace}:void 0,l=await o.signTransactions(e,c,a);return Al({},l,{signature:await this.decorateSignature(l.signature,s)})}async signMigrations(e,r){const n=await this.status(e);if(n.fullyMigrated)return!1;const i=this.walletForStatus(e,n),s=r(i.config),o=await this.migrator.signNextMigration(this.address,n.version,i,s);if(!o)return!1;await this.tracker.saveWalletConfig({config:s});const a=As.coderFor(s.version).config,c=a.imageHashOf(s),l=await this.tracker.configOfImageHash({imageHash:c,noCache:!0});if(!l||a.imageHashOf(l)!==c)throw Error(`Reverse lookup failed for imageHash ${c}`);return await this.tracker.saveMigration(this.address,o,this.contexts),!0}async signAllMigrations(e){var r=this;const n=[];return{signedMigrations:(await Promise.all(this.networks.map(async function(o){try{return await r.signMigrations(o.chainId,e)}catch(a){return console.warn(`Failed to sign migrations for chain ${o.chainId}`,a),n.push(o.chainId),null}}))).filter(o=>o!==null),failedChains:n}}async isMigratedAllChains(){var e=this;const r=[];return{migratedAllChains:(await Promise.all(this.networks.map(async function(s){try{return await e.status(s.chainId)}catch(o){return r.push(s.chainId),console.warn(`Failed to get status for chain ${s.chainId}`,o),{fullyMigrated:!0}}}))).every(s=>s.fullyMigrated),failedChains:r}}async sendSignedTransactions(e,r,n,i,s){if(!Array.isArray(e))return this.sendSignedTransactions([e],r,n,i,s);const o=i||await this.status(r);this.mustBeFullyMigrated(o);const a=await this.decorateTransactions(e,o,r);return s==null||s(a),this.relayer(r).relay(a,n)}async fillGasLimits(e,r,n){return this.walletForStatus(r,n||await this.status(r)).fillGasLimits(e)}async gasRefundQuotes(e,r,n,i,s){const o=i||await this.status(r),a=this.walletForStatus(r,o),c=await this.predecorateTransactions(e,o,r),l=mt.transaction.fromTransactionish(this.address,c),f=a.coders.config.buildStubSignature(a.config,n),u=Me(da(32)),p={chainId:r,intent:{id:u,wallet:this.address},signature:f,transactions:l,entrypoint:this.address,nonce:0},g=await this.decorateTransactions(p,o),y=mt.transaction.encodeBundleExecData(g),b=await this.relayer(r).getFeeOptionsRaw(g.entrypoint,y,s);return Al({},b,{decorated:g})}async prepareTransactions(e){const r=await this.status(e.chainId),n=await this.fillGasLimits(e.txs,e.chainId,r),i=await this.gasRefundQuotes(n,e.chainId,e.stubSignatureOverrides,r,{simulate:e.simulateForFeeOptions}),s=mt.transaction.unwind(this.address,i.decorated.transactions);return{transactions:n,flatDecorated:s,feeOptions:i.options,feeQuote:i.quote}}async sendTransaction(e,r,n,i=!1,s,o){const a=await this.status(r),c=i?e:await this.predecorateTransactions(e,a,r),f=mt.transaction.fromTransactionish(this.address,c).length>0?await this.signTransactions(c,r,void 0,o):void 0,u=await this.orchestrator.predecorateSignedTransactions({chainId:r}),p=[];return f!==void 0&&f.transactions.length>0&&p.push(f),p.push(...u.filter(g=>g.transactions.length>0)),this.sendSignedTransactions(p,r,n,void 0,s)}async signTypedData(e,r,n,i,s="ignore"){const o=Dk({domain:e,types:r,message:n});return this.signDigest(o,i,!0,s)}async getSigners(){var e=this;const r=n=>n.length?n[n.length-1]:void 0;return(await Promise.all(this.networks.map(async function({chainId:n,name:i}){try{var s;const o=await e.status(n);let a=(s=r(o.presignedConfigurations))==null?void 0:s.nextImageHash;if(!a&&o.onChain.version!==o.version){const u=r(o.signedMigrations);if(u){const{toVersion:p,toConfig:g}=u;a=As.genericCoderFor(p).config.imageHashOf(g)}}a||(a=o.onChain.imageHash);const c=await e.tracker.configOfImageHash({imageHash:a});if(!c)throw new Error(`unable to find config for image hash ${a}`);return As.genericCoderFor(c.version).config.signersOf(c).map(u=>Al({},u,{network:n}))}catch(o){return console.warn(`unable to get signers on network ${n} ${i}`,o),[]}}))).flat()}async getAllSigners(){var e=this;const r=[];return await Promise.all(this.networks.map(async function(n){const i=n.chainId,s=await e.status(i,!0),o=[s.onChain.imageHash,...s.onChain.version!==s.version?s.signedMigrations.map(a=>As.coderFor(a.toVersion).config.imageHashOf(a.toConfig)):[],...s.presignedConfigurations.map(a=>a.nextImageHash)];return Promise.all(o.map(async function(a,c){const l=c===o.length-1,f=await e.tracker.configOfImageHash({imageHash:a});if(!f){console.warn(`AllSigners may be incomplete, config not found for imageHash ${a}`);return}As.genericCoderFor(f.version).config.signersOf(f).forEach(g=>{const y=r.find(b=>b.address===g.address&&b.network===i);if(y&&l&&y.flaggedForRemoval){y.flaggedForRemoval=!1;return}y||r.push({address:g.address,weight:g.weight,network:i,flaggedForRemoval:!l})})}))})),r}}const nAe=async()=>window.crypto.subtle.generateKey({name:"AES-GCM",length:256},!1,["encrypt","decrypt"]),$F=async(t,e)=>{const n=new TextEncoder().encode(t),i=await window.crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits","deriveKey"]);return await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:e,iterations:31e4,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},qF=t=>Ue(t),VF=async(t,e)=>{const n=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(12)),s=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},t,n);return{iv:i,data:s}},zF=async(t,e)=>{const{iv:r,data:n}=e;try{const i=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:r},t,n);return new TextDecoder().decode(i)}catch{throw new Error("Could not decrypt data")}},U_=(t,e)=>e.some(r=>t instanceof r);let HF,GF;function iAe(){return HF||(HF=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function sAe(){return GF||(GF=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const $_=new WeakMap,E9=new WeakMap,iE=new WeakMap;function oAe(t){const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{r(gp(t.result)),i()},o=()=>{n(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return iE.set(e,t),e}function aAe(t){if($_.has(t))return;const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{r(),i()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});$_.set(t,e)}let q_={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return $_.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return gp(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function JZ(t){q_=t(q_)}function cAe(t){return sAe().includes(t)?function(...e){return t.apply(V_(this),e),gp(this.request)}:function(...e){return gp(t.apply(V_(this),e))}}function lAe(t){return typeof t=="function"?cAe(t):(t instanceof IDBTransaction&&aAe(t),U_(t,iAe())?new Proxy(t,q_):t)}function gp(t){if(t instanceof IDBRequest)return oAe(t);if(E9.has(t))return E9.get(t);const e=lAe(t);return e!==t&&(E9.set(t,e),iE.set(e,t)),e}const V_=t=>iE.get(t);function fAe(t,e,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=gp(o);return n&&o.addEventListener("upgradeneeded",c=>{n(gp(o.result),c.oldVersion,c.newVersion,gp(o.transaction),c)}),r&&o.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const uAe=["get","getKey","getAll","getAllKeys","count"],dAe=["put","add","delete","clear"],C9=new Map;function WF(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(C9.get(e))return C9.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,i=dAe.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||uAe.includes(r)))return;const s=async function(o,...a){const c=this.transaction(o,i?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),i&&c.done]))[0]};return C9.set(e,s),s}JZ(t=>({...t,get:(e,r,n)=>WF(e,r)||t.get(e,r,n),has:(e,r)=>!!WF(e,r)||t.has(e,r)}));const hAe=["continue","continuePrimaryKey","advance"],KF={},z_=new WeakMap,ZZ=new WeakMap,pAe={get(t,e){if(!hAe.includes(e))return t[e];let r=KF[e];return r||(r=KF[e]=function(...n){z_.set(this,ZZ.get(this)[e](...n))}),r}};async function*vAe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,pAe);for(ZZ.set(r,e),iE.set(r,V_(e));e;)yield r,e=await(z_.get(r)||e.continue()),z_.delete(r)}function YF(t,e){return e===Symbol.asyncIterator&&U_(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&U_(t,[IDBIndex,IDBObjectStore])}JZ(t=>({...t,get(e,r,n){return YF(e,r)?vAe:t.get(e,r,n)},has(e,r){return YF(e,r)||t.has(e,r)}}));const gAe="@sequence-recovery",yAe=1,C3=async t=>fAe(gAe,yAe,{upgrade:e=>{e.createObjectStore(t)}}),mAe=async t=>{await(await C3(t)).clear("security")};function bAe(t,e){const r=t.replace("ipfs://ipfs/","").replace("ipfs://","");return t.startsWith("ipfs://")?`${e}${r}`:t}function wAe(t){return t.startsWith("ipfs://")}class XZ{constructor(e,r,n=1e3){this.provider=e,this.solver=r,this.window=n,this.pending=new Map}async runByEIP5719(e,r,n){const i=`${e}-${r}-${n}`,s=Date.now();if(this.pending.has(i)&&s-this.pending.get(i).timestamp10)throw new Error("EIP5719 - Too many tries");if(mt.signer.canRecover(n)){const c=mt.signer.recoverSigner(r,n);if(c&&c.toLowerCase()===t.toLowerCase())return n}try{if(await mt.signer.isValidSignature(t,r,n,e))return n}catch{}const o=await EAe(xAe(t,e).getAlternativeSignature(r));if(!o||o==="")throw new Error("EIP5719 - Invalid signature and no alternative signature");const a=Me(await(i||new CAe).resolve(o));if(!a||a==="")throw new Error("EIP5719 - Empty alternative signature");if(a===Me(n))throw new Error("EIP5719 - Alternative signature is invalid or the same");return eX(t,e,r,a,i,s+1)}class CAe{constructor(e="https://cloudflare-ipfs.com/ipfs/"){var r=this;this.gateway=e,this.uri=n=>wAe(n)?bAe(n,this.gateway):n,this.resolve=async function(n){const i=r.uri(n),s=await fetch(i);if(!s.ok)throw new Error(`URISolverIPFS - Failed to fetch ${i}`);return await s.text()}}}const AAe=(t,e)=>e.some(r=>t instanceof r);let QF,JF;function SAe(){return QF||(QF=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function _Ae(){return JF||(JF=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const tX=new WeakMap,H_=new WeakMap,rX=new WeakMap,A9=new WeakMap,Zk=new WeakMap;function IAe(t){const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{r(th(t.result)),i()},o=()=>{n(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(r=>{r instanceof IDBCursor&&tX.set(r,t)}).catch(()=>{}),Zk.set(e,t),e}function TAe(t){if(H_.has(t))return;const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{r(),i()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});H_.set(t,e)}let G_={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return H_.get(t);if(e==="objectStoreNames")return t.objectStoreNames||rX.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return th(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function PAe(t){G_=t(G_)}function kAe(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){const n=t.call(S9(this),e,...r);return rX.set(n,e.sort?e.sort():[e]),th(n)}:_Ae().includes(t)?function(...e){return t.apply(S9(this),e),th(tX.get(this))}:function(...e){return th(t.apply(S9(this),e))}}function MAe(t){return typeof t=="function"?kAe(t):(t instanceof IDBTransaction&&TAe(t),AAe(t,SAe())?new Proxy(t,G_):t)}function th(t){if(t instanceof IDBRequest)return IAe(t);if(A9.has(t))return A9.get(t);const e=MAe(t);return e!==t&&(A9.set(t,e),Zk.set(e,t)),e}const S9=t=>Zk.get(t);function RAe(t,e,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=th(o);return n&&o.addEventListener("upgradeneeded",c=>{n(th(o.result),c.oldVersion,c.newVersion,th(o.transaction),c)}),r&&o.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const OAe=["get","getKey","getAll","getAllKeys","count"],DAe=["put","add","delete","clear"],_9=new Map;function ZF(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(_9.get(e))return _9.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,i=DAe.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||OAe.includes(r)))return;const s=async function(o,...a){const c=this.transaction(o,i?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),i&&c.done]))[0]};return _9.set(e,s),s}PAe(t=>({...t,get:(e,r,n)=>ZF(e,r)||t.get(e,r,n),has:(e,r)=>!!ZF(e,r)||t.has(e,r)}));function Zl(){return Zl=Object.assign?Object.assign.bind():function(t){for(var e=1;e{try{const{Signer:p,Subdigest:g,Digest:y,"To-Config":b}=u;let I;switch(u["Signature-Type"]){case"eip-712":case"eth_sign":case"erc-1271":I=u["Signature-Type"];break;default:throw new Error(`unknown signature type ${u["Signature-Type"]}`)}let C;try{C=BigInt(u["To-Checkpoint"])}catch{throw new Error(`to checkpoint is not a number: ${u["To-Checkpoint"]}`)}if(C<=s)return[];if(!vw(p))throw new Error(`signer is not an address: ${p}`);if(!Gr(g,32))throw new Error(`subdigest is not a hash: ${g}`);if(!Gr(y,32))throw new Error(`digest is not a hash: ${y}`);let S;try{S=BigInt(u["Chain-ID"])}catch{throw new Error(`chain id is not a number: ${u["Chain-ID"]}`)}if(!Gr(b,32))throw new Error(`to config is not a hash: ${b}`);return[{id:f,signatureType:I,signer:p,subdigest:g,digest:y,chainId:S,toImageHash:b,toCheckpoint:C}]}catch(p){return console.warn(`invalid wallet ${n} config update ${f}:`,p),[]}}),a=new Map;let c=[];for(const f of o){let u=a.get(f.toImageHash);u||(u=new Map,a.set(f.toImageHash,u),c.push(f)),u.set(f.signer,f)}e.longestPath?c.sort(({toCheckpoint:f},{toCheckpoint:u})=>f===u?0:ff===u?0:f[S,{signature:"0x",isDynamic:!1}])),[],0);if(C>=BigInt(f.threshold)){p=I;break}}if(!p){console.warn(`unreachable configs with checkpoint > ${f.checkpoint} from config ${u}`);break}const b=p.toImageHash;try{const I=await this.configOfImageHash({imageHash:b});if(!I)throw new Error(`unable to find config ${b}`);if(!ir.config.isWalletConfig(I))throw new Error(`config ${b} is not v2`);const C=new Map((await Promise.all(y.map(async function(L){const{id:F,subdigest:z,signatureType:_}=g.get(L);try{let $=await(await I6(F,r.options.rateLimitRetryDelayMs)).text();switch(_){case"eip-712":$+="01";break;case"eth_sign":$+="02";break;case"erc-1271":$+="03";break}if(r.eip5719)try{$=Me(await r.eip5719.runByEIP5719(L,z,$))}catch{console.warn(`unable to run eip-5719 on config update ${F}`)}const ie=mt.signer.tryRecoverSigner(z,$);return[[L,{signature:$,isDynamic:ie!==L}]]}catch($){return console.warn(`unable to fetch signer ${L} config update ${F}:`,$),[]}}))).flat()),{encoded:S,weight:O}=ir.signature.encodeSigners(f,C,[],0);if(OL>BigInt(f.checkpoint))}catch(I){console.warn(`unable to reconstruct wallet ${n} update from config ${u} to config ${b}:`,I),c=c.filter(({toImageHash:C})=>C!==b)}}return l}savePresignedConfiguration(e){throw new Error("arweave backend does not support saving config updates")}saveWitnesses(e){throw new Error("arweave backend does not support saving signatures")}async configOfImageHash(e){var r=this;if(!e.noCache){const i=this.configs.get(e.imageHash);if(i)try{return await i}catch{const o=this.configs.get(e.imageHash);if(o)return o}}const n=async function(i){const s=Object.entries(await Pm({Type:"config",Config:i},r.options)).flatMap(([o,a])=>{try{const c=Number(a.Version);if(!c)throw new Error(`invalid version: ${a.Version}`);return[{id:o,version:c}]}catch(c){return console.warn(`config ${i} at ${o} invalid:`,c),[]}});switch(s.length){case 0:r.configs.set(i,Promise.resolve(void 0));return;case 1:break;default:console.warn(`multiple configs ${i} at ${s.map(({id:o})=>o).join(", ")}`);break}for(const{id:o,version:a}of s)try{const c=Zl({},await(await I6(o,r.options.rateLimitRetryDelayMs)).json(),{version:a});c.tree&&(c.tree=H1(c.tree));const l=As.coderFor(a).config.imageHashOf(c);if(l!==i)throw new Error(`image hash is ${l}, expected ${i}`);return r.configs.set(i,Promise.resolve(c)),c}catch(c){console.warn(`config at ${o} invalid:`,c)}r.configs.set(i,Promise.resolve(void 0))}(e.imageHash);return e.noCache||this.configs.set(e.imageHash,n),n}saveWalletConfig(e){throw new Error("arweave backend does not support saving configs")}async imageHashOfCounterfactualWallet(e){const r=Qt(e.wallet),n=Object.entries(await Pm({Type:"wallet",Wallet:r},this.options)).flatMap(([i,s])=>{try{const{"Deploy-Config":o}=s,a=Number(s["Deploy-Version"]);if(!a)throw new Error(`invalid version: ${s["Deploy-Version"]}`);if(!o)throw new Error("no deploy config");const c=mt.context.defaultContexts[a];if(!c)throw new Error(`unknown version: ${a}`);if(mt.context.addressOf(c,o)!==r)throw new Error(`incorrect v${a} deploy config: ${o}`);return[{id:i,imageHash:o,context:c}]}catch(o){return console.warn(`wallet ${r} at ${i} invalid:`,o),[]}});switch(n.length){case 0:return;case 1:break;default:console.warn(`multiple deploy configs for wallet ${r} at ${n.map(({id:i})=>i).join(", ")}, using first`);break}return n[0]}saveCounterfactualWallet(e){throw new Error("arweave backend does not support saving wallets")}async walletsOfSigner(e){var r=this;const n=Qt(e.signer),i=new Map;for(const[s,o]of Object.entries(await Pm({Type:["signature","config update"],Signer:n,Witness:e.allSignatures?void 0:"true"},this.options))){const{Wallet:a,Subdigest:c,Digest:l,"Chain-ID":f}=o;try{if(i.has(a))continue;let u;switch(o["Signature-Type"]){case"eip-712":u="01";break;case"eth_sign":u="02";break;case"erc-1271":u="03";break;default:throw new Error(`unknown signature type ${o["Signature-Type"]}`)}if(c!==mt.signature.subdigestOf({digest:l,chainId:f,address:a}))throw new Error("incorrect subdigest");const p=I6(s,this.options.rateLimitRetryDelayMs).then(async function(g){const y=await g.text()+u;if(r.eip5719)try{return Me(await r.eip5719.runByEIP5719(n,c,y))}catch{console.warn(`unable to run eip-5719 on signature ${s}`)}return y});i.set(a,{digest:l,chainId:BigInt(f),signature:p})}catch(u){console.warn(`signer ${n} signature ${s} of wallet ${a} invalid:`,u)}}return Promise.all([...i.entries()].map(async function([s,{digest:o,chainId:a,signature:c}]){return{wallet:s,proof:{digest:o,chainId:a,signature:await c}}}))}async getMigration(e,r,n,i){const s=Qt(e),o=Object.entries(await Pm({Type:"migration",Migration:s,"Chain-ID":BigInt(i).toString(),"From-Version":`${n}`,"From-Config":r},this.options)).flatMap(([O,L])=>{try{const{"To-Config":F,Executor:z}=L,_=Number(L["To-Version"]);if(!_)throw new Error(`invalid version: ${L["To-Version"]}`);if(!Gr(F,32))throw new Error(`to config is not a hash: ${F}`);if(!vw(z))throw new Error(`executor is not an address: ${z}`);return{id:O,toVersion:_,toImageHash:F,executor:z}}catch(F){return console.warn(`chain ${i} migration ${O} for v${n} wallet ${s} from config ${r} invalid:`,F),[]}});switch(o.length){case 0:return;case 1:break;default:console.warn(`multiple chain ${i} migrations for v${n} wallet ${s} from config ${r} at ${o.map(({id:O})=>O).join(", ")}, using first`);break}const{id:a,toVersion:c,toImageHash:l,executor:f}=o[0],[u,p]=await Promise.all([I6(a,this.options.rateLimitRetryDelayMs).then(O=>O.text()),this.configOfImageHash({imageHash:l})]);if(!p)throw new Error(`unable to find to config ${l} for migration`);const g=new $i(NAe),[y,b,I]=g.decodeFunctionData("execute",u),C=mt.transaction.fromTxAbiEncode(y),S=mt.transaction.subdigestOfTransactions(s,i,b,C);return{tx:{entrypoint:f,transactions:C,nonce:b,chainId:i,intent:{id:S,wallet:s},signature:I},fromVersion:n,toVersion:Number(c),toConfig:p}}saveMigration(e,r,n){throw new Error("arweave backend does not support saving migrations")}}async function Pm(t,e){var r,n,i,s;const o=(r=e==null?void 0:e.namespace)!=null?r:Lv.namespace,a=e==null?void 0:e.owners,c=(n=e==null?void 0:e.graphqlUrl)!=null?n:Lv.graphqlUrl,l=(i=e==null?void 0:e.rateLimitRetryDelayMs)!=null?i:Lv.rateLimitRetryDelayMs,f=(s=e==null?void 0:e.pageSize)!=null?s:100,u=e==null?void 0:e.maxResults,p=Object.entries(t).flatMap(([y,b])=>b===void 0?[]:[`{ name: "${o?`${o}-${y}`:y}", values: [${typeof b=="string"?`"${b}"`:b.map(I=>`"${I}"`).join(", ")}] }`]),g=[];for(let y=!0;y&&(u===void 0||g.length{const r=[],n=new $i(Ps.mainModule.abi);for(const i of e){const s=Ue(i.data||"0x");if(i.to===t&&Me(s.slice(0,4))===bZ){const o=s.slice(4),a=Ns.defaultAbiCoder().decode([wZ],o)[0];r.push(...B_(i.to,a.map(c=>ns({},c,{to:c.target}))))}else try{const o=n.decodeFunctionData("execute",s)[0],a=B_(t,o.map(c=>ns({},c.toObject(),{to:c.target})));r.push(...a)}catch{r.push(i)}}return r},Nb=t=>t==null;var bCe=Object.freeze({__proto__:null,MetaTransactionsType:Y8,intendTransactionBundle:lCe,intendedTransactionID:fCe,unpackMetaTransactionsData:uCe,packMetaTransactionsData:hZ,digestOfTransactions:pZ,subdigestOfTransactions:dCe,subdigestOfGuestModuleTransactions:hCe,toSequenceTransactions:vZ,toSequenceTransaction:Qk,isSequenceTransaction:Q8,hasSequenceTransactions:gZ,sequenceTxAbiEncode:Sw,fromTxAbiEncode:pCe,encodeNonce:vCe,decodeNonce:gCe,fromTransactionish:yCe,isTransactionBundle:yZ,isSignedTransactionBundle:mZ,encodeBundleExecData:mCe,selfExecuteSelector:bZ,selfExecuteAbi:wZ,unwind:B_});const xZ="0x608060405234801561001057600080fd5b5060405161124a38038061124a83398101604081905261002f91610124565b600060405161003d906100dd565b604051809103906000f080158015610059573d6000803e3d6000fd5b5090506000816001600160a01b0316638f0684308686866040518463ffffffff1660e01b815260040161008e939291906101fb565b6020604051808303816000875af11580156100ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100d19190610244565b9050806000526001601ff35b610fdc8061026e83390190565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561011b578181015183820152602001610103565b50506000910152565b60008060006060848603121561013957600080fd5b83516001600160a01b038116811461015057600080fd5b6020850151604086015191945092506001600160401b038082111561017457600080fd5b818601915086601f83011261018857600080fd5b81518181111561019a5761019a6100ea565b604051601f8201601f19908116603f011681019083821181831017156101c2576101c26100ea565b816040528281528960208487010111156101db57600080fd5b6101ec836020830160208801610100565b80955050505050509250925092565b60018060a01b0384168152826020820152606060408201526000825180606084015261022e816080850160208701610100565b601f01601f191691909101608001949350505050565b60006020828403121561025657600080fd5b8151801515811461026657600080fd5b939250505056fe608060405234801561001057600080fd5b50610fbc806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c806376be4cea1161005057806376be4cea146100a65780638f068430146100b957806398ef1ed8146100cc57600080fd5b80631c6453271461006c5780633d787b6314610093575b600080fd5b61007f61007a366004610ad4565b6100df565b604051901515815260200160405180910390f35b61007f6100a1366004610ad4565b61023d565b61007f6100b4366004610b3e565b61031e565b61007f6100c7366004610ad4565b6108e1565b61007f6100da366004610ad4565b61096e565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea9061012890889088908890889088908190600401610bc3565b6020604051808303816000875af1925050508015610181575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261017e91810190610c45565b60015b610232573d8080156101af576040519150601f19603f3d011682016040523d82523d6000602084013e6101b4565b606091505b508051600181900361022757816000815181106101d3576101d3610c69565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f0100000000000000000000000000000000000000000000000000000000000000149250610235915050565b600092505050610235565b90505b949350505050565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea906102879088908890889088906001908990600401610bc3565b6020604051808303816000875af19250505080156102e0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526102dd91810190610c45565b60015b610232573d80801561030e576040519150601f19603f3d011682016040523d82523d6000602084013e610313565b606091505b506000915050610235565b600073ffffffffffffffffffffffffffffffffffffffff87163b6060827f64926492649264926492649264926492649264926492649264926492649264928888610369602082610c98565b610375928b9290610cd8565b61037e91610d02565b1490508015610484576000606089828a610399602082610c98565b926103a693929190610cd8565b8101906103b39190610e18565b955090925090508415806103c45750865b1561047d576000808373ffffffffffffffffffffffffffffffffffffffff16836040516103f19190610eb2565b6000604051808303816000865af19150503d806000811461042e576040519150601f19603f3d011682016040523d82523d6000602084013e610433565b606091505b50915091508161047a57806040517f9d0d6e2d0000000000000000000000000000000000000000000000000000000081526004016104719190610f18565b60405180910390fd5b50505b50506104be565b87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294505050505b80806104ca5750600083115b156106bb576040517f1626ba7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b1690631626ba7e90610523908c908690600401610f2b565b602060405180830381865afa92505050801561057a575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261057791810190610f44565b60015b61060f573d8080156105a8576040519150601f19603f3d011682016040523d82523d6000602084013e6105ad565b606091505b50851580156105bc5750600084115b156105db576105d08b8b8b8b8b600161031e565b9450505050506108d7565b806040517f6f2a95990000000000000000000000000000000000000000000000000000000081526004016104719190610f18565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f1626ba7e000000000000000000000000000000000000000000000000000000001480158161065f575086155b801561066b5750600085115b1561068b5761067f8c8c8c8c8c600161031e565b955050505050506108d7565b841580156106965750825b80156106a0575087155b156106af57806000526001601ffd5b94506108d79350505050565b6041871461074b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f5369676e617475726556616c696461746f72237265636f7665725369676e657260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610471565b600061075a6020828a8c610cd8565b61076391610d02565b90506000610775604060208b8d610cd8565b61077e91610d02565b905060008a8a604081811061079557610795610c69565b919091013560f81c915050601b81148015906107b557508060ff16601c14155b15610842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5369676e617475726556616c696461746f723a20696e76616c6964207369676e60448201527f617475726520762076616c7565000000000000000000000000000000000000006064820152608401610471565b6040805160008152602081018083528e905260ff831691810191909152606081018490526080810183905273ffffffffffffffffffffffffffffffffffffffff8e169060019060a0016020604051602081039080840390855afa1580156108ad573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff161496505050505050505b9695505050505050565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea9061092b9088908890889088906001908990600401610bc3565b6020604051808303816000875af115801561094a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102329190610c45565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea906109b790889088908890889088908190600401610bc3565b6020604051808303816000875af1925050508015610a10575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610a0d91810190610c45565b60015b610232573d808015610a3e576040519150601f19603f3d011682016040523d82523d6000602084013e610a43565b606091505b5080516001819003610a6257816000815181106101d3576101d3610c69565b8082fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a8857600080fd5b50565b60008083601f840112610a9d57600080fd5b50813567ffffffffffffffff811115610ab557600080fd5b602083019150836020828501011115610acd57600080fd5b9250929050565b60008060008060608587031215610aea57600080fd5b8435610af581610a66565b935060208501359250604085013567ffffffffffffffff811115610b1857600080fd5b610b2487828801610a8b565b95989497509550505050565b8015158114610a8857600080fd5b60008060008060008060a08789031215610b5757600080fd5b8635610b6281610a66565b955060208701359450604087013567ffffffffffffffff811115610b8557600080fd5b610b9189828a01610a8b565b9095509350506060870135610ba581610b30565b91506080870135610bb581610b30565b809150509295509295509295565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a060408201528360a0820152838560c0830137600060c085830181019190915292151560608201529015156080820152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016909101019392505050565b600060208284031215610c5757600080fd5b8151610c6281610b30565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b81810381811115610cd2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b60008085851115610ce857600080fd5b83861115610cf557600080fd5b5050820193919092039150565b80356020831015610cd2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610d7e57600080fd5b813567ffffffffffffffff80821115610d9957610d99610d3e565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715610ddf57610ddf610d3e565b81604052838152866020858801011115610df857600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215610e2d57600080fd5b8335610e3881610a66565b9250602084013567ffffffffffffffff80821115610e5557600080fd5b610e6187838801610d6d565b93506040860135915080821115610e7757600080fd5b50610e8486828701610d6d565b9150509250925092565b60005b83811015610ea9578181015183820152602001610e91565b50506000910152565b60008251610ec4818460208701610e8e565b9190910192915050565b60008151808452610ee6816020860160208601610e8e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610c626020830184610ece565b8281526040602082015260006102356040830184610ece565b600060208284031215610f5657600080fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c6257600080fdfea26469706673582212201a72aed4b15ffb05b6502997a9bb655992e06590bd26b336dfbb153d7ff6f34b64736f6c63430008120033",wCe="0x6492649264926492649264926492649264926492649264926492649264926492";async function EZ(t,e,r,n){try{return await t.call({data:qr([xZ,Ns.defaultAbiCoder().encode(["address","bytes32","bytes"],[e,r,n])])})==="0x01"}catch{return!1}}var xCe=Object.freeze({__proto__:null,EIP_6492_OFFCHAIN_DEPLOY_CODE:xZ,EIP_6492_SUFFIX:wCe,validateEIP6492Offchain:EZ});class ECe{constructor(e){this.provider=e,this.isDeployedCache=new Set}module(e){return new Dn(e,[...Ps.mainModuleUpgradable.abi,...Ps.mainModule.abi,...Ps.erc1271.abi],this.provider)}async isDeployed(e){if(this.isDeployedCache.has(e))return!0;const n=(await this.provider.getCode(e).then(i=>Ue(i))).length!==0;return n&&this.isDeployedCache.add(e),n}async implementation(e){const r=Ns.defaultAbiCoder().encode(["address"],[e]),n=await this.provider.getStorage(e,r).then(i=>Ue(i));if(n.length===20)return Qt(Me(n));if(n.length===32)return Ns.defaultAbiCoder().decode(["address"],n)[0]}async imageHash(e){try{return await this.module(e).imageHash()}catch{}}async nonce(e,r=0){try{return await this.module(e).readNonce(r)}catch(n){if(!await this.isDeployed(e))return 0;throw n}}async isValidSignature(e,r,n){return EZ(this.provider,e,r,n)}}var CCe=Object.freeze({__proto__:null,OnChainReader:ECe});function ACe(t){return t&&t.address&&t.digest&&t.chainId!==void 0&&t.config}var mt=Object.freeze({__proto__:null,config:nCe,signature:LEe,context:cCe,signer:VEe,EIP1271:UEe,transaction:bCe,reader:CCe,EIP6492:xCe,isWalletSignRequestMetadata:ACe});const L_=[{config:jk,signature:Fk},{config:K8,signature:W8}];function CZ(t){const e=t-1;if(e<0||e>=L_.length)throw new Error(`No coder for version: ${t}`);return L_[e]}function SCe(t){return CZ(t)}var As=Object.freeze({__proto__:null,ALL_CODERS:L_,coderFor:CZ,genericCoderFor:SCe});const _Ce=[w0,ir];function ICe(t,e,r){for(let n=0;ne.version)&&(e=r);if(e===void 0)throw new Error("No migrations");return e}async getAllMigratePresignedTransaction(e){const{address:r,fromImageHash:n,fromVersion:i,chainId:s}=e;let o=n,a=i;const c=Object.values(this.contexts),l=[];for(let f=1;fUe(s).length===0))return NF;if(!n.provider)throw new Error("signer.provider is not set, but is required");return n.provider.estimateGas({from:e,to:i.to,data:i.data,value:i.value})}))).map(i=>({executed:!0,succeeded:!0,gasUsed:Number(i),gasLimit:Number(i)}))}async getNonce(e,r,n){if(!this.provider)throw new Error("provider is not set");if(await this.provider.getCode(e)==="0x")return 0;r===void 0&&(r=0);const s=await new Dn(e,Ps.mainModule.abi,this.provider).readNonce(r,{blockTag:n});return mt.transaction.encodeNonce(r,s)}async wait(e,r,n=this.waitPollRate,i=5){var s=this;typeof e!="string"&&(e=mt.transaction.intendedTransactionID(e));let o=!1;const a=async function(f,u){let p=0;for(;!o;){try{return await f()}catch(g){if(p++,i!==void 0&&p>=i)throw Ci.error(`giving up after ${p} failed attempts${u?`: ${u}`:""}`,g),g;Ci.warn(`attempt #${p} failed${u?`: ${u}`:""}`,g)}n>0&&await new Promise(g=>setTimeout(g,n))}throw new Error(`timed out after ${p} failed attempts${u?`: ${u}`:""}`)},c=async function(){let f=s.fromBlockLog;if(f<0&&(f=await a(()=>s.provider.getBlockNumber(),"unable to get latest block number")+f),typeof e!="string")throw new Error("impossible");const u=e.replace("0x","");for(;!o;){const p=await a(()=>s.provider.getBlockNumber(),"unable to get latest block number"),g=await a(()=>s.provider.getLogs({fromBlock:Math.max(0,f-s.deltaBlocksLog),toBlock:p,topics:["0x1f180c27086c7a39ea2a7b25239d1ab92348f07ca7bb59d1438fcf527568f881"]}),`unable to get NonceChange logs for blocks ${Math.max(0,f-s.deltaBlocksLog)} to ${p}`);f=p;const b=(await Promise.all(g.map(I=>a(()=>s.provider.getTransactionReceipt(I.transactionHash),`unable to get receipt for transaction ${I.transactionHash}`)))).find(I=>I==null?void 0:I.logs.find(C=>C.topics.length===0&&C.data.replace("0x","")===u||C.topics.length===1&&C.topics[0]==="0x3dbd1590ea96dd3253a91f24e64e3a502e1225d602a5731357bc12643070ccd7"&&C.data.length>=64&&C.data.replace("0x","").startsWith(u)));if(b){const I=await a(()=>s.provider.getTransaction(b.hash),`unable to get transaction ${b.hash}`);if(!I)throw new Error(`Transaction response not found for ${e}`);const C=I;return C.receipt=b,C}o||await new Promise(I=>setTimeout(I,n))}throw new Error(`Timeout waiting for transaction receipt ${e}`)};return r!==void 0?Promise.race([c(),new Promise((l,f)=>setTimeout(()=>{o=!0,f(`Timeout waiting for transaction receipt ${e}`)},r))]):c()}}class BF extends NCe{constructor(e){if(super(LF(e)?{provider:e.provider}:Dp({},e,{provider:e.signer.provider})),this.signer=void 0,this.txnOptions=void 0,this.signer=LF(e)?e:e.signer,!this.signer.provider)throw new Error("Signer must have a provider")}async getFeeOptions(e,...r){return{options:[]}}async getFeeOptionsRaw(e,r,n){return{options:[]}}async gasRefundOptions(e,...r){const{options:n}=await this.getFeeOptions(e,...r);return n}setTransactionOptions(e){this.txnOptions=e}async relay(e,r,n=!0){r!==void 0&&Ci.warn("LocalRelayer doesn't accept fee quotes");const i=mt.transaction.encodeBundleExecData(e),s=this.signer.sendTransaction(Dp({to:e.entrypoint,data:i},this.txnOptions,{gasLimit:9e6}));if(n){const o=await s;return o.receipt=await o.wait(),o}else return s}}function LF(t){return t&&typeof t=="object"&&typeof t.provider=="object"&&typeof t.getAddress=="function"&&typeof t.connect=="function"}const BCe="v1",LCe="v0.4.1",FCe="1e27d0fd295aa5897878939595ef0c6adc54b1a3";let Ld=function(t){return t.UNKNOWN="UNKNOWN",t.DROPPED="DROPPED",t.QUEUED="QUEUED",t.SENT="SENT",t.SUCCEEDED="SUCCEEDED",t.PARTIALLY_FAILED="PARTIALLY_FAILED",t.FAILED="FAILED",t}({}),jCe=function(t){return t.SEND="SEND",t.RECEIVE="RECEIVE",t.BRIDGE_DEPOSIT="BRIDGE_DEPOSIT",t.BRIDGE_WITHDRAW="BRIDGE_WITHDRAW",t.BURN="BURN",t.UNKNOWN="UNKNOWN",t}({}),UCe=function(t){return t.UNKNOWN="UNKNOWN",t.ERC20_TOKEN="ERC20_TOKEN",t.ERC1155_TOKEN="ERC1155_TOKEN",t}({}),$Ce=function(t){return t.DESC="DESC",t.ASC="ASC",t}({});class SZ{constructor(e,r){this.hostname=void 0,this.fetch=void 0,this.path="/rpc/Relayer/",this.ping=(n,i)=>this.fetch(this.url("Ping"),Qr({},n,i)).then(s=>Jr(s).then(o=>({status:o.status})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.version=(n,i)=>this.fetch(this.url("Version"),Qr({},n,i)).then(s=>Jr(s).then(o=>({version:o.version})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.runtimeStatus=(n,i)=>this.fetch(this.url("RuntimeStatus"),Qr({},n,i)).then(s=>Jr(s).then(o=>({status:o.status})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.getSequenceContext=(n,i)=>this.fetch(this.url("GetSequenceContext"),Qr({},n,i)).then(s=>Jr(s).then(o=>({data:o.data})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.getChainID=(n,i)=>this.fetch(this.url("GetChainID"),Qr({},n,i)).then(s=>Jr(s).then(o=>({chainID:o.chainID})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.sendMetaTxn=(n,i,s)=>this.fetch(this.url("SendMetaTxn"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,txnHash:a.txnHash})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTxnNonce=(n,i,s)=>this.fetch(this.url("GetMetaTxnNonce"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({nonce:a.nonce})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTxnReceipt=(n,i,s)=>this.fetch(this.url("GetMetaTxnReceipt"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({receipt:a.receipt})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.simulate=(n,i,s)=>this.fetch(this.url("Simulate"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({results:a.results})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.updateMetaTxnGasLimits=(n,i,s)=>this.fetch(this.url("UpdateMetaTxnGasLimits"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({payload:a.payload})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.feeTokens=(n,i)=>this.fetch(this.url("FeeTokens"),Qr({},n,i)).then(s=>Jr(s).then(o=>({isFeeRequired:o.isFeeRequired,tokens:o.tokens})),s=>{throw Ur.new({cause:`fetch(): ${s.message||""}`})}),this.feeOptions=(n,i,s)=>this.fetch(this.url("FeeOptions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({options:a.options,sponsored:a.sponsored,quote:a.quote})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTxnNetworkFeeOptions=(n,i,s)=>this.fetch(this.url("GetMetaTxnNetworkFeeOptions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({options:a.options})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getMetaTransactions=(n,i,s)=>this.fetch(this.url("GetMetaTransactions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.sentTransactions=(n,i,s)=>this.fetch(this.url("SentTransactions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.pendingTransactions=(n,i,s)=>this.fetch(this.url("PendingTransactions"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,transactions:a.transactions})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getGasTank=(n,i,s)=>this.fetch(this.url("GetGasTank"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({gasTank:a.gasTank})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.addGasTank=(n,i,s)=>this.fetch(this.url("AddGasTank"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasTank:a.gasTank})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.updateGasTank=(n,i,s)=>this.fetch(this.url("UpdateGasTank"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasTank:a.gasTank})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getGasSponsor=(n,i,s)=>this.fetch(this.url("GetGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({gasSponsor:a.gasSponsor})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.addressGasSponsors=(n,i,s)=>this.fetch(this.url("AddressGasSponsors"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,gasSponsors:a.gasSponsors})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.listGasSponsors=(n,i,s)=>this.fetch(this.url("ListGasSponsors"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,gasSponsors:a.gasSponsors})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.addGasSponsor=(n,i,s)=>this.fetch(this.url("AddGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasSponsor:a.gasSponsor})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.updateGasSponsor=(n,i,s)=>this.fetch(this.url("UpdateGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,gasSponsor:a.gasSponsor})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.removeGasSponsor=(n,i,s)=>this.fetch(this.url("RemoveGasSponsor"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.reportGasSponsorUsage=(n,i,s)=>this.fetch(this.url("ReportGasSponsorUsage"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({gasSponsorUsage:a.gasSponsorUsage})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.nextGasTankBalanceAdjustmentNonce=(n,i,s)=>this.fetch(this.url("NextGasTankBalanceAdjustmentNonce"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({nonce:a.nonce})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.adjustGasTankBalance=(n,i,s)=>this.fetch(this.url("AdjustGasTankBalance"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({status:a.status,adjustment:a.adjustment})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.getGasTankBalanceAdjustment=(n,i,s)=>this.fetch(this.url("GetGasTankBalanceAdjustment"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({adjustment:a.adjustment})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.listGasTankBalanceAdjustments=(n,i,s)=>this.fetch(this.url("ListGasTankBalanceAdjustments"),Qr(n,i,s)).then(o=>Jr(o).then(a=>({page:a.page,adjustments:a.adjustments})),o=>{throw Ur.new({cause:`fetch(): ${o.message||""}`})}),this.hostname=e,this.fetch=(n,i)=>r(n,i)}url(e){return this.hostname+this.path+e}}const Qr=(t={},e={},r=null)=>({method:"POST",headers:Dp({},e,{"Content-Type":"application/json"}),body:JSON.stringify(t||{}),signal:r}),Jr=t=>t.text().then(e=>{let r;try{r=JSON.parse(e)}catch(n){let i="";throw n instanceof Error&&(i=n.message),Jk.new({status:t.status,cause:`JSON.parse(): ${i}: response text: ${e}`})}if(!t.ok){const n=typeof r.code=="number"?r.code:0;throw(VCe[n]||ui).new(r)}return r});let ui=class _Z extends Error{constructor(e,r,n,i,s){super(n),this.name=void 0,this.code=void 0,this.message=void 0,this.status=void 0,this.cause=void 0,this.msg=void 0,this.name=e||"WebrpcError",this.code=typeof r=="number"?r:0,this.message=n||`endpoint error ${this.code}`,this.msg=this.message,this.status=typeof i=="number"?i:0,this.cause=s,Object.setPrototypeOf(this,_Z.prototype)}static new(e){return new this(e.error,e.code,e.message||e.msg,e.status,e.cause)}},IZ=class TZ extends ui{constructor(e="WebrpcEndpoint",r=0,n="endpoint error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,TZ.prototype)}},Ur=class PZ extends ui{constructor(e="WebrpcRequestFailed",r=-1,n="request failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,PZ.prototype)}},kZ=class MZ extends ui{constructor(e="WebrpcBadRoute",r=-2,n="bad route",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,MZ.prototype)}},RZ=class OZ extends ui{constructor(e="WebrpcBadMethod",r=-3,n="bad method",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,OZ.prototype)}},DZ=class NZ extends ui{constructor(e="WebrpcBadRequest",r=-4,n="bad request",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,NZ.prototype)}},Jk=class BZ extends ui{constructor(e="WebrpcBadResponse",r=-5,n="bad response",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,BZ.prototype)}},LZ=class FZ extends ui{constructor(e="WebrpcServerPanic",r=-6,n="server panic",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,FZ.prototype)}},jZ=class UZ extends ui{constructor(e="WebrpcInternalError",r=-7,n="internal error",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,UZ.prototype)}},$Z=class qZ extends ui{constructor(e="WebrpcClientDisconnected",r=-8,n="client disconnected",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,qZ.prototype)}},VZ=class zZ extends ui{constructor(e="WebrpcStreamLost",r=-9,n="stream lost",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,zZ.prototype)}},HZ=class GZ extends ui{constructor(e="WebrpcStreamFinished",r=-10,n="stream finished",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,GZ.prototype)}};class J8 extends ui{constructor(e="Unauthorized",r=1e3,n="Unauthorized access",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,J8.prototype)}}class Z8 extends ui{constructor(e="PermissionDenied",r=1001,n="Permission denied",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,Z8.prototype)}}class X8 extends ui{constructor(e="MethodNotFound",r=1003,n="Method not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,X8.prototype)}}class eE extends ui{constructor(e="Aborted",r=1005,n="Request aborted",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,eE.prototype)}}let WZ=class KZ extends ui{constructor(e="InvalidArgument",r=2001,n="Invalid argument",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,KZ.prototype)}};class tE extends ui{constructor(e="Unavailable",r=2002,n="Unavailable resource",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,tE.prototype)}}class rE extends ui{constructor(e="QueryFailed",r=2003,n="Query failed",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,rE.prototype)}}let YZ=class QZ extends ui{constructor(e="NotFound",r=3e3,n="Resource not found",i=0,s){super(e,r,n,i,s),Object.setPrototypeOf(this,QZ.prototype)}},qCe=function(t){return t.WebrpcEndpoint="WebrpcEndpoint",t.WebrpcRequestFailed="WebrpcRequestFailed",t.WebrpcBadRoute="WebrpcBadRoute",t.WebrpcBadMethod="WebrpcBadMethod",t.WebrpcBadRequest="WebrpcBadRequest",t.WebrpcBadResponse="WebrpcBadResponse",t.WebrpcServerPanic="WebrpcServerPanic",t.WebrpcInternalError="WebrpcInternalError",t.WebrpcClientDisconnected="WebrpcClientDisconnected",t.WebrpcStreamLost="WebrpcStreamLost",t.WebrpcStreamFinished="WebrpcStreamFinished",t.Unauthorized="Unauthorized",t.PermissionDenied="PermissionDenied",t.MethodNotFound="MethodNotFound",t.Aborted="Aborted",t.InvalidArgument="InvalidArgument",t.Unavailable="Unavailable",t.QueryFailed="QueryFailed",t.NotFound="NotFound",t}({});const VCe={0:IZ,[-1]:Ur,[-2]:kZ,[-3]:RZ,[-4]:DZ,[-5]:Jk,[-6]:LZ,[-7]:jZ,[-8]:$Z,[-9]:VZ,[-10]:HZ,1e3:J8,1001:Z8,1003:X8,1005:eE,2001:WZ,2002:tE,2003:rE,3e3:YZ};var Q5=Object.freeze({__proto__:null,WebRPCVersion:BCe,WebRPCSchemaVersion:LCe,WebRPCSchemaHash:FCe,ETHTxnStatus:Ld,TransferType:jCe,FeeTokenType:UCe,SortOrder:$Ce,Relayer:SZ,WebrpcError:ui,WebrpcEndpointError:IZ,WebrpcRequestFailedError:Ur,WebrpcBadRouteError:kZ,WebrpcBadMethodError:RZ,WebrpcBadRequestError:DZ,WebrpcBadResponseError:Jk,WebrpcServerPanicError:LZ,WebrpcInternalErrorError:jZ,WebrpcClientDisconnectedError:$Z,WebrpcStreamLostError:VZ,WebrpcStreamFinishedError:HZ,UnauthorizedError:J8,PermissionDeniedError:Z8,MethodNotFoundError:X8,AbortedError:eE,InvalidArgumentError:WZ,UnavailableError:tE,QueryFailedError:rE,NotFoundError:YZ,errors:qCe});const zCe=[Ld.DROPPED,Ld.SUCCEEDED,Ld.PARTIALLY_FAILED,Ld.FAILED],HCe=[Ld.DROPPED,Ld.PARTIALLY_FAILED,Ld.FAILED],GCe=globalThis.fetch;class WCe{constructor(e){if(this.options=e,this.service=void 0,this.provider=void 0,this._fetch=(r,n)=>{const i={},{jwtAuth:s,projectAccessKey:o}=this.options;return s&&s.length>0&&(i.Authorization=`BEARER ${s}`),o&&o.length>0&&(i["X-Access-Key"]=o),n.headers=Dp({},n.headers,i),GCe(r,n)},this.service=new SZ(e.url,this._fetch),YCe(e.provider))this.provider=e.provider;else{const{jwtAuth:r,projectAccessKey:n}=this.options,i=VJ(e.provider.url,n,r);this.provider=new Iy(i,void 0,{staticNetwork:!0})}}async waitReceipt(e,r=1e3,n=5,i){typeof e!="string"&&(e=mt.transaction.intendedTransactionID(e)),Ci.info(`[rpc-relayer/waitReceipt] waiting for ${e}`);let s=0;for(;i===void 0||!i();){try{const{receipt:o}=await this.service.getMetaTxnReceipt({metaTxID:e});if(o&&o.txnReceipt&&o.txnReceipt!=="null"&&zCe.includes(o.status))return{receipt:o}}catch(o){if(s++,s===n)throw o}(i===void 0||!i())&&await new Promise(o=>setTimeout(o,r))}throw new Error(`Cancelled waiting for transaction receipt ${e}`)}async simulate(e,...r){const i=Ns.defaultAbiCoder().encode([mt.transaction.MetaTransactionsType],[mt.transaction.sequenceTxAbiEncode(r)]);return(await this.service.simulate({wallet:e,transactions:i})).results}async getFeeOptions(e,...r){const n=await this.service.feeTokens();if(n.isFeeRequired){const i=n.tokens.map(c=>c.symbol).join(", ");Ci.info(`[rpc-relayer/getFeeOptions] relayer fees are required, accepted tokens are ${i}`);const s=await this.getNonce(e);if(!this.provider)throw Ci.warn("[rpc-relayer/getFeeOptions] provider not set, needed for stub signature"),new Error("provider is not set");const{options:o,quote:a}=await this.service.feeOptions({wallet:e,to:e,data:mt.transaction.encodeBundleExecData({entrypoint:e,transactions:r,nonce:s})});return Ci.info(`[rpc-relayer/getFeeOptions] got refund options ${JSON.stringify(o,sb)}`),{options:o,quote:{_tag:"FeeQuote",_quote:a}}}else return Ci.info("[rpc-relayer/getFeeOptions] relayer fees are not required"),{options:[]}}async getFeeOptionsRaw(e,r,n){const{options:i,quote:s}=await this.service.feeOptions({wallet:e,to:e,data:Me(r),simulate:n==null?void 0:n.simulate});return{options:i,quote:{_tag:"FeeQuote",_quote:s}}}async gasRefundOptions(e,...r){const{options:n}=await this.getFeeOptions(e,...r);return n}async getNonce(e,r){Ci.info(`[rpc-relayer/getNonce] get nonce for wallet ${e} space: ${r}`);const n=r!==void 0?Nv(BigInt(r)):void 0,i=await this.service.getMetaTxnNonce({walletContractAddress:e,space:n}),s=BigInt(i.nonce),[o,a]=mt.transaction.decodeNonce(s);return Ci.info(`[rpc-relayer/getNonce] got next nonce for wallet ${e} ${a} space: ${o}`),s}async relay(e,r,n=!0){var i=this;Ci.info(`[rpc-relayer/relay] relaying signed meta-transactions ${JSON.stringify(e,sb)} with quote ${JSON.stringify(r,sb)}`);let s;if(r!==void 0&&(typeof r._quote=="string"?s=r._quote:Ci.warn("[rpc-relayer/relay] ignoring invalid fee quote")),!this.provider)throw Ci.warn("[rpc-relayer/relay] provider not set, failed relay"),new Error("provider is not set");const o=mt.transaction.encodeBundleExecData(e),a=await this.service.sendMetaTxn({call:{walletAddress:e.intent.wallet,contract:e.entrypoint,input:o},quote:s});if(Ci.info(`[rpc-relayer/relay] got relay result ${JSON.stringify(a,sb)}`),n)return this.wait(e.intent.id);{const c={hash:e.intent.id,confirmations:0,from:e.intent.wallet,wait:f=>Promise.reject(new Error("impossible"))},l=async function(u){var p;if(!i.provider)throw new Error("cannot wait for receipt, relayer has no provider set");const g=await i.wait(e.intent.id),y=(p=g.receipt)==null?void 0:p.transactionHash;if(!y)throw new Error("cannot wait for receipt, unknown native transaction hash");return Object.assign(c,g),i.provider.waitForTransaction(y,u)};return c.wait=l,c}}async wait(e,r,n=1e3,i=5){var s=this;let o=!1;const{receipt:a}=await(r!==void 0?Promise.race([this.waitReceipt(e,n,i,()=>o),new Promise((l,f)=>setTimeout(()=>{o=!0,f(`Timeout waiting for transaction receipt ${e}`)},r))]):this.waitReceipt(e,n,i));if(!a.txnReceipt||HCe.includes(a.status))throw new KCe(a);const c=JSON.parse(a.txnReceipt);return{blockHash:c.blockHash,blockNumber:Number(c.blockNumber),confirmations:1,from:typeof e=="string"?void 0:e.intent.wallet,hash:c.transactionHash,raw:a.txnReceipt,receipt:c,wait:async function(l){return s.provider.waitForTransaction(c.transactionHash,l)}}}}class KCe{constructor(e){this.receipt=e}}function YCe(t){return t&&typeof t=="object"&&typeof t.getNetwork=="function"&&typeof t.getBlockNumber=="function"}function QCe(t){return typeof t=="object"&&typeof t.simulate=="function"&&typeof t.getFeeOptions=="function"&&typeof t.gasRefundOptions=="function"&&typeof t.getNonce=="function"&&typeof t.relay=="function"&&typeof t.wait=="function"}function JCe(t){return t.getAddress!==void 0&&t.buildDeployTransaction!==void 0&&t.predecorateSignedTransactions!==void 0&&t.decorateTransactions!==void 0&&t.sign!==void 0&&t.notifyStatusChange!==void 0}class ZCe{constructor(e,r=!0){this.signer=e,this.eoa=r}getAddress(){return this.signer.getAddress()}async buildDeployTransaction(e){}async predecorateSignedTransactions(e){return[]}async decorateTransactions(e,r){return e}sign(e){return this.signer.signMessage(e)}notifyStatusChange(e,r,n){}suffix(){return new Uint8Array([2])}}let O0=function(t){return t[t.INITIAL=0]="INITIAL",t[t.SIGNING=1]="SIGNING",t[t.SIGNED=2]="SIGNED",t[t.ERROR=3]="ERROR",t}({});function XCe(t){return t===void 0||t.state===O0.INITIAL||t.state===O0.SIGNING}class nE{constructor(e,r=nE.randomTag()){this.tag=r,this.observers=[],this.signers=[],this.count=0,this.setSigners(e)}static randomTag(){return`default-${Me(da(8)).slice(2)}`}pullId(){return`${this.tag}-${this.count++}`}setSigners(e){this.signers=e.map(r=>JCe(r)?r:new ZCe(r))}async getSigners(){return Promise.all(this.signers.map(async function(e){return e.getAddress()}))}subscribe(e){return this.observers.push(e),()=>{this.observers=this.observers.filter(r=>r!==e)}}async notifyObservers(e,r,n){await Promise.all([...this.signers.map(async function(i){return i.notifyStatusChange(e,r,n)}),...this.observers.map(async function(i){return i(r,n)})])}async buildDeployTransaction(e){let r;for(const n of this.signers){const i=await n.buildDeployTransaction(e);r===void 0?r=i:i!=null&&i.transactions&&(r.transactions=i.transactions.concat(r.transactions))}return r}async predecorateSignedTransactions(e){const r=[];for(const n of this.signers)r.push(...await n.predecorateSignedTransactions(e??{}));return r}async decorateTransactions(e,r){for(const n of this.signers)e=await n.decorateTransactions(e,r??{});return e}signMessage(e){var r=this;const n=this.pullId();return new Promise(async function(i){const{message:s,metadata:o,callback:a,candidates:c}=e,l={ended:!1,message:s,signers:{}};let f=o??{};const u=b=>{f=b,r.notifyObservers(n,l,f)},p=()=>{try{r.notifyObservers(n,l,f);const b=Object.entries(l.signers).filter(([I,C])=>XCe(C));if(a&&a(l,u)||b.length===0){l.ended=!0,i(l),r.notifyObservers(n,l,f);return}}catch(b){console.error("Error while notifying observers",b)}};let g=r.signers;if(c){const b=await Promise.all(r.signers.map(async function(I){return I.getAddress()}));g=r.signers.filter((I,C)=>c.includes(b[C]))}const y=await Promise.allSettled(g.map(async function(b){const I=await b.getAddress();l.signers[I]={state:O0.SIGNING,request:b.sign(s,o??{}).then(C=>{const S=b.suffix();return l.signers[I]={state:O0.SIGNED,signature:C,suffix:S},p(),C}).catch(C=>{throw l.signers[I]={state:O0.ERROR,error:C},p(),C})}}));for(let b=0;bvi(e))):vi(t)}const jF=t=>{const e=new Map;for(const r of Object.keys(t.signers)){const n=t.signers[r];if(n.state===O0.SIGNED){const i=Ue(n.suffix),s=Cr(["bytes","bytes"],[n.signature,i]);e.set(r,{signature:s,isDynamic:i.length!==1||i[0]!==2})}}return e};let UF=class E3 extends z8{constructor(e){var r;if(BigInt(e.chainId)===0n&&!e.coders.signature.supportsNoChainId)throw new Error(`Sequence version ${e.config.version} doesn't support chainId 0`);super((r=e.provider)!=null?r:null),this.context=void 0,this.config=void 0,this.address=void 0,this.chainId=void 0,this.relayer=void 0,this.coders=void 0,this.orchestrator=void 0,this._reader=void 0,this.context=e.context,this.config=e.config,this.orchestrator=e.orchestrator,this.coders=e.coders,this.address=e.address,this.chainId=e.chainId,this.relayer=e.relayer,this._reader=e.reader}static newWallet(e){const r=mt.context.addressOf(e.context,e.coders.config.imageHashOf(e.config));return new E3(ld({},e,{address:r}))}reader(){if(this._reader)return this._reader;if(!this.provider)throw new Error("Wallet status provider requires a provider");return new mt.reader.OnChainReader(this.provider)}setConfig(e){this.config=e}setOrchestrator(e){this.orchestrator=e}setAddress(e){this.address=e}getSigners(){return this.orchestrator.getSigners()}async getAddress(){return this.address}async decorateTransactions(e){const r=await this.orchestrator.decorateTransactions(e);if(await this.reader().isDeployed(this.address))return r;const n=[{to:r.entrypoint,data:mt.transaction.encodeBundleExecData(r),revertOnError:!0}],i=await this.buildDeployTransaction();return i&&n.unshift(...i.transactions),{entrypoint:this.context.guestModule,chainId:this.chainId,intent:r.intent,transactions:n}}async buildDeployTransaction(e){if(e!=null&&e.ignoreDeployed&&await this.reader().isDeployed(this.address))return;const r=this.coders.config.imageHashOf(this.config);if(mt.context.addressOf(this.context,r)!==this.address)throw new Error(`First address of config ${r} doesn't match wallet address ${this.address}`);const n=E3.buildDeployTransaction(this.context,r);if(e!=null&&e.includeChildren){const i=await this.orchestrator.buildDeployTransaction(e);i&&(n.transactions=i.transactions.concat(n.transactions))}return n}async deploy(e){const r=await this.buildDeployTransaction(e);if(r!==void 0){if(!this.relayer)throw new Error("Wallet deploy requires a relayer");return this.relayer.relay(ld({},r,{chainId:this.chainId,intent:{id:Me(da(32)),wallet:this.address}}))}}static buildDeployTransaction(e,r){const n=new $i(Ps.factory.abi);return{entrypoint:e.guestModule,transactions:[{to:e.factory,data:n.encodeFunctionData(n.getFunction("deploy"),[e.mainModule,r]),gasLimit:1e5,delegateCall:!1,revertOnError:!0,value:0}]}}async buildUpdateConfigurationTransaction(e){if(this.coders.config.update.isKindUsed){const r=await this.reader().implementation(this.address),n=r&&r===this.context.mainModuleUpgradable;return this.coders.config.update.buildTransaction(this.address,e,this.context,n?"later":"first")}return this.coders.config.update.buildTransaction(this.address,e,this.context)}async getNonce(e=0){const r=await this.reader().nonce(this.address,e);if(r===void 0)throw new Error("Unable to determine nonce");return Number(r)}async signDigest(e,r){const n=RF(this.address,this.chainId,e);if(this.coders.config.hasSubdigest(this.config,n))return this.coders.signature.encodeSigners(this.config,new Map,[n],this.chainId).encoded;const i=ld({},r,{digest:e,chainId:this.chainId,address:this.address,config:this.config}),s=Ue(n),o=await this.orchestrator.signMessage({candidates:this.coders.config.signersOf(this.config).map(c=>c.address),message:s,metadata:i,callback:(c,l)=>{const f=jF(c),u=ld({},i,{parts:f});return l(u),this.coders.signature.hasEnoughSigningPower(this.config,f)}}),a=jF(o);return this.coders.signature.encodeSigners(this.config,a,[],this.chainId).encoded}signMessage(e){return this.signDigest(gr(e),{message:e})}signTypedData(e,r,n){const i=Dk({domain:e,types:r,message:n});return this.signDigest(i)}signTransactionBundle(e){if(e.entrypoint!==this.address)throw new Error(`Invalid entrypoint: ${e.entrypoint} !== ${this.address}`);return this.signTransactions(e.transactions,e.nonce)}async fetchNonceOrSpace(e){let r;if(e&&e.space!==void 0)r=BigInt(e.space);else{if(e===void 0)return this.randomNonce();if(e&&e.serial===!0)r=0;else return e}const n=await this.reader().nonce(this.address,r);if(n===void 0)throw new Error("Unable to determine nonce");return mt.transaction.encodeNonce(r,n)}randomNonce(){const e=BigInt(Me(da(12)));return mt.transaction.encodeNonce(e,0)}async signTransactions(e,r,n){const i=await FF(e),s=mt.transaction.fromTransactionish(this.address,i);s.length===0&&s.push({to:this.address,data:"0x",value:0,gasLimit:0,delegateCall:!1,revertOnError:!0});const o=await this.fetchNonceOrSpace(r),a=mt.transaction.digestOfTransactions(o,s),c=ld({digest:a,transactions:s},n),l=await this.signDigest(a,c);return{intent:{id:RF(this.address,this.chainId,a),wallet:this.address},chainId:this.chainId,transactions:s,entrypoint:this.address,nonce:o,signature:l}}async sendSignedTransaction(e,r){if(!this.relayer)throw new Error("Wallet sendTransaction requires a relayer");return this.relayer.relay(e,r)}async sendTransaction(e,r){let n;(r==null?void 0:r.nonce)!==void 0?n=r.nonce:r!=null&&r.serial?n={serial:!0}:n=this.randomNonce();const i=await this.signTransactions(e,n),s=await this.decorateTransactions(i);return this.sendSignedTransaction(s,r==null?void 0:r.quote)}async fillGasLimits(e){const r=await FF(e),n=mt.transaction.fromTransactionish(this.address,r),i=this.relayer;if(!i)throw new Error("Wallet fillGasLimits requires a relayer");const s=await i.simulate(this.address,...n);return n.map((o,a)=>{const c=o.gasLimit?Number(o.gasLimit):s[a].gasLimit;return ld({},o,s[a],{gasLimit:c})})}connect(e,r){return new E3({coders:this.coders,context:this.context,config:this.config,chainId:this.chainId,address:this.address,orchestrator:this.orchestrator,reader:this._reader,provider:e,relayer:r??this.relayer})}signTransaction(e){throw new Error("Method not implemented.")}};function Al(){return Al=Object.assign?Object.assign.bind():function(t){for(var e=1;e=BigInt(i.value))return i}else if(i.token.contractAddress&&i.token.type===Q5.FeeTokenType.ERC20_TOKEN&&await new Dn(i.token.contractAddress,n,this.provider).balanceOf(this.account.address)>=BigInt(i.value))return i;throw new Error("No fee option available - not enough balance")}async sendTransaction(e,r){var n,i,s,o,a;const c=await this.account.prepareTransactions({txs:e,chainId:this.chainId,stubSignatureOverrides:(n=(i=this.options)==null?void 0:i.stubSignatureOverrides)!=null?n:new Map,simulateForFeeOptions:r==null?void 0:r.simulateForFeeOptions}),f=await((s=(o=this.options)==null?void 0:o.selectFee)!=null?s:this.defaultSelectFee.bind(this))(e,c.feeOptions),u=[...c.transactions,...eAe(f)];return this.account.sendTransaction(u,this.chainId,c.feeQuote,void 0,void 0,((a=this.options)==null?void 0:a.nonceSpace)!==void 0?{nonceSpace:this.options.nonceSpace}:void 0)}getBalance(e){return this.provider.getBalance(this.account.address,e)}call(e,r){return this.provider.call(Al({},e,{blockTag:r}))}async resolveName(e){const r=await this.provider.resolveName(e);if(!r)throw new Error(`Could not resolve name ${e}`);return r}connect(e){throw new Error("Method not implemented.")}signTransaction(e){throw new Error("Method not implemented.")}getTransactionCount(e){throw new Error("Method not implemented.")}estimateGas(e){throw new Error("Method not implemented.")}getChainId(){return Promise.resolve(Number(this.chainId))}getGasPrice(){throw new Error("Method not implemented.")}getFeeData(){throw new Error("Method not implemented.")}getNonce(e){throw new Error("Method not implemented.")}populateCall(e){throw new Error("Method not implemented.")}checkTransaction(e){throw new Error("Method not implemented.")}async populateTransaction(e){throw new Error("Method not implemented.")}_checkProvider(e){throw new Error("Method not implemented.")}}class rAe{async isDeployed(e){return!1}async implementation(e){}async imageHash(e){}async nonce(e,r){return 0n}async isValidSignature(e,r,n){throw new Error("Method not supported.")}}class Ix{constructor(e){this.address=void 0,this.networks=void 0,this.tracker=void 0,this.contexts=void 0,this.migrator=void 0,this.migrations=void 0,this.orchestrator=void 0,this.jwt=void 0,this.projectAccessKey=void 0,this.address=Qt(e.address),this.contexts=e.contexts,this.tracker=e.tracker,this.networks=e.networks,this.orchestrator=e.orchestrator,this.jwt=e.jwt,this.projectAccessKey=e.projectAccessKey,this.migrations=e.migrations||DF.DefaultMigrations,this.migrator=new OF.Migrator(e.tracker,this.migrations,this.contexts)}getSigner(e,r){return new tAe(this,e,r)}static async new(e){var r;const i=new OF.Migrator(e.tracker,(r=e.migrations)!=null?r:DF.DefaultMigrations,e.contexts).lastMigration(),s=i.configCoder,o=s.fromSimple(e.config),a=s.imageHashOf(o),c=e.contexts[i.version],l=mt.context.addressOf(c,a);return await e.tracker.saveCounterfactualWallet({config:o,context:Object.values(e.contexts)}),new Ix({address:l,tracker:e.tracker,contexts:e.contexts,networks:e.networks,orchestrator:e.orchestrator,migrations:e.migrations,projectAccessKey:e.projectAccessKey})}getAddress(){return Promise.resolve(this.address)}get version(){return this.migrator.lastMigration().version}get coders(){const e=this.migrator.lastMigration();return{signature:e.signatureCoder,config:e.configCoder}}network(e){const r=BigInt(e),n=this.networks.find(i=>r===BigInt(i.chainId));if(!n)throw new Error(`Network not found for chainId ${e}`);return n}providerFor(e){const r=this.network(e);if(!r.provider&&!r.rpcUrl)throw new Error(`Provider not found for chainId ${e}`);const n=new ca(r.name,r.chainId);return r.provider||new Iy(VJ(r.rpcUrl,this.projectAccessKey,this.jwt),n,{staticNetwork:n})}reader(e){return BigInt(e)===0n?new rAe:new mt.reader.OnChainReader(this.providerFor(e))}relayer(e){const r=this.network(e);if(!r.relayer)throw new Error(`Relayer not found for chainId ${e}`);return QCe(r.relayer)?r.relayer:new WCe(Al({},r.relayer,this.projectAccessKey?{projectAccessKey:this.projectAccessKey}:{jwtAuth:this.jwt}))}setOrchestrator(e){this.orchestrator=e}setJwt(e){this.jwt=e}contextFor(e){const r=this.contexts[e];if(!r)throw new Error(`Context not found for version ${e}`);return r}walletForStatus(e,r){const n=As.coderFor(r.version);return this.walletFor(e,this.contextFor(r.version),r.config,n)}walletFor(e,r,n,i){const s=BigInt(e)===0n;return new UF({config:n,context:r,chainId:e,coders:i,relayer:s?void 0:this.relayer(e),address:this.address,orchestrator:this.orchestrator,reader:this.reader(e)})}async status(e,r=!1){var n=this;const i=this.reader(e).isDeployed(this.address),s=this.tracker.imageHashOfCounterfactualWallet({wallet:this.address}).then(F=>{if(!F)throw new Error(`Counterfactual imageHash not found for wallet ${this.address}`);return F}),o=s.then(F=>TCe.counterfactualVersion(this.address,F.imageHash,Object.values(this.contexts))),a=async function(){if(!await i)return o;const z=await n.reader(e).implementation(n.address);if(!z)throw new Error(`Implementation not found for wallet ${n.address}`);const _=Object.values(n.contexts);for(let $=0;$<_.length;$++)if(_[$].mainModule===z||_[$].mainModuleUpgradable===z)return _[$].version;throw new Error(`Version not found for implementation ${z}`)}(),c=async function(){const F=await n.reader(e).imageHash(n.address);if(F)return F;const z=await s;if(z)return z.imageHash;throw new Error(`On-chain imageHash not found for wallet ${n.address}`)}(),l=async function(){const F=await c,z=await n.tracker.configOfImageHash({imageHash:F});if(z)return z;throw new Error(`On-chain config not found for imageHash ${F}`)}(),f=await a,u=await c;let p=u,g=f,y=[];if(f!==this.version){const F=await this.migrator.getAllMigratePresignedTransaction({address:this.address,fromImageHash:u,fromVersion:f,chainId:e});p=F.lastImageHash,g=F.lastVersion,y=F.signedMigrations}const b=await this.tracker.loadPresignedConfiguration({wallet:this.address,fromImageHash:p,longestPath:r}),I=b&&b.length>0?b[b.length-1].nextImageHash:p,C=await this.tracker.configOfImageHash({imageHash:I});if(!C)throw new Error(`Config not found for imageHash ${I}`);const S=await i,O=await s,L=As.coderFor(g).config.checkpointOf(C);return{original:Al({},O,{version:await o}),onChain:{imageHash:u,config:await l,version:f,deployed:S},fullyMigrated:g===this.version,signedMigrations:y,version:g,presignedConfigurations:b,imageHash:I,config:C,checkpoint:L,canOnchainValidate:f===this.version&&S}}mustBeFullyMigrated(e){if(!e.fullyMigrated)throw new Error(`Wallet ${this.address} is not fully migrated`)}async predecorateSignedTransactions(e,r){const n=await this.orchestrator.predecorateSignedTransactions({chainId:r}),i=await this.predecorateTransactions([],e,r);return mt.transaction.fromTransactionish(this.address,i).length>0&&n.push(await this.signTransactions(i,r)),n}async predecorateTransactions(e,r,n){if(r.onChain.imageHash!==r.imageHash){const s=await this.walletForStatus(n,r).buildUpdateConfigurationTransaction(r.config);return[Array.isArray(e)?e:[e],s.transactions].flat()}return e}async decorateTransactions(e,r,n){var i,s;if(!Array.isArray(e))return this.decorateTransactions([e],r,n);n=(i=n)!=null?i:e[0].chainId;const o=await this.buildBootstrapTransactions(r,n),a=o.transactions.length>0;if(!a&&e.length===1)return e[0];const{entrypoint:c}=a?o:e[0],l={entrypoint:c,chainId:n,intent:(s=e[0])==null?void 0:s.intent,transactions:[...o.transactions,...e.map(f=>({to:f.entrypoint,data:mt.transaction.encodeBundleExecData(f),gasLimit:0,delegateCall:!1,revertOnError:!0,value:0}))]};if(!r.onChain.deployed){const f=mt.transaction.subdigestOfGuestModuleTransactions(this.contexts[this.version].guestModule,n,l.transactions);l.intent===void 0?l.intent={id:f,wallet:this.address}:l.intent.id=f}return l}async decorateSignature(e,r){if(!r.presignedConfigurations||r.presignedConfigurations.length===0)return e;const n=this.coders.signature,i=r.presignedConfigurations.map(o=>o.signature),s=n.chainSignatures(e,i);return n.trim(s)}async publishWitnessFor(e,r=0){const n=Oo(`This is a Sequence account woo! ${Date.now()}`),i=await this.status(r),s=this.coders.config.fromSimple({threshold:e.length,checkpoint:0,signers:e.map(f=>({address:f,weight:1}))}),a=await this.walletFor(r,i.original.context,s,this.coders).signDigest(n),c=this.coders.signature.decode(a),l=this.coders.signature.signaturesOfDecoded(c);if(l.length===0)throw new Error("No signatures found");return this.tracker.saveWitnesses({wallet:this.address,digest:n,chainId:r,signatures:l})}async publishWitness(){const e=Oo(`This is a Sequence account woo! ${Date.now()}`),r=await this.signDigest(e,0,!1),n=this.coders.signature.decode(r),i=this.coders.signature.signaturesOfDecoded(n);return this.tracker.saveWitnesses({wallet:this.address,digest:e,chainId:0,signatures:i})}async signDigest(e,r,n=!0,i="ignore",s){const o=BigInt(r)===0n?this.networks[0].chainId:r,a=await this.status(o);if(this.mustBeFullyMigrated(a),!a.canOnchainValidate&&i==="throw")throw new Error("Wallet cannot validate onchain");const l=await this.walletForStatus(r,a).signDigest(e,s),f=n?this.decorateSignature(l,a):l;if(!a.canOnchainValidate)switch(i){case"ignore":return f;case"eip6492":return this.buildEIP6492Signature(await f,a,r)}return f}buildOnChainSignature(e){const r=mt.signature.subdigestOf({digest:Me(e),chainId:0,address:this.address}),n=Me(r),i=this.coders.config.fromSimple({threshold:32768,checkpoint:0,signers:[],subdigests:[n]}),s=new $i(Ps.mainModule.abi),o={entrypoint:this.address,transactions:[{to:this.address,data:s.encodeFunctionData("setExtraImageHash",[this.coders.config.imageHashOf(i),"57896044618658097711785492504343953926634992332820282019728792003956564819968"]),gasLimit:25e4}]};this.tracker.saveWalletConfig({config:i});const a=this.coders.signature.encodeSigners(i,new Map,[n],0).encoded;return{bundle:o,signature:a}}async buildEIP6492Signature(e,r,n){const i=await this.buildBootstrapTransactions(r,n);if(i.transactions.length===0)throw new Error("Cannot build EIP-6492 signature without bootstrap transactions");const s=Ns.defaultAbiCoder().encode(["address","bytes","bytes"],[i.entrypoint,mt.transaction.encodeBundleExecData(i),e]);return Cr(["bytes","bytes32"],[s,mt.EIP6492.EIP_6492_SUFFIX])}async editConfig(e){const r=await this.status(0).then(i=>i.config),n=this.coders.config.editConfig(r,Al({},e,{checkpoint:this.coders.config.checkpointOf(r)+1n}));return this.updateConfig(n)}async updateConfig(e){if(!this.coders.config.isWalletConfig(e))throw new Error(`Invalid config for wallet ${this.address}`);const r=this.coders.config.imageHashOf(e),n=this.coders.signature.hashSetImageHash(r),i=await this.signDigest(n,0,!1);await this.tracker.savePresignedConfiguration({wallet:this.address,nextConfig:e,signature:i});const s=await this.tracker.configOfImageHash({imageHash:r,noCache:!0});if(!s||this.coders.config.imageHashOf(s)!==r)throw Error(`Reverse lookup failed for imageHash ${r}`)}async buildBootstrapTransactions(e,r){var n;const i=await this.orchestrator.buildDeployTransaction({chainId:r}),s=(n=i==null?void 0:i.transactions)!=null?n:[];if(!e.onChain.deployed){const c=UF.buildDeployTransaction(e.original.context,e.original.imageHash);s.push(...c.transactions)}s.push(...e.signedMigrations.map(c=>({to:c.tx.entrypoint,data:mt.transaction.encodeBundleExecData(c.tx),value:0,gasLimit:0,revertOnError:!0,delegateCall:!1})));const o=e.signedMigrations.length>0?e.signedMigrations[0].tx.intent.id:mt.transaction.subdigestOfGuestModuleTransactions(this.contexts[this.version].guestModule,r,s),{guestModule:a}=this.contextFor(e.version);return{entrypoint:a,transactions:s,chainId:r,intent:{id:o,wallet:this.address}}}async bootstrapTransactions(e,r){const n=r||await this.status(e);return this.buildBootstrapTransactions(n,e)}async doBootstrap(e,r,n){const i=await this.bootstrapTransactions(e,n);return this.relayer(e).relay(Al({},i,{chainId:e}),r)}signMessage(e,r,n="ignore"){return this.signDigest(gr(e),r,!0,n)}async signTransactions(e,r,n,i){const s=n||await this.status(r);this.mustBeFullyMigrated(s);const o=this.walletForStatus(r,s),a={address:this.address,digest:"",chainId:r,config:{version:this.version},decorate:!0,cantValidateBehavior:"ignore"},c=i!=null&&i.serial?{serial:!0}:(i==null?void 0:i.nonceSpace)!==void 0?{space:i.nonceSpace}:void 0,l=await o.signTransactions(e,c,a);return Al({},l,{signature:await this.decorateSignature(l.signature,s)})}async signMigrations(e,r){const n=await this.status(e);if(n.fullyMigrated)return!1;const i=this.walletForStatus(e,n),s=r(i.config),o=await this.migrator.signNextMigration(this.address,n.version,i,s);if(!o)return!1;await this.tracker.saveWalletConfig({config:s});const a=As.coderFor(s.version).config,c=a.imageHashOf(s),l=await this.tracker.configOfImageHash({imageHash:c,noCache:!0});if(!l||a.imageHashOf(l)!==c)throw Error(`Reverse lookup failed for imageHash ${c}`);return await this.tracker.saveMigration(this.address,o,this.contexts),!0}async signAllMigrations(e){var r=this;const n=[];return{signedMigrations:(await Promise.all(this.networks.map(async function(o){try{return await r.signMigrations(o.chainId,e)}catch(a){return console.warn(`Failed to sign migrations for chain ${o.chainId}`,a),n.push(o.chainId),null}}))).filter(o=>o!==null),failedChains:n}}async isMigratedAllChains(){var e=this;const r=[];return{migratedAllChains:(await Promise.all(this.networks.map(async function(s){try{return await e.status(s.chainId)}catch(o){return r.push(s.chainId),console.warn(`Failed to get status for chain ${s.chainId}`,o),{fullyMigrated:!0}}}))).every(s=>s.fullyMigrated),failedChains:r}}async sendSignedTransactions(e,r,n,i,s){if(!Array.isArray(e))return this.sendSignedTransactions([e],r,n,i,s);const o=i||await this.status(r);this.mustBeFullyMigrated(o);const a=await this.decorateTransactions(e,o,r);return s==null||s(a),this.relayer(r).relay(a,n)}async fillGasLimits(e,r,n){return this.walletForStatus(r,n||await this.status(r)).fillGasLimits(e)}async gasRefundQuotes(e,r,n,i,s){const o=i||await this.status(r),a=this.walletForStatus(r,o),c=await this.predecorateTransactions(e,o,r),l=mt.transaction.fromTransactionish(this.address,c),f=a.coders.config.buildStubSignature(a.config,n),u=Me(da(32)),p={chainId:r,intent:{id:u,wallet:this.address},signature:f,transactions:l,entrypoint:this.address,nonce:0},g=await this.decorateTransactions(p,o),y=mt.transaction.encodeBundleExecData(g),b=await this.relayer(r).getFeeOptionsRaw(g.entrypoint,y,s);return Al({},b,{decorated:g})}async prepareTransactions(e){const r=await this.status(e.chainId),n=await this.fillGasLimits(e.txs,e.chainId,r),i=await this.gasRefundQuotes(n,e.chainId,e.stubSignatureOverrides,r,{simulate:e.simulateForFeeOptions}),s=mt.transaction.unwind(this.address,i.decorated.transactions);return{transactions:n,flatDecorated:s,feeOptions:i.options,feeQuote:i.quote}}async sendTransaction(e,r,n,i=!1,s,o){const a=await this.status(r),c=i?e:await this.predecorateTransactions(e,a,r),f=mt.transaction.fromTransactionish(this.address,c).length>0?await this.signTransactions(c,r,void 0,o):void 0,u=await this.orchestrator.predecorateSignedTransactions({chainId:r}),p=[];return f!==void 0&&f.transactions.length>0&&p.push(f),p.push(...u.filter(g=>g.transactions.length>0)),this.sendSignedTransactions(p,r,n,void 0,s)}async signTypedData(e,r,n,i,s="ignore"){const o=Dk({domain:e,types:r,message:n});return this.signDigest(o,i,!0,s)}async getSigners(){var e=this;const r=n=>n.length?n[n.length-1]:void 0;return(await Promise.all(this.networks.map(async function({chainId:n,name:i}){try{var s;const o=await e.status(n);let a=(s=r(o.presignedConfigurations))==null?void 0:s.nextImageHash;if(!a&&o.onChain.version!==o.version){const u=r(o.signedMigrations);if(u){const{toVersion:p,toConfig:g}=u;a=As.genericCoderFor(p).config.imageHashOf(g)}}a||(a=o.onChain.imageHash);const c=await e.tracker.configOfImageHash({imageHash:a});if(!c)throw new Error(`unable to find config for image hash ${a}`);return As.genericCoderFor(c.version).config.signersOf(c).map(u=>Al({},u,{network:n}))}catch(o){return console.warn(`unable to get signers on network ${n} ${i}`,o),[]}}))).flat()}async getAllSigners(){var e=this;const r=[];return await Promise.all(this.networks.map(async function(n){const i=n.chainId,s=await e.status(i,!0),o=[s.onChain.imageHash,...s.onChain.version!==s.version?s.signedMigrations.map(a=>As.coderFor(a.toVersion).config.imageHashOf(a.toConfig)):[],...s.presignedConfigurations.map(a=>a.nextImageHash)];return Promise.all(o.map(async function(a,c){const l=c===o.length-1,f=await e.tracker.configOfImageHash({imageHash:a});if(!f){console.warn(`AllSigners may be incomplete, config not found for imageHash ${a}`);return}As.genericCoderFor(f.version).config.signersOf(f).forEach(g=>{const y=r.find(b=>b.address===g.address&&b.network===i);if(y&&l&&y.flaggedForRemoval){y.flaggedForRemoval=!1;return}y||r.push({address:g.address,weight:g.weight,network:i,flaggedForRemoval:!l})})}))})),r}}const nAe=async()=>window.crypto.subtle.generateKey({name:"AES-GCM",length:256},!1,["encrypt","decrypt"]),$F=async(t,e)=>{const n=new TextEncoder().encode(t),i=await window.crypto.subtle.importKey("raw",n,"PBKDF2",!1,["deriveBits","deriveKey"]);return await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:e,iterations:31e4,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},qF=t=>Ue(t),VF=async(t,e)=>{const n=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(12)),s=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},t,n);return{iv:i,data:s}},zF=async(t,e)=>{const{iv:r,data:n}=e;try{const i=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:r},t,n);return new TextDecoder().decode(i)}catch{throw new Error("Could not decrypt data")}},U_=(t,e)=>e.some(r=>t instanceof r);let HF,GF;function iAe(){return HF||(HF=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function sAe(){return GF||(GF=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const $_=new WeakMap,E9=new WeakMap,iE=new WeakMap;function oAe(t){const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{r(gp(t.result)),i()},o=()=>{n(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return iE.set(e,t),e}function aAe(t){if($_.has(t))return;const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{r(),i()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});$_.set(t,e)}let q_={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return $_.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return gp(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function JZ(t){q_=t(q_)}function cAe(t){return sAe().includes(t)?function(...e){return t.apply(V_(this),e),gp(this.request)}:function(...e){return gp(t.apply(V_(this),e))}}function lAe(t){return typeof t=="function"?cAe(t):(t instanceof IDBTransaction&&aAe(t),U_(t,iAe())?new Proxy(t,q_):t)}function gp(t){if(t instanceof IDBRequest)return oAe(t);if(E9.has(t))return E9.get(t);const e=lAe(t);return e!==t&&(E9.set(t,e),iE.set(e,t)),e}const V_=t=>iE.get(t);function fAe(t,e,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=gp(o);return n&&o.addEventListener("upgradeneeded",c=>{n(gp(o.result),c.oldVersion,c.newVersion,gp(o.transaction),c)}),r&&o.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const uAe=["get","getKey","getAll","getAllKeys","count"],dAe=["put","add","delete","clear"],C9=new Map;function WF(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(C9.get(e))return C9.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,i=dAe.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||uAe.includes(r)))return;const s=async function(o,...a){const c=this.transaction(o,i?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),i&&c.done]))[0]};return C9.set(e,s),s}JZ(t=>({...t,get:(e,r,n)=>WF(e,r)||t.get(e,r,n),has:(e,r)=>!!WF(e,r)||t.has(e,r)}));const hAe=["continue","continuePrimaryKey","advance"],KF={},z_=new WeakMap,ZZ=new WeakMap,pAe={get(t,e){if(!hAe.includes(e))return t[e];let r=KF[e];return r||(r=KF[e]=function(...n){z_.set(this,ZZ.get(this)[e](...n))}),r}};async function*vAe(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,pAe);for(ZZ.set(r,e),iE.set(r,V_(e));e;)yield r,e=await(z_.get(r)||e.continue()),z_.delete(r)}function YF(t,e){return e===Symbol.asyncIterator&&U_(t,[IDBIndex,IDBObjectStore,IDBCursor])||e==="iterate"&&U_(t,[IDBIndex,IDBObjectStore])}JZ(t=>({...t,get(e,r,n){return YF(e,r)?vAe:t.get(e,r,n)},has(e,r){return YF(e,r)||t.has(e,r)}}));const gAe="@sequence-recovery",yAe=1,C3=async t=>fAe(gAe,yAe,{upgrade:e=>{e.createObjectStore(t)}}),mAe=async t=>{await(await C3(t)).clear("security")};function bAe(t,e){const r=t.replace("ipfs://ipfs/","").replace("ipfs://","");return t.startsWith("ipfs://")?`${e}${r}`:t}function wAe(t){return t.startsWith("ipfs://")}class XZ{constructor(e,r,n=1e3){this.provider=e,this.solver=r,this.window=n,this.pending=new Map}async runByEIP5719(e,r,n){const i=`${e}-${r}-${n}`,s=Date.now();if(this.pending.has(i)&&s-this.pending.get(i).timestamp10)throw new Error("EIP5719 - Too many tries");if(mt.signer.canRecover(n)){const c=mt.signer.recoverSigner(r,n);if(c&&c.toLowerCase()===t.toLowerCase())return n}try{if(await mt.signer.isValidSignature(t,r,n,e))return n}catch{}const o=await EAe(xAe(t,e).getAlternativeSignature(r));if(!o||o==="")throw new Error("EIP5719 - Invalid signature and no alternative signature");const a=Me(await(i||new CAe).resolve(o));if(!a||a==="")throw new Error("EIP5719 - Empty alternative signature");if(a===Me(n))throw new Error("EIP5719 - Alternative signature is invalid or the same");return eX(t,e,r,a,i,s+1)}class CAe{constructor(e="https://cloudflare-ipfs.com/ipfs/"){var r=this;this.gateway=e,this.uri=n=>wAe(n)?bAe(n,this.gateway):n,this.resolve=async function(n){const i=r.uri(n),s=await fetch(i);if(!s.ok)throw new Error(`URISolverIPFS - Failed to fetch ${i}`);return await s.text()}}}const AAe=(t,e)=>e.some(r=>t instanceof r);let QF,JF;function SAe(){return QF||(QF=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function _Ae(){return JF||(JF=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const tX=new WeakMap,H_=new WeakMap,rX=new WeakMap,A9=new WeakMap,Zk=new WeakMap;function IAe(t){const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{r(th(t.result)),i()},o=()=>{n(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(r=>{r instanceof IDBCursor&&tX.set(r,t)}).catch(()=>{}),Zk.set(e,t),e}function TAe(t){if(H_.has(t))return;const e=new Promise((r,n)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{r(),i()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});H_.set(t,e)}let G_={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return H_.get(t);if(e==="objectStoreNames")return t.objectStoreNames||rX.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return th(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function PAe(t){G_=t(G_)}function kAe(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){const n=t.call(S9(this),e,...r);return rX.set(n,e.sort?e.sort():[e]),th(n)}:_Ae().includes(t)?function(...e){return t.apply(S9(this),e),th(tX.get(this))}:function(...e){return th(t.apply(S9(this),e))}}function MAe(t){return typeof t=="function"?kAe(t):(t instanceof IDBTransaction&&TAe(t),AAe(t,SAe())?new Proxy(t,G_):t)}function th(t){if(t instanceof IDBRequest)return IAe(t);if(A9.has(t))return A9.get(t);const e=MAe(t);return e!==t&&(A9.set(t,e),Zk.set(e,t)),e}const S9=t=>Zk.get(t);function RAe(t,e,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=th(o);return n&&o.addEventListener("upgradeneeded",c=>{n(th(o.result),c.oldVersion,c.newVersion,th(o.transaction),c)}),r&&o.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",l=>i(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const OAe=["get","getKey","getAll","getAllKeys","count"],DAe=["put","add","delete","clear"],_9=new Map;function ZF(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(_9.get(e))return _9.get(e);const r=e.replace(/FromIndex$/,""),n=e!==r,i=DAe.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||OAe.includes(r)))return;const s=async function(o,...a){const c=this.transaction(o,i?"readwrite":"readonly");let l=c.store;return n&&(l=l.index(a.shift())),(await Promise.all([l[r](...a),i&&c.done]))[0]};return _9.set(e,s),s}PAe(t=>({...t,get:(e,r,n)=>ZF(e,r)||t.get(e,r,n),has:(e,r)=>!!ZF(e,r)||t.has(e,r)}));function Zl(){return Zl=Object.assign?Object.assign.bind():function(t){for(var e=1;e{try{const{Signer:p,Subdigest:g,Digest:y,"To-Config":b}=u;let I;switch(u["Signature-Type"]){case"eip-712":case"eth_sign":case"erc-1271":I=u["Signature-Type"];break;default:throw new Error(`unknown signature type ${u["Signature-Type"]}`)}let C;try{C=BigInt(u["To-Checkpoint"])}catch{throw new Error(`to checkpoint is not a number: ${u["To-Checkpoint"]}`)}if(C<=s)return[];if(!vw(p))throw new Error(`signer is not an address: ${p}`);if(!Gr(g,32))throw new Error(`subdigest is not a hash: ${g}`);if(!Gr(y,32))throw new Error(`digest is not a hash: ${y}`);let S;try{S=BigInt(u["Chain-ID"])}catch{throw new Error(`chain id is not a number: ${u["Chain-ID"]}`)}if(!Gr(b,32))throw new Error(`to config is not a hash: ${b}`);return[{id:f,signatureType:I,signer:p,subdigest:g,digest:y,chainId:S,toImageHash:b,toCheckpoint:C}]}catch(p){return console.warn(`invalid wallet ${n} config update ${f}:`,p),[]}}),a=new Map;let c=[];for(const f of o){let u=a.get(f.toImageHash);u||(u=new Map,a.set(f.toImageHash,u),c.push(f)),u.set(f.signer,f)}e.longestPath?c.sort(({toCheckpoint:f},{toCheckpoint:u})=>f===u?0:ff===u?0:f[S,{signature:"0x",isDynamic:!1}])),[],0);if(C>=BigInt(f.threshold)){p=I;break}}if(!p){console.warn(`unreachable configs with checkpoint > ${f.checkpoint} from config ${u}`);break}const b=p.toImageHash;try{const I=await this.configOfImageHash({imageHash:b});if(!I)throw new Error(`unable to find config ${b}`);if(!ir.config.isWalletConfig(I))throw new Error(`config ${b} is not v2`);const C=new Map((await Promise.all(y.map(async function(L){const{id:F,subdigest:z,signatureType:_}=g.get(L);try{let $=await(await I6(F,r.options.rateLimitRetryDelayMs)).text();switch(_){case"eip-712":$+="01";break;case"eth_sign":$+="02";break;case"erc-1271":$+="03";break}if(r.eip5719)try{$=Me(await r.eip5719.runByEIP5719(L,z,$))}catch{console.warn(`unable to run eip-5719 on config update ${F}`)}const ie=mt.signer.tryRecoverSigner(z,$);return[[L,{signature:$,isDynamic:ie!==L}]]}catch($){return console.warn(`unable to fetch signer ${L} config update ${F}:`,$),[]}}))).flat()),{encoded:S,weight:O}=ir.signature.encodeSigners(f,C,[],0);if(OL>BigInt(f.checkpoint))}catch(I){console.warn(`unable to reconstruct wallet ${n} update from config ${u} to config ${b}:`,I),c=c.filter(({toImageHash:C})=>C!==b)}}return l}savePresignedConfiguration(e){throw new Error("arweave backend does not support saving config updates")}saveWitnesses(e){throw new Error("arweave backend does not support saving signatures")}async configOfImageHash(e){var r=this;if(!e.noCache){const i=this.configs.get(e.imageHash);if(i)try{return await i}catch{const o=this.configs.get(e.imageHash);if(o)return o}}const n=async function(i){const s=Object.entries(await Pm({Type:"config",Config:i},r.options)).flatMap(([o,a])=>{try{const c=Number(a.Version);if(!c)throw new Error(`invalid version: ${a.Version}`);return[{id:o,version:c}]}catch(c){return console.warn(`config ${i} at ${o} invalid:`,c),[]}});switch(s.length){case 0:r.configs.set(i,Promise.resolve(void 0));return;case 1:break;default:console.warn(`multiple configs ${i} at ${s.map(({id:o})=>o).join(", ")}`);break}for(const{id:o,version:a}of s)try{const c=Zl({},await(await I6(o,r.options.rateLimitRetryDelayMs)).json(),{version:a});c.tree&&(c.tree=H1(c.tree));const l=As.coderFor(a).config.imageHashOf(c);if(l!==i)throw new Error(`image hash is ${l}, expected ${i}`);return r.configs.set(i,Promise.resolve(c)),c}catch(c){console.warn(`config at ${o} invalid:`,c)}r.configs.set(i,Promise.resolve(void 0))}(e.imageHash);return e.noCache||this.configs.set(e.imageHash,n),n}saveWalletConfig(e){throw new Error("arweave backend does not support saving configs")}async imageHashOfCounterfactualWallet(e){const r=Qt(e.wallet),n=Object.entries(await Pm({Type:"wallet",Wallet:r},this.options)).flatMap(([i,s])=>{try{const{"Deploy-Config":o}=s,a=Number(s["Deploy-Version"]);if(!a)throw new Error(`invalid version: ${s["Deploy-Version"]}`);if(!o)throw new Error("no deploy config");const c=mt.context.defaultContexts[a];if(!c)throw new Error(`unknown version: ${a}`);if(mt.context.addressOf(c,o)!==r)throw new Error(`incorrect v${a} deploy config: ${o}`);return[{id:i,imageHash:o,context:c}]}catch(o){return console.warn(`wallet ${r} at ${i} invalid:`,o),[]}});switch(n.length){case 0:return;case 1:break;default:console.warn(`multiple deploy configs for wallet ${r} at ${n.map(({id:i})=>i).join(", ")}, using first`);break}return n[0]}saveCounterfactualWallet(e){throw new Error("arweave backend does not support saving wallets")}async walletsOfSigner(e){var r=this;const n=Qt(e.signer),i=new Map;for(const[s,o]of Object.entries(await Pm({Type:["signature","config update"],Signer:n,Witness:e.allSignatures?void 0:"true"},this.options))){const{Wallet:a,Subdigest:c,Digest:l,"Chain-ID":f}=o;try{if(i.has(a))continue;let u;switch(o["Signature-Type"]){case"eip-712":u="01";break;case"eth_sign":u="02";break;case"erc-1271":u="03";break;default:throw new Error(`unknown signature type ${o["Signature-Type"]}`)}if(c!==mt.signature.subdigestOf({digest:l,chainId:f,address:a}))throw new Error("incorrect subdigest");const p=I6(s,this.options.rateLimitRetryDelayMs).then(async function(g){const y=await g.text()+u;if(r.eip5719)try{return Me(await r.eip5719.runByEIP5719(n,c,y))}catch{console.warn(`unable to run eip-5719 on signature ${s}`)}return y});i.set(a,{digest:l,chainId:BigInt(f),signature:p})}catch(u){console.warn(`signer ${n} signature ${s} of wallet ${a} invalid:`,u)}}return Promise.all([...i.entries()].map(async function([s,{digest:o,chainId:a,signature:c}]){return{wallet:s,proof:{digest:o,chainId:a,signature:await c}}}))}async getMigration(e,r,n,i){const s=Qt(e),o=Object.entries(await Pm({Type:"migration",Migration:s,"Chain-ID":BigInt(i).toString(),"From-Version":`${n}`,"From-Config":r},this.options)).flatMap(([O,L])=>{try{const{"To-Config":F,Executor:z}=L,_=Number(L["To-Version"]);if(!_)throw new Error(`invalid version: ${L["To-Version"]}`);if(!Gr(F,32))throw new Error(`to config is not a hash: ${F}`);if(!vw(z))throw new Error(`executor is not an address: ${z}`);return{id:O,toVersion:_,toImageHash:F,executor:z}}catch(F){return console.warn(`chain ${i} migration ${O} for v${n} wallet ${s} from config ${r} invalid:`,F),[]}});switch(o.length){case 0:return;case 1:break;default:console.warn(`multiple chain ${i} migrations for v${n} wallet ${s} from config ${r} at ${o.map(({id:O})=>O).join(", ")}, using first`);break}const{id:a,toVersion:c,toImageHash:l,executor:f}=o[0],[u,p]=await Promise.all([I6(a,this.options.rateLimitRetryDelayMs).then(O=>O.text()),this.configOfImageHash({imageHash:l})]);if(!p)throw new Error(`unable to find to config ${l} for migration`);const g=new $i(NAe),[y,b,I]=g.decodeFunctionData("execute",u),C=mt.transaction.fromTxAbiEncode(y),S=mt.transaction.subdigestOfTransactions(s,i,b,C);return{tx:{entrypoint:f,transactions:C,nonce:b,chainId:i,intent:{id:S,wallet:s},signature:I},fromVersion:n,toVersion:Number(c),toConfig:p}}saveMigration(e,r,n){throw new Error("arweave backend does not support saving migrations")}}async function Pm(t,e){var r,n,i,s;const o=(r=e==null?void 0:e.namespace)!=null?r:Lv.namespace,a=e==null?void 0:e.owners,c=(n=e==null?void 0:e.graphqlUrl)!=null?n:Lv.graphqlUrl,l=(i=e==null?void 0:e.rateLimitRetryDelayMs)!=null?i:Lv.rateLimitRetryDelayMs,f=(s=e==null?void 0:e.pageSize)!=null?s:100,u=e==null?void 0:e.maxResults,p=Object.entries(t).flatMap(([y,b])=>b===void 0?[]:[`{ name: "${o?`${o}-${y}`:y}", values: [${typeof b=="string"?`"${b}"`:b.map(I=>`"${I}"`).join(", ")}] }`]),g=[];for(let y=!0;y&&(u===void 0||g.length`"${S}"`).join(", ")}]`}) { pageInfo { @@ -890,7 +890,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho "stateMutability": "view", "type": "function" } -]`;class Tx{constructor(e){de(this,"isFetchingBalances",Or(!1));de(this,"isFetchingTokenInfo",Or(!1));de(this,"balances",Or([]));de(this,"userAddedTokens",Or([]));de(this,"local",{userAddedTokens:new Np(dh.TOKENS_USER_ADDITIONS)});this.store=e;const r=this.store.get(Nn);pX(r.networks,n=>{const i=this.store.get(yi).accountAddress.get();i&&n.length>0&&this.loadBalances(i,n)})}async loadBalances(e,r){const n=r.filter(o=>o.type===Ft.MAINNET),i=[];this.isFetchingBalances.set(!0),await Promise.allSettled(n.map(async o=>{if(!o.rpcUrl){console.warn(`No RPC URL found for network ${o.name}`);return}const a=new Iy(o.rpcUrl);try{const c=await a.getBalance(e);i.push({contractType:hh.NATIVE,contractAddress:bu,tokenID:"",accountAddress:e,balance:c.toString(),chainId:o.chainId,blockHash:Zg,blockNumber:0,contractInfo:E9e(XAe(o.chainId)),uniqueCollectibles:"0",isSummary:!0})}catch(c){console.error(c)}})),this.balances.set(i);const s=this.local.userAddedTokens.get()??[];this.userAddedTokens.set(s),s.length>0&&await Promise.allSettled(s.map(async o=>{await this.loadUserAddedTokenBalance(e,o)})),this.isFetchingBalances.set(!1)}async loadUserAddedTokenBalance(e,r){const n=this.store.get(Nn).providerForChainId(r.chainId);try{const s=await new Dn(r.address,jv,n).balanceOf(e),o=this.balances.get();if(!s){this.removeToken(r);return}o.push({contractType:r.contractType,contractAddress:r.address,tokenID:"",accountAddress:e,balance:s.toString(),chainId:r.chainId,blockHash:Zg,blockNumber:0,contractInfo:{address:r.address,chainId:r.chainId,decimals:r.decimals,name:r.symbol,symbol:r.symbol,type:"ERC20",logoURI:"",deployed:!0,bytecodeHash:"",extensions:{link:"",description:"",ogImage:"",originAddress:"",originChainId:0,blacklist:!1,verified:!0,verifiedBy:"User",featured:!1},updatedAt:"0"},uniqueCollectibles:"0",isSummary:!0}),this.balances.set(o)}catch(i){console.error(i)}}async updateTokenBalance(e){const r=this.store.get(Nn).providerForChainId(e.chainId);this.isFetchingBalances.set(!0);const n=this.store.get(yi).accountAddress.get();if(!n){console.warn("No account found");return}const i=this.balances.get();try{let s;e.contractType===hh.NATIVE?s=await r.getBalance(n):s=await new Dn(e.contractAddress,jv,r).balanceOf(n),i.map(o=>{o.contractAddress===e.contractAddress&&o.chainId===e.chainId&&(o.balance=s.toString())}),this.balances.set(i)}catch(s){console.error(s)}this.isFetchingBalances.set(!1)}async addToken(e){const r=this.local.userAddedTokens.get()??[];if(r.some(s=>s.chainId===e.chainId&&s.address===e.address))throw new Error(`Token with chainId ${e.chainId} and address ${e.address} already exists`);r.push(e),this.local.userAddedTokens.set(r),this.userAddedTokens.set(r);const i=this.store.get(yi).accountAddress.get();i&&(this.isFetchingBalances.set(!0),await this.loadUserAddedTokenBalance(i,e),this.isFetchingBalances.set(!1))}async removeToken(e){const r=this.local.userAddedTokens.get(),n=(r==null?void 0:r.filter(s=>!(s.chainId===e.chainId&&s.address===e.address)))??[];this.local.userAddedTokens.set(n),this.userAddedTokens.set(n);const i=this.balances.get().filter(s=>!(s.chainId===e.chainId&&s.contractAddress===e.address));this.balances.set(i)}async getTokenInfo(e,r){const n=this.store.get(Nn).providerForChainId(e);this.isFetchingTokenInfo.set(!0);try{const i=new Dn(r,jv,n),s=await i.decimals(),o=await i.symbol();if(this.isFetchingTokenInfo.set(!1),s&&o)return{decimals:Number(s),symbol:o};throw new Error(`Could not get decimals and symbol for token at ${r}`)}catch(i){throw console.error(i),new Error(`Error getting token info ${JSON.stringify(i)}`)}}clear(){this.local.userAddedTokens.set([]),this.isFetchingBalances.set(!1),this.isFetchingTokenInfo.set(!1),this.balances.set([])}}class yi{constructor(e){de(this,"isLoadingAccount",Or(!0));de(this,"account");de(this,"accountAddress",Or(void 0));de(this,"isPromptingForPassword",Or(!1));this.store=e,this.loadAccount(),this.store.get(Nn).networks.subscribe(n=>{this.account&&this.loadAccount()}),this.accountAddress.subscribe(n=>{n&&this.store.get(Nn).accountLoaded.set(!0)})}async signInWithRecoveryMnemonic(e,r,n){try{this.isLoadingAccount.set(!0);const i=V5.fromPhrase(r),s=new nE([i]),a=this.store.get(Nn).networks.get(),c=new Ix({address:e,tracker:Y_,contexts:cX,orchestrator:s,networks:a});n?await this.encryptRecoveryMnemonicWithPassword(r,c.address,n):await this.encryptRecoveryMnemonic(r,c.address),this.account=c,this.accountAddress.set(c.address)}catch(i){console.warn(i)}this.isLoadingAccount.set(!1)}async loadAccount(e){const r=await C3(yl.SECURITY),n=await r.get(yl.SECURITY,"mnemonic");var i=await r.get(yl.SECURITY,"key");let s;if(n&&!i&&!e){this.isPromptingForPassword.set(!0);return}n&&(i?s=await this.decryptRecoveryMnemonic(n,i):s=await this.decryptRecoveryMnemonicWithPassword(n,e)),s?e?this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic,e):this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic):setTimeout(()=>{this.isLoadingAccount.set(!1)},200)}async encryptRecoveryMnemonic(e,r){const n=await nAe(),i=JSON.stringify({wallet:r,mnemonic:e}),s=await VF(n,i);s.salt=qF(r);const o=await C3(yl.SECURITY);await o.put(yl.SECURITY,n,"key"),await o.put(yl.SECURITY,s,"mnemonic")}async encryptRecoveryMnemonicWithPassword(e,r,n){const i=qF(r),s=await $F(n,i),o=JSON.stringify({wallet:r,mnemonic:e}),a=await VF(s,o);a.salt=i,await(await C3(yl.SECURITY)).put(yl.SECURITY,a,"mnemonic")}async decryptRecoveryMnemonic(e,r){const n=await zF(r,e);return JSON.parse(n)}async decryptRecoveryMnemonicWithPassword(e,r){const n=e.salt,i=await $F(r,n),s=await zF(i,e);return JSON.parse(s)}logout(){this.account=void 0,this.accountAddress.set(void 0),mAe(yl.SECURITY);const e=this.store.get(Nn),r=this.store.get(Tx);e.clear(),r.clear(),localStorage.clear()}}const A9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M3.98%208.223A10.477%2010.477%200%200%200%201.934%2012C3.226%2016.338%207.244%2019.5%2012%2019.5c.993%200%201.953-.138%202.863-.395M6.228%206.228A10.451%2010.451%200%200%201%2012%204.5c4.756%200%208.773%203.162%2010.065%207.498a10.522%2010.522%200%200%201-4.293%205.774M6.228%206.228%203%203m3.228%203.228%203.65%203.65m7.894%207.894L21%2021m-3.228-3.228-3.65-3.65m0%200a3%203%200%201%200-4.243-4.243m4.242%204.242L9.88%209.88'%20/%3e%3c/svg%3e",S9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M2.036%2012.322a1.012%201.012%200%200%201%200-.639C3.423%207.51%207.36%204.5%2012%204.5c4.638%200%208.573%203.007%209.963%207.178.07.207.07.431%200%20.639C20.577%2016.49%2016.64%2019.5%2012%2019.5c-4.638%200-8.573-3.007-9.963-7.178Z'%20/%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M15%2012a3%203%200%201%201-6%200%203%203%200%200%201%206%200Z'%20/%3e%3c/svg%3e",vX=({label:t,labelLocation:e="top",value:r,onChange:n})=>{const[i,s]=D.useState(!1),o=()=>{s(!i)};return W.jsxs("div",{style:{position:"relative",width:"100%"},children:[W.jsx(Wn,{type:i?"text":"password",name:"password",label:t,labelLocation:e,value:r,onChange:n}),W.jsx("button",{type:"button",onClick:o,style:{position:"absolute",top:"50%",right:"12px",transform:"translateY(5%)",background:"none",border:"none",cursor:"pointer"},children:i?W.jsx("img",{src:A9e,style:{width:"25px",height:"25px"}}):W.jsx("img",{src:S9e,style:{width:"25px",height:"25px"}})})]})},vM="/wallet-recovery-app/assets/sequence-logo-B9LB7ao9.svg";function _9e(){const t=Ir(yi),e=yn(t.isLoadingAccount),r=yn(t.isPromptingForPassword),[n,i]=D.useState(""),[s,o]=D.useState(!1),[a,c]=D.useState(!1),l=async()=>{try{await t.loadAccount(n)}catch(p){console.warn(p),c(!0)}},f=()=>{o(!0)},u=()=>{t.logout(),o(!1),t.isLoadingAccount.set(!1)};return W.jsxs(xe,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:[W.jsxs(xe,{width:"full",style:{maxWidth:"800px"},children:[W.jsx(xe,{padding:"6",marginTop:"16",children:W.jsxs(xe,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:vM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Ge,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),!e&&W.jsxs(W.Fragment,{children:[W.jsx(xe,{marginTop:"8",children:W.jsxs($r,{flexDirection:"column",gap:"6",children:[W.jsx(Ge,{variant:"medium",color:"warning",textAlign:"center",children:"Warning section"}),W.jsx(Ge,{variant:"normal",color:"text100",marginBottom:"4",children:"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga."})]})}),W.jsxs(xe,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(xe,{children:W.jsx(Zt,{as:eY,to:"/recovery",variant:"primary",size:"lg",shape:"square",label:"Start Recovery",width:"full",marginTop:"16"})}),W.jsx(xe,{children:W.jsx(Zt,{variant:"text",size:"lg",shape:"square",label:"Learn more",width:"full",marginTop:"6"})})]})]}),e&&W.jsx(W.Fragment,{children:r?W.jsxs(xe,{flexDirection:"column",marginTop:"8",justifyContent:"center",alignItems:"center",children:[W.jsx(Ge,{variant:"large",color:"text100",marginBottom:"8",children:"Weclome back!"}),W.jsx(vX,{label:"Password",value:n,onChange:p=>{i(p.target.value),c(!1)}}),W.jsx(xe,{alignSelf:"flex-start",height:"6",children:a&&W.jsx(Ge,{variant:"small",color:"negative",marginLeft:"2",marginTop:"1",children:"Incorrect password"})}),W.jsx(Zt,{marginBottom:"3",variant:"primary",size:"lg",shape:"square",label:"Unlock",onClick:()=>{l()}}),W.jsx(xe,{children:W.jsx(Zt,{variant:"text",label:"The dog ate my password (Forgot Password)",onClick:()=>{f()}})})]}):W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx($r,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})})})]}),s&&W.jsx(Tc,{size:"md",onClose:()=>o(!1),children:W.jsxs($r,{flexDirection:"column",alignItems:"center",padding:"16",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",children:'Click "Reset" to START OVER and re-enter your mnemonic'}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:()=>{o(!1)},"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:"Reset",onClick:()=>{u()},"data-id":"signingContinue"})]})]})})]})}const I9e={"0x087Aa00C1f09464D1D6a9Ff0eE2377dBB7c7B324":[{wallet:"0xaf39AE56e001250FaCBd122b11A90d32A0aD6686",subdigest:"0x0f4490a7aa40f15929635252953ce594ba3342401c2c53eff56451dc147475da"}],"0x09A820a9109E5EC82DCfF24484b2047739a92Abc":[{wallet:"0xcF47342c7064AAA5BA0F4163bEA0c7545756b8BF",subdigest:"0xa598ddbe6372b985f60367a1a9c12cb99e20e38c782d9bc941ddaa9f4c9296e5"}],"0x0aBb5b9d20f06DAdF752CEeBe4df26E585A1d897":[{wallet:"0x3F00C5A7fEadD358429645b29b3d776C5f61892d",subdigest:"0x7c33d7864e6e6f92e39328b407fc8fa0206c6ebdb5a31d9056dcc96bba5eb108"}],"0x0f286489b5b85EAcC4E00e1902e138b5Aa662F1c":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x76009a037ebbb28a9f71f1e68c38291e3b2b1a4bf772a56a79e1a6336cbbc7ab"}],"0x1A535D13c62F240cC7985B05a0229182D546550e":[{wallet:"0x46Ba18e7eCB93362A1804cC47EaD90244945016D",subdigest:"0x0acff6ca38c72b9287ba8163569a452ce12c9ffd64c082feba8a5f7300546579"}],"0x1B9498d7177a09d98ABE532e472e1b9f32dAc9B8":[{wallet:"0x848045071DbdBa2F352dF2f0335e02ba61f205aC"}],"0x253ff3Dd87c440A9565814756f85219F487e2FFe":[{wallet:"0xd18a46E40b29FA6CFC0D9f5A930E72cD0EC1e4D2",subdigest:"0x12822b7fde91535103ee7757fe362bfdca0dc2e25211c6ca7c133c20a66d604f"}],"0x27D263a5707510378823fa496674EeC7656780B6":[{wallet:"0xBc4f7bB193ac09D7eC53eF0a499B073A296A94f0",subdigest:"0xbf3913760753e93aba2f40235dd03e693f85853d7c9f9c5f1f62ce7ee91c6313"}],"0x36fA6B68007575C100c1C2916942ee857dE0778E":[{wallet:"0x52CE3cab58639223cf870A73942175e6C7BA9A0C",subdigest:"0x455b01f5c47ece34a3f4dee5d9b3d3b590d524029f4e845b2d4eccb7e8d9472b"}],"0x3Ed9724712417687eb0eaBc2cA2e452E3d2DCdEc":[{wallet:"0x4955338954fFF19396Fe4bA17D93370cA8b77d2B",subdigest:"0x96c4ddf36a03af12b56cf6dc618ab83d814b86a01c69464f1b94bfca826e47fa"}],"0x3F0c7e32678Bc6dCf9dEfB6368EcaE7B88C69036":[{wallet:"0x592625C316A2F184F0C6a4b2952e9b40Ef111a26",subdigest:"0x5e9cf684e8dcf38d5b079a89ff4644de144c85ca16e3b618ab4ae490becff25f"},{wallet:"0xEBB418588FFc0785B6a2559a281A37c117679D6F",subdigest:"0x98be9228917ad8193e14102ed0a989689ec6af1f04bd731f3cca43c02c1abc07"}],"0x4577CAF3A5caBcaF2038863d361cb32f423d5d53":[{wallet:"0xF68f5A97abAAa940A9Ad3AeD723C2179F8551502",subdigest:"0x336448a71e4188cd95c39b278d6d26144d51dc5b3edfdd2af67c3b0425a2e2d3"}],"0x50d27302c45FE4FC8d7cc435920a22D477d3DEB2":[{wallet:"0x97692217ca8e06D7156ef7f4606faB4624bd10C0",subdigest:"0x898993e7c2394c1c9b63b2cfa637a8a2c7b04ce9387c9ecc9c56ef1f56ae58be"}],"0x57160B380fF4Edf3DA3b1c27e723dc2AB3f057Be":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x89f982d77ae08a8ea17d6755d297615f5756e5363db8a9b95758d5a981f8e4ae"}],"0x6647b94603e0D90265d8869a3656C1b0F9B6caC5":[{wallet:"0x6cDe6f20610FF172Cd838CDF69Aae3c27521CBa4",subdigest:"0xab2d0dbda84cffb9a3934412172236a9d98fd3d6b80d47b35956cc5f935c69de"}],"0x69DD1F76595E8a49252F16DDa69474c3a818E3c0":[{wallet:"0x756F9E22591e0aC2Aa0C365708aF0a516F269979",subdigest:"0x261126c464ac19bb769c407ec28fe026f297357938ba9024bd66bb5a48ca9349"}],"0x6Ae23160FBB280Ae4eE78C476ca9FDb51bBcC444":[{wallet:"0xDfA3338DD0147b5e7793cE040F92462177e00024",subdigest:"0xae67c59800e8dd98b955a5fb857c39971fe5fb29e3e5083246fd122b37c4ee88"}],"0x6B917b4459Db2C9cb774e0a9B0eee668273e191a":[{wallet:"0x676b5FaCD2380F51d4EB1A2492057A31FfB100c5",subdigest:"0x60a62db58b5be8277ff22e8104ead5c4d87d6d1173fd7b2b0174978e663974c7"}],"0x6b593de1F2c6cEf51693323edc4467c2A4D5B78B":[{wallet:"0xD9DF096A66A89e63eE977C5Fda59a65f872a6901",subdigest:"0x8ef909db0fd633cac1445a89dace09c5b2fa1bda2d85e5915f6afc2d547f6a87"}],"0x6c77214450C1060f2f6a093c8054278b77E8769b":[{wallet:"0x16b47E837ff421382D516cA5A79b76aFd8473675",subdigest:"0x67521db115964b2559b99d5854ab07bae09e6e6cb0c1cd3de3d1f553c31c515f"}],"0x70F2E179c95a6e3b9a2Fe742B88568a12FFF7f8B":[{wallet:"0x649ba7F76D856aB021C9EEB8bac3B46f3e72EfD0",subdigest:"0x178be5e2d834d0224794dfbe49cf9621127d3396b75246a32093a21e6db320eb"}],"0x77fCC4D33ae477f217a09Ec8dBEBC22E7e8F5e33":[{wallet:"0xD09C7A6Af7046F45343978A1620391D6237c3762",subdigest:"0xca780c4505a811222e215eceeb2b28f222c1a6b126e9ccc86560f5199c34d5da"}],"0x78C22edc81d7a7A1D690e6C91824Cf9Eff2760c8":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xd84553d4372b26e3eb96fa77bd157e4e1b593bff1c54c7e69ad8857673d2266e"}],"0x79621cB0c2c8FbB8Ca20E4177b7DF0Aa7a931e73":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0xbd64f6f75e64b49c6a4f46b2715ca3bf11e21a7e07702b89ea1607e3884e9d40"}],"0x79A7DF6E89da1AEa293bFa11987d7CE828223a7A":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x858235d87309c9e2d72dca9bfa41b61fbb635ac6d9e099b868ff8a8c99bf8c37"}],"0x7b1A301155c0Fad8e5b95055e2A100333D464eA3":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x31001033b765a3cc9407304daeafeeda015d318e73be3de8832a9dc1377f9340"}],"0x85c5B1f9464723A2cC81F69A71a11dA528E0CBCe":[{wallet:"0xF178cE73DB2bA1C575D5c63ecA490b09ec31949b",subdigest:"0x65e9c76ef7e14697c6fd1822fbd39719b43091f13d2d051c911d1373175c2c42"}],"0x943237FFB0024Bf758A79db00e043789FD8299f0":[{wallet:"0x639b6017C4b8F8a5322205A68a1331A817Dd46e2",subdigest:"0xa3bc90cafcccb0fe0b8c0939fa908216ddc667d6b022fe54efca05ec815c163c"}],"0x9EeA332285d7B3755CB46f7D0D49CF0edcC112Ef":[{wallet:"0x04EfBe99e49001b78bB68c35B0354CD4a2Ac4Fd8",subdigest:"0xd3c43ef36d4347d1b5323fa188cf8482de05631a86bc05b12b8ce3b661f4d2f9"}],"0x9b704574e65F8b785FD125F5f3C4F7E34690Bd02":[{wallet:"0xBA9498300dFE650a2b59A42271ec771B6Ed6a091",subdigest:"0x9894f57b20f78245e02d424a21f0d361038905285f53c51c1949e27f39a9fbb8"}],"0xA923984d96b7327c60f246da366b2525B34C6984":[{wallet:"0x7ae10aA190513577D9Ac9ae146128d97df4F4fF0",subdigest:"0x3b849360d50831070d92bec368b63cf0725525cd7b60f406cee5357731b75457"}],"0xACFC6D1DB5875Cb72E1b6BaddaCe28F45044ee6a":[{wallet:"0xAdAf943368aB95208763ccAcCD5ecB9a7772de40",subdigest:"0xb0d0da150a42bca8103e1c40e5e99c7a190043b3121f52c6d41ae473597d0ebe"}],"0xB278dd7c9FC754dBc82Ac29C6f78B6301BE8E8C6":[{wallet:"0xeCc653CB03a9B6587Bcb58A8372535b6Ea5a17d6",subdigest:"0x6fd9bb4768107b4bd0f3c8e11b00027ee5e6417b1d4ab3d5e56c1724eeb2e3b2"}],"0xBaA9D704C8244071e6B9bF6BcbC2c2281dB75096":[{wallet:"0xb547CcA265A91f7a92d9a97804807962B2A4D7d8",subdigest:"0xfca7ea635bf9e89d7034ce6d9378ff6948eaa340ab2d428e5b157efc82b9f8d5"}],"0xC29fD04F9079c36dC15549e8AAF8F058214F0Dae":[{wallet:"0xB7005885711d54BD3594Be1955266d37470BD053",subdigest:"0xb0bc66ea204ea2cb93ca190189471392b59fb8608cb75a69a7b01b7096338428"}],"0xD2751030a5007895968414443efae561BdCB1Af2":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0x2872f961dd02e7b3fabd4a7bed036259085de28fe2f1c0f49a5d1be6ae4c7b07"}],"0xD721d5849fDE7862E77D251B6fA711114f4579Ab":[{wallet:"0x77415fb6aFe8A13275b088f1e197Bd9EDa1AA95C",subdigest:"0xc775316600b59750707446a7915cf88cc6f1827ce931dd688bf5990a7b95ec29"}],"0xE1B6c2c194dF83A8E01F8C582ddA58840fE46318":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xde7ebed8b2c62552e8ff5a08d2e5b33d336d709e6cf2812b9874cd7b5fd5189e"}],"0xE5Ed2A916971Fa6fe07EbD4564DeAaF2c20A7684":[{wallet:"0xFDB7922bA08BAbad2e3e36b66e0521c7EEA0faEF"}],"0xF9ED1e54dc86Bf248FBe059D4aEfD8183F0A816F":[{wallet:"0xCdFdaDB6F2b2f3c7db93521AbD05a3C32aF6b226",subdigest:"0x0433c483ced183cee562b8061788fc93d0c9f666af896096a5e184076f787eac"}],"0xa3CF0b935AccFd8bbE569B984D9Bc7Ec775ce22d":[{wallet:"0x23C6B8E47fa9f40e73E6627598d13085130f3ed6",subdigest:"0x13e9cd21769bc2a4f779b0f73c1cc7ca6c96c6af3262721eec17ac72104fef32"}],"0xbe9f4fB13fbC98042a32dC8354A339258abf1456":[{wallet:"0x81fF1aD4232671403e0f3CC85D021144511E3B6e",subdigest:"0x130c5b993a04ab84b0b074ea69241d6f3c040eced24dbe7c2015263718526670"}],"0xd4b26195aD1487DE6a42Fd69bC81CEbc8b86f0b5":[{wallet:"0xF36A0bd53d85307b35f90756263984329FBfA176",subdigest:"0x13d918ac4e97df0477fcab1c210ef1f96a999abe64dd07e48017b96c4902f50b"}],"0xdaD0038b8BBf78Ac84a4566E75269339Daa0dEdC":[{wallet:"0x8Fd48EB1ecDc0652306de1A0A8BA5561Ba733351",subdigest:"0x3541d7b2f07d87fa8b30c9ef1594da2353d45c40830f0c8e01126e3c89b9b508"}],"0xe7d51Cd5097A287a3B63014dc453Cfb8D9A03152":[{wallet:"0x4E5B1F98F81372BD4B763Be9bF50Aa6C5B7b9913",subdigest:"0x818fbd74398f446b4d7fcb207bf6377393fa923732243995d8464844ec8d42ce"}],"0xed7F28464630398E06e0Fa0Fc04FEa2fe40427aB":[{wallet:"0x6D0f613C239ed1d409C4e41758ACd55E0b1Cb410",subdigest:"0xe6baef08a191785d5d3897cb3e96f3473585d2f034657a4134754c5206b87268"}],"0xf24d3aFE0768827EAe9f671F3C1c283BfFAF0C19":[{wallet:"0xf03Bf61943e00fa3557E496409e1E9c95a1c24E4",subdigest:"0x3d1192dcd531e9ec60795b4129b03eb54b9226bc2d08be3f2b2524ae80244afb"}],"0xf3bf75114bEf71abE4E87f8CA4dD82E372b948A9":[{wallet:"0x3e270820e36EC3C29903C2635B0f53f192Dc29ab",subdigest:"0x70f563cb3ba62214e88d61e55450a8f4245bc5666aa006c93802ad2e96d3ac05"}],"0xf95C86e3a52dEbf8b984983852CAc5d8652C8A9A":[{wallet:"0xb07d236F2B5d1f4AB12236e94ac8049dE40321F4",subdigest:"0x877c04b91ea48703e9cc936f4506d89943ed8b9ec32b15990eea41ce0c59dde7"}],"0xfed1D937a8708001A23AFD8AEd02f9E05de9f251":[{wallet:"0x6743b60A94898E228c5aa642A2e11cb595dCB1fB"}]};function T9e(t,e=6,r=4){if(t.length<=e+r+3)return t;const n=t.slice(0,e),i=t.slice(-r);return`${n}...${i}`}function P9e(){const t=Ir(yi),r=Ir(Nn).networks.get(),[n,i]=D.useState(""),[s,o]=D.useState([]),[a,c]=D.useState(""),[l,f]=D.useState(""),[u,p]=D.useState(!1),[g,y]=D.useState(!1),[b,I]=D.useState(!1),[C,S]=D.useState(!1),O=yn(t.isLoadingAccount);D.useEffect(()=>{if(y(!1),!vw(n))return;S(!0);const ce=Qt(n);ie(ce)},[n]);const L=()=>{const ce=Qt(n);u?t.signInWithRecoveryMnemonic(ce,a.trim(),l):t.signInWithRecoveryMnemonic(ce,a.trim())},F=()=>a&&a.replace(/\s+/g," ").trim().split(" ").length!==12,z=()=>l&&l.length<8,_=async ce=>{if(i(""),o([]),c(ce),I(!1),!F()){S(!0);try{const K=V5.fromPhrase(ce),P=[...(await Y_.walletsOfSigner({signer:K.address})).map(({wallet:M})=>M),...(I9e[K.address]??[]).map(({wallet:M})=>M)];o(P),P.length===1&&i(P[0])}catch(K){console.error(K)}S(!1)}},$=async ce=>{i(ce),I(!1)},ie=async ce=>{try{const K=V5.fromPhrase(a),P=new nE([K]),m=(await new Ix({address:ce,tracker:Y_,contexts:cX,orchestrator:P,networks:r}).status(ge.MAINNET)).config,E=As.genericCoderFor(m.version).config.signersOf(m).some(x=>x.address===K.address);I(E),E||y(!0)}catch(K){y(!0),console.error(K)}S(!1)};return W.jsx(xe,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:W.jsxs(xe,{width:"full",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsx(xe,{padding:"6",marginTop:"16",children:W.jsxs(xe,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:vM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Ge,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),W.jsxs(xe,{marginTop:"12",children:[W.jsxs(xe,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(Ge,{variant:"medium",color:"text100",textAlign:"center",children:"Enter your recovery phrase"}),W.jsxs(Ge,{variant:"normal",color:"text50",marginTop:"4",textAlign:"center",children:["This is the recovery phrase you create on"," ",W.jsx(Ge,{variant:"link",cursor:"pointer",color:"text80",onClick:()=>window.open("https://sequence.app/settings/recovery"),children:"sequence.app/settings/recovery"})]})]}),W.jsxs(xe,{flexDirection:"column",marginTop:"12",gap:"8",children:[W.jsxs(xe,{children:[W.jsx(Kwe,{name:"mnemonic",label:"Recovery Phrase",labelLocation:"top",value:a,onChange:ce=>_(ce.target.value)}),F()&&W.jsx(Ge,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Mnemonic must be 12 words"})]}),W.jsx(eP,{labelLocation:"right",label:"Use Password to Encrypt Mnemonic (Optional)",checked:u,onCheckedChange:ce=>{p(ce===!0)}}),u&&W.jsxs(xe,{children:[W.jsx(vX,{label:"Create Password (min 8 characters)",value:l,onChange:ce=>f(ce.target.value)}),z()&&W.jsx(Ge,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Password not long enough"})]}),W.jsxs(xe,{children:[W.jsx(Wn,{name:"wallet",label:"Sequence Wallet Address",labelLocation:"left",value:n,onChange:ce=>$(ce.target.value)}),g&&W.jsx(xe,{justifyContent:"center",marginTop:"2",children:W.jsx(Ge,{variant:"small",color:"negative",children:"Wallet does not match recovery phrase"})})]}),s.length>=1&&W.jsxs(xe,{flexDirection:"column",gap:"4",children:[W.jsx(Ge,{variant:"normal",marginTop:"4",color:"text100",textAlign:"center",children:"Select your wallet"}),W.jsx(xe,{display:"grid",gap:"4",style:{gridTemplateColumns:"1fr 1fr 1fr"},children:s.map(ce=>W.jsx(Zt,{size:"lg",shape:"square",label:T9e(ce,18,4),onClick:()=>{i(ce)}},ce))})]}),C&&W.jsx(xe,{alignItems:"center",justifyContent:"center",children:W.jsx($r,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})})]})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[O&&W.jsx(xe,{marginTop:"16",alignItems:"center",justifyContent:"center",children:W.jsx($r,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})}),!O&&W.jsxs(W.Fragment,{children:[W.jsx(xe,{children:W.jsx(Zt,{variant:"primary",size:"lg",shape:"square",label:"Continue",disabled:!a||!vw(n)||u&&(!l||l.length<8)||b===!1,onClick:()=>{L()},width:"full",marginTop:"16"})}),W.jsx(xe,{children:W.jsx(Zt,{as:eY,to:"/",variant:"text",size:"lg",shape:"square",label:"Go back to start",width:"full",marginTop:"6"})})]})]})]})})}const k9e="modulepreload",M9e=function(t){return"/wallet-recovery-app/"+t},tj={},R9e=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(c=>{if(c=M9e(c),c in tj)return;tj[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":k9e,l||(u.as="script"),u.crossOrigin="",u.href=c,a&&u.setAttribute("nonce",a),document.head.appendChild(u),l)return new Promise((p,g)=>{u.addEventListener("load",p),u.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var gM={exports:{}},Uv=typeof Reflect=="object"?Reflect:null,rj=Uv&&typeof Uv.apply=="function"?Uv.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},I3;Uv&&typeof Uv.ownKeys=="function"?I3=Uv.ownKeys:Object.getOwnPropertySymbols?I3=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:I3=function(e){return Object.getOwnPropertyNames(e)};function O9e(t){console&&console.warn&&console.warn(t)}var gX=Number.isNaN||function(e){return e!==e};function cn(){cn.init.call(this)}gM.exports=cn;gM.exports.once=L9e;cn.EventEmitter=cn;cn.prototype._events=void 0;cn.prototype._eventsCount=0;cn.prototype._maxListeners=void 0;var nj=10;function oE(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(cn,"defaultMaxListeners",{enumerable:!0,get:function(){return nj},set:function(t){if(typeof t!="number"||t<0||gX(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");nj=t}});cn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};cn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||gX(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function yX(t){return t._maxListeners===void 0?cn.defaultMaxListeners:t._maxListeners}cn.prototype.getMaxListeners=function(){return yX(this)};cn.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")rj(c,this,r);else for(var l=c.length,f=EX(c,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,O9e(a)}return t}cn.prototype.addListener=function(e,r){return mX(this,e,r,!1)};cn.prototype.on=cn.prototype.addListener;cn.prototype.prependListener=function(e,r){return mX(this,e,r,!0)};function D9e(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function bX(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=D9e.bind(n);return i.listener=r,n.wrapFn=i,i}cn.prototype.once=function(e,r){return oE(r),this.on(e,bX(this,e,r)),this};cn.prototype.prependOnceListener=function(e,r){return oE(r),this.prependListener(e,bX(this,e,r)),this};cn.prototype.removeListener=function(e,r){var n,i,s,o,a;if(oE(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():N9e(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};cn.prototype.off=cn.prototype.removeListener;cn.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function wX(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?B9e(i):EX(i,i.length)}cn.prototype.listeners=function(e){return wX(this,e,!0)};cn.prototype.rawListeners=function(e){return wX(this,e,!1)};cn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):xX.call(t,e)};cn.prototype.listenerCount=xX;function xX(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}cn.prototype.eventNames=function(){return this._eventsCount>0?I3(this._events):[]};function EX(t,e){for(var r=new Array(e),n=0;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new V9e:typeof navigator<"u"?Y9e(navigator.userAgent):J9e()}function K9e(t){return t!==""&&G9e.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Y9e(t){var e=K9e(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new q9e;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{const i=this.store.get(li).accountAddress.get();i&&n.length>0&&this.loadBalances(i,n)})}async loadBalances(e,r){const n=r.filter(o=>o.type===Ft.MAINNET),i=[];this.isFetchingBalances.set(!0),await Promise.allSettled(n.map(async o=>{if(!o.rpcUrl){console.warn(`No RPC URL found for network ${o.name}`);return}const a=new Iy(o.rpcUrl);try{const c=await a.getBalance(e);i.push({contractType:hh.NATIVE,contractAddress:bu,tokenID:"",accountAddress:e,balance:c.toString(),chainId:o.chainId,blockHash:Zg,blockNumber:0,contractInfo:E9e(XAe(o.chainId)),uniqueCollectibles:"0",isSummary:!0})}catch(c){console.error(c)}})),this.balances.set(i);const s=this.local.userAddedTokens.get()??[];this.userAddedTokens.set(s),s.length>0&&await Promise.allSettled(s.map(async o=>{await this.loadUserAddedTokenBalance(e,o)})),this.isFetchingBalances.set(!1)}async loadUserAddedTokenBalance(e,r){const n=this.store.get(Nn).providerForChainId(r.chainId);try{const s=await new Dn(r.address,jv,n).balanceOf(e),o=this.balances.get();if(!s){this.removeToken(r);return}o.push({contractType:r.contractType,contractAddress:r.address,tokenID:"",accountAddress:e,balance:s.toString(),chainId:r.chainId,blockHash:Zg,blockNumber:0,contractInfo:{address:r.address,chainId:r.chainId,decimals:r.decimals,name:r.symbol,symbol:r.symbol,type:"ERC20",logoURI:"",deployed:!0,bytecodeHash:"",extensions:{link:"",description:"",ogImage:"",originAddress:"",originChainId:0,blacklist:!1,verified:!0,verifiedBy:"User",featured:!1},updatedAt:"0"},uniqueCollectibles:"0",isSummary:!0}),this.balances.set(o)}catch(i){console.error(i)}}async updateTokenBalance(e){const r=this.store.get(Nn).providerForChainId(e.chainId);this.isFetchingBalances.set(!0);const n=this.store.get(li).accountAddress.get();if(!n){console.warn("No account found");return}const i=this.balances.get();try{let s;e.contractType===hh.NATIVE?s=await r.getBalance(n):s=await new Dn(e.contractAddress,jv,r).balanceOf(n),i.map(o=>{o.contractAddress===e.contractAddress&&o.chainId===e.chainId&&(o.balance=s.toString())}),this.balances.set(i)}catch(s){console.error(s)}this.isFetchingBalances.set(!1)}async addToken(e){const r=this.local.userAddedTokens.get()??[];if(r.some(s=>s.chainId===e.chainId&&s.address===e.address))throw new Error(`Token with chainId ${e.chainId} and address ${e.address} already exists`);r.push(e),this.local.userAddedTokens.set(r),this.userAddedTokens.set(r);const i=this.store.get(li).accountAddress.get();i&&(this.isFetchingBalances.set(!0),await this.loadUserAddedTokenBalance(i,e),this.isFetchingBalances.set(!1))}async removeToken(e){const r=this.local.userAddedTokens.get(),n=(r==null?void 0:r.filter(o=>!(o.chainId===e.chainId&&o.address===e.address)))??[];this.local.userAddedTokens.set(n),this.userAddedTokens.set(n);const i=this.balances.get().filter(o=>!(o.chainId===e.chainId&&o.contractAddress===e.address));this.balances.set(i);const s=this.store.get(li).accountAddress.get();s&&(this.isFetchingBalances.set(!0),await this.loadUserAddedTokenBalance(s,e),this.isFetchingBalances.set(!1))}async getTokenInfo(e,r){const n=this.store.get(Nn).providerForChainId(e);this.isFetchingTokenInfo.set(!0);try{const i=new Dn(r,jv,n),s=await i.decimals(),o=await i.symbol();if(this.isFetchingTokenInfo.set(!1),s&&o)return{decimals:Number(s),symbol:o};throw new Error(`Could not get decimals and symbol for token at ${r}`)}catch(i){throw console.error(i),new Error(`Error getting token info ${JSON.stringify(i)}`)}}clear(){this.local.userAddedTokens.set([]),this.isFetchingBalances.set(!1),this.isFetchingTokenInfo.set(!1),this.balances.set([])}}class li{constructor(e){de(this,"isLoadingAccount",Or(!0));de(this,"account");de(this,"accountAddress",Or(void 0));de(this,"isPromptingForPassword",Or(!1));this.store=e,this.loadAccount(),this.store.get(Nn).networks.subscribe(n=>{this.account&&this.loadAccount()}),this.accountAddress.subscribe(n=>{n&&this.store.get(Nn).accountLoaded.set(!0)})}async signInWithRecoveryMnemonic(e,r,n){try{this.isLoadingAccount.set(!0);const i=V5.fromPhrase(r),s=new nE([i]),a=this.store.get(Nn).networks.get(),c=new Ix({address:e,tracker:Y_,contexts:cX,orchestrator:s,networks:a});n?await this.encryptRecoveryMnemonicWithPassword(r,c.address,n):await this.encryptRecoveryMnemonic(r,c.address),this.account=c,this.accountAddress.set(c.address)}catch(i){console.warn(i)}this.isLoadingAccount.set(!1)}async loadAccount(e){const r=await C3(yl.SECURITY),n=await r.get(yl.SECURITY,"mnemonic");var i=await r.get(yl.SECURITY,"key");let s;if(n&&!i&&!e){this.isPromptingForPassword.set(!0);return}n&&(i?s=await this.decryptRecoveryMnemonic(n,i):s=await this.decryptRecoveryMnemonicWithPassword(n,e)),s?e?this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic,e):this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic):setTimeout(()=>{this.isLoadingAccount.set(!1)},200)}async encryptRecoveryMnemonic(e,r){const n=await nAe(),i=JSON.stringify({wallet:r,mnemonic:e}),s=await VF(n,i);s.salt=qF(r);const o=await C3(yl.SECURITY);await o.put(yl.SECURITY,n,"key"),await o.put(yl.SECURITY,s,"mnemonic")}async encryptRecoveryMnemonicWithPassword(e,r,n){const i=qF(r),s=await $F(n,i),o=JSON.stringify({wallet:r,mnemonic:e}),a=await VF(s,o);a.salt=i,await(await C3(yl.SECURITY)).put(yl.SECURITY,a,"mnemonic")}async decryptRecoveryMnemonic(e,r){const n=await zF(r,e);return JSON.parse(n)}async decryptRecoveryMnemonicWithPassword(e,r){const n=e.salt,i=await $F(r,n),s=await zF(i,e);return JSON.parse(s)}logout(){this.account=void 0,this.accountAddress.set(void 0),mAe(yl.SECURITY);const e=this.store.get(Nn),r=this.store.get(Tx);e.clear(),r.clear(),localStorage.clear()}}const A9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M3.98%208.223A10.477%2010.477%200%200%200%201.934%2012C3.226%2016.338%207.244%2019.5%2012%2019.5c.993%200%201.953-.138%202.863-.395M6.228%206.228A10.451%2010.451%200%200%201%2012%204.5c4.756%200%208.773%203.162%2010.065%207.498a10.522%2010.522%200%200%201-4.293%205.774M6.228%206.228%203%203m3.228%203.228%203.65%203.65m7.894%207.894L21%2021m-3.228-3.228-3.65-3.65m0%200a3%203%200%201%200-4.243-4.243m4.242%204.242L9.88%209.88'%20/%3e%3c/svg%3e",S9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M2.036%2012.322a1.012%201.012%200%200%201%200-.639C3.423%207.51%207.36%204.5%2012%204.5c4.638%200%208.573%203.007%209.963%207.178.07.207.07.431%200%20.639C20.577%2016.49%2016.64%2019.5%2012%2019.5c-4.638%200-8.573-3.007-9.963-7.178Z'%20/%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M15%2012a3%203%200%201%201-6%200%203%203%200%200%201%206%200Z'%20/%3e%3c/svg%3e",vX=({label:t,labelLocation:e="top",value:r,onChange:n})=>{const[i,s]=D.useState(!1),o=()=>{s(!i)};return W.jsxs("div",{style:{position:"relative",width:"100%"},children:[W.jsx(Wn,{type:i?"text":"password",name:"password",label:t,labelLocation:e,value:r,onChange:n}),W.jsx("button",{type:"button",onClick:o,style:{position:"absolute",top:"50%",right:"12px",transform:"translateY(5%)",background:"none",border:"none",cursor:"pointer"},children:i?W.jsx("img",{src:A9e,style:{width:"25px",height:"25px"}}):W.jsx("img",{src:S9e,style:{width:"25px",height:"25px"}})})]})},vM="/wallet-recovery-app/assets/sequence-logo-B9LB7ao9.svg";function _9e(){const t=Ir(li),e=yn(t.isLoadingAccount),r=yn(t.isPromptingForPassword),[n,i]=D.useState(""),[s,o]=D.useState(!1),[a,c]=D.useState(!1),l=async()=>{try{await t.loadAccount(n)}catch(p){console.warn(p),c(!0)}},f=()=>{o(!0)},u=()=>{t.logout(),o(!1),t.isLoadingAccount.set(!1)};return W.jsxs(xe,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:[W.jsxs(xe,{width:"full",style:{maxWidth:"800px"},children:[W.jsx(xe,{padding:"6",marginTop:"16",children:W.jsxs(xe,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:vM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Ge,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),!e&&W.jsxs(W.Fragment,{children:[W.jsx(xe,{marginTop:"8",children:W.jsxs($r,{flexDirection:"column",gap:"6",children:[W.jsx(Ge,{variant:"medium",color:"warning",textAlign:"center",children:"Warning section"}),W.jsx(Ge,{variant:"normal",color:"text100",marginBottom:"4",children:"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga."})]})}),W.jsxs(xe,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(xe,{children:W.jsx(Zt,{as:eY,to:"/recovery",variant:"primary",size:"lg",shape:"square",label:"Start Recovery",width:"full",marginTop:"16"})}),W.jsx(xe,{children:W.jsx(Zt,{variant:"text",size:"lg",shape:"square",label:"Learn more",width:"full",marginTop:"6"})})]})]}),e&&W.jsx(W.Fragment,{children:r?W.jsxs(xe,{flexDirection:"column",marginTop:"8",justifyContent:"center",alignItems:"center",children:[W.jsx(Ge,{variant:"large",color:"text100",marginBottom:"8",children:"Weclome back!"}),W.jsx(vX,{label:"Password",value:n,onChange:p=>{i(p.target.value),c(!1)}}),W.jsx(xe,{alignSelf:"flex-start",height:"6",children:a&&W.jsx(Ge,{variant:"small",color:"negative",marginLeft:"2",marginTop:"1",children:"Incorrect password"})}),W.jsx(Zt,{marginBottom:"3",variant:"primary",size:"lg",shape:"square",label:"Unlock",onClick:()=>{l()}}),W.jsx(xe,{children:W.jsx(Zt,{variant:"text",label:"The dog ate my password (Forgot Password)",onClick:()=>{f()}})})]}):W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx($r,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})})})]}),s&&W.jsx(Tc,{size:"md",onClose:()=>o(!1),children:W.jsxs($r,{flexDirection:"column",alignItems:"center",padding:"16",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",children:'Click "Reset" to START OVER and re-enter your mnemonic'}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:()=>{o(!1)},"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:"Reset",onClick:()=>{u()},"data-id":"signingContinue"})]})]})})]})}const I9e={"0x087Aa00C1f09464D1D6a9Ff0eE2377dBB7c7B324":[{wallet:"0xaf39AE56e001250FaCBd122b11A90d32A0aD6686",subdigest:"0x0f4490a7aa40f15929635252953ce594ba3342401c2c53eff56451dc147475da"}],"0x09A820a9109E5EC82DCfF24484b2047739a92Abc":[{wallet:"0xcF47342c7064AAA5BA0F4163bEA0c7545756b8BF",subdigest:"0xa598ddbe6372b985f60367a1a9c12cb99e20e38c782d9bc941ddaa9f4c9296e5"}],"0x0aBb5b9d20f06DAdF752CEeBe4df26E585A1d897":[{wallet:"0x3F00C5A7fEadD358429645b29b3d776C5f61892d",subdigest:"0x7c33d7864e6e6f92e39328b407fc8fa0206c6ebdb5a31d9056dcc96bba5eb108"}],"0x0f286489b5b85EAcC4E00e1902e138b5Aa662F1c":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x76009a037ebbb28a9f71f1e68c38291e3b2b1a4bf772a56a79e1a6336cbbc7ab"}],"0x1A535D13c62F240cC7985B05a0229182D546550e":[{wallet:"0x46Ba18e7eCB93362A1804cC47EaD90244945016D",subdigest:"0x0acff6ca38c72b9287ba8163569a452ce12c9ffd64c082feba8a5f7300546579"}],"0x1B9498d7177a09d98ABE532e472e1b9f32dAc9B8":[{wallet:"0x848045071DbdBa2F352dF2f0335e02ba61f205aC"}],"0x253ff3Dd87c440A9565814756f85219F487e2FFe":[{wallet:"0xd18a46E40b29FA6CFC0D9f5A930E72cD0EC1e4D2",subdigest:"0x12822b7fde91535103ee7757fe362bfdca0dc2e25211c6ca7c133c20a66d604f"}],"0x27D263a5707510378823fa496674EeC7656780B6":[{wallet:"0xBc4f7bB193ac09D7eC53eF0a499B073A296A94f0",subdigest:"0xbf3913760753e93aba2f40235dd03e693f85853d7c9f9c5f1f62ce7ee91c6313"}],"0x36fA6B68007575C100c1C2916942ee857dE0778E":[{wallet:"0x52CE3cab58639223cf870A73942175e6C7BA9A0C",subdigest:"0x455b01f5c47ece34a3f4dee5d9b3d3b590d524029f4e845b2d4eccb7e8d9472b"}],"0x3Ed9724712417687eb0eaBc2cA2e452E3d2DCdEc":[{wallet:"0x4955338954fFF19396Fe4bA17D93370cA8b77d2B",subdigest:"0x96c4ddf36a03af12b56cf6dc618ab83d814b86a01c69464f1b94bfca826e47fa"}],"0x3F0c7e32678Bc6dCf9dEfB6368EcaE7B88C69036":[{wallet:"0x592625C316A2F184F0C6a4b2952e9b40Ef111a26",subdigest:"0x5e9cf684e8dcf38d5b079a89ff4644de144c85ca16e3b618ab4ae490becff25f"},{wallet:"0xEBB418588FFc0785B6a2559a281A37c117679D6F",subdigest:"0x98be9228917ad8193e14102ed0a989689ec6af1f04bd731f3cca43c02c1abc07"}],"0x4577CAF3A5caBcaF2038863d361cb32f423d5d53":[{wallet:"0xF68f5A97abAAa940A9Ad3AeD723C2179F8551502",subdigest:"0x336448a71e4188cd95c39b278d6d26144d51dc5b3edfdd2af67c3b0425a2e2d3"}],"0x50d27302c45FE4FC8d7cc435920a22D477d3DEB2":[{wallet:"0x97692217ca8e06D7156ef7f4606faB4624bd10C0",subdigest:"0x898993e7c2394c1c9b63b2cfa637a8a2c7b04ce9387c9ecc9c56ef1f56ae58be"}],"0x57160B380fF4Edf3DA3b1c27e723dc2AB3f057Be":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x89f982d77ae08a8ea17d6755d297615f5756e5363db8a9b95758d5a981f8e4ae"}],"0x6647b94603e0D90265d8869a3656C1b0F9B6caC5":[{wallet:"0x6cDe6f20610FF172Cd838CDF69Aae3c27521CBa4",subdigest:"0xab2d0dbda84cffb9a3934412172236a9d98fd3d6b80d47b35956cc5f935c69de"}],"0x69DD1F76595E8a49252F16DDa69474c3a818E3c0":[{wallet:"0x756F9E22591e0aC2Aa0C365708aF0a516F269979",subdigest:"0x261126c464ac19bb769c407ec28fe026f297357938ba9024bd66bb5a48ca9349"}],"0x6Ae23160FBB280Ae4eE78C476ca9FDb51bBcC444":[{wallet:"0xDfA3338DD0147b5e7793cE040F92462177e00024",subdigest:"0xae67c59800e8dd98b955a5fb857c39971fe5fb29e3e5083246fd122b37c4ee88"}],"0x6B917b4459Db2C9cb774e0a9B0eee668273e191a":[{wallet:"0x676b5FaCD2380F51d4EB1A2492057A31FfB100c5",subdigest:"0x60a62db58b5be8277ff22e8104ead5c4d87d6d1173fd7b2b0174978e663974c7"}],"0x6b593de1F2c6cEf51693323edc4467c2A4D5B78B":[{wallet:"0xD9DF096A66A89e63eE977C5Fda59a65f872a6901",subdigest:"0x8ef909db0fd633cac1445a89dace09c5b2fa1bda2d85e5915f6afc2d547f6a87"}],"0x6c77214450C1060f2f6a093c8054278b77E8769b":[{wallet:"0x16b47E837ff421382D516cA5A79b76aFd8473675",subdigest:"0x67521db115964b2559b99d5854ab07bae09e6e6cb0c1cd3de3d1f553c31c515f"}],"0x70F2E179c95a6e3b9a2Fe742B88568a12FFF7f8B":[{wallet:"0x649ba7F76D856aB021C9EEB8bac3B46f3e72EfD0",subdigest:"0x178be5e2d834d0224794dfbe49cf9621127d3396b75246a32093a21e6db320eb"}],"0x77fCC4D33ae477f217a09Ec8dBEBC22E7e8F5e33":[{wallet:"0xD09C7A6Af7046F45343978A1620391D6237c3762",subdigest:"0xca780c4505a811222e215eceeb2b28f222c1a6b126e9ccc86560f5199c34d5da"}],"0x78C22edc81d7a7A1D690e6C91824Cf9Eff2760c8":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xd84553d4372b26e3eb96fa77bd157e4e1b593bff1c54c7e69ad8857673d2266e"}],"0x79621cB0c2c8FbB8Ca20E4177b7DF0Aa7a931e73":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0xbd64f6f75e64b49c6a4f46b2715ca3bf11e21a7e07702b89ea1607e3884e9d40"}],"0x79A7DF6E89da1AEa293bFa11987d7CE828223a7A":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x858235d87309c9e2d72dca9bfa41b61fbb635ac6d9e099b868ff8a8c99bf8c37"}],"0x7b1A301155c0Fad8e5b95055e2A100333D464eA3":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x31001033b765a3cc9407304daeafeeda015d318e73be3de8832a9dc1377f9340"}],"0x85c5B1f9464723A2cC81F69A71a11dA528E0CBCe":[{wallet:"0xF178cE73DB2bA1C575D5c63ecA490b09ec31949b",subdigest:"0x65e9c76ef7e14697c6fd1822fbd39719b43091f13d2d051c911d1373175c2c42"}],"0x943237FFB0024Bf758A79db00e043789FD8299f0":[{wallet:"0x639b6017C4b8F8a5322205A68a1331A817Dd46e2",subdigest:"0xa3bc90cafcccb0fe0b8c0939fa908216ddc667d6b022fe54efca05ec815c163c"}],"0x9EeA332285d7B3755CB46f7D0D49CF0edcC112Ef":[{wallet:"0x04EfBe99e49001b78bB68c35B0354CD4a2Ac4Fd8",subdigest:"0xd3c43ef36d4347d1b5323fa188cf8482de05631a86bc05b12b8ce3b661f4d2f9"}],"0x9b704574e65F8b785FD125F5f3C4F7E34690Bd02":[{wallet:"0xBA9498300dFE650a2b59A42271ec771B6Ed6a091",subdigest:"0x9894f57b20f78245e02d424a21f0d361038905285f53c51c1949e27f39a9fbb8"}],"0xA923984d96b7327c60f246da366b2525B34C6984":[{wallet:"0x7ae10aA190513577D9Ac9ae146128d97df4F4fF0",subdigest:"0x3b849360d50831070d92bec368b63cf0725525cd7b60f406cee5357731b75457"}],"0xACFC6D1DB5875Cb72E1b6BaddaCe28F45044ee6a":[{wallet:"0xAdAf943368aB95208763ccAcCD5ecB9a7772de40",subdigest:"0xb0d0da150a42bca8103e1c40e5e99c7a190043b3121f52c6d41ae473597d0ebe"}],"0xB278dd7c9FC754dBc82Ac29C6f78B6301BE8E8C6":[{wallet:"0xeCc653CB03a9B6587Bcb58A8372535b6Ea5a17d6",subdigest:"0x6fd9bb4768107b4bd0f3c8e11b00027ee5e6417b1d4ab3d5e56c1724eeb2e3b2"}],"0xBaA9D704C8244071e6B9bF6BcbC2c2281dB75096":[{wallet:"0xb547CcA265A91f7a92d9a97804807962B2A4D7d8",subdigest:"0xfca7ea635bf9e89d7034ce6d9378ff6948eaa340ab2d428e5b157efc82b9f8d5"}],"0xC29fD04F9079c36dC15549e8AAF8F058214F0Dae":[{wallet:"0xB7005885711d54BD3594Be1955266d37470BD053",subdigest:"0xb0bc66ea204ea2cb93ca190189471392b59fb8608cb75a69a7b01b7096338428"}],"0xD2751030a5007895968414443efae561BdCB1Af2":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0x2872f961dd02e7b3fabd4a7bed036259085de28fe2f1c0f49a5d1be6ae4c7b07"}],"0xD721d5849fDE7862E77D251B6fA711114f4579Ab":[{wallet:"0x77415fb6aFe8A13275b088f1e197Bd9EDa1AA95C",subdigest:"0xc775316600b59750707446a7915cf88cc6f1827ce931dd688bf5990a7b95ec29"}],"0xE1B6c2c194dF83A8E01F8C582ddA58840fE46318":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xde7ebed8b2c62552e8ff5a08d2e5b33d336d709e6cf2812b9874cd7b5fd5189e"}],"0xE5Ed2A916971Fa6fe07EbD4564DeAaF2c20A7684":[{wallet:"0xFDB7922bA08BAbad2e3e36b66e0521c7EEA0faEF"}],"0xF9ED1e54dc86Bf248FBe059D4aEfD8183F0A816F":[{wallet:"0xCdFdaDB6F2b2f3c7db93521AbD05a3C32aF6b226",subdigest:"0x0433c483ced183cee562b8061788fc93d0c9f666af896096a5e184076f787eac"}],"0xa3CF0b935AccFd8bbE569B984D9Bc7Ec775ce22d":[{wallet:"0x23C6B8E47fa9f40e73E6627598d13085130f3ed6",subdigest:"0x13e9cd21769bc2a4f779b0f73c1cc7ca6c96c6af3262721eec17ac72104fef32"}],"0xbe9f4fB13fbC98042a32dC8354A339258abf1456":[{wallet:"0x81fF1aD4232671403e0f3CC85D021144511E3B6e",subdigest:"0x130c5b993a04ab84b0b074ea69241d6f3c040eced24dbe7c2015263718526670"}],"0xd4b26195aD1487DE6a42Fd69bC81CEbc8b86f0b5":[{wallet:"0xF36A0bd53d85307b35f90756263984329FBfA176",subdigest:"0x13d918ac4e97df0477fcab1c210ef1f96a999abe64dd07e48017b96c4902f50b"}],"0xdaD0038b8BBf78Ac84a4566E75269339Daa0dEdC":[{wallet:"0x8Fd48EB1ecDc0652306de1A0A8BA5561Ba733351",subdigest:"0x3541d7b2f07d87fa8b30c9ef1594da2353d45c40830f0c8e01126e3c89b9b508"}],"0xe7d51Cd5097A287a3B63014dc453Cfb8D9A03152":[{wallet:"0x4E5B1F98F81372BD4B763Be9bF50Aa6C5B7b9913",subdigest:"0x818fbd74398f446b4d7fcb207bf6377393fa923732243995d8464844ec8d42ce"}],"0xed7F28464630398E06e0Fa0Fc04FEa2fe40427aB":[{wallet:"0x6D0f613C239ed1d409C4e41758ACd55E0b1Cb410",subdigest:"0xe6baef08a191785d5d3897cb3e96f3473585d2f034657a4134754c5206b87268"}],"0xf24d3aFE0768827EAe9f671F3C1c283BfFAF0C19":[{wallet:"0xf03Bf61943e00fa3557E496409e1E9c95a1c24E4",subdigest:"0x3d1192dcd531e9ec60795b4129b03eb54b9226bc2d08be3f2b2524ae80244afb"}],"0xf3bf75114bEf71abE4E87f8CA4dD82E372b948A9":[{wallet:"0x3e270820e36EC3C29903C2635B0f53f192Dc29ab",subdigest:"0x70f563cb3ba62214e88d61e55450a8f4245bc5666aa006c93802ad2e96d3ac05"}],"0xf95C86e3a52dEbf8b984983852CAc5d8652C8A9A":[{wallet:"0xb07d236F2B5d1f4AB12236e94ac8049dE40321F4",subdigest:"0x877c04b91ea48703e9cc936f4506d89943ed8b9ec32b15990eea41ce0c59dde7"}],"0xfed1D937a8708001A23AFD8AEd02f9E05de9f251":[{wallet:"0x6743b60A94898E228c5aa642A2e11cb595dCB1fB"}]};function T9e(t,e=6,r=4){if(t.length<=e+r+3)return t;const n=t.slice(0,e),i=t.slice(-r);return`${n}...${i}`}function P9e(){const t=Ir(li),r=Ir(Nn).networks.get(),[n,i]=D.useState(""),[s,o]=D.useState([]),[a,c]=D.useState(""),[l,f]=D.useState(""),[u,p]=D.useState(!1),[g,y]=D.useState(!1),[b,I]=D.useState(!1),[C,S]=D.useState(!1),O=yn(t.isLoadingAccount);D.useEffect(()=>{if(y(!1),!vw(n))return;S(!0);const ce=Qt(n);ie(ce)},[n]);const L=()=>{const ce=Qt(n);u?t.signInWithRecoveryMnemonic(ce,a.trim(),l):t.signInWithRecoveryMnemonic(ce,a.trim())},F=()=>a&&a.replace(/\s+/g," ").trim().split(" ").length!==12,z=()=>l&&l.length<8,_=async ce=>{if(i(""),o([]),c(ce),I(!1),!F()){S(!0);try{const K=V5.fromPhrase(ce),P=[...(await Y_.walletsOfSigner({signer:K.address})).map(({wallet:M})=>M),...(I9e[K.address]??[]).map(({wallet:M})=>M)];o(P),P.length===1&&i(P[0])}catch(K){console.error(K)}S(!1)}},$=async ce=>{i(ce),I(!1)},ie=async ce=>{try{const K=V5.fromPhrase(a),P=new nE([K]),m=(await new Ix({address:ce,tracker:Y_,contexts:cX,orchestrator:P,networks:r}).status(ge.MAINNET)).config,E=As.genericCoderFor(m.version).config.signersOf(m).some(x=>x.address===K.address);I(E),E||y(!0)}catch(K){y(!0),console.error(K)}S(!1)};return W.jsx(xe,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:W.jsxs(xe,{width:"full",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsx(xe,{padding:"6",marginTop:"16",children:W.jsxs(xe,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:vM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Ge,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),W.jsxs(xe,{marginTop:"12",children:[W.jsxs(xe,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(Ge,{variant:"medium",color:"text100",textAlign:"center",children:"Enter your recovery phrase"}),W.jsxs(Ge,{variant:"normal",color:"text50",marginTop:"4",textAlign:"center",children:["This is the recovery phrase you create on"," ",W.jsx(Ge,{variant:"link",cursor:"pointer",color:"text80",onClick:()=>window.open("https://sequence.app/settings/recovery"),children:"sequence.app/settings/recovery"})]})]}),W.jsxs(xe,{flexDirection:"column",marginTop:"12",gap:"8",children:[W.jsxs(xe,{children:[W.jsx(Kwe,{name:"mnemonic",label:"Recovery Phrase",labelLocation:"top",value:a,onChange:ce=>_(ce.target.value)}),F()&&W.jsx(Ge,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Mnemonic must be 12 words"})]}),W.jsx(eP,{labelLocation:"right",label:"Use Password to Encrypt Mnemonic (Optional)",checked:u,onCheckedChange:ce=>{p(ce===!0)}}),u&&W.jsxs(xe,{children:[W.jsx(vX,{label:"Create Password (min 8 characters)",value:l,onChange:ce=>f(ce.target.value)}),z()&&W.jsx(Ge,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Password not long enough"})]}),W.jsxs(xe,{children:[W.jsx(Wn,{name:"wallet",label:"Sequence Wallet Address",labelLocation:"left",value:n,onChange:ce=>$(ce.target.value)}),g&&W.jsx(xe,{justifyContent:"center",marginTop:"2",children:W.jsx(Ge,{variant:"small",color:"negative",children:"Wallet does not match recovery phrase"})})]}),s.length>=1&&W.jsxs(xe,{flexDirection:"column",gap:"4",children:[W.jsx(Ge,{variant:"normal",marginTop:"4",color:"text100",textAlign:"center",children:"Select your wallet"}),W.jsx(xe,{display:"grid",gap:"4",style:{gridTemplateColumns:"1fr 1fr 1fr"},children:s.map(ce=>W.jsx(Zt,{size:"lg",shape:"square",label:T9e(ce,18,4),onClick:()=>{i(ce)}},ce))})]}),C&&W.jsx(xe,{alignItems:"center",justifyContent:"center",children:W.jsx($r,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})})]})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[O&&W.jsx(xe,{marginTop:"16",alignItems:"center",justifyContent:"center",children:W.jsx($r,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})}),!O&&W.jsxs(W.Fragment,{children:[W.jsx(xe,{children:W.jsx(Zt,{variant:"primary",size:"lg",shape:"square",label:"Continue",disabled:!a||!vw(n)||u&&(!l||l.length<8)||b===!1,onClick:()=>{L()},width:"full",marginTop:"16"})}),W.jsx(xe,{children:W.jsx(Zt,{as:eY,to:"/",variant:"text",size:"lg",shape:"square",label:"Go back to start",width:"full",marginTop:"6"})})]})]})]})})}const k9e="modulepreload",M9e=function(t){return"/wallet-recovery-app/"+t},tj={},R9e=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(c=>{if(c=M9e(c),c in tj)return;tj[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":k9e,l||(u.as="script"),u.crossOrigin="",u.href=c,a&&u.setAttribute("nonce",a),document.head.appendChild(u),l)return new Promise((p,g)=>{u.addEventListener("load",p),u.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var gM={exports:{}},Uv=typeof Reflect=="object"?Reflect:null,rj=Uv&&typeof Uv.apply=="function"?Uv.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},I3;Uv&&typeof Uv.ownKeys=="function"?I3=Uv.ownKeys:Object.getOwnPropertySymbols?I3=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:I3=function(e){return Object.getOwnPropertyNames(e)};function O9e(t){console&&console.warn&&console.warn(t)}var gX=Number.isNaN||function(e){return e!==e};function cn(){cn.init.call(this)}gM.exports=cn;gM.exports.once=L9e;cn.EventEmitter=cn;cn.prototype._events=void 0;cn.prototype._eventsCount=0;cn.prototype._maxListeners=void 0;var nj=10;function oE(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(cn,"defaultMaxListeners",{enumerable:!0,get:function(){return nj},set:function(t){if(typeof t!="number"||t<0||gX(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");nj=t}});cn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};cn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||gX(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function yX(t){return t._maxListeners===void 0?cn.defaultMaxListeners:t._maxListeners}cn.prototype.getMaxListeners=function(){return yX(this)};cn.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")rj(c,this,r);else for(var l=c.length,f=EX(c,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,O9e(a)}return t}cn.prototype.addListener=function(e,r){return mX(this,e,r,!1)};cn.prototype.on=cn.prototype.addListener;cn.prototype.prependListener=function(e,r){return mX(this,e,r,!0)};function D9e(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function bX(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=D9e.bind(n);return i.listener=r,n.wrapFn=i,i}cn.prototype.once=function(e,r){return oE(r),this.on(e,bX(this,e,r)),this};cn.prototype.prependOnceListener=function(e,r){return oE(r),this.prependListener(e,bX(this,e,r)),this};cn.prototype.removeListener=function(e,r){var n,i,s,o,a;if(oE(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():N9e(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};cn.prototype.off=cn.prototype.removeListener;cn.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function wX(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?B9e(i):EX(i,i.length)}cn.prototype.listeners=function(e){return wX(this,e,!0)};cn.prototype.rawListeners=function(e){return wX(this,e,!1)};cn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):xX.call(t,e)};cn.prototype.listenerCount=xX;function xX(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}cn.prototype.eventNames=function(){return this._eventsCount>0?I3(this._events):[]};function EX(t,e){for(var r=new Array(e),n=0;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new V9e:typeof navigator<"u"?Y9e(navigator.userAgent):J9e()}function K9e(t){return t!==""&&G9e.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Y9e(t){var e=K9e(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new q9e;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length>5,this.byteCount=this.blockCount<<2,this.outputBlocks=G>>5,this.extraBytes=(G&31)>>3;for(var Z=0;Z<50;++Z)this.s[Z]=0}k.prototype.update=function(j){if(this.finalized)throw new Error(r);var X,G=typeof j;if(G!=="string"){if(G==="object"){if(j===null)throw new Error(e);if(c&&j.constructor===ArrayBuffer)j=new Uint8Array(j);else if(!Array.isArray(j)&&(!c||!ArrayBuffer.isView(j)))throw new Error(e)}else throw new Error(e);X=!0}for(var Z=this.blocks,ee=this.byteCount,N=j.length,te=this.blockCount,fe=0,Ee=this.s,_e,Re;fe>2]|=j[fe]<>2]|=Re<>2]|=(192|Re>>6)<>2]|=(128|Re&63)<=57344?(Z[_e>>2]|=(224|Re>>12)<>2]|=(128|Re>>6&63)<>2]|=(128|Re&63)<>2]|=(240|Re>>18)<>2]|=(128|Re>>12&63)<>2]|=(128|Re>>6&63)<>2]|=(128|Re&63)<=ee){for(this.start=_e-ee,this.block=Z[te],_e=0;_e>8,G=j&255;G>0;)ee.unshift(G),j=j>>8,G=j&255,++Z;return X?ee.push(Z):ee.unshift(Z),this.update(ee),ee.length},k.prototype.encodeString=function(j){var X,G=typeof j;if(G!=="string"){if(G==="object"){if(j===null)throw new Error(e);if(c&&j.constructor===ArrayBuffer)j=new Uint8Array(j);else if(!Array.isArray(j)&&(!c||!ArrayBuffer.isView(j)))throw new Error(e)}else throw new Error(e);X=!0}var Z=0,ee=j.length;if(X)Z=ee;else for(var N=0;N=57344?Z+=3:(te=65536+((te&1023)<<10|j.charCodeAt(++N)&1023),Z+=4)}return Z+=this.encode(Z*8),this.update(j),Z},k.prototype.bytepad=function(j,X){for(var G=this.encode(X),Z=0;Z>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(j[0]=j[G],X=1;X>4&15]+l[fe&15]+l[fe>>12&15]+l[fe>>8&15]+l[fe>>20&15]+l[fe>>16&15]+l[fe>>28&15]+l[fe>>24&15];N%j===0&&(oe(X),ee=0)}return Z&&(fe=X[ee],te+=l[fe>>4&15]+l[fe&15],Z>1&&(te+=l[fe>>12&15]+l[fe>>8&15]),Z>2&&(te+=l[fe>>20&15]+l[fe>>16&15])),te},k.prototype.arrayBuffer=function(){this.finalize();var j=this.blockCount,X=this.s,G=this.outputBlocks,Z=this.extraBytes,ee=0,N=0,te=this.outputBits>>3,fe;Z?fe=new ArrayBuffer(G+1<<2):fe=new ArrayBuffer(te);for(var Ee=new Uint32Array(fe);N>8&255,te[fe+2]=Ee>>16&255,te[fe+3]=Ee>>24&255;N%j===0&&oe(X)}return Z&&(fe=N<<2,Ee=X[ee],te[fe]=Ee&255,Z>1&&(te[fe+1]=Ee>>8&255),Z>2&&(te[fe+2]=Ee>>16&255)),te};function H(j,X,G){k.call(this,j,X,G)}H.prototype=new k,H.prototype.finalize=function(){return this.encode(this.outputBits,!0),k.prototype.finalize.call(this)};var oe=function(j){var X,G,Z,ee,N,te,fe,Ee,_e,Re,Te,De,ze,et,Je,ke,Ne,tt,Ze,st,nt,We,lt,vt,Ke,gt,wt,rt,It,At,Tt,Xt,lr,xt,ar,rr,kt,Dt,Nt,dt,Lt,Mt,ut,Vt,zt,ht,Et,Bt,He,$t,Ct,ct,Ht,Rr,Ut,Sr,er,kr,bi,wi,xi,Ti,Sn;for(Z=0;Z<48;Z+=2)ee=j[0]^j[10]^j[20]^j[30]^j[40],N=j[1]^j[11]^j[21]^j[31]^j[41],te=j[2]^j[12]^j[22]^j[32]^j[42],fe=j[3]^j[13]^j[23]^j[33]^j[43],Ee=j[4]^j[14]^j[24]^j[34]^j[44],_e=j[5]^j[15]^j[25]^j[35]^j[45],Re=j[6]^j[16]^j[26]^j[36]^j[46],Te=j[7]^j[17]^j[27]^j[37]^j[47],De=j[8]^j[18]^j[28]^j[38]^j[48],ze=j[9]^j[19]^j[29]^j[39]^j[49],X=De^(te<<1|fe>>>31),G=ze^(fe<<1|te>>>31),j[0]^=X,j[1]^=G,j[10]^=X,j[11]^=G,j[20]^=X,j[21]^=G,j[30]^=X,j[31]^=G,j[40]^=X,j[41]^=G,X=ee^(Ee<<1|_e>>>31),G=N^(_e<<1|Ee>>>31),j[2]^=X,j[3]^=G,j[12]^=X,j[13]^=G,j[22]^=X,j[23]^=G,j[32]^=X,j[33]^=G,j[42]^=X,j[43]^=G,X=te^(Re<<1|Te>>>31),G=fe^(Te<<1|Re>>>31),j[4]^=X,j[5]^=G,j[14]^=X,j[15]^=G,j[24]^=X,j[25]^=G,j[34]^=X,j[35]^=G,j[44]^=X,j[45]^=G,X=Ee^(De<<1|ze>>>31),G=_e^(ze<<1|De>>>31),j[6]^=X,j[7]^=G,j[16]^=X,j[17]^=G,j[26]^=X,j[27]^=G,j[36]^=X,j[37]^=G,j[46]^=X,j[47]^=G,X=Re^(ee<<1|N>>>31),G=Te^(N<<1|ee>>>31),j[8]^=X,j[9]^=G,j[18]^=X,j[19]^=G,j[28]^=X,j[29]^=G,j[38]^=X,j[39]^=G,j[48]^=X,j[49]^=G,et=j[0],Je=j[1],ht=j[11]<<4|j[10]>>>28,Et=j[10]<<4|j[11]>>>28,rt=j[20]<<3|j[21]>>>29,It=j[21]<<3|j[20]>>>29,wi=j[31]<<9|j[30]>>>23,xi=j[30]<<9|j[31]>>>23,Mt=j[40]<<18|j[41]>>>14,ut=j[41]<<18|j[40]>>>14,xt=j[2]<<1|j[3]>>>31,ar=j[3]<<1|j[2]>>>31,ke=j[13]<<12|j[12]>>>20,Ne=j[12]<<12|j[13]>>>20,Bt=j[22]<<10|j[23]>>>22,He=j[23]<<10|j[22]>>>22,At=j[33]<<13|j[32]>>>19,Tt=j[32]<<13|j[33]>>>19,Ti=j[42]<<2|j[43]>>>30,Sn=j[43]<<2|j[42]>>>30,Rr=j[5]<<30|j[4]>>>2,Ut=j[4]<<30|j[5]>>>2,rr=j[14]<<6|j[15]>>>26,kt=j[15]<<6|j[14]>>>26,tt=j[25]<<11|j[24]>>>21,Ze=j[24]<<11|j[25]>>>21,$t=j[34]<<15|j[35]>>>17,Ct=j[35]<<15|j[34]>>>17,Xt=j[45]<<29|j[44]>>>3,lr=j[44]<<29|j[45]>>>3,vt=j[6]<<28|j[7]>>>4,Ke=j[7]<<28|j[6]>>>4,Sr=j[17]<<23|j[16]>>>9,er=j[16]<<23|j[17]>>>9,Dt=j[26]<<25|j[27]>>>7,Nt=j[27]<<25|j[26]>>>7,st=j[36]<<21|j[37]>>>11,nt=j[37]<<21|j[36]>>>11,ct=j[47]<<24|j[46]>>>8,Ht=j[46]<<24|j[47]>>>8,Vt=j[8]<<27|j[9]>>>5,zt=j[9]<<27|j[8]>>>5,gt=j[18]<<20|j[19]>>>12,wt=j[19]<<20|j[18]>>>12,kr=j[29]<<7|j[28]>>>25,bi=j[28]<<7|j[29]>>>25,dt=j[38]<<8|j[39]>>>24,Lt=j[39]<<8|j[38]>>>24,We=j[48]<<14|j[49]>>>18,lt=j[49]<<14|j[48]>>>18,j[0]=et^~ke&tt,j[1]=Je^~Ne&Ze,j[10]=vt^~gt&rt,j[11]=Ke^~wt&It,j[20]=xt^~rr&Dt,j[21]=ar^~kt&Nt,j[30]=Vt^~ht&Bt,j[31]=zt^~Et&He,j[40]=Rr^~Sr&kr,j[41]=Ut^~er&bi,j[2]=ke^~tt&st,j[3]=Ne^~Ze&nt,j[12]=gt^~rt&At,j[13]=wt^~It&Tt,j[22]=rr^~Dt&dt,j[23]=kt^~Nt&Lt,j[32]=ht^~Bt&$t,j[33]=Et^~He&Ct,j[42]=Sr^~kr&wi,j[43]=er^~bi&xi,j[4]=tt^~st&We,j[5]=Ze^~nt<,j[14]=rt^~At&Xt,j[15]=It^~Tt&lr,j[24]=Dt^~dt&Mt,j[25]=Nt^~Lt&ut,j[34]=Bt^~$t&ct,j[35]=He^~Ct&Ht,j[44]=kr^~wi&Ti,j[45]=bi^~xi&Sn,j[6]=st^~We&et,j[7]=nt^~lt&Je,j[16]=At^~Xt&vt,j[17]=Tt^~lr&Ke,j[26]=dt^~Mt&xt,j[27]=Lt^~ut&ar,j[36]=$t^~ct&Vt,j[37]=Ct^~Ht&zt,j[46]=wi^~Ti&Rr,j[47]=xi^~Sn&Ut,j[8]=We^~et&ke,j[9]=lt^~Je&Ne,j[18]=Xt^~vt>,j[19]=lr^~Ke&wt,j[28]=Mt^~xt&rr,j[29]=ut^~ar&kt,j[38]=ct^~Vt&ht,j[39]=Ht^~zt&Et,j[48]=Ti^~Rr&Sr,j[49]=Sn^~Ut&er,j[0]^=b[Z],j[1]^=b[Z+1]};if(a)t.exports=v;else for(R=0;R{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 Ej=WSe();var eI;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(eI||(eI={}));var Dc;(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"})(Dc||(Dc={}));const Cj="0123456789abcdef";class En{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();T3[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(xj>T3[n])&&console.log.apply(console,r)}debug(...e){this._log(En.levels.DEBUG,e)}info(...e){this._log(En.levels.INFO,e)}warn(...e){this._log(En.levels.WARNING,e)}makeError(e,r,n){if(wj)return this.makeError("censored error",r,{});r||(r=En.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(c=>{const l=n[c];try{if(l instanceof Uint8Array){let f="";for(let u=0;u>4],f+=Cj[l[u]&15];i.push(c+"=Uint8Array(0x"+f+")")}else i.push(c+"="+JSON.stringify(l))}catch{i.push(c+"="+JSON.stringify(n[c].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case Dc.NUMERIC_FAULT:{o="NUMERIC_FAULT";const c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":o+="-"+c;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Dc.CALL_EXCEPTION:case Dc.INSUFFICIENT_FUNDS:case Dc.MISSING_NEW:case Dc.NONCE_EXPIRED:case Dc.REPLACEMENT_UNDERPRICED:case Dc.TRANSACTION_REPLACED:case Dc.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(c){a[c]=n[c]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,En.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){Ej&&this.throwError("platform missing String.prototype.normalize",En.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ej})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,En.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,En.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,En.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",En.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",En.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",En.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return O9||(O9=new En(GSe)),O9}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",En.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bj){if(!e)return;this.globalLogger().throwError("error censorship permanent",En.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}wj=!!e,bj=!!r}static setLogLevel(e){const r=T3[e.toLowerCase()];if(r==null){En.globalLogger().warn("invalid log level - "+e);return}xj=r}static from(e){return new En(e)}}En.errors=Dc;En.levels=eI;const KSe="bytes/5.7.0",ri=new En(KSe);function kX(t){return!!t.toHexString}function $v(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return $v(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function YSe(t){return Vl(t)&&!(t.length%2)||wM(t)}function Aj(t){return typeof t=="number"&&t==t&&t%1===0}function wM(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Aj(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function vi(t,e){if(e||(e={}),typeof t=="number"){ri.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),$v(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kX(t)&&(t=t.toHexString()),Vl(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":ri.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ivi(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),$v(n)}function JSe(t,e){t=vi(t),t.length>e&&ri.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),$v(r)}function Vl(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const D9="0123456789abcdef";function ia(t,e){if(e||(e={}),typeof t=="number"){ri.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=D9[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),kX(t))return t.toHexString();if(Vl(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":ri.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(wM(t)){let r="0x";for(let n=0;n>4]+D9[i&15]}return r}return ri.throwArgumentError("invalid hexlify value","value",t)}function ZSe(t){if(typeof t!="string")t=ia(t);else if(!Vl(t)||t.length%2)return null;return(t.length-2)/2}function Sj(t,e,r){return typeof t!="string"?t=ia(t):(!Vl(t)||t.length%2)&&ri.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function qv(t,e){for(typeof t!="string"?t=ia(t):Vl(t)||ri.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&ri.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function MX(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(YSe(t)){let r=vi(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=ia(r.slice(0,32)),e.s=ia(r.slice(32,64))):r.length===65?(e.r=ia(r.slice(0,32)),e.s=ia(r.slice(32,64)),e.v=r[64]):ri.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:ri.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=ia(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=JSe(vi(e._vs),32);e._vs=ia(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&ri.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=ia(i);e.s==null?e.s=o:e.s!==o&&ri.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?ri.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&&ri.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Vl(e.r)?ri.throwArgumentError("signature missing or invalid r","signature",t):e.r=qv(e.r,32),e.s==null||!Vl(e.s)?ri.throwArgumentError("signature missing or invalid s","signature",t):e.s=qv(e.s,32);const r=vi(e.s);r[0]>=128&&ri.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=ia(r);e._vs&&(Vl(e._vs)||ri.throwArgumentError("signature invalid _vs","signature",t),e._vs=qv(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&ri.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function xM(t){return"0x"+HSe.keccak_256(vi(t))}var EM={exports:{}};const XSe={},e7e=Object.freeze(Object.defineProperty({__proto__:null,default:XSe},Symbol.toStringTag,{value:"Module"})),aE=V$(e7e);EM.exports;(function(t){(function(e,r){function n(M,v){if(!M)throw new Error(v||"Assertion failed")}function i(M,v){M.super_=v;var m=function(){};m.prototype=v.prototype,M.prototype=new m,M.prototype.constructor=M}function s(M,v,m){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&((v==="le"||v==="be")&&(m=v,v=10),this._init(M||0,v||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=aE.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,m){return v.cmp(m)>0?v:m},s.min=function(v,m){return v.cmp(m)<0?v:m},s.prototype._init=function(v,m,R){if(typeof v=="number")return this._initNumber(v,m,R);if(typeof v=="object")return this._initArray(v,m,R);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),v=v.toString().replace(/\s+/g,"");var B=0;v[0]==="-"&&(B++,this.negative=1),B=0;B-=3)x=v[B]|v[B-1]<<8|v[B-2]<<16,this.words[E]|=x<>>26-w&67108863,w+=24,w>=26&&(w-=26,E++);else if(R==="le")for(B=0,E=0;B>>26-w&67108863,w+=24,w>=26&&(w-=26,E++);return this._strip()};function a(M,v){var m=M.charCodeAt(v);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 "+M)}function c(M,v,m){var R=a(M,m);return m-1>=v&&(R|=a(M,m-1)<<4),R}s.prototype._parseHex=function(v,m,R){this.length=Math.ceil((v.length-m)/6),this.words=new Array(this.length);for(var B=0;B=m;B-=2)w=c(v,m,B)<=18?(E-=18,x+=1,this.words[x]|=w>>>26):E+=8;else{var T=v.length-m;for(B=T%2===0?m+1:m;B=18?(E-=18,x+=1,this.words[x]|=w>>>26):E+=8}this._strip()};function l(M,v,m,R){for(var B=0,E=0,x=Math.min(M.length,m),w=v;w=49?E=T-49+10:T>=17?E=T-17+10:E=T,n(T>=0&&E1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(v,m){v=v||10,m=m|0||1;var R;if(v===16||v==="hex"){R="";for(var B=0,E=0,x=0;x>>24-B&16777215,B+=2,B>=26&&(B-=26,x--),E!==0||x!==this.length-1?R=p[6-T.length]+T+R:R=T+R}for(E!==0&&(R=E.toString(16)+R);R.length%m!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}if(v===(v|0)&&v>=2&&v<=36){var k=g[v],H=y[v];R="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var j=oe.modrn(H).toString(v);oe=oe.idivn(H),oe.isZero()?R=j+R:R=p[k-j.length]+j+R}for(this.isZero()&&(R="0"+R);R.length%m!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,m){return this.toArrayLike(o,v,m)}),s.prototype.toArray=function(v,m){return this.toArrayLike(Array,v,m)};var b=function(v,m){return v.allocUnsafe?v.allocUnsafe(m):new v(m)};s.prototype.toArrayLike=function(v,m,R){this._strip();var B=this.byteLength(),E=R||Math.max(1,B);n(B<=E,"byte array longer than desired length"),n(E>0,"Requested array length <= 0");var x=b(v,E),w=m==="le"?"LE":"BE";return this["_toArrayLike"+w](x,B),x},s.prototype._toArrayLikeLE=function(v,m){for(var R=0,B=0,E=0,x=0;E>8&255),R>16&255),x===6?(R>24&255),B=0,x=0):(B=w>>>24,x+=2)}if(R=0&&(v[R--]=w>>8&255),R>=0&&(v[R--]=w>>16&255),x===6?(R>=0&&(v[R--]=w>>24&255),B=0,x=0):(B=w>>>24,x+=2)}if(R>=0)for(v[R--]=B;R>=0;)v[R--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var m=v,R=0;return m>=4096&&(R+=13,m>>>=13),m>=64&&(R+=7,m>>>=7),m>=8&&(R+=4,m>>>=4),m>=2&&(R+=2,m>>>=2),R+m},s.prototype._zeroBits=function(v){if(v===0)return 26;var m=v,R=0;return m&8191||(R+=13,m>>>=13),m&127||(R+=7,m>>>=7),m&15||(R+=4,m>>>=4),m&3||(R+=2,m>>>=2),m&1||R++,R},s.prototype.bitLength=function(){var v=this.words[this.length-1],m=this._countBits(v);return(this.length-1)*26+m};function I(M){for(var v=new Array(M.bitLength()),m=0;m>>B&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,m=0;mv.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var m;this.length>v.length?m=v:m=this;for(var R=0;Rv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var m,R;this.length>v.length?(m=this,R=v):(m=v,R=this);for(var B=0;Bv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){n(typeof v=="number"&&v>=0);var m=Math.ceil(v/26)|0,R=v%26;this._expand(m),R>0&&m--;for(var B=0;B0&&(this.words[B]=~this.words[B]&67108863>>26-R),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,m){n(typeof v=="number"&&v>=0);var R=v/26|0,B=v%26;return this._expand(R+1),m?this.words[R]=this.words[R]|1<v.length?(R=this,B=v):(R=v,B=this);for(var E=0,x=0;x>>26;for(;E!==0&&x>>26;if(this.length=R.length,E!==0)this.words[this.length]=E,this.length++;else if(R!==this)for(;xv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var m=this.iadd(v);return v.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var R=this.cmp(v);if(R===0)return this.negative=0,this.length=1,this.words[0]=0,this;var B,E;R>0?(B=this,E=v):(B=v,E=this);for(var x=0,w=0;w>26,this.words[w]=m&67108863;for(;x!==0&&w>26,this.words[w]=m&67108863;if(x===0&&w>>26,oe=T&67108863,j=Math.min(k,v.length-1),X=Math.max(0,k-M.length+1);X<=j;X++){var G=k-X|0;B=M.words[G]|0,E=v.words[X]|0,x=B*E+oe,H+=x/67108864|0,oe=x&67108863}m.words[k]=oe|0,T=H|0}return T!==0?m.words[k]=T|0:m.length--,m._strip()}var S=function(v,m,R){var B=v.words,E=m.words,x=R.words,w=0,T,k,H,oe=B[0]|0,j=oe&8191,X=oe>>>13,G=B[1]|0,Z=G&8191,ee=G>>>13,N=B[2]|0,te=N&8191,fe=N>>>13,Ee=B[3]|0,_e=Ee&8191,Re=Ee>>>13,Te=B[4]|0,De=Te&8191,ze=Te>>>13,et=B[5]|0,Je=et&8191,ke=et>>>13,Ne=B[6]|0,tt=Ne&8191,Ze=Ne>>>13,st=B[7]|0,nt=st&8191,We=st>>>13,lt=B[8]|0,vt=lt&8191,Ke=lt>>>13,gt=B[9]|0,wt=gt&8191,rt=gt>>>13,It=E[0]|0,At=It&8191,Tt=It>>>13,Xt=E[1]|0,lr=Xt&8191,xt=Xt>>>13,ar=E[2]|0,rr=ar&8191,kt=ar>>>13,Dt=E[3]|0,Nt=Dt&8191,dt=Dt>>>13,Lt=E[4]|0,Mt=Lt&8191,ut=Lt>>>13,Vt=E[5]|0,zt=Vt&8191,ht=Vt>>>13,Et=E[6]|0,Bt=Et&8191,He=Et>>>13,$t=E[7]|0,Ct=$t&8191,ct=$t>>>13,Ht=E[8]|0,Rr=Ht&8191,Ut=Ht>>>13,Sr=E[9]|0,er=Sr&8191,kr=Sr>>>13;R.negative=v.negative^m.negative,R.length=19,T=Math.imul(j,At),k=Math.imul(j,Tt),k=k+Math.imul(X,At)|0,H=Math.imul(X,Tt);var bi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(bi>>>26)|0,bi&=67108863,T=Math.imul(Z,At),k=Math.imul(Z,Tt),k=k+Math.imul(ee,At)|0,H=Math.imul(ee,Tt),T=T+Math.imul(j,lr)|0,k=k+Math.imul(j,xt)|0,k=k+Math.imul(X,lr)|0,H=H+Math.imul(X,xt)|0;var wi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(wi>>>26)|0,wi&=67108863,T=Math.imul(te,At),k=Math.imul(te,Tt),k=k+Math.imul(fe,At)|0,H=Math.imul(fe,Tt),T=T+Math.imul(Z,lr)|0,k=k+Math.imul(Z,xt)|0,k=k+Math.imul(ee,lr)|0,H=H+Math.imul(ee,xt)|0,T=T+Math.imul(j,rr)|0,k=k+Math.imul(j,kt)|0,k=k+Math.imul(X,rr)|0,H=H+Math.imul(X,kt)|0;var xi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(xi>>>26)|0,xi&=67108863,T=Math.imul(_e,At),k=Math.imul(_e,Tt),k=k+Math.imul(Re,At)|0,H=Math.imul(Re,Tt),T=T+Math.imul(te,lr)|0,k=k+Math.imul(te,xt)|0,k=k+Math.imul(fe,lr)|0,H=H+Math.imul(fe,xt)|0,T=T+Math.imul(Z,rr)|0,k=k+Math.imul(Z,kt)|0,k=k+Math.imul(ee,rr)|0,H=H+Math.imul(ee,kt)|0,T=T+Math.imul(j,Nt)|0,k=k+Math.imul(j,dt)|0,k=k+Math.imul(X,Nt)|0,H=H+Math.imul(X,dt)|0;var Ti=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,T=Math.imul(De,At),k=Math.imul(De,Tt),k=k+Math.imul(ze,At)|0,H=Math.imul(ze,Tt),T=T+Math.imul(_e,lr)|0,k=k+Math.imul(_e,xt)|0,k=k+Math.imul(Re,lr)|0,H=H+Math.imul(Re,xt)|0,T=T+Math.imul(te,rr)|0,k=k+Math.imul(te,kt)|0,k=k+Math.imul(fe,rr)|0,H=H+Math.imul(fe,kt)|0,T=T+Math.imul(Z,Nt)|0,k=k+Math.imul(Z,dt)|0,k=k+Math.imul(ee,Nt)|0,H=H+Math.imul(ee,dt)|0,T=T+Math.imul(j,Mt)|0,k=k+Math.imul(j,ut)|0,k=k+Math.imul(X,Mt)|0,H=H+Math.imul(X,ut)|0;var Sn=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,T=Math.imul(Je,At),k=Math.imul(Je,Tt),k=k+Math.imul(ke,At)|0,H=Math.imul(ke,Tt),T=T+Math.imul(De,lr)|0,k=k+Math.imul(De,xt)|0,k=k+Math.imul(ze,lr)|0,H=H+Math.imul(ze,xt)|0,T=T+Math.imul(_e,rr)|0,k=k+Math.imul(_e,kt)|0,k=k+Math.imul(Re,rr)|0,H=H+Math.imul(Re,kt)|0,T=T+Math.imul(te,Nt)|0,k=k+Math.imul(te,dt)|0,k=k+Math.imul(fe,Nt)|0,H=H+Math.imul(fe,dt)|0,T=T+Math.imul(Z,Mt)|0,k=k+Math.imul(Z,ut)|0,k=k+Math.imul(ee,Mt)|0,H=H+Math.imul(ee,ut)|0,T=T+Math.imul(j,zt)|0,k=k+Math.imul(j,ht)|0,k=k+Math.imul(X,zt)|0,H=H+Math.imul(X,ht)|0;var ui=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(ui>>>26)|0,ui&=67108863,T=Math.imul(tt,At),k=Math.imul(tt,Tt),k=k+Math.imul(Ze,At)|0,H=Math.imul(Ze,Tt),T=T+Math.imul(Je,lr)|0,k=k+Math.imul(Je,xt)|0,k=k+Math.imul(ke,lr)|0,H=H+Math.imul(ke,xt)|0,T=T+Math.imul(De,rr)|0,k=k+Math.imul(De,kt)|0,k=k+Math.imul(ze,rr)|0,H=H+Math.imul(ze,kt)|0,T=T+Math.imul(_e,Nt)|0,k=k+Math.imul(_e,dt)|0,k=k+Math.imul(Re,Nt)|0,H=H+Math.imul(Re,dt)|0,T=T+Math.imul(te,Mt)|0,k=k+Math.imul(te,ut)|0,k=k+Math.imul(fe,Mt)|0,H=H+Math.imul(fe,ut)|0,T=T+Math.imul(Z,zt)|0,k=k+Math.imul(Z,ht)|0,k=k+Math.imul(ee,zt)|0,H=H+Math.imul(ee,ht)|0,T=T+Math.imul(j,Bt)|0,k=k+Math.imul(j,He)|0,k=k+Math.imul(X,Bt)|0,H=H+Math.imul(X,He)|0;var Fs=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Fs>>>26)|0,Fs&=67108863,T=Math.imul(nt,At),k=Math.imul(nt,Tt),k=k+Math.imul(We,At)|0,H=Math.imul(We,Tt),T=T+Math.imul(tt,lr)|0,k=k+Math.imul(tt,xt)|0,k=k+Math.imul(Ze,lr)|0,H=H+Math.imul(Ze,xt)|0,T=T+Math.imul(Je,rr)|0,k=k+Math.imul(Je,kt)|0,k=k+Math.imul(ke,rr)|0,H=H+Math.imul(ke,kt)|0,T=T+Math.imul(De,Nt)|0,k=k+Math.imul(De,dt)|0,k=k+Math.imul(ze,Nt)|0,H=H+Math.imul(ze,dt)|0,T=T+Math.imul(_e,Mt)|0,k=k+Math.imul(_e,ut)|0,k=k+Math.imul(Re,Mt)|0,H=H+Math.imul(Re,ut)|0,T=T+Math.imul(te,zt)|0,k=k+Math.imul(te,ht)|0,k=k+Math.imul(fe,zt)|0,H=H+Math.imul(fe,ht)|0,T=T+Math.imul(Z,Bt)|0,k=k+Math.imul(Z,He)|0,k=k+Math.imul(ee,Bt)|0,H=H+Math.imul(ee,He)|0,T=T+Math.imul(j,Ct)|0,k=k+Math.imul(j,ct)|0,k=k+Math.imul(X,Ct)|0,H=H+Math.imul(X,ct)|0;var di=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(di>>>26)|0,di&=67108863,T=Math.imul(vt,At),k=Math.imul(vt,Tt),k=k+Math.imul(Ke,At)|0,H=Math.imul(Ke,Tt),T=T+Math.imul(nt,lr)|0,k=k+Math.imul(nt,xt)|0,k=k+Math.imul(We,lr)|0,H=H+Math.imul(We,xt)|0,T=T+Math.imul(tt,rr)|0,k=k+Math.imul(tt,kt)|0,k=k+Math.imul(Ze,rr)|0,H=H+Math.imul(Ze,kt)|0,T=T+Math.imul(Je,Nt)|0,k=k+Math.imul(Je,dt)|0,k=k+Math.imul(ke,Nt)|0,H=H+Math.imul(ke,dt)|0,T=T+Math.imul(De,Mt)|0,k=k+Math.imul(De,ut)|0,k=k+Math.imul(ze,Mt)|0,H=H+Math.imul(ze,ut)|0,T=T+Math.imul(_e,zt)|0,k=k+Math.imul(_e,ht)|0,k=k+Math.imul(Re,zt)|0,H=H+Math.imul(Re,ht)|0,T=T+Math.imul(te,Bt)|0,k=k+Math.imul(te,He)|0,k=k+Math.imul(fe,Bt)|0,H=H+Math.imul(fe,He)|0,T=T+Math.imul(Z,Ct)|0,k=k+Math.imul(Z,ct)|0,k=k+Math.imul(ee,Ct)|0,H=H+Math.imul(ee,ct)|0,T=T+Math.imul(j,Rr)|0,k=k+Math.imul(j,Ut)|0,k=k+Math.imul(X,Rr)|0,H=H+Math.imul(X,Ut)|0;var jo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(jo>>>26)|0,jo&=67108863,T=Math.imul(wt,At),k=Math.imul(wt,Tt),k=k+Math.imul(rt,At)|0,H=Math.imul(rt,Tt),T=T+Math.imul(vt,lr)|0,k=k+Math.imul(vt,xt)|0,k=k+Math.imul(Ke,lr)|0,H=H+Math.imul(Ke,xt)|0,T=T+Math.imul(nt,rr)|0,k=k+Math.imul(nt,kt)|0,k=k+Math.imul(We,rr)|0,H=H+Math.imul(We,kt)|0,T=T+Math.imul(tt,Nt)|0,k=k+Math.imul(tt,dt)|0,k=k+Math.imul(Ze,Nt)|0,H=H+Math.imul(Ze,dt)|0,T=T+Math.imul(Je,Mt)|0,k=k+Math.imul(Je,ut)|0,k=k+Math.imul(ke,Mt)|0,H=H+Math.imul(ke,ut)|0,T=T+Math.imul(De,zt)|0,k=k+Math.imul(De,ht)|0,k=k+Math.imul(ze,zt)|0,H=H+Math.imul(ze,ht)|0,T=T+Math.imul(_e,Bt)|0,k=k+Math.imul(_e,He)|0,k=k+Math.imul(Re,Bt)|0,H=H+Math.imul(Re,He)|0,T=T+Math.imul(te,Ct)|0,k=k+Math.imul(te,ct)|0,k=k+Math.imul(fe,Ct)|0,H=H+Math.imul(fe,ct)|0,T=T+Math.imul(Z,Rr)|0,k=k+Math.imul(Z,Ut)|0,k=k+Math.imul(ee,Rr)|0,H=H+Math.imul(ee,Ut)|0,T=T+Math.imul(j,er)|0,k=k+Math.imul(j,kr)|0,k=k+Math.imul(X,er)|0,H=H+Math.imul(X,kr)|0;var Uo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Uo>>>26)|0,Uo&=67108863,T=Math.imul(wt,lr),k=Math.imul(wt,xt),k=k+Math.imul(rt,lr)|0,H=Math.imul(rt,xt),T=T+Math.imul(vt,rr)|0,k=k+Math.imul(vt,kt)|0,k=k+Math.imul(Ke,rr)|0,H=H+Math.imul(Ke,kt)|0,T=T+Math.imul(nt,Nt)|0,k=k+Math.imul(nt,dt)|0,k=k+Math.imul(We,Nt)|0,H=H+Math.imul(We,dt)|0,T=T+Math.imul(tt,Mt)|0,k=k+Math.imul(tt,ut)|0,k=k+Math.imul(Ze,Mt)|0,H=H+Math.imul(Ze,ut)|0,T=T+Math.imul(Je,zt)|0,k=k+Math.imul(Je,ht)|0,k=k+Math.imul(ke,zt)|0,H=H+Math.imul(ke,ht)|0,T=T+Math.imul(De,Bt)|0,k=k+Math.imul(De,He)|0,k=k+Math.imul(ze,Bt)|0,H=H+Math.imul(ze,He)|0,T=T+Math.imul(_e,Ct)|0,k=k+Math.imul(_e,ct)|0,k=k+Math.imul(Re,Ct)|0,H=H+Math.imul(Re,ct)|0,T=T+Math.imul(te,Rr)|0,k=k+Math.imul(te,Ut)|0,k=k+Math.imul(fe,Rr)|0,H=H+Math.imul(fe,Ut)|0,T=T+Math.imul(Z,er)|0,k=k+Math.imul(Z,kr)|0,k=k+Math.imul(ee,er)|0,H=H+Math.imul(ee,kr)|0;var hi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(hi>>>26)|0,hi&=67108863,T=Math.imul(wt,rr),k=Math.imul(wt,kt),k=k+Math.imul(rt,rr)|0,H=Math.imul(rt,kt),T=T+Math.imul(vt,Nt)|0,k=k+Math.imul(vt,dt)|0,k=k+Math.imul(Ke,Nt)|0,H=H+Math.imul(Ke,dt)|0,T=T+Math.imul(nt,Mt)|0,k=k+Math.imul(nt,ut)|0,k=k+Math.imul(We,Mt)|0,H=H+Math.imul(We,ut)|0,T=T+Math.imul(tt,zt)|0,k=k+Math.imul(tt,ht)|0,k=k+Math.imul(Ze,zt)|0,H=H+Math.imul(Ze,ht)|0,T=T+Math.imul(Je,Bt)|0,k=k+Math.imul(Je,He)|0,k=k+Math.imul(ke,Bt)|0,H=H+Math.imul(ke,He)|0,T=T+Math.imul(De,Ct)|0,k=k+Math.imul(De,ct)|0,k=k+Math.imul(ze,Ct)|0,H=H+Math.imul(ze,ct)|0,T=T+Math.imul(_e,Rr)|0,k=k+Math.imul(_e,Ut)|0,k=k+Math.imul(Re,Rr)|0,H=H+Math.imul(Re,Ut)|0,T=T+Math.imul(te,er)|0,k=k+Math.imul(te,kr)|0,k=k+Math.imul(fe,er)|0,H=H+Math.imul(fe,kr)|0;var oo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(oo>>>26)|0,oo&=67108863,T=Math.imul(wt,Nt),k=Math.imul(wt,dt),k=k+Math.imul(rt,Nt)|0,H=Math.imul(rt,dt),T=T+Math.imul(vt,Mt)|0,k=k+Math.imul(vt,ut)|0,k=k+Math.imul(Ke,Mt)|0,H=H+Math.imul(Ke,ut)|0,T=T+Math.imul(nt,zt)|0,k=k+Math.imul(nt,ht)|0,k=k+Math.imul(We,zt)|0,H=H+Math.imul(We,ht)|0,T=T+Math.imul(tt,Bt)|0,k=k+Math.imul(tt,He)|0,k=k+Math.imul(Ze,Bt)|0,H=H+Math.imul(Ze,He)|0,T=T+Math.imul(Je,Ct)|0,k=k+Math.imul(Je,ct)|0,k=k+Math.imul(ke,Ct)|0,H=H+Math.imul(ke,ct)|0,T=T+Math.imul(De,Rr)|0,k=k+Math.imul(De,Ut)|0,k=k+Math.imul(ze,Rr)|0,H=H+Math.imul(ze,Ut)|0,T=T+Math.imul(_e,er)|0,k=k+Math.imul(_e,kr)|0,k=k+Math.imul(Re,er)|0,H=H+Math.imul(Re,kr)|0;var ao=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(ao>>>26)|0,ao&=67108863,T=Math.imul(wt,Mt),k=Math.imul(wt,ut),k=k+Math.imul(rt,Mt)|0,H=Math.imul(rt,ut),T=T+Math.imul(vt,zt)|0,k=k+Math.imul(vt,ht)|0,k=k+Math.imul(Ke,zt)|0,H=H+Math.imul(Ke,ht)|0,T=T+Math.imul(nt,Bt)|0,k=k+Math.imul(nt,He)|0,k=k+Math.imul(We,Bt)|0,H=H+Math.imul(We,He)|0,T=T+Math.imul(tt,Ct)|0,k=k+Math.imul(tt,ct)|0,k=k+Math.imul(Ze,Ct)|0,H=H+Math.imul(Ze,ct)|0,T=T+Math.imul(Je,Rr)|0,k=k+Math.imul(Je,Ut)|0,k=k+Math.imul(ke,Rr)|0,H=H+Math.imul(ke,Ut)|0,T=T+Math.imul(De,er)|0,k=k+Math.imul(De,kr)|0,k=k+Math.imul(ze,er)|0,H=H+Math.imul(ze,kr)|0;var _n=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(_n>>>26)|0,_n&=67108863,T=Math.imul(wt,zt),k=Math.imul(wt,ht),k=k+Math.imul(rt,zt)|0,H=Math.imul(rt,ht),T=T+Math.imul(vt,Bt)|0,k=k+Math.imul(vt,He)|0,k=k+Math.imul(Ke,Bt)|0,H=H+Math.imul(Ke,He)|0,T=T+Math.imul(nt,Ct)|0,k=k+Math.imul(nt,ct)|0,k=k+Math.imul(We,Ct)|0,H=H+Math.imul(We,ct)|0,T=T+Math.imul(tt,Rr)|0,k=k+Math.imul(tt,Ut)|0,k=k+Math.imul(Ze,Rr)|0,H=H+Math.imul(Ze,Ut)|0,T=T+Math.imul(Je,er)|0,k=k+Math.imul(Je,kr)|0,k=k+Math.imul(ke,er)|0,H=H+Math.imul(ke,kr)|0;var $o=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+($o>>>26)|0,$o&=67108863,T=Math.imul(wt,Bt),k=Math.imul(wt,He),k=k+Math.imul(rt,Bt)|0,H=Math.imul(rt,He),T=T+Math.imul(vt,Ct)|0,k=k+Math.imul(vt,ct)|0,k=k+Math.imul(Ke,Ct)|0,H=H+Math.imul(Ke,ct)|0,T=T+Math.imul(nt,Rr)|0,k=k+Math.imul(nt,Ut)|0,k=k+Math.imul(We,Rr)|0,H=H+Math.imul(We,Ut)|0,T=T+Math.imul(tt,er)|0,k=k+Math.imul(tt,kr)|0,k=k+Math.imul(Ze,er)|0,H=H+Math.imul(Ze,kr)|0;var Gi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,T=Math.imul(wt,Ct),k=Math.imul(wt,ct),k=k+Math.imul(rt,Ct)|0,H=Math.imul(rt,ct),T=T+Math.imul(vt,Rr)|0,k=k+Math.imul(vt,Ut)|0,k=k+Math.imul(Ke,Rr)|0,H=H+Math.imul(Ke,Ut)|0,T=T+Math.imul(nt,er)|0,k=k+Math.imul(nt,kr)|0,k=k+Math.imul(We,er)|0,H=H+Math.imul(We,kr)|0;var qo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(qo>>>26)|0,qo&=67108863,T=Math.imul(wt,Rr),k=Math.imul(wt,Ut),k=k+Math.imul(rt,Rr)|0,H=Math.imul(rt,Ut),T=T+Math.imul(vt,er)|0,k=k+Math.imul(vt,kr)|0,k=k+Math.imul(Ke,er)|0,H=H+Math.imul(Ke,kr)|0;var Ca=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,T=Math.imul(wt,er),k=Math.imul(wt,kr),k=k+Math.imul(rt,er)|0,H=Math.imul(rt,kr);var co=(w+T|0)+((k&8191)<<13)|0;return w=(H+(k>>>13)|0)+(co>>>26)|0,co&=67108863,x[0]=bi,x[1]=wi,x[2]=xi,x[3]=Ti,x[4]=Sn,x[5]=ui,x[6]=Fs,x[7]=di,x[8]=jo,x[9]=Uo,x[10]=hi,x[11]=oo,x[12]=ao,x[13]=_n,x[14]=$o,x[15]=Gi,x[16]=qo,x[17]=Ca,x[18]=co,w!==0&&(x[19]=w,R.length++),R};Math.imul||(S=C);function O(M,v,m){m.negative=v.negative^M.negative,m.length=M.length+v.length;for(var R=0,B=0,E=0;E>>26)|0,B+=x>>>26,x&=67108863}m.words[E]=w,R=x,x=B}return R!==0?m.words[E]=R:m.length--,m._strip()}function L(M,v,m){return O(M,v,m)}s.prototype.mulTo=function(v,m){var R,B=this.length+v.length;return this.length===10&&v.length===10?R=S(this,v,m):B<63?R=C(this,v,m):B<1024?R=O(this,v,m):R=L(this,v,m),R},s.prototype.mul=function(v){var m=new s(null);return m.words=new Array(this.length+v.length),this.mulTo(v,m)},s.prototype.mulf=function(v){var m=new s(null);return m.words=new Array(this.length+v.length),L(this,v,m)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var m=v<0;m&&(v=-v),n(typeof v=="number"),n(v<67108864);for(var R=0,B=0;B>=26,R+=E/67108864|0,R+=x>>>26,this.words[B]=x&67108863}return R!==0&&(this.words[B]=R,this.length++),m?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var m=I(v);if(m.length===0)return new s(1);for(var R=this,B=0;B=0);var m=v%26,R=(v-m)/26,B=67108863>>>26-m<<26-m,E;if(m!==0){var x=0;for(E=0;E>>26-m}x&&(this.words[E]=x,this.length++)}if(R!==0){for(E=this.length-1;E>=0;E--)this.words[E+R]=this.words[E];for(E=0;E=0);var B;m?B=(m-m%26)/26:B=0;var E=v%26,x=Math.min((v-E)/26,this.length),w=67108863^67108863>>>E<x)for(this.length-=x,k=0;k=0&&(H!==0||k>=B);k--){var oe=this.words[k]|0;this.words[k]=H<<26-E|oe>>>E,H=oe&w}return T&&H!==0&&(T.words[T.length++]=H),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,m,R){return n(this.negative===0),this.iushrn(v,m,R)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){n(typeof v=="number"&&v>=0);var m=v%26,R=(v-m)/26,B=1<=0);var m=v%26,R=(v-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=R)return this;if(m!==0&&R++,this.length=Math.min(R,this.length),m!==0){var B=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},s.prototype.isubn=function(v){if(n(typeof v=="number"),n(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(T/67108864|0),this.words[E+R]=x&67108863}for(;E>26,this.words[E+R]=x&67108863;if(w===0)return this._strip();for(n(w===-1),w=0,E=0;E>26,this.words[E]=x&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,m){var R=this.length-v.length,B=this.clone(),E=v,x=E.words[E.length-1]|0,w=this._countBits(x);R=26-w,R!==0&&(E=E.ushln(R),B.iushln(R),x=E.words[E.length-1]|0);var T=B.length-E.length,k;if(m!=="mod"){k=new s(null),k.length=T+1,k.words=new Array(k.length);for(var H=0;H=0;j--){var X=(B.words[E.length+j]|0)*67108864+(B.words[E.length+j-1]|0);for(X=Math.min(X/x|0,67108863),B._ishlnsubmul(E,X,j);B.negative!==0;)X--,B.negative=0,B._ishlnsubmul(E,1,j),B.isZero()||(B.negative^=1);k&&(k.words[j]=X)}return k&&k._strip(),B._strip(),m!=="div"&&R!==0&&B.iushrn(R),{div:k||null,mod:B}},s.prototype.divmod=function(v,m,R){if(n(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var B,E,x;return this.negative!==0&&v.negative===0?(x=this.neg().divmod(v,m),m!=="mod"&&(B=x.div.neg()),m!=="div"&&(E=x.mod.neg(),R&&E.negative!==0&&E.iadd(v)),{div:B,mod:E}):this.negative===0&&v.negative!==0?(x=this.divmod(v.neg(),m),m!=="mod"&&(B=x.div.neg()),{div:B,mod:x.mod}):this.negative&v.negative?(x=this.neg().divmod(v.neg(),m),m!=="div"&&(E=x.mod.neg(),R&&E.negative!==0&&E.isub(v)),{div:x.div,mod:E}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?m==="div"?{div:this.divn(v.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,m)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var m=this.divmod(v);if(m.mod.isZero())return m.div;var R=m.div.negative!==0?m.mod.isub(v):m.mod,B=v.ushrn(1),E=v.andln(1),x=R.cmp(B);return x<0||E===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modrn=function(v){var m=v<0;m&&(v=-v),n(v<=67108863);for(var R=(1<<26)%v,B=0,E=this.length-1;E>=0;E--)B=(R*B+(this.words[E]|0))%v;return m?-B:B},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var m=v<0;m&&(v=-v),n(v<=67108863);for(var R=0,B=this.length-1;B>=0;B--){var E=(this.words[B]|0)+R*67108864;this.words[B]=E/v|0,R=E%v}return this._strip(),m?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){n(v.negative===0),n(!v.isZero());var m=this,R=v.clone();m.negative!==0?m=m.umod(v):m=m.clone();for(var B=new s(1),E=new s(0),x=new s(0),w=new s(1),T=0;m.isEven()&&R.isEven();)m.iushrn(1),R.iushrn(1),++T;for(var k=R.clone(),H=m.clone();!m.isZero();){for(var oe=0,j=1;!(m.words[0]&j)&&oe<26;++oe,j<<=1);if(oe>0)for(m.iushrn(oe);oe-- >0;)(B.isOdd()||E.isOdd())&&(B.iadd(k),E.isub(H)),B.iushrn(1),E.iushrn(1);for(var X=0,G=1;!(R.words[0]&G)&&X<26;++X,G<<=1);if(X>0)for(R.iushrn(X);X-- >0;)(x.isOdd()||w.isOdd())&&(x.iadd(k),w.isub(H)),x.iushrn(1),w.iushrn(1);m.cmp(R)>=0?(m.isub(R),B.isub(x),E.isub(w)):(R.isub(m),x.isub(B),w.isub(E))}return{a:x,b:w,gcd:R.iushln(T)}},s.prototype._invmp=function(v){n(v.negative===0),n(!v.isZero());var m=this,R=v.clone();m.negative!==0?m=m.umod(v):m=m.clone();for(var B=new s(1),E=new s(0),x=R.clone();m.cmpn(1)>0&&R.cmpn(1)>0;){for(var w=0,T=1;!(m.words[0]&T)&&w<26;++w,T<<=1);if(w>0)for(m.iushrn(w);w-- >0;)B.isOdd()&&B.iadd(x),B.iushrn(1);for(var k=0,H=1;!(R.words[0]&H)&&k<26;++k,H<<=1);if(k>0)for(R.iushrn(k);k-- >0;)E.isOdd()&&E.iadd(x),E.iushrn(1);m.cmp(R)>=0?(m.isub(R),B.isub(E)):(R.isub(m),E.isub(B))}var oe;return m.cmpn(1)===0?oe=B:oe=E,oe.cmpn(0)<0&&oe.iadd(v),oe},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var m=this.clone(),R=v.clone();m.negative=0,R.negative=0;for(var B=0;m.isEven()&&R.isEven();B++)m.iushrn(1),R.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;R.isEven();)R.iushrn(1);var E=m.cmp(R);if(E<0){var x=m;m=R,R=x}else if(E===0||R.cmpn(1)===0)break;m.isub(R)}while(!0);return R.iushln(B)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){n(typeof v=="number");var m=v%26,R=(v-m)/26,B=1<>>26,w&=67108863,this.words[x]=w}return E!==0&&(this.words[x]=E,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var m=v<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var R;if(this.length>1)R=1;else{m&&(v=-v),n(v<=67108863,"Number is too big");var B=this.words[0]|0;R=B===v?0:Bv.length)return 1;if(this.length=0;R--){var B=this.words[R]|0,E=v.words[R]|0;if(B!==E){BE&&(m=1);break}}return m},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new K(v)},s.prototype.toRed=function(v){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return n(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(v){return n(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var F={k256:null,p224:null,p192:null,p25519:null};function z(M,v){this.name=M,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},z.prototype.ireduce=function(v){var m=v,R;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),R=m.bitLength();while(R>this.n);var B=R0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},z.prototype.split=function(v,m){v.iushrn(this.n,0,m)},z.prototype.imulK=function(v){return v.imul(this.k)};function _(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(_,z),_.prototype.split=function(v,m){for(var R=4194303,B=Math.min(v.length,9),E=0;E>>22,x=w}x>>>=22,v.words[E-10]=x,x===0&&v.length>10?v.length-=10:v.length-=9},_.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var m=0,R=0;R>>=26,v.words[R]=E,m=B}return m!==0&&(v.words[v.length++]=m),v},s._prime=function(v){if(F[v])return F[v];var m;if(v==="k256")m=new _;else if(v==="p224")m=new $;else if(v==="p192")m=new ie;else if(v==="p25519")m=new ce;else throw new Error("Unknown prime "+v);return F[v]=m,m};function K(M){if(typeof M=="string"){var v=s._prime(M);this.m=v.p,this.prime=v}else n(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}K.prototype._verify1=function(v){n(v.negative===0,"red works only with positives"),n(v.red,"red works only with red numbers")},K.prototype._verify2=function(v,m){n((v.negative|m.negative)===0,"red works only with positives"),n(v.red&&v.red===m.red,"red works only with red numbers")},K.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(f(v,v.umod(this.m)._forceRed(this)),v)},K.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},K.prototype.add=function(v,m){this._verify2(v,m);var R=v.add(m);return R.cmp(this.m)>=0&&R.isub(this.m),R._forceRed(this)},K.prototype.iadd=function(v,m){this._verify2(v,m);var R=v.iadd(m);return R.cmp(this.m)>=0&&R.isub(this.m),R},K.prototype.sub=function(v,m){this._verify2(v,m);var R=v.sub(m);return R.cmpn(0)<0&&R.iadd(this.m),R._forceRed(this)},K.prototype.isub=function(v,m){this._verify2(v,m);var R=v.isub(m);return R.cmpn(0)<0&&R.iadd(this.m),R},K.prototype.shl=function(v,m){return this._verify1(v),this.imod(v.ushln(m))},K.prototype.imul=function(v,m){return this._verify2(v,m),this.imod(v.imul(m))},K.prototype.mul=function(v,m){return this._verify2(v,m),this.imod(v.mul(m))},K.prototype.isqr=function(v){return this.imul(v,v.clone())},K.prototype.sqr=function(v){return this.mul(v,v)},K.prototype.sqrt=function(v){if(v.isZero())return v.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var R=this.m.add(new s(1)).iushrn(2);return this.pow(v,R)}for(var B=this.m.subn(1),E=0;!B.isZero()&&B.andln(1)===0;)E++,B.iushrn(1);n(!B.isZero());var x=new s(1).toRed(this),w=x.redNeg(),T=this.m.subn(1).iushrn(1),k=this.m.bitLength();for(k=new s(2*k*k).toRed(this);this.pow(k,T).cmp(w)!==0;)k.redIAdd(w);for(var H=this.pow(k,B),oe=this.pow(v,B.addn(1).iushrn(1)),j=this.pow(v,B),X=E;j.cmp(x)!==0;){for(var G=j,Z=0;G.cmp(x)!==0;Z++)G=G.redSqr();n(Z=0;E--){for(var H=m.words[E],oe=k-1;oe>=0;oe--){var j=H>>oe&1;if(x!==B[0]&&(x=this.sqr(x)),j===0&&w===0){T=0;continue}w<<=1,w|=j,T++,!(T!==R&&(E!==0||oe!==0))&&(x=this.mul(x,B[w]),T=0,w=0)}k=26}return x},K.prototype.convertTo=function(v){var m=v.umod(this.m);return m===v?m.clone():m},K.prototype.convertFrom=function(v){var m=v.clone();return m.red=null,m},s.mont=function(v){return new P(v)};function P(M){K.call(this,M),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(P,K),P.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},P.prototype.convertFrom=function(v){var m=this.imod(v.mul(this.rinv));return m.red=null,m},P.prototype.imul=function(v,m){if(v.isZero()||m.isZero())return v.words[0]=0,v.length=1,v;var R=v.imul(m),B=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=R.isub(B).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},P.prototype.mul=function(v,m){if(v.isZero()||m.isZero())return new s(0)._forceRed(this);var R=v.mul(m),B=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=R.isub(B).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},P.prototype.invm=function(v){var m=this.imod(v._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,Si)})(EM);var t7e=EM.exports;const sr=_u(t7e);var r7e=sr.BN;function n7e(t){return new r7e(t,36).toString(16)}const i7e="strings/5.7.0",s7e=new En(i7e);var J5;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(J5||(J5={}));var _j;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(_j||(_j={}));function N9(t,e=J5.current){e!=J5.current&&(s7e.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 s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return vi(r)}const o7e=`Ethereum Signed Message: -`;function RX(t){return typeof t=="string"&&(t=N9(t)),xM(QSe([N9(o7e),N9(String(t.length)),t]))}const a7e="address/5.7.0",ab=new En(a7e);function Ij(t){Vl(t,20)||ab.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=vi(xM(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 c7e=9007199254740991;function l7e(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const CM={};for(let t=0;t<10;t++)CM[String(t)]=String(t);for(let t=0;t<26;t++)CM[String.fromCharCode(65+t)]=String(10+t);const Tj=Math.floor(l7e(c7e));function f7e(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>CM[n]).join("");for(;e.length>=Tj;){let n=e.substring(0,Tj);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 u7e(t){let e=null;if(typeof t!="string"&&ab.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Ij(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&ab.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)!==f7e(t)&&ab.throwArgumentError("bad icap checksum","address",t),e=n7e(t.substring(4));e.length<40;)e="0"+e;e=Ij("0x"+e)}else ab.throwArgumentError("invalid address","address",t);return e}function Rm(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var Mx={},Pr={},Yp=OX;function OX(t,e){if(!t)throw new Error(e||"Assertion failed")}OX.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var tI={exports:{}};typeof Object.create=="function"?tI.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:tI.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 cE=tI.exports,d7e=Yp,h7e=cE;Pr.inherits=h7e;function p7e(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function v7e(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++]=s&63|128):p7e(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Pr.htonl=DX;function y7e(t,e){for(var r="",n=0;n>>0}return s}Pr.join32=m7e;function b7e(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Pr.split32=b7e;function w7e(t,e){return t>>>e|t<<32-e}Pr.rotr32=w7e;function x7e(t,e){return t<>>32-e}Pr.rotl32=x7e;function E7e(t,e){return t+e>>>0}Pr.sum32=E7e;function C7e(t,e,r){return t+e+r>>>0}Pr.sum32_3=C7e;function A7e(t,e,r,n){return t+e+r+n>>>0}Pr.sum32_4=A7e;function S7e(t,e,r,n,i){return t+e+r+n+i>>>0}Pr.sum32_5=S7e;function _7e(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}Pr.sum64=_7e;function I7e(t,e,r,n){var i=e+n>>>0,s=(i>>0}Pr.sum64_hi=I7e;function T7e(t,e,r,n){var i=e+n;return i>>>0}Pr.sum64_lo=T7e;function P7e(t,e,r,n,i,s,o,a){var c=0,l=e;l=l+n>>>0,c+=l>>0,c+=l>>0,c+=l>>0}Pr.sum64_4_hi=P7e;function k7e(t,e,r,n,i,s,o,a){var c=e+n+s+a;return c>>>0}Pr.sum64_4_lo=k7e;function M7e(t,e,r,n,i,s,o,a,c,l){var f=0,u=e;u=u+n>>>0,f+=u>>0,f+=u>>0,f+=u>>0,f+=u>>0}Pr.sum64_5_hi=M7e;function R7e(t,e,r,n,i,s,o,a,c,l){var f=e+n+s+a+l;return f>>>0}Pr.sum64_5_lo=R7e;function O7e(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Pr.rotr64_hi=O7e;function D7e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pr.rotr64_lo=D7e;function N7e(t,e,r){return t>>>r}Pr.shr64_hi=N7e;function B7e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pr.shr64_lo=B7e;var Ry={},Pj=Pr,L7e=Yp;function lE(){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}Ry.BlockHash=lE;lE.prototype.update=function(e,r){if(e=Pj.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=Pj.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}sf.g0_256=q7e;function V7e(t){return zl(t,17)^zl(t,19)^t>>>10}sf.g1_256=V7e;var sy=Pr,z7e=Ry,H7e=sf,B9=sy.rotl32,Om=sy.sum32,G7e=sy.sum32_5,W7e=H7e.ft_1,UX=z7e.BlockHash,K7e=[1518500249,1859775393,2400959708,3395469782];function Xl(){if(!(this instanceof Xl))return new Xl;UX.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}sy.inherits(Xl,UX);var Y7e=Xl;Xl.blockSize=512;Xl.outSize=160;Xl.hmacStrength=80;Xl.padLength=64;Xl.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()),B_e(e.length<=this.blockSize);for(var r=e.length;r>8,p=f&255;u?c.push(u,p):c.push(p)}return c}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",c=0;c(p>>1)-1?b=(p>>1)-I:b=I,g.isubn(b)):b=0,u[y]=b,g.iushrn(1)}return u}r.getNAF=n;function i(c,l){var f=[[],[]];c=c.clone(),l=l.clone();for(var u=0,p=0,g;c.cmpn(-u)>0||l.cmpn(-p)>0;){var y=c.andln(3)+u&3,b=l.andln(3)+p&3;y===3&&(y=-1),b===3&&(b=-1);var I;y&1?(g=c.andln(7)+u&7,(g===3||g===5)&&b===2?I=-y:I=y):I=0,f[0].push(I);var C;b&1?(g=l.andln(7)+p&7,(g===3||g===5)&&y===2?C=-b:C=b):C=0,f[1].push(C),2*u===I+1&&(u=1-u),2*p===C+1&&(p=1-p),c.iushrn(1),l.iushrn(1)}return f}r.getJSF=i;function s(c,l,f){var u="_"+l;c.prototype[l]=function(){return this[u]!==void 0?this[u]:this[u]=f.call(this)}}r.cachedProperty=s;function o(c){return typeof c=="string"?r.toArray(c,"hex"):c}r.parseBytes=o;function a(c){return new sr(c,"hex","le")}r.intFromLE=a}),Z5=wa.getNAF,j_e=wa.getJSF,X5=wa.assert;function Oh(t,e){this.type=t,this.p=new sr(e.p,16),this.red=e.prime?sr.red(e.prime):sr.mont(this.p),this.zero=new sr(0).toRed(this.red),this.one=new sr(1).toRed(this.red),this.two=new sr(2).toRed(this.red),this.n=e.n&&new sr(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 Qp=Oh;Oh.prototype.point=function(){throw new Error("Not implemented")};Oh.prototype.validate=function(){throw new Error("Not implemented")};Oh.prototype._fixedNafMul=function(e,r){X5(e.precomputed);var n=e._getDoubles(),i=Z5(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),p=s;p>0;p--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];X5(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};Oh.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,p;for(f=0;f=1;f-=2){var y=f-1,b=f;if(o[y]!==1||o[b]!==1){c[y]=Z5(n[y],o[y],this._bitLength),c[b]=Z5(n[b],o[b],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[b].length,l);continue}var I=[r[y],null,null,r[b]];r[y].y.cmp(r[b].y)===0?(I[1]=r[y].add(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg())):r[y].y.cmp(r[b].y.redNeg())===0?(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].add(r[b].neg())):(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg()));var C=[-3,-1,-5,-7,0,7,5,1,3],S=j_e(n[y],n[b]);for(l=Math.max(S[0].length,l),c[y]=new Array(l),c[b]=new Array(l),u=0;u=0;f--){for(var _=0;f>=0;){var $=!0;for(u=0;u=0&&_++,F=F.dblp(_),f<0)break;for(u=0;u0?p=a[u][ie-1>>1]:ie<0&&(p=a[u][-ie-1>>1].neg()),p.type==="affine"?F=F.mixedAdd(p):F=F.add(p))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};cc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),p=p.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:p},{a:g,b:y}]};lc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),p=l.add(f).neg();return{k1:u,k2:p}};lc.prototype.pointFromX=function(e,r){e=new sr(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 s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};lc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};lc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};zi.prototype.isInfinity=function(){return this.inf};zi.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)};zi.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(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};zi.prototype.getX=function(){return this.x.fromRed()};zi.prototype.getY=function(){return this.y.fromRed()};zi.prototype.mul=function(e){return e=new sr(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)};zi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};zi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};zi.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)};zi.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(s){return s.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};zi.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 cs(t,e,r,n){Qp.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new sr(0)):(this.x=new sr(e,16),this.y=new sr(r,16),this.z=new sr(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}SM(cs,Qp.BasePoint);lc.prototype.jpoint=function(e,r,n){return new cs(this,e,r,n)};cs.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)};cs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};cs.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),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),p=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(p).redISub(p),y=l.redMul(p.redISub(g)).redISub(o.redMul(u)),b=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,b)};cs.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),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),p=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(p)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(p,g,y)};cs.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(s),this.x.cmp(n)===0)return!0}};cs.prototype.inspect=function(){return this.isInfinity()?"":""};cs.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var P3=Ny(function(t,e){var r=e;r.base=Qp,r.short=$_e,r.mont=null,r.edwards=null}),k3=Ny(function(t,e){var r=e,n=wa.assert;function i(a){a.type==="short"?this.curve=new P3.short(a):a.type==="edwards"?this.curve=new P3.edwards(a):this.curve=new P3.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,c){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(c);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("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:If.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("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:If.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("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:If.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("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:If.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"]}),s("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:If.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"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:If.sha256,gRed:!1,g:["9"]}),s("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:If.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("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:If.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ph(t){if(!(this instanceof ph))return new ph(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=Hc.toArray(t.entropy,t.entropyEnc||"hex"),r=Hc.toArray(t.nonce,t.nonceEnc||"hex"),n=Hc.toArray(t.pers,t.persEnc||"hex");AM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var ZX=ph;ph.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 s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};ph.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=Hc.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var q_e=wa.assert;function fE(t,e){if(t instanceof fE)return t;this._importDER(t,e)||(q_e(t.r&&t.s,"Signature without r or s"),this.r=new sr(t.r,16),this.s=new sr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var uE=fE;function V_e(){this.place=0}function j9(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,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function Oj(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)}fE.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=Oj(r),n=Oj(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];U9(i,r.length),i=i.concat(r),i.push(2),U9(i,n.length);var s=i.concat(n),o=[48];return U9(o,s.length),o=o.concat(s),wa.encode(o,e)};var z_e=function(){throw new Error("unsupported")},XX=wa.assert;function oc(t){if(!(this instanceof oc))return new oc(t);typeof t=="string"&&(XX(Object.prototype.hasOwnProperty.call(k3,t),"Unknown curve "+t),t=k3[t]),t instanceof k3.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 H_e=oc;oc.prototype.keyPair=function(e){return new _M(this,e)};oc.prototype.keyFromPrivate=function(e,r){return _M.fromPrivate(this,e,r)};oc.prototype.keyFromPublic=function(e,r){return _M.fromPublic(this,e,r)};oc.prototype.genKeyPair=function(e){e||(e={});for(var r=new ZX({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||z_e(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new sr(2));;){var s=new sr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};oc.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};oc.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 sr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new ZX({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new sr(1)),f=0;;f++){var u=i.k?i.k(f):new sr(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var p=this.g.mul(u);if(!p.isInfinity()){var g=p.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var b=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(b=b.umod(this.n),b.cmpn(0)!==0){var I=(p.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),I^=1),new uE({r:y,s:b,recoveryParam:I})}}}}}};oc.prototype.verify=function(e,r,n,i){e=this._truncateToN(new sr(e,16)),n=this.keyFromPublic(n,i),r=new uE(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),c=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};oc.prototype.recoverPubKey=function(t,e,r,n){XX((3&r)===r,"The recovery param is more than two bits"),e=new uE(e,n);var i=this.n,s=new sr(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),p=a.mul(f).umod(i);return this.g.mulAdd(u,o,p)};oc.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new uE(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var G_e=Ny(function(t,e){var r=e;r.version="6.5.4",r.utils=wa,r.rand=function(){throw new Error("unsupported")},r.curve=P3,r.curves=k3,r.ec=H_e,r.eddsa=null}),W_e=G_e.ec;const K_e="signing-key/5.7.0",sI=new En(K_e);let $9=null;function fd(){return $9||($9=new W_e("secp256k1")),$9}class Y_e{constructor(e){Rm(this,"curve","secp256k1"),Rm(this,"privateKey",ia(e)),ZSe(this.privateKey)!==32&&sI.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=fd().keyFromPrivate(vi(this.privateKey));Rm(this,"publicKey","0x"+r.getPublic(!1,"hex")),Rm(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),Rm(this,"_isSigningKey",!0)}_addPoint(e){const r=fd().keyFromPublic(vi(this.publicKey)),n=fd().keyFromPublic(vi(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=fd().keyFromPrivate(vi(this.privateKey)),n=vi(e);n.length!==32&&sI.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return MX({recoveryParam:i.recoveryParam,r:qv("0x"+i.r.toString(16),32),s:qv("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=fd().keyFromPrivate(vi(this.privateKey)),n=fd().keyFromPublic(vi(eee(e)));return qv("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function Q_e(t,e){const r=MX(e),n={r:vi(r.r),s:vi(r.s)};return"0x"+fd().recoverPubKey(vi(t),n,r.recoveryParam).encode("hex",!1)}function eee(t,e){const r=vi(t);return r.length===32?new Y_e(r).publicKey:r.length===33?"0x"+fd().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?ia(r):sI.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Dj;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Dj||(Dj={}));function J_e(t){const e=eee(t);return u7e(Sj(xM(Sj(e,1)),12))}function Z_e(t,e){return J_e(Q_e(vi(t),e))}var IM={},dE={},cr={},tee={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,c){var l=a>>>16&65535,f=a&65535,u=c>>>16&65535,p=c&65535;return f*p+(l*p+f*u<<16>>>0)|0}t.mul=Math.imul||e;function r(a,c){return a+c|0}t.add=r;function n(a,c){return a-c|0}t.sub=n;function i(a,c){return a<>>32-c}t.rotl=i;function s(a,c){return a<<32-c|a>>>c}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tee);Object.defineProperty(cr,"__esModule",{value:!0});var ree=tee;function X_e(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}cr.readInt16BE=X_e;function eIe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}cr.readUint16BE=eIe;function tIe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}cr.readInt16LE=tIe;function rIe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}cr.readUint16LE=rIe;function nee(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}cr.writeUint16BE=nee;cr.writeInt16BE=nee;function iee(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}cr.writeUint16LE=iee;cr.writeInt16LE=iee;function oI(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}cr.readInt32BE=oI;function aI(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}cr.readUint32BE=aI;function cI(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}cr.readInt32LE=cI;function lI(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}cr.readUint32LE=lI;function e4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}cr.writeUint32BE=e4;cr.writeInt32BE=e4;function t4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}cr.writeUint32LE=t4;cr.writeInt32LE=t4;function nIe(t,e){e===void 0&&(e=0);var r=oI(t,e),n=oI(t,e+4);return r*4294967296+n-(n>>31)*4294967296}cr.readInt64BE=nIe;function iIe(t,e){e===void 0&&(e=0);var r=aI(t,e),n=aI(t,e+4);return r*4294967296+n}cr.readUint64BE=iIe;function sIe(t,e){e===void 0&&(e=0);var r=cI(t,e),n=cI(t,e+4);return n*4294967296+r-(r>>31)*4294967296}cr.readInt64LE=sIe;function oIe(t,e){e===void 0&&(e=0);var r=lI(t,e),n=lI(t,e+4);return n*4294967296+r}cr.readUint64LE=oIe;function see(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),e4(t/4294967296>>>0,e,r),e4(t>>>0,e,r+4),e}cr.writeUint64BE=see;cr.writeInt64BE=see;function oee(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),t4(t>>>0,e,r),t4(t/4294967296>>>0,e,r+4),e}cr.writeUint64LE=oee;cr.writeInt64LE=oee;function aIe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}cr.readUintBE=aIe;function cIe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}cr.writeUintBE=lIe;function fIe(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!ree.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s>>16|m<<16,K=K+m|0,_^=K,_=_>>>20|_<<12,L=L+$|0,R^=L,R=R>>>16|R<<16,P=P+R|0,$^=P,$=$>>>20|$<<12,F=F+ie|0,B^=F,B=B>>>16|B<<16,M=M+B|0,ie^=M,ie=ie>>>20|ie<<12,z=z+ce|0,E^=z,E=E>>>16|E<<16,v=v+E|0,ce^=v,ce=ce>>>20|ce<<12,F=F+ie|0,B^=F,B=B>>>24|B<<8,M=M+B|0,ie^=M,ie=ie>>>25|ie<<7,z=z+ce|0,E^=z,E=E>>>24|E<<8,v=v+E|0,ce^=v,ce=ce>>>25|ce<<7,L=L+$|0,R^=L,R=R>>>24|R<<8,P=P+R|0,$^=P,$=$>>>25|$<<7,O=O+_|0,m^=O,m=m>>>24|m<<8,K=K+m|0,_^=K,_=_>>>25|_<<7,O=O+$|0,E^=O,E=E>>>16|E<<16,M=M+E|0,$^=M,$=$>>>20|$<<12,L=L+ie|0,m^=L,m=m>>>16|m<<16,v=v+m|0,ie^=v,ie=ie>>>20|ie<<12,F=F+ce|0,R^=F,R=R>>>16|R<<16,K=K+R|0,ce^=K,ce=ce>>>20|ce<<12,z=z+_|0,B^=z,B=B>>>16|B<<16,P=P+B|0,_^=P,_=_>>>20|_<<12,F=F+ce|0,R^=F,R=R>>>24|R<<8,K=K+R|0,ce^=K,ce=ce>>>25|ce<<7,z=z+_|0,B^=z,B=B>>>24|B<<8,P=P+B|0,_^=P,_=_>>>25|_<<7,L=L+ie|0,m^=L,m=m>>>24|m<<8,v=v+m|0,ie^=v,ie=ie>>>25|ie<<7,O=O+$|0,E^=O,E=E>>>24|E<<8,M=M+E|0,$^=M,$=$>>>25|$<<7;ms.writeUint32LE(O+n|0,t,0),ms.writeUint32LE(L+i|0,t,4),ms.writeUint32LE(F+s|0,t,8),ms.writeUint32LE(z+o|0,t,12),ms.writeUint32LE(_+a|0,t,16),ms.writeUint32LE($+c|0,t,20),ms.writeUint32LE(ie+l|0,t,24),ms.writeUint32LE(ce+f|0,t,28),ms.writeUint32LE(K+u|0,t,32),ms.writeUint32LE(P+p|0,t,36),ms.writeUint32LE(M+g|0,t,40),ms.writeUint32LE(v+y|0,t,44),ms.writeUint32LE(m+b|0,t,48),ms.writeUint32LE(R+I|0,t,52),ms.writeUint32LE(B+C|0,t,56),ms.writeUint32LE(E+S|0,t,60)}function aee(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var cee={},Dh={};Object.defineProperty(Dh,"__esModule",{value:!0});function AIe(t,e,r){return~(t-1)&e|t-1&r}Dh.select=AIe;function SIe(t,e){return(t|0)-(e|0)-1>>>31&1}Dh.lessOrEqual=SIe;function lee(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Dh.compare=lee;function _Ie(t,e){return t.length===0||e.length===0?!1:lee(t,e)!==0}Dh.equal=_Ie;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Dh,r=xa;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=a[0]|a[1]<<8;this._r[0]=c&8191;var l=a[2]|a[3]<<8;this._r[1]=(c>>>13|l<<3)&8191;var f=a[4]|a[5]<<8;this._r[2]=(l>>>10|f<<6)&7939;var u=a[6]|a[7]<<8;this._r[3]=(f>>>7|u<<9)&8191;var p=a[8]|a[9]<<8;this._r[4]=(u>>>4|p<<12)&255,this._r[5]=p>>>1&8190;var g=a[10]|a[11]<<8;this._r[6]=(p>>>14|g<<2)&8191;var y=a[12]|a[13]<<8;this._r[7]=(g>>>11|y<<5)&8065;var b=a[14]|a[15]<<8;this._r[8]=(y>>>8|b<<8)&8191,this._r[9]=b>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,c,l){for(var f=this._fin?0:2048,u=this._h[0],p=this._h[1],g=this._h[2],y=this._h[3],b=this._h[4],I=this._h[5],C=this._h[6],S=this._h[7],O=this._h[8],L=this._h[9],F=this._r[0],z=this._r[1],_=this._r[2],$=this._r[3],ie=this._r[4],ce=this._r[5],K=this._r[6],P=this._r[7],M=this._r[8],v=this._r[9];l>=16;){var m=a[c+0]|a[c+1]<<8;u+=m&8191;var R=a[c+2]|a[c+3]<<8;p+=(m>>>13|R<<3)&8191;var B=a[c+4]|a[c+5]<<8;g+=(R>>>10|B<<6)&8191;var E=a[c+6]|a[c+7]<<8;y+=(B>>>7|E<<9)&8191;var x=a[c+8]|a[c+9]<<8;b+=(E>>>4|x<<12)&8191,I+=x>>>1&8191;var w=a[c+10]|a[c+11]<<8;C+=(x>>>14|w<<2)&8191;var T=a[c+12]|a[c+13]<<8;S+=(w>>>11|T<<5)&8191;var k=a[c+14]|a[c+15]<<8;O+=(T>>>8|k<<8)&8191,L+=k>>>5|f;var H=0,oe=H;oe+=u*F,oe+=p*(5*v),oe+=g*(5*M),oe+=y*(5*P),oe+=b*(5*K),H=oe>>>13,oe&=8191,oe+=I*(5*ce),oe+=C*(5*ie),oe+=S*(5*$),oe+=O*(5*_),oe+=L*(5*z),H+=oe>>>13,oe&=8191;var j=H;j+=u*z,j+=p*F,j+=g*(5*v),j+=y*(5*M),j+=b*(5*P),H=j>>>13,j&=8191,j+=I*(5*K),j+=C*(5*ce),j+=S*(5*ie),j+=O*(5*$),j+=L*(5*_),H+=j>>>13,j&=8191;var X=H;X+=u*_,X+=p*z,X+=g*F,X+=y*(5*v),X+=b*(5*M),H=X>>>13,X&=8191,X+=I*(5*P),X+=C*(5*K),X+=S*(5*ce),X+=O*(5*ie),X+=L*(5*$),H+=X>>>13,X&=8191;var G=H;G+=u*$,G+=p*_,G+=g*z,G+=y*F,G+=b*(5*v),H=G>>>13,G&=8191,G+=I*(5*M),G+=C*(5*P),G+=S*(5*K),G+=O*(5*ce),G+=L*(5*ie),H+=G>>>13,G&=8191;var Z=H;Z+=u*ie,Z+=p*$,Z+=g*_,Z+=y*z,Z+=b*F,H=Z>>>13,Z&=8191,Z+=I*(5*v),Z+=C*(5*M),Z+=S*(5*P),Z+=O*(5*K),Z+=L*(5*ce),H+=Z>>>13,Z&=8191;var ee=H;ee+=u*ce,ee+=p*ie,ee+=g*$,ee+=y*_,ee+=b*z,H=ee>>>13,ee&=8191,ee+=I*F,ee+=C*(5*v),ee+=S*(5*M),ee+=O*(5*P),ee+=L*(5*K),H+=ee>>>13,ee&=8191;var N=H;N+=u*K,N+=p*ce,N+=g*ie,N+=y*$,N+=b*_,H=N>>>13,N&=8191,N+=I*z,N+=C*F,N+=S*(5*v),N+=O*(5*M),N+=L*(5*P),H+=N>>>13,N&=8191;var te=H;te+=u*P,te+=p*K,te+=g*ce,te+=y*ie,te+=b*$,H=te>>>13,te&=8191,te+=I*_,te+=C*z,te+=S*F,te+=O*(5*v),te+=L*(5*M),H+=te>>>13,te&=8191;var fe=H;fe+=u*M,fe+=p*P,fe+=g*K,fe+=y*ce,fe+=b*ie,H=fe>>>13,fe&=8191,fe+=I*$,fe+=C*_,fe+=S*z,fe+=O*F,fe+=L*(5*v),H+=fe>>>13,fe&=8191;var Ee=H;Ee+=u*v,Ee+=p*M,Ee+=g*P,Ee+=y*K,Ee+=b*ce,H=Ee>>>13,Ee&=8191,Ee+=I*ie,Ee+=C*$,Ee+=S*_,Ee+=O*z,Ee+=L*F,H+=Ee>>>13,Ee&=8191,H=(H<<2)+H|0,H=H+oe|0,oe=H&8191,H=H>>>13,j+=H,u=oe,p=j,g=X,y=G,b=Z,I=ee,C=N,S=te,O=fe,L=Ee,c+=16,l-=16}this._h[0]=u,this._h[1]=p,this._h[2]=g,this._h[3]=y,this._h[4]=b,this._h[5]=I,this._h[6]=C,this._h[7]=S,this._h[8]=O,this._h[9]=L},o.prototype.finish=function(a,c){c===void 0&&(c=0);var l=new Uint16Array(10),f,u,p,g;if(this._leftover){for(g=this._leftover,this._buffer[g++]=1;g<16;g++)this._buffer[g]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(f=this._h[1]>>>13,this._h[1]&=8191,g=2;g<10;g++)this._h[g]+=f,f=this._h[g]>>>13,this._h[g]&=8191;for(this._h[0]+=f*5,f=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=f,f=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=f,l[0]=this._h[0]+5,f=l[0]>>>13,l[0]&=8191,g=1;g<10;g++)l[g]=this._h[g]+f,f=l[g]>>>13,l[g]&=8191;for(l[9]-=8192,u=(f^1)-1,g=0;g<10;g++)l[g]&=u;for(u=~u,g=0;g<10;g++)this._h[g]=this._h[g]&u|l[g];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,p=this._h[0]+this._pad[0],this._h[0]=p&65535,g=1;g<8;g++)p=(this._h[g]+this._pad[g]|0)+(p>>>16)|0,this._h[g]=p&65535;return a[c+0]=this._h[0]>>>0,a[c+1]=this._h[0]>>>8,a[c+2]=this._h[1]>>>0,a[c+3]=this._h[1]>>>8,a[c+4]=this._h[2]>>>0,a[c+5]=this._h[2]>>>8,a[c+6]=this._h[3]>>>0,a[c+7]=this._h[3]>>>8,a[c+8]=this._h[4]>>>0,a[c+9]=this._h[4]>>>8,a[c+10]=this._h[5]>>>0,a[c+11]=this._h[5]>>>8,a[c+12]=this._h[6]>>>0,a[c+13]=this._h[6]>>>8,a[c+14]=this._h[7]>>>0,a[c+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var c=0,l=a.length,f;if(this._leftover){f=16-this._leftover,f>l&&(f=l);for(var u=0;u=16&&(f=l-l%16,this._blocks(a,c,f),c+=f,l-=f),l){for(var u=0;u16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var g=new Uint8Array(16);g.set(l,g.length-l.length);var y=new Uint8Array(32);e.stream(this._key,g,y,4);var b=f.length+this.tagLength,I;if(p){if(p.length!==b)throw new Error("ChaCha20Poly1305: incorrect destination length");I=p}else I=new Uint8Array(b);return e.streamXOR(this._key,g,f,I,4),this._authenticate(I.subarray(I.length-this.tagLength,I.length),y,I.subarray(0,I.length-this.tagLength),u),n.wipe(g),I},c.prototype.open=function(l,f,u,p){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(f.length0&&g.update(o.subarray(p.length%16))),g.update(u),u.length%16>0&&g.update(o.subarray(u.length%16));var y=new Uint8Array(8);p&&i.writeUint64LE(p.length,y),g.update(y),i.writeUint64LE(u.length,y),g.update(y);for(var b=g.digest(),I=0;Ithis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n256)throw new Error("randomString charset is too long");let p="";const g=f.length,y=256-256%g;for(;l>0;){const b=i(Math.ceil(l*256/y),u);for(let I=0;I0;I++){const C=b[I];C0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._temp,this._state,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,p=l<<3,g=l%64<56?64:128;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.state),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,c,l,f,u){for(;u>=64;){for(var p=c[0],g=c[1],y=c[2],b=c[3],I=c[4],C=c[5],S=c[6],O=c[7],L=0;L<16;L++){var F=f+L*4;a[L]=e.readUint32BE(l,F)}for(var L=16;L<64;L++){var z=a[L-2],_=(z>>>17|z<<15)^(z>>>19|z<<13)^z>>>10;z=a[L-15];var $=(z>>>7|z<<25)^(z>>>18|z<<14)^z>>>3;a[L]=(_+a[L-7]|0)+($+a[L-16]|0)}for(var L=0;L<64;L++){var _=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&C^~I&S)|0)+(O+(i[L]+a[L]|0)|0)|0,$=((p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10))+(p&g^p&y^g&y)|0;O=S,S=C,C=I,I=b+_|0,b=y,y=g,g=p,p=_+$|0}c[0]+=p,c[1]+=g,c[2]+=y,c[3]+=b,c[4]+=I,c[5]+=C,c[6]+=S,c[7]+=O,f+=64,u-=64}return f}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(Ox);var PM={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Nh,r=xa;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(L){const F=new Float64Array(16);if(L)for(let z=0;z>16&1),z[ce-1]&=65535;z[15]=_[15]-32767-(z[14]>>16&1);const ie=z[15]>>16&1;z[14]&=65535,a(_,z,1-ie)}for(let $=0;$<16;$++)L[2*$]=_[$]&255,L[2*$+1]=_[$]>>8}function l(L,F){for(let z=0;z<16;z++)L[z]=F[2*z]+(F[2*z+1]<<8);L[15]&=32767}function f(L,F,z){for(let _=0;_<16;_++)L[_]=F[_]+z[_]}function u(L,F,z){for(let _=0;_<16;_++)L[_]=F[_]-z[_]}function p(L,F,z){let _,$,ie=0,ce=0,K=0,P=0,M=0,v=0,m=0,R=0,B=0,E=0,x=0,w=0,T=0,k=0,H=0,oe=0,j=0,X=0,G=0,Z=0,ee=0,N=0,te=0,fe=0,Ee=0,_e=0,Re=0,Te=0,De=0,ze=0,et=0,Je=z[0],ke=z[1],Ne=z[2],tt=z[3],Ze=z[4],st=z[5],nt=z[6],We=z[7],lt=z[8],vt=z[9],Ke=z[10],gt=z[11],wt=z[12],rt=z[13],It=z[14],At=z[15];_=F[0],ie+=_*Je,ce+=_*ke,K+=_*Ne,P+=_*tt,M+=_*Ze,v+=_*st,m+=_*nt,R+=_*We,B+=_*lt,E+=_*vt,x+=_*Ke,w+=_*gt,T+=_*wt,k+=_*rt,H+=_*It,oe+=_*At,_=F[1],ce+=_*Je,K+=_*ke,P+=_*Ne,M+=_*tt,v+=_*Ze,m+=_*st,R+=_*nt,B+=_*We,E+=_*lt,x+=_*vt,w+=_*Ke,T+=_*gt,k+=_*wt,H+=_*rt,oe+=_*It,j+=_*At,_=F[2],K+=_*Je,P+=_*ke,M+=_*Ne,v+=_*tt,m+=_*Ze,R+=_*st,B+=_*nt,E+=_*We,x+=_*lt,w+=_*vt,T+=_*Ke,k+=_*gt,H+=_*wt,oe+=_*rt,j+=_*It,X+=_*At,_=F[3],P+=_*Je,M+=_*ke,v+=_*Ne,m+=_*tt,R+=_*Ze,B+=_*st,E+=_*nt,x+=_*We,w+=_*lt,T+=_*vt,k+=_*Ke,H+=_*gt,oe+=_*wt,j+=_*rt,X+=_*It,G+=_*At,_=F[4],M+=_*Je,v+=_*ke,m+=_*Ne,R+=_*tt,B+=_*Ze,E+=_*st,x+=_*nt,w+=_*We,T+=_*lt,k+=_*vt,H+=_*Ke,oe+=_*gt,j+=_*wt,X+=_*rt,G+=_*It,Z+=_*At,_=F[5],v+=_*Je,m+=_*ke,R+=_*Ne,B+=_*tt,E+=_*Ze,x+=_*st,w+=_*nt,T+=_*We,k+=_*lt,H+=_*vt,oe+=_*Ke,j+=_*gt,X+=_*wt,G+=_*rt,Z+=_*It,ee+=_*At,_=F[6],m+=_*Je,R+=_*ke,B+=_*Ne,E+=_*tt,x+=_*Ze,w+=_*st,T+=_*nt,k+=_*We,H+=_*lt,oe+=_*vt,j+=_*Ke,X+=_*gt,G+=_*wt,Z+=_*rt,ee+=_*It,N+=_*At,_=F[7],R+=_*Je,B+=_*ke,E+=_*Ne,x+=_*tt,w+=_*Ze,T+=_*st,k+=_*nt,H+=_*We,oe+=_*lt,j+=_*vt,X+=_*Ke,G+=_*gt,Z+=_*wt,ee+=_*rt,N+=_*It,te+=_*At,_=F[8],B+=_*Je,E+=_*ke,x+=_*Ne,w+=_*tt,T+=_*Ze,k+=_*st,H+=_*nt,oe+=_*We,j+=_*lt,X+=_*vt,G+=_*Ke,Z+=_*gt,ee+=_*wt,N+=_*rt,te+=_*It,fe+=_*At,_=F[9],E+=_*Je,x+=_*ke,w+=_*Ne,T+=_*tt,k+=_*Ze,H+=_*st,oe+=_*nt,j+=_*We,X+=_*lt,G+=_*vt,Z+=_*Ke,ee+=_*gt,N+=_*wt,te+=_*rt,fe+=_*It,Ee+=_*At,_=F[10],x+=_*Je,w+=_*ke,T+=_*Ne,k+=_*tt,H+=_*Ze,oe+=_*st,j+=_*nt,X+=_*We,G+=_*lt,Z+=_*vt,ee+=_*Ke,N+=_*gt,te+=_*wt,fe+=_*rt,Ee+=_*It,_e+=_*At,_=F[11],w+=_*Je,T+=_*ke,k+=_*Ne,H+=_*tt,oe+=_*Ze,j+=_*st,X+=_*nt,G+=_*We,Z+=_*lt,ee+=_*vt,N+=_*Ke,te+=_*gt,fe+=_*wt,Ee+=_*rt,_e+=_*It,Re+=_*At,_=F[12],T+=_*Je,k+=_*ke,H+=_*Ne,oe+=_*tt,j+=_*Ze,X+=_*st,G+=_*nt,Z+=_*We,ee+=_*lt,N+=_*vt,te+=_*Ke,fe+=_*gt,Ee+=_*wt,_e+=_*rt,Re+=_*It,Te+=_*At,_=F[13],k+=_*Je,H+=_*ke,oe+=_*Ne,j+=_*tt,X+=_*Ze,G+=_*st,Z+=_*nt,ee+=_*We,N+=_*lt,te+=_*vt,fe+=_*Ke,Ee+=_*gt,_e+=_*wt,Re+=_*rt,Te+=_*It,De+=_*At,_=F[14],H+=_*Je,oe+=_*ke,j+=_*Ne,X+=_*tt,G+=_*Ze,Z+=_*st,ee+=_*nt,N+=_*We,te+=_*lt,fe+=_*vt,Ee+=_*Ke,_e+=_*gt,Re+=_*wt,Te+=_*rt,De+=_*It,ze+=_*At,_=F[15],oe+=_*Je,j+=_*ke,X+=_*Ne,G+=_*tt,Z+=_*Ze,ee+=_*st,N+=_*nt,te+=_*We,fe+=_*lt,Ee+=_*vt,_e+=_*Ke,Re+=_*gt,Te+=_*wt,De+=_*rt,ze+=_*It,et+=_*At,ie+=38*j,ce+=38*X,K+=38*G,P+=38*Z,M+=38*ee,v+=38*N,m+=38*te,R+=38*fe,B+=38*Ee,E+=38*_e,x+=38*Re,w+=38*Te,T+=38*De,k+=38*ze,H+=38*et,$=1,_=ie+$+65535,$=Math.floor(_/65536),ie=_-$*65536,_=ce+$+65535,$=Math.floor(_/65536),ce=_-$*65536,_=K+$+65535,$=Math.floor(_/65536),K=_-$*65536,_=P+$+65535,$=Math.floor(_/65536),P=_-$*65536,_=M+$+65535,$=Math.floor(_/65536),M=_-$*65536,_=v+$+65535,$=Math.floor(_/65536),v=_-$*65536,_=m+$+65535,$=Math.floor(_/65536),m=_-$*65536,_=R+$+65535,$=Math.floor(_/65536),R=_-$*65536,_=B+$+65535,$=Math.floor(_/65536),B=_-$*65536,_=E+$+65535,$=Math.floor(_/65536),E=_-$*65536,_=x+$+65535,$=Math.floor(_/65536),x=_-$*65536,_=w+$+65535,$=Math.floor(_/65536),w=_-$*65536,_=T+$+65535,$=Math.floor(_/65536),T=_-$*65536,_=k+$+65535,$=Math.floor(_/65536),k=_-$*65536,_=H+$+65535,$=Math.floor(_/65536),H=_-$*65536,_=oe+$+65535,$=Math.floor(_/65536),oe=_-$*65536,ie+=$-1+37*($-1),$=1,_=ie+$+65535,$=Math.floor(_/65536),ie=_-$*65536,_=ce+$+65535,$=Math.floor(_/65536),ce=_-$*65536,_=K+$+65535,$=Math.floor(_/65536),K=_-$*65536,_=P+$+65535,$=Math.floor(_/65536),P=_-$*65536,_=M+$+65535,$=Math.floor(_/65536),M=_-$*65536,_=v+$+65535,$=Math.floor(_/65536),v=_-$*65536,_=m+$+65535,$=Math.floor(_/65536),m=_-$*65536,_=R+$+65535,$=Math.floor(_/65536),R=_-$*65536,_=B+$+65535,$=Math.floor(_/65536),B=_-$*65536,_=E+$+65535,$=Math.floor(_/65536),E=_-$*65536,_=x+$+65535,$=Math.floor(_/65536),x=_-$*65536,_=w+$+65535,$=Math.floor(_/65536),w=_-$*65536,_=T+$+65535,$=Math.floor(_/65536),T=_-$*65536,_=k+$+65535,$=Math.floor(_/65536),k=_-$*65536,_=H+$+65535,$=Math.floor(_/65536),H=_-$*65536,_=oe+$+65535,$=Math.floor(_/65536),oe=_-$*65536,ie+=$-1+37*($-1),L[0]=ie,L[1]=ce,L[2]=K,L[3]=P,L[4]=M,L[5]=v,L[6]=m,L[7]=R,L[8]=B,L[9]=E,L[10]=x,L[11]=w,L[12]=T,L[13]=k,L[14]=H,L[15]=oe}function g(L,F){p(L,F,F)}function y(L,F){const z=n();for(let _=0;_<16;_++)z[_]=F[_];for(let _=253;_>=0;_--)g(z,z),_!==2&&_!==4&&p(z,z,F);for(let _=0;_<16;_++)L[_]=z[_]}function b(L,F){const z=new Uint8Array(32),_=new Float64Array(80),$=n(),ie=n(),ce=n(),K=n(),P=n(),M=n();for(let B=0;B<31;B++)z[B]=L[B];z[31]=L[31]&127|64,z[0]&=248,l(_,F);for(let B=0;B<16;B++)ie[B]=_[B];$[0]=K[0]=1;for(let B=254;B>=0;--B){const E=z[B>>>3]>>>(B&7)&1;a($,ie,E),a(ce,K,E),f(P,$,ce),u($,$,ce),f(ce,ie,K),u(ie,ie,K),g(K,P),g(M,$),p($,ce,$),p(ce,ie,P),f(P,$,ce),u($,$,ce),g(ie,$),u(ce,K,M),p($,ce,s),f($,$,K),p(ce,ce,$),p($,K,M),p(K,ie,_),g(ie,P),a($,ie,E),a(ce,K,E)}for(let B=0;B<16;B++)_[B+16]=$[B],_[B+32]=ce[B],_[B+48]=ie[B],_[B+64]=K[B];const v=_.subarray(32),m=_.subarray(16);y(v,v),p(m,m,v);const R=new Uint8Array(32);return c(R,m),R}t.scalarMult=b;function I(L){return b(L,i)}t.scalarMultBase=I;function C(L){if(L.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const F=new Uint8Array(L);return{publicKey:I(F),secretKey:F}}t.generateKeyPairFromSeed=C;function S(L){const F=(0,e.randomBytes)(32,L),z=C(F);return(0,r.wipe)(F),z}t.generateKeyPair=S;function O(L,F,z=!1){if(L.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(F.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=b(L,F);if(z){let $=0;for(let ie=0;ie<_.length;ie++)$|=_[ie];if($===0)throw new Error("X25519: invalid shared key")}return _}t.sharedKey=O})(PM);function dee(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function M3(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=dee(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function UIe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(O);C!==S;){for(var F=y[C],z=0,_=O-1;(F!==0||z>>0,L[_]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");I=z,C++}for(var $=O-I;$!==O&&L[$]===0;)$++;for(var ie=c.repeat(b);$>>0,O=new Uint8Array(S);y[b];){var L=r[y.charCodeAt(b)];if(L===255)return;for(var F=0,z=S-1;(L!==0||F>>0,O[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");C=F,b++}if(y[b]!==" "){for(var _=S-C;_!==S&&O[_]===0;)_++;for(var $=new Uint8Array(I+(S-_)),ie=I;_!==S;)$[ie++]=O[_++];return $}}}function g(y){var b=p(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:p,decode:g}}var $Ie=UIe,qIe=$Ie;const VIe=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},zIe=t=>new TextEncoder().encode(t),HIe=t=>new TextDecoder().decode(t);class GIe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class WIe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hee(this,e)}}class KIe{constructor(e){this.decoders=e}or(e){return hee(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hee=(t,e)=>new KIe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class YIe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new GIe(e,r,n),this.decoder=new WIe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gE=({name:t,prefix:e,encode:r,decode:n})=>new YIe(t,e,r,n),Dx=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=qIe(r,e);return gE({prefix:t,name:e,encode:n,decode:s=>VIe(i(s))})},QIe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},JIe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gE({prefix:e,name:t,encode(i){return JIe(i,n,r)},decode(i){return QIe(i,n,r,t)}}),ZIe=gE({prefix:"\0",name:"identity",encode:t=>HIe(t),decode:t=>zIe(t)}),XIe=Object.freeze(Object.defineProperty({__proto__:null,identity:ZIe},Symbol.toStringTag,{value:"Module"})),eTe=ls({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),tTe=Object.freeze(Object.defineProperty({__proto__:null,base2:eTe},Symbol.toStringTag,{value:"Module"})),rTe=ls({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),nTe=Object.freeze(Object.defineProperty({__proto__:null,base8:rTe},Symbol.toStringTag,{value:"Module"})),iTe=Dx({prefix:"9",name:"base10",alphabet:"0123456789"}),sTe=Object.freeze(Object.defineProperty({__proto__:null,base10:iTe},Symbol.toStringTag,{value:"Module"})),oTe=ls({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),aTe=ls({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),cTe=Object.freeze(Object.defineProperty({__proto__:null,base16:oTe,base16upper:aTe},Symbol.toStringTag,{value:"Module"})),lTe=ls({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),fTe=ls({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uTe=ls({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dTe=ls({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),hTe=ls({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),pTe=ls({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vTe=ls({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gTe=ls({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),yTe=ls({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),mTe=Object.freeze(Object.defineProperty({__proto__:null,base32:lTe,base32hex:hTe,base32hexpad:vTe,base32hexpadupper:gTe,base32hexupper:pTe,base32pad:uTe,base32padupper:dTe,base32upper:fTe,base32z:yTe},Symbol.toStringTag,{value:"Module"})),bTe=Dx({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wTe=Dx({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),xTe=Object.freeze(Object.defineProperty({__proto__:null,base36:bTe,base36upper:wTe},Symbol.toStringTag,{value:"Module"})),ETe=Dx({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),CTe=Dx({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ATe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:ETe,base58flickr:CTe},Symbol.toStringTag,{value:"Module"})),STe=ls({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_Te=ls({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ITe=ls({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),TTe=ls({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),PTe=Object.freeze(Object.defineProperty({__proto__:null,base64:STe,base64pad:_Te,base64url:ITe,base64urlpad:TTe},Symbol.toStringTag,{value:"Module"})),pee=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),kTe=pee.reduce((t,e,r)=>(t[r]=e,t),[]),MTe=pee.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function RTe(t){return t.reduce((e,r)=>(e+=kTe[r],e),"")}function OTe(t){const e=[];for(const r of t){const n=MTe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const DTe=gE({prefix:"🚀",name:"base256emoji",encode:RTe,decode:OTe}),NTe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:DTe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const Fj={...XIe,...tTe,...nTe,...sTe,...cTe,...mTe,...xTe,...ATe,...PTe,...NTe};function vee(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const jj=vee("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),q9=vee("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=dee(t.length);for(let r=0;r",HTe="MIT",GTe={url:"https://github.com/indutny/elliptic/issues"},WTe="https://github.com/indutny/elliptic",KTe={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},YTe={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},QTe={name:BTe,version:LTe,description:FTe,main:jTe,files:UTe,scripts:$Te,repository:qTe,keywords:VTe,author:zTe,license:HTe,bugs:GTe,homepage:WTe,devDependencies:KTe,dependencies:YTe};var Ea={},kM={exports:{}};kM.exports;(function(t){(function(e,r){function n(K,P){if(!K)throw new Error(P||"Assertion failed")}function i(K,P){K.super_=P;var M=function(){};M.prototype=P.prototype,K.prototype=new M,K.prototype.constructor=K}function s(K,P,M){if(s.isBN(K))return K;this.negative=0,this.words=null,this.length=0,this.red=null,K!==null&&((P==="le"||P==="be")&&(M=P,P=10),this._init(K||0,P||10,M||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=aE.Buffer}catch{}s.isBN=function(P){return P instanceof s?!0:P!==null&&typeof P=="object"&&P.constructor.wordSize===s.wordSize&&Array.isArray(P.words)},s.max=function(P,M){return P.cmp(M)>0?P:M},s.min=function(P,M){return P.cmp(M)<0?P:M},s.prototype._init=function(P,M,v){if(typeof P=="number")return this._initNumber(P,M,v);if(typeof P=="object")return this._initArray(P,M,v);M==="hex"&&(M=16),n(M===(M|0)&&M>=2&&M<=36),P=P.toString().replace(/\s+/g,"");var m=0;P[0]==="-"&&(m++,this.negative=1),m=0;m-=3)B=P[m]|P[m-1]<<8|P[m-2]<<16,this.words[R]|=B<>>26-E&67108863,E+=24,E>=26&&(E-=26,R++);else if(v==="le")for(m=0,R=0;m>>26-E&67108863,E+=24,E>=26&&(E-=26,R++);return this.strip()};function a(K,P){var M=K.charCodeAt(P);return M>=65&&M<=70?M-55:M>=97&&M<=102?M-87:M-48&15}function c(K,P,M){var v=a(K,M);return M-1>=P&&(v|=a(K,M-1)<<4),v}s.prototype._parseHex=function(P,M,v){this.length=Math.ceil((P.length-M)/6),this.words=new Array(this.length);for(var m=0;m=M;m-=2)E=c(P,M,m)<=18?(R-=18,B+=1,this.words[B]|=E>>>26):R+=8;else{var x=P.length-M;for(m=x%2===0?M+1:M;m=18?(R-=18,B+=1,this.words[B]|=E>>>26):R+=8}this.strip()};function l(K,P,M,v){for(var m=0,R=Math.min(K.length,M),B=P;B=49?m+=E-49+10:E>=17?m+=E-17+10:m+=E}return m}s.prototype._parseBase=function(P,M,v){this.words=[0],this.length=1;for(var m=0,R=1;R<=67108863;R*=M)m++;m--,R=R/M|0;for(var B=P.length-v,E=B%m,x=Math.min(B,B-E)+v,w=0,T=v;T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var f=["","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"],u=[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];s.prototype.toString=function(P,M){P=P||10,M=M|0||1;var v;if(P===16||P==="hex"){v="";for(var m=0,R=0,B=0;B>>24-m&16777215,R!==0||B!==this.length-1?v=f[6-x.length]+x+v:v=x+v,m+=2,m>=26&&(m-=26,B--)}for(R!==0&&(v=R.toString(16)+v);v.length%M!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(P===(P|0)&&P>=2&&P<=36){var w=u[P],T=p[P];v="";var k=this.clone();for(k.negative=0;!k.isZero();){var H=k.modn(T).toString(P);k=k.idivn(T),k.isZero()?v=H+v:v=f[w-H.length]+H+v}for(this.isZero()&&(v="0"+v);v.length%M!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var P=this.words[0];return this.length===2?P+=this.words[1]*67108864:this.length===3&&this.words[2]===1?P+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-P:P},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(P,M){return n(typeof o<"u"),this.toArrayLike(o,P,M)},s.prototype.toArray=function(P,M){return this.toArrayLike(Array,P,M)},s.prototype.toArrayLike=function(P,M,v){var m=this.byteLength(),R=v||Math.max(1,m);n(m<=R,"byte array longer than desired length"),n(R>0,"Requested array length <= 0"),this.strip();var B=M==="le",E=new P(R),x,w,T=this.clone();if(B){for(w=0;!T.isZero();w++)x=T.andln(255),T.iushrn(8),E[w]=x;for(;w=4096&&(v+=13,M>>>=13),M>=64&&(v+=7,M>>>=7),M>=8&&(v+=4,M>>>=4),M>=2&&(v+=2,M>>>=2),v+M},s.prototype._zeroBits=function(P){if(P===0)return 26;var M=P,v=0;return M&8191||(v+=13,M>>>=13),M&127||(v+=7,M>>>=7),M&15||(v+=4,M>>>=4),M&3||(v+=2,M>>>=2),M&1||v++,v},s.prototype.bitLength=function(){var P=this.words[this.length-1],M=this._countBits(P);return(this.length-1)*26+M};function g(K){for(var P=new Array(K.bitLength()),M=0;M>>m}return P}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var P=0,M=0;MP.length?this.clone().ior(P):P.clone().ior(this)},s.prototype.uor=function(P){return this.length>P.length?this.clone().iuor(P):P.clone().iuor(this)},s.prototype.iuand=function(P){var M;this.length>P.length?M=P:M=this;for(var v=0;vP.length?this.clone().iand(P):P.clone().iand(this)},s.prototype.uand=function(P){return this.length>P.length?this.clone().iuand(P):P.clone().iuand(this)},s.prototype.iuxor=function(P){var M,v;this.length>P.length?(M=this,v=P):(M=P,v=this);for(var m=0;mP.length?this.clone().ixor(P):P.clone().ixor(this)},s.prototype.uxor=function(P){return this.length>P.length?this.clone().iuxor(P):P.clone().iuxor(this)},s.prototype.inotn=function(P){n(typeof P=="number"&&P>=0);var M=Math.ceil(P/26)|0,v=P%26;this._expand(M),v>0&&M--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-v),this.strip()},s.prototype.notn=function(P){return this.clone().inotn(P)},s.prototype.setn=function(P,M){n(typeof P=="number"&&P>=0);var v=P/26|0,m=P%26;return this._expand(v+1),M?this.words[v]=this.words[v]|1<P.length?(v=this,m=P):(v=P,m=this);for(var R=0,B=0;B>>26;for(;R!==0&&B>>26;if(this.length=v.length,R!==0)this.words[this.length]=R,this.length++;else if(v!==this)for(;BP.length?this.clone().iadd(P):P.clone().iadd(this)},s.prototype.isub=function(P){if(P.negative!==0){P.negative=0;var M=this.iadd(P);return P.negative=1,M._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(P),this.negative=1,this._normSign();var v=this.cmp(P);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,R;v>0?(m=this,R=P):(m=P,R=this);for(var B=0,E=0;E>26,this.words[E]=M&67108863;for(;B!==0&&E>26,this.words[E]=M&67108863;if(B===0&&E>>26,k=x&67108863,H=Math.min(w,P.length-1),oe=Math.max(0,w-K.length+1);oe<=H;oe++){var j=w-oe|0;m=K.words[j]|0,R=P.words[oe]|0,B=m*R+k,T+=B/67108864|0,k=B&67108863}M.words[w]=k|0,x=T|0}return x!==0?M.words[w]=x|0:M.length--,M.strip()}var b=function(P,M,v){var m=P.words,R=M.words,B=v.words,E=0,x,w,T,k=m[0]|0,H=k&8191,oe=k>>>13,j=m[1]|0,X=j&8191,G=j>>>13,Z=m[2]|0,ee=Z&8191,N=Z>>>13,te=m[3]|0,fe=te&8191,Ee=te>>>13,_e=m[4]|0,Re=_e&8191,Te=_e>>>13,De=m[5]|0,ze=De&8191,et=De>>>13,Je=m[6]|0,ke=Je&8191,Ne=Je>>>13,tt=m[7]|0,Ze=tt&8191,st=tt>>>13,nt=m[8]|0,We=nt&8191,lt=nt>>>13,vt=m[9]|0,Ke=vt&8191,gt=vt>>>13,wt=R[0]|0,rt=wt&8191,It=wt>>>13,At=R[1]|0,Tt=At&8191,Xt=At>>>13,lr=R[2]|0,xt=lr&8191,ar=lr>>>13,rr=R[3]|0,kt=rr&8191,Dt=rr>>>13,Nt=R[4]|0,dt=Nt&8191,Lt=Nt>>>13,Mt=R[5]|0,ut=Mt&8191,Vt=Mt>>>13,zt=R[6]|0,ht=zt&8191,Et=zt>>>13,Bt=R[7]|0,He=Bt&8191,$t=Bt>>>13,Ct=R[8]|0,ct=Ct&8191,Ht=Ct>>>13,Rr=R[9]|0,Ut=Rr&8191,Sr=Rr>>>13;v.negative=P.negative^M.negative,v.length=19,x=Math.imul(H,rt),w=Math.imul(H,It),w=w+Math.imul(oe,rt)|0,T=Math.imul(oe,It);var er=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(er>>>26)|0,er&=67108863,x=Math.imul(X,rt),w=Math.imul(X,It),w=w+Math.imul(G,rt)|0,T=Math.imul(G,It),x=x+Math.imul(H,Tt)|0,w=w+Math.imul(H,Xt)|0,w=w+Math.imul(oe,Tt)|0,T=T+Math.imul(oe,Xt)|0;var kr=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(kr>>>26)|0,kr&=67108863,x=Math.imul(ee,rt),w=Math.imul(ee,It),w=w+Math.imul(N,rt)|0,T=Math.imul(N,It),x=x+Math.imul(X,Tt)|0,w=w+Math.imul(X,Xt)|0,w=w+Math.imul(G,Tt)|0,T=T+Math.imul(G,Xt)|0,x=x+Math.imul(H,xt)|0,w=w+Math.imul(H,ar)|0,w=w+Math.imul(oe,xt)|0,T=T+Math.imul(oe,ar)|0;var bi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(bi>>>26)|0,bi&=67108863,x=Math.imul(fe,rt),w=Math.imul(fe,It),w=w+Math.imul(Ee,rt)|0,T=Math.imul(Ee,It),x=x+Math.imul(ee,Tt)|0,w=w+Math.imul(ee,Xt)|0,w=w+Math.imul(N,Tt)|0,T=T+Math.imul(N,Xt)|0,x=x+Math.imul(X,xt)|0,w=w+Math.imul(X,ar)|0,w=w+Math.imul(G,xt)|0,T=T+Math.imul(G,ar)|0,x=x+Math.imul(H,kt)|0,w=w+Math.imul(H,Dt)|0,w=w+Math.imul(oe,kt)|0,T=T+Math.imul(oe,Dt)|0;var wi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(wi>>>26)|0,wi&=67108863,x=Math.imul(Re,rt),w=Math.imul(Re,It),w=w+Math.imul(Te,rt)|0,T=Math.imul(Te,It),x=x+Math.imul(fe,Tt)|0,w=w+Math.imul(fe,Xt)|0,w=w+Math.imul(Ee,Tt)|0,T=T+Math.imul(Ee,Xt)|0,x=x+Math.imul(ee,xt)|0,w=w+Math.imul(ee,ar)|0,w=w+Math.imul(N,xt)|0,T=T+Math.imul(N,ar)|0,x=x+Math.imul(X,kt)|0,w=w+Math.imul(X,Dt)|0,w=w+Math.imul(G,kt)|0,T=T+Math.imul(G,Dt)|0,x=x+Math.imul(H,dt)|0,w=w+Math.imul(H,Lt)|0,w=w+Math.imul(oe,dt)|0,T=T+Math.imul(oe,Lt)|0;var xi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(xi>>>26)|0,xi&=67108863,x=Math.imul(ze,rt),w=Math.imul(ze,It),w=w+Math.imul(et,rt)|0,T=Math.imul(et,It),x=x+Math.imul(Re,Tt)|0,w=w+Math.imul(Re,Xt)|0,w=w+Math.imul(Te,Tt)|0,T=T+Math.imul(Te,Xt)|0,x=x+Math.imul(fe,xt)|0,w=w+Math.imul(fe,ar)|0,w=w+Math.imul(Ee,xt)|0,T=T+Math.imul(Ee,ar)|0,x=x+Math.imul(ee,kt)|0,w=w+Math.imul(ee,Dt)|0,w=w+Math.imul(N,kt)|0,T=T+Math.imul(N,Dt)|0,x=x+Math.imul(X,dt)|0,w=w+Math.imul(X,Lt)|0,w=w+Math.imul(G,dt)|0,T=T+Math.imul(G,Lt)|0,x=x+Math.imul(H,ut)|0,w=w+Math.imul(H,Vt)|0,w=w+Math.imul(oe,ut)|0,T=T+Math.imul(oe,Vt)|0;var Ti=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,x=Math.imul(ke,rt),w=Math.imul(ke,It),w=w+Math.imul(Ne,rt)|0,T=Math.imul(Ne,It),x=x+Math.imul(ze,Tt)|0,w=w+Math.imul(ze,Xt)|0,w=w+Math.imul(et,Tt)|0,T=T+Math.imul(et,Xt)|0,x=x+Math.imul(Re,xt)|0,w=w+Math.imul(Re,ar)|0,w=w+Math.imul(Te,xt)|0,T=T+Math.imul(Te,ar)|0,x=x+Math.imul(fe,kt)|0,w=w+Math.imul(fe,Dt)|0,w=w+Math.imul(Ee,kt)|0,T=T+Math.imul(Ee,Dt)|0,x=x+Math.imul(ee,dt)|0,w=w+Math.imul(ee,Lt)|0,w=w+Math.imul(N,dt)|0,T=T+Math.imul(N,Lt)|0,x=x+Math.imul(X,ut)|0,w=w+Math.imul(X,Vt)|0,w=w+Math.imul(G,ut)|0,T=T+Math.imul(G,Vt)|0,x=x+Math.imul(H,ht)|0,w=w+Math.imul(H,Et)|0,w=w+Math.imul(oe,ht)|0,T=T+Math.imul(oe,Et)|0;var Sn=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,x=Math.imul(Ze,rt),w=Math.imul(Ze,It),w=w+Math.imul(st,rt)|0,T=Math.imul(st,It),x=x+Math.imul(ke,Tt)|0,w=w+Math.imul(ke,Xt)|0,w=w+Math.imul(Ne,Tt)|0,T=T+Math.imul(Ne,Xt)|0,x=x+Math.imul(ze,xt)|0,w=w+Math.imul(ze,ar)|0,w=w+Math.imul(et,xt)|0,T=T+Math.imul(et,ar)|0,x=x+Math.imul(Re,kt)|0,w=w+Math.imul(Re,Dt)|0,w=w+Math.imul(Te,kt)|0,T=T+Math.imul(Te,Dt)|0,x=x+Math.imul(fe,dt)|0,w=w+Math.imul(fe,Lt)|0,w=w+Math.imul(Ee,dt)|0,T=T+Math.imul(Ee,Lt)|0,x=x+Math.imul(ee,ut)|0,w=w+Math.imul(ee,Vt)|0,w=w+Math.imul(N,ut)|0,T=T+Math.imul(N,Vt)|0,x=x+Math.imul(X,ht)|0,w=w+Math.imul(X,Et)|0,w=w+Math.imul(G,ht)|0,T=T+Math.imul(G,Et)|0,x=x+Math.imul(H,He)|0,w=w+Math.imul(H,$t)|0,w=w+Math.imul(oe,He)|0,T=T+Math.imul(oe,$t)|0;var ui=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(ui>>>26)|0,ui&=67108863,x=Math.imul(We,rt),w=Math.imul(We,It),w=w+Math.imul(lt,rt)|0,T=Math.imul(lt,It),x=x+Math.imul(Ze,Tt)|0,w=w+Math.imul(Ze,Xt)|0,w=w+Math.imul(st,Tt)|0,T=T+Math.imul(st,Xt)|0,x=x+Math.imul(ke,xt)|0,w=w+Math.imul(ke,ar)|0,w=w+Math.imul(Ne,xt)|0,T=T+Math.imul(Ne,ar)|0,x=x+Math.imul(ze,kt)|0,w=w+Math.imul(ze,Dt)|0,w=w+Math.imul(et,kt)|0,T=T+Math.imul(et,Dt)|0,x=x+Math.imul(Re,dt)|0,w=w+Math.imul(Re,Lt)|0,w=w+Math.imul(Te,dt)|0,T=T+Math.imul(Te,Lt)|0,x=x+Math.imul(fe,ut)|0,w=w+Math.imul(fe,Vt)|0,w=w+Math.imul(Ee,ut)|0,T=T+Math.imul(Ee,Vt)|0,x=x+Math.imul(ee,ht)|0,w=w+Math.imul(ee,Et)|0,w=w+Math.imul(N,ht)|0,T=T+Math.imul(N,Et)|0,x=x+Math.imul(X,He)|0,w=w+Math.imul(X,$t)|0,w=w+Math.imul(G,He)|0,T=T+Math.imul(G,$t)|0,x=x+Math.imul(H,ct)|0,w=w+Math.imul(H,Ht)|0,w=w+Math.imul(oe,ct)|0,T=T+Math.imul(oe,Ht)|0;var Fs=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Fs>>>26)|0,Fs&=67108863,x=Math.imul(Ke,rt),w=Math.imul(Ke,It),w=w+Math.imul(gt,rt)|0,T=Math.imul(gt,It),x=x+Math.imul(We,Tt)|0,w=w+Math.imul(We,Xt)|0,w=w+Math.imul(lt,Tt)|0,T=T+Math.imul(lt,Xt)|0,x=x+Math.imul(Ze,xt)|0,w=w+Math.imul(Ze,ar)|0,w=w+Math.imul(st,xt)|0,T=T+Math.imul(st,ar)|0,x=x+Math.imul(ke,kt)|0,w=w+Math.imul(ke,Dt)|0,w=w+Math.imul(Ne,kt)|0,T=T+Math.imul(Ne,Dt)|0,x=x+Math.imul(ze,dt)|0,w=w+Math.imul(ze,Lt)|0,w=w+Math.imul(et,dt)|0,T=T+Math.imul(et,Lt)|0,x=x+Math.imul(Re,ut)|0,w=w+Math.imul(Re,Vt)|0,w=w+Math.imul(Te,ut)|0,T=T+Math.imul(Te,Vt)|0,x=x+Math.imul(fe,ht)|0,w=w+Math.imul(fe,Et)|0,w=w+Math.imul(Ee,ht)|0,T=T+Math.imul(Ee,Et)|0,x=x+Math.imul(ee,He)|0,w=w+Math.imul(ee,$t)|0,w=w+Math.imul(N,He)|0,T=T+Math.imul(N,$t)|0,x=x+Math.imul(X,ct)|0,w=w+Math.imul(X,Ht)|0,w=w+Math.imul(G,ct)|0,T=T+Math.imul(G,Ht)|0,x=x+Math.imul(H,Ut)|0,w=w+Math.imul(H,Sr)|0,w=w+Math.imul(oe,Ut)|0,T=T+Math.imul(oe,Sr)|0;var di=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(di>>>26)|0,di&=67108863,x=Math.imul(Ke,Tt),w=Math.imul(Ke,Xt),w=w+Math.imul(gt,Tt)|0,T=Math.imul(gt,Xt),x=x+Math.imul(We,xt)|0,w=w+Math.imul(We,ar)|0,w=w+Math.imul(lt,xt)|0,T=T+Math.imul(lt,ar)|0,x=x+Math.imul(Ze,kt)|0,w=w+Math.imul(Ze,Dt)|0,w=w+Math.imul(st,kt)|0,T=T+Math.imul(st,Dt)|0,x=x+Math.imul(ke,dt)|0,w=w+Math.imul(ke,Lt)|0,w=w+Math.imul(Ne,dt)|0,T=T+Math.imul(Ne,Lt)|0,x=x+Math.imul(ze,ut)|0,w=w+Math.imul(ze,Vt)|0,w=w+Math.imul(et,ut)|0,T=T+Math.imul(et,Vt)|0,x=x+Math.imul(Re,ht)|0,w=w+Math.imul(Re,Et)|0,w=w+Math.imul(Te,ht)|0,T=T+Math.imul(Te,Et)|0,x=x+Math.imul(fe,He)|0,w=w+Math.imul(fe,$t)|0,w=w+Math.imul(Ee,He)|0,T=T+Math.imul(Ee,$t)|0,x=x+Math.imul(ee,ct)|0,w=w+Math.imul(ee,Ht)|0,w=w+Math.imul(N,ct)|0,T=T+Math.imul(N,Ht)|0,x=x+Math.imul(X,Ut)|0,w=w+Math.imul(X,Sr)|0,w=w+Math.imul(G,Ut)|0,T=T+Math.imul(G,Sr)|0;var jo=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(jo>>>26)|0,jo&=67108863,x=Math.imul(Ke,xt),w=Math.imul(Ke,ar),w=w+Math.imul(gt,xt)|0,T=Math.imul(gt,ar),x=x+Math.imul(We,kt)|0,w=w+Math.imul(We,Dt)|0,w=w+Math.imul(lt,kt)|0,T=T+Math.imul(lt,Dt)|0,x=x+Math.imul(Ze,dt)|0,w=w+Math.imul(Ze,Lt)|0,w=w+Math.imul(st,dt)|0,T=T+Math.imul(st,Lt)|0,x=x+Math.imul(ke,ut)|0,w=w+Math.imul(ke,Vt)|0,w=w+Math.imul(Ne,ut)|0,T=T+Math.imul(Ne,Vt)|0,x=x+Math.imul(ze,ht)|0,w=w+Math.imul(ze,Et)|0,w=w+Math.imul(et,ht)|0,T=T+Math.imul(et,Et)|0,x=x+Math.imul(Re,He)|0,w=w+Math.imul(Re,$t)|0,w=w+Math.imul(Te,He)|0,T=T+Math.imul(Te,$t)|0,x=x+Math.imul(fe,ct)|0,w=w+Math.imul(fe,Ht)|0,w=w+Math.imul(Ee,ct)|0,T=T+Math.imul(Ee,Ht)|0,x=x+Math.imul(ee,Ut)|0,w=w+Math.imul(ee,Sr)|0,w=w+Math.imul(N,Ut)|0,T=T+Math.imul(N,Sr)|0;var Uo=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Uo>>>26)|0,Uo&=67108863,x=Math.imul(Ke,kt),w=Math.imul(Ke,Dt),w=w+Math.imul(gt,kt)|0,T=Math.imul(gt,Dt),x=x+Math.imul(We,dt)|0,w=w+Math.imul(We,Lt)|0,w=w+Math.imul(lt,dt)|0,T=T+Math.imul(lt,Lt)|0,x=x+Math.imul(Ze,ut)|0,w=w+Math.imul(Ze,Vt)|0,w=w+Math.imul(st,ut)|0,T=T+Math.imul(st,Vt)|0,x=x+Math.imul(ke,ht)|0,w=w+Math.imul(ke,Et)|0,w=w+Math.imul(Ne,ht)|0,T=T+Math.imul(Ne,Et)|0,x=x+Math.imul(ze,He)|0,w=w+Math.imul(ze,$t)|0,w=w+Math.imul(et,He)|0,T=T+Math.imul(et,$t)|0,x=x+Math.imul(Re,ct)|0,w=w+Math.imul(Re,Ht)|0,w=w+Math.imul(Te,ct)|0,T=T+Math.imul(Te,Ht)|0,x=x+Math.imul(fe,Ut)|0,w=w+Math.imul(fe,Sr)|0,w=w+Math.imul(Ee,Ut)|0,T=T+Math.imul(Ee,Sr)|0;var hi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(hi>>>26)|0,hi&=67108863,x=Math.imul(Ke,dt),w=Math.imul(Ke,Lt),w=w+Math.imul(gt,dt)|0,T=Math.imul(gt,Lt),x=x+Math.imul(We,ut)|0,w=w+Math.imul(We,Vt)|0,w=w+Math.imul(lt,ut)|0,T=T+Math.imul(lt,Vt)|0,x=x+Math.imul(Ze,ht)|0,w=w+Math.imul(Ze,Et)|0,w=w+Math.imul(st,ht)|0,T=T+Math.imul(st,Et)|0,x=x+Math.imul(ke,He)|0,w=w+Math.imul(ke,$t)|0,w=w+Math.imul(Ne,He)|0,T=T+Math.imul(Ne,$t)|0,x=x+Math.imul(ze,ct)|0,w=w+Math.imul(ze,Ht)|0,w=w+Math.imul(et,ct)|0,T=T+Math.imul(et,Ht)|0,x=x+Math.imul(Re,Ut)|0,w=w+Math.imul(Re,Sr)|0,w=w+Math.imul(Te,Ut)|0,T=T+Math.imul(Te,Sr)|0;var oo=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(oo>>>26)|0,oo&=67108863,x=Math.imul(Ke,ut),w=Math.imul(Ke,Vt),w=w+Math.imul(gt,ut)|0,T=Math.imul(gt,Vt),x=x+Math.imul(We,ht)|0,w=w+Math.imul(We,Et)|0,w=w+Math.imul(lt,ht)|0,T=T+Math.imul(lt,Et)|0,x=x+Math.imul(Ze,He)|0,w=w+Math.imul(Ze,$t)|0,w=w+Math.imul(st,He)|0,T=T+Math.imul(st,$t)|0,x=x+Math.imul(ke,ct)|0,w=w+Math.imul(ke,Ht)|0,w=w+Math.imul(Ne,ct)|0,T=T+Math.imul(Ne,Ht)|0,x=x+Math.imul(ze,Ut)|0,w=w+Math.imul(ze,Sr)|0,w=w+Math.imul(et,Ut)|0,T=T+Math.imul(et,Sr)|0;var ao=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(ao>>>26)|0,ao&=67108863,x=Math.imul(Ke,ht),w=Math.imul(Ke,Et),w=w+Math.imul(gt,ht)|0,T=Math.imul(gt,Et),x=x+Math.imul(We,He)|0,w=w+Math.imul(We,$t)|0,w=w+Math.imul(lt,He)|0,T=T+Math.imul(lt,$t)|0,x=x+Math.imul(Ze,ct)|0,w=w+Math.imul(Ze,Ht)|0,w=w+Math.imul(st,ct)|0,T=T+Math.imul(st,Ht)|0,x=x+Math.imul(ke,Ut)|0,w=w+Math.imul(ke,Sr)|0,w=w+Math.imul(Ne,Ut)|0,T=T+Math.imul(Ne,Sr)|0;var _n=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(_n>>>26)|0,_n&=67108863,x=Math.imul(Ke,He),w=Math.imul(Ke,$t),w=w+Math.imul(gt,He)|0,T=Math.imul(gt,$t),x=x+Math.imul(We,ct)|0,w=w+Math.imul(We,Ht)|0,w=w+Math.imul(lt,ct)|0,T=T+Math.imul(lt,Ht)|0,x=x+Math.imul(Ze,Ut)|0,w=w+Math.imul(Ze,Sr)|0,w=w+Math.imul(st,Ut)|0,T=T+Math.imul(st,Sr)|0;var $o=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+($o>>>26)|0,$o&=67108863,x=Math.imul(Ke,ct),w=Math.imul(Ke,Ht),w=w+Math.imul(gt,ct)|0,T=Math.imul(gt,Ht),x=x+Math.imul(We,Ut)|0,w=w+Math.imul(We,Sr)|0,w=w+Math.imul(lt,Ut)|0,T=T+Math.imul(lt,Sr)|0;var Gi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,x=Math.imul(Ke,Ut),w=Math.imul(Ke,Sr),w=w+Math.imul(gt,Ut)|0,T=Math.imul(gt,Sr);var qo=(E+x|0)+((w&8191)<<13)|0;return E=(T+(w>>>13)|0)+(qo>>>26)|0,qo&=67108863,B[0]=er,B[1]=kr,B[2]=bi,B[3]=wi,B[4]=xi,B[5]=Ti,B[6]=Sn,B[7]=ui,B[8]=Fs,B[9]=di,B[10]=jo,B[11]=Uo,B[12]=hi,B[13]=oo,B[14]=ao,B[15]=_n,B[16]=$o,B[17]=Gi,B[18]=qo,E!==0&&(B[19]=E,v.length++),v};Math.imul||(b=y);function I(K,P,M){M.negative=P.negative^K.negative,M.length=K.length+P.length;for(var v=0,m=0,R=0;R>>26)|0,m+=B>>>26,B&=67108863}M.words[R]=E,v=B,B=m}return v!==0?M.words[R]=v:M.length--,M.strip()}function C(K,P,M){var v=new S;return v.mulp(K,P,M)}s.prototype.mulTo=function(P,M){var v,m=this.length+P.length;return this.length===10&&P.length===10?v=b(this,P,M):m<63?v=y(this,P,M):m<1024?v=I(this,P,M):v=C(this,P,M),v};function S(K,P){this.x=K,this.y=P}S.prototype.makeRBT=function(P){for(var M=new Array(P),v=s.prototype._countBits(P)-1,m=0;m>=1;return m},S.prototype.permute=function(P,M,v,m,R,B){for(var E=0;E>>1)R++;return 1<>>13,v[2*B+1]=R&8191,R=R>>>13;for(B=2*M;B>=26,M+=m/67108864|0,M+=R>>>26,this.words[v]=R&67108863}return M!==0&&(this.words[v]=M,this.length++),this},s.prototype.muln=function(P){return this.clone().imuln(P)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(P){var M=g(P);if(M.length===0)return new s(1);for(var v=this,m=0;m=0);var M=P%26,v=(P-M)/26,m=67108863>>>26-M<<26-M,R;if(M!==0){var B=0;for(R=0;R>>26-M}B&&(this.words[R]=B,this.length++)}if(v!==0){for(R=this.length-1;R>=0;R--)this.words[R+v]=this.words[R];for(R=0;R=0);var m;M?m=(M-M%26)/26:m=0;var R=P%26,B=Math.min((P-R)/26,this.length),E=67108863^67108863>>>R<B)for(this.length-=B,w=0;w=0&&(T!==0||w>=m);w--){var k=this.words[w]|0;this.words[w]=T<<26-R|k>>>R,T=k&E}return x&&T!==0&&(x.words[x.length++]=T),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(P,M,v){return n(this.negative===0),this.iushrn(P,M,v)},s.prototype.shln=function(P){return this.clone().ishln(P)},s.prototype.ushln=function(P){return this.clone().iushln(P)},s.prototype.shrn=function(P){return this.clone().ishrn(P)},s.prototype.ushrn=function(P){return this.clone().iushrn(P)},s.prototype.testn=function(P){n(typeof P=="number"&&P>=0);var M=P%26,v=(P-M)/26,m=1<=0);var M=P%26,v=(P-M)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(M!==0&&v++,this.length=Math.min(v,this.length),M!==0){var m=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},s.prototype.isubn=function(P){if(n(typeof P=="number"),n(P<67108864),P<0)return this.iaddn(-P);if(this.negative!==0)return this.negative=0,this.iaddn(P),this.negative=1,this;if(this.words[0]-=P,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var M=0;M>26)-(x/67108864|0),this.words[R+v]=B&67108863}for(;R>26,this.words[R+v]=B&67108863;if(E===0)return this.strip();for(n(E===-1),E=0,R=0;R>26,this.words[R]=B&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(P,M){var v=this.length-P.length,m=this.clone(),R=P,B=R.words[R.length-1]|0,E=this._countBits(B);v=26-E,v!==0&&(R=R.ushln(v),m.iushln(v),B=R.words[R.length-1]|0);var x=m.length-R.length,w;if(M!=="mod"){w=new s(null),w.length=x+1,w.words=new Array(w.length);for(var T=0;T=0;H--){var oe=(m.words[R.length+H]|0)*67108864+(m.words[R.length+H-1]|0);for(oe=Math.min(oe/B|0,67108863),m._ishlnsubmul(R,oe,H);m.negative!==0;)oe--,m.negative=0,m._ishlnsubmul(R,1,H),m.isZero()||(m.negative^=1);w&&(w.words[H]=oe)}return w&&w.strip(),m.strip(),M!=="div"&&v!==0&&m.iushrn(v),{div:w||null,mod:m}},s.prototype.divmod=function(P,M,v){if(n(!P.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var m,R,B;return this.negative!==0&&P.negative===0?(B=this.neg().divmod(P,M),M!=="mod"&&(m=B.div.neg()),M!=="div"&&(R=B.mod.neg(),v&&R.negative!==0&&R.iadd(P)),{div:m,mod:R}):this.negative===0&&P.negative!==0?(B=this.divmod(P.neg(),M),M!=="mod"&&(m=B.div.neg()),{div:m,mod:B.mod}):this.negative&P.negative?(B=this.neg().divmod(P.neg(),M),M!=="div"&&(R=B.mod.neg(),v&&R.negative!==0&&R.isub(P)),{div:B.div,mod:R}):P.length>this.length||this.cmp(P)<0?{div:new s(0),mod:this}:P.length===1?M==="div"?{div:this.divn(P.words[0]),mod:null}:M==="mod"?{div:null,mod:new s(this.modn(P.words[0]))}:{div:this.divn(P.words[0]),mod:new s(this.modn(P.words[0]))}:this._wordDiv(P,M)},s.prototype.div=function(P){return this.divmod(P,"div",!1).div},s.prototype.mod=function(P){return this.divmod(P,"mod",!1).mod},s.prototype.umod=function(P){return this.divmod(P,"mod",!0).mod},s.prototype.divRound=function(P){var M=this.divmod(P);if(M.mod.isZero())return M.div;var v=M.div.negative!==0?M.mod.isub(P):M.mod,m=P.ushrn(1),R=P.andln(1),B=v.cmp(m);return B<0||R===1&&B===0?M.div:M.div.negative!==0?M.div.isubn(1):M.div.iaddn(1)},s.prototype.modn=function(P){n(P<=67108863);for(var M=(1<<26)%P,v=0,m=this.length-1;m>=0;m--)v=(M*v+(this.words[m]|0))%P;return v},s.prototype.idivn=function(P){n(P<=67108863);for(var M=0,v=this.length-1;v>=0;v--){var m=(this.words[v]|0)+M*67108864;this.words[v]=m/P|0,M=m%P}return this.strip()},s.prototype.divn=function(P){return this.clone().idivn(P)},s.prototype.egcd=function(P){n(P.negative===0),n(!P.isZero());var M=this,v=P.clone();M.negative!==0?M=M.umod(P):M=M.clone();for(var m=new s(1),R=new s(0),B=new s(0),E=new s(1),x=0;M.isEven()&&v.isEven();)M.iushrn(1),v.iushrn(1),++x;for(var w=v.clone(),T=M.clone();!M.isZero();){for(var k=0,H=1;!(M.words[0]&H)&&k<26;++k,H<<=1);if(k>0)for(M.iushrn(k);k-- >0;)(m.isOdd()||R.isOdd())&&(m.iadd(w),R.isub(T)),m.iushrn(1),R.iushrn(1);for(var oe=0,j=1;!(v.words[0]&j)&&oe<26;++oe,j<<=1);if(oe>0)for(v.iushrn(oe);oe-- >0;)(B.isOdd()||E.isOdd())&&(B.iadd(w),E.isub(T)),B.iushrn(1),E.iushrn(1);M.cmp(v)>=0?(M.isub(v),m.isub(B),R.isub(E)):(v.isub(M),B.isub(m),E.isub(R))}return{a:B,b:E,gcd:v.iushln(x)}},s.prototype._invmp=function(P){n(P.negative===0),n(!P.isZero());var M=this,v=P.clone();M.negative!==0?M=M.umod(P):M=M.clone();for(var m=new s(1),R=new s(0),B=v.clone();M.cmpn(1)>0&&v.cmpn(1)>0;){for(var E=0,x=1;!(M.words[0]&x)&&E<26;++E,x<<=1);if(E>0)for(M.iushrn(E);E-- >0;)m.isOdd()&&m.iadd(B),m.iushrn(1);for(var w=0,T=1;!(v.words[0]&T)&&w<26;++w,T<<=1);if(w>0)for(v.iushrn(w);w-- >0;)R.isOdd()&&R.iadd(B),R.iushrn(1);M.cmp(v)>=0?(M.isub(v),m.isub(R)):(v.isub(M),R.isub(m))}var k;return M.cmpn(1)===0?k=m:k=R,k.cmpn(0)<0&&k.iadd(P),k},s.prototype.gcd=function(P){if(this.isZero())return P.abs();if(P.isZero())return this.abs();var M=this.clone(),v=P.clone();M.negative=0,v.negative=0;for(var m=0;M.isEven()&&v.isEven();m++)M.iushrn(1),v.iushrn(1);do{for(;M.isEven();)M.iushrn(1);for(;v.isEven();)v.iushrn(1);var R=M.cmp(v);if(R<0){var B=M;M=v,v=B}else if(R===0||v.cmpn(1)===0)break;M.isub(v)}while(!0);return v.iushln(m)},s.prototype.invm=function(P){return this.egcd(P).a.umod(P)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(P){return this.words[0]&P},s.prototype.bincn=function(P){n(typeof P=="number");var M=P%26,v=(P-M)/26,m=1<>>26,E&=67108863,this.words[B]=E}return R!==0&&(this.words[B]=R,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(P){var M=P<0;if(this.negative!==0&&!M)return-1;if(this.negative===0&&M)return 1;this.strip();var v;if(this.length>1)v=1;else{M&&(P=-P),n(P<=67108863,"Number is too big");var m=this.words[0]|0;v=m===P?0:mP.length)return 1;if(this.length=0;v--){var m=this.words[v]|0,R=P.words[v]|0;if(m!==R){mR&&(M=1);break}}return M},s.prototype.gtn=function(P){return this.cmpn(P)===1},s.prototype.gt=function(P){return this.cmp(P)===1},s.prototype.gten=function(P){return this.cmpn(P)>=0},s.prototype.gte=function(P){return this.cmp(P)>=0},s.prototype.ltn=function(P){return this.cmpn(P)===-1},s.prototype.lt=function(P){return this.cmp(P)===-1},s.prototype.lten=function(P){return this.cmpn(P)<=0},s.prototype.lte=function(P){return this.cmp(P)<=0},s.prototype.eqn=function(P){return this.cmpn(P)===0},s.prototype.eq=function(P){return this.cmp(P)===0},s.red=function(P){return new ie(P)},s.prototype.toRed=function(P){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),P.convertTo(this)._forceRed(P)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(P){return this.red=P,this},s.prototype.forceRed=function(P){return n(!this.red,"Already a number in reduction context"),this._forceRed(P)},s.prototype.redAdd=function(P){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,P)},s.prototype.redIAdd=function(P){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,P)},s.prototype.redSub=function(P){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,P)},s.prototype.redISub=function(P){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,P)},s.prototype.redShl=function(P){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,P)},s.prototype.redMul=function(P){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,P),this.red.mul(this,P)},s.prototype.redIMul=function(P){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,P),this.red.imul(this,P)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(P){return n(this.red&&!P.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,P)};var O={k256:null,p224:null,p192:null,p25519:null};function L(K,P){this.name=K,this.p=new s(P,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var P=new s(null);return P.words=new Array(Math.ceil(this.n/13)),P},L.prototype.ireduce=function(P){var M=P,v;do this.split(M,this.tmp),M=this.imulK(M),M=M.iadd(this.tmp),v=M.bitLength();while(v>this.n);var m=v0?M.isub(this.p):M.strip!==void 0?M.strip():M._strip(),M},L.prototype.split=function(P,M){P.iushrn(this.n,0,M)},L.prototype.imulK=function(P){return P.imul(this.k)};function F(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(F,L),F.prototype.split=function(P,M){for(var v=4194303,m=Math.min(P.length,9),R=0;R>>22,B=E}B>>>=22,P.words[R-10]=B,B===0&&P.length>10?P.length-=10:P.length-=9},F.prototype.imulK=function(P){P.words[P.length]=0,P.words[P.length+1]=0,P.length+=2;for(var M=0,v=0;v>>=26,P.words[v]=R,M=m}return M!==0&&(P.words[P.length++]=M),P},s._prime=function(P){if(O[P])return O[P];var M;if(P==="k256")M=new F;else if(P==="p224")M=new z;else if(P==="p192")M=new _;else if(P==="p25519")M=new $;else throw new Error("Unknown prime "+P);return O[P]=M,M};function ie(K){if(typeof K=="string"){var P=s._prime(K);this.m=P.p,this.prime=P}else n(K.gtn(1),"modulus must be greater than 1"),this.m=K,this.prime=null}ie.prototype._verify1=function(P){n(P.negative===0,"red works only with positives"),n(P.red,"red works only with red numbers")},ie.prototype._verify2=function(P,M){n((P.negative|M.negative)===0,"red works only with positives"),n(P.red&&P.red===M.red,"red works only with red numbers")},ie.prototype.imod=function(P){return this.prime?this.prime.ireduce(P)._forceRed(this):P.umod(this.m)._forceRed(this)},ie.prototype.neg=function(P){return P.isZero()?P.clone():this.m.sub(P)._forceRed(this)},ie.prototype.add=function(P,M){this._verify2(P,M);var v=P.add(M);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},ie.prototype.iadd=function(P,M){this._verify2(P,M);var v=P.iadd(M);return v.cmp(this.m)>=0&&v.isub(this.m),v},ie.prototype.sub=function(P,M){this._verify2(P,M);var v=P.sub(M);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},ie.prototype.isub=function(P,M){this._verify2(P,M);var v=P.isub(M);return v.cmpn(0)<0&&v.iadd(this.m),v},ie.prototype.shl=function(P,M){return this._verify1(P),this.imod(P.ushln(M))},ie.prototype.imul=function(P,M){return this._verify2(P,M),this.imod(P.imul(M))},ie.prototype.mul=function(P,M){return this._verify2(P,M),this.imod(P.mul(M))},ie.prototype.isqr=function(P){return this.imul(P,P.clone())},ie.prototype.sqr=function(P){return this.mul(P,P)},ie.prototype.sqrt=function(P){if(P.isZero())return P.clone();var M=this.m.andln(3);if(n(M%2===1),M===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(P,v)}for(var m=this.m.subn(1),R=0;!m.isZero()&&m.andln(1)===0;)R++,m.iushrn(1);n(!m.isZero());var B=new s(1).toRed(this),E=B.redNeg(),x=this.m.subn(1).iushrn(1),w=this.m.bitLength();for(w=new s(2*w*w).toRed(this);this.pow(w,x).cmp(E)!==0;)w.redIAdd(E);for(var T=this.pow(w,m),k=this.pow(P,m.addn(1).iushrn(1)),H=this.pow(P,m),oe=R;H.cmp(B)!==0;){for(var j=H,X=0;j.cmp(B)!==0;X++)j=j.redSqr();n(X=0;R--){for(var T=M.words[R],k=w-1;k>=0;k--){var H=T>>k&1;if(B!==m[0]&&(B=this.sqr(B)),H===0&&E===0){x=0;continue}E<<=1,E|=H,x++,!(x!==v&&(R!==0||k!==0))&&(B=this.mul(B,m[E]),x=0,E=0)}w=26}return B},ie.prototype.convertTo=function(P){var M=P.umod(this.m);return M===P?M.clone():M},ie.prototype.convertFrom=function(P){var M=P.clone();return M.red=null,M},s.mont=function(P){return new ce(P)};function ce(K){ie.call(this,K),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ce,ie),ce.prototype.convertTo=function(P){return this.imod(P.ushln(this.shift))},ce.prototype.convertFrom=function(P){var M=this.imod(P.mul(this.rinv));return M.red=null,M},ce.prototype.imul=function(P,M){if(P.isZero()||M.isZero())return P.words[0]=0,P.length=1,P;var v=P.imul(M),m=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=v.isub(m).iushrn(this.shift),B=R;return R.cmp(this.m)>=0?B=R.isub(this.m):R.cmpn(0)<0&&(B=R.iadd(this.m)),B._forceRed(this)},ce.prototype.mul=function(P,M){if(P.isZero()||M.isZero())return new s(0)._forceRed(this);var v=P.mul(M),m=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=v.isub(m).iushrn(this.shift),B=R;return R.cmp(this.m)>=0?B=R.isub(this.m):R.cmpn(0)<0&&(B=R.iadd(this.m)),B._forceRed(this)},ce.prototype.invm=function(P){var M=this.imod(P._invmp(this.m).mul(this.r2));return M._forceRed(this)}})(t,Si)})(kM);var Ou=kM.exports,MM={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var c=0;c>8,u=l&255;f?a.push(f,u):a.push(u)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(b>>1)-1?C=(b>>1)-S:C=S,I.isubn(C)):C=0,g[y]=C,I.iushrn(1)}return g}e.getNAF=s;function o(f,u){var p=[[],[]];f=f.clone(),u=u.clone();for(var g=0,y=0,b;f.cmpn(-g)>0||u.cmpn(-y)>0;){var I=f.andln(3)+g&3,C=u.andln(3)+y&3;I===3&&(I=-1),C===3&&(C=-1);var S;I&1?(b=f.andln(7)+g&7,(b===3||b===5)&&C===2?S=-I:S=I):S=0,p[0].push(S);var O;C&1?(b=u.andln(7)+y&7,(b===3||b===5)&&I===2?O=-C:O=C):O=0,p[1].push(O),2*g===S+1&&(g=1-g),2*y===O+1&&(y=1-y),f.iushrn(1),u.iushrn(1)}return p}e.getJSF=o;function a(f,u,p){var g="_"+u;f.prototype[u]=function(){return this[g]!==void 0?this[g]:this[g]=p.call(this)}}e.cachedProperty=a;function c(f){return typeof f=="string"?e.toArray(f,"hex"):f}e.parseBytes=c;function l(f){return new r(f,"hex","le")}e.intFromLE=l})(Ea);var RM={exports:{}},V9;RM.exports=function(e){return V9||(V9=new Fd(null)),V9.generate(e)};function Fd(t){this.rand=t}RM.exports.Rand=Fd;Fd.prototype.generate=function(e){return this._rand(e)};Fd.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var yE=Bh;Bh.prototype.point=function(){throw new Error("Not implemented")};Bh.prototype.validate=function(){throw new Error("Not implemented")};Bh.prototype._fixedNafMul=function(e,r){n4(e.precomputed);var n=e._getDoubles(),i=r4(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),p=s;p>0;p--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];n4(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};Bh.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,p;for(f=0;f=1;f-=2){var y=f-1,b=f;if(o[y]!==1||o[b]!==1){c[y]=r4(n[y],o[y],this._bitLength),c[b]=r4(n[b],o[b],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[b].length,l);continue}var I=[r[y],null,null,r[b]];r[y].y.cmp(r[b].y)===0?(I[1]=r[y].add(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg())):r[y].y.cmp(r[b].y.redNeg())===0?(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].add(r[b].neg())):(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg()));var C=[-3,-1,-5,-7,0,7,5,1,3],S=JTe(n[y],n[b]);for(l=Math.max(S[0].length,l),c[y]=new Array(l),c[b]=new Array(l),u=0;u=0;f--){for(var _=0;f>=0;){var $=!0;for(u=0;u=0&&_++,F=F.dblp(_),f<0)break;for(u=0;u0?p=a[u][ie-1>>1]:ie<0&&(p=a[u][-ie-1>>1].neg()),p.type==="affine"?F=F.mixedAdd(p):F=F.add(p))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};fc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),p=p.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:p},{a:g,b:y}]};uc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),p=l.add(f).neg();return{k1:u,k2:p}};uc.prototype.pointFromX=function(e,r){e=new Kn(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 s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};uc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};uc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Hi.prototype.isInfinity=function(){return this.inf};Hi.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)};Hi.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(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Hi.prototype.getX=function(){return this.x.fromRed()};Hi.prototype.getY=function(){return this.y.fromRed()};Hi.prototype.mul=function(e){return e=new Kn(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)};Hi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Hi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Hi.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)};Hi.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(s){return s.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};Hi.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 fs(t,e,r,n){By.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Kn(0)):(this.x=new Kn(e,16),this.y=new Kn(r,16),this.z=new Kn(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}DM(fs,By.BasePoint);uc.prototype.jpoint=function(e,r,n){return new fs(this,e,r,n)};fs.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)};fs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};fs.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),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),p=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(p).redISub(p),y=l.redMul(p.redISub(g)).redISub(o.redMul(u)),b=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,b)};fs.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),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),p=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(p)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(p,g,y)};fs.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(s),this.x.cmp(n)===0)return!0}};fs.prototype.inspect=function(){return this.isInfinity()?"":""};fs.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var gv=Ou,bee=cE,mE=yE,tPe=Ea;function Ly(t){mE.call(this,"mont",t),this.a=new gv(t.a,16).toRed(this.red),this.b=new gv(t.b,16).toRed(this.red),this.i4=new gv(4).toRed(this.red).redInvm(),this.two=new gv(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}bee(Ly,mE);var rPe=Ly;Ly.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function qi(t,e,r){mE.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new gv(e,16),this.z=new gv(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}bee(qi,mE.BasePoint);Ly.prototype.decodePoint=function(e,r){return this.point(tPe.toArray(e,r),1)};Ly.prototype.point=function(e,r){return new qi(this,e,r)};Ly.prototype.pointFromJSON=function(e){return qi.fromJSON(this,e)};qi.prototype.precompute=function(){};qi.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};qi.fromJSON=function(e,r){return new qi(e,r[0],r[1]||e.one)};qi.prototype.inspect=function(){return this.isInfinity()?"":""};qi.prototype.isInfinity=function(){return this.z.cmpn(0)===0};qi.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)};qi.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};qi.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),c=s.redMul(i),l=r.z.redMul(a.redAdd(c).redSqr()),f=r.x.redMul(a.redISub(c).redSqr());return this.curve.point(l,f)};qi.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};qi.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};qi.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};qi.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};qi.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};qi.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var nPe=Ea,eu=Ou,wee=cE,bE=yE,iPe=nPe.assert;function of(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,bE.call(this,"edwards",t),this.a=new eu(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new eu(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new eu(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),iPe(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}wee(of,bE);var sPe=of;of.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};of.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};of.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};of.prototype.pointFromX=function(e,r){e=new eu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var c=a.fromRed().isOdd();return(r&&!c||!r&&c)&&(a=a.redNeg()),this.point(e,a)};of.prototype.pointFromY=function(e,r){e=new eu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};of.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function wn(t,e,r,n,i){bE.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new eu(e,16),this.y=new eu(r,16),this.z=n?new eu(n,16):this.curve.one,this.t=i&&new eu(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}wee(wn,bE.BasePoint);of.prototype.pointFromJSON=function(e){return wn.fromJSON(this,e)};of.prototype.point=function(e,r,n,i){return new wn(this,e,r,n,i)};wn.fromJSON=function(e,r){return new wn(e,r[0],r[1],r[2])};wn.prototype.inspect=function(){return this.isInfinity()?"":""};wn.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};wn.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),c=i.redSub(r),l=s.redMul(a),f=o.redMul(c),u=s.redMul(c),p=a.redMul(o);return this.curve.point(l,f,p,u)};wn.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,c,l;if(this.curve.twisted){a=this.curve._mulA(r);var f=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(f.redSub(this.curve.two)),s=f.redMul(a.redSub(n)),o=f.redSqr().redSub(f).redSub(f)):(c=this.z.redSqr(),l=f.redSub(c).redISub(c),i=e.redSub(r).redISub(n).redMul(l),s=f.redMul(a.redSub(n)),o=f.redMul(l))}else a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),l=a.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)};wn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};wn.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),c=s.redAdd(i),l=n.redAdd(r),f=o.redMul(a),u=c.redMul(l),p=o.redMul(l),g=a.redMul(c);return this.curve.point(f,u,g,p)};wn.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),c=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),f=r.redMul(a).redMul(l),u,p;return this.curve.twisted?(u=r.redMul(c).redMul(s.redSub(this.curve._mulA(i))),p=a.redMul(c)):(u=r.redMul(c).redMul(s.redSub(i)),p=this.curve._mulC(a).redMul(c)),this.curve.point(f,u,p)};wn.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};wn.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};wn.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};wn.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};wn.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};wn.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};wn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};wn.prototype.getY=function(){return this.normalize(),this.y.fromRed()};wn.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};wn.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};wn.prototype.toP=wn.prototype.normalize;wn.prototype.mixedAdd=wn.prototype.add;(function(t){var e=t;e.base=yE,e.short=ePe,e.mont=rPe,e.edwards=sPe})(OM);var wE={},z9,$j;function oPe(){return $j||($j=1,z9={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),z9}(function(t){var e=t,r=Mx,n=OM,i=Ea,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,f){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var u=new o(f);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:u}),u}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=oPe()}catch{c=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})})(wE);var aPe=Mx,yp=MM,xee=Yp;function vh(t){if(!(this instanceof vh))return new vh(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=yp.toArray(t.entropy,t.entropyEnc||"hex"),r=yp.toArray(t.nonce,t.nonceEnc||"hex"),n=yp.toArray(t.pers,t.persEnc||"hex");xee(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var cPe=vh;vh.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 s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};vh.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=yp.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var i4=Ou,NM=Ea,dPe=NM.assert;function xE(t,e){if(t instanceof xE)return t;this._importDER(t,e)||(dPe(t.r&&t.s,"Signature without r or s"),this.r=new i4(t.r,16),this.s=new i4(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var hPe=xE;function pPe(){this.place=0}function H9(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function qj(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)}xE.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=qj(r),n=qj(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];G9(i,r.length),i=i.concat(r),i.push(2),G9(i,n.length);var s=i.concat(n),o=[48];return G9(o,s.length),o=o.concat(s),NM.encode(o,e)};var tu=Ou,Eee=cPe,vPe=Ea,W9=wE,gPe=mee,Cee=vPe.assert,BM=uPe,EE=hPe;function ac(t){if(!(this instanceof ac))return new ac(t);typeof t=="string"&&(Cee(Object.prototype.hasOwnProperty.call(W9,t),"Unknown curve "+t),t=W9[t]),t instanceof W9.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 yPe=ac;ac.prototype.keyPair=function(e){return new BM(this,e)};ac.prototype.keyFromPrivate=function(e,r){return BM.fromPrivate(this,e,r)};ac.prototype.keyFromPublic=function(e,r){return BM.fromPublic(this,e,r)};ac.prototype.genKeyPair=function(e){e||(e={});for(var r=new Eee({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||gPe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new tu(2));;){var s=new tu(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};ac.prototype._truncateToN=function(e,r,n){var i;if(tu.isBN(e)||typeof e=="number")e=new tu(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new tu(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new tu(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};ac.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new Eee({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new tu(1)),f=0;;f++){var u=i.k?i.k(f):new tu(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var p=this.g.mul(u);if(!p.isInfinity()){var g=p.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var b=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(b=b.umod(this.n),b.cmpn(0)!==0){var I=(p.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),I^=1),new EE({r:y,s:b,recoveryParam:I})}}}}}};ac.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new EE(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),l=c.mul(e).umod(this.n),f=c.mul(o).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.eqXToP(o)):(u=this.g.mulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.getX().umod(this.n).cmp(o)===0)};ac.prototype.recoverPubKey=function(t,e,r,n){Cee((3&r)===r,"The recovery param is more than two bits"),e=new EE(e,n);var i=this.n,s=new tu(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),p=a.mul(f).umod(i);return this.g.mulAdd(u,o,p)};ac.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new EE(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Bx=Ea,Aee=Bx.assert,Vj=Bx.parseBytes,Fy=Bx.cachedProperty;function Ui(t,e){this.eddsa=t,this._secret=Vj(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Vj(e.pub)}Ui.fromPublic=function(e,r){return r instanceof Ui?r:new Ui(e,{pub:r})};Ui.fromSecret=function(e,r){return r instanceof Ui?r:new Ui(e,{secret:r})};Ui.prototype.secret=function(){return this._secret};Fy(Ui,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Fy(Ui,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Fy(Ui,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});Fy(Ui,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Fy(Ui,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Fy(Ui,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Ui.prototype.sign=function(e){return Aee(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Ui.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Ui.prototype.getSecret=function(e){return Aee(this._secret,"KeyPair is public only"),Bx.encode(this.secret(),e)};Ui.prototype.getPublic=function(e){return Bx.encode(this.pubBytes(),e)};var mPe=Ui,bPe=Ou,CE=Ea,zj=CE.assert,AE=CE.cachedProperty,wPe=CE.parseBytes;function Jp(t,e){this.eddsa=t,typeof e!="object"&&(e=wPe(e)),Array.isArray(e)&&(zj(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),zj(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof bPe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}AE(Jp,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});AE(Jp,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});AE(Jp,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});AE(Jp,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Jp.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Jp.prototype.toHex=function(){return CE.encode(this.toBytes(),"hex").toUpperCase()};var xPe=Jp,EPe=Mx,CPe=wE,cy=Ea,APe=cy.assert,See=cy.parseBytes,_ee=mPe,Hj=xPe;function Bo(t){if(APe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Bo))return new Bo(t);t=CPe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=EPe.sha512}var SPe=Bo;Bo.prototype.sign=function(e,r){e=See(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:o})};Bo.prototype.verify=function(e,r,n){if(e=See(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)};Bo.prototype.hashInt=function(){for(var e=this.hash(),r=0;r0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,p=l<<3,g=l%128<112?128:256;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._stateHi.set(c.stateHi),this._stateLo.set(c.stateLo),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.stateHi),r.wipe(c.stateLo),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,c,l,f,u,p,g){for(var y=l[0],b=l[1],I=l[2],C=l[3],S=l[4],O=l[5],L=l[6],F=l[7],z=f[0],_=f[1],$=f[2],ie=f[3],ce=f[4],K=f[5],P=f[6],M=f[7],v,m,R,B,E,x,w,T;g>=128;){for(var k=0;k<16;k++){var H=8*k+p;a[k]=e.readUint32BE(u,H),c[k]=e.readUint32BE(u,H+4)}for(var k=0;k<80;k++){var oe=y,j=b,X=I,G=C,Z=S,ee=O,N=L,te=F,fe=z,Ee=_,_e=$,Re=ie,Te=ce,De=K,ze=P,et=M;if(v=F,m=M,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=(S>>>14|ce<<18)^(S>>>18|ce<<14)^(ce>>>9|S<<23),m=(ce>>>14|S<<18)^(ce>>>18|S<<14)^(S>>>9|ce<<23),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=S&O^~S&L,m=ce&K^~ce&P,E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=i[k*2],m=i[k*2+1],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=a[k%16],m=c[k%16],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,R=w&65535|T<<16,B=E&65535|x<<16,v=R,m=B,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=(y>>>28|z<<4)^(z>>>2|y<<30)^(z>>>7|y<<25),m=(z>>>28|y<<4)^(y>>>2|z<<30)^(y>>>7|z<<25),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=y&b^y&I^b&I,m=z&_^z&$^_&$,E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,te=w&65535|T<<16,et=E&65535|x<<16,v=G,m=Re,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=R,m=B,E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,G=w&65535|T<<16,Re=E&65535|x<<16,b=oe,I=j,C=X,S=G,O=Z,L=ee,F=N,y=te,_=fe,$=Ee,ie=_e,ce=Re,K=Te,P=De,M=ze,z=et,k%16===15)for(var H=0;H<16;H++)v=a[H],m=c[H],E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=a[(H+9)%16],m=c[(H+9)%16],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,R=a[(H+1)%16],B=c[(H+1)%16],v=(R>>>1|B<<31)^(R>>>8|B<<24)^R>>>7,m=(B>>>1|R<<31)^(B>>>8|R<<24)^(B>>>7|R<<25),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,R=a[(H+14)%16],B=c[(H+14)%16],v=(R>>>19|B<<13)^(B>>>29|R<<3)^R>>>6,m=(B>>>19|R<<13)^(R>>>29|B<<3)^(B>>>6|R<<26),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,a[H]=w&65535|T<<16,c[H]=E&65535|x<<16}v=y,m=z,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[0],m=f[0],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[0]=y=w&65535|T<<16,f[0]=z=E&65535|x<<16,v=b,m=_,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[1],m=f[1],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[1]=b=w&65535|T<<16,f[1]=_=E&65535|x<<16,v=I,m=$,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[2],m=f[2],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[2]=I=w&65535|T<<16,f[2]=$=E&65535|x<<16,v=C,m=ie,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[3],m=f[3],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[3]=C=w&65535|T<<16,f[3]=ie=E&65535|x<<16,v=S,m=ce,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[4],m=f[4],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[4]=S=w&65535|T<<16,f[4]=ce=E&65535|x<<16,v=O,m=K,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[5],m=f[5],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[5]=O=w&65535|T<<16,f[5]=K=E&65535|x<<16,v=L,m=P,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[6],m=f[6],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[6]=L=w&65535|T<<16,f[6]=P=E&65535|x<<16,v=F,m=M,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[7],m=f[7],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[7]=F=w&65535|T<<16,f[7]=M=E&65535|x<<16,p+=128,g-=128}return p}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(Iee);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Nh,r=Iee,n=xa;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(G){const Z=new Float64Array(16);if(G)for(let ee=0;ee>16&1),ee[Ee-1]&=65535;ee[15]=N[15]-32767-(ee[14]>>16&1);const fe=ee[15]>>16&1;ee[14]&=65535,b(N,ee,1-fe)}for(let te=0;te<16;te++)G[2*te]=N[te]&255,G[2*te+1]=N[te]>>8}function C(G,Z){let ee=0;for(let N=0;N<32;N++)ee|=G[N]^Z[N];return(1&ee-1>>>8)-1}function S(G,Z){const ee=new Uint8Array(32),N=new Uint8Array(32);return I(ee,G),I(N,Z),C(ee,N)}function O(G){const Z=new Uint8Array(32);return I(Z,G),Z[0]&1}function L(G,Z){for(let ee=0;ee<16;ee++)G[ee]=Z[2*ee]+(Z[2*ee+1]<<8);G[15]&=32767}function F(G,Z,ee){for(let N=0;N<16;N++)G[N]=Z[N]+ee[N]}function z(G,Z,ee){for(let N=0;N<16;N++)G[N]=Z[N]-ee[N]}function _(G,Z,ee){let N,te,fe=0,Ee=0,_e=0,Re=0,Te=0,De=0,ze=0,et=0,Je=0,ke=0,Ne=0,tt=0,Ze=0,st=0,nt=0,We=0,lt=0,vt=0,Ke=0,gt=0,wt=0,rt=0,It=0,At=0,Tt=0,Xt=0,lr=0,xt=0,ar=0,rr=0,kt=0,Dt=ee[0],Nt=ee[1],dt=ee[2],Lt=ee[3],Mt=ee[4],ut=ee[5],Vt=ee[6],zt=ee[7],ht=ee[8],Et=ee[9],Bt=ee[10],He=ee[11],$t=ee[12],Ct=ee[13],ct=ee[14],Ht=ee[15];N=Z[0],fe+=N*Dt,Ee+=N*Nt,_e+=N*dt,Re+=N*Lt,Te+=N*Mt,De+=N*ut,ze+=N*Vt,et+=N*zt,Je+=N*ht,ke+=N*Et,Ne+=N*Bt,tt+=N*He,Ze+=N*$t,st+=N*Ct,nt+=N*ct,We+=N*Ht,N=Z[1],Ee+=N*Dt,_e+=N*Nt,Re+=N*dt,Te+=N*Lt,De+=N*Mt,ze+=N*ut,et+=N*Vt,Je+=N*zt,ke+=N*ht,Ne+=N*Et,tt+=N*Bt,Ze+=N*He,st+=N*$t,nt+=N*Ct,We+=N*ct,lt+=N*Ht,N=Z[2],_e+=N*Dt,Re+=N*Nt,Te+=N*dt,De+=N*Lt,ze+=N*Mt,et+=N*ut,Je+=N*Vt,ke+=N*zt,Ne+=N*ht,tt+=N*Et,Ze+=N*Bt,st+=N*He,nt+=N*$t,We+=N*Ct,lt+=N*ct,vt+=N*Ht,N=Z[3],Re+=N*Dt,Te+=N*Nt,De+=N*dt,ze+=N*Lt,et+=N*Mt,Je+=N*ut,ke+=N*Vt,Ne+=N*zt,tt+=N*ht,Ze+=N*Et,st+=N*Bt,nt+=N*He,We+=N*$t,lt+=N*Ct,vt+=N*ct,Ke+=N*Ht,N=Z[4],Te+=N*Dt,De+=N*Nt,ze+=N*dt,et+=N*Lt,Je+=N*Mt,ke+=N*ut,Ne+=N*Vt,tt+=N*zt,Ze+=N*ht,st+=N*Et,nt+=N*Bt,We+=N*He,lt+=N*$t,vt+=N*Ct,Ke+=N*ct,gt+=N*Ht,N=Z[5],De+=N*Dt,ze+=N*Nt,et+=N*dt,Je+=N*Lt,ke+=N*Mt,Ne+=N*ut,tt+=N*Vt,Ze+=N*zt,st+=N*ht,nt+=N*Et,We+=N*Bt,lt+=N*He,vt+=N*$t,Ke+=N*Ct,gt+=N*ct,wt+=N*Ht,N=Z[6],ze+=N*Dt,et+=N*Nt,Je+=N*dt,ke+=N*Lt,Ne+=N*Mt,tt+=N*ut,Ze+=N*Vt,st+=N*zt,nt+=N*ht,We+=N*Et,lt+=N*Bt,vt+=N*He,Ke+=N*$t,gt+=N*Ct,wt+=N*ct,rt+=N*Ht,N=Z[7],et+=N*Dt,Je+=N*Nt,ke+=N*dt,Ne+=N*Lt,tt+=N*Mt,Ze+=N*ut,st+=N*Vt,nt+=N*zt,We+=N*ht,lt+=N*Et,vt+=N*Bt,Ke+=N*He,gt+=N*$t,wt+=N*Ct,rt+=N*ct,It+=N*Ht,N=Z[8],Je+=N*Dt,ke+=N*Nt,Ne+=N*dt,tt+=N*Lt,Ze+=N*Mt,st+=N*ut,nt+=N*Vt,We+=N*zt,lt+=N*ht,vt+=N*Et,Ke+=N*Bt,gt+=N*He,wt+=N*$t,rt+=N*Ct,It+=N*ct,At+=N*Ht,N=Z[9],ke+=N*Dt,Ne+=N*Nt,tt+=N*dt,Ze+=N*Lt,st+=N*Mt,nt+=N*ut,We+=N*Vt,lt+=N*zt,vt+=N*ht,Ke+=N*Et,gt+=N*Bt,wt+=N*He,rt+=N*$t,It+=N*Ct,At+=N*ct,Tt+=N*Ht,N=Z[10],Ne+=N*Dt,tt+=N*Nt,Ze+=N*dt,st+=N*Lt,nt+=N*Mt,We+=N*ut,lt+=N*Vt,vt+=N*zt,Ke+=N*ht,gt+=N*Et,wt+=N*Bt,rt+=N*He,It+=N*$t,At+=N*Ct,Tt+=N*ct,Xt+=N*Ht,N=Z[11],tt+=N*Dt,Ze+=N*Nt,st+=N*dt,nt+=N*Lt,We+=N*Mt,lt+=N*ut,vt+=N*Vt,Ke+=N*zt,gt+=N*ht,wt+=N*Et,rt+=N*Bt,It+=N*He,At+=N*$t,Tt+=N*Ct,Xt+=N*ct,lr+=N*Ht,N=Z[12],Ze+=N*Dt,st+=N*Nt,nt+=N*dt,We+=N*Lt,lt+=N*Mt,vt+=N*ut,Ke+=N*Vt,gt+=N*zt,wt+=N*ht,rt+=N*Et,It+=N*Bt,At+=N*He,Tt+=N*$t,Xt+=N*Ct,lr+=N*ct,xt+=N*Ht,N=Z[13],st+=N*Dt,nt+=N*Nt,We+=N*dt,lt+=N*Lt,vt+=N*Mt,Ke+=N*ut,gt+=N*Vt,wt+=N*zt,rt+=N*ht,It+=N*Et,At+=N*Bt,Tt+=N*He,Xt+=N*$t,lr+=N*Ct,xt+=N*ct,ar+=N*Ht,N=Z[14],nt+=N*Dt,We+=N*Nt,lt+=N*dt,vt+=N*Lt,Ke+=N*Mt,gt+=N*ut,wt+=N*Vt,rt+=N*zt,It+=N*ht,At+=N*Et,Tt+=N*Bt,Xt+=N*He,lr+=N*$t,xt+=N*Ct,ar+=N*ct,rr+=N*Ht,N=Z[15],We+=N*Dt,lt+=N*Nt,vt+=N*dt,Ke+=N*Lt,gt+=N*Mt,wt+=N*ut,rt+=N*Vt,It+=N*zt,At+=N*ht,Tt+=N*Et,Xt+=N*Bt,lr+=N*He,xt+=N*$t,ar+=N*Ct,rr+=N*ct,kt+=N*Ht,fe+=38*lt,Ee+=38*vt,_e+=38*Ke,Re+=38*gt,Te+=38*wt,De+=38*rt,ze+=38*It,et+=38*At,Je+=38*Tt,ke+=38*Xt,Ne+=38*lr,tt+=38*xt,Ze+=38*ar,st+=38*rr,nt+=38*kt,te=1,N=fe+te+65535,te=Math.floor(N/65536),fe=N-te*65536,N=Ee+te+65535,te=Math.floor(N/65536),Ee=N-te*65536,N=_e+te+65535,te=Math.floor(N/65536),_e=N-te*65536,N=Re+te+65535,te=Math.floor(N/65536),Re=N-te*65536,N=Te+te+65535,te=Math.floor(N/65536),Te=N-te*65536,N=De+te+65535,te=Math.floor(N/65536),De=N-te*65536,N=ze+te+65535,te=Math.floor(N/65536),ze=N-te*65536,N=et+te+65535,te=Math.floor(N/65536),et=N-te*65536,N=Je+te+65535,te=Math.floor(N/65536),Je=N-te*65536,N=ke+te+65535,te=Math.floor(N/65536),ke=N-te*65536,N=Ne+te+65535,te=Math.floor(N/65536),Ne=N-te*65536,N=tt+te+65535,te=Math.floor(N/65536),tt=N-te*65536,N=Ze+te+65535,te=Math.floor(N/65536),Ze=N-te*65536,N=st+te+65535,te=Math.floor(N/65536),st=N-te*65536,N=nt+te+65535,te=Math.floor(N/65536),nt=N-te*65536,N=We+te+65535,te=Math.floor(N/65536),We=N-te*65536,fe+=te-1+37*(te-1),te=1,N=fe+te+65535,te=Math.floor(N/65536),fe=N-te*65536,N=Ee+te+65535,te=Math.floor(N/65536),Ee=N-te*65536,N=_e+te+65535,te=Math.floor(N/65536),_e=N-te*65536,N=Re+te+65535,te=Math.floor(N/65536),Re=N-te*65536,N=Te+te+65535,te=Math.floor(N/65536),Te=N-te*65536,N=De+te+65535,te=Math.floor(N/65536),De=N-te*65536,N=ze+te+65535,te=Math.floor(N/65536),ze=N-te*65536,N=et+te+65535,te=Math.floor(N/65536),et=N-te*65536,N=Je+te+65535,te=Math.floor(N/65536),Je=N-te*65536,N=ke+te+65535,te=Math.floor(N/65536),ke=N-te*65536,N=Ne+te+65535,te=Math.floor(N/65536),Ne=N-te*65536,N=tt+te+65535,te=Math.floor(N/65536),tt=N-te*65536,N=Ze+te+65535,te=Math.floor(N/65536),Ze=N-te*65536,N=st+te+65535,te=Math.floor(N/65536),st=N-te*65536,N=nt+te+65535,te=Math.floor(N/65536),nt=N-te*65536,N=We+te+65535,te=Math.floor(N/65536),We=N-te*65536,fe+=te-1+37*(te-1),G[0]=fe,G[1]=Ee,G[2]=_e,G[3]=Re,G[4]=Te,G[5]=De,G[6]=ze,G[7]=et,G[8]=Je,G[9]=ke,G[10]=Ne,G[11]=tt,G[12]=Ze,G[13]=st,G[14]=nt,G[15]=We}function $(G,Z){_(G,Z,Z)}function ie(G,Z){const ee=i();let N;for(N=0;N<16;N++)ee[N]=Z[N];for(N=253;N>=0;N--)$(ee,ee),N!==2&&N!==4&&_(ee,ee,Z);for(N=0;N<16;N++)G[N]=ee[N]}function ce(G,Z){const ee=i();let N;for(N=0;N<16;N++)ee[N]=Z[N];for(N=250;N>=0;N--)$(ee,ee),N!==1&&_(ee,ee,Z);for(N=0;N<16;N++)G[N]=ee[N]}function K(G,Z){const ee=i(),N=i(),te=i(),fe=i(),Ee=i(),_e=i(),Re=i(),Te=i(),De=i();z(ee,G[1],G[0]),z(De,Z[1],Z[0]),_(ee,ee,De),F(N,G[0],G[1]),F(De,Z[0],Z[1]),_(N,N,De),_(te,G[3],Z[3]),_(te,te,l),_(fe,G[2],Z[2]),F(fe,fe,fe),z(Ee,N,ee),z(_e,fe,te),F(Re,fe,te),F(Te,N,ee),_(G[0],Ee,_e),_(G[1],Te,Re),_(G[2],Re,_e),_(G[3],Ee,Te)}function P(G,Z,ee){for(let N=0;N<4;N++)b(G[N],Z[N],ee)}function M(G,Z){const ee=i(),N=i(),te=i();ie(te,Z[2]),_(ee,Z[0],te),_(N,Z[1],te),I(G,N),G[31]^=O(ee)<<7}function v(G,Z,ee){g(G[0],o),g(G[1],a),g(G[2],a),g(G[3],o);for(let N=255;N>=0;--N){const te=ee[N/8|0]>>(N&7)&1;P(G,Z,te),K(Z,G),K(G,G),P(G,Z,te)}}function m(G,Z){const ee=[i(),i(),i(),i()];g(ee[0],f),g(ee[1],u),g(ee[2],a),_(ee[3],f,u),v(G,ee,Z)}function R(G){if(G.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const Z=(0,r.hash)(G);Z[0]&=248,Z[31]&=127,Z[31]|=64;const ee=new Uint8Array(32),N=[i(),i(),i(),i()];m(N,Z),M(ee,N);const te=new Uint8Array(64);return te.set(G),te.set(ee,32),{publicKey:ee,secretKey:te}}t.generateKeyPairFromSeed=R;function B(G){const Z=(0,e.randomBytes)(32,G),ee=R(Z);return(0,n.wipe)(Z),ee}t.generateKeyPair=B;function E(G){if(G.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(G.subarray(32))}t.extractPublicKeyFromSecretKey=E;const x=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function w(G,Z){let ee,N,te,fe;for(N=63;N>=32;--N){for(ee=0,te=N-32,fe=N-12;te>4)*x[te],ee=Z[te]>>8,Z[te]&=255;for(te=0;te<32;te++)Z[te]-=ee*x[te];for(N=0;N<32;N++)Z[N+1]+=Z[N]>>8,G[N]=Z[N]&255}function T(G){const Z=new Float64Array(64);for(let ee=0;ee<64;ee++)Z[ee]=G[ee];for(let ee=0;ee<64;ee++)G[ee]=0;w(G,Z)}function k(G,Z){const ee=new Float64Array(64),N=[i(),i(),i(),i()],te=(0,r.hash)(G.subarray(0,32));te[0]&=248,te[31]&=127,te[31]|=64;const fe=new Uint8Array(64);fe.set(te.subarray(32),32);const Ee=new r.SHA512;Ee.update(fe.subarray(32)),Ee.update(Z);const _e=Ee.digest();Ee.clean(),T(_e),m(N,_e),M(fe,N),Ee.reset(),Ee.update(fe.subarray(0,32)),Ee.update(G.subarray(32)),Ee.update(Z);const Re=Ee.digest();T(Re);for(let Te=0;Te<32;Te++)ee[Te]=_e[Te];for(let Te=0;Te<32;Te++)for(let De=0;De<32;De++)ee[Te+De]+=Re[Te]*te[De];return w(fe.subarray(32),ee),fe}t.sign=k;function H(G,Z){const ee=i(),N=i(),te=i(),fe=i(),Ee=i(),_e=i(),Re=i();return g(G[2],a),L(G[1],Z),$(te,G[1]),_(fe,te,c),z(te,te,G[2]),F(fe,G[2],fe),$(Ee,fe),$(_e,Ee),_(Re,_e,Ee),_(ee,Re,te),_(ee,ee,fe),ce(ee,ee),_(ee,ee,te),_(ee,ee,fe),_(ee,ee,fe),_(G[0],ee,fe),$(N,G[0]),_(N,N,fe),S(N,te)&&_(G[0],G[0],p),$(N,G[0]),_(N,N,fe),S(N,te)?-1:(O(G[0])===Z[31]>>7&&z(G[0],o,G[0]),_(G[3],G[0],G[1]),0)}function oe(G,Z,ee){const N=new Uint8Array(32),te=[i(),i(),i(),i()],fe=[i(),i(),i(),i()];if(ee.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(H(fe,G))return!1;const Ee=new r.SHA512;Ee.update(ee.subarray(0,32)),Ee.update(G),Ee.update(Z);const _e=Ee.digest();return T(_e),v(te,fe,_e),m(fe,ee.subarray(32)),K(te,fe),M(N,te),!C(ee,N)}t.verify=oe;function j(G){let Z=[i(),i(),i(),i()];if(H(Z,G))throw new Error("Ed25519: invalid public key");let ee=i(),N=i(),te=Z[1];F(ee,a,te),z(N,a,te),ie(N,N),_(ee,ee,N);let fe=new Uint8Array(32);return I(fe,ee),fe}t.convertPublicKeyToX25519=j;function X(G){const Z=(0,r.hash)(G.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const ee=new Uint8Array(Z.subarray(0,32));return(0,n.wipe)(Z),ee}t.convertSecretKeyToX25519=X})(LM);const _Pe="EdDSA",IPe="JWT",s4=".",SE="base64url",Tee="utf8",Pee="utf8",TPe=":",PPe="did",kPe="key",Gj="base58btc",MPe="z",RPe="K36",OPe=32,DPe=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),NPe=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Lp(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return NPe(t)}catch{return t}}function Su(t){return typeof t=="string"?t:DPe(t)||""}function Wj(t){return Lp(ji(Li(t,SE),Tee))}function o4(t){return ji(Li(Su(t),Tee),SE)}function kee(t){const e=Li(RPe,Gj),r=MPe+ji(M3([e,t]),Gj);return[PPe,kPe,r].join(TPe)}function BPe(t){return ji(t,SE)}function LPe(t){return Li(t,SE)}function FPe(t){return Li([o4(t.header),o4(t.payload)].join(s4),Pee)}function jPe(t){return[o4(t.header),o4(t.payload),BPe(t.signature)].join(s4)}function dI(t){const e=t.split(s4),r=Wj(e[0]),n=Wj(e[1]),i=LPe(e[2]),s=Li(e.slice(0,2).join(s4),Pee);return{header:r,payload:n,signature:i,data:s}}function Kj(t=Nh.randomBytes(OPe)){return LM.generateKeyPairFromSeed(t)}async function UPe(t,e,r,n,i=at.fromMiliseconds(Date.now())){const s={alg:_Pe,typ:IPe},o=kee(n.publicKey),a=i+r,c={iss:o,sub:t,aud:e,iat:i,exp:a},l=FPe({header:s,payload:c}),f=LM.sign(n.secretKey,l);return jPe({header:s,payload:c,signature:f})}const $Pe={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var qPe={};const VPe=":";function Vv(t){const[e,r]=t.split(VPe);return{namespace:e,reference:r}}function Yj(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function Mee(t,e){return t.includes(":")?[t]:e.chains||[]}var zPe=Object.defineProperty,Qj=Object.getOwnPropertySymbols,HPe=Object.prototype.hasOwnProperty,GPe=Object.prototype.propertyIsEnumerable,Jj=(t,e,r)=>e in t?zPe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zj=(t,e)=>{for(var r in e||(e={}))HPe.call(e,r)&&Jj(t,r,e[r]);if(Qj)for(var r of Qj(e))GPe.call(e,r)&&Jj(t,r,e[r]);return t};const WPe="ReactNative",la={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},KPe="js";function a4(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function jy(){return!kx()&&!!mM()&&navigator.product===WPe}function Lx(){return!a4()&&!!mM()&&!!kx()}function Fx(){return jy()?la.reactNative:a4()?la.node:Lx()?la.browser:la.unknown}function YPe(){var t;try{return jy()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function QPe(t,e){let r=Pw.parse(t);return r=Zj(Zj({},r),e),t=Pw.stringify(r),t}function Ree(){return IX()||{name:"",description:"",url:"",icons:[""]}}function JPe(){if(Fx()===la.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=W9e();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function ZPe(){var t;const e=Fx();return e===la.browser?[e,((t=_X())==null?void 0:t.host)||"unknown"].join(":"):e}function Oee(t,e,r){const n=JPe(),i=ZPe();return[[t,e].join("-"),[KPe,r].join("-"),n,i].join("/")}function XPe({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const c=r.split("?"),l=Oee(t,e,n),f={auth:i,ua:l,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},u=QPe(c[1]||"",f);return c[0]+"?"+u}function N0(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Dee(t){return Object.fromEntries(t.entries())}function Nee(t){return new Map(Object.entries(t))}function y0(t=at.FIVE_MINUTES,e){const r=at.toMiliseconds(t||at.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function zv(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Bee(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function eke(t){return Bee("topic",t)}function tke(t){return Bee("id",t)}function Lee(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Ei(t,e){return at.fromMiliseconds(Date.now()+at.toMiliseconds(t))}function ud(t){return Date.now()>=at.toMiliseconds(t)}function Er(t,e){return`${t}${e?`:${e}`:""}`}function R3(t=[],e=[]){return[...new Set([...t,...e])]}async function rke({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=nke(s,t,e),a=Fx();if(a===la.browser){if(!((n=kx())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,ske()?"_blank":"_self","noreferrer noopener")}else a===la.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function nke(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${oke(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function ike(t,e){let r="";try{if(Lx()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Xj(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function eU(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function FM(){return typeof process<"u"&&qPe.IS_VITEST==="true"}function ske(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function oke(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Fee(t){return Buffer.from(t,"base64").toString("utf-8")}const ake="https://rpc.walletconnect.org/v1";async function cke(t,e,r,n,i,s){switch(r.t){case"eip191":return lke(t,e,r.s);case"eip1271":return await fke(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function lke(t,e,r){return Z_e(RX(e),r).toLowerCase()===t.toLowerCase()}async function fke(t,e,r,n,i,s){const o=Vv(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",f=r.substring(2),u=RX(e).substring(2),p=a+u+c+l+f,g=await fetch(`${s||ake}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:uke(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:p},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function uke(){return Date.now()+Math.floor(Math.random()*1e3)}var dke=Object.defineProperty,hke=Object.defineProperties,pke=Object.getOwnPropertyDescriptors,tU=Object.getOwnPropertySymbols,vke=Object.prototype.hasOwnProperty,gke=Object.prototype.propertyIsEnumerable,rU=(t,e,r)=>e in t?dke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yke=(t,e)=>{for(var r in e||(e={}))vke.call(e,r)&&rU(t,r,e[r]);if(tU)for(var r of tU(e))gke.call(e,r)&&rU(t,r,e[r]);return t},mke=(t,e)=>hke(t,pke(e));const bke="did:pkh:",jM=t=>t==null?void 0:t.split(":"),wke=t=>{const e=t&&jM(t);if(e)return t.includes(bke)?e[3]:e[1]},hI=t=>{const e=t&&jM(t);if(e)return e[2]+":"+e[3]},c4=t=>{const e=t&&jM(t);if(e)return e.pop()};async function nU(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=jee(i,i.iss),o=c4(i.iss);return await cke(o,s,n,hI(i.iss),r)}const jee=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=c4(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${wke(e)}`,c=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.exp?`Expiration Time: ${t.exp}`:void 0,u=t.nbf?`Not Before: ${t.nbf}`:void 0,p=t.requestId?`Request ID: ${t.requestId}`:void 0,g=t.resources?`Resources:${t.resources.map(b=>` + */(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 s=!n&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=Si:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,c=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",l="0123456789abcdef".split(""),f=[31,7936,2031616,520093696],u=[4,1024,262144,67108864],p=[1,256,65536,16777216],g=[6,1536,393216,100663296],y=[0,8,16,24],b=[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],I=[224,256,384,512],C=[128,256],S=["hex","buffer","arrayBuffer","array","digest"],O={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(j){return Object.prototype.toString.call(j)==="[object Array]"}),c&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(j){return typeof j=="object"&&j.buffer&&j.buffer.constructor===ArrayBuffer});for(var L=function(j,X,G){return function(Z){return new k(j,X,j).update(Z)[G]()}},F=function(j,X,G){return function(Z,ee){return new k(j,X,ee).update(Z)[G]()}},z=function(j,X,G){return function(Z,ee,N,te){return v["cshake"+j].update(Z,ee,N,te)[G]()}},_=function(j,X,G){return function(Z,ee,N,te){return v["kmac"+j].update(Z,ee,N,te)[G]()}},$=function(j,X,G,Z){for(var ee=0;ee>5,this.byteCount=this.blockCount<<2,this.outputBlocks=G>>5,this.extraBytes=(G&31)>>3;for(var Z=0;Z<50;++Z)this.s[Z]=0}k.prototype.update=function(j){if(this.finalized)throw new Error(r);var X,G=typeof j;if(G!=="string"){if(G==="object"){if(j===null)throw new Error(e);if(c&&j.constructor===ArrayBuffer)j=new Uint8Array(j);else if(!Array.isArray(j)&&(!c||!ArrayBuffer.isView(j)))throw new Error(e)}else throw new Error(e);X=!0}for(var Z=this.blocks,ee=this.byteCount,N=j.length,te=this.blockCount,fe=0,Ee=this.s,_e,Re;fe>2]|=j[fe]<>2]|=Re<>2]|=(192|Re>>6)<>2]|=(128|Re&63)<=57344?(Z[_e>>2]|=(224|Re>>12)<>2]|=(128|Re>>6&63)<>2]|=(128|Re&63)<>2]|=(240|Re>>18)<>2]|=(128|Re>>12&63)<>2]|=(128|Re>>6&63)<>2]|=(128|Re&63)<=ee){for(this.start=_e-ee,this.block=Z[te],_e=0;_e>8,G=j&255;G>0;)ee.unshift(G),j=j>>8,G=j&255,++Z;return X?ee.push(Z):ee.unshift(Z),this.update(ee),ee.length},k.prototype.encodeString=function(j){var X,G=typeof j;if(G!=="string"){if(G==="object"){if(j===null)throw new Error(e);if(c&&j.constructor===ArrayBuffer)j=new Uint8Array(j);else if(!Array.isArray(j)&&(!c||!ArrayBuffer.isView(j)))throw new Error(e)}else throw new Error(e);X=!0}var Z=0,ee=j.length;if(X)Z=ee;else for(var N=0;N=57344?Z+=3:(te=65536+((te&1023)<<10|j.charCodeAt(++N)&1023),Z+=4)}return Z+=this.encode(Z*8),this.update(j),Z},k.prototype.bytepad=function(j,X){for(var G=this.encode(X),Z=0;Z>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(j[0]=j[G],X=1;X>4&15]+l[fe&15]+l[fe>>12&15]+l[fe>>8&15]+l[fe>>20&15]+l[fe>>16&15]+l[fe>>28&15]+l[fe>>24&15];N%j===0&&(oe(X),ee=0)}return Z&&(fe=X[ee],te+=l[fe>>4&15]+l[fe&15],Z>1&&(te+=l[fe>>12&15]+l[fe>>8&15]),Z>2&&(te+=l[fe>>20&15]+l[fe>>16&15])),te},k.prototype.arrayBuffer=function(){this.finalize();var j=this.blockCount,X=this.s,G=this.outputBlocks,Z=this.extraBytes,ee=0,N=0,te=this.outputBits>>3,fe;Z?fe=new ArrayBuffer(G+1<<2):fe=new ArrayBuffer(te);for(var Ee=new Uint32Array(fe);N>8&255,te[fe+2]=Ee>>16&255,te[fe+3]=Ee>>24&255;N%j===0&&oe(X)}return Z&&(fe=N<<2,Ee=X[ee],te[fe]=Ee&255,Z>1&&(te[fe+1]=Ee>>8&255),Z>2&&(te[fe+2]=Ee>>16&255)),te};function H(j,X,G){k.call(this,j,X,G)}H.prototype=new k,H.prototype.finalize=function(){return this.encode(this.outputBits,!0),k.prototype.finalize.call(this)};var oe=function(j){var X,G,Z,ee,N,te,fe,Ee,_e,Re,Te,De,ze,et,Je,ke,Ne,tt,Ze,st,nt,We,lt,vt,Ke,gt,wt,rt,It,At,Tt,Xt,lr,xt,ar,rr,kt,Dt,Nt,dt,Lt,Mt,ut,Vt,zt,ht,Et,Bt,He,$t,Ct,ct,Ht,Rr,Ut,Sr,er,kr,bi,wi,xi,Ti,Sn;for(Z=0;Z<48;Z+=2)ee=j[0]^j[10]^j[20]^j[30]^j[40],N=j[1]^j[11]^j[21]^j[31]^j[41],te=j[2]^j[12]^j[22]^j[32]^j[42],fe=j[3]^j[13]^j[23]^j[33]^j[43],Ee=j[4]^j[14]^j[24]^j[34]^j[44],_e=j[5]^j[15]^j[25]^j[35]^j[45],Re=j[6]^j[16]^j[26]^j[36]^j[46],Te=j[7]^j[17]^j[27]^j[37]^j[47],De=j[8]^j[18]^j[28]^j[38]^j[48],ze=j[9]^j[19]^j[29]^j[39]^j[49],X=De^(te<<1|fe>>>31),G=ze^(fe<<1|te>>>31),j[0]^=X,j[1]^=G,j[10]^=X,j[11]^=G,j[20]^=X,j[21]^=G,j[30]^=X,j[31]^=G,j[40]^=X,j[41]^=G,X=ee^(Ee<<1|_e>>>31),G=N^(_e<<1|Ee>>>31),j[2]^=X,j[3]^=G,j[12]^=X,j[13]^=G,j[22]^=X,j[23]^=G,j[32]^=X,j[33]^=G,j[42]^=X,j[43]^=G,X=te^(Re<<1|Te>>>31),G=fe^(Te<<1|Re>>>31),j[4]^=X,j[5]^=G,j[14]^=X,j[15]^=G,j[24]^=X,j[25]^=G,j[34]^=X,j[35]^=G,j[44]^=X,j[45]^=G,X=Ee^(De<<1|ze>>>31),G=_e^(ze<<1|De>>>31),j[6]^=X,j[7]^=G,j[16]^=X,j[17]^=G,j[26]^=X,j[27]^=G,j[36]^=X,j[37]^=G,j[46]^=X,j[47]^=G,X=Re^(ee<<1|N>>>31),G=Te^(N<<1|ee>>>31),j[8]^=X,j[9]^=G,j[18]^=X,j[19]^=G,j[28]^=X,j[29]^=G,j[38]^=X,j[39]^=G,j[48]^=X,j[49]^=G,et=j[0],Je=j[1],ht=j[11]<<4|j[10]>>>28,Et=j[10]<<4|j[11]>>>28,rt=j[20]<<3|j[21]>>>29,It=j[21]<<3|j[20]>>>29,wi=j[31]<<9|j[30]>>>23,xi=j[30]<<9|j[31]>>>23,Mt=j[40]<<18|j[41]>>>14,ut=j[41]<<18|j[40]>>>14,xt=j[2]<<1|j[3]>>>31,ar=j[3]<<1|j[2]>>>31,ke=j[13]<<12|j[12]>>>20,Ne=j[12]<<12|j[13]>>>20,Bt=j[22]<<10|j[23]>>>22,He=j[23]<<10|j[22]>>>22,At=j[33]<<13|j[32]>>>19,Tt=j[32]<<13|j[33]>>>19,Ti=j[42]<<2|j[43]>>>30,Sn=j[43]<<2|j[42]>>>30,Rr=j[5]<<30|j[4]>>>2,Ut=j[4]<<30|j[5]>>>2,rr=j[14]<<6|j[15]>>>26,kt=j[15]<<6|j[14]>>>26,tt=j[25]<<11|j[24]>>>21,Ze=j[24]<<11|j[25]>>>21,$t=j[34]<<15|j[35]>>>17,Ct=j[35]<<15|j[34]>>>17,Xt=j[45]<<29|j[44]>>>3,lr=j[44]<<29|j[45]>>>3,vt=j[6]<<28|j[7]>>>4,Ke=j[7]<<28|j[6]>>>4,Sr=j[17]<<23|j[16]>>>9,er=j[16]<<23|j[17]>>>9,Dt=j[26]<<25|j[27]>>>7,Nt=j[27]<<25|j[26]>>>7,st=j[36]<<21|j[37]>>>11,nt=j[37]<<21|j[36]>>>11,ct=j[47]<<24|j[46]>>>8,Ht=j[46]<<24|j[47]>>>8,Vt=j[8]<<27|j[9]>>>5,zt=j[9]<<27|j[8]>>>5,gt=j[18]<<20|j[19]>>>12,wt=j[19]<<20|j[18]>>>12,kr=j[29]<<7|j[28]>>>25,bi=j[28]<<7|j[29]>>>25,dt=j[38]<<8|j[39]>>>24,Lt=j[39]<<8|j[38]>>>24,We=j[48]<<14|j[49]>>>18,lt=j[49]<<14|j[48]>>>18,j[0]=et^~ke&tt,j[1]=Je^~Ne&Ze,j[10]=vt^~gt&rt,j[11]=Ke^~wt&It,j[20]=xt^~rr&Dt,j[21]=ar^~kt&Nt,j[30]=Vt^~ht&Bt,j[31]=zt^~Et&He,j[40]=Rr^~Sr&kr,j[41]=Ut^~er&bi,j[2]=ke^~tt&st,j[3]=Ne^~Ze&nt,j[12]=gt^~rt&At,j[13]=wt^~It&Tt,j[22]=rr^~Dt&dt,j[23]=kt^~Nt&Lt,j[32]=ht^~Bt&$t,j[33]=Et^~He&Ct,j[42]=Sr^~kr&wi,j[43]=er^~bi&xi,j[4]=tt^~st&We,j[5]=Ze^~nt<,j[14]=rt^~At&Xt,j[15]=It^~Tt&lr,j[24]=Dt^~dt&Mt,j[25]=Nt^~Lt&ut,j[34]=Bt^~$t&ct,j[35]=He^~Ct&Ht,j[44]=kr^~wi&Ti,j[45]=bi^~xi&Sn,j[6]=st^~We&et,j[7]=nt^~lt&Je,j[16]=At^~Xt&vt,j[17]=Tt^~lr&Ke,j[26]=dt^~Mt&xt,j[27]=Lt^~ut&ar,j[36]=$t^~ct&Vt,j[37]=Ct^~Ht&zt,j[46]=wi^~Ti&Rr,j[47]=xi^~Sn&Ut,j[8]=We^~et&ke,j[9]=lt^~Je&Ne,j[18]=Xt^~vt>,j[19]=lr^~Ke&wt,j[28]=Mt^~xt&rr,j[29]=ut^~ar&kt,j[38]=ct^~Vt&ht,j[39]=Ht^~zt&Et,j[48]=Ti^~Rr&Sr,j[49]=Sn^~Ut&er,j[0]^=b[Z],j[1]^=b[Z+1]};if(a)t.exports=v;else for(R=0;R{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 Ej=WSe();var eI;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(eI||(eI={}));var Dc;(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"})(Dc||(Dc={}));const Cj="0123456789abcdef";class En{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();T3[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(xj>T3[n])&&console.log.apply(console,r)}debug(...e){this._log(En.levels.DEBUG,e)}info(...e){this._log(En.levels.INFO,e)}warn(...e){this._log(En.levels.WARNING,e)}makeError(e,r,n){if(wj)return this.makeError("censored error",r,{});r||(r=En.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(c=>{const l=n[c];try{if(l instanceof Uint8Array){let f="";for(let u=0;u>4],f+=Cj[l[u]&15];i.push(c+"=Uint8Array(0x"+f+")")}else i.push(c+"="+JSON.stringify(l))}catch{i.push(c+"="+JSON.stringify(n[c].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let o="";switch(r){case Dc.NUMERIC_FAULT:{o="NUMERIC_FAULT";const c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":o+="-"+c;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Dc.CALL_EXCEPTION:case Dc.INSUFFICIENT_FUNDS:case Dc.MISSING_NEW:case Dc.NONCE_EXPIRED:case Dc.REPLACEMENT_UNDERPRICED:case Dc.TRANSACTION_REPLACED:case Dc.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(n).forEach(function(c){a[c]=n[c]}),a}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,En.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){Ej&&this.throwError("platform missing String.prototype.normalize",En.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Ej})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,En.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,En.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,En.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",En.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",En.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",En.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return O9||(O9=new En(GSe)),O9}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",En.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bj){if(!e)return;this.globalLogger().throwError("error censorship permanent",En.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}wj=!!e,bj=!!r}static setLogLevel(e){const r=T3[e.toLowerCase()];if(r==null){En.globalLogger().warn("invalid log level - "+e);return}xj=r}static from(e){return new En(e)}}En.errors=Dc;En.levels=eI;const KSe="bytes/5.7.0",ri=new En(KSe);function kX(t){return!!t.toHexString}function $v(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return $v(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function YSe(t){return Vl(t)&&!(t.length%2)||wM(t)}function Aj(t){return typeof t=="number"&&t==t&&t%1===0}function wM(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!Aj(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function gi(t,e){if(e||(e={}),typeof t=="number"){ri.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),$v(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kX(t)&&(t=t.toHexString()),Vl(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":ri.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;igi(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),$v(n)}function JSe(t,e){t=gi(t),t.length>e&&ri.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),$v(r)}function Vl(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const D9="0123456789abcdef";function ia(t,e){if(e||(e={}),typeof t=="number"){ri.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=D9[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),kX(t))return t.toHexString();if(Vl(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":ri.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(wM(t)){let r="0x";for(let n=0;n>4]+D9[i&15]}return r}return ri.throwArgumentError("invalid hexlify value","value",t)}function ZSe(t){if(typeof t!="string")t=ia(t);else if(!Vl(t)||t.length%2)return null;return(t.length-2)/2}function Sj(t,e,r){return typeof t!="string"?t=ia(t):(!Vl(t)||t.length%2)&&ri.throwArgumentError("invalid hexData","value",t),e=2+2*e,"0x"+t.substring(e)}function qv(t,e){for(typeof t!="string"?t=ia(t):Vl(t)||ri.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&ri.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function MX(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(YSe(t)){let r=gi(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=ia(r.slice(0,32)),e.s=ia(r.slice(32,64))):r.length===65?(e.r=ia(r.slice(0,32)),e.s=ia(r.slice(32,64)),e.v=r[64]):ri.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:ri.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=ia(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=JSe(gi(e._vs),32);e._vs=ia(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&ri.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const o=ia(i);e.s==null?e.s=o:e.s!==o&&ri.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?ri.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&&ri.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Vl(e.r)?ri.throwArgumentError("signature missing or invalid r","signature",t):e.r=qv(e.r,32),e.s==null||!Vl(e.s)?ri.throwArgumentError("signature missing or invalid s","signature",t):e.s=qv(e.s,32);const r=gi(e.s);r[0]>=128&&ri.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=ia(r);e._vs&&(Vl(e._vs)||ri.throwArgumentError("signature invalid _vs","signature",t),e._vs=qv(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&ri.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function xM(t){return"0x"+HSe.keccak_256(gi(t))}var EM={exports:{}};const XSe={},e7e=Object.freeze(Object.defineProperty({__proto__:null,default:XSe},Symbol.toStringTag,{value:"Module"})),aE=V$(e7e);EM.exports;(function(t){(function(e,r){function n(M,v){if(!M)throw new Error(v||"Assertion failed")}function i(M,v){M.super_=v;var m=function(){};m.prototype=v.prototype,M.prototype=new m,M.prototype.constructor=M}function s(M,v,m){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&((v==="le"||v==="be")&&(m=v,v=10),this._init(M||0,v||10,m||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=aE.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,m){return v.cmp(m)>0?v:m},s.min=function(v,m){return v.cmp(m)<0?v:m},s.prototype._init=function(v,m,R){if(typeof v=="number")return this._initNumber(v,m,R);if(typeof v=="object")return this._initArray(v,m,R);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),v=v.toString().replace(/\s+/g,"");var B=0;v[0]==="-"&&(B++,this.negative=1),B=0;B-=3)x=v[B]|v[B-1]<<8|v[B-2]<<16,this.words[E]|=x<>>26-w&67108863,w+=24,w>=26&&(w-=26,E++);else if(R==="le")for(B=0,E=0;B>>26-w&67108863,w+=24,w>=26&&(w-=26,E++);return this._strip()};function a(M,v){var m=M.charCodeAt(v);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 "+M)}function c(M,v,m){var R=a(M,m);return m-1>=v&&(R|=a(M,m-1)<<4),R}s.prototype._parseHex=function(v,m,R){this.length=Math.ceil((v.length-m)/6),this.words=new Array(this.length);for(var B=0;B=m;B-=2)w=c(v,m,B)<=18?(E-=18,x+=1,this.words[x]|=w>>>26):E+=8;else{var T=v.length-m;for(B=T%2===0?m+1:m;B=18?(E-=18,x+=1,this.words[x]|=w>>>26):E+=8}this._strip()};function l(M,v,m,R){for(var B=0,E=0,x=Math.min(M.length,m),w=v;w=49?E=T-49+10:T>=17?E=T-17+10:E=T,n(T>=0&&E1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){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"],g=[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],y=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(v,m){v=v||10,m=m|0||1;var R;if(v===16||v==="hex"){R="";for(var B=0,E=0,x=0;x>>24-B&16777215,B+=2,B>=26&&(B-=26,x--),E!==0||x!==this.length-1?R=p[6-T.length]+T+R:R=T+R}for(E!==0&&(R=E.toString(16)+R);R.length%m!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}if(v===(v|0)&&v>=2&&v<=36){var k=g[v],H=y[v];R="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var j=oe.modrn(H).toString(v);oe=oe.idivn(H),oe.isZero()?R=j+R:R=p[k-j.length]+j+R}for(this.isZero()&&(R="0"+R);R.length%m!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,m){return this.toArrayLike(o,v,m)}),s.prototype.toArray=function(v,m){return this.toArrayLike(Array,v,m)};var b=function(v,m){return v.allocUnsafe?v.allocUnsafe(m):new v(m)};s.prototype.toArrayLike=function(v,m,R){this._strip();var B=this.byteLength(),E=R||Math.max(1,B);n(B<=E,"byte array longer than desired length"),n(E>0,"Requested array length <= 0");var x=b(v,E),w=m==="le"?"LE":"BE";return this["_toArrayLike"+w](x,B),x},s.prototype._toArrayLikeLE=function(v,m){for(var R=0,B=0,E=0,x=0;E>8&255),R>16&255),x===6?(R>24&255),B=0,x=0):(B=w>>>24,x+=2)}if(R=0&&(v[R--]=w>>8&255),R>=0&&(v[R--]=w>>16&255),x===6?(R>=0&&(v[R--]=w>>24&255),B=0,x=0):(B=w>>>24,x+=2)}if(R>=0)for(v[R--]=B;R>=0;)v[R--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var m=v,R=0;return m>=4096&&(R+=13,m>>>=13),m>=64&&(R+=7,m>>>=7),m>=8&&(R+=4,m>>>=4),m>=2&&(R+=2,m>>>=2),R+m},s.prototype._zeroBits=function(v){if(v===0)return 26;var m=v,R=0;return m&8191||(R+=13,m>>>=13),m&127||(R+=7,m>>>=7),m&15||(R+=4,m>>>=4),m&3||(R+=2,m>>>=2),m&1||R++,R},s.prototype.bitLength=function(){var v=this.words[this.length-1],m=this._countBits(v);return(this.length-1)*26+m};function I(M){for(var v=new Array(M.bitLength()),m=0;m>>B&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,m=0;mv.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var m;this.length>v.length?m=v:m=this;for(var R=0;Rv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var m,R;this.length>v.length?(m=this,R=v):(m=v,R=this);for(var B=0;Bv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){n(typeof v=="number"&&v>=0);var m=Math.ceil(v/26)|0,R=v%26;this._expand(m),R>0&&m--;for(var B=0;B0&&(this.words[B]=~this.words[B]&67108863>>26-R),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,m){n(typeof v=="number"&&v>=0);var R=v/26|0,B=v%26;return this._expand(R+1),m?this.words[R]=this.words[R]|1<v.length?(R=this,B=v):(R=v,B=this);for(var E=0,x=0;x>>26;for(;E!==0&&x>>26;if(this.length=R.length,E!==0)this.words[this.length]=E,this.length++;else if(R!==this)for(;xv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var m=this.iadd(v);return v.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var R=this.cmp(v);if(R===0)return this.negative=0,this.length=1,this.words[0]=0,this;var B,E;R>0?(B=this,E=v):(B=v,E=this);for(var x=0,w=0;w>26,this.words[w]=m&67108863;for(;x!==0&&w>26,this.words[w]=m&67108863;if(x===0&&w>>26,oe=T&67108863,j=Math.min(k,v.length-1),X=Math.max(0,k-M.length+1);X<=j;X++){var G=k-X|0;B=M.words[G]|0,E=v.words[X]|0,x=B*E+oe,H+=x/67108864|0,oe=x&67108863}m.words[k]=oe|0,T=H|0}return T!==0?m.words[k]=T|0:m.length--,m._strip()}var S=function(v,m,R){var B=v.words,E=m.words,x=R.words,w=0,T,k,H,oe=B[0]|0,j=oe&8191,X=oe>>>13,G=B[1]|0,Z=G&8191,ee=G>>>13,N=B[2]|0,te=N&8191,fe=N>>>13,Ee=B[3]|0,_e=Ee&8191,Re=Ee>>>13,Te=B[4]|0,De=Te&8191,ze=Te>>>13,et=B[5]|0,Je=et&8191,ke=et>>>13,Ne=B[6]|0,tt=Ne&8191,Ze=Ne>>>13,st=B[7]|0,nt=st&8191,We=st>>>13,lt=B[8]|0,vt=lt&8191,Ke=lt>>>13,gt=B[9]|0,wt=gt&8191,rt=gt>>>13,It=E[0]|0,At=It&8191,Tt=It>>>13,Xt=E[1]|0,lr=Xt&8191,xt=Xt>>>13,ar=E[2]|0,rr=ar&8191,kt=ar>>>13,Dt=E[3]|0,Nt=Dt&8191,dt=Dt>>>13,Lt=E[4]|0,Mt=Lt&8191,ut=Lt>>>13,Vt=E[5]|0,zt=Vt&8191,ht=Vt>>>13,Et=E[6]|0,Bt=Et&8191,He=Et>>>13,$t=E[7]|0,Ct=$t&8191,ct=$t>>>13,Ht=E[8]|0,Rr=Ht&8191,Ut=Ht>>>13,Sr=E[9]|0,er=Sr&8191,kr=Sr>>>13;R.negative=v.negative^m.negative,R.length=19,T=Math.imul(j,At),k=Math.imul(j,Tt),k=k+Math.imul(X,At)|0,H=Math.imul(X,Tt);var bi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(bi>>>26)|0,bi&=67108863,T=Math.imul(Z,At),k=Math.imul(Z,Tt),k=k+Math.imul(ee,At)|0,H=Math.imul(ee,Tt),T=T+Math.imul(j,lr)|0,k=k+Math.imul(j,xt)|0,k=k+Math.imul(X,lr)|0,H=H+Math.imul(X,xt)|0;var wi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(wi>>>26)|0,wi&=67108863,T=Math.imul(te,At),k=Math.imul(te,Tt),k=k+Math.imul(fe,At)|0,H=Math.imul(fe,Tt),T=T+Math.imul(Z,lr)|0,k=k+Math.imul(Z,xt)|0,k=k+Math.imul(ee,lr)|0,H=H+Math.imul(ee,xt)|0,T=T+Math.imul(j,rr)|0,k=k+Math.imul(j,kt)|0,k=k+Math.imul(X,rr)|0,H=H+Math.imul(X,kt)|0;var xi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(xi>>>26)|0,xi&=67108863,T=Math.imul(_e,At),k=Math.imul(_e,Tt),k=k+Math.imul(Re,At)|0,H=Math.imul(Re,Tt),T=T+Math.imul(te,lr)|0,k=k+Math.imul(te,xt)|0,k=k+Math.imul(fe,lr)|0,H=H+Math.imul(fe,xt)|0,T=T+Math.imul(Z,rr)|0,k=k+Math.imul(Z,kt)|0,k=k+Math.imul(ee,rr)|0,H=H+Math.imul(ee,kt)|0,T=T+Math.imul(j,Nt)|0,k=k+Math.imul(j,dt)|0,k=k+Math.imul(X,Nt)|0,H=H+Math.imul(X,dt)|0;var Ti=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,T=Math.imul(De,At),k=Math.imul(De,Tt),k=k+Math.imul(ze,At)|0,H=Math.imul(ze,Tt),T=T+Math.imul(_e,lr)|0,k=k+Math.imul(_e,xt)|0,k=k+Math.imul(Re,lr)|0,H=H+Math.imul(Re,xt)|0,T=T+Math.imul(te,rr)|0,k=k+Math.imul(te,kt)|0,k=k+Math.imul(fe,rr)|0,H=H+Math.imul(fe,kt)|0,T=T+Math.imul(Z,Nt)|0,k=k+Math.imul(Z,dt)|0,k=k+Math.imul(ee,Nt)|0,H=H+Math.imul(ee,dt)|0,T=T+Math.imul(j,Mt)|0,k=k+Math.imul(j,ut)|0,k=k+Math.imul(X,Mt)|0,H=H+Math.imul(X,ut)|0;var Sn=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,T=Math.imul(Je,At),k=Math.imul(Je,Tt),k=k+Math.imul(ke,At)|0,H=Math.imul(ke,Tt),T=T+Math.imul(De,lr)|0,k=k+Math.imul(De,xt)|0,k=k+Math.imul(ze,lr)|0,H=H+Math.imul(ze,xt)|0,T=T+Math.imul(_e,rr)|0,k=k+Math.imul(_e,kt)|0,k=k+Math.imul(Re,rr)|0,H=H+Math.imul(Re,kt)|0,T=T+Math.imul(te,Nt)|0,k=k+Math.imul(te,dt)|0,k=k+Math.imul(fe,Nt)|0,H=H+Math.imul(fe,dt)|0,T=T+Math.imul(Z,Mt)|0,k=k+Math.imul(Z,ut)|0,k=k+Math.imul(ee,Mt)|0,H=H+Math.imul(ee,ut)|0,T=T+Math.imul(j,zt)|0,k=k+Math.imul(j,ht)|0,k=k+Math.imul(X,zt)|0,H=H+Math.imul(X,ht)|0;var di=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(di>>>26)|0,di&=67108863,T=Math.imul(tt,At),k=Math.imul(tt,Tt),k=k+Math.imul(Ze,At)|0,H=Math.imul(Ze,Tt),T=T+Math.imul(Je,lr)|0,k=k+Math.imul(Je,xt)|0,k=k+Math.imul(ke,lr)|0,H=H+Math.imul(ke,xt)|0,T=T+Math.imul(De,rr)|0,k=k+Math.imul(De,kt)|0,k=k+Math.imul(ze,rr)|0,H=H+Math.imul(ze,kt)|0,T=T+Math.imul(_e,Nt)|0,k=k+Math.imul(_e,dt)|0,k=k+Math.imul(Re,Nt)|0,H=H+Math.imul(Re,dt)|0,T=T+Math.imul(te,Mt)|0,k=k+Math.imul(te,ut)|0,k=k+Math.imul(fe,Mt)|0,H=H+Math.imul(fe,ut)|0,T=T+Math.imul(Z,zt)|0,k=k+Math.imul(Z,ht)|0,k=k+Math.imul(ee,zt)|0,H=H+Math.imul(ee,ht)|0,T=T+Math.imul(j,Bt)|0,k=k+Math.imul(j,He)|0,k=k+Math.imul(X,Bt)|0,H=H+Math.imul(X,He)|0;var Fs=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Fs>>>26)|0,Fs&=67108863,T=Math.imul(nt,At),k=Math.imul(nt,Tt),k=k+Math.imul(We,At)|0,H=Math.imul(We,Tt),T=T+Math.imul(tt,lr)|0,k=k+Math.imul(tt,xt)|0,k=k+Math.imul(Ze,lr)|0,H=H+Math.imul(Ze,xt)|0,T=T+Math.imul(Je,rr)|0,k=k+Math.imul(Je,kt)|0,k=k+Math.imul(ke,rr)|0,H=H+Math.imul(ke,kt)|0,T=T+Math.imul(De,Nt)|0,k=k+Math.imul(De,dt)|0,k=k+Math.imul(ze,Nt)|0,H=H+Math.imul(ze,dt)|0,T=T+Math.imul(_e,Mt)|0,k=k+Math.imul(_e,ut)|0,k=k+Math.imul(Re,Mt)|0,H=H+Math.imul(Re,ut)|0,T=T+Math.imul(te,zt)|0,k=k+Math.imul(te,ht)|0,k=k+Math.imul(fe,zt)|0,H=H+Math.imul(fe,ht)|0,T=T+Math.imul(Z,Bt)|0,k=k+Math.imul(Z,He)|0,k=k+Math.imul(ee,Bt)|0,H=H+Math.imul(ee,He)|0,T=T+Math.imul(j,Ct)|0,k=k+Math.imul(j,ct)|0,k=k+Math.imul(X,Ct)|0,H=H+Math.imul(X,ct)|0;var hi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(hi>>>26)|0,hi&=67108863,T=Math.imul(vt,At),k=Math.imul(vt,Tt),k=k+Math.imul(Ke,At)|0,H=Math.imul(Ke,Tt),T=T+Math.imul(nt,lr)|0,k=k+Math.imul(nt,xt)|0,k=k+Math.imul(We,lr)|0,H=H+Math.imul(We,xt)|0,T=T+Math.imul(tt,rr)|0,k=k+Math.imul(tt,kt)|0,k=k+Math.imul(Ze,rr)|0,H=H+Math.imul(Ze,kt)|0,T=T+Math.imul(Je,Nt)|0,k=k+Math.imul(Je,dt)|0,k=k+Math.imul(ke,Nt)|0,H=H+Math.imul(ke,dt)|0,T=T+Math.imul(De,Mt)|0,k=k+Math.imul(De,ut)|0,k=k+Math.imul(ze,Mt)|0,H=H+Math.imul(ze,ut)|0,T=T+Math.imul(_e,zt)|0,k=k+Math.imul(_e,ht)|0,k=k+Math.imul(Re,zt)|0,H=H+Math.imul(Re,ht)|0,T=T+Math.imul(te,Bt)|0,k=k+Math.imul(te,He)|0,k=k+Math.imul(fe,Bt)|0,H=H+Math.imul(fe,He)|0,T=T+Math.imul(Z,Ct)|0,k=k+Math.imul(Z,ct)|0,k=k+Math.imul(ee,Ct)|0,H=H+Math.imul(ee,ct)|0,T=T+Math.imul(j,Rr)|0,k=k+Math.imul(j,Ut)|0,k=k+Math.imul(X,Rr)|0,H=H+Math.imul(X,Ut)|0;var jo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(jo>>>26)|0,jo&=67108863,T=Math.imul(wt,At),k=Math.imul(wt,Tt),k=k+Math.imul(rt,At)|0,H=Math.imul(rt,Tt),T=T+Math.imul(vt,lr)|0,k=k+Math.imul(vt,xt)|0,k=k+Math.imul(Ke,lr)|0,H=H+Math.imul(Ke,xt)|0,T=T+Math.imul(nt,rr)|0,k=k+Math.imul(nt,kt)|0,k=k+Math.imul(We,rr)|0,H=H+Math.imul(We,kt)|0,T=T+Math.imul(tt,Nt)|0,k=k+Math.imul(tt,dt)|0,k=k+Math.imul(Ze,Nt)|0,H=H+Math.imul(Ze,dt)|0,T=T+Math.imul(Je,Mt)|0,k=k+Math.imul(Je,ut)|0,k=k+Math.imul(ke,Mt)|0,H=H+Math.imul(ke,ut)|0,T=T+Math.imul(De,zt)|0,k=k+Math.imul(De,ht)|0,k=k+Math.imul(ze,zt)|0,H=H+Math.imul(ze,ht)|0,T=T+Math.imul(_e,Bt)|0,k=k+Math.imul(_e,He)|0,k=k+Math.imul(Re,Bt)|0,H=H+Math.imul(Re,He)|0,T=T+Math.imul(te,Ct)|0,k=k+Math.imul(te,ct)|0,k=k+Math.imul(fe,Ct)|0,H=H+Math.imul(fe,ct)|0,T=T+Math.imul(Z,Rr)|0,k=k+Math.imul(Z,Ut)|0,k=k+Math.imul(ee,Rr)|0,H=H+Math.imul(ee,Ut)|0,T=T+Math.imul(j,er)|0,k=k+Math.imul(j,kr)|0,k=k+Math.imul(X,er)|0,H=H+Math.imul(X,kr)|0;var Uo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Uo>>>26)|0,Uo&=67108863,T=Math.imul(wt,lr),k=Math.imul(wt,xt),k=k+Math.imul(rt,lr)|0,H=Math.imul(rt,xt),T=T+Math.imul(vt,rr)|0,k=k+Math.imul(vt,kt)|0,k=k+Math.imul(Ke,rr)|0,H=H+Math.imul(Ke,kt)|0,T=T+Math.imul(nt,Nt)|0,k=k+Math.imul(nt,dt)|0,k=k+Math.imul(We,Nt)|0,H=H+Math.imul(We,dt)|0,T=T+Math.imul(tt,Mt)|0,k=k+Math.imul(tt,ut)|0,k=k+Math.imul(Ze,Mt)|0,H=H+Math.imul(Ze,ut)|0,T=T+Math.imul(Je,zt)|0,k=k+Math.imul(Je,ht)|0,k=k+Math.imul(ke,zt)|0,H=H+Math.imul(ke,ht)|0,T=T+Math.imul(De,Bt)|0,k=k+Math.imul(De,He)|0,k=k+Math.imul(ze,Bt)|0,H=H+Math.imul(ze,He)|0,T=T+Math.imul(_e,Ct)|0,k=k+Math.imul(_e,ct)|0,k=k+Math.imul(Re,Ct)|0,H=H+Math.imul(Re,ct)|0,T=T+Math.imul(te,Rr)|0,k=k+Math.imul(te,Ut)|0,k=k+Math.imul(fe,Rr)|0,H=H+Math.imul(fe,Ut)|0,T=T+Math.imul(Z,er)|0,k=k+Math.imul(Z,kr)|0,k=k+Math.imul(ee,er)|0,H=H+Math.imul(ee,kr)|0;var pi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(pi>>>26)|0,pi&=67108863,T=Math.imul(wt,rr),k=Math.imul(wt,kt),k=k+Math.imul(rt,rr)|0,H=Math.imul(rt,kt),T=T+Math.imul(vt,Nt)|0,k=k+Math.imul(vt,dt)|0,k=k+Math.imul(Ke,Nt)|0,H=H+Math.imul(Ke,dt)|0,T=T+Math.imul(nt,Mt)|0,k=k+Math.imul(nt,ut)|0,k=k+Math.imul(We,Mt)|0,H=H+Math.imul(We,ut)|0,T=T+Math.imul(tt,zt)|0,k=k+Math.imul(tt,ht)|0,k=k+Math.imul(Ze,zt)|0,H=H+Math.imul(Ze,ht)|0,T=T+Math.imul(Je,Bt)|0,k=k+Math.imul(Je,He)|0,k=k+Math.imul(ke,Bt)|0,H=H+Math.imul(ke,He)|0,T=T+Math.imul(De,Ct)|0,k=k+Math.imul(De,ct)|0,k=k+Math.imul(ze,Ct)|0,H=H+Math.imul(ze,ct)|0,T=T+Math.imul(_e,Rr)|0,k=k+Math.imul(_e,Ut)|0,k=k+Math.imul(Re,Rr)|0,H=H+Math.imul(Re,Ut)|0,T=T+Math.imul(te,er)|0,k=k+Math.imul(te,kr)|0,k=k+Math.imul(fe,er)|0,H=H+Math.imul(fe,kr)|0;var oo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(oo>>>26)|0,oo&=67108863,T=Math.imul(wt,Nt),k=Math.imul(wt,dt),k=k+Math.imul(rt,Nt)|0,H=Math.imul(rt,dt),T=T+Math.imul(vt,Mt)|0,k=k+Math.imul(vt,ut)|0,k=k+Math.imul(Ke,Mt)|0,H=H+Math.imul(Ke,ut)|0,T=T+Math.imul(nt,zt)|0,k=k+Math.imul(nt,ht)|0,k=k+Math.imul(We,zt)|0,H=H+Math.imul(We,ht)|0,T=T+Math.imul(tt,Bt)|0,k=k+Math.imul(tt,He)|0,k=k+Math.imul(Ze,Bt)|0,H=H+Math.imul(Ze,He)|0,T=T+Math.imul(Je,Ct)|0,k=k+Math.imul(Je,ct)|0,k=k+Math.imul(ke,Ct)|0,H=H+Math.imul(ke,ct)|0,T=T+Math.imul(De,Rr)|0,k=k+Math.imul(De,Ut)|0,k=k+Math.imul(ze,Rr)|0,H=H+Math.imul(ze,Ut)|0,T=T+Math.imul(_e,er)|0,k=k+Math.imul(_e,kr)|0,k=k+Math.imul(Re,er)|0,H=H+Math.imul(Re,kr)|0;var ao=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(ao>>>26)|0,ao&=67108863,T=Math.imul(wt,Mt),k=Math.imul(wt,ut),k=k+Math.imul(rt,Mt)|0,H=Math.imul(rt,ut),T=T+Math.imul(vt,zt)|0,k=k+Math.imul(vt,ht)|0,k=k+Math.imul(Ke,zt)|0,H=H+Math.imul(Ke,ht)|0,T=T+Math.imul(nt,Bt)|0,k=k+Math.imul(nt,He)|0,k=k+Math.imul(We,Bt)|0,H=H+Math.imul(We,He)|0,T=T+Math.imul(tt,Ct)|0,k=k+Math.imul(tt,ct)|0,k=k+Math.imul(Ze,Ct)|0,H=H+Math.imul(Ze,ct)|0,T=T+Math.imul(Je,Rr)|0,k=k+Math.imul(Je,Ut)|0,k=k+Math.imul(ke,Rr)|0,H=H+Math.imul(ke,Ut)|0,T=T+Math.imul(De,er)|0,k=k+Math.imul(De,kr)|0,k=k+Math.imul(ze,er)|0,H=H+Math.imul(ze,kr)|0;var _n=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(_n>>>26)|0,_n&=67108863,T=Math.imul(wt,zt),k=Math.imul(wt,ht),k=k+Math.imul(rt,zt)|0,H=Math.imul(rt,ht),T=T+Math.imul(vt,Bt)|0,k=k+Math.imul(vt,He)|0,k=k+Math.imul(Ke,Bt)|0,H=H+Math.imul(Ke,He)|0,T=T+Math.imul(nt,Ct)|0,k=k+Math.imul(nt,ct)|0,k=k+Math.imul(We,Ct)|0,H=H+Math.imul(We,ct)|0,T=T+Math.imul(tt,Rr)|0,k=k+Math.imul(tt,Ut)|0,k=k+Math.imul(Ze,Rr)|0,H=H+Math.imul(Ze,Ut)|0,T=T+Math.imul(Je,er)|0,k=k+Math.imul(Je,kr)|0,k=k+Math.imul(ke,er)|0,H=H+Math.imul(ke,kr)|0;var $o=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+($o>>>26)|0,$o&=67108863,T=Math.imul(wt,Bt),k=Math.imul(wt,He),k=k+Math.imul(rt,Bt)|0,H=Math.imul(rt,He),T=T+Math.imul(vt,Ct)|0,k=k+Math.imul(vt,ct)|0,k=k+Math.imul(Ke,Ct)|0,H=H+Math.imul(Ke,ct)|0,T=T+Math.imul(nt,Rr)|0,k=k+Math.imul(nt,Ut)|0,k=k+Math.imul(We,Rr)|0,H=H+Math.imul(We,Ut)|0,T=T+Math.imul(tt,er)|0,k=k+Math.imul(tt,kr)|0,k=k+Math.imul(Ze,er)|0,H=H+Math.imul(Ze,kr)|0;var Gi=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,T=Math.imul(wt,Ct),k=Math.imul(wt,ct),k=k+Math.imul(rt,Ct)|0,H=Math.imul(rt,ct),T=T+Math.imul(vt,Rr)|0,k=k+Math.imul(vt,Ut)|0,k=k+Math.imul(Ke,Rr)|0,H=H+Math.imul(Ke,Ut)|0,T=T+Math.imul(nt,er)|0,k=k+Math.imul(nt,kr)|0,k=k+Math.imul(We,er)|0,H=H+Math.imul(We,kr)|0;var qo=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(qo>>>26)|0,qo&=67108863,T=Math.imul(wt,Rr),k=Math.imul(wt,Ut),k=k+Math.imul(rt,Rr)|0,H=Math.imul(rt,Ut),T=T+Math.imul(vt,er)|0,k=k+Math.imul(vt,kr)|0,k=k+Math.imul(Ke,er)|0,H=H+Math.imul(Ke,kr)|0;var Ca=(w+T|0)+((k&8191)<<13)|0;w=(H+(k>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,T=Math.imul(wt,er),k=Math.imul(wt,kr),k=k+Math.imul(rt,er)|0,H=Math.imul(rt,kr);var co=(w+T|0)+((k&8191)<<13)|0;return w=(H+(k>>>13)|0)+(co>>>26)|0,co&=67108863,x[0]=bi,x[1]=wi,x[2]=xi,x[3]=Ti,x[4]=Sn,x[5]=di,x[6]=Fs,x[7]=hi,x[8]=jo,x[9]=Uo,x[10]=pi,x[11]=oo,x[12]=ao,x[13]=_n,x[14]=$o,x[15]=Gi,x[16]=qo,x[17]=Ca,x[18]=co,w!==0&&(x[19]=w,R.length++),R};Math.imul||(S=C);function O(M,v,m){m.negative=v.negative^M.negative,m.length=M.length+v.length;for(var R=0,B=0,E=0;E>>26)|0,B+=x>>>26,x&=67108863}m.words[E]=w,R=x,x=B}return R!==0?m.words[E]=R:m.length--,m._strip()}function L(M,v,m){return O(M,v,m)}s.prototype.mulTo=function(v,m){var R,B=this.length+v.length;return this.length===10&&v.length===10?R=S(this,v,m):B<63?R=C(this,v,m):B<1024?R=O(this,v,m):R=L(this,v,m),R},s.prototype.mul=function(v){var m=new s(null);return m.words=new Array(this.length+v.length),this.mulTo(v,m)},s.prototype.mulf=function(v){var m=new s(null);return m.words=new Array(this.length+v.length),L(this,v,m)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var m=v<0;m&&(v=-v),n(typeof v=="number"),n(v<67108864);for(var R=0,B=0;B>=26,R+=E/67108864|0,R+=x>>>26,this.words[B]=x&67108863}return R!==0&&(this.words[B]=R,this.length++),m?this.ineg():this},s.prototype.muln=function(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var m=I(v);if(m.length===0)return new s(1);for(var R=this,B=0;B=0);var m=v%26,R=(v-m)/26,B=67108863>>>26-m<<26-m,E;if(m!==0){var x=0;for(E=0;E>>26-m}x&&(this.words[E]=x,this.length++)}if(R!==0){for(E=this.length-1;E>=0;E--)this.words[E+R]=this.words[E];for(E=0;E=0);var B;m?B=(m-m%26)/26:B=0;var E=v%26,x=Math.min((v-E)/26,this.length),w=67108863^67108863>>>E<x)for(this.length-=x,k=0;k=0&&(H!==0||k>=B);k--){var oe=this.words[k]|0;this.words[k]=H<<26-E|oe>>>E,H=oe&w}return T&&H!==0&&(T.words[T.length++]=H),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,m,R){return n(this.negative===0),this.iushrn(v,m,R)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){n(typeof v=="number"&&v>=0);var m=v%26,R=(v-m)/26,B=1<=0);var m=v%26,R=(v-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=R)return this;if(m!==0&&R++,this.length=Math.min(R,this.length),m!==0){var B=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},s.prototype.isubn=function(v){if(n(typeof v=="number"),n(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(T/67108864|0),this.words[E+R]=x&67108863}for(;E>26,this.words[E+R]=x&67108863;if(w===0)return this._strip();for(n(w===-1),w=0,E=0;E>26,this.words[E]=x&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,m){var R=this.length-v.length,B=this.clone(),E=v,x=E.words[E.length-1]|0,w=this._countBits(x);R=26-w,R!==0&&(E=E.ushln(R),B.iushln(R),x=E.words[E.length-1]|0);var T=B.length-E.length,k;if(m!=="mod"){k=new s(null),k.length=T+1,k.words=new Array(k.length);for(var H=0;H=0;j--){var X=(B.words[E.length+j]|0)*67108864+(B.words[E.length+j-1]|0);for(X=Math.min(X/x|0,67108863),B._ishlnsubmul(E,X,j);B.negative!==0;)X--,B.negative=0,B._ishlnsubmul(E,1,j),B.isZero()||(B.negative^=1);k&&(k.words[j]=X)}return k&&k._strip(),B._strip(),m!=="div"&&R!==0&&B.iushrn(R),{div:k||null,mod:B}},s.prototype.divmod=function(v,m,R){if(n(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var B,E,x;return this.negative!==0&&v.negative===0?(x=this.neg().divmod(v,m),m!=="mod"&&(B=x.div.neg()),m!=="div"&&(E=x.mod.neg(),R&&E.negative!==0&&E.iadd(v)),{div:B,mod:E}):this.negative===0&&v.negative!==0?(x=this.divmod(v.neg(),m),m!=="mod"&&(B=x.div.neg()),{div:B,mod:x.mod}):this.negative&v.negative?(x=this.neg().divmod(v.neg(),m),m!=="div"&&(E=x.mod.neg(),R&&E.negative!==0&&E.isub(v)),{div:x.div,mod:E}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?m==="div"?{div:this.divn(v.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,m)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var m=this.divmod(v);if(m.mod.isZero())return m.div;var R=m.div.negative!==0?m.mod.isub(v):m.mod,B=v.ushrn(1),E=v.andln(1),x=R.cmp(B);return x<0||E===1&&x===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},s.prototype.modrn=function(v){var m=v<0;m&&(v=-v),n(v<=67108863);for(var R=(1<<26)%v,B=0,E=this.length-1;E>=0;E--)B=(R*B+(this.words[E]|0))%v;return m?-B:B},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var m=v<0;m&&(v=-v),n(v<=67108863);for(var R=0,B=this.length-1;B>=0;B--){var E=(this.words[B]|0)+R*67108864;this.words[B]=E/v|0,R=E%v}return this._strip(),m?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){n(v.negative===0),n(!v.isZero());var m=this,R=v.clone();m.negative!==0?m=m.umod(v):m=m.clone();for(var B=new s(1),E=new s(0),x=new s(0),w=new s(1),T=0;m.isEven()&&R.isEven();)m.iushrn(1),R.iushrn(1),++T;for(var k=R.clone(),H=m.clone();!m.isZero();){for(var oe=0,j=1;!(m.words[0]&j)&&oe<26;++oe,j<<=1);if(oe>0)for(m.iushrn(oe);oe-- >0;)(B.isOdd()||E.isOdd())&&(B.iadd(k),E.isub(H)),B.iushrn(1),E.iushrn(1);for(var X=0,G=1;!(R.words[0]&G)&&X<26;++X,G<<=1);if(X>0)for(R.iushrn(X);X-- >0;)(x.isOdd()||w.isOdd())&&(x.iadd(k),w.isub(H)),x.iushrn(1),w.iushrn(1);m.cmp(R)>=0?(m.isub(R),B.isub(x),E.isub(w)):(R.isub(m),x.isub(B),w.isub(E))}return{a:x,b:w,gcd:R.iushln(T)}},s.prototype._invmp=function(v){n(v.negative===0),n(!v.isZero());var m=this,R=v.clone();m.negative!==0?m=m.umod(v):m=m.clone();for(var B=new s(1),E=new s(0),x=R.clone();m.cmpn(1)>0&&R.cmpn(1)>0;){for(var w=0,T=1;!(m.words[0]&T)&&w<26;++w,T<<=1);if(w>0)for(m.iushrn(w);w-- >0;)B.isOdd()&&B.iadd(x),B.iushrn(1);for(var k=0,H=1;!(R.words[0]&H)&&k<26;++k,H<<=1);if(k>0)for(R.iushrn(k);k-- >0;)E.isOdd()&&E.iadd(x),E.iushrn(1);m.cmp(R)>=0?(m.isub(R),B.isub(E)):(R.isub(m),E.isub(B))}var oe;return m.cmpn(1)===0?oe=B:oe=E,oe.cmpn(0)<0&&oe.iadd(v),oe},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var m=this.clone(),R=v.clone();m.negative=0,R.negative=0;for(var B=0;m.isEven()&&R.isEven();B++)m.iushrn(1),R.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;R.isEven();)R.iushrn(1);var E=m.cmp(R);if(E<0){var x=m;m=R,R=x}else if(E===0||R.cmpn(1)===0)break;m.isub(R)}while(!0);return R.iushln(B)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){n(typeof v=="number");var m=v%26,R=(v-m)/26,B=1<>>26,w&=67108863,this.words[x]=w}return E!==0&&(this.words[x]=E,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var m=v<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var R;if(this.length>1)R=1;else{m&&(v=-v),n(v<=67108863,"Number is too big");var B=this.words[0]|0;R=B===v?0:Bv.length)return 1;if(this.length=0;R--){var B=this.words[R]|0,E=v.words[R]|0;if(B!==E){BE&&(m=1);break}}return m},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new K(v)},s.prototype.toRed=function(v){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return n(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(v){return n(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var F={k256:null,p224:null,p192:null,p25519:null};function z(M,v){this.name=M,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},z.prototype.ireduce=function(v){var m=v,R;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),R=m.bitLength();while(R>this.n);var B=R0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},z.prototype.split=function(v,m){v.iushrn(this.n,0,m)},z.prototype.imulK=function(v){return v.imul(this.k)};function _(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(_,z),_.prototype.split=function(v,m){for(var R=4194303,B=Math.min(v.length,9),E=0;E>>22,x=w}x>>>=22,v.words[E-10]=x,x===0&&v.length>10?v.length-=10:v.length-=9},_.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var m=0,R=0;R>>=26,v.words[R]=E,m=B}return m!==0&&(v.words[v.length++]=m),v},s._prime=function(v){if(F[v])return F[v];var m;if(v==="k256")m=new _;else if(v==="p224")m=new $;else if(v==="p192")m=new ie;else if(v==="p25519")m=new ce;else throw new Error("Unknown prime "+v);return F[v]=m,m};function K(M){if(typeof M=="string"){var v=s._prime(M);this.m=v.p,this.prime=v}else n(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}K.prototype._verify1=function(v){n(v.negative===0,"red works only with positives"),n(v.red,"red works only with red numbers")},K.prototype._verify2=function(v,m){n((v.negative|m.negative)===0,"red works only with positives"),n(v.red&&v.red===m.red,"red works only with red numbers")},K.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(f(v,v.umod(this.m)._forceRed(this)),v)},K.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},K.prototype.add=function(v,m){this._verify2(v,m);var R=v.add(m);return R.cmp(this.m)>=0&&R.isub(this.m),R._forceRed(this)},K.prototype.iadd=function(v,m){this._verify2(v,m);var R=v.iadd(m);return R.cmp(this.m)>=0&&R.isub(this.m),R},K.prototype.sub=function(v,m){this._verify2(v,m);var R=v.sub(m);return R.cmpn(0)<0&&R.iadd(this.m),R._forceRed(this)},K.prototype.isub=function(v,m){this._verify2(v,m);var R=v.isub(m);return R.cmpn(0)<0&&R.iadd(this.m),R},K.prototype.shl=function(v,m){return this._verify1(v),this.imod(v.ushln(m))},K.prototype.imul=function(v,m){return this._verify2(v,m),this.imod(v.imul(m))},K.prototype.mul=function(v,m){return this._verify2(v,m),this.imod(v.mul(m))},K.prototype.isqr=function(v){return this.imul(v,v.clone())},K.prototype.sqr=function(v){return this.mul(v,v)},K.prototype.sqrt=function(v){if(v.isZero())return v.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var R=this.m.add(new s(1)).iushrn(2);return this.pow(v,R)}for(var B=this.m.subn(1),E=0;!B.isZero()&&B.andln(1)===0;)E++,B.iushrn(1);n(!B.isZero());var x=new s(1).toRed(this),w=x.redNeg(),T=this.m.subn(1).iushrn(1),k=this.m.bitLength();for(k=new s(2*k*k).toRed(this);this.pow(k,T).cmp(w)!==0;)k.redIAdd(w);for(var H=this.pow(k,B),oe=this.pow(v,B.addn(1).iushrn(1)),j=this.pow(v,B),X=E;j.cmp(x)!==0;){for(var G=j,Z=0;G.cmp(x)!==0;Z++)G=G.redSqr();n(Z=0;E--){for(var H=m.words[E],oe=k-1;oe>=0;oe--){var j=H>>oe&1;if(x!==B[0]&&(x=this.sqr(x)),j===0&&w===0){T=0;continue}w<<=1,w|=j,T++,!(T!==R&&(E!==0||oe!==0))&&(x=this.mul(x,B[w]),T=0,w=0)}k=26}return x},K.prototype.convertTo=function(v){var m=v.umod(this.m);return m===v?m.clone():m},K.prototype.convertFrom=function(v){var m=v.clone();return m.red=null,m},s.mont=function(v){return new P(v)};function P(M){K.call(this,M),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(P,K),P.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},P.prototype.convertFrom=function(v){var m=this.imod(v.mul(this.rinv));return m.red=null,m},P.prototype.imul=function(v,m){if(v.isZero()||m.isZero())return v.words[0]=0,v.length=1,v;var R=v.imul(m),B=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=R.isub(B).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},P.prototype.mul=function(v,m){if(v.isZero()||m.isZero())return new s(0)._forceRed(this);var R=v.mul(m),B=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=R.isub(B).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},P.prototype.invm=function(v){var m=this.imod(v._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,Si)})(EM);var t7e=EM.exports;const sr=_u(t7e);var r7e=sr.BN;function n7e(t){return new r7e(t,36).toString(16)}const i7e="strings/5.7.0",s7e=new En(i7e);var J5;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(J5||(J5={}));var _j;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(_j||(_j={}));function N9(t,e=J5.current){e!=J5.current&&(s7e.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 s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return gi(r)}const o7e=`Ethereum Signed Message: +`;function RX(t){return typeof t=="string"&&(t=N9(t)),xM(QSe([N9(o7e),N9(String(t.length)),t]))}const a7e="address/5.7.0",ab=new En(a7e);function Ij(t){Vl(t,20)||ab.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=gi(xM(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 c7e=9007199254740991;function l7e(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const CM={};for(let t=0;t<10;t++)CM[String(t)]=String(t);for(let t=0;t<26;t++)CM[String.fromCharCode(65+t)]=String(10+t);const Tj=Math.floor(l7e(c7e));function f7e(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>CM[n]).join("");for(;e.length>=Tj;){let n=e.substring(0,Tj);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 u7e(t){let e=null;if(typeof t!="string"&&ab.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Ij(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&ab.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)!==f7e(t)&&ab.throwArgumentError("bad icap checksum","address",t),e=n7e(t.substring(4));e.length<40;)e="0"+e;e=Ij("0x"+e)}else ab.throwArgumentError("invalid address","address",t);return e}function Rm(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}var Mx={},Pr={},Yp=OX;function OX(t,e){if(!t)throw new Error(e||"Assertion failed")}OX.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var tI={exports:{}};typeof Object.create=="function"?tI.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:tI.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 cE=tI.exports,d7e=Yp,h7e=cE;Pr.inherits=h7e;function p7e(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function v7e(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++]=s&63|128):p7e(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}Pr.htonl=DX;function y7e(t,e){for(var r="",n=0;n>>0}return s}Pr.join32=m7e;function b7e(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}Pr.split32=b7e;function w7e(t,e){return t>>>e|t<<32-e}Pr.rotr32=w7e;function x7e(t,e){return t<>>32-e}Pr.rotl32=x7e;function E7e(t,e){return t+e>>>0}Pr.sum32=E7e;function C7e(t,e,r){return t+e+r>>>0}Pr.sum32_3=C7e;function A7e(t,e,r,n){return t+e+r+n>>>0}Pr.sum32_4=A7e;function S7e(t,e,r,n,i){return t+e+r+n+i>>>0}Pr.sum32_5=S7e;function _7e(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}Pr.sum64=_7e;function I7e(t,e,r,n){var i=e+n>>>0,s=(i>>0}Pr.sum64_hi=I7e;function T7e(t,e,r,n){var i=e+n;return i>>>0}Pr.sum64_lo=T7e;function P7e(t,e,r,n,i,s,o,a){var c=0,l=e;l=l+n>>>0,c+=l>>0,c+=l>>0,c+=l>>0}Pr.sum64_4_hi=P7e;function k7e(t,e,r,n,i,s,o,a){var c=e+n+s+a;return c>>>0}Pr.sum64_4_lo=k7e;function M7e(t,e,r,n,i,s,o,a,c,l){var f=0,u=e;u=u+n>>>0,f+=u>>0,f+=u>>0,f+=u>>0,f+=u>>0}Pr.sum64_5_hi=M7e;function R7e(t,e,r,n,i,s,o,a,c,l){var f=e+n+s+a+l;return f>>>0}Pr.sum64_5_lo=R7e;function O7e(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}Pr.rotr64_hi=O7e;function D7e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pr.rotr64_lo=D7e;function N7e(t,e,r){return t>>>r}Pr.shr64_hi=N7e;function B7e(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}Pr.shr64_lo=B7e;var Ry={},Pj=Pr,L7e=Yp;function lE(){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}Ry.BlockHash=lE;lE.prototype.update=function(e,r){if(e=Pj.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=Pj.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}sf.g0_256=q7e;function V7e(t){return zl(t,17)^zl(t,19)^t>>>10}sf.g1_256=V7e;var sy=Pr,z7e=Ry,H7e=sf,B9=sy.rotl32,Om=sy.sum32,G7e=sy.sum32_5,W7e=H7e.ft_1,UX=z7e.BlockHash,K7e=[1518500249,1859775393,2400959708,3395469782];function Xl(){if(!(this instanceof Xl))return new Xl;UX.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}sy.inherits(Xl,UX);var Y7e=Xl;Xl.blockSize=512;Xl.outSize=160;Xl.hmacStrength=80;Xl.padLength=64;Xl.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()),B_e(e.length<=this.blockSize);for(var r=e.length;r>8,p=f&255;u?c.push(u,p):c.push(p)}return c}r.toArray=n;function i(o){return o.length===1?"0"+o:o}r.zero2=i;function s(o){for(var a="",c=0;c(p>>1)-1?b=(p>>1)-I:b=I,g.isubn(b)):b=0,u[y]=b,g.iushrn(1)}return u}r.getNAF=n;function i(c,l){var f=[[],[]];c=c.clone(),l=l.clone();for(var u=0,p=0,g;c.cmpn(-u)>0||l.cmpn(-p)>0;){var y=c.andln(3)+u&3,b=l.andln(3)+p&3;y===3&&(y=-1),b===3&&(b=-1);var I;y&1?(g=c.andln(7)+u&7,(g===3||g===5)&&b===2?I=-y:I=y):I=0,f[0].push(I);var C;b&1?(g=l.andln(7)+p&7,(g===3||g===5)&&y===2?C=-b:C=b):C=0,f[1].push(C),2*u===I+1&&(u=1-u),2*p===C+1&&(p=1-p),c.iushrn(1),l.iushrn(1)}return f}r.getJSF=i;function s(c,l,f){var u="_"+l;c.prototype[l]=function(){return this[u]!==void 0?this[u]:this[u]=f.call(this)}}r.cachedProperty=s;function o(c){return typeof c=="string"?r.toArray(c,"hex"):c}r.parseBytes=o;function a(c){return new sr(c,"hex","le")}r.intFromLE=a}),Z5=wa.getNAF,j_e=wa.getJSF,X5=wa.assert;function Oh(t,e){this.type=t,this.p=new sr(e.p,16),this.red=e.prime?sr.red(e.prime):sr.mont(this.p),this.zero=new sr(0).toRed(this.red),this.one=new sr(1).toRed(this.red),this.two=new sr(2).toRed(this.red),this.n=e.n&&new sr(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 Qp=Oh;Oh.prototype.point=function(){throw new Error("Not implemented")};Oh.prototype.validate=function(){throw new Error("Not implemented")};Oh.prototype._fixedNafMul=function(e,r){X5(e.precomputed);var n=e._getDoubles(),i=Z5(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),p=s;p>0;p--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];X5(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};Oh.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,p;for(f=0;f=1;f-=2){var y=f-1,b=f;if(o[y]!==1||o[b]!==1){c[y]=Z5(n[y],o[y],this._bitLength),c[b]=Z5(n[b],o[b],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[b].length,l);continue}var I=[r[y],null,null,r[b]];r[y].y.cmp(r[b].y)===0?(I[1]=r[y].add(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg())):r[y].y.cmp(r[b].y.redNeg())===0?(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].add(r[b].neg())):(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg()));var C=[-3,-1,-5,-7,0,7,5,1,3],S=j_e(n[y],n[b]);for(l=Math.max(S[0].length,l),c[y]=new Array(l),c[b]=new Array(l),u=0;u=0;f--){for(var _=0;f>=0;){var $=!0;for(u=0;u=0&&_++,F=F.dblp(_),f<0)break;for(u=0;u0?p=a[u][ie-1>>1]:ie<0&&(p=a[u][-ie-1>>1].neg()),p.type==="affine"?F=F.mixedAdd(p):F=F.add(p))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};cc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),p=p.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:p},{a:g,b:y}]};lc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),p=l.add(f).neg();return{k1:u,k2:p}};lc.prototype.pointFromX=function(e,r){e=new sr(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 s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};lc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};lc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};zi.prototype.isInfinity=function(){return this.inf};zi.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)};zi.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(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};zi.prototype.getX=function(){return this.x.fromRed()};zi.prototype.getY=function(){return this.y.fromRed()};zi.prototype.mul=function(e){return e=new sr(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)};zi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};zi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};zi.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)};zi.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(s){return s.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};zi.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 cs(t,e,r,n){Qp.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new sr(0)):(this.x=new sr(e,16),this.y=new sr(r,16),this.z=new sr(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}SM(cs,Qp.BasePoint);lc.prototype.jpoint=function(e,r,n){return new cs(this,e,r,n)};cs.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)};cs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};cs.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),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),p=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(p).redISub(p),y=l.redMul(p.redISub(g)).redISub(o.redMul(u)),b=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,b)};cs.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),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),p=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(p)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(p,g,y)};cs.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(s),this.x.cmp(n)===0)return!0}};cs.prototype.inspect=function(){return this.isInfinity()?"":""};cs.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var P3=Ny(function(t,e){var r=e;r.base=Qp,r.short=$_e,r.mont=null,r.edwards=null}),k3=Ny(function(t,e){var r=e,n=wa.assert;function i(a){a.type==="short"?this.curve=new P3.short(a):a.type==="edwards"?this.curve=new P3.edwards(a):this.curve=new P3.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(a,c){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var l=new i(c);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:l}),l}})}s("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:If.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("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:If.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("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:If.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("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:If.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"]}),s("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:If.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"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:If.sha256,gRed:!1,g:["9"]}),s("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:If.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("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:If.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function ph(t){if(!(this instanceof ph))return new ph(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=Hc.toArray(t.entropy,t.entropyEnc||"hex"),r=Hc.toArray(t.nonce,t.nonceEnc||"hex"),n=Hc.toArray(t.pers,t.persEnc||"hex");AM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var ZX=ph;ph.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 s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};ph.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=Hc.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var q_e=wa.assert;function fE(t,e){if(t instanceof fE)return t;this._importDER(t,e)||(q_e(t.r&&t.s,"Signature without r or s"),this.r=new sr(t.r,16),this.s=new sr(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var uE=fE;function V_e(){this.place=0}function j9(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,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function Oj(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)}fE.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=Oj(r),n=Oj(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];U9(i,r.length),i=i.concat(r),i.push(2),U9(i,n.length);var s=i.concat(n),o=[48];return U9(o,s.length),o=o.concat(s),wa.encode(o,e)};var z_e=function(){throw new Error("unsupported")},XX=wa.assert;function oc(t){if(!(this instanceof oc))return new oc(t);typeof t=="string"&&(XX(Object.prototype.hasOwnProperty.call(k3,t),"Unknown curve "+t),t=k3[t]),t instanceof k3.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 H_e=oc;oc.prototype.keyPair=function(e){return new _M(this,e)};oc.prototype.keyFromPrivate=function(e,r){return _M.fromPrivate(this,e,r)};oc.prototype.keyFromPublic=function(e,r){return _M.fromPublic(this,e,r)};oc.prototype.genKeyPair=function(e){e||(e={});for(var r=new ZX({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||z_e(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new sr(2));;){var s=new sr(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};oc.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};oc.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 sr(e,16));for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new ZX({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new sr(1)),f=0;;f++){var u=i.k?i.k(f):new sr(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var p=this.g.mul(u);if(!p.isInfinity()){var g=p.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var b=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(b=b.umod(this.n),b.cmpn(0)!==0){var I=(p.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),I^=1),new uE({r:y,s:b,recoveryParam:I})}}}}}};oc.prototype.verify=function(e,r,n,i){e=this._truncateToN(new sr(e,16)),n=this.keyFromPublic(n,i),r=new uE(r,"hex");var s=r.r,o=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),c=a.mul(e).umod(this.n),l=a.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(c,n.getPublic(),l),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)};oc.prototype.recoverPubKey=function(t,e,r,n){XX((3&r)===r,"The recovery param is more than two bits"),e=new uE(e,n);var i=this.n,s=new sr(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),p=a.mul(f).umod(i);return this.g.mulAdd(u,o,p)};oc.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new uE(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var G_e=Ny(function(t,e){var r=e;r.version="6.5.4",r.utils=wa,r.rand=function(){throw new Error("unsupported")},r.curve=P3,r.curves=k3,r.ec=H_e,r.eddsa=null}),W_e=G_e.ec;const K_e="signing-key/5.7.0",sI=new En(K_e);let $9=null;function fd(){return $9||($9=new W_e("secp256k1")),$9}class Y_e{constructor(e){Rm(this,"curve","secp256k1"),Rm(this,"privateKey",ia(e)),ZSe(this.privateKey)!==32&&sI.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=fd().keyFromPrivate(gi(this.privateKey));Rm(this,"publicKey","0x"+r.getPublic(!1,"hex")),Rm(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),Rm(this,"_isSigningKey",!0)}_addPoint(e){const r=fd().keyFromPublic(gi(this.publicKey)),n=fd().keyFromPublic(gi(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=fd().keyFromPrivate(gi(this.privateKey)),n=gi(e);n.length!==32&&sI.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return MX({recoveryParam:i.recoveryParam,r:qv("0x"+i.r.toString(16),32),s:qv("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=fd().keyFromPrivate(gi(this.privateKey)),n=fd().keyFromPublic(gi(eee(e)));return qv("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function Q_e(t,e){const r=MX(e),n={r:gi(r.r),s:gi(r.s)};return"0x"+fd().recoverPubKey(gi(t),n,r.recoveryParam).encode("hex",!1)}function eee(t,e){const r=gi(t);return r.length===32?new Y_e(r).publicKey:r.length===33?"0x"+fd().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?ia(r):sI.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Dj;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Dj||(Dj={}));function J_e(t){const e=eee(t);return u7e(Sj(xM(Sj(e,1)),12))}function Z_e(t,e){return J_e(Q_e(gi(t),e))}var IM={},dE={},cr={},tee={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,c){var l=a>>>16&65535,f=a&65535,u=c>>>16&65535,p=c&65535;return f*p+(l*p+f*u<<16>>>0)|0}t.mul=Math.imul||e;function r(a,c){return a+c|0}t.add=r;function n(a,c){return a-c|0}t.sub=n;function i(a,c){return a<>>32-c}t.rotl=i;function s(a,c){return a<<32-c|a>>>c}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(tee);Object.defineProperty(cr,"__esModule",{value:!0});var ree=tee;function X_e(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}cr.readInt16BE=X_e;function eIe(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}cr.readUint16BE=eIe;function tIe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}cr.readInt16LE=tIe;function rIe(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}cr.readUint16LE=rIe;function nee(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}cr.writeUint16BE=nee;cr.writeInt16BE=nee;function iee(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}cr.writeUint16LE=iee;cr.writeInt16LE=iee;function oI(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}cr.readInt32BE=oI;function aI(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}cr.readUint32BE=aI;function cI(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}cr.readInt32LE=cI;function lI(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}cr.readUint32LE=lI;function e4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}cr.writeUint32BE=e4;cr.writeInt32BE=e4;function t4(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}cr.writeUint32LE=t4;cr.writeInt32LE=t4;function nIe(t,e){e===void 0&&(e=0);var r=oI(t,e),n=oI(t,e+4);return r*4294967296+n-(n>>31)*4294967296}cr.readInt64BE=nIe;function iIe(t,e){e===void 0&&(e=0);var r=aI(t,e),n=aI(t,e+4);return r*4294967296+n}cr.readUint64BE=iIe;function sIe(t,e){e===void 0&&(e=0);var r=cI(t,e),n=cI(t,e+4);return n*4294967296+r-(r>>31)*4294967296}cr.readInt64LE=sIe;function oIe(t,e){e===void 0&&(e=0);var r=lI(t,e),n=lI(t,e+4);return n*4294967296+r}cr.readUint64LE=oIe;function see(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),e4(t/4294967296>>>0,e,r),e4(t>>>0,e,r+4),e}cr.writeUint64BE=see;cr.writeInt64BE=see;function oee(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),t4(t>>>0,e,r),t4(t/4294967296>>>0,e,r+4),e}cr.writeUint64LE=oee;cr.writeInt64LE=oee;function aIe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}cr.readUintBE=aIe;function cIe(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}cr.writeUintBE=lIe;function fIe(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!ree.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s>>16|m<<16,K=K+m|0,_^=K,_=_>>>20|_<<12,L=L+$|0,R^=L,R=R>>>16|R<<16,P=P+R|0,$^=P,$=$>>>20|$<<12,F=F+ie|0,B^=F,B=B>>>16|B<<16,M=M+B|0,ie^=M,ie=ie>>>20|ie<<12,z=z+ce|0,E^=z,E=E>>>16|E<<16,v=v+E|0,ce^=v,ce=ce>>>20|ce<<12,F=F+ie|0,B^=F,B=B>>>24|B<<8,M=M+B|0,ie^=M,ie=ie>>>25|ie<<7,z=z+ce|0,E^=z,E=E>>>24|E<<8,v=v+E|0,ce^=v,ce=ce>>>25|ce<<7,L=L+$|0,R^=L,R=R>>>24|R<<8,P=P+R|0,$^=P,$=$>>>25|$<<7,O=O+_|0,m^=O,m=m>>>24|m<<8,K=K+m|0,_^=K,_=_>>>25|_<<7,O=O+$|0,E^=O,E=E>>>16|E<<16,M=M+E|0,$^=M,$=$>>>20|$<<12,L=L+ie|0,m^=L,m=m>>>16|m<<16,v=v+m|0,ie^=v,ie=ie>>>20|ie<<12,F=F+ce|0,R^=F,R=R>>>16|R<<16,K=K+R|0,ce^=K,ce=ce>>>20|ce<<12,z=z+_|0,B^=z,B=B>>>16|B<<16,P=P+B|0,_^=P,_=_>>>20|_<<12,F=F+ce|0,R^=F,R=R>>>24|R<<8,K=K+R|0,ce^=K,ce=ce>>>25|ce<<7,z=z+_|0,B^=z,B=B>>>24|B<<8,P=P+B|0,_^=P,_=_>>>25|_<<7,L=L+ie|0,m^=L,m=m>>>24|m<<8,v=v+m|0,ie^=v,ie=ie>>>25|ie<<7,O=O+$|0,E^=O,E=E>>>24|E<<8,M=M+E|0,$^=M,$=$>>>25|$<<7;ms.writeUint32LE(O+n|0,t,0),ms.writeUint32LE(L+i|0,t,4),ms.writeUint32LE(F+s|0,t,8),ms.writeUint32LE(z+o|0,t,12),ms.writeUint32LE(_+a|0,t,16),ms.writeUint32LE($+c|0,t,20),ms.writeUint32LE(ie+l|0,t,24),ms.writeUint32LE(ce+f|0,t,28),ms.writeUint32LE(K+u|0,t,32),ms.writeUint32LE(P+p|0,t,36),ms.writeUint32LE(M+g|0,t,40),ms.writeUint32LE(v+y|0,t,44),ms.writeUint32LE(m+b|0,t,48),ms.writeUint32LE(R+I|0,t,52),ms.writeUint32LE(B+C|0,t,56),ms.writeUint32LE(E+S|0,t,60)}function aee(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var cee={},Dh={};Object.defineProperty(Dh,"__esModule",{value:!0});function AIe(t,e,r){return~(t-1)&e|t-1&r}Dh.select=AIe;function SIe(t,e){return(t|0)-(e|0)-1>>>31&1}Dh.lessOrEqual=SIe;function lee(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Dh.compare=lee;function _Ie(t,e){return t.length===0||e.length===0?!1:lee(t,e)!==0}Dh.equal=_Ie;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Dh,r=xa;t.DIGEST_LENGTH=16;var n=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=a[0]|a[1]<<8;this._r[0]=c&8191;var l=a[2]|a[3]<<8;this._r[1]=(c>>>13|l<<3)&8191;var f=a[4]|a[5]<<8;this._r[2]=(l>>>10|f<<6)&7939;var u=a[6]|a[7]<<8;this._r[3]=(f>>>7|u<<9)&8191;var p=a[8]|a[9]<<8;this._r[4]=(u>>>4|p<<12)&255,this._r[5]=p>>>1&8190;var g=a[10]|a[11]<<8;this._r[6]=(p>>>14|g<<2)&8191;var y=a[12]|a[13]<<8;this._r[7]=(g>>>11|y<<5)&8065;var b=a[14]|a[15]<<8;this._r[8]=(y>>>8|b<<8)&8191,this._r[9]=b>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,c,l){for(var f=this._fin?0:2048,u=this._h[0],p=this._h[1],g=this._h[2],y=this._h[3],b=this._h[4],I=this._h[5],C=this._h[6],S=this._h[7],O=this._h[8],L=this._h[9],F=this._r[0],z=this._r[1],_=this._r[2],$=this._r[3],ie=this._r[4],ce=this._r[5],K=this._r[6],P=this._r[7],M=this._r[8],v=this._r[9];l>=16;){var m=a[c+0]|a[c+1]<<8;u+=m&8191;var R=a[c+2]|a[c+3]<<8;p+=(m>>>13|R<<3)&8191;var B=a[c+4]|a[c+5]<<8;g+=(R>>>10|B<<6)&8191;var E=a[c+6]|a[c+7]<<8;y+=(B>>>7|E<<9)&8191;var x=a[c+8]|a[c+9]<<8;b+=(E>>>4|x<<12)&8191,I+=x>>>1&8191;var w=a[c+10]|a[c+11]<<8;C+=(x>>>14|w<<2)&8191;var T=a[c+12]|a[c+13]<<8;S+=(w>>>11|T<<5)&8191;var k=a[c+14]|a[c+15]<<8;O+=(T>>>8|k<<8)&8191,L+=k>>>5|f;var H=0,oe=H;oe+=u*F,oe+=p*(5*v),oe+=g*(5*M),oe+=y*(5*P),oe+=b*(5*K),H=oe>>>13,oe&=8191,oe+=I*(5*ce),oe+=C*(5*ie),oe+=S*(5*$),oe+=O*(5*_),oe+=L*(5*z),H+=oe>>>13,oe&=8191;var j=H;j+=u*z,j+=p*F,j+=g*(5*v),j+=y*(5*M),j+=b*(5*P),H=j>>>13,j&=8191,j+=I*(5*K),j+=C*(5*ce),j+=S*(5*ie),j+=O*(5*$),j+=L*(5*_),H+=j>>>13,j&=8191;var X=H;X+=u*_,X+=p*z,X+=g*F,X+=y*(5*v),X+=b*(5*M),H=X>>>13,X&=8191,X+=I*(5*P),X+=C*(5*K),X+=S*(5*ce),X+=O*(5*ie),X+=L*(5*$),H+=X>>>13,X&=8191;var G=H;G+=u*$,G+=p*_,G+=g*z,G+=y*F,G+=b*(5*v),H=G>>>13,G&=8191,G+=I*(5*M),G+=C*(5*P),G+=S*(5*K),G+=O*(5*ce),G+=L*(5*ie),H+=G>>>13,G&=8191;var Z=H;Z+=u*ie,Z+=p*$,Z+=g*_,Z+=y*z,Z+=b*F,H=Z>>>13,Z&=8191,Z+=I*(5*v),Z+=C*(5*M),Z+=S*(5*P),Z+=O*(5*K),Z+=L*(5*ce),H+=Z>>>13,Z&=8191;var ee=H;ee+=u*ce,ee+=p*ie,ee+=g*$,ee+=y*_,ee+=b*z,H=ee>>>13,ee&=8191,ee+=I*F,ee+=C*(5*v),ee+=S*(5*M),ee+=O*(5*P),ee+=L*(5*K),H+=ee>>>13,ee&=8191;var N=H;N+=u*K,N+=p*ce,N+=g*ie,N+=y*$,N+=b*_,H=N>>>13,N&=8191,N+=I*z,N+=C*F,N+=S*(5*v),N+=O*(5*M),N+=L*(5*P),H+=N>>>13,N&=8191;var te=H;te+=u*P,te+=p*K,te+=g*ce,te+=y*ie,te+=b*$,H=te>>>13,te&=8191,te+=I*_,te+=C*z,te+=S*F,te+=O*(5*v),te+=L*(5*M),H+=te>>>13,te&=8191;var fe=H;fe+=u*M,fe+=p*P,fe+=g*K,fe+=y*ce,fe+=b*ie,H=fe>>>13,fe&=8191,fe+=I*$,fe+=C*_,fe+=S*z,fe+=O*F,fe+=L*(5*v),H+=fe>>>13,fe&=8191;var Ee=H;Ee+=u*v,Ee+=p*M,Ee+=g*P,Ee+=y*K,Ee+=b*ce,H=Ee>>>13,Ee&=8191,Ee+=I*ie,Ee+=C*$,Ee+=S*_,Ee+=O*z,Ee+=L*F,H+=Ee>>>13,Ee&=8191,H=(H<<2)+H|0,H=H+oe|0,oe=H&8191,H=H>>>13,j+=H,u=oe,p=j,g=X,y=G,b=Z,I=ee,C=N,S=te,O=fe,L=Ee,c+=16,l-=16}this._h[0]=u,this._h[1]=p,this._h[2]=g,this._h[3]=y,this._h[4]=b,this._h[5]=I,this._h[6]=C,this._h[7]=S,this._h[8]=O,this._h[9]=L},o.prototype.finish=function(a,c){c===void 0&&(c=0);var l=new Uint16Array(10),f,u,p,g;if(this._leftover){for(g=this._leftover,this._buffer[g++]=1;g<16;g++)this._buffer[g]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(f=this._h[1]>>>13,this._h[1]&=8191,g=2;g<10;g++)this._h[g]+=f,f=this._h[g]>>>13,this._h[g]&=8191;for(this._h[0]+=f*5,f=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=f,f=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=f,l[0]=this._h[0]+5,f=l[0]>>>13,l[0]&=8191,g=1;g<10;g++)l[g]=this._h[g]+f,f=l[g]>>>13,l[g]&=8191;for(l[9]-=8192,u=(f^1)-1,g=0;g<10;g++)l[g]&=u;for(u=~u,g=0;g<10;g++)this._h[g]=this._h[g]&u|l[g];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,p=this._h[0]+this._pad[0],this._h[0]=p&65535,g=1;g<8;g++)p=(this._h[g]+this._pad[g]|0)+(p>>>16)|0,this._h[g]=p&65535;return a[c+0]=this._h[0]>>>0,a[c+1]=this._h[0]>>>8,a[c+2]=this._h[1]>>>0,a[c+3]=this._h[1]>>>8,a[c+4]=this._h[2]>>>0,a[c+5]=this._h[2]>>>8,a[c+6]=this._h[3]>>>0,a[c+7]=this._h[3]>>>8,a[c+8]=this._h[4]>>>0,a[c+9]=this._h[4]>>>8,a[c+10]=this._h[5]>>>0,a[c+11]=this._h[5]>>>8,a[c+12]=this._h[6]>>>0,a[c+13]=this._h[6]>>>8,a[c+14]=this._h[7]>>>0,a[c+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var c=0,l=a.length,f;if(this._leftover){f=16-this._leftover,f>l&&(f=l);for(var u=0;u=16&&(f=l-l%16,this._blocks(a,c,f),c+=f,l-=f),l){for(var u=0;u16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var g=new Uint8Array(16);g.set(l,g.length-l.length);var y=new Uint8Array(32);e.stream(this._key,g,y,4);var b=f.length+this.tagLength,I;if(p){if(p.length!==b)throw new Error("ChaCha20Poly1305: incorrect destination length");I=p}else I=new Uint8Array(b);return e.streamXOR(this._key,g,f,I,4),this._authenticate(I.subarray(I.length-this.tagLength,I.length),y,I.subarray(0,I.length-this.tagLength),u),n.wipe(g),I},c.prototype.open=function(l,f,u,p){if(l.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(f.length0&&g.update(o.subarray(p.length%16))),g.update(u),u.length%16>0&&g.update(o.subarray(u.length%16));var y=new Uint8Array(8);p&&i.writeUint64LE(p.length,y),g.update(y),i.writeUint64LE(u.length,y),g.update(y);for(var b=g.digest(),I=0;Ithis.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n256)throw new Error("randomString charset is too long");let p="";const g=f.length,y=256-256%g;for(;l>0;){const b=i(Math.ceil(l*256/y),u);for(let I=0;I0;I++){const C=b[I];C0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._temp,this._state,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,p=l<<3,g=l%64<56?64:128;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.state),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,c,l,f,u){for(;u>=64;){for(var p=c[0],g=c[1],y=c[2],b=c[3],I=c[4],C=c[5],S=c[6],O=c[7],L=0;L<16;L++){var F=f+L*4;a[L]=e.readUint32BE(l,F)}for(var L=16;L<64;L++){var z=a[L-2],_=(z>>>17|z<<15)^(z>>>19|z<<13)^z>>>10;z=a[L-15];var $=(z>>>7|z<<25)^(z>>>18|z<<14)^z>>>3;a[L]=(_+a[L-7]|0)+($+a[L-16]|0)}for(var L=0;L<64;L++){var _=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&C^~I&S)|0)+(O+(i[L]+a[L]|0)|0)|0,$=((p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10))+(p&g^p&y^g&y)|0;O=S,S=C,C=I,I=b+_|0,b=y,y=g,g=p,p=_+$|0}c[0]+=p,c[1]+=g,c[2]+=y,c[3]+=b,c[4]+=I,c[5]+=C,c[6]+=S,c[7]+=O,f+=64,u-=64}return f}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(Ox);var PM={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Nh,r=xa;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(L){const F=new Float64Array(16);if(L)for(let z=0;z>16&1),z[ce-1]&=65535;z[15]=_[15]-32767-(z[14]>>16&1);const ie=z[15]>>16&1;z[14]&=65535,a(_,z,1-ie)}for(let $=0;$<16;$++)L[2*$]=_[$]&255,L[2*$+1]=_[$]>>8}function l(L,F){for(let z=0;z<16;z++)L[z]=F[2*z]+(F[2*z+1]<<8);L[15]&=32767}function f(L,F,z){for(let _=0;_<16;_++)L[_]=F[_]+z[_]}function u(L,F,z){for(let _=0;_<16;_++)L[_]=F[_]-z[_]}function p(L,F,z){let _,$,ie=0,ce=0,K=0,P=0,M=0,v=0,m=0,R=0,B=0,E=0,x=0,w=0,T=0,k=0,H=0,oe=0,j=0,X=0,G=0,Z=0,ee=0,N=0,te=0,fe=0,Ee=0,_e=0,Re=0,Te=0,De=0,ze=0,et=0,Je=z[0],ke=z[1],Ne=z[2],tt=z[3],Ze=z[4],st=z[5],nt=z[6],We=z[7],lt=z[8],vt=z[9],Ke=z[10],gt=z[11],wt=z[12],rt=z[13],It=z[14],At=z[15];_=F[0],ie+=_*Je,ce+=_*ke,K+=_*Ne,P+=_*tt,M+=_*Ze,v+=_*st,m+=_*nt,R+=_*We,B+=_*lt,E+=_*vt,x+=_*Ke,w+=_*gt,T+=_*wt,k+=_*rt,H+=_*It,oe+=_*At,_=F[1],ce+=_*Je,K+=_*ke,P+=_*Ne,M+=_*tt,v+=_*Ze,m+=_*st,R+=_*nt,B+=_*We,E+=_*lt,x+=_*vt,w+=_*Ke,T+=_*gt,k+=_*wt,H+=_*rt,oe+=_*It,j+=_*At,_=F[2],K+=_*Je,P+=_*ke,M+=_*Ne,v+=_*tt,m+=_*Ze,R+=_*st,B+=_*nt,E+=_*We,x+=_*lt,w+=_*vt,T+=_*Ke,k+=_*gt,H+=_*wt,oe+=_*rt,j+=_*It,X+=_*At,_=F[3],P+=_*Je,M+=_*ke,v+=_*Ne,m+=_*tt,R+=_*Ze,B+=_*st,E+=_*nt,x+=_*We,w+=_*lt,T+=_*vt,k+=_*Ke,H+=_*gt,oe+=_*wt,j+=_*rt,X+=_*It,G+=_*At,_=F[4],M+=_*Je,v+=_*ke,m+=_*Ne,R+=_*tt,B+=_*Ze,E+=_*st,x+=_*nt,w+=_*We,T+=_*lt,k+=_*vt,H+=_*Ke,oe+=_*gt,j+=_*wt,X+=_*rt,G+=_*It,Z+=_*At,_=F[5],v+=_*Je,m+=_*ke,R+=_*Ne,B+=_*tt,E+=_*Ze,x+=_*st,w+=_*nt,T+=_*We,k+=_*lt,H+=_*vt,oe+=_*Ke,j+=_*gt,X+=_*wt,G+=_*rt,Z+=_*It,ee+=_*At,_=F[6],m+=_*Je,R+=_*ke,B+=_*Ne,E+=_*tt,x+=_*Ze,w+=_*st,T+=_*nt,k+=_*We,H+=_*lt,oe+=_*vt,j+=_*Ke,X+=_*gt,G+=_*wt,Z+=_*rt,ee+=_*It,N+=_*At,_=F[7],R+=_*Je,B+=_*ke,E+=_*Ne,x+=_*tt,w+=_*Ze,T+=_*st,k+=_*nt,H+=_*We,oe+=_*lt,j+=_*vt,X+=_*Ke,G+=_*gt,Z+=_*wt,ee+=_*rt,N+=_*It,te+=_*At,_=F[8],B+=_*Je,E+=_*ke,x+=_*Ne,w+=_*tt,T+=_*Ze,k+=_*st,H+=_*nt,oe+=_*We,j+=_*lt,X+=_*vt,G+=_*Ke,Z+=_*gt,ee+=_*wt,N+=_*rt,te+=_*It,fe+=_*At,_=F[9],E+=_*Je,x+=_*ke,w+=_*Ne,T+=_*tt,k+=_*Ze,H+=_*st,oe+=_*nt,j+=_*We,X+=_*lt,G+=_*vt,Z+=_*Ke,ee+=_*gt,N+=_*wt,te+=_*rt,fe+=_*It,Ee+=_*At,_=F[10],x+=_*Je,w+=_*ke,T+=_*Ne,k+=_*tt,H+=_*Ze,oe+=_*st,j+=_*nt,X+=_*We,G+=_*lt,Z+=_*vt,ee+=_*Ke,N+=_*gt,te+=_*wt,fe+=_*rt,Ee+=_*It,_e+=_*At,_=F[11],w+=_*Je,T+=_*ke,k+=_*Ne,H+=_*tt,oe+=_*Ze,j+=_*st,X+=_*nt,G+=_*We,Z+=_*lt,ee+=_*vt,N+=_*Ke,te+=_*gt,fe+=_*wt,Ee+=_*rt,_e+=_*It,Re+=_*At,_=F[12],T+=_*Je,k+=_*ke,H+=_*Ne,oe+=_*tt,j+=_*Ze,X+=_*st,G+=_*nt,Z+=_*We,ee+=_*lt,N+=_*vt,te+=_*Ke,fe+=_*gt,Ee+=_*wt,_e+=_*rt,Re+=_*It,Te+=_*At,_=F[13],k+=_*Je,H+=_*ke,oe+=_*Ne,j+=_*tt,X+=_*Ze,G+=_*st,Z+=_*nt,ee+=_*We,N+=_*lt,te+=_*vt,fe+=_*Ke,Ee+=_*gt,_e+=_*wt,Re+=_*rt,Te+=_*It,De+=_*At,_=F[14],H+=_*Je,oe+=_*ke,j+=_*Ne,X+=_*tt,G+=_*Ze,Z+=_*st,ee+=_*nt,N+=_*We,te+=_*lt,fe+=_*vt,Ee+=_*Ke,_e+=_*gt,Re+=_*wt,Te+=_*rt,De+=_*It,ze+=_*At,_=F[15],oe+=_*Je,j+=_*ke,X+=_*Ne,G+=_*tt,Z+=_*Ze,ee+=_*st,N+=_*nt,te+=_*We,fe+=_*lt,Ee+=_*vt,_e+=_*Ke,Re+=_*gt,Te+=_*wt,De+=_*rt,ze+=_*It,et+=_*At,ie+=38*j,ce+=38*X,K+=38*G,P+=38*Z,M+=38*ee,v+=38*N,m+=38*te,R+=38*fe,B+=38*Ee,E+=38*_e,x+=38*Re,w+=38*Te,T+=38*De,k+=38*ze,H+=38*et,$=1,_=ie+$+65535,$=Math.floor(_/65536),ie=_-$*65536,_=ce+$+65535,$=Math.floor(_/65536),ce=_-$*65536,_=K+$+65535,$=Math.floor(_/65536),K=_-$*65536,_=P+$+65535,$=Math.floor(_/65536),P=_-$*65536,_=M+$+65535,$=Math.floor(_/65536),M=_-$*65536,_=v+$+65535,$=Math.floor(_/65536),v=_-$*65536,_=m+$+65535,$=Math.floor(_/65536),m=_-$*65536,_=R+$+65535,$=Math.floor(_/65536),R=_-$*65536,_=B+$+65535,$=Math.floor(_/65536),B=_-$*65536,_=E+$+65535,$=Math.floor(_/65536),E=_-$*65536,_=x+$+65535,$=Math.floor(_/65536),x=_-$*65536,_=w+$+65535,$=Math.floor(_/65536),w=_-$*65536,_=T+$+65535,$=Math.floor(_/65536),T=_-$*65536,_=k+$+65535,$=Math.floor(_/65536),k=_-$*65536,_=H+$+65535,$=Math.floor(_/65536),H=_-$*65536,_=oe+$+65535,$=Math.floor(_/65536),oe=_-$*65536,ie+=$-1+37*($-1),$=1,_=ie+$+65535,$=Math.floor(_/65536),ie=_-$*65536,_=ce+$+65535,$=Math.floor(_/65536),ce=_-$*65536,_=K+$+65535,$=Math.floor(_/65536),K=_-$*65536,_=P+$+65535,$=Math.floor(_/65536),P=_-$*65536,_=M+$+65535,$=Math.floor(_/65536),M=_-$*65536,_=v+$+65535,$=Math.floor(_/65536),v=_-$*65536,_=m+$+65535,$=Math.floor(_/65536),m=_-$*65536,_=R+$+65535,$=Math.floor(_/65536),R=_-$*65536,_=B+$+65535,$=Math.floor(_/65536),B=_-$*65536,_=E+$+65535,$=Math.floor(_/65536),E=_-$*65536,_=x+$+65535,$=Math.floor(_/65536),x=_-$*65536,_=w+$+65535,$=Math.floor(_/65536),w=_-$*65536,_=T+$+65535,$=Math.floor(_/65536),T=_-$*65536,_=k+$+65535,$=Math.floor(_/65536),k=_-$*65536,_=H+$+65535,$=Math.floor(_/65536),H=_-$*65536,_=oe+$+65535,$=Math.floor(_/65536),oe=_-$*65536,ie+=$-1+37*($-1),L[0]=ie,L[1]=ce,L[2]=K,L[3]=P,L[4]=M,L[5]=v,L[6]=m,L[7]=R,L[8]=B,L[9]=E,L[10]=x,L[11]=w,L[12]=T,L[13]=k,L[14]=H,L[15]=oe}function g(L,F){p(L,F,F)}function y(L,F){const z=n();for(let _=0;_<16;_++)z[_]=F[_];for(let _=253;_>=0;_--)g(z,z),_!==2&&_!==4&&p(z,z,F);for(let _=0;_<16;_++)L[_]=z[_]}function b(L,F){const z=new Uint8Array(32),_=new Float64Array(80),$=n(),ie=n(),ce=n(),K=n(),P=n(),M=n();for(let B=0;B<31;B++)z[B]=L[B];z[31]=L[31]&127|64,z[0]&=248,l(_,F);for(let B=0;B<16;B++)ie[B]=_[B];$[0]=K[0]=1;for(let B=254;B>=0;--B){const E=z[B>>>3]>>>(B&7)&1;a($,ie,E),a(ce,K,E),f(P,$,ce),u($,$,ce),f(ce,ie,K),u(ie,ie,K),g(K,P),g(M,$),p($,ce,$),p(ce,ie,P),f(P,$,ce),u($,$,ce),g(ie,$),u(ce,K,M),p($,ce,s),f($,$,K),p(ce,ce,$),p($,K,M),p(K,ie,_),g(ie,P),a($,ie,E),a(ce,K,E)}for(let B=0;B<16;B++)_[B+16]=$[B],_[B+32]=ce[B],_[B+48]=ie[B],_[B+64]=K[B];const v=_.subarray(32),m=_.subarray(16);y(v,v),p(m,m,v);const R=new Uint8Array(32);return c(R,m),R}t.scalarMult=b;function I(L){return b(L,i)}t.scalarMultBase=I;function C(L){if(L.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const F=new Uint8Array(L);return{publicKey:I(F),secretKey:F}}t.generateKeyPairFromSeed=C;function S(L){const F=(0,e.randomBytes)(32,L),z=C(F);return(0,r.wipe)(F),z}t.generateKeyPair=S;function O(L,F,z=!1){if(L.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(F.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _=b(L,F);if(z){let $=0;for(let ie=0;ie<_.length;ie++)$|=_[ie];if($===0)throw new Error("X25519: invalid shared key")}return _}t.sharedKey=O})(PM);function dee(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function M3(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=dee(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function UIe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(O);C!==S;){for(var F=y[C],z=0,_=O-1;(F!==0||z>>0,L[_]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");I=z,C++}for(var $=O-I;$!==O&&L[$]===0;)$++;for(var ie=c.repeat(b);$>>0,O=new Uint8Array(S);y[b];){var L=r[y.charCodeAt(b)];if(L===255)return;for(var F=0,z=S-1;(L!==0||F>>0,O[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");C=F,b++}if(y[b]!==" "){for(var _=S-C;_!==S&&O[_]===0;)_++;for(var $=new Uint8Array(I+(S-_)),ie=I;_!==S;)$[ie++]=O[_++];return $}}}function g(y){var b=p(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:p,decode:g}}var $Ie=UIe,qIe=$Ie;const VIe=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},zIe=t=>new TextEncoder().encode(t),HIe=t=>new TextDecoder().decode(t);class GIe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class WIe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return hee(this,e)}}class KIe{constructor(e){this.decoders=e}or(e){return hee(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const hee=(t,e)=>new KIe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class YIe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new GIe(e,r,n),this.decoder=new WIe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gE=({name:t,prefix:e,encode:r,decode:n})=>new YIe(t,e,r,n),Dx=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=qIe(r,e);return gE({prefix:t,name:e,encode:n,decode:s=>VIe(i(s))})},QIe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},JIe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<gE({prefix:e,name:t,encode(i){return JIe(i,n,r)},decode(i){return QIe(i,n,r,t)}}),ZIe=gE({prefix:"\0",name:"identity",encode:t=>HIe(t),decode:t=>zIe(t)}),XIe=Object.freeze(Object.defineProperty({__proto__:null,identity:ZIe},Symbol.toStringTag,{value:"Module"})),eTe=ls({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),tTe=Object.freeze(Object.defineProperty({__proto__:null,base2:eTe},Symbol.toStringTag,{value:"Module"})),rTe=ls({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),nTe=Object.freeze(Object.defineProperty({__proto__:null,base8:rTe},Symbol.toStringTag,{value:"Module"})),iTe=Dx({prefix:"9",name:"base10",alphabet:"0123456789"}),sTe=Object.freeze(Object.defineProperty({__proto__:null,base10:iTe},Symbol.toStringTag,{value:"Module"})),oTe=ls({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),aTe=ls({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),cTe=Object.freeze(Object.defineProperty({__proto__:null,base16:oTe,base16upper:aTe},Symbol.toStringTag,{value:"Module"})),lTe=ls({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),fTe=ls({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),uTe=ls({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dTe=ls({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),hTe=ls({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),pTe=ls({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vTe=ls({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gTe=ls({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),yTe=ls({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),mTe=Object.freeze(Object.defineProperty({__proto__:null,base32:lTe,base32hex:hTe,base32hexpad:vTe,base32hexpadupper:gTe,base32hexupper:pTe,base32pad:uTe,base32padupper:dTe,base32upper:fTe,base32z:yTe},Symbol.toStringTag,{value:"Module"})),bTe=Dx({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wTe=Dx({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),xTe=Object.freeze(Object.defineProperty({__proto__:null,base36:bTe,base36upper:wTe},Symbol.toStringTag,{value:"Module"})),ETe=Dx({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),CTe=Dx({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ATe=Object.freeze(Object.defineProperty({__proto__:null,base58btc:ETe,base58flickr:CTe},Symbol.toStringTag,{value:"Module"})),STe=ls({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_Te=ls({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ITe=ls({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),TTe=ls({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),PTe=Object.freeze(Object.defineProperty({__proto__:null,base64:STe,base64pad:_Te,base64url:ITe,base64urlpad:TTe},Symbol.toStringTag,{value:"Module"})),pee=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),kTe=pee.reduce((t,e,r)=>(t[r]=e,t),[]),MTe=pee.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function RTe(t){return t.reduce((e,r)=>(e+=kTe[r],e),"")}function OTe(t){const e=[];for(const r of t){const n=MTe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const DTe=gE({prefix:"🚀",name:"base256emoji",encode:RTe,decode:OTe}),NTe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:DTe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const Fj={...XIe,...tTe,...nTe,...sTe,...cTe,...mTe,...xTe,...ATe,...PTe,...NTe};function vee(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const jj=vee("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),q9=vee("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=dee(t.length);for(let r=0;r",HTe="MIT",GTe={url:"https://github.com/indutny/elliptic/issues"},WTe="https://github.com/indutny/elliptic",KTe={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},YTe={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},QTe={name:BTe,version:LTe,description:FTe,main:jTe,files:UTe,scripts:$Te,repository:qTe,keywords:VTe,author:zTe,license:HTe,bugs:GTe,homepage:WTe,devDependencies:KTe,dependencies:YTe};var Ea={},kM={exports:{}};kM.exports;(function(t){(function(e,r){function n(K,P){if(!K)throw new Error(P||"Assertion failed")}function i(K,P){K.super_=P;var M=function(){};M.prototype=P.prototype,K.prototype=new M,K.prototype.constructor=K}function s(K,P,M){if(s.isBN(K))return K;this.negative=0,this.words=null,this.length=0,this.red=null,K!==null&&((P==="le"||P==="be")&&(M=P,P=10),this._init(K||0,P||10,M||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=aE.Buffer}catch{}s.isBN=function(P){return P instanceof s?!0:P!==null&&typeof P=="object"&&P.constructor.wordSize===s.wordSize&&Array.isArray(P.words)},s.max=function(P,M){return P.cmp(M)>0?P:M},s.min=function(P,M){return P.cmp(M)<0?P:M},s.prototype._init=function(P,M,v){if(typeof P=="number")return this._initNumber(P,M,v);if(typeof P=="object")return this._initArray(P,M,v);M==="hex"&&(M=16),n(M===(M|0)&&M>=2&&M<=36),P=P.toString().replace(/\s+/g,"");var m=0;P[0]==="-"&&(m++,this.negative=1),m=0;m-=3)B=P[m]|P[m-1]<<8|P[m-2]<<16,this.words[R]|=B<>>26-E&67108863,E+=24,E>=26&&(E-=26,R++);else if(v==="le")for(m=0,R=0;m>>26-E&67108863,E+=24,E>=26&&(E-=26,R++);return this.strip()};function a(K,P){var M=K.charCodeAt(P);return M>=65&&M<=70?M-55:M>=97&&M<=102?M-87:M-48&15}function c(K,P,M){var v=a(K,M);return M-1>=P&&(v|=a(K,M-1)<<4),v}s.prototype._parseHex=function(P,M,v){this.length=Math.ceil((P.length-M)/6),this.words=new Array(this.length);for(var m=0;m=M;m-=2)E=c(P,M,m)<=18?(R-=18,B+=1,this.words[B]|=E>>>26):R+=8;else{var x=P.length-M;for(m=x%2===0?M+1:M;m=18?(R-=18,B+=1,this.words[B]|=E>>>26):R+=8}this.strip()};function l(K,P,M,v){for(var m=0,R=Math.min(K.length,M),B=P;B=49?m+=E-49+10:E>=17?m+=E-17+10:m+=E}return m}s.prototype._parseBase=function(P,M,v){this.words=[0],this.length=1;for(var m=0,R=1;R<=67108863;R*=M)m++;m--,R=R/M|0;for(var B=P.length-v,E=B%m,x=Math.min(B,B-E)+v,w=0,T=v;T1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var f=["","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"],u=[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];s.prototype.toString=function(P,M){P=P||10,M=M|0||1;var v;if(P===16||P==="hex"){v="";for(var m=0,R=0,B=0;B>>24-m&16777215,R!==0||B!==this.length-1?v=f[6-x.length]+x+v:v=x+v,m+=2,m>=26&&(m-=26,B--)}for(R!==0&&(v=R.toString(16)+v);v.length%M!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(P===(P|0)&&P>=2&&P<=36){var w=u[P],T=p[P];v="";var k=this.clone();for(k.negative=0;!k.isZero();){var H=k.modn(T).toString(P);k=k.idivn(T),k.isZero()?v=H+v:v=f[w-H.length]+H+v}for(this.isZero()&&(v="0"+v);v.length%M!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var P=this.words[0];return this.length===2?P+=this.words[1]*67108864:this.length===3&&this.words[2]===1?P+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-P:P},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(P,M){return n(typeof o<"u"),this.toArrayLike(o,P,M)},s.prototype.toArray=function(P,M){return this.toArrayLike(Array,P,M)},s.prototype.toArrayLike=function(P,M,v){var m=this.byteLength(),R=v||Math.max(1,m);n(m<=R,"byte array longer than desired length"),n(R>0,"Requested array length <= 0"),this.strip();var B=M==="le",E=new P(R),x,w,T=this.clone();if(B){for(w=0;!T.isZero();w++)x=T.andln(255),T.iushrn(8),E[w]=x;for(;w=4096&&(v+=13,M>>>=13),M>=64&&(v+=7,M>>>=7),M>=8&&(v+=4,M>>>=4),M>=2&&(v+=2,M>>>=2),v+M},s.prototype._zeroBits=function(P){if(P===0)return 26;var M=P,v=0;return M&8191||(v+=13,M>>>=13),M&127||(v+=7,M>>>=7),M&15||(v+=4,M>>>=4),M&3||(v+=2,M>>>=2),M&1||v++,v},s.prototype.bitLength=function(){var P=this.words[this.length-1],M=this._countBits(P);return(this.length-1)*26+M};function g(K){for(var P=new Array(K.bitLength()),M=0;M>>m}return P}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var P=0,M=0;MP.length?this.clone().ior(P):P.clone().ior(this)},s.prototype.uor=function(P){return this.length>P.length?this.clone().iuor(P):P.clone().iuor(this)},s.prototype.iuand=function(P){var M;this.length>P.length?M=P:M=this;for(var v=0;vP.length?this.clone().iand(P):P.clone().iand(this)},s.prototype.uand=function(P){return this.length>P.length?this.clone().iuand(P):P.clone().iuand(this)},s.prototype.iuxor=function(P){var M,v;this.length>P.length?(M=this,v=P):(M=P,v=this);for(var m=0;mP.length?this.clone().ixor(P):P.clone().ixor(this)},s.prototype.uxor=function(P){return this.length>P.length?this.clone().iuxor(P):P.clone().iuxor(this)},s.prototype.inotn=function(P){n(typeof P=="number"&&P>=0);var M=Math.ceil(P/26)|0,v=P%26;this._expand(M),v>0&&M--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-v),this.strip()},s.prototype.notn=function(P){return this.clone().inotn(P)},s.prototype.setn=function(P,M){n(typeof P=="number"&&P>=0);var v=P/26|0,m=P%26;return this._expand(v+1),M?this.words[v]=this.words[v]|1<P.length?(v=this,m=P):(v=P,m=this);for(var R=0,B=0;B>>26;for(;R!==0&&B>>26;if(this.length=v.length,R!==0)this.words[this.length]=R,this.length++;else if(v!==this)for(;BP.length?this.clone().iadd(P):P.clone().iadd(this)},s.prototype.isub=function(P){if(P.negative!==0){P.negative=0;var M=this.iadd(P);return P.negative=1,M._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(P),this.negative=1,this._normSign();var v=this.cmp(P);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,R;v>0?(m=this,R=P):(m=P,R=this);for(var B=0,E=0;E>26,this.words[E]=M&67108863;for(;B!==0&&E>26,this.words[E]=M&67108863;if(B===0&&E>>26,k=x&67108863,H=Math.min(w,P.length-1),oe=Math.max(0,w-K.length+1);oe<=H;oe++){var j=w-oe|0;m=K.words[j]|0,R=P.words[oe]|0,B=m*R+k,T+=B/67108864|0,k=B&67108863}M.words[w]=k|0,x=T|0}return x!==0?M.words[w]=x|0:M.length--,M.strip()}var b=function(P,M,v){var m=P.words,R=M.words,B=v.words,E=0,x,w,T,k=m[0]|0,H=k&8191,oe=k>>>13,j=m[1]|0,X=j&8191,G=j>>>13,Z=m[2]|0,ee=Z&8191,N=Z>>>13,te=m[3]|0,fe=te&8191,Ee=te>>>13,_e=m[4]|0,Re=_e&8191,Te=_e>>>13,De=m[5]|0,ze=De&8191,et=De>>>13,Je=m[6]|0,ke=Je&8191,Ne=Je>>>13,tt=m[7]|0,Ze=tt&8191,st=tt>>>13,nt=m[8]|0,We=nt&8191,lt=nt>>>13,vt=m[9]|0,Ke=vt&8191,gt=vt>>>13,wt=R[0]|0,rt=wt&8191,It=wt>>>13,At=R[1]|0,Tt=At&8191,Xt=At>>>13,lr=R[2]|0,xt=lr&8191,ar=lr>>>13,rr=R[3]|0,kt=rr&8191,Dt=rr>>>13,Nt=R[4]|0,dt=Nt&8191,Lt=Nt>>>13,Mt=R[5]|0,ut=Mt&8191,Vt=Mt>>>13,zt=R[6]|0,ht=zt&8191,Et=zt>>>13,Bt=R[7]|0,He=Bt&8191,$t=Bt>>>13,Ct=R[8]|0,ct=Ct&8191,Ht=Ct>>>13,Rr=R[9]|0,Ut=Rr&8191,Sr=Rr>>>13;v.negative=P.negative^M.negative,v.length=19,x=Math.imul(H,rt),w=Math.imul(H,It),w=w+Math.imul(oe,rt)|0,T=Math.imul(oe,It);var er=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(er>>>26)|0,er&=67108863,x=Math.imul(X,rt),w=Math.imul(X,It),w=w+Math.imul(G,rt)|0,T=Math.imul(G,It),x=x+Math.imul(H,Tt)|0,w=w+Math.imul(H,Xt)|0,w=w+Math.imul(oe,Tt)|0,T=T+Math.imul(oe,Xt)|0;var kr=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(kr>>>26)|0,kr&=67108863,x=Math.imul(ee,rt),w=Math.imul(ee,It),w=w+Math.imul(N,rt)|0,T=Math.imul(N,It),x=x+Math.imul(X,Tt)|0,w=w+Math.imul(X,Xt)|0,w=w+Math.imul(G,Tt)|0,T=T+Math.imul(G,Xt)|0,x=x+Math.imul(H,xt)|0,w=w+Math.imul(H,ar)|0,w=w+Math.imul(oe,xt)|0,T=T+Math.imul(oe,ar)|0;var bi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(bi>>>26)|0,bi&=67108863,x=Math.imul(fe,rt),w=Math.imul(fe,It),w=w+Math.imul(Ee,rt)|0,T=Math.imul(Ee,It),x=x+Math.imul(ee,Tt)|0,w=w+Math.imul(ee,Xt)|0,w=w+Math.imul(N,Tt)|0,T=T+Math.imul(N,Xt)|0,x=x+Math.imul(X,xt)|0,w=w+Math.imul(X,ar)|0,w=w+Math.imul(G,xt)|0,T=T+Math.imul(G,ar)|0,x=x+Math.imul(H,kt)|0,w=w+Math.imul(H,Dt)|0,w=w+Math.imul(oe,kt)|0,T=T+Math.imul(oe,Dt)|0;var wi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(wi>>>26)|0,wi&=67108863,x=Math.imul(Re,rt),w=Math.imul(Re,It),w=w+Math.imul(Te,rt)|0,T=Math.imul(Te,It),x=x+Math.imul(fe,Tt)|0,w=w+Math.imul(fe,Xt)|0,w=w+Math.imul(Ee,Tt)|0,T=T+Math.imul(Ee,Xt)|0,x=x+Math.imul(ee,xt)|0,w=w+Math.imul(ee,ar)|0,w=w+Math.imul(N,xt)|0,T=T+Math.imul(N,ar)|0,x=x+Math.imul(X,kt)|0,w=w+Math.imul(X,Dt)|0,w=w+Math.imul(G,kt)|0,T=T+Math.imul(G,Dt)|0,x=x+Math.imul(H,dt)|0,w=w+Math.imul(H,Lt)|0,w=w+Math.imul(oe,dt)|0,T=T+Math.imul(oe,Lt)|0;var xi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(xi>>>26)|0,xi&=67108863,x=Math.imul(ze,rt),w=Math.imul(ze,It),w=w+Math.imul(et,rt)|0,T=Math.imul(et,It),x=x+Math.imul(Re,Tt)|0,w=w+Math.imul(Re,Xt)|0,w=w+Math.imul(Te,Tt)|0,T=T+Math.imul(Te,Xt)|0,x=x+Math.imul(fe,xt)|0,w=w+Math.imul(fe,ar)|0,w=w+Math.imul(Ee,xt)|0,T=T+Math.imul(Ee,ar)|0,x=x+Math.imul(ee,kt)|0,w=w+Math.imul(ee,Dt)|0,w=w+Math.imul(N,kt)|0,T=T+Math.imul(N,Dt)|0,x=x+Math.imul(X,dt)|0,w=w+Math.imul(X,Lt)|0,w=w+Math.imul(G,dt)|0,T=T+Math.imul(G,Lt)|0,x=x+Math.imul(H,ut)|0,w=w+Math.imul(H,Vt)|0,w=w+Math.imul(oe,ut)|0,T=T+Math.imul(oe,Vt)|0;var Ti=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,x=Math.imul(ke,rt),w=Math.imul(ke,It),w=w+Math.imul(Ne,rt)|0,T=Math.imul(Ne,It),x=x+Math.imul(ze,Tt)|0,w=w+Math.imul(ze,Xt)|0,w=w+Math.imul(et,Tt)|0,T=T+Math.imul(et,Xt)|0,x=x+Math.imul(Re,xt)|0,w=w+Math.imul(Re,ar)|0,w=w+Math.imul(Te,xt)|0,T=T+Math.imul(Te,ar)|0,x=x+Math.imul(fe,kt)|0,w=w+Math.imul(fe,Dt)|0,w=w+Math.imul(Ee,kt)|0,T=T+Math.imul(Ee,Dt)|0,x=x+Math.imul(ee,dt)|0,w=w+Math.imul(ee,Lt)|0,w=w+Math.imul(N,dt)|0,T=T+Math.imul(N,Lt)|0,x=x+Math.imul(X,ut)|0,w=w+Math.imul(X,Vt)|0,w=w+Math.imul(G,ut)|0,T=T+Math.imul(G,Vt)|0,x=x+Math.imul(H,ht)|0,w=w+Math.imul(H,Et)|0,w=w+Math.imul(oe,ht)|0,T=T+Math.imul(oe,Et)|0;var Sn=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Sn>>>26)|0,Sn&=67108863,x=Math.imul(Ze,rt),w=Math.imul(Ze,It),w=w+Math.imul(st,rt)|0,T=Math.imul(st,It),x=x+Math.imul(ke,Tt)|0,w=w+Math.imul(ke,Xt)|0,w=w+Math.imul(Ne,Tt)|0,T=T+Math.imul(Ne,Xt)|0,x=x+Math.imul(ze,xt)|0,w=w+Math.imul(ze,ar)|0,w=w+Math.imul(et,xt)|0,T=T+Math.imul(et,ar)|0,x=x+Math.imul(Re,kt)|0,w=w+Math.imul(Re,Dt)|0,w=w+Math.imul(Te,kt)|0,T=T+Math.imul(Te,Dt)|0,x=x+Math.imul(fe,dt)|0,w=w+Math.imul(fe,Lt)|0,w=w+Math.imul(Ee,dt)|0,T=T+Math.imul(Ee,Lt)|0,x=x+Math.imul(ee,ut)|0,w=w+Math.imul(ee,Vt)|0,w=w+Math.imul(N,ut)|0,T=T+Math.imul(N,Vt)|0,x=x+Math.imul(X,ht)|0,w=w+Math.imul(X,Et)|0,w=w+Math.imul(G,ht)|0,T=T+Math.imul(G,Et)|0,x=x+Math.imul(H,He)|0,w=w+Math.imul(H,$t)|0,w=w+Math.imul(oe,He)|0,T=T+Math.imul(oe,$t)|0;var di=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(di>>>26)|0,di&=67108863,x=Math.imul(We,rt),w=Math.imul(We,It),w=w+Math.imul(lt,rt)|0,T=Math.imul(lt,It),x=x+Math.imul(Ze,Tt)|0,w=w+Math.imul(Ze,Xt)|0,w=w+Math.imul(st,Tt)|0,T=T+Math.imul(st,Xt)|0,x=x+Math.imul(ke,xt)|0,w=w+Math.imul(ke,ar)|0,w=w+Math.imul(Ne,xt)|0,T=T+Math.imul(Ne,ar)|0,x=x+Math.imul(ze,kt)|0,w=w+Math.imul(ze,Dt)|0,w=w+Math.imul(et,kt)|0,T=T+Math.imul(et,Dt)|0,x=x+Math.imul(Re,dt)|0,w=w+Math.imul(Re,Lt)|0,w=w+Math.imul(Te,dt)|0,T=T+Math.imul(Te,Lt)|0,x=x+Math.imul(fe,ut)|0,w=w+Math.imul(fe,Vt)|0,w=w+Math.imul(Ee,ut)|0,T=T+Math.imul(Ee,Vt)|0,x=x+Math.imul(ee,ht)|0,w=w+Math.imul(ee,Et)|0,w=w+Math.imul(N,ht)|0,T=T+Math.imul(N,Et)|0,x=x+Math.imul(X,He)|0,w=w+Math.imul(X,$t)|0,w=w+Math.imul(G,He)|0,T=T+Math.imul(G,$t)|0,x=x+Math.imul(H,ct)|0,w=w+Math.imul(H,Ht)|0,w=w+Math.imul(oe,ct)|0,T=T+Math.imul(oe,Ht)|0;var Fs=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Fs>>>26)|0,Fs&=67108863,x=Math.imul(Ke,rt),w=Math.imul(Ke,It),w=w+Math.imul(gt,rt)|0,T=Math.imul(gt,It),x=x+Math.imul(We,Tt)|0,w=w+Math.imul(We,Xt)|0,w=w+Math.imul(lt,Tt)|0,T=T+Math.imul(lt,Xt)|0,x=x+Math.imul(Ze,xt)|0,w=w+Math.imul(Ze,ar)|0,w=w+Math.imul(st,xt)|0,T=T+Math.imul(st,ar)|0,x=x+Math.imul(ke,kt)|0,w=w+Math.imul(ke,Dt)|0,w=w+Math.imul(Ne,kt)|0,T=T+Math.imul(Ne,Dt)|0,x=x+Math.imul(ze,dt)|0,w=w+Math.imul(ze,Lt)|0,w=w+Math.imul(et,dt)|0,T=T+Math.imul(et,Lt)|0,x=x+Math.imul(Re,ut)|0,w=w+Math.imul(Re,Vt)|0,w=w+Math.imul(Te,ut)|0,T=T+Math.imul(Te,Vt)|0,x=x+Math.imul(fe,ht)|0,w=w+Math.imul(fe,Et)|0,w=w+Math.imul(Ee,ht)|0,T=T+Math.imul(Ee,Et)|0,x=x+Math.imul(ee,He)|0,w=w+Math.imul(ee,$t)|0,w=w+Math.imul(N,He)|0,T=T+Math.imul(N,$t)|0,x=x+Math.imul(X,ct)|0,w=w+Math.imul(X,Ht)|0,w=w+Math.imul(G,ct)|0,T=T+Math.imul(G,Ht)|0,x=x+Math.imul(H,Ut)|0,w=w+Math.imul(H,Sr)|0,w=w+Math.imul(oe,Ut)|0,T=T+Math.imul(oe,Sr)|0;var hi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(hi>>>26)|0,hi&=67108863,x=Math.imul(Ke,Tt),w=Math.imul(Ke,Xt),w=w+Math.imul(gt,Tt)|0,T=Math.imul(gt,Xt),x=x+Math.imul(We,xt)|0,w=w+Math.imul(We,ar)|0,w=w+Math.imul(lt,xt)|0,T=T+Math.imul(lt,ar)|0,x=x+Math.imul(Ze,kt)|0,w=w+Math.imul(Ze,Dt)|0,w=w+Math.imul(st,kt)|0,T=T+Math.imul(st,Dt)|0,x=x+Math.imul(ke,dt)|0,w=w+Math.imul(ke,Lt)|0,w=w+Math.imul(Ne,dt)|0,T=T+Math.imul(Ne,Lt)|0,x=x+Math.imul(ze,ut)|0,w=w+Math.imul(ze,Vt)|0,w=w+Math.imul(et,ut)|0,T=T+Math.imul(et,Vt)|0,x=x+Math.imul(Re,ht)|0,w=w+Math.imul(Re,Et)|0,w=w+Math.imul(Te,ht)|0,T=T+Math.imul(Te,Et)|0,x=x+Math.imul(fe,He)|0,w=w+Math.imul(fe,$t)|0,w=w+Math.imul(Ee,He)|0,T=T+Math.imul(Ee,$t)|0,x=x+Math.imul(ee,ct)|0,w=w+Math.imul(ee,Ht)|0,w=w+Math.imul(N,ct)|0,T=T+Math.imul(N,Ht)|0,x=x+Math.imul(X,Ut)|0,w=w+Math.imul(X,Sr)|0,w=w+Math.imul(G,Ut)|0,T=T+Math.imul(G,Sr)|0;var jo=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(jo>>>26)|0,jo&=67108863,x=Math.imul(Ke,xt),w=Math.imul(Ke,ar),w=w+Math.imul(gt,xt)|0,T=Math.imul(gt,ar),x=x+Math.imul(We,kt)|0,w=w+Math.imul(We,Dt)|0,w=w+Math.imul(lt,kt)|0,T=T+Math.imul(lt,Dt)|0,x=x+Math.imul(Ze,dt)|0,w=w+Math.imul(Ze,Lt)|0,w=w+Math.imul(st,dt)|0,T=T+Math.imul(st,Lt)|0,x=x+Math.imul(ke,ut)|0,w=w+Math.imul(ke,Vt)|0,w=w+Math.imul(Ne,ut)|0,T=T+Math.imul(Ne,Vt)|0,x=x+Math.imul(ze,ht)|0,w=w+Math.imul(ze,Et)|0,w=w+Math.imul(et,ht)|0,T=T+Math.imul(et,Et)|0,x=x+Math.imul(Re,He)|0,w=w+Math.imul(Re,$t)|0,w=w+Math.imul(Te,He)|0,T=T+Math.imul(Te,$t)|0,x=x+Math.imul(fe,ct)|0,w=w+Math.imul(fe,Ht)|0,w=w+Math.imul(Ee,ct)|0,T=T+Math.imul(Ee,Ht)|0,x=x+Math.imul(ee,Ut)|0,w=w+Math.imul(ee,Sr)|0,w=w+Math.imul(N,Ut)|0,T=T+Math.imul(N,Sr)|0;var Uo=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Uo>>>26)|0,Uo&=67108863,x=Math.imul(Ke,kt),w=Math.imul(Ke,Dt),w=w+Math.imul(gt,kt)|0,T=Math.imul(gt,Dt),x=x+Math.imul(We,dt)|0,w=w+Math.imul(We,Lt)|0,w=w+Math.imul(lt,dt)|0,T=T+Math.imul(lt,Lt)|0,x=x+Math.imul(Ze,ut)|0,w=w+Math.imul(Ze,Vt)|0,w=w+Math.imul(st,ut)|0,T=T+Math.imul(st,Vt)|0,x=x+Math.imul(ke,ht)|0,w=w+Math.imul(ke,Et)|0,w=w+Math.imul(Ne,ht)|0,T=T+Math.imul(Ne,Et)|0,x=x+Math.imul(ze,He)|0,w=w+Math.imul(ze,$t)|0,w=w+Math.imul(et,He)|0,T=T+Math.imul(et,$t)|0,x=x+Math.imul(Re,ct)|0,w=w+Math.imul(Re,Ht)|0,w=w+Math.imul(Te,ct)|0,T=T+Math.imul(Te,Ht)|0,x=x+Math.imul(fe,Ut)|0,w=w+Math.imul(fe,Sr)|0,w=w+Math.imul(Ee,Ut)|0,T=T+Math.imul(Ee,Sr)|0;var pi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(pi>>>26)|0,pi&=67108863,x=Math.imul(Ke,dt),w=Math.imul(Ke,Lt),w=w+Math.imul(gt,dt)|0,T=Math.imul(gt,Lt),x=x+Math.imul(We,ut)|0,w=w+Math.imul(We,Vt)|0,w=w+Math.imul(lt,ut)|0,T=T+Math.imul(lt,Vt)|0,x=x+Math.imul(Ze,ht)|0,w=w+Math.imul(Ze,Et)|0,w=w+Math.imul(st,ht)|0,T=T+Math.imul(st,Et)|0,x=x+Math.imul(ke,He)|0,w=w+Math.imul(ke,$t)|0,w=w+Math.imul(Ne,He)|0,T=T+Math.imul(Ne,$t)|0,x=x+Math.imul(ze,ct)|0,w=w+Math.imul(ze,Ht)|0,w=w+Math.imul(et,ct)|0,T=T+Math.imul(et,Ht)|0,x=x+Math.imul(Re,Ut)|0,w=w+Math.imul(Re,Sr)|0,w=w+Math.imul(Te,Ut)|0,T=T+Math.imul(Te,Sr)|0;var oo=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(oo>>>26)|0,oo&=67108863,x=Math.imul(Ke,ut),w=Math.imul(Ke,Vt),w=w+Math.imul(gt,ut)|0,T=Math.imul(gt,Vt),x=x+Math.imul(We,ht)|0,w=w+Math.imul(We,Et)|0,w=w+Math.imul(lt,ht)|0,T=T+Math.imul(lt,Et)|0,x=x+Math.imul(Ze,He)|0,w=w+Math.imul(Ze,$t)|0,w=w+Math.imul(st,He)|0,T=T+Math.imul(st,$t)|0,x=x+Math.imul(ke,ct)|0,w=w+Math.imul(ke,Ht)|0,w=w+Math.imul(Ne,ct)|0,T=T+Math.imul(Ne,Ht)|0,x=x+Math.imul(ze,Ut)|0,w=w+Math.imul(ze,Sr)|0,w=w+Math.imul(et,Ut)|0,T=T+Math.imul(et,Sr)|0;var ao=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(ao>>>26)|0,ao&=67108863,x=Math.imul(Ke,ht),w=Math.imul(Ke,Et),w=w+Math.imul(gt,ht)|0,T=Math.imul(gt,Et),x=x+Math.imul(We,He)|0,w=w+Math.imul(We,$t)|0,w=w+Math.imul(lt,He)|0,T=T+Math.imul(lt,$t)|0,x=x+Math.imul(Ze,ct)|0,w=w+Math.imul(Ze,Ht)|0,w=w+Math.imul(st,ct)|0,T=T+Math.imul(st,Ht)|0,x=x+Math.imul(ke,Ut)|0,w=w+Math.imul(ke,Sr)|0,w=w+Math.imul(Ne,Ut)|0,T=T+Math.imul(Ne,Sr)|0;var _n=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(_n>>>26)|0,_n&=67108863,x=Math.imul(Ke,He),w=Math.imul(Ke,$t),w=w+Math.imul(gt,He)|0,T=Math.imul(gt,$t),x=x+Math.imul(We,ct)|0,w=w+Math.imul(We,Ht)|0,w=w+Math.imul(lt,ct)|0,T=T+Math.imul(lt,Ht)|0,x=x+Math.imul(Ze,Ut)|0,w=w+Math.imul(Ze,Sr)|0,w=w+Math.imul(st,Ut)|0,T=T+Math.imul(st,Sr)|0;var $o=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+($o>>>26)|0,$o&=67108863,x=Math.imul(Ke,ct),w=Math.imul(Ke,Ht),w=w+Math.imul(gt,ct)|0,T=Math.imul(gt,Ht),x=x+Math.imul(We,Ut)|0,w=w+Math.imul(We,Sr)|0,w=w+Math.imul(lt,Ut)|0,T=T+Math.imul(lt,Sr)|0;var Gi=(E+x|0)+((w&8191)<<13)|0;E=(T+(w>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,x=Math.imul(Ke,Ut),w=Math.imul(Ke,Sr),w=w+Math.imul(gt,Ut)|0,T=Math.imul(gt,Sr);var qo=(E+x|0)+((w&8191)<<13)|0;return E=(T+(w>>>13)|0)+(qo>>>26)|0,qo&=67108863,B[0]=er,B[1]=kr,B[2]=bi,B[3]=wi,B[4]=xi,B[5]=Ti,B[6]=Sn,B[7]=di,B[8]=Fs,B[9]=hi,B[10]=jo,B[11]=Uo,B[12]=pi,B[13]=oo,B[14]=ao,B[15]=_n,B[16]=$o,B[17]=Gi,B[18]=qo,E!==0&&(B[19]=E,v.length++),v};Math.imul||(b=y);function I(K,P,M){M.negative=P.negative^K.negative,M.length=K.length+P.length;for(var v=0,m=0,R=0;R>>26)|0,m+=B>>>26,B&=67108863}M.words[R]=E,v=B,B=m}return v!==0?M.words[R]=v:M.length--,M.strip()}function C(K,P,M){var v=new S;return v.mulp(K,P,M)}s.prototype.mulTo=function(P,M){var v,m=this.length+P.length;return this.length===10&&P.length===10?v=b(this,P,M):m<63?v=y(this,P,M):m<1024?v=I(this,P,M):v=C(this,P,M),v};function S(K,P){this.x=K,this.y=P}S.prototype.makeRBT=function(P){for(var M=new Array(P),v=s.prototype._countBits(P)-1,m=0;m>=1;return m},S.prototype.permute=function(P,M,v,m,R,B){for(var E=0;E>>1)R++;return 1<>>13,v[2*B+1]=R&8191,R=R>>>13;for(B=2*M;B>=26,M+=m/67108864|0,M+=R>>>26,this.words[v]=R&67108863}return M!==0&&(this.words[v]=M,this.length++),this},s.prototype.muln=function(P){return this.clone().imuln(P)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(P){var M=g(P);if(M.length===0)return new s(1);for(var v=this,m=0;m=0);var M=P%26,v=(P-M)/26,m=67108863>>>26-M<<26-M,R;if(M!==0){var B=0;for(R=0;R>>26-M}B&&(this.words[R]=B,this.length++)}if(v!==0){for(R=this.length-1;R>=0;R--)this.words[R+v]=this.words[R];for(R=0;R=0);var m;M?m=(M-M%26)/26:m=0;var R=P%26,B=Math.min((P-R)/26,this.length),E=67108863^67108863>>>R<B)for(this.length-=B,w=0;w=0&&(T!==0||w>=m);w--){var k=this.words[w]|0;this.words[w]=T<<26-R|k>>>R,T=k&E}return x&&T!==0&&(x.words[x.length++]=T),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(P,M,v){return n(this.negative===0),this.iushrn(P,M,v)},s.prototype.shln=function(P){return this.clone().ishln(P)},s.prototype.ushln=function(P){return this.clone().iushln(P)},s.prototype.shrn=function(P){return this.clone().ishrn(P)},s.prototype.ushrn=function(P){return this.clone().iushrn(P)},s.prototype.testn=function(P){n(typeof P=="number"&&P>=0);var M=P%26,v=(P-M)/26,m=1<=0);var M=P%26,v=(P-M)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(M!==0&&v++,this.length=Math.min(v,this.length),M!==0){var m=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},s.prototype.isubn=function(P){if(n(typeof P=="number"),n(P<67108864),P<0)return this.iaddn(-P);if(this.negative!==0)return this.negative=0,this.iaddn(P),this.negative=1,this;if(this.words[0]-=P,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var M=0;M>26)-(x/67108864|0),this.words[R+v]=B&67108863}for(;R>26,this.words[R+v]=B&67108863;if(E===0)return this.strip();for(n(E===-1),E=0,R=0;R>26,this.words[R]=B&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(P,M){var v=this.length-P.length,m=this.clone(),R=P,B=R.words[R.length-1]|0,E=this._countBits(B);v=26-E,v!==0&&(R=R.ushln(v),m.iushln(v),B=R.words[R.length-1]|0);var x=m.length-R.length,w;if(M!=="mod"){w=new s(null),w.length=x+1,w.words=new Array(w.length);for(var T=0;T=0;H--){var oe=(m.words[R.length+H]|0)*67108864+(m.words[R.length+H-1]|0);for(oe=Math.min(oe/B|0,67108863),m._ishlnsubmul(R,oe,H);m.negative!==0;)oe--,m.negative=0,m._ishlnsubmul(R,1,H),m.isZero()||(m.negative^=1);w&&(w.words[H]=oe)}return w&&w.strip(),m.strip(),M!=="div"&&v!==0&&m.iushrn(v),{div:w||null,mod:m}},s.prototype.divmod=function(P,M,v){if(n(!P.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var m,R,B;return this.negative!==0&&P.negative===0?(B=this.neg().divmod(P,M),M!=="mod"&&(m=B.div.neg()),M!=="div"&&(R=B.mod.neg(),v&&R.negative!==0&&R.iadd(P)),{div:m,mod:R}):this.negative===0&&P.negative!==0?(B=this.divmod(P.neg(),M),M!=="mod"&&(m=B.div.neg()),{div:m,mod:B.mod}):this.negative&P.negative?(B=this.neg().divmod(P.neg(),M),M!=="div"&&(R=B.mod.neg(),v&&R.negative!==0&&R.isub(P)),{div:B.div,mod:R}):P.length>this.length||this.cmp(P)<0?{div:new s(0),mod:this}:P.length===1?M==="div"?{div:this.divn(P.words[0]),mod:null}:M==="mod"?{div:null,mod:new s(this.modn(P.words[0]))}:{div:this.divn(P.words[0]),mod:new s(this.modn(P.words[0]))}:this._wordDiv(P,M)},s.prototype.div=function(P){return this.divmod(P,"div",!1).div},s.prototype.mod=function(P){return this.divmod(P,"mod",!1).mod},s.prototype.umod=function(P){return this.divmod(P,"mod",!0).mod},s.prototype.divRound=function(P){var M=this.divmod(P);if(M.mod.isZero())return M.div;var v=M.div.negative!==0?M.mod.isub(P):M.mod,m=P.ushrn(1),R=P.andln(1),B=v.cmp(m);return B<0||R===1&&B===0?M.div:M.div.negative!==0?M.div.isubn(1):M.div.iaddn(1)},s.prototype.modn=function(P){n(P<=67108863);for(var M=(1<<26)%P,v=0,m=this.length-1;m>=0;m--)v=(M*v+(this.words[m]|0))%P;return v},s.prototype.idivn=function(P){n(P<=67108863);for(var M=0,v=this.length-1;v>=0;v--){var m=(this.words[v]|0)+M*67108864;this.words[v]=m/P|0,M=m%P}return this.strip()},s.prototype.divn=function(P){return this.clone().idivn(P)},s.prototype.egcd=function(P){n(P.negative===0),n(!P.isZero());var M=this,v=P.clone();M.negative!==0?M=M.umod(P):M=M.clone();for(var m=new s(1),R=new s(0),B=new s(0),E=new s(1),x=0;M.isEven()&&v.isEven();)M.iushrn(1),v.iushrn(1),++x;for(var w=v.clone(),T=M.clone();!M.isZero();){for(var k=0,H=1;!(M.words[0]&H)&&k<26;++k,H<<=1);if(k>0)for(M.iushrn(k);k-- >0;)(m.isOdd()||R.isOdd())&&(m.iadd(w),R.isub(T)),m.iushrn(1),R.iushrn(1);for(var oe=0,j=1;!(v.words[0]&j)&&oe<26;++oe,j<<=1);if(oe>0)for(v.iushrn(oe);oe-- >0;)(B.isOdd()||E.isOdd())&&(B.iadd(w),E.isub(T)),B.iushrn(1),E.iushrn(1);M.cmp(v)>=0?(M.isub(v),m.isub(B),R.isub(E)):(v.isub(M),B.isub(m),E.isub(R))}return{a:B,b:E,gcd:v.iushln(x)}},s.prototype._invmp=function(P){n(P.negative===0),n(!P.isZero());var M=this,v=P.clone();M.negative!==0?M=M.umod(P):M=M.clone();for(var m=new s(1),R=new s(0),B=v.clone();M.cmpn(1)>0&&v.cmpn(1)>0;){for(var E=0,x=1;!(M.words[0]&x)&&E<26;++E,x<<=1);if(E>0)for(M.iushrn(E);E-- >0;)m.isOdd()&&m.iadd(B),m.iushrn(1);for(var w=0,T=1;!(v.words[0]&T)&&w<26;++w,T<<=1);if(w>0)for(v.iushrn(w);w-- >0;)R.isOdd()&&R.iadd(B),R.iushrn(1);M.cmp(v)>=0?(M.isub(v),m.isub(R)):(v.isub(M),R.isub(m))}var k;return M.cmpn(1)===0?k=m:k=R,k.cmpn(0)<0&&k.iadd(P),k},s.prototype.gcd=function(P){if(this.isZero())return P.abs();if(P.isZero())return this.abs();var M=this.clone(),v=P.clone();M.negative=0,v.negative=0;for(var m=0;M.isEven()&&v.isEven();m++)M.iushrn(1),v.iushrn(1);do{for(;M.isEven();)M.iushrn(1);for(;v.isEven();)v.iushrn(1);var R=M.cmp(v);if(R<0){var B=M;M=v,v=B}else if(R===0||v.cmpn(1)===0)break;M.isub(v)}while(!0);return v.iushln(m)},s.prototype.invm=function(P){return this.egcd(P).a.umod(P)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(P){return this.words[0]&P},s.prototype.bincn=function(P){n(typeof P=="number");var M=P%26,v=(P-M)/26,m=1<>>26,E&=67108863,this.words[B]=E}return R!==0&&(this.words[B]=R,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(P){var M=P<0;if(this.negative!==0&&!M)return-1;if(this.negative===0&&M)return 1;this.strip();var v;if(this.length>1)v=1;else{M&&(P=-P),n(P<=67108863,"Number is too big");var m=this.words[0]|0;v=m===P?0:mP.length)return 1;if(this.length=0;v--){var m=this.words[v]|0,R=P.words[v]|0;if(m!==R){mR&&(M=1);break}}return M},s.prototype.gtn=function(P){return this.cmpn(P)===1},s.prototype.gt=function(P){return this.cmp(P)===1},s.prototype.gten=function(P){return this.cmpn(P)>=0},s.prototype.gte=function(P){return this.cmp(P)>=0},s.prototype.ltn=function(P){return this.cmpn(P)===-1},s.prototype.lt=function(P){return this.cmp(P)===-1},s.prototype.lten=function(P){return this.cmpn(P)<=0},s.prototype.lte=function(P){return this.cmp(P)<=0},s.prototype.eqn=function(P){return this.cmpn(P)===0},s.prototype.eq=function(P){return this.cmp(P)===0},s.red=function(P){return new ie(P)},s.prototype.toRed=function(P){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),P.convertTo(this)._forceRed(P)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(P){return this.red=P,this},s.prototype.forceRed=function(P){return n(!this.red,"Already a number in reduction context"),this._forceRed(P)},s.prototype.redAdd=function(P){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,P)},s.prototype.redIAdd=function(P){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,P)},s.prototype.redSub=function(P){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,P)},s.prototype.redISub=function(P){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,P)},s.prototype.redShl=function(P){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,P)},s.prototype.redMul=function(P){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,P),this.red.mul(this,P)},s.prototype.redIMul=function(P){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,P),this.red.imul(this,P)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(P){return n(this.red&&!P.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,P)};var O={k256:null,p224:null,p192:null,p25519:null};function L(K,P){this.name=K,this.p=new s(P,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var P=new s(null);return P.words=new Array(Math.ceil(this.n/13)),P},L.prototype.ireduce=function(P){var M=P,v;do this.split(M,this.tmp),M=this.imulK(M),M=M.iadd(this.tmp),v=M.bitLength();while(v>this.n);var m=v0?M.isub(this.p):M.strip!==void 0?M.strip():M._strip(),M},L.prototype.split=function(P,M){P.iushrn(this.n,0,M)},L.prototype.imulK=function(P){return P.imul(this.k)};function F(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(F,L),F.prototype.split=function(P,M){for(var v=4194303,m=Math.min(P.length,9),R=0;R>>22,B=E}B>>>=22,P.words[R-10]=B,B===0&&P.length>10?P.length-=10:P.length-=9},F.prototype.imulK=function(P){P.words[P.length]=0,P.words[P.length+1]=0,P.length+=2;for(var M=0,v=0;v>>=26,P.words[v]=R,M=m}return M!==0&&(P.words[P.length++]=M),P},s._prime=function(P){if(O[P])return O[P];var M;if(P==="k256")M=new F;else if(P==="p224")M=new z;else if(P==="p192")M=new _;else if(P==="p25519")M=new $;else throw new Error("Unknown prime "+P);return O[P]=M,M};function ie(K){if(typeof K=="string"){var P=s._prime(K);this.m=P.p,this.prime=P}else n(K.gtn(1),"modulus must be greater than 1"),this.m=K,this.prime=null}ie.prototype._verify1=function(P){n(P.negative===0,"red works only with positives"),n(P.red,"red works only with red numbers")},ie.prototype._verify2=function(P,M){n((P.negative|M.negative)===0,"red works only with positives"),n(P.red&&P.red===M.red,"red works only with red numbers")},ie.prototype.imod=function(P){return this.prime?this.prime.ireduce(P)._forceRed(this):P.umod(this.m)._forceRed(this)},ie.prototype.neg=function(P){return P.isZero()?P.clone():this.m.sub(P)._forceRed(this)},ie.prototype.add=function(P,M){this._verify2(P,M);var v=P.add(M);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},ie.prototype.iadd=function(P,M){this._verify2(P,M);var v=P.iadd(M);return v.cmp(this.m)>=0&&v.isub(this.m),v},ie.prototype.sub=function(P,M){this._verify2(P,M);var v=P.sub(M);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},ie.prototype.isub=function(P,M){this._verify2(P,M);var v=P.isub(M);return v.cmpn(0)<0&&v.iadd(this.m),v},ie.prototype.shl=function(P,M){return this._verify1(P),this.imod(P.ushln(M))},ie.prototype.imul=function(P,M){return this._verify2(P,M),this.imod(P.imul(M))},ie.prototype.mul=function(P,M){return this._verify2(P,M),this.imod(P.mul(M))},ie.prototype.isqr=function(P){return this.imul(P,P.clone())},ie.prototype.sqr=function(P){return this.mul(P,P)},ie.prototype.sqrt=function(P){if(P.isZero())return P.clone();var M=this.m.andln(3);if(n(M%2===1),M===3){var v=this.m.add(new s(1)).iushrn(2);return this.pow(P,v)}for(var m=this.m.subn(1),R=0;!m.isZero()&&m.andln(1)===0;)R++,m.iushrn(1);n(!m.isZero());var B=new s(1).toRed(this),E=B.redNeg(),x=this.m.subn(1).iushrn(1),w=this.m.bitLength();for(w=new s(2*w*w).toRed(this);this.pow(w,x).cmp(E)!==0;)w.redIAdd(E);for(var T=this.pow(w,m),k=this.pow(P,m.addn(1).iushrn(1)),H=this.pow(P,m),oe=R;H.cmp(B)!==0;){for(var j=H,X=0;j.cmp(B)!==0;X++)j=j.redSqr();n(X=0;R--){for(var T=M.words[R],k=w-1;k>=0;k--){var H=T>>k&1;if(B!==m[0]&&(B=this.sqr(B)),H===0&&E===0){x=0;continue}E<<=1,E|=H,x++,!(x!==v&&(R!==0||k!==0))&&(B=this.mul(B,m[E]),x=0,E=0)}w=26}return B},ie.prototype.convertTo=function(P){var M=P.umod(this.m);return M===P?M.clone():M},ie.prototype.convertFrom=function(P){var M=P.clone();return M.red=null,M},s.mont=function(P){return new ce(P)};function ce(K){ie.call(this,K),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ce,ie),ce.prototype.convertTo=function(P){return this.imod(P.ushln(this.shift))},ce.prototype.convertFrom=function(P){var M=this.imod(P.mul(this.rinv));return M.red=null,M},ce.prototype.imul=function(P,M){if(P.isZero()||M.isZero())return P.words[0]=0,P.length=1,P;var v=P.imul(M),m=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=v.isub(m).iushrn(this.shift),B=R;return R.cmp(this.m)>=0?B=R.isub(this.m):R.cmpn(0)<0&&(B=R.iadd(this.m)),B._forceRed(this)},ce.prototype.mul=function(P,M){if(P.isZero()||M.isZero())return new s(0)._forceRed(this);var v=P.mul(M),m=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=v.isub(m).iushrn(this.shift),B=R;return R.cmp(this.m)>=0?B=R.isub(this.m):R.cmpn(0)<0&&(B=R.iadd(this.m)),B._forceRed(this)},ce.prototype.invm=function(P){var M=this.imod(P._invmp(this.m).mul(this.r2));return M._forceRed(this)}})(t,Si)})(kM);var Ou=kM.exports,MM={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var c=0;c>8,u=l&255;f?a.push(f,u):a.push(u)}return a}e.toArray=r;function n(s){return s.length===1?"0"+s:s}e.zero2=n;function i(s){for(var o="",a=0;a(b>>1)-1?C=(b>>1)-S:C=S,I.isubn(C)):C=0,g[y]=C,I.iushrn(1)}return g}e.getNAF=s;function o(f,u){var p=[[],[]];f=f.clone(),u=u.clone();for(var g=0,y=0,b;f.cmpn(-g)>0||u.cmpn(-y)>0;){var I=f.andln(3)+g&3,C=u.andln(3)+y&3;I===3&&(I=-1),C===3&&(C=-1);var S;I&1?(b=f.andln(7)+g&7,(b===3||b===5)&&C===2?S=-I:S=I):S=0,p[0].push(S);var O;C&1?(b=u.andln(7)+y&7,(b===3||b===5)&&I===2?O=-C:O=C):O=0,p[1].push(O),2*g===S+1&&(g=1-g),2*y===O+1&&(y=1-y),f.iushrn(1),u.iushrn(1)}return p}e.getJSF=o;function a(f,u,p){var g="_"+u;f.prototype[u]=function(){return this[g]!==void 0?this[g]:this[g]=p.call(this)}}e.cachedProperty=a;function c(f){return typeof f=="string"?e.toArray(f,"hex"):f}e.parseBytes=c;function l(f){return new r(f,"hex","le")}e.intFromLE=l})(Ea);var RM={exports:{}},V9;RM.exports=function(e){return V9||(V9=new Fd(null)),V9.generate(e)};function Fd(t){this.rand=t}RM.exports.Rand=Fd;Fd.prototype.generate=function(e){return this._rand(e)};Fd.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var yE=Bh;Bh.prototype.point=function(){throw new Error("Not implemented")};Bh.prototype.validate=function(){throw new Error("Not implemented")};Bh.prototype._fixedNafMul=function(e,r){n4(e.precomputed);var n=e._getDoubles(),i=r4(r,1,this._bitLength),s=(1<=a;l--)c=(c<<1)+i[l];o.push(c)}for(var f=this.jpoint(null,null,null),u=this.jpoint(null,null,null),p=s;p>0;p--){for(a=0;a=0;c--){for(var l=0;c>=0&&o[c]===0;c--)l++;if(c>=0&&l++,a=a.dblp(l),c<0)break;var f=o[c];n4(f!==0),e.type==="affine"?f>0?a=a.mixedAdd(s[f-1>>1]):a=a.mixedAdd(s[-f-1>>1].neg()):f>0?a=a.add(s[f-1>>1]):a=a.add(s[-f-1>>1].neg())}return e.type==="affine"?a.toP():a};Bh.prototype._wnafMulAdd=function(e,r,n,i,s){var o=this._wnafT1,a=this._wnafT2,c=this._wnafT3,l=0,f,u,p;for(f=0;f=1;f-=2){var y=f-1,b=f;if(o[y]!==1||o[b]!==1){c[y]=r4(n[y],o[y],this._bitLength),c[b]=r4(n[b],o[b],this._bitLength),l=Math.max(c[y].length,l),l=Math.max(c[b].length,l);continue}var I=[r[y],null,null,r[b]];r[y].y.cmp(r[b].y)===0?(I[1]=r[y].add(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg())):r[y].y.cmp(r[b].y.redNeg())===0?(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].add(r[b].neg())):(I[1]=r[y].toJ().mixedAdd(r[b]),I[2]=r[y].toJ().mixedAdd(r[b].neg()));var C=[-3,-1,-5,-7,0,7,5,1,3],S=JTe(n[y],n[b]);for(l=Math.max(S[0].length,l),c[y]=new Array(l),c[b]=new Array(l),u=0;u=0;f--){for(var _=0;f>=0;){var $=!0;for(u=0;u=0&&_++,F=F.dblp(_),f<0)break;for(u=0;u0?p=a[u][ie-1>>1]:ie<0&&(p=a[u][-ie-1>>1].neg()),p.type==="affine"?F=F.mixedAdd(p):F=F.add(p))}}for(f=0;f=Math.ceil((e.bitLength()+1)/r.step):!1};fc.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s=0&&(g=l,y=f),u.negative&&(u=u.neg(),p=p.neg()),g.negative&&(g=g.neg(),y=y.neg()),[{a:u,b:p},{a:g,b:y}]};uc.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],s=i.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=s.mul(n.a),c=o.mul(i.a),l=s.mul(n.b),f=o.mul(i.b),u=e.sub(a).sub(c),p=l.add(f).neg();return{k1:u,k2:p}};uc.prototype.pointFromX=function(e,r){e=new Kn(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 s=i.fromRed().isOdd();return(r&&!s||!r&&s)&&(i=i.redNeg()),this.point(e,i)};uc.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0};uc.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Hi.prototype.isInfinity=function(){return this.inf};Hi.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)};Hi.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(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Hi.prototype.getX=function(){return this.x.fromRed()};Hi.prototype.getY=function(){return this.y.fromRed()};Hi.prototype.mul=function(e){return e=new Kn(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)};Hi.prototype.mulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Hi.prototype.jmulAdd=function(e,r,n){var i=[this,r],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Hi.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)};Hi.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(s){return s.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};Hi.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 fs(t,e,r,n){By.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Kn(0)):(this.x=new Kn(e,16),this.y=new Kn(r,16),this.z=new Kn(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}DM(fs,By.BasePoint);uc.prototype.jpoint=function(e,r,n){return new fs(this,e,r,n)};fs.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)};fs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};fs.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),s=e.x.redMul(n),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),c=i.redSub(s),l=o.redSub(a);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),u=f.redMul(c),p=i.redMul(f),g=l.redSqr().redIAdd(u).redISub(p).redISub(p),y=l.redMul(p.redISub(g)).redISub(o.redMul(u)),b=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(g,y,b)};fs.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),s=this.y,o=e.y.redMul(r).redMul(this.z),a=n.redSub(i),c=s.redSub(o);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),f=l.redMul(a),u=n.redMul(l),p=c.redSqr().redIAdd(f).redISub(u).redISub(u),g=c.redMul(u.redISub(p)).redISub(s.redMul(f)),y=this.z.redMul(a);return this.curve.jpoint(p,g,y)};fs.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(s),this.x.cmp(n)===0)return!0}};fs.prototype.inspect=function(){return this.isInfinity()?"":""};fs.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var gv=Ou,bee=cE,mE=yE,tPe=Ea;function Ly(t){mE.call(this,"mont",t),this.a=new gv(t.a,16).toRed(this.red),this.b=new gv(t.b,16).toRed(this.red),this.i4=new gv(4).toRed(this.red).redInvm(),this.two=new gv(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}bee(Ly,mE);var rPe=Ly;Ly.prototype.validate=function(e){var r=e.normalize().x,n=r.redSqr(),i=n.redMul(r).redAdd(n.redMul(this.a)).redAdd(r),s=i.redSqrt();return s.redSqr().cmp(i)===0};function qi(t,e,r){mE.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new gv(e,16),this.z=new gv(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}bee(qi,mE.BasePoint);Ly.prototype.decodePoint=function(e,r){return this.point(tPe.toArray(e,r),1)};Ly.prototype.point=function(e,r){return new qi(this,e,r)};Ly.prototype.pointFromJSON=function(e){return qi.fromJSON(this,e)};qi.prototype.precompute=function(){};qi.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};qi.fromJSON=function(e,r){return new qi(e,r[0],r[1]||e.one)};qi.prototype.inspect=function(){return this.isInfinity()?"":""};qi.prototype.isInfinity=function(){return this.z.cmpn(0)===0};qi.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=r.redSub(i),o=r.redMul(i),a=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)};qi.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};qi.prototype.diffAdd=function(e,r){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(n),c=s.redMul(i),l=r.z.redMul(a.redAdd(c).redSqr()),f=r.x.redMul(a.redISub(c).redSqr());return this.curve.point(l,f)};qi.prototype.mul=function(e){for(var r=e.clone(),n=this,i=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i};qi.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};qi.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};qi.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};qi.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};qi.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var nPe=Ea,eu=Ou,wee=cE,bE=yE,iPe=nPe.assert;function of(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,bE.call(this,"edwards",t),this.a=new eu(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new eu(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new eu(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),iPe(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}wee(of,bE);var sPe=of;of.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};of.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};of.prototype.jpoint=function(e,r,n,i){return this.point(e,r,n,i)};of.prototype.pointFromX=function(e,r){e=new eu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var c=a.fromRed().isOdd();return(r&&!c||!r&&c)&&(a=a.redNeg()),this.point(e,a)};of.prototype.pointFromY=function(e,r){e=new eu(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};of.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),n=e.y.redSqr(),i=r.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(n)));return i.cmp(s)===0};function wn(t,e,r,n,i){bE.BasePoint.call(this,t,"projective"),e===null&&r===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new eu(e,16),this.y=new eu(r,16),this.z=n?new eu(n,16):this.curve.one,this.t=i&&new eu(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}wee(wn,bE.BasePoint);of.prototype.pointFromJSON=function(e){return wn.fromJSON(this,e)};of.prototype.point=function(e,r,n,i){return new wn(this,e,r,n,i)};wn.fromJSON=function(e,r){return new wn(e,r[0],r[1],r[2])};wn.prototype.inspect=function(){return this.isInfinity()?"":""};wn.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};wn.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=i.redAdd(r),a=o.redSub(n),c=i.redSub(r),l=s.redMul(a),f=o.redMul(c),u=s.redMul(c),p=a.redMul(o);return this.curve.point(l,f,p,u)};wn.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),n=this.y.redSqr(),i,s,o,a,c,l;if(this.curve.twisted){a=this.curve._mulA(r);var f=a.redAdd(n);this.zOne?(i=e.redSub(r).redSub(n).redMul(f.redSub(this.curve.two)),s=f.redMul(a.redSub(n)),o=f.redSqr().redSub(f).redSub(f)):(c=this.z.redSqr(),l=f.redSub(c).redISub(c),i=e.redSub(r).redISub(n).redMul(l),s=f.redMul(a.redSub(n)),o=f.redMul(l))}else a=r.redAdd(n),c=this.curve._mulC(this.z).redSqr(),l=a.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(a)).redMul(l),s=this.curve._mulC(a).redMul(r.redISub(n)),o=a.redMul(l);return this.curve.point(i,s,o)};wn.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};wn.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=n.redSub(r),a=s.redSub(i),c=s.redAdd(i),l=n.redAdd(r),f=o.redMul(a),u=c.redMul(l),p=o.redMul(l),g=a.redMul(c);return this.curve.point(f,u,g,p)};wn.prototype._projAdd=function(e){var r=this.z.redMul(e.z),n=r.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(i).redMul(s),a=n.redSub(o),c=n.redAdd(o),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),f=r.redMul(a).redMul(l),u,p;return this.curve.twisted?(u=r.redMul(c).redMul(s.redSub(this.curve._mulA(i))),p=a.redMul(c)):(u=r.redMul(c).redMul(s.redSub(i)),p=this.curve._mulC(a).redMul(c)),this.curve.point(f,u,p)};wn.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};wn.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};wn.prototype.mulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!1)};wn.prototype.jmulAdd=function(e,r,n){return this.curve._wnafMulAdd(1,[this,r],[e,n],2,!0)};wn.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};wn.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};wn.prototype.getX=function(){return this.normalize(),this.x.fromRed()};wn.prototype.getY=function(){return this.normalize(),this.y.fromRed()};wn.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};wn.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}};wn.prototype.toP=wn.prototype.normalize;wn.prototype.mixedAdd=wn.prototype.add;(function(t){var e=t;e.base=yE,e.short=ePe,e.mont=rPe,e.edwards=sPe})(OM);var wE={},z9,$j;function oPe(){return $j||($j=1,z9={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),z9}(function(t){var e=t,r=Mx,n=OM,i=Ea,s=i.assert;function o(l){l.type==="short"?this.curve=new n.short(l):l.type==="edwards"?this.curve=new n.edwards(l):this.curve=new n.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(l,f){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var u=new o(f);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:u}),u}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=oPe()}catch{c=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})})(wE);var aPe=Mx,yp=MM,xee=Yp;function vh(t){if(!(this instanceof vh))return new vh(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=yp.toArray(t.entropy,t.entropyEnc||"hex"),r=yp.toArray(t.nonce,t.nonceEnc||"hex"),n=yp.toArray(t.pers,t.persEnc||"hex");xee(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var cPe=vh;vh.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 s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};vh.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=yp.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length"};var i4=Ou,NM=Ea,dPe=NM.assert;function xE(t,e){if(t instanceof xE)return t;this._importDER(t,e)||(dPe(t.r&&t.s,"Signature without r or s"),this.r=new i4(t.r,16),this.s=new i4(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var hPe=xE;function pPe(){this.place=0}function H9(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||t[e.place]===0)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function qj(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)}xE.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=qj(r),n=qj(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];G9(i,r.length),i=i.concat(r),i.push(2),G9(i,n.length);var s=i.concat(n),o=[48];return G9(o,s.length),o=o.concat(s),NM.encode(o,e)};var tu=Ou,Eee=cPe,vPe=Ea,W9=wE,gPe=mee,Cee=vPe.assert,BM=uPe,EE=hPe;function ac(t){if(!(this instanceof ac))return new ac(t);typeof t=="string"&&(Cee(Object.prototype.hasOwnProperty.call(W9,t),"Unknown curve "+t),t=W9[t]),t instanceof W9.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 yPe=ac;ac.prototype.keyPair=function(e){return new BM(this,e)};ac.prototype.keyFromPrivate=function(e,r){return BM.fromPrivate(this,e,r)};ac.prototype.keyFromPublic=function(e,r){return BM.fromPublic(this,e,r)};ac.prototype.genKeyPair=function(e){e||(e={});for(var r=new Eee({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||gPe(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new tu(2));;){var s=new tu(r.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};ac.prototype._truncateToN=function(e,r,n){var i;if(tu.isBN(e)||typeof e=="number")e=new tu(e,16),i=e.byteLength();else if(typeof e=="object")i=e.length,e=new tu(e,16);else{var s=e.toString();i=s.length+1>>>1,e=new tu(s,16)}typeof n!="number"&&(n=i*8);var o=n-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};ac.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(e,!1,i.msgBitLength);for(var s=this.n.byteLength(),o=r.getPrivate().toArray("be",s),a=e.toArray("be",s),c=new Eee({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new tu(1)),f=0;;f++){var u=i.k?i.k(f):new tu(c.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(l)>=0)){var p=this.g.mul(u);if(!p.isInfinity()){var g=p.getX(),y=g.umod(this.n);if(y.cmpn(0)!==0){var b=u.invm(this.n).mul(y.mul(r.getPrivate()).iadd(e));if(b=b.umod(this.n),b.cmpn(0)!==0){var I=(p.getY().isOdd()?1:0)|(g.cmp(y)!==0?2:0);return i.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),I^=1),new EE({r:y,s:b,recoveryParam:I})}}}}}};ac.prototype.verify=function(e,r,n,i,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),n=this.keyFromPublic(n,i),r=new EE(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),l=c.mul(e).umod(this.n),f=c.mul(o).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.eqXToP(o)):(u=this.g.mulAdd(l,n.getPublic(),f),u.isInfinity()?!1:u.getX().umod(this.n).cmp(o)===0)};ac.prototype.recoverPubKey=function(t,e,r,n){Cee((3&r)===r,"The recovery param is more than two bits"),e=new EE(e,n);var i=this.n,s=new tu(t),o=e.r,a=e.s,c=r&1,l=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?o=this.curve.pointFromX(o.add(this.curve.n),c):o=this.curve.pointFromX(o,c);var f=e.r.invm(i),u=i.sub(s).mul(f).umod(i),p=a.mul(f).umod(i);return this.g.mulAdd(u,o,p)};ac.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new EE(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var Bx=Ea,Aee=Bx.assert,Vj=Bx.parseBytes,Fy=Bx.cachedProperty;function Ui(t,e){this.eddsa=t,this._secret=Vj(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Vj(e.pub)}Ui.fromPublic=function(e,r){return r instanceof Ui?r:new Ui(e,{pub:r})};Ui.fromSecret=function(e,r){return r instanceof Ui?r:new Ui(e,{secret:r})};Ui.prototype.secret=function(){return this._secret};Fy(Ui,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Fy(Ui,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Fy(Ui,"privBytes",function(){var e=this.eddsa,r=this.hash(),n=e.encodingLength-1,i=r.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i});Fy(Ui,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Fy(Ui,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Fy(Ui,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Ui.prototype.sign=function(e){return Aee(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Ui.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Ui.prototype.getSecret=function(e){return Aee(this._secret,"KeyPair is public only"),Bx.encode(this.secret(),e)};Ui.prototype.getPublic=function(e){return Bx.encode(this.pubBytes(),e)};var mPe=Ui,bPe=Ou,CE=Ea,zj=CE.assert,AE=CE.cachedProperty,wPe=CE.parseBytes;function Jp(t,e){this.eddsa=t,typeof e!="object"&&(e=wPe(e)),Array.isArray(e)&&(zj(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),zj(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof bPe&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}AE(Jp,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});AE(Jp,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});AE(Jp,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});AE(Jp,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Jp.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Jp.prototype.toHex=function(){return CE.encode(this.toBytes(),"hex").toUpperCase()};var xPe=Jp,EPe=Mx,CPe=wE,cy=Ea,APe=cy.assert,See=cy.parseBytes,_ee=mPe,Hj=xPe;function Bo(t){if(APe(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Bo))return new Bo(t);t=CPe[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=EPe.sha512}var SPe=Bo;Bo.prototype.sign=function(e,r){e=See(e);var n=this.keyFromSecret(r),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),o=this.encodePoint(s),a=this.hashInt(o,n.pubBytes(),e).mul(n.priv()),c=i.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:o})};Bo.prototype.verify=function(e,r,n){if(e=See(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var i=this.keyFromPublic(n),s=this.hashInt(r.Rencoded(),i.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(i.pub().mul(s));return a.eq(o)};Bo.prototype.hashInt=function(){for(var e=this.hash(),r=0;r0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=c[f++],l--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(l>=this.blockSize&&(f=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,c,f,l),l%=this.blockSize);l>0;)this._buffer[this._bufferLength++]=c[f++],l--;return this},a.prototype.finish=function(c){if(!this._finished){var l=this._bytesHashed,f=this._bufferLength,u=l/536870912|0,p=l<<3,g=l%128<112?128:256;this._buffer[f]=128;for(var y=f+1;y0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(c){return this._stateHi.set(c.stateHi),this._stateLo.set(c.stateLo),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(c){r.wipe(c.stateHi),r.wipe(c.stateLo),c.buffer&&r.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},a}();t.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function s(a,c,l,f,u,p,g){for(var y=l[0],b=l[1],I=l[2],C=l[3],S=l[4],O=l[5],L=l[6],F=l[7],z=f[0],_=f[1],$=f[2],ie=f[3],ce=f[4],K=f[5],P=f[6],M=f[7],v,m,R,B,E,x,w,T;g>=128;){for(var k=0;k<16;k++){var H=8*k+p;a[k]=e.readUint32BE(u,H),c[k]=e.readUint32BE(u,H+4)}for(var k=0;k<80;k++){var oe=y,j=b,X=I,G=C,Z=S,ee=O,N=L,te=F,fe=z,Ee=_,_e=$,Re=ie,Te=ce,De=K,ze=P,et=M;if(v=F,m=M,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=(S>>>14|ce<<18)^(S>>>18|ce<<14)^(ce>>>9|S<<23),m=(ce>>>14|S<<18)^(ce>>>18|S<<14)^(S>>>9|ce<<23),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=S&O^~S&L,m=ce&K^~ce&P,E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=i[k*2],m=i[k*2+1],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=a[k%16],m=c[k%16],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,R=w&65535|T<<16,B=E&65535|x<<16,v=R,m=B,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=(y>>>28|z<<4)^(z>>>2|y<<30)^(z>>>7|y<<25),m=(z>>>28|y<<4)^(y>>>2|z<<30)^(y>>>7|z<<25),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,v=y&b^y&I^b&I,m=z&_^z&$^_&$,E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,te=w&65535|T<<16,et=E&65535|x<<16,v=G,m=Re,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=R,m=B,E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,G=w&65535|T<<16,Re=E&65535|x<<16,b=oe,I=j,C=X,S=G,O=Z,L=ee,F=N,y=te,_=fe,$=Ee,ie=_e,ce=Re,K=Te,P=De,M=ze,z=et,k%16===15)for(var H=0;H<16;H++)v=a[H],m=c[H],E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=a[(H+9)%16],m=c[(H+9)%16],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,R=a[(H+1)%16],B=c[(H+1)%16],v=(R>>>1|B<<31)^(R>>>8|B<<24)^R>>>7,m=(B>>>1|R<<31)^(B>>>8|R<<24)^(B>>>7|R<<25),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,R=a[(H+14)%16],B=c[(H+14)%16],v=(R>>>19|B<<13)^(B>>>29|R<<3)^R>>>6,m=(B>>>19|R<<13)^(R>>>29|B<<3)^(B>>>6|R<<26),E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,a[H]=w&65535|T<<16,c[H]=E&65535|x<<16}v=y,m=z,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[0],m=f[0],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[0]=y=w&65535|T<<16,f[0]=z=E&65535|x<<16,v=b,m=_,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[1],m=f[1],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[1]=b=w&65535|T<<16,f[1]=_=E&65535|x<<16,v=I,m=$,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[2],m=f[2],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[2]=I=w&65535|T<<16,f[2]=$=E&65535|x<<16,v=C,m=ie,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[3],m=f[3],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[3]=C=w&65535|T<<16,f[3]=ie=E&65535|x<<16,v=S,m=ce,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[4],m=f[4],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[4]=S=w&65535|T<<16,f[4]=ce=E&65535|x<<16,v=O,m=K,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[5],m=f[5],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[5]=O=w&65535|T<<16,f[5]=K=E&65535|x<<16,v=L,m=P,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[6],m=f[6],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[6]=L=w&65535|T<<16,f[6]=P=E&65535|x<<16,v=F,m=M,E=m&65535,x=m>>>16,w=v&65535,T=v>>>16,v=l[7],m=f[7],E+=m&65535,x+=m>>>16,w+=v&65535,T+=v>>>16,x+=E>>>16,w+=x>>>16,T+=w>>>16,l[7]=F=w&65535|T<<16,f[7]=M=E&65535|x<<16,p+=128,g-=128}return p}function o(a){var c=new n;c.update(a);var l=c.digest();return c.clean(),l}t.hash=o})(Iee);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Nh,r=Iee,n=xa;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(G){const Z=new Float64Array(16);if(G)for(let ee=0;ee>16&1),ee[Ee-1]&=65535;ee[15]=N[15]-32767-(ee[14]>>16&1);const fe=ee[15]>>16&1;ee[14]&=65535,b(N,ee,1-fe)}for(let te=0;te<16;te++)G[2*te]=N[te]&255,G[2*te+1]=N[te]>>8}function C(G,Z){let ee=0;for(let N=0;N<32;N++)ee|=G[N]^Z[N];return(1&ee-1>>>8)-1}function S(G,Z){const ee=new Uint8Array(32),N=new Uint8Array(32);return I(ee,G),I(N,Z),C(ee,N)}function O(G){const Z=new Uint8Array(32);return I(Z,G),Z[0]&1}function L(G,Z){for(let ee=0;ee<16;ee++)G[ee]=Z[2*ee]+(Z[2*ee+1]<<8);G[15]&=32767}function F(G,Z,ee){for(let N=0;N<16;N++)G[N]=Z[N]+ee[N]}function z(G,Z,ee){for(let N=0;N<16;N++)G[N]=Z[N]-ee[N]}function _(G,Z,ee){let N,te,fe=0,Ee=0,_e=0,Re=0,Te=0,De=0,ze=0,et=0,Je=0,ke=0,Ne=0,tt=0,Ze=0,st=0,nt=0,We=0,lt=0,vt=0,Ke=0,gt=0,wt=0,rt=0,It=0,At=0,Tt=0,Xt=0,lr=0,xt=0,ar=0,rr=0,kt=0,Dt=ee[0],Nt=ee[1],dt=ee[2],Lt=ee[3],Mt=ee[4],ut=ee[5],Vt=ee[6],zt=ee[7],ht=ee[8],Et=ee[9],Bt=ee[10],He=ee[11],$t=ee[12],Ct=ee[13],ct=ee[14],Ht=ee[15];N=Z[0],fe+=N*Dt,Ee+=N*Nt,_e+=N*dt,Re+=N*Lt,Te+=N*Mt,De+=N*ut,ze+=N*Vt,et+=N*zt,Je+=N*ht,ke+=N*Et,Ne+=N*Bt,tt+=N*He,Ze+=N*$t,st+=N*Ct,nt+=N*ct,We+=N*Ht,N=Z[1],Ee+=N*Dt,_e+=N*Nt,Re+=N*dt,Te+=N*Lt,De+=N*Mt,ze+=N*ut,et+=N*Vt,Je+=N*zt,ke+=N*ht,Ne+=N*Et,tt+=N*Bt,Ze+=N*He,st+=N*$t,nt+=N*Ct,We+=N*ct,lt+=N*Ht,N=Z[2],_e+=N*Dt,Re+=N*Nt,Te+=N*dt,De+=N*Lt,ze+=N*Mt,et+=N*ut,Je+=N*Vt,ke+=N*zt,Ne+=N*ht,tt+=N*Et,Ze+=N*Bt,st+=N*He,nt+=N*$t,We+=N*Ct,lt+=N*ct,vt+=N*Ht,N=Z[3],Re+=N*Dt,Te+=N*Nt,De+=N*dt,ze+=N*Lt,et+=N*Mt,Je+=N*ut,ke+=N*Vt,Ne+=N*zt,tt+=N*ht,Ze+=N*Et,st+=N*Bt,nt+=N*He,We+=N*$t,lt+=N*Ct,vt+=N*ct,Ke+=N*Ht,N=Z[4],Te+=N*Dt,De+=N*Nt,ze+=N*dt,et+=N*Lt,Je+=N*Mt,ke+=N*ut,Ne+=N*Vt,tt+=N*zt,Ze+=N*ht,st+=N*Et,nt+=N*Bt,We+=N*He,lt+=N*$t,vt+=N*Ct,Ke+=N*ct,gt+=N*Ht,N=Z[5],De+=N*Dt,ze+=N*Nt,et+=N*dt,Je+=N*Lt,ke+=N*Mt,Ne+=N*ut,tt+=N*Vt,Ze+=N*zt,st+=N*ht,nt+=N*Et,We+=N*Bt,lt+=N*He,vt+=N*$t,Ke+=N*Ct,gt+=N*ct,wt+=N*Ht,N=Z[6],ze+=N*Dt,et+=N*Nt,Je+=N*dt,ke+=N*Lt,Ne+=N*Mt,tt+=N*ut,Ze+=N*Vt,st+=N*zt,nt+=N*ht,We+=N*Et,lt+=N*Bt,vt+=N*He,Ke+=N*$t,gt+=N*Ct,wt+=N*ct,rt+=N*Ht,N=Z[7],et+=N*Dt,Je+=N*Nt,ke+=N*dt,Ne+=N*Lt,tt+=N*Mt,Ze+=N*ut,st+=N*Vt,nt+=N*zt,We+=N*ht,lt+=N*Et,vt+=N*Bt,Ke+=N*He,gt+=N*$t,wt+=N*Ct,rt+=N*ct,It+=N*Ht,N=Z[8],Je+=N*Dt,ke+=N*Nt,Ne+=N*dt,tt+=N*Lt,Ze+=N*Mt,st+=N*ut,nt+=N*Vt,We+=N*zt,lt+=N*ht,vt+=N*Et,Ke+=N*Bt,gt+=N*He,wt+=N*$t,rt+=N*Ct,It+=N*ct,At+=N*Ht,N=Z[9],ke+=N*Dt,Ne+=N*Nt,tt+=N*dt,Ze+=N*Lt,st+=N*Mt,nt+=N*ut,We+=N*Vt,lt+=N*zt,vt+=N*ht,Ke+=N*Et,gt+=N*Bt,wt+=N*He,rt+=N*$t,It+=N*Ct,At+=N*ct,Tt+=N*Ht,N=Z[10],Ne+=N*Dt,tt+=N*Nt,Ze+=N*dt,st+=N*Lt,nt+=N*Mt,We+=N*ut,lt+=N*Vt,vt+=N*zt,Ke+=N*ht,gt+=N*Et,wt+=N*Bt,rt+=N*He,It+=N*$t,At+=N*Ct,Tt+=N*ct,Xt+=N*Ht,N=Z[11],tt+=N*Dt,Ze+=N*Nt,st+=N*dt,nt+=N*Lt,We+=N*Mt,lt+=N*ut,vt+=N*Vt,Ke+=N*zt,gt+=N*ht,wt+=N*Et,rt+=N*Bt,It+=N*He,At+=N*$t,Tt+=N*Ct,Xt+=N*ct,lr+=N*Ht,N=Z[12],Ze+=N*Dt,st+=N*Nt,nt+=N*dt,We+=N*Lt,lt+=N*Mt,vt+=N*ut,Ke+=N*Vt,gt+=N*zt,wt+=N*ht,rt+=N*Et,It+=N*Bt,At+=N*He,Tt+=N*$t,Xt+=N*Ct,lr+=N*ct,xt+=N*Ht,N=Z[13],st+=N*Dt,nt+=N*Nt,We+=N*dt,lt+=N*Lt,vt+=N*Mt,Ke+=N*ut,gt+=N*Vt,wt+=N*zt,rt+=N*ht,It+=N*Et,At+=N*Bt,Tt+=N*He,Xt+=N*$t,lr+=N*Ct,xt+=N*ct,ar+=N*Ht,N=Z[14],nt+=N*Dt,We+=N*Nt,lt+=N*dt,vt+=N*Lt,Ke+=N*Mt,gt+=N*ut,wt+=N*Vt,rt+=N*zt,It+=N*ht,At+=N*Et,Tt+=N*Bt,Xt+=N*He,lr+=N*$t,xt+=N*Ct,ar+=N*ct,rr+=N*Ht,N=Z[15],We+=N*Dt,lt+=N*Nt,vt+=N*dt,Ke+=N*Lt,gt+=N*Mt,wt+=N*ut,rt+=N*Vt,It+=N*zt,At+=N*ht,Tt+=N*Et,Xt+=N*Bt,lr+=N*He,xt+=N*$t,ar+=N*Ct,rr+=N*ct,kt+=N*Ht,fe+=38*lt,Ee+=38*vt,_e+=38*Ke,Re+=38*gt,Te+=38*wt,De+=38*rt,ze+=38*It,et+=38*At,Je+=38*Tt,ke+=38*Xt,Ne+=38*lr,tt+=38*xt,Ze+=38*ar,st+=38*rr,nt+=38*kt,te=1,N=fe+te+65535,te=Math.floor(N/65536),fe=N-te*65536,N=Ee+te+65535,te=Math.floor(N/65536),Ee=N-te*65536,N=_e+te+65535,te=Math.floor(N/65536),_e=N-te*65536,N=Re+te+65535,te=Math.floor(N/65536),Re=N-te*65536,N=Te+te+65535,te=Math.floor(N/65536),Te=N-te*65536,N=De+te+65535,te=Math.floor(N/65536),De=N-te*65536,N=ze+te+65535,te=Math.floor(N/65536),ze=N-te*65536,N=et+te+65535,te=Math.floor(N/65536),et=N-te*65536,N=Je+te+65535,te=Math.floor(N/65536),Je=N-te*65536,N=ke+te+65535,te=Math.floor(N/65536),ke=N-te*65536,N=Ne+te+65535,te=Math.floor(N/65536),Ne=N-te*65536,N=tt+te+65535,te=Math.floor(N/65536),tt=N-te*65536,N=Ze+te+65535,te=Math.floor(N/65536),Ze=N-te*65536,N=st+te+65535,te=Math.floor(N/65536),st=N-te*65536,N=nt+te+65535,te=Math.floor(N/65536),nt=N-te*65536,N=We+te+65535,te=Math.floor(N/65536),We=N-te*65536,fe+=te-1+37*(te-1),te=1,N=fe+te+65535,te=Math.floor(N/65536),fe=N-te*65536,N=Ee+te+65535,te=Math.floor(N/65536),Ee=N-te*65536,N=_e+te+65535,te=Math.floor(N/65536),_e=N-te*65536,N=Re+te+65535,te=Math.floor(N/65536),Re=N-te*65536,N=Te+te+65535,te=Math.floor(N/65536),Te=N-te*65536,N=De+te+65535,te=Math.floor(N/65536),De=N-te*65536,N=ze+te+65535,te=Math.floor(N/65536),ze=N-te*65536,N=et+te+65535,te=Math.floor(N/65536),et=N-te*65536,N=Je+te+65535,te=Math.floor(N/65536),Je=N-te*65536,N=ke+te+65535,te=Math.floor(N/65536),ke=N-te*65536,N=Ne+te+65535,te=Math.floor(N/65536),Ne=N-te*65536,N=tt+te+65535,te=Math.floor(N/65536),tt=N-te*65536,N=Ze+te+65535,te=Math.floor(N/65536),Ze=N-te*65536,N=st+te+65535,te=Math.floor(N/65536),st=N-te*65536,N=nt+te+65535,te=Math.floor(N/65536),nt=N-te*65536,N=We+te+65535,te=Math.floor(N/65536),We=N-te*65536,fe+=te-1+37*(te-1),G[0]=fe,G[1]=Ee,G[2]=_e,G[3]=Re,G[4]=Te,G[5]=De,G[6]=ze,G[7]=et,G[8]=Je,G[9]=ke,G[10]=Ne,G[11]=tt,G[12]=Ze,G[13]=st,G[14]=nt,G[15]=We}function $(G,Z){_(G,Z,Z)}function ie(G,Z){const ee=i();let N;for(N=0;N<16;N++)ee[N]=Z[N];for(N=253;N>=0;N--)$(ee,ee),N!==2&&N!==4&&_(ee,ee,Z);for(N=0;N<16;N++)G[N]=ee[N]}function ce(G,Z){const ee=i();let N;for(N=0;N<16;N++)ee[N]=Z[N];for(N=250;N>=0;N--)$(ee,ee),N!==1&&_(ee,ee,Z);for(N=0;N<16;N++)G[N]=ee[N]}function K(G,Z){const ee=i(),N=i(),te=i(),fe=i(),Ee=i(),_e=i(),Re=i(),Te=i(),De=i();z(ee,G[1],G[0]),z(De,Z[1],Z[0]),_(ee,ee,De),F(N,G[0],G[1]),F(De,Z[0],Z[1]),_(N,N,De),_(te,G[3],Z[3]),_(te,te,l),_(fe,G[2],Z[2]),F(fe,fe,fe),z(Ee,N,ee),z(_e,fe,te),F(Re,fe,te),F(Te,N,ee),_(G[0],Ee,_e),_(G[1],Te,Re),_(G[2],Re,_e),_(G[3],Ee,Te)}function P(G,Z,ee){for(let N=0;N<4;N++)b(G[N],Z[N],ee)}function M(G,Z){const ee=i(),N=i(),te=i();ie(te,Z[2]),_(ee,Z[0],te),_(N,Z[1],te),I(G,N),G[31]^=O(ee)<<7}function v(G,Z,ee){g(G[0],o),g(G[1],a),g(G[2],a),g(G[3],o);for(let N=255;N>=0;--N){const te=ee[N/8|0]>>(N&7)&1;P(G,Z,te),K(Z,G),K(G,G),P(G,Z,te)}}function m(G,Z){const ee=[i(),i(),i(),i()];g(ee[0],f),g(ee[1],u),g(ee[2],a),_(ee[3],f,u),v(G,ee,Z)}function R(G){if(G.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const Z=(0,r.hash)(G);Z[0]&=248,Z[31]&=127,Z[31]|=64;const ee=new Uint8Array(32),N=[i(),i(),i(),i()];m(N,Z),M(ee,N);const te=new Uint8Array(64);return te.set(G),te.set(ee,32),{publicKey:ee,secretKey:te}}t.generateKeyPairFromSeed=R;function B(G){const Z=(0,e.randomBytes)(32,G),ee=R(Z);return(0,n.wipe)(Z),ee}t.generateKeyPair=B;function E(G){if(G.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(G.subarray(32))}t.extractPublicKeyFromSecretKey=E;const x=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function w(G,Z){let ee,N,te,fe;for(N=63;N>=32;--N){for(ee=0,te=N-32,fe=N-12;te>4)*x[te],ee=Z[te]>>8,Z[te]&=255;for(te=0;te<32;te++)Z[te]-=ee*x[te];for(N=0;N<32;N++)Z[N+1]+=Z[N]>>8,G[N]=Z[N]&255}function T(G){const Z=new Float64Array(64);for(let ee=0;ee<64;ee++)Z[ee]=G[ee];for(let ee=0;ee<64;ee++)G[ee]=0;w(G,Z)}function k(G,Z){const ee=new Float64Array(64),N=[i(),i(),i(),i()],te=(0,r.hash)(G.subarray(0,32));te[0]&=248,te[31]&=127,te[31]|=64;const fe=new Uint8Array(64);fe.set(te.subarray(32),32);const Ee=new r.SHA512;Ee.update(fe.subarray(32)),Ee.update(Z);const _e=Ee.digest();Ee.clean(),T(_e),m(N,_e),M(fe,N),Ee.reset(),Ee.update(fe.subarray(0,32)),Ee.update(G.subarray(32)),Ee.update(Z);const Re=Ee.digest();T(Re);for(let Te=0;Te<32;Te++)ee[Te]=_e[Te];for(let Te=0;Te<32;Te++)for(let De=0;De<32;De++)ee[Te+De]+=Re[Te]*te[De];return w(fe.subarray(32),ee),fe}t.sign=k;function H(G,Z){const ee=i(),N=i(),te=i(),fe=i(),Ee=i(),_e=i(),Re=i();return g(G[2],a),L(G[1],Z),$(te,G[1]),_(fe,te,c),z(te,te,G[2]),F(fe,G[2],fe),$(Ee,fe),$(_e,Ee),_(Re,_e,Ee),_(ee,Re,te),_(ee,ee,fe),ce(ee,ee),_(ee,ee,te),_(ee,ee,fe),_(ee,ee,fe),_(G[0],ee,fe),$(N,G[0]),_(N,N,fe),S(N,te)&&_(G[0],G[0],p),$(N,G[0]),_(N,N,fe),S(N,te)?-1:(O(G[0])===Z[31]>>7&&z(G[0],o,G[0]),_(G[3],G[0],G[1]),0)}function oe(G,Z,ee){const N=new Uint8Array(32),te=[i(),i(),i(),i()],fe=[i(),i(),i(),i()];if(ee.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(H(fe,G))return!1;const Ee=new r.SHA512;Ee.update(ee.subarray(0,32)),Ee.update(G),Ee.update(Z);const _e=Ee.digest();return T(_e),v(te,fe,_e),m(fe,ee.subarray(32)),K(te,fe),M(N,te),!C(ee,N)}t.verify=oe;function j(G){let Z=[i(),i(),i(),i()];if(H(Z,G))throw new Error("Ed25519: invalid public key");let ee=i(),N=i(),te=Z[1];F(ee,a,te),z(N,a,te),ie(N,N),_(ee,ee,N);let fe=new Uint8Array(32);return I(fe,ee),fe}t.convertPublicKeyToX25519=j;function X(G){const Z=(0,r.hash)(G.subarray(0,32));Z[0]&=248,Z[31]&=127,Z[31]|=64;const ee=new Uint8Array(Z.subarray(0,32));return(0,n.wipe)(Z),ee}t.convertSecretKeyToX25519=X})(LM);const _Pe="EdDSA",IPe="JWT",s4=".",SE="base64url",Tee="utf8",Pee="utf8",TPe=":",PPe="did",kPe="key",Gj="base58btc",MPe="z",RPe="K36",OPe=32,DPe=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),NPe=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Lp(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return NPe(t)}catch{return t}}function Su(t){return typeof t=="string"?t:DPe(t)||""}function Wj(t){return Lp(ji(Li(t,SE),Tee))}function o4(t){return ji(Li(Su(t),Tee),SE)}function kee(t){const e=Li(RPe,Gj),r=MPe+ji(M3([e,t]),Gj);return[PPe,kPe,r].join(TPe)}function BPe(t){return ji(t,SE)}function LPe(t){return Li(t,SE)}function FPe(t){return Li([o4(t.header),o4(t.payload)].join(s4),Pee)}function jPe(t){return[o4(t.header),o4(t.payload),BPe(t.signature)].join(s4)}function dI(t){const e=t.split(s4),r=Wj(e[0]),n=Wj(e[1]),i=LPe(e[2]),s=Li(e.slice(0,2).join(s4),Pee);return{header:r,payload:n,signature:i,data:s}}function Kj(t=Nh.randomBytes(OPe)){return LM.generateKeyPairFromSeed(t)}async function UPe(t,e,r,n,i=at.fromMiliseconds(Date.now())){const s={alg:_Pe,typ:IPe},o=kee(n.publicKey),a=i+r,c={iss:o,sub:t,aud:e,iat:i,exp:a},l=FPe({header:s,payload:c}),f=LM.sign(n.secretKey,l);return jPe({header:s,payload:c,signature:f})}const $Pe={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var qPe={};const VPe=":";function Vv(t){const[e,r]=t.split(VPe);return{namespace:e,reference:r}}function Yj(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function Mee(t,e){return t.includes(":")?[t]:e.chains||[]}var zPe=Object.defineProperty,Qj=Object.getOwnPropertySymbols,HPe=Object.prototype.hasOwnProperty,GPe=Object.prototype.propertyIsEnumerable,Jj=(t,e,r)=>e in t?zPe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zj=(t,e)=>{for(var r in e||(e={}))HPe.call(e,r)&&Jj(t,r,e[r]);if(Qj)for(var r of Qj(e))GPe.call(e,r)&&Jj(t,r,e[r]);return t};const WPe="ReactNative",la={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},KPe="js";function a4(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function jy(){return!kx()&&!!mM()&&navigator.product===WPe}function Lx(){return!a4()&&!!mM()&&!!kx()}function Fx(){return jy()?la.reactNative:a4()?la.node:Lx()?la.browser:la.unknown}function YPe(){var t;try{return jy()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function QPe(t,e){let r=Pw.parse(t);return r=Zj(Zj({},r),e),t=Pw.stringify(r),t}function Ree(){return IX()||{name:"",description:"",url:"",icons:[""]}}function JPe(){if(Fx()===la.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=W9e();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function ZPe(){var t;const e=Fx();return e===la.browser?[e,((t=_X())==null?void 0:t.host)||"unknown"].join(":"):e}function Oee(t,e,r){const n=JPe(),i=ZPe();return[[t,e].join("-"),[KPe,r].join("-"),n,i].join("/")}function XPe({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a}){const c=r.split("?"),l=Oee(t,e,n),f={auth:i,ua:l,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},u=QPe(c[1]||"",f);return c[0]+"?"+u}function N0(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Dee(t){return Object.fromEntries(t.entries())}function Nee(t){return new Map(Object.entries(t))}function y0(t=at.FIVE_MINUTES,e){const r=at.toMiliseconds(t||at.FIVE_MINUTES);let n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function zv(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function Bee(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function eke(t){return Bee("topic",t)}function tke(t){return Bee("id",t)}function Lee(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Ei(t,e){return at.fromMiliseconds(Date.now()+at.toMiliseconds(t))}function ud(t){return Date.now()>=at.toMiliseconds(t)}function Er(t,e){return`${t}${e?`:${e}`:""}`}function R3(t=[],e=[]){return[...new Set([...t,...e])]}async function rke({id:t,topic:e,wcDeepLink:r}){var n;try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=nke(s,t,e),a=Fx();if(a===la.browser){if(!((n=kx())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,ske()?"_blank":"_self","noreferrer noopener")}else a===la.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function nke(t,e,r){const n=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let i=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${oke(n,!0)}`}else i=`${i}/wc?${n}`;return i}async function ike(t,e){let r="";try{if(Lx()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(n){console.error(n)}return r}function Xj(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),n=r.indexOf(e);return r[n+2]}function eU(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function FM(){return typeof process<"u"&&qPe.IS_VITEST==="true"}function ske(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function oke(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function Fee(t){return Buffer.from(t,"base64").toString("utf-8")}const ake="https://rpc.walletconnect.org/v1";async function cke(t,e,r,n,i,s){switch(r.t){case"eip191":return lke(t,e,r.s);case"eip1271":return await fke(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function lke(t,e,r){return Z_e(RX(e),r).toLowerCase()===t.toLowerCase()}async function fke(t,e,r,n,i,s){const o=Vv(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",f=r.substring(2),u=RX(e).substring(2),p=a+u+c+l+f,g=await fetch(`${s||ake}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:uke(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:p},"latest"]})}),{result:y}=await g.json();return y?y.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function uke(){return Date.now()+Math.floor(Math.random()*1e3)}var dke=Object.defineProperty,hke=Object.defineProperties,pke=Object.getOwnPropertyDescriptors,tU=Object.getOwnPropertySymbols,vke=Object.prototype.hasOwnProperty,gke=Object.prototype.propertyIsEnumerable,rU=(t,e,r)=>e in t?dke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yke=(t,e)=>{for(var r in e||(e={}))vke.call(e,r)&&rU(t,r,e[r]);if(tU)for(var r of tU(e))gke.call(e,r)&&rU(t,r,e[r]);return t},mke=(t,e)=>hke(t,pke(e));const bke="did:pkh:",jM=t=>t==null?void 0:t.split(":"),wke=t=>{const e=t&&jM(t);if(e)return t.includes(bke)?e[3]:e[1]},hI=t=>{const e=t&&jM(t);if(e)return e[2]+":"+e[3]},c4=t=>{const e=t&&jM(t);if(e)return e.pop()};async function nU(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=jee(i,i.iss),o=c4(i.iss);return await cke(o,s,n,hI(i.iss),r)}const jee=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=c4(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${wke(e)}`,c=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.exp?`Expiration Time: ${t.exp}`:void 0,u=t.nbf?`Not Before: ${t.nbf}`:void 0,p=t.requestId?`Request ID: ${t.requestId}`:void 0,g=t.resources?`Resources:${t.resources.map(b=>` - ${b}`).join("")}`:void 0,y=O3(t.resources);if(y){const b=kw(y);i=Pke(i,b)}return[r,n,"",i,"",s,o,a,c,l,f,u,p,g].filter(b=>b!=null).join(` `)};function xke(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function Eke(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Fp(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function Cke(t,e,r,n={}){return r==null||r.sort((i,s)=>i.localeCompare(s)),{att:{[t]:Ake(e,r,n)}}}function Ake(t,e,r={}){e=e==null?void 0:e.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function Uee(t){return Fp(t),`urn:recap:${xke(t).replace(/=/g,"")}`}function kw(t){const e=Eke(t.replace("urn:recap:",""));return Fp(e),e}function Ske(t,e,r){const n=Cke(t,e,r);return Uee(n)}function _ke(t){return t&&t.includes("urn:recap:")}function Ike(t,e){const r=kw(t),n=kw(e),i=Tke(r,n);return Uee(i)}function Tke(t,e){Fp(t),Fp(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[i])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;n.att[i]=mke(yke({},n.att[i]),{[a]:((c=t.att[i])==null?void 0:c[a])||((l=e.att[i])==null?void 0:l[a])})})}),n}function Pke(t="",e){Fp(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(u=>({ability:u.split("/")[0],action:u.split("/")[1]}));c.sort((u,p)=>u.action.localeCompare(p.action));const l={};c.forEach(u=>{l[u.ability]||(l[u.ability]=[]),l[u.ability].push(u.action)});const f=Object.keys(l).map(u=>(i++,`(${i}) '${u}': '${l[u].join("', '")}' for '${a}'.`));n.push(f.join(", ").replace(".,","."))});const s=n.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function iU(t){var e;const r=kw(t);Fp(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function sU(t){const e=kw(t);Fp(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function O3(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return _ke(e)?e:void 0}const $ee="base10",eo="base16",jd="base64pad",Nm="base64url",jx="utf8",qee=0,lu=1,Ux=2,kke=0,oU=1,Bb=12,UM=32;function Mke(){const t=PM.generateKeyPair();return{privateKey:ji(t.secretKey,eo),publicKey:ji(t.publicKey,eo)}}function pI(){const t=Nh.randomBytes(UM);return ji(t,eo)}function Rke(t,e){const r=PM.sharedKey(Li(t,eo),Li(e,eo),!0),n=new RIe(Ox.SHA256,r).expand(UM);return ji(n,eo)}function D3(t){const e=Ox.hash(Li(t,eo));return ji(e,eo)}function Bf(t){const e=Ox.hash(Li(t,jx));return ji(e,eo)}function Vee(t){return Li(`${t}`,$ee)}function jp(t){return Number(ji(t,$ee))}function Oke(t){const e=Vee(typeof t.type<"u"?t.type:qee);if(jp(e)===lu&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Li(t.senderPublicKey,eo):void 0,n=typeof t.iv<"u"?Li(t.iv,eo):Nh.randomBytes(Bb),i=new IM.ChaCha20Poly1305(Li(t.symKey,eo)).seal(n,Li(t.message,jx));return zee({type:e,sealed:i,iv:n,senderPublicKey:r,encoding:t.encoding})}function Dke(t,e){const r=Vee(Ux),n=Nh.randomBytes(Bb),i=Li(t,jx);return zee({type:r,sealed:i,iv:n,encoding:e})}function Nke(t){const e=new IM.ChaCha20Poly1305(Li(t.symKey,eo)),{sealed:r,iv:n}=Mw({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ji(i,jx)}function Bke(t,e){const{sealed:r}=Mw({encoded:t,encoding:e});return ji(r,jx)}function zee(t){const{encoding:e=jd}=t;if(jp(t.type)===Ux)return ji(M3([t.type,t.sealed]),e);if(jp(t.type)===lu){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ji(M3([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return ji(M3([t.type,t.iv,t.sealed]),e)}function Mw(t){const{encoded:e,encoding:r=jd}=t,n=Li(e,r),i=n.slice(kke,oU),s=oU;if(jp(i)===lu){const l=s+UM,f=l+Bb,u=n.slice(s,l),p=n.slice(l,f),g=n.slice(f);return{type:i,sealed:g,iv:p,senderPublicKey:u}}if(jp(i)===Ux){const l=n.slice(s),f=Nh.randomBytes(Bb);return{type:i,sealed:l,iv:f}}const o=s+Bb,a=n.slice(s,o),c=n.slice(o);return{type:i,sealed:c,iv:a}}function Lke(t,e){const r=Mw({encoded:t,encoding:e==null?void 0:e.encoding});return Hee({type:jp(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ji(r.senderPublicKey,eo):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function Hee(t){const e=(t==null?void 0:t.type)||qee;if(e===lu){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function aU(t){return t.type===lu&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function cU(t){return t.type===Ux}function Fke(t){return new yee.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function jke(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function Uke(t){return Buffer.from(jke(t),"base64")}function $ke(t,e){const[r,n,i]=t.split("."),s=Uke(i);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),c=`${r}.${n}`,l=new Ox.SHA256().update(Buffer.from(c)).digest(),f=Fke(e),u=Buffer.from(l).toString("hex");if(!f.verify(u,{r:o,s:a}))throw new Error("Invalid signature");return dI(t).payload}const qke="irn";function vI(t){return(t==null?void 0:t.relay)||{protocol:qke}}function cb(t){const e=$Pe[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var Vke=Object.defineProperty,zke=Object.defineProperties,Hke=Object.getOwnPropertyDescriptors,lU=Object.getOwnPropertySymbols,Gke=Object.prototype.hasOwnProperty,Wke=Object.prototype.propertyIsEnumerable,fU=(t,e,r)=>e in t?Vke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uU=(t,e)=>{for(var r in e||(e={}))Gke.call(e,r)&&fU(t,r,e[r]);if(lU)for(var r of lU(e))Wke.call(e,r)&&fU(t,r,e[r]);return t},Kke=(t,e)=>zke(t,Hke(e));function Yke(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function dU(t){if(!t.includes("wc:")){const c=Fee(t);c!=null&&c.includes("wc:")&&(t=c)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Pw.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:n,topic:Qke(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:Yke(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function Qke(t){return t.startsWith("//")?t.substring(2):t}function Jke(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function hU(t){return`${t.protocol}:${t.topic}@${t.version}?`+Pw.stringify(uU(Kke(uU({symKey:t.symKey},Jke(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function k6(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Uy(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function Zke(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Uy(r.accounts))}),e}function Xke(t,e){const r=[];return Object.values(t).forEach(n=>{Uy(n.accounts).includes(e)&&r.push(...n.methods)}),r}function eMe(t,e){const r=[];return Object.values(t).forEach(n=>{Uy(n.accounts).includes(e)&&r.push(...n.events)}),r}function $M(t){return t.includes(":")}function lb(t){return $M(t)?t.split(":")[0]:t}function tMe(t){const e={};return t==null||t.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function pU(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=tMe(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=R3(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const rMe={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},nMe={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function it(t,e){const{message:r,code:n}=nMe[t];return{message:e?`${r} ${e}`:r,code:n}}function rn(t,e){const{message:r,code:n}=rMe[t];return{message:e?`${r} ${e}`:r,code:n}}function rf(t,e){return!!Array.isArray(t)}function Rw(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function To(t){return typeof t>"u"}function ii(t,e){return e&&To(t)?!0:typeof t=="string"&&!!t.trim().length}function qM(t,e){return typeof t=="number"&&!isNaN(t)}function iMe(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return N0(i,n)?(n.forEach(o=>{const{accounts:a,methods:c,events:l}=t.namespaces[o],f=Uy(a),u=r[o];(!N0(Mee(o,u),f)||!N0(u.methods,c)||!N0(u.events,l))&&(s=!1)}),s):!1}function l4(t){return ii(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function sMe(t){if(ii(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&l4(r)}}return!1}function oMe(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(ii(t,!1)){if(e(t))return!0;const r=Fee(t);return e(r)}}catch{}return!1}function aMe(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function cMe(t){return t==null?void 0:t.topic}function lMe(t,e){let r=null;return ii(t==null?void 0:t.publicKey,!1)||(r=it("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function vU(t){let e=!0;return rf(t)?t.length&&(e=t.every(r=>ii(r,!1))):e=!1,e}function fMe(t,e,r){let n=null;return rf(e)&&e.length?e.forEach(i=>{n||l4(i)||(n=rn("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):l4(t)||(n=rn("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function uMe(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const o=fMe(i,Mee(i,s),`${e} ${r}`);o&&(n=o)}),n}function dMe(t,e){let r=null;return rf(t)?t.forEach(n=>{r||sMe(n)||(r=rn("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=rn("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function hMe(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=dMe(n==null?void 0:n.accounts,`${e} namespace`);i&&(r=i)}),r}function pMe(t,e){let r=null;return vU(t==null?void 0:t.methods)?vU(t==null?void 0:t.events)||(r=rn("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=rn("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Gee(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=pMe(n,`${e}, namespace`);i&&(r=i)}),r}function vMe(t,e,r){let n=null;if(t&&Rw(t)){const i=Gee(t,e);i&&(n=i);const s=uMe(t,e,r);s&&(n=s)}else n=it("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function K9(t,e){let r=null;if(t&&Rw(t)){const n=Gee(t,e);n&&(r=n);const i=hMe(t,e);i&&(r=i)}else r=it("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function Wee(t){return ii(t.protocol,!0)}function gMe(t,e){let r=!1;return t?t&&rf(t)&&t.length&&t.forEach(n=>{r=Wee(n)}):r=!0,r}function yMe(t){return typeof t=="number"}function xo(t){return typeof t<"u"&&typeof t!==null}function mMe(t){return!(!t||typeof t!="object"||!t.code||!qM(t.code)||!t.message||!ii(t.message,!1))}function bMe(t){return!(To(t)||!ii(t.method,!1))}function wMe(t){return!(To(t)||To(t.result)&&To(t.error)||!qM(t.id)||!ii(t.jsonrpc,!1))}function xMe(t){return!(To(t)||!ii(t.name,!1))}function gU(t,e){return!(!l4(e)||!Zke(t).includes(e))}function EMe(t,e,r){return ii(r,!1)?Xke(t,e).includes(r):!1}function CMe(t,e,r){return ii(r,!1)?eMe(t,e).includes(r):!1}function yU(t,e,r){let n=null;const i=AMe(t),s=SMe(e),o=Object.keys(i),a=Object.keys(s),c=mU(Object.keys(t)),l=mU(Object.keys(e)),f=c.filter(u=>!l.includes(u));return f.length&&(n=it("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} @@ -919,16 +919,16 @@ PERFORMANCE OF THIS SOFTWARE. Required: ${o.toString()} Approved: ${a.toString()}`)),Object.keys(e).forEach(u=>{if(!u.includes(":")||n)return;const p=Uy(e[u].accounts);p.includes(u)||(n=it("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${u} Required: ${u} - Approved: ${p.toString()}`))}),o.forEach(u=>{n||(N0(i[u].methods,s[u].methods)?N0(i[u].events,s[u].events)||(n=it("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${u}`)):n=it("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${u}`))}),n}function AMe(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function mU(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function SMe(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Uy(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function _Me(t,e){return qM(t)&&t<=e.max&&t>=e.min}function bU(){const t=Fx();return new Promise(e=>{switch(t){case la.browser:e(IMe());break;case la.reactNative:e(TMe());break;case la.node:e(PMe());break;default:e(!0)}})}function IMe(){return Lx()&&(navigator==null?void 0:navigator.onLine)}async function TMe(){if(jy()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function PMe(){return!0}function kMe(t){switch(Fx()){case la.browser:MMe(t);break;case la.reactNative:RMe(t);break}}function MMe(t){!jy()&&Lx()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function RMe(t){jy()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const Y9={};let Bm=class{static get(e){return Y9[e]}static set(e,r){Y9[e]=r}static delete(e){delete Y9[e]}};class Zp{}let OMe=class extends Zp{constructor(e){super()}};const wU=at.FIVE_SECONDS,$y={pulse:"heartbeat_pulse"};let DMe=class Kee extends OMe{constructor(e){super(e),this.events=new ba.EventEmitter,this.interval=wU,this.interval=(e==null?void 0:e.interval)||wU}static async init(e){const r=new Kee(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),at.toMiliseconds(this.interval))}pulse(){this.events.emit($y.pulse)}};const NMe=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,BMe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,LMe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function FMe(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){jMe(t);return}return e}function jMe(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function M6(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!LMe.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(NMe.test(t)||BMe.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,FMe)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function UMe(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mi(t,...e){try{return UMe(t(...e))}catch(r){return Promise.reject(r)}}function $Me(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qMe(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function N3(t){if($Me(t))return String(t);if(qMe(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return N3(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Yee(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const gI="base64:";function VMe(t){if(typeof t=="string")return t;Yee();const e=Buffer.from(t).toString("base64");return gI+e}function zMe(t){return typeof t!="string"||!t.startsWith(gI)?t:(Yee(),Buffer.from(t.slice(gI.length),"base64"))}function bo(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function HMe(...t){return bo(t.join(":"))}function R6(t){return t=bo(t),t?t+":":""}const GMe="memory",WMe=()=>{const t=new Map;return{name:GMe,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function KMe(t={}){const e={mounts:{"":t.driver||WMe()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const f of e.mountpoints)if(l.startsWith(f))return{base:f,relativeKey:l.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,f)=>e.mountpoints.filter(u=>u.startsWith(l)||f&&l.startsWith(u)).map(u=>({relativeBase:l.length>u.length?l.slice(u.length):void 0,mountpoint:u,driver:e.mounts[u]})),i=(l,f)=>{if(e.watching){f=bo(f);for(const u of e.watchListeners)u(l,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await xU(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,f,u)=>{const p=new Map,g=y=>{let b=p.get(y.base);return b||(b={driver:y.driver,base:y.base,items:[]},p.set(y.base,b)),b};for(const y of l){const b=typeof y=="string",I=bo(b?y:y.key),C=b?void 0:y.value,S=b||!y.options?f:{...f,...y.options},O=r(I);g(O).items.push({key:I,value:C,relativeKey:O.relativeKey,options:S})}return Promise.all([...p.values()].map(y=>u(y))).then(y=>y.flat())},c={hasItem(l,f={}){l=bo(l);const{relativeKey:u,driver:p}=r(l);return Mi(p.hasItem,u,f)},getItem(l,f={}){l=bo(l);const{relativeKey:u,driver:p}=r(l);return Mi(p.getItem,u,f).then(g=>M6(g))},getItems(l,f){return a(l,f,u=>u.driver.getItems?Mi(u.driver.getItems,u.items.map(p=>({key:p.relativeKey,options:p.options})),f).then(p=>p.map(g=>({key:HMe(u.base,g.key),value:M6(g.value)}))):Promise.all(u.items.map(p=>Mi(u.driver.getItem,p.relativeKey,p.options).then(g=>({key:p.key,value:M6(g)})))))},getItemRaw(l,f={}){l=bo(l);const{relativeKey:u,driver:p}=r(l);return p.getItemRaw?Mi(p.getItemRaw,u,f):Mi(p.getItem,u,f).then(g=>zMe(g))},async setItem(l,f,u={}){if(f===void 0)return c.removeItem(l);l=bo(l);const{relativeKey:p,driver:g}=r(l);g.setItem&&(await Mi(g.setItem,p,N3(f),u),g.watch||i("update",l))},async setItems(l,f){await a(l,f,async u=>{if(u.driver.setItems)return Mi(u.driver.setItems,u.items.map(p=>({key:p.relativeKey,value:N3(p.value),options:p.options})),f);u.driver.setItem&&await Promise.all(u.items.map(p=>Mi(u.driver.setItem,p.relativeKey,N3(p.value),p.options)))})},async setItemRaw(l,f,u={}){if(f===void 0)return c.removeItem(l,u);l=bo(l);const{relativeKey:p,driver:g}=r(l);if(g.setItemRaw)await Mi(g.setItemRaw,p,f,u);else if(g.setItem)await Mi(g.setItem,p,VMe(f),u);else return;g.watch||i("update",l)},async removeItem(l,f={}){typeof f=="boolean"&&(f={removeMeta:f}),l=bo(l);const{relativeKey:u,driver:p}=r(l);p.removeItem&&(await Mi(p.removeItem,u,f),(f.removeMeta||f.removeMata)&&await Mi(p.removeItem,u+"$",f),p.watch||i("remove",l))},async getMeta(l,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),l=bo(l);const{relativeKey:u,driver:p}=r(l),g=Object.create(null);if(p.getMeta&&Object.assign(g,await Mi(p.getMeta,u,f)),!f.nativeOnly){const y=await Mi(p.getItem,u+"$",f).then(b=>M6(b));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(g,y))}return g},setMeta(l,f,u={}){return this.setItem(l+"$",f,u)},removeMeta(l,f={}){return this.removeItem(l+"$",f)},async getKeys(l,f={}){l=R6(l);const u=n(l,!0);let p=[];const g=[];for(const y of u){const b=await Mi(y.driver.getKeys,y.relativeBase,f);for(const I of b){const C=y.mountpoint+bo(I);p.some(S=>C.startsWith(S))||g.push(C)}p=[y.mountpoint,...p.filter(I=>!I.startsWith(y.mountpoint))]}return l?g.filter(y=>y.startsWith(l)&&y[y.length-1]!=="$"):g.filter(y=>y[y.length-1]!=="$")},async clear(l,f={}){l=R6(l),await Promise.all(n(l,!1).map(async u=>{if(u.driver.clear)return Mi(u.driver.clear,u.relativeBase,f);if(u.driver.removeItem){const p=await u.driver.getKeys(u.relativeBase||"",f);return Promise.all(p.map(g=>u.driver.removeItem(g,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>EU(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,f){if(l=R6(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((u,p)=>p.length-u.length)),e.mounts[l]=f,e.watching&&Promise.resolve(xU(f,i,l)).then(u=>{e.unwatch[l]=u}).catch(console.error),c},async unmount(l,f=!0){l=R6(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),f&&await EU(e.mounts[l]),e.mountpoints=e.mountpoints.filter(u=>u!==l),delete e.mounts[l])},getMount(l=""){l=bo(l)+":";const f=r(l);return{driver:f.driver,base:f.base}},getMounts(l="",f={}){return l=bo(l),n(l,f.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(l,f={})=>c.getKeys(l,f),get:(l,f={})=>c.getItem(l,f),set:(l,f,u={})=>c.setItem(l,f,u),has:(l,f={})=>c.hasItem(l,f),del:(l,f={})=>c.removeItem(l,f),remove:(l,f={})=>c.removeItem(l,f)};return c}function xU(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function EU(t){typeof t.dispose=="function"&&await Mi(t.dispose)}function Xp(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Qee(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Xp(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let Q9;function $x(){return Q9||(Q9=Qee("keyval-store","keyval")),Q9}function CU(t,e=$x()){return e("readonly",r=>Xp(r.get(t)))}function YMe(t,e,r=$x()){return r("readwrite",n=>(n.put(e,t),Xp(n.transaction)))}function QMe(t,e=$x()){return e("readwrite",r=>(r.delete(t),Xp(r.transaction)))}function JMe(t=$x()){return t("readwrite",e=>(e.clear(),Xp(e.transaction)))}function ZMe(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xp(t.transaction)}function XMe(t=$x()){return t("readonly",e=>{if(e.getAllKeys)return Xp(e.getAllKeys());const r=[];return ZMe(e,n=>r.push(n.key)).then(()=>r)})}const eRe="idb-keyval";var tRe=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=Qee(t.dbName,t.storeName)),{name:eRe,options:t,async hasItem(i){return!(typeof await CU(r(i),n)>"u")},async getItem(i){return await CU(r(i),n)??null},setItem(i,s){return YMe(r(i),s,n)},removeItem(i){return QMe(r(i),n)},getKeys(){return XMe(n)},clear(){return JMe(n)}}};const rRe="WALLET_CONNECT_V2_INDEXED_DB",nRe="keyvaluestorage";let iRe=class{constructor(){this.indexedDb=KMe({driver:tRe({dbName:rRe,storeName:nRe})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Su(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var J9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},B3={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof J9<"u"&&J9.localStorage?B3.exports=J9.localStorage:typeof window<"u"&&window.localStorage?B3.exports=window.localStorage:B3.exports=new e})();function sRe(t){var e;return[t[0],Lp((e=t[1])!=null?e:"")]}let oRe=class{constructor(){this.localStorage=B3.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(sRe)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Lp(r)}async setItem(e,r){this.localStorage.setItem(e,Su(r))}async removeItem(e){this.localStorage.removeItem(e)}};const aRe="wc_storage_version",AU=1,cRe=async(t,e,r)=>{const n=aRe,i=await e.getItem(n);if(i&&i>=AU){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,AU),r(e),lRe(t,o)},lRe=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let fRe=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new oRe;this.storage=e;try{const r=new iRe;cRe(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function uRe(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var dRe=hRe;function hRe(t,e,r){var n=r&&r.stringify||uRe,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?u:0,t.charCodeAt(g+1)){case 100:case 102:if(f>=c||e[f]==null)break;u=c||e[f]==null)break;u=c||e[f]===void 0)break;u",u=g+2,g++;break}l+=n(e[f]),u=g+2,g++;break;case 115:if(f>=c)break;u-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(r);c.log||(c.log=Dw),Object.defineProperty(c,"levelVal",{get:f}),Object.defineProperty(c,"level",{get:u,set:p});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:wRe(t)};c.levels=Wl.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Dw,c.serializers=n,c._serialize=i,c._stdErrSerialize=s,c.child=g,e&&(c._logEvent=yI());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function u(){return this._level}function p(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,j1(l,c,"error","log"),j1(l,c,"fatal","error"),j1(l,c,"warn","error"),j1(l,c,"info","log"),j1(l,c,"debug","log"),j1(l,c,"trace","log")}function g(y,b){if(!y)throw new Error("missing bindings for child Pino");b=b||{},i&&y.serializers&&(b.serializers=y.serializers);const I=b.serializers;if(i&&I){var C=Object.assign({},n,I),S=t.browser.serialize===!0?Object.keys(C):i;delete y.serializers,_E([y],S,C,this._stdErrSerialize)}function O(L){this._childLevel=(L._childLevel|0)+1,this.error=U1(L,y,"error"),this.fatal=U1(L,y,"fatal"),this.warn=U1(L,y,"warn"),this.info=U1(L,y,"info"),this.debug=U1(L,y,"debug"),this.trace=U1(L,y,"trace"),C&&(this.serializers=C,this._serialize=S),e&&(this._logEvent=yI([].concat(L._logEvent.bindings,y)))}return O.prototype=this,new O(this)}return c}Wl.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Wl.stdSerializers=pRe;Wl.stdTimeFunctions=Object.assign({},{nullTime:Jee,epochTime:Zee,unixTime:xRe,isoTime:ERe});function j1(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Dw:i[r]?i[r]:Ow[r]||Ow[n]||Dw,gRe(t,e,r)}function gRe(t,e,r){!t.transmit&&e[r]===Dw||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ow?Ow:this;for(var c=0;c-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function U1(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Xee=class{constructor(e,r=VM){this.level=e??"error",this.levelValue=G1.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new _U(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===G1.levels.values.error?console.error(e):r===G1.levels.values.warn?console.warn(e):r===G1.levels.values.debug?console.debug(e):r===G1.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Su({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new _U(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Su({extraMetadata:e})),new Blob(r,{type:"application/json"})}},_Re=class{constructor(e,r=VM){this.baseChunkLogger=new Xee(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},IRe=class{constructor(e,r=VM){this.baseChunkLogger=new Xee(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TRe=Object.defineProperty,PRe=Object.defineProperties,kRe=Object.getOwnPropertyDescriptors,IU=Object.getOwnPropertySymbols,MRe=Object.prototype.hasOwnProperty,RRe=Object.prototype.propertyIsEnumerable,TU=(t,e,r)=>e in t?TRe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f4=(t,e)=>{for(var r in e||(e={}))MRe.call(e,r)&&TU(t,r,e[r]);if(IU)for(var r of IU(e))RRe.call(e,r)&&TU(t,r,e[r]);return t},u4=(t,e)=>PRe(t,kRe(e));function IE(t){return u4(f4({},t),{level:(t==null?void 0:t.level)||ARe.level})}function ORe(t,e=Vx){return t[e]||""}function DRe(t,e,r=Vx){return t[r]=e,t}function Lo(t,e=Vx){let r="";return typeof t.bindings>"u"?r=ORe(t,e):r=t.bindings().context||"",r}function NRe(t,e,r=Vx){const n=Lo(t,r);return n.trim()?`${n}/${e}`:e}function so(t,e,r=Vx){const n=NRe(t,e,r),i=t.child({context:n});return DRe(i,n,r)}function BRe(t){var e,r;const n=new _Re((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:qx(u4(f4({},t.opts),{level:"trace",browser:u4(f4({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function LRe(t){var e;const r=new IRe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:qx(u4(f4({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function FRe(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?BRe(t):LRe(t)}let jRe=class extends Zp{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},URe=class extends Zp{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},$Re=class{constructor(e,r){this.logger=e,this.core=r}},qRe=class extends Zp{constructor(e,r){super(),this.relayer=e,this.logger=r}},VRe=class extends Zp{constructor(e){super()}},zRe=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},HRe=class extends Zp{constructor(e,r){super(),this.relayer=e,this.logger=r}},GRe=class extends Zp{constructor(e,r){super(),this.core=e,this.logger=r}},WRe=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},KRe=class{constructor(e,r){this.projectId=e,this.logger=r}},YRe=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},QRe=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},JRe=class{constructor(e){this.client=e}};const ZRe="PARSE_ERROR",XRe="INVALID_REQUEST",eOe="METHOD_NOT_FOUND",tOe="INVALID_PARAMS",ete="INTERNAL_ERROR",zM="SERVER_ERROR",rOe=[-32700,-32600,-32601,-32602,-32603],Lb={[ZRe]:{code:-32700,message:"Parse error"},[XRe]:{code:-32600,message:"Invalid Request"},[eOe]:{code:-32601,message:"Method not found"},[tOe]:{code:-32602,message:"Invalid params"},[ete]:{code:-32603,message:"Internal error"},[zM]:{code:-32e3,message:"Server error"}},tte=zM;function nOe(t){return rOe.includes(t)}function PU(t){return Object.keys(Lb).includes(t)?Lb[t]:Lb[tte]}function iOe(t){const e=Object.values(Lb).find(r=>r.code===t);return e||Lb[tte]}function rte(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var nte={},Cf={},kU;function sOe(){if(kU)return Cf;kU=1,Object.defineProperty(Cf,"__esModule",{value:!0}),Cf.isBrowserCryptoAvailable=Cf.getSubtleCrypto=Cf.getBrowerCrypto=void 0;function t(){return(Si==null?void 0:Si.crypto)||(Si==null?void 0:Si.msCrypto)||{}}Cf.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Cf.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Cf.isBrowserCryptoAvailable=r,Cf}var Af={},MU;function oOe(){if(MU)return Af;MU=1,Object.defineProperty(Af,"__esModule",{value:!0}),Af.isBrowser=Af.isNode=Af.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Af.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Af.isNode=e;function r(){return!t()&&!e()}return Af.isBrowser=r,Af}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Px;e.__exportStar(sOe(),t),e.__exportStar(oOe(),t)})(nte);function dd(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function B0(t=6){return BigInt(dd(t))}function Ud(t,e,r){return{id:r||dd(),jsonrpc:"2.0",method:t,params:e}}function TE(t,e){return{id:t,jsonrpc:"2.0",result:e}}function PE(t,e,r){return{id:t,jsonrpc:"2.0",error:aOe(e)}}function aOe(t,e){return typeof t>"u"?PU(ete):(typeof t=="string"&&(t=Object.assign(Object.assign({},PU(zM)),{message:t})),nOe(t.code)&&(t=iOe(t.code)),t)}class cOe{}class lOe extends cOe{constructor(){super()}}class fOe extends lOe{constructor(e){super()}}const uOe="^https?:",dOe="^wss?:";function hOe(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function ite(t,e){const r=hOe(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function RU(t){return ite(t,uOe)}function OU(t){return ite(t,dOe)}function pOe(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function ste(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function HM(t){return ste(t)&&"method"in t}function kE(t){return ste(t)&&(xl(t)||Wa(t))}function xl(t){return"result"in t}function Wa(t){return"error"in t}let dc=class extends fOe{constructor(e){super(e),this.events=new ba.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Ud(e.method,e.params||[],e.id||B0().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Wa(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),kE(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vOe=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),gOe=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",DU=t=>t.split("?")[0],NU=10,yOe=vOe();let mOe=class{constructor(e){if(this.url=e,this.events=new ba.EventEmitter,this.registering=!1,!OU(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Su(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!OU(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=nte.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!pOe(e)},o=new yOe(e,[],s);gOe()?o.onerror=a=>{const c=a;n(this.emitError(c.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Lp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=PE(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return rte(e,DU(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>NU&&this.events.setMaxListeners(NU)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${DU(this.url)}`));return this.events.emit("register_error",r),r}};var d4={exports:{}};d4.exports;(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",f="[object Boolean]",u="[object Date]",p="[object Error]",g="[object Function]",y="[object GeneratorFunction]",b="[object Map]",I="[object Number]",C="[object Null]",S="[object Object]",O="[object Promise]",L="[object Proxy]",F="[object RegExp]",z="[object Set]",_="[object String]",$="[object Symbol]",ie="[object Undefined]",ce="[object WeakMap]",K="[object ArrayBuffer]",P="[object DataView]",M="[object Float32Array]",v="[object Float64Array]",m="[object Int8Array]",R="[object Int16Array]",B="[object Int32Array]",E="[object Uint8Array]",x="[object Uint8ClampedArray]",w="[object Uint16Array]",T="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,H=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,j={};j[M]=j[v]=j[m]=j[R]=j[B]=j[E]=j[x]=j[w]=j[T]=!0,j[a]=j[c]=j[K]=j[f]=j[P]=j[u]=j[p]=j[g]=j[b]=j[I]=j[S]=j[F]=j[z]=j[_]=j[ce]=!1;var X=typeof Si=="object"&&Si&&Si.Object===Object&&Si,G=typeof self=="object"&&self&&self.Object===Object&&self,Z=X||G||Function("return this")(),ee=e&&!e.nodeType&&e,N=ee&&!0&&t&&!t.nodeType&&t,te=N&&N.exports===ee,fe=te&&X.process,Ee=function(){try{return fe&&fe.binding&&fe.binding("util")}catch{}}(),_e=Ee&&Ee.isTypedArray;function Re(le,we){for(var $e=-1,yt=le==null?0:le.length,zr=0,tr=[];++$e-1}function Ti(le,we){var $e=this.__data__,yt=pc($e,le);return yt<0?(++this.size,$e.push([le,we])):$e[yt][1]=we,this}er.prototype.clear=kr,er.prototype.delete=bi,er.prototype.get=wi,er.prototype.has=xi,er.prototype.set=Ti;function Sn(le){var we=-1,$e=le==null?0:le.length;for(this.clear();++we<$e;){var yt=le[we];this.set(yt[0],yt[1])}}function ui(){this.size=0,this.__data__={hash:new Ct,map:new(Nt||er),string:new Ct}}function Fs(le){var we=Vo(this,le).delete(le);return this.size-=we?1:0,we}function di(le){return Vo(this,le).get(le)}function jo(le){return Vo(this,le).has(le)}function Uo(le,we){var $e=Vo(this,le),yt=$e.size;return $e.set(le,we),this.size+=$e.size==yt?0:1,this}Sn.prototype.clear=ui,Sn.prototype.delete=Fs,Sn.prototype.get=di,Sn.prototype.has=jo,Sn.prototype.set=Uo;function hi(le){var we=-1,$e=le==null?0:le.length;for(this.__data__=new Sn;++we<$e;)this.add(le[we])}function oo(le){return this.__data__.set(le,n),this}function ao(le){return this.__data__.has(le)}hi.prototype.add=hi.prototype.push=oo,hi.prototype.has=ao;function _n(le){var we=this.__data__=new er(le);this.size=we.size}function $o(){this.__data__=new er,this.size=0}function Gi(le){var we=this.__data__,$e=we.delete(le);return this.size=we.size,$e}function qo(le){return this.__data__.get(le)}function Ca(le){return this.__data__.has(le)}function co(le,we){var $e=this.__data__;if($e instanceof er){var yt=$e.__data__;if(!Nt||yt.lengthjn))return!1;var en=tr.get(le);if(en&&tr.get(we))return en==we;var Pn=-1,ps=!0,Un=$e&s?new hi:void 0;for(tr.set(le,we),tr.set(we,le);++Pn-1&&le%1==0&&le-1&&le%1==0&&le<=o}function $u(le){var we=typeof le;return le!=null&&(we=="object"||we=="function")}function ff(le){return le!=null&&typeof le=="object"}var a1=_e?et(_e):r1;function zo(le){return Vy(le)?Lh(le):n1(le)}function Wr(){return[]}function Kr(){return!1}t.exports=zy})(d4,d4.exports);var bOe=d4.exports;const wOe=_u(bOe),ote="wc",ate=2,GM="core",nf=`${ote}@2:${GM}:`,xOe={name:GM,logger:"error"},EOe={database:":memory:"},COe="crypto",BU="client_ed25519_seed",AOe=at.ONE_DAY,SOe="keychain",_Oe="0.3",IOe="messages",TOe="0.3",POe=at.SIX_HOURS,kOe="publisher",cte="irn",MOe="error",lte="wss://relay.walletconnect.org",ROe="relayer",Ys={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},OOe="_subscription",Na={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},DOe=.1,mI="2.17.2",vn={link_mode:"link_mode",relay:"relay"},NOe="0.3",BOe="WALLETCONNECT_CLIENT_ID",LU="WALLETCONNECT_LINK_MODE_APPS",El={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},LOe="subscription",FOe="0.3",jOe=at.FIVE_SECONDS*1e3,UOe="pairing",$Oe="0.3",Lm={wc_pairingDelete:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:at.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:at.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:at.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:at.ONE_DAY,prompt:!1,tag:0},res:{ttl:at.ONE_DAY,prompt:!1,tag:0}}},x0={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Sc={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},qOe="history",VOe="0.3",zOe="expirer",ja={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},HOe="0.3",GOe="verify-api",WOe="https://verify.walletconnect.com",fte="https://verify.walletconnect.org",Fb=fte,KOe=`${Fb}/v3`,YOe=[WOe,fte],QOe="echo",JOe="https://echo.walletconnect.com",bl={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Tf={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},_c={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},c0={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},l0={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Fm={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ZOe=.1,XOe="event-client",eDe=86400,tDe="https://pulse.walletconnect.org/batch";function rDe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(O);C!==S;){for(var F=y[C],z=0,_=O-1;(F!==0||z>>0,L[_]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");I=z,C++}for(var $=O-I;$!==O&&L[$]===0;)$++;for(var ie=c.repeat(b);$>>0,O=new Uint8Array(S);y[b];){var L=r[y.charCodeAt(b)];if(L===255)return;for(var F=0,z=S-1;(L!==0||F>>0,O[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");C=F,b++}if(y[b]!==" "){for(var _=S-C;_!==S&&O[_]===0;)_++;for(var $=new Uint8Array(I+(S-_)),ie=I;_!==S;)$[ie++]=O[_++];return $}}}function g(y){var b=p(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:p,decode:g}}var nDe=rDe,iDe=nDe;const ute=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},sDe=t=>new TextEncoder().encode(t),oDe=t=>new TextDecoder().decode(t);class aDe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class cDe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return dte(this,e)}}class lDe{constructor(e){this.decoders=e}or(e){return dte(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const dte=(t,e)=>new lDe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class fDe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new aDe(e,r,n),this.decoder=new cDe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const ME=({name:t,prefix:e,encode:r,decode:n})=>new fDe(t,e,r,n),zx=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=iDe(r,e);return ME({prefix:t,name:e,encode:n,decode:s=>ute(i(s))})},uDe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},dDe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<ME({prefix:e,name:t,encode(i){return dDe(i,n,r)},decode(i){return uDe(i,n,r,t)}}),hDe=ME({prefix:"\0",name:"identity",encode:t=>oDe(t),decode:t=>sDe(t)});var pDe=Object.freeze({__proto__:null,identity:hDe});const vDe=us({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var gDe=Object.freeze({__proto__:null,base2:vDe});const yDe=us({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var mDe=Object.freeze({__proto__:null,base8:yDe});const bDe=zx({prefix:"9",name:"base10",alphabet:"0123456789"});var wDe=Object.freeze({__proto__:null,base10:bDe});const xDe=us({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),EDe=us({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var CDe=Object.freeze({__proto__:null,base16:xDe,base16upper:EDe});const ADe=us({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),SDe=us({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_De=us({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),IDe=us({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),TDe=us({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),PDe=us({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kDe=us({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),MDe=us({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),RDe=us({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ODe=Object.freeze({__proto__:null,base32:ADe,base32upper:SDe,base32pad:_De,base32padupper:IDe,base32hex:TDe,base32hexupper:PDe,base32hexpad:kDe,base32hexpadupper:MDe,base32z:RDe});const DDe=zx({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),NDe=zx({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var BDe=Object.freeze({__proto__:null,base36:DDe,base36upper:NDe});const LDe=zx({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),FDe=zx({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var jDe=Object.freeze({__proto__:null,base58btc:LDe,base58flickr:FDe});const UDe=us({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$De=us({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),qDe=us({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),VDe=us({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var zDe=Object.freeze({__proto__:null,base64:UDe,base64pad:$De,base64url:qDe,base64urlpad:VDe});const hte=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),HDe=hte.reduce((t,e,r)=>(t[r]=e,t),[]),GDe=hte.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function WDe(t){return t.reduce((e,r)=>(e+=HDe[r],e),"")}function KDe(t){const e=[];for(const r of t){const n=GDe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const YDe=ME({prefix:"🚀",name:"base256emoji",encode:WDe,decode:KDe});var QDe=Object.freeze({__proto__:null,base256emoji:YDe}),JDe=pte,FU=128,ZDe=127,XDe=~ZDe,eNe=Math.pow(2,31);function pte(t,e,r){e=e||[],r=r||0;for(var n=r;t>=eNe;)e[r++]=t&255|FU,t/=128;for(;t&XDe;)e[r++]=t&255|FU,t>>>=7;return e[r]=t|0,pte.bytes=r-n+1,e}var tNe=bI,rNe=128,jU=127;function bI(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw bI.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&jU)<=rNe);return bI.bytes=s-n,r}var nNe=Math.pow(2,7),iNe=Math.pow(2,14),sNe=Math.pow(2,21),oNe=Math.pow(2,28),aNe=Math.pow(2,35),cNe=Math.pow(2,42),lNe=Math.pow(2,49),fNe=Math.pow(2,56),uNe=Math.pow(2,63),dNe=function(t){return t(vte.encode(t,e,r),e),$U=t=>vte.encodingLength(t),wI=(t,e)=>{const r=e.byteLength,n=$U(t),i=n+$U(r),s=new Uint8Array(i+r);return UU(t,s,0),UU(r,s,n),s.set(e,i),new pNe(t,r,e,s)};class pNe{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const gte=({name:t,code:e,encode:r})=>new vNe(t,e,r);let vNe=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?wI(this.code,r):r.then(n=>wI(this.code,n))}else throw Error("Unknown type, must be binary type")}};const yte=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),gNe=gte({name:"sha2-256",code:18,encode:yte("SHA-256")}),yNe=gte({name:"sha2-512",code:19,encode:yte("SHA-512")});var mNe=Object.freeze({__proto__:null,sha256:gNe,sha512:yNe});const mte=0,bNe="identity",bte=ute,wNe=t=>wI(mte,bte(t)),xNe={code:mte,name:bNe,encode:bte,digest:wNe};var ENe=Object.freeze({__proto__:null,identity:xNe});new TextEncoder,new TextDecoder;const qU={...pDe,...gDe,...mDe,...wDe,...CDe,...ODe,...BDe,...jDe,...zDe,...QDe};({...mNe,...ENe});function CNe(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function wte(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const VU=wte("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),X9=wte("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=CNe(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=it("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=so(r,this.name)}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Dee(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Nee(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}let INe=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=COe,this.randomSessionIdentifier=pI(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Kj(i);return kee(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=Mke();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Kj(s),a=this.randomSessionIdentifier;return await UPe(a,i,AOe,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),c=Rke(a,s);return this.setSymKey(c,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||D3(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=Hee(o),c=Su(s);if(cU(a))return Dke(c,o==null?void 0:o.encoding);if(aU(a)){const p=a.senderPublicKey,g=a.receiverPublicKey;i=await this.generateSharedKey(p,g)}const l=this.getSymKey(i),{type:f,senderPublicKey:u}=a;return Oke({type:f,symKey:l,message:c,senderPublicKey:u,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=Lke(s,o);if(cU(a)){const c=Bke(s,o==null?void 0:o.encoding);return Lp(c)}if(aU(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(i),l=Nke({symKey:c,encoded:s,encoding:o==null?void 0:o.encoding});return Lp(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}},this.getPayloadType=(i,s=jd)=>{const o=Mw({encoded:i,encoding:s});return jp(o.type)},this.getPayloadSenderPublicKey=(i,s=jd)=>{const o=Mw({encoded:i,encoding:s});return o.senderPublicKey?ji(o.senderPublicKey,eo):void 0},this.core=e,this.logger=so(r,this.name),this.keychain=n||new _Ne(this.core,this.logger)}get context(){return Lo(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(BU)}catch{e=pI(),await this.keychain.set(BU,e)}return SNe(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}};class TNe extends $Re{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=IOe,this.version=TOe,this.initialized=!1,this.storagePrefix=nf,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Bf(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Bf(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=so(e,this.name),this.core=r}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Dee(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Nee(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class PNe extends qRe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new ba.EventEmitter,this.name=kOe,this.queue=new Map,this.publishTimeout=at.toMiliseconds(at.ONE_MINUTE),this.failedPublishTimeout=at.toMiliseconds(at.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||POe,c=vI(s),l=(s==null?void 0:s.prompt)||!1,f=(s==null?void 0:s.tag)||0,u=(s==null?void 0:s.id)||B0().toString(),p={topic:n,message:i,opts:{ttl:a,relay:c,prompt:l,tag:f,id:u,attestation:s==null?void 0:s.attestation}},g=`Failed to publish payload, please try again. id:${u} tag:${f}`,y=Date.now();let b,I=1;try{for(;b===void 0;){if(Date.now()-y>this.publishTimeout)throw new Error(g);this.logger.trace({id:u,attempts:I},`publisher.publish - attempt ${I}`),b=await await zv(this.rpcPublish(n,i,a,c,l,f,u,s==null?void 0:s.attestation).catch(C=>this.logger.warn(C)),this.publishTimeout,g),I++,b||await new Promise(C=>setTimeout(C,this.failedPublishTimeout))}this.relayer.events.emit(Ys.publish,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:u,topic:n,message:i,opts:s}})}catch(C){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(C),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw C;this.queue.set(u,p)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=so(r,this.name),this.registerEventListeners()}get context(){return Lo(this.logger)}rpcPublish(e,r,n,i,s,o,a,c){var l,f,u,p;const g={method:cb(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:c},id:a};return To((l=g.params)==null?void 0:l.prompt)&&((f=g.params)==null||delete f.prompt),To((u=g.params)==null?void 0:u.tag)&&((p=g.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on($y.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Ys.connection_stalled);return}this.checkQueue()}),this.relayer.on(Ys.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class kNe{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var MNe=Object.defineProperty,RNe=Object.defineProperties,ONe=Object.getOwnPropertyDescriptors,zU=Object.getOwnPropertySymbols,DNe=Object.prototype.hasOwnProperty,NNe=Object.prototype.propertyIsEnumerable,HU=(t,e,r)=>e in t?MNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jm=(t,e)=>{for(var r in e||(e={}))DNe.call(e,r)&&HU(t,r,e[r]);if(zU)for(var r of zU(e))NNe.call(e,r)&&HU(t,r,e[r]);return t},eS=(t,e)=>RNe(t,ONe(e));class BNe extends HRe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new kNe,this.events=new ba.EventEmitter,this.name=LOe,this.version=FOe,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=nf,this.subscribeTimeout=at.toMiliseconds(at.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=vI(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new at.Watch;a.start(i);const c=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(c),a.stop(i),s(!0)),a.elapsed(i)>=jOe&&(clearInterval(c),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=so(r,this.name),this.clientId=""}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=vI(n);await this.rpcUnsubscribe(e,r,i);const s=rn("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===vn.relay&&await this.restartToComplete();const s={method:cb(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Bf(e+this.clientId);if((n==null?void 0:n.transportType)===vn.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},at.toMiliseconds(at.ONE_SECOND)),a;const c=await zv(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!c&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return c?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ys.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:cb(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await zv(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(Ys.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:cb(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await zv(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(Ys.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:cb(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,eS(jm({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,jm({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,jm({},r)),this.topicMap.set(r.topic,e),this.events.emit(El.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(El.deleted,eS(jm({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(El.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);rf(r)&&this.onBatchSubscribe(r.map((n,i)=>eS(jm({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on($y.pulse,async()=>{await this.checkPending()}),this.events.on(El.created,async e=>{const r=El.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(El.deleted,async e=>{const r=El.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var LNe=Object.defineProperty,GU=Object.getOwnPropertySymbols,FNe=Object.prototype.hasOwnProperty,jNe=Object.prototype.propertyIsEnumerable,WU=(t,e,r)=>e in t?LNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KU=(t,e)=>{for(var r in e||(e={}))FNe.call(e,r)&&WU(t,r,e[r]);if(GU)for(var r of GU(e))jNe.call(e,r)&&WU(t,r,e[r]);return t};class UNe extends VRe{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new ba.EventEmitter,this.name=ROe,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=at.toMiliseconds(at.THIRTY_SECONDS+at.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||B0().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(c,l)=>{const f=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Na.disconnect,f);const u=await o;this.provider.off(Na.disconnect,f),c(u)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(a4())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Ys.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(Ys.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Na.payload,this.onPayloadHandler),this.provider.on(Na.connect,this.onConnectHandler),this.provider.on(Na.disconnect,this.onDisconnectHandler),this.provider.on(Na.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?so(e.logger,this.name):qx(IE({level:e.logger||MOe})),this.messages=new TNe(this.logger,e.core),this.subscriber=new BNe(this,this.logger),this.publisher=new PNe(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||lte,this.projectId=e.projectId,this.bundleId=YPe(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Lo(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:vn.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",c;const l=f=>{f.topic===e&&(this.subscriber.off(El.created,l),c())};return await Promise.all([new Promise(f=>{c=f,this.subscriber.on(El.created,l)}),new Promise(async(f,u)=>{a=await this.subscriber.subscribe(e,KU({internal:{throwOnFailedPublish:o}},r)).catch(p=>{o&&u(p)})||a,f()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await zv(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Na.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Na.disconnect,i),await zv(this.provider.connect(),at.toMiliseconds(at.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await bU())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=Ei(at.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(Ys.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(a4())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new dc(new mOe(XPe({sdkVersion:mI,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),HM(e)){if(!e.method.endsWith(OOe))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:vn.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(KU({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else kE(e)&&this.events.emit(Ys.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ys.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=TE(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Na.payload,this.onPayloadHandler),this.provider.off(Na.connect,this.onConnectHandler),this.provider.off(Na.disconnect,this.onDisconnectHandler),this.provider.off(Na.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await bU();kMe(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Ys.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},at.toMiliseconds(DOe))))}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var $Ne=Object.defineProperty,YU=Object.getOwnPropertySymbols,qNe=Object.prototype.hasOwnProperty,VNe=Object.prototype.propertyIsEnumerable,QU=(t,e,r)=>e in t?$Ne(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,JU=(t,e)=>{for(var r in e||(e={}))qNe.call(e,r)&&QU(t,r,e[r]);if(YU)for(var r of YU(e))VNe.call(e,r)&&QU(t,r,e[r]);return t};class e1 extends zRe{constructor(e,r,n,i=nf,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=NOe,this.cached=[],this.initialized=!1,this.storagePrefix=nf,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!To(o)?this.map.set(this.getKey(o),o):aMe(o)?this.map.set(o.id,o):cMe(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>wOe(a[c],o[c]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=JU(JU({},this.getData(o)),a);this.map.set(o,c),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=so(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=it("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class zNe{constructor(e,r){this.core=e,this.logger=r,this.name=UOe,this.version=$Oe,this.events=new yM,this.initialized=!1,this.storagePrefix=nf,this.ignoredPayloadTypes=[lu],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=pI(),s=await this.core.crypto.setSymKey(i),o=Ei(at.FIVE_MINUTES),a={protocol:cte},c={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=hU({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(x0.create,c),this.core.expirer.set(s,o),await this.pairings.set(s,c),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[bl.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:c,methods:l}=dU(n.uri);i.props.properties.topic=s,i.addTrace(bl.pairing_uri_validation_success),i.addTrace(bl.pairing_uri_not_expired);let f;if(this.pairings.keys.includes(s)){if(f=this.pairings.get(s),i.addTrace(bl.existing_pairing),f.active)throw i.setError(Tf.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(bl.pairing_not_expired)}const u=c||Ei(at.FIVE_MINUTES),p={topic:s,relay:a,expiry:u,active:!1,methods:l};this.core.expirer.set(s,u),await this.pairings.set(s,p),i.addTrace(bl.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(x0.create,p),i.addTrace(bl.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(bl.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Tf.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(g){throw i.setError(Tf.subscribe_pairing_topic_failure),g}return i.addTrace(bl.subscribe_pairing_topic_success),p},this.activate=async({topic:n})=>{this.isInitialized();const i=Ei(at.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=y0();this.events.once(Er("pairing_ping",s),({error:l})=>{l?c(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",rn("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,c=this.core.crypto.keychain.get(i);return hU({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:c,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=Ud(i,s),a=await this.core.crypto.encode(n,o),c=Lm[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,c),o.id},this.sendResult=async(n,i,s)=>{const o=TE(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=Lm[c.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=PE(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=Lm[c.request.method]?Lm[c.request.method].res:Lm.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,rn("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ud(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(x0.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{xl(i)?this.events.emit(Er("pairing_ping",s),{}):Wa(i)&&this.events.emit(Er("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(x0.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=rn("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(rn("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!xo(n)){const{message:a}=it("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Tf.malformed_pairing_uri),new Error(a)}if(!oMe(n.uri)){const{message:a}=it("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Tf.malformed_pairing_uri),new Error(a)}const o=dU(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=it("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Tf.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=it("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Tf.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&at.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!xo(n)){const{message:s}=it("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!xo(n)){const{message:s}=it("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ii(n,!1)){const{message:i}=it("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=it("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ud(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=it("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=so(r,this.name),this.pairings=new e1(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Lo(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ys.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===vn.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{HM(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):kE(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(ja.expired,async e=>{const{topic:r}=Lee(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(x0.expire,{topic:r}))})}}class HNe extends URe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new ba.EventEmitter,this.name=qOe,this.version=VOe,this.cached=[],this.initialized=!1,this.storagePrefix=nf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:Ei(at.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Sc.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Wa(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Sc.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Sc.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=so(r,this.name)}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:Ud(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Sc.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Sc.created,e=>{const r=Sc.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sc.updated,e=>{const r=Sc.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sc.deleted,e=>{const r=Sc.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on($y.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{at.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Sc.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class GNe extends GRe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new ba.EventEmitter,this.name=zOe,this.version=HOe,this.cached=[],this.initialized=!1,this.storagePrefix=nf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(ja.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(ja.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=so(r,this.name)}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return eke(e);if(typeof e=="number")return tke(e);const{message:r}=it("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ja.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;at.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(ja.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on($y.pulse,()=>this.checkExpirations()),this.events.on(ja.created,e=>{const r=ja.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ja.expired,e=>{const r=ja.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ja.deleted,e=>{const r=ja.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WNe extends WRe{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GOe,this.verifyUrlV3=KOe,this.storagePrefix=nf,this.version=ate,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&at.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!Lx()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=kx(),f=this.startAbortTimer(at.ONE_SECOND*5),u=await new Promise((p,g)=>{const y=()=>{window.removeEventListener("message",I),l.body.removeChild(b),g("attestation aborted")};this.abortController.signal.addEventListener("abort",y);const b=l.createElement("iframe");b.src=c,b.style.display="none",b.addEventListener("error",y,{signal:this.abortController.signal});const I=C=>{if(C.data&&typeof C.data=="string")try{const S=JSON.parse(C.data);if(S.type==="verify_attestation"){if(dI(S.attestation).payload.id!==o)return;clearInterval(f),l.body.removeChild(b),this.abortController.signal.removeEventListener("abort",y),window.removeEventListener("message",I),p(S.attestation===null?"":S.attestation)}}catch(S){this.logger.warn(S)}};l.body.appendChild(b),window.addEventListener("message",I,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",u),u}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(dI(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,c)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(at.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Fb;return YOe.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Fb}`),s=Fb),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(at.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=$ke(i,s.publicKey),a={hasExpired:at.toMiliseconds(o.exp)this.abortController.abort(),at.toMiliseconds(e))}}class KNe extends KRe{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=QOe,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,c=`${JOe}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=so(r,this.context)}}var YNe=Object.defineProperty,ZU=Object.getOwnPropertySymbols,QNe=Object.prototype.hasOwnProperty,JNe=Object.prototype.propertyIsEnumerable,XU=(t,e,r)=>e in t?YNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Um=(t,e)=>{for(var r in e||(e={}))QNe.call(e,r)&&XU(t,r,e[r]);if(ZU)for(var r of ZU(e))JNe.call(e,r)&&XU(t,r,e[r]);return t};class ZNe extends YRe{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=XOe,this.storagePrefix=nf,this.storageVersion=ZOe,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!FM())try{const i={eventId:eU(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Oee(this.core.relayer.protocol,this.core.relayer.version,mI)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:c}}=i,l=eU(),f=this.core.projectId||"",u=Date.now(),p=Um({eventId:l,timestamp:u,props:{event:s,type:o,properties:{topic:a,trace:c}},bundleId:f,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,p),this.shouldPersist=!0),p},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return Um(Um({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on($y.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{at.fromMiliseconds(Date.now())-at.fromMiliseconds(i.timestamp)>eDe&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Um(Um({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${tDe}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${mI}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>Ree().url,this.logger=so(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var XNe=Object.defineProperty,e$=Object.getOwnPropertySymbols,eBe=Object.prototype.hasOwnProperty,tBe=Object.prototype.propertyIsEnumerable,t$=(t,e,r)=>e in t?XNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r$=(t,e)=>{for(var r in e||(e={}))eBe.call(e,r)&&t$(t,r,e[r]);if(e$)for(var r of e$(e))tBe.call(e,r)&&t$(t,r,e[r]);return t};let rBe=class xte extends jRe{constructor(e){var r;super(e),this.protocol=ote,this.version=ate,this.name=GM,this.events=new ba.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:c})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:vn.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:c})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||lte,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=IE({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:xOe.logger}),{logger:i,chunkLoggerController:s}=FRe({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=so(i,this.name),this.heartbeat=new DMe,this.crypto=new INe(this,this.logger,e==null?void 0:e.keychain),this.history=new HNe(this,this.logger),this.expirer=new GNe(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new fRe(r$(r$({},EOe),e==null?void 0:e.storageOptions)),this.relayer=new UNe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new zNe(this,this.logger),this.verify=new WNe(this,this.logger,this.storage),this.echoClient=new KNe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZNe(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new xte(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(BOe,n),r}get context(){return Lo(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(LU,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(LU)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}};const nBe=rBe,Ete="wc",Cte=2,Ate="client",WM=`${Ete}@${Cte}:${Ate}:`,tS={name:Ate,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},n$="WALLETCONNECT_DEEPLINK_CHOICE",iBe="proposal",Ste="Proposal expired",sBe="session",$1=at.SEVEN_DAYS,oBe="engine",ki={wc_sessionPropose:{req:{ttl:at.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1104},res:{ttl:at.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1106},res:{ttl:at.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:at.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:at.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1112},res:{ttl:at.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1114},res:{ttl:at.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:at.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:at.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1119}}},rS={min:at.FIVE_MINUTES,max:at.SEVEN_DAYS},vl={idle:"IDLE",active:"ACTIVE"},aBe="request",cBe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],lBe="wc",fBe="auth",uBe="authKeys",dBe="pairingTopics",hBe="requests",RE=`${lBe}@${1.5}:${fBe}:`,L3=`${RE}:PUB_KEY`;var pBe=Object.defineProperty,vBe=Object.defineProperties,gBe=Object.getOwnPropertyDescriptors,i$=Object.getOwnPropertySymbols,yBe=Object.prototype.hasOwnProperty,mBe=Object.prototype.propertyIsEnumerable,s$=(t,e,r)=>e in t?pBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vn=(t,e)=>{for(var r in e||(e={}))yBe.call(e,r)&&s$(t,r,e[r]);if(i$)for(var r of i$(e))mBe.call(e,r)&&s$(t,r,e[r]);return t},Ic=(t,e)=>vBe(t,gBe(e));class bBe extends JRe{constructor(e){super(e),this.name=oBe,this.events=new yM,this.initialized=!1,this.requestQueue={state:vl.idle,queue:[]},this.sessionRequestQueue={state:vl.idle,queue:[]},this.requestQueueDelay=at.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(ki)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},at.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Ic(Vn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:c}=n;let l=i,f,u=!1;try{l&&(u=this.client.core.pairing.pairings.get(l).active)}catch(L){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),L}if(!l||!u){const{topic:L,uri:F}=await this.client.core.pairing.create();l=L,f=F}if(!l){const{message:L}=it("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(L)}const p=await this.client.core.crypto.generateKeyPair(),g=ki.wc_sessionPropose.req.ttl||at.FIVE_MINUTES,y=Ei(g),b=Vn({requiredNamespaces:s,optionalNamespaces:o,relays:c??[{protocol:cte}],proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:y,pairingTopic:l},a&&{sessionProperties:a}),{reject:I,resolve:C,done:S}=y0(g,Ste);this.events.once(Er("session_connect"),async({error:L,session:F})=>{if(L)I(L);else if(F){F.self.publicKey=p;const z=Ic(Vn({},F),{pairingTopic:b.pairingTopic,requiredNamespaces:b.requiredNamespaces,optionalNamespaces:b.optionalNamespaces,transportType:vn.relay});await this.client.session.set(F.topic,z),await this.setExpiry(F.topic,F.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:F.peer.metadata}),this.cleanupDuplicatePairings(z),C(z)}});const O=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:b,throwOnFailedPublish:!0});return await this.setProposal(O,Vn({id:O},b)),{uri:f,approval:S}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[_c.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch($){throw o.setError(c0.no_internet_connection),$}try{await this.isValidProposalId(r==null?void 0:r.id)}catch($){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(c0.proposal_not_found),$}try{await this.isValidApprove(r)}catch($){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(c0.session_approve_namespace_validation_failure),$}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:f,sessionConfig:u}=r,p=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:g,proposer:y,requiredNamespaces:b,optionalNamespaces:I}=p;let C=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:g});C||(C=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:_c.session_approve_started,properties:{topic:g,trace:[_c.session_approve_started,_c.session_namespaces_validation_success]}}));const S=await this.client.core.crypto.generateKeyPair(),O=y.publicKey,L=await this.client.core.crypto.generateSharedKey(S,O),F=Vn(Vn({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:S,metadata:this.client.metadata},expiry:Ei($1)},f&&{sessionProperties:f}),u&&{sessionConfig:u}),z=vn.relay;C.addTrace(_c.subscribing_session_topic);try{await this.client.core.relayer.subscribe(L,{transportType:z})}catch($){throw C.setError(c0.subscribe_session_topic_failure),$}C.addTrace(_c.subscribe_session_topic_success);const _=Ic(Vn({},F),{topic:L,requiredNamespaces:b,optionalNamespaces:I,pairingTopic:g,acknowledged:!1,self:F.controller,peer:{publicKey:y.publicKey,metadata:y.metadata},controller:S,transportType:vn.relay});await this.client.session.set(L,_),C.addTrace(_c.store_session);try{C.addTrace(_c.publishing_session_settle),await this.sendRequest({topic:L,method:"wc_sessionSettle",params:F,throwOnFailedPublish:!0}).catch($=>{throw C==null||C.setError(c0.session_settle_publish_failure),$}),C.addTrace(_c.session_settle_publish_success),C.addTrace(_c.publishing_session_approve),await this.sendResult({id:a,topic:g,result:{relay:{protocol:c??"irn"},responderPublicKey:S},throwOnFailedPublish:!0}).catch($=>{throw C==null||C.setError(c0.session_approve_publish_failure),$}),C.addTrace(_c.session_approve_publish_success)}catch($){throw this.client.logger.error($),this.client.session.delete(L,rn("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(L),$}return this.client.core.eventClient.deleteEvent({eventId:C.eventId}),await this.client.core.pairing.updateMetadata({topic:g,metadata:y.metadata}),await this.client.proposal.delete(a,rn("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:g}),await this.setExpiry(L,Ei($1)),{topic:L,acknowledged:()=>Promise.resolve(this.client.session.get(L))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:ki.wc_sessionPropose.reject}),await this.client.proposal.delete(n,rn("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=y0(),c=dd(),l=B0().toString(),f=this.client.session.get(n).namespaces;return this.events.once(Er("session_update",c),({error:u})=>{u?a(u):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(u=>{this.client.logger.error(u),this.client.session.update(n,{namespaces:f}),a(u)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:n}=r,i=dd(),{done:s,resolve:o,reject:a}=y0();return this.events.once(Er("session_extend",i),({error:c})=>{c?a(c):o()}),await this.setExpiry(n,Ei($1)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=ki.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===vn.relay&&await this.confirmOnlineStateOrThrow();const c=dd(),l=B0().toString(),{done:f,resolve:u,reject:p}=y0(o,"Request expired. Please try again.");this.events.once(Er("session_request",c),({error:y,result:b})=>{y?p(y):u(b)});const g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return g?(await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Ic(Vn({},i),{expiryTimestamp:Ei(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),await f()):await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Ic(Vn({},i),{expiryTimestamp:Ei(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(b=>p(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),y()}),new Promise(async y=>{var b;if(!((b=a.sessionConfig)!=null&&b.disableDeepLink)){const I=await ike(this.client.core.storage,n$);await rke({id:c,topic:s,wcDeepLink:I})}y()}),f()]).then(y=>y[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===vn.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);xl(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Wa(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=dd(),s=B0().toString(),{done:o,resolve:a,reject:c}=y0();this.events.once(Er("session_ping",i),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=B0().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:rn("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=it("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>iMe(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?vn.link_mode:vn.relay;o===vn.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:f,nonce:u,type:p,exp:g,nbf:y,methods:b=[],expiry:I}=r,C=[...r.resources||[]],{topic:S,uri:O}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:S,uri:O}});const L=await this.client.core.crypto.generateKeyPair(),F=D3(L);if(await Promise.all([this.client.auth.authKeys.set(L3,{responseTopic:F,publicKey:L}),this.client.auth.pairingTopics.set(F,{topic:F,pairingTopic:S})]),await this.client.core.relayer.subscribe(F,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${S}`),b.length>0){const{namespace:E}=Vv(a[0]);let x=Ske(E,"request",b);O3(C)&&(x=Ike(x,C.pop())),C.push(x)}const z=I&&I>ki.wc_sessionAuthenticate.req.ttl?I:ki.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:p??"caip122",chains:a,statement:c,aud:l,domain:f,version:"1",nonce:u,iat:new Date().toISOString(),exp:g,nbf:y,resources:C},requester:{publicKey:L,metadata:this.client.metadata},expiryTimestamp:Ei(z)},$={eip155:{chains:a,methods:[...new Set(["personal_sign",...b])],events:["chainChanged","accountsChanged"]}},ie={requiredNamespaces:{},optionalNamespaces:$,relays:[{protocol:"irn"}],pairingTopic:S,proposer:{publicKey:L,metadata:this.client.metadata},expiryTimestamp:Ei(ki.wc_sessionPropose.req.ttl)},{done:ce,resolve:K,reject:P}=y0(z,"Request expired"),M=async({error:E,session:x})=>{if(this.events.off(Er("session_request",m),v),E)P(E);else if(x){x.self.publicKey=L,await this.client.session.set(x.topic,x),await this.setExpiry(x.topic,x.expiry),S&&await this.client.core.pairing.updateMetadata({topic:S,metadata:x.peer.metadata});const w=this.client.session.get(x.topic);await this.deleteProposal(R),K({session:w})}},v=async E=>{var x,w,T;if(await this.deletePendingAuthRequest(m,{message:"fulfilled",code:0}),E.error){const Z=rn("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return E.error.code===Z.code?void 0:(this.events.off(Er("session_connect"),M),P(E.error.message))}await this.deleteProposal(R),this.events.off(Er("session_connect"),M);const{cacaos:k,responder:H}=E.result,oe=[],j=[];for(const Z of k){await nU({cacao:Z,projectId:this.client.core.projectId})||(this.client.logger.error(Z,"Signature verification failed"),P(rn("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:ee}=Z,N=O3(ee.resources),te=[hI(ee.iss)],fe=c4(ee.iss);if(N){const Ee=iU(N),_e=sU(N);oe.push(...Ee),te.push(..._e)}for(const Ee of te)j.push(`${Ee}:${fe}`)}const X=await this.client.core.crypto.generateSharedKey(L,H.publicKey);let G;oe.length>0&&(G={topic:X,acknowledged:!0,self:{publicKey:L,metadata:this.client.metadata},peer:H,controller:H.publicKey,expiry:Ei($1),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:S,namespaces:pU([...new Set(oe)],[...new Set(j)]),transportType:o},await this.client.core.relayer.subscribe(X,{transportType:o}),await this.client.session.set(X,G),S&&await this.client.core.pairing.updateMetadata({topic:S,metadata:H.metadata}),G=this.client.session.get(X)),(x=this.client.metadata.redirect)!=null&&x.linkMode&&(w=H.metadata.redirect)!=null&&w.linkMode&&(T=H.metadata.redirect)!=null&&T.universal&&n&&(this.client.core.addLinkModeSupportedApp(H.metadata.redirect.universal),this.client.session.update(X,{transportType:vn.link_mode})),K({auths:k,session:G})},m=dd(),R=dd();this.events.once(Er("session_connect"),M),this.events.once(Er("session_request",m),v);let B;try{if(s){const E=Ud("wc_sessionAuthenticate",_,m);this.client.core.history.set(S,E);const x=await this.client.core.crypto.encode("",E,{type:Ux,encoding:Nm});B=k6(n,S,x)}else await Promise.all([this.sendRequest({topic:S,method:"wc_sessionAuthenticate",params:_,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:m}),this.sendRequest({topic:S,method:"wc_sessionPropose",params:ie,expiry:ki.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:R})])}catch(E){throw this.events.off(Er("session_connect"),M),this.events.off(Er("session_request",m),v),E}return await this.setProposal(R,Vn({id:R},ie)),await this.setAuthRequest(m,{request:Ic(Vn({},_),{verifyContext:{}}),pairingTopic:S,transportType:o}),{uri:B??O,response:ce}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[l0.authenticated_session_approve_started]}});try{this.isInitialized()}catch(I){throw s.setError(Fm.no_internet_connection),I}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Fm.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||vn.relay;a===vn.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=D3(c),u={type:lu,receiverPublicKey:c,senderPublicKey:l},p=[],g=[];for(const I of i){if(!await nU({cacao:I,projectId:this.client.core.projectId})){s.setError(Fm.invalid_cacao);const F=rn("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:F,encodeOpts:u}),new Error(F.message)}s.addTrace(l0.cacaos_verified);const{p:C}=I,S=O3(C.resources),O=[hI(C.iss)],L=c4(C.iss);if(S){const F=iU(S),z=sU(S);p.push(...F),O.push(...z)}for(const F of O)g.push(`${F}:${L}`)}const y=await this.client.core.crypto.generateSharedKey(l,c);s.addTrace(l0.create_authenticated_session_topic);let b;if((p==null?void 0:p.length)>0){b={topic:y,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Ei($1),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:pU([...new Set(p)],[...new Set(g)]),transportType:a},s.addTrace(l0.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(y,{transportType:a})}catch(I){throw s.setError(Fm.subscribe_authenticated_session_topic_failure),I}s.addTrace(l0.subscribe_authenticated_session_topic_success),await this.client.session.set(y,b),s.addTrace(l0.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(l0.publishing_authenticated_session_approve);try{await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(I){throw s.setError(Fm.authenticated_session_approve_publish_failure),I}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:b}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===vn.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=D3(o),l={type:lu,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:c,error:i,encodeOpts:l,rpcOpts:ki.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,rn("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return jee(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:c}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,rn("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(n$).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,rn("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=vl.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(c0.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,rn("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=vl.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,Ei(ki.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=vn.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||Ei(ki.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:f}=r,u=Ud(i,s,c);let p;const g=!!f;try{const I=g?Nm:jd;p=await this.client.core.crypto.encode(n,u,{encoding:I})}catch(I){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),I}let y;if(cBe.includes(i)){const I=Bf(JSON.stringify(u)),C=Bf(p);y=await this.client.core.verify.register({id:C,decryptedId:I})}const b=ki[i].req;if(b.attestation=y,o&&(b.ttl=o),a&&(b.id=a),this.client.core.history.set(n,u),g){const I=k6(f,n,p);await global.Linking.openURL(I,this.client.name)}else{const I=ki[i].req;o&&(I.ttl=o),a&&(I.id=a),l?(I.internal=Ic(Vn({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,p,I)):this.client.core.relayer.publish(n,p,I).catch(C=>this.client.logger.error(C))}return u.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=r,l=TE(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?Nm:jd;f=await this.client.core.crypto.encode(i,l,Ic(Vn({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),g}let p;try{p=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),g}if(u){const g=k6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=ki[p.request.method].res;o?(g.internal=Ic(Vn({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,g)):this.client.core.relayer.publish(i,f,g).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:c}=r,l=PE(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?Nm:jd;f=await this.client.core.crypto.encode(i,l,Ic(Vn({},o||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),g}let p;try{p=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),g}if(u){const g=k6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=a||ki[p.request.method].res;this.client.core.relayer.publish(i,f,g)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;ud(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ud(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===vl.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=vl.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=vl.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,c=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=it("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:c}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(Vn({},i.params));const f=a.expiryTimestamp||Ei(ki.wc_sessionPropose.req.ttl),u=Vn({id:c,pairingTopic:n,expiryTimestamp:f},a);await this.setProposal(c,u);const p=await this.getVerifyContext({attestationId:s,hash:Bf(JSON.stringify(i)),encryptedId:o,metadata:u.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Tf.proposal_listener_not_found)),l==null||l.addTrace(bl.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:u,verifyContext:p})}catch(l){await this.sendError({id:c,topic:n,error:l,rpcOpts:ki.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(xl(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const f=await this.client.core.crypto.generateSharedKey(c,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const u=await this.client.core.relayer.subscribe(f,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:r})}else if(Wa(n)){await this.client.proposal.delete(s,rn("USER_DISCONNECTED"));const o=Er("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(Er("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:f,sessionConfig:u}=n.params,p=Ic(Vn(Vn({topic:r,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},f&&{sessionProperties:f}),u&&{sessionConfig:u}),{transportType:vn.relay}),g=Er("session_connect");if(this.events.listenerCount(g)===0)throw new Error(`emitting ${g} without any listeners 997`);this.events.emit(Er("session_connect"),{session:p}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;xl(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Er("session_approve",i),{})):Wa(n)&&(await this.client.session.delete(r,rn("USER_DISCONNECTED")),this.events.emit(Er("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Bm.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:rn("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Vn({topic:r},i));try{Bm.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(c){throw Bm.delete(o),c}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=Er("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Er("session_update",i),{}):Wa(n)&&this.events.emit(Er("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Ei($1)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=Er("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Er("session_extend",i),{}):Wa(n)&&this.events.emit(Er("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=Er("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{xl(n)?this.events.emit(Er("session_ping",i),{}):Wa(n)&&this.events.emit(Er("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Ys.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:rn("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:f}=r,{id:u,params:p}=a;try{await this.isValidRequest(Vn({topic:o},p));const g=this.client.session.get(o),y=await this.getVerifyContext({attestationId:c,hash:Bf(JSON.stringify(Ud("wc_sessionRequest",p,u))),encryptedId:l,metadata:g.peer.metadata,transportType:f}),b={id:u,topic:o,params:p,verifyContext:y};await this.setPendingSessionRequest(b),f===vn.link_mode&&(n=g.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=g.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(b):(this.addSessionRequestToSessionRequestQueue(b),this.processSessionRequestQueue())}catch(g){await this.sendError({id:u,topic:o,error:g}),this.client.logger.error(g)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=Er("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Er("session_request",i),{result:n.result}):Wa(n)&&this.events.emit(Er("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Bm.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Vn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Bm.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),xl(n)?this.events.emit(Er("session_request",i),{result:n.result}):Wa(n)&&this.events.emit(Er("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:c}=r;try{const{requester:l,authPayload:f,expiryTimestamp:u}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Bf(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:c}),g={requester:l,pairingTopic:i,id:s.id,authPayload:f,verifyContext:p,expiryTimestamp:u};await this.setAuthRequest(s.id,{request:g,pairingTopic:i,transportType:c}),c===vn.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:p})}catch(l){this.client.logger.error(l);const f=s.params.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,c),g={type:lu,receiverPublicKey:f,senderPublicKey:u};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:g,rpcOpts:ki.wc_sessionAuthenticate.autoReject,appLink:p})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=vl.idle,this.processSessionRequestQueue()},at.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=Er("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(Er("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===vl.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=vl.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:Ud("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!xo(r)){const{message:c}=it("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(c)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(To(n)||await this.isValidPairingTopic(n),!gMe(a)){const{message:c}=it("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(c)}!To(i)&&Rw(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!To(s)&&Rw(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),To(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=vMe(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!xo(r))throw new Error(it("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),c=K9(i,"approve()");if(c)throw new Error(c.message);const l=yU(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!ii(s,!0)){const{message:f}=it("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}To(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!xo(r)){const{message:s}=it("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!mMe(i)){const{message:s}=it("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!xo(r)){const{message:l}=it("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!Wee(n)){const{message:l}=it("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=lMe(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=K9(s,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(ud(o)){const{message:l}=it("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!xo(r)){const{message:c}=it("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(c)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=K9(i,"update()");if(o)throw new Error(o.message);const a=yU(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!xo(r)){const{message:i}=it("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!xo(r)){const{message:c}=it("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(c)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!gU(a,s)){const{message:c}=it("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(c)}if(!bMe(i)){const{message:c}=it("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(c)}if(!EMe(a,s,i.method)){const{message:c}=it("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(c)}if(o&&!_Me(o,rS)){const{message:c}=it("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${rS.min} and ${rS.max}`);throw new Error(c)}},this.isValidRespond=async r=>{var n;if(!xo(r)){const{message:o}=it("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!wMe(s)){const{message:o}=it("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!xo(r)){const{message:i}=it("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!xo(r)){const{message:a}=it("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!gU(o,s)){const{message:a}=it("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!xMe(i)){const{message:a}=it("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!CMe(o,s,i.name)){const{message:a}=it("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!xo(r)){const{message:i}=it("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!ii(i,!1))throw new Error("uri is required parameter");if(!ii(s,!1))throw new Error("domain is required parameter");if(!ii(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(c=>Vv(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Vv(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,c={verified:{verifyUrl:o.verifyUrl||Fb,validation:"UNKNOWN",origin:o.url||""}};try{if(a===vn.link_mode){const f=this.getAppLinkIfEnabled(o,a);return c.verified.validation=f&&new URL(f).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!ii(i,!1)){const{message:s}=it("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=it("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,c,l,f,u,p;return!r||n!==vn.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((f=r==null?void 0:r.redirect)==null?void 0:f.universal)!==void 0&&((u=r==null?void 0:r.redirect)==null?void 0:u.universal)!==""&&((p=r==null?void 0:r.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Xj(r,"topic")||"",i=decodeURIComponent(Xj(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:vn.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(FM()||jy()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ys.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(L3)?this.client.auth.authKeys.get(L3):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===vn.link_mode?Nm:jd});try{HM(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Bf(n)})):kE(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(ja.expired,async e=>{const{topic:r,id:n}=Lee(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,it("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,it("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(x0.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(x0.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ii(e,!1)){const{message:r}=it("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=it("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ud(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=it("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!ii(e,!1)){const{message:r}=it("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=it("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ud(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=it("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=it("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ii(e,!1)){const{message:r}=it("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=it("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!yMe(e)){const{message:r}=it("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=it("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ud(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=it("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class wBe extends e1{constructor(e,r){super(e,r,iBe,WM),this.core=e,this.logger=r}}let xBe=class extends e1{constructor(e,r){super(e,r,sBe,WM),this.core=e,this.logger=r}};class EBe extends e1{constructor(e,r){super(e,r,aBe,WM,n=>n.id),this.core=e,this.logger=r}}class CBe extends e1{constructor(e,r){super(e,r,uBe,RE,()=>L3),this.core=e,this.logger=r}}class ABe extends e1{constructor(e,r){super(e,r,dBe,RE),this.core=e,this.logger=r}}class SBe extends e1{constructor(e,r){super(e,r,hBe,RE,n=>n.id),this.core=e,this.logger=r}}class _Be{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new CBe(this.core,this.logger),this.pairingTopics=new ABe(this.core,this.logger),this.requests=new SBe(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class OE extends QRe{constructor(e){super(e),this.protocol=Ete,this.version=Cte,this.name=tS.name,this.events=new ba.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||tS.name,this.metadata=(e==null?void 0:e.metadata)||Ree(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:qx(IE({level:(e==null?void 0:e.logger)||tS.logger}));this.core=(e==null?void 0:e.core)||new nBe(e),this.logger=so(r,this.name),this.session=new xBe(this.core,this.logger),this.proposal=new wBe(this.core,this.logger),this.pendingRequest=new EBe(this.core,this.logger),this.engine=new bBe(this),this.auth=new _Be(this.core,this.logger)}static async init(e){const r=new OE(e);return await r.initialize(),r}get context(){return Lo(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var h4={exports:{}};/** + Approved: ${p.toString()}`))}),o.forEach(u=>{n||(N0(i[u].methods,s[u].methods)?N0(i[u].events,s[u].events)||(n=it("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${u}`)):n=it("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${u}`))}),n}function AMe(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function mU(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function SMe(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Uy(t[r].accounts);n==null||n.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function _Me(t,e){return qM(t)&&t<=e.max&&t>=e.min}function bU(){const t=Fx();return new Promise(e=>{switch(t){case la.browser:e(IMe());break;case la.reactNative:e(TMe());break;case la.node:e(PMe());break;default:e(!0)}})}function IMe(){return Lx()&&(navigator==null?void 0:navigator.onLine)}async function TMe(){if(jy()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function PMe(){return!0}function kMe(t){switch(Fx()){case la.browser:MMe(t);break;case la.reactNative:RMe(t);break}}function MMe(t){!jy()&&Lx()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function RMe(t){jy()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const Y9={};let Bm=class{static get(e){return Y9[e]}static set(e,r){Y9[e]=r}static delete(e){delete Y9[e]}};class Zp{}let OMe=class extends Zp{constructor(e){super()}};const wU=at.FIVE_SECONDS,$y={pulse:"heartbeat_pulse"};let DMe=class Kee extends OMe{constructor(e){super(e),this.events=new ba.EventEmitter,this.interval=wU,this.interval=(e==null?void 0:e.interval)||wU}static async init(e){const r=new Kee(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),at.toMiliseconds(this.interval))}pulse(){this.events.emit($y.pulse)}};const NMe=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,BMe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,LMe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function FMe(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){jMe(t);return}return e}function jMe(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function M6(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!LMe.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(NMe.test(t)||BMe.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,FMe)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function UMe(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Mi(t,...e){try{return UMe(t(...e))}catch(r){return Promise.reject(r)}}function $Me(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function qMe(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function N3(t){if($Me(t))return String(t);if(qMe(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return N3(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Yee(){if(typeof Buffer>"u")throw new TypeError("[unstorage] Buffer is not supported!")}const gI="base64:";function VMe(t){if(typeof t=="string")return t;Yee();const e=Buffer.from(t).toString("base64");return gI+e}function zMe(t){return typeof t!="string"||!t.startsWith(gI)?t:(Yee(),Buffer.from(t.slice(gI.length),"base64"))}function bo(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function HMe(...t){return bo(t.join(":"))}function R6(t){return t=bo(t),t?t+":":""}const GMe="memory",WMe=()=>{const t=new Map;return{name:GMe,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function KMe(t={}){const e={mounts:{"":t.driver||WMe()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{for(const f of e.mountpoints)if(l.startsWith(f))return{base:f,relativeKey:l.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:l,driver:e.mounts[""]}},n=(l,f)=>e.mountpoints.filter(u=>u.startsWith(l)||f&&l.startsWith(u)).map(u=>({relativeBase:l.length>u.length?l.slice(u.length):void 0,mountpoint:u,driver:e.mounts[u]})),i=(l,f)=>{if(e.watching){f=bo(f);for(const u of e.watchListeners)u(l,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(const l in e.mounts)e.unwatch[l]=await xU(e.mounts[l],i,l)}},o=async()=>{if(e.watching){for(const l in e.unwatch)await e.unwatch[l]();e.unwatch={},e.watching=!1}},a=(l,f,u)=>{const p=new Map,g=y=>{let b=p.get(y.base);return b||(b={driver:y.driver,base:y.base,items:[]},p.set(y.base,b)),b};for(const y of l){const b=typeof y=="string",I=bo(b?y:y.key),C=b?void 0:y.value,S=b||!y.options?f:{...f,...y.options},O=r(I);g(O).items.push({key:I,value:C,relativeKey:O.relativeKey,options:S})}return Promise.all([...p.values()].map(y=>u(y))).then(y=>y.flat())},c={hasItem(l,f={}){l=bo(l);const{relativeKey:u,driver:p}=r(l);return Mi(p.hasItem,u,f)},getItem(l,f={}){l=bo(l);const{relativeKey:u,driver:p}=r(l);return Mi(p.getItem,u,f).then(g=>M6(g))},getItems(l,f){return a(l,f,u=>u.driver.getItems?Mi(u.driver.getItems,u.items.map(p=>({key:p.relativeKey,options:p.options})),f).then(p=>p.map(g=>({key:HMe(u.base,g.key),value:M6(g.value)}))):Promise.all(u.items.map(p=>Mi(u.driver.getItem,p.relativeKey,p.options).then(g=>({key:p.key,value:M6(g)})))))},getItemRaw(l,f={}){l=bo(l);const{relativeKey:u,driver:p}=r(l);return p.getItemRaw?Mi(p.getItemRaw,u,f):Mi(p.getItem,u,f).then(g=>zMe(g))},async setItem(l,f,u={}){if(f===void 0)return c.removeItem(l);l=bo(l);const{relativeKey:p,driver:g}=r(l);g.setItem&&(await Mi(g.setItem,p,N3(f),u),g.watch||i("update",l))},async setItems(l,f){await a(l,f,async u=>{if(u.driver.setItems)return Mi(u.driver.setItems,u.items.map(p=>({key:p.relativeKey,value:N3(p.value),options:p.options})),f);u.driver.setItem&&await Promise.all(u.items.map(p=>Mi(u.driver.setItem,p.relativeKey,N3(p.value),p.options)))})},async setItemRaw(l,f,u={}){if(f===void 0)return c.removeItem(l,u);l=bo(l);const{relativeKey:p,driver:g}=r(l);if(g.setItemRaw)await Mi(g.setItemRaw,p,f,u);else if(g.setItem)await Mi(g.setItem,p,VMe(f),u);else return;g.watch||i("update",l)},async removeItem(l,f={}){typeof f=="boolean"&&(f={removeMeta:f}),l=bo(l);const{relativeKey:u,driver:p}=r(l);p.removeItem&&(await Mi(p.removeItem,u,f),(f.removeMeta||f.removeMata)&&await Mi(p.removeItem,u+"$",f),p.watch||i("remove",l))},async getMeta(l,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),l=bo(l);const{relativeKey:u,driver:p}=r(l),g=Object.create(null);if(p.getMeta&&Object.assign(g,await Mi(p.getMeta,u,f)),!f.nativeOnly){const y=await Mi(p.getItem,u+"$",f).then(b=>M6(b));y&&typeof y=="object"&&(typeof y.atime=="string"&&(y.atime=new Date(y.atime)),typeof y.mtime=="string"&&(y.mtime=new Date(y.mtime)),Object.assign(g,y))}return g},setMeta(l,f,u={}){return this.setItem(l+"$",f,u)},removeMeta(l,f={}){return this.removeItem(l+"$",f)},async getKeys(l,f={}){l=R6(l);const u=n(l,!0);let p=[];const g=[];for(const y of u){const b=await Mi(y.driver.getKeys,y.relativeBase,f);for(const I of b){const C=y.mountpoint+bo(I);p.some(S=>C.startsWith(S))||g.push(C)}p=[y.mountpoint,...p.filter(I=>!I.startsWith(y.mountpoint))]}return l?g.filter(y=>y.startsWith(l)&&y[y.length-1]!=="$"):g.filter(y=>y[y.length-1]!=="$")},async clear(l,f={}){l=R6(l),await Promise.all(n(l,!1).map(async u=>{if(u.driver.clear)return Mi(u.driver.clear,u.relativeBase,f);if(u.driver.removeItem){const p=await u.driver.getKeys(u.relativeBase||"",f);return Promise.all(p.map(g=>u.driver.removeItem(g,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(l=>EU(l)))},async watch(l){return await s(),e.watchListeners.push(l),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==l),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(l,f){if(l=R6(l),l&&e.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(e.mountpoints.push(l),e.mountpoints.sort((u,p)=>p.length-u.length)),e.mounts[l]=f,e.watching&&Promise.resolve(xU(f,i,l)).then(u=>{e.unwatch[l]=u}).catch(console.error),c},async unmount(l,f=!0){l=R6(l),!(!l||!e.mounts[l])&&(e.watching&&l in e.unwatch&&(e.unwatch[l](),delete e.unwatch[l]),f&&await EU(e.mounts[l]),e.mountpoints=e.mountpoints.filter(u=>u!==l),delete e.mounts[l])},getMount(l=""){l=bo(l)+":";const f=r(l);return{driver:f.driver,base:f.base}},getMounts(l="",f={}){return l=bo(l),n(l,f.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(l,f={})=>c.getKeys(l,f),get:(l,f={})=>c.getItem(l,f),set:(l,f,u={})=>c.setItem(l,f,u),has:(l,f={})=>c.hasItem(l,f),del:(l,f={})=>c.removeItem(l,f),remove:(l,f={})=>c.removeItem(l,f)};return c}function xU(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function EU(t){typeof t.dispose=="function"&&await Mi(t.dispose)}function Xp(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Qee(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Xp(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let Q9;function $x(){return Q9||(Q9=Qee("keyval-store","keyval")),Q9}function CU(t,e=$x()){return e("readonly",r=>Xp(r.get(t)))}function YMe(t,e,r=$x()){return r("readwrite",n=>(n.put(e,t),Xp(n.transaction)))}function QMe(t,e=$x()){return e("readwrite",r=>(r.delete(t),Xp(r.transaction)))}function JMe(t=$x()){return t("readwrite",e=>(e.clear(),Xp(e.transaction)))}function ZMe(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Xp(t.transaction)}function XMe(t=$x()){return t("readonly",e=>{if(e.getAllKeys)return Xp(e.getAllKeys());const r=[];return ZMe(e,n=>r.push(n.key)).then(()=>r)})}const eRe="idb-keyval";var tRe=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=Qee(t.dbName,t.storeName)),{name:eRe,options:t,async hasItem(i){return!(typeof await CU(r(i),n)>"u")},async getItem(i){return await CU(r(i),n)??null},setItem(i,s){return YMe(r(i),s,n)},removeItem(i){return QMe(r(i),n)},getKeys(){return XMe(n)},clear(){return JMe(n)}}};const rRe="WALLET_CONNECT_V2_INDEXED_DB",nRe="keyvaluestorage";let iRe=class{constructor(){this.indexedDb=KMe({driver:tRe({dbName:rRe,storeName:nRe})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Su(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var J9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},B3={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof J9<"u"&&J9.localStorage?B3.exports=J9.localStorage:typeof window<"u"&&window.localStorage?B3.exports=window.localStorage:B3.exports=new e})();function sRe(t){var e;return[t[0],Lp((e=t[1])!=null?e:"")]}let oRe=class{constructor(){this.localStorage=B3.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(sRe)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Lp(r)}async setItem(e,r){this.localStorage.setItem(e,Su(r))}async removeItem(e){this.localStorage.removeItem(e)}};const aRe="wc_storage_version",AU=1,cRe=async(t,e,r)=>{const n=aRe,i=await e.getItem(n);if(i&&i>=AU){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const l=await t.getItem(a);await e.setItem(a,l),o.push(a)}}await e.setItem(n,AU),r(e),lRe(t,o)},lRe=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let fRe=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new oRe;this.storage=e;try{const r=new iRe;cRe(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function uRe(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var dRe=hRe;function hRe(t,e,r){var n=r&&r.stringify||uRe,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?u:0,t.charCodeAt(g+1)){case 100:case 102:if(f>=c||e[f]==null)break;u=c||e[f]==null)break;u=c||e[f]===void 0)break;u",u=g+2,g++;break}l+=n(e[f]),u=g+2,g++;break;case 115:if(f>=c)break;u-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(r);c.log||(c.log=Dw),Object.defineProperty(c,"levelVal",{get:f}),Object.defineProperty(c,"level",{get:u,set:p});const l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:wRe(t)};c.levels=Wl.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Dw,c.serializers=n,c._serialize=i,c._stdErrSerialize=s,c.child=g,e&&(c._logEvent=yI());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function u(){return this._level}function p(y){if(y!=="silent"&&!this.levels.values[y])throw Error("unknown level "+y);this._level=y,j1(l,c,"error","log"),j1(l,c,"fatal","error"),j1(l,c,"warn","error"),j1(l,c,"info","log"),j1(l,c,"debug","log"),j1(l,c,"trace","log")}function g(y,b){if(!y)throw new Error("missing bindings for child Pino");b=b||{},i&&y.serializers&&(b.serializers=y.serializers);const I=b.serializers;if(i&&I){var C=Object.assign({},n,I),S=t.browser.serialize===!0?Object.keys(C):i;delete y.serializers,_E([y],S,C,this._stdErrSerialize)}function O(L){this._childLevel=(L._childLevel|0)+1,this.error=U1(L,y,"error"),this.fatal=U1(L,y,"fatal"),this.warn=U1(L,y,"warn"),this.info=U1(L,y,"info"),this.debug=U1(L,y,"debug"),this.trace=U1(L,y,"trace"),C&&(this.serializers=C,this._serialize=S),e&&(this._logEvent=yI([].concat(L._logEvent.bindings,y)))}return O.prototype=this,new O(this)}return c}Wl.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Wl.stdSerializers=pRe;Wl.stdTimeFunctions=Object.assign({},{nullTime:Jee,epochTime:Zee,unixTime:xRe,isoTime:ERe});function j1(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Dw:i[r]?i[r]:Ow[r]||Ow[n]||Dw,gRe(t,e,r)}function gRe(t,e,r){!t.transmit&&e[r]===Dw||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ow?Ow:this;for(var c=0;c-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function U1(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;ithis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}},Xee=class{constructor(e,r=VM){this.level=e??"error",this.levelValue=G1.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new _U(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===G1.levels.values.error?console.error(e):r===G1.levels.values.warn?console.warn(e):r===G1.levels.values.debug?console.debug(e):r===G1.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Su({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new _U(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Su({extraMetadata:e})),new Blob(r,{type:"application/json"})}},_Re=class{constructor(e,r=VM){this.baseChunkLogger=new Xee(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}},IRe=class{constructor(e,r=VM){this.baseChunkLogger=new Xee(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var TRe=Object.defineProperty,PRe=Object.defineProperties,kRe=Object.getOwnPropertyDescriptors,IU=Object.getOwnPropertySymbols,MRe=Object.prototype.hasOwnProperty,RRe=Object.prototype.propertyIsEnumerable,TU=(t,e,r)=>e in t?TRe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f4=(t,e)=>{for(var r in e||(e={}))MRe.call(e,r)&&TU(t,r,e[r]);if(IU)for(var r of IU(e))RRe.call(e,r)&&TU(t,r,e[r]);return t},u4=(t,e)=>PRe(t,kRe(e));function IE(t){return u4(f4({},t),{level:(t==null?void 0:t.level)||ARe.level})}function ORe(t,e=Vx){return t[e]||""}function DRe(t,e,r=Vx){return t[r]=e,t}function Lo(t,e=Vx){let r="";return typeof t.bindings>"u"?r=ORe(t,e):r=t.bindings().context||"",r}function NRe(t,e,r=Vx){const n=Lo(t,r);return n.trim()?`${n}/${e}`:e}function so(t,e,r=Vx){const n=NRe(t,e,r),i=t.child({context:n});return DRe(i,n,r)}function BRe(t){var e,r;const n=new _Re((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:qx(u4(f4({},t.opts),{level:"trace",browser:u4(f4({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function LRe(t){var e;const r=new IRe((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:qx(u4(f4({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function FRe(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?BRe(t):LRe(t)}let jRe=class extends Zp{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},URe=class extends Zp{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},$Re=class{constructor(e,r){this.logger=e,this.core=r}},qRe=class extends Zp{constructor(e,r){super(),this.relayer=e,this.logger=r}},VRe=class extends Zp{constructor(e){super()}},zRe=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},HRe=class extends Zp{constructor(e,r){super(),this.relayer=e,this.logger=r}},GRe=class extends Zp{constructor(e,r){super(),this.core=e,this.logger=r}},WRe=class{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}},KRe=class{constructor(e,r){this.projectId=e,this.logger=r}},YRe=class{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}},QRe=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},JRe=class{constructor(e){this.client=e}};const ZRe="PARSE_ERROR",XRe="INVALID_REQUEST",eOe="METHOD_NOT_FOUND",tOe="INVALID_PARAMS",ete="INTERNAL_ERROR",zM="SERVER_ERROR",rOe=[-32700,-32600,-32601,-32602,-32603],Lb={[ZRe]:{code:-32700,message:"Parse error"},[XRe]:{code:-32600,message:"Invalid Request"},[eOe]:{code:-32601,message:"Method not found"},[tOe]:{code:-32602,message:"Invalid params"},[ete]:{code:-32603,message:"Internal error"},[zM]:{code:-32e3,message:"Server error"}},tte=zM;function nOe(t){return rOe.includes(t)}function PU(t){return Object.keys(Lb).includes(t)?Lb[t]:Lb[tte]}function iOe(t){const e=Object.values(Lb).find(r=>r.code===t);return e||Lb[tte]}function rte(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var nte={},Cf={},kU;function sOe(){if(kU)return Cf;kU=1,Object.defineProperty(Cf,"__esModule",{value:!0}),Cf.isBrowserCryptoAvailable=Cf.getSubtleCrypto=Cf.getBrowerCrypto=void 0;function t(){return(Si==null?void 0:Si.crypto)||(Si==null?void 0:Si.msCrypto)||{}}Cf.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Cf.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Cf.isBrowserCryptoAvailable=r,Cf}var Af={},MU;function oOe(){if(MU)return Af;MU=1,Object.defineProperty(Af,"__esModule",{value:!0}),Af.isBrowser=Af.isNode=Af.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Af.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Af.isNode=e;function r(){return!t()&&!e()}return Af.isBrowser=r,Af}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Px;e.__exportStar(sOe(),t),e.__exportStar(oOe(),t)})(nte);function dd(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function B0(t=6){return BigInt(dd(t))}function Ud(t,e,r){return{id:r||dd(),jsonrpc:"2.0",method:t,params:e}}function TE(t,e){return{id:t,jsonrpc:"2.0",result:e}}function PE(t,e,r){return{id:t,jsonrpc:"2.0",error:aOe(e)}}function aOe(t,e){return typeof t>"u"?PU(ete):(typeof t=="string"&&(t=Object.assign(Object.assign({},PU(zM)),{message:t})),nOe(t.code)&&(t=iOe(t.code)),t)}class cOe{}class lOe extends cOe{constructor(){super()}}class fOe extends lOe{constructor(e){super()}}const uOe="^https?:",dOe="^wss?:";function hOe(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function ite(t,e){const r=hOe(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function RU(t){return ite(t,uOe)}function OU(t){return ite(t,dOe)}function pOe(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function ste(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function HM(t){return ste(t)&&"method"in t}function kE(t){return ste(t)&&(xl(t)||Wa(t))}function xl(t){return"result"in t}function Wa(t){return"error"in t}let dc=class extends fOe{constructor(e){super(e),this.events=new ba.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(Ud(e.method,e.params||[],e.id||B0().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Wa(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),kE(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const vOe=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),gOe=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",DU=t=>t.split("?")[0],NU=10,yOe=vOe();let mOe=class{constructor(e){if(this.url=e,this.events=new ba.EventEmitter,this.registering=!1,!OU(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Su(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!OU(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=nte.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!pOe(e)},o=new yOe(e,[],s);gOe()?o.onerror=a=>{const c=a;n(this.emitError(c.error))}:o.on("error",a=>{n(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Lp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=PE(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return rte(e,DU(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>NU&&this.events.setMaxListeners(NU)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${DU(this.url)}`));return this.events.emit("register_error",r),r}};var d4={exports:{}};d4.exports;(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",f="[object Boolean]",u="[object Date]",p="[object Error]",g="[object Function]",y="[object GeneratorFunction]",b="[object Map]",I="[object Number]",C="[object Null]",S="[object Object]",O="[object Promise]",L="[object Proxy]",F="[object RegExp]",z="[object Set]",_="[object String]",$="[object Symbol]",ie="[object Undefined]",ce="[object WeakMap]",K="[object ArrayBuffer]",P="[object DataView]",M="[object Float32Array]",v="[object Float64Array]",m="[object Int8Array]",R="[object Int16Array]",B="[object Int32Array]",E="[object Uint8Array]",x="[object Uint8ClampedArray]",w="[object Uint16Array]",T="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,H=/^\[object .+?Constructor\]$/,oe=/^(?:0|[1-9]\d*)$/,j={};j[M]=j[v]=j[m]=j[R]=j[B]=j[E]=j[x]=j[w]=j[T]=!0,j[a]=j[c]=j[K]=j[f]=j[P]=j[u]=j[p]=j[g]=j[b]=j[I]=j[S]=j[F]=j[z]=j[_]=j[ce]=!1;var X=typeof Si=="object"&&Si&&Si.Object===Object&&Si,G=typeof self=="object"&&self&&self.Object===Object&&self,Z=X||G||Function("return this")(),ee=e&&!e.nodeType&&e,N=ee&&!0&&t&&!t.nodeType&&t,te=N&&N.exports===ee,fe=te&&X.process,Ee=function(){try{return fe&&fe.binding&&fe.binding("util")}catch{}}(),_e=Ee&&Ee.isTypedArray;function Re(le,we){for(var $e=-1,yt=le==null?0:le.length,zr=0,tr=[];++$e-1}function Ti(le,we){var $e=this.__data__,yt=pc($e,le);return yt<0?(++this.size,$e.push([le,we])):$e[yt][1]=we,this}er.prototype.clear=kr,er.prototype.delete=bi,er.prototype.get=wi,er.prototype.has=xi,er.prototype.set=Ti;function Sn(le){var we=-1,$e=le==null?0:le.length;for(this.clear();++we<$e;){var yt=le[we];this.set(yt[0],yt[1])}}function di(){this.size=0,this.__data__={hash:new Ct,map:new(Nt||er),string:new Ct}}function Fs(le){var we=Vo(this,le).delete(le);return this.size-=we?1:0,we}function hi(le){return Vo(this,le).get(le)}function jo(le){return Vo(this,le).has(le)}function Uo(le,we){var $e=Vo(this,le),yt=$e.size;return $e.set(le,we),this.size+=$e.size==yt?0:1,this}Sn.prototype.clear=di,Sn.prototype.delete=Fs,Sn.prototype.get=hi,Sn.prototype.has=jo,Sn.prototype.set=Uo;function pi(le){var we=-1,$e=le==null?0:le.length;for(this.__data__=new Sn;++we<$e;)this.add(le[we])}function oo(le){return this.__data__.set(le,n),this}function ao(le){return this.__data__.has(le)}pi.prototype.add=pi.prototype.push=oo,pi.prototype.has=ao;function _n(le){var we=this.__data__=new er(le);this.size=we.size}function $o(){this.__data__=new er,this.size=0}function Gi(le){var we=this.__data__,$e=we.delete(le);return this.size=we.size,$e}function qo(le){return this.__data__.get(le)}function Ca(le){return this.__data__.has(le)}function co(le,we){var $e=this.__data__;if($e instanceof er){var yt=$e.__data__;if(!Nt||yt.lengthjn))return!1;var en=tr.get(le);if(en&&tr.get(we))return en==we;var Pn=-1,ps=!0,Un=$e&s?new pi:void 0;for(tr.set(le,we),tr.set(we,le);++Pn-1&&le%1==0&&le-1&&le%1==0&&le<=o}function $u(le){var we=typeof le;return le!=null&&(we=="object"||we=="function")}function ff(le){return le!=null&&typeof le=="object"}var a1=_e?et(_e):r1;function zo(le){return Vy(le)?Lh(le):n1(le)}function Wr(){return[]}function Kr(){return!1}t.exports=zy})(d4,d4.exports);var bOe=d4.exports;const wOe=_u(bOe),ote="wc",ate=2,GM="core",nf=`${ote}@2:${GM}:`,xOe={name:GM,logger:"error"},EOe={database:":memory:"},COe="crypto",BU="client_ed25519_seed",AOe=at.ONE_DAY,SOe="keychain",_Oe="0.3",IOe="messages",TOe="0.3",POe=at.SIX_HOURS,kOe="publisher",cte="irn",MOe="error",lte="wss://relay.walletconnect.org",ROe="relayer",Ys={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},OOe="_subscription",Na={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},DOe=.1,mI="2.17.2",vn={link_mode:"link_mode",relay:"relay"},NOe="0.3",BOe="WALLETCONNECT_CLIENT_ID",LU="WALLETCONNECT_LINK_MODE_APPS",El={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},LOe="subscription",FOe="0.3",jOe=at.FIVE_SECONDS*1e3,UOe="pairing",$Oe="0.3",Lm={wc_pairingDelete:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:at.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:at.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:at.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:at.ONE_DAY,prompt:!1,tag:0},res:{ttl:at.ONE_DAY,prompt:!1,tag:0}}},x0={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Sc={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},qOe="history",VOe="0.3",zOe="expirer",ja={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},HOe="0.3",GOe="verify-api",WOe="https://verify.walletconnect.com",fte="https://verify.walletconnect.org",Fb=fte,KOe=`${Fb}/v3`,YOe=[WOe,fte],QOe="echo",JOe="https://echo.walletconnect.com",bl={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Tf={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},_c={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},c0={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},l0={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Fm={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ZOe=.1,XOe="event-client",eDe=86400,tDe="https://pulse.walletconnect.org/batch";function rDe(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,L=new Uint8Array(O);C!==S;){for(var F=y[C],z=0,_=O-1;(F!==0||z>>0,L[_]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");I=z,C++}for(var $=O-I;$!==O&&L[$]===0;)$++;for(var ie=c.repeat(b);$>>0,O=new Uint8Array(S);y[b];){var L=r[y.charCodeAt(b)];if(L===255)return;for(var F=0,z=S-1;(L!==0||F>>0,O[z]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");C=F,b++}if(y[b]!==" "){for(var _=S-C;_!==S&&O[_]===0;)_++;for(var $=new Uint8Array(I+(S-_)),ie=I;_!==S;)$[ie++]=O[_++];return $}}}function g(y){var b=p(y);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:p,decode:g}}var nDe=rDe,iDe=nDe;const ute=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},sDe=t=>new TextEncoder().encode(t),oDe=t=>new TextDecoder().decode(t);class aDe{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class cDe{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return dte(this,e)}}class lDe{constructor(e){this.decoders=e}or(e){return dte(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const dte=(t,e)=>new lDe({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class fDe{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new aDe(e,r,n),this.decoder=new cDe(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const ME=({name:t,prefix:e,encode:r,decode:n})=>new fDe(t,e,r,n),zx=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=iDe(r,e);return ME({prefix:t,name:e,encode:n,decode:s=>ute(i(s))})},uDe=(t,e,r,n)=>{const i={};for(let f=0;f=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},dDe=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<ME({prefix:e,name:t,encode(i){return dDe(i,n,r)},decode(i){return uDe(i,n,r,t)}}),hDe=ME({prefix:"\0",name:"identity",encode:t=>oDe(t),decode:t=>sDe(t)});var pDe=Object.freeze({__proto__:null,identity:hDe});const vDe=us({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var gDe=Object.freeze({__proto__:null,base2:vDe});const yDe=us({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var mDe=Object.freeze({__proto__:null,base8:yDe});const bDe=zx({prefix:"9",name:"base10",alphabet:"0123456789"});var wDe=Object.freeze({__proto__:null,base10:bDe});const xDe=us({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),EDe=us({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var CDe=Object.freeze({__proto__:null,base16:xDe,base16upper:EDe});const ADe=us({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),SDe=us({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_De=us({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),IDe=us({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),TDe=us({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),PDe=us({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kDe=us({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),MDe=us({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),RDe=us({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ODe=Object.freeze({__proto__:null,base32:ADe,base32upper:SDe,base32pad:_De,base32padupper:IDe,base32hex:TDe,base32hexupper:PDe,base32hexpad:kDe,base32hexpadupper:MDe,base32z:RDe});const DDe=zx({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),NDe=zx({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var BDe=Object.freeze({__proto__:null,base36:DDe,base36upper:NDe});const LDe=zx({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),FDe=zx({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var jDe=Object.freeze({__proto__:null,base58btc:LDe,base58flickr:FDe});const UDe=us({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$De=us({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),qDe=us({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),VDe=us({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var zDe=Object.freeze({__proto__:null,base64:UDe,base64pad:$De,base64url:qDe,base64urlpad:VDe});const hte=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),HDe=hte.reduce((t,e,r)=>(t[r]=e,t),[]),GDe=hte.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function WDe(t){return t.reduce((e,r)=>(e+=HDe[r],e),"")}function KDe(t){const e=[];for(const r of t){const n=GDe[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const YDe=ME({prefix:"🚀",name:"base256emoji",encode:WDe,decode:KDe});var QDe=Object.freeze({__proto__:null,base256emoji:YDe}),JDe=pte,FU=128,ZDe=127,XDe=~ZDe,eNe=Math.pow(2,31);function pte(t,e,r){e=e||[],r=r||0;for(var n=r;t>=eNe;)e[r++]=t&255|FU,t/=128;for(;t&XDe;)e[r++]=t&255|FU,t>>>=7;return e[r]=t|0,pte.bytes=r-n+1,e}var tNe=bI,rNe=128,jU=127;function bI(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw bI.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&jU)<=rNe);return bI.bytes=s-n,r}var nNe=Math.pow(2,7),iNe=Math.pow(2,14),sNe=Math.pow(2,21),oNe=Math.pow(2,28),aNe=Math.pow(2,35),cNe=Math.pow(2,42),lNe=Math.pow(2,49),fNe=Math.pow(2,56),uNe=Math.pow(2,63),dNe=function(t){return t(vte.encode(t,e,r),e),$U=t=>vte.encodingLength(t),wI=(t,e)=>{const r=e.byteLength,n=$U(t),i=n+$U(r),s=new Uint8Array(i+r);return UU(t,s,0),UU(r,s,n),s.set(e,i),new pNe(t,r,e,s)};class pNe{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const gte=({name:t,code:e,encode:r})=>new vNe(t,e,r);let vNe=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?wI(this.code,r):r.then(n=>wI(this.code,n))}else throw Error("Unknown type, must be binary type")}};const yte=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),gNe=gte({name:"sha2-256",code:18,encode:yte("SHA-256")}),yNe=gte({name:"sha2-512",code:19,encode:yte("SHA-512")});var mNe=Object.freeze({__proto__:null,sha256:gNe,sha512:yNe});const mte=0,bNe="identity",bte=ute,wNe=t=>wI(mte,bte(t)),xNe={code:mte,name:bNe,encode:bte,digest:wNe};var ENe=Object.freeze({__proto__:null,identity:xNe});new TextEncoder,new TextDecoder;const qU={...pDe,...gDe,...mDe,...wDe,...CDe,...ODe,...BDe,...jDe,...zDe,...QDe};({...mNe,...ENe});function CNe(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function wte(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const VU=wte("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),X9=wte("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);const e=CNe(t.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=it("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=so(r,this.name)}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Dee(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Nee(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}let INe=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=COe,this.randomSessionIdentifier=pI(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Kj(i);return kee(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=Mke();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Kj(s),a=this.randomSessionIdentifier;return await UPe(a,i,AOe,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),c=Rke(a,s);return this.setSymKey(c,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||D3(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();const a=Hee(o),c=Su(s);if(cU(a))return Dke(c,o==null?void 0:o.encoding);if(aU(a)){const p=a.senderPublicKey,g=a.receiverPublicKey;i=await this.generateSharedKey(p,g)}const l=this.getSymKey(i),{type:f,senderPublicKey:u}=a;return Oke({type:f,symKey:l,message:c,senderPublicKey:u,encoding:o==null?void 0:o.encoding})},this.decode=async(i,s,o)=>{this.isInitialized();const a=Lke(s,o);if(cU(a)){const c=Bke(s,o==null?void 0:o.encoding);return Lp(c)}if(aU(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(i),l=Nke({symKey:c,encoded:s,encoding:o==null?void 0:o.encoding});return Lp(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}},this.getPayloadType=(i,s=jd)=>{const o=Mw({encoded:i,encoding:s});return jp(o.type)},this.getPayloadSenderPublicKey=(i,s=jd)=>{const o=Mw({encoded:i,encoding:s});return o.senderPublicKey?ji(o.senderPublicKey,eo):void 0},this.core=e,this.logger=so(r,this.name),this.keychain=n||new _Ne(this.core,this.logger)}get context(){return Lo(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(BU)}catch{e=pI(),await this.keychain.set(BU,e)}return SNe(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}};class TNe extends $Re{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=IOe,this.version=TOe,this.initialized=!1,this.storagePrefix=nf,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Bf(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),o=Bf(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=so(e,this.name),this.core=r}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Dee(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Nee(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class PNe extends qRe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new ba.EventEmitter,this.name=kOe,this.queue=new Map,this.publishTimeout=at.toMiliseconds(at.ONE_MINUTE),this.failedPublishTimeout=at.toMiliseconds(at.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const a=(s==null?void 0:s.ttl)||POe,c=vI(s),l=(s==null?void 0:s.prompt)||!1,f=(s==null?void 0:s.tag)||0,u=(s==null?void 0:s.id)||B0().toString(),p={topic:n,message:i,opts:{ttl:a,relay:c,prompt:l,tag:f,id:u,attestation:s==null?void 0:s.attestation}},g=`Failed to publish payload, please try again. id:${u} tag:${f}`,y=Date.now();let b,I=1;try{for(;b===void 0;){if(Date.now()-y>this.publishTimeout)throw new Error(g);this.logger.trace({id:u,attempts:I},`publisher.publish - attempt ${I}`),b=await await zv(this.rpcPublish(n,i,a,c,l,f,u,s==null?void 0:s.attestation).catch(C=>this.logger.warn(C)),this.publishTimeout,g),I++,b||await new Promise(C=>setTimeout(C,this.failedPublishTimeout))}this.relayer.events.emit(Ys.publish,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:u,topic:n,message:i,opts:s}})}catch(C){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(C),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw C;this.queue.set(u,p)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=so(r,this.name),this.registerEventListeners()}get context(){return Lo(this.logger)}rpcPublish(e,r,n,i,s,o,a,c){var l,f,u,p;const g={method:cb(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o,attestation:c},id:a};return To((l=g.params)==null?void 0:l.prompt)&&((f=g.params)==null||delete f.prompt),To((u=g.params)==null?void 0:u.tag)&&((p=g.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on($y.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Ys.connection_stalled);return}this.checkQueue()}),this.relayer.on(Ys.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class kNe{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var MNe=Object.defineProperty,RNe=Object.defineProperties,ONe=Object.getOwnPropertyDescriptors,zU=Object.getOwnPropertySymbols,DNe=Object.prototype.hasOwnProperty,NNe=Object.prototype.propertyIsEnumerable,HU=(t,e,r)=>e in t?MNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jm=(t,e)=>{for(var r in e||(e={}))DNe.call(e,r)&&HU(t,r,e[r]);if(zU)for(var r of zU(e))NNe.call(e,r)&&HU(t,r,e[r]);return t},eS=(t,e)=>RNe(t,ONe(e));class BNe extends HRe{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new kNe,this.events=new ba.EventEmitter,this.name=LOe,this.version=FOe,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=nf,this.subscribeTimeout=at.toMiliseconds(at.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=vI(i),o={topic:n,relay:s,transportType:i==null?void 0:i.transportType};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s,i);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,o)=>{const a=new at.Watch;a.start(i);const c=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(c),a.stop(i),s(!0)),a.elapsed(i)>=jOe&&(clearInterval(c),a.stop(i),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=so(r,this.name),this.clientId=""}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=vI(n);await this.rpcUnsubscribe(e,r,i);const s=rn("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r,n){var i;(n==null?void 0:n.transportType)===vn.relay&&await this.restartToComplete();const s={method:cb(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const o=(i=n==null?void 0:n.internal)==null?void 0:i.throwOnFailedPublish;try{const a=Bf(e+this.clientId);if((n==null?void 0:n.transportType)===vn.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch(l=>this.logger.warn(l))},at.toMiliseconds(at.ONE_SECOND)),a;const c=await zv(this.relayer.request(s).catch(l=>this.logger.warn(l)),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!c&&o)throw new Error(`Subscribing to ${e} failed, please try again`);return c?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ys.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:cb(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await zv(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(Ys.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,n={method:cb(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await zv(this.relayer.request(n).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(Ys.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:cb(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,eS(jm({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,jm({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,jm({},r)),this.topicMap.set(r.topic,e),this.events.emit(El.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(El.deleted,eS(jm({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(El.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);rf(r)&&this.onBatchSubscribe(r.map((n,i)=>eS(jm({},e[i]),{id:n})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on($y.pulse,async()=>{await this.checkPending()}),this.events.on(El.created,async e=>{const r=El.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(El.deleted,async e=>{const r=El.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var LNe=Object.defineProperty,GU=Object.getOwnPropertySymbols,FNe=Object.prototype.hasOwnProperty,jNe=Object.prototype.propertyIsEnumerable,WU=(t,e,r)=>e in t?LNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,KU=(t,e)=>{for(var r in e||(e={}))FNe.call(e,r)&&WU(t,r,e[r]);if(GU)for(var r of GU(e))jNe.call(e,r)&&WU(t,r,e[r]);return t};class UNe extends VRe{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new ba.EventEmitter,this.name=ROe,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=at.toMiliseconds(at.THIRTY_SECONDS+at.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||B0().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(c,l)=>{const f=()=>{l(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(Na.disconnect,f);const u=await o;this.provider.off(Na.disconnect,f),c(u)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(a4())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Ys.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(Ys.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Na.payload,this.onPayloadHandler),this.provider.on(Na.connect,this.onConnectHandler),this.provider.on(Na.disconnect,this.onDisconnectHandler),this.provider.on(Na.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?so(e.logger,this.name):qx(IE({level:e.logger||MOe})),this.messages=new TNe(this.logger,e.core),this.subscriber=new BNe(this,this.logger),this.publisher=new PNe(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||lte,this.projectId=e.projectId,this.bundleId=YPe(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return Lo(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:vn.relay})}async subscribe(e,r){var n,i,s;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();const o=typeof((n=r==null?void 0:r.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",c;const l=f=>{f.topic===e&&(this.subscriber.off(El.created,l),c())};return await Promise.all([new Promise(f=>{c=f,this.subscriber.on(El.created,l)}),new Promise(async(f,u)=>{a=await this.subscriber.subscribe(e,KU({internal:{throwOnFailedPublish:o}},r)).catch(p=>{o&&u(p)})||a,f()})]),a}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await zv(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off(Na.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(Na.disconnect,i),await zv(this.provider.connect(),at.toMiliseconds(at.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await bU())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((n,i)=>n.publishedAt-i.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const n of r)try{await this.onMessageEvent(n)}catch(i){this.logger.warn(i)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:n}=e;if(!r.sessionExists){const i=Ei(at.FIVE_MINUTES),s={topic:n,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(Ys.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,n,i,s;if(a4())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new dc(new mOe(XPe({sdkVersion:mI,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),HM(e)){if(!e.method.endsWith(OOe))return;const r=e.params,{topic:n,message:i,publishedAt:s,attestation:o}=r.data,a={topic:n,message:i,publishedAt:s,transportType:vn.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(KU({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else kE(e)&&this.events.emit(Ys.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Ys.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=TE(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Na.payload,this.onPayloadHandler),this.provider.off(Na.connect,this.onConnectHandler),this.provider.off(Na.disconnect,this.onDisconnectHandler),this.provider.off(Na.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await bU();kMe(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Ys.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},at.toMiliseconds(DOe))))}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var $Ne=Object.defineProperty,YU=Object.getOwnPropertySymbols,qNe=Object.prototype.hasOwnProperty,VNe=Object.prototype.propertyIsEnumerable,QU=(t,e,r)=>e in t?$Ne(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,JU=(t,e)=>{for(var r in e||(e={}))qNe.call(e,r)&&QU(t,r,e[r]);if(YU)for(var r of YU(e))VNe.call(e,r)&&QU(t,r,e[r]);return t};class e1 extends zRe{constructor(e,r,n,i=nf,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=NOe,this.cached=[],this.initialized=!1,this.storagePrefix=nf,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!To(o)?this.map.set(this.getKey(o),o):aMe(o)?this.map.set(o.id,o):cMe(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>wOe(a[c],o[c]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=JU(JU({},this.getData(o)),a);this.map.set(o,c),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=so(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=it("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class zNe{constructor(e,r){this.core=e,this.logger=r,this.name=UOe,this.version=$Oe,this.events=new yM,this.initialized=!1,this.storagePrefix=nf,this.ignoredPayloadTypes=[lu],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=pI(),s=await this.core.crypto.setSymKey(i),o=Ei(at.FIVE_MINUTES),a={protocol:cte},c={topic:s,expiry:o,relay:a,active:!1,methods:n==null?void 0:n.methods},l=hU({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:n==null?void 0:n.methods});return this.events.emit(x0.create,c),this.core.expirer.set(s,o),await this.pairings.set(s,c),await this.core.relayer.subscribe(s,{transportType:n==null?void 0:n.transportType}),{topic:s,uri:l}},this.pair=async n=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:n==null?void 0:n.uri,trace:[bl.pairing_started]}});this.isValidPair(n,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:c,methods:l}=dU(n.uri);i.props.properties.topic=s,i.addTrace(bl.pairing_uri_validation_success),i.addTrace(bl.pairing_uri_not_expired);let f;if(this.pairings.keys.includes(s)){if(f=this.pairings.get(s),i.addTrace(bl.existing_pairing),f.active)throw i.setError(Tf.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(bl.pairing_not_expired)}const u=c||Ei(at.FIVE_MINUTES),p={topic:s,relay:a,expiry:u,active:!1,methods:l};this.core.expirer.set(s,u),await this.pairings.set(s,p),i.addTrace(bl.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(x0.create,p),i.addTrace(bl.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(bl.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(Tf.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(g){throw i.setError(Tf.subscribe_pairing_topic_failure),g}return i.addTrace(bl.subscribe_pairing_topic_success),p},this.activate=async({topic:n})=>{this.isInitialized();const i=Ei(at.THIRTY_DAYS);this.core.expirer.set(n,i),await this.pairings.update(n,{active:!0,expiry:i})},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=y0();this.events.once(Er("pairing_ping",s),({error:l})=>{l?c(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",rn("USER_DISCONNECTED")),await this.deletePairing(i))},this.formatUriFromPairing=n=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=n,c=this.core.crypto.keychain.get(i);return hU({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:c,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(n,i,s)=>{const o=Ud(i,s),a=await this.core.crypto.encode(n,o),c=Lm[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,c),o.id},this.sendResult=async(n,i,s)=>{const o=TE(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=Lm[c.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=PE(n,s),a=await this.core.crypto.encode(i,o),c=await this.core.history.get(i,n),l=Lm[c.request.method]?Lm[c.request.method].res:Lm.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,rn("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ud(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(x0.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{xl(i)?this.events.emit(Er("pairing_ping",s),{}):Wa(i)&&this.events.emit(Er("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(x0.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=rn("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(rn("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=(n,i)=>{var s;if(!xo(n)){const{message:a}=it("MISSING_OR_INVALID",`pair() params: ${n}`);throw i.setError(Tf.malformed_pairing_uri),new Error(a)}if(!oMe(n.uri)){const{message:a}=it("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw i.setError(Tf.malformed_pairing_uri),new Error(a)}const o=dU(n==null?void 0:n.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=it("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(Tf.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=it("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(Tf.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&at.toMiliseconds(o==null?void 0:o.expiryTimestamp){if(!xo(n)){const{message:s}=it("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!xo(n)){const{message:s}=it("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ii(n,!1)){const{message:i}=it("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=it("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ud(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=it("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=so(r,this.name),this.pairings=new e1(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Lo(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Ys.message,async e=>{const{topic:r,message:n,transportType:i}=e;if(!this.pairings.keys.includes(r)||i===vn.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const s=await this.core.crypto.decode(r,n);try{HM(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):kE(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(ja.expired,async e=>{const{topic:r}=Lee(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(x0.expire,{topic:r}))})}}class HNe extends URe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new ba.EventEmitter,this.name=qOe,this.version=VOe,this.cached=[],this.initialized=!1,this.storagePrefix=nf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:Ei(at.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Sc.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Wa(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(Sc.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Sc.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=so(r,this.name)}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:Ud(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Sc.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Sc.created,e=>{const r=Sc.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sc.updated,e=>{const r=Sc.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Sc.deleted,e=>{const r=Sc.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on($y.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{at.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Sc.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class GNe extends GRe{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new ba.EventEmitter,this.name=zOe,this.version=HOe,this.cached=[],this.initialized=!1,this.storagePrefix=nf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(ja.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(ja.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=so(r,this.name)}get context(){return Lo(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return eke(e);if(typeof e=="number")return tke(e);const{message:r}=it("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(ja.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=it("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:n}=it("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;at.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(ja.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on($y.pulse,()=>this.checkExpirations()),this.events.on(ja.created,e=>{const r=ja.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ja.expired,e=>{const r=ja.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(ja.deleted,e=>{const r=ja.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WNe extends WRe{constructor(e,r,n){super(e,r,n),this.core=e,this.logger=r,this.store=n,this.name=GOe,this.verifyUrlV3=KOe,this.storagePrefix=nf,this.version=ate,this.init=async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&at.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt){if(!Lx()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const l=kx(),f=this.startAbortTimer(at.ONE_SECOND*5),u=await new Promise((p,g)=>{const y=()=>{window.removeEventListener("message",I),l.body.removeChild(b),g("attestation aborted")};this.abortController.signal.addEventListener("abort",y);const b=l.createElement("iframe");b.src=c,b.style.display="none",b.addEventListener("error",y,{signal:this.abortController.signal});const I=C=>{if(C.data&&typeof C.data=="string")try{const S=JSON.parse(C.data);if(S.type==="verify_attestation"){if(dI(S.attestation).payload.id!==o)return;clearInterval(f),l.body.removeChild(b),this.abortController.signal.removeEventListener("abort",y),window.removeEventListener("message",I),p(S.attestation===null?"":S.attestation)}}catch(S){this.logger.warn(S)}};l.body.appendChild(b),window.addEventListener("message",I,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",u),u}catch(l){this.logger.warn(l)}return""},this.resolve=async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(dI(s).payload.id!==a)return;const l=await this.isValidJwtAttestation(s);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,c)},this.fetchAttestation=async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(at.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=i=>{let s=i||Fb;return YOe.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Fb}`),s=Fb),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(at.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}},this.persistPublicKey=async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i},this.validateAttestation=(i,s)=>{const o=$ke(i,s.publicKey),a={hasExpired:at.toMiliseconds(o.exp)this.abortController.abort(),at.toMiliseconds(e))}}class KNe extends KRe{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=QOe,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=n,c=`${JOe}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})},this.logger=so(r,this.context)}}var YNe=Object.defineProperty,ZU=Object.getOwnPropertySymbols,QNe=Object.prototype.hasOwnProperty,JNe=Object.prototype.propertyIsEnumerable,XU=(t,e,r)=>e in t?YNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Um=(t,e)=>{for(var r in e||(e={}))QNe.call(e,r)&&XU(t,r,e[r]);if(ZU)for(var r of ZU(e))JNe.call(e,r)&&XU(t,r,e[r]);return t};class ZNe extends YRe{constructor(e,r,n=!0){super(e,r,n),this.core=e,this.logger=r,this.context=XOe,this.storagePrefix=nf,this.storageVersion=ZOe,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!FM())try{const i={eventId:eU(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Oee(this.core.relayer.protocol,this.core.relayer.version,mI)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}},this.createEvent=i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:c}}=i,l=eU(),f=this.core.projectId||"",u=Date.now(),p=Um({eventId:l,timestamp:u,props:{event:s,type:o,properties:{topic:a,trace:c}},bundleId:f,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,p),this.shouldPersist=!0),p},this.getEvent=i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return Um(Um({},a),this.setMethods(a.eventId))},this.deleteEvent=i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on($y.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{at.fromMiliseconds(Date.now())-at.fromMiliseconds(i.timestamp)>eDe&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})},this.setMethods=i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)}),this.addTrace=(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)},this.setError=(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,Um(Um({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${tDe}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${mI}${s}`,{method:"POST",body:JSON.stringify(i)})},this.getAppDomain=()=>Ree().url,this.logger=so(r,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var XNe=Object.defineProperty,e$=Object.getOwnPropertySymbols,eBe=Object.prototype.hasOwnProperty,tBe=Object.prototype.propertyIsEnumerable,t$=(t,e,r)=>e in t?XNe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,r$=(t,e)=>{for(var r in e||(e={}))eBe.call(e,r)&&t$(t,r,e[r]);if(e$)for(var r of e$(e))tBe.call(e,r)&&t$(t,r,e[r]);return t};let rBe=class xte extends jRe{constructor(e){var r;super(e),this.protocol=ote,this.version=ate,this.name=GM,this.events=new ba.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:c})=>{if(!o||!a)return;const l={topic:o,message:a,publishedAt:Date.now(),transportType:vn.link_mode};this.relayer.onLinkMessageEvent(l,{sessionExists:c})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||lte,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=IE({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:xOe.logger}),{logger:i,chunkLoggerController:s}=FRe({opts:n,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=so(i,this.name),this.heartbeat=new DMe,this.crypto=new INe(this,this.logger,e==null?void 0:e.keychain),this.history=new HNe(this,this.logger),this.expirer=new GNe(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new fRe(r$(r$({},EOe),e==null?void 0:e.storageOptions)),this.relayer=new UNe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new zNe(this,this.logger),this.verify=new WNe(this,this.logger,this.storage),this.echoClient=new KNe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ZNe(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new xte(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(BOe,n),r}get context(){return Lo(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(LU,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(LU)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}};const nBe=rBe,Ete="wc",Cte=2,Ate="client",WM=`${Ete}@${Cte}:${Ate}:`,tS={name:Ate,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},n$="WALLETCONNECT_DEEPLINK_CHOICE",iBe="proposal",Ste="Proposal expired",sBe="session",$1=at.SEVEN_DAYS,oBe="engine",ki={wc_sessionPropose:{req:{ttl:at.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1104},res:{ttl:at.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1106},res:{ttl:at.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:at.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:at.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1112},res:{ttl:at.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:at.ONE_DAY,prompt:!1,tag:1114},res:{ttl:at.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:at.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:at.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:at.FIVE_MINUTES,prompt:!1,tag:1119}}},rS={min:at.FIVE_MINUTES,max:at.SEVEN_DAYS},vl={idle:"IDLE",active:"ACTIVE"},aBe="request",cBe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],lBe="wc",fBe="auth",uBe="authKeys",dBe="pairingTopics",hBe="requests",RE=`${lBe}@${1.5}:${fBe}:`,L3=`${RE}:PUB_KEY`;var pBe=Object.defineProperty,vBe=Object.defineProperties,gBe=Object.getOwnPropertyDescriptors,i$=Object.getOwnPropertySymbols,yBe=Object.prototype.hasOwnProperty,mBe=Object.prototype.propertyIsEnumerable,s$=(t,e,r)=>e in t?pBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vn=(t,e)=>{for(var r in e||(e={}))yBe.call(e,r)&&s$(t,r,e[r]);if(i$)for(var r of i$(e))mBe.call(e,r)&&s$(t,r,e[r]);return t},Ic=(t,e)=>vBe(t,gBe(e));class bBe extends JRe{constructor(e){super(e),this.name=oBe,this.events=new yM,this.initialized=!1,this.requestQueue={state:vl.idle,queue:[]},this.sessionRequestQueue={state:vl.idle,queue:[]},this.requestQueueDelay=at.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(ki)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},at.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Ic(Vn({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:c}=n;let l=i,f,u=!1;try{l&&(u=this.client.core.pairing.pairings.get(l).active)}catch(L){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),L}if(!l||!u){const{topic:L,uri:F}=await this.client.core.pairing.create();l=L,f=F}if(!l){const{message:L}=it("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(L)}const p=await this.client.core.crypto.generateKeyPair(),g=ki.wc_sessionPropose.req.ttl||at.FIVE_MINUTES,y=Ei(g),b=Vn({requiredNamespaces:s,optionalNamespaces:o,relays:c??[{protocol:cte}],proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:y,pairingTopic:l},a&&{sessionProperties:a}),{reject:I,resolve:C,done:S}=y0(g,Ste);this.events.once(Er("session_connect"),async({error:L,session:F})=>{if(L)I(L);else if(F){F.self.publicKey=p;const z=Ic(Vn({},F),{pairingTopic:b.pairingTopic,requiredNamespaces:b.requiredNamespaces,optionalNamespaces:b.optionalNamespaces,transportType:vn.relay});await this.client.session.set(F.topic,z),await this.setExpiry(F.topic,F.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:F.peer.metadata}),this.cleanupDuplicatePairings(z),C(z)}});const O=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:b,throwOnFailedPublish:!0});return await this.setProposal(O,Vn({id:O},b)),{uri:f,approval:S}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{var n,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=r==null?void 0:r.id)==null?void 0:n.toString(),trace:[_c.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch($){throw o.setError(c0.no_internet_connection),$}try{await this.isValidProposalId(r==null?void 0:r.id)}catch($){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(c0.proposal_not_found),$}try{await this.isValidApprove(r)}catch($){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(c0.session_approve_namespace_validation_failure),$}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:f,sessionConfig:u}=r,p=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:g,proposer:y,requiredNamespaces:b,optionalNamespaces:I}=p;let C=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:g});C||(C=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:_c.session_approve_started,properties:{topic:g,trace:[_c.session_approve_started,_c.session_namespaces_validation_success]}}));const S=await this.client.core.crypto.generateKeyPair(),O=y.publicKey,L=await this.client.core.crypto.generateSharedKey(S,O),F=Vn(Vn({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:S,metadata:this.client.metadata},expiry:Ei($1)},f&&{sessionProperties:f}),u&&{sessionConfig:u}),z=vn.relay;C.addTrace(_c.subscribing_session_topic);try{await this.client.core.relayer.subscribe(L,{transportType:z})}catch($){throw C.setError(c0.subscribe_session_topic_failure),$}C.addTrace(_c.subscribe_session_topic_success);const _=Ic(Vn({},F),{topic:L,requiredNamespaces:b,optionalNamespaces:I,pairingTopic:g,acknowledged:!1,self:F.controller,peer:{publicKey:y.publicKey,metadata:y.metadata},controller:S,transportType:vn.relay});await this.client.session.set(L,_),C.addTrace(_c.store_session);try{C.addTrace(_c.publishing_session_settle),await this.sendRequest({topic:L,method:"wc_sessionSettle",params:F,throwOnFailedPublish:!0}).catch($=>{throw C==null||C.setError(c0.session_settle_publish_failure),$}),C.addTrace(_c.session_settle_publish_success),C.addTrace(_c.publishing_session_approve),await this.sendResult({id:a,topic:g,result:{relay:{protocol:c??"irn"},responderPublicKey:S},throwOnFailedPublish:!0}).catch($=>{throw C==null||C.setError(c0.session_approve_publish_failure),$}),C.addTrace(_c.session_approve_publish_success)}catch($){throw this.client.logger.error($),this.client.session.delete(L,rn("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(L),$}return this.client.core.eventClient.deleteEvent({eventId:C.eventId}),await this.client.core.pairing.updateMetadata({topic:g,metadata:y.metadata}),await this.client.proposal.delete(a,rn("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:g}),await this.setExpiry(L,Ei($1)),{topic:L,acknowledged:()=>Promise.resolve(this.client.session.get(L))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&(await this.sendError({id:n,topic:s,error:i,rpcOpts:ki.wc_sessionPropose.reject}),await this.client.proposal.delete(n,rn("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:n,namespaces:i}=r,{done:s,resolve:o,reject:a}=y0(),c=dd(),l=B0().toString(),f=this.client.session.get(n).namespaces;return this.events.once(Er("session_update",c),({error:u})=>{u?a(u):o()}),await this.client.session.update(n,{namespaces:i}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(u=>{this.client.logger.error(u),this.client.session.update(n,{namespaces:f}),a(u)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:n}=r,i=dd(),{done:s,resolve:o,reject:a}=y0();return this.events.once(Er("session_extend",i),({error:c})=>{c?a(c):o()}),await this.setExpiry(n,Ei($1)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:s,expiry:o=ki.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===vn.relay&&await this.confirmOnlineStateOrThrow();const c=dd(),l=B0().toString(),{done:f,resolve:u,reject:p}=y0(o,"Request expired. Please try again.");this.events.once(Er("session_request",c),({error:y,result:b})=>{y?p(y):u(b)});const g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return g?(await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Ic(Vn({},i),{expiryTimestamp:Ei(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),await f()):await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:s,method:"wc_sessionRequest",params:{request:Ic(Vn({},i),{expiryTimestamp:Ei(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(b=>p(b)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:c}),y()}),new Promise(async y=>{var b;if(!((b=a.sessionConfig)!=null&&b.disableDeepLink)){const I=await ike(this.client.core.storage,n$);await rke({id:c,topic:s,wcDeepLink:I})}y()}),f()]).then(y=>y[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i,o=this.client.session.get(n);o.transportType===vn.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);xl(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0,appLink:a}):Wa(i)&&await this.sendError({id:s,topic:n,error:i.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=dd(),s=B0().toString(),{done:o,resolve:a,reject:c}=y0();this.events.once(Er("session_ping",i),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,o=B0().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:rn("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=it("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>iMe(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,n)=>{var i;this.isInitialized(),this.isValidAuthenticate(r);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?vn.link_mode:vn.relay;o===vn.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:f,nonce:u,type:p,exp:g,nbf:y,methods:b=[],expiry:I}=r,C=[...r.resources||[]],{topic:S,uri:O}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:S,uri:O}});const L=await this.client.core.crypto.generateKeyPair(),F=D3(L);if(await Promise.all([this.client.auth.authKeys.set(L3,{responseTopic:F,publicKey:L}),this.client.auth.pairingTopics.set(F,{topic:F,pairingTopic:S})]),await this.client.core.relayer.subscribe(F,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${S}`),b.length>0){const{namespace:E}=Vv(a[0]);let x=Ske(E,"request",b);O3(C)&&(x=Ike(x,C.pop())),C.push(x)}const z=I&&I>ki.wc_sessionAuthenticate.req.ttl?I:ki.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:p??"caip122",chains:a,statement:c,aud:l,domain:f,version:"1",nonce:u,iat:new Date().toISOString(),exp:g,nbf:y,resources:C},requester:{publicKey:L,metadata:this.client.metadata},expiryTimestamp:Ei(z)},$={eip155:{chains:a,methods:[...new Set(["personal_sign",...b])],events:["chainChanged","accountsChanged"]}},ie={requiredNamespaces:{},optionalNamespaces:$,relays:[{protocol:"irn"}],pairingTopic:S,proposer:{publicKey:L,metadata:this.client.metadata},expiryTimestamp:Ei(ki.wc_sessionPropose.req.ttl)},{done:ce,resolve:K,reject:P}=y0(z,"Request expired"),M=async({error:E,session:x})=>{if(this.events.off(Er("session_request",m),v),E)P(E);else if(x){x.self.publicKey=L,await this.client.session.set(x.topic,x),await this.setExpiry(x.topic,x.expiry),S&&await this.client.core.pairing.updateMetadata({topic:S,metadata:x.peer.metadata});const w=this.client.session.get(x.topic);await this.deleteProposal(R),K({session:w})}},v=async E=>{var x,w,T;if(await this.deletePendingAuthRequest(m,{message:"fulfilled",code:0}),E.error){const Z=rn("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return E.error.code===Z.code?void 0:(this.events.off(Er("session_connect"),M),P(E.error.message))}await this.deleteProposal(R),this.events.off(Er("session_connect"),M);const{cacaos:k,responder:H}=E.result,oe=[],j=[];for(const Z of k){await nU({cacao:Z,projectId:this.client.core.projectId})||(this.client.logger.error(Z,"Signature verification failed"),P(rn("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:ee}=Z,N=O3(ee.resources),te=[hI(ee.iss)],fe=c4(ee.iss);if(N){const Ee=iU(N),_e=sU(N);oe.push(...Ee),te.push(..._e)}for(const Ee of te)j.push(`${Ee}:${fe}`)}const X=await this.client.core.crypto.generateSharedKey(L,H.publicKey);let G;oe.length>0&&(G={topic:X,acknowledged:!0,self:{publicKey:L,metadata:this.client.metadata},peer:H,controller:H.publicKey,expiry:Ei($1),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:S,namespaces:pU([...new Set(oe)],[...new Set(j)]),transportType:o},await this.client.core.relayer.subscribe(X,{transportType:o}),await this.client.session.set(X,G),S&&await this.client.core.pairing.updateMetadata({topic:S,metadata:H.metadata}),G=this.client.session.get(X)),(x=this.client.metadata.redirect)!=null&&x.linkMode&&(w=H.metadata.redirect)!=null&&w.linkMode&&(T=H.metadata.redirect)!=null&&T.universal&&n&&(this.client.core.addLinkModeSupportedApp(H.metadata.redirect.universal),this.client.session.update(X,{transportType:vn.link_mode})),K({auths:k,session:G})},m=dd(),R=dd();this.events.once(Er("session_connect"),M),this.events.once(Er("session_request",m),v);let B;try{if(s){const E=Ud("wc_sessionAuthenticate",_,m);this.client.core.history.set(S,E);const x=await this.client.core.crypto.encode("",E,{type:Ux,encoding:Nm});B=k6(n,S,x)}else await Promise.all([this.sendRequest({topic:S,method:"wc_sessionAuthenticate",params:_,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:m}),this.sendRequest({topic:S,method:"wc_sessionPropose",params:ie,expiry:ki.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:R})])}catch(E){throw this.events.off(Er("session_connect"),M),this.events.off(Er("session_request",m),v),E}return await this.setProposal(R,Vn({id:R},ie)),await this.setAuthRequest(m,{request:Ic(Vn({},_),{verifyContext:{}}),pairingTopic:S,transportType:o}),{uri:B??O,response:ce}},this.approveSessionAuthenticate=async r=>{const{id:n,auths:i}=r,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[l0.authenticated_session_approve_started]}});try{this.isInitialized()}catch(I){throw s.setError(Fm.no_internet_connection),I}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(Fm.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const a=o.transportType||vn.relay;a===vn.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=D3(c),u={type:lu,receiverPublicKey:c,senderPublicKey:l},p=[],g=[];for(const I of i){if(!await nU({cacao:I,projectId:this.client.core.projectId})){s.setError(Fm.invalid_cacao);const F=rn("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:F,encodeOpts:u}),new Error(F.message)}s.addTrace(l0.cacaos_verified);const{p:C}=I,S=O3(C.resources),O=[hI(C.iss)],L=c4(C.iss);if(S){const F=iU(S),z=sU(S);p.push(...F),O.push(...z)}for(const F of O)g.push(`${F}:${L}`)}const y=await this.client.core.crypto.generateSharedKey(l,c);s.addTrace(l0.create_authenticated_session_topic);let b;if((p==null?void 0:p.length)>0){b={topic:y,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Ei($1),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:pU([...new Set(p)],[...new Set(g)]),transportType:a},s.addTrace(l0.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(y,{transportType:a})}catch(I){throw s.setError(Fm.subscribe_authenticated_session_topic_failure),I}s.addTrace(l0.subscribe_authenticated_session_topic_success),await this.client.session.set(y,b),s.addTrace(l0.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(l0.publishing_authenticated_session_approve);try{await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(I){throw s.setError(Fm.authenticated_session_approve_publish_failure),I}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:b}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===vn.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=D3(o),l={type:lu,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:n,topic:c,error:i,encodeOpts:l,rpcOpts:ki.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,rn("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return jee(n,i)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{var n;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:c}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,rn("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(n$).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===i&&this.deletePendingSessionRequest(l.id,rn("USER_DISCONNECTED"))}),i===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=vl.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})},this.deleteProposal=async(r,n)=>{if(n)try{const i=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(c0.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,rn("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=vl.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,n,i=!1)=>{await Promise.all([this.client.auth.requests.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,n),await this.client.session.update(r,{expiry:n}))},this.setProposal=async(r,n)=>{this.client.core.expirer.set(r,Ei(ki.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,n)},this.setAuthRequest=async(r,n)=>{const{request:i,pairingTopic:s,transportType:o=vn.relay}=n;this.client.core.expirer.set(r,i.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:r,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||Ei(ki.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,a),await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:f}=r,u=Ud(i,s,c);let p;const g=!!f;try{const I=g?Nm:jd;p=await this.client.core.crypto.encode(n,u,{encoding:I})}catch(I){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),I}let y;if(cBe.includes(i)){const I=Bf(JSON.stringify(u)),C=Bf(p);y=await this.client.core.verify.register({id:C,decryptedId:I})}const b=ki[i].req;if(b.attestation=y,o&&(b.ttl=o),a&&(b.id=a),this.client.core.history.set(n,u),g){const I=k6(f,n,p);await global.Linking.openURL(I,this.client.name)}else{const I=ki[i].req;o&&(I.ttl=o),a&&(I.id=a),l?(I.internal=Ic(Vn({},I.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,p,I)):this.client.core.relayer.publish(n,p,I).catch(C=>this.client.logger.error(C))}return u.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=r,l=TE(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?Nm:jd;f=await this.client.core.crypto.encode(i,l,Ic(Vn({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),g}let p;try{p=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),g}if(u){const g=k6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=ki[p.request.method].res;o?(g.internal=Ic(Vn({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,g)):this.client.core.relayer.publish(i,f,g).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(l)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:c}=r,l=PE(n,s);let f;const u=c&&typeof(global==null?void 0:global.Linking)<"u";try{const g=u?Nm:jd;f=await this.client.core.crypto.encode(i,l,Ic(Vn({},o||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),g}let p;try{p=await this.client.core.history.get(i,n)}catch(g){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),g}if(u){const g=k6(c,i,f);await global.Linking.openURL(g,this.client.name)}else{const g=a||ki[p.request.method].res;this.client.core.relayer.publish(i,f,g)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;ud(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ud(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===vl.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=vl.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=vl.idle},this.processRequest=async r=>{const{topic:n,payload:i,attestation:s,transportType:o,encryptedId:a}=r,c=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,i);case"wc_sessionPing":return await this.onSessionPingRequest(n,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i,transportType:s}=r,o=(await this.client.core.history.get(n,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=it("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:n,payload:i,attestation:s,encryptedId:o}=r,{params:a,id:c}=i;try{const l=this.client.core.eventClient.getEvent({topic:n});this.isValidConnect(Vn({},i.params));const f=a.expiryTimestamp||Ei(ki.wc_sessionPropose.req.ttl),u=Vn({id:c,pairingTopic:n,expiryTimestamp:f},a);await this.setProposal(c,u);const p=await this.getVerifyContext({attestationId:s,hash:Bf(JSON.stringify(i)),encryptedId:o,metadata:u.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(Tf.proposal_listener_not_found)),l==null||l.addTrace(bl.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:u,verifyContext:p})}catch(l){await this.sendError({id:c,topic:n,error:l,rpcOpts:ki.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(r,n,i)=>{const{id:s}=n;if(xl(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const f=await this.client.core.crypto.generateSharedKey(c,l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const u=await this.client.core.relayer.subscribe(f,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:u}),await this.client.core.pairing.activate({topic:r})}else if(Wa(n)){await this.client.proposal.delete(s,rn("USER_DISCONNECTED"));const o=Er("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(Er("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:f,sessionConfig:u}=n.params,p=Ic(Vn(Vn({topic:r,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},f&&{sessionProperties:f}),u&&{sessionConfig:u}),{transportType:vn.relay}),g=Er("session_connect");if(this.events.listenerCount(g)===0)throw new Error(`emitting ${g} without any listeners 997`);this.events.emit(Er("session_connect"),{session:p}),await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;xl(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Er("session_approve",i),{})):Wa(n)&&(await this.client.session.delete(r,rn("USER_DISCONNECTED")),this.events.emit(Er("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const o=`${r}_session_update`,a=Bm.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:rn("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Vn({topic:r},i));try{Bm.set(o,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(c){throw Bm.delete(o),c}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=Er("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Er("session_update",i),{}):Wa(n)&&this.events.emit(Er("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Ei($1)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=Er("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Er("session_extend",i),{}):Wa(n)&&this.events.emit(Er("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=Er("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{xl(n)?this.events.emit(Er("session_ping",i),{}):Wa(n)&&this.events.emit(Er("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Ys.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:rn("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var n,i,s;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:f}=r,{id:u,params:p}=a;try{await this.isValidRequest(Vn({topic:o},p));const g=this.client.session.get(o),y=await this.getVerifyContext({attestationId:c,hash:Bf(JSON.stringify(Ud("wc_sessionRequest",p,u))),encryptedId:l,metadata:g.peer.metadata,transportType:f}),b={id:u,topic:o,params:p,verifyContext:y};await this.setPendingSessionRequest(b),f===vn.link_mode&&(n=g.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((i=g.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(b):(this.addSessionRequestToSessionRequestQueue(b),this.processSessionRequestQueue())}catch(g){await this.sendError({id:u,topic:o,error:g}),this.client.logger.error(g)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=Er("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);xl(n)?this.events.emit(Er("session_request",i),{result:n.result}):Wa(n)&&this.events.emit(Er("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const o=`${r}_session_event_${s.event.name}`,a=Bm.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Vn({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),Bm.set(o,i)}catch(o){await this.sendError({id:i,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),xl(n)?this.events.emit(Er("session_request",i),{result:n.result}):Wa(n)&&this.events.emit(Er("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async r=>{var n;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:c}=r;try{const{requester:l,authPayload:f,expiryTimestamp:u}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Bf(JSON.stringify(s)),encryptedId:a,metadata:l.metadata,transportType:c}),g={requester:l,pairingTopic:i,id:s.id,authPayload:f,verifyContext:p,expiryTimestamp:u};await this.setAuthRequest(s.id,{request:g,pairingTopic:i,transportType:c}),c===vn.link_mode&&(n=l.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:p})}catch(l){this.client.logger.error(l);const f=s.params.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,c),g={type:lu,receiverPublicKey:f,senderPublicKey:u};await this.sendError({id:s.id,topic:i,error:l,encodeOpts:g,rpcOpts:ki.wc_sessionAuthenticate.autoReject,appLink:p})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=vl.idle,this.processSessionRequestQueue()},at.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=Er("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(Er("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===vl.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=vl.active,this.emitSessionRequest(r)}catch(n){this.client.logger.error(n)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest({topic:r.topic,payload:Ud("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id)})},this.isValidConnect=async r=>{if(!xo(r)){const{message:c}=it("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(c)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(To(n)||await this.isValidPairingTopic(n),!gMe(a)){const{message:c}=it("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(c)}!To(i)&&Rw(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!To(s)&&Rw(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),To(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=vMe(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!xo(r))throw new Error(it("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const a=this.client.proposal.get(n),c=K9(i,"approve()");if(c)throw new Error(c.message);const l=yU(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!ii(s,!0)){const{message:f}=it("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}To(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!xo(r)){const{message:s}=it("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!mMe(i)){const{message:s}=it("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!xo(r)){const{message:l}=it("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!Wee(n)){const{message:l}=it("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=lMe(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=K9(s,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(ud(o)){const{message:l}=it("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!xo(r)){const{message:c}=it("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(c)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=K9(i,"update()");if(o)throw new Error(o.message);const a=yU(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!xo(r)){const{message:i}=it("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!xo(r)){const{message:c}=it("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(c)}const{topic:n,request:i,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:a}=this.client.session.get(n);if(!gU(a,s)){const{message:c}=it("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(c)}if(!bMe(i)){const{message:c}=it("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(c)}if(!EMe(a,s,i.method)){const{message:c}=it("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(c)}if(o&&!_Me(o,rS)){const{message:c}=it("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${rS.min} and ${rS.max}`);throw new Error(c)}},this.isValidRespond=async r=>{var n;if(!xo(r)){const{message:o}=it("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(o){throw(n=r==null?void 0:r.response)!=null&&n.id&&this.cleanupAfterResponse(r),o}if(!wMe(s)){const{message:o}=it("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!xo(r)){const{message:i}=it("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!xo(r)){const{message:a}=it("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!gU(o,s)){const{message:a}=it("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!xMe(i)){const{message:a}=it("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!CMe(o,s,i.name)){const{message:a}=it("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!xo(r)){const{message:i}=it("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:o}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!ii(i,!1))throw new Error("uri is required parameter");if(!ii(s,!1))throw new Error("domain is required parameter");if(!ii(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(c=>Vv(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Vv(n[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:n,hash:i,encryptedId:s,metadata:o,transportType:a}=r,c={verified:{verifyUrl:o.verifyUrl||Fb,validation:"UNKNOWN",origin:o.url||""}};try{if(a===vn.link_mode){const f=this.getAppLinkIfEnabled(o,a);return c.verified.validation=f&&new URL(f).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:n,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!ii(i,!1)){const{message:s}=it("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=it("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}},this.isLinkModeEnabled=(r,n)=>{var i,s,o,a,c,l,f,u,p;return!r||n!==vn.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((f=r==null?void 0:r.redirect)==null?void 0:f.universal)!==void 0&&((u=r==null?void 0:r.redirect)==null?void 0:u.universal)!==""&&((p=r==null?void 0:r.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,n)=>{var i;return this.isLinkModeEnabled(r,n)?(i=r==null?void 0:r.redirect)==null?void 0:i.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const n=Xj(r,"topic")||"",i=decodeURIComponent(Xj(r,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:vn.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:i,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(FM()||jy()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const n=global==null?void 0:global.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await n.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=it("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ys.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:n,attestation:i,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(L3)?this.client.auth.authKeys.get(L3):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(r,n,{receiverPublicKey:o,encoding:s===vn.link_mode?Nm:jd});try{HM(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:i,transportType:s,encryptedId:Bf(n)})):kE(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(ja.expired,async e=>{const{topic:r,id:n}=Lee(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,it("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,it("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(x0.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(x0.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ii(e,!1)){const{message:r}=it("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=it("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(ud(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=it("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!ii(e,!1)){const{message:r}=it("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=it("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(ud(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=it("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=it("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ii(e,!1)){const{message:r}=it("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=it("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!yMe(e)){const{message:r}=it("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=it("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(ud(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=it("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class wBe extends e1{constructor(e,r){super(e,r,iBe,WM),this.core=e,this.logger=r}}let xBe=class extends e1{constructor(e,r){super(e,r,sBe,WM),this.core=e,this.logger=r}};class EBe extends e1{constructor(e,r){super(e,r,aBe,WM,n=>n.id),this.core=e,this.logger=r}}class CBe extends e1{constructor(e,r){super(e,r,uBe,RE,()=>L3),this.core=e,this.logger=r}}class ABe extends e1{constructor(e,r){super(e,r,dBe,RE),this.core=e,this.logger=r}}class SBe extends e1{constructor(e,r){super(e,r,hBe,RE,n=>n.id),this.core=e,this.logger=r}}class _Be{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new CBe(this.core,this.logger),this.pairingTopics=new ABe(this.core,this.logger),this.requests=new SBe(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class OE extends QRe{constructor(e){super(e),this.protocol=Ete,this.version=Cte,this.name=tS.name,this.events=new ba.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async(n,i)=>{try{return await this.engine.authenticate(n,i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=(e==null?void 0:e.name)||tS.name,this.metadata=(e==null?void 0:e.metadata)||Ree(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:qx(IE({level:(e==null?void 0:e.logger)||tS.logger}));this.core=(e==null?void 0:e.core)||new nBe(e),this.logger=so(r,this.name),this.session=new xBe(this.core,this.logger),this.proposal=new wBe(this.core,this.logger),this.pendingRequest=new EBe(this.core,this.logger),this.engine=new bBe(this),this.auth=new _Be(this.core,this.logger)}static async init(e){const r=new OE(e);return await r.initialize(),r}get context(){return Lo(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var h4={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */h4.exports;(function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",l=500,f="__lodash_placeholder__",u=1,p=2,g=4,y=1,b=2,I=1,C=2,S=4,O=8,L=16,F=32,z=64,_=128,$=256,ie=512,ce=30,K="...",P=800,M=16,v=1,m=2,R=3,B=1/0,E=9007199254740991,x=17976931348623157e292,w=NaN,T=4294967295,k=T-1,H=T>>>1,oe=[["ary",_],["bind",I],["bindKey",C],["curry",O],["curryRight",L],["flip",ie],["partial",F],["partialRight",z],["rearg",$]],j="[object Arguments]",X="[object Array]",G="[object AsyncFunction]",Z="[object Boolean]",ee="[object Date]",N="[object DOMException]",te="[object Error]",fe="[object Function]",Ee="[object GeneratorFunction]",_e="[object Map]",Re="[object Number]",Te="[object Null]",De="[object Object]",ze="[object Promise]",et="[object Proxy]",Je="[object RegExp]",ke="[object Set]",Ne="[object String]",tt="[object Symbol]",Ze="[object Undefined]",st="[object WeakMap]",nt="[object WeakSet]",We="[object ArrayBuffer]",lt="[object DataView]",vt="[object Float32Array]",Ke="[object Float64Array]",gt="[object Int8Array]",wt="[object Int16Array]",rt="[object Int32Array]",It="[object Uint8Array]",At="[object Uint8ClampedArray]",Tt="[object Uint16Array]",Xt="[object Uint32Array]",lr=/\b__p \+= '';/g,xt=/\b(__p \+=) '' \+/g,ar=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rr=/&(?:amp|lt|gt|quot|#39);/g,kt=/[&<>"']/g,Dt=RegExp(rr.source),Nt=RegExp(kt.source),dt=/<%-([\s\S]+?)%>/g,Lt=/<%([\s\S]+?)%>/g,Mt=/<%=([\s\S]+?)%>/g,ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vt=/^\w*$/,zt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ht=/[\\^$.*+?()[\]{}|]/g,Et=RegExp(ht.source),Bt=/^\s+/,He=/\s/,$t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ct=/\{\n\/\* \[wrapped with (.+)\] \*/,ct=/,? & /,Ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Rr=/[()=,{}\[\]\/\s]/,Ut=/\\(\\)?/g,Sr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,er=/\w*$/,kr=/^[-+]0x[0-9a-f]+$/i,bi=/^0b[01]+$/i,wi=/^\[object .+?Constructor\]$/,xi=/^0o[0-7]+$/i,Ti=/^(?:0|[1-9]\d*)$/,Sn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ui=/($^)/,Fs=/['\n\r\u2028\u2029\\]/g,di="\\ud800-\\udfff",jo="\\u0300-\\u036f",Uo="\\ufe20-\\ufe2f",hi="\\u20d0-\\u20ff",oo=jo+Uo+hi,ao="\\u2700-\\u27bf",_n="a-z\\xdf-\\xf6\\xf8-\\xff",$o="\\xac\\xb1\\xd7\\xf7",Gi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qo="\\u2000-\\u206f",Ca=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",co="A-Z\\xc0-\\xd6\\xd8-\\xde",Lh="\\ufe0e\\ufe0f",pc=$o+Gi+qo+Ca,Fh="['’]",cf="["+di+"]",jh="["+pc+"]",lf="["+oo+"]",Du="\\d+",qy="["+ao+"]",r1="["+_n+"]",n1="[^"+di+pc+Du+ao+_n+co+"]",Nu="\\ud83c[\\udffb-\\udfff]",Bu="(?:"+lf+"|"+Nu+")",Uh="[^"+di+"]",Lu="(?:\\ud83c[\\udde6-\\uddff]){2}",Vo="[\\ud800-\\udbff][\\udc00-\\udfff]",ds="["+co+"]",hr="\\u200d",i1="(?:"+r1+"|"+n1+")",Aa="(?:"+ds+"|"+n1+")",hs="(?:"+Fh+"(?:d|ll|m|re|s|t|ve))?",s1="(?:"+Fh+"(?:D|LL|M|RE|S|T|VE))?",$h=Bu+"?",qh="["+Lh+"]?",Fu="(?:"+hr+"(?:"+[Uh,Lu,Vo].join("|")+")"+qh+$h+")*",vc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ju="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",o1=qh+$h+Fu,nl="(?:"+[qy,Lu,Vo].join("|")+")"+o1,Vy="(?:"+[Uh+lf+"?",lf,Lu,Vo,cf].join("|")+")",Uu=RegExp(Fh,"g"),zy=RegExp(lf,"g"),il=RegExp(Nu+"(?="+Nu+")|"+Vy+o1,"g"),lo=RegExp([ds+"?"+r1+"+"+hs+"(?="+[jh,ds,"$"].join("|")+")",Aa+"+"+s1+"(?="+[jh,ds+i1,"$"].join("|")+")",ds+"?"+i1+"+"+hs,ds+"+"+s1,ju,vc,Du,nl].join("|"),"g"),$u=RegExp("["+hr+di+oo+Lh+"]"),ff=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,a1=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zo=-1,Wr={};Wr[vt]=Wr[Ke]=Wr[gt]=Wr[wt]=Wr[rt]=Wr[It]=Wr[At]=Wr[Tt]=Wr[Xt]=!0,Wr[j]=Wr[X]=Wr[We]=Wr[Z]=Wr[lt]=Wr[ee]=Wr[te]=Wr[fe]=Wr[_e]=Wr[Re]=Wr[De]=Wr[Je]=Wr[ke]=Wr[Ne]=Wr[st]=!1;var Kr={};Kr[j]=Kr[X]=Kr[We]=Kr[lt]=Kr[Z]=Kr[ee]=Kr[vt]=Kr[Ke]=Kr[gt]=Kr[wt]=Kr[rt]=Kr[_e]=Kr[Re]=Kr[De]=Kr[Je]=Kr[ke]=Kr[Ne]=Kr[tt]=Kr[It]=Kr[At]=Kr[Tt]=Kr[Xt]=!0,Kr[te]=Kr[fe]=Kr[st]=!1;var le={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},we={"&":"&","<":"<",">":">",'"':""","'":"'"},$e={"&":"&","<":"<",">":">",""":'"',"'":"'"},yt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zr=parseFloat,tr=parseInt,ln=typeof Si=="object"&&Si&&Si.Object===Object&&Si,jn=typeof self=="object"&&self&&self.Object===Object&&self,wr=ln||jn||Function("return this")(),en=e&&!e.nodeType&&e,Pn=en&&!0&&t&&!t.nodeType&&t,ps=Pn&&Pn.exports===en,Un=ps&&ln.process,fn=function(){try{var be=Pn&&Pn.require&&Pn.require("util").types;return be||Un&&Un.binding&&Un.binding("util")}catch{}}(),Yn=fn&&fn.isArrayBuffer,Ho=fn&&fn.isDate,js=fn&&fn.isMap,Go=fn&&fn.isRegExp,Vh=fn&&fn.isSet,uf=fn&&fn.isTypedArray;function Qn(be,Oe,Pe){switch(Pe.length){case 0:return be.call(Oe);case 1:return be.call(Oe,Pe[0]);case 2:return be.call(Oe,Pe[0],Pe[1]);case 3:return be.call(Oe,Pe[0],Pe[1],Pe[2])}return be.apply(Oe,Pe)}function LE(be,Oe,Pe,bt){for(var Jt=-1,Nr=be==null?0:be.length;++Jt-1}function Hy(be,Oe,Pe){for(var bt=-1,Jt=be==null?0:be.length;++bt-1;);return Pe}function Qx(be,Oe){for(var Pe=be.length;Pe--&&qu(Oe,be[Pe],0)>-1;);return Pe}function GE(be,Oe){for(var Pe=be.length,bt=0;Pe--;)be[Pe]===Oe&&++bt;return bt}var WE=Yy(le),KE=Yy(we);function YE(be){return"\\"+yt[be]}function QE(be,Oe){return be==null?r:be[Oe]}function zu(be){return $u.test(be)}function JE(be){return ff.test(be)}function ZE(be){for(var Oe,Pe=[];!(Oe=be.next()).done;)Pe.push(Oe.value);return Pe}function Zy(be){var Oe=-1,Pe=Array(be.size);return be.forEach(function(bt,Jt){Pe[++Oe]=[Jt,bt]}),Pe}function hn(be,Oe){return function(Pe){return be(Oe(Pe))}}function gc(be,Oe){for(var Pe=-1,bt=be.length,Jt=0,Nr=[];++Pe-1}function _re(d,h){var A=this.__data__,U=h2(A,d);return U<0?(++this.size,A.push([d,h])):A[U][1]=h,this}pf.prototype.clear=Ere,pf.prototype.delete=Cre,pf.prototype.get=Are,pf.prototype.has=Sre,pf.prototype.set=_re;function vf(d){var h=-1,A=d==null?0:d.length;for(this.clear();++h=h?d:h)),d}function Ia(d,h,A,U,J,se){var he,ye=h&u,Ce=h&p,Fe=h&g;if(A&&(he=J?A(d,U,J,se):A(d)),he!==r)return he;if(!kn(d))return d;var je=nr(d);if(je){if(he=kne(d),!ye)return vo(d,he)}else{var Ve=vs(d),ft=Ve==fe||Ve==Ee;if(Ju(d))return kR(d,ye);if(Ve==De||Ve==j||ft&&!J){if(he=Ce||ft?{}:YR(d),!ye)return Ce?bne(d,qre(he,d)):mne(d,oR(he,d))}else{if(!Kr[Ve])return J?d:{};he=Mne(d,Ve,ye)}}se||(se=new mc);var Rt=se.get(d);if(Rt)return Rt;se.set(d,he),AO(d)?d.forEach(function(Kt){he.add(Ia(Kt,h,A,Kt,d,se))}):EO(d)&&d.forEach(function(Kt,xr){he.set(xr,Ia(Kt,h,A,xr,d,se))});var Wt=Fe?Ce?_C:SC:Ce?yo:Pi,ur=je?r:Wt(d);return fo(ur||d,function(Kt,xr){ur&&(xr=Kt,Kt=d[xr]),nm(he,xr,Ia(Kt,h,A,xr,d,se))}),he}function Vre(d){var h=Pi(d);return function(A){return aR(A,d,h)}}function aR(d,h,A){var U=A.length;if(d==null)return!U;for(d=tn(d);U--;){var J=A[U],se=h[J],he=d[J];if(he===r&&!(J in d)||!se(he))return!1}return!0}function cR(d,h,A){if(typeof d!="function")throw new po(o);return fm(function(){d.apply(r,A)},h)}function im(d,h,A,U){var J=-1,se=c1,he=!0,ye=d.length,Ce=[],Fe=h.length;if(!ye)return Ce;A&&(h=dn(h,Us(A))),U?(se=Hy,he=!1):h.length>=i&&(se=Gh,he=!1,h=new Qh(h));e:for(;++JJ?0:J+A),U=U===r||U>J?J:fr(U),U<0&&(U+=J),U=A>U?0:_O(U);A0&&A(ye)?h>1?Wi(ye,h-1,A,U,J):ol(J,ye):U||(J[J.length]=ye)}return J}var aC=BR(),uR=BR(!0);function ll(d,h){return d&&aC(d,h,Pi)}function cC(d,h){return d&&uR(d,h,Pi)}function v2(d,h){return sl(h,function(A){return wf(d[A])})}function Zh(d,h){h=Yu(h,d);for(var A=0,U=h.length;d!=null&&Ah}function Gre(d,h){return d!=null&&Hr.call(d,h)}function Wre(d,h){return d!=null&&h in tn(d)}function Kre(d,h,A){return d>=pt(h,A)&&d=120&&je.length>=120)?new Qh(he&&je):r}je=d[0];var Ve=-1,ft=ye[0];e:for(;++Ve-1;)ye!==d&&y1.call(ye,Ce,1),y1.call(d,Ce,1);return d}function ER(d,h){for(var A=d?h.length:0,U=A-1;A--;){var J=h[A];if(A==U||J!==se){var se=J;bf(J)?y1.call(d,J,1):mC(d,J)}}return d}function vC(d,h){return d+pe(un()*(h-d+1))}function ane(d,h,A,U){for(var J=-1,se=Qe(ae((h-d)/(A||1)),0),he=Pe(se);se--;)he[U?se:++J]=d,d+=A;return he}function gC(d,h){var A="";if(!d||h<1||h>E)return A;do h%2&&(A+=d),h=pe(h/2),h&&(d+=d);while(h);return A}function pr(d,h){return OC(ZR(d,h,mo),d+"")}function cne(d){return sR(_1(d))}function lne(d,h){var A=_1(d);return _2(A,Jh(h,0,A.length))}function am(d,h,A,U){if(!kn(d))return d;h=Yu(h,d);for(var J=-1,se=h.length,he=se-1,ye=d;ye!=null&&++JJ?0:J+h),A=A>J?J:A,A<0&&(A+=J),J=h>A?0:A-h>>>0,h>>>=0;for(var se=Pe(J);++U>>1,he=d[se];he!==null&&!Ko(he)&&(A?he<=h:he=i){var Fe=h?null:Cne(d);if(Fe)return uo(Fe);he=!1,J=Gh,Ce=new Qh}else Ce=h?[]:ye;e:for(;++U=U?d:Ta(d,h,A)}var PR=q||function(d){return wr.clearTimeout(d)};function kR(d,h){if(h)return d.slice();var A=d.length,U=i2?i2(A):new d.constructor(A);return d.copy(U),U}function EC(d){var h=new d.constructor(d.byteLength);return new v1(h).set(new v1(d)),h}function pne(d,h){var A=h?EC(d.buffer):d.buffer;return new d.constructor(A,d.byteOffset,d.byteLength)}function vne(d){var h=new d.constructor(d.source,er.exec(d));return h.lastIndex=d.lastIndex,h}function gne(d){return rm?tn(rm.call(d)):{}}function MR(d,h){var A=h?EC(d.buffer):d.buffer;return new d.constructor(A,d.byteOffset,d.length)}function RR(d,h){if(d!==h){var A=d!==r,U=d===null,J=d===d,se=Ko(d),he=h!==r,ye=h===null,Ce=h===h,Fe=Ko(h);if(!ye&&!Fe&&!se&&d>h||se&&he&&Ce&&!ye&&!Fe||U&&he&&Ce||!A&&Ce||!J)return 1;if(!U&&!se&&!Fe&&d=ye)return Ce;var Fe=A[U];return Ce*(Fe=="desc"?-1:1)}}return d.index-h.index}function OR(d,h,A,U){for(var J=-1,se=d.length,he=A.length,ye=-1,Ce=h.length,Fe=Qe(se-he,0),je=Pe(Ce+Fe),Ve=!U;++ye1?A[J-1]:r,he=J>2?A[2]:r;for(se=d.length>3&&typeof se=="function"?(J--,se):r,he&&Vs(A[0],A[1],he)&&(se=J<3?r:se,J=1),h=tn(h);++U-1?J[se?h[he]:he]:r}}function jR(d){return mf(function(h){var A=h.length,U=A,J=_a.prototype.thru;for(d&&h.reverse();U--;){var se=h[U];if(typeof se!="function")throw new po(o);if(J&&!he&&A2(se)=="wrapper")var he=new _a([],!0)}for(U=he?U:A;++U1&&Mr.reverse(),je&&Ceye))return!1;var Fe=se.get(d),je=se.get(h);if(Fe&&je)return Fe==h&&je==d;var Ve=-1,ft=!0,Rt=A&b?new Qh:r;for(se.set(d,h),se.set(h,d);++Ve1?"& ":"")+h[U],h=h.join(A>2?", ":" "),d.replace($t,`{ + */h4.exports;(function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",a="Invalid `variable` option passed into `_.template`",c="__lodash_hash_undefined__",l=500,f="__lodash_placeholder__",u=1,p=2,g=4,y=1,b=2,I=1,C=2,S=4,O=8,L=16,F=32,z=64,_=128,$=256,ie=512,ce=30,K="...",P=800,M=16,v=1,m=2,R=3,B=1/0,E=9007199254740991,x=17976931348623157e292,w=NaN,T=4294967295,k=T-1,H=T>>>1,oe=[["ary",_],["bind",I],["bindKey",C],["curry",O],["curryRight",L],["flip",ie],["partial",F],["partialRight",z],["rearg",$]],j="[object Arguments]",X="[object Array]",G="[object AsyncFunction]",Z="[object Boolean]",ee="[object Date]",N="[object DOMException]",te="[object Error]",fe="[object Function]",Ee="[object GeneratorFunction]",_e="[object Map]",Re="[object Number]",Te="[object Null]",De="[object Object]",ze="[object Promise]",et="[object Proxy]",Je="[object RegExp]",ke="[object Set]",Ne="[object String]",tt="[object Symbol]",Ze="[object Undefined]",st="[object WeakMap]",nt="[object WeakSet]",We="[object ArrayBuffer]",lt="[object DataView]",vt="[object Float32Array]",Ke="[object Float64Array]",gt="[object Int8Array]",wt="[object Int16Array]",rt="[object Int32Array]",It="[object Uint8Array]",At="[object Uint8ClampedArray]",Tt="[object Uint16Array]",Xt="[object Uint32Array]",lr=/\b__p \+= '';/g,xt=/\b(__p \+=) '' \+/g,ar=/(__e\(.*?\)|\b__t\)) \+\n'';/g,rr=/&(?:amp|lt|gt|quot|#39);/g,kt=/[&<>"']/g,Dt=RegExp(rr.source),Nt=RegExp(kt.source),dt=/<%-([\s\S]+?)%>/g,Lt=/<%([\s\S]+?)%>/g,Mt=/<%=([\s\S]+?)%>/g,ut=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vt=/^\w*$/,zt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ht=/[\\^$.*+?()[\]{}|]/g,Et=RegExp(ht.source),Bt=/^\s+/,He=/\s/,$t=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ct=/\{\n\/\* \[wrapped with (.+)\] \*/,ct=/,? & /,Ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Rr=/[()=,{}\[\]\/\s]/,Ut=/\\(\\)?/g,Sr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,er=/\w*$/,kr=/^[-+]0x[0-9a-f]+$/i,bi=/^0b[01]+$/i,wi=/^\[object .+?Constructor\]$/,xi=/^0o[0-7]+$/i,Ti=/^(?:0|[1-9]\d*)$/,Sn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,di=/($^)/,Fs=/['\n\r\u2028\u2029\\]/g,hi="\\ud800-\\udfff",jo="\\u0300-\\u036f",Uo="\\ufe20-\\ufe2f",pi="\\u20d0-\\u20ff",oo=jo+Uo+pi,ao="\\u2700-\\u27bf",_n="a-z\\xdf-\\xf6\\xf8-\\xff",$o="\\xac\\xb1\\xd7\\xf7",Gi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qo="\\u2000-\\u206f",Ca=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",co="A-Z\\xc0-\\xd6\\xd8-\\xde",Lh="\\ufe0e\\ufe0f",pc=$o+Gi+qo+Ca,Fh="['’]",cf="["+hi+"]",jh="["+pc+"]",lf="["+oo+"]",Du="\\d+",qy="["+ao+"]",r1="["+_n+"]",n1="[^"+hi+pc+Du+ao+_n+co+"]",Nu="\\ud83c[\\udffb-\\udfff]",Bu="(?:"+lf+"|"+Nu+")",Uh="[^"+hi+"]",Lu="(?:\\ud83c[\\udde6-\\uddff]){2}",Vo="[\\ud800-\\udbff][\\udc00-\\udfff]",ds="["+co+"]",hr="\\u200d",i1="(?:"+r1+"|"+n1+")",Aa="(?:"+ds+"|"+n1+")",hs="(?:"+Fh+"(?:d|ll|m|re|s|t|ve))?",s1="(?:"+Fh+"(?:D|LL|M|RE|S|T|VE))?",$h=Bu+"?",qh="["+Lh+"]?",Fu="(?:"+hr+"(?:"+[Uh,Lu,Vo].join("|")+")"+qh+$h+")*",vc="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ju="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",o1=qh+$h+Fu,nl="(?:"+[qy,Lu,Vo].join("|")+")"+o1,Vy="(?:"+[Uh+lf+"?",lf,Lu,Vo,cf].join("|")+")",Uu=RegExp(Fh,"g"),zy=RegExp(lf,"g"),il=RegExp(Nu+"(?="+Nu+")|"+Vy+o1,"g"),lo=RegExp([ds+"?"+r1+"+"+hs+"(?="+[jh,ds,"$"].join("|")+")",Aa+"+"+s1+"(?="+[jh,ds+i1,"$"].join("|")+")",ds+"?"+i1+"+"+hs,ds+"+"+s1,ju,vc,Du,nl].join("|"),"g"),$u=RegExp("["+hr+hi+oo+Lh+"]"),ff=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,a1=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zo=-1,Wr={};Wr[vt]=Wr[Ke]=Wr[gt]=Wr[wt]=Wr[rt]=Wr[It]=Wr[At]=Wr[Tt]=Wr[Xt]=!0,Wr[j]=Wr[X]=Wr[We]=Wr[Z]=Wr[lt]=Wr[ee]=Wr[te]=Wr[fe]=Wr[_e]=Wr[Re]=Wr[De]=Wr[Je]=Wr[ke]=Wr[Ne]=Wr[st]=!1;var Kr={};Kr[j]=Kr[X]=Kr[We]=Kr[lt]=Kr[Z]=Kr[ee]=Kr[vt]=Kr[Ke]=Kr[gt]=Kr[wt]=Kr[rt]=Kr[_e]=Kr[Re]=Kr[De]=Kr[Je]=Kr[ke]=Kr[Ne]=Kr[tt]=Kr[It]=Kr[At]=Kr[Tt]=Kr[Xt]=!0,Kr[te]=Kr[fe]=Kr[st]=!1;var le={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},we={"&":"&","<":"<",">":">",'"':""","'":"'"},$e={"&":"&","<":"<",">":">",""":'"',"'":"'"},yt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zr=parseFloat,tr=parseInt,ln=typeof Si=="object"&&Si&&Si.Object===Object&&Si,jn=typeof self=="object"&&self&&self.Object===Object&&self,wr=ln||jn||Function("return this")(),en=e&&!e.nodeType&&e,Pn=en&&!0&&t&&!t.nodeType&&t,ps=Pn&&Pn.exports===en,Un=ps&&ln.process,fn=function(){try{var be=Pn&&Pn.require&&Pn.require("util").types;return be||Un&&Un.binding&&Un.binding("util")}catch{}}(),Yn=fn&&fn.isArrayBuffer,Ho=fn&&fn.isDate,js=fn&&fn.isMap,Go=fn&&fn.isRegExp,Vh=fn&&fn.isSet,uf=fn&&fn.isTypedArray;function Qn(be,Oe,Pe){switch(Pe.length){case 0:return be.call(Oe);case 1:return be.call(Oe,Pe[0]);case 2:return be.call(Oe,Pe[0],Pe[1]);case 3:return be.call(Oe,Pe[0],Pe[1],Pe[2])}return be.apply(Oe,Pe)}function LE(be,Oe,Pe,bt){for(var Jt=-1,Nr=be==null?0:be.length;++Jt-1}function Hy(be,Oe,Pe){for(var bt=-1,Jt=be==null?0:be.length;++bt-1;);return Pe}function Qx(be,Oe){for(var Pe=be.length;Pe--&&qu(Oe,be[Pe],0)>-1;);return Pe}function GE(be,Oe){for(var Pe=be.length,bt=0;Pe--;)be[Pe]===Oe&&++bt;return bt}var WE=Yy(le),KE=Yy(we);function YE(be){return"\\"+yt[be]}function QE(be,Oe){return be==null?r:be[Oe]}function zu(be){return $u.test(be)}function JE(be){return ff.test(be)}function ZE(be){for(var Oe,Pe=[];!(Oe=be.next()).done;)Pe.push(Oe.value);return Pe}function Zy(be){var Oe=-1,Pe=Array(be.size);return be.forEach(function(bt,Jt){Pe[++Oe]=[Jt,bt]}),Pe}function hn(be,Oe){return function(Pe){return be(Oe(Pe))}}function gc(be,Oe){for(var Pe=-1,bt=be.length,Jt=0,Nr=[];++Pe-1}function _re(d,h){var A=this.__data__,U=h2(A,d);return U<0?(++this.size,A.push([d,h])):A[U][1]=h,this}pf.prototype.clear=Ere,pf.prototype.delete=Cre,pf.prototype.get=Are,pf.prototype.has=Sre,pf.prototype.set=_re;function vf(d){var h=-1,A=d==null?0:d.length;for(this.clear();++h=h?d:h)),d}function Ia(d,h,A,U,J,se){var he,ye=h&u,Ce=h&p,Fe=h&g;if(A&&(he=J?A(d,U,J,se):A(d)),he!==r)return he;if(!kn(d))return d;var je=nr(d);if(je){if(he=kne(d),!ye)return vo(d,he)}else{var Ve=vs(d),ft=Ve==fe||Ve==Ee;if(Ju(d))return kR(d,ye);if(Ve==De||Ve==j||ft&&!J){if(he=Ce||ft?{}:YR(d),!ye)return Ce?bne(d,qre(he,d)):mne(d,oR(he,d))}else{if(!Kr[Ve])return J?d:{};he=Mne(d,Ve,ye)}}se||(se=new mc);var Rt=se.get(d);if(Rt)return Rt;se.set(d,he),AO(d)?d.forEach(function(Kt){he.add(Ia(Kt,h,A,Kt,d,se))}):EO(d)&&d.forEach(function(Kt,xr){he.set(xr,Ia(Kt,h,A,xr,d,se))});var Wt=Fe?Ce?_C:SC:Ce?yo:Pi,ur=je?r:Wt(d);return fo(ur||d,function(Kt,xr){ur&&(xr=Kt,Kt=d[xr]),nm(he,xr,Ia(Kt,h,A,xr,d,se))}),he}function Vre(d){var h=Pi(d);return function(A){return aR(A,d,h)}}function aR(d,h,A){var U=A.length;if(d==null)return!U;for(d=tn(d);U--;){var J=A[U],se=h[J],he=d[J];if(he===r&&!(J in d)||!se(he))return!1}return!0}function cR(d,h,A){if(typeof d!="function")throw new po(o);return fm(function(){d.apply(r,A)},h)}function im(d,h,A,U){var J=-1,se=c1,he=!0,ye=d.length,Ce=[],Fe=h.length;if(!ye)return Ce;A&&(h=dn(h,Us(A))),U?(se=Hy,he=!1):h.length>=i&&(se=Gh,he=!1,h=new Qh(h));e:for(;++JJ?0:J+A),U=U===r||U>J?J:fr(U),U<0&&(U+=J),U=A>U?0:_O(U);A0&&A(ye)?h>1?Wi(ye,h-1,A,U,J):ol(J,ye):U||(J[J.length]=ye)}return J}var aC=BR(),uR=BR(!0);function ll(d,h){return d&&aC(d,h,Pi)}function cC(d,h){return d&&uR(d,h,Pi)}function v2(d,h){return sl(h,function(A){return wf(d[A])})}function Zh(d,h){h=Yu(h,d);for(var A=0,U=h.length;d!=null&&Ah}function Gre(d,h){return d!=null&&Hr.call(d,h)}function Wre(d,h){return d!=null&&h in tn(d)}function Kre(d,h,A){return d>=pt(h,A)&&d=120&&je.length>=120)?new Qh(he&&je):r}je=d[0];var Ve=-1,ft=ye[0];e:for(;++Ve-1;)ye!==d&&y1.call(ye,Ce,1),y1.call(d,Ce,1);return d}function ER(d,h){for(var A=d?h.length:0,U=A-1;A--;){var J=h[A];if(A==U||J!==se){var se=J;bf(J)?y1.call(d,J,1):mC(d,J)}}return d}function vC(d,h){return d+pe(un()*(h-d+1))}function ane(d,h,A,U){for(var J=-1,se=Qe(ae((h-d)/(A||1)),0),he=Pe(se);se--;)he[U?se:++J]=d,d+=A;return he}function gC(d,h){var A="";if(!d||h<1||h>E)return A;do h%2&&(A+=d),h=pe(h/2),h&&(d+=d);while(h);return A}function pr(d,h){return OC(ZR(d,h,mo),d+"")}function cne(d){return sR(_1(d))}function lne(d,h){var A=_1(d);return _2(A,Jh(h,0,A.length))}function am(d,h,A,U){if(!kn(d))return d;h=Yu(h,d);for(var J=-1,se=h.length,he=se-1,ye=d;ye!=null&&++JJ?0:J+h),A=A>J?J:A,A<0&&(A+=J),J=h>A?0:A-h>>>0,h>>>=0;for(var se=Pe(J);++U>>1,he=d[se];he!==null&&!Ko(he)&&(A?he<=h:he=i){var Fe=h?null:Cne(d);if(Fe)return uo(Fe);he=!1,J=Gh,Ce=new Qh}else Ce=h?[]:ye;e:for(;++U=U?d:Ta(d,h,A)}var PR=q||function(d){return wr.clearTimeout(d)};function kR(d,h){if(h)return d.slice();var A=d.length,U=i2?i2(A):new d.constructor(A);return d.copy(U),U}function EC(d){var h=new d.constructor(d.byteLength);return new v1(h).set(new v1(d)),h}function pne(d,h){var A=h?EC(d.buffer):d.buffer;return new d.constructor(A,d.byteOffset,d.byteLength)}function vne(d){var h=new d.constructor(d.source,er.exec(d));return h.lastIndex=d.lastIndex,h}function gne(d){return rm?tn(rm.call(d)):{}}function MR(d,h){var A=h?EC(d.buffer):d.buffer;return new d.constructor(A,d.byteOffset,d.length)}function RR(d,h){if(d!==h){var A=d!==r,U=d===null,J=d===d,se=Ko(d),he=h!==r,ye=h===null,Ce=h===h,Fe=Ko(h);if(!ye&&!Fe&&!se&&d>h||se&&he&&Ce&&!ye&&!Fe||U&&he&&Ce||!A&&Ce||!J)return 1;if(!U&&!se&&!Fe&&d=ye)return Ce;var Fe=A[U];return Ce*(Fe=="desc"?-1:1)}}return d.index-h.index}function OR(d,h,A,U){for(var J=-1,se=d.length,he=A.length,ye=-1,Ce=h.length,Fe=Qe(se-he,0),je=Pe(Ce+Fe),Ve=!U;++ye1?A[J-1]:r,he=J>2?A[2]:r;for(se=d.length>3&&typeof se=="function"?(J--,se):r,he&&Vs(A[0],A[1],he)&&(se=J<3?r:se,J=1),h=tn(h);++U-1?J[se?h[he]:he]:r}}function jR(d){return mf(function(h){var A=h.length,U=A,J=_a.prototype.thru;for(d&&h.reverse();U--;){var se=h[U];if(typeof se!="function")throw new po(o);if(J&&!he&&A2(se)=="wrapper")var he=new _a([],!0)}for(U=he?U:A;++U1&&Mr.reverse(),je&&Ceye))return!1;var Fe=se.get(d),je=se.get(h);if(Fe&&je)return Fe==h&&je==d;var Ve=-1,ft=!0,Rt=A&b?new Qh:r;for(se.set(d,h),se.set(h,d);++Ve1?"& ":"")+h[U],h=h.join(A>2?", ":" "),d.replace($t,`{ /* [wrapped with `+h+`] */ -`)}function One(d){return nr(d)||t0(d)||!!(a2&&d&&d[a2])}function bf(d,h){var A=typeof d;return h=h??E,!!h&&(A=="number"||A!="symbol"&&Ti.test(d))&&d>-1&&d%1==0&&d0){if(++h>=P)return arguments[0]}else h=0;return d.apply(r,arguments)}}function _2(d,h){var A=-1,U=d.length,J=U-1;for(h=h===r?U:h;++A1?d[h-1]:r;return A=typeof A=="function"?(d.pop(),A):r,fO(d,A)});function uO(d){var h=ne(d);return h.__chain__=!0,h}function zie(d,h){return h(d),d}function I2(d,h){return h(d)}var Hie=mf(function(d){var h=d.length,A=h?d[0]:0,U=this.__wrapped__,J=function(se){return oC(se,d)};return h>1||this.__actions__.length||!(U instanceof _r)||!bf(A)?this.thru(J):(U=U.slice(A,+A+(h?1:0)),U.__actions__.push({func:I2,args:[J],thisArg:r}),new _a(U,this.__chain__).thru(function(se){return h&&!se.length&&se.push(r),se}))});function Gie(){return uO(this)}function Wie(){return new _a(this.value(),this.__chain__)}function Kie(){this.__values__===r&&(this.__values__=SO(this.value()));var d=this.__index__>=this.__values__.length,h=d?r:this.__values__[this.__index__++];return{done:d,value:h}}function Yie(){return this}function Qie(d){for(var h,A=this;A instanceof d2;){var U=iO(A);U.__index__=0,U.__values__=r,h?J.__wrapped__=U:h=U;var J=U;A=A.__wrapped__}return J.__wrapped__=d,h}function Jie(){var d=this.__wrapped__;if(d instanceof _r){var h=d;return this.__actions__.length&&(h=new _r(this)),h=h.reverse(),h.__actions__.push({func:I2,args:[DC],thisArg:r}),new _a(h,this.__chain__)}return this.thru(DC)}function Zie(){return IR(this.__wrapped__,this.__actions__)}var Xie=b2(function(d,h,A){Hr.call(d,A)?++d[A]:gf(d,A,1)});function ese(d,h,A){var U=nr(d)?Hx:zre;return A&&Vs(d,h,A)&&(h=r),U(d,Gt(h,3))}function tse(d,h){var A=nr(d)?sl:fR;return A(d,Gt(h,3))}var rse=FR(sO),nse=FR(oO);function ise(d,h){return Wi(T2(d,h),1)}function sse(d,h){return Wi(T2(d,h),B)}function ose(d,h,A){return A=A===r?1:fr(A),Wi(T2(d,h),A)}function dO(d,h){var A=nr(d)?fo:Wu;return A(d,Gt(h,3))}function hO(d,h){var A=nr(d)?FE:lR;return A(d,Gt(h,3))}var ase=b2(function(d,h,A){Hr.call(d,A)?d[A].push(h):gf(d,A,[h])});function cse(d,h,A,U){d=go(d)?d:_1(d),A=A&&!U?fr(A):0;var J=d.length;return A<0&&(A=Qe(J+A,0)),O2(d)?A<=J&&d.indexOf(h,A)>-1:!!J&&qu(d,h,A)>-1}var lse=pr(function(d,h,A){var U=-1,J=typeof h=="function",se=go(d)?Pe(d.length):[];return Wu(d,function(he){se[++U]=J?Qn(h,he,A):sm(he,h,A)}),se}),fse=b2(function(d,h,A){gf(d,A,h)});function T2(d,h){var A=nr(d)?dn:gR;return A(d,Gt(h,3))}function use(d,h,A,U){return d==null?[]:(nr(h)||(h=h==null?[]:[h]),A=U?r:A,nr(A)||(A=A==null?[]:[A]),wR(d,h,A))}var dse=b2(function(d,h,A){d[A?0:1].push(h)},function(){return[[],[]]});function hse(d,h,A){var U=nr(d)?Gy:Kx,J=arguments.length<3;return U(d,Gt(h,4),A,J,Wu)}function pse(d,h,A){var U=nr(d)?jE:Kx,J=arguments.length<3;return U(d,Gt(h,4),A,J,lR)}function vse(d,h){var A=nr(d)?sl:fR;return A(d,M2(Gt(h,3)))}function gse(d){var h=nr(d)?sR:cne;return h(d)}function yse(d,h,A){(A?Vs(d,h,A):h===r)?h=1:h=fr(h);var U=nr(d)?jre:lne;return U(d,h)}function mse(d){var h=nr(d)?Ure:une;return h(d)}function bse(d){if(d==null)return 0;if(go(d))return O2(d)?df(d):d.length;var h=vs(d);return h==_e||h==ke?d.size:dC(d).length}function wse(d,h,A){var U=nr(d)?zh:dne;return A&&Vs(d,h,A)&&(h=r),U(d,Gt(h,3))}var xse=pr(function(d,h){if(d==null)return[];var A=h.length;return A>1&&Vs(d,h[0],h[1])?h=[]:A>2&&Vs(h[0],h[1],h[2])&&(h=[h[0]]),wR(d,Wi(h,1),[])}),P2=V||function(){return wr.Date.now()};function Ese(d,h){if(typeof h!="function")throw new po(o);return d=fr(d),function(){if(--d<1)return h.apply(this,arguments)}}function pO(d,h,A){return h=A?r:h,h=d&&h==null?d.length:h,yf(d,_,r,r,r,r,h)}function vO(d,h){var A;if(typeof h!="function")throw new po(o);return d=fr(d),function(){return--d>0&&(A=h.apply(this,arguments)),d<=1&&(h=r),A}}var BC=pr(function(d,h,A){var U=I;if(A.length){var J=gc(A,A1(BC));U|=F}return yf(d,U,h,A,J)}),gO=pr(function(d,h,A){var U=I|C;if(A.length){var J=gc(A,A1(gO));U|=F}return yf(h,U,d,A,J)});function yO(d,h,A){h=A?r:h;var U=yf(d,O,r,r,r,r,r,h);return U.placeholder=yO.placeholder,U}function mO(d,h,A){h=A?r:h;var U=yf(d,L,r,r,r,r,r,h);return U.placeholder=mO.placeholder,U}function bO(d,h,A){var U,J,se,he,ye,Ce,Fe=0,je=!1,Ve=!1,ft=!0;if(typeof d!="function")throw new po(o);h=ka(h)||0,kn(A)&&(je=!!A.leading,Ve="maxWait"in A,se=Ve?Qe(ka(A.maxWait)||0,h):se,ft="trailing"in A?!!A.trailing:ft);function Rt(ei){var wc=U,Ef=J;return U=J=r,Fe=ei,he=d.apply(Ef,wc),he}function Wt(ei){return Fe=ei,ye=fm(xr,h),je?Rt(ei):he}function ur(ei){var wc=ei-Ce,Ef=ei-Fe,FO=h-wc;return Ve?pt(FO,se-Ef):FO}function Kt(ei){var wc=ei-Ce,Ef=ei-Fe;return Ce===r||wc>=h||wc<0||Ve&&Ef>=se}function xr(){var ei=P2();if(Kt(ei))return Mr(ei);ye=fm(xr,ur(ei))}function Mr(ei){return ye=r,ft&&U?Rt(ei):(U=J=r,he)}function Yo(){ye!==r&&PR(ye),Fe=0,U=Ce=J=ye=r}function zs(){return ye===r?he:Mr(P2())}function Qo(){var ei=P2(),wc=Kt(ei);if(U=arguments,J=this,Ce=ei,wc){if(ye===r)return Wt(Ce);if(Ve)return PR(ye),ye=fm(xr,h),Rt(Ce)}return ye===r&&(ye=fm(xr,h)),he}return Qo.cancel=Yo,Qo.flush=zs,Qo}var Cse=pr(function(d,h){return cR(d,1,h)}),Ase=pr(function(d,h,A){return cR(d,ka(h)||0,A)});function Sse(d){return yf(d,ie)}function k2(d,h){if(typeof d!="function"||h!=null&&typeof h!="function")throw new po(o);var A=function(){var U=arguments,J=h?h.apply(this,U):U[0],se=A.cache;if(se.has(J))return se.get(J);var he=d.apply(this,U);return A.cache=se.set(J,he)||se,he};return A.cache=new(k2.Cache||vf),A}k2.Cache=vf;function M2(d){if(typeof d!="function")throw new po(o);return function(){var h=arguments;switch(h.length){case 0:return!d.call(this);case 1:return!d.call(this,h[0]);case 2:return!d.call(this,h[0],h[1]);case 3:return!d.call(this,h[0],h[1],h[2])}return!d.apply(this,h)}}function _se(d){return vO(2,d)}var Ise=hne(function(d,h){h=h.length==1&&nr(h[0])?dn(h[0],Us(Gt())):dn(Wi(h,1),Us(Gt()));var A=h.length;return pr(function(U){for(var J=-1,se=pt(U.length,A);++J=h}),t0=hR(function(){return arguments}())?hR:function(d){return qn(d)&&Hr.call(d,"callee")&&!o2.call(d,"callee")},nr=Pe.isArray,qse=Yn?Us(Yn):Qre;function go(d){return d!=null&&R2(d.length)&&!wf(d)}function Xn(d){return qn(d)&&go(d)}function Vse(d){return d===!0||d===!1||qn(d)&&qs(d)==Z}var Ju=Se||KC,zse=Ho?Us(Ho):Jre;function Hse(d){return qn(d)&&d.nodeType===1&&!um(d)}function Gse(d){if(d==null)return!0;if(go(d)&&(nr(d)||typeof d=="string"||typeof d.splice=="function"||Ju(d)||S1(d)||t0(d)))return!d.length;var h=vs(d);if(h==_e||h==ke)return!d.size;if(lm(d))return!dC(d).length;for(var A in d)if(Hr.call(d,A))return!1;return!0}function Wse(d,h){return om(d,h)}function Kse(d,h,A){A=typeof A=="function"?A:r;var U=A?A(d,h):r;return U===r?om(d,h,r,A):!!U}function FC(d){if(!qn(d))return!1;var h=qs(d);return h==te||h==N||typeof d.message=="string"&&typeof d.name=="string"&&!um(d)}function Yse(d){return typeof d=="number"&&Ae(d)}function wf(d){if(!kn(d))return!1;var h=qs(d);return h==fe||h==Ee||h==G||h==et}function xO(d){return typeof d=="number"&&d==fr(d)}function R2(d){return typeof d=="number"&&d>-1&&d%1==0&&d<=E}function kn(d){var h=typeof d;return d!=null&&(h=="object"||h=="function")}function qn(d){return d!=null&&typeof d=="object"}var EO=js?Us(js):Xre;function Qse(d,h){return d===h||uC(d,h,TC(h))}function Jse(d,h,A){return A=typeof A=="function"?A:r,uC(d,h,TC(h),A)}function Zse(d){return CO(d)&&d!=+d}function Xse(d){if(Bne(d))throw new Jt(s);return pR(d)}function eoe(d){return d===null}function toe(d){return d==null}function CO(d){return typeof d=="number"||qn(d)&&qs(d)==Re}function um(d){if(!qn(d)||qs(d)!=De)return!1;var h=g1(d);if(h===null)return!0;var A=Hr.call(h,"constructor")&&h.constructor;return typeof A=="function"&&A instanceof A&&d1.call(A)==rC}var jC=Go?Us(Go):ene;function roe(d){return xO(d)&&d>=-E&&d<=E}var AO=Vh?Us(Vh):tne;function O2(d){return typeof d=="string"||!nr(d)&&qn(d)&&qs(d)==Ne}function Ko(d){return typeof d=="symbol"||qn(d)&&qs(d)==tt}var S1=uf?Us(uf):rne;function noe(d){return d===r}function ioe(d){return qn(d)&&vs(d)==st}function soe(d){return qn(d)&&qs(d)==nt}var ooe=C2(hC),aoe=C2(function(d,h){return d<=h});function SO(d){if(!d)return[];if(go(d))return O2(d)?ho(d):vo(d);if(Wh&&d[Wh])return ZE(d[Wh]());var h=vs(d),A=h==_e?Zy:h==ke?uo:_1;return A(d)}function xf(d){if(!d)return d===0?d:0;if(d=ka(d),d===B||d===-B){var h=d<0?-1:1;return h*x}return d===d?d:0}function fr(d){var h=xf(d),A=h%1;return h===h?A?h-A:h:0}function _O(d){return d?Jh(fr(d),0,T):0}function ka(d){if(typeof d=="number")return d;if(Ko(d))return w;if(kn(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=kn(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=Yx(d);var A=bi.test(d);return A||xi.test(d)?tr(d.slice(2),A?2:8):kr.test(d)?w:+d}function IO(d){return fl(d,yo(d))}function coe(d){return d?Jh(fr(d),-E,E):d===0?d:0}function Yr(d){return d==null?"":Wo(d)}var loe=E1(function(d,h){if(lm(h)||go(h)){fl(h,Pi(h),d);return}for(var A in h)Hr.call(h,A)&&nm(d,A,h[A])}),TO=E1(function(d,h){fl(h,yo(h),d)}),D2=E1(function(d,h,A,U){fl(h,yo(h),d,U)}),foe=E1(function(d,h,A,U){fl(h,Pi(h),d,U)}),uoe=mf(oC);function doe(d,h){var A=x1(d);return h==null?A:oR(A,h)}var hoe=pr(function(d,h){d=tn(d);var A=-1,U=h.length,J=U>2?h[2]:r;for(J&&Vs(h[0],h[1],J)&&(U=1);++A1),se}),fl(d,_C(d),A),U&&(A=Ia(A,u|p|g,Ane));for(var J=h.length;J--;)mC(A,h[J]);return A});function Moe(d,h){return kO(d,M2(Gt(h)))}var Roe=mf(function(d,h){return d==null?{}:sne(d,h)});function kO(d,h){if(d==null)return{};var A=dn(_C(d),function(U){return[U]});return h=Gt(h),xR(d,A,function(U,J){return h(U,J[0])})}function Ooe(d,h,A){h=Yu(h,d);var U=-1,J=h.length;for(J||(J=1,d=r);++Uh){var U=d;d=h,h=U}if(A||d%1||h%1){var J=un();return pt(d+J*(h-d+zr("1e-"+((J+"").length-1))),h)}return vC(d,h)}var zoe=C1(function(d,h,A){return h=h.toLowerCase(),d+(A?OO(h):h)});function OO(d){return qC(Yr(d).toLowerCase())}function DO(d){return d=Yr(d),d&&d.replace(Sn,WE).replace(zy,"")}function Hoe(d,h,A){d=Yr(d),h=Wo(h);var U=d.length;A=A===r?U:Jh(fr(A),0,U);var J=A;return A-=h.length,A>=0&&d.slice(A,J)==h}function Goe(d){return d=Yr(d),d&&Nt.test(d)?d.replace(kt,KE):d}function Woe(d){return d=Yr(d),d&&Et.test(d)?d.replace(ht,"\\$&"):d}var Koe=C1(function(d,h,A){return d+(A?"-":"")+h.toLowerCase()}),Yoe=C1(function(d,h,A){return d+(A?" ":"")+h.toLowerCase()}),Qoe=LR("toLowerCase");function Joe(d,h,A){d=Yr(d),h=fr(h);var U=h?df(d):0;if(!h||U>=h)return d;var J=(h-U)/2;return E2(pe(J),A)+d+E2(ae(J),A)}function Zoe(d,h,A){d=Yr(d),h=fr(h);var U=h?df(d):0;return h&&U>>0,A?(d=Yr(d),d&&(typeof h=="string"||h!=null&&!jC(h))&&(h=Wo(h),!h&&zu(d))?Qu(ho(d),0,A):d.split(h,A)):[]}var sae=C1(function(d,h,A){return d+(A?" ":"")+qC(h)});function oae(d,h,A){return d=Yr(d),A=A==null?0:Jh(fr(A),0,d.length),h=Wo(h),d.slice(A,A+h.length)==h}function aae(d,h,A){var U=ne.templateSettings;A&&Vs(d,h,A)&&(h=r),d=Yr(d),h=D2({},h,U,zR);var J=D2({},h.imports,U.imports,zR),se=Pi(J),he=Hh(J,se),ye,Ce,Fe=0,je=h.interpolate||ui,Ve="__p += '",ft=tm((h.escape||ui).source+"|"+je.source+"|"+(je===Mt?Sr:ui).source+"|"+(h.evaluate||ui).source+"|$","g"),Rt="//# sourceURL="+(Hr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zo+"]")+` +`)}function One(d){return nr(d)||t0(d)||!!(a2&&d&&d[a2])}function bf(d,h){var A=typeof d;return h=h??E,!!h&&(A=="number"||A!="symbol"&&Ti.test(d))&&d>-1&&d%1==0&&d0){if(++h>=P)return arguments[0]}else h=0;return d.apply(r,arguments)}}function _2(d,h){var A=-1,U=d.length,J=U-1;for(h=h===r?U:h;++A1?d[h-1]:r;return A=typeof A=="function"?(d.pop(),A):r,fO(d,A)});function uO(d){var h=ne(d);return h.__chain__=!0,h}function zie(d,h){return h(d),d}function I2(d,h){return h(d)}var Hie=mf(function(d){var h=d.length,A=h?d[0]:0,U=this.__wrapped__,J=function(se){return oC(se,d)};return h>1||this.__actions__.length||!(U instanceof _r)||!bf(A)?this.thru(J):(U=U.slice(A,+A+(h?1:0)),U.__actions__.push({func:I2,args:[J],thisArg:r}),new _a(U,this.__chain__).thru(function(se){return h&&!se.length&&se.push(r),se}))});function Gie(){return uO(this)}function Wie(){return new _a(this.value(),this.__chain__)}function Kie(){this.__values__===r&&(this.__values__=SO(this.value()));var d=this.__index__>=this.__values__.length,h=d?r:this.__values__[this.__index__++];return{done:d,value:h}}function Yie(){return this}function Qie(d){for(var h,A=this;A instanceof d2;){var U=iO(A);U.__index__=0,U.__values__=r,h?J.__wrapped__=U:h=U;var J=U;A=A.__wrapped__}return J.__wrapped__=d,h}function Jie(){var d=this.__wrapped__;if(d instanceof _r){var h=d;return this.__actions__.length&&(h=new _r(this)),h=h.reverse(),h.__actions__.push({func:I2,args:[DC],thisArg:r}),new _a(h,this.__chain__)}return this.thru(DC)}function Zie(){return IR(this.__wrapped__,this.__actions__)}var Xie=b2(function(d,h,A){Hr.call(d,A)?++d[A]:gf(d,A,1)});function ese(d,h,A){var U=nr(d)?Hx:zre;return A&&Vs(d,h,A)&&(h=r),U(d,Gt(h,3))}function tse(d,h){var A=nr(d)?sl:fR;return A(d,Gt(h,3))}var rse=FR(sO),nse=FR(oO);function ise(d,h){return Wi(T2(d,h),1)}function sse(d,h){return Wi(T2(d,h),B)}function ose(d,h,A){return A=A===r?1:fr(A),Wi(T2(d,h),A)}function dO(d,h){var A=nr(d)?fo:Wu;return A(d,Gt(h,3))}function hO(d,h){var A=nr(d)?FE:lR;return A(d,Gt(h,3))}var ase=b2(function(d,h,A){Hr.call(d,A)?d[A].push(h):gf(d,A,[h])});function cse(d,h,A,U){d=go(d)?d:_1(d),A=A&&!U?fr(A):0;var J=d.length;return A<0&&(A=Qe(J+A,0)),O2(d)?A<=J&&d.indexOf(h,A)>-1:!!J&&qu(d,h,A)>-1}var lse=pr(function(d,h,A){var U=-1,J=typeof h=="function",se=go(d)?Pe(d.length):[];return Wu(d,function(he){se[++U]=J?Qn(h,he,A):sm(he,h,A)}),se}),fse=b2(function(d,h,A){gf(d,A,h)});function T2(d,h){var A=nr(d)?dn:gR;return A(d,Gt(h,3))}function use(d,h,A,U){return d==null?[]:(nr(h)||(h=h==null?[]:[h]),A=U?r:A,nr(A)||(A=A==null?[]:[A]),wR(d,h,A))}var dse=b2(function(d,h,A){d[A?0:1].push(h)},function(){return[[],[]]});function hse(d,h,A){var U=nr(d)?Gy:Kx,J=arguments.length<3;return U(d,Gt(h,4),A,J,Wu)}function pse(d,h,A){var U=nr(d)?jE:Kx,J=arguments.length<3;return U(d,Gt(h,4),A,J,lR)}function vse(d,h){var A=nr(d)?sl:fR;return A(d,M2(Gt(h,3)))}function gse(d){var h=nr(d)?sR:cne;return h(d)}function yse(d,h,A){(A?Vs(d,h,A):h===r)?h=1:h=fr(h);var U=nr(d)?jre:lne;return U(d,h)}function mse(d){var h=nr(d)?Ure:une;return h(d)}function bse(d){if(d==null)return 0;if(go(d))return O2(d)?df(d):d.length;var h=vs(d);return h==_e||h==ke?d.size:dC(d).length}function wse(d,h,A){var U=nr(d)?zh:dne;return A&&Vs(d,h,A)&&(h=r),U(d,Gt(h,3))}var xse=pr(function(d,h){if(d==null)return[];var A=h.length;return A>1&&Vs(d,h[0],h[1])?h=[]:A>2&&Vs(h[0],h[1],h[2])&&(h=[h[0]]),wR(d,Wi(h,1),[])}),P2=V||function(){return wr.Date.now()};function Ese(d,h){if(typeof h!="function")throw new po(o);return d=fr(d),function(){if(--d<1)return h.apply(this,arguments)}}function pO(d,h,A){return h=A?r:h,h=d&&h==null?d.length:h,yf(d,_,r,r,r,r,h)}function vO(d,h){var A;if(typeof h!="function")throw new po(o);return d=fr(d),function(){return--d>0&&(A=h.apply(this,arguments)),d<=1&&(h=r),A}}var BC=pr(function(d,h,A){var U=I;if(A.length){var J=gc(A,A1(BC));U|=F}return yf(d,U,h,A,J)}),gO=pr(function(d,h,A){var U=I|C;if(A.length){var J=gc(A,A1(gO));U|=F}return yf(h,U,d,A,J)});function yO(d,h,A){h=A?r:h;var U=yf(d,O,r,r,r,r,r,h);return U.placeholder=yO.placeholder,U}function mO(d,h,A){h=A?r:h;var U=yf(d,L,r,r,r,r,r,h);return U.placeholder=mO.placeholder,U}function bO(d,h,A){var U,J,se,he,ye,Ce,Fe=0,je=!1,Ve=!1,ft=!0;if(typeof d!="function")throw new po(o);h=ka(h)||0,kn(A)&&(je=!!A.leading,Ve="maxWait"in A,se=Ve?Qe(ka(A.maxWait)||0,h):se,ft="trailing"in A?!!A.trailing:ft);function Rt(ei){var wc=U,Ef=J;return U=J=r,Fe=ei,he=d.apply(Ef,wc),he}function Wt(ei){return Fe=ei,ye=fm(xr,h),je?Rt(ei):he}function ur(ei){var wc=ei-Ce,Ef=ei-Fe,FO=h-wc;return Ve?pt(FO,se-Ef):FO}function Kt(ei){var wc=ei-Ce,Ef=ei-Fe;return Ce===r||wc>=h||wc<0||Ve&&Ef>=se}function xr(){var ei=P2();if(Kt(ei))return Mr(ei);ye=fm(xr,ur(ei))}function Mr(ei){return ye=r,ft&&U?Rt(ei):(U=J=r,he)}function Yo(){ye!==r&&PR(ye),Fe=0,U=Ce=J=ye=r}function zs(){return ye===r?he:Mr(P2())}function Qo(){var ei=P2(),wc=Kt(ei);if(U=arguments,J=this,Ce=ei,wc){if(ye===r)return Wt(Ce);if(Ve)return PR(ye),ye=fm(xr,h),Rt(Ce)}return ye===r&&(ye=fm(xr,h)),he}return Qo.cancel=Yo,Qo.flush=zs,Qo}var Cse=pr(function(d,h){return cR(d,1,h)}),Ase=pr(function(d,h,A){return cR(d,ka(h)||0,A)});function Sse(d){return yf(d,ie)}function k2(d,h){if(typeof d!="function"||h!=null&&typeof h!="function")throw new po(o);var A=function(){var U=arguments,J=h?h.apply(this,U):U[0],se=A.cache;if(se.has(J))return se.get(J);var he=d.apply(this,U);return A.cache=se.set(J,he)||se,he};return A.cache=new(k2.Cache||vf),A}k2.Cache=vf;function M2(d){if(typeof d!="function")throw new po(o);return function(){var h=arguments;switch(h.length){case 0:return!d.call(this);case 1:return!d.call(this,h[0]);case 2:return!d.call(this,h[0],h[1]);case 3:return!d.call(this,h[0],h[1],h[2])}return!d.apply(this,h)}}function _se(d){return vO(2,d)}var Ise=hne(function(d,h){h=h.length==1&&nr(h[0])?dn(h[0],Us(Gt())):dn(Wi(h,1),Us(Gt()));var A=h.length;return pr(function(U){for(var J=-1,se=pt(U.length,A);++J=h}),t0=hR(function(){return arguments}())?hR:function(d){return qn(d)&&Hr.call(d,"callee")&&!o2.call(d,"callee")},nr=Pe.isArray,qse=Yn?Us(Yn):Qre;function go(d){return d!=null&&R2(d.length)&&!wf(d)}function Xn(d){return qn(d)&&go(d)}function Vse(d){return d===!0||d===!1||qn(d)&&qs(d)==Z}var Ju=Se||KC,zse=Ho?Us(Ho):Jre;function Hse(d){return qn(d)&&d.nodeType===1&&!um(d)}function Gse(d){if(d==null)return!0;if(go(d)&&(nr(d)||typeof d=="string"||typeof d.splice=="function"||Ju(d)||S1(d)||t0(d)))return!d.length;var h=vs(d);if(h==_e||h==ke)return!d.size;if(lm(d))return!dC(d).length;for(var A in d)if(Hr.call(d,A))return!1;return!0}function Wse(d,h){return om(d,h)}function Kse(d,h,A){A=typeof A=="function"?A:r;var U=A?A(d,h):r;return U===r?om(d,h,r,A):!!U}function FC(d){if(!qn(d))return!1;var h=qs(d);return h==te||h==N||typeof d.message=="string"&&typeof d.name=="string"&&!um(d)}function Yse(d){return typeof d=="number"&&Ae(d)}function wf(d){if(!kn(d))return!1;var h=qs(d);return h==fe||h==Ee||h==G||h==et}function xO(d){return typeof d=="number"&&d==fr(d)}function R2(d){return typeof d=="number"&&d>-1&&d%1==0&&d<=E}function kn(d){var h=typeof d;return d!=null&&(h=="object"||h=="function")}function qn(d){return d!=null&&typeof d=="object"}var EO=js?Us(js):Xre;function Qse(d,h){return d===h||uC(d,h,TC(h))}function Jse(d,h,A){return A=typeof A=="function"?A:r,uC(d,h,TC(h),A)}function Zse(d){return CO(d)&&d!=+d}function Xse(d){if(Bne(d))throw new Jt(s);return pR(d)}function eoe(d){return d===null}function toe(d){return d==null}function CO(d){return typeof d=="number"||qn(d)&&qs(d)==Re}function um(d){if(!qn(d)||qs(d)!=De)return!1;var h=g1(d);if(h===null)return!0;var A=Hr.call(h,"constructor")&&h.constructor;return typeof A=="function"&&A instanceof A&&d1.call(A)==rC}var jC=Go?Us(Go):ene;function roe(d){return xO(d)&&d>=-E&&d<=E}var AO=Vh?Us(Vh):tne;function O2(d){return typeof d=="string"||!nr(d)&&qn(d)&&qs(d)==Ne}function Ko(d){return typeof d=="symbol"||qn(d)&&qs(d)==tt}var S1=uf?Us(uf):rne;function noe(d){return d===r}function ioe(d){return qn(d)&&vs(d)==st}function soe(d){return qn(d)&&qs(d)==nt}var ooe=C2(hC),aoe=C2(function(d,h){return d<=h});function SO(d){if(!d)return[];if(go(d))return O2(d)?ho(d):vo(d);if(Wh&&d[Wh])return ZE(d[Wh]());var h=vs(d),A=h==_e?Zy:h==ke?uo:_1;return A(d)}function xf(d){if(!d)return d===0?d:0;if(d=ka(d),d===B||d===-B){var h=d<0?-1:1;return h*x}return d===d?d:0}function fr(d){var h=xf(d),A=h%1;return h===h?A?h-A:h:0}function _O(d){return d?Jh(fr(d),0,T):0}function ka(d){if(typeof d=="number")return d;if(Ko(d))return w;if(kn(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=kn(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=Yx(d);var A=bi.test(d);return A||xi.test(d)?tr(d.slice(2),A?2:8):kr.test(d)?w:+d}function IO(d){return fl(d,yo(d))}function coe(d){return d?Jh(fr(d),-E,E):d===0?d:0}function Yr(d){return d==null?"":Wo(d)}var loe=E1(function(d,h){if(lm(h)||go(h)){fl(h,Pi(h),d);return}for(var A in h)Hr.call(h,A)&&nm(d,A,h[A])}),TO=E1(function(d,h){fl(h,yo(h),d)}),D2=E1(function(d,h,A,U){fl(h,yo(h),d,U)}),foe=E1(function(d,h,A,U){fl(h,Pi(h),d,U)}),uoe=mf(oC);function doe(d,h){var A=x1(d);return h==null?A:oR(A,h)}var hoe=pr(function(d,h){d=tn(d);var A=-1,U=h.length,J=U>2?h[2]:r;for(J&&Vs(h[0],h[1],J)&&(U=1);++A1),se}),fl(d,_C(d),A),U&&(A=Ia(A,u|p|g,Ane));for(var J=h.length;J--;)mC(A,h[J]);return A});function Moe(d,h){return kO(d,M2(Gt(h)))}var Roe=mf(function(d,h){return d==null?{}:sne(d,h)});function kO(d,h){if(d==null)return{};var A=dn(_C(d),function(U){return[U]});return h=Gt(h),xR(d,A,function(U,J){return h(U,J[0])})}function Ooe(d,h,A){h=Yu(h,d);var U=-1,J=h.length;for(J||(J=1,d=r);++Uh){var U=d;d=h,h=U}if(A||d%1||h%1){var J=un();return pt(d+J*(h-d+zr("1e-"+((J+"").length-1))),h)}return vC(d,h)}var zoe=C1(function(d,h,A){return h=h.toLowerCase(),d+(A?OO(h):h)});function OO(d){return qC(Yr(d).toLowerCase())}function DO(d){return d=Yr(d),d&&d.replace(Sn,WE).replace(zy,"")}function Hoe(d,h,A){d=Yr(d),h=Wo(h);var U=d.length;A=A===r?U:Jh(fr(A),0,U);var J=A;return A-=h.length,A>=0&&d.slice(A,J)==h}function Goe(d){return d=Yr(d),d&&Nt.test(d)?d.replace(kt,KE):d}function Woe(d){return d=Yr(d),d&&Et.test(d)?d.replace(ht,"\\$&"):d}var Koe=C1(function(d,h,A){return d+(A?"-":"")+h.toLowerCase()}),Yoe=C1(function(d,h,A){return d+(A?" ":"")+h.toLowerCase()}),Qoe=LR("toLowerCase");function Joe(d,h,A){d=Yr(d),h=fr(h);var U=h?df(d):0;if(!h||U>=h)return d;var J=(h-U)/2;return E2(pe(J),A)+d+E2(ae(J),A)}function Zoe(d,h,A){d=Yr(d),h=fr(h);var U=h?df(d):0;return h&&U>>0,A?(d=Yr(d),d&&(typeof h=="string"||h!=null&&!jC(h))&&(h=Wo(h),!h&&zu(d))?Qu(ho(d),0,A):d.split(h,A)):[]}var sae=C1(function(d,h,A){return d+(A?" ":"")+qC(h)});function oae(d,h,A){return d=Yr(d),A=A==null?0:Jh(fr(A),0,d.length),h=Wo(h),d.slice(A,A+h.length)==h}function aae(d,h,A){var U=ne.templateSettings;A&&Vs(d,h,A)&&(h=r),d=Yr(d),h=D2({},h,U,zR);var J=D2({},h.imports,U.imports,zR),se=Pi(J),he=Hh(J,se),ye,Ce,Fe=0,je=h.interpolate||di,Ve="__p += '",ft=tm((h.escape||di).source+"|"+je.source+"|"+(je===Mt?Sr:di).source+"|"+(h.evaluate||di).source+"|$","g"),Rt="//# sourceURL="+(Hr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zo+"]")+` `;d.replace(ft,function(Kt,xr,Mr,Yo,zs,Qo){return Mr||(Mr=Yo),Ve+=d.slice(Fe,Qo).replace(Fs,YE),xr&&(ye=!0,Ve+=`' + __e(`+xr+`) + '`),zs&&(Ce=!0,Ve+=`'; @@ -945,12 +945,12 @@ __p += '`),Mr&&(Ve+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Ve+`return __p -}`;var ur=BO(function(){return Nr(se,Rt+"return "+Ve).apply(r,he)});if(ur.source=Ve,FC(ur))throw ur;return ur}function cae(d){return Yr(d).toLowerCase()}function lae(d){return Yr(d).toUpperCase()}function fae(d,h,A){if(d=Yr(d),d&&(A||h===r))return Yx(d);if(!d||!(h=Wo(h)))return d;var U=ho(d),J=ho(h),se=Vu(U,J),he=Qx(U,J)+1;return Qu(U,se,he).join("")}function uae(d,h,A){if(d=Yr(d),d&&(A||h===r))return d.slice(0,em(d)+1);if(!d||!(h=Wo(h)))return d;var U=ho(d),J=Qx(U,ho(h))+1;return Qu(U,0,J).join("")}function dae(d,h,A){if(d=Yr(d),d&&(A||h===r))return d.replace(Bt,"");if(!d||!(h=Wo(h)))return d;var U=ho(d),J=Vu(U,ho(h));return Qu(U,J).join("")}function hae(d,h){var A=ce,U=K;if(kn(h)){var J="separator"in h?h.separator:J;A="length"in h?fr(h.length):A,U="omission"in h?Wo(h.omission):U}d=Yr(d);var se=d.length;if(zu(d)){var he=ho(d);se=he.length}if(A>=se)return d;var ye=A-df(U);if(ye<1)return U;var Ce=he?Qu(he,0,ye).join(""):d.slice(0,ye);if(J===r)return Ce+U;if(he&&(ye+=Ce.length-ye),jC(J)){if(d.slice(ye).search(J)){var Fe,je=Ce;for(J.global||(J=tm(J.source,Yr(er.exec(J))+"g")),J.lastIndex=0;Fe=J.exec(je);)var Ve=Fe.index;Ce=Ce.slice(0,Ve===r?ye:Ve)}}else if(d.indexOf(Wo(J),ye)!=ye){var ft=Ce.lastIndexOf(J);ft>-1&&(Ce=Ce.slice(0,ft))}return Ce+U}function pae(d){return d=Yr(d),d&&Dt.test(d)?d.replace(rr,Zx):d}var vae=C1(function(d,h,A){return d+(A?" ":"")+h.toUpperCase()}),qC=LR("toUpperCase");function NO(d,h,A){return d=Yr(d),h=A?r:h,h===r?JE(d)?t2(d):qE(d):d.match(h)||[]}var BO=pr(function(d,h){try{return Qn(d,r,h)}catch(A){return FC(A)?A:new Jt(A)}}),gae=mf(function(d,h){return fo(h,function(A){A=ul(A),gf(d,A,BC(d[A],d))}),d});function yae(d){var h=d==null?0:d.length,A=Gt();return d=h?dn(d,function(U){if(typeof U[1]!="function")throw new po(o);return[A(U[0]),U[1]]}):[],pr(function(U){for(var J=-1;++JE)return[];var A=T,U=pt(d,T);h=Gt(h),d-=T;for(var J=Jy(U,h);++A0||h<0)?new _r(A):(d<0?A=A.takeRight(-d):d&&(A=A.drop(d)),h!==r&&(h=fr(h),A=h<0?A.dropRight(-h):A.take(h-d)),A)},_r.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},_r.prototype.toArray=function(){return this.take(T)},ll(_r.prototype,function(d,h){var A=/^(?:filter|find|map|reject)|While$/.test(h),U=/^(?:head|last)$/.test(h),J=ne[U?"take"+(h=="last"?"Right":""):h],se=U||/^find/.test(h);J&&(ne.prototype[h]=function(){var he=this.__wrapped__,ye=U?[1]:arguments,Ce=he instanceof _r,Fe=ye[0],je=Ce||nr(he),Ve=function(xr){var Mr=J.apply(ne,ol([xr],ye));return U&&ft?Mr[0]:Mr};je&&A&&typeof Fe=="function"&&Fe.length!=1&&(Ce=je=!1);var ft=this.__chain__,Rt=!!this.__actions__.length,Wt=se&&!ft,ur=Ce&&!Rt;if(!se&&je){he=ur?he:new _r(this);var Kt=d.apply(he,ye);return Kt.__actions__.push({func:I2,args:[Ve],thisArg:r}),new _a(Kt,ft)}return Wt&&ur?d.apply(this,ye):(Kt=this.thru(Ve),Wt?U?Kt.value()[0]:Kt.value():Kt)})}),fo(["pop","push","shift","sort","splice","unshift"],function(d){var h=f1[d],A=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",U=/^(?:pop|shift)$/.test(d);ne.prototype[d]=function(){var J=arguments;if(U&&!this.__chain__){var se=this.value();return h.apply(nr(se)?se:[],J)}return this[A](function(he){return h.apply(nr(he)?he:[],J)})}}),ll(_r.prototype,function(d,h){var A=ne[h];if(A){var U=A.name+"";Hr.call(hf,U)||(hf[U]=[]),hf[U].push({name:h,func:A})}}),hf[w2(r,C).name]=[{name:"wrapper",func:r}],_r.prototype.clone=pre,_r.prototype.reverse=vre,_r.prototype.value=gre,ne.prototype.at=Hie,ne.prototype.chain=Gie,ne.prototype.commit=Wie,ne.prototype.next=Kie,ne.prototype.plant=Qie,ne.prototype.reverse=Jie,ne.prototype.toJSON=ne.prototype.valueOf=ne.prototype.value=Zie,ne.prototype.first=ne.prototype.head,Wh&&(ne.prototype[Wh]=Yie),ne},Hu=r2();Pn?((Pn.exports=Hu)._=Hu,en._=Hu):wr._=Hu}).call(Si)})(h4,h4.exports);var IBe=h4.exports,xI={exports:{}};(function(t,e){var r=typeof self<"u"?self:Si,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(v){return v&&DataView.prototype.isPrototypeOf(v)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(v){return v&&l.indexOf(Object.prototype.toString.call(v))>-1};function u(v){if(typeof v!="string"&&(v=String(v)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(v))throw new TypeError("Invalid character in header field name");return v.toLowerCase()}function p(v){return typeof v!="string"&&(v=String(v)),v}function g(v){var m={next:function(){var R=v.shift();return{done:R===void 0,value:R}}};return a.iterable&&(m[Symbol.iterator]=function(){return m}),m}function y(v){this.map={},v instanceof y?v.forEach(function(m,R){this.append(R,m)},this):Array.isArray(v)?v.forEach(function(m){this.append(m[0],m[1])},this):v&&Object.getOwnPropertyNames(v).forEach(function(m){this.append(m,v[m])},this)}y.prototype.append=function(v,m){v=u(v),m=p(m);var R=this.map[v];this.map[v]=R?R+", "+m:m},y.prototype.delete=function(v){delete this.map[u(v)]},y.prototype.get=function(v){return v=u(v),this.has(v)?this.map[v]:null},y.prototype.has=function(v){return this.map.hasOwnProperty(u(v))},y.prototype.set=function(v,m){this.map[u(v)]=p(m)},y.prototype.forEach=function(v,m){for(var R in this.map)this.map.hasOwnProperty(R)&&v.call(m,this.map[R],R,this)},y.prototype.keys=function(){var v=[];return this.forEach(function(m,R){v.push(R)}),g(v)},y.prototype.values=function(){var v=[];return this.forEach(function(m){v.push(m)}),g(v)},y.prototype.entries=function(){var v=[];return this.forEach(function(m,R){v.push([R,m])}),g(v)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function b(v){if(v.bodyUsed)return Promise.reject(new TypeError("Already read"));v.bodyUsed=!0}function I(v){return new Promise(function(m,R){v.onload=function(){m(v.result)},v.onerror=function(){R(v.error)}})}function C(v){var m=new FileReader,R=I(m);return m.readAsArrayBuffer(v),R}function S(v){var m=new FileReader,R=I(m);return m.readAsText(v),R}function O(v){for(var m=new Uint8Array(v),R=new Array(m.length),B=0;B-1?m:v}function $(v,m){m=m||{};var R=m.body;if(v instanceof $){if(v.bodyUsed)throw new TypeError("Already read");this.url=v.url,this.credentials=v.credentials,m.headers||(this.headers=new y(v.headers)),this.method=v.method,this.mode=v.mode,this.signal=v.signal,!R&&v._bodyInit!=null&&(R=v._bodyInit,v.bodyUsed=!0)}else this.url=String(v);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new y(m.headers)),this.method=_(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&R)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(R)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function ie(v){var m=new FormData;return v.trim().split("&").forEach(function(R){if(R){var B=R.split("="),E=B.shift().replace(/\+/g," "),x=B.join("=").replace(/\+/g," ");m.append(decodeURIComponent(E),decodeURIComponent(x))}}),m}function ce(v){var m=new y,R=v.replace(/\r?\n[\t ]+/g," ");return R.split(/\r?\n/).forEach(function(B){var E=B.split(":"),x=E.shift().trim();if(x){var w=E.join(":").trim();m.append(x,w)}}),m}F.call($.prototype);function K(v,m){m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in m?m.statusText:"OK",this.headers=new y(m.headers),this.url=m.url||"",this._initBody(v)}F.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},K.error=function(){var v=new K(null,{status:0,statusText:""});return v.type="error",v};var P=[301,302,303,307,308];K.redirect=function(v,m){if(P.indexOf(m)===-1)throw new RangeError("Invalid status code");return new K(null,{status:m,headers:{location:v}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(m,R){this.message=m,this.name=R;var B=Error(m);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function M(v,m){return new Promise(function(R,B){var E=new $(v,m);if(E.signal&&E.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function w(){x.abort()}x.onload=function(){var T={status:x.status,statusText:x.statusText,headers:ce(x.getAllResponseHeaders()||"")};T.url="responseURL"in x?x.responseURL:T.headers.get("X-Request-URL");var k="response"in x?x.response:x.responseText;R(new K(k,T))},x.onerror=function(){B(new TypeError("Network request failed"))},x.ontimeout=function(){B(new TypeError("Network request failed"))},x.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},x.open(E.method,E.url,!0),E.credentials==="include"?x.withCredentials=!0:E.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&a.blob&&(x.responseType="blob"),E.headers.forEach(function(T,k){x.setRequestHeader(k,T)}),E.signal&&(E.signal.addEventListener("abort",w),x.onreadystatechange=function(){x.readyState===4&&E.signal.removeEventListener("abort",w)}),x.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return M.polyfill=!0,s.fetch||(s.fetch=M,s.Headers=y,s.Request=$,s.Response=K),o.Headers=y,o.Request=$,o.Response=K,o.fetch=M,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(xI,xI.exports);var TBe=xI.exports;const o$=_u(TBe);var PBe=Object.defineProperty,kBe=Object.defineProperties,MBe=Object.getOwnPropertyDescriptors,a$=Object.getOwnPropertySymbols,RBe=Object.prototype.hasOwnProperty,OBe=Object.prototype.propertyIsEnumerable,c$=(t,e,r)=>e in t?PBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l$=(t,e)=>{for(var r in e||(e={}))RBe.call(e,r)&&c$(t,r,e[r]);if(a$)for(var r of a$(e))OBe.call(e,r)&&c$(t,r,e[r]);return t},f$=(t,e)=>kBe(t,MBe(e));const DBe={Accept:"application/json","Content-Type":"application/json"},NBe="POST",u$={headers:DBe,method:NBe},d$=10;let rl=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new ba.EventEmitter,this.isAvailable=!1,this.registering=!1,!RU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Su(e),n=await(await o$(this.url,f$(l$({},u$),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!RU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Su({id:1,jsonrpc:"2.0",method:"test",params:[]});await o$(e,f$(l$({},u$),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Lp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=PE(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return rte(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>d$&&this.events.setMaxListeners(d$)}};const h$="error",BBe="wss://relay.walletconnect.org",LBe="wc",FBe="universal_provider",p$=`${LBe}@2:${FBe}:`,_te="https://rpc.walletconnect.org/v1/",W1="generic",jBe=`${_te}bundler`,hc={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var UBe=Object.defineProperty,$Be=Object.defineProperties,qBe=Object.getOwnPropertyDescriptors,v$=Object.getOwnPropertySymbols,VBe=Object.prototype.hasOwnProperty,zBe=Object.prototype.propertyIsEnumerable,g$=(t,e,r)=>e in t?UBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D6=(t,e)=>{for(var r in e||(e={}))VBe.call(e,r)&&g$(t,r,e[r]);if(v$)for(var r of v$(e))zBe.call(e,r)&&g$(t,r,e[r]);return t},HBe=(t,e)=>$Be(t,qBe(e));function va(t,e,r){var n;const i=Vv(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${_te}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function t1(t){return t.includes(":")?t.split(":")[1]:t}function Ite(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function GBe(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function nS(t={},e={}){const r=y$(t),n=y$(e);return IBe.merge(r,n)}function y$(t){var e,r,n,i;const s={};if(!Rw(t))return s;for(const[o,a]of Object.entries(t)){const c=$M(o)?[o]:a.chains,l=a.methods||[],f=a.events||[],u=a.rpcMap||{},p=lb(o);s[p]=HBe(D6(D6({},s[p]),a),{chains:R3(c,(e=s[p])==null?void 0:e.chains),methods:R3(l,(r=s[p])==null?void 0:r.methods),events:R3(f,(n=s[p])==null?void 0:n.events),rpcMap:D6(D6({},u),(i=s[p])==null?void 0:i.rpcMap)})}return s}function WBe(t){return t.includes(":")?t.split(":")[2]:t}function m$(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=$M(r)?[r]:n.chains?n.chains:Ite(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function iS(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const Tte={},Vr=t=>Tte[t],sS=(t,e)=>{Tte[t]=e};class KBe{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}var YBe=Object.defineProperty,QBe=Object.defineProperties,JBe=Object.getOwnPropertyDescriptors,b$=Object.getOwnPropertySymbols,ZBe=Object.prototype.hasOwnProperty,XBe=Object.prototype.propertyIsEnumerable,w$=(t,e,r)=>e in t?YBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x$=(t,e)=>{for(var r in e||(e={}))ZBe.call(e,r)&&w$(t,r,e[r]);if(b$)for(var r of b$(e))XBe.call(e,r)&&w$(t,r,e[r]);return t},E$=(t,e)=>QBe(t,JBe(e));class eLe{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||va(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(t1(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const c=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:E$(x$({},o.sessionProperties||{}),{capabilities:E$(x$({},a||{}),{[s]:c})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return c}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ud("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${jBe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class tLe{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class rLe{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}let nLe=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||va(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new dc(new rl(n,Vr("disableProviderPing")))}};class iLe{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=t1(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class sLe{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class oLe{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class aLe{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||va(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace);return typeof n>"u"?void 0:new dc(new rl(n,Vr("disableProviderPing")))}}class cLe{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||va(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace);return typeof n>"u"?void 0:new dc(new rl(n))}}class lLe{constructor(e){this.name=W1,this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Vv(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}var fLe=Object.defineProperty,uLe=Object.defineProperties,dLe=Object.getOwnPropertyDescriptors,C$=Object.getOwnPropertySymbols,hLe=Object.prototype.hasOwnProperty,pLe=Object.prototype.propertyIsEnumerable,A$=(t,e,r)=>e in t?fLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))hLe.call(e,r)&&A$(t,r,e[r]);if(C$)for(var r of C$(e))pLe.call(e,r)&&A$(t,r,e[r]);return t},oS=(t,e)=>uLe(t,dLe(e));let vLe=class Pte{constructor(e){this.events=new yM,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:qx(IE({level:(e==null?void 0:e.logger)||h$})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new Pte(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:N6({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,TE(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:rn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=m$(this.session.namespaces);this.namespaces=nS(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=m$(s.namespaces);this.namespaces=nS(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==Ste)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===W1?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(rf(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await OE.init({core:this.providerOpts.core,logger:this.providerOpts.logger||h$,relayUrl:this.providerOpts.relayUrl||BBe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>lb(r)))];sS("client",this.client),sS("events",this.events),sS("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=GBe(r,this.session),i=Ite(n),s=nS(this.namespaces,this.optionalNamespaces),o=oS(N6({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new eLe({namespace:o});break;case"algorand":this.rpcProviders[r]=new nLe({namespace:o});break;case"solana":this.rpcProviders[r]=new tLe({namespace:o});break;case"cosmos":this.rpcProviders[r]=new rLe({namespace:o});break;case"polkadot":this.rpcProviders[r]=new KBe({namespace:o});break;case"cip34":this.rpcProviders[r]=new iLe({namespace:o});break;case"elrond":this.rpcProviders[r]=new sLe({namespace:o});break;case"multiversx":this.rpcProviders[r]=new oLe({namespace:o});break;case"near":this.rpcProviders[r]=new aLe({namespace:o});break;case"tezos":this.rpcProviders[r]=new cLe({namespace:o});break;default:this.rpcProviders[W1]?this.rpcProviders[W1].updateNamespace(o):this.rpcProviders[W1]=new lLe({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&rf(i)&&this.events.emit("accountsChanged",i.map(WBe))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=lb(i),a=iS(i)!==iS(s)?`${o}:${iS(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=oS(N6({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",oS(N6({},rn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(hc.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[W1]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>lb(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=lb(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${p$}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${p$}/${e}`)}};const gLe=vLe,yLe="wc",mLe="ethereum_provider",bLe=`${yLe}@2:${mLe}:`,wLe="https://rpc.walletconnect.org/v1/",EI=["eth_sendTransaction","personal_sign"],xLe=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],CI=["chainChanged","accountsChanged"],ELe=["chainChanged","accountsChanged","message","disconnect","connect"];var CLe=Object.defineProperty,ALe=Object.defineProperties,SLe=Object.getOwnPropertyDescriptors,S$=Object.getOwnPropertySymbols,_Le=Object.prototype.hasOwnProperty,ILe=Object.prototype.propertyIsEnumerable,_$=(t,e,r)=>e in t?CLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K1=(t,e)=>{for(var r in e||(e={}))_Le.call(e,r)&&_$(t,r,e[r]);if(S$)for(var r of S$(e))ILe.call(e,r)&&_$(t,r,e[r]);return t},aS=(t,e)=>ALe(t,SLe(e));function p4(t){return Number(t[0].split(":")[1])}function B6(t){return`0x${t.toString(16)}`}function TLe(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=t;if(!rf(e))throw new Error("Invalid chains");const c={chains:e,methods:n||EI,events:s||CI,rpcMap:K1({},e.length?{[p4(e)]:a[p4(e)]}:{})},l=s==null?void 0:s.filter(g=>!CI.includes(g)),f=n==null?void 0:n.filter(g=>!EI.includes(g));if(!r&&!o&&!i&&!(l!=null&&l.length)&&!(f!=null&&f.length))return{required:e.length?c:void 0};const u=(l==null?void 0:l.length)&&(f==null?void 0:f.length)||!r,p={chains:[...new Set(u?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(i!=null&&i.length?i:xLe))],events:[...new Set(c.events.concat(o!=null&&o.length?o:ELe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?p:void 0}}let PLe=class kte{constructor(){this.events=new ba.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=bLe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new kte;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=TLe(this.rpc);try{const i=await new Promise(async(o,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(aS(K1({namespaces:K1({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{o(l)}).catch(l=>{a(new Error(l.message))})});if(!i)return;const s=Yj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:B6(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,o)=>{var a;this.rpc.showQrModal&&((a=this.modal)==null||a.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(aS(K1({},e),{chains:this.rpc.chains}),r).then(c=>{s(c)}).catch(c=>{o(new Error(c.message))})}),i=n.session;if(i){const s=Yj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:B6(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",B6(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",aS(K1({},rn("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",B6(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],o=i.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=i.length?(e==null?void 0:e.methods)||EI:[],c=i.length?(e==null?void 0:e.events)||CI:[],l=(e==null?void 0:e.optionalMethods)||[],f=(e==null?void 0:e.optionalEvents)||[],u=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),p=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(g=>this.formatChainId(g)),optionalChains:s.map(g=>this.formatChainId(g)),methods:a,events:c,optionalMethods:l,optionalEvents:f,rpcMap:u,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:p,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?p4(this.rpc.chains):p4(this.rpc.optionalChains),this.signer=await gLe.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await R9e(()=>import("./index-BqUc7-Na.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(K1({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&rf(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&rf(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${wLe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var Mte={exports:{}};/*! +}`;var ur=BO(function(){return Nr(se,Rt+"return "+Ve).apply(r,he)});if(ur.source=Ve,FC(ur))throw ur;return ur}function cae(d){return Yr(d).toLowerCase()}function lae(d){return Yr(d).toUpperCase()}function fae(d,h,A){if(d=Yr(d),d&&(A||h===r))return Yx(d);if(!d||!(h=Wo(h)))return d;var U=ho(d),J=ho(h),se=Vu(U,J),he=Qx(U,J)+1;return Qu(U,se,he).join("")}function uae(d,h,A){if(d=Yr(d),d&&(A||h===r))return d.slice(0,em(d)+1);if(!d||!(h=Wo(h)))return d;var U=ho(d),J=Qx(U,ho(h))+1;return Qu(U,0,J).join("")}function dae(d,h,A){if(d=Yr(d),d&&(A||h===r))return d.replace(Bt,"");if(!d||!(h=Wo(h)))return d;var U=ho(d),J=Vu(U,ho(h));return Qu(U,J).join("")}function hae(d,h){var A=ce,U=K;if(kn(h)){var J="separator"in h?h.separator:J;A="length"in h?fr(h.length):A,U="omission"in h?Wo(h.omission):U}d=Yr(d);var se=d.length;if(zu(d)){var he=ho(d);se=he.length}if(A>=se)return d;var ye=A-df(U);if(ye<1)return U;var Ce=he?Qu(he,0,ye).join(""):d.slice(0,ye);if(J===r)return Ce+U;if(he&&(ye+=Ce.length-ye),jC(J)){if(d.slice(ye).search(J)){var Fe,je=Ce;for(J.global||(J=tm(J.source,Yr(er.exec(J))+"g")),J.lastIndex=0;Fe=J.exec(je);)var Ve=Fe.index;Ce=Ce.slice(0,Ve===r?ye:Ve)}}else if(d.indexOf(Wo(J),ye)!=ye){var ft=Ce.lastIndexOf(J);ft>-1&&(Ce=Ce.slice(0,ft))}return Ce+U}function pae(d){return d=Yr(d),d&&Dt.test(d)?d.replace(rr,Zx):d}var vae=C1(function(d,h,A){return d+(A?" ":"")+h.toUpperCase()}),qC=LR("toUpperCase");function NO(d,h,A){return d=Yr(d),h=A?r:h,h===r?JE(d)?t2(d):qE(d):d.match(h)||[]}var BO=pr(function(d,h){try{return Qn(d,r,h)}catch(A){return FC(A)?A:new Jt(A)}}),gae=mf(function(d,h){return fo(h,function(A){A=ul(A),gf(d,A,BC(d[A],d))}),d});function yae(d){var h=d==null?0:d.length,A=Gt();return d=h?dn(d,function(U){if(typeof U[1]!="function")throw new po(o);return[A(U[0]),U[1]]}):[],pr(function(U){for(var J=-1;++JE)return[];var A=T,U=pt(d,T);h=Gt(h),d-=T;for(var J=Jy(U,h);++A0||h<0)?new _r(A):(d<0?A=A.takeRight(-d):d&&(A=A.drop(d)),h!==r&&(h=fr(h),A=h<0?A.dropRight(-h):A.take(h-d)),A)},_r.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},_r.prototype.toArray=function(){return this.take(T)},ll(_r.prototype,function(d,h){var A=/^(?:filter|find|map|reject)|While$/.test(h),U=/^(?:head|last)$/.test(h),J=ne[U?"take"+(h=="last"?"Right":""):h],se=U||/^find/.test(h);J&&(ne.prototype[h]=function(){var he=this.__wrapped__,ye=U?[1]:arguments,Ce=he instanceof _r,Fe=ye[0],je=Ce||nr(he),Ve=function(xr){var Mr=J.apply(ne,ol([xr],ye));return U&&ft?Mr[0]:Mr};je&&A&&typeof Fe=="function"&&Fe.length!=1&&(Ce=je=!1);var ft=this.__chain__,Rt=!!this.__actions__.length,Wt=se&&!ft,ur=Ce&&!Rt;if(!se&&je){he=ur?he:new _r(this);var Kt=d.apply(he,ye);return Kt.__actions__.push({func:I2,args:[Ve],thisArg:r}),new _a(Kt,ft)}return Wt&&ur?d.apply(this,ye):(Kt=this.thru(Ve),Wt?U?Kt.value()[0]:Kt.value():Kt)})}),fo(["pop","push","shift","sort","splice","unshift"],function(d){var h=f1[d],A=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",U=/^(?:pop|shift)$/.test(d);ne.prototype[d]=function(){var J=arguments;if(U&&!this.__chain__){var se=this.value();return h.apply(nr(se)?se:[],J)}return this[A](function(he){return h.apply(nr(he)?he:[],J)})}}),ll(_r.prototype,function(d,h){var A=ne[h];if(A){var U=A.name+"";Hr.call(hf,U)||(hf[U]=[]),hf[U].push({name:h,func:A})}}),hf[w2(r,C).name]=[{name:"wrapper",func:r}],_r.prototype.clone=pre,_r.prototype.reverse=vre,_r.prototype.value=gre,ne.prototype.at=Hie,ne.prototype.chain=Gie,ne.prototype.commit=Wie,ne.prototype.next=Kie,ne.prototype.plant=Qie,ne.prototype.reverse=Jie,ne.prototype.toJSON=ne.prototype.valueOf=ne.prototype.value=Zie,ne.prototype.first=ne.prototype.head,Wh&&(ne.prototype[Wh]=Yie),ne},Hu=r2();Pn?((Pn.exports=Hu)._=Hu,en._=Hu):wr._=Hu}).call(Si)})(h4,h4.exports);var IBe=h4.exports,xI={exports:{}};(function(t,e){var r=typeof self<"u"?self:Si,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(v){return v&&DataView.prototype.isPrototypeOf(v)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(v){return v&&l.indexOf(Object.prototype.toString.call(v))>-1};function u(v){if(typeof v!="string"&&(v=String(v)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(v))throw new TypeError("Invalid character in header field name");return v.toLowerCase()}function p(v){return typeof v!="string"&&(v=String(v)),v}function g(v){var m={next:function(){var R=v.shift();return{done:R===void 0,value:R}}};return a.iterable&&(m[Symbol.iterator]=function(){return m}),m}function y(v){this.map={},v instanceof y?v.forEach(function(m,R){this.append(R,m)},this):Array.isArray(v)?v.forEach(function(m){this.append(m[0],m[1])},this):v&&Object.getOwnPropertyNames(v).forEach(function(m){this.append(m,v[m])},this)}y.prototype.append=function(v,m){v=u(v),m=p(m);var R=this.map[v];this.map[v]=R?R+", "+m:m},y.prototype.delete=function(v){delete this.map[u(v)]},y.prototype.get=function(v){return v=u(v),this.has(v)?this.map[v]:null},y.prototype.has=function(v){return this.map.hasOwnProperty(u(v))},y.prototype.set=function(v,m){this.map[u(v)]=p(m)},y.prototype.forEach=function(v,m){for(var R in this.map)this.map.hasOwnProperty(R)&&v.call(m,this.map[R],R,this)},y.prototype.keys=function(){var v=[];return this.forEach(function(m,R){v.push(R)}),g(v)},y.prototype.values=function(){var v=[];return this.forEach(function(m){v.push(m)}),g(v)},y.prototype.entries=function(){var v=[];return this.forEach(function(m,R){v.push([R,m])}),g(v)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function b(v){if(v.bodyUsed)return Promise.reject(new TypeError("Already read"));v.bodyUsed=!0}function I(v){return new Promise(function(m,R){v.onload=function(){m(v.result)},v.onerror=function(){R(v.error)}})}function C(v){var m=new FileReader,R=I(m);return m.readAsArrayBuffer(v),R}function S(v){var m=new FileReader,R=I(m);return m.readAsText(v),R}function O(v){for(var m=new Uint8Array(v),R=new Array(m.length),B=0;B-1?m:v}function $(v,m){m=m||{};var R=m.body;if(v instanceof $){if(v.bodyUsed)throw new TypeError("Already read");this.url=v.url,this.credentials=v.credentials,m.headers||(this.headers=new y(v.headers)),this.method=v.method,this.mode=v.mode,this.signal=v.signal,!R&&v._bodyInit!=null&&(R=v._bodyInit,v.bodyUsed=!0)}else this.url=String(v);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new y(m.headers)),this.method=_(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&R)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(R)}$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function ie(v){var m=new FormData;return v.trim().split("&").forEach(function(R){if(R){var B=R.split("="),E=B.shift().replace(/\+/g," "),x=B.join("=").replace(/\+/g," ");m.append(decodeURIComponent(E),decodeURIComponent(x))}}),m}function ce(v){var m=new y,R=v.replace(/\r?\n[\t ]+/g," ");return R.split(/\r?\n/).forEach(function(B){var E=B.split(":"),x=E.shift().trim();if(x){var w=E.join(":").trim();m.append(x,w)}}),m}F.call($.prototype);function K(v,m){m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in m?m.statusText:"OK",this.headers=new y(m.headers),this.url=m.url||"",this._initBody(v)}F.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},K.error=function(){var v=new K(null,{status:0,statusText:""});return v.type="error",v};var P=[301,302,303,307,308];K.redirect=function(v,m){if(P.indexOf(m)===-1)throw new RangeError("Invalid status code");return new K(null,{status:m,headers:{location:v}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(m,R){this.message=m,this.name=R;var B=Error(m);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function M(v,m){return new Promise(function(R,B){var E=new $(v,m);if(E.signal&&E.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function w(){x.abort()}x.onload=function(){var T={status:x.status,statusText:x.statusText,headers:ce(x.getAllResponseHeaders()||"")};T.url="responseURL"in x?x.responseURL:T.headers.get("X-Request-URL");var k="response"in x?x.response:x.responseText;R(new K(k,T))},x.onerror=function(){B(new TypeError("Network request failed"))},x.ontimeout=function(){B(new TypeError("Network request failed"))},x.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},x.open(E.method,E.url,!0),E.credentials==="include"?x.withCredentials=!0:E.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&a.blob&&(x.responseType="blob"),E.headers.forEach(function(T,k){x.setRequestHeader(k,T)}),E.signal&&(E.signal.addEventListener("abort",w),x.onreadystatechange=function(){x.readyState===4&&E.signal.removeEventListener("abort",w)}),x.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return M.polyfill=!0,s.fetch||(s.fetch=M,s.Headers=y,s.Request=$,s.Response=K),o.Headers=y,o.Request=$,o.Response=K,o.fetch=M,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(xI,xI.exports);var TBe=xI.exports;const o$=_u(TBe);var PBe=Object.defineProperty,kBe=Object.defineProperties,MBe=Object.getOwnPropertyDescriptors,a$=Object.getOwnPropertySymbols,RBe=Object.prototype.hasOwnProperty,OBe=Object.prototype.propertyIsEnumerable,c$=(t,e,r)=>e in t?PBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l$=(t,e)=>{for(var r in e||(e={}))RBe.call(e,r)&&c$(t,r,e[r]);if(a$)for(var r of a$(e))OBe.call(e,r)&&c$(t,r,e[r]);return t},f$=(t,e)=>kBe(t,MBe(e));const DBe={Accept:"application/json","Content-Type":"application/json"},NBe="POST",u$={headers:DBe,method:NBe},d$=10;let rl=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new ba.EventEmitter,this.isAvailable=!1,this.registering=!1,!RU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=Su(e),n=await(await o$(this.url,f$(l$({},u$),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!RU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Su({id:1,jsonrpc:"2.0",method:"test",params:[]});await o$(e,f$(l$({},u$),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Lp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=PE(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return rte(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>d$&&this.events.setMaxListeners(d$)}};const h$="error",BBe="wss://relay.walletconnect.org",LBe="wc",FBe="universal_provider",p$=`${LBe}@2:${FBe}:`,_te="https://rpc.walletconnect.org/v1/",W1="generic",jBe=`${_te}bundler`,hc={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var UBe=Object.defineProperty,$Be=Object.defineProperties,qBe=Object.getOwnPropertyDescriptors,v$=Object.getOwnPropertySymbols,VBe=Object.prototype.hasOwnProperty,zBe=Object.prototype.propertyIsEnumerable,g$=(t,e,r)=>e in t?UBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D6=(t,e)=>{for(var r in e||(e={}))VBe.call(e,r)&&g$(t,r,e[r]);if(v$)for(var r of v$(e))zBe.call(e,r)&&g$(t,r,e[r]);return t},HBe=(t,e)=>$Be(t,qBe(e));function va(t,e,r){var n;const i=Vv(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${_te}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function t1(t){return t.includes(":")?t.split(":")[1]:t}function Ite(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function GBe(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function nS(t={},e={}){const r=y$(t),n=y$(e);return IBe.merge(r,n)}function y$(t){var e,r,n,i;const s={};if(!Rw(t))return s;for(const[o,a]of Object.entries(t)){const c=$M(o)?[o]:a.chains,l=a.methods||[],f=a.events||[],u=a.rpcMap||{},p=lb(o);s[p]=HBe(D6(D6({},s[p]),a),{chains:R3(c,(e=s[p])==null?void 0:e.chains),methods:R3(l,(r=s[p])==null?void 0:r.methods),events:R3(f,(n=s[p])==null?void 0:n.events),rpcMap:D6(D6({},u),(i=s[p])==null?void 0:i.rpcMap)})}return s}function WBe(t){return t.includes(":")?t.split(":")[2]:t}function m$(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=$M(r)?[r]:n.chains?n.chains:Ite(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function iS(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const Tte={},Vr=t=>Tte[t],sS=(t,e)=>{Tte[t]=e};class KBe{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}var YBe=Object.defineProperty,QBe=Object.defineProperties,JBe=Object.getOwnPropertyDescriptors,b$=Object.getOwnPropertySymbols,ZBe=Object.prototype.hasOwnProperty,XBe=Object.prototype.propertyIsEnumerable,w$=(t,e,r)=>e in t?YBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x$=(t,e)=>{for(var r in e||(e={}))ZBe.call(e,r)&&w$(t,r,e[r]);if(b$)for(var r of b$(e))XBe.call(e,r)&&w$(t,r,e[r]);return t},E$=(t,e)=>QBe(t,JBe(e));class eLe{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||va(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(t1(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const c=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:E$(x$({},o.sessionProperties||{}),{capabilities:E$(x$({},a||{}),{[s]:c})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return c}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ud("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${jBe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class tLe{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class rLe{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}let nLe=class{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||va(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new dc(new rl(n,Vr("disableProviderPing")))}};class iLe{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=t1(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class sLe{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class oLe{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=t1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}class aLe{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||va(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace);return typeof n>"u"?void 0:new dc(new rl(n,Vr("disableProviderPing")))}}class cLe{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||va(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace);return typeof n>"u"?void 0:new dc(new rl(n))}}class lLe{constructor(e){this.name=W1,this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(hc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Vv(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||va(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new dc(new rl(n,Vr("disableProviderPing")))}}var fLe=Object.defineProperty,uLe=Object.defineProperties,dLe=Object.getOwnPropertyDescriptors,C$=Object.getOwnPropertySymbols,hLe=Object.prototype.hasOwnProperty,pLe=Object.prototype.propertyIsEnumerable,A$=(t,e,r)=>e in t?fLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,N6=(t,e)=>{for(var r in e||(e={}))hLe.call(e,r)&&A$(t,r,e[r]);if(C$)for(var r of C$(e))pLe.call(e,r)&&A$(t,r,e[r]);return t},oS=(t,e)=>uLe(t,dLe(e));let vLe=class Pte{constructor(e){this.events=new yM,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:qx(IE({level:(e==null?void 0:e.logger)||h$})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new Pte(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:N6({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,TE(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:rn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=m$(this.session.namespaces);this.namespaces=nS(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=m$(s.namespaces);this.namespaces=nS(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==Ste)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===W1?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(rf(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await OE.init({core:this.providerOpts.core,logger:this.providerOpts.logger||h$,relayUrl:this.providerOpts.relayUrl||BBe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>lb(r)))];sS("client",this.client),sS("events",this.events),sS("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=GBe(r,this.session),i=Ite(n),s=nS(this.namespaces,this.optionalNamespaces),o=oS(N6({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new eLe({namespace:o});break;case"algorand":this.rpcProviders[r]=new nLe({namespace:o});break;case"solana":this.rpcProviders[r]=new tLe({namespace:o});break;case"cosmos":this.rpcProviders[r]=new rLe({namespace:o});break;case"polkadot":this.rpcProviders[r]=new KBe({namespace:o});break;case"cip34":this.rpcProviders[r]=new iLe({namespace:o});break;case"elrond":this.rpcProviders[r]=new sLe({namespace:o});break;case"multiversx":this.rpcProviders[r]=new oLe({namespace:o});break;case"near":this.rpcProviders[r]=new aLe({namespace:o});break;case"tezos":this.rpcProviders[r]=new cLe({namespace:o});break;default:this.rpcProviders[W1]?this.rpcProviders[W1].updateNamespace(o):this.rpcProviders[W1]=new lLe({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&rf(i)&&this.events.emit("accountsChanged",i.map(WBe))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=lb(i),a=iS(i)!==iS(s)?`${o}:${iS(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=oS(N6({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",oS(N6({},rn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(hc.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[W1]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>lb(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=lb(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${p$}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${p$}/${e}`)}};const gLe=vLe,yLe="wc",mLe="ethereum_provider",bLe=`${yLe}@2:${mLe}:`,wLe="https://rpc.walletconnect.org/v1/",EI=["eth_sendTransaction","personal_sign"],xLe=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],CI=["chainChanged","accountsChanged"],ELe=["chainChanged","accountsChanged","message","disconnect","connect"];var CLe=Object.defineProperty,ALe=Object.defineProperties,SLe=Object.getOwnPropertyDescriptors,S$=Object.getOwnPropertySymbols,_Le=Object.prototype.hasOwnProperty,ILe=Object.prototype.propertyIsEnumerable,_$=(t,e,r)=>e in t?CLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K1=(t,e)=>{for(var r in e||(e={}))_Le.call(e,r)&&_$(t,r,e[r]);if(S$)for(var r of S$(e))ILe.call(e,r)&&_$(t,r,e[r]);return t},aS=(t,e)=>ALe(t,SLe(e));function p4(t){return Number(t[0].split(":")[1])}function B6(t){return`0x${t.toString(16)}`}function TLe(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=t;if(!rf(e))throw new Error("Invalid chains");const c={chains:e,methods:n||EI,events:s||CI,rpcMap:K1({},e.length?{[p4(e)]:a[p4(e)]}:{})},l=s==null?void 0:s.filter(g=>!CI.includes(g)),f=n==null?void 0:n.filter(g=>!EI.includes(g));if(!r&&!o&&!i&&!(l!=null&&l.length)&&!(f!=null&&f.length))return{required:e.length?c:void 0};const u=(l==null?void 0:l.length)&&(f==null?void 0:f.length)||!r,p={chains:[...new Set(u?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(i!=null&&i.length?i:xLe))],events:[...new Set(c.events.concat(o!=null&&o.length?o:ELe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?p:void 0}}let PLe=class kte{constructor(){this.events=new ba.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=bLe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new kte;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=TLe(this.rpc);try{const i=await new Promise(async(o,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(aS(K1({namespaces:K1({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{o(l)}).catch(l=>{a(new Error(l.message))})});if(!i)return;const s=Yj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:B6(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,o)=>{var a;this.rpc.showQrModal&&((a=this.modal)==null||a.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(aS(K1({},e),{chains:this.rpc.chains}),r).then(c=>{s(c)}).catch(c=>{o(new Error(c.message))})}),i=n.session;if(i){const s=Yj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:B6(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",B6(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",aS(K1({},rn("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",B6(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],o=i.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=i.length?(e==null?void 0:e.methods)||EI:[],c=i.length?(e==null?void 0:e.events)||CI:[],l=(e==null?void 0:e.optionalMethods)||[],f=(e==null?void 0:e.optionalEvents)||[],u=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),p=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(g=>this.formatChainId(g)),optionalChains:s.map(g=>this.formatChainId(g)),methods:a,events:c,optionalMethods:l,optionalEvents:f,rpcMap:u,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:p,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?p4(this.rpc.chains):p4(this.rpc.optionalChains),this.signer=await gLe.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await R9e(()=>import("./index-Mx8kZtbv.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(K1({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&rf(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&rf(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${wLe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var Mte={exports:{}};/*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. */(function(t,e){(function(r){var n=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(x){return Object.prototype.toString.call(x)==="[object Array]"},s=10,o=typeof process=="object"&&typeof process.nextTick=="function",a=typeof Symbol=="function",c=typeof Reflect=="object",l=typeof setImmediate=="function",f=l?setImmediate:setTimeout,u=a?c&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(E){var x=Object.getOwnPropertyNames(E);return x.push.apply(x,Object.getOwnPropertySymbols(E)),x}:Object.keys;function p(){this._events={},this._conf&&g.call(this,this._conf)}function g(E){E&&(this._conf=E,E.delimiter&&(this.delimiter=E.delimiter),E.maxListeners!==r&&(this._maxListeners=E.maxListeners),E.wildcard&&(this.wildcard=E.wildcard),E.newListener&&(this._newListener=E.newListener),E.removeListener&&(this._removeListener=E.removeListener),E.verboseMemoryLeak&&(this.verboseMemoryLeak=E.verboseMemoryLeak),E.ignoreErrors&&(this.ignoreErrors=E.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function y(E,x){var w="(node) warning: possible EventEmitter memory leak detected. "+E+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(w+=" Event name: "+x+"."),typeof process<"u"&&process.emitWarning){var T=new Error(w);T.name="MaxListenersExceededWarning",T.emitter=this,T.count=E,process.emitWarning(T)}else console.error(w),console.trace&&console.trace()}var b=function(E,x,w){var T=arguments.length;switch(T){case 0:return[];case 1:return[E];case 2:return[E,x];case 3:return[E,x,w];default:for(var k=new Array(T);T--;)k[T]=arguments[T];return k}};function I(E,x){for(var w={},T,k=E.length,H=0,oe=0;oe0;)E=H[X],oe.call(j,E,w[E]);this._listeners={},this._listenersCount=0,G()}}});function S(E,x,w,T){var k=Object.assign({},x);if(!E)return k;if(typeof E!="object")throw TypeError("options must be an object");var H=Object.keys(E),oe=H.length,j,X,G;function Z(N){throw Error('Invalid "'+j+'" option value'+(N?". Reason: "+N:""))}for(var ee=0;ee0;)if(j===E[X])return H;oe(x)}}var F=L(["function"]),z=L(["object","function"]);function _(E,x,w){var T,k,H=0,oe,j=new E(function(X,G,Z){w=S(w,{timeout:0,overload:!1},{timeout:function(fe,Ee){return fe*=1,(typeof fe!="number"||fe<0||!Number.isFinite(fe))&&Ee("timeout must be a positive number"),fe}}),T=!w.overload&&typeof E.prototype.cancel=="function"&&typeof Z=="function";function ee(){k&&(k=null),H&&(clearTimeout(H),H=0)}var N=function(fe){ee(),X(fe)},te=function(fe){ee(),G(fe)};T?x(N,te,Z):(k=[function(fe){te(fe||Error("canceled"))}],x(N,te,function(fe){if(oe)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof fe!="function")throw TypeError("onCancel callback must be a function");k.push(fe)}),oe=!0),w.timeout>0&&(H=setTimeout(function(){var fe=Error("timeout");fe.code="ETIMEDOUT",H=0,j.cancel(fe),G(fe)},w.timeout))});return T||(j.cancel=function(X){if(k){for(var G=k.length,Z=1;Z0;)te=ze[j],te!=="_listeners"&&(et=ie(E,x,w[te],T+1,k),et&&(N?N.push.apply(N,et):N=et));return N}else if(Te==="**"){for(Re=T+1===k||T+2===k&&De==="*",Re&&w._listeners&&(N=ie(E,x,w,k,k)),ze=u(w),j=ze.length;j-- >0;)te=ze[j],te!=="_listeners"&&(te==="*"||te==="**"?(w[te]._listeners&&!Re&&(et=ie(E,x,w[te],k,k),et&&(N?N.push.apply(N,et):N=et)),et=ie(E,x,w[te],T,k)):te===De?et=ie(E,x,w[te],T+2,k):et=ie(E,x,w[te],T,k),et&&(N?N.push.apply(N,et):N=et));return N}else w[Te]&&(N=ie(E,x,w[Te],T+1,k));if(fe=w["*"],fe&&ie(E,x,fe,T+1,k),Ee=w["**"],Ee)if(T0;)te=ze[j],te!=="_listeners"&&(te===De?ie(E,x,Ee[te],T+2,k):te===Te?ie(E,x,Ee[te],T+1,k):(_e={},_e[te]=Ee[te],ie(E,x,{"**":_e},T+1,k)));else Ee._listeners?ie(E,x,Ee,k,k):Ee["*"]&&Ee["*"]._listeners&&ie(E,x,Ee["*"],k,k);return N}function ce(E,x,w){var T=0,k=0,H,oe=this.delimiter,j=oe.length,X;if(typeof E=="string")if((H=E.indexOf(oe))!==-1){X=new Array(5);do X[T++]=E.slice(k,H),k=H+j;while((H=E.indexOf(oe,k))!==-1);X[T++]=E.slice(k)}else X=[E],T=1;else X=E,T=E.length;if(T>1){for(H=0;H+10&&G._listeners.length>this._maxListeners&&(G._listeners.warned=!0,y.call(this,G._listeners.length,Z))):G._listeners=x,!0;return!0}function K(E,x,w,T){for(var k=u(E),H=k.length,oe,j,X,G=E._listeners,Z;H-- >0;)j=k[H],oe=E[j],j==="_listeners"?X=w:X=w?w.concat(j):[j],Z=T||typeof j=="symbol",G&&x.push(Z?X:X.join(this.delimiter)),typeof oe=="object"&&K.call(this,oe,x,X,Z);return x}function P(E){for(var x=u(E),w=x.length,T,k,H;w-- >0;)k=x[w],T=E[k],T&&(H=!0,k!=="_listeners"&&!P(T)&&delete E[k]);return H}function M(E,x,w){this.emitter=E,this.event=x,this.listener=w}M.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function v(E,x,w){if(w===!0)k=!0;else if(w===!1)T=!0;else{if(!w||typeof w!="object")throw TypeError("options should be an object or true");var T=w.async,k=w.promisify,H=w.nextTick,oe=w.objectify}if(T||H||k){var j=x,X=x._origin||x;if(H&&!o)throw Error("process.nextTick is not supported");k===r&&(k=x.constructor.name==="AsyncFunction"),x=function(){var G=arguments,Z=this,ee=this.event;return k?H?Promise.resolve():new Promise(function(N){f(N)}).then(function(){return Z.event=ee,j.apply(Z,G)}):(H?process.nextTick:f)(function(){Z.event=ee,j.apply(Z,G)})},x._async=!0,x._origin=X}return[x,oe?new M(this,E,x):this]}function m(E){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,g.call(this,E)}m.EventEmitter2=m,m.prototype.listenTo=function(E,x,w){if(typeof E!="object")throw TypeError("target musts be an object");var T=this;w=S(w,{on:r,off:r,reducers:r},{on:F,off:F,reducers:z});function k(H){if(typeof H!="object")throw TypeError("events must be an object");var oe=w.reducers,j=$.call(T,E),X;j===-1?X=new C(T,E,w):X=T._observers[j];for(var G=u(H),Z=G.length,ee,N=typeof oe=="function",te=0;te0;)k=w[T],(!E||k._target===E)&&(k.unsubscribe(x),H=!0);return H},m.prototype.delimiter=".",m.prototype.setMaxListeners=function(E){E!==r&&(this._maxListeners=E,this._conf||(this._conf={}),this._conf.maxListeners=E)},m.prototype.getMaxListeners=function(){return this._maxListeners},m.prototype.event="",m.prototype.once=function(E,x,w){return this._once(E,x,!1,w)},m.prototype.prependOnceListener=function(E,x,w){return this._once(E,x,!0,w)},m.prototype._once=function(E,x,w,T){return this._many(E,1,x,w,T)},m.prototype.many=function(E,x,w,T){return this._many(E,x,w,!1,T)},m.prototype.prependMany=function(E,x,w,T){return this._many(E,x,w,!0,T)},m.prototype._many=function(E,x,w,T,k){var H=this;if(typeof w!="function")throw new Error("many only accepts instances of Function");function oe(){return--x===0&&H.off(E,oe),w.apply(this,arguments)}return oe._origin=w,this._on(E,oe,T,k)},m.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||p.call(this);var E=arguments[0],x,w=this.wildcard,T,k,H,oe,j;if(E==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(w&&(x=E,E!=="newListener"&&E!=="removeListener"&&typeof E=="object")){if(k=E.length,a){for(H=0;H3)for(T=new Array(X-1),oe=1;oe3)for(k=new Array(G-1),j=1;j0&&this._events[E].length>this._maxListeners&&(this._events[E].warned=!0,y.call(this,this._events[E].length,E))):this._events[E]=x,k)},m.prototype.off=function(E,x){if(typeof x!="function")throw new Error("removeListener only takes instances of Function");var w,T=[];if(this.wildcard){var k=typeof E=="string"?E.split(this.delimiter):E.slice();if(T=ie.call(this,null,k,this.listenerTree,0),!T)return this}else{if(!this._events[E])return this;w=this._events[E],T.push({_listeners:w})}for(var H=0;H0){for(T=this._all,x=0,w=T.length;x0;)T=x[w[H]],typeof T=="function"?k.push(T):k.push.apply(k,T);return k}else{if(this.wildcard){if(oe=this.listenerTree,!oe)return[];var j=[],X=typeof E=="string"?E.split(this.delimiter):E.slice();return ie.call(this,j,X,oe,0),j}return x?(T=x[E],T?typeof T=="function"?[T]:T:[]):[]}},m.prototype.eventNames=function(E){var x=this._events;return this.wildcard?K.call(this,this.listenerTree,[],null,E):x?u(x):[]},m.prototype.listenerCount=function(E){return this.listeners(E).length},m.prototype.hasListeners=function(E){if(this.wildcard){var x=[],w=typeof E=="string"?E.split(this.delimiter):E.slice();return ie.call(this,x,w,this.listenerTree,0),x.length>0}var T=this._events,k=this._all;return!!(k&&k.length||T&&(E===r?u(T).length:T[E]))},m.prototype.listenersAny=function(){return this._all?this._all:[]},m.prototype.waitFor=function(E,x){var w=this,T=typeof x;return T==="number"?x={timeout:x}:T==="function"&&(x={filter:x}),x=S(x,{timeout:0,filter:r,handleError:!1,Promise,overload:!1},{filter:F,Promise:O}),_(x.Promise,function(k,H,oe){function j(){var X=x.filter;if(!(X&&!X.apply(w,arguments)))if(w.off(E,j),x.handleError){var G=arguments[0];G?H(G):k(b.apply(null,arguments).slice(1))}else k(b.apply(null,arguments))}oe(function(){w.off(E,j)}),w._on(E,j,!1)},{timeout:x.timeout,overload:x.overload})};function R(E,x,w){w=S(w,{Promise,timeout:0,overload:!1},{Promise:O});var T=w.Promise;return _(T,function(k,H,oe){var j;if(typeof E.addEventListener=="function"){j=function(){k(b.apply(null,arguments))},oe(function(){E.removeEventListener(x,j)}),E.addEventListener(x,j,{once:!0});return}var X=function(){G&&E.removeListener("error",G),k(b.apply(null,arguments))},G;x!=="error"&&(G=function(Z){E.removeListener(x,X),H(Z)},E.once("error",G)),oe(function(){G&&E.removeListener("error",G),E.removeListener(x,X)}),E.once(x,X)},{timeout:w.timeout,overload:w.overload})}var B=m.prototype;Object.defineProperties(m,{defaultMaxListeners:{get:function(){return B._maxListeners},set:function(E){if(typeof E!="number"||E<0||Number.isNaN(E))throw TypeError("n must be a non-negative number");B._maxListeners=E},enumerable:!0},once:{value:R,writable:!0,configurable:!0}}),Object.defineProperties(B,{_maxListeners:{value:s,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=m})()})(Mte);var kLe=Mte.exports,AI=function(){return AI=Object.assign||function(e){for(var r,n=1,i=arguments.length;n0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]0&&(i.types.Claims.push({name:"app",type:"string"}),i.message.app=this.claims.app),this.claims.iat&&this.claims.iat>0&&(i.types.Claims.push({name:"iat",type:"int64"}),i.message.iat=this.claims.iat),this.claims.exp&&this.claims.exp>0&&(i.types.Claims.push({name:"exp",type:"int64"}),i.message.exp=this.claims.exp),this.claims.n&&this.claims.n>0&&(i.types.Claims.push({name:"n",type:"uint64"}),i.message.n=this.claims.n),this.claims.typ&&this.claims.typ.length>0&&(i.types.Claims.push({name:"typ",type:"string"}),i.message.typ=this.claims.typ),this.claims.ogn&&this.claims.ogn.length>0&&(i.types.Claims.push({name:"ogn",type:"string"}),i.message.ogn=this.claims.ogn),this.claims.v&&this.claims.v.length>0&&(i.types.Claims.push({name:"v",type:"string"}),i.message.v=this.claims.v),i},t}(),OLe=function(t){if(t.app==="")return{ok:!1,err:new Error("claims: app is empty")};var e=Math.round(new Date().getTime()/1e3),r=5*60,n=60*60*24*365+r;return t.v===""?{ok:!1,err:new Error("claims: ethauth version is empty")}:t.iat&&t.iat!==0&&(t.iat>e+r||t.iate+n?{ok:!1,err:new Error("claims: token has expired")}:{ok:!0}},DLe=function(t,e,r){return E0(void 0,void 0,void 0,function(){var n,i;return C0(this,function(s){return n=r.messageDigest(),i=A4e(n,r.signature),i.slice(0,2)==="0x"&&i.length===42&&i.toLowerCase()===r.address.toLowerCase()?[2,{isValid:!0,address:r.address}]:[2,{isValid:!1}]})})},NLe=function(t,e,r){return E0(void 0,void 0,void 0,function(){var n,i,s,o,a;return C0(this,function(c){switch(c.label){case 0:return!t||t===void 0?[2,{isValid:!1}]:(n=r.messageDigest(),[4,t.getCode(r.address)]);case 1:if(i=c.sent(),i==="0x"||i.length<=2)throw new Error("ValidateContractAccountProof failed. unable to fetch wallet contract code");return s=["function isValidSignature(bytes32, bytes) public view returns (bytes4)"],o=new Dn(r.address,s,t),[4,o.isValidSignature(n,Ue(r.signature))];case 2:return a=c.sent(),a===BLe?[2,{isValid:!0,address:r.address}]:[2,{isValid:!1}]}})})},BLe="0x1626ba7e",LLe=function(){function t(){for(var e=[],r=0;r0&&(c+="."+i.extra),[2,c]}})})},this.decodeProof=function(i,s){return s===void 0&&(s=!1),E0(n,void 0,void 0,function(){var o,a,c,l,f,u,p,g,y,b;return C0(this,function(I){switch(I.label){case 0:if(o=i.split("."),o.length<4||o.length>5)throw new Error("ethauth: invalid proof string");if(a=o[0],c=o[1],l=o[2],f=o[3],u=o[4],a!==SI)throw new Error("ethauth: not an ethauth proof");return p=MF.decode(l),g=JSON.parse(p),y=new Ote({address:c,claims:g,signature:f,extra:u}),[4,this.validateProof(y,s)];case 1:if(b=I.sent(),!b)throw new Error("ethauth: proof is invalid");return[2,y]}})})},this.validateProof=function(i,s){return s===void 0&&(s=!1),E0(n,void 0,void 0,function(){var o,a;return C0(this,function(c){switch(c.label){case 0:if(o=this.validateProofClaims(i),o.err)throw new Error("ethauth: proof claims are invalid ".concat(o.err));return s===!0?[3,2]:[4,this.validateProofSignature(i)];case 1:if(a=c.sent(),a!==!0)throw new Error("ethauth: proof signature is invalid");c.label=2;case 2:return[2,!0]}})})},this.validateProofSignature=function(i){return E0(n,void 0,void 0,function(){var s,c,o,a,c;return C0(this,function(l){switch(l.label){case 0:s=[],c=0,l.label=1;case 1:if(!(c{const n=Qt(await t.getAddress());if(!n||n===""||n==="0x")throw ULe;const i=new Ote;if(i.address=n,!r||!r.app||r.app==="")throw new Dte("authorization options requires app to be set");i.claims.app=r.app,i.claims.ogn=r.origin,i.claims.n=r.nonce,i.setExpiryIn(r.expiry?Math.max(r.expiry,200):FLe);const s=i.messageTypedData(),o=c9e(e);i.signature=await(t instanceof Ix?t.signTypedData(s.domain,s.types,s.message,o,"eip6492"):t.signTypedData(s.domain,s.types,s.message,o));const c=await new LLe().encodeProof(i,!0);return{typedData:s,proofString:c}};class Dte extends Error{constructor(e){super(e),this.name="AuthError"}}const ULe=new Dte("auth error: account address is empty");mt.context.defaultContexts,new aX.remote.RemoteConfigTracker("https://sessions.sequence.app");const $Le=new Map(["addHook(bytes4,address)","clearExtraImageHashes(bytes32[])","removeHook(bytes4)","setExtraImageHash(bytes32,uint256)","updateIPFSRoot(bytes32)","updateImageHash(bytes32)","updateImageHashAndIPFS(bytes32,bytes32)","updateImplementation(address)"].map(t=>[Oo(t).slice(0,10),t]));function _I(t,e){const r=mt.transaction.fromTransactionish(t,e);mt.transaction.unwind(t,r).forEach(i=>qLe(t,i))}function qLe(t,e){if(e.to.toLowerCase()===t.toLowerCase()&&e.data){const r=Ue(e.data);if(r.length>=4&&!VLe(r))throw new Error("self calls are forbidden")}if(e.delegateCall)throw new Error("delegate calls are forbidden");if(e.data){const n=Me(e.data).slice(0,10),i=$Le.get(n);if(i){const s=i.slice(0,i.indexOf("("));throw new Error(`${s} calls are forbidden`)}}}function VLe(t){const e=new $i(Ps.mainModule.abi);try{return e.decodeFunctionData("createContract",t),!0}catch{return!1}}function $c(){return $c=Object.assign?Object.assign.bind():function(t){for(var e=1;ee.predicate(t))}const WLe=[{name:"Decentraland Exception",predicate:YLe},{name:"0x v3 Exception",predicate:QLe}],KLe=/^Decentraland Login\nEphemeral address: 0x[a-fA-F0-9]{40}\nExpiration: (\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)((-(\d{2}):(\d{2})|Z)?)$/;function YLe(t){try{const e=Ip(t);return KLe.test(e)}catch{return!1}}function QLe(t){const e=new $i(JLe);try{return e.decodeFunctionData("OrderWithHash",t),!0}catch{return!1}}const JLe=[{inputs:[{components:[{internalType:"address",name:"makerAddress",type:"address"},{internalType:"address",name:"takerAddress",type:"address"},{internalType:"address",name:"feeRecipientAddress",type:"address"},{internalType:"address",name:"senderAddress",type:"address"},{internalType:"uint256",name:"makerAssetAmount",type:"uint256"},{internalType:"uint256",name:"takerAssetAmount",type:"uint256"},{internalType:"uint256",name:"makerFee",type:"uint256"},{internalType:"uint256",name:"takerFee",type:"uint256"},{internalType:"uint256",name:"expirationTimeSeconds",type:"uint256"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes",name:"makerAssetData",type:"bytes"},{internalType:"bytes",name:"takerAssetData",type:"bytes"},{internalType:"bytes",name:"makerFeeAssetData",type:"bytes"},{internalType:"bytes",name:"takerFeeAssetData",type:"bytes"}],internalType:"struct IEIP1271Data.Order",name:"order",type:"tuple"},{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderWithHash",outputs:[],stateMutability:"pure",type:"function"}],F3=Ii(`Ethereum Signed Message: -`),ZLe=t=>mu(t)?Ue(t):Ii(t),Nte=t=>{const e=ZLe(t);return GLe(e)?e:Ue(qr([F3,Ii(String(e.length)),e]))},XLe=t=>{if(JSON.stringify(t.slice(0,F3.length))!==JSON.stringify(F3))return t;const e=t.slice(F3.length),r=String(e.length).length;let n,i;try{i=Number(Ip(e.slice(0,r)))}catch{i=Number(Me(e.slice(0,r)))}return i>e.length||!Number.isInteger(i)?n=r-1:n=r,e.slice(n)},I$=async(t,e,r,n)=>new mt.reader.OnChainReader(n).isValidSignature(t,e,r);async function eFe(t){return Array.isArray(t)?Promise.all(t.map(e=>pi(e))):pi(t)}function tFe(t){return[t,...t.auxiliary||[]]}const rFe=1e4;class nFe{constructor(e,r,n){var i=this;this.account=void 0,this.signerReadyCallbacks=[],this.prompter=void 0,this.networks=void 0,this._openIntent=void 0,this._connectOptions=void 0,this.events=new kLe.EventEmitter2,this.onConnectOptionsChange=void 0,this.promptConnect=async function(s){if(!s&&!i._connectOptions)throw new Error("prompter connect options are empty");if(!i.prompter)return i.connect(s);const o=await i.prompter.promptConnect(s||i._connectOptions).catch(c=>({connected:!1})),a=o;return a.connected&&!a.session&&(a.session=await i.walletSession(s==null?void 0:s.networkId)),o},this.isSignedIn=async function(){return await i.signerReady(),!!i.account},this.getAccount=async function(){if(await i.signerReady(),i.account===void 0)throw new Error("signerReady failed resolve");return i.account},this.account=e,this.prompter=r,this.networks=n}defaultChainId(){var e,r;return(e=(r=this.prompter)==null?void 0:r.getDefaultChainId())!=null?e:this.networks[0].chainId}async signIn(e,r={}){this.setAccount(e);const{connect:n,defaultNetworkId:i}=r;if(n){const a=this._connectOptions;let c;if(this.prompter!==null){var s;c=await((s=this.prompter)==null?void 0:s.promptSignInConnect(a))}else c=await this.connect(a);this.notifyConnect(c),(!a||a.keepWalletOpened!==!0)&&this.notifyClose()}if(i&&this.defaultChainId()!==i){var o;await((o=this.prompter)==null?void 0:o.promptChangeNetwork(i))}}signOut(){this.account&&this.notifyDisconnect(),this.setAccount(null)}signerReset(){this.account=void 0}signerReady(e=rFe){return new Promise((r,n)=>{this.account!==void 0?r():(setTimeout(()=>{this.account===void 0&&(this.signerReadyCallbacks=[],n("signerReady timed out"))},e),this.signerReadyCallbacks.push(r))})}async connect(e){var r,n;if(!this.account)return{connected:!1,chainId:"0x0",error:"unable to connect without signed in account"};const i=(r=(n=e==null?void 0:e.networkId)!=null?n:this.defaultChainId())!=null?r:ge.MAINNET,s=a9e(i).chainId,o={connected:!0,chainId:zc(s)};if(e&&e.authorize){const a={app:e.app,origin:e.origin,expiry:e.expiry,nonce:e.authorizeNonce};try{o.proof=await jLe(this.account,s,a)}catch(c){return Ci.warn(`connect, signAuthorization failed for options: ${JSON.stringify(e)}, due to: ${c.message}`),{connected:!1,chainId:"0x0",error:`signAuthorization failed: ${c.message}`}}}return o.session=this.walletSession(s),o}async sendMessageRequest(e){var r;const i=Number(((r=e.clientVersion)==null?void 0:r.split(".")[0])||"0")<2,s={id:e.data.id,jsonrpc:"2.0",result:null,error:void 0};try{const o=await this.request({method:e.data.method,params:e.data.params,chainId:e.chainId});return $c({},e,{data:i?$c({},s,{result:o}):o})}catch(o){return $c({},e,{data:i?$c({},s,{error:o}):{error:o}})}}async request(e){await this.getAccount();try{var r,n;if((!this.account||this.account===null)&&!iFe.includes(e.method))throw HLe;const l=this.account;if(!l)throw new Error("WalletRequestHandler: wallet account is not configured");const f=(r=this.account)==null?void 0:r.providerFor((n=e.chainId)!=null?n:this.defaultChainId());if(!f)throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${e.chainId}`);const u=sFe(f)?f:void 0;switch(e.method){case"net_version":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("net_version",[])}case"eth_chainId":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("eth_chainId",[])}case"eth_accounts":return[l.address];case"eth_getBalance":{const[p,g]=e.params,y=await f.getBalance(p,g);return Nv(y)}case"sequence_sign":case"personal_sign":case"eth_sign":{let p;switch(e.method){case"sequence_sign":case"personal_sign":{const[I,C]=e.params;p=I;break}case"eth_sign":{const[I,C]=e.params;p=C;break}}let g="";const y=Nte(p),b=e.method==="sequence_sign";if(this.prompter===null){var i;g=await l.signMessage(y,(i=e.chainId)!=null?i:this.defaultChainId(),b?"eip6492":"ignore")}else g=await this.prompter.promptSignMessage({chainId:e.chainId,message:Ue(y),eip6492:b},this.connectOptions);if(g&&g.length>0)return g;throw new Error("declined by user")}case"sequence_signTypedData_v4":case"eth_signTypedData":case"eth_signTypedData_v4":{const[p,g]=e.params;let y;if(typeof g=="string")try{y=JSON.parse(g)}catch(C){console.warn("walletRequestHandler: error parsing typedData",C)}else y=g;if(!y||!y.domain||!y.types||!y.message)throw new Error("invalid typedData object");let b="";const I=e.method==="sequence_signTypedData_v4";if(this.prompter===null){var s;b=await l.signTypedData(y.domain,y.types,y.message,(s=e.chainId)!=null?s:this.defaultChainId(),I?"eip6492":"ignore")}else b=await this.prompter.promptSignMessage({chainId:e.chainId,typedData:y,eip6492:I},this.connectOptions);if(b&&b.length>0)return b;throw new Error("declined by user")}case"eth_sendTransaction":{const p=tFe(e.params[0]).map(y=>("gas"in y&&y.gasLimit===void 0&&(y.gasLimit=y.gas,delete y.gas),y));_I(l.address,p);let g="";if(this.prompter===null){var o,a;const y=await l.sendTransaction(p,(o=e.chainId)!=null?o:this.defaultChainId());g=(a=y==null?void 0:y.hash)!=null?a:""}else g=await this.prompter.promptSendTransaction(p,e.chainId,this.connectOptions);if(g)return g;throw new Error("declined by user")}case"eth_signTransaction":{const[p]=e.params;if(Qt(p.from)!==l.address)throw new Error("sender address does not match wallet");if(_I(l.address,p),this.prompter===null){var c;return await l.signTransactions(p,(c=e.chainId)!=null?c:this.defaultChainId())}else return await this.prompter.promptSignTransaction(p,e.chainId,this.connectOptions)}case"eth_sendRawTransaction":if(mt.transaction.isSignedTransactionBundle(e.params[0])){const p=Number(e.params[0].chainId);return(await l.relayer(p).relay(e.params[0])).hash}else return(await f.broadcastTransaction(e.params[0])).hash;case"eth_getTransactionCount":{const p=Qt(e.params[0]),g=e.params[1],y=await f.getTransactionCount(p,g);return Nv(BigInt(y))}case"eth_blockNumber":return await f.getBlockNumber();case"eth_getBlockByNumber":return await f.getBlock(e.params[0]);case"eth_getBlockByHash":return await f.getBlock(e.params[0]);case"eth_getTransactionByHash":return await f.getTransaction(e.params[0]);case"eth_call":{const[p,g]=e.params;return await f.call($c({},p,{blockTag:g}))}case"eth_getCode":{const[p,g]=e.params;return await f.getCode(p,g)}case"eth_estimateGas":{const[p]=e.params;return await f.estimateGas(p)}case"eth_gasPrice":{const p=await f.getFeeData();return p.gasPrice===null?null:Nv(p.gasPrice)}case"wallet_switchEthereumChain":{const[p]=e.params;if(!p.chainId||p.chainId.length===0)throw new Error("invalid chainId");const g=BigInt(p.chainId);return this.setDefaultChainId(Number(g)),null}case"sequence_getWalletContext":return l.contexts;case"sequence_getWalletConfig":{const[p]=e.params;return p?[(await l.status(p)).onChain.config]:await Promise.all(l.networks.map(async function(g){return(await l.status(g.chainId)).onChain.config}))}case"sequence_getWalletState":{const[p]=e.params;return p?[T$(p,await l.status(p))]:await Promise.all(l.networks.map(async function(g){const y=await l.status(g.chainId);return T$(g.chainId,y)}))}case"sequence_getNetworks":return await this.getNetworks(!0);case"sequence_isSequence":return!0;case"sequence_updateConfig":throw new Error("sequence_updateConfig method is not allowed from a dapp");case"sequence_publishConfig":throw new Error("sequence_publishConfig method is not allowed from a dapp");case"sequence_gasRefundOptions":break;case"sequence_getNonce":break;case"sequence_relay":break;case"sequence_setDefaultNetwork":{const[p]=e.params;if(!p)throw new Error("invalid request, method argument defaultChainId cannot be empty");return this.setDefaultChainId(p),await this.getNetworks(!0)}default:{if(!u)throw new Error("Account provider doesn't support send method");return await u.send(e.method,e.params)}}}catch(l){throw Ci.error(l),{message:typeof l=="string"?l:(l==null?void 0:l.message)||"unkown error",code:4001}}}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}async getAddress(){var e,r;return(e=(r=this.account)==null?void 0:r.address)!=null?e:""}get openIntent(){return this._openIntent}setOpenIntent(e){this._openIntent=e}get connectOptions(){return this._connectOptions}setConnectOptions(e){var r;this._connectOptions=e,(r=this.onConnectOptionsChange)==null||r.call(this,e)}async setDefaultChainId(e){var r;return await((r=this.prompter)==null?void 0:r.promptChangeNetwork(e)),this.defaultChainId()}async getNetworks(e){return this.account?e?this.account.networks.map(r=>{const n=$c({},r);return n.provider=void 0,n.relayer=void 0,n}):this.account.networks:(Ci.warn("signer not set: getNetworks is returning an empty list"),[])}walletSession(e){if(!this.account)return;const r={walletContext:this.account.contexts,accountAddress:this.account.address,networks:this.account.networks.map(i=>$c({},i,{provider:void 0,relayer:void 0}))};if(e){const i=Iw(r.networks,e);if(i){var n;(n=r.networks)==null||n.forEach(s=>delete s.isDefaultChain),i.isDefaultChain=!0}}return r}notifyConnect(e,r){var n;if(console.log("emit connect",e),this.events.emit("connect",e),(n=e.session)!=null&&n.accountAddress){var i;this.events.emit("accountsChanged",[(i=e.session)==null?void 0:i.accountAddress],r)}}notifyDisconnect(e){this.events.emit("accountsChanged",[],e),this.events.emit("disconnect",void 0,e)}notifyChainChanged(e,r){this.events.emit("chainChanged",zc(e),r)}async notifyNetworks(e){const r=e||await this.getNetworks(!0);if(this.events.emit("networks",r),r.length>0){const n=r.find(i=>i.chainId===this.defaultChainId());n&&this.events.emit("chainChanged",zc(n.chainId))}else this.events.emit("chainChanged","0x0")}async notifyWalletContext(){if(!this.account){Ci.warn("signer not set: skipping to notify wallet context");return}const e=this.account.contexts;this.events.emit("walletContext",e)}notifyClose(e){this.events.emit("close",e)}setAccount(e){if(this.account=e,e!==void 0){for(let r=0;rc.canOnchainValidate||c.original.version===2&&n,o=await r.status(i);if(s(o))return!0;if(await e.promptConfirmWalletDeploy(i,this.connectOptions)){const c=await r.status(i);return s(c)?!0:(Ci.error("WalletRequestHandler: result for promptConfirmWalletDeploy is not correct"),!1)}return!1}}function T$(t,e){return{context:e.original.context,config:e.onChain.config,address:mt.context.addressOf(e.original.context,e.original.imageHash),chainId:t,deployed:e.onChain.deployed,imageHash:e.imageHash,lastImageHash:e.onChain.imageHash,published:!0,status:e}}const iFe=["net_version","eth_chainId","eth_getBalance","eth_getTransactionCount","eth_blockNumber","eth_getBlockByNumber","eth_getBlockByHash","eth_getTransactionByHash","eth_getCode","eth_estimateGas","eth_gasPrice","sequence_getWalletContext","sequence_getNetworks","sequence_setDefaultNetwork"];function sFe(t){return t&&typeof t=="object"&&typeof t.send=="function"&&typeof t.getNetwork=="function"}function oFe(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}class DE{get utils(){return this.provider.utils}constructor(e,r){this.client=e,this.provider=r,this.singleNetworkSigners={},this._isSequenceSigner=!0}async getAddress(){return this.client.getAddress()}connect(e){if(!KM.is(e))throw new Error("SequenceSigner can only be connected to a SequenceProvider");return new DE(this.client,e)}getSigner(e){if(!e)return this;const r=this.provider.toChainId(e);return this.singleNetworkSigners[r]||(this.singleNetworkSigners[r]=new Bte(this.client,this.provider,r)),this.singleNetworkSigners[r]}useChainId(e){return this.provider.toChainId(e)||this.client.getChainId()}async signMessage(e,r){const{eip6492:n=!0}=r||{},i=this.useChainId(r==null?void 0:r.chainId);return this.client.signMessage(e,{eip6492:n,chainId:i})}async signTypedData(e,r,n,i){const{eip6492:s=!0}=i||{},o=this.useChainId(i==null?void 0:i.chainId);return this.client.signTypedData({domain:e,types:r,message:n},{eip6492:s,chainId:o})}getProvider(e){return this.provider.getProvider(e)}async sendTransaction(e,r){const n=this.useChainId(r==null?void 0:r.chainId),i=await eFe(e),s=await this.client.sendTransaction(i,{chainId:n}),o=this.getProvider(n);try{return await new Promise(c=>{(async function f(){const u=await o.getTransaction(s);if(u!==null)return c(u);await o.once("block",f)})()})}catch(a){throw a.transactionHash=s,a}}async getWalletConfig(e){const r=this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}getNetworks(){return this.client.getNetworks()}async getBalance(e,r){return this.getProvider(r==null?void 0:r.chainId).getBalance(this.getAddress(),e)}async estimateGas(e,r){return this.getProvider(r==null?void 0:r.chainId).estimateGas(e)}async call(e,r){return this.getProvider(r==null?void 0:r.chainId).call(e)}getChainId(){return Promise.resolve(this.client.getChainId())}async getFeeData(e){return this.getProvider(e==null?void 0:e.chainId).getFeeData()}async resolveName(e){const r=await this.provider.resolveName(e);if(r===null)throw new Error(`ENS name not found: ${e}`);return r}_checkProvider(e){}getNonce(e){throw new Error("SequenceSigner does not support getNonce")}populateCall(e){throw new Error("SequenceSigner does not support populateCall")}populateTransaction(e){throw new Error("SequenceSigner does not support populateTransaction")}checkTransaction(e){throw new Error("SequenceSigner does not support checkTransaction")}getTransactionCount(e){throw new Error("SequenceSigner does not support getTransactionCount")}signTransaction(e){throw new Error("SequenceWallet does not support signTransaction, use sendTransaction instead.")}static is(e){return e&&typeof e=="object"&&e._isSequenceSigner===!0}}class Bte extends DE{constructor(e,r,n){super(e,r.getProvider(n)),this.chainId=n,this._isSingleNetworkSequenceSigner=!0}_useChainId(e){const r=this.provider.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This signer only supports the network ${this.chainId}, but ${r} was requested.`);return r||this.provider.toChainId(this.chainId)}useChainId(e){return this._useChainId(e)}getChainId(){return Promise.resolve(this.provider.toChainId(this.chainId))}getProvider(e){return super.getProvider(this._useChainId(e))}getSigner(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceSigner===!0}}class aFe{constructor(e){if(this.signer=e,Bte.is(e))throw new Error("WalletUtils does not support SingleNetworkSequenceSigner")}signMessage(e,r,n){return this.signer.signMessage(e,{chainId:r,eip6492:n})}signTypedData(e,r,n,i,s){return this.signer.signTypedData(e,r,n,{chainId:i,eip6492:s})}async isValidSignature(e,r,n,i){return I$(e,r,n,this.signer.getProvider(i))}async isValidMessageSignature(e,r,n,i){const s=this.signer.getProvider(i),o=Nte(r),a=OEe(o);return I$(e,a,n,s)}isValidTypedDataSignature(e,r,n,i){return this.isValidSignature(e,Dk(r),n,i)}}const cFe=["method"],P$=["connect","disconnect","chainChanged","accountsChanged"];class KM extends gJ{constructor(e,r,n=dM,i){super(e.getChainId(),i),this.client=e,this.providerFor=r,this.networks=n,this.options=i,this.singleNetworkProviders={},this._isSequenceProvider=!0,this.utils=void 0,this.signer=void 0,this.eip1193EventListeners=new Map,e.onConnect(s=>{var o;(o=this.eip1193EventListeners.get("connect"))==null||o.forEach(a=>a(s))}),e.onDisconnect(s=>{var o;(o=this.eip1193EventListeners.get("disconnect"))==null||o.forEach(a=>a(s))}),e.onDefaultChainIdChanged(s=>{var o;(o=this.eip1193EventListeners.get("chainChanged"))==null||o.forEach(a=>a(s))}),e.onAccountsChanged(s=>{var o;(o=this.eip1193EventListeners.get("accountsChanged"))==null||o.forEach(a=>a(s))}),this.signer=new DE(this.client,this),this.utils=new aFe(this.signer)}async on(e,r){if(P$.includes(e)){const n=this.eip1193EventListeners.get(e)||new Set;return n.add(r),this.eip1193EventListeners.set(e,n),this}return super.on(e,r)}async off(e,r){if(P$.includes(e)){const n=this.eip1193EventListeners.get(e);return n&&(r?n.delete(r):n.clear()),this}return super.off(e,r)}getSigner(e){return this.signer.getSigner(e)}connect(e){return this.client.connect(e)}disconnect(){return this.client.disconnect()}isConnected(){return this.client.isConnected()}getSession(){return this.client.getSession()}listAccounts(){return[this.client.getAddress()]}getAddress(){return this.client.getAddress()}getNetworks(){return this.client.getNetworks()}getChainId(){return this.client.getChainId()}setDefaultChainId(e){return this.client.setDefaultChainId(this.toChainId(e))}isOpened(){return this.client.isOpened()}closeWallet(){return this.client.closeWallet()}getWalletContext(){return this.client.getWalletContext()}async getWalletConfig(e){const r=await this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}authorize(e){return this.client.connect($c({},e,{authorize:!0}))}async openWallet(e,r){return await this.client.openWallet(e,r),!0}toChainId(e){if(e===void 0)return;const r=Iw(this.networks,e);if(!r)throw new Error(`Unsupported network ${e}`);return r.chainId}async useChainId(e){return this.toChainId(e)||this.client.getChainId()}getProvider(e){if(!e)return this;const r=this.toChainId(e);return this.singleNetworkProviders[r]||(this.singleNetworkProviders[r]=new lFe(this.client,this.providerFor,r,this.options)),this.singleNetworkProviders[r]}async _getSubprovider(e){const r=await this.useChainId(e),n=this.providerFor(r);if(!n)throw new Error(`Unsupported network ${r}`);return n}async _perform(e){var r;const{method:n}=e,i=oFe(e,cFe),s=await this._getSubprovider(),o=(r=s.getRpcRequest(e))!=null?r:{method:n,args:Object.values(i)};if(!o)throw new Error(`Unsupported method ${e.method}`);return s.send(o.method,o.args)}async perform(e,r){if(e==="eth_chainId")return zc(await this.useChainId());if(e==="eth_accounts")return[this.client.getAddress()];if(e==="wallet_switchEthereumChain"){const n=r[0],i=Lte(n);return this.setDefaultChainId(i)}return e==="eth_sendTransaction"||e==="eth_sign"||e==="eth_signTypedData"||e==="eth_signTypedData_v4"||e==="personal_sign"||e==="sequence_sign"||e==="sequence_signTypedData_v4"?this.client.request({method:e,params:r,chainId:this.getChainId()}):this._perform($c({method:e},r))}send(e,r){return this.perform(e,r)}request(e){return this.perform(e.method,e.params)}async _detectNetwork(){const e=this.client.getChainId(),r=Iw(this.networks,e);if(!r)throw new Error(`Unknown network ${e}`);return new ca(r.name,r.chainId)}async detectNetwork(){return this._detectNetwork()}async waitForTransaction(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).waitForTransaction(e,r,n)}async getBlockNumber(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getBlockNumber()}async getFeeData(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getFeeData()}async getBalance(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBalance(e,r)}async getTransactionCount(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getTransactionCount(e,r)}async getCode(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getCode(e,r)}async getStorage(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).getStorage(e,r,n)}async call(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).call(e)}async estimateGas(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).estimateGas(e)}async getBlock(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBlock(e,r)}async getTransaction(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getTransaction(e)}async getLogs(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getLogs(e)}async supportsENS(){return(await this.getNetworks()).some(r=>r.chainId===1)}async getResolver(e){return await this.supportsENS()?(await this._getSubprovider(1)).getResolver(e):null}async resolveName(e){return vw(e)?e:await this.supportsENS()?(await this._getSubprovider(1)).resolveName(e):null}async lookupAddress(e){return await this.supportsENS()?(await this._getSubprovider(1)).lookupAddress(e):null}async getAvatar(e){return await this.supportsENS()?(await this._getSubprovider(1)).getAvatar(e):null}}KM.is=t=>t&&typeof t=="object"&&t._isSequenceProvider===!0;function Lte(t){return typeof t=="object"?Lte(t.chainId):Number(t)}class lFe extends KM{constructor(e,r,n,i){super(e,r,void 0,i),this.chainId=n,this._isSingleNetworkSequenceProvider=!0}_useChainId(e){const r=this.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This provider only supports the network ${this.chainId}, but ${r} was requested.`);return r||super.toChainId(this.chainId)}useChainId(e){return Promise.resolve(this._useChainId(e))}getChainId(){return super.toChainId(this.chainId)}async getNetwork(){const e=await this.client.getNetworks(),r=Iw(e,this.chainId);if(!r)throw new Error(`Unsupported network ${this.chainId}`);return new ca(r.name,r.chainId)}getProvider(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}getSigner(e){return super.getSigner(this._useChainId(e))}setDefaultChainId(e){throw new Error(`This provider only supports the network ${this.chainId}; use the parent provider to switch networks.`)}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceProvider===!0}}class Zr{constructor(e){de(this,"networkStore",Ir(Nn));de(this,"authStore",Ir(yi));de(this,"accountAddress",this.authStore.accountAddress.get());de(this,"availableExternalProviders",Or([]));de(this,"selectedExternalProvider",Or(void 0));de(this,"selectedExternalWalletAddress",Or(void 0));de(this,"isSendingTokenTransaction",Or(void 0));de(this,"isSendingCollectibleTransaction",Or(void 0));de(this,"isSendingSignedTokenTransaction",Or(void 0));de(this,"connectDetails",Or(void 0));de(this,"connectOptions",Or(void 0));de(this,"isSigningTxn",Or(!1));de(this,"isSigningMsg",Or(!1));de(this,"toSignPermission",Or(void 0));de(this,"toSignResult",Or(void 0));de(this,"toSignTxnDetails",Or(void 0));de(this,"toSignMsgDetails",Or(void 0));de(this,"isCheckingWalletDeployment",Or(!1));de(this,"signClientWarningType",Or(!1));de(this,"walletRequestHandler");de(this,"local",{lastConnectedExternalProviderInfo:new Np(dh.LAST_CONNECTED_EXTERNAL_PROVIDER_INFO)});de(this,"defaultNetwork",new Np(dh.DEFAULT_NETWORK));de(this,"getLastConnectedExternalProviderInfo",()=>this.local.lastConnectedExternalProviderInfo.get());de(this,"sendToken",async(e,r,n)=>{var i,s;try{const o=this.store.get(yi).account,a=e.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Nn).providerForChainId(a);this.isSendingTokenTransaction.set({tokenBalance:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(!n)return{hash:""};if(e.contractType===hh.NATIVE?(console.info("Sending native token with address, on chainId: ",e.contractAddress,a),p={to:r,value:E6e(n)}):e.contractType===hh.ERC20&&(console.info("Sending ERC20 token with address, on chainId: ",e.contractAddress,a),p=await new Dn(e.contractAddress,jv,c).transfer.populateTransaction(r,W7(n,((s=e.contractInfo)==null?void 0:s.decimals)??18))),!p)throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingTokenTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction")}});de(this,"sendCollectible",async(e,r,n)=>{var i,s;try{const o=this.store.get(yi).account,a=e.collectibleInfoParams.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Nn).providerForChainId(a);this.isSendingCollectibleTransaction.set({collectibleInfo:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(e.collectibleInfoParams.contractType==="ERC721")console.info("Sending ERC721 non-fungible token with address, on chainId: ",e.collectibleInfoParams.address,a),p=await new Dn(e.collectibleInfoParams.address,hM,c).safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId);else if(e.collectibleInfoParams.contractType==="ERC1155"){console.info("Sending ERC1155 token with address, on chainId: ",e.collectibleInfoParams.address,a);const y=new Dn(e.collectibleInfoParams.address,pM,c);if(!n)return{hash:""};p=await y.safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId,W7(n,((s=e==null?void 0:e.collectibleInfoResponse)==null?void 0:s.decimals)??18),"0x")}if(!p)throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingCollectibleTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction")}});de(this,"setExternalProvider",async e=>{if(!e){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0),this.local.lastConnectedExternalProviderInfo.set(void 0);return}const n=(await this.getExternalProviderAccounts(e.provider))[0];this.local.lastConnectedExternalProviderInfo.set(e.info),this.selectedExternalProvider.set(e),this.selectedExternalWalletAddress.set(n),e.provider.on("accountsChanged",async i=>{if(i.length===0){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0);return}if(i[0]!==n){const o=(await this.getExternalProviderAccounts(e.provider))[0];this.selectedExternalWalletAddress.set(o)}})});de(this,"resetSignObservables",()=>{this.isSigningTxn.set(!1),this.toSignTxnDetails.set(void 0),this.toSignMsgDetails.set(void 0),this.toSignPermission.set(void 0),this.toSignResult.set(void 0)});de(this,"checkWalletDeployment",async e=>{const r=this.store.get(yi).account;if(!r)throw new Error("No account found");return(await r.status(e)).onChain.deployed});this.store=e,this.walletRequestHandler=new nFe(void 0,new fFe(e),this.networkStore.networks.get()),this.walletRequestHandler.onConnectOptionsChange=n=>{this.connectOptions.set(n)},this.availableExternalProviders.subscribe(n=>{const i=this.local.lastConnectedExternalProviderInfo.get(),s=n.find(o=>(i==null?void 0:i.name)===o.info.name);s&&this.setExternalProvider(s)});const r=this.store.get(yi).account;this.walletRequestHandler.signIn(r??null)}async sendTransaction(e,r,n,i,s){const o=await e.status(s),a=await e.predecorateTransactions(i,o,s),c=await e.signTransactions(a,s,void 0,{serial:!0}),l=await e.decorateTransactions(c,o);await this.switchToChain(r,s);const f=await r.request({method:"eth_estimateGas",params:[{from:n,to:l.entrypoint,data:mt.transaction.encodeBundleExecData(l)}]});return{hash:await r.request({method:"eth_sendTransaction",params:[{from:n,to:l.entrypoint,data:mt.transaction.encodeBundleExecData(l),gas:f}]})}}async getExternalProviderAccounts(e){return new Promise((r,n)=>{var i;(i=e.sendAsync)==null||i.call(e,{method:"eth_requestAccounts",params:[]},(s,o)=>{s&&n(s),o.result.length===0&&n(new Error("No accounts found")),r(o.result)})})}async getExternalProviderAddress(e){return(await this.getExternalProviderAccounts(e))[0]}async switchToChain(e,r){return new Promise((n,i)=>{var s;(s=e.sendAsync)==null||s.call(e,{method:"wallet_switchEthereumChain",params:[{chainId:zc(r)}]},(o,a)=>{o&&i(o),n(a)})})}}class fFe{constructor(e){this.store=e}getDefaultChainId(){return this.store.get(Zr).defaultNetwork.get()??1}async promptChangeNetwork(e){return this.store.get(Nn).networks.get().some(n=>n.chainId===e)?(this.store.get(Zr).defaultNetwork.set(e),!0):!1}async promptConfirmWalletDeploy(e,r){if(console.log("prompt confirm wallet deploy:",e,r),!e)return Promise.resolve(!1);const n=await this.store.get(Zr).checkWalletDeployment(e);return new Promise((i,s)=>{i(!!n)})}async promptConnect(e){console.log("promptconnect",e);const r=this.store.get(yi).account;return await this.store.get(Zr).walletRequestHandler.signIn(r??null),e&&this.store.get(Zr).walletRequestHandler.setConnectOptions(e),new Promise((n,i)=>{const s=this.store.get(Zr).connectDetails.subscribe(o=>{s(),!o||!o.connected?i("connect cancelled by user"):n(o)})})}async promptSignInConnect(e){return console.log("prompt sign in connect:",e),{connected:!1}}async promptSignMessage(e,r){return console.log("prompt sign message:",e,r),e.chainId?e.eip6492!==!0&&!(await this.store.get(yi).account.status(e.chainId)).canOnchainValidate&&!await this.promptConfirmWalletDeploy(e.chainId,r)?(this.store.get(Zr).signClientWarningType.set("notDeployed"),Promise.reject("User rejected wallet deploy request")):(this.store.get(Zr).isSigningMsg.set(!0),this.store.get(Zr).toSignMsgDetails.set({message:e,chainId:e.chainId,options:r}),new Promise((n,i)=>{const s=this.store.get(Zr).toSignPermission.subscribe(()=>{s();const o=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!o||o==="cancelled")i("request failed");else{const a=this.store.get(Zr).toSignResult.get();a&&n(a.hash)}})})):Promise.reject("No chainId found in message")}promptSignTransaction(e,r,n){console.log("prompt sign transaction:",e,r,n);let i;Array.isArray(e)?i=e:i=[e];const s=this.store.get(yi).accountAddress.get();if(!s)throw new Error("Unknown account address");const o=mt.transaction.fromTransactionish(s,i);return console.log("prompt sign txn:",o,r,n),_I(s,i),new Promise((a,c)=>{this.store.get(Zr).toSignTxnDetails.set({txn:i,chainId:r,options:n}),this.store.get(Zr).isSigningTxn.set(!0);const l=this.store.get(Zr).toSignPermission.subscribe(()=>{l();const f=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!f||f==="cancelled")c("request failed");else{const u=this.store.get(Zr).toSignResult.get();u&&a(u.hash)}})})}promptSendTransaction(e,r,n){return this.promptSignTransaction(e,r,n)}}async function Fte(t){return await PLe.init({projectId:lX,showQrModal:t,optionalChains:[1],metadata:{name:"Sequence Recovery Wallet External Wallet",description:"",url:"TODO_CHANGE_LATER",icons:[]}})}function uFe(){const[t,e]=D.useState(null),n=Ir(Zr).getLastConnectedExternalProviderInfo();return D.useEffect(()=>{async function i(){const s=await Fte(!1);await s.enable(),e(s)}return(n==null?void 0:n.name)==="WalletConnect"&&i(),()=>{t&&t.disconnect()}},[]),t}const k$=async(t,e,r=15)=>{let n,i=0;do{if(i>5&&await new Promise(s=>setTimeout(s,100*i)),n=await t.getTransactionReceipt(e),i===r){console.warn(`Could not get receipt for transaction ${e} after ${i} tries`);return}if(n)return n;i++}while(!n&&i<=r)};let L6=[];const cS={value:()=>L6,subscribe:t=>{function e(r){L6.some(n=>n.info.uuid===r.detail.info.uuid)||(L6=[...L6,r.detail],t())}return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}},jte=()=>D.useSyncExternalStore(cS.subscribe,cS.value,cS.value);class NE{constructor(e){de(this,"authStore",Ir(yi));de(this,"accountAddress",this.authStore.accountAddress.get());de(this,"isReady",Or(!1));de(this,"signClient");de(this,"currentRequestInfo");de(this,"allSessions",Or([]));de(this,"sessions",this.allSessions.readOnly());de(this,"createSignClient",async()=>{this.signClient=await OE.init({projectId:lX,metadata:{name:"Sequence Recovery Wallet",description:"Sequence Recovery Wallet - Recover Your Wallet",url:"http://localhost:5173",icons:["https://sequence.app/apple-touch-icon.png"]}}),this.signClient.on("session_proposal",this.onSessionProposal),this.signClient.on("session_request",this.onSessionRequest),this.signClient.on("session_ping",this.onSessionPing),this.signClient.on("session_event",this.onSessionEvent),this.signClient.on("session_update",this.onSessionUpdate),this.signClient.on("session_delete",this.onSessionDelete);const e=this.getSignClientSessions();e?this.allSessions.set(e):this.allSessions.set([]),this.isReady.set(!0)});de(this,"getSignClientSessions",()=>this.signClient.session.getAll().filter(r=>r.self.metadata.name!=="Sequence Recovery Wallet External Wallet"));de(this,"pair",async e=>{if(!this.signClient)throw new Error("WalletConnect signClient not initialized.");await this.signClient.core.pairing.pair({uri:e}),this.allSessions.set(this.getSignClientSessions())});de(this,"rejectRequest",()=>{var e;this.currentRequestInfo&&((e=this.signClient)==null||e.respond({topic:this.currentRequestInfo.topic,response:{id:this.currentRequestInfo.id,jsonrpc:"2.0",error:{message:"User rejected.",code:4001}}}))});de(this,"disconnectSession",async e=>{var n,i;const r=(n=this.signClient)==null?void 0:n.session.get(e);r&&(await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:r.topic,reason:{message:"User disconnected.",code:6e3}})),this.allSessions.set(this.getSignClientSessions()??[]))});de(this,"disconnectAllSessions",async()=>{var r;(((r=this.signClient)==null?void 0:r.session.getAll())??[]).forEach(async n=>{var i;await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:n.topic,reason:{message:"User disconnected.",code:6e3}}))}),this.allSessions.set([])});de(this,"onSessionProposal",async e=>{var l,f,u,p,g;console.log("onSessionProposal",e);const r=e.params.requiredNamespaces,n=e.params.optionalNamespaces,i=Object.keys(r).length===0?[]:r.eip155.chains??[],s=Object.keys(n).length===0?[]:n.eip155.chains??[],o=((l=i[0])==null?void 0:l.split(":").pop())??((f=s[0])==null?void 0:f.split(":").pop());if(!o)throw new Error("No chainId found in WalletConnect session proposal namespaces.");const a={app:e.params.proposer.metadata.name,origin:e.params.proposer.metadata.url,networkId:o,keepWalletOpened:!0},c=await this.store.get(Zr).walletRequestHandler.promptConnect(a);if(c&&c.connected){const b=this.store.get(Nn).networks.get(),I=i.map(_=>Number(_.split(":").pop())),C=s.map(_=>Number(_.split(":").pop())),L={eip155:{accounts:b.map(_=>_.chainId).filter(_=>[...I,...C].includes(_)).map(_=>"eip155:"+_+":"+this.accountAddress),methods:["eth_sendTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain"],events:["chainChanged","accountsChanged","connect","disconnect"]}},F=await((u=this.signClient)==null?void 0:u.approve({id:e.id,namespaces:L})),z=await(F==null?void 0:F.acknowledged());console.log("session",z),this.allSessions.set(this.getSignClientSessions()??[]),(p=this.signClient)==null||p.core.pairing.getPairings().filter(_=>e.params.pairingTopic!==_.topic).forEach(async _=>{var $,ie;e.params.proposer.metadata.url===(($=_.peerMetadata)==null?void 0:$.url)&&await((ie=this.signClient)==null?void 0:ie.core.pairing.disconnect({topic:_.topic}))})}else(g=this.signClient)==null||g.reject({id:e.id,reason:{message:"User rejected.",code:5e3}})});de(this,"onSessionRequest",async e=>{var o,a,c;console.log("onSessionRequest",e);const r=e.params.chainId.split(":").pop(),n={jsonrpc:"2.0",id:e.id,method:e.params.request.method,params:e.params.request.params,chainId:Number(r)};n.method==="eth_sendTransaction"&&Array.isArray(n.params)&&n.params.forEach(l=>{delete l.nonce});const i=(o=this.signClient)==null?void 0:o.session.get(e.topic),s={app:(i==null?void 0:i.peer.metadata.name)??"",origin:i==null?void 0:i.peer.metadata.url,networkId:r};this.store.get(Zr).walletRequestHandler.setConnectOptions(s),this.currentRequestInfo={topic:e.topic,id:e.id};try{const l=await this.store.get(Zr).walletRequestHandler.request(n);(a=this.signClient)==null||a.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",result:l}})}catch(l){(c=this.signClient)==null||c.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",error:{message:l.message,code:l.code??4001}}})}this.currentRequestInfo=void 0});de(this,"onSessionPing",async e=>{console.log("onSessionPing",e)});de(this,"onSessionEvent",async e=>{console.log("onSessionEvent",e)});de(this,"onSessionUpdate",async e=>{console.log("onSessionUpdate",e)});de(this,"onSessionDelete",async e=>{console.log("onSessionDelete",e),this.allSessions.set(this.getSignClientSessions()??[])});this.store=e,this.createSignClient()}}const M$=["https://dweb.link/ipfs/","https://gateway.pinata.cloud/ipfs/","https://nftstorage.link/ipfs/","https://flk-ipfs.io/ipfs/","https://storry.tv/ipfs/","https://ipfs.io/ipfs/","https://hardbin.com/ipfs/","https://ipfs.runfission.com/ipfs/","https://ipfs.eth.aragon.network/ipfs/","https://4everland.io/ipfs/","https://w3s.link/ipfs/","https://trustless-gateway.link/ipfs/"],dFe="QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1";class hFe{constructor(){de(this,"gatewayURL");de(this,"localStore");this.localStore=new Np(dh.GATEWAY_ADDRESS),this.gatewayURL=this.localStore.get(),this.findAccessibleGateway()}async findAccessibleGateway(){const e=this.localStore.get();if(e&&await this.isGatewayAccessible(e)){this.gatewayURL=e;return}for(const r of M$)if(await this.isGatewayAccessible(r)){this.gatewayURL=r,this.localStore.set(r);return}this.gatewayURL=M$[0],console.warn("No accessible IPFS gateways found, falling back to default")}async isGatewayAccessible(e){try{return await fetch(`${e}${dFe}`,{signal:AbortSignal.timeout(3e3)}),!0}catch{return!1}}async fetch(e){this.gatewayURL||await this.findAccessibleGateway();const r=await this.getGatewayURL(e);return fetch(r,{signal:AbortSignal.timeout(3e3)})}async getGatewayURL(e){if(this.gatewayURL||await this.findAccessibleGateway(),!e.startsWith("ipfs://"))throw new Error("Invalid IPFS URI");return e.replace("ipfs://",this.gatewayURL)}}class YM{constructor(e){de(this,"isFetchingBalances",Or(!1));de(this,"isFetchingCollectibleInfo",Or(!1));de(this,"ipfsGatewayHelper",new hFe);de(this,"userCollectibles",Or([]));de(this,"local",{userCollectibles:new Np(dh.COLLECTIBLES)});this.store=e;const r=this.store.get(Nn);pX(r.networks,n=>{const i=this.store.get(yi).accountAddress.get();i&&n.length>0&&this.loadBalances(i)})}async loadBalances(e){const r=this.local.userCollectibles.get()??[];if(r.length===0)return;this.isFetchingBalances.set(!0);const n=[],i=r.map(async s=>{const o=await this.getCollectibleInfo(s);if(!o.isOwner){this.removeCollectible({collectibleInfoParams:s,collectibleInfoResponse:o});return}n.push({collectibleInfoParams:s,collectibleInfoResponse:o})});await Promise.allSettled(i),this.userCollectibles.set(n),this.isFetchingBalances.set(!1)}async getCollectibleInfo(e){const r=this.store.get(yi).accountAddress.get();if(!r)throw new Error("No account found");const n=this.store.get(Nn).providerForChainId(e.chainId);this.isFetchingCollectibleInfo.set(!0);let i,s,o,a,c;if(e.contractType===hh.ERC721){const f=new Dn(e.address,hM,n),p=(await f.ownerOf(e.tokenId)).toLowerCase()===r.toLowerCase();if(!p)return this.isFetchingCollectibleInfo.set(!1),{isOwner:p,uri:""};i=await f.tokenURI(e.tokenId)}else if(e.contractType===hh.ERC1155){const f=new Dn(e.address,pM,n);if(a=await f.balanceOf(r,e.tokenId),!a)return this.isFetchingCollectibleInfo.set(!1),{isOwner:!1,uri:""};i=await f.uri(e.tokenId)}if(!i)throw new Error("Could not get collectible URI");i.includes("{id}")&&(i=i.replace("{id}",e.tokenId.toString()));let l;return i.startsWith("ipfs://")?l=await this.ipfsGatewayHelper.fetch(i).then(f=>f.json()):l=await fetch(i).then(f=>f.json()),l&&(c=l.decimals,s=l.image,o=l.name),s!=null&&s.startsWith("ipfs://")&&(s=await this.ipfsGatewayHelper.getGatewayURL(s)),a=a??BigInt(1),c=c??0,this.isFetchingCollectibleInfo.set(!1),{isOwner:!0,uri:i,image:s,name:o,balance:a,decimals:c}}async addCollectible(e){if(e.collectibleInfoResponse.isOwner){const r=this.local.userCollectibles.get()??[];if(r.some(n=>n.address===e.collectibleInfoParams.address&&n.tokenId===e.collectibleInfoParams.tokenId))throw new Error("Collectible already added");this.local.userCollectibles.set([...r,e.collectibleInfoParams]),this.isFetchingCollectibleInfo.set(!0),this.loadBalances(),this.isFetchingCollectibleInfo.set(!1)}}async removeCollectible(e){const n=(this.local.userCollectibles.get()??[]).filter(i=>i.address!==e.collectibleInfoParams.address||i.tokenId!==e.collectibleInfoParams.tokenId);this.local.userCollectibles.set(n)}}function BE({chainId:t,paddingTop:e="1",paddingBottom:r="2"}){return W.jsx(xe,{background:"backgroundMuted",width:"fit",height:"fit",borderRadius:"sm",paddingTop:e,paddingBottom:r,paddingX:"2",children:W.jsx(Ge,{variant:"xsmall",color:"text100",children:ky(t)})})}function pFe({collectibleInfo:t,onSendClick:e,onRemoveClick:r}){return W.jsxs($r,{width:"full",flexDirection:"column",gap:"2",padding:"4",children:[W.jsx(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsx(Ge,{variant:"medium",color:"text80",children:t.collectibleInfoResponse.name??"Collectible"})}),W.jsx(xe,{style:{height:"200px"},children:W.jsx(a8,{style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"},src:t.collectibleInfoResponse.image??"",width:"full"})}),W.jsx(xe,{justifyContent:"flex-end",children:W.jsx(Ge,{variant:"medium",color:"text100",children:t.collectibleInfoParams.contractType==="ERC1155"?Number(fh(t.collectibleInfoResponse.balance,t.collectibleInfoResponse.decimals??0)):1})}),W.jsxs(xe,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(BE,{chainId:t.collectibleInfoParams.chainId}),W.jsxs(xe,{children:[W.jsx(Zt,{size:"xs",label:"Send",variant:"primary",shape:"square",onClick:e}),r&&W.jsx(Zt,{marginLeft:"2",size:"xs",label:"Remove",shape:"square",onClick:r})]})]})]})}function vFe({onClose:t}){const r=Ir(Nn).networks.get(),n=r.filter(z=>z.type===Ft.MAINNET),i=Ir(YM),s=yn(i.isFetchingCollectibleInfo),o=h8(),[a,c]=D.useState(),[l,f]=D.useState(),[u,p]=D.useState(),[g,y]=D.useState(),[b,I]=D.useState(),[C,S]=D.useState(!1);D.useEffect(()=>{a&&l&&u&&g?i.getCollectibleInfo({chainId:a.chainId,address:l,tokenId:u,contractType:g}).then(z=>{I(z)}):I(void 0)},[a,l,u,g]);const O=n.map(z=>({label:z.title,value:z.chainId.toString()})),L=async()=>{a&&l&&b&&u&&g&&(await i.addCollectible({collectibleInfoParams:{chainId:a.chainId,address:l,tokenId:u,contractType:g},collectibleInfoResponse:b}),S(!1),o({variant:"success",title:"Collectible added"}),F(),t())},F=()=>{f(void 0),c(void 0),p(void 0),y(void 0)};return W.jsxs($r,{flexDirection:"column",paddingY:"4",paddingX:"8",marginBottom:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:C,children:[W.jsx(xe,{children:W.jsx(Ge,{variant:"medium",color:"text80",children:"Import ERC721 or ERC1155 Collectible"})}),W.jsxs(xe,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(M7,{label:"Collectible Network",labelLocation:"left",name:"collectibleNetwork",options:O,onValueChange:z=>c(r.find(_=>_.chainId===Number(z)))}),W.jsx(Wn,{width:"full",label:"Collectible Address",labelLocation:"left",name:"collectibleAddress",value:l??"",onChange:z=>{f(z.target.value)}}),W.jsx(M7,{label:"Collectible Type",labelLocation:"left",name:"collectibleType",options:[{value:"ERC721",label:"ERC721"},{value:"ERC1155",label:"ERC1155"}],onValueChange:z=>y(z)}),W.jsx(Wn,{width:"full",label:"Collectible Token ID",labelLocation:"left",name:"collectibleId",value:u??"",onKeyPress:z=>{/[0-9]/.test(z.key)||z.preventDefault()},onChange:z=>{if(z.target.value===""){p(void 0);return}p(z.target.value)}}),s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})}),b&&!b.isOwner&&!s&&W.jsx(xe,{alignItems:"center",justifyContent:"center",children:W.jsx(Ge,{variant:"medium",color:"warning",children:"You do not own this collectible"})}),b&&b.isOwner&&!s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx($r,{flexDirection:"column",gap:"2",children:W.jsxs(xe,{flexDirection:"row",gap:"6",children:[W.jsx("img",{src:b.image??"",alt:b.name??"",style:{width:"120px",height:"auto"}}),W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Ge,{variant:"medium",color:"text100",children:b.name??""}),W.jsx(W.Fragment,{children:b.balance&&W.jsxs(W.Fragment,{children:[W.jsx(Ge,{variant:"small",color:"text80",children:"Your Balance:"}),W.jsx(Ge,{variant:"medium",color:"text100",children:Number(fh(b.balance,b.decimals??0))})]})})]})]})})}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:C,onClick:()=>{F(),t()}}),W.jsx(Zt,{label:"Add",disabled:b===void 0||!b.isOwner||C,variant:"primary",size:"md",shape:"square",onClick:L})]})]})]})}function gFe({onSendClick:t}){const e=Ir(YM),r=yn(e.isFetchingBalances),n=yn(e.userCollectibles),i=D.useMemo(()=>n,[n]),[s,o]=D.useState(!1);return W.jsxs(W.Fragment,{children:[W.jsxs(xe,{width:"full",flexDirection:"row",flexWrap:"wrap",gap:"4",marginBottom:"8",children:[i.map(a=>W.jsx(xe,{width:"1/3",children:W.jsx(pFe,{collectibleInfo:a,onSendClick:()=>{t(a)},onRemoveClick:()=>{e.removeCollectible(a)}})},a.collectibleInfoParams.chainId+a.collectibleInfoParams.address+a.collectibleInfoParams.tokenId)),r&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})]}),W.jsxs(xe,{width:"full",flexDirection:"column",alignItems:"center",justifyContent:"center",marginBottom:"4",children:[s&&W.jsx(vFe,{onClose:()=>o(!1)}),W.jsx(Zt,{label:"Import collectible",leftIcon:UH,variant:"primary",size:"md",shape:"square",onClick:()=>{o(!0)}})]})]})}function yFe({onClose:t}){const e=Ir(Nn),r=h8(),[n,i]=D.useState(),[s,o]=D.useState(),[a,c]=D.useState(),[l,f]=D.useState(),[u,p]=D.useState(),[g,y]=D.useState(),b=async()=>{n&&s&&a&&l&&await e.addNetwork({chainId:Number(n),name:s,title:s,type:Ft.MAINNET,rpcUrl:a,blockExplorer:{rootUrl:l},nativeToken:{name:u||"Ether",symbol:g||"ETH",decimals:18}})},I=()=>{i(void 0),o(void 0),c(void 0),f(void 0),p(void 0),y(void 0)};return W.jsxs(xe,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(Wn,{width:"full",label:"Chain ID",labelLocation:"left",name:"chainId",value:n??"",onChange:C=>{i(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Network Name",labelLocation:"left",name:"networkName",value:s??"",onChange:C=>{o(C.target.value)}}),W.jsx(Wn,{width:"full",label:"RPC URL",labelLocation:"left",name:"rpcUrl",value:a??"",onChange:C=>{c(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Block explorer URL",labelLocation:"left",name:"rpcUrl",value:l??"",onChange:C=>{f(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Native Token Name",labelLocation:"left",name:"tokenName",value:u??"",onChange:C=>{p(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Native Token Symbol",labelLocation:"left",name:"tokenSymbol",value:g??"",onChange:C=>{y(C.target.value)}}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{I(),t()}}),W.jsx(Zt,{label:"Add",variant:"primary",size:"md",shape:"square",onClick:async()=>{try{await b(),r({variant:"success",title:"Network added",description:`You can now use ${s} network`}),I(),t()}catch(C){r({variant:"error",title:"Could not add network",description:C.message}),console.error(C)}}})]})]})}function R$({network:t}){var f,u;const e=Ir(Nn),n=yn(e.userAdditionNetworkChainIds).includes(t.chainId);D.useEffect(()=>{var p,g;(s!==t.rpcUrl||a!==((p=t.blockExplorer)==null?void 0:p.rootUrl))&&(o(t.rpcUrl),c(((g=t.blockExplorer)==null?void 0:g.rootUrl)??""))},[t]);const i=e.editedNetworkChainIds.get().includes(t.chainId),[s,o]=D.useState(t.rpcUrl),[a,c]=D.useState(((f=t.blockExplorer)==null?void 0:f.rootUrl)??""),l=s!==t.rpcUrl||a!==((u=t.blockExplorer)==null?void 0:u.rootUrl);return W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Ge,{fontWeight:"bold",color:"text100",children:t.title}),W.jsx(Wn,{label:"RPC URL",labelLocation:"left",name:"rpcUrl",spellCheck:!1,disabled:n,value:s??"",onChange:p=>{o(p.target.value)}}),W.jsx(Wn,{label:"Block Explorer URL",labelLocation:"left",name:"blockExplorerUrl",spellCheck:!1,disabled:n,value:a??"",onChange:p=>{c(p.target.value)}}),n&&W.jsxs(xe,{marginTop:"4",alignItems:"center",justifyContent:"flex-end",gap:"5",children:[W.jsx(Ge,{variant:"small",color:"text50",children:"Added by you"}),W.jsx(Zt,{label:"Remove",variant:"danger",size:"md",shape:"square",onClick:()=>e.removeNetwork(t.chainId)})]}),(l||i)&&!n&&W.jsxs(xe,{marginTop:"4",justifyContent:"flex-end",gap:"3",children:[W.jsx(W.Fragment,{children:i&&W.jsx(Zt,{label:"Reset to default",variant:"danger",size:"md",shape:"square",onClick:()=>e.resetNetworkEdit(t.chainId)})}),W.jsx(W.Fragment,{children:l&&W.jsx(Zt,{label:"Save",variant:"primary",size:"md",shape:"square",onClick:()=>{const p=t;p.rpcUrl=s,p.blockExplorer={rootUrl:a},p.relayer=_3(s),e.editNetwork(p)}})})]}),W.jsx(Sh,{})]})}function mFe(){const t=Ir(Nn),e=yn(t.networks),r=e.filter(f=>f.type===Ft.MAINNET),n=yn(t.userAdditionNetworkChainIds),i=r.sort((f,u)=>n.includes(f.chainId)?-1:1),s=e.filter(f=>f.type===Ft.TESTNET),[o,a]=D.useState(Ft.MAINNET),[c,l]=D.useState(!1);return W.jsxs(xe,{flexDirection:"column",paddingY:"4",paddingX:"8",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",children:[W.jsx(xe,{children:W.jsx(Ge,{variant:"large",color:"text80",children:"Networks"})}),W.jsx(xe,{width:"full",marginTop:"4",paddingBottom:"4",children:W.jsxs(vwe,{value:o,onValueChange:f=>a(f),children:[W.jsx(xe,{marginBottom:"10",children:W.jsx(pwe,{value:o,tabs:[{label:"Networks",value:Ft.MAINNET},{label:"Test Networks",value:Ft.TESTNET}]})}),W.jsx(HB,{value:Ft.MAINNET,children:W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsxs(xe,{width:"full",flexDirection:"column",alignItems:"flex-end",marginY:"4",children:[W.jsx(Zt,{label:"Add network",variant:"primary",size:"md",shape:"square",onClick:()=>{l(!0)}}),c&&W.jsx(yFe,{onClose:()=>l(!1)})]}),W.jsx(W.Fragment,{children:i.map((f,u)=>W.jsx(R$,{network:f},u))})]})}),W.jsx(HB,{value:Ft.TESTNET,children:W.jsx(xe,{flexDirection:"column",gap:"2",children:s.map((f,u)=>W.jsx(R$,{network:f},u))})})]})})]})}function lS({symbol:t,chainId:e,to:r,amount:n}){return W.jsxs(xe,{flexDirection:"column",width:"full",gap:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",children:"Pending transaction"}),W.jsxs(xe,{background:"backgroundMuted",flexDirection:"row",width:"full",height:"fit",borderRadius:"sm",paddingX:"4",paddingY:"2",alignItems:"center",gap:"5",children:[W.jsx(lh,{size:"md"}),W.jsxs(xe,{flexDirection:"column",gap:"1",children:[W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"1",children:[W.jsxs(Ge,{variant:"small",color:"text100",children:["Sending ",n," ",t," on"]}),W.jsx(BE,{chainId:e,paddingTop:"0",paddingBottom:"1"}),W.jsxs(Ge,{variant:"small",color:"text80",children:["to ",r]})]}),W.jsx(Ge,{variant:"small",color:"text50",children:"Your external wallet will prompt you to confirm the transaction"})]})]})]})}function bFe({onSelectProvider:t}){const e=Ir(NE),r=jte(),[n,i]=D.useState(!1),s=()=>window.confirm("All WalletConnect Dapp sessions will be disconnected. If you would like to continue, click OK and connect to WalletConnect again."),o=async()=>{try{if(!n){if(e.allSessions.get().length!==0){if(!s())throw new Error("User rejected wallet connect modal");await e.disconnectAllSessions(),t();return}i(!0);const a=await Fte(!0);await a.connect();let c=hre(a);t(c)}}catch(a){console.error(a)}};return W.jsx(W.Fragment,{children:!n&&W.jsxs(xe,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Select an external wallet to send transactions"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(xe,{flexDirection:"column",gap:"4",padding:"8",children:[W.jsx($r,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>{o()},children:W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:"https://avatars.githubusercontent.com/u/37784886",alt:"Wallet Connect",style:{width:"20px",height:"20px"}}),W.jsx(Ge,{variant:"normal",color:"text100",children:"Wallet Connect"})]})}),r.map(a=>W.jsx($r,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>t(a),children:W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:a.info.icon,alt:a.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Ge,{variant:"normal",color:"text100",children:a.info.name})]})},a.info.uuid))]})]})})}function wFe({collectibleInfo:t,onClose:e}){var y,b,I;const r=KP("isMobile"),n=Ir(Zr),[i,s]=D.useState(void 0),[o,a]=D.useState(void 0),[c,l]=D.useState(!1),[f,u]=D.useState(!1);if(D.useEffect(()=>{const C=n.selectedExternalWalletAddress.get();c&&C&&a(n.selectedExternalWalletAddress.get())},[c]),D.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=t.collectibleInfoParams.contractType==="ERC721",g=ky(t.collectibleInfoParams.chainId);return W.jsxs(xe,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(y=t==null?void 0:t.collectibleInfoResponse)==null?void 0:y.name," on ",g]}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(xe,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Wn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:p?"1":i??"",onChange:C=>{s(C.target.value)},disabled:p,controls:W.jsx(W.Fragment,{children:t.collectibleInfoParams.contractType==="ERC1155"&&W.jsx(Zt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var C,S;s(fh((C=t==null?void 0:t.collectibleInfoResponse)==null?void 0:C.balance,((S=t==null?void 0:t.collectibleInfoResponse)==null?void 0:S.decimals)??18))}})})}),W.jsxs(Ge,{variant:"small",color:"text50",children:["Current balance:"," ",fh((b=t==null?void 0:t.collectibleInfoResponse)==null?void 0:b.balance,((I=t==null?void 0:t.collectibleInfoResponse)==null?void 0:I.decimals)??18)]})]}),W.jsxs(xe,{flexDirection:"column",gap:"3",children:[W.jsx(Wn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:C=>{a(C.target.value)},disabled:c}),W.jsx(eP,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:C=>l(C===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Zt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!(p&&o||!p&&o&&i),onClick:()=>{e(o,i)}})]})]})]})}function xFe({tokenBalance:t,onClose:e}){var g,y;const r=KP("isMobile"),n=Ir(Zr),[i,s]=D.useState(void 0),[o,a]=D.useState(void 0),[c,l]=D.useState(!1),[f,u]=D.useState(!1);if(D.useEffect(()=>{const b=n.selectedExternalWalletAddress.get();c&&b&&a(n.selectedExternalWalletAddress.get())},[c]),D.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=ky(t.chainId);return W.jsxs(xe,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(g=t==null?void 0:t.contractInfo)==null?void 0:g.symbol," on ",p]}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(xe,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Wn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:i??"",onChange:b=>{s(b.target.value)},controls:W.jsx(Zt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var b;s(fh(t==null?void 0:t.balance,((b=t==null?void 0:t.contractInfo)==null?void 0:b.decimals)??18))}})}),W.jsxs(Ge,{variant:"small",color:"text50",children:["Current balance:"," ",fh(t==null?void 0:t.balance,((y=t==null?void 0:t.contractInfo)==null?void 0:y.decimals)??18)]})]}),W.jsxs(xe,{flexDirection:"column",gap:"3",children:[W.jsx(Wn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:b=>{a(b.target.value)},disabled:c}),W.jsx(eP,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:b=>l(b===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Zt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})]})}function EFe({onTokenListClick:t}){const e=Ir(yi),r=rk();return W.jsxs(Kye,{children:[W.jsx(Zt,{as:Yye,label:"Settings",variant:"text"}),W.jsx(Qye,{side:"bottom",align:"end",sideOffset:20,children:W.jsxs(xe,{marginTop:"2",children:[W.jsx(HA,{onClick:t,children:W.jsx(xe,{padding:"1",children:W.jsx(Ge,{variant:"normal",fontWeight:"bold",children:"Token List"})})}),W.jsx(HA,{disabled:!0,children:W.jsx(xe,{width:"16",children:W.jsx(Sh,{color:"white"})})}),W.jsx(HA,{onClick:()=>{e.logout(),r("/")},children:W.jsx(xe,{padding:"1",children:W.jsx(Ge,{variant:"normal",fontWeight:"bold",children:"Log out"})})})]})})]})}function CFe(){const t=Ir(Tx),e=yn(t.userAddedTokens);return W.jsxs(xe,{flexDirection:"column",paddingY:"4",paddingX:"8",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",children:[W.jsxs(xe,{flexDirection:"column",alignItems:"center",gap:"4",marginBottom:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",children:"Token List"}),W.jsx(Ge,{variant:"normal",color:"text50",children:"Tokens added by you can be removed here"})]}),W.jsxs(xe,{width:"full",height:"full",flexDirection:"column",marginTop:"4",paddingBottom:"12",gap:"4",children:[e.length===0&&W.jsx(xe,{height:"full",alignItems:"center",justifyContent:"center",children:W.jsx(Ge,{variant:"medium",color:"text50",marginBottom:"16",children:"You haven't added any tokens yet"})}),e.map((r,n)=>W.jsxs($r,{width:"full",flexDirection:"row",gap:"2",alignItems:"center",children:[W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Ge,{variant:"medium",color:"text80",children:r.symbol}),W.jsx(Ge,{variant:"normal",color:"text50",children:r.address}),W.jsx(BE,{chainId:r.chainId})]}),W.jsx(xe,{marginLeft:"auto",children:W.jsx(Zt,{label:"Remove",variant:"danger",size:"md",shape:"square",onClick:()=>{t.removeToken(r)}})})]},n))]})]})}function AFe({onClose:t}){const r=Ir(Nn).networks.get(),n=r.filter(S=>S.type===Ft.MAINNET),i=Ir(Tx),s=yn(i.isFetchingTokenInfo),o=h8(),[a,c]=D.useState(),[l,f]=D.useState(),[u,p]=D.useState(),[g,y]=D.useState(!1);D.useEffect(()=>{a&&l?i.getTokenInfo(a.chainId,l).then(S=>{p(S)}):p(void 0)},[a,l]);const b=n.map(S=>({label:S.title,value:S.chainId.toString()})),I=async()=>{a&&l&&u&&(y(!0),await i.addToken({chainId:a.chainId,address:l,contractType:hh.ERC20,symbol:u.symbol,decimals:u.decimals}),y(!1),o({variant:"success",title:"Token added"}),C(),t())},C=()=>{f(void 0),c(void 0)};return W.jsxs($r,{flexDirection:"column",paddingY:"4",paddingX:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:g,children:[W.jsx(xe,{children:W.jsx(Ge,{variant:"medium",color:"text80",children:"Import ERC20 Token"})}),W.jsxs(xe,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(M7,{label:"Token Network",labelLocation:"left",name:"tokenNetwork",options:b,onValueChange:S=>c(r.find(O=>O.chainId===Number(S)))}),W.jsx(Wn,{width:"full",label:"Token Address",labelLocation:"left",name:"tokenAddress",value:l??"",onChange:S=>{f(S.target.value)}}),s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})}),u&&W.jsxs(W.Fragment,{children:[W.jsx(Wn,{width:"full",label:"Token Symbol",labelLocation:"left",name:"tokenSymbol",value:(u==null?void 0:u.symbol)??"",disabled:!0}),W.jsx(Wn,{width:"full",label:"Token Decimals",labelLocation:"left",name:"tokenDecimals",value:(u==null?void 0:u.decimals)??"",disabled:!0})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:g,onClick:()=>{C(),t()}}),W.jsx(Zt,{label:"Add",disabled:u===void 0||g,variant:"primary",size:"md",shape:"square",onClick:I})]})]})]})}const SFe=(t,e)=>Math.floor(t*10**e)/10**e;function _Fe({disabled:t,tokenBalance:e,onSendClick:r,onRemoveClick:n}){var o,a;const i=fh(e.balance,((o=e.contractInfo)==null?void 0:o.decimals)??18),s=SFe(Number(i),5);return W.jsxs($r,{width:"full",flexDirection:"column",gap:"2",children:[W.jsxs(xe,{flexDirection:"row",alignItems:"center",children:[W.jsx(Ge,{variant:"medium",color:"text80",children:((a=e.contractInfo)==null?void 0:a.symbol)??"Native Token"}),W.jsx(xe,{marginLeft:"auto",children:W.jsx(Ge,{color:"text80",children:s})})]}),W.jsxs(xe,{flexDirection:"row",children:[W.jsx(BE,{chainId:e.chainId}),W.jsxs(xe,{marginLeft:"auto",gap:"2",children:[W.jsx(Zt,{size:"xs",label:"Send",variant:"primary",shape:"square",disabled:t,onClick:r}),n&&W.jsx(Zt,{size:"xs",label:"Remove",shape:"square",onClick:n})]})]})]})}function IFe({filterZeroBalances:t,onSendClick:e}){const r=Ir(Zr),n=Ir(Tx),i=yn(n.balances),s=yn(n.isFetchingBalances),o=yn(r.selectedExternalProvider)!==void 0,a=D.useMemo(()=>t?i.filter(u=>u.balance!=="0"):i,[i,t,s]),[c,l]=D.useState(!1),f=u=>u.contractType===hh.NATIVE?void 0:()=>{var p,g;n.removeToken({chainId:u.chainId,address:u.contractAddress,contractType:u.contractType,decimals:(p=u.contractInfo)==null?void 0:p.decimals,symbol:(g=u.contractInfo)==null?void 0:g.symbol})};return W.jsxs(W.Fragment,{children:[W.jsxs(xe,{width:"full",flexDirection:"column",gap:"4",marginBottom:"8",children:[a.map(u=>W.jsx(_Fe,{tokenBalance:u,disabled:!o,onSendClick:()=>e(u),onRemoveClick:f(u)},u.contractAddress+u.chainId)),s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})]}),c&&W.jsx(AFe,{onClose:()=>l(!1)}),!c&&W.jsx(xe,{width:"full",alignItems:"center",justifyContent:"center",marginBottom:"4",children:W.jsx(Zt,{label:"Import token",leftIcon:UH,variant:"primary",size:"md",shape:"square",onClick:()=>{l(!0)}})})]})}function TFe({onClose:t}){var a;const e=Ir(Zr),r=yn(e.connectOptions),[n,i]=D.useState(!1),s=async()=>{if(n)return;i(!0);const c=await e.walletRequestHandler.connect(r);e.connectDetails.set(c),i(!1),t()},o=()=>{e.connectDetails.set({connected:!1}),t()};return W.jsx(xe,{children:r&&W.jsxs(xe,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Would you like to allow this dapp to connect to your wallet?"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Ge,{variant:"md",color:"text100",children:r.app}),W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"3",children:[W.jsx(Ge,{variant:"md",color:"text100",children:(a=r.origin)==null?void 0:a.split("//")[1]}),W.jsx(yu,{size:"xs",icon:J4,onClick:()=>window.open(r.origin,"_blank")})]})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Network"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${ky(Number(r.networkId))}`})]}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"6",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:o,"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:n?"Authorizing…":"Connect",disabled:n,onClick:s,"data-id":"signingContinue"})]})]})})}function PFe({sessionList:t}){const e=Ir(NE);return W.jsxs(xe,{flexDirection:"column",gap:"2",children:[t.length!==0&&W.jsx(Ge,{variant:"large",color:"text80",marginTop:"6",marginBottom:"2",children:"Connected Dapps via WalletConnect"}),t.map((r,n)=>W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"2",padding:"2",children:[W.jsx(a8,{width:"8",height:"8",src:r.peer.metadata.icons[0]}),W.jsx(Ge,{variant:"normal",fontWeight:"bold",color:"text100",children:r.peer.metadata.name}),W.jsxs(xe,{gap:"2",children:[r.peer.metadata.url&&W.jsx(yu,{size:"xs",icon:J4,onClick:()=>window.open(r.peer.metadata.url,"_blank")}),W.jsx(yu,{size:"xs",icon:Vg,onClick:()=>{e.disconnectSession(r.topic)}})]})]},n))]})}function kFe({onClose:t}){var l,f;const e=Ir(Zr),r=Ir(yi),n=e.toSignMsgDetails.get(),i=r.accountAddress.get(),[s,o]=D.useState(""),[a,c]=D.useState("");return D.useEffect(()=>{if(console.log("details",n),c(new Date().toLocaleString()),n!=null&&n.message.message){const u=XLe(n.message.message);try{o(Ip(u))}catch{o(Me(u))}}else n!=null&&n.message.typedData&&o(JSON.stringify(n.message.typedData,void 0,4))},[n]),W.jsx(xe,{children:n&&W.jsxs(xe,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to sign this message?"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Ge,{variant:"md",color:"text100",children:a})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(xe,{alignItems:"center",gap:"3",children:[W.jsx(Ge,{variant:"md",color:"text100",children:(f=(l=n==null?void 0:n.options)==null?void 0:l.origin)==null?void 0:f.split("//")[1]}),W.jsx(yu,{size:"xs",icon:J4,onClick:()=>{var u;return window.open((u=n.options)==null?void 0:u.origin,"_blank")}})]})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Network"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${ky(n.chainId)}`})]}),W.jsxs($r,{flexDirection:"column",gap:"4",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Signee"}),W.jsx($r,{children:W.jsx(Ge,{variant:"md",color:"text100",children:`${i}`})})]}),W.jsx(GH,{label:"Message Content",children:W.jsx($r,{children:W.jsx(Ge,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:s})})}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(n)},"data-id":"signingContinue"})]})]})})}function MFe({onClose:t}){var I,C;const e=Ir(Zr),r=Ir(Nn),n=Ir(YM),[i,s]=D.useState("Unknown"),[o,a]=D.useState(null),[c,l]=D.useState({name:null}),[f,u]=D.useState(null),[p,g]=D.useState(""),y=e.toSignTxnDetails.get();D.useEffect(()=>{if(!y)return;g(new Date().toLocaleString());const S=r.providerForChainId(y.chainId??0),O=y.txn[0].data,L=y.txn[0].to;b(O,L,S)},[y]),D.useEffect(()=>{if(!y||!(y!=null&&y.txn[0].to)||!o)return;const S=y.txn[0].to,O={chainId:y.chainId,address:S,tokenId:o,contractType:i};n.getCollectibleInfo(O)},[i,o]);async function b(S,O,L){try{const F=new Dn(O,jv,L);try{const ie=await F.symbol();s("ERC20"),l({name:ie});const K=new $i(jv).parseTransaction({data:S}),P=await F.decimals();u(Number(fh(K==null?void 0:K.args[1],P??18)));return}catch{}const z=new Dn(O,C9e,L);if(await z.supportsInterface("0x80ac58cd")){s("ERC721");const ie=new Dn(O,hM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).tokenId.toString();a(K);const P=await ie.name();l({name:P});return}if(await z.supportsInterface("0xd9b67a26")){s("ERC1155");const ie=new Dn(O,pM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).id.toString();a(K);const P=await ie.uri(K);l({name:P});return}}catch(F){console.error("Error parsing contract type. The transaction is either using a smart contract that doesnt support ERC165 or the token is native:",F)}if(y!=null&&y.txn[0].value){s("Native Token"),l({name:`${ky((y==null?void 0:y.chainId)??1)} Native Token`});return}console.info("Token info could not be decoded for this transaction")}return W.jsx(xe,{children:y&&W.jsx(xe,{children:W.jsxs(xe,{flexDirection:"column",padding:"10",gap:"4",children:[W.jsx(Ge,{alignSelf:"center",variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to approve this transaction?"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Ge,{variant:"md",color:"text100",children:p})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(xe,{alignItems:"center",gap:"3",children:[W.jsx(Ge,{variant:"md",color:"text100",children:(C=(I=y==null?void 0:y.options)==null?void 0:I.origin)==null?void 0:C.split("//")[1]}),W.jsx(yu,{size:"xs",icon:J4,onClick:()=>{var S;return window.open((S=y.options)==null?void 0:S.origin,"_blank")}})]})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Token Standard"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${i}`})]}),i==="ERC721"||i==="ERC1155"&&W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Token ID"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${o}`})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Amount"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${f??0} ${c.name}`})]}),W.jsx(GH,{label:"Transaction Data",children:W.jsx(xe,{flexDirection:"column",gap:"2",children:y.txn.map((S,O)=>W.jsx($r,{children:W.jsx(Ge,{variant:"code",color:"text80",style:{whiteSpace:"pre-wrap"},children:JSON.stringify(S,null,4)||"Native token transfer"})},O))})}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(y)},"data-id":"signingContinue"})]})]})})})}function RFe({warningType:t}){return W.jsx(xe,{children:W.jsxs(xe,{flexDirection:"column",padding:"10",alignItems:"center",gap:"6",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",children:"Warning:"}),W.jsx(xe,{flexDirection:"column",children:W.jsx($r,{children:W.jsxs(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"2",children:[t==="noProvider"&&'Please ensure that an external wallet is connected via the "Connect" button',t==="isWalletConnect"&&"Please switch your external wallet to an option other than WalletConnect",t==="notDeployed"&&"Please deploy our wallet on the required network before trying to sign messages"]})})})]})})}var Ute={},Fo={};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.compactObject=Vte;Fo.deprecated=$Fe;var OFe=Fo.detectBrowser=qFe;Fo.disableLog=FFe;Fo.disableWarnings=jFe;Fo.extractVersion=j3;Fo.filterStats=VFe;Fo.log=UFe;Fo.walkStats=v4;Fo.wrapPeerConnectionEvent=LFe;function DFe(t,e,r){return e=NFe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function NFe(t){var e=BFe(t,"string");return gh(e)=="symbol"?e:e+""}function BFe(t,e){if(gh(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gh(t){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gh(t)}var $te=!0,qte=!0;function j3(t,e,r){var n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function LFe(t,e,r){if(t.RTCPeerConnection){var n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(o,a){if(o!==e)return i.apply(this,arguments);var c=function(f){var u=r(f);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[o,c])};var s=n.removeEventListener;n.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);var c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(n,"on"+e,{get:function(){return this["_on"+e]},set:function(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}}function FFe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):($te=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function jFe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):(qte=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function UFe(){if((typeof window>"u"?"undefined":gh(window))==="object"){if($te)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function $Fe(t,e){qte&&console.warn(t+" is deprecated, please use "+e+" instead.")}function qFe(t){var e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;var r=t.navigator;if(r.userAgentData&&r.userAgentData.brands){var n=r.userAgentData.brands.find(function(i){return i.brand==="Chromium"});if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=j3(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=j3(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=j3(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function O$(t){return Object.prototype.toString.call(t)==="[object Object]"}function Vte(t){return O$(t)?Object.keys(t).reduce(function(e,r){var n=O$(t[r]),i=n?Vte(t[r]):t[r],s=n&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,DFe({},r,i))},{}):t}function v4(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(function(n){n.endsWith("Id")?v4(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(function(i){v4(t,t.get(i),r)})}))}function VFe(t,e,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;var s=[];return t.forEach(function(o){o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(function(o){t.forEach(function(a){a.type===n&&a.trackId===o.id&&v4(t,a,i)})}),i}Object.defineProperty(Ute,"__esModule",{value:!0});var zFe=Ute.shimGetUserMedia=WFe,HFe=GFe(Fo);function zte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(zte=function(i){return i?r:e})(t)}function GFe(t,e){if(t&&t.__esModule)return t;if(t===null||gd(t)!="object"&&typeof t!="function")return{default:t};var r=zte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function gd(t){"@babel/helpers - typeof";return gd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gd(t)}var D$=HFe.log;function WFe(t,e){var r=t&&t.navigator;if(r.mediaDevices){var n=function(l){if(gd(l)!=="object"||l.mandatory||l.optional)return l;var f={};return Object.keys(l).forEach(function(u){if(!(u==="require"||u==="advanced"||u==="mediaSource")){var p=gd(l[u])==="object"?l[u]:{ideal:l[u]};p.exact!==void 0&&typeof p.exact=="number"&&(p.min=p.max=p.exact);var g=function(I,C){return I?I+C.charAt(0).toUpperCase()+C.slice(1):C==="deviceId"?"sourceId":C};if(p.ideal!==void 0){f.optional=f.optional||[];var y={};typeof p.ideal=="number"?(y[g("min",u)]=p.ideal,f.optional.push(y),y={},y[g("max",u)]=p.ideal,f.optional.push(y)):(y[g("",u)]=p.ideal,f.optional.push(y))}p.exact!==void 0&&typeof p.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",u)]=p.exact):["min","max"].forEach(function(b){p[b]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(b,u)]=p[b])})}}),l.advanced&&(f.optional=(f.optional||[]).concat(l.advanced)),f},i=function(l,f){if(e.version>=61)return f(l);if(l=JSON.parse(JSON.stringify(l)),l&&gd(l.audio)==="object"){var u=function(I,C,S){C in I&&!(S in I)&&(I[S]=I[C],delete I[C])};l=JSON.parse(JSON.stringify(l)),u(l.audio,"autoGainControl","googAutoGainControl"),u(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=n(l.audio)}if(l&&gd(l.video)==="object"){var p=l.video.facingMode;p=p&&(gd(p)==="object"?p:{ideal:p});var g=e.version<66;if(p&&(p.exact==="user"||p.exact==="environment"||p.ideal==="user"||p.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!g)){delete l.video.facingMode;var y;if(p.exact==="environment"||p.ideal==="environment"?y=["back","rear"]:(p.exact==="user"||p.ideal==="user")&&(y=["front"]),y)return r.mediaDevices.enumerateDevices().then(function(b){b=b.filter(function(C){return C.kind==="videoinput"});var I=b.find(function(C){return y.some(function(S){return C.label.toLowerCase().includes(S)})});return!I&&b.length&&y.includes("back")&&(I=b[b.length-1]),I&&(l.video.deviceId=p.exact?{exact:I.deviceId}:{ideal:I.deviceId}),l.video=n(l.video),D$("chrome: "+JSON.stringify(l)),f(l)})}l.video=n(l.video)}return D$("chrome: "+JSON.stringify(l)),f(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},o=function(l,f,u){i(l,function(p){r.webkitGetUserMedia(p,f,function(g){u&&u(s(g))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,function(l){return a(l).then(function(f){if(l.audio&&!f.getAudioTracks().length||l.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(function(u){u.stop()}),new DOMException("","NotFoundError");return f},function(f){return Promise.reject(s(f))})})}}}}var Hte={};Object.defineProperty(Hte,"__esModule",{value:!0});var KFe=Hte.shimGetUserMedia=JFe,YFe=QFe(Fo);function Gte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Gte=function(i){return i?r:e})(t)}function QFe(t,e){if(t&&t.__esModule)return t;if(t===null||Hv(t)!="object"&&typeof t!="function")return{default:t};var r=Gte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Hv(t){"@babel/helpers - typeof";return Hv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hv(t)}function JFe(t,e){var r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(c,l,f){YFe.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(c).then(l,f)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(l,f,u){f in l&&!(u in l)&&(l[u]=l[f],delete l[f])},s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(c){return Hv(c)==="object"&&Hv(c.audio)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c.audio,"autoGainControl","mozAutoGainControl"),i(c.audio,"noiseSuppression","mozNoiseSuppression")),s(c)},n&&n.prototype.getSettings){var o=n.prototype.getSettings;n.prototype.getSettings=function(){var c=o.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){var a=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&Hv(c)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[c])}}}}var af={};Object.defineProperty(af,"__esModule",{value:!0});af.shimAudioContext=aje;af.shimCallbacksAPI=rje;af.shimConstraints=Yte;af.shimCreateOfferLegacy=oje;var ZFe=af.shimGetUserMedia=nje;af.shimLocalStreamsAPI=eje;af.shimRTCIceServerUrls=ije;af.shimRemoteStreamsAPI=tje;af.shimTrackEventTransceiver=sje;var Wte=XFe(Fo);function Kte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Kte=function(i){return i?r:e})(t)}function XFe(t,e){if(t&&t.__esModule)return t;if(t===null||yh(t)!="object"&&typeof t!="function")return{default:t};var r=Kte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function eje(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){var e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(function(s){return e.call(i,s,n)}),n.getVideoTracks().forEach(function(s){return e.call(i,s,n)})},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=this,s=arguments.length,o=new Array(s>1?s-1:0),a=1;a=0)){n._remoteStreams.push(s);var o=new Event("addstream");o.stream=s,n.dispatchEvent(o)}})}),e.apply(n,arguments)}}}function rje(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){var e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=r.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p},e.createAnswer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=n.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p};var a=function(l,f,u){var p=i.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p};e.setLocalDescription=a,a=function(l,f,u){var p=s.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.setRemoteDescription=a,a=function(l,f,u){var p=o.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.addIceCandidate=a}}function nje(t){var e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=function(i){return n(Yte(i))}}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(s,o,a){e.mediaDevices.getUserMedia(s).then(o,a)}).bind(e))}function Yte(t){return t&&t.video!==void 0?Object.assign({},t,{video:Wte.compactObject(t.video)}):t}function ije(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){for(var s=[],o=0;o{throw TypeError(t)},Jte=(t,e,r)=>e.has(t)||Qte("Cannot "+r),cje=(t,e,r)=>(Jte(t,e,"read from private field"),r?r.call(t):e.get(t)),lje=(t,e,r)=>e.has(t)?Qte("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),fje=(t,e,r,n)=>(Jte(t,e,"write to private field"),e.set(t,r),r);const N$=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function uje(t){return t.join("|")}function dje(t){const e=B$(t);let r=0,n=N$.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),s=N$[i],o=B$(s);if(o===e)return s;o{const r=t.match(/_(.+?)\.wasm$/);return r?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.2.15/dist/${r[1]}/${t}`:e+t}};let L$=new WeakMap;function QM(t,e){var r;const n=L$.get(t);if(n!=null&&n.modulePromise&&e===void 0)return n.modulePromise;const i=(r=n==null?void 0:n.moduleOverrides)!=null?r:bje,s=t({...i});return L$.set(t,{moduleOverrides:i,modulePromise:s}),s}async function wje(t,e,r=ly){const n={...ly,...r},i=await QM(t),{size:s}=e,o=new Uint8Array(await e.arrayBuffer()),a=i._malloc(s);i.HEAPU8.set(o,a);const c=i.readBarcodesFromImage(a,s,Zte(i,n));i._free(a);const l=[];for(let f=0;f{var t,e=typeof document<"u"&&((t=document.currentScript)==null?void 0:t.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(r={}){var n,i=r,s,o,a=new Promise((q,V)=>{s=q,o=V}),c=typeof window=="object",l=typeof Bun<"u",f=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var u=Object.assign({},i),p="./this.program",g="";function y(q){return i.locateFile?i.locateFile(q,g):g+q}var b,I;if(c||f||l){var C;f?g=self.location.href:typeof document<"u"&&((C=document.currentScript)===null||C===void 0?void 0:C.tagName.toUpperCase())==="SCRIPT"&&(g=document.currentScript.src),e&&(g=e),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),f&&(I=q=>{var V=new XMLHttpRequest;return V.open("GET",q,!1),V.responseType="arraybuffer",V.send(null),new Uint8Array(V.response)}),b=q=>fetch(q,{credentials:"same-origin"}).then(V=>V.ok?V.arrayBuffer():Promise.reject(new Error(V.status+" : "+V.url)))}var S=i.print||console.log.bind(console),O=i.printErr||console.error.bind(console);Object.assign(i,u),u=null,i.arguments&&i.arguments,i.thisProgram&&(p=i.thisProgram);var L=i.wasmBinary,F,z=!1,_,$,ie,ce,K,P,M,v;function m(){var q=F.buffer;i.HEAP8=_=new Int8Array(q),i.HEAP16=ie=new Int16Array(q),i.HEAPU8=$=new Uint8Array(q),i.HEAPU16=ce=new Uint16Array(q),i.HEAP32=K=new Int32Array(q),i.HEAPU32=P=new Uint32Array(q),i.HEAPF32=M=new Float32Array(q),i.HEAPF64=v=new Float64Array(q)}var R=[],B=[],E=[];function x(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)k(i.preRun.shift());Je(R)}function w(){Je(B)}function T(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)oe(i.postRun.shift());Je(E)}function k(q){R.unshift(q)}function H(q){B.unshift(q)}function oe(q){E.unshift(q)}var j=0,X=null;function G(q){var V;j++,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j)}function Z(q){var V;if(j--,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j),j==0&&X){var re=X;X=null,re()}}function ee(q){var V;(V=i.onAbort)===null||V===void 0||V.call(i,q),q="Aborted("+q+")",O(q),z=!0,q+=". Build with -sASSERTIONS for more info.";var re=new WebAssembly.RuntimeError(q);throw o(re),re}var N="data:application/octet-stream;base64,",te=q=>q.startsWith(N);function fe(){var q="zxing_reader.wasm";return te(q)?q:y(q)}var Ee;function _e(q){if(q==Ee&&L)return new Uint8Array(L);if(I)return I(q);throw"both async and sync fetching of the wasm failed"}function Re(q){return L?Promise.resolve().then(()=>_e(q)):b(q).then(V=>new Uint8Array(V),()=>_e(q))}function Te(q,V,re){return Re(q).then(ae=>WebAssembly.instantiate(ae,V)).then(re,ae=>{O(`failed to asynchronously prepare wasm: ${ae}`),ee(ae)})}function De(q,V,re,ae){return!q&&typeof WebAssembly.instantiateStreaming=="function"&&!te(V)&&typeof fetch=="function"?fetch(V,{credentials:"same-origin"}).then(pe=>{var me=WebAssembly.instantiateStreaming(pe,re);return me.then(ae,function(Se){return O(`wasm streaming compile failed: ${Se}`),O("falling back to ArrayBuffer instantiation"),Te(V,re,ae)})}):Te(V,re,ae)}function ze(){return{a:Zy}}function et(){var q,V=ze();function re(pe,me){return hn=pe.exports,F=hn.za,m(),ds=hn.Da,H(hn.Aa),Z(),hn}G();function ae(pe){re(pe.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(V,re)}catch(pe){O(`Module.instantiateWasm callback failed with error: ${pe}`),o(pe)}return(q=Ee)!==null&&q!==void 0||(Ee=fe()),De(L,Ee,V,ae).catch(o),{}}var Je=q=>{for(;q.length>0;)q.shift()(i)};i.noExitRuntime;var ke=q=>ho(q),Ne=()=>em(),tt=[],Ze=0,st=q=>{var V=new lt(q);return V.get_caught()||(V.set_caught(!0),Ze--),V.set_rethrown(!1),tt.push(V),Xx(q),Jx(q)},nt=0,We=()=>{yr(0,0);var q=tt.pop();Zx(q.excPtr),nt=0};class lt{constructor(V){this.excPtr=V,this.ptr=V-24}set_type(V){P[this.ptr+4>>2]=V}get_type(){return P[this.ptr+4>>2]}set_destructor(V){P[this.ptr+8>>2]=V}get_destructor(){return P[this.ptr+8>>2]}set_caught(V){V=V?1:0,_[this.ptr+12]=V}get_caught(){return _[this.ptr+12]!=0}set_rethrown(V){V=V?1:0,_[this.ptr+13]=V}get_rethrown(){return _[this.ptr+13]!=0}init(V,re){this.set_adjusted_ptr(0),this.set_type(V),this.set_destructor(re)}set_adjusted_ptr(V){P[this.ptr+16>>2]=V}get_adjusted_ptr(){return P[this.ptr+16>>2]}}var vt=q=>{throw nt||(nt=q),nt},Ke=q=>df(q),gt=q=>{var V=nt;if(!V)return Ke(0),0;var re=new lt(V);re.set_adjusted_ptr(V);var ae=re.get_type();if(!ae)return Ke(0),V;for(var pe of q){if(pe===0||pe===ae)break;var me=re.ptr+16;if(e2(pe,ae,me))return Ke(pe),V}return Ke(ae),V},wt=()=>gt([]),rt=q=>gt([q]),It=(q,V)=>gt([q,V]),At=()=>{var q=tt.pop();q||ee("no exception to throw");var V=q.excPtr;throw q.get_rethrown()||(tt.push(q),q.set_rethrown(!0),q.set_caught(!1),Ze++),nt=V,nt},Tt=(q,V,re)=>{var ae=new lt(q);throw ae.init(V,re),nt=q,Ze++,nt},Xt=()=>Ze,lr=()=>{ee("")},xt={},ar=q=>{for(;q.length;){var V=q.pop(),re=q.pop();re(V)}};function rr(q){return this.fromWireType(P[q>>2])}var kt={},Dt={},Nt={},dt,Lt=q=>{throw new dt(q)},Mt=(q,V,re)=>{q.forEach(Ae=>Nt[Ae]=V);function ae(Ae){var Be=re(Ae);Be.length!==q.length&&Lt("Mismatched type converter count");for(var Ye=0;Ye{Dt.hasOwnProperty(Ae)?pe[Be]=Dt[Ae]:(me.push(Ae),kt.hasOwnProperty(Ae)||(kt[Ae]=[]),kt[Ae].push(()=>{pe[Be]=Dt[Ae],++Se,Se===me.length&&ae(pe)}))}),me.length===0&&ae(pe)},ut=q=>{var V=xt[q];delete xt[q];var re=V.rawConstructor,ae=V.rawDestructor,pe=V.fields,me=pe.map(Se=>Se.getterReturnType).concat(pe.map(Se=>Se.setterArgumentType));Mt([q],me,Se=>{var Ae={};return pe.forEach((Be,Ye)=>{var Qe=Be.fieldName,pt=Se[Ye],mr=Be.getter,Br=Be.getterContext,un=Se[Ye+pe.length],Zn=Be.setter,In=Be.setterContext;Ae[Qe]={read:pn=>pt.fromWireType(mr(Br,pn)),write:(pn,yc)=>{var $n=[];Zn(In,pn,un.toWireType($n,yc)),ar($n)}}}),[{name:V.name,fromWireType:Be=>{var Ye={};for(var Qe in Ae)Ye[Qe]=Ae[Qe].read(Be);return ae(Be),Ye},toWireType:(Be,Ye)=>{for(var Qe in Ae)if(!(Qe in Ye))throw new TypeError(`Missing field: "${Qe}"`);var pt=re();for(Qe in Ae)Ae[Qe].write(pt,Ye[Qe]);return Be!==null&&Be.push(ae,pt),pt},argPackAdvance:ct,readValueFromPointer:rr,destructorFunction:ae}]})},Vt=(q,V,re,ae,pe)=>{},zt=()=>{for(var q=new Array(256),V=0;V<256;++V)q[V]=String.fromCharCode(V);ht=q},ht,Et=q=>{for(var V="",re=q;$[re];)V+=ht[$[re++]];return V},Bt,He=q=>{throw new Bt(q)};function $t(q,V){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var ae=V.name;if(q||He(`type "${ae}" must have a positive integer typeid pointer`),Dt.hasOwnProperty(q)){if(re.ignoreDuplicateRegistrations)return;He(`Cannot register type '${ae}' twice`)}if(Dt[q]=V,delete Nt[q],kt.hasOwnProperty(q)){var pe=kt[q];delete kt[q],pe.forEach(me=>me())}}function Ct(q,V){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $t(q,V,re)}var ct=8,Ht=(q,V,re,ae)=>{V=Et(V),Ct(q,{name:V,fromWireType:function(pe){return!!pe},toWireType:function(pe,me){return me?re:ae},argPackAdvance:ct,readValueFromPointer:function(pe){return this.fromWireType($[pe])},destructorFunction:null})},Rr=q=>({count:q.count,deleteScheduled:q.deleteScheduled,preservePointerOnDelete:q.preservePointerOnDelete,ptr:q.ptr,ptrType:q.ptrType,smartPtr:q.smartPtr,smartPtrType:q.smartPtrType}),Ut=q=>{function V(re){return re.$$.ptrType.registeredClass.name}He(V(q)+" instance already deleted")},Sr=!1,er=q=>{},kr=q=>{q.smartPtr?q.smartPtrType.rawDestructor(q.smartPtr):q.ptrType.registeredClass.rawDestructor(q.ptr)},bi=q=>{q.count.value-=1;var V=q.count.value===0;V&&kr(q)},wi=(q,V,re)=>{if(V===re)return q;if(re.baseClass===void 0)return null;var ae=wi(q,V,re.baseClass);return ae===null?null:re.downcast(ae)},xi={},Ti=()=>Object.keys(hi).length,Sn=()=>{var q=[];for(var V in hi)hi.hasOwnProperty(V)&&q.push(hi[V]);return q},ui=[],Fs=()=>{for(;ui.length;){var q=ui.pop();q.$$.deleteScheduled=!1,q.delete()}},di,jo=q=>{di=q,ui.length&&di&&di(Fs)},Uo=()=>{i.getInheritedInstanceCount=Ti,i.getLiveInheritedInstances=Sn,i.flushPendingDeletes=Fs,i.setDelayFunction=jo},hi={},oo=(q,V)=>{for(V===void 0&&He("ptr should not be undefined");q.baseClass;)V=q.upcast(V),q=q.baseClass;return V},ao=(q,V)=>(V=oo(q,V),hi[V]),_n=(q,V)=>{(!V.ptrType||!V.ptr)&&Lt("makeClassHandle requires ptr and ptrType");var re=!!V.smartPtrType,ae=!!V.smartPtr;return re!==ae&&Lt("Both smartPtrType and smartPtr must be specified"),V.count={value:1},Gi(Object.create(q,{$$:{value:V,writable:!0}}))};function $o(q){var V=this.getPointee(q);if(!V)return this.destructor(q),null;var re=ao(this.registeredClass,V);if(re!==void 0){if(re.$$.count.value===0)return re.$$.ptr=V,re.$$.smartPtr=q,re.clone();var ae=re.clone();return this.destructor(q),ae}function pe(){return this.isSmartPointer?_n(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:V,smartPtrType:this,smartPtr:q}):_n(this.registeredClass.instancePrototype,{ptrType:this,ptr:q})}var me=this.registeredClass.getActualType(V),Se=xi[me];if(!Se)return pe.call(this);var Ae;this.isConst?Ae=Se.constPointerType:Ae=Se.pointerType;var Be=wi(V,this.registeredClass,Ae.registeredClass);return Be===null?pe.call(this):this.isSmartPointer?_n(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Be,smartPtrType:this,smartPtr:q}):_n(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Be})}var Gi=q=>typeof FinalizationRegistry>"u"?(Gi=V=>V,q):(Sr=new FinalizationRegistry(V=>{bi(V.$$)}),Gi=V=>{var re=V.$$,ae=!!re.smartPtr;if(ae){var pe={$$:re};Sr.register(V,pe,V)}return V},er=V=>Sr.unregister(V),Gi(q)),qo=()=>{Object.assign(Ca.prototype,{isAliasOf(q){if(!(this instanceof Ca)||!(q instanceof Ca))return!1;var V=this.$$.ptrType.registeredClass,re=this.$$.ptr;q.$$=q.$$;for(var ae=q.$$.ptrType.registeredClass,pe=q.$$.ptr;V.baseClass;)re=V.upcast(re),V=V.baseClass;for(;ae.baseClass;)pe=ae.upcast(pe),ae=ae.baseClass;return V===ae&&re===pe},clone(){if(this.$$.ptr||Ut(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var q=Gi(Object.create(Object.getPrototypeOf(this),{$$:{value:Rr(this.$$)}}));return q.$$.count.value+=1,q.$$.deleteScheduled=!1,q},delete(){this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),er(this),bi(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ui.push(this),ui.length===1&&di&&di(Fs),this.$$.deleteScheduled=!0,this}})};function Ca(){}var co=(q,V)=>Object.defineProperty(V,"name",{value:q}),Lh=(q,V,re)=>{if(q[V].overloadTable===void 0){var ae=q[V];q[V]=function(){for(var pe=arguments.length,me=new Array(pe),Se=0;Se{i.hasOwnProperty(q)?((re===void 0||i[q].overloadTable!==void 0&&i[q].overloadTable[re]!==void 0)&&He(`Cannot register public name '${q}' twice`),Lh(i,q,q),i.hasOwnProperty(re)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${re})!`),i[q].overloadTable[re]=V):(i[q]=V,re!==void 0&&(i[q].numArguments=re))},Fh=48,cf=57,jh=q=>{if(q===void 0)return"_unknown";q=q.replace(/[^a-zA-Z0-9_]/g,"$");var V=q.charCodeAt(0);return V>=Fh&&V<=cf?`_${q}`:q};function lf(q,V,re,ae,pe,me,Se,Ae){this.name=q,this.constructor=V,this.instancePrototype=re,this.rawDestructor=ae,this.baseClass=pe,this.getActualType=me,this.upcast=Se,this.downcast=Ae,this.pureVirtualFunctions=[]}var Du=(q,V,re)=>{for(;V!==re;)V.upcast||He(`Expected null or instance of ${re.name}, got an instance of ${V.name}`),q=V.upcast(q),V=V.baseClass;return q};function qy(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${zr(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var re=V.$$.ptrType.registeredClass,ae=Du(V.$$.ptr,re,this.registeredClass);return ae}function r1(q,V){var re;if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(re=this.rawConstructor(),q!==null&&q.push(this.rawDestructor,re),re):0;(!V||!V.$$)&&He(`Cannot pass "${zr(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);var ae=V.$$.ptrType.registeredClass;if(re=Du(V.$$.ptr,ae,this.registeredClass),this.isSmartPointer)switch(V.$$.smartPtr===void 0&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:V.$$.smartPtrType===this?re=V.$$.smartPtr:He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:re=V.$$.smartPtr;break;case 2:if(V.$$.smartPtrType===this)re=V.$$.smartPtr;else{var pe=V.clone();re=this.rawShare(re,zo.toHandle(()=>pe.delete())),q!==null&&q.push(this.rawDestructor,re)}break;default:He("Unsupporting sharing policy")}return re}function n1(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${zr(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.ptrType.name} to parameter type ${this.name}`);var re=V.$$.ptrType.registeredClass,ae=Du(V.$$.ptr,re,this.registeredClass);return ae}var Nu=()=>{Object.assign(Bu.prototype,{getPointee(q){return this.rawGetPointee&&(q=this.rawGetPointee(q)),q},destructor(q){var V;(V=this.rawDestructor)===null||V===void 0||V.call(this,q)},argPackAdvance:ct,readValueFromPointer:rr,fromWireType:$o})};function Bu(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe){this.name=q,this.registeredClass=V,this.isReference=re,this.isConst=ae,this.isSmartPointer=pe,this.pointeeType=me,this.sharingPolicy=Se,this.rawGetPointee=Ae,this.rawConstructor=Be,this.rawShare=Ye,this.rawDestructor=Qe,!pe&&V.baseClass===void 0?ae?(this.toWireType=qy,this.destructorFunction=null):(this.toWireType=n1,this.destructorFunction=null):this.toWireType=r1}var Uh=(q,V,re)=>{i.hasOwnProperty(q)||Lt("Replacing nonexistent public symbol"),i[q].overloadTable!==void 0&&re!==void 0?i[q].overloadTable[re]=V:(i[q]=V,i[q].argCount=re)},Lu=(q,V,re)=>{q=q.replace(/p/g,"i");var ae=i["dynCall_"+q];return ae(V,...re)},Vo=[],ds,hr=q=>{var V=Vo[q];return V||(q>=Vo.length&&(Vo.length=q+1),Vo[q]=V=ds.get(q)),V},i1=function(q,V){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(q.includes("j"))return Lu(q,V,re);var ae=hr(V)(...re);return ae},Aa=(q,V)=>function(){for(var re=arguments.length,ae=new Array(re),pe=0;pe{q=Et(q);function re(){return q.includes("j")?Aa(q,V):hr(V)}var ae=re();return typeof ae!="function"&&He(`unknown function pointer with signature ${q}: ${V}`),ae},s1=(q,V)=>{var re=co(V,function(ae){this.name=V,this.message=ae;var pe=new Error(ae).stack;pe!==void 0&&(this.stack=this.toString()+` -`+pe.replace(/^Error(:[^\n]*)?\n/,""))});return re.prototype=Object.create(q.prototype),re.prototype.constructor=re,re.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},re},$h,qh=q=>{var V=gc(q),re=Et(V);return uo(V),re},Fu=(q,V)=>{var re=[],ae={};function pe(me){if(!ae[me]&&!Dt[me]){if(Nt[me]){Nt[me].forEach(pe);return}re.push(me),ae[me]=!0}}throw V.forEach(pe),new $h(`${q}: `+re.map(qh).join([", "]))},vc=(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt,mr)=>{Qe=Et(Qe),me=hs(pe,me),Ae&&(Ae=hs(Se,Ae)),Ye&&(Ye=hs(Be,Ye)),mr=hs(pt,mr);var Br=jh(Qe);pc(Br,function(){Fu(`Cannot construct ${Qe} due to unbound types`,[ae])}),Mt([q,V,re],ae?[ae]:[],un=>{un=un[0];var Zn,In;ae?(Zn=un.registeredClass,In=Zn.instancePrototype):In=Ca.prototype;var pn=co(Qe,function(){if(Object.getPrototypeOf(this)!==yc)throw new Bt("Use 'new' to construct "+Qe);if($n.constructor_body===void 0)throw new Bt(Qe+" has no accessible constructor");for(var l2=arguments.length,b1=new Array(l2),w1=0;w1{for(var re=[],ae=0;ae>2]);return re};function o1(q){for(var V=1;V{var Se=ju(V,re);pe=hs(ae,pe),Mt([],[q],Ae=>{Ae=Ae[0];var Be=`constructor ${Ae.name}`;if(Ae.registeredClass.constructor_body===void 0&&(Ae.registeredClass.constructor_body=[]),Ae.registeredClass.constructor_body[V-1]!==void 0)throw new Bt(`Cannot register multiple constructors with identical number of parameters (${V-1}) for class '${Ae.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return Ae.registeredClass.constructor_body[V-1]=()=>{Fu(`Cannot construct ${Ae.name} due to unbound types`,Se)},Mt([],Se,Ye=>(Ye.splice(1,0,null),Ae.registeredClass.constructor_body[V-1]=nl(Be,Ye,null,pe,me),[])),[]})},Uu=q=>{q=q.trim();const V=q.indexOf("(");return V!==-1?q.substr(0,V):q},zy=(q,V,re,ae,pe,me,Se,Ae,Be,Ye)=>{var Qe=ju(re,ae);V=Et(V),V=Uu(V),me=hs(pe,me),Mt([],[q],pt=>{pt=pt[0];var mr=`${pt.name}.${V}`;V.startsWith("@@")&&(V=Symbol[V.substring(2)]),Ae&&pt.registeredClass.pureVirtualFunctions.push(V);function Br(){Fu(`Cannot call ${mr} due to unbound types`,Qe)}var un=pt.registeredClass.instancePrototype,Zn=un[V];return Zn===void 0||Zn.overloadTable===void 0&&Zn.className!==pt.name&&Zn.argCount===re-2?(Br.argCount=re-2,Br.className=pt.name,un[V]=Br):(Lh(un,V,mr),un[V].overloadTable[re-2]=Br),Mt([],Qe,In=>{var pn=nl(mr,In,pt,me,Se);return un[V].overloadTable===void 0?(pn.argCount=re-2,un[V]=pn):un[V].overloadTable[re-2]=pn,[]}),[]})},il=[],lo=[],$u=q=>{q>9&&--lo[q+1]===0&&(lo[q]=void 0,il.push(q))},ff=()=>lo.length/2-5-il.length,a1=()=>{lo.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=ff},zo={toValue:q=>(q||He("Cannot use deleted val. handle = "+q),lo[q]),toHandle:q=>{switch(q){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const V=il.pop()||lo.length;return lo[V]=q,lo[V+1]=1,V}}}},Wr={name:"emscripten::val",fromWireType:q=>{var V=zo.toValue(q);return $u(q),V},toWireType:(q,V)=>zo.toHandle(V),argPackAdvance:ct,readValueFromPointer:rr,destructorFunction:null},Kr=q=>Ct(q,Wr),le=(q,V,re)=>{switch(V){case 1:return re?function(ae){return this.fromWireType(_[ae])}:function(ae){return this.fromWireType($[ae])};case 2:return re?function(ae){return this.fromWireType(ie[ae>>1])}:function(ae){return this.fromWireType(ce[ae>>1])};case 4:return re?function(ae){return this.fromWireType(K[ae>>2])}:function(ae){return this.fromWireType(P[ae>>2])};default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},we=(q,V,re,ae)=>{V=Et(V);function pe(){}pe.values={},Ct(q,{name:V,constructor:pe,fromWireType:function(me){return this.constructor.values[me]},toWireType:(me,Se)=>Se.value,argPackAdvance:ct,readValueFromPointer:le(V,re,ae),destructorFunction:null}),pc(V,pe)},$e=(q,V)=>{var re=Dt[q];return re===void 0&&He(`${V} has unknown type ${qh(q)}`),re},yt=(q,V,re)=>{var ae=$e(q,"enum");V=Et(V);var pe=ae.constructor,me=Object.create(ae.constructor.prototype,{value:{value:re},constructor:{value:co(`${ae.name}_${V}`,function(){})}});pe.values[re]=me,pe[V]=me},zr=q=>{if(q===null)return"null";var V=typeof q;return V==="object"||V==="array"||V==="function"?q.toString():""+q},tr=(q,V)=>{switch(V){case 4:return function(re){return this.fromWireType(M[re>>2])};case 8:return function(re){return this.fromWireType(v[re>>3])};default:throw new TypeError(`invalid float width (${V}): ${q}`)}},ln=(q,V,re)=>{V=Et(V),Ct(q,{name:V,fromWireType:ae=>ae,toWireType:(ae,pe)=>pe,argPackAdvance:ct,readValueFromPointer:tr(V,re),destructorFunction:null})},jn=(q,V,re,ae,pe,me,Se,Ae)=>{var Be=ju(V,re);q=Et(q),q=Uu(q),pe=hs(ae,pe),pc(q,function(){Fu(`Cannot call ${q} due to unbound types`,Be)},V-1),Mt([],Be,Ye=>{var Qe=[Ye[0],null].concat(Ye.slice(1));return Uh(q,nl(q,Qe,null,pe,me),V-1),[]})},wr=(q,V,re)=>{switch(V){case 1:return re?ae=>_[ae]:ae=>$[ae];case 2:return re?ae=>ie[ae>>1]:ae=>ce[ae>>1];case 4:return re?ae=>K[ae>>2]:ae=>P[ae>>2];default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},en=(q,V,re,ae,pe)=>{V=Et(V);var me=Qe=>Qe;if(ae===0){var Se=32-8*re;me=Qe=>Qe<>>Se}var Ae=V.includes("unsigned"),Be=(Qe,pt)=>{},Ye;Ae?Ye=function(Qe,pt){return Be(pt,this.name),pt>>>0}:Ye=function(Qe,pt){return Be(pt,this.name),pt},Ct(q,{name:V,fromWireType:me,toWireType:Ye,argPackAdvance:ct,readValueFromPointer:wr(V,re,ae!==0),destructorFunction:null})},Pn=(q,V,re)=>{var ae=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],pe=ae[V];function me(Se){var Ae=P[Se>>2],Be=P[Se+4>>2];return new pe(_.buffer,Be,Ae)}re=Et(re),Ct(q,{name:re,fromWireType:me,argPackAdvance:ct,readValueFromPointer:me},{ignoreDuplicateRegistrations:!0})},ps=Object.assign({optional:!0},Wr),Un=(q,V)=>{Ct(q,ps)},fn=(q,V,re,ae)=>{if(!(ae>0))return 0;for(var pe=re,me=re+ae-1,Se=0;Se=55296&&Ae<=57343){var Be=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Be&1023}if(Ae<=127){if(re>=me)break;V[re++]=Ae}else if(Ae<=2047){if(re+1>=me)break;V[re++]=192|Ae>>6,V[re++]=128|Ae&63}else if(Ae<=65535){if(re+2>=me)break;V[re++]=224|Ae>>12,V[re++]=128|Ae>>6&63,V[re++]=128|Ae&63}else{if(re+3>=me)break;V[re++]=240|Ae>>18,V[re++]=128|Ae>>12&63,V[re++]=128|Ae>>6&63,V[re++]=128|Ae&63}}return V[re]=0,re-pe},Yn=(q,V,re)=>fn(q,$,V,re),Ho=q=>{for(var V=0,re=0;re=55296&&ae<=57343?(V+=4,++re):V+=3}return V},js=typeof TextDecoder<"u"?new TextDecoder:void 0,Go=(q,V,re)=>{for(var ae=V+re,pe=V;q[pe]&&!(pe>=ae);)++pe;if(pe-V>16&&q.buffer&&js)return js.decode(q.subarray(V,pe));for(var me="";V>10,56320|Ye&1023)}}return me},Vh=(q,V)=>q?Go($,q,V):"",uf=(q,V)=>{V=Et(V);var re=V==="std::string";Ct(q,{name:V,fromWireType(ae){var pe=P[ae>>2],me=ae+4,Se;if(re)for(var Ae=me,Be=0;Be<=pe;++Be){var Ye=me+Be;if(Be==pe||$[Ye]==0){var Qe=Ye-Ae,pt=Vh(Ae,Qe);Se===void 0?Se=pt:(Se+="\0",Se+=pt),Ae=Ye+1}}else{for(var mr=new Array(pe),Be=0;Be>2]=me,re&&Se)Yn(pe,Be,me+1);else if(Se)for(var Ye=0;Ye255&&(uo(Be),He("String has UTF-16 code units that do not fit in 8 bits")),$[Be+Ye]=Qe}else for(var Ye=0;Ye{for(var re=q,ae=re>>1,pe=ae+V/2;!(ae>=pe)&&ce[ae];)++ae;if(re=ae<<1,re-q>32&&Qn)return Qn.decode($.subarray(q,re));for(var me="",Se=0;!(Se>=V/2);++Se){var Ae=ie[q+Se*2>>1];if(Ae==0)break;me+=String.fromCharCode(Ae)}return me},fo=(q,V,re)=>{var ae;if((ae=re)!==null&&ae!==void 0||(re=2147483647),re<2)return 0;re-=2;for(var pe=V,me=re>1]=Ae,V+=2}return ie[V>>1]=0,V-pe},FE=q=>q.length*2,Hx=(q,V)=>{for(var re=0,ae="";!(re>=V/4);){var pe=K[q+re*4>>2];if(pe==0)break;if(++re,pe>=65536){var me=pe-65536;ae+=String.fromCharCode(55296|me>>10,56320|me&1023)}else ae+=String.fromCharCode(pe)}return ae},sl=(q,V,re)=>{var ae;if((ae=re)!==null&&ae!==void 0||(re=2147483647),re<4)return 0;for(var pe=V,me=pe+re-4,Se=0;Se=55296&&Ae<=57343){var Be=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Be&1023}if(K[V>>2]=Ae,V+=4,V+4>me)break}return K[V>>2]=0,V-pe},c1=q=>{for(var V=0,re=0;re=55296&&ae<=57343&&++re,V+=4}return V},Hy=(q,V,re)=>{re=Et(re);var ae,pe,me,Se;V===2?(ae=LE,pe=fo,Se=FE,me=Ae=>ce[Ae>>1]):V===4&&(ae=Hx,pe=sl,Se=c1,me=Ae=>P[Ae>>2]),Ct(q,{name:re,fromWireType:Ae=>{for(var Be=P[Ae>>2],Ye,Qe=Ae+4,pt=0;pt<=Be;++pt){var mr=Ae+4+pt*V;if(pt==Be||me(mr)==0){var Br=mr-Qe,un=ae(Qe,Br);Ye===void 0?Ye=un:(Ye+="\0",Ye+=un),Qe=mr+V}}return uo(Ae),Ye},toWireType:(Ae,Be)=>{typeof Be!="string"&&He(`Cannot pass non-string to C++ string type ${re}`);var Ye=Se(Be),Qe=Xy(4+Ye+V);return P[Qe>>2]=Ye/V,pe(Be,Qe+4,Ye+V),Ae!==null&&Ae.push(uo,Qe),Qe},argPackAdvance:ct,readValueFromPointer:rr,destructorFunction(Ae){uo(Ae)}})},dn=(q,V,re,ae,pe,me)=>{xt[q]={name:Et(V),rawConstructor:hs(re,ae),rawDestructor:hs(pe,me),fields:[]}},ol=(q,V,re,ae,pe,me,Se,Ae,Be,Ye)=>{xt[q].fields.push({fieldName:Et(V),getterReturnType:re,getter:hs(ae,pe),getterContext:me,setterArgumentType:Se,setter:hs(Ae,Be),setterContext:Ye})},Gy=(q,V)=>{V=Et(V),Ct(q,{isVoid:!0,name:V,argPackAdvance:0,fromWireType:()=>{},toWireType:(re,ae)=>{}})},jE=(q,V,re)=>$.copyWithin(q,V,V+re),zh=[],UE=(q,V,re,ae)=>(q=zh[q],V=zo.toValue(V),q(null,V,re,ae)),$E={},qE=q=>{var V=$E[q];return V===void 0?Et(q):V},Wy=()=>{if(typeof globalThis=="object")return globalThis;function q(V){V.$$$embind_global$$$=V;var re=typeof $$$embind_global$$$=="object"&&V.$$$embind_global$$$==V;return re||delete V.$$$embind_global$$$,re}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&q(global)?$$$embind_global$$$=global:typeof self=="object"&&q(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},l1=q=>q===0?zo.toHandle(Wy()):(q=qE(q),zo.toHandle(Wy()[q])),qu=q=>{var V=zh.length;return zh.push(q),V},VE=(q,V)=>{for(var re=new Array(q),ae=0;ae>2],"parameter "+ae);return re},Gx=Reflect.construct,Wx=(q,V,re)=>{var ae=[],pe=q.toWireType(ae,re);return ae.length&&(P[V>>2]=zo.toHandle(ae)),pe},Ky=(q,V,re)=>{var ae=VE(q,V),pe=ae.shift();q--;var me=new Array(q),Se=(Be,Ye,Qe,pt)=>{for(var mr=0,Br=0;BrBe.name).join(", ")}) => ${pe.name}>`;return qu(co(Ae,Se))},Yy=q=>{q>9&&(lo[q+1]+=1)},Kx=q=>{var V=zo.toValue(q);ar(V),$u(q)},zE=(q,V)=>{q=$e(q,"_emval_take_value");var re=q.readValueFromPointer(V);return zo.toHandle(re)},Qy=(q,V,re,ae)=>{var pe=new Date().getFullYear(),me=new Date(pe,0,1),Se=new Date(pe,6,1),Ae=me.getTimezoneOffset(),Be=Se.getTimezoneOffset(),Ye=Math.max(Ae,Be);P[q>>2]=Ye*60,K[V>>2]=+(Ae!=Be);var Qe=Br=>{var un=Br>=0?"-":"+",Zn=Math.abs(Br),In=String(Math.floor(Zn/60)).padStart(2,"0"),pn=String(Zn%60).padStart(2,"0");return`UTC${un}${In}${pn}`},pt=Qe(Ae),mr=Qe(Be);Be2147483648,HE=(q,V)=>Math.ceil(q/V)*V,Yx=q=>{var V=F.buffer,re=(q-V.byteLength+65535)/65536;try{return F.grow(re),m(),1}catch{}},Us=q=>{var V=$.length;q>>>=0;var re=Jy();if(q>re)return!1;for(var ae=1;ae<=4;ae*=2){var pe=V*(1+.2/ae);pe=Math.min(pe,q+100663296);var me=Math.min(re,HE(Math.max(q,pe),65536)),Se=Yx(me);if(Se)return!0}return!1},Hh={},Gh=()=>p||"./this.program",Vu=()=>{if(!Vu.strings){var q=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",V={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:q,_:Gh()};for(var re in Hh)Hh[re]===void 0?delete V[re]:V[re]=Hh[re];var ae=[];for(var re in V)ae.push(`${re}=${V[re]}`);Vu.strings=ae}return Vu.strings},Qx=(q,V)=>{for(var re=0;re{var re=0;return Vu().forEach((ae,pe)=>{var me=V+re;P[q+pe*4>>2]=me,Qx(ae,me),re+=ae.length+1}),0},WE=(q,V)=>{var re=Vu();P[q>>2]=re.length;var ae=0;return re.forEach(pe=>ae+=pe.length+1),P[V>>2]=ae,0},KE=q=>52;function YE(q,V,re,ae,pe){return 70}var QE=[null,[],[]],zu=(q,V)=>{var re=QE[q];V===0||V===10?((q===1?S:O)(Go(re,0)),re.length=0):re.push(V)},JE=(q,V,re,ae)=>{for(var pe=0,me=0;me>2],Ae=P[V+4>>2];V+=8;for(var Be=0;Be>2]=pe,0},ZE=q=>q;dt=i.InternalError=class extends Error{constructor(q){super(q),this.name="InternalError"}},zt(),Bt=i.BindingError=class extends Error{constructor(q){super(q),this.name="BindingError"}},qo(),Uo(),Nu(),$h=i.UnboundTypeError=s1(Error,"UnboundTypeError"),a1();var Zy={t:st,x:We,a:wt,j:rt,k:It,O:At,q:Tt,ga:Xt,d:vt,ca:lr,va:ut,ba:Vt,pa:Ht,ta:vc,sa:Vy,E:zy,oa:Kr,F:we,n:yt,W:ln,X:jn,y:en,u:Pn,ua:Un,V:uf,P:Hy,L:dn,wa:ol,qa:Gy,ja:jE,T:UE,xa:$u,ya:l1,U:Ky,Y:Yy,Z:Kx,ra:zE,da:Qy,ha:Us,ea:GE,fa:WE,ia:KE,$:YE,S:JE,J:h1,C:nC,Q:bt,R:s2,r:d1,b:Hu,D:n2,la:p1,c:Nr,ka:al,h:Pe,i:XE,s:po,N:tC,w:eC,I:i2,K:Hr,B:iC,H:o2,aa:a2,_:Wh,l:Jn,f:Jt,e:Oe,g:be,M:g1,m:tm,ma:rC,p:f1,v:Gu,na:u1,A:v1,o:tn,G:y1,z:ZE},hn=et(),gc=q=>(gc=hn.Ba)(q),uo=i._free=q=>(uo=i._free=hn.Ca)(q),Xy=i._malloc=q=>(Xy=i._malloc=hn.Ea)(q),Jx=q=>(Jx=hn.Fa)(q),yr=(q,V)=>(yr=hn.Ga)(q,V),df=q=>(df=hn.Ha)(q),ho=q=>(ho=hn.Ia)(q),em=()=>(em=hn.Ja)(),Zx=q=>(Zx=hn.Ka)(q),Xx=q=>(Xx=hn.La)(q),e2=(q,V,re)=>(e2=hn.Ma)(q,V,re);i.dynCall_viijii=(q,V,re,ae,pe,me,Se)=>(i.dynCall_viijii=hn.Na)(q,V,re,ae,pe,me,Se);var t2=i.dynCall_jiii=(q,V,re,ae)=>(t2=i.dynCall_jiii=hn.Oa)(q,V,re,ae);i.dynCall_jiji=(q,V,re,ae,pe)=>(i.dynCall_jiji=hn.Pa)(q,V,re,ae,pe);var r2=i.dynCall_jiiii=(q,V,re,ae,pe)=>(r2=i.dynCall_jiiii=hn.Qa)(q,V,re,ae,pe);i.dynCall_iiiiij=(q,V,re,ae,pe,me,Se)=>(i.dynCall_iiiiij=hn.Ra)(q,V,re,ae,pe,me,Se),i.dynCall_iiiiijj=(q,V,re,ae,pe,me,Se,Ae,Be)=>(i.dynCall_iiiiijj=hn.Sa)(q,V,re,ae,pe,me,Se,Ae,Be),i.dynCall_iiiiiijj=(q,V,re,ae,pe,me,Se,Ae,Be,Ye)=>(i.dynCall_iiiiiijj=hn.Ta)(q,V,re,ae,pe,me,Se,Ae,Be,Ye);function Hu(q,V){var re=Ne();try{return hr(q)(V)}catch(ae){if(ke(re),ae!==ae+0)throw ae;yr(1,0)}}function be(q,V,re,ae){var pe=Ne();try{hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function Oe(q,V,re){var ae=Ne();try{hr(q)(V,re)}catch(pe){if(ke(ae),pe!==pe+0)throw pe;yr(1,0)}}function Pe(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function bt(q,V,re,ae,pe){var me=Ne();try{return hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function Jt(q,V){var re=Ne();try{hr(q)(V)}catch(ae){if(ke(re),ae!==ae+0)throw ae;yr(1,0)}}function Nr(q,V,re){var ae=Ne();try{return hr(q)(V,re)}catch(pe){if(ke(ae),pe!==pe+0)throw pe;yr(1,0)}}function Jn(q){var V=Ne();try{hr(q)()}catch(re){if(ke(V),re!==re+0)throw re;yr(1,0)}}function tn(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe){var pt=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye,Qe)}catch(mr){if(ke(pt),mr!==mr+0)throw mr;yr(1,0)}}function tm(q,V,re,ae,pe){var me=Ne();try{hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function XE(q,V,re,ae,pe){var me=Ne();try{return hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function po(q,V,re,ae,pe,me){var Se=Ne();try{return hr(q)(V,re,ae,pe,me)}catch(Ae){if(ke(Se),Ae!==Ae+0)throw Ae;yr(1,0)}}function f1(q,V,re,ae,pe,me){var Se=Ne();try{hr(q)(V,re,ae,pe,me)}catch(Ae){if(ke(Se),Ae!==Ae+0)throw Ae;yr(1,0)}}function eC(q,V,re,ae,pe,me,Se){var Ae=Ne();try{return hr(q)(V,re,ae,pe,me,Se)}catch(Be){if(ke(Ae),Be!==Be+0)throw Be;yr(1,0)}}function Gu(q,V,re,ae,pe,me,Se,Ae){var Be=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae)}catch(Ye){if(ke(Be),Ye!==Ye+0)throw Ye;yr(1,0)}}function u1(q,V,re,ae,pe,me,Se,Ae,Be){var Ye=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be)}catch(Qe){if(ke(Ye),Qe!==Qe+0)throw Qe;yr(1,0)}}function d1(q){var V=Ne();try{return hr(q)()}catch(re){if(ke(V),re!==re+0)throw re;yr(1,0)}}function Hr(q,V,re,ae,pe,me,Se,Ae,Be){var Ye=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae,Be)}catch(Qe){if(ke(Ye),Qe!==Qe+0)throw Qe;yr(1,0)}}function tC(q,V,re,ae,pe,me,Se){var Ae=Ne();try{return hr(q)(V,re,ae,pe,me,Se)}catch(Be){if(ke(Ae),Be!==Be+0)throw Be;yr(1,0)}}function n2(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function h1(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function rC(q,V,re,ae,pe,me,Se,Ae){var Be=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae)}catch(Ye){if(ke(Be),Ye!==Ye+0)throw Ye;yr(1,0)}}function nC(q,V,re,ae,pe,me){var Se=Ne();try{return hr(q)(V,re,ae,pe,me)}catch(Ae){if(ke(Se),Ae!==Ae+0)throw Ae;yr(1,0)}}function iC(q,V,re,ae,pe,me,Se,Ae,Be,Ye){var Qe=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye)}catch(pt){if(ke(Qe),pt!==pt+0)throw pt;yr(1,0)}}function p1(q,V,re){var ae=Ne();try{return hr(q)(V,re)}catch(pe){if(ke(ae),pe!==pe+0)throw pe;yr(1,0)}}function al(q,V,re,ae,pe){var me=Ne();try{return hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function v1(q,V,re,ae,pe,me,Se,Ae,Be,Ye){var Qe=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye)}catch(pt){if(ke(Qe),pt!==pt+0)throw pt;yr(1,0)}}function i2(q,V,re,ae,pe,me,Se,Ae){var Be=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae)}catch(Ye){if(ke(Be),Ye!==Ye+0)throw Ye;yr(1,0)}}function g1(q,V,re,ae,pe,me,Se){var Ae=Ne();try{hr(q)(V,re,ae,pe,me,Se)}catch(Be){if(ke(Ae),Be!==Be+0)throw Be;yr(1,0)}}function s2(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function o2(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt){var mr=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt)}catch(Br){if(ke(mr),Br!==Br+0)throw Br;yr(1,0)}}function y1(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt,mr,Br,un,Zn){var In=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt,mr,Br,un,Zn)}catch(pn){if(ke(In),pn!==pn+0)throw pn;yr(1,0)}}function a2(q,V,re,ae){var pe=Ne();try{return t2(q,V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function Wh(q,V,re,ae,pe){var me=Ne();try{return r2(q,V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}var Sa;X=function q(){Sa||Kh(),Sa||(X=q)};function Kh(){if(j>0||(x(),j>0))return;function q(){var V;Sa||(Sa=!0,i.calledRun=!0,!z&&(w(),s(i),(V=i.onRuntimeInitialized)===null||V===void 0||V.call(i),T()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),q()},1)):q()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Kh(),n=a,n}})();function Eje(t){return QM(JM,t)}async function Cje(t,e){return wje(JM,t,e)}async function Aje(t,e){return xje(JM,t,e)}const ere=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],Sje=[...ere,["unknown"]].map(t=>t[0]),II=new Map(ere);function _je(t){for(const[e,r]of II)if(t===r)return e;return"unknown"}function Ije(t){if(tre(t))return{width:t.naturalWidth,height:t.naturalHeight};if(rre(t))return{width:t.width.baseVal.value,height:t.height.baseVal.value};if(nre(t))return{width:t.videoWidth,height:t.videoHeight};if(sre(t))return{width:t.width,height:t.height};if(are(t))return{width:t.displayWidth,height:t.displayHeight};if(ire(t))return{width:t.width,height:t.height};if(ore(t))return{width:t.width,height:t.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function tre(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLImageElement)}catch{return!1}}function rre(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.SVGImageElement)}catch{return!1}}function nre(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLVideoElement)}catch{return!1}}function ire(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLCanvasElement)}catch{return!1}}function sre(t){try{return t instanceof ImageBitmap||Object.prototype.toString.call(t)==="[object ImageBitmap]"}catch{return!1}}function ore(t){try{return t instanceof OffscreenCanvas||Object.prototype.toString.call(t)==="[object OffscreenCanvas]"}catch{return!1}}function are(t){try{return t instanceof VideoFrame||Object.prototype.toString.call(t)==="[object VideoFrame]"}catch{return!1}}function cre(t){try{return t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]"}catch{return!1}}function Tje(t){try{return t instanceof ImageData||Object.prototype.toString.call(t)==="[object ImageData]"}catch{return!1}}function Pje(t,e){try{const r=new OffscreenCanvas(t,e);if(r.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return r;throw void 0}catch{const r=document.createElement("canvas");return r.width=t,r.height=e,r}}async function lre(t){if(tre(t)&&!await Oje(t))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(rre(t)&&!await Dje(t))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(are(t)&&Nje(t))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(nre(t)&&(t.readyState===0||t.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(sre(t)&&Lje(t))throw new DOMException("The image source is detached.","InvalidStateError");const{width:e,height:r}=Ije(t);if(e===0||r===0)return null;const n=Pje(e,r).getContext("2d");n.drawImage(t,0,0);try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function kje(t){let e;try{if(globalThis.createImageBitmap)e=await createImageBitmap(t);else if(globalThis.Image){e=new Image;let r="";try{r=URL.createObjectURL(t),e.src=r,await e.decode()}finally{URL.revokeObjectURL(r)}}else return t}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await lre(e)}function Mje(t){const{width:e,height:r}=t;if(e===0||r===0)return null;const n=t.getContext("2d");try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function Rje(t){if(cre(t))return await kje(t);if(Tje(t)){if(Bje(t))throw new DOMException("The image data has been detached.","InvalidStateError");return t}return ire(t)||ore(t)?Mje(t):await lre(t)}async function Oje(t){try{return await t.decode(),!0}catch{return!1}}async function Dje(t){var e;try{return await((e=t.decode)==null?void 0:e.call(t)),!0}catch{return!1}}function Nje(t){return t.format===null}function Bje(t){return t.data.buffer.byteLength===0}function Lje(t){return t.width===0&&t.height===0}function F$(t,e){return Fje(t)?new DOMException(`${e}: ${t.message}`,t.name):jje(t)?new t.constructor(`${e}: ${t.message}`):new Error(`${e}: ${t}`)}function Fje(t){return t instanceof DOMException||Object.prototype.toString.call(t)==="[object DOMException]"}function jje(t){return t instanceof Error||Object.prototype.toString.call(t)==="[object Error]"}var U3;class TI extends EventTarget{constructor(e={}){var r;super(),lje(this,U3);try{const n=(r=e==null?void 0:e.formats)==null?void 0:r.filter(i=>i!=="unknown");if((n==null?void 0:n.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const i of n??[])if(!II.has(i))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${i}' is not a valid enum value of type BarcodeFormat.`);fje(this,U3,n??[]),Eje().then(i=>{this.dispatchEvent(new CustomEvent("load",{detail:i}))}).catch(i=>{this.dispatchEvent(new CustomEvent("error",{detail:i}))})}catch(n){throw F$(n,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return Sje.filter(e=>e!=="unknown")}async detect(e){try{const r=await Rje(e);if(r===null)return[];let n;const i={tryHarder:!0,returnCodabarStartEnd:!0,formats:cje(this,U3).map(s=>II.get(s))};try{cre(r)?n=await Cje(r,i):n=await Aje(r,i)}catch(s){throw console.error(s),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map(s=>{const{topLeft:{x:o,y:a},topRight:{x:c,y:l},bottomLeft:{x:f,y:u},bottomRight:{x:p,y:g}}=s.position,y=Math.min(o,c,f,p),b=Math.min(a,l,u,g),I=Math.max(o,c,f,p),C=Math.max(a,l,u,g);return{boundingBox:new DOMRectReadOnly(y,b,I-y,C-b),rawValue:s.text,format:_je(s.format),cornerPoints:[{x:o,y:a},{x:c,y:l},{x:p,y:g},{x:f,y:u}]}})}catch(r){throw F$(r,"Failed to execute 'detect' on 'BarcodeDetector'")}}}U3=new WeakMap;globalThis.BarcodeDetector!=null||(globalThis.BarcodeDetector=TI);function Uje(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007"}))}function $je(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z"}),qt.createElement("path",{d:"M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z"}))}function qje(t){const{scanning:e,startScanning:r,stopScanning:n}=t,[i,s]=D.useState(!1);function o(){s(!0),e?n():r(),setTimeout(()=>s(!1),1e3)}return qt.createElement("div",{style:{bottom:85,right:3,position:"absolute",zIndex:2,cursor:i?"default":"pointer"}},e?qt.createElement(Uje,{disabled:i,onClick:o}):qt.createElement($je,{disabled:i,onClick:o}))}function Vje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z"}))}function zje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z"}))}function Hje(t){const{status:e,scanning:r,torchToggle:n}=t;function i(s){n(s)}return r&&n?qt.createElement("div",{style:{bottom:35,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},e?qt.createElement(zje,{onClick:()=>i(!1)}):qt.createElement(Vje,{onClick:()=>i(!0)})):null}function Gje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z"}))}function Wje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z"}))}function Kje(t){const{scanning:e,capabilities:r,onZoom:n,value:i}=t;if(!e||!n)return null;const s=(r.max-r.min)/3;return qt.createElement(D.Fragment,null,qt.createElement("div",{style:{bottom:130,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Wje,{disabled:i<=r.min,onClick:function(){n(Math.max(i-s,r.min))}})),qt.createElement("div",{style:{bottom:180,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Gje,{disabled:i>=r.max,onClick:function(){n(Math.min(i+s,r.max))}})))}function Yje(t){const{scanning:e,loading:r,capabilities:n,border:i=35,onOff:s,torch:o,zoom:a,startScanning:c,stopScanning:l}=t,f="rgba(255, 0, 0, 0.5)";return qt.createElement("div",{style:{position:"relative"}},qt.createElement("svg",{viewBox:"0 0 100 100",style:{top:0,left:0,zIndex:1,boxSizing:"border-box",border:`${i>=35?i:35}px solid rgba(0, 0, 0, 0.2)`}},r&&qt.createElement("text",{x:"50",y:"50",textAnchor:"middle",fill:"black",fontSize:"8",fontFamily:"Arial",fontWeight:"bold"},"Loading ...",qt.createElement("animate",{attributeName:"opacity",values:"0;1;0",dur:"2s",repeatCount:"indefinite"})),qt.createElement("path",{fill:"none",d:"M23,0 L0,0 L0,23",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M0,77 L0,100 L23,100",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M77,100 L100,100 L100,77",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M100,23 L100,0 77,0",stroke:f,strokeWidth:3})),s&&qt.createElement(qje,{scanning:e,startScanning:c,stopScanning:l}),o&&n.torch&&qt.createElement(Hje,{scanning:e,status:o.status,torchToggle:o.toggle}),a&&n.zoom&&qt.createElement(Kje,{scanning:e,capabilities:n.zoom,value:a.value,onZoom:a.onChange}))}const Qje={facingMode:"environment",width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},Jje={audio:!0,tracker:void 0,onOff:!1,finder:!0,torch:!0,zoom:!1},Zje={width:"100%",height:"100%",position:"relative"},Xje={top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden"};var eUe=function(t){let e,r=!1;return(...n)=>(r||(e=t(n),r=!0),e)}(()=>{const t=OFe(window);switch(t.browser){case"chrome":zFe(window,t);break;case"firefox":KFe(window,t);break;case"safari":ZFe(window,t);break;default:throw new Error("Unsupported browser")}});const tUe="data:audio/mp3;base64,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";var fb=t=>t instanceof Date,fre=t=>t==null;const ure=t=>typeof t=="object";var j$=t=>!fre(t)&&!Array.isArray(t)&&ure(t)&&!fb(t),U$=t=>fre(t)||!ure(t);function dre(t,e){if(U$(t)||U$(e))return t===e;if(fb(t)&&fb(e))return t.getTime()===e.getTime();const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(const i of r){const s=t[i];if(!n.includes(i))return!1;if(i!=="ref"){const o=e[i];if(fb(s)&&fb(o)||j$(s)&&j$(o)||Array.isArray(s)&&Array.isArray(o)?!dre(s,o):s!==o)return!1}}return!0}function F6(t){if(t===null)throw new Error("Canvas should always be defined when component is mounted.");const e=t.getContext("2d");if(e===null)throw new Error("Canvas 2D context should be non-null");e.clearRect(0,0,t.width,t.height)}function rUe(t){var e;const{onScan:r,constraints:n,formats:i=["qr_code"],paused:s=!1,components:o,children:a,styles:c,classNames:l,allowMultiple:f,scanDelay:u,onError:p}=t,g=D.useRef(null),y=D.useRef(null),b=D.useRef(null),I=D.useMemo(()=>({...Qje,...n}),[n]),C=D.useMemo(()=>({...Jje,...o}),[o]),[S,O]=D.useState(!1),[L,F]=D.useState(!0),[z,_]=D.useState(I),$=function(){const v=D.useRef(Promise.resolve({type:"stop",data:{}})),m=D.useRef(null),R=D.useRef(null),[B,E]=D.useState({}),[x,w]=D.useState({}),T=D.useCallback(async(X,G)=>{var Z,ee,N;if(!window.isSecureContext)throw new Error("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.");if(((Z=navigator==null?void 0:navigator.mediaDevices)===null||Z===void 0?void 0:Z.getUserMedia)===void 0)throw new Error("this browser has no Stream API support");eUe();const te=await navigator.mediaDevices.getUserMedia({audio:!1,video:G});X.srcObject!==void 0?X.srcObject=te:X.mozSrcObject!==void 0?X.mozSrcObject=te:window.URL.createObjectURL?X.src=window.URL.createObjectURL(te):window.webkitURL?X.src=window.webkitURL.createObjectURL(te):X.src=te.id,await Promise.race([X.play(),new Promise(Ee=>setTimeout(Ee,3e3)).then(()=>{throw new Error("Loading camera stream timed out after 3 seconds.")})]),await new Promise(Ee=>setTimeout(Ee,500));const[fe]=te.getVideoTracks();return w(fe.getSettings()),E((N=(ee=fe==null?void 0:fe.getCapabilities)===null||ee===void 0?void 0:ee.call(fe))!==null&&N!==void 0?N:{}),m.current=te,R.current=fe,{type:"start",data:{videoEl:X,stream:te,constraints:G}}},[]),k=D.useCallback(async(X,G)=>{X.src="",X.srcObject=null,X.load();for(const Z of G.getTracks())G.removeTrack(Z),Z.stop();return m.current=null,R.current=null,w({}),{type:"stop",data:{}}},[]),H=D.useCallback(async(X,{constraints:G,restart:Z=!1})=>{if(v.current=v.current.then(ee=>{if(ee.type==="start"){const{data:{videoEl:N,stream:te,constraints:fe}}=ee;return Z||X!==N||G!==fe?k(N,te).then(()=>T(X,G)):ee}return T(X,G)}),(await v.current).type==="stop")throw new Error("Something went wrong with the camera task queue (start task).")},[T,k]),oe=D.useCallback(async()=>{if(v.current=v.current.then(X=>{if(X.type==="stop")return X;const{data:{videoEl:G,stream:Z}}=X;return k(G,Z)}),(await v.current).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")},[k]),j=D.useCallback(async X=>{const G=R.current;if(!G)throw new Error("No active video track found.");{X.advanced&&X.advanced[0].zoom&&G.getCapabilities().torch&&await G.applyConstraints({advanced:[{torch:!1}]}),await G.applyConstraints(X);const Z=G.getCapabilities(),ee=G.getSettings();E(Z),w(ee)}},[]);return D.useEffect(()=>()=>{(async()=>await oe())()},[oe]),{capabilities:B,settings:x,startCamera:H,stopCamera:oe,updateConstraints:j}}(),{startScanning:ie,stopScanning:ce}=function(v){const{videoElementRef:m,onScan:R,onFound:B,retryDelay:E=100,scanDelay:x=0,formats:w=[],audio:T=!0,allowMultiple:k=!1}=v,H=D.useRef(new TI({formats:w})),oe=D.useRef(null),j=D.useRef(null);D.useEffect(()=>{H.current=new TI({formats:w})},[w]),D.useEffect(()=>{typeof window<"u"&&T&&(oe.current=new Audio(tUe))},[T]);const X=D.useCallback(G=>async Z=>{if(m.current!==null&&m.current.readyState>1){const{lastScan:ee,contentBefore:N,lastScanHadContent:te}=G;if(Z-ee!N.includes(De.rawValue)),_e=fe.length>0;let Re=G.lastOnScan;(Ee||k&&_e&&Z-Re>=x)&&(T&&oe.current&&oe.current.paused&&oe.current.play().catch(De=>console.error("Error playing the sound",De)),Re=Z,R(fe)),_e&&B(fe),!_e&&te&&B(fe);const Te={lastScan:Z,lastOnScan:Re,lastScanHadContent:_e,contentBefore:Ee?fe.map(De=>De.rawValue):N};j.current=window.requestAnimationFrame(X(Te))}}},[m.current,R,B,E]);return{startScanning:D.useCallback(()=>{const G=performance.now(),Z={lastScan:G,lastOnScan:G,contentBefore:[],lastScanHadContent:!1};j.current=window.requestAnimationFrame(X(Z))},[X]),stopScanning:D.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null)},[])}}({videoElementRef:g,onScan:r,onFound:v=>function(m,R,B,E){const x=B;if(x==null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas is always defined.");const w=R;if(w==null)throw new Error("onFound handler should only be called when component is mounted. Thus video element is always defined.");if(m.length===0||E===void 0)F6(x);else{const T=w.offsetWidth,k=w.offsetHeight,H=w.videoWidth,oe=w.videoHeight,j=Math.max(T/H,k/oe),X=H*j,G=oe*j,Z=X/H,ee=G/oe,N=(T-X)/2,te=(k-G)/2,fe=({x:Te,y:De})=>({x:Math.floor(Te*Z),y:Math.floor(De*ee)}),Ee=({x:Te,y:De})=>({x:Math.floor(Te+N),y:Math.floor(De+te)}),_e=m.map(Te=>{const{boundingBox:De,cornerPoints:ze}=Te,{x:et,y:Je}=Ee(fe({x:De.x,y:De.y})),{x:ke,y:Ne}=fe({x:De.width,y:De.height});return{...Te,cornerPoints:ze.map(tt=>Ee(fe(tt))),boundingBox:DOMRectReadOnly.fromRect({x:et,y:Je,width:ke,height:Ne})}});x.width=w.offsetWidth,x.height=w.offsetHeight;const Re=x.getContext("2d");if(Re===null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas 2D context is always defined.");E(_e,Re)}}(v,g.current,b.current,C.tracker),formats:i,audio:C.audio,allowMultiple:f,retryDelay:C.tracker===void 0?500:10,scanDelay:u});D.useEffect(()=>(O(!0),()=>{O(!1)}),[]),D.useEffect(()=>{S&&(ce(),ie())},[o==null?void 0:o.tracker]),D.useEffect(()=>{if(!dre(I,z)){const v=I;n!=null&&n.deviceId&&delete v.facingMode,_(v)}},[n]);const K=D.useMemo(()=>({constraints:z,shouldStream:S&&!s}),[z,S,s]),P=async()=>{const v=g.current;if(v==null)throw new Error("Video should be defined when component is mounted.");const m=y.current;if(m==null)throw new Error("Canvas should be defined when component is mounted.");const R=m.getContext("2d");if(R==null)throw new Error("Canvas should be defined when component is mounted.");if(K.shouldStream){await $.stopCamera(),F(!1);try{await $.startCamera(v,K),v?F(!0):await $.stopCamera()}catch(B){p==null||p(B),console.error("error",B)}}else m.width=v.videoWidth,m.height=v.videoHeight,R.drawImage(v,0,0,v.videoWidth,v.videoHeight),await $.stopCamera(),F(!1)};D.useEffect(()=>{(async()=>await P())()},[K]);const M=D.useMemo(()=>K.shouldStream&&L,[K.shouldStream,L]);return D.useEffect(()=>{if(M){if(y.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus pause frame canvas is defined");if(F6(y.current),b.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus tracking canvas is defined");if(F6(b.current),g.current==null)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus video element is defined");ie()}},[M]),qt.createElement("div",{style:{...Zje,...c==null?void 0:c.container},className:l==null?void 0:l.container},qt.createElement("video",{ref:g,style:{...Xje,...c==null?void 0:c.video,visibility:s?"hidden":"visible"},className:l==null?void 0:l.video,autoPlay:!0,muted:!0,playsInline:!0}),qt.createElement("canvas",{ref:y,style:{display:s?"block":"none",position:"absolute",top:0,left:0,width:"100%"}}),qt.createElement("canvas",{ref:b,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}}),qt.createElement("div",{style:{top:0,left:0,position:"absolute",width:"100%",height:"100%"}},C.finder&&qt.createElement(Yje,{scanning:L,capabilities:$.capabilities,loading:!1,onOff:C.onOff,zoom:C.zoom&&$.settings.zoom?{value:$.settings.zoom,onChange:async v=>{const m={...z,advanced:[{zoom:v}]};await $.updateConstraints(m)}}:void 0,torch:C.torch?{status:(e=$.settings.torch)!==null&&e!==void 0&&e,toggle:async v=>{const m={...z,advanced:[{torch:v}]};await $.updateConstraints(m)}}:void 0,startScanning:async()=>await P(),stopScanning:async()=>{await $.stopCamera(),F6(b.current),F(!1)},border:c==null?void 0:c.finderBorder}),a))}function nUe({onQrUri:t}){const e=Ir(NE),[r,n]=D.useState(""),i=async()=>{if(r){console.log(r);try{await e.pair(r)}catch(s){console.error(s),t(!1)}}t(!0)};return W.jsxs(xe,{flexDirection:"column",justifyContent:"space-between",padding:"12",gap:"3",children:[W.jsx(rUe,{onScan:s=>{s[0].rawValue&&n(s[0].rawValue)},styles:{video:{transform:"scaleX(-1)",borderRadius:"10px"}}}),W.jsxs(xe,{children:[W.jsx(Wn,{label:"Paste Connection String",labelLocation:"top",name:"signClientUri",value:r??"",onChange:s=>{n(s.target.value)}}),W.jsx(xe,{justifyContent:"flex-end",children:W.jsx(Zt,{marginTop:"4",variant:"primary",size:"md",shape:"square",label:"Connect Dapp",disabled:!r,onClick:()=>{r&&i()}})})]})]})}const hre=t=>({info:{walletId:"",uuid:"",name:"WalletConnect",icon:"https://avatars.githubusercontent.com/u/37784886"},provider:t});function iUe(){var _e,Re;const t=jte(),e=Ir(yi),r=Ir(Tx),n=Ir(Zr),i=Ir(NE),s=yn(e.accountAddress),o=yn(n.isSigningTxn),a=yn(n.isSigningMsg),c=yn(i.allSessions),l=h8(),f=KP("isMobile"),u=uFe();D.useEffect(()=>{if(u&&u.connected&&!n.selectedExternalProvider.get()){let Te=hre(u),De=n.availableExternalProviders.get();De?n.availableExternalProviders.set([Te,...De]):n.availableExternalProviders.set([Te])}},[u]),D.useEffect(()=>{t.length>0&&n.availableExternalProviders.set(t)},[t]);const p=yn(n.selectedExternalProvider),g=yn(n.selectedExternalWalletAddress),y=yn(n.isSendingTokenTransaction),b=yn(n.isSendingCollectibleTransaction),I=yn(n.isSendingSignedTokenTransaction),C=Ir(Nn),[S,O]=D.useState(!0),[L,F]=D.useState(void 0),[z,_]=D.useState(void 0),[$,ie]=D.useState(!1),[ce,K]=D.useState(!1),[P,M]=D.useState(!1),[v,m]=D.useState(!1),[R,B]=D.useState(!1),[E,x]=D.useState(!1),[w,T]=D.useState(!1),k=yn(n.signClientWarningType),H=Te=>{_(void 0),n.isSendingCollectibleTransaction.set(void 0),F(Te),B(!0)},oe=Te=>{F(void 0),n.isSendingTokenTransaction.set(void 0),_(Te),x(!0)},j=async(Te=!1)=>{(p===void 0||Te)&&M(!0)},X=async()=>{n.setExternalProvider(void 0);const Te=p;(Te==null?void 0:Te.info.name)==="WalletConnect"&&Te.provider.disconnect()},G=async(Te,De)=>{if(!n.selectedExternalProvider.get()){console.warn("No external provider selected");return}var ze;let et;try{if(L)ze=L.chainId,et=await n.sendToken(L,Te,De);else if(z)ze=z.collectibleInfoParams.chainId,et=await n.sendCollectible(z,Te,De);else{console.warn("No pending send found");return}}catch(Ne){Ne.code===4001&&l({variant:"error",title:"User denied transaction signature."}),console.error(Ne);return}const Je=C.providerForChainId(ze),ke=await k$(Je,et.hash);ke&&l({variant:"success",title:"Transaction confirmed",description:"You can view the transaction details on your connected external wallet"}),L&&r.updateTokenBalance(L),F(void 0),_(void 0),n.isSendingTokenTransaction.set(void 0),n.isSendingCollectibleTransaction.set(void 0),console.log("receipt",ke)},Z=async(Te,De)=>{const ze=C.providerForChainId(De);await k$(ze,Te)&&(n.isSendingSignedTokenTransaction.set(void 0),l({variant:"success",title:"Sign transaction confirmed",description:"You can view the transaction details on your connected external wallet"}))},ee=()=>{i.rejectRequest(),n.toSignPermission.set("cancelled")};async function N(Te){var ke;const De=async(Ne,tt,Ze)=>{try{const st=await n.getExternalProviderAddress(ze);if(!st)throw new Error("No provider address found");return console.log("sendTransaction chainId",tt),await n.sendTransaction(et,ze,st,Ne,tt)}catch(st){throw n.isSendingSignedTokenTransaction.set(void 0),st}},ze=(ke=n.selectedExternalProvider.get())==null?void 0:ke.provider,et=e.account;let Je;if(Te)try{n.isSendingSignedTokenTransaction.set(Te),Je=await De(Te.txn,Te.chainId,Te.options),Z(Je.hash,Te.chainId),n.toSignResult.set(Je),n.toSignPermission.set("approved")}catch(Ne){throw n.isSendingSignedTokenTransaction.set(void 0),ee(),Ne}}async function te(Te){const De=async(Je,ke)=>{try{let Ne;if(Je.message)console.log("signMessage chainId",Je.chainId),Ne=await ze.signMessage(Je.message,Je.chainId,Je.eip6492?"eip6492":"throw");else if(Je.typedData){const tt=Je.typedData;Ne=await ze.signTypedData(tt.domain,tt.types,tt.message,Je.chainId,Je.eip6492?"eip6492":"throw")}if(!Ne)throw new Error("Account sign method failed");return{hash:Ne}}catch(Ne){throw Ne}},ze=e.account;let et;if(Te)try{et=await De(Te.message),n.toSignResult.set(et),n.toSignPermission.set("approved")}catch(Je){throw n.isSendingSignedTokenTransaction.set(void 0),ee(),Je}}const fe=async()=>{var Te;((Te=n.selectedExternalProvider.get())==null?void 0:Te.info.name)==="WalletConnect"?n.signClientWarningType.set("isWalletConnect"):T(!0)},Ee=async()=>{m(!0)};return W.jsxs(W.Fragment,{children:[W.jsxs(xe,{flexDirection:"column",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",justifyContent:"center",children:[W.jsxs(xe,{flexDirection:"row",width:"full",background:"backgroundMuted",paddingX:"8",paddingY:"4",alignItems:"center",children:[W.jsx("img",{src:vM,alt:"Sequence Logo",width:"40"}),W.jsxs(xe,{marginLeft:"auto",children:[W.jsx(Zt,{label:"Networks",variant:"text",marginRight:"8",onClick:()=>ie(!0)}),W.jsx(EFe,{onTokenListClick:()=>K(!0)})]})]}),W.jsxs(xe,{width:"full",paddingX:"8",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsxs($r,{flexDirection:"column",alignItems:"center",padding:"6",marginTop:"10",children:[W.jsx(Ge,{variant:"large",color:"text80",marginBottom:"4",children:"Your recovered wallet address"}),W.jsx(Ge,{variant:"normal",fontWeight:"bold",color:"text100",children:s}),W.jsx(PFe,{sessionList:c}),W.jsx(Zt,{marginTop:"4",variant:"primary",size:"sm",shape:"square",label:"Connect to a Dapp with WalletConnect",leftIcon:Kpe,onClick:()=>{fe()}})]}),W.jsxs($r,{alignItems:"center",flexDirection:"column",padding:"6",marginTop:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",marginBottom:"4",children:p?"Your external wallet that will be used to relay transactions":"Connect an external wallet to relay transactions"}),p&&W.jsx(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsxs(xe,{flexDirection:"column",alignItems:"center",gap:"2",children:[W.jsxs(xe,{flexDirection:"row",gap:"2",children:[W.jsx("img",{src:p.info.icon,alt:p.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Ge,{variant:"normal",color:"text100",children:p.info.name})]}),g&&W.jsxs(Ge,{variant:"normal",color:"text100",children:["(",g,")"]}),W.jsxs(xe,{flexDirection:"row",children:[W.jsx(Zt,{size:"xs",label:"Change external wallet",variant:"text",shape:"square",marginRight:"10",onClick:()=>j(!0)}),W.jsx(Zt,{size:"xs",label:"Disconnect",variant:"text",shape:"square",onClick:()=>X()})]})]})}),!p&&W.jsx(Zt,{label:"Connect",variant:"primary",size:"md",shape:"square",onClick:j})]}),y&&W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(lS,{symbol:((Re=(_e=y.tokenBalance)==null?void 0:_e.contractInfo)==null?void 0:Re.symbol)??"",chainId:y.tokenBalance.chainId,to:y.to,amount:y.amount})}),b&&W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(lS,{symbol:b.collectibleInfo.collectibleInfoResponse.name??"",chainId:b.collectibleInfo.collectibleInfoParams.chainId,to:b.to,amount:b.amount})}),I&&W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(lS,{symbol:"tokens",chainId:I.chainId,to:I.txn[0].to,amount:String(Number(I.txn[0].value))})}),W.jsxs(xe,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsxs(xe,{width:"full",flexDirection:"row",alignItems:"center",marginBottom:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",children:"Coins"}),W.jsx(xe,{marginLeft:"auto",children:W.jsx(swe,{label:"Filter zero balances",checked:S,onCheckedChange:O})})]}),W.jsx(IFe,{filterZeroBalances:S,onSendClick:H})]}),W.jsxs(xe,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsx(Ge,{variant:"large",color:"text80",marginBottom:"4",children:"Collectibles"}),W.jsx(gFe,{onSendClick:oe})]})]})]}),$&&W.jsx(Tc,{onClose:()=>ie(!1),children:W.jsx(mFe,{})}),ce&&W.jsx(Tc,{onClose:()=>K(!1),children:W.jsx(CFe,{})}),P&&W.jsx(Tc,{size:"md",onClose:()=>M(!1),children:W.jsx(bFe,{onSelectProvider:async Te=>{var De,ze;Te&&(((De=n.selectedExternalProvider.get())==null?void 0:De.info.name)==="WalletConnect"&&await((ze=n.selectedExternalProvider.get())==null?void 0:ze.provider).disconnect(),n.setExternalProvider(Te)),M(!1)}})}),v&&W.jsx(Tc,{size:"md",onClose:()=>m(!1),children:W.jsx(TFe,{onClose:()=>m(!1)})}),w&&W.jsx(Tc,{size:"md",contentProps:{style:{width:f?"100%":"600px",height:f?"":"750px"}},onClose:()=>T(!1),children:W.jsx(nUe,{onQrUri:Te=>{Te&&Ee(),T(!1)}})}),o&&W.jsx(Tc,{isDismissible:!1,size:"md",contentProps:{style:{width:f?"100%":"800px",maxHeight:"100%",overflowY:"auto"}},children:W.jsx(MFe,{onClose:Te=>{var De;n.isSigningTxn.set(!1),Te?n.selectedExternalProvider.get()===void 0?(ee(),n.signClientWarningType.set("noProvider")):((De=n.selectedExternalProvider.get())==null?void 0:De.info.name)==="WalletConnect"?(ee(),n.signClientWarningType.set("isWalletConnect")):N(Te):ee()}})}),a&&W.jsx(Tc,{isDismissible:!1,size:"md",contentProps:{style:{width:f?"100%":"800px",maxHeight:"90%",overflowY:"auto"}},children:W.jsx(kFe,{onClose:Te=>{var De;n.isSigningMsg.set(!1),Te?n.selectedExternalProvider.get()===void 0?(ee(),n.signClientWarningType.set("noProvider")):((De=n.selectedExternalProvider.get())==null?void 0:De.info.name)==="WalletConnect"?(ee(),n.signClientWarningType.set("isWalletConnect")):te(Te):ee()}})}),k&&W.jsx(Tc,{size:"md",onClose:()=>n.signClientWarningType.set(!1),children:W.jsx(RFe,{warningType:k})}),R&&W.jsx(Tc,{size:"md",onClose:()=>B(!1),children:W.jsx(xFe,{tokenBalance:L,onClose:(Te,De)=>{B(!1),Te&&De&&G(Te,De)}})}),E&&W.jsx(Tc,{size:"md",onClose:()=>x(!1),children:W.jsx(wFe,{collectibleInfo:z,onClose:(Te,De)=>{x(!1),(Te&&(z==null?void 0:z.collectibleInfoParams.contractType)==="ERC721"||Te&&De)&&G(Te,De)}})})]})}const sUe=()=>{const t=Ir(yi),e=yn(t.accountAddress);return W.jsx(M2e,{basename:"/wallet-recovery-app",children:W.jsxs(A2e,{children:[W.jsx(i3,{path:"/",element:e?W.jsx(JA,{replace:!0,to:"/wallet"}):W.jsx(_9e,{})}),W.jsx(i3,{path:"recovery",element:e?W.jsx(JA,{replace:!0,to:"/wallet"}):W.jsx(P9e,{})}),W.jsx(i3,{path:"wallet",element:e?W.jsx(iUe,{}):W.jsx(JA,{replace:!0,to:"/"})})]})})},oUe=Nxe();L7.createRoot(document.getElementById("root")).render(W.jsx(qt.StrictMode,{children:W.jsx(Bxe,{store:oUe,children:W.jsx(Rme,{theme:"dark",children:W.jsx(Vwe,{children:W.jsx(sUe,{})})})})}));export{R9e as _}; +`),ZLe=t=>mu(t)?Ue(t):Ii(t),Nte=t=>{const e=ZLe(t);return GLe(e)?e:Ue(qr([F3,Ii(String(e.length)),e]))},XLe=t=>{if(JSON.stringify(t.slice(0,F3.length))!==JSON.stringify(F3))return t;const e=t.slice(F3.length),r=String(e.length).length;let n,i;try{i=Number(Ip(e.slice(0,r)))}catch{i=Number(Me(e.slice(0,r)))}return i>e.length||!Number.isInteger(i)?n=r-1:n=r,e.slice(n)},I$=async(t,e,r,n)=>new mt.reader.OnChainReader(n).isValidSignature(t,e,r);async function eFe(t){return Array.isArray(t)?Promise.all(t.map(e=>vi(e))):vi(t)}function tFe(t){return[t,...t.auxiliary||[]]}const rFe=1e4;class nFe{constructor(e,r,n){var i=this;this.account=void 0,this.signerReadyCallbacks=[],this.prompter=void 0,this.networks=void 0,this._openIntent=void 0,this._connectOptions=void 0,this.events=new kLe.EventEmitter2,this.onConnectOptionsChange=void 0,this.promptConnect=async function(s){if(!s&&!i._connectOptions)throw new Error("prompter connect options are empty");if(!i.prompter)return i.connect(s);const o=await i.prompter.promptConnect(s||i._connectOptions).catch(c=>({connected:!1})),a=o;return a.connected&&!a.session&&(a.session=await i.walletSession(s==null?void 0:s.networkId)),o},this.isSignedIn=async function(){return await i.signerReady(),!!i.account},this.getAccount=async function(){if(await i.signerReady(),i.account===void 0)throw new Error("signerReady failed resolve");return i.account},this.account=e,this.prompter=r,this.networks=n}defaultChainId(){var e,r;return(e=(r=this.prompter)==null?void 0:r.getDefaultChainId())!=null?e:this.networks[0].chainId}async signIn(e,r={}){this.setAccount(e);const{connect:n,defaultNetworkId:i}=r;if(n){const a=this._connectOptions;let c;if(this.prompter!==null){var s;c=await((s=this.prompter)==null?void 0:s.promptSignInConnect(a))}else c=await this.connect(a);this.notifyConnect(c),(!a||a.keepWalletOpened!==!0)&&this.notifyClose()}if(i&&this.defaultChainId()!==i){var o;await((o=this.prompter)==null?void 0:o.promptChangeNetwork(i))}}signOut(){this.account&&this.notifyDisconnect(),this.setAccount(null)}signerReset(){this.account=void 0}signerReady(e=rFe){return new Promise((r,n)=>{this.account!==void 0?r():(setTimeout(()=>{this.account===void 0&&(this.signerReadyCallbacks=[],n("signerReady timed out"))},e),this.signerReadyCallbacks.push(r))})}async connect(e){var r,n;if(!this.account)return{connected:!1,chainId:"0x0",error:"unable to connect without signed in account"};const i=(r=(n=e==null?void 0:e.networkId)!=null?n:this.defaultChainId())!=null?r:ge.MAINNET,s=a9e(i).chainId,o={connected:!0,chainId:zc(s)};if(e&&e.authorize){const a={app:e.app,origin:e.origin,expiry:e.expiry,nonce:e.authorizeNonce};try{o.proof=await jLe(this.account,s,a)}catch(c){return Ci.warn(`connect, signAuthorization failed for options: ${JSON.stringify(e)}, due to: ${c.message}`),{connected:!1,chainId:"0x0",error:`signAuthorization failed: ${c.message}`}}}return o.session=this.walletSession(s),o}async sendMessageRequest(e){var r;const i=Number(((r=e.clientVersion)==null?void 0:r.split(".")[0])||"0")<2,s={id:e.data.id,jsonrpc:"2.0",result:null,error:void 0};try{const o=await this.request({method:e.data.method,params:e.data.params,chainId:e.chainId});return $c({},e,{data:i?$c({},s,{result:o}):o})}catch(o){return $c({},e,{data:i?$c({},s,{error:o}):{error:o}})}}async request(e){await this.getAccount();try{var r,n;if((!this.account||this.account===null)&&!iFe.includes(e.method))throw HLe;const l=this.account;if(!l)throw new Error("WalletRequestHandler: wallet account is not configured");const f=(r=this.account)==null?void 0:r.providerFor((n=e.chainId)!=null?n:this.defaultChainId());if(!f)throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${e.chainId}`);const u=sFe(f)?f:void 0;switch(e.method){case"net_version":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("net_version",[])}case"eth_chainId":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("eth_chainId",[])}case"eth_accounts":return[l.address];case"eth_getBalance":{const[p,g]=e.params,y=await f.getBalance(p,g);return Nv(y)}case"sequence_sign":case"personal_sign":case"eth_sign":{let p;switch(e.method){case"sequence_sign":case"personal_sign":{const[I,C]=e.params;p=I;break}case"eth_sign":{const[I,C]=e.params;p=C;break}}let g="";const y=Nte(p),b=e.method==="sequence_sign";if(this.prompter===null){var i;g=await l.signMessage(y,(i=e.chainId)!=null?i:this.defaultChainId(),b?"eip6492":"ignore")}else g=await this.prompter.promptSignMessage({chainId:e.chainId,message:Ue(y),eip6492:b},this.connectOptions);if(g&&g.length>0)return g;throw new Error("declined by user")}case"sequence_signTypedData_v4":case"eth_signTypedData":case"eth_signTypedData_v4":{const[p,g]=e.params;let y;if(typeof g=="string")try{y=JSON.parse(g)}catch(C){console.warn("walletRequestHandler: error parsing typedData",C)}else y=g;if(!y||!y.domain||!y.types||!y.message)throw new Error("invalid typedData object");let b="";const I=e.method==="sequence_signTypedData_v4";if(this.prompter===null){var s;b=await l.signTypedData(y.domain,y.types,y.message,(s=e.chainId)!=null?s:this.defaultChainId(),I?"eip6492":"ignore")}else b=await this.prompter.promptSignMessage({chainId:e.chainId,typedData:y,eip6492:I},this.connectOptions);if(b&&b.length>0)return b;throw new Error("declined by user")}case"eth_sendTransaction":{const p=tFe(e.params[0]).map(y=>("gas"in y&&y.gasLimit===void 0&&(y.gasLimit=y.gas,delete y.gas),y));_I(l.address,p);let g="";if(this.prompter===null){var o,a;const y=await l.sendTransaction(p,(o=e.chainId)!=null?o:this.defaultChainId());g=(a=y==null?void 0:y.hash)!=null?a:""}else g=await this.prompter.promptSendTransaction(p,e.chainId,this.connectOptions);if(g)return g;throw new Error("declined by user")}case"eth_signTransaction":{const[p]=e.params;if(Qt(p.from)!==l.address)throw new Error("sender address does not match wallet");if(_I(l.address,p),this.prompter===null){var c;return await l.signTransactions(p,(c=e.chainId)!=null?c:this.defaultChainId())}else return await this.prompter.promptSignTransaction(p,e.chainId,this.connectOptions)}case"eth_sendRawTransaction":if(mt.transaction.isSignedTransactionBundle(e.params[0])){const p=Number(e.params[0].chainId);return(await l.relayer(p).relay(e.params[0])).hash}else return(await f.broadcastTransaction(e.params[0])).hash;case"eth_getTransactionCount":{const p=Qt(e.params[0]),g=e.params[1],y=await f.getTransactionCount(p,g);return Nv(BigInt(y))}case"eth_blockNumber":return await f.getBlockNumber();case"eth_getBlockByNumber":return await f.getBlock(e.params[0]);case"eth_getBlockByHash":return await f.getBlock(e.params[0]);case"eth_getTransactionByHash":return await f.getTransaction(e.params[0]);case"eth_call":{const[p,g]=e.params;return await f.call($c({},p,{blockTag:g}))}case"eth_getCode":{const[p,g]=e.params;return await f.getCode(p,g)}case"eth_estimateGas":{const[p]=e.params;return await f.estimateGas(p)}case"eth_gasPrice":{const p=await f.getFeeData();return p.gasPrice===null?null:Nv(p.gasPrice)}case"wallet_switchEthereumChain":{const[p]=e.params;if(!p.chainId||p.chainId.length===0)throw new Error("invalid chainId");const g=BigInt(p.chainId);return this.setDefaultChainId(Number(g)),null}case"sequence_getWalletContext":return l.contexts;case"sequence_getWalletConfig":{const[p]=e.params;return p?[(await l.status(p)).onChain.config]:await Promise.all(l.networks.map(async function(g){return(await l.status(g.chainId)).onChain.config}))}case"sequence_getWalletState":{const[p]=e.params;return p?[T$(p,await l.status(p))]:await Promise.all(l.networks.map(async function(g){const y=await l.status(g.chainId);return T$(g.chainId,y)}))}case"sequence_getNetworks":return await this.getNetworks(!0);case"sequence_isSequence":return!0;case"sequence_updateConfig":throw new Error("sequence_updateConfig method is not allowed from a dapp");case"sequence_publishConfig":throw new Error("sequence_publishConfig method is not allowed from a dapp");case"sequence_gasRefundOptions":break;case"sequence_getNonce":break;case"sequence_relay":break;case"sequence_setDefaultNetwork":{const[p]=e.params;if(!p)throw new Error("invalid request, method argument defaultChainId cannot be empty");return this.setDefaultChainId(p),await this.getNetworks(!0)}default:{if(!u)throw new Error("Account provider doesn't support send method");return await u.send(e.method,e.params)}}}catch(l){throw Ci.error(l),{message:typeof l=="string"?l:(l==null?void 0:l.message)||"unkown error",code:4001}}}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}async getAddress(){var e,r;return(e=(r=this.account)==null?void 0:r.address)!=null?e:""}get openIntent(){return this._openIntent}setOpenIntent(e){this._openIntent=e}get connectOptions(){return this._connectOptions}setConnectOptions(e){var r;this._connectOptions=e,(r=this.onConnectOptionsChange)==null||r.call(this,e)}async setDefaultChainId(e){var r;return await((r=this.prompter)==null?void 0:r.promptChangeNetwork(e)),this.defaultChainId()}async getNetworks(e){return this.account?e?this.account.networks.map(r=>{const n=$c({},r);return n.provider=void 0,n.relayer=void 0,n}):this.account.networks:(Ci.warn("signer not set: getNetworks is returning an empty list"),[])}walletSession(e){if(!this.account)return;const r={walletContext:this.account.contexts,accountAddress:this.account.address,networks:this.account.networks.map(i=>$c({},i,{provider:void 0,relayer:void 0}))};if(e){const i=Iw(r.networks,e);if(i){var n;(n=r.networks)==null||n.forEach(s=>delete s.isDefaultChain),i.isDefaultChain=!0}}return r}notifyConnect(e,r){var n;if(console.log("emit connect",e),this.events.emit("connect",e),(n=e.session)!=null&&n.accountAddress){var i;this.events.emit("accountsChanged",[(i=e.session)==null?void 0:i.accountAddress],r)}}notifyDisconnect(e){this.events.emit("accountsChanged",[],e),this.events.emit("disconnect",void 0,e)}notifyChainChanged(e,r){this.events.emit("chainChanged",zc(e),r)}async notifyNetworks(e){const r=e||await this.getNetworks(!0);if(this.events.emit("networks",r),r.length>0){const n=r.find(i=>i.chainId===this.defaultChainId());n&&this.events.emit("chainChanged",zc(n.chainId))}else this.events.emit("chainChanged","0x0")}async notifyWalletContext(){if(!this.account){Ci.warn("signer not set: skipping to notify wallet context");return}const e=this.account.contexts;this.events.emit("walletContext",e)}notifyClose(e){this.events.emit("close",e)}setAccount(e){if(this.account=e,e!==void 0){for(let r=0;rc.canOnchainValidate||c.original.version===2&&n,o=await r.status(i);if(s(o))return!0;if(await e.promptConfirmWalletDeploy(i,this.connectOptions)){const c=await r.status(i);return s(c)?!0:(Ci.error("WalletRequestHandler: result for promptConfirmWalletDeploy is not correct"),!1)}return!1}}function T$(t,e){return{context:e.original.context,config:e.onChain.config,address:mt.context.addressOf(e.original.context,e.original.imageHash),chainId:t,deployed:e.onChain.deployed,imageHash:e.imageHash,lastImageHash:e.onChain.imageHash,published:!0,status:e}}const iFe=["net_version","eth_chainId","eth_getBalance","eth_getTransactionCount","eth_blockNumber","eth_getBlockByNumber","eth_getBlockByHash","eth_getTransactionByHash","eth_getCode","eth_estimateGas","eth_gasPrice","sequence_getWalletContext","sequence_getNetworks","sequence_setDefaultNetwork"];function sFe(t){return t&&typeof t=="object"&&typeof t.send=="function"&&typeof t.getNetwork=="function"}function oFe(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}class DE{get utils(){return this.provider.utils}constructor(e,r){this.client=e,this.provider=r,this.singleNetworkSigners={},this._isSequenceSigner=!0}async getAddress(){return this.client.getAddress()}connect(e){if(!KM.is(e))throw new Error("SequenceSigner can only be connected to a SequenceProvider");return new DE(this.client,e)}getSigner(e){if(!e)return this;const r=this.provider.toChainId(e);return this.singleNetworkSigners[r]||(this.singleNetworkSigners[r]=new Bte(this.client,this.provider,r)),this.singleNetworkSigners[r]}useChainId(e){return this.provider.toChainId(e)||this.client.getChainId()}async signMessage(e,r){const{eip6492:n=!0}=r||{},i=this.useChainId(r==null?void 0:r.chainId);return this.client.signMessage(e,{eip6492:n,chainId:i})}async signTypedData(e,r,n,i){const{eip6492:s=!0}=i||{},o=this.useChainId(i==null?void 0:i.chainId);return this.client.signTypedData({domain:e,types:r,message:n},{eip6492:s,chainId:o})}getProvider(e){return this.provider.getProvider(e)}async sendTransaction(e,r){const n=this.useChainId(r==null?void 0:r.chainId),i=await eFe(e),s=await this.client.sendTransaction(i,{chainId:n}),o=this.getProvider(n);try{return await new Promise(c=>{(async function f(){const u=await o.getTransaction(s);if(u!==null)return c(u);await o.once("block",f)})()})}catch(a){throw a.transactionHash=s,a}}async getWalletConfig(e){const r=this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}getNetworks(){return this.client.getNetworks()}async getBalance(e,r){return this.getProvider(r==null?void 0:r.chainId).getBalance(this.getAddress(),e)}async estimateGas(e,r){return this.getProvider(r==null?void 0:r.chainId).estimateGas(e)}async call(e,r){return this.getProvider(r==null?void 0:r.chainId).call(e)}getChainId(){return Promise.resolve(this.client.getChainId())}async getFeeData(e){return this.getProvider(e==null?void 0:e.chainId).getFeeData()}async resolveName(e){const r=await this.provider.resolveName(e);if(r===null)throw new Error(`ENS name not found: ${e}`);return r}_checkProvider(e){}getNonce(e){throw new Error("SequenceSigner does not support getNonce")}populateCall(e){throw new Error("SequenceSigner does not support populateCall")}populateTransaction(e){throw new Error("SequenceSigner does not support populateTransaction")}checkTransaction(e){throw new Error("SequenceSigner does not support checkTransaction")}getTransactionCount(e){throw new Error("SequenceSigner does not support getTransactionCount")}signTransaction(e){throw new Error("SequenceWallet does not support signTransaction, use sendTransaction instead.")}static is(e){return e&&typeof e=="object"&&e._isSequenceSigner===!0}}class Bte extends DE{constructor(e,r,n){super(e,r.getProvider(n)),this.chainId=n,this._isSingleNetworkSequenceSigner=!0}_useChainId(e){const r=this.provider.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This signer only supports the network ${this.chainId}, but ${r} was requested.`);return r||this.provider.toChainId(this.chainId)}useChainId(e){return this._useChainId(e)}getChainId(){return Promise.resolve(this.provider.toChainId(this.chainId))}getProvider(e){return super.getProvider(this._useChainId(e))}getSigner(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceSigner===!0}}class aFe{constructor(e){if(this.signer=e,Bte.is(e))throw new Error("WalletUtils does not support SingleNetworkSequenceSigner")}signMessage(e,r,n){return this.signer.signMessage(e,{chainId:r,eip6492:n})}signTypedData(e,r,n,i,s){return this.signer.signTypedData(e,r,n,{chainId:i,eip6492:s})}async isValidSignature(e,r,n,i){return I$(e,r,n,this.signer.getProvider(i))}async isValidMessageSignature(e,r,n,i){const s=this.signer.getProvider(i),o=Nte(r),a=OEe(o);return I$(e,a,n,s)}isValidTypedDataSignature(e,r,n,i){return this.isValidSignature(e,Dk(r),n,i)}}const cFe=["method"],P$=["connect","disconnect","chainChanged","accountsChanged"];class KM extends gJ{constructor(e,r,n=dM,i){super(e.getChainId(),i),this.client=e,this.providerFor=r,this.networks=n,this.options=i,this.singleNetworkProviders={},this._isSequenceProvider=!0,this.utils=void 0,this.signer=void 0,this.eip1193EventListeners=new Map,e.onConnect(s=>{var o;(o=this.eip1193EventListeners.get("connect"))==null||o.forEach(a=>a(s))}),e.onDisconnect(s=>{var o;(o=this.eip1193EventListeners.get("disconnect"))==null||o.forEach(a=>a(s))}),e.onDefaultChainIdChanged(s=>{var o;(o=this.eip1193EventListeners.get("chainChanged"))==null||o.forEach(a=>a(s))}),e.onAccountsChanged(s=>{var o;(o=this.eip1193EventListeners.get("accountsChanged"))==null||o.forEach(a=>a(s))}),this.signer=new DE(this.client,this),this.utils=new aFe(this.signer)}async on(e,r){if(P$.includes(e)){const n=this.eip1193EventListeners.get(e)||new Set;return n.add(r),this.eip1193EventListeners.set(e,n),this}return super.on(e,r)}async off(e,r){if(P$.includes(e)){const n=this.eip1193EventListeners.get(e);return n&&(r?n.delete(r):n.clear()),this}return super.off(e,r)}getSigner(e){return this.signer.getSigner(e)}connect(e){return this.client.connect(e)}disconnect(){return this.client.disconnect()}isConnected(){return this.client.isConnected()}getSession(){return this.client.getSession()}listAccounts(){return[this.client.getAddress()]}getAddress(){return this.client.getAddress()}getNetworks(){return this.client.getNetworks()}getChainId(){return this.client.getChainId()}setDefaultChainId(e){return this.client.setDefaultChainId(this.toChainId(e))}isOpened(){return this.client.isOpened()}closeWallet(){return this.client.closeWallet()}getWalletContext(){return this.client.getWalletContext()}async getWalletConfig(e){const r=await this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}authorize(e){return this.client.connect($c({},e,{authorize:!0}))}async openWallet(e,r){return await this.client.openWallet(e,r),!0}toChainId(e){if(e===void 0)return;const r=Iw(this.networks,e);if(!r)throw new Error(`Unsupported network ${e}`);return r.chainId}async useChainId(e){return this.toChainId(e)||this.client.getChainId()}getProvider(e){if(!e)return this;const r=this.toChainId(e);return this.singleNetworkProviders[r]||(this.singleNetworkProviders[r]=new lFe(this.client,this.providerFor,r,this.options)),this.singleNetworkProviders[r]}async _getSubprovider(e){const r=await this.useChainId(e),n=this.providerFor(r);if(!n)throw new Error(`Unsupported network ${r}`);return n}async _perform(e){var r;const{method:n}=e,i=oFe(e,cFe),s=await this._getSubprovider(),o=(r=s.getRpcRequest(e))!=null?r:{method:n,args:Object.values(i)};if(!o)throw new Error(`Unsupported method ${e.method}`);return s.send(o.method,o.args)}async perform(e,r){if(e==="eth_chainId")return zc(await this.useChainId());if(e==="eth_accounts")return[this.client.getAddress()];if(e==="wallet_switchEthereumChain"){const n=r[0],i=Lte(n);return this.setDefaultChainId(i)}return e==="eth_sendTransaction"||e==="eth_sign"||e==="eth_signTypedData"||e==="eth_signTypedData_v4"||e==="personal_sign"||e==="sequence_sign"||e==="sequence_signTypedData_v4"?this.client.request({method:e,params:r,chainId:this.getChainId()}):this._perform($c({method:e},r))}send(e,r){return this.perform(e,r)}request(e){return this.perform(e.method,e.params)}async _detectNetwork(){const e=this.client.getChainId(),r=Iw(this.networks,e);if(!r)throw new Error(`Unknown network ${e}`);return new ca(r.name,r.chainId)}async detectNetwork(){return this._detectNetwork()}async waitForTransaction(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).waitForTransaction(e,r,n)}async getBlockNumber(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getBlockNumber()}async getFeeData(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getFeeData()}async getBalance(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBalance(e,r)}async getTransactionCount(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getTransactionCount(e,r)}async getCode(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getCode(e,r)}async getStorage(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).getStorage(e,r,n)}async call(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).call(e)}async estimateGas(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).estimateGas(e)}async getBlock(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBlock(e,r)}async getTransaction(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getTransaction(e)}async getLogs(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getLogs(e)}async supportsENS(){return(await this.getNetworks()).some(r=>r.chainId===1)}async getResolver(e){return await this.supportsENS()?(await this._getSubprovider(1)).getResolver(e):null}async resolveName(e){return vw(e)?e:await this.supportsENS()?(await this._getSubprovider(1)).resolveName(e):null}async lookupAddress(e){return await this.supportsENS()?(await this._getSubprovider(1)).lookupAddress(e):null}async getAvatar(e){return await this.supportsENS()?(await this._getSubprovider(1)).getAvatar(e):null}}KM.is=t=>t&&typeof t=="object"&&t._isSequenceProvider===!0;function Lte(t){return typeof t=="object"?Lte(t.chainId):Number(t)}class lFe extends KM{constructor(e,r,n,i){super(e,r,void 0,i),this.chainId=n,this._isSingleNetworkSequenceProvider=!0}_useChainId(e){const r=this.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This provider only supports the network ${this.chainId}, but ${r} was requested.`);return r||super.toChainId(this.chainId)}useChainId(e){return Promise.resolve(this._useChainId(e))}getChainId(){return super.toChainId(this.chainId)}async getNetwork(){const e=await this.client.getNetworks(),r=Iw(e,this.chainId);if(!r)throw new Error(`Unsupported network ${this.chainId}`);return new ca(r.name,r.chainId)}getProvider(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}getSigner(e){return super.getSigner(this._useChainId(e))}setDefaultChainId(e){throw new Error(`This provider only supports the network ${this.chainId}; use the parent provider to switch networks.`)}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceProvider===!0}}class Zr{constructor(e){de(this,"networkStore",Ir(Nn));de(this,"authStore",Ir(li));de(this,"accountAddress",this.authStore.accountAddress.get());de(this,"availableExternalProviders",Or([]));de(this,"selectedExternalProvider",Or(void 0));de(this,"selectedExternalWalletAddress",Or(void 0));de(this,"isSendingTokenTransaction",Or(void 0));de(this,"isSendingCollectibleTransaction",Or(void 0));de(this,"isSendingSignedTokenTransaction",Or(void 0));de(this,"connectDetails",Or(void 0));de(this,"connectOptions",Or(void 0));de(this,"isSigningTxn",Or(!1));de(this,"isSigningMsg",Or(!1));de(this,"toSignPermission",Or(void 0));de(this,"toSignResult",Or(void 0));de(this,"toSignTxnDetails",Or(void 0));de(this,"toSignMsgDetails",Or(void 0));de(this,"isCheckingWalletDeployment",Or(!1));de(this,"signClientWarningType",Or(!1));de(this,"walletRequestHandler");de(this,"local",{lastConnectedExternalProviderInfo:new Np(dh.LAST_CONNECTED_EXTERNAL_PROVIDER_INFO)});de(this,"defaultNetwork",new Np(dh.DEFAULT_NETWORK));de(this,"getLastConnectedExternalProviderInfo",()=>this.local.lastConnectedExternalProviderInfo.get());de(this,"sendToken",async(e,r,n)=>{var i,s;try{const o=this.store.get(li).account,a=e.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Nn).providerForChainId(a);this.isSendingTokenTransaction.set({tokenBalance:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(!n)return{hash:""};if(e.contractType===hh.NATIVE?(console.info("Sending native token with address, on chainId: ",e.contractAddress,a),p={to:r,value:E6e(n)}):e.contractType===hh.ERC20&&(console.info("Sending ERC20 token with address, on chainId: ",e.contractAddress,a),p=await new Dn(e.contractAddress,jv,c).transfer.populateTransaction(r,W7(n,((s=e.contractInfo)==null?void 0:s.decimals)??18))),!p)throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingTokenTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction")}});de(this,"sendCollectible",async(e,r,n)=>{var i,s;try{const o=this.store.get(li).account,a=e.collectibleInfoParams.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Nn).providerForChainId(a);this.isSendingCollectibleTransaction.set({collectibleInfo:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(e.collectibleInfoParams.contractType==="ERC721")console.info("Sending ERC721 non-fungible token with address, on chainId: ",e.collectibleInfoParams.address,a),p=await new Dn(e.collectibleInfoParams.address,hM,c).safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId);else if(e.collectibleInfoParams.contractType==="ERC1155"){console.info("Sending ERC1155 token with address, on chainId: ",e.collectibleInfoParams.address,a);const y=new Dn(e.collectibleInfoParams.address,pM,c);if(!n)return{hash:""};p=await y.safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId,W7(n,((s=e==null?void 0:e.collectibleInfoResponse)==null?void 0:s.decimals)??18),"0x")}if(!p)throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingCollectibleTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction")}});de(this,"setExternalProvider",async e=>{if(!e){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0),this.local.lastConnectedExternalProviderInfo.set(void 0);return}const n=(await this.getExternalProviderAccounts(e.provider))[0];this.local.lastConnectedExternalProviderInfo.set(e.info),this.selectedExternalProvider.set(e),this.selectedExternalWalletAddress.set(n),e.provider.on("accountsChanged",async i=>{if(i.length===0){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0);return}if(i[0]!==n){const o=(await this.getExternalProviderAccounts(e.provider))[0];this.selectedExternalWalletAddress.set(o)}})});de(this,"resetSignObservables",()=>{this.isSigningTxn.set(!1),this.toSignTxnDetails.set(void 0),this.toSignMsgDetails.set(void 0),this.toSignPermission.set(void 0),this.toSignResult.set(void 0)});de(this,"checkWalletDeployment",async e=>{const r=this.store.get(li).account;if(!r)throw new Error("No account found");return(await r.status(e)).onChain.deployed});this.store=e,this.walletRequestHandler=new nFe(void 0,new fFe(e),this.networkStore.networks.get()),this.walletRequestHandler.onConnectOptionsChange=n=>{this.connectOptions.set(n)},this.availableExternalProviders.subscribe(n=>{const i=this.local.lastConnectedExternalProviderInfo.get(),s=n.find(o=>(i==null?void 0:i.name)===o.info.name);s&&this.setExternalProvider(s)});const r=this.store.get(li).account;this.walletRequestHandler.signIn(r??null)}async sendTransaction(e,r,n,i,s){const o=await e.status(s),a=await e.predecorateTransactions(i,o,s),c=await e.signTransactions(a,s,void 0,{serial:!0}),l=await e.decorateTransactions(c,o);await this.switchToChain(r,s);const f=await r.request({method:"eth_estimateGas",params:[{from:n,to:l.entrypoint,data:mt.transaction.encodeBundleExecData(l)}]});return{hash:await r.request({method:"eth_sendTransaction",params:[{from:n,to:l.entrypoint,data:mt.transaction.encodeBundleExecData(l),gas:f}]})}}async getExternalProviderAccounts(e){return new Promise((r,n)=>{var i;(i=e.sendAsync)==null||i.call(e,{method:"eth_requestAccounts",params:[]},(s,o)=>{s&&n(s),o.result.length===0&&n(new Error("No accounts found")),r(o.result)})})}async getExternalProviderAddress(e){return(await this.getExternalProviderAccounts(e))[0]}async switchToChain(e,r){return new Promise((n,i)=>{var s;(s=e.sendAsync)==null||s.call(e,{method:"wallet_switchEthereumChain",params:[{chainId:zc(r)}]},(o,a)=>{o&&i(o),n(a)})})}}class fFe{constructor(e){this.store=e}getDefaultChainId(){return this.store.get(Zr).defaultNetwork.get()??1}async promptChangeNetwork(e){return this.store.get(Nn).networks.get().some(n=>n.chainId===e)?(this.store.get(Zr).defaultNetwork.set(e),!0):!1}async promptConfirmWalletDeploy(e,r){if(console.log("prompt confirm wallet deploy:",e,r),!e)return Promise.resolve(!1);const n=await this.store.get(Zr).checkWalletDeployment(e);return new Promise((i,s)=>{i(!!n)})}async promptConnect(e){console.log("promptconnect",e);const r=this.store.get(li).account;return await this.store.get(Zr).walletRequestHandler.signIn(r??null),e&&this.store.get(Zr).walletRequestHandler.setConnectOptions(e),new Promise((n,i)=>{const s=this.store.get(Zr).connectDetails.subscribe(o=>{s(),!o||!o.connected?i("connect cancelled by user"):n(o)})})}async promptSignInConnect(e){return console.log("prompt sign in connect:",e),{connected:!1}}async promptSignMessage(e,r){return console.log("prompt sign message:",e,r),e.chainId?e.eip6492!==!0&&!(await this.store.get(li).account.status(e.chainId)).canOnchainValidate&&!await this.promptConfirmWalletDeploy(e.chainId,r)?(this.store.get(Zr).signClientWarningType.set("notDeployed"),Promise.reject("User rejected wallet deploy request")):(this.store.get(Zr).isSigningMsg.set(!0),this.store.get(Zr).toSignMsgDetails.set({message:e,chainId:e.chainId,options:r}),new Promise((n,i)=>{const s=this.store.get(Zr).toSignPermission.subscribe(()=>{s();const o=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!o||o==="cancelled")i("request failed");else{const a=this.store.get(Zr).toSignResult.get();a&&n(a.hash)}})})):Promise.reject("No chainId found in message")}promptSignTransaction(e,r,n){console.log("prompt sign transaction:",e,r,n);let i;Array.isArray(e)?i=e:i=[e];const s=this.store.get(li).accountAddress.get();if(!s)throw new Error("Unknown account address");const o=mt.transaction.fromTransactionish(s,i);return console.log("prompt sign txn:",o,r,n),_I(s,i),new Promise((a,c)=>{this.store.get(Zr).toSignTxnDetails.set({txn:i,chainId:r,options:n}),this.store.get(Zr).isSigningTxn.set(!0);const l=this.store.get(Zr).toSignPermission.subscribe(()=>{l();const f=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!f||f==="cancelled")c("request failed");else{const u=this.store.get(Zr).toSignResult.get();u&&a(u.hash)}})})}promptSendTransaction(e,r,n){return this.promptSignTransaction(e,r,n)}}async function Fte(t){return await PLe.init({projectId:lX,showQrModal:t,optionalChains:[1],metadata:{name:"Sequence Recovery Wallet External Wallet",description:"",url:"TODO_CHANGE_LATER",icons:[]}})}function uFe(){const[t,e]=D.useState(null),n=Ir(Zr).getLastConnectedExternalProviderInfo();return D.useEffect(()=>{async function i(){const s=await Fte(!1);await s.enable(),e(s)}return(n==null?void 0:n.name)==="WalletConnect"&&i(),()=>{t&&t.disconnect()}},[]),t}const k$=async(t,e,r=15)=>{let n,i=0;do{if(i>5&&await new Promise(s=>setTimeout(s,100*i)),n=await t.getTransactionReceipt(e),i===r){console.warn(`Could not get receipt for transaction ${e} after ${i} tries`);return}if(n)return n;i++}while(!n&&i<=r)};let L6=[];const cS={value:()=>L6,subscribe:t=>{function e(r){L6.some(n=>n.info.uuid===r.detail.info.uuid)||(L6=[...L6,r.detail],t())}return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}},jte=()=>D.useSyncExternalStore(cS.subscribe,cS.value,cS.value);class NE{constructor(e){de(this,"authStore",Ir(li));de(this,"accountAddress",this.authStore.accountAddress.get());de(this,"isReady",Or(!1));de(this,"signClient");de(this,"currentRequestInfo");de(this,"allSessions",Or([]));de(this,"sessions",this.allSessions.readOnly());de(this,"createSignClient",async()=>{this.signClient=await OE.init({projectId:lX,metadata:{name:"Sequence Recovery Wallet",description:"Sequence Recovery Wallet - Recover Your Wallet",url:"http://localhost:5173",icons:["https://sequence.app/apple-touch-icon.png"]}}),this.signClient.on("session_proposal",this.onSessionProposal),this.signClient.on("session_request",this.onSessionRequest),this.signClient.on("session_ping",this.onSessionPing),this.signClient.on("session_event",this.onSessionEvent),this.signClient.on("session_update",this.onSessionUpdate),this.signClient.on("session_delete",this.onSessionDelete);const e=this.getSignClientSessions();e?this.allSessions.set(e):this.allSessions.set([]),this.isReady.set(!0)});de(this,"getSignClientSessions",()=>this.signClient.session.getAll().filter(r=>r.self.metadata.name!=="Sequence Recovery Wallet External Wallet"));de(this,"pair",async e=>{if(!this.signClient)throw new Error("WalletConnect signClient not initialized.");await this.signClient.core.pairing.pair({uri:e}),this.allSessions.set(this.getSignClientSessions())});de(this,"rejectRequest",()=>{var e;this.currentRequestInfo&&((e=this.signClient)==null||e.respond({topic:this.currentRequestInfo.topic,response:{id:this.currentRequestInfo.id,jsonrpc:"2.0",error:{message:"User rejected.",code:4001}}}))});de(this,"disconnectSession",async e=>{var n,i;const r=(n=this.signClient)==null?void 0:n.session.get(e);r&&(await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:r.topic,reason:{message:"User disconnected.",code:6e3}})),this.allSessions.set(this.getSignClientSessions()??[]))});de(this,"disconnectAllSessions",async()=>{var r;(((r=this.signClient)==null?void 0:r.session.getAll())??[]).forEach(async n=>{var i;await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:n.topic,reason:{message:"User disconnected.",code:6e3}}))}),this.allSessions.set([])});de(this,"onSessionProposal",async e=>{var l,f,u,p,g;console.log("onSessionProposal",e);const r=e.params.requiredNamespaces,n=e.params.optionalNamespaces,i=Object.keys(r).length===0?[]:r.eip155.chains??[],s=Object.keys(n).length===0?[]:n.eip155.chains??[],o=((l=i[0])==null?void 0:l.split(":").pop())??((f=s[0])==null?void 0:f.split(":").pop());if(!o)throw new Error("No chainId found in WalletConnect session proposal namespaces.");const a={app:e.params.proposer.metadata.name,origin:e.params.proposer.metadata.url,networkId:o,keepWalletOpened:!0},c=await this.store.get(Zr).walletRequestHandler.promptConnect(a);if(c&&c.connected){const b=this.store.get(Nn).networks.get(),I=i.map(_=>Number(_.split(":").pop())),C=s.map(_=>Number(_.split(":").pop())),L={eip155:{accounts:b.map(_=>_.chainId).filter(_=>[...I,...C].includes(_)).map(_=>"eip155:"+_+":"+this.accountAddress),methods:["eth_sendTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain"],events:["chainChanged","accountsChanged","connect","disconnect"]}},F=await((u=this.signClient)==null?void 0:u.approve({id:e.id,namespaces:L})),z=await(F==null?void 0:F.acknowledged());console.log("session",z),this.allSessions.set(this.getSignClientSessions()??[]),(p=this.signClient)==null||p.core.pairing.getPairings().filter(_=>e.params.pairingTopic!==_.topic).forEach(async _=>{var $,ie;e.params.proposer.metadata.url===(($=_.peerMetadata)==null?void 0:$.url)&&await((ie=this.signClient)==null?void 0:ie.core.pairing.disconnect({topic:_.topic}))})}else(g=this.signClient)==null||g.reject({id:e.id,reason:{message:"User rejected.",code:5e3}})});de(this,"onSessionRequest",async e=>{var o,a,c;console.log("onSessionRequest",e);const r=e.params.chainId.split(":").pop(),n={jsonrpc:"2.0",id:e.id,method:e.params.request.method,params:e.params.request.params,chainId:Number(r)};n.method==="eth_sendTransaction"&&Array.isArray(n.params)&&n.params.forEach(l=>{delete l.nonce});const i=(o=this.signClient)==null?void 0:o.session.get(e.topic),s={app:(i==null?void 0:i.peer.metadata.name)??"",origin:i==null?void 0:i.peer.metadata.url,networkId:r};this.store.get(Zr).walletRequestHandler.setConnectOptions(s),this.currentRequestInfo={topic:e.topic,id:e.id};try{const l=await this.store.get(Zr).walletRequestHandler.request(n);(a=this.signClient)==null||a.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",result:l}})}catch(l){(c=this.signClient)==null||c.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",error:{message:l.message,code:l.code??4001}}})}this.currentRequestInfo=void 0});de(this,"onSessionPing",async e=>{console.log("onSessionPing",e)});de(this,"onSessionEvent",async e=>{console.log("onSessionEvent",e)});de(this,"onSessionUpdate",async e=>{console.log("onSessionUpdate",e)});de(this,"onSessionDelete",async e=>{console.log("onSessionDelete",e),this.allSessions.set(this.getSignClientSessions()??[])});this.store=e,this.createSignClient()}}const M$=["https://dweb.link/ipfs/","https://gateway.pinata.cloud/ipfs/","https://nftstorage.link/ipfs/","https://flk-ipfs.io/ipfs/","https://storry.tv/ipfs/","https://ipfs.io/ipfs/","https://hardbin.com/ipfs/","https://ipfs.runfission.com/ipfs/","https://ipfs.eth.aragon.network/ipfs/","https://4everland.io/ipfs/","https://w3s.link/ipfs/","https://trustless-gateway.link/ipfs/"],dFe="QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1";class hFe{constructor(){de(this,"gatewayURL");de(this,"localStore");this.localStore=new Np(dh.GATEWAY_ADDRESS),this.gatewayURL=this.localStore.get(),this.findAccessibleGateway()}async findAccessibleGateway(){const e=this.localStore.get();if(e&&await this.isGatewayAccessible(e)){this.gatewayURL=e;return}for(const r of M$)if(await this.isGatewayAccessible(r)){this.gatewayURL=r,this.localStore.set(r);return}this.gatewayURL=M$[0],console.warn("No accessible IPFS gateways found, falling back to default")}async isGatewayAccessible(e){try{return await fetch(`${e}${dFe}`,{signal:AbortSignal.timeout(3e3)}),!0}catch{return!1}}async fetch(e){this.gatewayURL||await this.findAccessibleGateway();const r=await this.getGatewayURL(e);return fetch(r,{signal:AbortSignal.timeout(3e3)})}async getGatewayURL(e){if(this.gatewayURL||await this.findAccessibleGateway(),!e.startsWith("ipfs://"))throw new Error("Invalid IPFS URI");return e.replace("ipfs://",this.gatewayURL)}}class YM{constructor(e){de(this,"isFetchingBalances",Or(!1));de(this,"isFetchingCollectibleInfo",Or(!1));de(this,"ipfsGatewayHelper",new hFe);de(this,"userCollectibles",Or([]));de(this,"local",{userCollectibles:new Np(dh.COLLECTIBLES)});this.store=e;const r=this.store.get(Nn);pX(r.networks,n=>{const i=this.store.get(li).accountAddress.get();i&&n.length>0&&this.loadBalances(i)})}async loadBalances(e){const r=this.local.userCollectibles.get()??[];if(r.length===0)return;this.isFetchingBalances.set(!0);const n=[],i=r.map(async s=>{const o=await this.getCollectibleInfo(s);if(!o.isOwner){this.removeCollectible({collectibleInfoParams:s,collectibleInfoResponse:o});return}n.push({collectibleInfoParams:s,collectibleInfoResponse:o})});await Promise.allSettled(i),this.userCollectibles.set(n),this.isFetchingBalances.set(!1)}async getCollectibleInfo(e){const r=this.store.get(li).accountAddress.get();if(!r)throw new Error("No account found");const n=this.store.get(Nn).providerForChainId(e.chainId);this.isFetchingCollectibleInfo.set(!0);let i,s,o,a,c;if(e.contractType===hh.ERC721){const f=new Dn(e.address,hM,n),p=(await f.ownerOf(e.tokenId)).toLowerCase()===r.toLowerCase();if(!p)return this.isFetchingCollectibleInfo.set(!1),{isOwner:p,uri:""};i=await f.tokenURI(e.tokenId)}else if(e.contractType===hh.ERC1155){const f=new Dn(e.address,pM,n);if(a=await f.balanceOf(r,e.tokenId),!a)return this.isFetchingCollectibleInfo.set(!1),{isOwner:!1,uri:""};i=await f.uri(e.tokenId)}if(!i)throw new Error("Could not get collectible URI");i.includes("{id}")&&(i=i.replace("{id}",e.tokenId.toString()));let l;return i.startsWith("ipfs://")?l=await this.ipfsGatewayHelper.fetch(i).then(f=>f.json()):l=await fetch(i).then(f=>f.json()),l&&(c=l.decimals,s=l.image,o=l.name),s!=null&&s.startsWith("ipfs://")&&(s=await this.ipfsGatewayHelper.getGatewayURL(s)),a=a??BigInt(1),c=c??0,this.isFetchingCollectibleInfo.set(!1),{isOwner:!0,uri:i,image:s,name:o,balance:a,decimals:c}}async addCollectible(e){if(e.collectibleInfoResponse.isOwner){const r=this.local.userCollectibles.get()??[];if(r.some(n=>n.address===e.collectibleInfoParams.address&&n.tokenId===e.collectibleInfoParams.tokenId))throw new Error("Collectible already added");this.local.userCollectibles.set([...r,e.collectibleInfoParams]),this.isFetchingCollectibleInfo.set(!0),this.loadBalances(),this.isFetchingCollectibleInfo.set(!1)}}async removeCollectible(e){const n=(this.local.userCollectibles.get()??[]).filter(i=>i.address!==e.collectibleInfoParams.address||i.tokenId!==e.collectibleInfoParams.tokenId);this.local.userCollectibles.set(n),this.isFetchingCollectibleInfo.set(!0),this.loadBalances(),this.isFetchingCollectibleInfo.set(!1)}}function BE({chainId:t,paddingTop:e="1",paddingBottom:r="2"}){return W.jsx(xe,{background:"backgroundMuted",width:"fit",height:"fit",borderRadius:"sm",paddingTop:e,paddingBottom:r,paddingX:"2",children:W.jsx(Ge,{variant:"xsmall",color:"text100",children:ky(t)})})}function pFe({collectibleInfo:t,onSendClick:e,onRemoveClick:r}){return W.jsxs($r,{width:"full",flexDirection:"column",gap:"2",padding:"4",children:[W.jsx(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsx(Ge,{variant:"medium",color:"text80",children:t.collectibleInfoResponse.name??"Collectible"})}),W.jsx(xe,{style:{height:"200px"},children:W.jsx(a8,{style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"},src:t.collectibleInfoResponse.image??"",width:"full"})}),W.jsx(xe,{justifyContent:"flex-end",children:W.jsx(Ge,{variant:"medium",color:"text100",children:t.collectibleInfoParams.contractType==="ERC1155"?Number(fh(t.collectibleInfoResponse.balance,t.collectibleInfoResponse.decimals??0)):1})}),W.jsxs(xe,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(BE,{chainId:t.collectibleInfoParams.chainId}),W.jsxs(xe,{children:[W.jsx(Zt,{size:"xs",label:"Send",variant:"primary",shape:"square",onClick:e}),r&&W.jsx(Zt,{marginLeft:"2",size:"xs",label:"Remove",shape:"square",onClick:r})]})]})]})}function vFe({onClose:t}){const r=Ir(Nn).networks.get(),n=r.filter(z=>z.type===Ft.MAINNET),i=Ir(YM),s=yn(i.isFetchingCollectibleInfo),o=h8(),[a,c]=D.useState(),[l,f]=D.useState(),[u,p]=D.useState(),[g,y]=D.useState(),[b,I]=D.useState(),[C,S]=D.useState(!1);D.useEffect(()=>{a&&l&&u&&g?i.getCollectibleInfo({chainId:a.chainId,address:l,tokenId:u,contractType:g}).then(z=>{I(z)}):I(void 0)},[a,l,u,g]);const O=n.map(z=>({label:z.title,value:z.chainId.toString()})),L=async()=>{a&&l&&b&&u&&g&&(await i.addCollectible({collectibleInfoParams:{chainId:a.chainId,address:l,tokenId:u,contractType:g},collectibleInfoResponse:b}),S(!1),o({variant:"success",title:"Collectible added"}),F(),t())},F=()=>{f(void 0),c(void 0),p(void 0),y(void 0)};return W.jsxs($r,{flexDirection:"column",paddingY:"4",paddingX:"8",marginBottom:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:C,children:[W.jsx(xe,{children:W.jsx(Ge,{variant:"medium",color:"text80",children:"Import ERC721 or ERC1155 Collectible"})}),W.jsxs(xe,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(M7,{label:"Collectible Network",labelLocation:"left",name:"collectibleNetwork",options:O,onValueChange:z=>c(r.find(_=>_.chainId===Number(z)))}),W.jsx(Wn,{width:"full",label:"Collectible Address",labelLocation:"left",name:"collectibleAddress",value:l??"",onChange:z=>{f(z.target.value)}}),W.jsx(M7,{label:"Collectible Type",labelLocation:"left",name:"collectibleType",options:[{value:"ERC721",label:"ERC721"},{value:"ERC1155",label:"ERC1155"}],onValueChange:z=>y(z)}),W.jsx(Wn,{width:"full",label:"Collectible Token ID",labelLocation:"left",name:"collectibleId",value:u??"",onKeyPress:z=>{/[0-9]/.test(z.key)||z.preventDefault()},onChange:z=>{if(z.target.value===""){p(void 0);return}p(z.target.value)}}),s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})}),b&&!b.isOwner&&!s&&W.jsx(xe,{alignItems:"center",justifyContent:"center",children:W.jsx(Ge,{variant:"medium",color:"warning",children:"You do not own this collectible"})}),b&&b.isOwner&&!s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx($r,{flexDirection:"column",gap:"2",children:W.jsxs(xe,{flexDirection:"row",gap:"6",children:[W.jsx("img",{src:b.image??"",alt:b.name??"",style:{width:"120px",height:"auto"}}),W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Ge,{variant:"medium",color:"text100",children:b.name??""}),W.jsx(W.Fragment,{children:b.balance&&W.jsxs(W.Fragment,{children:[W.jsx(Ge,{variant:"small",color:"text80",children:"Your Balance:"}),W.jsx(Ge,{variant:"medium",color:"text100",children:Number(fh(b.balance,b.decimals??0))})]})})]})]})})}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:C,onClick:()=>{F(),t()}}),W.jsx(Zt,{label:"Add",disabled:b===void 0||!b.isOwner||C,variant:"primary",size:"md",shape:"square",onClick:L})]})]})]})}function gFe({onSendClick:t}){const e=Ir(YM),r=yn(e.isFetchingBalances),n=yn(e.userCollectibles),i=D.useMemo(()=>n,[n]),[s,o]=D.useState(!1);return W.jsxs(W.Fragment,{children:[W.jsxs(xe,{width:"full",flexDirection:"row",flexWrap:"wrap",gap:"4",marginBottom:"8",children:[i.map(a=>W.jsx(xe,{width:"1/3",children:W.jsx(pFe,{collectibleInfo:a,onSendClick:()=>{t(a)},onRemoveClick:()=>{e.removeCollectible(a)}})},a.collectibleInfoParams.chainId+a.collectibleInfoParams.address+a.collectibleInfoParams.tokenId)),r&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})]}),W.jsxs(xe,{width:"full",flexDirection:"column",alignItems:"center",justifyContent:"center",marginBottom:"4",children:[s&&W.jsx(vFe,{onClose:()=>o(!1)}),W.jsx(Zt,{label:"Import collectible",leftIcon:UH,variant:"primary",size:"md",shape:"square",onClick:()=>{o(!0)}})]})]})}function yFe({onClose:t}){const e=Ir(Nn),r=h8(),[n,i]=D.useState(),[s,o]=D.useState(),[a,c]=D.useState(),[l,f]=D.useState(),[u,p]=D.useState(),[g,y]=D.useState(),b=async()=>{n&&s&&a&&l&&await e.addNetwork({chainId:Number(n),name:s,title:s,type:Ft.MAINNET,rpcUrl:a,blockExplorer:{rootUrl:l},nativeToken:{name:u||"Ether",symbol:g||"ETH",decimals:18}})},I=()=>{i(void 0),o(void 0),c(void 0),f(void 0),p(void 0),y(void 0)};return W.jsxs(xe,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(Wn,{width:"full",label:"Chain ID",labelLocation:"left",name:"chainId",value:n??"",onChange:C=>{i(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Network Name",labelLocation:"left",name:"networkName",value:s??"",onChange:C=>{o(C.target.value)}}),W.jsx(Wn,{width:"full",label:"RPC URL",labelLocation:"left",name:"rpcUrl",value:a??"",onChange:C=>{c(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Block explorer URL",labelLocation:"left",name:"rpcUrl",value:l??"",onChange:C=>{f(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Native Token Name",labelLocation:"left",name:"tokenName",value:u??"",onChange:C=>{p(C.target.value)}}),W.jsx(Wn,{width:"full",label:"Native Token Symbol",labelLocation:"left",name:"tokenSymbol",value:g??"",onChange:C=>{y(C.target.value)}}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{I(),t()}}),W.jsx(Zt,{label:"Add",variant:"primary",size:"md",shape:"square",onClick:async()=>{try{await b(),r({variant:"success",title:"Network added",description:`You can now use ${s} network`}),I(),t()}catch(C){r({variant:"error",title:"Could not add network",description:C.message}),console.error(C)}}})]})]})}function R$({network:t}){var f,u;const e=Ir(Nn),n=yn(e.userAdditionNetworkChainIds).includes(t.chainId);D.useEffect(()=>{var p,g;(s!==t.rpcUrl||a!==((p=t.blockExplorer)==null?void 0:p.rootUrl))&&(o(t.rpcUrl),c(((g=t.blockExplorer)==null?void 0:g.rootUrl)??""))},[t]);const i=e.editedNetworkChainIds.get().includes(t.chainId),[s,o]=D.useState(t.rpcUrl),[a,c]=D.useState(((f=t.blockExplorer)==null?void 0:f.rootUrl)??""),l=s!==t.rpcUrl||a!==((u=t.blockExplorer)==null?void 0:u.rootUrl);return W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Ge,{fontWeight:"bold",color:"text100",children:t.title}),W.jsx(Wn,{label:"RPC URL",labelLocation:"left",name:"rpcUrl",spellCheck:!1,disabled:n,value:s??"",onChange:p=>{o(p.target.value)}}),W.jsx(Wn,{label:"Block Explorer URL",labelLocation:"left",name:"blockExplorerUrl",spellCheck:!1,disabled:n,value:a??"",onChange:p=>{c(p.target.value)}}),n&&W.jsxs(xe,{marginTop:"4",alignItems:"center",justifyContent:"flex-end",gap:"5",children:[W.jsx(Ge,{variant:"small",color:"text50",children:"Added by you"}),W.jsx(Zt,{label:"Remove",variant:"danger",size:"md",shape:"square",onClick:()=>e.removeNetwork(t.chainId)})]}),(l||i)&&!n&&W.jsxs(xe,{marginTop:"4",justifyContent:"flex-end",gap:"3",children:[W.jsx(W.Fragment,{children:i&&W.jsx(Zt,{label:"Reset to default",variant:"danger",size:"md",shape:"square",onClick:()=>e.resetNetworkEdit(t.chainId)})}),W.jsx(W.Fragment,{children:l&&W.jsx(Zt,{label:"Save",variant:"primary",size:"md",shape:"square",onClick:()=>{const p=t;p.rpcUrl=s,p.blockExplorer={rootUrl:a},p.relayer=_3(s),e.editNetwork(p)}})})]}),W.jsx(Sh,{})]})}function mFe(){const t=Ir(Nn),e=yn(t.networks),r=e.filter(f=>f.type===Ft.MAINNET),n=yn(t.userAdditionNetworkChainIds),i=r.sort((f,u)=>n.includes(f.chainId)?-1:1),s=e.filter(f=>f.type===Ft.TESTNET),[o,a]=D.useState(Ft.MAINNET),[c,l]=D.useState(!1);return W.jsxs(xe,{flexDirection:"column",paddingY:"4",paddingX:"8",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",children:[W.jsx(xe,{children:W.jsx(Ge,{variant:"large",color:"text80",children:"Networks"})}),W.jsx(xe,{width:"full",marginTop:"4",paddingBottom:"4",children:W.jsxs(vwe,{value:o,onValueChange:f=>a(f),children:[W.jsx(xe,{marginBottom:"10",children:W.jsx(pwe,{value:o,tabs:[{label:"Networks",value:Ft.MAINNET},{label:"Test Networks",value:Ft.TESTNET}]})}),W.jsx(HB,{value:Ft.MAINNET,children:W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsxs(xe,{width:"full",flexDirection:"column",alignItems:"flex-end",marginY:"4",children:[W.jsx(Zt,{label:"Add network",variant:"primary",size:"md",shape:"square",onClick:()=>{l(!0)}}),c&&W.jsx(yFe,{onClose:()=>l(!1)})]}),W.jsx(W.Fragment,{children:i.map((f,u)=>W.jsx(R$,{network:f},u))})]})}),W.jsx(HB,{value:Ft.TESTNET,children:W.jsx(xe,{flexDirection:"column",gap:"2",children:s.map((f,u)=>W.jsx(R$,{network:f},u))})})]})})]})}function lS({symbol:t,chainId:e,to:r,amount:n}){return W.jsxs(xe,{flexDirection:"column",width:"full",gap:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",children:"Pending transaction"}),W.jsxs(xe,{background:"backgroundMuted",flexDirection:"row",width:"full",height:"fit",borderRadius:"sm",paddingX:"4",paddingY:"2",alignItems:"center",gap:"5",children:[W.jsx(lh,{size:"md"}),W.jsxs(xe,{flexDirection:"column",gap:"1",children:[W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"1",children:[W.jsxs(Ge,{variant:"small",color:"text100",children:["Sending ",n," ",t," on"]}),W.jsx(BE,{chainId:e,paddingTop:"0",paddingBottom:"1"}),W.jsxs(Ge,{variant:"small",color:"text80",children:["to ",r]})]}),W.jsx(Ge,{variant:"small",color:"text50",children:"Your external wallet will prompt you to confirm the transaction"})]})]})]})}function bFe({onSelectProvider:t}){const e=Ir(NE),r=jte(),[n,i]=D.useState(!1),s=()=>window.confirm("All WalletConnect Dapp sessions will be disconnected. If you would like to continue, click OK and connect to WalletConnect again."),o=async()=>{try{if(!n){if(e.allSessions.get().length!==0){if(!s())throw new Error("User rejected wallet connect modal");await e.disconnectAllSessions(),t();return}i(!0);const a=await Fte(!0);await a.connect();let c=hre(a);t(c)}}catch(a){console.error(a)}};return W.jsx(W.Fragment,{children:!n&&W.jsxs(xe,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Select an external wallet to send transactions"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(xe,{flexDirection:"column",gap:"4",padding:"8",children:[W.jsx($r,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>{o()},children:W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:"https://avatars.githubusercontent.com/u/37784886",alt:"Wallet Connect",style:{width:"20px",height:"20px"}}),W.jsx(Ge,{variant:"normal",color:"text100",children:"Wallet Connect"})]})}),r.map(a=>W.jsx($r,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>t(a),children:W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:a.info.icon,alt:a.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Ge,{variant:"normal",color:"text100",children:a.info.name})]})},a.info.uuid))]})]})})}function wFe({collectibleInfo:t,onClose:e}){var y,b,I;const r=KP("isMobile"),n=Ir(Zr),[i,s]=D.useState(void 0),[o,a]=D.useState(void 0),[c,l]=D.useState(!1),[f,u]=D.useState(!1);if(D.useEffect(()=>{const C=n.selectedExternalWalletAddress.get();c&&C&&a(n.selectedExternalWalletAddress.get())},[c]),D.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=t.collectibleInfoParams.contractType==="ERC721",g=ky(t.collectibleInfoParams.chainId);return W.jsxs(xe,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(y=t==null?void 0:t.collectibleInfoResponse)==null?void 0:y.name," on ",g]}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(xe,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Wn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:p?"1":i??"",onChange:C=>{s(C.target.value)},disabled:p,controls:W.jsx(W.Fragment,{children:t.collectibleInfoParams.contractType==="ERC1155"&&W.jsx(Zt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var C,S;s(fh((C=t==null?void 0:t.collectibleInfoResponse)==null?void 0:C.balance,((S=t==null?void 0:t.collectibleInfoResponse)==null?void 0:S.decimals)??18))}})})}),W.jsxs(Ge,{variant:"small",color:"text50",children:["Current balance:"," ",fh((b=t==null?void 0:t.collectibleInfoResponse)==null?void 0:b.balance,((I=t==null?void 0:t.collectibleInfoResponse)==null?void 0:I.decimals)??18)]})]}),W.jsxs(xe,{flexDirection:"column",gap:"3",children:[W.jsx(Wn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:C=>{a(C.target.value)},disabled:c}),W.jsx(eP,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:C=>l(C===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Zt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!(p&&o||!p&&o&&i),onClick:()=>{e(o,i)}})]})]})]})}function xFe({tokenBalance:t,onClose:e}){var g,y;const r=KP("isMobile"),n=Ir(Zr),[i,s]=D.useState(void 0),[o,a]=D.useState(void 0),[c,l]=D.useState(!1),[f,u]=D.useState(!1);if(D.useEffect(()=>{const b=n.selectedExternalWalletAddress.get();c&&b&&a(n.selectedExternalWalletAddress.get())},[c]),D.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=ky(t.chainId);return W.jsxs(xe,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(g=t==null?void 0:t.contractInfo)==null?void 0:g.symbol," on ",p]}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(xe,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Wn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:i??"",onChange:b=>{s(b.target.value)},controls:W.jsx(Zt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var b;s(fh(t==null?void 0:t.balance,((b=t==null?void 0:t.contractInfo)==null?void 0:b.decimals)??18))}})}),W.jsxs(Ge,{variant:"small",color:"text50",children:["Current balance:"," ",fh(t==null?void 0:t.balance,((y=t==null?void 0:t.contractInfo)==null?void 0:y.decimals)??18)]})]}),W.jsxs(xe,{flexDirection:"column",gap:"3",children:[W.jsx(Wn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:b=>{a(b.target.value)},disabled:c}),W.jsx(eP,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:b=>l(b===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Zt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})]})}function EFe({onTokenListClick:t}){const e=Ir(li),r=rk();return W.jsxs(Kye,{children:[W.jsx(Zt,{as:Yye,label:"Settings",variant:"text"}),W.jsx(Qye,{side:"bottom",align:"end",sideOffset:20,children:W.jsxs(xe,{marginTop:"2",children:[W.jsx(HA,{onClick:t,children:W.jsx(xe,{padding:"1",children:W.jsx(Ge,{variant:"normal",fontWeight:"bold",children:"Token List"})})}),W.jsx(HA,{disabled:!0,children:W.jsx(xe,{width:"16",children:W.jsx(Sh,{color:"white"})})}),W.jsx(HA,{onClick:()=>{e.logout(),r("/")},children:W.jsx(xe,{padding:"1",children:W.jsx(Ge,{variant:"normal",fontWeight:"bold",children:"Log out"})})})]})})]})}function CFe(){const t=Ir(Tx),e=yn(t.userAddedTokens);return W.jsxs(xe,{flexDirection:"column",paddingY:"4",paddingX:"8",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",children:[W.jsxs(xe,{flexDirection:"column",alignItems:"center",gap:"4",marginBottom:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",children:"Token List"}),W.jsx(Ge,{variant:"normal",color:"text50",children:"Tokens added by you can be removed here"})]}),W.jsxs(xe,{width:"full",height:"full",flexDirection:"column",marginTop:"4",paddingBottom:"12",gap:"4",children:[e.length===0&&W.jsx(xe,{height:"full",alignItems:"center",justifyContent:"center",children:W.jsx(Ge,{variant:"medium",color:"text50",marginBottom:"16",children:"You haven't added any tokens yet"})}),e.map((r,n)=>W.jsxs($r,{width:"full",flexDirection:"row",gap:"2",alignItems:"center",children:[W.jsxs(xe,{flexDirection:"column",gap:"2",children:[W.jsx(Ge,{variant:"medium",color:"text80",children:r.symbol}),W.jsx(Ge,{variant:"normal",color:"text50",children:r.address}),W.jsx(BE,{chainId:r.chainId})]}),W.jsx(xe,{marginLeft:"auto",children:W.jsx(Zt,{label:"Remove",variant:"danger",size:"md",shape:"square",onClick:()=>{t.removeToken(r)}})})]},n))]})]})}function AFe({onClose:t}){const r=Ir(Nn).networks.get(),n=r.filter(S=>S.type===Ft.MAINNET),i=Ir(Tx),s=yn(i.isFetchingTokenInfo),o=h8(),[a,c]=D.useState(),[l,f]=D.useState(),[u,p]=D.useState(),[g,y]=D.useState(!1);D.useEffect(()=>{a&&l?i.getTokenInfo(a.chainId,l).then(S=>{p(S)}):p(void 0)},[a,l]);const b=n.map(S=>({label:S.title,value:S.chainId.toString()})),I=async()=>{a&&l&&u&&(y(!0),await i.addToken({chainId:a.chainId,address:l,contractType:hh.ERC20,symbol:u.symbol,decimals:u.decimals}),y(!1),o({variant:"success",title:"Token added"}),C(),t())},C=()=>{f(void 0),c(void 0)};return W.jsxs($r,{flexDirection:"column",paddingY:"4",paddingX:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:g,children:[W.jsx(xe,{children:W.jsx(Ge,{variant:"medium",color:"text80",children:"Import ERC20 Token"})}),W.jsxs(xe,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(M7,{label:"Token Network",labelLocation:"left",name:"tokenNetwork",options:b,onValueChange:S=>c(r.find(O=>O.chainId===Number(S)))}),W.jsx(Wn,{width:"full",label:"Token Address",labelLocation:"left",name:"tokenAddress",value:l??"",onChange:S=>{f(S.target.value)}}),s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})}),u&&W.jsxs(W.Fragment,{children:[W.jsx(Wn,{width:"full",label:"Token Symbol",labelLocation:"left",name:"tokenSymbol",value:(u==null?void 0:u.symbol)??"",disabled:!0}),W.jsx(Wn,{width:"full",label:"Token Decimals",labelLocation:"left",name:"tokenDecimals",value:(u==null?void 0:u.decimals)??"",disabled:!0})]}),W.jsxs(xe,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Zt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:g,onClick:()=>{C(),t()}}),W.jsx(Zt,{label:"Add",disabled:u===void 0||g,variant:"primary",size:"md",shape:"square",onClick:I})]})]})]})}const SFe=(t,e)=>Math.floor(t*10**e)/10**e;function _Fe({disabled:t,tokenBalance:e,onSendClick:r,onRemoveClick:n}){var o,a;const i=fh(e.balance,((o=e.contractInfo)==null?void 0:o.decimals)??18),s=SFe(Number(i),5);return W.jsxs($r,{width:"full",flexDirection:"column",gap:"2",children:[W.jsxs(xe,{flexDirection:"row",alignItems:"center",children:[W.jsx(Ge,{variant:"medium",color:"text80",children:((a=e.contractInfo)==null?void 0:a.symbol)??"Native Token"}),W.jsx(xe,{marginLeft:"auto",children:W.jsx(Ge,{color:"text80",children:s})})]}),W.jsxs(xe,{flexDirection:"row",children:[W.jsx(BE,{chainId:e.chainId}),W.jsxs(xe,{marginLeft:"auto",gap:"2",children:[W.jsx(Zt,{size:"xs",label:"Send",variant:"primary",shape:"square",disabled:t,onClick:r}),n&&W.jsx(Zt,{size:"xs",label:"Remove",shape:"square",onClick:n})]})]})]})}function IFe({filterZeroBalances:t,onSendClick:e}){const r=Ir(Zr),n=Ir(Tx),i=yn(n.balances),s=yn(n.isFetchingBalances),o=yn(r.selectedExternalProvider)!==void 0,a=D.useMemo(()=>t?i.filter(u=>u.balance!=="0"):i,[i,t,s]),[c,l]=D.useState(!1),f=u=>u.contractType===hh.NATIVE?void 0:()=>{var p,g;n.removeToken({chainId:u.chainId,address:u.contractAddress,contractType:u.contractType,decimals:(p=u.contractInfo)==null?void 0:p.decimals,symbol:(g=u.contractInfo)==null?void 0:g.symbol})};return W.jsxs(W.Fragment,{children:[W.jsxs(xe,{width:"full",flexDirection:"column",gap:"4",marginBottom:"8",children:[a.map(u=>W.jsx(_Fe,{tokenBalance:u,disabled:!o,onSendClick:()=>e(u),onRemoveClick:f(u)},u.contractAddress+u.chainId)),s&&W.jsx(xe,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(lh,{size:"lg"})})]}),c&&W.jsx(AFe,{onClose:()=>l(!1)}),!c&&W.jsx(xe,{width:"full",alignItems:"center",justifyContent:"center",marginBottom:"4",children:W.jsx(Zt,{label:"Import token",leftIcon:UH,variant:"primary",size:"md",shape:"square",onClick:()=>{l(!0)}})})]})}function TFe({onClose:t}){var a;const e=Ir(Zr),r=yn(e.connectOptions),[n,i]=D.useState(!1),s=async()=>{if(n)return;i(!0);const c=await e.walletRequestHandler.connect(r);e.connectDetails.set(c),i(!1),t()},o=()=>{e.connectDetails.set({connected:!1}),t()};return W.jsx(xe,{children:r&&W.jsxs(xe,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Would you like to allow this dapp to connect to your wallet?"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Ge,{variant:"md",color:"text100",children:r.app}),W.jsxs(xe,{flexDirection:"row",alignItems:"center",gap:"3",children:[W.jsx(Ge,{variant:"md",color:"text100",children:(a=r.origin)==null?void 0:a.split("//")[1]}),W.jsx(yu,{size:"xs",icon:J4,onClick:()=>window.open(r.origin,"_blank")})]})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Network"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${ky(Number(r.networkId))}`})]}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"6",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:o,"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:n?"Authorizing…":"Connect",disabled:n,onClick:s,"data-id":"signingContinue"})]})]})})}function PFe({sessionList:t}){const e=Ir(NE);return W.jsxs(xe,{flexDirection:"column",gap:"2",children:[t.length!==0&&W.jsx(Ge,{variant:"large",color:"text80",marginTop:"6",marginBottom:"2",children:"Connected Dapps via WalletConnect"}),t.map((r,n)=>W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"2",padding:"2",children:[W.jsx(a8,{width:"8",height:"8",src:r.peer.metadata.icons[0]}),W.jsx(Ge,{variant:"normal",fontWeight:"bold",color:"text100",children:r.peer.metadata.name}),W.jsxs(xe,{gap:"2",children:[r.peer.metadata.url&&W.jsx(yu,{size:"xs",icon:J4,onClick:()=>window.open(r.peer.metadata.url,"_blank")}),W.jsx(yu,{size:"xs",icon:Vg,onClick:()=>{e.disconnectSession(r.topic)}})]})]},n))]})}function kFe({onClose:t}){var l,f;const e=Ir(Zr),r=Ir(li),n=e.toSignMsgDetails.get(),i=r.accountAddress.get(),[s,o]=D.useState(""),[a,c]=D.useState("");return D.useEffect(()=>{if(console.log("details",n),c(new Date().toLocaleString()),n!=null&&n.message.message){const u=XLe(n.message.message);try{o(Ip(u))}catch{o(Me(u))}}else n!=null&&n.message.typedData&&o(JSON.stringify(n.message.typedData,void 0,4))},[n]),W.jsx(xe,{children:n&&W.jsxs(xe,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to sign this message?"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Ge,{variant:"md",color:"text100",children:a})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(xe,{alignItems:"center",gap:"3",children:[W.jsx(Ge,{variant:"md",color:"text100",children:(f=(l=n==null?void 0:n.options)==null?void 0:l.origin)==null?void 0:f.split("//")[1]}),W.jsx(yu,{size:"xs",icon:J4,onClick:()=>{var u;return window.open((u=n.options)==null?void 0:u.origin,"_blank")}})]})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Network"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${ky(n.chainId)}`})]}),W.jsxs($r,{flexDirection:"column",gap:"4",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Signee"}),W.jsx($r,{children:W.jsx(Ge,{variant:"md",color:"text100",children:`${i}`})})]}),W.jsx(GH,{label:"Message Content",children:W.jsx($r,{children:W.jsx(Ge,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:s})})}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(n)},"data-id":"signingContinue"})]})]})})}function MFe({onClose:t}){var I,C;const e=Ir(Zr),r=Ir(Nn),n=Ir(YM),[i,s]=D.useState("Unknown"),[o,a]=D.useState(null),[c,l]=D.useState({name:null}),[f,u]=D.useState(null),[p,g]=D.useState(""),y=e.toSignTxnDetails.get();D.useEffect(()=>{if(!y)return;g(new Date().toLocaleString());const S=r.providerForChainId(y.chainId??0),O=y.txn[0].data,L=y.txn[0].to;b(O,L,S)},[y]),D.useEffect(()=>{if(!y||!(y!=null&&y.txn[0].to)||!o)return;const S=y.txn[0].to,O={chainId:y.chainId,address:S,tokenId:o,contractType:i};n.getCollectibleInfo(O)},[i,o]);async function b(S,O,L){try{const F=new Dn(O,jv,L);try{const ie=await F.symbol();s("ERC20"),l({name:ie});const K=new $i(jv).parseTransaction({data:S}),P=await F.decimals();u(Number(fh(K==null?void 0:K.args[1],P??18)));return}catch{}const z=new Dn(O,C9e,L);if(await z.supportsInterface("0x80ac58cd")){s("ERC721");const ie=new Dn(O,hM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).tokenId.toString();a(K);const P=await ie.name();l({name:P});return}if(await z.supportsInterface("0xd9b67a26")){s("ERC1155");const ie=new Dn(O,pM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).id.toString();a(K);const P=await ie.uri(K);l({name:P});return}}catch(F){console.error("Error parsing contract type. The transaction is either using a smart contract that doesnt support ERC165 or the token is native:",F)}if(y!=null&&y.txn[0].value){s("Native Token"),l({name:`${ky((y==null?void 0:y.chainId)??1)} Native Token`});return}console.info("Token info could not be decoded for this transaction")}return W.jsx(xe,{children:y&&W.jsx(xe,{children:W.jsxs(xe,{flexDirection:"column",padding:"10",gap:"4",children:[W.jsx(Ge,{alignSelf:"center",variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to approve this transaction?"}),W.jsx(Sh,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Ge,{variant:"md",color:"text100",children:p})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(xe,{alignItems:"center",gap:"3",children:[W.jsx(Ge,{variant:"md",color:"text100",children:(C=(I=y==null?void 0:y.options)==null?void 0:I.origin)==null?void 0:C.split("//")[1]}),W.jsx(yu,{size:"xs",icon:J4,onClick:()=>{var S;return window.open((S=y.options)==null?void 0:S.origin,"_blank")}})]})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Token Standard"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${i}`})]}),i==="ERC721"||i==="ERC1155"&&W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Token ID"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${o}`})]}),W.jsxs($r,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Ge,{variant:"md",color:"text100",children:"Amount"}),W.jsx(Ge,{variant:"md",color:"text100",children:`${f??0} ${c.name}`})]}),W.jsx(GH,{label:"Transaction Data",children:W.jsx(xe,{flexDirection:"column",gap:"2",children:y.txn.map((S,O)=>W.jsx($r,{children:W.jsx(Ge,{variant:"code",color:"text80",style:{whiteSpace:"pre-wrap"},children:JSON.stringify(S,null,4)||"Native token transfer"})},O))})}),W.jsxs(xe,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Zt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Zt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(y)},"data-id":"signingContinue"})]})]})})})}function RFe({warningType:t}){return W.jsx(xe,{children:W.jsxs(xe,{flexDirection:"column",padding:"10",alignItems:"center",gap:"6",children:[W.jsx(Ge,{variant:"md",fontWeight:"bold",color:"text100",children:"Warning:"}),W.jsx(xe,{flexDirection:"column",children:W.jsx($r,{children:W.jsxs(Ge,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"2",children:[t==="noProvider"&&'Please ensure that an external wallet is connected via the "Connect" button',t==="isWalletConnect"&&"Please switch your external wallet to an option other than WalletConnect",t==="notDeployed"&&"Please deploy our wallet on the required network before trying to sign messages"]})})})]})})}var Ute={},Fo={};Object.defineProperty(Fo,"__esModule",{value:!0});Fo.compactObject=Vte;Fo.deprecated=$Fe;var OFe=Fo.detectBrowser=qFe;Fo.disableLog=FFe;Fo.disableWarnings=jFe;Fo.extractVersion=j3;Fo.filterStats=VFe;Fo.log=UFe;Fo.walkStats=v4;Fo.wrapPeerConnectionEvent=LFe;function DFe(t,e,r){return e=NFe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function NFe(t){var e=BFe(t,"string");return gh(e)=="symbol"?e:e+""}function BFe(t,e){if(gh(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gh(t){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gh(t)}var $te=!0,qte=!0;function j3(t,e,r){var n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function LFe(t,e,r){if(t.RTCPeerConnection){var n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(o,a){if(o!==e)return i.apply(this,arguments);var c=function(f){var u=r(f);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[o,c])};var s=n.removeEventListener;n.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);var c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(n,"on"+e,{get:function(){return this["_on"+e]},set:function(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}}function FFe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):($te=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function jFe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):(qte=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function UFe(){if((typeof window>"u"?"undefined":gh(window))==="object"){if($te)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function $Fe(t,e){qte&&console.warn(t+" is deprecated, please use "+e+" instead.")}function qFe(t){var e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;var r=t.navigator;if(r.userAgentData&&r.userAgentData.brands){var n=r.userAgentData.brands.find(function(i){return i.brand==="Chromium"});if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=j3(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=j3(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=j3(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function O$(t){return Object.prototype.toString.call(t)==="[object Object]"}function Vte(t){return O$(t)?Object.keys(t).reduce(function(e,r){var n=O$(t[r]),i=n?Vte(t[r]):t[r],s=n&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,DFe({},r,i))},{}):t}function v4(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(function(n){n.endsWith("Id")?v4(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(function(i){v4(t,t.get(i),r)})}))}function VFe(t,e,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;var s=[];return t.forEach(function(o){o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(function(o){t.forEach(function(a){a.type===n&&a.trackId===o.id&&v4(t,a,i)})}),i}Object.defineProperty(Ute,"__esModule",{value:!0});var zFe=Ute.shimGetUserMedia=WFe,HFe=GFe(Fo);function zte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(zte=function(i){return i?r:e})(t)}function GFe(t,e){if(t&&t.__esModule)return t;if(t===null||gd(t)!="object"&&typeof t!="function")return{default:t};var r=zte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function gd(t){"@babel/helpers - typeof";return gd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gd(t)}var D$=HFe.log;function WFe(t,e){var r=t&&t.navigator;if(r.mediaDevices){var n=function(l){if(gd(l)!=="object"||l.mandatory||l.optional)return l;var f={};return Object.keys(l).forEach(function(u){if(!(u==="require"||u==="advanced"||u==="mediaSource")){var p=gd(l[u])==="object"?l[u]:{ideal:l[u]};p.exact!==void 0&&typeof p.exact=="number"&&(p.min=p.max=p.exact);var g=function(I,C){return I?I+C.charAt(0).toUpperCase()+C.slice(1):C==="deviceId"?"sourceId":C};if(p.ideal!==void 0){f.optional=f.optional||[];var y={};typeof p.ideal=="number"?(y[g("min",u)]=p.ideal,f.optional.push(y),y={},y[g("max",u)]=p.ideal,f.optional.push(y)):(y[g("",u)]=p.ideal,f.optional.push(y))}p.exact!==void 0&&typeof p.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",u)]=p.exact):["min","max"].forEach(function(b){p[b]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(b,u)]=p[b])})}}),l.advanced&&(f.optional=(f.optional||[]).concat(l.advanced)),f},i=function(l,f){if(e.version>=61)return f(l);if(l=JSON.parse(JSON.stringify(l)),l&&gd(l.audio)==="object"){var u=function(I,C,S){C in I&&!(S in I)&&(I[S]=I[C],delete I[C])};l=JSON.parse(JSON.stringify(l)),u(l.audio,"autoGainControl","googAutoGainControl"),u(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=n(l.audio)}if(l&&gd(l.video)==="object"){var p=l.video.facingMode;p=p&&(gd(p)==="object"?p:{ideal:p});var g=e.version<66;if(p&&(p.exact==="user"||p.exact==="environment"||p.ideal==="user"||p.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!g)){delete l.video.facingMode;var y;if(p.exact==="environment"||p.ideal==="environment"?y=["back","rear"]:(p.exact==="user"||p.ideal==="user")&&(y=["front"]),y)return r.mediaDevices.enumerateDevices().then(function(b){b=b.filter(function(C){return C.kind==="videoinput"});var I=b.find(function(C){return y.some(function(S){return C.label.toLowerCase().includes(S)})});return!I&&b.length&&y.includes("back")&&(I=b[b.length-1]),I&&(l.video.deviceId=p.exact?{exact:I.deviceId}:{ideal:I.deviceId}),l.video=n(l.video),D$("chrome: "+JSON.stringify(l)),f(l)})}l.video=n(l.video)}return D$("chrome: "+JSON.stringify(l)),f(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},o=function(l,f,u){i(l,function(p){r.webkitGetUserMedia(p,f,function(g){u&&u(s(g))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,function(l){return a(l).then(function(f){if(l.audio&&!f.getAudioTracks().length||l.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(function(u){u.stop()}),new DOMException("","NotFoundError");return f},function(f){return Promise.reject(s(f))})})}}}}var Hte={};Object.defineProperty(Hte,"__esModule",{value:!0});var KFe=Hte.shimGetUserMedia=JFe,YFe=QFe(Fo);function Gte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Gte=function(i){return i?r:e})(t)}function QFe(t,e){if(t&&t.__esModule)return t;if(t===null||Hv(t)!="object"&&typeof t!="function")return{default:t};var r=Gte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Hv(t){"@babel/helpers - typeof";return Hv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hv(t)}function JFe(t,e){var r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(c,l,f){YFe.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(c).then(l,f)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(l,f,u){f in l&&!(u in l)&&(l[u]=l[f],delete l[f])},s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(c){return Hv(c)==="object"&&Hv(c.audio)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c.audio,"autoGainControl","mozAutoGainControl"),i(c.audio,"noiseSuppression","mozNoiseSuppression")),s(c)},n&&n.prototype.getSettings){var o=n.prototype.getSettings;n.prototype.getSettings=function(){var c=o.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){var a=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&Hv(c)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[c])}}}}var af={};Object.defineProperty(af,"__esModule",{value:!0});af.shimAudioContext=aje;af.shimCallbacksAPI=rje;af.shimConstraints=Yte;af.shimCreateOfferLegacy=oje;var ZFe=af.shimGetUserMedia=nje;af.shimLocalStreamsAPI=eje;af.shimRTCIceServerUrls=ije;af.shimRemoteStreamsAPI=tje;af.shimTrackEventTransceiver=sje;var Wte=XFe(Fo);function Kte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Kte=function(i){return i?r:e})(t)}function XFe(t,e){if(t&&t.__esModule)return t;if(t===null||yh(t)!="object"&&typeof t!="function")return{default:t};var r=Kte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function eje(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){var e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(function(s){return e.call(i,s,n)}),n.getVideoTracks().forEach(function(s){return e.call(i,s,n)})},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=this,s=arguments.length,o=new Array(s>1?s-1:0),a=1;a=0)){n._remoteStreams.push(s);var o=new Event("addstream");o.stream=s,n.dispatchEvent(o)}})}),e.apply(n,arguments)}}}function rje(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){var e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=r.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p},e.createAnswer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=n.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p};var a=function(l,f,u){var p=i.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p};e.setLocalDescription=a,a=function(l,f,u){var p=s.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.setRemoteDescription=a,a=function(l,f,u){var p=o.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.addIceCandidate=a}}function nje(t){var e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=function(i){return n(Yte(i))}}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(s,o,a){e.mediaDevices.getUserMedia(s).then(o,a)}).bind(e))}function Yte(t){return t&&t.video!==void 0?Object.assign({},t,{video:Wte.compactObject(t.video)}):t}function ije(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){for(var s=[],o=0;o{throw TypeError(t)},Jte=(t,e,r)=>e.has(t)||Qte("Cannot "+r),cje=(t,e,r)=>(Jte(t,e,"read from private field"),r?r.call(t):e.get(t)),lje=(t,e,r)=>e.has(t)?Qte("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),fje=(t,e,r,n)=>(Jte(t,e,"write to private field"),e.set(t,r),r);const N$=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function uje(t){return t.join("|")}function dje(t){const e=B$(t);let r=0,n=N$.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),s=N$[i],o=B$(s);if(o===e)return s;o{const r=t.match(/_(.+?)\.wasm$/);return r?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.2.15/dist/${r[1]}/${t}`:e+t}};let L$=new WeakMap;function QM(t,e){var r;const n=L$.get(t);if(n!=null&&n.modulePromise&&e===void 0)return n.modulePromise;const i=(r=n==null?void 0:n.moduleOverrides)!=null?r:bje,s=t({...i});return L$.set(t,{moduleOverrides:i,modulePromise:s}),s}async function wje(t,e,r=ly){const n={...ly,...r},i=await QM(t),{size:s}=e,o=new Uint8Array(await e.arrayBuffer()),a=i._malloc(s);i.HEAPU8.set(o,a);const c=i.readBarcodesFromImage(a,s,Zte(i,n));i._free(a);const l=[];for(let f=0;f{var t,e=typeof document<"u"&&((t=document.currentScript)==null?void 0:t.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(r={}){var n,i=r,s,o,a=new Promise((q,V)=>{s=q,o=V}),c=typeof window=="object",l=typeof Bun<"u",f=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var u=Object.assign({},i),p="./this.program",g="";function y(q){return i.locateFile?i.locateFile(q,g):g+q}var b,I;if(c||f||l){var C;f?g=self.location.href:typeof document<"u"&&((C=document.currentScript)===null||C===void 0?void 0:C.tagName.toUpperCase())==="SCRIPT"&&(g=document.currentScript.src),e&&(g=e),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),f&&(I=q=>{var V=new XMLHttpRequest;return V.open("GET",q,!1),V.responseType="arraybuffer",V.send(null),new Uint8Array(V.response)}),b=q=>fetch(q,{credentials:"same-origin"}).then(V=>V.ok?V.arrayBuffer():Promise.reject(new Error(V.status+" : "+V.url)))}var S=i.print||console.log.bind(console),O=i.printErr||console.error.bind(console);Object.assign(i,u),u=null,i.arguments&&i.arguments,i.thisProgram&&(p=i.thisProgram);var L=i.wasmBinary,F,z=!1,_,$,ie,ce,K,P,M,v;function m(){var q=F.buffer;i.HEAP8=_=new Int8Array(q),i.HEAP16=ie=new Int16Array(q),i.HEAPU8=$=new Uint8Array(q),i.HEAPU16=ce=new Uint16Array(q),i.HEAP32=K=new Int32Array(q),i.HEAPU32=P=new Uint32Array(q),i.HEAPF32=M=new Float32Array(q),i.HEAPF64=v=new Float64Array(q)}var R=[],B=[],E=[];function x(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)k(i.preRun.shift());Je(R)}function w(){Je(B)}function T(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)oe(i.postRun.shift());Je(E)}function k(q){R.unshift(q)}function H(q){B.unshift(q)}function oe(q){E.unshift(q)}var j=0,X=null;function G(q){var V;j++,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j)}function Z(q){var V;if(j--,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j),j==0&&X){var re=X;X=null,re()}}function ee(q){var V;(V=i.onAbort)===null||V===void 0||V.call(i,q),q="Aborted("+q+")",O(q),z=!0,q+=". Build with -sASSERTIONS for more info.";var re=new WebAssembly.RuntimeError(q);throw o(re),re}var N="data:application/octet-stream;base64,",te=q=>q.startsWith(N);function fe(){var q="zxing_reader.wasm";return te(q)?q:y(q)}var Ee;function _e(q){if(q==Ee&&L)return new Uint8Array(L);if(I)return I(q);throw"both async and sync fetching of the wasm failed"}function Re(q){return L?Promise.resolve().then(()=>_e(q)):b(q).then(V=>new Uint8Array(V),()=>_e(q))}function Te(q,V,re){return Re(q).then(ae=>WebAssembly.instantiate(ae,V)).then(re,ae=>{O(`failed to asynchronously prepare wasm: ${ae}`),ee(ae)})}function De(q,V,re,ae){return!q&&typeof WebAssembly.instantiateStreaming=="function"&&!te(V)&&typeof fetch=="function"?fetch(V,{credentials:"same-origin"}).then(pe=>{var me=WebAssembly.instantiateStreaming(pe,re);return me.then(ae,function(Se){return O(`wasm streaming compile failed: ${Se}`),O("falling back to ArrayBuffer instantiation"),Te(V,re,ae)})}):Te(V,re,ae)}function ze(){return{a:Zy}}function et(){var q,V=ze();function re(pe,me){return hn=pe.exports,F=hn.za,m(),ds=hn.Da,H(hn.Aa),Z(),hn}G();function ae(pe){re(pe.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(V,re)}catch(pe){O(`Module.instantiateWasm callback failed with error: ${pe}`),o(pe)}return(q=Ee)!==null&&q!==void 0||(Ee=fe()),De(L,Ee,V,ae).catch(o),{}}var Je=q=>{for(;q.length>0;)q.shift()(i)};i.noExitRuntime;var ke=q=>ho(q),Ne=()=>em(),tt=[],Ze=0,st=q=>{var V=new lt(q);return V.get_caught()||(V.set_caught(!0),Ze--),V.set_rethrown(!1),tt.push(V),Xx(q),Jx(q)},nt=0,We=()=>{yr(0,0);var q=tt.pop();Zx(q.excPtr),nt=0};class lt{constructor(V){this.excPtr=V,this.ptr=V-24}set_type(V){P[this.ptr+4>>2]=V}get_type(){return P[this.ptr+4>>2]}set_destructor(V){P[this.ptr+8>>2]=V}get_destructor(){return P[this.ptr+8>>2]}set_caught(V){V=V?1:0,_[this.ptr+12]=V}get_caught(){return _[this.ptr+12]!=0}set_rethrown(V){V=V?1:0,_[this.ptr+13]=V}get_rethrown(){return _[this.ptr+13]!=0}init(V,re){this.set_adjusted_ptr(0),this.set_type(V),this.set_destructor(re)}set_adjusted_ptr(V){P[this.ptr+16>>2]=V}get_adjusted_ptr(){return P[this.ptr+16>>2]}}var vt=q=>{throw nt||(nt=q),nt},Ke=q=>df(q),gt=q=>{var V=nt;if(!V)return Ke(0),0;var re=new lt(V);re.set_adjusted_ptr(V);var ae=re.get_type();if(!ae)return Ke(0),V;for(var pe of q){if(pe===0||pe===ae)break;var me=re.ptr+16;if(e2(pe,ae,me))return Ke(pe),V}return Ke(ae),V},wt=()=>gt([]),rt=q=>gt([q]),It=(q,V)=>gt([q,V]),At=()=>{var q=tt.pop();q||ee("no exception to throw");var V=q.excPtr;throw q.get_rethrown()||(tt.push(q),q.set_rethrown(!0),q.set_caught(!1),Ze++),nt=V,nt},Tt=(q,V,re)=>{var ae=new lt(q);throw ae.init(V,re),nt=q,Ze++,nt},Xt=()=>Ze,lr=()=>{ee("")},xt={},ar=q=>{for(;q.length;){var V=q.pop(),re=q.pop();re(V)}};function rr(q){return this.fromWireType(P[q>>2])}var kt={},Dt={},Nt={},dt,Lt=q=>{throw new dt(q)},Mt=(q,V,re)=>{q.forEach(Ae=>Nt[Ae]=V);function ae(Ae){var Be=re(Ae);Be.length!==q.length&&Lt("Mismatched type converter count");for(var Ye=0;Ye{Dt.hasOwnProperty(Ae)?pe[Be]=Dt[Ae]:(me.push(Ae),kt.hasOwnProperty(Ae)||(kt[Ae]=[]),kt[Ae].push(()=>{pe[Be]=Dt[Ae],++Se,Se===me.length&&ae(pe)}))}),me.length===0&&ae(pe)},ut=q=>{var V=xt[q];delete xt[q];var re=V.rawConstructor,ae=V.rawDestructor,pe=V.fields,me=pe.map(Se=>Se.getterReturnType).concat(pe.map(Se=>Se.setterArgumentType));Mt([q],me,Se=>{var Ae={};return pe.forEach((Be,Ye)=>{var Qe=Be.fieldName,pt=Se[Ye],mr=Be.getter,Br=Be.getterContext,un=Se[Ye+pe.length],Zn=Be.setter,In=Be.setterContext;Ae[Qe]={read:pn=>pt.fromWireType(mr(Br,pn)),write:(pn,yc)=>{var $n=[];Zn(In,pn,un.toWireType($n,yc)),ar($n)}}}),[{name:V.name,fromWireType:Be=>{var Ye={};for(var Qe in Ae)Ye[Qe]=Ae[Qe].read(Be);return ae(Be),Ye},toWireType:(Be,Ye)=>{for(var Qe in Ae)if(!(Qe in Ye))throw new TypeError(`Missing field: "${Qe}"`);var pt=re();for(Qe in Ae)Ae[Qe].write(pt,Ye[Qe]);return Be!==null&&Be.push(ae,pt),pt},argPackAdvance:ct,readValueFromPointer:rr,destructorFunction:ae}]})},Vt=(q,V,re,ae,pe)=>{},zt=()=>{for(var q=new Array(256),V=0;V<256;++V)q[V]=String.fromCharCode(V);ht=q},ht,Et=q=>{for(var V="",re=q;$[re];)V+=ht[$[re++]];return V},Bt,He=q=>{throw new Bt(q)};function $t(q,V){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var ae=V.name;if(q||He(`type "${ae}" must have a positive integer typeid pointer`),Dt.hasOwnProperty(q)){if(re.ignoreDuplicateRegistrations)return;He(`Cannot register type '${ae}' twice`)}if(Dt[q]=V,delete Nt[q],kt.hasOwnProperty(q)){var pe=kt[q];delete kt[q],pe.forEach(me=>me())}}function Ct(q,V){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $t(q,V,re)}var ct=8,Ht=(q,V,re,ae)=>{V=Et(V),Ct(q,{name:V,fromWireType:function(pe){return!!pe},toWireType:function(pe,me){return me?re:ae},argPackAdvance:ct,readValueFromPointer:function(pe){return this.fromWireType($[pe])},destructorFunction:null})},Rr=q=>({count:q.count,deleteScheduled:q.deleteScheduled,preservePointerOnDelete:q.preservePointerOnDelete,ptr:q.ptr,ptrType:q.ptrType,smartPtr:q.smartPtr,smartPtrType:q.smartPtrType}),Ut=q=>{function V(re){return re.$$.ptrType.registeredClass.name}He(V(q)+" instance already deleted")},Sr=!1,er=q=>{},kr=q=>{q.smartPtr?q.smartPtrType.rawDestructor(q.smartPtr):q.ptrType.registeredClass.rawDestructor(q.ptr)},bi=q=>{q.count.value-=1;var V=q.count.value===0;V&&kr(q)},wi=(q,V,re)=>{if(V===re)return q;if(re.baseClass===void 0)return null;var ae=wi(q,V,re.baseClass);return ae===null?null:re.downcast(ae)},xi={},Ti=()=>Object.keys(pi).length,Sn=()=>{var q=[];for(var V in pi)pi.hasOwnProperty(V)&&q.push(pi[V]);return q},di=[],Fs=()=>{for(;di.length;){var q=di.pop();q.$$.deleteScheduled=!1,q.delete()}},hi,jo=q=>{hi=q,di.length&&hi&&hi(Fs)},Uo=()=>{i.getInheritedInstanceCount=Ti,i.getLiveInheritedInstances=Sn,i.flushPendingDeletes=Fs,i.setDelayFunction=jo},pi={},oo=(q,V)=>{for(V===void 0&&He("ptr should not be undefined");q.baseClass;)V=q.upcast(V),q=q.baseClass;return V},ao=(q,V)=>(V=oo(q,V),pi[V]),_n=(q,V)=>{(!V.ptrType||!V.ptr)&&Lt("makeClassHandle requires ptr and ptrType");var re=!!V.smartPtrType,ae=!!V.smartPtr;return re!==ae&&Lt("Both smartPtrType and smartPtr must be specified"),V.count={value:1},Gi(Object.create(q,{$$:{value:V,writable:!0}}))};function $o(q){var V=this.getPointee(q);if(!V)return this.destructor(q),null;var re=ao(this.registeredClass,V);if(re!==void 0){if(re.$$.count.value===0)return re.$$.ptr=V,re.$$.smartPtr=q,re.clone();var ae=re.clone();return this.destructor(q),ae}function pe(){return this.isSmartPointer?_n(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:V,smartPtrType:this,smartPtr:q}):_n(this.registeredClass.instancePrototype,{ptrType:this,ptr:q})}var me=this.registeredClass.getActualType(V),Se=xi[me];if(!Se)return pe.call(this);var Ae;this.isConst?Ae=Se.constPointerType:Ae=Se.pointerType;var Be=wi(V,this.registeredClass,Ae.registeredClass);return Be===null?pe.call(this):this.isSmartPointer?_n(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Be,smartPtrType:this,smartPtr:q}):_n(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Be})}var Gi=q=>typeof FinalizationRegistry>"u"?(Gi=V=>V,q):(Sr=new FinalizationRegistry(V=>{bi(V.$$)}),Gi=V=>{var re=V.$$,ae=!!re.smartPtr;if(ae){var pe={$$:re};Sr.register(V,pe,V)}return V},er=V=>Sr.unregister(V),Gi(q)),qo=()=>{Object.assign(Ca.prototype,{isAliasOf(q){if(!(this instanceof Ca)||!(q instanceof Ca))return!1;var V=this.$$.ptrType.registeredClass,re=this.$$.ptr;q.$$=q.$$;for(var ae=q.$$.ptrType.registeredClass,pe=q.$$.ptr;V.baseClass;)re=V.upcast(re),V=V.baseClass;for(;ae.baseClass;)pe=ae.upcast(pe),ae=ae.baseClass;return V===ae&&re===pe},clone(){if(this.$$.ptr||Ut(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var q=Gi(Object.create(Object.getPrototypeOf(this),{$$:{value:Rr(this.$$)}}));return q.$$.count.value+=1,q.$$.deleteScheduled=!1,q},delete(){this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),er(this),bi(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),di.push(this),di.length===1&&hi&&hi(Fs),this.$$.deleteScheduled=!0,this}})};function Ca(){}var co=(q,V)=>Object.defineProperty(V,"name",{value:q}),Lh=(q,V,re)=>{if(q[V].overloadTable===void 0){var ae=q[V];q[V]=function(){for(var pe=arguments.length,me=new Array(pe),Se=0;Se{i.hasOwnProperty(q)?((re===void 0||i[q].overloadTable!==void 0&&i[q].overloadTable[re]!==void 0)&&He(`Cannot register public name '${q}' twice`),Lh(i,q,q),i.hasOwnProperty(re)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${re})!`),i[q].overloadTable[re]=V):(i[q]=V,re!==void 0&&(i[q].numArguments=re))},Fh=48,cf=57,jh=q=>{if(q===void 0)return"_unknown";q=q.replace(/[^a-zA-Z0-9_]/g,"$");var V=q.charCodeAt(0);return V>=Fh&&V<=cf?`_${q}`:q};function lf(q,V,re,ae,pe,me,Se,Ae){this.name=q,this.constructor=V,this.instancePrototype=re,this.rawDestructor=ae,this.baseClass=pe,this.getActualType=me,this.upcast=Se,this.downcast=Ae,this.pureVirtualFunctions=[]}var Du=(q,V,re)=>{for(;V!==re;)V.upcast||He(`Expected null or instance of ${re.name}, got an instance of ${V.name}`),q=V.upcast(q),V=V.baseClass;return q};function qy(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${zr(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var re=V.$$.ptrType.registeredClass,ae=Du(V.$$.ptr,re,this.registeredClass);return ae}function r1(q,V){var re;if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(re=this.rawConstructor(),q!==null&&q.push(this.rawDestructor,re),re):0;(!V||!V.$$)&&He(`Cannot pass "${zr(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);var ae=V.$$.ptrType.registeredClass;if(re=Du(V.$$.ptr,ae,this.registeredClass),this.isSmartPointer)switch(V.$$.smartPtr===void 0&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:V.$$.smartPtrType===this?re=V.$$.smartPtr:He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:re=V.$$.smartPtr;break;case 2:if(V.$$.smartPtrType===this)re=V.$$.smartPtr;else{var pe=V.clone();re=this.rawShare(re,zo.toHandle(()=>pe.delete())),q!==null&&q.push(this.rawDestructor,re)}break;default:He("Unsupporting sharing policy")}return re}function n1(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${zr(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.ptrType.name} to parameter type ${this.name}`);var re=V.$$.ptrType.registeredClass,ae=Du(V.$$.ptr,re,this.registeredClass);return ae}var Nu=()=>{Object.assign(Bu.prototype,{getPointee(q){return this.rawGetPointee&&(q=this.rawGetPointee(q)),q},destructor(q){var V;(V=this.rawDestructor)===null||V===void 0||V.call(this,q)},argPackAdvance:ct,readValueFromPointer:rr,fromWireType:$o})};function Bu(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe){this.name=q,this.registeredClass=V,this.isReference=re,this.isConst=ae,this.isSmartPointer=pe,this.pointeeType=me,this.sharingPolicy=Se,this.rawGetPointee=Ae,this.rawConstructor=Be,this.rawShare=Ye,this.rawDestructor=Qe,!pe&&V.baseClass===void 0?ae?(this.toWireType=qy,this.destructorFunction=null):(this.toWireType=n1,this.destructorFunction=null):this.toWireType=r1}var Uh=(q,V,re)=>{i.hasOwnProperty(q)||Lt("Replacing nonexistent public symbol"),i[q].overloadTable!==void 0&&re!==void 0?i[q].overloadTable[re]=V:(i[q]=V,i[q].argCount=re)},Lu=(q,V,re)=>{q=q.replace(/p/g,"i");var ae=i["dynCall_"+q];return ae(V,...re)},Vo=[],ds,hr=q=>{var V=Vo[q];return V||(q>=Vo.length&&(Vo.length=q+1),Vo[q]=V=ds.get(q)),V},i1=function(q,V){let re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(q.includes("j"))return Lu(q,V,re);var ae=hr(V)(...re);return ae},Aa=(q,V)=>function(){for(var re=arguments.length,ae=new Array(re),pe=0;pe{q=Et(q);function re(){return q.includes("j")?Aa(q,V):hr(V)}var ae=re();return typeof ae!="function"&&He(`unknown function pointer with signature ${q}: ${V}`),ae},s1=(q,V)=>{var re=co(V,function(ae){this.name=V,this.message=ae;var pe=new Error(ae).stack;pe!==void 0&&(this.stack=this.toString()+` +`+pe.replace(/^Error(:[^\n]*)?\n/,""))});return re.prototype=Object.create(q.prototype),re.prototype.constructor=re,re.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},re},$h,qh=q=>{var V=gc(q),re=Et(V);return uo(V),re},Fu=(q,V)=>{var re=[],ae={};function pe(me){if(!ae[me]&&!Dt[me]){if(Nt[me]){Nt[me].forEach(pe);return}re.push(me),ae[me]=!0}}throw V.forEach(pe),new $h(`${q}: `+re.map(qh).join([", "]))},vc=(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt,mr)=>{Qe=Et(Qe),me=hs(pe,me),Ae&&(Ae=hs(Se,Ae)),Ye&&(Ye=hs(Be,Ye)),mr=hs(pt,mr);var Br=jh(Qe);pc(Br,function(){Fu(`Cannot construct ${Qe} due to unbound types`,[ae])}),Mt([q,V,re],ae?[ae]:[],un=>{un=un[0];var Zn,In;ae?(Zn=un.registeredClass,In=Zn.instancePrototype):In=Ca.prototype;var pn=co(Qe,function(){if(Object.getPrototypeOf(this)!==yc)throw new Bt("Use 'new' to construct "+Qe);if($n.constructor_body===void 0)throw new Bt(Qe+" has no accessible constructor");for(var l2=arguments.length,b1=new Array(l2),w1=0;w1{for(var re=[],ae=0;ae>2]);return re};function o1(q){for(var V=1;V{var Se=ju(V,re);pe=hs(ae,pe),Mt([],[q],Ae=>{Ae=Ae[0];var Be=`constructor ${Ae.name}`;if(Ae.registeredClass.constructor_body===void 0&&(Ae.registeredClass.constructor_body=[]),Ae.registeredClass.constructor_body[V-1]!==void 0)throw new Bt(`Cannot register multiple constructors with identical number of parameters (${V-1}) for class '${Ae.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return Ae.registeredClass.constructor_body[V-1]=()=>{Fu(`Cannot construct ${Ae.name} due to unbound types`,Se)},Mt([],Se,Ye=>(Ye.splice(1,0,null),Ae.registeredClass.constructor_body[V-1]=nl(Be,Ye,null,pe,me),[])),[]})},Uu=q=>{q=q.trim();const V=q.indexOf("(");return V!==-1?q.substr(0,V):q},zy=(q,V,re,ae,pe,me,Se,Ae,Be,Ye)=>{var Qe=ju(re,ae);V=Et(V),V=Uu(V),me=hs(pe,me),Mt([],[q],pt=>{pt=pt[0];var mr=`${pt.name}.${V}`;V.startsWith("@@")&&(V=Symbol[V.substring(2)]),Ae&&pt.registeredClass.pureVirtualFunctions.push(V);function Br(){Fu(`Cannot call ${mr} due to unbound types`,Qe)}var un=pt.registeredClass.instancePrototype,Zn=un[V];return Zn===void 0||Zn.overloadTable===void 0&&Zn.className!==pt.name&&Zn.argCount===re-2?(Br.argCount=re-2,Br.className=pt.name,un[V]=Br):(Lh(un,V,mr),un[V].overloadTable[re-2]=Br),Mt([],Qe,In=>{var pn=nl(mr,In,pt,me,Se);return un[V].overloadTable===void 0?(pn.argCount=re-2,un[V]=pn):un[V].overloadTable[re-2]=pn,[]}),[]})},il=[],lo=[],$u=q=>{q>9&&--lo[q+1]===0&&(lo[q]=void 0,il.push(q))},ff=()=>lo.length/2-5-il.length,a1=()=>{lo.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=ff},zo={toValue:q=>(q||He("Cannot use deleted val. handle = "+q),lo[q]),toHandle:q=>{switch(q){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const V=il.pop()||lo.length;return lo[V]=q,lo[V+1]=1,V}}}},Wr={name:"emscripten::val",fromWireType:q=>{var V=zo.toValue(q);return $u(q),V},toWireType:(q,V)=>zo.toHandle(V),argPackAdvance:ct,readValueFromPointer:rr,destructorFunction:null},Kr=q=>Ct(q,Wr),le=(q,V,re)=>{switch(V){case 1:return re?function(ae){return this.fromWireType(_[ae])}:function(ae){return this.fromWireType($[ae])};case 2:return re?function(ae){return this.fromWireType(ie[ae>>1])}:function(ae){return this.fromWireType(ce[ae>>1])};case 4:return re?function(ae){return this.fromWireType(K[ae>>2])}:function(ae){return this.fromWireType(P[ae>>2])};default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},we=(q,V,re,ae)=>{V=Et(V);function pe(){}pe.values={},Ct(q,{name:V,constructor:pe,fromWireType:function(me){return this.constructor.values[me]},toWireType:(me,Se)=>Se.value,argPackAdvance:ct,readValueFromPointer:le(V,re,ae),destructorFunction:null}),pc(V,pe)},$e=(q,V)=>{var re=Dt[q];return re===void 0&&He(`${V} has unknown type ${qh(q)}`),re},yt=(q,V,re)=>{var ae=$e(q,"enum");V=Et(V);var pe=ae.constructor,me=Object.create(ae.constructor.prototype,{value:{value:re},constructor:{value:co(`${ae.name}_${V}`,function(){})}});pe.values[re]=me,pe[V]=me},zr=q=>{if(q===null)return"null";var V=typeof q;return V==="object"||V==="array"||V==="function"?q.toString():""+q},tr=(q,V)=>{switch(V){case 4:return function(re){return this.fromWireType(M[re>>2])};case 8:return function(re){return this.fromWireType(v[re>>3])};default:throw new TypeError(`invalid float width (${V}): ${q}`)}},ln=(q,V,re)=>{V=Et(V),Ct(q,{name:V,fromWireType:ae=>ae,toWireType:(ae,pe)=>pe,argPackAdvance:ct,readValueFromPointer:tr(V,re),destructorFunction:null})},jn=(q,V,re,ae,pe,me,Se,Ae)=>{var Be=ju(V,re);q=Et(q),q=Uu(q),pe=hs(ae,pe),pc(q,function(){Fu(`Cannot call ${q} due to unbound types`,Be)},V-1),Mt([],Be,Ye=>{var Qe=[Ye[0],null].concat(Ye.slice(1));return Uh(q,nl(q,Qe,null,pe,me),V-1),[]})},wr=(q,V,re)=>{switch(V){case 1:return re?ae=>_[ae]:ae=>$[ae];case 2:return re?ae=>ie[ae>>1]:ae=>ce[ae>>1];case 4:return re?ae=>K[ae>>2]:ae=>P[ae>>2];default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},en=(q,V,re,ae,pe)=>{V=Et(V);var me=Qe=>Qe;if(ae===0){var Se=32-8*re;me=Qe=>Qe<>>Se}var Ae=V.includes("unsigned"),Be=(Qe,pt)=>{},Ye;Ae?Ye=function(Qe,pt){return Be(pt,this.name),pt>>>0}:Ye=function(Qe,pt){return Be(pt,this.name),pt},Ct(q,{name:V,fromWireType:me,toWireType:Ye,argPackAdvance:ct,readValueFromPointer:wr(V,re,ae!==0),destructorFunction:null})},Pn=(q,V,re)=>{var ae=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],pe=ae[V];function me(Se){var Ae=P[Se>>2],Be=P[Se+4>>2];return new pe(_.buffer,Be,Ae)}re=Et(re),Ct(q,{name:re,fromWireType:me,argPackAdvance:ct,readValueFromPointer:me},{ignoreDuplicateRegistrations:!0})},ps=Object.assign({optional:!0},Wr),Un=(q,V)=>{Ct(q,ps)},fn=(q,V,re,ae)=>{if(!(ae>0))return 0;for(var pe=re,me=re+ae-1,Se=0;Se=55296&&Ae<=57343){var Be=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Be&1023}if(Ae<=127){if(re>=me)break;V[re++]=Ae}else if(Ae<=2047){if(re+1>=me)break;V[re++]=192|Ae>>6,V[re++]=128|Ae&63}else if(Ae<=65535){if(re+2>=me)break;V[re++]=224|Ae>>12,V[re++]=128|Ae>>6&63,V[re++]=128|Ae&63}else{if(re+3>=me)break;V[re++]=240|Ae>>18,V[re++]=128|Ae>>12&63,V[re++]=128|Ae>>6&63,V[re++]=128|Ae&63}}return V[re]=0,re-pe},Yn=(q,V,re)=>fn(q,$,V,re),Ho=q=>{for(var V=0,re=0;re=55296&&ae<=57343?(V+=4,++re):V+=3}return V},js=typeof TextDecoder<"u"?new TextDecoder:void 0,Go=(q,V,re)=>{for(var ae=V+re,pe=V;q[pe]&&!(pe>=ae);)++pe;if(pe-V>16&&q.buffer&&js)return js.decode(q.subarray(V,pe));for(var me="";V>10,56320|Ye&1023)}}return me},Vh=(q,V)=>q?Go($,q,V):"",uf=(q,V)=>{V=Et(V);var re=V==="std::string";Ct(q,{name:V,fromWireType(ae){var pe=P[ae>>2],me=ae+4,Se;if(re)for(var Ae=me,Be=0;Be<=pe;++Be){var Ye=me+Be;if(Be==pe||$[Ye]==0){var Qe=Ye-Ae,pt=Vh(Ae,Qe);Se===void 0?Se=pt:(Se+="\0",Se+=pt),Ae=Ye+1}}else{for(var mr=new Array(pe),Be=0;Be>2]=me,re&&Se)Yn(pe,Be,me+1);else if(Se)for(var Ye=0;Ye255&&(uo(Be),He("String has UTF-16 code units that do not fit in 8 bits")),$[Be+Ye]=Qe}else for(var Ye=0;Ye{for(var re=q,ae=re>>1,pe=ae+V/2;!(ae>=pe)&&ce[ae];)++ae;if(re=ae<<1,re-q>32&&Qn)return Qn.decode($.subarray(q,re));for(var me="",Se=0;!(Se>=V/2);++Se){var Ae=ie[q+Se*2>>1];if(Ae==0)break;me+=String.fromCharCode(Ae)}return me},fo=(q,V,re)=>{var ae;if((ae=re)!==null&&ae!==void 0||(re=2147483647),re<2)return 0;re-=2;for(var pe=V,me=re>1]=Ae,V+=2}return ie[V>>1]=0,V-pe},FE=q=>q.length*2,Hx=(q,V)=>{for(var re=0,ae="";!(re>=V/4);){var pe=K[q+re*4>>2];if(pe==0)break;if(++re,pe>=65536){var me=pe-65536;ae+=String.fromCharCode(55296|me>>10,56320|me&1023)}else ae+=String.fromCharCode(pe)}return ae},sl=(q,V,re)=>{var ae;if((ae=re)!==null&&ae!==void 0||(re=2147483647),re<4)return 0;for(var pe=V,me=pe+re-4,Se=0;Se=55296&&Ae<=57343){var Be=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Be&1023}if(K[V>>2]=Ae,V+=4,V+4>me)break}return K[V>>2]=0,V-pe},c1=q=>{for(var V=0,re=0;re=55296&&ae<=57343&&++re,V+=4}return V},Hy=(q,V,re)=>{re=Et(re);var ae,pe,me,Se;V===2?(ae=LE,pe=fo,Se=FE,me=Ae=>ce[Ae>>1]):V===4&&(ae=Hx,pe=sl,Se=c1,me=Ae=>P[Ae>>2]),Ct(q,{name:re,fromWireType:Ae=>{for(var Be=P[Ae>>2],Ye,Qe=Ae+4,pt=0;pt<=Be;++pt){var mr=Ae+4+pt*V;if(pt==Be||me(mr)==0){var Br=mr-Qe,un=ae(Qe,Br);Ye===void 0?Ye=un:(Ye+="\0",Ye+=un),Qe=mr+V}}return uo(Ae),Ye},toWireType:(Ae,Be)=>{typeof Be!="string"&&He(`Cannot pass non-string to C++ string type ${re}`);var Ye=Se(Be),Qe=Xy(4+Ye+V);return P[Qe>>2]=Ye/V,pe(Be,Qe+4,Ye+V),Ae!==null&&Ae.push(uo,Qe),Qe},argPackAdvance:ct,readValueFromPointer:rr,destructorFunction(Ae){uo(Ae)}})},dn=(q,V,re,ae,pe,me)=>{xt[q]={name:Et(V),rawConstructor:hs(re,ae),rawDestructor:hs(pe,me),fields:[]}},ol=(q,V,re,ae,pe,me,Se,Ae,Be,Ye)=>{xt[q].fields.push({fieldName:Et(V),getterReturnType:re,getter:hs(ae,pe),getterContext:me,setterArgumentType:Se,setter:hs(Ae,Be),setterContext:Ye})},Gy=(q,V)=>{V=Et(V),Ct(q,{isVoid:!0,name:V,argPackAdvance:0,fromWireType:()=>{},toWireType:(re,ae)=>{}})},jE=(q,V,re)=>$.copyWithin(q,V,V+re),zh=[],UE=(q,V,re,ae)=>(q=zh[q],V=zo.toValue(V),q(null,V,re,ae)),$E={},qE=q=>{var V=$E[q];return V===void 0?Et(q):V},Wy=()=>{if(typeof globalThis=="object")return globalThis;function q(V){V.$$$embind_global$$$=V;var re=typeof $$$embind_global$$$=="object"&&V.$$$embind_global$$$==V;return re||delete V.$$$embind_global$$$,re}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&q(global)?$$$embind_global$$$=global:typeof self=="object"&&q(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},l1=q=>q===0?zo.toHandle(Wy()):(q=qE(q),zo.toHandle(Wy()[q])),qu=q=>{var V=zh.length;return zh.push(q),V},VE=(q,V)=>{for(var re=new Array(q),ae=0;ae>2],"parameter "+ae);return re},Gx=Reflect.construct,Wx=(q,V,re)=>{var ae=[],pe=q.toWireType(ae,re);return ae.length&&(P[V>>2]=zo.toHandle(ae)),pe},Ky=(q,V,re)=>{var ae=VE(q,V),pe=ae.shift();q--;var me=new Array(q),Se=(Be,Ye,Qe,pt)=>{for(var mr=0,Br=0;BrBe.name).join(", ")}) => ${pe.name}>`;return qu(co(Ae,Se))},Yy=q=>{q>9&&(lo[q+1]+=1)},Kx=q=>{var V=zo.toValue(q);ar(V),$u(q)},zE=(q,V)=>{q=$e(q,"_emval_take_value");var re=q.readValueFromPointer(V);return zo.toHandle(re)},Qy=(q,V,re,ae)=>{var pe=new Date().getFullYear(),me=new Date(pe,0,1),Se=new Date(pe,6,1),Ae=me.getTimezoneOffset(),Be=Se.getTimezoneOffset(),Ye=Math.max(Ae,Be);P[q>>2]=Ye*60,K[V>>2]=+(Ae!=Be);var Qe=Br=>{var un=Br>=0?"-":"+",Zn=Math.abs(Br),In=String(Math.floor(Zn/60)).padStart(2,"0"),pn=String(Zn%60).padStart(2,"0");return`UTC${un}${In}${pn}`},pt=Qe(Ae),mr=Qe(Be);Be2147483648,HE=(q,V)=>Math.ceil(q/V)*V,Yx=q=>{var V=F.buffer,re=(q-V.byteLength+65535)/65536;try{return F.grow(re),m(),1}catch{}},Us=q=>{var V=$.length;q>>>=0;var re=Jy();if(q>re)return!1;for(var ae=1;ae<=4;ae*=2){var pe=V*(1+.2/ae);pe=Math.min(pe,q+100663296);var me=Math.min(re,HE(Math.max(q,pe),65536)),Se=Yx(me);if(Se)return!0}return!1},Hh={},Gh=()=>p||"./this.program",Vu=()=>{if(!Vu.strings){var q=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",V={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:q,_:Gh()};for(var re in Hh)Hh[re]===void 0?delete V[re]:V[re]=Hh[re];var ae=[];for(var re in V)ae.push(`${re}=${V[re]}`);Vu.strings=ae}return Vu.strings},Qx=(q,V)=>{for(var re=0;re{var re=0;return Vu().forEach((ae,pe)=>{var me=V+re;P[q+pe*4>>2]=me,Qx(ae,me),re+=ae.length+1}),0},WE=(q,V)=>{var re=Vu();P[q>>2]=re.length;var ae=0;return re.forEach(pe=>ae+=pe.length+1),P[V>>2]=ae,0},KE=q=>52;function YE(q,V,re,ae,pe){return 70}var QE=[null,[],[]],zu=(q,V)=>{var re=QE[q];V===0||V===10?((q===1?S:O)(Go(re,0)),re.length=0):re.push(V)},JE=(q,V,re,ae)=>{for(var pe=0,me=0;me>2],Ae=P[V+4>>2];V+=8;for(var Be=0;Be>2]=pe,0},ZE=q=>q;dt=i.InternalError=class extends Error{constructor(q){super(q),this.name="InternalError"}},zt(),Bt=i.BindingError=class extends Error{constructor(q){super(q),this.name="BindingError"}},qo(),Uo(),Nu(),$h=i.UnboundTypeError=s1(Error,"UnboundTypeError"),a1();var Zy={t:st,x:We,a:wt,j:rt,k:It,O:At,q:Tt,ga:Xt,d:vt,ca:lr,va:ut,ba:Vt,pa:Ht,ta:vc,sa:Vy,E:zy,oa:Kr,F:we,n:yt,W:ln,X:jn,y:en,u:Pn,ua:Un,V:uf,P:Hy,L:dn,wa:ol,qa:Gy,ja:jE,T:UE,xa:$u,ya:l1,U:Ky,Y:Yy,Z:Kx,ra:zE,da:Qy,ha:Us,ea:GE,fa:WE,ia:KE,$:YE,S:JE,J:h1,C:nC,Q:bt,R:s2,r:d1,b:Hu,D:n2,la:p1,c:Nr,ka:al,h:Pe,i:XE,s:po,N:tC,w:eC,I:i2,K:Hr,B:iC,H:o2,aa:a2,_:Wh,l:Jn,f:Jt,e:Oe,g:be,M:g1,m:tm,ma:rC,p:f1,v:Gu,na:u1,A:v1,o:tn,G:y1,z:ZE},hn=et(),gc=q=>(gc=hn.Ba)(q),uo=i._free=q=>(uo=i._free=hn.Ca)(q),Xy=i._malloc=q=>(Xy=i._malloc=hn.Ea)(q),Jx=q=>(Jx=hn.Fa)(q),yr=(q,V)=>(yr=hn.Ga)(q,V),df=q=>(df=hn.Ha)(q),ho=q=>(ho=hn.Ia)(q),em=()=>(em=hn.Ja)(),Zx=q=>(Zx=hn.Ka)(q),Xx=q=>(Xx=hn.La)(q),e2=(q,V,re)=>(e2=hn.Ma)(q,V,re);i.dynCall_viijii=(q,V,re,ae,pe,me,Se)=>(i.dynCall_viijii=hn.Na)(q,V,re,ae,pe,me,Se);var t2=i.dynCall_jiii=(q,V,re,ae)=>(t2=i.dynCall_jiii=hn.Oa)(q,V,re,ae);i.dynCall_jiji=(q,V,re,ae,pe)=>(i.dynCall_jiji=hn.Pa)(q,V,re,ae,pe);var r2=i.dynCall_jiiii=(q,V,re,ae,pe)=>(r2=i.dynCall_jiiii=hn.Qa)(q,V,re,ae,pe);i.dynCall_iiiiij=(q,V,re,ae,pe,me,Se)=>(i.dynCall_iiiiij=hn.Ra)(q,V,re,ae,pe,me,Se),i.dynCall_iiiiijj=(q,V,re,ae,pe,me,Se,Ae,Be)=>(i.dynCall_iiiiijj=hn.Sa)(q,V,re,ae,pe,me,Se,Ae,Be),i.dynCall_iiiiiijj=(q,V,re,ae,pe,me,Se,Ae,Be,Ye)=>(i.dynCall_iiiiiijj=hn.Ta)(q,V,re,ae,pe,me,Se,Ae,Be,Ye);function Hu(q,V){var re=Ne();try{return hr(q)(V)}catch(ae){if(ke(re),ae!==ae+0)throw ae;yr(1,0)}}function be(q,V,re,ae){var pe=Ne();try{hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function Oe(q,V,re){var ae=Ne();try{hr(q)(V,re)}catch(pe){if(ke(ae),pe!==pe+0)throw pe;yr(1,0)}}function Pe(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function bt(q,V,re,ae,pe){var me=Ne();try{return hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function Jt(q,V){var re=Ne();try{hr(q)(V)}catch(ae){if(ke(re),ae!==ae+0)throw ae;yr(1,0)}}function Nr(q,V,re){var ae=Ne();try{return hr(q)(V,re)}catch(pe){if(ke(ae),pe!==pe+0)throw pe;yr(1,0)}}function Jn(q){var V=Ne();try{hr(q)()}catch(re){if(ke(V),re!==re+0)throw re;yr(1,0)}}function tn(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe){var pt=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye,Qe)}catch(mr){if(ke(pt),mr!==mr+0)throw mr;yr(1,0)}}function tm(q,V,re,ae,pe){var me=Ne();try{hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function XE(q,V,re,ae,pe){var me=Ne();try{return hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function po(q,V,re,ae,pe,me){var Se=Ne();try{return hr(q)(V,re,ae,pe,me)}catch(Ae){if(ke(Se),Ae!==Ae+0)throw Ae;yr(1,0)}}function f1(q,V,re,ae,pe,me){var Se=Ne();try{hr(q)(V,re,ae,pe,me)}catch(Ae){if(ke(Se),Ae!==Ae+0)throw Ae;yr(1,0)}}function eC(q,V,re,ae,pe,me,Se){var Ae=Ne();try{return hr(q)(V,re,ae,pe,me,Se)}catch(Be){if(ke(Ae),Be!==Be+0)throw Be;yr(1,0)}}function Gu(q,V,re,ae,pe,me,Se,Ae){var Be=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae)}catch(Ye){if(ke(Be),Ye!==Ye+0)throw Ye;yr(1,0)}}function u1(q,V,re,ae,pe,me,Se,Ae,Be){var Ye=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be)}catch(Qe){if(ke(Ye),Qe!==Qe+0)throw Qe;yr(1,0)}}function d1(q){var V=Ne();try{return hr(q)()}catch(re){if(ke(V),re!==re+0)throw re;yr(1,0)}}function Hr(q,V,re,ae,pe,me,Se,Ae,Be){var Ye=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae,Be)}catch(Qe){if(ke(Ye),Qe!==Qe+0)throw Qe;yr(1,0)}}function tC(q,V,re,ae,pe,me,Se){var Ae=Ne();try{return hr(q)(V,re,ae,pe,me,Se)}catch(Be){if(ke(Ae),Be!==Be+0)throw Be;yr(1,0)}}function n2(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function h1(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function rC(q,V,re,ae,pe,me,Se,Ae){var Be=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae)}catch(Ye){if(ke(Be),Ye!==Ye+0)throw Ye;yr(1,0)}}function nC(q,V,re,ae,pe,me){var Se=Ne();try{return hr(q)(V,re,ae,pe,me)}catch(Ae){if(ke(Se),Ae!==Ae+0)throw Ae;yr(1,0)}}function iC(q,V,re,ae,pe,me,Se,Ae,Be,Ye){var Qe=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye)}catch(pt){if(ke(Qe),pt!==pt+0)throw pt;yr(1,0)}}function p1(q,V,re){var ae=Ne();try{return hr(q)(V,re)}catch(pe){if(ke(ae),pe!==pe+0)throw pe;yr(1,0)}}function al(q,V,re,ae,pe){var me=Ne();try{return hr(q)(V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}function v1(q,V,re,ae,pe,me,Se,Ae,Be,Ye){var Qe=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye)}catch(pt){if(ke(Qe),pt!==pt+0)throw pt;yr(1,0)}}function i2(q,V,re,ae,pe,me,Se,Ae){var Be=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae)}catch(Ye){if(ke(Be),Ye!==Ye+0)throw Ye;yr(1,0)}}function g1(q,V,re,ae,pe,me,Se){var Ae=Ne();try{hr(q)(V,re,ae,pe,me,Se)}catch(Be){if(ke(Ae),Be!==Be+0)throw Be;yr(1,0)}}function s2(q,V,re,ae){var pe=Ne();try{return hr(q)(V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function o2(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt){var mr=Ne();try{return hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt)}catch(Br){if(ke(mr),Br!==Br+0)throw Br;yr(1,0)}}function y1(q,V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt,mr,Br,un,Zn){var In=Ne();try{hr(q)(V,re,ae,pe,me,Se,Ae,Be,Ye,Qe,pt,mr,Br,un,Zn)}catch(pn){if(ke(In),pn!==pn+0)throw pn;yr(1,0)}}function a2(q,V,re,ae){var pe=Ne();try{return t2(q,V,re,ae)}catch(me){if(ke(pe),me!==me+0)throw me;yr(1,0)}}function Wh(q,V,re,ae,pe){var me=Ne();try{return r2(q,V,re,ae,pe)}catch(Se){if(ke(me),Se!==Se+0)throw Se;yr(1,0)}}var Sa;X=function q(){Sa||Kh(),Sa||(X=q)};function Kh(){if(j>0||(x(),j>0))return;function q(){var V;Sa||(Sa=!0,i.calledRun=!0,!z&&(w(),s(i),(V=i.onRuntimeInitialized)===null||V===void 0||V.call(i),T()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),q()},1)):q()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Kh(),n=a,n}})();function Eje(t){return QM(JM,t)}async function Cje(t,e){return wje(JM,t,e)}async function Aje(t,e){return xje(JM,t,e)}const ere=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],Sje=[...ere,["unknown"]].map(t=>t[0]),II=new Map(ere);function _je(t){for(const[e,r]of II)if(t===r)return e;return"unknown"}function Ije(t){if(tre(t))return{width:t.naturalWidth,height:t.naturalHeight};if(rre(t))return{width:t.width.baseVal.value,height:t.height.baseVal.value};if(nre(t))return{width:t.videoWidth,height:t.videoHeight};if(sre(t))return{width:t.width,height:t.height};if(are(t))return{width:t.displayWidth,height:t.displayHeight};if(ire(t))return{width:t.width,height:t.height};if(ore(t))return{width:t.width,height:t.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function tre(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLImageElement)}catch{return!1}}function rre(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.SVGImageElement)}catch{return!1}}function nre(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLVideoElement)}catch{return!1}}function ire(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLCanvasElement)}catch{return!1}}function sre(t){try{return t instanceof ImageBitmap||Object.prototype.toString.call(t)==="[object ImageBitmap]"}catch{return!1}}function ore(t){try{return t instanceof OffscreenCanvas||Object.prototype.toString.call(t)==="[object OffscreenCanvas]"}catch{return!1}}function are(t){try{return t instanceof VideoFrame||Object.prototype.toString.call(t)==="[object VideoFrame]"}catch{return!1}}function cre(t){try{return t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]"}catch{return!1}}function Tje(t){try{return t instanceof ImageData||Object.prototype.toString.call(t)==="[object ImageData]"}catch{return!1}}function Pje(t,e){try{const r=new OffscreenCanvas(t,e);if(r.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return r;throw void 0}catch{const r=document.createElement("canvas");return r.width=t,r.height=e,r}}async function lre(t){if(tre(t)&&!await Oje(t))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(rre(t)&&!await Dje(t))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(are(t)&&Nje(t))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(nre(t)&&(t.readyState===0||t.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(sre(t)&&Lje(t))throw new DOMException("The image source is detached.","InvalidStateError");const{width:e,height:r}=Ije(t);if(e===0||r===0)return null;const n=Pje(e,r).getContext("2d");n.drawImage(t,0,0);try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function kje(t){let e;try{if(globalThis.createImageBitmap)e=await createImageBitmap(t);else if(globalThis.Image){e=new Image;let r="";try{r=URL.createObjectURL(t),e.src=r,await e.decode()}finally{URL.revokeObjectURL(r)}}else return t}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await lre(e)}function Mje(t){const{width:e,height:r}=t;if(e===0||r===0)return null;const n=t.getContext("2d");try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function Rje(t){if(cre(t))return await kje(t);if(Tje(t)){if(Bje(t))throw new DOMException("The image data has been detached.","InvalidStateError");return t}return ire(t)||ore(t)?Mje(t):await lre(t)}async function Oje(t){try{return await t.decode(),!0}catch{return!1}}async function Dje(t){var e;try{return await((e=t.decode)==null?void 0:e.call(t)),!0}catch{return!1}}function Nje(t){return t.format===null}function Bje(t){return t.data.buffer.byteLength===0}function Lje(t){return t.width===0&&t.height===0}function F$(t,e){return Fje(t)?new DOMException(`${e}: ${t.message}`,t.name):jje(t)?new t.constructor(`${e}: ${t.message}`):new Error(`${e}: ${t}`)}function Fje(t){return t instanceof DOMException||Object.prototype.toString.call(t)==="[object DOMException]"}function jje(t){return t instanceof Error||Object.prototype.toString.call(t)==="[object Error]"}var U3;class TI extends EventTarget{constructor(e={}){var r;super(),lje(this,U3);try{const n=(r=e==null?void 0:e.formats)==null?void 0:r.filter(i=>i!=="unknown");if((n==null?void 0:n.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const i of n??[])if(!II.has(i))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${i}' is not a valid enum value of type BarcodeFormat.`);fje(this,U3,n??[]),Eje().then(i=>{this.dispatchEvent(new CustomEvent("load",{detail:i}))}).catch(i=>{this.dispatchEvent(new CustomEvent("error",{detail:i}))})}catch(n){throw F$(n,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return Sje.filter(e=>e!=="unknown")}async detect(e){try{const r=await Rje(e);if(r===null)return[];let n;const i={tryHarder:!0,returnCodabarStartEnd:!0,formats:cje(this,U3).map(s=>II.get(s))};try{cre(r)?n=await Cje(r,i):n=await Aje(r,i)}catch(s){throw console.error(s),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map(s=>{const{topLeft:{x:o,y:a},topRight:{x:c,y:l},bottomLeft:{x:f,y:u},bottomRight:{x:p,y:g}}=s.position,y=Math.min(o,c,f,p),b=Math.min(a,l,u,g),I=Math.max(o,c,f,p),C=Math.max(a,l,u,g);return{boundingBox:new DOMRectReadOnly(y,b,I-y,C-b),rawValue:s.text,format:_je(s.format),cornerPoints:[{x:o,y:a},{x:c,y:l},{x:p,y:g},{x:f,y:u}]}})}catch(r){throw F$(r,"Failed to execute 'detect' on 'BarcodeDetector'")}}}U3=new WeakMap;globalThis.BarcodeDetector!=null||(globalThis.BarcodeDetector=TI);function Uje(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007"}))}function $je(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z"}),qt.createElement("path",{d:"M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z"}))}function qje(t){const{scanning:e,startScanning:r,stopScanning:n}=t,[i,s]=D.useState(!1);function o(){s(!0),e?n():r(),setTimeout(()=>s(!1),1e3)}return qt.createElement("div",{style:{bottom:85,right:3,position:"absolute",zIndex:2,cursor:i?"default":"pointer"}},e?qt.createElement(Uje,{disabled:i,onClick:o}):qt.createElement($je,{disabled:i,onClick:o}))}function Vje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z"}))}function zje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z"}))}function Hje(t){const{status:e,scanning:r,torchToggle:n}=t;function i(s){n(s)}return r&&n?qt.createElement("div",{style:{bottom:35,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},e?qt.createElement(zje,{onClick:()=>i(!1)}):qt.createElement(Vje,{onClick:()=>i(!0)})):null}function Gje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z"}))}function Wje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z"}))}function Kje(t){const{scanning:e,capabilities:r,onZoom:n,value:i}=t;if(!e||!n)return null;const s=(r.max-r.min)/3;return qt.createElement(D.Fragment,null,qt.createElement("div",{style:{bottom:130,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Wje,{disabled:i<=r.min,onClick:function(){n(Math.max(i-s,r.min))}})),qt.createElement("div",{style:{bottom:180,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Gje,{disabled:i>=r.max,onClick:function(){n(Math.min(i+s,r.max))}})))}function Yje(t){const{scanning:e,loading:r,capabilities:n,border:i=35,onOff:s,torch:o,zoom:a,startScanning:c,stopScanning:l}=t,f="rgba(255, 0, 0, 0.5)";return qt.createElement("div",{style:{position:"relative"}},qt.createElement("svg",{viewBox:"0 0 100 100",style:{top:0,left:0,zIndex:1,boxSizing:"border-box",border:`${i>=35?i:35}px solid rgba(0, 0, 0, 0.2)`}},r&&qt.createElement("text",{x:"50",y:"50",textAnchor:"middle",fill:"black",fontSize:"8",fontFamily:"Arial",fontWeight:"bold"},"Loading ...",qt.createElement("animate",{attributeName:"opacity",values:"0;1;0",dur:"2s",repeatCount:"indefinite"})),qt.createElement("path",{fill:"none",d:"M23,0 L0,0 L0,23",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M0,77 L0,100 L23,100",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M77,100 L100,100 L100,77",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M100,23 L100,0 77,0",stroke:f,strokeWidth:3})),s&&qt.createElement(qje,{scanning:e,startScanning:c,stopScanning:l}),o&&n.torch&&qt.createElement(Hje,{scanning:e,status:o.status,torchToggle:o.toggle}),a&&n.zoom&&qt.createElement(Kje,{scanning:e,capabilities:n.zoom,value:a.value,onZoom:a.onChange}))}const Qje={facingMode:"environment",width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},Jje={audio:!0,tracker:void 0,onOff:!1,finder:!0,torch:!0,zoom:!1},Zje={width:"100%",height:"100%",position:"relative"},Xje={top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden"};var eUe=function(t){let e,r=!1;return(...n)=>(r||(e=t(n),r=!0),e)}(()=>{const t=OFe(window);switch(t.browser){case"chrome":zFe(window,t);break;case"firefox":KFe(window,t);break;case"safari":ZFe(window,t);break;default:throw new Error("Unsupported browser")}});const tUe="data:audio/mp3;base64,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";var fb=t=>t instanceof Date,fre=t=>t==null;const ure=t=>typeof t=="object";var j$=t=>!fre(t)&&!Array.isArray(t)&&ure(t)&&!fb(t),U$=t=>fre(t)||!ure(t);function dre(t,e){if(U$(t)||U$(e))return t===e;if(fb(t)&&fb(e))return t.getTime()===e.getTime();const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(const i of r){const s=t[i];if(!n.includes(i))return!1;if(i!=="ref"){const o=e[i];if(fb(s)&&fb(o)||j$(s)&&j$(o)||Array.isArray(s)&&Array.isArray(o)?!dre(s,o):s!==o)return!1}}return!0}function F6(t){if(t===null)throw new Error("Canvas should always be defined when component is mounted.");const e=t.getContext("2d");if(e===null)throw new Error("Canvas 2D context should be non-null");e.clearRect(0,0,t.width,t.height)}function rUe(t){var e;const{onScan:r,constraints:n,formats:i=["qr_code"],paused:s=!1,components:o,children:a,styles:c,classNames:l,allowMultiple:f,scanDelay:u,onError:p}=t,g=D.useRef(null),y=D.useRef(null),b=D.useRef(null),I=D.useMemo(()=>({...Qje,...n}),[n]),C=D.useMemo(()=>({...Jje,...o}),[o]),[S,O]=D.useState(!1),[L,F]=D.useState(!0),[z,_]=D.useState(I),$=function(){const v=D.useRef(Promise.resolve({type:"stop",data:{}})),m=D.useRef(null),R=D.useRef(null),[B,E]=D.useState({}),[x,w]=D.useState({}),T=D.useCallback(async(X,G)=>{var Z,ee,N;if(!window.isSecureContext)throw new Error("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.");if(((Z=navigator==null?void 0:navigator.mediaDevices)===null||Z===void 0?void 0:Z.getUserMedia)===void 0)throw new Error("this browser has no Stream API support");eUe();const te=await navigator.mediaDevices.getUserMedia({audio:!1,video:G});X.srcObject!==void 0?X.srcObject=te:X.mozSrcObject!==void 0?X.mozSrcObject=te:window.URL.createObjectURL?X.src=window.URL.createObjectURL(te):window.webkitURL?X.src=window.webkitURL.createObjectURL(te):X.src=te.id,await Promise.race([X.play(),new Promise(Ee=>setTimeout(Ee,3e3)).then(()=>{throw new Error("Loading camera stream timed out after 3 seconds.")})]),await new Promise(Ee=>setTimeout(Ee,500));const[fe]=te.getVideoTracks();return w(fe.getSettings()),E((N=(ee=fe==null?void 0:fe.getCapabilities)===null||ee===void 0?void 0:ee.call(fe))!==null&&N!==void 0?N:{}),m.current=te,R.current=fe,{type:"start",data:{videoEl:X,stream:te,constraints:G}}},[]),k=D.useCallback(async(X,G)=>{X.src="",X.srcObject=null,X.load();for(const Z of G.getTracks())G.removeTrack(Z),Z.stop();return m.current=null,R.current=null,w({}),{type:"stop",data:{}}},[]),H=D.useCallback(async(X,{constraints:G,restart:Z=!1})=>{if(v.current=v.current.then(ee=>{if(ee.type==="start"){const{data:{videoEl:N,stream:te,constraints:fe}}=ee;return Z||X!==N||G!==fe?k(N,te).then(()=>T(X,G)):ee}return T(X,G)}),(await v.current).type==="stop")throw new Error("Something went wrong with the camera task queue (start task).")},[T,k]),oe=D.useCallback(async()=>{if(v.current=v.current.then(X=>{if(X.type==="stop")return X;const{data:{videoEl:G,stream:Z}}=X;return k(G,Z)}),(await v.current).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")},[k]),j=D.useCallback(async X=>{const G=R.current;if(!G)throw new Error("No active video track found.");{X.advanced&&X.advanced[0].zoom&&G.getCapabilities().torch&&await G.applyConstraints({advanced:[{torch:!1}]}),await G.applyConstraints(X);const Z=G.getCapabilities(),ee=G.getSettings();E(Z),w(ee)}},[]);return D.useEffect(()=>()=>{(async()=>await oe())()},[oe]),{capabilities:B,settings:x,startCamera:H,stopCamera:oe,updateConstraints:j}}(),{startScanning:ie,stopScanning:ce}=function(v){const{videoElementRef:m,onScan:R,onFound:B,retryDelay:E=100,scanDelay:x=0,formats:w=[],audio:T=!0,allowMultiple:k=!1}=v,H=D.useRef(new TI({formats:w})),oe=D.useRef(null),j=D.useRef(null);D.useEffect(()=>{H.current=new TI({formats:w})},[w]),D.useEffect(()=>{typeof window<"u"&&T&&(oe.current=new Audio(tUe))},[T]);const X=D.useCallback(G=>async Z=>{if(m.current!==null&&m.current.readyState>1){const{lastScan:ee,contentBefore:N,lastScanHadContent:te}=G;if(Z-ee!N.includes(De.rawValue)),_e=fe.length>0;let Re=G.lastOnScan;(Ee||k&&_e&&Z-Re>=x)&&(T&&oe.current&&oe.current.paused&&oe.current.play().catch(De=>console.error("Error playing the sound",De)),Re=Z,R(fe)),_e&&B(fe),!_e&&te&&B(fe);const Te={lastScan:Z,lastOnScan:Re,lastScanHadContent:_e,contentBefore:Ee?fe.map(De=>De.rawValue):N};j.current=window.requestAnimationFrame(X(Te))}}},[m.current,R,B,E]);return{startScanning:D.useCallback(()=>{const G=performance.now(),Z={lastScan:G,lastOnScan:G,contentBefore:[],lastScanHadContent:!1};j.current=window.requestAnimationFrame(X(Z))},[X]),stopScanning:D.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null)},[])}}({videoElementRef:g,onScan:r,onFound:v=>function(m,R,B,E){const x=B;if(x==null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas is always defined.");const w=R;if(w==null)throw new Error("onFound handler should only be called when component is mounted. Thus video element is always defined.");if(m.length===0||E===void 0)F6(x);else{const T=w.offsetWidth,k=w.offsetHeight,H=w.videoWidth,oe=w.videoHeight,j=Math.max(T/H,k/oe),X=H*j,G=oe*j,Z=X/H,ee=G/oe,N=(T-X)/2,te=(k-G)/2,fe=({x:Te,y:De})=>({x:Math.floor(Te*Z),y:Math.floor(De*ee)}),Ee=({x:Te,y:De})=>({x:Math.floor(Te+N),y:Math.floor(De+te)}),_e=m.map(Te=>{const{boundingBox:De,cornerPoints:ze}=Te,{x:et,y:Je}=Ee(fe({x:De.x,y:De.y})),{x:ke,y:Ne}=fe({x:De.width,y:De.height});return{...Te,cornerPoints:ze.map(tt=>Ee(fe(tt))),boundingBox:DOMRectReadOnly.fromRect({x:et,y:Je,width:ke,height:Ne})}});x.width=w.offsetWidth,x.height=w.offsetHeight;const Re=x.getContext("2d");if(Re===null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas 2D context is always defined.");E(_e,Re)}}(v,g.current,b.current,C.tracker),formats:i,audio:C.audio,allowMultiple:f,retryDelay:C.tracker===void 0?500:10,scanDelay:u});D.useEffect(()=>(O(!0),()=>{O(!1)}),[]),D.useEffect(()=>{S&&(ce(),ie())},[o==null?void 0:o.tracker]),D.useEffect(()=>{if(!dre(I,z)){const v=I;n!=null&&n.deviceId&&delete v.facingMode,_(v)}},[n]);const K=D.useMemo(()=>({constraints:z,shouldStream:S&&!s}),[z,S,s]),P=async()=>{const v=g.current;if(v==null)throw new Error("Video should be defined when component is mounted.");const m=y.current;if(m==null)throw new Error("Canvas should be defined when component is mounted.");const R=m.getContext("2d");if(R==null)throw new Error("Canvas should be defined when component is mounted.");if(K.shouldStream){await $.stopCamera(),F(!1);try{await $.startCamera(v,K),v?F(!0):await $.stopCamera()}catch(B){p==null||p(B),console.error("error",B)}}else m.width=v.videoWidth,m.height=v.videoHeight,R.drawImage(v,0,0,v.videoWidth,v.videoHeight),await $.stopCamera(),F(!1)};D.useEffect(()=>{(async()=>await P())()},[K]);const M=D.useMemo(()=>K.shouldStream&&L,[K.shouldStream,L]);return D.useEffect(()=>{if(M){if(y.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus pause frame canvas is defined");if(F6(y.current),b.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus tracking canvas is defined");if(F6(b.current),g.current==null)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus video element is defined");ie()}},[M]),qt.createElement("div",{style:{...Zje,...c==null?void 0:c.container},className:l==null?void 0:l.container},qt.createElement("video",{ref:g,style:{...Xje,...c==null?void 0:c.video,visibility:s?"hidden":"visible"},className:l==null?void 0:l.video,autoPlay:!0,muted:!0,playsInline:!0}),qt.createElement("canvas",{ref:y,style:{display:s?"block":"none",position:"absolute",top:0,left:0,width:"100%"}}),qt.createElement("canvas",{ref:b,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}}),qt.createElement("div",{style:{top:0,left:0,position:"absolute",width:"100%",height:"100%"}},C.finder&&qt.createElement(Yje,{scanning:L,capabilities:$.capabilities,loading:!1,onOff:C.onOff,zoom:C.zoom&&$.settings.zoom?{value:$.settings.zoom,onChange:async v=>{const m={...z,advanced:[{zoom:v}]};await $.updateConstraints(m)}}:void 0,torch:C.torch?{status:(e=$.settings.torch)!==null&&e!==void 0&&e,toggle:async v=>{const m={...z,advanced:[{torch:v}]};await $.updateConstraints(m)}}:void 0,startScanning:async()=>await P(),stopScanning:async()=>{await $.stopCamera(),F6(b.current),F(!1)},border:c==null?void 0:c.finderBorder}),a))}function nUe({onQrUri:t}){const e=Ir(NE),[r,n]=D.useState(""),i=async()=>{if(r){console.log(r);try{await e.pair(r)}catch(s){console.error(s),t(!1)}}t(!0)};return W.jsxs(xe,{flexDirection:"column",justifyContent:"space-between",padding:"12",gap:"3",children:[W.jsx(rUe,{onScan:s=>{s[0].rawValue&&n(s[0].rawValue)},styles:{video:{transform:"scaleX(-1)",borderRadius:"10px"}}}),W.jsxs(xe,{children:[W.jsx(Wn,{label:"Paste Connection String",labelLocation:"top",name:"signClientUri",value:r??"",onChange:s=>{n(s.target.value)}}),W.jsx(xe,{justifyContent:"flex-end",children:W.jsx(Zt,{marginTop:"4",variant:"primary",size:"md",shape:"square",label:"Connect Dapp",disabled:!r,onClick:()=>{r&&i()}})})]})]})}const hre=t=>({info:{walletId:"",uuid:"",name:"WalletConnect",icon:"https://avatars.githubusercontent.com/u/37784886"},provider:t});function iUe(){var _e,Re;const t=jte(),e=Ir(li),r=Ir(Tx),n=Ir(Zr),i=Ir(NE),s=yn(e.accountAddress),o=yn(n.isSigningTxn),a=yn(n.isSigningMsg),c=yn(i.allSessions),l=h8(),f=KP("isMobile"),u=uFe();D.useEffect(()=>{if(u&&u.connected&&!n.selectedExternalProvider.get()){let Te=hre(u),De=n.availableExternalProviders.get();De?n.availableExternalProviders.set([Te,...De]):n.availableExternalProviders.set([Te])}},[u]),D.useEffect(()=>{t.length>0&&n.availableExternalProviders.set(t)},[t]);const p=yn(n.selectedExternalProvider),g=yn(n.selectedExternalWalletAddress),y=yn(n.isSendingTokenTransaction),b=yn(n.isSendingCollectibleTransaction),I=yn(n.isSendingSignedTokenTransaction),C=Ir(Nn),[S,O]=D.useState(!0),[L,F]=D.useState(void 0),[z,_]=D.useState(void 0),[$,ie]=D.useState(!1),[ce,K]=D.useState(!1),[P,M]=D.useState(!1),[v,m]=D.useState(!1),[R,B]=D.useState(!1),[E,x]=D.useState(!1),[w,T]=D.useState(!1),k=yn(n.signClientWarningType),H=Te=>{_(void 0),n.isSendingCollectibleTransaction.set(void 0),F(Te),B(!0)},oe=Te=>{F(void 0),n.isSendingTokenTransaction.set(void 0),_(Te),x(!0)},j=async(Te=!1)=>{(p===void 0||Te)&&M(!0)},X=async()=>{n.setExternalProvider(void 0);const Te=p;(Te==null?void 0:Te.info.name)==="WalletConnect"&&Te.provider.disconnect()},G=async(Te,De)=>{if(!n.selectedExternalProvider.get()){console.warn("No external provider selected");return}var ze;let et;try{if(L)ze=L.chainId,et=await n.sendToken(L,Te,De);else if(z)ze=z.collectibleInfoParams.chainId,et=await n.sendCollectible(z,Te,De);else{console.warn("No pending send found");return}}catch(Ne){Ne.code===4001&&l({variant:"error",title:"User denied transaction signature."}),console.error(Ne);return}const Je=C.providerForChainId(ze),ke=await k$(Je,et.hash);ke&&l({variant:"success",title:"Transaction confirmed",description:"You can view the transaction details on your connected external wallet"}),L&&r.updateTokenBalance(L),F(void 0),_(void 0),n.isSendingTokenTransaction.set(void 0),n.isSendingCollectibleTransaction.set(void 0),console.log("receipt",ke)},Z=async(Te,De)=>{const ze=C.providerForChainId(De);await k$(ze,Te)&&(n.isSendingSignedTokenTransaction.set(void 0),l({variant:"success",title:"Sign transaction confirmed",description:"You can view the transaction details on your connected external wallet"}))},ee=()=>{i.rejectRequest(),n.toSignPermission.set("cancelled")};async function N(Te){var ke;const De=async(Ne,tt,Ze)=>{try{const st=await n.getExternalProviderAddress(ze);if(!st)throw new Error("No provider address found");return console.log("sendTransaction chainId",tt),await n.sendTransaction(et,ze,st,Ne,tt)}catch(st){throw n.isSendingSignedTokenTransaction.set(void 0),st}},ze=(ke=n.selectedExternalProvider.get())==null?void 0:ke.provider,et=e.account;let Je;if(Te)try{n.isSendingSignedTokenTransaction.set(Te),Je=await De(Te.txn,Te.chainId,Te.options),Z(Je.hash,Te.chainId),n.toSignResult.set(Je),n.toSignPermission.set("approved")}catch(Ne){throw n.isSendingSignedTokenTransaction.set(void 0),ee(),Ne}}async function te(Te){const De=async(Je,ke)=>{try{let Ne;if(Je.message)console.log("signMessage chainId",Je.chainId),Ne=await ze.signMessage(Je.message,Je.chainId,Je.eip6492?"eip6492":"throw");else if(Je.typedData){const tt=Je.typedData;Ne=await ze.signTypedData(tt.domain,tt.types,tt.message,Je.chainId,Je.eip6492?"eip6492":"throw")}if(!Ne)throw new Error("Account sign method failed");return{hash:Ne}}catch(Ne){throw Ne}},ze=e.account;let et;if(Te)try{et=await De(Te.message),n.toSignResult.set(et),n.toSignPermission.set("approved")}catch(Je){throw n.isSendingSignedTokenTransaction.set(void 0),ee(),Je}}const fe=async()=>{var Te;((Te=n.selectedExternalProvider.get())==null?void 0:Te.info.name)==="WalletConnect"?n.signClientWarningType.set("isWalletConnect"):T(!0)},Ee=async()=>{m(!0)};return W.jsxs(W.Fragment,{children:[W.jsxs(xe,{flexDirection:"column",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",justifyContent:"center",children:[W.jsxs(xe,{flexDirection:"row",width:"full",background:"backgroundMuted",paddingX:"8",paddingY:"4",alignItems:"center",children:[W.jsx("img",{src:vM,alt:"Sequence Logo",width:"40"}),W.jsxs(xe,{marginLeft:"auto",children:[W.jsx(Zt,{label:"Networks",variant:"text",marginRight:"8",onClick:()=>ie(!0)}),W.jsx(EFe,{onTokenListClick:()=>K(!0)})]})]}),W.jsxs(xe,{width:"full",paddingX:"8",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsxs($r,{flexDirection:"column",alignItems:"center",padding:"6",marginTop:"10",children:[W.jsx(Ge,{variant:"large",color:"text80",marginBottom:"4",children:"Your recovered wallet address"}),W.jsx(Ge,{variant:"normal",fontWeight:"bold",color:"text100",children:s}),W.jsx(PFe,{sessionList:c}),W.jsx(Zt,{marginTop:"4",variant:"primary",size:"sm",shape:"square",label:"Connect to a Dapp with WalletConnect",leftIcon:Kpe,onClick:()=>{fe()}})]}),W.jsxs($r,{alignItems:"center",flexDirection:"column",padding:"6",marginTop:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",marginBottom:"4",children:p?"Your external wallet that will be used to relay transactions":"Connect an external wallet to relay transactions"}),p&&W.jsx(xe,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsxs(xe,{flexDirection:"column",alignItems:"center",gap:"2",children:[W.jsxs(xe,{flexDirection:"row",gap:"2",children:[W.jsx("img",{src:p.info.icon,alt:p.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Ge,{variant:"normal",color:"text100",children:p.info.name})]}),g&&W.jsxs(Ge,{variant:"normal",color:"text100",children:["(",g,")"]}),W.jsxs(xe,{flexDirection:"row",children:[W.jsx(Zt,{size:"xs",label:"Change external wallet",variant:"text",shape:"square",marginRight:"10",onClick:()=>j(!0)}),W.jsx(Zt,{size:"xs",label:"Disconnect",variant:"text",shape:"square",onClick:()=>X()})]})]})}),!p&&W.jsx(Zt,{label:"Connect",variant:"primary",size:"md",shape:"square",onClick:j})]}),y&&W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(lS,{symbol:((Re=(_e=y.tokenBalance)==null?void 0:_e.contractInfo)==null?void 0:Re.symbol)??"",chainId:y.tokenBalance.chainId,to:y.to,amount:y.amount})}),b&&W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(lS,{symbol:b.collectibleInfo.collectibleInfoResponse.name??"",chainId:b.collectibleInfo.collectibleInfoParams.chainId,to:b.to,amount:b.amount})}),I&&W.jsx(xe,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(lS,{symbol:"tokens",chainId:I.chainId,to:I.txn[0].to,amount:String(Number(I.txn[0].value))})}),W.jsxs(xe,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsxs(xe,{width:"full",flexDirection:"row",alignItems:"center",marginBottom:"4",children:[W.jsx(Ge,{variant:"large",color:"text80",children:"Coins"}),W.jsx(xe,{marginLeft:"auto",children:W.jsx(swe,{label:"Filter zero balances",checked:S,onCheckedChange:O})})]}),W.jsx(IFe,{filterZeroBalances:S,onSendClick:H})]}),W.jsxs(xe,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsx(Ge,{variant:"large",color:"text80",marginBottom:"4",children:"Collectibles"}),W.jsx(gFe,{onSendClick:oe})]})]})]}),$&&W.jsx(Tc,{onClose:()=>ie(!1),children:W.jsx(mFe,{})}),ce&&W.jsx(Tc,{onClose:()=>K(!1),children:W.jsx(CFe,{})}),P&&W.jsx(Tc,{size:"md",onClose:()=>M(!1),children:W.jsx(bFe,{onSelectProvider:async Te=>{var De,ze;Te&&(((De=n.selectedExternalProvider.get())==null?void 0:De.info.name)==="WalletConnect"&&await((ze=n.selectedExternalProvider.get())==null?void 0:ze.provider).disconnect(),n.setExternalProvider(Te)),M(!1)}})}),v&&W.jsx(Tc,{size:"md",onClose:()=>m(!1),children:W.jsx(TFe,{onClose:()=>m(!1)})}),w&&W.jsx(Tc,{size:"md",contentProps:{style:{width:f?"100%":"600px",height:f?"":"750px"}},onClose:()=>T(!1),children:W.jsx(nUe,{onQrUri:Te=>{Te&&Ee(),T(!1)}})}),o&&W.jsx(Tc,{isDismissible:!1,size:"md",contentProps:{style:{width:f?"100%":"800px",maxHeight:"100%",overflowY:"auto"}},children:W.jsx(MFe,{onClose:Te=>{var De;n.isSigningTxn.set(!1),Te?n.selectedExternalProvider.get()===void 0?(ee(),n.signClientWarningType.set("noProvider")):((De=n.selectedExternalProvider.get())==null?void 0:De.info.name)==="WalletConnect"?(ee(),n.signClientWarningType.set("isWalletConnect")):N(Te):ee()}})}),a&&W.jsx(Tc,{isDismissible:!1,size:"md",contentProps:{style:{width:f?"100%":"800px",maxHeight:"90%",overflowY:"auto"}},children:W.jsx(kFe,{onClose:Te=>{var De;n.isSigningMsg.set(!1),Te?n.selectedExternalProvider.get()===void 0?(ee(),n.signClientWarningType.set("noProvider")):((De=n.selectedExternalProvider.get())==null?void 0:De.info.name)==="WalletConnect"?(ee(),n.signClientWarningType.set("isWalletConnect")):te(Te):ee()}})}),k&&W.jsx(Tc,{size:"md",onClose:()=>n.signClientWarningType.set(!1),children:W.jsx(RFe,{warningType:k})}),R&&W.jsx(Tc,{size:"md",onClose:()=>B(!1),children:W.jsx(xFe,{tokenBalance:L,onClose:(Te,De)=>{B(!1),Te&&De&&G(Te,De)}})}),E&&W.jsx(Tc,{size:"md",onClose:()=>x(!1),children:W.jsx(wFe,{collectibleInfo:z,onClose:(Te,De)=>{x(!1),(Te&&(z==null?void 0:z.collectibleInfoParams.contractType)==="ERC721"||Te&&De)&&G(Te,De)}})})]})}const sUe=()=>{const t=Ir(li),e=yn(t.accountAddress);return W.jsx(M2e,{basename:"/wallet-recovery-app",children:W.jsxs(A2e,{children:[W.jsx(i3,{path:"/",element:e?W.jsx(JA,{replace:!0,to:"/wallet"}):W.jsx(_9e,{})}),W.jsx(i3,{path:"recovery",element:e?W.jsx(JA,{replace:!0,to:"/wallet"}):W.jsx(P9e,{})}),W.jsx(i3,{path:"wallet",element:e?W.jsx(iUe,{}):W.jsx(JA,{replace:!0,to:"/"})})]})})},oUe=Nxe();L7.createRoot(document.getElementById("root")).render(W.jsx(qt.StrictMode,{children:W.jsx(Bxe,{store:oUe,children:W.jsx(Rme,{theme:"dark",children:W.jsx(Vwe,{children:W.jsx(sUe,{})})})})}));export{R9e as _}; diff --git a/assets/index-BqUc7-Na.js b/assets/index-Mx8kZtbv.js similarity index 98% rename from assets/index-BqUc7-Na.js rename to assets/index-Mx8kZtbv.js index f4fce2e..f25acb0 100644 --- a/assets/index-BqUc7-Na.js +++ b/assets/index-Mx8kZtbv.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DZHWH4bK.js","assets/index-Bq8MMoYt.js","assets/index-AnxZPkAf.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-Bq8MMoYt.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/wallet-recovery-app/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-DZHWH4bK.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BHJ6sBpm.js","assets/index-BTMLuAci.js","assets/index-AnxZPkAf.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-BTMLuAci.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/wallet-recovery-app/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-BHJ6sBpm.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; diff --git a/index.html b/index.html index 7ccffc3..bf58ee3 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Sequence Wallet Recovery - +