diff --git a/main/packages/examples/react-demo/build/assets/index-DyTdSpy0.js b/main/packages/examples/react-demo/build/assets/index-DyTdSpy0.js new file mode 100644 index 000000000..b956f761e --- /dev/null +++ b/main/packages/examples/react-demo/build/assets/index-DyTdSpy0.js @@ -0,0 +1,248 @@ +(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const D of document.querySelectorAll('link[rel="modulepreload"]'))R(D);new MutationObserver(D=>{for(const U of D)if(U.type==="childList")for(const ie of U.addedNodes)ie.tagName==="LINK"&&ie.rel==="modulepreload"&&R(ie)}).observe(document,{childList:!0,subtree:!0});function b(D){const U={};return D.integrity&&(U.integrity=D.integrity),D.referrerPolicy&&(U.referrerPolicy=D.referrerPolicy),D.crossOrigin==="use-credentials"?U.credentials="include":D.crossOrigin==="anonymous"?U.credentials="omit":U.credentials="same-origin",U}function R(D){if(D.ep)return;D.ep=!0;const U=b(D);fetch(D.href,U)}})();function $te(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var oK={exports:{}},tE={},aK={exports:{}},Cr={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var C8=Symbol.for("react.element"),qte=Symbol.for("react.portal"),Wte=Symbol.for("react.fragment"),Vte=Symbol.for("react.strict_mode"),Yte=Symbol.for("react.profiler"),Gte=Symbol.for("react.provider"),Zte=Symbol.for("react.context"),Qte=Symbol.for("react.forward_ref"),Xte=Symbol.for("react.suspense"),Jte=Symbol.for("react.memo"),ene=Symbol.for("react.lazy"),Yj=Symbol.iterator;function tne(o){return o===null||typeof o!="object"?null:(o=Yj&&o[Yj]||o["@@iterator"],typeof o=="function"?o:null)}var sK={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},uK=Object.assign,lK={};function zv(o,l,b){this.props=o,this.context=l,this.refs=lK,this.updater=b||sK}zv.prototype.isReactComponent={};zv.prototype.setState=function(o,l){if(typeof o!="object"&&typeof o!="function"&&o!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,o,l,"setState")};zv.prototype.forceUpdate=function(o){this.updater.enqueueForceUpdate(this,o,"forceUpdate")};function cK(){}cK.prototype=zv.prototype;function LA(o,l,b){this.props=o,this.context=l,this.refs=lK,this.updater=b||sK}var OA=LA.prototype=new cK;OA.constructor=LA;uK(OA,zv.prototype);OA.isPureReactComponent=!0;var Gj=Array.isArray,fK=Object.prototype.hasOwnProperty,NA={current:null},dK={key:!0,ref:!0,__self:!0,__source:!0};function hK(o,l,b){var R,D={},U=null,ie=null;if(l!=null)for(R in l.ref!==void 0&&(ie=l.ref),l.key!==void 0&&(U=""+l.key),l)fK.call(l,R)&&!dK.hasOwnProperty(R)&&(D[R]=l[R]);var ae=arguments.length-2;if(ae===1)D.children=b;else if(1>>1,_r=hn[fr];if(0>>1;frD(Lu,ur))Xa<_r&&0>D(Ou,Lu)?(hn[fr]=Ou,hn[Xa]=ur,fr=Xa):(hn[fr]=Lu,hn[no]=ur,fr=no);else if(Xa<_r&&0>D(Ou,ur))hn[fr]=Ou,hn[Xa]=ur,fr=Xa;else break e}}return Zn}function D(hn,Zn){var ur=hn.sortIndex-Zn.sortIndex;return ur!==0?ur:hn.id-Zn.id}if(typeof performance=="object"&&typeof performance.now=="function"){var U=performance;o.unstable_now=function(){return U.now()}}else{var ie=Date,ae=ie.now();o.unstable_now=function(){return ie.now()-ae}}var ke=[],He=[],tt=1,nt=null,lt=3,jt=!1,Zt=!1,nn=!1,Lr=typeof setTimeout=="function"?setTimeout:null,Ye=typeof clearTimeout=="function"?clearTimeout:null,Ke=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function et(hn){for(var Zn=b(He);Zn!==null;){if(Zn.callback===null)R(He);else if(Zn.startTime<=hn)R(He),Zn.sortIndex=Zn.expirationTime,l(ke,Zn);else break;Zn=b(He)}}function It(hn){if(nn=!1,et(hn),!Zt)if(b(ke)!==null)Zt=!0,Hc(je);else{var Zn=b(He);Zn!==null&&go(It,Zn.startTime-hn)}}function je(hn,Zn){Zt=!1,nn&&(nn=!1,Ye(vn),vn=-1),jt=!0;var ur=lt;try{for(et(Zn),nt=b(ke);nt!==null&&(!(nt.expirationTime>Zn)||hn&&!Ei());){var fr=nt.callback;if(typeof fr=="function"){nt.callback=null,lt=nt.priorityLevel;var _r=fr(nt.expirationTime<=Zn);Zn=o.unstable_now(),typeof _r=="function"?nt.callback=_r:nt===b(ke)&&R(ke),et(Zn)}else R(ke);nt=b(ke)}if(nt!==null)var Iu=!0;else{var no=b(He);no!==null&&go(It,no.startTime-Zn),Iu=!1}return Iu}finally{nt=null,lt=ur,jt=!1}}var dn=!1,$t=null,vn=-1,rr=5,sr=-1;function Ei(){return!(o.unstable_now()-srhn||125fr?(hn.sortIndex=ur,l(He,hn),b(ke)===null&&hn===b(He)&&(nn?(Ye(vn),vn=-1):nn=!0,go(It,ur-fr))):(hn.sortIndex=_r,l(ke,hn),Zt||jt||(Zt=!0,Hc(je))),hn},o.unstable_shouldYield=Ei,o.unstable_wrapCallback=function(hn){var Zn=lt;return function(){var ur=lt;lt=Zn;try{return hn.apply(this,arguments)}finally{lt=ur}}}})(yK);vK.exports=yK;var dne=vK.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var hne=ar,Au=dne;function Xt(o){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+o,b=1;b"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jx=Object.prototype.hasOwnProperty,pne=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Qj={},Xj={};function mne(o){return jx.call(Xj,o)?!0:jx.call(Qj,o)?!1:pne.test(o)?Xj[o]=!0:(Qj[o]=!0,!1)}function gne(o,l,b,R){if(b!==null&&b.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return R?!1:b!==null?!b.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function vne(o,l,b,R){if(l===null||typeof l>"u"||gne(o,l,b,R))return!0;if(R)return!1;if(b!==null)switch(b.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function ks(o,l,b,R,D,U,ie){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=R,this.attributeNamespace=D,this.mustUseProperty=b,this.propertyName=o,this.type=l,this.sanitizeURL=U,this.removeEmptyString=ie}var xa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){xa[o]=new ks(o,0,!1,o,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var l=o[0];xa[l]=new ks(l,1,!1,o[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(o){xa[o]=new ks(o,2,!1,o.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){xa[o]=new ks(o,2,!1,o,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){xa[o]=new ks(o,3,!1,o.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(o){xa[o]=new ks(o,3,!0,o,null,!1,!1)});["capture","download"].forEach(function(o){xa[o]=new ks(o,4,!1,o,null,!1,!1)});["cols","rows","size","span"].forEach(function(o){xa[o]=new ks(o,6,!1,o,null,!1,!1)});["rowSpan","start"].forEach(function(o){xa[o]=new ks(o,5,!1,o.toLowerCase(),null,!1,!1)});var BA=/[\-:]([a-z])/g;function zA(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var l=o.replace(BA,zA);xa[l]=new ks(l,1,!1,o,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var l=o.replace(BA,zA);xa[l]=new ks(l,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(o){var l=o.replace(BA,zA);xa[l]=new ks(l,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(o){xa[o]=new ks(o,1,!1,o.toLowerCase(),null,!1,!1)});xa.xlinkHref=new ks("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(o){xa[o]=new ks(o,1,!1,o.toLowerCase(),null,!0,!0)});function FA(o,l,b,R){var D=xa.hasOwnProperty(l)?xa[l]:null;(D!==null?D.type!==0:R||!(2ae||D[ie]!==U[ae]){var ke=` +`+D[ie].replace(" at new "," at ");return o.displayName&&ke.includes("")&&(ke=ke.replace("",o.displayName)),ke}while(1<=ie&&0<=ae);break}}}finally{mx=!1,Error.prepareStackTrace=b}return(o=o?o.displayName||o.name:"")?Z6(o):""}function yne(o){switch(o.tag){case 5:return Z6(o.type);case 16:return Z6("Lazy");case 13:return Z6("Suspense");case 19:return Z6("SuspenseList");case 0:case 2:case 15:return o=gx(o.type,!1),o;case 11:return o=gx(o.type.render,!1),o;case 1:return o=gx(o.type,!0),o;default:return""}}function $x(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case pv:return"Fragment";case hv:return"Portal";case Ux:return"Profiler";case jA:return"StrictMode";case Kx:return"Suspense";case Hx:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case _K:return(o.displayName||"Context")+".Consumer";case wK:return(o._context.displayName||"Context")+".Provider";case UA:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case KA:return l=o.displayName||null,l!==null?l:$x(o.type)||"Memo";case cp:l=o._payload,o=o._init;try{return $x(o(l))}catch{}}return null}function bne(o){var l=o.type;switch(o.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=l.render,o=o.displayName||o.name||"",l.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return $x(l);case 8:return l===jA?"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 l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function kp(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function EK(o){var l=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function wne(o){var l=EK(o)?"checked":"value",b=Object.getOwnPropertyDescriptor(o.constructor.prototype,l),R=""+o[l];if(!o.hasOwnProperty(l)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var D=b.get,U=b.set;return Object.defineProperty(o,l,{configurable:!0,get:function(){return D.call(this)},set:function(ie){R=""+ie,U.call(this,ie)}}),Object.defineProperty(o,l,{enumerable:b.enumerable}),{getValue:function(){return R},setValue:function(ie){R=""+ie},stopTracking:function(){o._valueTracker=null,delete o[l]}}}}function rS(o){o._valueTracker||(o._valueTracker=wne(o))}function kK(o){if(!o)return!1;var l=o._valueTracker;if(!l)return!0;var b=l.getValue(),R="";return o&&(R=EK(o)?o.checked?"true":"false":o.value),o=R,o!==b?(l.setValue(o),!0):!1}function PS(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function qx(o,l){var b=l.checked;return to({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??o._wrapperState.initialChecked})}function eU(o,l){var b=l.defaultValue==null?"":l.defaultValue,R=l.checked!=null?l.checked:l.defaultChecked;b=kp(l.value!=null?l.value:b),o._wrapperState={initialChecked:R,initialValue:b,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function MK(o,l){l=l.checked,l!=null&&FA(o,"checked",l,!1)}function Wx(o,l){MK(o,l);var b=kp(l.value),R=l.type;if(b!=null)R==="number"?(b===0&&o.value===""||o.value!=b)&&(o.value=""+b):o.value!==""+b&&(o.value=""+b);else if(R==="submit"||R==="reset"){o.removeAttribute("value");return}l.hasOwnProperty("value")?Vx(o,l.type,b):l.hasOwnProperty("defaultValue")&&Vx(o,l.type,kp(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(o.defaultChecked=!!l.defaultChecked)}function tU(o,l,b){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var R=l.type;if(!(R!=="submit"&&R!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+o._wrapperState.initialValue,b||l===o.value||(o.value=l),o.defaultValue=l}b=o.name,b!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,b!==""&&(o.name=b)}function Vx(o,l,b){(l!=="number"||PS(o.ownerDocument)!==o)&&(b==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+b&&(o.defaultValue=""+b))}var Q6=Array.isArray;function Mv(o,l,b,R){if(o=o.options,l){l={};for(var D=0;D"+l.valueOf().toString()+"",l=iS.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;l.firstChild;)o.appendChild(l.firstChild)}});function c8(o,l){if(l){var b=o.firstChild;if(b&&b===o.lastChild&&b.nodeType===3){b.nodeValue=l;return}}o.textContent=l}var e8={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},_ne=["Webkit","ms","Moz","O"];Object.keys(e8).forEach(function(o){_ne.forEach(function(l){l=l+o.charAt(0).toUpperCase()+o.substring(1),e8[l]=e8[o]})});function TK(o,l,b){return l==null||typeof l=="boolean"||l===""?"":b||typeof l!="number"||l===0||e8.hasOwnProperty(o)&&e8[o]?(""+l).trim():l+"px"}function RK(o,l){o=o.style;for(var b in l)if(l.hasOwnProperty(b)){var R=b.indexOf("--")===0,D=TK(b,l[b],R);b==="float"&&(b="cssFloat"),R?o.setProperty(b,D):o[b]=D}}var Sne=to({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 Zx(o,l){if(l){if(Sne[o]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(Xt(137,o));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(Xt(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(Xt(61))}if(l.style!=null&&typeof l.style!="object")throw Error(Xt(62))}}function Qx(o,l){if(o.indexOf("-")===-1)return typeof l.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Xx=null;function HA(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Jx=null,Cv=null,xv=null;function iU(o){if(o=T8(o)){if(typeof Jx!="function")throw Error(Xt(280));var l=o.stateNode;l&&(l=aE(l),Jx(o.stateNode,o.type,l))}}function PK(o){Cv?xv?xv.push(o):xv=[o]:Cv=o}function IK(){if(Cv){var o=Cv,l=xv;if(xv=Cv=null,iU(o),l)for(o=0;o>>=0,o===0?32:31-(Lne(o)/One|0)|0}var oS=64,aS=4194304;function X6(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function NS(o,l){var b=o.pendingLanes;if(b===0)return 0;var R=0,D=o.suspendedLanes,U=o.pingedLanes,ie=b&268435455;if(ie!==0){var ae=ie&~D;ae!==0?R=X6(ae):(U&=ie,U!==0&&(R=X6(U)))}else ie=b&~D,ie!==0?R=X6(ie):U!==0&&(R=X6(U));if(R===0)return 0;if(l!==0&&l!==R&&!(l&D)&&(D=R&-R,U=l&-l,D>=U||D===16&&(U&4194240)!==0))return l;if(R&4&&(R|=b&16),l=o.entangledLanes,l!==0)for(o=o.entanglements,l&=R;0b;b++)l.push(o);return l}function x8(o,l,b){o.pendingLanes|=l,l!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,l=31-jc(l),o[l]=b}function zne(o,l){var b=o.pendingLanes&~l;o.pendingLanes=l,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=l,o.mutableReadLanes&=l,o.entangledLanes&=l,l=o.entanglements;var R=o.eventTimes;for(o=o.expirationTimes;0=n8),hU=" ",pU=!1;function XK(o,l){switch(o){case"keyup":return dre.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function JK(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var mv=!1;function pre(o,l){switch(o){case"compositionend":return JK(l);case"keypress":return l.which!==32?null:(pU=!0,hU);case"textInput":return o=l.data,o===hU&&pU?null:o;default:return null}}function mre(o,l){if(mv)return o==="compositionend"||!QA&&XK(o,l)?(o=ZK(),_S=YA=pp=null,mv=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:b,offset:l-o};o=R}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=yU(b)}}function rH(o,l){return o&&l?o===l?!0:o&&o.nodeType===3?!1:l&&l.nodeType===3?rH(o,l.parentNode):"contains"in o?o.contains(l):o.compareDocumentPosition?!!(o.compareDocumentPosition(l)&16):!1:!1}function iH(){for(var o=window,l=PS();l instanceof o.HTMLIFrameElement;){try{var b=typeof l.contentWindow.location.href=="string"}catch{b=!1}if(b)o=l.contentWindow;else break;l=PS(o.document)}return l}function XA(o){var l=o&&o.nodeName&&o.nodeName.toLowerCase();return l&&(l==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||l==="textarea"||o.contentEditable==="true")}function kre(o){var l=iH(),b=o.focusedElem,R=o.selectionRange;if(l!==b&&b&&b.ownerDocument&&rH(b.ownerDocument.documentElement,b)){if(R!==null&&XA(b)){if(l=R.start,o=R.end,o===void 0&&(o=l),"selectionStart"in b)b.selectionStart=l,b.selectionEnd=Math.min(o,b.value.length);else if(o=(l=b.ownerDocument||document)&&l.defaultView||window,o.getSelection){o=o.getSelection();var D=b.textContent.length,U=Math.min(R.start,D);R=R.end===void 0?U:Math.min(R.end,D),!o.extend&&U>R&&(D=R,R=U,U=D),D=bU(b,U);var ie=bU(b,R);D&&ie&&(o.rangeCount!==1||o.anchorNode!==D.node||o.anchorOffset!==D.offset||o.focusNode!==ie.node||o.focusOffset!==ie.offset)&&(l=l.createRange(),l.setStart(D.node,D.offset),o.removeAllRanges(),U>R?(o.addRange(l),o.extend(ie.node,ie.offset)):(l.setEnd(ie.node,ie.offset),o.addRange(l)))}}for(l=[],o=b;o=o.parentNode;)o.nodeType===1&&l.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b=document.documentMode,gv=null,oA=null,i8=null,aA=!1;function wU(o,l,b){var R=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;aA||gv==null||gv!==PS(R)||(R=gv,"selectionStart"in R&&XA(R)?R={start:R.selectionStart,end:R.selectionEnd}:(R=(R.ownerDocument&&R.ownerDocument.defaultView||window).getSelection(),R={anchorNode:R.anchorNode,anchorOffset:R.anchorOffset,focusNode:R.focusNode,focusOffset:R.focusOffset}),i8&&g8(i8,R)||(i8=R,R=zS(oA,"onSelect"),0bv||(o.current=dA[bv],dA[bv]=null,bv--)}function Li(o,l){bv++,dA[bv]=o.current,o.current=l}var Mp={},Za=xp(Mp),Js=xp(!1),Im=Mp;function Iv(o,l){var b=o.type.contextTypes;if(!b)return Mp;var R=o.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===l)return R.__reactInternalMemoizedMaskedChildContext;var D={},U;for(U in b)D[U]=l[U];return R&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=l,o.__reactInternalMemoizedMaskedChildContext=D),D}function eu(o){return o=o.childContextTypes,o!=null}function jS(){Bi(Js),Bi(Za)}function xU(o,l,b){if(Za.current!==Mp)throw Error(Xt(168));Li(Za,l),Li(Js,b)}function hH(o,l,b){var R=o.stateNode;if(l=l.childContextTypes,typeof R.getChildContext!="function")return b;R=R.getChildContext();for(var D in R)if(!(D in l))throw Error(Xt(108,bne(o)||"Unknown",D));return to({},b,R)}function US(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Mp,Im=Za.current,Li(Za,o),Li(Js,Js.current),!0}function AU(o,l,b){var R=o.stateNode;if(!R)throw Error(Xt(169));b?(o=hH(o,l,Im),R.__reactInternalMemoizedMergedChildContext=o,Bi(Js),Bi(Za),Li(Za,o)):Bi(Js),Li(Js,b)}var _h=null,sE=!1,Rx=!1;function pH(o){_h===null?_h=[o]:_h.push(o)}function Dre(o){sE=!0,pH(o)}function Ap(){if(!Rx&&_h!==null){Rx=!0;var o=0,l=fi;try{var b=_h;for(fi=1;o>=ie,D-=ie,Sh=1<<32-jc(l)+D|b<vn?(rr=$t,$t=null):rr=$t.sibling;var sr=lt(Ye,$t,et[vn],It);if(sr===null){$t===null&&($t=rr);break}o&&$t&&sr.alternate===null&&l(Ye,$t),Ke=U(sr,Ke,vn),dn===null?je=sr:dn.sibling=sr,dn=sr,$t=rr}if(vn===et.length)return b(Ye,$t),qi&&Mm(Ye,vn),je;if($t===null){for(;vnvn?(rr=$t,$t=null):rr=$t.sibling;var Ei=lt(Ye,$t,sr.value,It);if(Ei===null){$t===null&&($t=rr);break}o&&$t&&Ei.alternate===null&&l(Ye,$t),Ke=U(Ei,Ke,vn),dn===null?je=Ei:dn.sibling=Ei,dn=Ei,$t=rr}if(sr.done)return b(Ye,$t),qi&&Mm(Ye,vn),je;if($t===null){for(;!sr.done;vn++,sr=et.next())sr=nt(Ye,sr.value,It),sr!==null&&(Ke=U(sr,Ke,vn),dn===null?je=sr:dn.sibling=sr,dn=sr);return qi&&Mm(Ye,vn),je}for($t=R(Ye,$t);!sr.done;vn++,sr=et.next())sr=jt($t,Ye,vn,sr.value,It),sr!==null&&(o&&sr.alternate!==null&&$t.delete(sr.key===null?vn:sr.key),Ke=U(sr,Ke,vn),dn===null?je=sr:dn.sibling=sr,dn=sr);return o&&$t.forEach(function(Pu){return l(Ye,Pu)}),qi&&Mm(Ye,vn),je}function Lr(Ye,Ke,et,It){if(typeof et=="object"&&et!==null&&et.type===pv&&et.key===null&&(et=et.props.children),typeof et=="object"&&et!==null){switch(et.$$typeof){case nS:e:{for(var je=et.key,dn=Ke;dn!==null;){if(dn.key===je){if(je=et.type,je===pv){if(dn.tag===7){b(Ye,dn.sibling),Ke=D(dn,et.props.children),Ke.return=Ye,Ye=Ke;break e}}else if(dn.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===cp&&PU(je)===dn.type){b(Ye,dn.sibling),Ke=D(dn,et.props),Ke.ref=V6(Ye,dn,et),Ke.return=Ye,Ye=Ke;break e}b(Ye,dn);break}else l(Ye,dn);dn=dn.sibling}et.type===pv?(Ke=Pm(et.props.children,Ye.mode,It,et.key),Ke.return=Ye,Ye=Ke):(It=TS(et.type,et.key,et.props,null,Ye.mode,It),It.ref=V6(Ye,Ke,et),It.return=Ye,Ye=It)}return ie(Ye);case hv:e:{for(dn=et.key;Ke!==null;){if(Ke.key===dn)if(Ke.tag===4&&Ke.stateNode.containerInfo===et.containerInfo&&Ke.stateNode.implementation===et.implementation){b(Ye,Ke.sibling),Ke=D(Ke,et.children||[]),Ke.return=Ye,Ye=Ke;break e}else{b(Ye,Ke);break}else l(Ye,Ke);Ke=Ke.sibling}Ke=zx(et,Ye.mode,It),Ke.return=Ye,Ye=Ke}return ie(Ye);case cp:return dn=et._init,Lr(Ye,Ke,dn(et._payload),It)}if(Q6(et))return Zt(Ye,Ke,et,It);if(K6(et))return nn(Ye,Ke,et,It);hS(Ye,et)}return typeof et=="string"&&et!==""||typeof et=="number"?(et=""+et,Ke!==null&&Ke.tag===6?(b(Ye,Ke.sibling),Ke=D(Ke,et),Ke.return=Ye,Ye=Ke):(b(Ye,Ke),Ke=Bx(et,Ye.mode,It),Ke.return=Ye,Ye=Ke),ie(Ye)):b(Ye,Ke)}return Lr}var Ov=yH(!0),bH=yH(!1),$S=xp(null),qS=null,Sv=null,nT=null;function rT(){nT=Sv=qS=null}function iT(o){var l=$S.current;Bi($S),o._currentValue=l}function mA(o,l,b){for(;o!==null;){var R=o.alternate;if((o.childLanes&l)!==l?(o.childLanes|=l,R!==null&&(R.childLanes|=l)):R!==null&&(R.childLanes&l)!==l&&(R.childLanes|=l),o===b)break;o=o.return}}function Tv(o,l){qS=o,nT=Sv=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&l&&(Xs=!0),o.firstContext=null)}function Tl(o){var l=o._currentValue;if(nT!==o)if(o={context:o,memoizedValue:l,next:null},Sv===null){if(qS===null)throw Error(Xt(308));Sv=o,qS.dependencies={lanes:0,firstContext:o}}else Sv=Sv.next=o;return l}var Am=null;function oT(o){Am===null?Am=[o]:Am.push(o)}function wH(o,l,b,R){var D=l.interleaved;return D===null?(b.next=b,oT(l)):(b.next=D.next,D.next=b),l.interleaved=b,xh(o,R)}function xh(o,l){o.lanes|=l;var b=o.alternate;for(b!==null&&(b.lanes|=l),b=o,o=o.return;o!==null;)o.childLanes|=l,b=o.alternate,b!==null&&(b.childLanes|=l),b=o,o=o.return;return b.tag===3?b.stateNode:null}var fp=!1;function aT(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _H(o,l){o=o.updateQueue,l.updateQueue===o&&(l.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function kh(o,l){return{eventTime:o,lane:l,tag:0,payload:null,callback:null,next:null}}function wp(o,l,b){var R=o.updateQueue;if(R===null)return null;if(R=R.shared,Hr&2){var D=R.pending;return D===null?l.next=l:(l.next=D.next,D.next=l),R.pending=l,xh(o,b)}return D=R.interleaved,D===null?(l.next=l,oT(R)):(l.next=D.next,D.next=l),R.interleaved=l,xh(o,b)}function ES(o,l,b){if(l=l.updateQueue,l!==null&&(l=l.shared,(b&4194240)!==0)){var R=l.lanes;R&=o.pendingLanes,b|=R,l.lanes=b,qA(o,b)}}function IU(o,l){var b=o.updateQueue,R=o.alternate;if(R!==null&&(R=R.updateQueue,b===R)){var D=null,U=null;if(b=b.firstBaseUpdate,b!==null){do{var ie={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};U===null?D=U=ie:U=U.next=ie,b=b.next}while(b!==null);U===null?D=U=l:U=U.next=l}else D=U=l;b={baseState:R.baseState,firstBaseUpdate:D,lastBaseUpdate:U,shared:R.shared,effects:R.effects},o.updateQueue=b;return}o=b.lastBaseUpdate,o===null?b.firstBaseUpdate=l:o.next=l,b.lastBaseUpdate=l}function WS(o,l,b,R){var D=o.updateQueue;fp=!1;var U=D.firstBaseUpdate,ie=D.lastBaseUpdate,ae=D.shared.pending;if(ae!==null){D.shared.pending=null;var ke=ae,He=ke.next;ke.next=null,ie===null?U=He:ie.next=He,ie=ke;var tt=o.alternate;tt!==null&&(tt=tt.updateQueue,ae=tt.lastBaseUpdate,ae!==ie&&(ae===null?tt.firstBaseUpdate=He:ae.next=He,tt.lastBaseUpdate=ke))}if(U!==null){var nt=D.baseState;ie=0,tt=He=ke=null,ae=U;do{var lt=ae.lane,jt=ae.eventTime;if((R<)===lt){tt!==null&&(tt=tt.next={eventTime:jt,lane:0,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null});e:{var Zt=o,nn=ae;switch(lt=l,jt=b,nn.tag){case 1:if(Zt=nn.payload,typeof Zt=="function"){nt=Zt.call(jt,nt,lt);break e}nt=Zt;break e;case 3:Zt.flags=Zt.flags&-65537|128;case 0:if(Zt=nn.payload,lt=typeof Zt=="function"?Zt.call(jt,nt,lt):Zt,lt==null)break e;nt=to({},nt,lt);break e;case 2:fp=!0}}ae.callback!==null&&ae.lane!==0&&(o.flags|=64,lt=D.effects,lt===null?D.effects=[ae]:lt.push(ae))}else jt={eventTime:jt,lane:lt,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null},tt===null?(He=tt=jt,ke=nt):tt=tt.next=jt,ie|=lt;if(ae=ae.next,ae===null){if(ae=D.shared.pending,ae===null)break;lt=ae,ae=lt.next,lt.next=null,D.lastBaseUpdate=lt,D.shared.pending=null}}while(!0);if(tt===null&&(ke=nt),D.baseState=ke,D.firstBaseUpdate=He,D.lastBaseUpdate=tt,l=D.shared.interleaved,l!==null){D=l;do ie|=D.lane,D=D.next;while(D!==l)}else U===null&&(D.shared.lanes=0);Nm|=ie,o.lanes=ie,o.memoizedState=nt}}function LU(o,l,b){if(o=l.effects,l.effects=null,o!==null)for(l=0;lb?b:4,o(!0);var R=Ix.transition;Ix.transition={};try{o(!1),l()}finally{fi=b,Ix.transition=R}}function zH(){return Rl().memoizedState}function jre(o,l,b){var R=Sp(o);if(b={lane:R,action:b,hasEagerState:!1,eagerState:null,next:null},FH(o))jH(l,b);else if(b=wH(o,l,b,R),b!==null){var D=Ss();Uc(b,o,R,D),UH(b,l,R)}}function Ure(o,l,b){var R=Sp(o),D={lane:R,action:b,hasEagerState:!1,eagerState:null,next:null};if(FH(o))jH(l,D);else{var U=o.alternate;if(o.lanes===0&&(U===null||U.lanes===0)&&(U=l.lastRenderedReducer,U!==null))try{var ie=l.lastRenderedState,ae=U(ie,b);if(D.hasEagerState=!0,D.eagerState=ae,Kc(ae,ie)){var ke=l.interleaved;ke===null?(D.next=D,oT(l)):(D.next=ke.next,ke.next=D),l.interleaved=D;return}}catch{}finally{}b=wH(o,l,D,R),b!==null&&(D=Ss(),Uc(b,o,R,D),UH(b,l,R))}}function FH(o){var l=o.alternate;return o===eo||l!==null&&l===eo}function jH(o,l){o8=YS=!0;var b=o.pending;b===null?l.next=l:(l.next=b.next,b.next=l),o.pending=l}function UH(o,l,b){if(b&4194240){var R=l.lanes;R&=o.pendingLanes,b|=R,l.lanes=b,qA(o,b)}}var GS={readContext:Tl,useCallback:Va,useContext:Va,useEffect:Va,useImperativeHandle:Va,useInsertionEffect:Va,useLayoutEffect:Va,useMemo:Va,useReducer:Va,useRef:Va,useState:Va,useDebugValue:Va,useDeferredValue:Va,useTransition:Va,useMutableSource:Va,useSyncExternalStore:Va,useId:Va,unstable_isNewReconciler:!1},Kre={readContext:Tl,useCallback:function(o,l){return id().memoizedState=[o,l===void 0?null:l],o},useContext:Tl,useEffect:NU,useImperativeHandle:function(o,l,b){return b=b!=null?b.concat([o]):null,MS(4194308,4,LH.bind(null,l,o),b)},useLayoutEffect:function(o,l){return MS(4194308,4,o,l)},useInsertionEffect:function(o,l){return MS(4,2,o,l)},useMemo:function(o,l){var b=id();return l=l===void 0?null:l,o=o(),b.memoizedState=[o,l],o},useReducer:function(o,l,b){var R=id();return l=b!==void 0?b(l):l,R.memoizedState=R.baseState=l,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:l},R.queue=o,o=o.dispatch=jre.bind(null,eo,o),[R.memoizedState,o]},useRef:function(o){var l=id();return o={current:o},l.memoizedState=o},useState:OU,useDebugValue:pT,useDeferredValue:function(o){return id().memoizedState=o},useTransition:function(){var o=OU(!1),l=o[0];return o=Fre.bind(null,o[1]),id().memoizedState=o,[l,o]},useMutableSource:function(){},useSyncExternalStore:function(o,l,b){var R=eo,D=id();if(qi){if(b===void 0)throw Error(Xt(407));b=b()}else{if(b=l(),ia===null)throw Error(Xt(349));Om&30||MH(R,l,b)}D.memoizedState=b;var U={value:b,getSnapshot:l};return D.queue=U,NU(xH.bind(null,R,U,o),[o]),R.flags|=2048,k8(9,CH.bind(null,R,U,b,l),void 0,null),b},useId:function(){var o=id(),l=ia.identifierPrefix;if(qi){var b=Eh,R=Sh;b=(R&~(1<<32-jc(R)-1)).toString(32)+b,l=":"+l+"R"+b,b=S8++,0<\/script>",o=o.removeChild(o.firstChild)):typeof R.is=="string"?o=ie.createElement(b,{is:R.is}):(o=ie.createElement(b),b==="select"&&(ie=o,R.multiple?ie.multiple=!0:R.size&&(ie.size=R.size))):o=ie.createElementNS(o,b),o[od]=l,o[b8]=R,QH(o,l,!1,!1),l.stateNode=o;e:{switch(ie=Qx(b,R),b){case"dialog":Di("cancel",o),Di("close",o),D=R;break;case"iframe":case"object":case"embed":Di("load",o),D=R;break;case"video":case"audio":for(D=0;DBv&&(l.flags|=128,R=!0,Y6(U,!1),l.lanes=4194304)}else{if(!R)if(o=VS(ie),o!==null){if(l.flags|=128,R=!0,b=o.updateQueue,b!==null&&(l.updateQueue=b,l.flags|=4),Y6(U,!0),U.tail===null&&U.tailMode==="hidden"&&!ie.alternate&&!qi)return Ya(l),null}else 2*mo()-U.renderingStartTime>Bv&&b!==1073741824&&(l.flags|=128,R=!0,Y6(U,!1),l.lanes=4194304);U.isBackwards?(ie.sibling=l.child,l.child=ie):(b=U.last,b!==null?b.sibling=ie:l.child=ie,U.last=ie)}return U.tail!==null?(l=U.tail,U.rendering=l,U.tail=l.sibling,U.renderingStartTime=mo(),l.sibling=null,b=Ji.current,Li(Ji,R?b&1|2:b&1),l):(Ya(l),null);case 22:case 23:return wT(),R=l.memoizedState!==null,o!==null&&o.memoizedState!==null!==R&&(l.flags|=8192),R&&l.mode&1?Mu&1073741824&&(Ya(l),l.subtreeFlags&6&&(l.flags|=8192)):Ya(l),null;case 24:return null;case 25:return null}throw Error(Xt(156,l.tag))}function Zre(o,l){switch(eT(l),l.tag){case 1:return eu(l.type)&&jS(),o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 3:return Nv(),Bi(Js),Bi(Za),lT(),o=l.flags,o&65536&&!(o&128)?(l.flags=o&-65537|128,l):null;case 5:return uT(l),null;case 13:if(Bi(Ji),o=l.memoizedState,o!==null&&o.dehydrated!==null){if(l.alternate===null)throw Error(Xt(340));Lv()}return o=l.flags,o&65536?(l.flags=o&-65537|128,l):null;case 19:return Bi(Ji),null;case 4:return Nv(),null;case 10:return iT(l.type._context),null;case 22:case 23:return wT(),null;case 24:return null;default:return null}}var mS=!1,Ga=!1,Qre=typeof WeakSet=="function"?WeakSet:Set,En=null;function Ev(o,l){var b=o.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(R){co(o,l,R)}else b.current=null}function kA(o,l,b){try{b()}catch(R){co(o,l,R)}}var WU=!1;function Xre(o,l){if(sA=DS,o=iH(),XA(o)){if("selectionStart"in o)var b={start:o.selectionStart,end:o.selectionEnd};else e:{b=(b=o.ownerDocument)&&b.defaultView||window;var R=b.getSelection&&b.getSelection();if(R&&R.rangeCount!==0){b=R.anchorNode;var D=R.anchorOffset,U=R.focusNode;R=R.focusOffset;try{b.nodeType,U.nodeType}catch{b=null;break e}var ie=0,ae=-1,ke=-1,He=0,tt=0,nt=o,lt=null;t:for(;;){for(var jt;nt!==b||D!==0&&nt.nodeType!==3||(ae=ie+D),nt!==U||R!==0&&nt.nodeType!==3||(ke=ie+R),nt.nodeType===3&&(ie+=nt.nodeValue.length),(jt=nt.firstChild)!==null;)lt=nt,nt=jt;for(;;){if(nt===o)break t;if(lt===b&&++He===D&&(ae=ie),lt===U&&++tt===R&&(ke=ie),(jt=nt.nextSibling)!==null)break;nt=lt,lt=nt.parentNode}nt=jt}b=ae===-1||ke===-1?null:{start:ae,end:ke}}else b=null}b=b||{start:0,end:0}}else b=null;for(uA={focusedElem:o,selectionRange:b},DS=!1,En=l;En!==null;)if(l=En,o=l.child,(l.subtreeFlags&1028)!==0&&o!==null)o.return=l,En=o;else for(;En!==null;){l=En;try{var Zt=l.alternate;if(l.flags&1024)switch(l.tag){case 0:case 11:case 15:break;case 1:if(Zt!==null){var nn=Zt.memoizedProps,Lr=Zt.memoizedState,Ye=l.stateNode,Ke=Ye.getSnapshotBeforeUpdate(l.elementType===l.type?nn:Bc(l.type,nn),Lr);Ye.__reactInternalSnapshotBeforeUpdate=Ke}break;case 3:var et=l.stateNode.containerInfo;et.nodeType===1?et.textContent="":et.nodeType===9&&et.documentElement&&et.removeChild(et.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Xt(163))}}catch(It){co(l,l.return,It)}if(o=l.sibling,o!==null){o.return=l.return,En=o;break}En=l.return}return Zt=WU,WU=!1,Zt}function a8(o,l,b){var R=l.updateQueue;if(R=R!==null?R.lastEffect:null,R!==null){var D=R=R.next;do{if((D.tag&o)===o){var U=D.destroy;D.destroy=void 0,U!==void 0&&kA(l,b,U)}D=D.next}while(D!==R)}}function cE(o,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var b=l=l.next;do{if((b.tag&o)===o){var R=b.create;b.destroy=R()}b=b.next}while(b!==l)}}function MA(o){var l=o.ref;if(l!==null){var b=o.stateNode;switch(o.tag){case 5:o=b;break;default:o=b}typeof l=="function"?l(o):l.current=o}}function e$(o){var l=o.alternate;l!==null&&(o.alternate=null,e$(l)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(l=o.stateNode,l!==null&&(delete l[od],delete l[b8],delete l[fA],delete l[Ore],delete l[Nre])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function t$(o){return o.tag===5||o.tag===3||o.tag===4}function VU(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||t$(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function CA(o,l,b){var R=o.tag;if(R===5||R===6)o=o.stateNode,l?b.nodeType===8?b.parentNode.insertBefore(o,l):b.insertBefore(o,l):(b.nodeType===8?(l=b.parentNode,l.insertBefore(o,b)):(l=b,l.appendChild(o)),b=b._reactRootContainer,b!=null||l.onclick!==null||(l.onclick=FS));else if(R!==4&&(o=o.child,o!==null))for(CA(o,l,b),o=o.sibling;o!==null;)CA(o,l,b),o=o.sibling}function xA(o,l,b){var R=o.tag;if(R===5||R===6)o=o.stateNode,l?b.insertBefore(o,l):b.appendChild(o);else if(R!==4&&(o=o.child,o!==null))for(xA(o,l,b),o=o.sibling;o!==null;)xA(o,l,b),o=o.sibling}var Ma=null,zc=!1;function lp(o,l,b){for(b=b.child;b!==null;)n$(o,l,b),b=b.sibling}function n$(o,l,b){if(sd&&typeof sd.onCommitFiberUnmount=="function")try{sd.onCommitFiberUnmount(nE,b)}catch{}switch(b.tag){case 5:Ga||Ev(b,l);case 6:var R=Ma,D=zc;Ma=null,lp(o,l,b),Ma=R,zc=D,Ma!==null&&(zc?(o=Ma,b=b.stateNode,o.nodeType===8?o.parentNode.removeChild(b):o.removeChild(b)):Ma.removeChild(b.stateNode));break;case 18:Ma!==null&&(zc?(o=Ma,b=b.stateNode,o.nodeType===8?Tx(o.parentNode,b):o.nodeType===1&&Tx(o,b),p8(o)):Tx(Ma,b.stateNode));break;case 4:R=Ma,D=zc,Ma=b.stateNode.containerInfo,zc=!0,lp(o,l,b),Ma=R,zc=D;break;case 0:case 11:case 14:case 15:if(!Ga&&(R=b.updateQueue,R!==null&&(R=R.lastEffect,R!==null))){D=R=R.next;do{var U=D,ie=U.destroy;U=U.tag,ie!==void 0&&(U&2||U&4)&&kA(b,l,ie),D=D.next}while(D!==R)}lp(o,l,b);break;case 1:if(!Ga&&(Ev(b,l),R=b.stateNode,typeof R.componentWillUnmount=="function"))try{R.props=b.memoizedProps,R.state=b.memoizedState,R.componentWillUnmount()}catch(ae){co(b,l,ae)}lp(o,l,b);break;case 21:lp(o,l,b);break;case 22:b.mode&1?(Ga=(R=Ga)||b.memoizedState!==null,lp(o,l,b),Ga=R):lp(o,l,b);break;default:lp(o,l,b)}}function YU(o){var l=o.updateQueue;if(l!==null){o.updateQueue=null;var b=o.stateNode;b===null&&(b=o.stateNode=new Qre),l.forEach(function(R){var D=sie.bind(null,o,R);b.has(R)||(b.add(R),R.then(D,D))})}}function Dc(o,l){var b=l.deletions;if(b!==null)for(var R=0;RD&&(D=ie),R&=~U}if(R=D,R=mo()-R,R=(120>R?120:480>R?480:1080>R?1080:1920>R?1920:3e3>R?3e3:4320>R?4320:1960*eie(R/1960))-R,10o?16:o,mp===null)var R=!1;else{if(o=mp,mp=null,XS=0,Hr&6)throw Error(Xt(331));var D=Hr;for(Hr|=4,En=o.current;En!==null;){var U=En,ie=U.child;if(En.flags&16){var ae=U.deletions;if(ae!==null){for(var ke=0;kemo()-yT?Rm(o,0):vT|=b),tu(o,l)}function c$(o,l){l===0&&(o.mode&1?(l=aS,aS<<=1,!(aS&130023424)&&(aS=4194304)):l=1);var b=Ss();o=xh(o,l),o!==null&&(x8(o,l,b),tu(o,b))}function aie(o){var l=o.memoizedState,b=0;l!==null&&(b=l.retryLane),c$(o,b)}function sie(o,l){var b=0;switch(o.tag){case 13:var R=o.stateNode,D=o.memoizedState;D!==null&&(b=D.retryLane);break;case 19:R=o.stateNode;break;default:throw Error(Xt(314))}R!==null&&R.delete(l),c$(o,b)}var f$;f$=function(o,l,b){if(o!==null)if(o.memoizedProps!==l.pendingProps||Js.current)Xs=!0;else{if(!(o.lanes&b)&&!(l.flags&128))return Xs=!1,Yre(o,l,b);Xs=!!(o.flags&131072)}else Xs=!1,qi&&l.flags&1048576&&mH(l,HS,l.index);switch(l.lanes=0,l.tag){case 2:var R=l.type;CS(o,l),o=l.pendingProps;var D=Iv(l,Za.current);Tv(l,b),D=fT(null,l,R,o,D,b);var U=dT();return l.flags|=1,typeof D=="object"&&D!==null&&typeof D.render=="function"&&D.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,eu(R)?(U=!0,US(l)):U=!1,l.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,aT(l),D.updater=lE,l.stateNode=D,D._reactInternals=l,vA(l,R,o,b),l=wA(null,l,R,!0,U,b)):(l.tag=0,qi&&U&&JA(l),_s(null,l,D,b),l=l.child),l;case 16:R=l.elementType;e:{switch(CS(o,l),o=l.pendingProps,D=R._init,R=D(R._payload),l.type=R,D=l.tag=lie(R),o=Bc(R,o),D){case 0:l=bA(null,l,R,o,b);break e;case 1:l=HU(null,l,R,o,b);break e;case 11:l=UU(null,l,R,o,b);break e;case 14:l=KU(null,l,R,Bc(R.type,o),b);break e}throw Error(Xt(306,R,""))}return l;case 0:return R=l.type,D=l.pendingProps,D=l.elementType===R?D:Bc(R,D),bA(o,l,R,D,b);case 1:return R=l.type,D=l.pendingProps,D=l.elementType===R?D:Bc(R,D),HU(o,l,R,D,b);case 3:e:{if(YH(l),o===null)throw Error(Xt(387));R=l.pendingProps,U=l.memoizedState,D=U.element,_H(o,l),WS(l,R,null,b);var ie=l.memoizedState;if(R=ie.element,U.isDehydrated)if(U={element:R,isDehydrated:!1,cache:ie.cache,pendingSuspenseBoundaries:ie.pendingSuspenseBoundaries,transitions:ie.transitions},l.updateQueue.baseState=U,l.memoizedState=U,l.flags&256){D=Dv(Error(Xt(423)),l),l=$U(o,l,R,b,D);break e}else if(R!==D){D=Dv(Error(Xt(424)),l),l=$U(o,l,R,b,D);break e}else for(Cu=bp(l.stateNode.containerInfo.firstChild),xu=l,qi=!0,Fc=null,b=bH(l,null,R,b),l.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(Lv(),R===D){l=Ah(o,l,b);break e}_s(o,l,R,b)}l=l.child}return l;case 5:return SH(l),o===null&&pA(l),R=l.type,D=l.pendingProps,U=o!==null?o.memoizedProps:null,ie=D.children,lA(R,D)?ie=null:U!==null&&lA(R,U)&&(l.flags|=32),VH(o,l),_s(o,l,ie,b),l.child;case 6:return o===null&&pA(l),null;case 13:return GH(o,l,b);case 4:return sT(l,l.stateNode.containerInfo),R=l.pendingProps,o===null?l.child=Ov(l,null,R,b):_s(o,l,R,b),l.child;case 11:return R=l.type,D=l.pendingProps,D=l.elementType===R?D:Bc(R,D),UU(o,l,R,D,b);case 7:return _s(o,l,l.pendingProps,b),l.child;case 8:return _s(o,l,l.pendingProps.children,b),l.child;case 12:return _s(o,l,l.pendingProps.children,b),l.child;case 10:e:{if(R=l.type._context,D=l.pendingProps,U=l.memoizedProps,ie=D.value,Li($S,R._currentValue),R._currentValue=ie,U!==null)if(Kc(U.value,ie)){if(U.children===D.children&&!Js.current){l=Ah(o,l,b);break e}}else for(U=l.child,U!==null&&(U.return=l);U!==null;){var ae=U.dependencies;if(ae!==null){ie=U.child;for(var ke=ae.firstContext;ke!==null;){if(ke.context===R){if(U.tag===1){ke=kh(-1,b&-b),ke.tag=2;var He=U.updateQueue;if(He!==null){He=He.shared;var tt=He.pending;tt===null?ke.next=ke:(ke.next=tt.next,tt.next=ke),He.pending=ke}}U.lanes|=b,ke=U.alternate,ke!==null&&(ke.lanes|=b),mA(U.return,b,l),ae.lanes|=b;break}ke=ke.next}}else if(U.tag===10)ie=U.type===l.type?null:U.child;else if(U.tag===18){if(ie=U.return,ie===null)throw Error(Xt(341));ie.lanes|=b,ae=ie.alternate,ae!==null&&(ae.lanes|=b),mA(ie,b,l),ie=U.sibling}else ie=U.child;if(ie!==null)ie.return=U;else for(ie=U;ie!==null;){if(ie===l){ie=null;break}if(U=ie.sibling,U!==null){U.return=ie.return,ie=U;break}ie=ie.return}U=ie}_s(o,l,D.children,b),l=l.child}return l;case 9:return D=l.type,R=l.pendingProps.children,Tv(l,b),D=Tl(D),R=R(D),l.flags|=1,_s(o,l,R,b),l.child;case 14:return R=l.type,D=Bc(R,l.pendingProps),D=Bc(R.type,D),KU(o,l,R,D,b);case 15:return qH(o,l,l.type,l.pendingProps,b);case 17:return R=l.type,D=l.pendingProps,D=l.elementType===R?D:Bc(R,D),CS(o,l),l.tag=1,eu(R)?(o=!0,US(l)):o=!1,Tv(l,b),KH(l,R,D),vA(l,R,D,b),wA(null,l,R,!0,o,b);case 19:return ZH(o,l,b);case 22:return WH(o,l,b)}throw Error(Xt(156,l.tag))};function d$(o,l){return FK(o,l)}function uie(o,l,b,R){this.tag=o,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=R,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xl(o,l,b,R){return new uie(o,l,b,R)}function ST(o){return o=o.prototype,!(!o||!o.isReactComponent)}function lie(o){if(typeof o=="function")return ST(o)?1:0;if(o!=null){if(o=o.$$typeof,o===UA)return 11;if(o===KA)return 14}return 2}function Ep(o,l){var b=o.alternate;return b===null?(b=xl(o.tag,l,o.key,o.mode),b.elementType=o.elementType,b.type=o.type,b.stateNode=o.stateNode,b.alternate=o,o.alternate=b):(b.pendingProps=l,b.type=o.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=o.flags&14680064,b.childLanes=o.childLanes,b.lanes=o.lanes,b.child=o.child,b.memoizedProps=o.memoizedProps,b.memoizedState=o.memoizedState,b.updateQueue=o.updateQueue,l=o.dependencies,b.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},b.sibling=o.sibling,b.index=o.index,b.ref=o.ref,b}function TS(o,l,b,R,D,U){var ie=2;if(R=o,typeof o=="function")ST(o)&&(ie=1);else if(typeof o=="string")ie=5;else e:switch(o){case pv:return Pm(b.children,D,U,l);case jA:ie=8,D|=8;break;case Ux:return o=xl(12,b,l,D|2),o.elementType=Ux,o.lanes=U,o;case Kx:return o=xl(13,b,l,D),o.elementType=Kx,o.lanes=U,o;case Hx:return o=xl(19,b,l,D),o.elementType=Hx,o.lanes=U,o;case SK:return dE(b,D,U,l);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case wK:ie=10;break e;case _K:ie=9;break e;case UA:ie=11;break e;case KA:ie=14;break e;case cp:ie=16,R=null;break e}throw Error(Xt(130,o==null?o:typeof o,""))}return l=xl(ie,b,l,D),l.elementType=o,l.type=R,l.lanes=U,l}function Pm(o,l,b,R){return o=xl(7,o,R,l),o.lanes=b,o}function dE(o,l,b,R){return o=xl(22,o,R,l),o.elementType=SK,o.lanes=b,o.stateNode={isHidden:!1},o}function Bx(o,l,b){return o=xl(6,o,null,l),o.lanes=b,o}function zx(o,l,b){return l=xl(4,o.children!==null?o.children:[],o.key,l),l.lanes=b,l.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},l}function cie(o,l,b,R,D){this.tag=l,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yx(0),this.expirationTimes=yx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yx(0),this.identifierPrefix=R,this.onRecoverableError=D,this.mutableSourceEagerHydrationData=null}function ET(o,l,b,R,D,U,ie,ae,ke){return o=new cie(o,l,b,ae,ke),l===1?(l=1,U===!0&&(l|=8)):l=0,U=xl(3,null,null,l),o.current=U,U.stateNode=o,U.memoizedState={element:R,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},aT(U),o}function fie(o,l,b){var R=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(g$)}catch(o){console.error(o)}}g$(),gK.exports=Tu;var gie=gK.exports,v$,nK=gie;v$=nK.createRoot,nK.hydrateRoot;var vie={},ku=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ws={exports:{}};(function(o){var l=ku!==void 0?ku:typeof self<"u"?self:typeof window<"u"?window:{},b=typeof globalThis<"u"?globalThis:typeof window<"u"?window:ku!==void 0?ku:typeof self<"u"?self:{};function R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function D(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var U={exports:{}};(function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||b!==void 0&&b,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(h){var y=i!==void 0&&i||typeof self<"u"&&self||y!==void 0&&y,k="URLSearchParams"in y,E="Symbol"in y&&"iterator"in Symbol,M="FileReader"in y&&"Blob"in y&&function(){try{return new Blob,!0}catch{return!1}}(),C="FormData"in y,O="ArrayBuffer"in y;if(O)var z=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],H=ArrayBuffer.isView||function(p){return p&&z.indexOf(Object.prototype.toString.call(p))>-1};function ee(p){if(typeof p!="string"&&(p=String(p)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(p)||p==="")throw new TypeError('Invalid character in header field name: "'+p+'"');return p.toLowerCase()}function te(p){return typeof p!="string"&&(p=String(p)),p}function se(p){var f={next:function(){var _=p.shift();return{done:_===void 0,value:_}}};return E&&(f[Symbol.iterator]=function(){return f}),f}function oe(p){this.map={},p instanceof oe?p.forEach(function(f,_){this.append(_,f)},this):Array.isArray(p)?p.forEach(function(f){this.append(f[0],f[1])},this):p&&Object.getOwnPropertyNames(p).forEach(function(f){this.append(f,p[f])},this)}function Ee(p){if(p.bodyUsed)return Promise.reject(new TypeError("Already read"));p.bodyUsed=!0}function we(p){return new Promise(function(f,_){p.onload=function(){f(p.result)},p.onerror=function(){_(p.error)}})}function Ce(p){var f=new FileReader,_=we(f);return f.readAsArrayBuffer(p),_}function ze(p){if(p.slice)return p.slice(0);var f=new Uint8Array(p.byteLength);return f.set(new Uint8Array(p)),f.buffer}function Fe(){return this.bodyUsed=!1,this._initBody=function(p){var f;this.bodyUsed=this.bodyUsed,this._bodyInit=p,p?typeof p=="string"?this._bodyText=p:M&&Blob.prototype.isPrototypeOf(p)?this._bodyBlob=p:C&&FormData.prototype.isPrototypeOf(p)?this._bodyFormData=p:k&&URLSearchParams.prototype.isPrototypeOf(p)?this._bodyText=p.toString():O&&M&&(f=p)&&DataView.prototype.isPrototypeOf(f)?(this._bodyArrayBuffer=ze(p.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):O&&(ArrayBuffer.prototype.isPrototypeOf(p)||H(p))?this._bodyArrayBuffer=ze(p):this._bodyText=p=Object.prototype.toString.call(p):this._bodyText="",this.headers.get("content-type")||(typeof p=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):k&&URLSearchParams.prototype.isPrototypeOf(p)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},M&&(this.blob=function(){var p=Ee(this);if(p)return p;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?Ee(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(Ce)}),this.text=function(){var p,f,_,T=Ee(this);if(T)return T;if(this._bodyBlob)return p=this._bodyBlob,_=we(f=new FileReader),f.readAsText(p),_;if(this._bodyArrayBuffer)return Promise.resolve(function(L){for(var B=new Uint8Array(L),$=new Array(B.length),Y=0;Y-1?B:L}(f.method||this.method||"GET"),this.mode=f.mode||this.mode||null,this.signal=f.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(_),!(this.method!=="GET"&&this.method!=="HEAD"||f.cache!=="no-store"&&f.cache!=="no-cache")){var T=/([?&])_=[^&]*/;T.test(this.url)?this.url=this.url.replace(T,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function P(p){var f=new FormData;return p.trim().split("&").forEach(function(_){if(_){var T=_.split("="),L=T.shift().replace(/\+/g," "),B=T.join("=").replace(/\+/g," ");f.append(decodeURIComponent(L),decodeURIComponent(B))}}),f}function d(p,f){if(!(this instanceof d))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');f||(f={}),this.type="default",this.status=f.status===void 0?200:f.status,this.ok=this.status>=200&&this.status<300,this.statusText=f.statusText===void 0?"":""+f.statusText,this.headers=new oe(f.headers),this.url=f.url||"",this._initBody(p)}S.prototype.clone=function(){return new S(this,{body:this._bodyInit})},Fe.call(S.prototype),Fe.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new oe(this.headers),url:this.url})},d.error=function(){var p=new d(null,{status:0,statusText:""});return p.type="error",p};var g=[301,302,303,307,308];d.redirect=function(p,f){if(g.indexOf(f)===-1)throw new RangeError("Invalid status code");return new d(null,{status:f,headers:{location:p}})},h.DOMException=y.DOMException;try{new h.DOMException}catch{h.DOMException=function(f,_){this.message=f,this.name=_;var T=Error(f);this.stack=T.stack},h.DOMException.prototype=Object.create(Error.prototype),h.DOMException.prototype.constructor=h.DOMException}function m(p,f){return new Promise(function(_,T){var L=new S(p,f);if(L.signal&&L.signal.aborted)return T(new h.DOMException("Aborted","AbortError"));var B=new XMLHttpRequest;function $(){B.abort()}B.onload=function(){var Y,q,F={status:B.status,statusText:B.statusText,headers:(Y=B.getAllResponseHeaders()||"",q=new oe,Y.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(Z){return Z.indexOf(` +`)===0?Z.substr(1,Z.length):Z}).forEach(function(Z){var ne=Z.split(":"),ue=ne.shift().trim();if(ue){var me=ne.join(":").trim();q.append(ue,me)}}),q)};F.url="responseURL"in B?B.responseURL:F.headers.get("X-Request-URL");var K="response"in B?B.response:B.responseText;setTimeout(function(){_(new d(K,F))},0)},B.onerror=function(){setTimeout(function(){T(new TypeError("Network request failed"))},0)},B.ontimeout=function(){setTimeout(function(){T(new TypeError("Network request failed"))},0)},B.onabort=function(){setTimeout(function(){T(new h.DOMException("Aborted","AbortError"))},0)},B.open(L.method,function(Y){try{return Y===""&&y.location.href?y.location.href:Y}catch{return Y}}(L.url),!0),L.credentials==="include"?B.withCredentials=!0:L.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&(M?B.responseType="blob":O&&L.headers.get("Content-Type")&&L.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(B.responseType="arraybuffer")),!f||typeof f.headers!="object"||f.headers instanceof oe?L.headers.forEach(function(Y,q){B.setRequestHeader(q,Y)}):Object.getOwnPropertyNames(f.headers).forEach(function(Y){B.setRequestHeader(Y,te(f.headers[Y]))}),L.signal&&(L.signal.addEventListener("abort",$),B.onreadystatechange=function(){B.readyState===4&&L.signal.removeEventListener("abort",$)}),B.send(L._bodyInit===void 0?null:L._bodyInit)})}m.polyfill=!0,y.fetch||(y.fetch=m,y.Headers=oe,y.Request=S,y.Response=d),h.Headers=oe,h.Request=S,h.Response=d,h.fetch=m})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var a=n.fetch?n:r;(t=a.fetch).default=a.fetch,t.fetch=a.fetch,t.Headers=a.Headers,t.Request=a.Request,t.Response=a.Response,e.exports=t})(U,U.exports);var ie=R(U.exports),ae=[],ke=[],He=typeof Uint8Array<"u"?Uint8Array:Array,tt=!1;function nt(){tt=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)ae[t]=e[t],ke[e.charCodeAt(t)]=t;ke[45]=62,ke[95]=63}function lt(e,t,n){for(var r,a,i=[],h=t;h>18&63]+ae[a>>12&63]+ae[a>>6&63]+ae[63&a]);return i.join("")}function jt(e){var t;tt||nt();for(var n=e.length,r=n%3,a="",i=[],h=16383,y=0,k=n-r;yk?k:y+h));return r===1?(t=e[n-1],a+=ae[t>>2],a+=ae[t<<4&63],a+="=="):r===2&&(t=(e[n-2]<<8)+e[n-1],a+=ae[t>>10],a+=ae[t>>4&63],a+=ae[t<<2&63],a+="="),i.push(a),i.join("")}function Zt(e,t,n,r,a){var i,h,y=8*a-r-1,k=(1<>1,M=-7,C=n?a-1:0,O=n?-1:1,z=e[t+C];for(C+=O,i=z&(1<<-M)-1,z>>=-M,M+=y;M>0;i=256*i+e[t+C],C+=O,M-=8);for(h=i&(1<<-M)-1,i>>=-M,M+=r;M>0;h=256*h+e[t+C],C+=O,M-=8);if(i===0)i=1-E;else{if(i===k)return h?NaN:1/0*(z?-1:1);h+=Math.pow(2,r),i-=E}return(z?-1:1)*h*Math.pow(2,i-r)}function nn(e,t,n,r,a,i){var h,y,k,E=8*i-a-1,M=(1<>1,O=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=r?0:i-1,H=r?1:-1,ee=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(y=isNaN(t)?1:0,h=M):(h=Math.floor(Math.log(t)/Math.LN2),t*(k=Math.pow(2,-h))<1&&(h--,k*=2),(t+=h+C>=1?O/k:O*Math.pow(2,1-C))*k>=2&&(h++,k/=2),h+C>=M?(y=0,h=M):h+C>=1?(y=(t*k-1)*Math.pow(2,a),h+=C):(y=t*Math.pow(2,C-1)*Math.pow(2,a),h=0));a>=8;e[n+z]=255&y,z+=H,y/=256,a-=8);for(h=h<0;e[n+z]=255&h,z+=H,h/=256,E-=8);e[n+z-H]|=128*ee}var Lr={}.toString,Ye=Array.isArray||function(e){return Lr.call(e)=="[object Array]"};je.TYPED_ARRAY_SUPPORT=l.TYPED_ARRAY_SUPPORT===void 0||l.TYPED_ARRAY_SUPPORT;var Ke=et();function et(){return je.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function It(e,t){if(et()=et())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et().toString(16)+" bytes");return 0|e}function Ei(e){return!(e==null||!e._isBuffer)}function Pu(e,t){if(Ei(e))return e.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var n=e.length;if(n===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ki(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return qc(e).length;default:if(r)return ki(e).length;t=(""+t).toLowerCase(),r=!0}}function Pl(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Il(this,t,n);case"utf8":case"utf-8":return no(this,t,n);case"ascii":return Xa(this,t,n);case"latin1":case"binary":return Ou(this,t,n);case"base64":return Iu(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rh(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function Qa(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Aa(e,t,n,r,a){if(e.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if(typeof t=="string"&&(t=je.from(t,r)),Ei(t))return t.length===0?-1:Hc(e,t,n,r,a);if(typeof t=="number")return t&=255,je.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Hc(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function Hc(e,t,n,r,a){var i,h=1,y=e.length,k=t.length;if(r!==void 0&&((r=String(r).toLowerCase())==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(e.length<2||t.length<2)return-1;h=2,y/=2,k/=2,n/=2}function E(z,H){return h===1?z[H]:z.readUInt16BE(H*h)}if(a){var M=-1;for(i=n;iy&&(n=y-k),i=n;i>=0;i--){for(var C=!0,O=0;Oa&&(r=a):r=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var h=0;h>8,k=h%256,E.push(k),E.push(y);return E}(t,e.length-n),e,n,r)}function Iu(e,t,n){return t===0&&n===e.length?jt(e):jt(e.slice(t,n))}function no(e,t,n){n=Math.min(e.length,n);for(var r=[],a=t;a239?4:E>223?3:E>191?2:1;if(a+C<=n)switch(C){case 1:E<128&&(M=E);break;case 2:(192&(i=e[a+1]))==128&&(k=(31&E)<<6|63&i)>127&&(M=k);break;case 3:i=e[a+1],h=e[a+2],(192&i)==128&&(192&h)==128&&(k=(15&E)<<12|(63&i)<<6|63&h)>2047&&(k<55296||k>57343)&&(M=k);break;case 4:i=e[a+1],h=e[a+2],y=e[a+3],(192&i)==128&&(192&h)==128&&(192&y)==128&&(k=(15&E)<<18|(63&i)<<12|(63&h)<<6|63&y)>65535&&k<1114112&&(M=k)}M===null?(M=65533,C=1):M>65535&&(M-=65536,r.push(M>>>10&1023|55296),M=56320|1023&M),r.push(M),a+=C}return function(O){var z=O.length;if(z<=Lu)return String.fromCharCode.apply(String,O);for(var H="",ee=0;ee0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},je.prototype.compare=function(e,t,n,r,a){if(!Ei(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),a===void 0&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(a>>>=0)-(r>>>=0),h=(n>>>=0)-(t>>>=0),y=Math.min(i,h),k=this.slice(r,a),E=e.slice(t,n),M=0;Ma)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return go(this,e,t,n);case"utf8":case"utf-8":return hn(this,e,t,n);case"ascii":return Zn(this,e,t,n);case"latin1":case"binary":return ur(this,e,t,n);case"base64":return fr(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _r(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},je.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Lu=4096;function Xa(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;ar)&&(n=r);for(var a="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function Mo(e,t,n,r,a,i){if(!Ei(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function $c(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-n,2);a>>8*(r?a:1-a)}function nu(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-n,4);a>>8*(r?a:3-a)&255}function Kn(e,t,n,r,a,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function hr(e,t,n,r,a){return a||Kn(e,0,n,4),nn(e,t,n,r,23,4),n+4}function xr(e,t,n,r,a){return a||Kn(e,0,n,8),nn(e,t,n,r,52,8),n+8}je.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=t===void 0?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)r+=this[e+--t]*a;return r},je.prototype.readUInt8=function(e,t){return t||zi(e,1,this.length),this[e]},je.prototype.readUInt16LE=function(e,t){return t||zi(e,2,this.length),this[e]|this[e+1]<<8},je.prototype.readUInt16BE=function(e,t){return t||zi(e,2,this.length),this[e]<<8|this[e+1]},je.prototype.readUInt32LE=function(e,t){return t||zi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},je.prototype.readUInt32BE=function(e,t){return t||zi(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},je.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||zi(e,t,this.length);for(var r=this[e],a=1,i=0;++i=(a*=128)&&(r-=Math.pow(2,8*t)),r},je.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||zi(e,t,this.length);for(var r=t,a=1,i=this[e+--r];r>0&&(a*=256);)i+=this[e+--r]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},je.prototype.readInt8=function(e,t){return t||zi(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},je.prototype.readInt16LE=function(e,t){t||zi(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},je.prototype.readInt16BE=function(e,t){t||zi(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},je.prototype.readInt32LE=function(e,t){return t||zi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},je.prototype.readInt32BE=function(e,t){return t||zi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},je.prototype.readFloatLE=function(e,t){return t||zi(e,4,this.length),Zt(this,e,!0,23,4)},je.prototype.readFloatBE=function(e,t){return t||zi(e,4,this.length),Zt(this,e,!1,23,4)},je.prototype.readDoubleLE=function(e,t){return t||zi(e,8,this.length),Zt(this,e,!0,52,8)},je.prototype.readDoubleBE=function(e,t){return t||zi(e,8,this.length),Zt(this,e,!1,52,8)},je.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||Mo(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+n},je.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,1,255,0),je.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},je.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,2,65535,0),je.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):$c(this,e,t,!0),t+2},je.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,2,65535,0),je.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):$c(this,e,t,!1),t+2},je.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,4,4294967295,0),je.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):nu(this,e,t,!0),t+4},je.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,4,4294967295,0),je.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):nu(this,e,t,!1),t+4},je.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Mo(this,e,t,n,a-1,-a)}var i=0,h=1,y=0;for(this[t]=255&e;++i>0)-y&255;return t+n},je.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Mo(this,e,t,n,a-1,-a)}var i=n-1,h=1,y=0;for(this[t+i]=255&e;--i>=0&&(h*=256);)e<0&&y===0&&this[t+i+1]!==0&&(y=1),this[t+i]=(e/h>>0)-y&255;return t+n},je.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,1,127,-128),je.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},je.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,2,32767,-32768),je.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):$c(this,e,t,!0),t+2},je.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,2,32767,-32768),je.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):$c(this,e,t,!1),t+2},je.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,4,2147483647,-2147483648),je.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):nu(this,e,t,!0),t+4},je.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Mo(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),je.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):nu(this,e,t,!1),t+4},je.prototype.writeFloatLE=function(e,t,n){return hr(this,e,t,!0,n)},je.prototype.writeFloatBE=function(e,t,n){return hr(this,e,t,!1,n)},je.prototype.writeDoubleLE=function(e,t,n){return xr(this,e,t,!0,n)},je.prototype.writeDoubleBE=function(e,t,n){return xr(this,e,t,!1,n)},je.prototype.copy=function(e,t,n,r){if(n||(n=0),r||r===0||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--a)e[a+t]=this[a+n];else if(i<1e3||!je.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,n=n===void 0?this.length:n>>>0,e||(e=0),typeof e=="number")for(i=t;i55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(h+1===r){(t-=3)>-1&&i.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function qc(e){return function(t){var n,r,a,i,h,y;tt||nt();var k=t.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");h=t[k-2]==="="?2:t[k-1]==="="?1:0,y=new He(3*k/4-h),a=h>0?k-4:k;var E=0;for(n=0,r=0;n>16&255,y[E++]=i>>8&255,y[E++]=255&i;return h===2?(i=ke[t.charCodeAt(n)]<<2|ke[t.charCodeAt(n+1)]>>4,y[E++]=255&i):h===1&&(i=ke[t.charCodeAt(n)]<<10|ke[t.charCodeAt(n+1)]<<4|ke[t.charCodeAt(n+2)]>>2,y[E++]=i>>8&255,y[E++]=255&i),y}(function(t){if((t=function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}(t).replace(zr,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(e))}function ru(e,t,n,r){for(var a=0;a=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function di(e){return e!=null&&(!!e._isBuffer||Wc(e)||function(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&Wc(t.slice(0,0))}(e))}function Wc(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}var Nu=Object.freeze({__proto__:null,Buffer:je,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),je.alloc(+e)},isBuffer:di,kMaxLength:Ke}),Fo={},Ph={},ge={},G=D(Nu),Q={};function Re(){throw new Error("setTimeout has not been defined")}function Ge(){throw new Error("clearTimeout has not been defined")}var st=Re,St=Ge;function vr(e){if(st===setTimeout)return setTimeout(e,0);if((st===Re||!st)&&setTimeout)return st=setTimeout,setTimeout(e,0);try{return st(e,0)}catch{try{return st.call(null,e,0)}catch{return st.call(this,e,0)}}}typeof l.setTimeout=="function"&&(st=setTimeout),typeof l.clearTimeout=="function"&&(St=clearTimeout);var ti,Or=[],si=!1,$r=-1;function E$(){si&&ti&&(si=!1,ti.length?Or=ti.concat(Or):$r=-1,Or.length&&AT())}function AT(){if(!si){var e=vr(E$);si=!0;for(var t=Or.length;t;){for(ti=Or,Or=[];++$r1)for(var n=1;nL$)throw new RangeError("requested too many random bytes");var n=O$.allocUnsafe(e);if(e>0)if(e>wE)for(var r=0;r0&&h.length>a){h.warned=!0;var y=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");y.name="MaxListenersExceededWarning",y.emitter=e,y.type=t,y.count=h.length,function(k){typeof console.warn=="function"?console.warn(k):console.log(k)}(y)}}else h=i[t]=n,++e._eventsCount;return e}function LT(e,t,n){var r=!1;function a(){e.removeListener(t,a),r||(r=!0,n.apply(e,arguments))}return a.listener=n,a}function OT(e){var t=this._events;if(t){var n=t[e];if(typeof n=="function")return 1;if(n)return n.length}return 0}function Kv(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}Ih.prototype=Object.create(null),Sr.EventEmitter=Sr,Sr.usingDomains=!1,Sr.prototype.domain=void 0,Sr.prototype._events=void 0,Sr.prototype._maxListeners=void 0,Sr.defaultMaxListeners=10,Sr.init=function(){this.domain=null,Sr.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Ih,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Sr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Sr.prototype.getMaxListeners=function(){return PT(this)},Sr.prototype.emit=function(e){var t,n,r,a,i,h,y,k=e==="error";if(h=this._events)k=k&&h.error==null;else if(!k)return!1;if(y=this.domain,k){if(t=arguments[1],!y){if(t instanceof Error)throw t;var E=new Error('Uncaught, unspecified "error" event. ('+t+")");throw E.context=t,E}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=y,t.domainThrown=!1,y.emit("error",t),!1}if(!(n=h[e]))return!1;var M=typeof n=="function";switch(r=arguments.length){case 1:(function(C,O,z){if(O)C.call(z);else for(var H=C.length,ee=Kv(C,H),te=0;te0;)if(n[i]===t||n[i].listener&&n[i].listener===t){h=n[i].listener,a=i;break}if(a<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount==0)return this._events=new Ih,this;delete r[e]}else(function(y,k){for(var E=k,M=E+1,C=y.length;M0?Reflect.ownKeys(this._events):[]};var EE=D(Object.freeze({__proto__:null,EventEmitter:Sr,default:Sr})),NT=EE.EventEmitter,Lh=typeof Object.create=="function"?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},N$=/%[sdj%]/g;function I8(e){if(!$v(e)){for(var t=[],n=0;n=a)return y;switch(y){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return y}}),h=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),D8(t)?n.showHidden=t:t&&IE(n,t),Yc(n.showHidden)&&(n.showHidden=!1),Yc(n.depth)&&(n.depth=2),Yc(n.colors)&&(n.colors=!1),Yc(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=D$),N8(n,e,n.depth)}function D$(e,t){var n=Vc.styles[t];return n?"\x1B["+Vc.colors[n][0]+"m"+e+"\x1B["+Vc.colors[n][1]+"m":e}function B$(e,t){return e}function N8(e,t,n){if(e.customInspect&&t&&Vv(t.inspect)&&t.inspect!==Vc&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return $v(r)||(r=N8(e,r,n)),r}var a=function(O,z){if(Yc(z))return O.stylize("undefined","undefined");if($v(z)){var H="'"+JSON.stringify(z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return O.stylize(H,"string")}return TE(z)?O.stylize(""+z,"number"):D8(z)?O.stylize(""+z,"boolean"):Hv(z)?O.stylize("null","null"):void 0}(e,t);if(a)return a;var i=Object.keys(t),h=function(O){var z={};return O.forEach(function(H,ee){z[H]=!0}),z}(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(t)),Wv(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return CE(t);if(i.length===0){if(Vv(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(qv(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(B8(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Wv(t))return CE(t)}var k,E="",M=!1,C=["{","}"];return AE(t)&&(M=!0,C=["[","]"]),Vv(t)&&(E=" [Function"+(t.name?": "+t.name:"")+"]"),qv(t)&&(E=" "+RegExp.prototype.toString.call(t)),B8(t)&&(E=" "+Date.prototype.toUTCString.call(t)),Wv(t)&&(E=" "+CE(t)),i.length!==0||M&&t.length!=0?n<0?qv(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),k=M?function(O,z,H,ee,te){for(var se=[],oe=0,Ee=z.length;oe60?H[0]+(z===""?"":z+` + `)+" "+O.join(`, + `)+" "+H[1]:H[0]+z+" "+O.join(", ")+" "+H[1]}(k,E,C)):C[0]+E+C[1]}function CE(e){return"["+Error.prototype.toString.call(e)+"]"}function xE(e,t,n,r,a,i){var h,y,k;if((k=Object.getOwnPropertyDescriptor(t,a)||{value:t[a]}).get?y=k.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):k.set&&(y=e.stylize("[Setter]","special")),UT(r,a)||(h="["+a+"]"),y||(e.seen.indexOf(k.value)<0?(y=Hv(n)?N8(e,k.value,null):N8(e,k.value,n-1)).indexOf(` +`)>-1&&(y=i?y.split(` +`).map(function(E){return" "+E}).join(` +`).substr(2):` +`+y.split(` +`).map(function(E){return" "+E}).join(` +`)):y=e.stylize("[Circular]","special")),Yc(h)){if(i&&a.match(/^\d+$/))return y;(h=JSON.stringify(""+a)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=e.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=e.stylize(h,"string"))}return h+": "+y}function AE(e){return Array.isArray(e)}function D8(e){return typeof e=="boolean"}function Hv(e){return e===null}function DT(e){return e==null}function TE(e){return typeof e=="number"}function $v(e){return typeof e=="string"}function BT(e){return typeof e=="symbol"}function Yc(e){return e===void 0}function qv(e){return Rp(e)&&RE(e)==="[object RegExp]"}function Rp(e){return typeof e=="object"&&e!==null}function B8(e){return Rp(e)&&RE(e)==="[object Date]"}function Wv(e){return Rp(e)&&(RE(e)==="[object Error]"||e instanceof Error)}function Vv(e){return typeof e=="function"}function zT(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||e===void 0}function FT(e){return di(e)}function RE(e){return Object.prototype.toString.call(e)}function PE(e){return e<10?"0"+e.toString(10):e.toString(10)}Vc.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Vc.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var z$=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jT(){console.log("%s - %s",function(){var e=new Date,t=[PE(e.getHours()),PE(e.getMinutes()),PE(e.getSeconds())].join(":");return[e.getDate(),z$[e.getMonth()],t].join(" ")}(),I8.apply(null,arguments))}function IE(e,t){if(!t||!Rp(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function UT(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var LE,KT,F$={inherits:Lh,_extend:IE,log:jT,isBuffer:FT,isPrimitive:zT,isFunction:Vv,isError:Wv,isDate:B8,isObject:Rp,isRegExp:qv,isUndefined:Yc,isSymbol:BT,isString:$v,isNumber:TE,isNullOrUndefined:DT,isNull:Hv,isBoolean:D8,isArray:AE,inspect:Vc,deprecate:L8,format:I8,debuglog:ME},HT=D(Object.freeze({__proto__:null,_extend:IE,debuglog:ME,default:F$,deprecate:L8,format:I8,inherits:Lh,inspect:Vc,isArray:AE,isBoolean:D8,isBuffer:FT,isDate:B8,isError:Wv,isFunction:Vv,isNull:Hv,isNullOrUndefined:DT,isNumber:TE,isObject:Rp,isPrimitive:zT,isRegExp:qv,isString:$v,isSymbol:BT,isUndefined:Yc,log:jT}));function j$(){if(KT)return LE;function e(k,E){var M=Object.keys(k);if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(k);E&&(C=C.filter(function(O){return Object.getOwnPropertyDescriptor(k,O).enumerable})),M.push.apply(M,C)}return M}function t(k){for(var E=1;E0?this.tail.next=O:this.head=O,this.tail=O,++this.length}},{key:"unshift",value:function(C){var O={data:C,next:this.head};this.length===0&&(this.tail=O),this.head=O,++this.length}},{key:"shift",value:function(){if(this.length!==0){var C=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,C}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(C){if(this.length===0)return"";for(var O=this.head,z=""+O.data;O=O.next;)z+=C+O.data;return z}},{key:"concat",value:function(C){if(this.length===0)return i.alloc(0);for(var O,z,H,ee=i.allocUnsafe(C>>>0),te=this.head,se=0;te;)O=te.data,z=ee,H=se,i.prototype.copy.call(O,z,H),se+=te.data.length,te=te.next;return ee}},{key:"consume",value:function(C,O){var z;return Cee.length?ee.length:C;if(te===ee.length?H+=ee:H+=ee.slice(0,C),(C-=te)==0){te===ee.length?(++z,O.next?this.head=O.next:this.head=this.tail=null):(this.head=O,O.data=ee.slice(te));break}++z}return this.length-=z,H}},{key:"_getBuffer",value:function(C){var O=i.allocUnsafe(C),z=this.head,H=1;for(z.data.copy(O),C-=z.data.length;z=z.next;){var ee=z.data,te=C>ee.length?ee.length:C;if(ee.copy(O,O.length-C,0,te),(C-=te)==0){te===ee.length?(++H,z.next?this.head=z.next:this.head=this.tail=null):(this.head=z,z.data=ee.slice(te));break}++H}return this.length-=H,O}},{key:y,value:function(C,O){return h(this,t(t({},O),{},{depth:0,customInspect:!1}))}}],M&&r(E.prototype,M),Object.defineProperty(E,"prototype",{writable:!1}),k}(),LE}function $T(e,t){OE(e,t),z8(e)}function z8(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function OE(e,t){e.emit("error",t)}var qT={destroy:function(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return r||a?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pr(OE,this,e)):pr(OE,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(i){!t&&i?n._writableState?n._writableState.errorEmitted?pr(z8,n):(n._writableState.errorEmitted=!0,pr($T,n,i)):pr($T,n,i):t?(pr(z8,n),t(i)):pr(z8,n)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Pp={},WT={};function Du(e,t,n){n||(n=Error);var r=function(a){var i,h;function y(k,E,M){return a.call(this,function(C,O,z){return typeof t=="string"?t:t(C,O,z)}(k,E,M))||this}return h=a,(i=y).prototype=Object.create(h.prototype),i.prototype.constructor=i,i.__proto__=h,y}(n);r.prototype.name=n.name,r.prototype.code=e,WT[e]=r}function VT(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(r){return String(r)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:n===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}Du("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),Du("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,a,i;if(typeof t=="string"&&(a="not ",t.substr(0,a.length)===a)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(y,k,E){return(E===void 0||E>y.length)&&(E=y.length),y.substring(E-k.length,E)===k}(e," argument"))i="The ".concat(e," ").concat(r," ").concat(VT(t,"type"));else{var h=function(y,k,E){return typeof E!="number"&&(E=0),!(E+k.length>y.length)&&y.indexOf(k,E)!==-1}(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(h," ").concat(r," ").concat(VT(t,"type"))}return i+". Received type ".concat(typeof n)},TypeError),Du("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Du("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),Du("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Du("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),Du("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Du("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Du("ERR_STREAM_WRITE_AFTER_END","write after end"),Du("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Du("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),Du("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Pp.codes=WT;var NE,YT,DE,GT,U$=Pp.codes.ERR_INVALID_OPT_VALUE,ZT={getHighWaterMark:function(e,t,n,r){var a=function(i,h,y){return i.highWaterMark!=null?i.highWaterMark:h?i[y]:null}(t,r,n);if(a!=null){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new U$(r?n:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}},K$=function(e,t){if(BE("noDeprecation"))return e;var n=!1;return function(){if(!n){if(BE("throwDeprecation"))throw new Error(t);BE("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}};function BE(e){try{if(!b.localStorage)return!1}catch{return!1}var t=b.localStorage[e];return t!=null&&String(t).toLowerCase()==="true"}function QT(){if(YT)return NE;function e(g){var m=this;this.next=null,this.entry=null,this.finish=function(){(function(p,f,_){var T=p.entry;for(p.entry=null;T;){var L=T.callback;f.pendingcb--,L(_),T=T.next}f.corkedRequestsFree.next=p})(m,g)}}var t;YT=1,NE=Ce,Ce.WritableState=we;var n,r={deprecate:K$},a=NT,i=G.Buffer,h=(b!==void 0?b:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},y=qT,k=ZT.getHighWaterMark,E=Pp.codes,M=E.ERR_INVALID_ARG_TYPE,C=E.ERR_METHOD_NOT_IMPLEMENTED,O=E.ERR_MULTIPLE_CALLBACK,z=E.ERR_STREAM_CANNOT_PIPE,H=E.ERR_STREAM_DESTROYED,ee=E.ERR_STREAM_NULL_VALUES,te=E.ERR_STREAM_WRITE_AFTER_END,se=E.ERR_UNKNOWN_ENCODING,oe=y.errorOrDestroy;function Ee(){}function we(g,m,p){t=t||jm(),g=g||{},typeof p!="boolean"&&(p=m instanceof t),this.objectMode=!!g.objectMode,p&&(this.objectMode=this.objectMode||!!g.writableObjectMode),this.highWaterMark=k(this,g,"writableHighWaterMark",p),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=g.decodeStrings===!1;this.decodeStrings=!f,this.defaultEncoding=g.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(_){(function(T,L){var B=T._writableState,$=B.sync,Y=B.writecb;if(typeof Y!="function")throw new O;if(function(F){F.writing=!1,F.writecb=null,F.length-=F.writelen,F.writelen=0}(B),L)(function(F,K,Z,ne,ue){--K.pendingcb,Z?(pr(ue,ne),pr(d,F,K),F._writableState.errorEmitted=!0,oe(F,ne)):(ue(ne),F._writableState.errorEmitted=!0,oe(F,ne),d(F,K))})(T,B,$,L,Y);else{var q=S(B)||T.destroyed;q||B.corked||B.bufferProcessing||!B.bufferedRequest||$e(T,B),$?pr(Fe,T,B,q,Y):Fe(T,B,q,Y)}})(m,_)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function Ce(g){var m=this instanceof(t=t||jm());if(!m&&!n.call(Ce,this))return new Ce(g);this._writableState=new we(g,this,m),this.writable=!0,g&&(typeof g.write=="function"&&(this._write=g.write),typeof g.writev=="function"&&(this._writev=g.writev),typeof g.destroy=="function"&&(this._destroy=g.destroy),typeof g.final=="function"&&(this._final=g.final)),a.call(this)}function ze(g,m,p,f,_,T,L){m.writelen=f,m.writecb=L,m.writing=!0,m.sync=!0,m.destroyed?m.onwrite(new H("write")):p?g._writev(_,m.onwrite):g._write(_,T,m.onwrite),m.sync=!1}function Fe(g,m,p,f){p||function(_,T){T.length===0&&T.needDrain&&(T.needDrain=!1,_.emit("drain"))}(g,m),m.pendingcb--,f(),d(g,m)}function $e(g,m){m.bufferProcessing=!0;var p=m.bufferedRequest;if(g._writev&&p&&p.next){var f=m.bufferedRequestCount,_=new Array(f),T=m.corkedRequestsFree;T.entry=p;for(var L=0,B=!0;p;)_[L]=p,p.isBuf||(B=!1),p=p.next,L+=1;_.allBuffers=B,ze(g,m,!0,m.length,_,"",T.finish),m.pendingcb++,m.lastBufferedRequest=null,T.next?(m.corkedRequestsFree=T.next,T.next=null):m.corkedRequestsFree=new e(m),m.bufferedRequestCount=0}else{for(;p;){var $=p.chunk,Y=p.encoding,q=p.callback;if(ze(g,m,!1,m.objectMode?1:$.length,$,Y,q),p=p.next,m.bufferedRequestCount--,m.writing)break}p===null&&(m.lastBufferedRequest=null)}m.bufferedRequest=p,m.bufferProcessing=!1}function S(g){return g.ending&&g.length===0&&g.bufferedRequest===null&&!g.finished&&!g.writing}function P(g,m){g._final(function(p){m.pendingcb--,p&&oe(g,p),m.prefinished=!0,g.emit("prefinish"),d(g,m)})}function d(g,m){var p=S(m);if(p&&(function(_,T){T.prefinished||T.finalCalled||(typeof _._final!="function"||T.destroyed?(T.prefinished=!0,_.emit("prefinish")):(T.pendingcb++,T.finalCalled=!0,pr(P,_,T)))}(g,m),m.pendingcb===0&&(m.finished=!0,g.emit("finish"),m.autoDestroy))){var f=g._readableState;(!f||f.autoDestroy&&f.endEmitted)&&g.destroy()}return p}return wr(Ce,a),we.prototype.getBuffer=function(){for(var g=this.bufferedRequest,m=[];g;)m.push(g),g=g.next;return m},function(){try{Object.defineProperty(we.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(Ce,Symbol.hasInstance,{value:function(g){return!!n.call(this,g)||this===Ce&&g&&g._writableState instanceof we}})):n=function(g){return g instanceof this},Ce.prototype.pipe=function(){oe(this,new z)},Ce.prototype.write=function(g,m,p){var f,_=this._writableState,T=!1,L=!_.objectMode&&(f=g,i.isBuffer(f)||f instanceof h);return L&&!i.isBuffer(g)&&(g=function(B){return i.from(B)}(g)),typeof m=="function"&&(p=m,m=null),L?m="buffer":m||(m=_.defaultEncoding),typeof p!="function"&&(p=Ee),_.ending?function(B,$){var Y=new te;oe(B,Y),pr($,Y)}(this,p):(L||function(B,$,Y,q){var F;return Y===null?F=new ee:typeof Y=="string"||$.objectMode||(F=new M("chunk",["string","Buffer"],Y)),!F||(oe(B,F),pr(q,F),!1)}(this,_,g,p))&&(_.pendingcb++,T=function(B,$,Y,q,F,K){if(!Y){var Z=function(fe,De,_e){return fe.objectMode||fe.decodeStrings===!1||typeof De!="string"||(De=i.from(De,_e)),De}($,q,F);q!==Z&&(Y=!0,F="buffer",q=Z)}var ne=$.objectMode?1:q.length;$.length+=ne;var ue=$.length<$.highWaterMark;if(ue||($.needDrain=!0),$.writing||$.corked){var me=$.lastBufferedRequest;$.lastBufferedRequest={chunk:q,encoding:F,isBuf:Y,callback:K,next:null},me?me.next=$.lastBufferedRequest:$.bufferedRequest=$.lastBufferedRequest,$.bufferedRequestCount+=1}else ze(B,$,!1,ne,q,F,K);return ue}(this,_,L,g,m,p)),T},Ce.prototype.cork=function(){this._writableState.corked++},Ce.prototype.uncork=function(){var g=this._writableState;g.corked&&(g.corked--,g.writing||g.corked||g.bufferProcessing||!g.bufferedRequest||$e(this,g))},Ce.prototype.setDefaultEncoding=function(g){if(typeof g=="string"&&(g=g.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((g+"").toLowerCase())>-1))throw new se(g);return this._writableState.defaultEncoding=g,this},Object.defineProperty(Ce.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Ce.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Ce.prototype._write=function(g,m,p){p(new C("_write()"))},Ce.prototype._writev=null,Ce.prototype.end=function(g,m,p){var f=this._writableState;return typeof g=="function"?(p=g,g=null,m=null):typeof m=="function"&&(p=m,m=null),g!=null&&this.write(g,m),f.corked&&(f.corked=1,this.uncork()),f.ending||function(_,T,L){T.ending=!0,d(_,T),L&&(T.finished?pr(L):_.once("finish",L)),T.ended=!0,_.writable=!1}(this,f,p),this},Object.defineProperty(Ce.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(Ce.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(g){this._writableState&&(this._writableState.destroyed=g)}}),Ce.prototype.destroy=y.destroy,Ce.prototype._undestroy=y.undestroy,Ce.prototype._destroy=function(g,m){m(g)},NE}function jm(){if(GT)return DE;GT=1;var e=Object.keys||function(E){var M=[];for(var C in E)M.push(C);return M};DE=h;var t=oR(),n=QT();wr(h,t);for(var r=e(n.prototype),a=0;a>5==6?2:C>>4==14?3:C>>3==30?4:C>>6==2?-1:-2}function a(C){var O=this.lastTotal-this.lastNeed,z=function(H,ee,te){if((192&ee[0])!=128)return H.lastNeed=0,"�";if(H.lastNeed>1&&ee.length>1){if((192&ee[1])!=128)return H.lastNeed=1,"�";if(H.lastNeed>2&&ee.length>2&&(192&ee[2])!=128)return H.lastNeed=2,"�"}}(this,C);return z!==void 0?z:this.lastNeed<=C.length?(C.copy(this.lastChar,O,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(C.copy(this.lastChar,O,0,C.length),void(this.lastNeed-=C.length))}function i(C,O){if((C.length-O)%2==0){var z=C.toString("utf16le",O);if(z){var H=z.charCodeAt(z.length-1);if(H>=55296&&H<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1],z.slice(0,-1)}return z}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=C[C.length-1],C.toString("utf16le",O,C.length-1)}function h(C){var O=C&&C.length?this.write(C):"";if(this.lastNeed){var z=this.lastTotal-this.lastNeed;return O+this.lastChar.toString("utf16le",0,z)}return O}function y(C,O){var z=(C.length-O)%3;return z===0?C.toString("base64",O):(this.lastNeed=3-z,this.lastTotal=3,z===1?this.lastChar[0]=C[C.length-1]:(this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1]),C.toString("base64",O,C.length-z))}function k(C){var O=C&&C.length?this.write(C):"";return this.lastNeed?O+this.lastChar.toString("base64",0,3-this.lastNeed):O}function E(C){return C.toString(this.encoding)}function M(C){return C&&C.length?this.write(C):""}return zE.StringDecoder=n,n.prototype.write=function(C){if(C.length===0)return"";var O,z;if(this.lastNeed){if((O=this.fillLast(C))===void 0)return"";z=this.lastNeed,this.lastNeed=0}else z=0;return z=0?(Ee>0&&(ee.lastNeed=Ee-1),Ee):--oe=0?(Ee>0&&(ee.lastNeed=Ee-2),Ee):--oe=0?(Ee>0&&(Ee===2?Ee=0:ee.lastNeed=Ee-3),Ee):0}(this,C,O);if(!this.lastNeed)return C.toString("utf8",O);this.lastTotal=z;var H=C.length-(z-this.lastNeed);return C.copy(this.lastChar,0,H),C.toString("utf8",O,H)},n.prototype.fillLast=function(C){if(this.lastNeed<=C.length)return C.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);C.copy(this.lastChar,this.lastTotal-this.lastNeed,0,C.length),this.lastNeed-=C.length},zE}var eR=Pp.codes.ERR_STREAM_PREMATURE_CLOSE;function H$(){}var FE,tR,nR,rR,jE,iR,UE=function e(t,n,r){if(typeof n=="function")return e(t,null,n);n||(n={}),r=function(H){var ee=!1;return function(){if(!ee){ee=!0;for(var te=arguments.length,se=new Array(te),oe=0;oe0)if(typeof F=="string"||me.objectMode||Object.getPrototypeOf(F)===a.prototype||(F=function(fe){return a.from(fe)}(F)),Z)me.endEmitted?oe(q,new se):Fe(q,me,F,!0);else if(me.ended)oe(q,new ee);else{if(me.destroyed)return!1;me.reading=!1,me.decoder&&!K?(F=me.decoder.write(F),me.objectMode||F.length!==0?Fe(q,me,F,!1):g(q,me)):Fe(q,me,F,!1)}else Z||(me.reading=!1,g(q,me));return!me.ended&&(me.lengthF.highWaterMark&&(F.highWaterMark=function(K){return K>=$e?K=$e:(K--,K|=K>>>1,K|=K>>>2,K|=K>>>4,K|=K>>>8,K|=K>>>16,K++),K}(q)),q<=F.length?q:F.ended?F.length:(F.needReadable=!0,0))}function P(q){var F=q._readableState;t("emitReadable",F.needReadable,F.emittedReadable),F.needReadable=!1,F.emittedReadable||(t("emitReadable",F.flowing),F.emittedReadable=!0,pr(d,q))}function d(q){var F=q._readableState;t("emitReadable_",F.destroyed,F.length,F.ended),F.destroyed||!F.length&&!F.ended||(q.emit("readable"),F.emittedReadable=!1),F.needReadable=!F.flowing&&!F.ended&&F.length<=F.highWaterMark,T(q)}function g(q,F){F.readingMore||(F.readingMore=!0,pr(m,q,F))}function m(q,F){for(;!F.reading&&!F.ended&&(F.length0,F.resumeScheduled&&!F.paused?F.flowing=!0:q.listenerCount("data")>0&&q.resume()}function f(q){t("readable nexttick read 0"),q.read(0)}function _(q,F){t("resume",F.reading),F.reading||q.read(0),F.resumeScheduled=!1,q.emit("resume"),T(q),F.flowing&&!F.reading&&q.read(0)}function T(q){var F=q._readableState;for(t("flow",F.flowing);F.flowing&&q.read()!==null;);}function L(q,F){return F.length===0?null:(F.objectMode?K=F.buffer.shift():!q||q>=F.length?(K=F.decoder?F.buffer.join(""):F.buffer.length===1?F.buffer.first():F.buffer.concat(F.length),F.buffer.clear()):K=F.buffer.consume(q,F.decoder),K);var K}function B(q){var F=q._readableState;t("endReadable",F.endEmitted),F.endEmitted||(F.ended=!0,pr($,F,q))}function $(q,F){if(t("endReadableNT",q.endEmitted,q.length),!q.endEmitted&&q.length===0&&(q.endEmitted=!0,F.readable=!1,F.emit("end"),q.autoDestroy)){var K=F._writableState;(!K||K.autoDestroy&&K.finished)&&F.destroy()}}function Y(q,F){for(var K=0,Z=q.length;K=F.highWaterMark:F.length>0)||F.ended))return t("read: emitReadable",F.length,F.ended),F.length===0&&F.ended?B(this):P(this),null;if((q=S(q,F))===0&&F.ended)return F.length===0&&B(this),null;var Z,ne=F.needReadable;return t("need readable",ne),(F.length===0||F.length-q0?L(q,F):null)===null?(F.needReadable=F.length<=F.highWaterMark,q=0):(F.length-=q,F.awaitDrain=0),F.length===0&&(F.ended||(F.needReadable=!0),K!==q&&F.ended&&B(this)),Z!==null&&this.emit("data",Z),Z},Ce.prototype._read=function(q){oe(this,new te("_read()"))},Ce.prototype.pipe=function(q,F){var K=this,Z=this._readableState;switch(Z.pipesCount){case 0:Z.pipes=q;break;case 1:Z.pipes=[Z.pipes,q];break;default:Z.pipes.push(q)}Z.pipesCount+=1,t("pipe count=%d opts=%j",Z.pipesCount,F);var ne=F&&F.end===!1||q===mi.stdout||q===mi.stderr?Ae:me;function ue(qe,Xe){t("onunpipe"),qe===K&&Xe&&Xe.hasUnpiped===!1&&(Xe.hasUnpiped=!0,t("cleanup"),q.removeListener("close",ve),q.removeListener("finish",Se),q.removeListener("drain",fe),q.removeListener("error",pe),q.removeListener("unpipe",ue),K.removeListener("end",me),K.removeListener("end",Ae),K.removeListener("data",_e),De=!0,!Z.awaitDrain||q._writableState&&!q._writableState.needDrain||fe())}function me(){t("onend"),q.end()}Z.endEmitted?pr(ne):K.once("end",ne),q.on("unpipe",ue);var fe=function(qe){return function(){var Xe=qe._readableState;t("pipeOnDrain",Xe.awaitDrain),Xe.awaitDrain&&Xe.awaitDrain--,Xe.awaitDrain===0&&n(qe,"data")&&(Xe.flowing=!0,T(qe))}}(K);q.on("drain",fe);var De=!1;function _e(qe){t("ondata");var Xe=q.write(qe);t("dest.write",Xe),Xe===!1&&((Z.pipesCount===1&&Z.pipes===q||Z.pipesCount>1&&Y(Z.pipes,q)!==-1)&&!De&&(t("false write response, pause",Z.awaitDrain),Z.awaitDrain++),K.pause())}function pe(qe){t("onerror",qe),Ae(),q.removeListener("error",pe),n(q,"error")===0&&oe(q,qe)}function ve(){q.removeListener("finish",Se),Ae()}function Se(){t("onfinish"),q.removeListener("close",ve),Ae()}function Ae(){t("unpipe"),K.unpipe(q)}return K.on("data",_e),function(qe,Xe,Be){if(typeof qe.prependListener=="function")return qe.prependListener(Xe,Be);qe._events&&qe._events[Xe]?Array.isArray(qe._events[Xe])?qe._events[Xe].unshift(Be):qe._events[Xe]=[Be,qe._events[Xe]]:qe.on(Xe,Be)}(q,"error",pe),q.once("close",ve),q.once("finish",Se),q.emit("pipe",K),Z.flowing||(t("pipe resume"),K.resume()),q},Ce.prototype.unpipe=function(q){var F=this._readableState,K={hasUnpiped:!1};if(F.pipesCount===0)return this;if(F.pipesCount===1)return q&&q!==F.pipes||(q||(q=F.pipes),F.pipes=null,F.pipesCount=0,F.flowing=!1,q&&q.emit("unpipe",this,K)),this;if(!q){var Z=F.pipes,ne=F.pipesCount;F.pipes=null,F.pipesCount=0,F.flowing=!1;for(var ue=0;ue0,Z.flowing!==!1&&this.resume()):q==="readable"&&(Z.endEmitted||Z.readableListening||(Z.readableListening=Z.needReadable=!0,Z.flowing=!1,Z.emittedReadable=!1,t("on readable",Z.length,Z.reading),Z.length?P(this):Z.reading||pr(f,this))),K},Ce.prototype.addListener=Ce.prototype.on,Ce.prototype.removeListener=function(q,F){var K=r.prototype.removeListener.call(this,q,F);return q==="readable"&&pr(p,this),K},Ce.prototype.removeAllListeners=function(q){var F=r.prototype.removeAllListeners.apply(this,arguments);return q!=="readable"&&q!==void 0||pr(p,this),F},Ce.prototype.resume=function(){var q=this._readableState;return q.flowing||(t("resume"),q.flowing=!q.readableListening,function(F,K){K.resumeScheduled||(K.resumeScheduled=!0,pr(_,F,K))}(this,q)),q.paused=!1,this},Ce.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Ce.prototype.wrap=function(q){var F=this,K=this._readableState,Z=!1;for(var ne in q.on("end",function(){if(t("wrapped end"),K.decoder&&!K.ended){var me=K.decoder.end();me&&me.length&&F.push(me)}F.push(null)}),q.on("data",function(me){t("wrapped data"),K.decoder&&(me=K.decoder.write(me)),K.objectMode&&me==null||(K.objectMode||me&&me.length)&&(F.push(me)||(Z=!0,q.pause()))}),q)this[ne]===void 0&&typeof q[ne]=="function"&&(this[ne]=function(me){return function(){return q[me].apply(q,arguments)}}(ne));for(var ue=0;ue0,function(E){r||(r=E),E&&i.forEach(fR),k||(i.forEach(fR),a(r))})});return t.reduce(eq)};(function(e,t){(t=e.exports=oR()).Stream=t,t.Readable=t,t.Writable=QT(),t.Duplex=jm(),t.Transform=aR,t.PassThrough=Q$,t.finished=UE,t.pipeline=tq})(SE,SE.exports);var Oh=SE.exports,U8=br().Buffer,dR=Oh.Transform;function Nh(e){dR.call(this),this._block=U8.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}wr(Nh,dR),Nh.prototype._transform=function(e,t,n){var r=null;try{this.update(e,t)}catch(a){r=a}n(r)},Nh.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(n){t=n}e(t)},Nh.prototype.update=function(e,t){if(function(y,k){if(!U8.isBuffer(y)&&typeof y!="string")throw new TypeError(k+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");U8.isBuffer(e)||(e=U8.from(e,t));for(var n=this._block,r=0;this._blockOffset+e.length-r>=this._blockSize;){for(var a=this._blockOffset;a0;++i)this._length[i]+=h,(h=this._length[i]/4294967296|0)>0&&(this._length[i]-=4294967296*h);return this},Nh.prototype._update=function(){throw new Error("_update is not implemented")},Nh.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return t},Nh.prototype._digest=function(){throw new Error("_digest is not implemented")};var hR=Nh,nq=wr,pR=hR,rq=br().Buffer,iq=new Array(16);function K8(){pR.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function H8(e,t){return e<>>32-t}function Ta(e,t,n,r,a,i,h){return H8(e+(t&n|~t&r)+a+i|0,h)+t|0}function Ra(e,t,n,r,a,i,h){return H8(e+(t&r|n&~r)+a+i|0,h)+t|0}function Pa(e,t,n,r,a,i,h){return H8(e+(t^n^r)+a+i|0,h)+t|0}function Ia(e,t,n,r,a,i,h){return H8(e+(n^(t|~r))+a+i|0,h)+t|0}nq(K8,pR),K8.prototype._update=function(){for(var e=iq,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,r=this._b,a=this._c,i=this._d;n=Ta(n,r,a,i,e[0],3614090360,7),i=Ta(i,n,r,a,e[1],3905402710,12),a=Ta(a,i,n,r,e[2],606105819,17),r=Ta(r,a,i,n,e[3],3250441966,22),n=Ta(n,r,a,i,e[4],4118548399,7),i=Ta(i,n,r,a,e[5],1200080426,12),a=Ta(a,i,n,r,e[6],2821735955,17),r=Ta(r,a,i,n,e[7],4249261313,22),n=Ta(n,r,a,i,e[8],1770035416,7),i=Ta(i,n,r,a,e[9],2336552879,12),a=Ta(a,i,n,r,e[10],4294925233,17),r=Ta(r,a,i,n,e[11],2304563134,22),n=Ta(n,r,a,i,e[12],1804603682,7),i=Ta(i,n,r,a,e[13],4254626195,12),a=Ta(a,i,n,r,e[14],2792965006,17),n=Ra(n,r=Ta(r,a,i,n,e[15],1236535329,22),a,i,e[1],4129170786,5),i=Ra(i,n,r,a,e[6],3225465664,9),a=Ra(a,i,n,r,e[11],643717713,14),r=Ra(r,a,i,n,e[0],3921069994,20),n=Ra(n,r,a,i,e[5],3593408605,5),i=Ra(i,n,r,a,e[10],38016083,9),a=Ra(a,i,n,r,e[15],3634488961,14),r=Ra(r,a,i,n,e[4],3889429448,20),n=Ra(n,r,a,i,e[9],568446438,5),i=Ra(i,n,r,a,e[14],3275163606,9),a=Ra(a,i,n,r,e[3],4107603335,14),r=Ra(r,a,i,n,e[8],1163531501,20),n=Ra(n,r,a,i,e[13],2850285829,5),i=Ra(i,n,r,a,e[2],4243563512,9),a=Ra(a,i,n,r,e[7],1735328473,14),n=Pa(n,r=Ra(r,a,i,n,e[12],2368359562,20),a,i,e[5],4294588738,4),i=Pa(i,n,r,a,e[8],2272392833,11),a=Pa(a,i,n,r,e[11],1839030562,16),r=Pa(r,a,i,n,e[14],4259657740,23),n=Pa(n,r,a,i,e[1],2763975236,4),i=Pa(i,n,r,a,e[4],1272893353,11),a=Pa(a,i,n,r,e[7],4139469664,16),r=Pa(r,a,i,n,e[10],3200236656,23),n=Pa(n,r,a,i,e[13],681279174,4),i=Pa(i,n,r,a,e[0],3936430074,11),a=Pa(a,i,n,r,e[3],3572445317,16),r=Pa(r,a,i,n,e[6],76029189,23),n=Pa(n,r,a,i,e[9],3654602809,4),i=Pa(i,n,r,a,e[12],3873151461,11),a=Pa(a,i,n,r,e[15],530742520,16),n=Ia(n,r=Pa(r,a,i,n,e[2],3299628645,23),a,i,e[0],4096336452,6),i=Ia(i,n,r,a,e[7],1126891415,10),a=Ia(a,i,n,r,e[14],2878612391,15),r=Ia(r,a,i,n,e[5],4237533241,21),n=Ia(n,r,a,i,e[12],1700485571,6),i=Ia(i,n,r,a,e[3],2399980690,10),a=Ia(a,i,n,r,e[10],4293915773,15),r=Ia(r,a,i,n,e[1],2240044497,21),n=Ia(n,r,a,i,e[8],1873313359,6),i=Ia(i,n,r,a,e[15],4264355552,10),a=Ia(a,i,n,r,e[6],2734768916,15),r=Ia(r,a,i,n,e[13],1309151649,21),n=Ia(n,r,a,i,e[4],4149444226,6),i=Ia(i,n,r,a,e[11],3174756917,10),a=Ia(a,i,n,r,e[2],718787259,15),r=Ia(r,a,i,n,e[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+a|0,this._d=this._d+i|0},K8.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=rq.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var HE=K8,$E=G.Buffer,oq=wr,mR=hR,aq=new Array(16),Gv=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Zv=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Qv=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Xv=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Jv=[0,1518500249,1859775393,2400959708,2840853838],ey=[1352829926,1548603684,1836072691,2053994217,0];function $8(){mR.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function Ip(e,t){return e<>>32-t}function gR(e,t,n,r,a,i,h,y){return Ip(e+(t^n^r)+i+h|0,y)+a|0}function vR(e,t,n,r,a,i,h,y){return Ip(e+(t&n|~t&r)+i+h|0,y)+a|0}function yR(e,t,n,r,a,i,h,y){return Ip(e+((t|~n)^r)+i+h|0,y)+a|0}function bR(e,t,n,r,a,i,h,y){return Ip(e+(t&r|n&~r)+i+h|0,y)+a|0}function wR(e,t,n,r,a,i,h,y){return Ip(e+(t^(n|~r))+i+h|0,y)+a|0}oq($8,mR),$8.prototype._update=function(){for(var e=aq,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var n=0|this._a,r=0|this._b,a=0|this._c,i=0|this._d,h=0|this._e,y=0|this._a,k=0|this._b,E=0|this._c,M=0|this._d,C=0|this._e,O=0;O<80;O+=1){var z,H;O<16?(z=gR(n,r,a,i,h,e[Gv[O]],Jv[0],Qv[O]),H=wR(y,k,E,M,C,e[Zv[O]],ey[0],Xv[O])):O<32?(z=vR(n,r,a,i,h,e[Gv[O]],Jv[1],Qv[O]),H=bR(y,k,E,M,C,e[Zv[O]],ey[1],Xv[O])):O<48?(z=yR(n,r,a,i,h,e[Gv[O]],Jv[2],Qv[O]),H=yR(y,k,E,M,C,e[Zv[O]],ey[2],Xv[O])):O<64?(z=bR(n,r,a,i,h,e[Gv[O]],Jv[3],Qv[O]),H=vR(y,k,E,M,C,e[Zv[O]],ey[3],Xv[O])):(z=wR(n,r,a,i,h,e[Gv[O]],Jv[4],Qv[O]),H=gR(y,k,E,M,C,e[Zv[O]],ey[4],Xv[O])),n=h,h=i,i=Ip(a,10),a=r,r=z,y=C,C=M,M=Ip(E,10),E=k,k=H}var ee=this._b+a+M|0;this._b=this._c+i+C|0,this._c=this._d+h+y|0,this._d=this._e+n+k|0,this._e=this._a+r+E|0,this._a=ee},$8.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=$E.alloc?$E.alloc(20):new $E(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var qE=$8,_R={exports:{}},SR=br().Buffer;function q8(e,t){this._block=SR.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}q8.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=SR.from(e,t));for(var n=this._block,r=this._blockSize,a=e.length,i=this._len,h=0;h=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,a=(n-r)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},q8.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Um=q8,sq=wr,ER=Um,uq=br().Buffer,lq=[1518500249,1859775393,-1894007588,-899497514],cq=new Array(80);function ty(){this.init(),this._w=cq,ER.call(this,64,56)}function fq(e){return e<<30|e>>>2}function dq(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}sq(ty,ER),ty.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},ty.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,a=0|this._b,i=0|this._c,h=0|this._d,y=0|this._e,k=0;k<16;++k)n[k]=e.readInt32BE(4*k);for(;k<80;++k)n[k]=n[k-3]^n[k-8]^n[k-14]^n[k-16];for(var E=0;E<80;++E){var M=~~(E/20),C=0|((t=r)<<5|t>>>27)+dq(M,a,i,h)+y+n[E]+lq[M];y=h,h=i,i=fq(a),a=r,r=C}this._a=r+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=h+this._d|0,this._e=y+this._e|0},ty.prototype._hash=function(){var e=uq.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var hq=ty,pq=wr,kR=Um,mq=br().Buffer,gq=[1518500249,1859775393,-1894007588,-899497514],vq=new Array(80);function ny(){this.init(),this._w=vq,kR.call(this,64,56)}function yq(e){return e<<5|e>>>27}function bq(e){return e<<30|e>>>2}function wq(e,t,n,r){return e===0?t&n|~t&r:e===2?t&n|t&r|n&r:t^n^r}pq(ny,kR),ny.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},ny.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,a=0|this._b,i=0|this._c,h=0|this._d,y=0|this._e,k=0;k<16;++k)n[k]=e.readInt32BE(4*k);for(;k<80;++k)n[k]=(t=n[k-3]^n[k-8]^n[k-14]^n[k-16])<<1|t>>>31;for(var E=0;E<80;++E){var M=~~(E/20),C=yq(r)+wq(M,a,i,h)+y+n[E]+gq[M]|0;y=h,h=i,i=bq(a),a=r,r=C}this._a=r+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=h+this._d|0,this._e=y+this._e|0},ny.prototype._hash=function(){var e=mq.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var _q=ny,Sq=wr,MR=Um,Eq=br().Buffer,kq=[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],Mq=new Array(64);function ry(){this.init(),this._w=Mq,MR.call(this,64,56)}function Cq(e,t,n){return n^e&(t^n)}function xq(e,t,n){return e&t|n&(e|t)}function Aq(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Tq(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Rq(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Pq(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sq(ry,MR),ry.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},ry.prototype._update=function(e){for(var t=this._w,n=0|this._a,r=0|this._b,a=0|this._c,i=0|this._d,h=0|this._e,y=0|this._f,k=0|this._g,E=0|this._h,M=0;M<16;++M)t[M]=e.readInt32BE(4*M);for(;M<64;++M)t[M]=Pq(t[M-2])+t[M-7]+Rq(t[M-15])+t[M-16]|0;for(var C=0;C<64;++C){var O=E+Tq(h)+Cq(h,y,k)+kq[C]+t[C]|0,z=Aq(n)+xq(n,r,a)|0;E=k,k=y,y=h,h=i+O|0,i=a,a=r,r=n,n=O+z|0}this._a=n+this._a|0,this._b=r+this._b|0,this._c=a+this._c|0,this._d=i+this._d|0,this._e=h+this._e|0,this._f=y+this._f|0,this._g=k+this._g|0,this._h=E+this._h|0},ry.prototype._hash=function(){var e=Eq.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var CR=ry,Iq=wr,Lq=CR,Oq=Um,Nq=br().Buffer,Dq=new Array(64);function W8(){this.init(),this._w=Dq,Oq.call(this,64,56)}Iq(W8,Lq),W8.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},W8.prototype._hash=function(){var e=Nq.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var Bq=W8,zq=wr,xR=Um,Fq=br().Buffer,AR=[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],jq=new Array(160);function iy(){this.init(),this._w=jq,xR.call(this,128,112)}function TR(e,t,n){return n^e&(t^n)}function RR(e,t,n){return e&t|n&(e|t)}function PR(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function IR(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Uq(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Kq(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Hq(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function $q(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function jo(e,t){return e>>>0>>0?1:0}zq(iy,xR),iy.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},iy.prototype._update=function(e){for(var t=this._w,n=0|this._ah,r=0|this._bh,a=0|this._ch,i=0|this._dh,h=0|this._eh,y=0|this._fh,k=0|this._gh,E=0|this._hh,M=0|this._al,C=0|this._bl,O=0|this._cl,z=0|this._dl,H=0|this._el,ee=0|this._fl,te=0|this._gl,se=0|this._hl,oe=0;oe<32;oe+=2)t[oe]=e.readInt32BE(4*oe),t[oe+1]=e.readInt32BE(4*oe+4);for(;oe<160;oe+=2){var Ee=t[oe-30],we=t[oe-30+1],Ce=Uq(Ee,we),ze=Kq(we,Ee),Fe=Hq(Ee=t[oe-4],we=t[oe-4+1]),$e=$q(we,Ee),S=t[oe-14],P=t[oe-14+1],d=t[oe-32],g=t[oe-32+1],m=ze+P|0,p=Ce+S+jo(m,ze)|0;p=(p=p+Fe+jo(m=m+$e|0,$e)|0)+d+jo(m=m+g|0,g)|0,t[oe]=p,t[oe+1]=m}for(var f=0;f<160;f+=2){p=t[f],m=t[f+1];var _=RR(n,r,a),T=RR(M,C,O),L=PR(n,M),B=PR(M,n),$=IR(h,H),Y=IR(H,h),q=AR[f],F=AR[f+1],K=TR(h,y,k),Z=TR(H,ee,te),ne=se+Y|0,ue=E+$+jo(ne,se)|0;ue=(ue=(ue=ue+K+jo(ne=ne+Z|0,Z)|0)+q+jo(ne=ne+F|0,F)|0)+p+jo(ne=ne+m|0,m)|0;var me=B+T|0,fe=L+_+jo(me,B)|0;E=k,se=te,k=y,te=ee,y=h,ee=H,h=i+ue+jo(H=z+ne|0,z)|0,i=a,z=O,a=r,O=C,r=n,C=M,n=ue+fe+jo(M=ne+me|0,ne)|0}this._al=this._al+M|0,this._bl=this._bl+C|0,this._cl=this._cl+O|0,this._dl=this._dl+z|0,this._el=this._el+H|0,this._fl=this._fl+ee|0,this._gl=this._gl+te|0,this._hl=this._hl+se|0,this._ah=this._ah+n+jo(this._al,M)|0,this._bh=this._bh+r+jo(this._bl,C)|0,this._ch=this._ch+a+jo(this._cl,O)|0,this._dh=this._dh+i+jo(this._dl,z)|0,this._eh=this._eh+h+jo(this._el,H)|0,this._fh=this._fh+y+jo(this._fl,ee)|0,this._gh=this._gh+k+jo(this._gl,te)|0,this._hh=this._hh+E+jo(this._hl,se)|0},iy.prototype._hash=function(){var e=Fq.allocUnsafe(64);function t(n,r,a){e.writeInt32BE(n,a),e.writeInt32BE(r,a+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var LR=iy,qq=wr,Wq=LR,Vq=Um,Yq=br().Buffer,Gq=new Array(160);function V8(){this.init(),this._w=Gq,Vq.call(this,128,112)}qq(V8,Wq),V8.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},V8.prototype._hash=function(){var e=Yq.allocUnsafe(48);function t(n,r,a){e.writeInt32BE(n,a),e.writeInt32BE(r,a+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Zq=V8,Lp=_R.exports=function(e){e=e.toLowerCase();var t=Lp[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Lp.sha=hq,Lp.sha1=_q,Lp.sha224=Bq,Lp.sha256=CR,Lp.sha384=Zq,Lp.sha512=LR;var WE=_R.exports;function Op(){this.head=null,this.tail=null,this.length=0}Op.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Op.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},Op.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Op.prototype.clear=function(){this.head=this.tail=null,this.length=0},Op.prototype.join=function(e){if(this.length===0)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},Op.prototype.concat=function(e){if(this.length===0)return je.alloc(0);if(this.length===1)return this.head.data;for(var t=je.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Qq=je.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Km(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!Qq(t))throw new Error("Unknown encoding: "+t)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Jq;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=eW;break;default:return void(this.write=Xq)}this.charBuffer=new je(6),this.charReceived=0,this.charLength=0}function Xq(e){return e.toString(this.encoding)}function Jq(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function eW(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Km.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,e.length===0)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,a=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,a),a-=this.charReceived),a=(t+=e.toString(this.encoding,0,a)).length-1,(r=t.charCodeAt(a))>=55296&&r<=56319){var i=this.surrogateSize;return this.charLength+=i,this.charReceived+=i,this.charBuffer.copy(this.charBuffer,i,0,i),e.copy(this.charBuffer,0,0,i),t.substring(0,a)}return t},Km.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(t==1&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},Km.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,a=this.encoding;t+=r.slice(0,n).toString(a)}return t};var tW=Object.freeze({__proto__:null,StringDecoder:Km});Wi.ReadableState=OR;var ui=ME("stream");function OR(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof iu&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||n===0?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Op,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Km(e.encoding),this.encoding=e.encoding)}function Wi(e){if(!(this instanceof Wi))return new Wi(e);this._readableState=new OR(e,this),this.readable=!0,e&&typeof e.read=="function"&&(this._read=e.read),Sr.call(this)}function NR(e,t,n,r,a){var i=function(E,M){var C=null;return di(M)||typeof M=="string"||M==null||E.objectMode||(C=new TypeError("Invalid non-string/buffer chunk")),C}(t,n);if(i)e.emit("error",i);else if(n===null)t.reading=!1,function(E,M){if(!M.ended){if(M.decoder){var C=M.decoder.end();C&&C.length&&(M.buffer.push(C),M.length+=M.objectMode?1:C.length)}M.ended=!0,Y8(E)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!a){var h=new Error("stream.push() after EOF");e.emit("error",h)}else if(t.endEmitted&&a){var y=new Error("stream.unshift() after end event");e.emit("error",y)}else{var k;!t.decoder||a||r||(n=t.decoder.write(n),k=!t.objectMode&&n.length===0),a||(t.reading=!1),k||(t.flowing&&t.length===0&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,a?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Y8(e))),function(E,M){M.readingMore||(M.readingMore=!0,pr(nW,E,M))}(e,t)}else a||(t.reading=!1);return function(E){return!E.ended&&(E.needReadable||E.lengtht.highWaterMark&&(t.highWaterMark=function(n){return n>=DR?n=DR:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Y8(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(ui("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?pr(zR,e):zR(e))}function zR(e){ui("emit readable"),e.emit("readable"),VE(e)}function nW(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):t.buffer.length===1?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(r,a,i){var h;return rO.length?O.length:y;if(z===O.length?C+=O:C+=O.slice(0,y),(y-=z)==0){z===O.length?(++M,E.next?k.head=E.next:k.head=k.tail=null):(k.head=E,E.data=O.slice(z));break}++M}return k.length-=M,C}(r,a):function(y,k){var E=je.allocUnsafe(y),M=k.head,C=1;for(M.data.copy(E),y-=M.data.length;M=M.next;){var O=M.data,z=y>O.length?O.length:y;if(O.copy(E,E.length-y,0,z),(y-=z)==0){z===O.length?(++C,M.next?k.head=M.next:k.head=k.tail=null):(k.head=M,M.data=O.slice(z));break}++C}return k.length-=C,E}(r,a),h}(e,t.buffer,t.decoder),n);var n}function YE(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,pr(oW,t,e))}function oW(e,t){e.endEmitted||e.length!==0||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function jR(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return ui("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?YE(this):Y8(this),null;if((e=BR(e,t))===0&&t.ended)return t.length===0&&YE(this),null;var r,a=t.needReadable;return ui("need readable",a),(t.length===0||t.length-e0?FR(e,t):null)===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&YE(this)),r!==null&&this.emit("data",r),r},Wi.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Wi.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,ui("pipe count=%d opts=%j",r.pipesCount,t);var a=t&&t.end===!1?E:h;function i(te){ui("onunpipe"),te===n&&E()}function h(){ui("onend"),e.end()}r.endEmitted?pr(a):n.once("end",a),e.on("unpipe",i);var y=function(te){return function(){var se=te._readableState;ui("pipeOnDrain",se.awaitDrain),se.awaitDrain&&se.awaitDrain--,se.awaitDrain===0&&te.listeners("data").length&&(se.flowing=!0,VE(te))}}(n);e.on("drain",y);var k=!1;function E(){ui("cleanup"),e.removeListener("close",z),e.removeListener("finish",H),e.removeListener("drain",y),e.removeListener("error",O),e.removeListener("unpipe",i),n.removeListener("end",h),n.removeListener("end",E),n.removeListener("data",C),k=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||y()}var M=!1;function C(te){ui("ondata"),M=!1,e.write(te)!==!1||M||((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&jR(r.pipes,e)!==-1)&&!k&&(ui("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,M=!0),n.pause())}function O(te){var se;ui("onerror",te),ee(),e.removeListener("error",O),se="error",e.listeners(se).length===0&&e.emit("error",te)}function z(){e.removeListener("finish",H),ee()}function H(){ui("onfinish"),e.removeListener("close",z),ee()}function ee(){ui("unpipe"),n.unpipe(e)}return n.on("data",C),function(te,se,oe){if(typeof te.prependListener=="function")return te.prependListener(se,oe);te._events&&te._events[se]?Array.isArray(te._events[se])?te._events[se].unshift(oe):te._events[se]=[oe,te._events[se]]:te.on(se,oe)}(e,"error",O),e.once("close",z),e.once("finish",H),e.emit("pipe",n),r.flowing||(ui("pipe resume"),n.resume()),e},Wi.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},oa.prototype._write=function(e,t,n){n(new Error("not implemented"))},oa.prototype._writev=null,oa.prototype.end=function(e,t,n){var r=this._writableState;typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(a,i,h){i.ending=!0,qR(a,i),h&&(i.finished?pr(h):a.once("finish",h)),i.ended=!0,a.writable=!1}(this,r,n)},Lh(iu,Wi);for(var VR=Object.keys(oa.prototype),QE=0;QE$m?t=e(t):t.length<$m&&(t=Np.concat([t,yW],$m));for(var n=this._ipad=Np.allocUnsafe($m),r=this._opad=Np.allocUnsafe($m),a=0;a<$m;a++)n[a]=54^t[a],r[a]=92^t[a];this._hash=[n]}vW(Z8,XR),Z8.prototype._update=function(e){this._hash.push(e)},Z8.prototype._final=function(){var e=this._alg(Np.concat(this._hash));return this._alg(Np.concat([this._opad,e]))};var bW=HE,JR=function(e){return new bW().update(e).digest()},wW=wr,_W=Z8,eP=Dh,ay=br().Buffer,SW=JR,JE=qE,ek=WE,EW=ay.alloc(128);function sy(e,t){eP.call(this,"digest"),typeof t=="string"&&(t=ay.from(t));var n=e==="sha512"||e==="sha384"?128:64;this._alg=e,this._key=t,t.length>n?t=(e==="rmd160"?new JE:ek(e)).update(t).digest():t.lengthMW||t!=t)throw new TypeError("Bad key length")},iP=b.process&&b.process.browser?"utf-8":b.process&&b.process.version?parseInt(mi.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary":"utf-8",tk=br().Buffer,oP=function(e,t,n){if(tk.isBuffer(e))return e;if(typeof e=="string")return tk.from(e,t);if(ArrayBuffer.isView(e))return tk.from(e.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},CW=JR,xW=qE,AW=WE,Dp=br().Buffer,TW=rP,aP=iP,sP=oP,RW=Dp.alloc(128),X8={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function uP(e,t,n){var r=function(E){function M(O){return AW(E).update(O).digest()}function C(O){return new xW().update(O).digest()}return E==="rmd160"||E==="ripemd160"?C:E==="md5"?CW:M}(e),a=e==="sha512"||e==="sha384"?128:64;t.length>a?t=r(t):t.length>>0},writeUInt32BE:function(e,t,n){e[0+n]=t>>>24,e[1+n]=t>>>16&255,e[2+n]=t>>>8&255,e[3+n]=255&t},ip:function(e,t,n,r){for(var a=0,i=0,h=6;h>=0;h-=2){for(var y=0;y<=24;y+=8)a<<=1,a|=t>>>y+h&1;for(y=0;y<=24;y+=8)a<<=1,a|=e>>>y+h&1}for(h=6;h>=0;h-=2){for(y=1;y<=25;y+=8)i<<=1,i|=t>>>y+h&1;for(y=1;y<=25;y+=8)i<<=1,i|=e>>>y+h&1}n[r+0]=a>>>0,n[r+1]=i>>>0},rip:function(e,t,n,r){for(var a=0,i=0,h=0;h<4;h++)for(var y=24;y>=0;y-=8)a<<=1,a|=t>>>y+h&1,a<<=1,a|=e>>>y+h&1;for(h=4;h<8;h++)for(y=24;y>=0;y-=8)i<<=1,i|=t>>>y+h&1,i<<=1,i|=e>>>y+h&1;n[r+0]=a>>>0,n[r+1]=i>>>0},pc1:function(e,t,n,r){for(var a=0,i=0,h=7;h>=5;h--){for(var y=0;y<=24;y+=8)a<<=1,a|=t>>y+h&1;for(y=0;y<=24;y+=8)a<<=1,a|=e>>y+h&1}for(y=0;y<=24;y+=8)a<<=1,a|=t>>y+h&1;for(h=1;h<=3;h++){for(y=0;y<=24;y+=8)i<<=1,i|=t>>y+h&1;for(y=0;y<=24;y+=8)i<<=1,i|=e>>y+h&1}for(y=0;y<=24;y+=8)i<<=1,i|=e>>y+h&1;n[r+0]=a>>>0,n[r+1]=i>>>0},r28shl:function(e,t){return e<>>28-t}},J8=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Bp.pc2=function(e,t,n,r){for(var a=0,i=0,h=J8.length>>>1,y=0;y>>J8[y]&1;for(y=h;y>>J8[y]&1;n[r+0]=a>>>0,n[r+1]=i>>>0},Bp.expand=function(e,t,n){var r=0,a=0;r=(1&e)<<5|e>>>27;for(var i=23;i>=15;i-=4)r<<=6,r|=e>>>i&63;for(i=11;i>=3;i-=4)a|=e>>>i&63,a<<=6;a|=(31&e)<<1|e>>>31,t[n+0]=r>>>0,t[n+1]=a>>>0};var gP=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Bp.substitute=function(e,t){for(var n=0,r=0;r<4;r++)n<<=4,n|=gP[64*r+(e>>>18-6*r&63)];for(r=0;r<4;r++)n<<=4,n|=gP[256+64*r+(t>>>18-6*r&63)];return n>>>0};var vP=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];Bp.permute=function(e){for(var t=0,n=0;n>>vP[n]&1;return t>>>0},Bp.padSplit=function(e,t,n){for(var r=e.toString(2);r.length0;r--)t+=this._buffer(e,t),n+=this._flushBuffer(a,n);return t+=this._buffer(e,t),a},zu.prototype.final=function(e){var t,n;return e&&(t=this.update(e)),n=this.type==="encrypt"?this._finalEncrypt():this._finalDecrypt(),t?t.concat(n):n},zu.prototype._pad=function(e,t){if(t===0)return!1;for(;t>>1];n=Co.r28shl(n,i),r=Co.r28shl(r,i),Co.pc2(n,r,e.keys,a)}},Gc.prototype._update=function(e,t,n,r){var a=this._desState,i=Co.readUInt32BE(e,t),h=Co.readUInt32BE(e,t+4);Co.ip(i,h,a.tmp,0),i=a.tmp[0],h=a.tmp[1],this.type==="encrypt"?this._encrypt(a,i,h,a.tmp,0):this._decrypt(a,i,h,a.tmp,0),i=a.tmp[0],h=a.tmp[1],Co.writeUInt32BE(n,i,r),Co.writeUInt32BE(n,h,r+4)},Gc.prototype._pad=function(e,t){if(this.padding===!1)return!1;for(var n=e.length-t,r=t;r>>0,i=C}Co.rip(h,i,r,a)},Gc.prototype._decrypt=function(e,t,n,r,a){for(var i=n,h=t,y=e.keys.length-2;y>=0;y-=2){var k=e.keys[y],E=e.keys[y+1];Co.expand(i,e.tmp,0),k^=e.tmp[0],E^=e.tmp[1];var M=Co.substitute(k,E),C=i;i=(h^Co.permute(M))>>>0,h=C}Co.rip(i,h,r,a)};var SP={},DW=Bu,BW=wr,ew={};function zW(e){DW.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t>i%8,e._prev=YW(e._prev,n?r:a);return h}function YW(e,t){var n=e.length,r=-1,a=nw.allocUnsafe(e.length);for(e=nw.concat([e,nw.from([t])]);++r>7;return a}TP.encrypt=function(e,t,n){for(var r=t.length,a=nw.allocUnsafe(r),i=-1;++i>>24]^M[H>>>16&255]^C[ee>>>8&255]^O[255&te]^t[se++],h=E[H>>>24]^M[ee>>>16&255]^C[te>>>8&255]^O[255&z]^t[se++],y=E[ee>>>24]^M[te>>>16&255]^C[z>>>8&255]^O[255&H]^t[se++],k=E[te>>>24]^M[z>>>16&255]^C[H>>>8&255]^O[255&ee]^t[se++],z=i,H=h,ee=y,te=k;return i=(r[z>>>24]<<24|r[H>>>16&255]<<16|r[ee>>>8&255]<<8|r[255&te])^t[se++],h=(r[H>>>24]<<24|r[ee>>>16&255]<<16|r[te>>>8&255]<<8|r[255&z])^t[se++],y=(r[ee>>>24]<<24|r[te>>>16&255]<<16|r[z>>>8&255]<<8|r[255&H])^t[se++],k=(r[te>>>24]<<24|r[z>>>16&255]<<16|r[H>>>8&255]<<8|r[255&ee])^t[se++],[i>>>=0,h>>>=0,y>>>=0,k>>>=0]}var tV=[0,1,2,4,8,16,32,64,128,27,54],vo=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var n=[],r=[],a=[[],[],[],[]],i=[[],[],[],[]],h=0,y=0,k=0;k<256;++k){var E=y^y<<1^y<<2^y<<3^y<<4;E=E>>>8^255&E^99,n[h]=E,r[E]=h;var M=e[h],C=e[M],O=e[C],z=257*e[E]^16843008*E;a[0][h]=z<<24|z>>>8,a[1][h]=z<<16|z>>>16,a[2][h]=z<<8|z>>>24,a[3][h]=z,z=16843009*O^65537*C^257*M^16843008*h,i[0][E]=z<<24|z>>>8,i[1][E]=z<<16|z>>>16,i[2][E]=z<<8|z>>>24,i[3][E]=z,h===0?h=y=1:(h=M^e[e[e[O^M]]],y^=e[e[y]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:a,INV_SUB_MIX:i}}();function Fu(e){this._key=fk(e),this._reset()}Fu.blockSize=16,Fu.keySize=32,Fu.prototype.blockSize=Fu.blockSize,Fu.prototype.keySize=Fu.keySize,Fu.prototype._reset=function(){for(var e=this._key,t=e.length,n=t+6,r=4*(n+1),a=[],i=0;i>>24,h=vo.SBOX[h>>>24]<<24|vo.SBOX[h>>>16&255]<<16|vo.SBOX[h>>>8&255]<<8|vo.SBOX[255&h],h^=tV[i/t|0]<<24):t>6&&i%t==4&&(h=vo.SBOX[h>>>24]<<24|vo.SBOX[h>>>16&255]<<16|vo.SBOX[h>>>8&255]<<8|vo.SBOX[255&h]),a[i]=a[i-t]^h}for(var y=[],k=0;k>>24]]^vo.INV_SUB_MIX[1][vo.SBOX[M>>>16&255]]^vo.INV_SUB_MIX[2][vo.SBOX[M>>>8&255]]^vo.INV_SUB_MIX[3][vo.SBOX[255&M]]}this._nRounds=n,this._keySchedule=a,this._invKeySchedule=y},Fu.prototype.encryptBlockRaw=function(e){return NP(e=fk(e),this._keySchedule,vo.SUB_MIX,vo.SBOX,this._nRounds)},Fu.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),n=iw.allocUnsafe(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n},Fu.prototype.decryptBlock=function(e){var t=(e=fk(e))[1];e[1]=e[3],e[3]=t;var n=NP(e,this._invKeySchedule,vo.INV_SUB_MIX,vo.INV_SBOX,this._nRounds),r=iw.allocUnsafe(16);return r.writeUInt32BE(n[0],0),r.writeUInt32BE(n[3],4),r.writeUInt32BE(n[2],8),r.writeUInt32BE(n[1],12),r},Fu.prototype.scrub=function(){dk(this._keySchedule),dk(this._invKeySchedule),dk(this._key)},dy.AES=Fu;var Wm=br().Buffer,nV=Wm.alloc(16,0);function DP(e){var t=Wm.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function hy(e){this.h=e,this.state=Wm.alloc(16,0),this.cache=Wm.allocUnsafe(0)}hy.prototype.ghash=function(e){for(var t=-1;++t0;t--)r[t]=r[t]>>>1|(1&r[t-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=r[0]^225<<24)}this.state=DP(a)},hy.prototype.update=function(e){var t;for(this.cache=Wm.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},hy.prototype.final=function(e,t){return this.cache.length&&this.ghash(Wm.concat([this.cache,nV],16)),this.ghash(DP([0,e,0,t])),this.state};var rV=hy,iV=dy,Ms=br().Buffer,BP=Dh,zP=rV,oV=cy,aV=PP;function jp(e,t,n,r){BP.call(this);var a=Ms.alloc(4,0);this._cipher=new iV.AES(t);var i=this._cipher.encryptBlock(a);this._ghash=new zP(i),n=function(h,y,k){if(y.length===12)return h._finID=Ms.concat([y,Ms.from([0,0,0,1])]),Ms.concat([y,Ms.from([0,0,0,2])]);var E=new zP(k),M=y.length,C=M%16;E.update(y),C&&(C=16-C,E.update(Ms.alloc(C,0))),E.update(Ms.alloc(8,0));var O=8*M,z=Ms.alloc(8);z.writeUIntBE(O,0,8),E.update(z),h._finID=E.state;var H=Ms.from(h._finID);return aV(H),H}(this,n,i),this._prev=Ms.from(n),this._cache=Ms.allocUnsafe(0),this._secCache=Ms.allocUnsafe(0),this._decrypt=r,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}wr(jp,BP),jp.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=Ms.alloc(t,0),this._ghash.update(t))}this._called=!0;var n=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(n),this._len+=e.length,n},jp.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=oV(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,n){var r=0;t.length!==n.length&&r++;for(var a=Math.min(t.length,n.length),i=0;i0||r>0;){var k=new uV;k.update(y),k.update(e),t&&k.update(t),y=k.digest();var E=0;if(a>0){var M=i.length-a;E=Math.min(a,y.length),y.copy(i,M,0,E),a-=E}if(E0){var C=h.length-r,O=Math.min(r,y.length-E);y.copy(h,C,E,E+O),r-=O}}return y.fill(0),{key:i,iv:h}},KP=ck,lV=FP,fd=br().Buffer,cV=UP,HP=Dh,fV=dy,dV=aw;function py(e,t,n){HP.call(this),this._cache=new sw,this._cipher=new fV.AES(t),this._prev=fd.from(n),this._mode=e,this._autopadding=!0}wr(py,HP),py.prototype._update=function(e){var t,n;this._cache.add(e);for(var r=[];t=this._cache.get();)n=this._mode.encrypt(this,t),r.push(n);return fd.concat(r)};var hV=fd.alloc(16,16);function sw(){this.cache=fd.allocUnsafe(0)}function $P(e,t,n){var r=KP[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");if(typeof t=="string"&&(t=fd.from(t)),t.length!==r.key/8)throw new TypeError("invalid key length "+t.length);if(typeof n=="string"&&(n=fd.from(n)),r.mode!=="GCM"&&n.length!==r.iv)throw new TypeError("invalid iv length "+n.length);return r.type==="stream"?new cV(r.module,t,n):r.type==="auth"?new lV(r.module,t,n):new py(r.module,t,n)}py.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(hV))throw this._cipher.scrub(),new Error("data not multiple of block length")},py.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},sw.prototype.add=function(e){this.cache=fd.concat([this.cache,e])},sw.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},sw.prototype.flush=function(){for(var e=16-this.cache.length,t=fd.allocUnsafe(e),n=-1;++n16)throw new Error("unable to decrypt data");for(var r=-1;++r16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},uw.prototype.flush=function(){if(this.cache.length)return this.cache},pk.createDecipher=function(e,t){var n=qP[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=vV(t,!1,n.key,n.iv);return VP(e,r.key,r.iv)},pk.createDecipheriv=VP;var YP=ak,GP=pk,yV=LP;ou.createCipher=ou.Cipher=YP.createCipher,ou.createCipheriv=ou.Cipheriv=YP.createCipheriv,ou.createDecipher=ou.Decipher=GP.createDecipher,ou.createDecipheriv=ou.Decipheriv=GP.createDecipheriv,ou.listCiphers=ou.getCiphers=function(){return Object.keys(yV)};var ZP={};(function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}})(ZP);var QP=HW,mk=ou,zh=ck,dd=ZP,XP=aw;function JP(e,t,n){if(e=e.toLowerCase(),zh[e])return mk.createCipheriv(e,t,n);if(dd[e])return new QP({key:t,iv:n,mode:e});throw new TypeError("invalid suite type")}function eI(e,t,n){if(e=e.toLowerCase(),zh[e])return mk.createDecipheriv(e,t,n);if(dd[e])return new QP({key:t,iv:n,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}Dl.createCipher=Dl.Cipher=function(e,t){var n,r;if(e=e.toLowerCase(),zh[e])n=zh[e].key,r=zh[e].iv;else{if(!dd[e])throw new TypeError("invalid suite type");n=8*dd[e].key,r=dd[e].iv}var a=XP(t,!1,n,r);return JP(e,a.key,a.iv)},Dl.createCipheriv=Dl.Cipheriv=JP,Dl.createDecipher=Dl.Decipher=function(e,t){var n,r;if(e=e.toLowerCase(),zh[e])n=zh[e].key,r=zh[e].iv;else{if(!dd[e])throw new TypeError("invalid suite type");n=8*dd[e].key,r=dd[e].iv}var a=XP(t,!1,n,r);return eI(e,a.key,a.iv)},Dl.createDecipheriv=Dl.Decipheriv=eI,Dl.listCiphers=Dl.getCiphers=function(){return Object.keys(dd).concat(mk.getCiphers())};var Kp={},tI={exports:{}};(function(e){(function(t,n){function r(S,P){if(!S)throw new Error(P||"Assertion failed")}function a(S,P){S.super_=P;var d=function(){};d.prototype=P.prototype,S.prototype=new d,S.prototype.constructor=S}function i(S,P,d){if(i.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&(P!=="le"&&P!=="be"||(d=P,P=10),this._init(S||0,P||10,d||"be"))}var h;typeof t=="object"?t.exports=i:n.BN=i,i.BN=i,i.wordSize=26;try{h=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:G.Buffer}catch{}function y(S,P){var d=S.charCodeAt(P);return d>=65&&d<=70?d-55:d>=97&&d<=102?d-87:d-48&15}function k(S,P,d){var g=y(S,d);return d-1>=P&&(g|=y(S,d-1)<<4),g}function E(S,P,d,g){for(var m=0,p=Math.min(S.length,d),f=P;f=49?_-49+10:_>=17?_-17+10:_}return m}i.isBN=function(S){return S instanceof i||S!==null&&typeof S=="object"&&S.constructor.wordSize===i.wordSize&&Array.isArray(S.words)},i.max=function(S,P){return S.cmp(P)>0?S:P},i.min=function(S,P){return S.cmp(P)<0?S:P},i.prototype._init=function(S,P,d){if(typeof S=="number")return this._initNumber(S,P,d);if(typeof S=="object")return this._initArray(S,P,d);P==="hex"&&(P=16),r(P===(0|P)&&P>=2&&P<=36);var g=0;(S=S.toString().replace(/\s+/g,""))[0]==="-"&&(g++,this.negative=1),g=0;g-=3)p=S[g]|S[g-1]<<8|S[g-2]<<16,this.words[m]|=p<>>26-f&67108863,(f+=24)>=26&&(f-=26,m++);else if(d==="le")for(g=0,m=0;g>>26-f&67108863,(f+=24)>=26&&(f-=26,m++);return this.strip()},i.prototype._parseHex=function(S,P,d){this.length=Math.ceil((S.length-P)/6),this.words=new Array(this.length);for(var g=0;g=P;g-=2)m=k(S,P,g)<=18?(p-=18,f+=1,this.words[f]|=m>>>26):p+=8;else for(g=(S.length-P)%2==0?P+1:P;g=18?(p-=18,f+=1,this.words[f]|=m>>>26):p+=8;this.strip()},i.prototype._parseBase=function(S,P,d){this.words=[0],this.length=1;for(var g=0,m=1;m<=67108863;m*=P)g++;g--,m=m/P|0;for(var p=S.length-d,f=p%g,_=Math.min(p,p-f)+d,T=0,L=d;L<_;L+=g)T=E(S,L,L+g,P),this.imuln(m),this.words[0]+T<67108864?this.words[0]+=T:this._iaddn(T);if(f!==0){var B=1;for(T=E(S,L,S.length,P),L=0;L1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var M=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function z(S,P,d){d.negative=P.negative^S.negative;var g=S.length+P.length|0;d.length=g,g=g-1|0;var m=0|S.words[0],p=0|P.words[0],f=m*p,_=67108863&f,T=f/67108864|0;d.words[0]=_;for(var L=1;L>>26,$=67108863&T,Y=Math.min(L,P.length-1),q=Math.max(0,L-S.length+1);q<=Y;q++){var F=L-q|0;B+=(f=(m=0|S.words[F])*(p=0|P.words[q])+$)/67108864|0,$=67108863&f}d.words[L]=0|$,T=0|B}return T!==0?d.words[L]=0|T:d.length--,d.strip()}i.prototype.toString=function(S,P){var d;if(P=0|P||1,(S=S||10)===16||S==="hex"){d="";for(var g=0,m=0,p=0;p>>24-g&16777215)!=0||p!==this.length-1?M[6-_.length]+_+d:_+d,(g+=2)>=26&&(g-=26,p--)}for(m!==0&&(d=m.toString(16)+d);d.length%P!=0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(S===(0|S)&&S>=2&&S<=36){var T=C[S],L=O[S];d="";var B=this.clone();for(B.negative=0;!B.isZero();){var $=B.modn(L).toString(S);d=(B=B.idivn(L)).isZero()?$+d:M[T-$.length]+$+d}for(this.isZero()&&(d="0"+d);d.length%P!=0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var S=this.words[0];return this.length===2?S+=67108864*this.words[1]:this.length===3&&this.words[2]===1?S+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-S:S},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(S,P){return r(h!==void 0),this.toArrayLike(h,S,P)},i.prototype.toArray=function(S,P){return this.toArrayLike(Array,S,P)},i.prototype.toArrayLike=function(S,P,d){var g=this.byteLength(),m=d||Math.max(1,g);r(g<=m,"byte array longer than desired length"),r(m>0,"Requested array length <= 0"),this.strip();var p,f,_=P==="le",T=new S(m),L=this.clone();if(_){for(f=0;!L.isZero();f++)p=L.andln(255),L.iushrn(8),T[f]=p;for(;f=4096&&(d+=13,P>>>=13),P>=64&&(d+=7,P>>>=7),P>=8&&(d+=4,P>>>=4),P>=2&&(d+=2,P>>>=2),d+P},i.prototype._zeroBits=function(S){if(S===0)return 26;var P=S,d=0;return!(8191&P)&&(d+=13,P>>>=13),!(127&P)&&(d+=7,P>>>=7),!(15&P)&&(d+=4,P>>>=4),!(3&P)&&(d+=2,P>>>=2),!(1&P)&&d++,d},i.prototype.bitLength=function(){var S=this.words[this.length-1],P=this._countBits(S);return 26*(this.length-1)+P},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var S=0,P=0;PS.length?this.clone().ior(S):S.clone().ior(this)},i.prototype.uor=function(S){return this.length>S.length?this.clone().iuor(S):S.clone().iuor(this)},i.prototype.iuand=function(S){var P;P=this.length>S.length?S:this;for(var d=0;dS.length?this.clone().iand(S):S.clone().iand(this)},i.prototype.uand=function(S){return this.length>S.length?this.clone().iuand(S):S.clone().iuand(this)},i.prototype.iuxor=function(S){var P,d;this.length>S.length?(P=this,d=S):(P=S,d=this);for(var g=0;gS.length?this.clone().ixor(S):S.clone().ixor(this)},i.prototype.uxor=function(S){return this.length>S.length?this.clone().iuxor(S):S.clone().iuxor(this)},i.prototype.inotn=function(S){r(typeof S=="number"&&S>=0);var P=0|Math.ceil(S/26),d=S%26;this._expand(P),d>0&&P--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-d),this.strip()},i.prototype.notn=function(S){return this.clone().inotn(S)},i.prototype.setn=function(S,P){r(typeof S=="number"&&S>=0);var d=S/26|0,g=S%26;return this._expand(d+1),this.words[d]=P?this.words[d]|1<S.length?(d=this,g=S):(d=S,g=this);for(var m=0,p=0;p>>26;for(;m!==0&&p>>26;if(this.length=d.length,m!==0)this.words[this.length]=m,this.length++;else if(d!==this)for(;pS.length?this.clone().iadd(S):S.clone().iadd(this)},i.prototype.isub=function(S){if(S.negative!==0){S.negative=0;var P=this.iadd(S);return S.negative=1,P._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(S),this.negative=1,this._normSign();var d,g,m=this.cmp(S);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;m>0?(d=this,g=S):(d=S,g=this);for(var p=0,f=0;f>26,this.words[f]=67108863&P;for(;p!==0&&f>26,this.words[f]=67108863&P;if(p===0&&f>>13,q=0|f[1],F=8191&q,K=q>>>13,Z=0|f[2],ne=8191&Z,ue=Z>>>13,me=0|f[3],fe=8191&me,De=me>>>13,_e=0|f[4],pe=8191&_e,ve=_e>>>13,Se=0|f[5],Ae=8191&Se,qe=Se>>>13,Xe=0|f[6],Be=8191&Xe,gt=Xe>>>13,bt=0|f[7],ot=8191&bt,Wt=bt>>>13,vt=0|f[8],at=8191&vt,Rt=vt>>>13,Dt=0|f[9],Lt=8191&Dt,rn=Dt>>>13,Vt=0|_[0],Pt=8191&Vt,en=Vt>>>13,on=0|_[1],At=8191&on,Jt=on>>>13,tn=0|_[2],Bt=8191&tn,Rn=tn>>>13,wn=0|_[3],Ut=8191&wn,Fn=wn>>>13,kn=0|_[4],Nt=8191&kn,Mn=kn>>>13,yn=0|_[5],Ft=8191&yn,An=yn>>>13,bn=0|_[6],Qt=8191&bn,Ln=bn>>>13,Bn=0|_[7],Kt=8191&Bn,Pn=Bn>>>13,In=0|_[8],qt=8191&In,pn=In>>>13,Hn=0|_[9],Yt=8191&Hn,$n=Hn>>>13;d.negative=S.negative^P.negative,d.length=19;var Cn=(L+(g=Math.imul($,Pt))|0)+((8191&(m=(m=Math.imul($,en))+Math.imul(Y,Pt)|0))<<13)|0;L=((p=Math.imul(Y,en))+(m>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,g=Math.imul(F,Pt),m=(m=Math.imul(F,en))+Math.imul(K,Pt)|0,p=Math.imul(K,en);var On=(L+(g=g+Math.imul($,At)|0)|0)+((8191&(m=(m=m+Math.imul($,Jt)|0)+Math.imul(Y,At)|0))<<13)|0;L=((p=p+Math.imul(Y,Jt)|0)+(m>>>13)|0)+(On>>>26)|0,On&=67108863,g=Math.imul(ne,Pt),m=(m=Math.imul(ne,en))+Math.imul(ue,Pt)|0,p=Math.imul(ue,en),g=g+Math.imul(F,At)|0,m=(m=m+Math.imul(F,Jt)|0)+Math.imul(K,At)|0,p=p+Math.imul(K,Jt)|0;var Fi=(L+(g=g+Math.imul($,Bt)|0)|0)+((8191&(m=(m=m+Math.imul($,Rn)|0)+Math.imul(Y,Bt)|0))<<13)|0;L=((p=p+Math.imul(Y,Rn)|0)+(m>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,g=Math.imul(fe,Pt),m=(m=Math.imul(fe,en))+Math.imul(De,Pt)|0,p=Math.imul(De,en),g=g+Math.imul(ne,At)|0,m=(m=m+Math.imul(ne,Jt)|0)+Math.imul(ue,At)|0,p=p+Math.imul(ue,Jt)|0,g=g+Math.imul(F,Bt)|0,m=(m=m+Math.imul(F,Rn)|0)+Math.imul(K,Bt)|0,p=p+Math.imul(K,Rn)|0;var ji=(L+(g=g+Math.imul($,Ut)|0)|0)+((8191&(m=(m=m+Math.imul($,Fn)|0)+Math.imul(Y,Ut)|0))<<13)|0;L=((p=p+Math.imul(Y,Fn)|0)+(m>>>13)|0)+(ji>>>26)|0,ji&=67108863,g=Math.imul(pe,Pt),m=(m=Math.imul(pe,en))+Math.imul(ve,Pt)|0,p=Math.imul(ve,en),g=g+Math.imul(fe,At)|0,m=(m=m+Math.imul(fe,Jt)|0)+Math.imul(De,At)|0,p=p+Math.imul(De,Jt)|0,g=g+Math.imul(ne,Bt)|0,m=(m=m+Math.imul(ne,Rn)|0)+Math.imul(ue,Bt)|0,p=p+Math.imul(ue,Rn)|0,g=g+Math.imul(F,Ut)|0,m=(m=m+Math.imul(F,Fn)|0)+Math.imul(K,Ut)|0,p=p+Math.imul(K,Fn)|0;var xi=(L+(g=g+Math.imul($,Nt)|0)|0)+((8191&(m=(m=m+Math.imul($,Mn)|0)+Math.imul(Y,Nt)|0))<<13)|0;L=((p=p+Math.imul(Y,Mn)|0)+(m>>>13)|0)+(xi>>>26)|0,xi&=67108863,g=Math.imul(Ae,Pt),m=(m=Math.imul(Ae,en))+Math.imul(qe,Pt)|0,p=Math.imul(qe,en),g=g+Math.imul(pe,At)|0,m=(m=m+Math.imul(pe,Jt)|0)+Math.imul(ve,At)|0,p=p+Math.imul(ve,Jt)|0,g=g+Math.imul(fe,Bt)|0,m=(m=m+Math.imul(fe,Rn)|0)+Math.imul(De,Bt)|0,p=p+Math.imul(De,Rn)|0,g=g+Math.imul(ne,Ut)|0,m=(m=m+Math.imul(ne,Fn)|0)+Math.imul(ue,Ut)|0,p=p+Math.imul(ue,Fn)|0,g=g+Math.imul(F,Nt)|0,m=(m=m+Math.imul(F,Mn)|0)+Math.imul(K,Nt)|0,p=p+Math.imul(K,Mn)|0;var vi=(L+(g=g+Math.imul($,Ft)|0)|0)+((8191&(m=(m=m+Math.imul($,An)|0)+Math.imul(Y,Ft)|0))<<13)|0;L=((p=p+Math.imul(Y,An)|0)+(m>>>13)|0)+(vi>>>26)|0,vi&=67108863,g=Math.imul(Be,Pt),m=(m=Math.imul(Be,en))+Math.imul(gt,Pt)|0,p=Math.imul(gt,en),g=g+Math.imul(Ae,At)|0,m=(m=m+Math.imul(Ae,Jt)|0)+Math.imul(qe,At)|0,p=p+Math.imul(qe,Jt)|0,g=g+Math.imul(pe,Bt)|0,m=(m=m+Math.imul(pe,Rn)|0)+Math.imul(ve,Bt)|0,p=p+Math.imul(ve,Rn)|0,g=g+Math.imul(fe,Ut)|0,m=(m=m+Math.imul(fe,Fn)|0)+Math.imul(De,Ut)|0,p=p+Math.imul(De,Fn)|0,g=g+Math.imul(ne,Nt)|0,m=(m=m+Math.imul(ne,Mn)|0)+Math.imul(ue,Nt)|0,p=p+Math.imul(ue,Mn)|0,g=g+Math.imul(F,Ft)|0,m=(m=m+Math.imul(F,An)|0)+Math.imul(K,Ft)|0,p=p+Math.imul(K,An)|0;var Vi=(L+(g=g+Math.imul($,Qt)|0)|0)+((8191&(m=(m=m+Math.imul($,Ln)|0)+Math.imul(Y,Qt)|0))<<13)|0;L=((p=p+Math.imul(Y,Ln)|0)+(m>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,g=Math.imul(ot,Pt),m=(m=Math.imul(ot,en))+Math.imul(Wt,Pt)|0,p=Math.imul(Wt,en),g=g+Math.imul(Be,At)|0,m=(m=m+Math.imul(Be,Jt)|0)+Math.imul(gt,At)|0,p=p+Math.imul(gt,Jt)|0,g=g+Math.imul(Ae,Bt)|0,m=(m=m+Math.imul(Ae,Rn)|0)+Math.imul(qe,Bt)|0,p=p+Math.imul(qe,Rn)|0,g=g+Math.imul(pe,Ut)|0,m=(m=m+Math.imul(pe,Fn)|0)+Math.imul(ve,Ut)|0,p=p+Math.imul(ve,Fn)|0,g=g+Math.imul(fe,Nt)|0,m=(m=m+Math.imul(fe,Mn)|0)+Math.imul(De,Nt)|0,p=p+Math.imul(De,Mn)|0,g=g+Math.imul(ne,Ft)|0,m=(m=m+Math.imul(ne,An)|0)+Math.imul(ue,Ft)|0,p=p+Math.imul(ue,An)|0,g=g+Math.imul(F,Qt)|0,m=(m=m+Math.imul(F,Ln)|0)+Math.imul(K,Qt)|0,p=p+Math.imul(K,Ln)|0;var dr=(L+(g=g+Math.imul($,Kt)|0)|0)+((8191&(m=(m=m+Math.imul($,Pn)|0)+Math.imul(Y,Kt)|0))<<13)|0;L=((p=p+Math.imul(Y,Pn)|0)+(m>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(at,Pt),m=(m=Math.imul(at,en))+Math.imul(Rt,Pt)|0,p=Math.imul(Rt,en),g=g+Math.imul(ot,At)|0,m=(m=m+Math.imul(ot,Jt)|0)+Math.imul(Wt,At)|0,p=p+Math.imul(Wt,Jt)|0,g=g+Math.imul(Be,Bt)|0,m=(m=m+Math.imul(Be,Rn)|0)+Math.imul(gt,Bt)|0,p=p+Math.imul(gt,Rn)|0,g=g+Math.imul(Ae,Ut)|0,m=(m=m+Math.imul(Ae,Fn)|0)+Math.imul(qe,Ut)|0,p=p+Math.imul(qe,Fn)|0,g=g+Math.imul(pe,Nt)|0,m=(m=m+Math.imul(pe,Mn)|0)+Math.imul(ve,Nt)|0,p=p+Math.imul(ve,Mn)|0,g=g+Math.imul(fe,Ft)|0,m=(m=m+Math.imul(fe,An)|0)+Math.imul(De,Ft)|0,p=p+Math.imul(De,An)|0,g=g+Math.imul(ne,Qt)|0,m=(m=m+Math.imul(ne,Ln)|0)+Math.imul(ue,Qt)|0,p=p+Math.imul(ue,Ln)|0,g=g+Math.imul(F,Kt)|0,m=(m=m+Math.imul(F,Pn)|0)+Math.imul(K,Kt)|0,p=p+Math.imul(K,Pn)|0;var jn=(L+(g=g+Math.imul($,qt)|0)|0)+((8191&(m=(m=m+Math.imul($,pn)|0)+Math.imul(Y,qt)|0))<<13)|0;L=((p=p+Math.imul(Y,pn)|0)+(m>>>13)|0)+(jn>>>26)|0,jn&=67108863,g=Math.imul(Lt,Pt),m=(m=Math.imul(Lt,en))+Math.imul(rn,Pt)|0,p=Math.imul(rn,en),g=g+Math.imul(at,At)|0,m=(m=m+Math.imul(at,Jt)|0)+Math.imul(Rt,At)|0,p=p+Math.imul(Rt,Jt)|0,g=g+Math.imul(ot,Bt)|0,m=(m=m+Math.imul(ot,Rn)|0)+Math.imul(Wt,Bt)|0,p=p+Math.imul(Wt,Rn)|0,g=g+Math.imul(Be,Ut)|0,m=(m=m+Math.imul(Be,Fn)|0)+Math.imul(gt,Ut)|0,p=p+Math.imul(gt,Fn)|0,g=g+Math.imul(Ae,Nt)|0,m=(m=m+Math.imul(Ae,Mn)|0)+Math.imul(qe,Nt)|0,p=p+Math.imul(qe,Mn)|0,g=g+Math.imul(pe,Ft)|0,m=(m=m+Math.imul(pe,An)|0)+Math.imul(ve,Ft)|0,p=p+Math.imul(ve,An)|0,g=g+Math.imul(fe,Qt)|0,m=(m=m+Math.imul(fe,Ln)|0)+Math.imul(De,Qt)|0,p=p+Math.imul(De,Ln)|0,g=g+Math.imul(ne,Kt)|0,m=(m=m+Math.imul(ne,Pn)|0)+Math.imul(ue,Kt)|0,p=p+Math.imul(ue,Pn)|0,g=g+Math.imul(F,qt)|0,m=(m=m+Math.imul(F,pn)|0)+Math.imul(K,qt)|0,p=p+Math.imul(K,pn)|0;var yi=(L+(g=g+Math.imul($,Yt)|0)|0)+((8191&(m=(m=m+Math.imul($,$n)|0)+Math.imul(Y,Yt)|0))<<13)|0;L=((p=p+Math.imul(Y,$n)|0)+(m>>>13)|0)+(yi>>>26)|0,yi&=67108863,g=Math.imul(Lt,At),m=(m=Math.imul(Lt,Jt))+Math.imul(rn,At)|0,p=Math.imul(rn,Jt),g=g+Math.imul(at,Bt)|0,m=(m=m+Math.imul(at,Rn)|0)+Math.imul(Rt,Bt)|0,p=p+Math.imul(Rt,Rn)|0,g=g+Math.imul(ot,Ut)|0,m=(m=m+Math.imul(ot,Fn)|0)+Math.imul(Wt,Ut)|0,p=p+Math.imul(Wt,Fn)|0,g=g+Math.imul(Be,Nt)|0,m=(m=m+Math.imul(Be,Mn)|0)+Math.imul(gt,Nt)|0,p=p+Math.imul(gt,Mn)|0,g=g+Math.imul(Ae,Ft)|0,m=(m=m+Math.imul(Ae,An)|0)+Math.imul(qe,Ft)|0,p=p+Math.imul(qe,An)|0,g=g+Math.imul(pe,Qt)|0,m=(m=m+Math.imul(pe,Ln)|0)+Math.imul(ve,Qt)|0,p=p+Math.imul(ve,Ln)|0,g=g+Math.imul(fe,Kt)|0,m=(m=m+Math.imul(fe,Pn)|0)+Math.imul(De,Kt)|0,p=p+Math.imul(De,Pn)|0,g=g+Math.imul(ne,qt)|0,m=(m=m+Math.imul(ne,pn)|0)+Math.imul(ue,qt)|0,p=p+Math.imul(ue,pn)|0;var Ui=(L+(g=g+Math.imul(F,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(F,$n)|0)+Math.imul(K,Yt)|0))<<13)|0;L=((p=p+Math.imul(K,$n)|0)+(m>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,g=Math.imul(Lt,Bt),m=(m=Math.imul(Lt,Rn))+Math.imul(rn,Bt)|0,p=Math.imul(rn,Rn),g=g+Math.imul(at,Ut)|0,m=(m=m+Math.imul(at,Fn)|0)+Math.imul(Rt,Ut)|0,p=p+Math.imul(Rt,Fn)|0,g=g+Math.imul(ot,Nt)|0,m=(m=m+Math.imul(ot,Mn)|0)+Math.imul(Wt,Nt)|0,p=p+Math.imul(Wt,Mn)|0,g=g+Math.imul(Be,Ft)|0,m=(m=m+Math.imul(Be,An)|0)+Math.imul(gt,Ft)|0,p=p+Math.imul(gt,An)|0,g=g+Math.imul(Ae,Qt)|0,m=(m=m+Math.imul(Ae,Ln)|0)+Math.imul(qe,Qt)|0,p=p+Math.imul(qe,Ln)|0,g=g+Math.imul(pe,Kt)|0,m=(m=m+Math.imul(pe,Pn)|0)+Math.imul(ve,Kt)|0,p=p+Math.imul(ve,Pn)|0,g=g+Math.imul(fe,qt)|0,m=(m=m+Math.imul(fe,pn)|0)+Math.imul(De,qt)|0,p=p+Math.imul(De,pn)|0;var Ai=(L+(g=g+Math.imul(ne,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(ne,$n)|0)+Math.imul(ue,Yt)|0))<<13)|0;L=((p=p+Math.imul(ue,$n)|0)+(m>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,g=Math.imul(Lt,Ut),m=(m=Math.imul(Lt,Fn))+Math.imul(rn,Ut)|0,p=Math.imul(rn,Fn),g=g+Math.imul(at,Nt)|0,m=(m=m+Math.imul(at,Mn)|0)+Math.imul(Rt,Nt)|0,p=p+Math.imul(Rt,Mn)|0,g=g+Math.imul(ot,Ft)|0,m=(m=m+Math.imul(ot,An)|0)+Math.imul(Wt,Ft)|0,p=p+Math.imul(Wt,An)|0,g=g+Math.imul(Be,Qt)|0,m=(m=m+Math.imul(Be,Ln)|0)+Math.imul(gt,Qt)|0,p=p+Math.imul(gt,Ln)|0,g=g+Math.imul(Ae,Kt)|0,m=(m=m+Math.imul(Ae,Pn)|0)+Math.imul(qe,Kt)|0,p=p+Math.imul(qe,Pn)|0,g=g+Math.imul(pe,qt)|0,m=(m=m+Math.imul(pe,pn)|0)+Math.imul(ve,qt)|0,p=p+Math.imul(ve,pn)|0;var Ki=(L+(g=g+Math.imul(fe,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(fe,$n)|0)+Math.imul(De,Yt)|0))<<13)|0;L=((p=p+Math.imul(De,$n)|0)+(m>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,g=Math.imul(Lt,Nt),m=(m=Math.imul(Lt,Mn))+Math.imul(rn,Nt)|0,p=Math.imul(rn,Mn),g=g+Math.imul(at,Ft)|0,m=(m=m+Math.imul(at,An)|0)+Math.imul(Rt,Ft)|0,p=p+Math.imul(Rt,An)|0,g=g+Math.imul(ot,Qt)|0,m=(m=m+Math.imul(ot,Ln)|0)+Math.imul(Wt,Qt)|0,p=p+Math.imul(Wt,Ln)|0,g=g+Math.imul(Be,Kt)|0,m=(m=m+Math.imul(Be,Pn)|0)+Math.imul(gt,Kt)|0,p=p+Math.imul(gt,Pn)|0,g=g+Math.imul(Ae,qt)|0,m=(m=m+Math.imul(Ae,pn)|0)+Math.imul(qe,qt)|0,p=p+Math.imul(qe,pn)|0;var ri=(L+(g=g+Math.imul(pe,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(pe,$n)|0)+Math.imul(ve,Yt)|0))<<13)|0;L=((p=p+Math.imul(ve,$n)|0)+(m>>>13)|0)+(ri>>>26)|0,ri&=67108863,g=Math.imul(Lt,Ft),m=(m=Math.imul(Lt,An))+Math.imul(rn,Ft)|0,p=Math.imul(rn,An),g=g+Math.imul(at,Qt)|0,m=(m=m+Math.imul(at,Ln)|0)+Math.imul(Rt,Qt)|0,p=p+Math.imul(Rt,Ln)|0,g=g+Math.imul(ot,Kt)|0,m=(m=m+Math.imul(ot,Pn)|0)+Math.imul(Wt,Kt)|0,p=p+Math.imul(Wt,Pn)|0,g=g+Math.imul(Be,qt)|0,m=(m=m+Math.imul(Be,pn)|0)+Math.imul(gt,qt)|0,p=p+Math.imul(gt,pn)|0;var ii=(L+(g=g+Math.imul(Ae,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(Ae,$n)|0)+Math.imul(qe,Yt)|0))<<13)|0;L=((p=p+Math.imul(qe,$n)|0)+(m>>>13)|0)+(ii>>>26)|0,ii&=67108863,g=Math.imul(Lt,Qt),m=(m=Math.imul(Lt,Ln))+Math.imul(rn,Qt)|0,p=Math.imul(rn,Ln),g=g+Math.imul(at,Kt)|0,m=(m=m+Math.imul(at,Pn)|0)+Math.imul(Rt,Kt)|0,p=p+Math.imul(Rt,Pn)|0,g=g+Math.imul(ot,qt)|0,m=(m=m+Math.imul(ot,pn)|0)+Math.imul(Wt,qt)|0,p=p+Math.imul(Wt,pn)|0;var kr=(L+(g=g+Math.imul(Be,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(Be,$n)|0)+Math.imul(gt,Yt)|0))<<13)|0;L=((p=p+Math.imul(gt,$n)|0)+(m>>>13)|0)+(kr>>>26)|0,kr&=67108863,g=Math.imul(Lt,Kt),m=(m=Math.imul(Lt,Pn))+Math.imul(rn,Kt)|0,p=Math.imul(rn,Pn),g=g+Math.imul(at,qt)|0,m=(m=m+Math.imul(at,pn)|0)+Math.imul(Rt,qt)|0,p=p+Math.imul(Rt,pn)|0;var qr=(L+(g=g+Math.imul(ot,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(ot,$n)|0)+Math.imul(Wt,Yt)|0))<<13)|0;L=((p=p+Math.imul(Wt,$n)|0)+(m>>>13)|0)+(qr>>>26)|0,qr&=67108863,g=Math.imul(Lt,qt),m=(m=Math.imul(Lt,pn))+Math.imul(rn,qt)|0,p=Math.imul(rn,pn);var Ti=(L+(g=g+Math.imul(at,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(at,$n)|0)+Math.imul(Rt,Yt)|0))<<13)|0;L=((p=p+Math.imul(Rt,$n)|0)+(m>>>13)|0)+(Ti>>>26)|0,Ti&=67108863;var Oi=(L+(g=Math.imul(Lt,Yt))|0)+((8191&(m=(m=Math.imul(Lt,$n))+Math.imul(rn,Yt)|0))<<13)|0;return L=((p=Math.imul(rn,$n))+(m>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,T[0]=Cn,T[1]=On,T[2]=Fi,T[3]=ji,T[4]=xi,T[5]=vi,T[6]=Vi,T[7]=dr,T[8]=jn,T[9]=yi,T[10]=Ui,T[11]=Ai,T[12]=Ki,T[13]=ri,T[14]=ii,T[15]=kr,T[16]=qr,T[17]=Ti,T[18]=Oi,L!==0&&(T[19]=L,d.length++),d};function ee(S,P,d){return new te().mulp(S,P,d)}function te(S,P){this.x=S,this.y=P}Math.imul||(H=z),i.prototype.mulTo=function(S,P){var d,g=this.length+S.length;return d=this.length===10&&S.length===10?H(this,S,P):g<63?z(this,S,P):g<1024?function(m,p,f){f.negative=p.negative^m.negative,f.length=m.length+p.length;for(var _=0,T=0,L=0;L>>26)|0)>>>26,B&=67108863}f.words[L]=$,_=B,B=T}return _!==0?f.words[L]=_:f.length--,f.strip()}(this,S,P):ee(this,S,P),d},te.prototype.makeRBT=function(S){for(var P=new Array(S),d=i.prototype._countBits(S)-1,g=0;g>=1;return g},te.prototype.permute=function(S,P,d,g,m,p){for(var f=0;f>>=1)m++;return 1<>>=13,d[2*p+1]=8191&m,m>>>=13;for(p=2*P;p>=26,P+=g/67108864|0,P+=m>>>26,this.words[d]=67108863&m}return P!==0&&(this.words[d]=P,this.length++),this},i.prototype.muln=function(S){return this.clone().imuln(S)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(S){var P=function(p){for(var f=new Array(p.bitLength()),_=0;_>>L}return f}(S);if(P.length===0)return new i(1);for(var d=this,g=0;g=0);var P,d=S%26,g=(S-d)/26,m=67108863>>>26-d<<26-d;if(d!==0){var p=0;for(P=0;P>>26-d}p&&(this.words[P]=p,this.length++)}if(g!==0){for(P=this.length-1;P>=0;P--)this.words[P+g]=this.words[P];for(P=0;P=0),g=P?(P-P%26)/26:0;var m=S%26,p=Math.min((S-m)/26,this.length),f=67108863^67108863>>>m<p)for(this.length-=p,T=0;T=0&&(L!==0||T>=g);T--){var B=0|this.words[T];this.words[T]=L<<26-m|B>>>m,L=B&f}return _&&L!==0&&(_.words[_.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(S,P,d){return r(this.negative===0),this.iushrn(S,P,d)},i.prototype.shln=function(S){return this.clone().ishln(S)},i.prototype.ushln=function(S){return this.clone().iushln(S)},i.prototype.shrn=function(S){return this.clone().ishrn(S)},i.prototype.ushrn=function(S){return this.clone().iushrn(S)},i.prototype.testn=function(S){r(typeof S=="number"&&S>=0);var P=S%26,d=(S-P)/26,g=1<=0);var P=S%26,d=(S-P)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(P!==0&&d++,this.length=Math.min(d,this.length),P!==0){var g=67108863^67108863>>>P<=67108864;P++)this.words[P]-=67108864,P===this.length-1?this.words[P+1]=1:this.words[P+1]++;return this.length=Math.max(this.length,P+1),this},i.prototype.isubn=function(S){if(r(typeof S=="number"),r(S<67108864),S<0)return this.iaddn(-S);if(this.negative!==0)return this.negative=0,this.iaddn(S),this.negative=1,this;if(this.words[0]-=S,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var P=0;P>26)-(_/67108864|0),this.words[g+d]=67108863&m}for(;g>26,this.words[g+d]=67108863&m;if(f===0)return this.strip();for(r(f===-1),f=0,g=0;g>26,this.words[g]=67108863&m;return this.negative=1,this.strip()},i.prototype._wordDiv=function(S,P){var d=(this.length,S.length),g=this.clone(),m=S,p=0|m.words[m.length-1];(d=26-this._countBits(p))!=0&&(m=m.ushln(d),g.iushln(d),p=0|m.words[m.length-1]);var f,_=g.length-m.length;if(P!=="mod"){(f=new i(null)).length=_+1,f.words=new Array(f.length);for(var T=0;T=0;B--){var $=67108864*(0|g.words[m.length+B])+(0|g.words[m.length+B-1]);for($=Math.min($/p|0,67108863),g._ishlnsubmul(m,$,B);g.negative!==0;)$--,g.negative=0,g._ishlnsubmul(m,1,B),g.isZero()||(g.negative^=1);f&&(f.words[B]=$)}return f&&f.strip(),g.strip(),P!=="div"&&d!==0&&g.iushrn(d),{div:f||null,mod:g}},i.prototype.divmod=function(S,P,d){return r(!S.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&S.negative===0?(p=this.neg().divmod(S,P),P!=="mod"&&(g=p.div.neg()),P!=="div"&&(m=p.mod.neg(),d&&m.negative!==0&&m.iadd(S)),{div:g,mod:m}):this.negative===0&&S.negative!==0?(p=this.divmod(S.neg(),P),P!=="mod"&&(g=p.div.neg()),{div:g,mod:p.mod}):this.negative&S.negative?(p=this.neg().divmod(S.neg(),P),P!=="div"&&(m=p.mod.neg(),d&&m.negative!==0&&m.isub(S)),{div:p.div,mod:m}):S.length>this.length||this.cmp(S)<0?{div:new i(0),mod:this}:S.length===1?P==="div"?{div:this.divn(S.words[0]),mod:null}:P==="mod"?{div:null,mod:new i(this.modn(S.words[0]))}:{div:this.divn(S.words[0]),mod:new i(this.modn(S.words[0]))}:this._wordDiv(S,P);var g,m,p},i.prototype.div=function(S){return this.divmod(S,"div",!1).div},i.prototype.mod=function(S){return this.divmod(S,"mod",!1).mod},i.prototype.umod=function(S){return this.divmod(S,"mod",!0).mod},i.prototype.divRound=function(S){var P=this.divmod(S);if(P.mod.isZero())return P.div;var d=P.div.negative!==0?P.mod.isub(S):P.mod,g=S.ushrn(1),m=S.andln(1),p=d.cmp(g);return p<0||m===1&&p===0?P.div:P.div.negative!==0?P.div.isubn(1):P.div.iaddn(1)},i.prototype.modn=function(S){r(S<=67108863);for(var P=(1<<26)%S,d=0,g=this.length-1;g>=0;g--)d=(P*d+(0|this.words[g]))%S;return d},i.prototype.idivn=function(S){r(S<=67108863);for(var P=0,d=this.length-1;d>=0;d--){var g=(0|this.words[d])+67108864*P;this.words[d]=g/S|0,P=g%S}return this.strip()},i.prototype.divn=function(S){return this.clone().idivn(S)},i.prototype.egcd=function(S){r(S.negative===0),r(!S.isZero());var P=this,d=S.clone();P=P.negative!==0?P.umod(S):P.clone();for(var g=new i(1),m=new i(0),p=new i(0),f=new i(1),_=0;P.isEven()&&d.isEven();)P.iushrn(1),d.iushrn(1),++_;for(var T=d.clone(),L=P.clone();!P.isZero();){for(var B=0,$=1;!(P.words[0]&$)&&B<26;++B,$<<=1);if(B>0)for(P.iushrn(B);B-- >0;)(g.isOdd()||m.isOdd())&&(g.iadd(T),m.isub(L)),g.iushrn(1),m.iushrn(1);for(var Y=0,q=1;!(d.words[0]&q)&&Y<26;++Y,q<<=1);if(Y>0)for(d.iushrn(Y);Y-- >0;)(p.isOdd()||f.isOdd())&&(p.iadd(T),f.isub(L)),p.iushrn(1),f.iushrn(1);P.cmp(d)>=0?(P.isub(d),g.isub(p),m.isub(f)):(d.isub(P),p.isub(g),f.isub(m))}return{a:p,b:f,gcd:d.iushln(_)}},i.prototype._invmp=function(S){r(S.negative===0),r(!S.isZero());var P=this,d=S.clone();P=P.negative!==0?P.umod(S):P.clone();for(var g,m=new i(1),p=new i(0),f=d.clone();P.cmpn(1)>0&&d.cmpn(1)>0;){for(var _=0,T=1;!(P.words[0]&T)&&_<26;++_,T<<=1);if(_>0)for(P.iushrn(_);_-- >0;)m.isOdd()&&m.iadd(f),m.iushrn(1);for(var L=0,B=1;!(d.words[0]&B)&&L<26;++L,B<<=1);if(L>0)for(d.iushrn(L);L-- >0;)p.isOdd()&&p.iadd(f),p.iushrn(1);P.cmp(d)>=0?(P.isub(d),m.isub(p)):(d.isub(P),p.isub(m))}return(g=P.cmpn(1)===0?m:p).cmpn(0)<0&&g.iadd(S),g},i.prototype.gcd=function(S){if(this.isZero())return S.abs();if(S.isZero())return this.abs();var P=this.clone(),d=S.clone();P.negative=0,d.negative=0;for(var g=0;P.isEven()&&d.isEven();g++)P.iushrn(1),d.iushrn(1);for(;;){for(;P.isEven();)P.iushrn(1);for(;d.isEven();)d.iushrn(1);var m=P.cmp(d);if(m<0){var p=P;P=d,d=p}else if(m===0||d.cmpn(1)===0)break;P.isub(d)}return d.iushln(g)},i.prototype.invm=function(S){return this.egcd(S).a.umod(S)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(S){return this.words[0]&S},i.prototype.bincn=function(S){r(typeof S=="number");var P=S%26,d=(S-P)/26,g=1<>>26,f&=67108863,this.words[p]=f}return m!==0&&(this.words[p]=m,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(S){var P,d=S<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;if(this.strip(),this.length>1)P=1;else{d&&(S=-S),r(S<=67108863,"Number is too big");var g=0|this.words[0];P=g===S?0:gS.length)return 1;if(this.length=0;d--){var g=0|this.words[d],m=0|S.words[d];if(g!==m){gm&&(P=1);break}}return P},i.prototype.gtn=function(S){return this.cmpn(S)===1},i.prototype.gt=function(S){return this.cmp(S)===1},i.prototype.gten=function(S){return this.cmpn(S)>=0},i.prototype.gte=function(S){return this.cmp(S)>=0},i.prototype.ltn=function(S){return this.cmpn(S)===-1},i.prototype.lt=function(S){return this.cmp(S)===-1},i.prototype.lten=function(S){return this.cmpn(S)<=0},i.prototype.lte=function(S){return this.cmp(S)<=0},i.prototype.eqn=function(S){return this.cmpn(S)===0},i.prototype.eq=function(S){return this.cmp(S)===0},i.red=function(S){return new Fe(S)},i.prototype.toRed=function(S){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),S.convertTo(this)._forceRed(S)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(S){return this.red=S,this},i.prototype.forceRed=function(S){return r(!this.red,"Already a number in reduction context"),this._forceRed(S)},i.prototype.redAdd=function(S){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,S)},i.prototype.redIAdd=function(S){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,S)},i.prototype.redSub=function(S){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,S)},i.prototype.redISub=function(S){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,S)},i.prototype.redShl=function(S){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,S)},i.prototype.redMul=function(S){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.mul(this,S)},i.prototype.redIMul=function(S){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.imul(this,S)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(S){return r(this.red&&!S.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,S)};var se={k256:null,p224:null,p192:null,p25519:null};function oe(S,P){this.name=S,this.p=new i(P,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function Ee(){oe.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function we(){oe.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Ce(){oe.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function ze(){oe.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Fe(S){if(typeof S=="string"){var P=i._prime(S);this.m=P.p,this.prime=P}else r(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}function $e(S){Fe.call(this,S),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}oe.prototype._tmp=function(){var S=new i(null);return S.words=new Array(Math.ceil(this.n/13)),S},oe.prototype.ireduce=function(S){var P,d=S;do this.split(d,this.tmp),P=(d=(d=this.imulK(d)).iadd(this.tmp)).bitLength();while(P>this.n);var g=P0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},oe.prototype.split=function(S,P){S.iushrn(this.n,0,P)},oe.prototype.imulK=function(S){return S.imul(this.k)},a(Ee,oe),Ee.prototype.split=function(S,P){for(var d=4194303,g=Math.min(S.length,9),m=0;m>>22,p=f}p>>>=22,S.words[m-10]=p,p===0&&S.length>10?S.length-=10:S.length-=9},Ee.prototype.imulK=function(S){S.words[S.length]=0,S.words[S.length+1]=0,S.length+=2;for(var P=0,d=0;d>>=26,S.words[d]=m,P=g}return P!==0&&(S.words[S.length++]=P),S},i._prime=function(S){if(se[S])return se[S];var P;if(S==="k256")P=new Ee;else if(S==="p224")P=new we;else if(S==="p192")P=new Ce;else{if(S!=="p25519")throw new Error("Unknown prime "+S);P=new ze}return se[S]=P,P},Fe.prototype._verify1=function(S){r(S.negative===0,"red works only with positives"),r(S.red,"red works only with red numbers")},Fe.prototype._verify2=function(S,P){r((S.negative|P.negative)==0,"red works only with positives"),r(S.red&&S.red===P.red,"red works only with red numbers")},Fe.prototype.imod=function(S){return this.prime?this.prime.ireduce(S)._forceRed(this):S.umod(this.m)._forceRed(this)},Fe.prototype.neg=function(S){return S.isZero()?S.clone():this.m.sub(S)._forceRed(this)},Fe.prototype.add=function(S,P){this._verify2(S,P);var d=S.add(P);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},Fe.prototype.iadd=function(S,P){this._verify2(S,P);var d=S.iadd(P);return d.cmp(this.m)>=0&&d.isub(this.m),d},Fe.prototype.sub=function(S,P){this._verify2(S,P);var d=S.sub(P);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},Fe.prototype.isub=function(S,P){this._verify2(S,P);var d=S.isub(P);return d.cmpn(0)<0&&d.iadd(this.m),d},Fe.prototype.shl=function(S,P){return this._verify1(S),this.imod(S.ushln(P))},Fe.prototype.imul=function(S,P){return this._verify2(S,P),this.imod(S.imul(P))},Fe.prototype.mul=function(S,P){return this._verify2(S,P),this.imod(S.mul(P))},Fe.prototype.isqr=function(S){return this.imul(S,S.clone())},Fe.prototype.sqr=function(S){return this.mul(S,S)},Fe.prototype.sqrt=function(S){if(S.isZero())return S.clone();var P=this.m.andln(3);if(r(P%2==1),P===3){var d=this.m.add(new i(1)).iushrn(2);return this.pow(S,d)}for(var g=this.m.subn(1),m=0;!g.isZero()&&g.andln(1)===0;)m++,g.iushrn(1);r(!g.isZero());var p=new i(1).toRed(this),f=p.redNeg(),_=this.m.subn(1).iushrn(1),T=this.m.bitLength();for(T=new i(2*T*T).toRed(this);this.pow(T,_).cmp(f)!==0;)T.redIAdd(f);for(var L=this.pow(T,g),B=this.pow(S,g.addn(1).iushrn(1)),$=this.pow(S,g),Y=m;$.cmp(p)!==0;){for(var q=$,F=0;q.cmp(p)!==0;F++)q=q.redSqr();r(F=0;g--){for(var T=P.words[g],L=_-1;L>=0;L--){var B=T>>L&1;m!==d[0]&&(m=this.sqr(m)),B!==0||p!==0?(p<<=1,p|=B,(++f==4||g===0&&L===0)&&(m=this.mul(m,d[p]),f=0,p=0)):f=0}_=26}return m},Fe.prototype.convertTo=function(S){var P=S.umod(this.m);return P===S?P.clone():P},Fe.prototype.convertFrom=function(S){var P=S.clone();return P.red=null,P},i.mont=function(S){return new $e(S)},a($e,Fe),$e.prototype.convertTo=function(S){return this.imod(S.ushln(this.shift))},$e.prototype.convertFrom=function(S){var P=this.imod(S.mul(this.rinv));return P.red=null,P},$e.prototype.imul=function(S,P){if(S.isZero()||P.isZero())return S.words[0]=0,S.length=1,S;var d=S.imul(P),g=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(g).iushrn(this.shift),p=m;return m.cmp(this.m)>=0?p=m.isub(this.m):m.cmpn(0)<0&&(p=m.iadd(this.m)),p._forceRed(this)},$e.prototype.mul=function(S,P){if(S.isZero()||P.isZero())return new i(0)._forceRed(this);var d=S.mul(P),g=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(g).iushrn(this.shift),p=m;return m.cmp(this.m)>=0?p=m.isub(this.m):m.cmpn(0)<0&&(p=m.iadd(this.m)),p._forceRed(this)},$e.prototype.invm=function(S){return this.imod(S._invmp(this.m).mul(this.r2))._forceRed(this)}})(e,b)})(tI);var nI,gk,rI,vk,iI,Uo=tI.exports,lw={exports:{}};function yk(){if(nI)return lw.exports;var e;function t(r){this.rand=r}if(nI=1,lw.exports=function(r){return e||(e=new t(null)),e.generate(r)},lw.exports.Rand=t,t.prototype.generate=function(r){return this._rand(r)},t.prototype._rand=function(r){if(this.rand.getBytes)return this.rand.getBytes(r);for(var a=new Uint8Array(r),i=0;i=0);return h},n.prototype._randrange=function(r,a){var i=a.sub(r);return r.add(this._randbelow(i))},n.prototype.test=function(r,a,i){var h=r.bitLength(),y=e.mont(r),k=new e(1).toRed(y);a||(a=Math.max(1,h/48|0));for(var E=r.subn(1),M=0;!E.testn(M);M++);for(var C=r.shrn(M),O=E.toRed(y);a>0;a--){var z=this._randrange(new e(2),E);i&&i(z);var H=z.toRed(y).redPow(C);if(H.cmp(k)!==0&&H.cmp(O)!==0){for(var ee=1;ee0;a--){var O=this._randrange(new e(2),k),z=r.gcd(O);if(z.cmpn(1)!==0)return z;var H=O.toRed(h).redPow(M);if(H.cmp(y)!==0&&H.cmp(C)!==0){for(var ee=1;eete;)oe.ishrn(1);if(oe.isEven()&&oe.iadd(a),oe.testn(1)||oe.iadd(i),se.cmp(i)){if(!se.cmp(h))for(;oe.mod(y).cmp(k);)oe.iadd(M)}else for(;oe.mod(n).cmp(E);)oe.iadd(M);if(z(Ee=oe.shrn(1))&&z(oe)&&H(Ee)&&H(oe)&&r.test(Ee)&&r.test(oe))return oe}}return vk}var bk,sI,uI,bV={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}};function wV(){if(sI)return bk;sI=1;var e=Uo,t=new(oI()),n=new e(24),r=new e(11),a=new e(10),i=new e(3),h=new e(7),y=aI(),k=Uv;function E(H,ee){return ee=ee||"utf8",di(H)||(H=new je(H,ee)),this._pub=new e(H),this}function M(H,ee){return ee=ee||"utf8",di(H)||(H=new je(H,ee)),this._priv=new e(H),this}bk=O;var C={};function O(H,ee,te){this.setGenerator(ee),this.__prime=new e(H),this._prime=e.mont(this.__prime),this._primeLen=H.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,te?(this.setPublicKey=E,this.setPrivateKey=M):this._primeCode=8}function z(H,ee){var te=new je(H.toArray());return ee?te.toString(ee):te}return Object.defineProperty(O.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=function(H,ee){var te=ee.toString("hex"),se=[te,H.toString(16)].join("_");if(se in C)return C[se];var oe,Ee=0;if(H.isEven()||!y.simpleSieve||!y.fermatTest(H)||!t.test(H))return Ee+=1,Ee+=te==="02"||te==="05"?8:4,C[se]=Ee,Ee;switch(t.test(H.shrn(1))||(Ee+=2),te){case"02":H.mod(n).cmp(r)&&(Ee+=8);break;case"05":(oe=H.mod(a)).cmp(i)&&oe.cmp(h)&&(Ee+=8);break;default:Ee+=4}return C[se]=Ee,Ee}(this.__prime,this.__gen)),this._primeCode}}),O.prototype.generateKeys=function(){return this._priv||(this._priv=new e(k(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},O.prototype.computeSecret=function(H){var ee=new je((H=(H=new e(H)).toRed(this._prime)).redPow(this._priv).fromRed().toArray()),te=this.getPrime();if(ee.length=48&&m<=57?m-48:m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:void r(!1,"Invalid character in "+d)}function k(d,g,m){var p=y(d,m);return m-1>=g&&(p|=y(d,m-1)<<4),p}function E(d,g,m,p){for(var f=0,_=0,T=Math.min(d.length,m),L=g;L=49?B-49+10:B>=17?B-17+10:B,r(B>=0&&_0?d:g},i.min=function(d,g){return d.cmp(g)<0?d:g},i.prototype._init=function(d,g,m){if(typeof d=="number")return this._initNumber(d,g,m);if(typeof d=="object")return this._initArray(d,g,m);g==="hex"&&(g=16),r(g===(0|g)&&g>=2&&g<=36);var p=0;(d=d.toString().replace(/\s+/g,""))[0]==="-"&&(p++,this.negative=1),p=0;p-=3)_=d[p]|d[p-1]<<8|d[p-2]<<16,this.words[f]|=_<>>26-T&67108863,(T+=24)>=26&&(T-=26,f++);else if(m==="le")for(p=0,f=0;p>>26-T&67108863,(T+=24)>=26&&(T-=26,f++);return this._strip()},i.prototype._parseHex=function(d,g,m){this.length=Math.ceil((d.length-g)/6),this.words=new Array(this.length);for(var p=0;p=g;p-=2)f=k(d,g,p)<<_,this.words[T]|=67108863&f,_>=18?(_-=18,T+=1,this.words[T]|=f>>>26):_+=8;else for(p=(d.length-g)%2==0?g+1:g;p=18?(_-=18,T+=1,this.words[T]|=f>>>26):_+=8;this._strip()},i.prototype._parseBase=function(d,g,m){this.words=[0],this.length=1;for(var p=0,f=1;f<=67108863;f*=g)p++;p--,f=f/g|0;for(var _=d.length-m,T=_%p,L=Math.min(_,_-T)+m,B=0,$=m;$1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=C}catch{i.prototype.inspect=C}else i.prototype.inspect=C;function C(){return(this.red?""}var O=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],z=[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],H=[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];function ee(d,g,m){m.negative=g.negative^d.negative;var p=d.length+g.length|0;m.length=p,p=p-1|0;var f=0|d.words[0],_=0|g.words[0],T=f*_,L=67108863&T,B=T/67108864|0;m.words[0]=L;for(var $=1;$>>26,q=67108863&B,F=Math.min($,g.length-1),K=Math.max(0,$-d.length+1);K<=F;K++){var Z=$-K|0;Y+=(T=(f=0|d.words[Z])*(_=0|g.words[K])+q)/67108864|0,q=67108863&T}m.words[$]=0|q,B=0|Y}return B!==0?m.words[$]=0|B:m.length--,m._strip()}i.prototype.toString=function(d,g){var m;if(g=0|g||1,(d=d||10)===16||d==="hex"){m="";for(var p=0,f=0,_=0;_>>24-p&16777215,(p+=2)>=26&&(p-=26,_--),m=f!==0||_!==this.length-1?O[6-L.length]+L+m:L+m}for(f!==0&&(m=f.toString(16)+m);m.length%g!=0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(d===(0|d)&&d>=2&&d<=36){var B=z[d],$=H[d];m="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var q=Y.modrn($).toString(d);m=(Y=Y.idivn($)).isZero()?q+m:O[B-q.length]+q+m}for(this.isZero()&&(m="0"+m);m.length%g!=0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=67108864*this.words[1]:this.length===3&&this.words[2]===1?d+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},i.prototype.toJSON=function(){return this.toString(16,2)},h&&(i.prototype.toBuffer=function(d,g){return this.toArrayLike(h,d,g)}),i.prototype.toArray=function(d,g){return this.toArrayLike(Array,d,g)},i.prototype.toArrayLike=function(d,g,m){this._strip();var p=this.byteLength(),f=m||Math.max(1,p);r(p<=f,"byte array longer than desired length"),r(f>0,"Requested array length <= 0");var _=function(T,L){return T.allocUnsafe?T.allocUnsafe(L):new T(L)}(d,f);return this["_toArrayLike"+(g==="le"?"LE":"BE")](_,p),_},i.prototype._toArrayLikeLE=function(d,g){for(var m=0,p=0,f=0,_=0;f>8&255),m>16&255),_===6?(m>24&255),p=0,_=0):(p=T>>>24,_+=2)}if(m=0&&(d[m--]=T>>8&255),m>=0&&(d[m--]=T>>16&255),_===6?(m>=0&&(d[m--]=T>>24&255),p=0,_=0):(p=T>>>24,_+=2)}if(m>=0)for(d[m--]=p;m>=0;)d[m--]=0},Math.clz32?i.prototype._countBits=function(d){return 32-Math.clz32(d)}:i.prototype._countBits=function(d){var g=d,m=0;return g>=4096&&(m+=13,g>>>=13),g>=64&&(m+=7,g>>>=7),g>=8&&(m+=4,g>>>=4),g>=2&&(m+=2,g>>>=2),m+g},i.prototype._zeroBits=function(d){if(d===0)return 26;var g=d,m=0;return!(8191&g)&&(m+=13,g>>>=13),!(127&g)&&(m+=7,g>>>=7),!(15&g)&&(m+=4,g>>>=4),!(3&g)&&(m+=2,g>>>=2),!(1&g)&&m++,m},i.prototype.bitLength=function(){var d=this.words[this.length-1],g=this._countBits(d);return 26*(this.length-1)+g},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,g=0;gd.length?this.clone().ior(d):d.clone().ior(this)},i.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},i.prototype.iuand=function(d){var g;g=this.length>d.length?d:this;for(var m=0;md.length?this.clone().iand(d):d.clone().iand(this)},i.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},i.prototype.iuxor=function(d){var g,m;this.length>d.length?(g=this,m=d):(g=d,m=this);for(var p=0;pd.length?this.clone().ixor(d):d.clone().ixor(this)},i.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},i.prototype.inotn=function(d){r(typeof d=="number"&&d>=0);var g=0|Math.ceil(d/26),m=d%26;this._expand(g),m>0&&g--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-m),this._strip()},i.prototype.notn=function(d){return this.clone().inotn(d)},i.prototype.setn=function(d,g){r(typeof d=="number"&&d>=0);var m=d/26|0,p=d%26;return this._expand(m+1),this.words[m]=g?this.words[m]|1<d.length?(m=this,p=d):(m=d,p=this);for(var f=0,_=0;_>>26;for(;f!==0&&_>>26;if(this.length=m.length,f!==0)this.words[this.length]=f,this.length++;else if(m!==this)for(;_d.length?this.clone().iadd(d):d.clone().iadd(this)},i.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var g=this.iadd(d);return d.negative=1,g._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var m,p,f=this.cmp(d);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(m=this,p=d):(m=d,p=this);for(var _=0,T=0;T>26,this.words[T]=67108863&g;for(;_!==0&&T>26,this.words[T]=67108863&g;if(_===0&&T>>13,K=0|T[1],Z=8191&K,ne=K>>>13,ue=0|T[2],me=8191&ue,fe=ue>>>13,De=0|T[3],_e=8191&De,pe=De>>>13,ve=0|T[4],Se=8191&ve,Ae=ve>>>13,qe=0|T[5],Xe=8191&qe,Be=qe>>>13,gt=0|T[6],bt=8191>,ot=gt>>>13,Wt=0|T[7],vt=8191&Wt,at=Wt>>>13,Rt=0|T[8],Dt=8191&Rt,Lt=Rt>>>13,rn=0|T[9],Vt=8191&rn,Pt=rn>>>13,en=0|L[0],on=8191&en,At=en>>>13,Jt=0|L[1],tn=8191&Jt,Bt=Jt>>>13,Rn=0|L[2],wn=8191&Rn,Ut=Rn>>>13,Fn=0|L[3],kn=8191&Fn,Nt=Fn>>>13,Mn=0|L[4],yn=8191&Mn,Ft=Mn>>>13,An=0|L[5],bn=8191&An,Qt=An>>>13,Ln=0|L[6],Bn=8191&Ln,Kt=Ln>>>13,Pn=0|L[7],In=8191&Pn,qt=Pn>>>13,pn=0|L[8],Hn=8191&pn,Yt=pn>>>13,$n=0|L[9],Cn=8191&$n,On=$n>>>13;m.negative=d.negative^g.negative,m.length=19;var Fi=($+(p=Math.imul(q,on))|0)+((8191&(f=(f=Math.imul(q,At))+Math.imul(F,on)|0))<<13)|0;$=((_=Math.imul(F,At))+(f>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,p=Math.imul(Z,on),f=(f=Math.imul(Z,At))+Math.imul(ne,on)|0,_=Math.imul(ne,At);var ji=($+(p=p+Math.imul(q,tn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Bt)|0)+Math.imul(F,tn)|0))<<13)|0;$=((_=_+Math.imul(F,Bt)|0)+(f>>>13)|0)+(ji>>>26)|0,ji&=67108863,p=Math.imul(me,on),f=(f=Math.imul(me,At))+Math.imul(fe,on)|0,_=Math.imul(fe,At),p=p+Math.imul(Z,tn)|0,f=(f=f+Math.imul(Z,Bt)|0)+Math.imul(ne,tn)|0,_=_+Math.imul(ne,Bt)|0;var xi=($+(p=p+Math.imul(q,wn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Ut)|0)+Math.imul(F,wn)|0))<<13)|0;$=((_=_+Math.imul(F,Ut)|0)+(f>>>13)|0)+(xi>>>26)|0,xi&=67108863,p=Math.imul(_e,on),f=(f=Math.imul(_e,At))+Math.imul(pe,on)|0,_=Math.imul(pe,At),p=p+Math.imul(me,tn)|0,f=(f=f+Math.imul(me,Bt)|0)+Math.imul(fe,tn)|0,_=_+Math.imul(fe,Bt)|0,p=p+Math.imul(Z,wn)|0,f=(f=f+Math.imul(Z,Ut)|0)+Math.imul(ne,wn)|0,_=_+Math.imul(ne,Ut)|0;var vi=($+(p=p+Math.imul(q,kn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Nt)|0)+Math.imul(F,kn)|0))<<13)|0;$=((_=_+Math.imul(F,Nt)|0)+(f>>>13)|0)+(vi>>>26)|0,vi&=67108863,p=Math.imul(Se,on),f=(f=Math.imul(Se,At))+Math.imul(Ae,on)|0,_=Math.imul(Ae,At),p=p+Math.imul(_e,tn)|0,f=(f=f+Math.imul(_e,Bt)|0)+Math.imul(pe,tn)|0,_=_+Math.imul(pe,Bt)|0,p=p+Math.imul(me,wn)|0,f=(f=f+Math.imul(me,Ut)|0)+Math.imul(fe,wn)|0,_=_+Math.imul(fe,Ut)|0,p=p+Math.imul(Z,kn)|0,f=(f=f+Math.imul(Z,Nt)|0)+Math.imul(ne,kn)|0,_=_+Math.imul(ne,Nt)|0;var Vi=($+(p=p+Math.imul(q,yn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Ft)|0)+Math.imul(F,yn)|0))<<13)|0;$=((_=_+Math.imul(F,Ft)|0)+(f>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,p=Math.imul(Xe,on),f=(f=Math.imul(Xe,At))+Math.imul(Be,on)|0,_=Math.imul(Be,At),p=p+Math.imul(Se,tn)|0,f=(f=f+Math.imul(Se,Bt)|0)+Math.imul(Ae,tn)|0,_=_+Math.imul(Ae,Bt)|0,p=p+Math.imul(_e,wn)|0,f=(f=f+Math.imul(_e,Ut)|0)+Math.imul(pe,wn)|0,_=_+Math.imul(pe,Ut)|0,p=p+Math.imul(me,kn)|0,f=(f=f+Math.imul(me,Nt)|0)+Math.imul(fe,kn)|0,_=_+Math.imul(fe,Nt)|0,p=p+Math.imul(Z,yn)|0,f=(f=f+Math.imul(Z,Ft)|0)+Math.imul(ne,yn)|0,_=_+Math.imul(ne,Ft)|0;var dr=($+(p=p+Math.imul(q,bn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Qt)|0)+Math.imul(F,bn)|0))<<13)|0;$=((_=_+Math.imul(F,Qt)|0)+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,p=Math.imul(bt,on),f=(f=Math.imul(bt,At))+Math.imul(ot,on)|0,_=Math.imul(ot,At),p=p+Math.imul(Xe,tn)|0,f=(f=f+Math.imul(Xe,Bt)|0)+Math.imul(Be,tn)|0,_=_+Math.imul(Be,Bt)|0,p=p+Math.imul(Se,wn)|0,f=(f=f+Math.imul(Se,Ut)|0)+Math.imul(Ae,wn)|0,_=_+Math.imul(Ae,Ut)|0,p=p+Math.imul(_e,kn)|0,f=(f=f+Math.imul(_e,Nt)|0)+Math.imul(pe,kn)|0,_=_+Math.imul(pe,Nt)|0,p=p+Math.imul(me,yn)|0,f=(f=f+Math.imul(me,Ft)|0)+Math.imul(fe,yn)|0,_=_+Math.imul(fe,Ft)|0,p=p+Math.imul(Z,bn)|0,f=(f=f+Math.imul(Z,Qt)|0)+Math.imul(ne,bn)|0,_=_+Math.imul(ne,Qt)|0;var jn=($+(p=p+Math.imul(q,Bn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Kt)|0)+Math.imul(F,Bn)|0))<<13)|0;$=((_=_+Math.imul(F,Kt)|0)+(f>>>13)|0)+(jn>>>26)|0,jn&=67108863,p=Math.imul(vt,on),f=(f=Math.imul(vt,At))+Math.imul(at,on)|0,_=Math.imul(at,At),p=p+Math.imul(bt,tn)|0,f=(f=f+Math.imul(bt,Bt)|0)+Math.imul(ot,tn)|0,_=_+Math.imul(ot,Bt)|0,p=p+Math.imul(Xe,wn)|0,f=(f=f+Math.imul(Xe,Ut)|0)+Math.imul(Be,wn)|0,_=_+Math.imul(Be,Ut)|0,p=p+Math.imul(Se,kn)|0,f=(f=f+Math.imul(Se,Nt)|0)+Math.imul(Ae,kn)|0,_=_+Math.imul(Ae,Nt)|0,p=p+Math.imul(_e,yn)|0,f=(f=f+Math.imul(_e,Ft)|0)+Math.imul(pe,yn)|0,_=_+Math.imul(pe,Ft)|0,p=p+Math.imul(me,bn)|0,f=(f=f+Math.imul(me,Qt)|0)+Math.imul(fe,bn)|0,_=_+Math.imul(fe,Qt)|0,p=p+Math.imul(Z,Bn)|0,f=(f=f+Math.imul(Z,Kt)|0)+Math.imul(ne,Bn)|0,_=_+Math.imul(ne,Kt)|0;var yi=($+(p=p+Math.imul(q,In)|0)|0)+((8191&(f=(f=f+Math.imul(q,qt)|0)+Math.imul(F,In)|0))<<13)|0;$=((_=_+Math.imul(F,qt)|0)+(f>>>13)|0)+(yi>>>26)|0,yi&=67108863,p=Math.imul(Dt,on),f=(f=Math.imul(Dt,At))+Math.imul(Lt,on)|0,_=Math.imul(Lt,At),p=p+Math.imul(vt,tn)|0,f=(f=f+Math.imul(vt,Bt)|0)+Math.imul(at,tn)|0,_=_+Math.imul(at,Bt)|0,p=p+Math.imul(bt,wn)|0,f=(f=f+Math.imul(bt,Ut)|0)+Math.imul(ot,wn)|0,_=_+Math.imul(ot,Ut)|0,p=p+Math.imul(Xe,kn)|0,f=(f=f+Math.imul(Xe,Nt)|0)+Math.imul(Be,kn)|0,_=_+Math.imul(Be,Nt)|0,p=p+Math.imul(Se,yn)|0,f=(f=f+Math.imul(Se,Ft)|0)+Math.imul(Ae,yn)|0,_=_+Math.imul(Ae,Ft)|0,p=p+Math.imul(_e,bn)|0,f=(f=f+Math.imul(_e,Qt)|0)+Math.imul(pe,bn)|0,_=_+Math.imul(pe,Qt)|0,p=p+Math.imul(me,Bn)|0,f=(f=f+Math.imul(me,Kt)|0)+Math.imul(fe,Bn)|0,_=_+Math.imul(fe,Kt)|0,p=p+Math.imul(Z,In)|0,f=(f=f+Math.imul(Z,qt)|0)+Math.imul(ne,In)|0,_=_+Math.imul(ne,qt)|0;var Ui=($+(p=p+Math.imul(q,Hn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Yt)|0)+Math.imul(F,Hn)|0))<<13)|0;$=((_=_+Math.imul(F,Yt)|0)+(f>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,p=Math.imul(Vt,on),f=(f=Math.imul(Vt,At))+Math.imul(Pt,on)|0,_=Math.imul(Pt,At),p=p+Math.imul(Dt,tn)|0,f=(f=f+Math.imul(Dt,Bt)|0)+Math.imul(Lt,tn)|0,_=_+Math.imul(Lt,Bt)|0,p=p+Math.imul(vt,wn)|0,f=(f=f+Math.imul(vt,Ut)|0)+Math.imul(at,wn)|0,_=_+Math.imul(at,Ut)|0,p=p+Math.imul(bt,kn)|0,f=(f=f+Math.imul(bt,Nt)|0)+Math.imul(ot,kn)|0,_=_+Math.imul(ot,Nt)|0,p=p+Math.imul(Xe,yn)|0,f=(f=f+Math.imul(Xe,Ft)|0)+Math.imul(Be,yn)|0,_=_+Math.imul(Be,Ft)|0,p=p+Math.imul(Se,bn)|0,f=(f=f+Math.imul(Se,Qt)|0)+Math.imul(Ae,bn)|0,_=_+Math.imul(Ae,Qt)|0,p=p+Math.imul(_e,Bn)|0,f=(f=f+Math.imul(_e,Kt)|0)+Math.imul(pe,Bn)|0,_=_+Math.imul(pe,Kt)|0,p=p+Math.imul(me,In)|0,f=(f=f+Math.imul(me,qt)|0)+Math.imul(fe,In)|0,_=_+Math.imul(fe,qt)|0,p=p+Math.imul(Z,Hn)|0,f=(f=f+Math.imul(Z,Yt)|0)+Math.imul(ne,Hn)|0,_=_+Math.imul(ne,Yt)|0;var Ai=($+(p=p+Math.imul(q,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(q,On)|0)+Math.imul(F,Cn)|0))<<13)|0;$=((_=_+Math.imul(F,On)|0)+(f>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,p=Math.imul(Vt,tn),f=(f=Math.imul(Vt,Bt))+Math.imul(Pt,tn)|0,_=Math.imul(Pt,Bt),p=p+Math.imul(Dt,wn)|0,f=(f=f+Math.imul(Dt,Ut)|0)+Math.imul(Lt,wn)|0,_=_+Math.imul(Lt,Ut)|0,p=p+Math.imul(vt,kn)|0,f=(f=f+Math.imul(vt,Nt)|0)+Math.imul(at,kn)|0,_=_+Math.imul(at,Nt)|0,p=p+Math.imul(bt,yn)|0,f=(f=f+Math.imul(bt,Ft)|0)+Math.imul(ot,yn)|0,_=_+Math.imul(ot,Ft)|0,p=p+Math.imul(Xe,bn)|0,f=(f=f+Math.imul(Xe,Qt)|0)+Math.imul(Be,bn)|0,_=_+Math.imul(Be,Qt)|0,p=p+Math.imul(Se,Bn)|0,f=(f=f+Math.imul(Se,Kt)|0)+Math.imul(Ae,Bn)|0,_=_+Math.imul(Ae,Kt)|0,p=p+Math.imul(_e,In)|0,f=(f=f+Math.imul(_e,qt)|0)+Math.imul(pe,In)|0,_=_+Math.imul(pe,qt)|0,p=p+Math.imul(me,Hn)|0,f=(f=f+Math.imul(me,Yt)|0)+Math.imul(fe,Hn)|0,_=_+Math.imul(fe,Yt)|0;var Ki=($+(p=p+Math.imul(Z,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Z,On)|0)+Math.imul(ne,Cn)|0))<<13)|0;$=((_=_+Math.imul(ne,On)|0)+(f>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,p=Math.imul(Vt,wn),f=(f=Math.imul(Vt,Ut))+Math.imul(Pt,wn)|0,_=Math.imul(Pt,Ut),p=p+Math.imul(Dt,kn)|0,f=(f=f+Math.imul(Dt,Nt)|0)+Math.imul(Lt,kn)|0,_=_+Math.imul(Lt,Nt)|0,p=p+Math.imul(vt,yn)|0,f=(f=f+Math.imul(vt,Ft)|0)+Math.imul(at,yn)|0,_=_+Math.imul(at,Ft)|0,p=p+Math.imul(bt,bn)|0,f=(f=f+Math.imul(bt,Qt)|0)+Math.imul(ot,bn)|0,_=_+Math.imul(ot,Qt)|0,p=p+Math.imul(Xe,Bn)|0,f=(f=f+Math.imul(Xe,Kt)|0)+Math.imul(Be,Bn)|0,_=_+Math.imul(Be,Kt)|0,p=p+Math.imul(Se,In)|0,f=(f=f+Math.imul(Se,qt)|0)+Math.imul(Ae,In)|0,_=_+Math.imul(Ae,qt)|0,p=p+Math.imul(_e,Hn)|0,f=(f=f+Math.imul(_e,Yt)|0)+Math.imul(pe,Hn)|0,_=_+Math.imul(pe,Yt)|0;var ri=($+(p=p+Math.imul(me,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(me,On)|0)+Math.imul(fe,Cn)|0))<<13)|0;$=((_=_+Math.imul(fe,On)|0)+(f>>>13)|0)+(ri>>>26)|0,ri&=67108863,p=Math.imul(Vt,kn),f=(f=Math.imul(Vt,Nt))+Math.imul(Pt,kn)|0,_=Math.imul(Pt,Nt),p=p+Math.imul(Dt,yn)|0,f=(f=f+Math.imul(Dt,Ft)|0)+Math.imul(Lt,yn)|0,_=_+Math.imul(Lt,Ft)|0,p=p+Math.imul(vt,bn)|0,f=(f=f+Math.imul(vt,Qt)|0)+Math.imul(at,bn)|0,_=_+Math.imul(at,Qt)|0,p=p+Math.imul(bt,Bn)|0,f=(f=f+Math.imul(bt,Kt)|0)+Math.imul(ot,Bn)|0,_=_+Math.imul(ot,Kt)|0,p=p+Math.imul(Xe,In)|0,f=(f=f+Math.imul(Xe,qt)|0)+Math.imul(Be,In)|0,_=_+Math.imul(Be,qt)|0,p=p+Math.imul(Se,Hn)|0,f=(f=f+Math.imul(Se,Yt)|0)+Math.imul(Ae,Hn)|0,_=_+Math.imul(Ae,Yt)|0;var ii=($+(p=p+Math.imul(_e,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(_e,On)|0)+Math.imul(pe,Cn)|0))<<13)|0;$=((_=_+Math.imul(pe,On)|0)+(f>>>13)|0)+(ii>>>26)|0,ii&=67108863,p=Math.imul(Vt,yn),f=(f=Math.imul(Vt,Ft))+Math.imul(Pt,yn)|0,_=Math.imul(Pt,Ft),p=p+Math.imul(Dt,bn)|0,f=(f=f+Math.imul(Dt,Qt)|0)+Math.imul(Lt,bn)|0,_=_+Math.imul(Lt,Qt)|0,p=p+Math.imul(vt,Bn)|0,f=(f=f+Math.imul(vt,Kt)|0)+Math.imul(at,Bn)|0,_=_+Math.imul(at,Kt)|0,p=p+Math.imul(bt,In)|0,f=(f=f+Math.imul(bt,qt)|0)+Math.imul(ot,In)|0,_=_+Math.imul(ot,qt)|0,p=p+Math.imul(Xe,Hn)|0,f=(f=f+Math.imul(Xe,Yt)|0)+Math.imul(Be,Hn)|0,_=_+Math.imul(Be,Yt)|0;var kr=($+(p=p+Math.imul(Se,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Se,On)|0)+Math.imul(Ae,Cn)|0))<<13)|0;$=((_=_+Math.imul(Ae,On)|0)+(f>>>13)|0)+(kr>>>26)|0,kr&=67108863,p=Math.imul(Vt,bn),f=(f=Math.imul(Vt,Qt))+Math.imul(Pt,bn)|0,_=Math.imul(Pt,Qt),p=p+Math.imul(Dt,Bn)|0,f=(f=f+Math.imul(Dt,Kt)|0)+Math.imul(Lt,Bn)|0,_=_+Math.imul(Lt,Kt)|0,p=p+Math.imul(vt,In)|0,f=(f=f+Math.imul(vt,qt)|0)+Math.imul(at,In)|0,_=_+Math.imul(at,qt)|0,p=p+Math.imul(bt,Hn)|0,f=(f=f+Math.imul(bt,Yt)|0)+Math.imul(ot,Hn)|0,_=_+Math.imul(ot,Yt)|0;var qr=($+(p=p+Math.imul(Xe,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Xe,On)|0)+Math.imul(Be,Cn)|0))<<13)|0;$=((_=_+Math.imul(Be,On)|0)+(f>>>13)|0)+(qr>>>26)|0,qr&=67108863,p=Math.imul(Vt,Bn),f=(f=Math.imul(Vt,Kt))+Math.imul(Pt,Bn)|0,_=Math.imul(Pt,Kt),p=p+Math.imul(Dt,In)|0,f=(f=f+Math.imul(Dt,qt)|0)+Math.imul(Lt,In)|0,_=_+Math.imul(Lt,qt)|0,p=p+Math.imul(vt,Hn)|0,f=(f=f+Math.imul(vt,Yt)|0)+Math.imul(at,Hn)|0,_=_+Math.imul(at,Yt)|0;var Ti=($+(p=p+Math.imul(bt,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(bt,On)|0)+Math.imul(ot,Cn)|0))<<13)|0;$=((_=_+Math.imul(ot,On)|0)+(f>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,p=Math.imul(Vt,In),f=(f=Math.imul(Vt,qt))+Math.imul(Pt,In)|0,_=Math.imul(Pt,qt),p=p+Math.imul(Dt,Hn)|0,f=(f=f+Math.imul(Dt,Yt)|0)+Math.imul(Lt,Hn)|0,_=_+Math.imul(Lt,Yt)|0;var Oi=($+(p=p+Math.imul(vt,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(vt,On)|0)+Math.imul(at,Cn)|0))<<13)|0;$=((_=_+Math.imul(at,On)|0)+(f>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,p=Math.imul(Vt,Hn),f=(f=Math.imul(Vt,Yt))+Math.imul(Pt,Hn)|0,_=Math.imul(Pt,Yt);var xo=($+(p=p+Math.imul(Dt,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Dt,On)|0)+Math.imul(Lt,Cn)|0))<<13)|0;$=((_=_+Math.imul(Lt,On)|0)+(f>>>13)|0)+(xo>>>26)|0,xo&=67108863;var ca=($+(p=Math.imul(Vt,Cn))|0)+((8191&(f=(f=Math.imul(Vt,On))+Math.imul(Pt,Cn)|0))<<13)|0;return $=((_=Math.imul(Pt,On))+(f>>>13)|0)+(ca>>>26)|0,ca&=67108863,B[0]=Fi,B[1]=ji,B[2]=xi,B[3]=vi,B[4]=Vi,B[5]=dr,B[6]=jn,B[7]=yi,B[8]=Ui,B[9]=Ai,B[10]=Ki,B[11]=ri,B[12]=ii,B[13]=kr,B[14]=qr,B[15]=Ti,B[16]=Oi,B[17]=xo,B[18]=ca,$!==0&&(B[19]=$,m.length++),m};function se(d,g,m){m.negative=g.negative^d.negative,m.length=d.length+g.length;for(var p=0,f=0,_=0;_>>26)|0)>>>26,T&=67108863}m.words[_]=L,p=T,T=f}return p!==0?m.words[_]=p:m.length--,m._strip()}function oe(d,g,m){return se(d,g,m)}Math.imul||(te=ee),i.prototype.mulTo=function(d,g){var m=this.length+d.length;return this.length===10&&d.length===10?te(this,d,g):m<63?ee(this,d,g):m<1024?se(this,d,g):oe(this,d,g)},i.prototype.mul=function(d){var g=new i(null);return g.words=new Array(this.length+d.length),this.mulTo(d,g)},i.prototype.mulf=function(d){var g=new i(null);return g.words=new Array(this.length+d.length),oe(this,d,g)},i.prototype.imul=function(d){return this.clone().mulTo(d,this)},i.prototype.imuln=function(d){var g=d<0;g&&(d=-d),r(typeof d=="number"),r(d<67108864);for(var m=0,p=0;p>=26,m+=f/67108864|0,m+=_>>>26,this.words[p]=67108863&_}return m!==0&&(this.words[p]=m,this.length++),g?this.ineg():this},i.prototype.muln=function(d){return this.clone().imuln(d)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(d){var g=function(_){for(var T=new Array(_.bitLength()),L=0;L>>$&1}return T}(d);if(g.length===0)return new i(1);for(var m=this,p=0;p=0);var g,m=d%26,p=(d-m)/26,f=67108863>>>26-m<<26-m;if(m!==0){var _=0;for(g=0;g>>26-m}_&&(this.words[g]=_,this.length++)}if(p!==0){for(g=this.length-1;g>=0;g--)this.words[g+p]=this.words[g];for(g=0;g=0),p=g?(g-g%26)/26:0;var f=d%26,_=Math.min((d-f)/26,this.length),T=67108863^67108863>>>f<_)for(this.length-=_,B=0;B=0&&($!==0||B>=p);B--){var Y=0|this.words[B];this.words[B]=$<<26-f|Y>>>f,$=Y&T}return L&&$!==0&&(L.words[L.length++]=$),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(d,g,m){return r(this.negative===0),this.iushrn(d,g,m)},i.prototype.shln=function(d){return this.clone().ishln(d)},i.prototype.ushln=function(d){return this.clone().iushln(d)},i.prototype.shrn=function(d){return this.clone().ishrn(d)},i.prototype.ushrn=function(d){return this.clone().iushrn(d)},i.prototype.testn=function(d){r(typeof d=="number"&&d>=0);var g=d%26,m=(d-g)/26,p=1<=0);var g=d%26,m=(d-g)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(g!==0&&m++,this.length=Math.min(m,this.length),g!==0){var p=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},i.prototype.isubn=function(d){if(r(typeof d=="number"),r(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(L/67108864|0),this.words[p+m]=67108863&f}for(;p>26,this.words[p+m]=67108863&f;if(T===0)return this._strip();for(r(T===-1),T=0,p=0;p>26,this.words[p]=67108863&f;return this.negative=1,this._strip()},i.prototype._wordDiv=function(d,g){var m=(this.length,d.length),p=this.clone(),f=d,_=0|f.words[f.length-1];(m=26-this._countBits(_))!=0&&(f=f.ushln(m),p.iushln(m),_=0|f.words[f.length-1]);var T,L=p.length-f.length;if(g!=="mod"){(T=new i(null)).length=L+1,T.words=new Array(T.length);for(var B=0;B=0;Y--){var q=67108864*(0|p.words[f.length+Y])+(0|p.words[f.length+Y-1]);for(q=Math.min(q/_|0,67108863),p._ishlnsubmul(f,q,Y);p.negative!==0;)q--,p.negative=0,p._ishlnsubmul(f,1,Y),p.isZero()||(p.negative^=1);T&&(T.words[Y]=q)}return T&&T._strip(),p._strip(),g!=="div"&&m!==0&&p.iushrn(m),{div:T||null,mod:p}},i.prototype.divmod=function(d,g,m){return r(!d.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&d.negative===0?(_=this.neg().divmod(d,g),g!=="mod"&&(p=_.div.neg()),g!=="div"&&(f=_.mod.neg(),m&&f.negative!==0&&f.iadd(d)),{div:p,mod:f}):this.negative===0&&d.negative!==0?(_=this.divmod(d.neg(),g),g!=="mod"&&(p=_.div.neg()),{div:p,mod:_.mod}):this.negative&d.negative?(_=this.neg().divmod(d.neg(),g),g!=="div"&&(f=_.mod.neg(),m&&f.negative!==0&&f.isub(d)),{div:_.div,mod:f}):d.length>this.length||this.cmp(d)<0?{div:new i(0),mod:this}:d.length===1?g==="div"?{div:this.divn(d.words[0]),mod:null}:g==="mod"?{div:null,mod:new i(this.modrn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new i(this.modrn(d.words[0]))}:this._wordDiv(d,g);var p,f,_},i.prototype.div=function(d){return this.divmod(d,"div",!1).div},i.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},i.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},i.prototype.divRound=function(d){var g=this.divmod(d);if(g.mod.isZero())return g.div;var m=g.div.negative!==0?g.mod.isub(d):g.mod,p=d.ushrn(1),f=d.andln(1),_=m.cmp(p);return _<0||f===1&&_===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},i.prototype.modrn=function(d){var g=d<0;g&&(d=-d),r(d<=67108863);for(var m=(1<<26)%d,p=0,f=this.length-1;f>=0;f--)p=(m*p+(0|this.words[f]))%d;return g?-p:p},i.prototype.modn=function(d){return this.modrn(d)},i.prototype.idivn=function(d){var g=d<0;g&&(d=-d),r(d<=67108863);for(var m=0,p=this.length-1;p>=0;p--){var f=(0|this.words[p])+67108864*m;this.words[p]=f/d|0,m=f%d}return this._strip(),g?this.ineg():this},i.prototype.divn=function(d){return this.clone().idivn(d)},i.prototype.egcd=function(d){r(d.negative===0),r(!d.isZero());var g=this,m=d.clone();g=g.negative!==0?g.umod(d):g.clone();for(var p=new i(1),f=new i(0),_=new i(0),T=new i(1),L=0;g.isEven()&&m.isEven();)g.iushrn(1),m.iushrn(1),++L;for(var B=m.clone(),$=g.clone();!g.isZero();){for(var Y=0,q=1;!(g.words[0]&q)&&Y<26;++Y,q<<=1);if(Y>0)for(g.iushrn(Y);Y-- >0;)(p.isOdd()||f.isOdd())&&(p.iadd(B),f.isub($)),p.iushrn(1),f.iushrn(1);for(var F=0,K=1;!(m.words[0]&K)&&F<26;++F,K<<=1);if(F>0)for(m.iushrn(F);F-- >0;)(_.isOdd()||T.isOdd())&&(_.iadd(B),T.isub($)),_.iushrn(1),T.iushrn(1);g.cmp(m)>=0?(g.isub(m),p.isub(_),f.isub(T)):(m.isub(g),_.isub(p),T.isub(f))}return{a:_,b:T,gcd:m.iushln(L)}},i.prototype._invmp=function(d){r(d.negative===0),r(!d.isZero());var g=this,m=d.clone();g=g.negative!==0?g.umod(d):g.clone();for(var p,f=new i(1),_=new i(0),T=m.clone();g.cmpn(1)>0&&m.cmpn(1)>0;){for(var L=0,B=1;!(g.words[0]&B)&&L<26;++L,B<<=1);if(L>0)for(g.iushrn(L);L-- >0;)f.isOdd()&&f.iadd(T),f.iushrn(1);for(var $=0,Y=1;!(m.words[0]&Y)&&$<26;++$,Y<<=1);if($>0)for(m.iushrn($);$-- >0;)_.isOdd()&&_.iadd(T),_.iushrn(1);g.cmp(m)>=0?(g.isub(m),f.isub(_)):(m.isub(g),_.isub(f))}return(p=g.cmpn(1)===0?f:_).cmpn(0)<0&&p.iadd(d),p},i.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var g=this.clone(),m=d.clone();g.negative=0,m.negative=0;for(var p=0;g.isEven()&&m.isEven();p++)g.iushrn(1),m.iushrn(1);for(;;){for(;g.isEven();)g.iushrn(1);for(;m.isEven();)m.iushrn(1);var f=g.cmp(m);if(f<0){var _=g;g=m,m=_}else if(f===0||m.cmpn(1)===0)break;g.isub(m)}return m.iushln(p)},i.prototype.invm=function(d){return this.egcd(d).a.umod(d)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(d){return this.words[0]&d},i.prototype.bincn=function(d){r(typeof d=="number");var g=d%26,m=(d-g)/26,p=1<>>26,T&=67108863,this.words[_]=T}return f!==0&&(this.words[_]=f,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(d){var g,m=d<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;if(this._strip(),this.length>1)g=1;else{m&&(d=-d),r(d<=67108863,"Number is too big");var p=0|this.words[0];g=p===d?0:pd.length)return 1;if(this.length=0;m--){var p=0|this.words[m],f=0|d.words[m];if(p!==f){pf&&(g=1);break}}return g},i.prototype.gtn=function(d){return this.cmpn(d)===1},i.prototype.gt=function(d){return this.cmp(d)===1},i.prototype.gten=function(d){return this.cmpn(d)>=0},i.prototype.gte=function(d){return this.cmp(d)>=0},i.prototype.ltn=function(d){return this.cmpn(d)===-1},i.prototype.lt=function(d){return this.cmp(d)===-1},i.prototype.lten=function(d){return this.cmpn(d)<=0},i.prototype.lte=function(d){return this.cmp(d)<=0},i.prototype.eqn=function(d){return this.cmpn(d)===0},i.prototype.eq=function(d){return this.cmp(d)===0},i.red=function(d){return new S(d)},i.prototype.toRed=function(d){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(d){return this.red=d,this},i.prototype.forceRed=function(d){return r(!this.red,"Already a number in reduction context"),this._forceRed(d)},i.prototype.redAdd=function(d){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},i.prototype.redIAdd=function(d){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},i.prototype.redSub=function(d){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},i.prototype.redISub=function(d){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},i.prototype.redShl=function(d){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},i.prototype.redMul=function(d){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},i.prototype.redIMul=function(d){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(d){return r(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var Ee={k256:null,p224:null,p192:null,p25519:null};function we(d,g){this.name=d,this.p=new i(g,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function Ce(){we.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function ze(){we.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Fe(){we.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $e(){we.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(d){if(typeof d=="string"){var g=i._prime(d);this.m=g.p,this.prime=g}else r(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}function P(d){S.call(this,d),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}we.prototype._tmp=function(){var d=new i(null);return d.words=new Array(Math.ceil(this.n/13)),d},we.prototype.ireduce=function(d){var g,m=d;do this.split(m,this.tmp),g=(m=(m=this.imulK(m)).iadd(this.tmp)).bitLength();while(g>this.n);var p=g0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},we.prototype.split=function(d,g){d.iushrn(this.n,0,g)},we.prototype.imulK=function(d){return d.imul(this.k)},a(Ce,we),Ce.prototype.split=function(d,g){for(var m=4194303,p=Math.min(d.length,9),f=0;f>>22,_=T}_>>>=22,d.words[f-10]=_,_===0&&d.length>10?d.length-=10:d.length-=9},Ce.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var g=0,m=0;m>>=26,d.words[m]=f,g=p}return g!==0&&(d.words[d.length++]=g),d},i._prime=function(d){if(Ee[d])return Ee[d];var g;if(d==="k256")g=new Ce;else if(d==="p224")g=new ze;else if(d==="p192")g=new Fe;else{if(d!=="p25519")throw new Error("Unknown prime "+d);g=new $e}return Ee[d]=g,g},S.prototype._verify1=function(d){r(d.negative===0,"red works only with positives"),r(d.red,"red works only with red numbers")},S.prototype._verify2=function(d,g){r((d.negative|g.negative)==0,"red works only with positives"),r(d.red&&d.red===g.red,"red works only with red numbers")},S.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(M(d,d.umod(this.m)._forceRed(this)),d)},S.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},S.prototype.add=function(d,g){this._verify2(d,g);var m=d.add(g);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},S.prototype.iadd=function(d,g){this._verify2(d,g);var m=d.iadd(g);return m.cmp(this.m)>=0&&m.isub(this.m),m},S.prototype.sub=function(d,g){this._verify2(d,g);var m=d.sub(g);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},S.prototype.isub=function(d,g){this._verify2(d,g);var m=d.isub(g);return m.cmpn(0)<0&&m.iadd(this.m),m},S.prototype.shl=function(d,g){return this._verify1(d),this.imod(d.ushln(g))},S.prototype.imul=function(d,g){return this._verify2(d,g),this.imod(d.imul(g))},S.prototype.mul=function(d,g){return this._verify2(d,g),this.imod(d.mul(g))},S.prototype.isqr=function(d){return this.imul(d,d.clone())},S.prototype.sqr=function(d){return this.mul(d,d)},S.prototype.sqrt=function(d){if(d.isZero())return d.clone();var g=this.m.andln(3);if(r(g%2==1),g===3){var m=this.m.add(new i(1)).iushrn(2);return this.pow(d,m)}for(var p=this.m.subn(1),f=0;!p.isZero()&&p.andln(1)===0;)f++,p.iushrn(1);r(!p.isZero());var _=new i(1).toRed(this),T=_.redNeg(),L=this.m.subn(1).iushrn(1),B=this.m.bitLength();for(B=new i(2*B*B).toRed(this);this.pow(B,L).cmp(T)!==0;)B.redIAdd(T);for(var $=this.pow(B,p),Y=this.pow(d,p.addn(1).iushrn(1)),q=this.pow(d,p),F=f;q.cmp(_)!==0;){for(var K=q,Z=0;K.cmp(_)!==0;Z++)K=K.redSqr();r(Z=0;p--){for(var B=g.words[p],$=L-1;$>=0;$--){var Y=B>>$&1;f!==m[0]&&(f=this.sqr(f)),Y!==0||_!==0?(_<<=1,_|=Y,(++T==4||p===0&&$===0)&&(f=this.mul(f,m[_]),T=0,_=0)):T=0}L=26}return f},S.prototype.convertTo=function(d){var g=d.umod(this.m);return g===d?g.clone():g},S.prototype.convertFrom=function(d){var g=d.clone();return g.red=null,g},i.mont=function(d){return new P(d)},a(P,S),P.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},P.prototype.convertFrom=function(d){var g=this.imod(d.mul(this.rinv));return g.red=null,g},P.prototype.imul=function(d,g){if(d.isZero()||g.isZero())return d.words[0]=0,d.length=1,d;var m=d.imul(g),p=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=m.isub(p).iushrn(this.shift),_=f;return f.cmp(this.m)>=0?_=f.isub(this.m):f.cmpn(0)<0&&(_=f.iadd(this.m)),_._forceRed(this)},P.prototype.mul=function(d,g){if(d.isZero()||g.isZero())return new i(0)._forceRed(this);var m=d.mul(g),p=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=m.isub(p).iushrn(this.shift),_=f;return f.cmp(this.m)>=0?_=f.isub(this.m):f.cmpn(0)<0&&(_=f.iadd(this.m)),_._forceRed(this)},P.prototype.invm=function(d){return this.imod(d._invmp(this.m).mul(this.r2))._forceRed(this)}})(e,b)})(lI);var Ym=lI.exports,_V=Uv;function cI(e){var t,n=e.modulus.byteLength();do t=new Ym(_V(n));while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function fI(e,t){var n=function(z){var H=cI(z);return{blinder:H.toRed(Ym.mont(z.modulus)).redPow(new Ym(z.publicExponent)).fromRed(),unblinder:H.invm(z.modulus)}}(t),r=t.modulus.byteLength(),a=new Ym(e).mul(n.blinder).umod(t.modulus),i=a.toRed(Ym.mont(t.prime1)),h=a.toRed(Ym.mont(t.prime2)),y=t.coefficient,k=t.prime1,E=t.prime2,M=i.redPow(t.exponent1).fromRed(),C=h.redPow(t.exponent2).fromRed(),O=M.isub(C).imul(y).umod(k).imul(E);return C.iadd(O).imul(n.unblinder).umod(t.modulus).toArrayLike(je,"be",r)}fI.getr=cI;var wk=fI,dI={},SV={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny ",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{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"},dependencies:{"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"}},au={},_k={};(function(e){var t=e;function n(a){return a.length===1?"0"+a:a}function r(a){for(var i="",h=0;h>8,M=255&k;E?h.push(E,M):h.push(M)}return h},t.zero2=n,t.toHex=r,t.encode=function(a,i){return i==="hex"?r(a):a}})(_k),function(e){var t=e,n=Uo,r=Bu,a=_k;t.assert=r,t.toArray=a.toArray,t.zero2=a.zero2,t.toHex=a.toHex,t.encode=a.encode,t.getNAF=function(i,h,y){var k=new Array(Math.max(i.bitLength(),y)+1);k.fill(0);for(var E=1<(E>>1)-1?(E>>1)-z:z,M.isubn(O)):O=0,k[C]=O,M.iushrn(1)}return k},t.getJSF=function(i,h){var y=[[],[]];i=i.clone(),h=h.clone();for(var k,E=0,M=0;i.cmpn(-E)>0||h.cmpn(-M)>0;){var C,O,z=i.andln(3)+E&3,H=h.andln(3)+M&3;z===3&&(z=-1),H===3&&(H=-1),C=1&z?(k=i.andln(7)+E&7)!=3&&k!==5||H!==2?z:-z:0,y[0].push(C),O=1&H?(k=h.andln(7)+M&7)!=3&&k!==5||z!==2?H:-H:0,y[1].push(O),2*E===C+1&&(E=1-E),2*M===O+1&&(M=1-M),i.iushrn(1),h.iushrn(1)}return y},t.cachedProperty=function(i,h,y){var k="_"+h;i.prototype[h]=function(){return this[k]!==void 0?this[k]:this[k]=y.call(this)}},t.parseBytes=function(i){return typeof i=="string"?t.toArray(i,"hex"):i},t.intFromLE=function(i){return new n(i,"hex","le")}}(au);var Sk={},Hp=Uo,vy=au,cw=vy.getNAF,EV=vy.getJSF,fw=vy.assert;function Fh(e,t){this.type=e,this.p=new Hp(t.p,16),this.red=t.prime?Hp.red(t.prime):Hp.mont(this.p),this.zero=new Hp(0).toRed(this.red),this.one=new Hp(1).toRed(this.red),this.two=new Hp(2).toRed(this.red),this.n=t.n&&new Hp(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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 n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var dw=Fh;function ju(e,t){this.curve=e,this.type=t,this.precomputed=null}Fh.prototype.point=function(){throw new Error("Not implemented")},Fh.prototype.validate=function(){throw new Error("Not implemented")},Fh.prototype._fixedNafMul=function(e,t){fw(e.precomputed);var n=e._getDoubles(),r=cw(t,1,this._bitLength),a=(1<=i;k--)h=(h<<1)+r[k];y.push(h)}for(var E=this.jpoint(null,null,null),M=this.jpoint(null,null,null),C=a;C>0;C--){for(i=0;i=0;y--){for(var k=0;y>=0&&i[y]===0;y--)k++;if(y>=0&&k++,h=h.dblp(k),y<0)break;var E=i[y];fw(E!==0),h=e.type==="affine"?E>0?h.mixedAdd(a[E-1>>1]):h.mixedAdd(a[-E-1>>1].neg()):E>0?h.add(a[E-1>>1]):h.add(a[-E-1>>1].neg())}return e.type==="affine"?h.toP():h},Fh.prototype._wnafMulAdd=function(e,t,n,r,a){var i,h,y,k=this._wnafT1,E=this._wnafT2,M=this._wnafT3,C=0;for(i=0;i=1;i-=2){var z=i-1,H=i;if(k[z]===1&&k[H]===1){var ee=[t[z],null,null,t[H]];t[z].y.cmp(t[H].y)===0?(ee[1]=t[z].add(t[H]),ee[2]=t[z].toJ().mixedAdd(t[H].neg())):t[z].y.cmp(t[H].y.redNeg())===0?(ee[1]=t[z].toJ().mixedAdd(t[H]),ee[2]=t[z].add(t[H].neg())):(ee[1]=t[z].toJ().mixedAdd(t[H]),ee[2]=t[z].toJ().mixedAdd(t[H].neg()));var te=[-3,-1,-5,-7,0,7,5,1,3],se=EV(n[z],n[H]);for(C=Math.max(se[0].length,C),M[z]=new Array(C),M[H]=new Array(C),h=0;h=0;i--){for(var ze=0;i>=0;){var Fe=!0;for(h=0;h=0&&ze++,we=we.dblp(ze),i<0)break;for(h=0;h0?y=E[h][$e-1>>1]:$e<0&&(y=E[h][-$e-1>>1].neg()),we=y.type==="affine"?we.mixedAdd(y):we.add(y))}}for(i=0;i=Math.ceil((e.bitLength()+1)/t.step)},ju.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,a=0;a=0&&(i=t,h=n),r.negative&&(r=r.neg(),a=a.neg()),i.negative&&(i=i.neg(),h=h.neg()),[{a:r,b:a},{a:i,b:h}]},Uu.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],a=r.b.mul(e).divRound(this.n),i=n.b.neg().mul(e).divRound(this.n),h=a.mul(n.a),y=i.mul(r.a),k=a.mul(n.b),E=i.mul(r.b);return{k1:e.sub(h).sub(y),k2:k.add(E).neg()}},Uu.prototype.pointFromX=function(e,t){(e=new ro(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(r.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var a=r.fromRed().isOdd();return(t&&!a||!t&&a)&&(r=r.redNeg()),this.point(e,r)},Uu.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return n.redSqr().redISub(a).cmpn(0)===0},Uu.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,a=this._endoWnafT2,i=0;i":""},Ko.prototype.isInfinity=function(){return this.inf},Ko.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Ko.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),a=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),i=a.redSqr().redISub(this.x.redAdd(this.x)),h=a.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,h)},Ko.prototype.getX=function(){return this.x.fromRed()},Ko.prototype.getY=function(){return this.y.fromRed()},Ko.prototype.mul=function(e){return e=new ro(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)},Ko.prototype.mulAdd=function(e,t,n){var r=[this,t],a=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,a):this.curve._wnafMulAdd(1,r,a,2)},Ko.prototype.jmulAdd=function(e,t,n){var r=[this,t],a=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,a,!0):this.curve._wnafMulAdd(1,r,a,2,!0)},Ko.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)},Ko.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(a){return a.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},Ko.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Ek(aa,Gm.BasePoint),Uu.prototype.jpoint=function(e,t,n){return new aa(this,e,t,n)},aa.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},aa.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},aa.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),a=e.x.redMul(n),i=this.y.redMul(t.redMul(e.z)),h=e.y.redMul(n.redMul(this.z)),y=r.redSub(a),k=i.redSub(h);if(y.cmpn(0)===0)return k.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var E=y.redSqr(),M=E.redMul(y),C=r.redMul(E),O=k.redSqr().redIAdd(M).redISub(C).redISub(C),z=k.redMul(C.redISub(O)).redISub(i.redMul(M)),H=this.z.redMul(e.z).redMul(y);return this.curve.jpoint(O,z,H)},aa.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),a=this.y,i=e.y.redMul(t).redMul(this.z),h=n.redSub(r),y=a.redSub(i);if(h.cmpn(0)===0)return y.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var k=h.redSqr(),E=k.redMul(h),M=n.redMul(k),C=y.redSqr().redIAdd(E).redISub(M).redISub(M),O=y.redMul(M.redISub(C)).redISub(a.redMul(E)),z=this.z.redMul(h);return this.curve.jpoint(C,O,z)},aa.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(a),this.x.cmp(n)===0)return!0}},aa.prototype.inspect=function(){return this.isInfinity()?"":""},aa.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Zm=Uo,hI=wr,hw=dw,CV=au;function Qm(e){hw.call(this,"mont",e),this.a=new Zm(e.a,16).toRed(this.red),this.b=new Zm(e.b,16).toRed(this.red),this.i4=new Zm(4).toRed(this.red).redInvm(),this.two=new Zm(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}hI(Qm,hw);var xV=Qm;function Ho(e,t,n){hw.BasePoint.call(this,e,"projective"),t===null&&n===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Zm(t,16),this.z=new Zm(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Qm.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return r.redSqrt().redSqr().cmp(r)===0},hI(Ho,hw.BasePoint),Qm.prototype.decodePoint=function(e,t){return this.point(CV.toArray(e,t),1)},Qm.prototype.point=function(e,t){return new Ho(this,e,t)},Qm.prototype.pointFromJSON=function(e){return Ho.fromJSON(this,e)},Ho.prototype.precompute=function(){},Ho.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Ho.fromJSON=function(e,t){return new Ho(e,t[0],t[1]||e.one)},Ho.prototype.inspect=function(){return this.isInfinity()?"":""},Ho.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Ho.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),a=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,a)},Ho.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Ho.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),a=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(n),h=a.redMul(r),y=t.z.redMul(i.redAdd(h).redSqr()),k=t.x.redMul(i.redISub(h).redSqr());return this.curve.point(y,k)},Ho.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var i=a.length-1;i>=0;i--)a[i]===0?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},Ho.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Ho.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Ho.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Ho.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Ho.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var hd=Uo,pI=wr,pw=dw,AV=au.assert;function Zc(e){this.twisted=(0|e.a)!=1,this.mOneA=this.twisted&&(0|e.a)==-1,this.extended=this.mOneA,pw.call(this,"edwards",e),this.a=new hd(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new hd(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new hd(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),AV(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(0|e.c)==1}pI(Zc,pw);var TV=Zc;function Mi(e,t,n,r,a){pw.BasePoint.call(this,e,"projective"),t===null&&n===null&&r===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 hd(t,16),this.y=new hd(n,16),this.z=r?new hd(r,16):this.curve.one,this.t=a&&new hd(a,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()))))}Zc.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Zc.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Zc.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},Zc.prototype.pointFromX=function(e,t){(e=new hd(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),a=this.one.redSub(this.c2.redMul(this.d).redMul(n)),i=r.redMul(a.redInvm()),h=i.redSqrt();if(h.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var y=h.fromRed().isOdd();return(t&&!y||!t&&y)&&(h=h.redNeg()),this.point(e,h)},Zc.prototype.pointFromY=function(e,t){(e=new hd(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),a=n.redMul(this.d).redMul(this.c2).redSub(this.a),i=r.redMul(a.redInvm());if(i.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var h=i.redSqrt();if(h.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==t&&(h=h.redNeg()),this.point(h,e)},Zc.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return r.cmp(a)===0},pI(Mi,pw.BasePoint),Zc.prototype.pointFromJSON=function(e){return Mi.fromJSON(this,e)},Zc.prototype.point=function(e,t,n,r){return new Mi(this,e,t,n,r)},Mi.fromJSON=function(e,t){return new Mi(e,t[0],t[1],t[2])},Mi.prototype.inspect=function(){return this.isInfinity()?"":""},Mi.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Mi.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),a=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=r.redAdd(t),h=i.redSub(n),y=r.redSub(t),k=a.redMul(h),E=i.redMul(y),M=a.redMul(y),C=h.redMul(i);return this.curve.point(k,E,C,M)},Mi.prototype._projDbl=function(){var e,t,n,r,a,i,h=this.x.redAdd(this.y).redSqr(),y=this.x.redSqr(),k=this.y.redSqr();if(this.curve.twisted){var E=(r=this.curve._mulA(y)).redAdd(k);this.zOne?(e=h.redSub(y).redSub(k).redMul(E.redSub(this.curve.two)),t=E.redMul(r.redSub(k)),n=E.redSqr().redSub(E).redSub(E)):(a=this.z.redSqr(),i=E.redSub(a).redISub(a),e=h.redSub(y).redISub(k).redMul(i),t=E.redMul(r.redSub(k)),n=E.redMul(i))}else r=y.redAdd(k),a=this.curve._mulC(this.z).redSqr(),i=r.redSub(a).redSub(a),e=this.curve._mulC(h.redISub(r)).redMul(i),t=this.curve._mulC(r).redMul(y.redISub(k)),n=r.redMul(i);return this.curve.point(e,t,n)},Mi.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Mi.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),a=this.z.redMul(e.z.redAdd(e.z)),i=n.redSub(t),h=a.redSub(r),y=a.redAdd(r),k=n.redAdd(t),E=i.redMul(h),M=y.redMul(k),C=i.redMul(k),O=h.redMul(y);return this.curve.point(E,M,O,C)},Mi.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),a=r.redSqr(),i=this.x.redMul(e.x),h=this.y.redMul(e.y),y=this.curve.d.redMul(i).redMul(h),k=a.redSub(y),E=a.redAdd(y),M=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(h),C=r.redMul(k).redMul(M);return this.curve.twisted?(t=r.redMul(E).redMul(h.redSub(this.curve._mulA(i))),n=k.redMul(E)):(t=r.redMul(E).redMul(h.redSub(i)),n=this.curve._mulC(k).redMul(E)),this.curve.point(C,t,n)},Mi.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Mi.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Mi.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},Mi.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},Mi.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},Mi.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Mi.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Mi.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Mi.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Mi.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),this.x.cmp(t)===0)return!0}},Mi.prototype.toP=Mi.prototype.normalize,Mi.prototype.mixedAdd=Mi.prototype.add,function(e){var t=e;t.base=dw,t.short=MV,t.mont=xV,t.edwards=TV}(Sk);var mw={},gw={},Ar={},RV=Bu,PV=wr;function IV(e,t){return(64512&e.charCodeAt(t))==55296&&!(t<0||t+1>=e.length)&&(64512&e.charCodeAt(t+1))==56320}function mI(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function gI(e){return e.length===1?"0"+e:e}function vI(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}Ar.inherits=PV,Ar.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if(typeof e=="string")if(t){if(t==="hex")for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),a=0;a>6|192,n[r++]=63&i|128):IV(e,a)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++a)),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=63&i|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=63&i|128)}else for(a=0;a>>0}return i},Ar.split32=function(e,t){for(var n=new Array(4*e.length),r=0,a=0;r>>24,n[a+1]=i>>>16&255,n[a+2]=i>>>8&255,n[a+3]=255&i):(n[a+3]=i>>>24,n[a+2]=i>>>16&255,n[a+1]=i>>>8&255,n[a]=255&i)}return n},Ar.rotr32=function(e,t){return e>>>t|e<<32-t},Ar.rotl32=function(e,t){return e<>>32-t},Ar.sum32=function(e,t){return e+t>>>0},Ar.sum32_3=function(e,t,n){return e+t+n>>>0},Ar.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},Ar.sum32_5=function(e,t,n,r,a){return e+t+n+r+a>>>0},Ar.sum64=function(e,t,n,r){var a=e[t],i=r+e[t+1]>>>0,h=(i>>0,e[t+1]=i},Ar.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},Ar.sum64_lo=function(e,t,n,r){return t+r>>>0},Ar.sum64_4_hi=function(e,t,n,r,a,i,h,y){var k=0,E=t;return k+=(E=E+r>>>0)>>0)>>0)>>0},Ar.sum64_4_lo=function(e,t,n,r,a,i,h,y){return t+r+i+y>>>0},Ar.sum64_5_hi=function(e,t,n,r,a,i,h,y,k,E){var M=0,C=t;return M+=(C=C+r>>>0)>>0)>>0)>>0)>>0},Ar.sum64_5_lo=function(e,t,n,r,a,i,h,y,k,E){return t+r+i+y+E>>>0},Ar.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},Ar.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},Ar.shr64_hi=function(e,t,n){return e>>>n},Ar.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var Xm={},yI=Ar,LV=Bu;function vw(){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}Xm.BlockHash=vw,vw.prototype.update=function(e,t){if(e=yI.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=yI.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,r[a++]=e>>>16&255,r[a++]=e>>>8&255,r[a++]=255&e}else for(r[a++]=255&e,r[a++]=e>>>8&255,r[a++]=e>>>16&255,r[a++]=e>>>24&255,r[a++]=0,r[a++]=0,r[a++]=0,r[a++]=0,i=8;i>>3},Qc.g1_256=function(e){return Xc(e,17)^Xc(e,19)^e>>>10};var e2=Ar,OV=Xm,NV=Qc,kk=e2.rotl32,yy=e2.sum32,DV=e2.sum32_5,BV=NV.ft_1,SI=OV.BlockHash,zV=[1518500249,1859775393,2400959708,3395469782];function Jc(){if(!(this instanceof Jc))return new Jc;SI.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}e2.inherits(Jc,SI);var FV=Jc;Jc.blockSize=512,Jc.outSize=160,Jc.hmacStrength=80,Jc.padLength=64,Jc.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;rthis.blockSize&&(e=new this.Hash().update(e).digest()),CY(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var TY=Uh;Uh.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},Uh.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(r=n,n=t,t=null),n&&(n=qp.toArray(n,r||"hex"),this._update(n));for(var a=[];a.length"};var bw=Uo,Rk=au,IY=Rk.assert;function ww(e,t){if(e instanceof ww)return e;this._importDER(e,t)||(IY(e.r&&e.s,"Signature without r or s"),this.r=new bw(e.r,16),this.s=new bw(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var Pk,FI,LY=ww;function OY(){this.place=0}function Ik(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(r===0||r>4)return!1;for(var a=0,i=0,h=t.place;i>>=0;return!(a<=127)&&(t.place=h,a)}function jI(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}ww.prototype._importDER=function(e,t){e=Rk.toArray(e,t);var n=new OY;if(e[n.place++]!==48)return!1;var r=Ik(e,n);if(r===!1||r+n.place!==e.length||e[n.place++]!==2)return!1;var a=Ik(e,n);if(a===!1)return!1;var i=e.slice(n.place,a+n.place);if(n.place+=a,e[n.place++]!==2)return!1;var h=Ik(e,n);if(h===!1||e.length!==h+n.place)return!1;var y=e.slice(n.place,h+n.place);if(i[0]===0){if(!(128&i[1]))return!1;i=i.slice(1)}if(y[0]===0){if(!(128&y[1]))return!1;y=y.slice(1)}return this.r=new bw(i),this.s=new bw(y),this.recoveryParam=null,!0},ww.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=jI(t),n=jI(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];Lk(r,t.length),(r=r.concat(t)).push(2),Lk(r,n.length);var a=r.concat(n),i=[48];return Lk(i,a.length),i=i.concat(a),Rk.encode(i,e)};var wy=au,UI=wy.assert,KI=wy.parseBytes,i2=wy.cachedProperty;function $o(e,t){this.eddsa=e,this._secret=KI(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=KI(t.pub)}$o.fromPublic=function(e,t){return t instanceof $o?t:new $o(e,{pub:t})},$o.fromSecret=function(e,t){return t instanceof $o?t:new $o(e,{secret:t})},$o.prototype.secret=function(){return this._secret},i2($o,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),i2($o,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),i2($o,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),i2($o,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),i2($o,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),i2($o,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),$o.prototype.sign=function(e){return UI(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},$o.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},$o.prototype.getSecret=function(e){return UI(this._secret,"KeyPair is public only"),wy.encode(this.secret(),e)},$o.prototype.getPublic=function(e){return wy.encode(this.pubBytes(),e)};var NY=$o,DY=Uo,_w=au,BY=_w.assert,Sw=_w.cachedProperty,zY=_w.parseBytes;function Wp(e,t){this.eddsa=e,typeof t!="object"&&(t=zY(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),BY(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof DY&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Sw(Wp,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Sw(Wp,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Sw(Wp,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Sw(Wp,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),Wp.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},Wp.prototype.toHex=function(){return _w.encode(this.toBytes(),"hex").toUpperCase()};var FY=Wp,jY=gw,UY=mw,o2=au,KY=o2.assert,HI=o2.parseBytes,$I=NY,qI=FY;function xs(e){if(KY(e==="ed25519","only tested with ed25519 so far"),!(this instanceof xs))return new xs(e);e=UY[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=jY.sha512}var WI,HY=xs;function Ok(){return WI||(WI=1,function(e){var t=e;t.version=SV.version,t.utils=au,t.rand=yk(),t.curve=Sk,t.curves=mw,t.ec=function(){if(FI)return Pk;FI=1;var n=Uo,r=TY,a=au,i=mw,h=yk(),y=a.assert,k=PY,E=LY;function M(C){if(!(this instanceof M))return new M(C);typeof C=="string"&&(y(Object.prototype.hasOwnProperty.call(i,C),"Unknown curve "+C),C=i[C]),C instanceof i.PresetCurve&&(C={curve:C}),this.curve=C.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=C.curve.g,this.g.precompute(C.curve.n.bitLength()+1),this.hash=C.hash||C.curve.hash}return Pk=M,M.prototype.keyPair=function(C){return new k(this,C)},M.prototype.keyFromPrivate=function(C,O){return k.fromPrivate(this,C,O)},M.prototype.keyFromPublic=function(C,O){return k.fromPublic(this,C,O)},M.prototype.genKeyPair=function(C){C||(C={});for(var O=new r({hash:this.hash,pers:C.pers,persEnc:C.persEnc||"utf8",entropy:C.entropy||h(this.hash.hmacStrength),entropyEnc:C.entropy&&C.entropyEnc||"utf8",nonce:this.n.toArray()}),z=this.n.byteLength(),H=this.n.sub(new n(2));;){var ee=new n(O.generate(z));if(!(ee.cmp(H)>0))return ee.iaddn(1),this.keyFromPrivate(ee)}},M.prototype._truncateToN=function(C,O){var z=8*C.byteLength()-this.n.bitLength();return z>0&&(C=C.ushrn(z)),!O&&C.cmp(this.n)>=0?C.sub(this.n):C},M.prototype.sign=function(C,O,z,H){typeof z=="object"&&(H=z,z=null),H||(H={}),O=this.keyFromPrivate(O,z),C=this._truncateToN(new n(C,16));for(var ee=this.n.byteLength(),te=O.getPrivate().toArray("be",ee),se=C.toArray("be",ee),oe=new r({hash:this.hash,entropy:te,nonce:se,pers:H.pers,persEnc:H.persEnc||"utf8"}),Ee=this.n.sub(new n(1)),we=0;;we++){var Ce=H.k?H.k(we):new n(oe.generate(this.n.byteLength()));if(!((Ce=this._truncateToN(Ce,!0)).cmpn(1)<=0||Ce.cmp(Ee)>=0)){var ze=this.g.mul(Ce);if(!ze.isInfinity()){var Fe=ze.getX(),$e=Fe.umod(this.n);if($e.cmpn(0)!==0){var S=Ce.invm(this.n).mul($e.mul(O.getPrivate()).iadd(C));if((S=S.umod(this.n)).cmpn(0)!==0){var P=(ze.getY().isOdd()?1:0)|(Fe.cmp($e)!==0?2:0);return H.canonical&&S.cmp(this.nh)>0&&(S=this.n.sub(S),P^=1),new E({r:$e,s:S,recoveryParam:P})}}}}}},M.prototype.verify=function(C,O,z,H){C=this._truncateToN(new n(C,16)),z=this.keyFromPublic(z,H);var ee=(O=new E(O,"hex")).r,te=O.s;if(ee.cmpn(1)<0||ee.cmp(this.n)>=0||te.cmpn(1)<0||te.cmp(this.n)>=0)return!1;var se,oe=te.invm(this.n),Ee=oe.mul(C).umod(this.n),we=oe.mul(ee).umod(this.n);return this.curve._maxwellTrick?!(se=this.g.jmulAdd(Ee,z.getPublic(),we)).isInfinity()&&se.eqXToP(ee):!(se=this.g.mulAdd(Ee,z.getPublic(),we)).isInfinity()&&se.getX().umod(this.n).cmp(ee)===0},M.prototype.recoverPubKey=function(C,O,z,H){y((3&z)===z,"The recovery param is more than two bits"),O=new E(O,H);var ee=this.n,te=new n(C),se=O.r,oe=O.s,Ee=1&z,we=z>>1;if(se.cmp(this.curve.p.umod(this.curve.n))>=0&&we)throw new Error("Unable to find sencond key candinate");se=we?this.curve.pointFromX(se.add(this.curve.n),Ee):this.curve.pointFromX(se,Ee);var Ce=O.r.invm(ee),ze=ee.sub(te).mul(Ce).umod(ee),Fe=oe.mul(Ce).umod(ee);return this.g.mulAdd(ze,se,Fe)},M.prototype.getKeyRecoveryParam=function(C,O,z,H){if((O=new E(O,H)).recoveryParam!==null)return O.recoveryParam;for(var ee=0;ee<4;ee++){var te;try{te=this.recoverPubKey(C,O,ee)}catch{continue}if(te.eq(z))return ee}throw new Error("Unable to find valid recovery factor")},Pk}(),t.eddsa=HY}(dI)),dI}xs.prototype.sign=function(e,t){e=HI(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),a=this.g.mul(r),i=this.encodePoint(a),h=this.hashInt(i,n.pubBytes(),e).mul(n.priv()),y=r.add(h).umod(this.curve.n);return this.makeSignature({R:a,S:y,Rencoded:i})},xs.prototype.verify=function(e,t,n){e=HI(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),a=this.hashInt(t.Rencoded(),r.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(r.pub().mul(a)).eq(i)},xs.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=48&&m<=57?m-48:m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:void r(!1,"Invalid character in "+d)}function k(d,g,m){var p=y(d,m);return m-1>=g&&(p|=y(d,m-1)<<4),p}function E(d,g,m,p){for(var f=0,_=0,T=Math.min(d.length,m),L=g;L=49?B-49+10:B>=17?B-17+10:B,r(B>=0&&_0?d:g},i.min=function(d,g){return d.cmp(g)<0?d:g},i.prototype._init=function(d,g,m){if(typeof d=="number")return this._initNumber(d,g,m);if(typeof d=="object")return this._initArray(d,g,m);g==="hex"&&(g=16),r(g===(0|g)&&g>=2&&g<=36);var p=0;(d=d.toString().replace(/\s+/g,""))[0]==="-"&&(p++,this.negative=1),p=0;p-=3)_=d[p]|d[p-1]<<8|d[p-2]<<16,this.words[f]|=_<>>26-T&67108863,(T+=24)>=26&&(T-=26,f++);else if(m==="le")for(p=0,f=0;p>>26-T&67108863,(T+=24)>=26&&(T-=26,f++);return this._strip()},i.prototype._parseHex=function(d,g,m){this.length=Math.ceil((d.length-g)/6),this.words=new Array(this.length);for(var p=0;p=g;p-=2)f=k(d,g,p)<<_,this.words[T]|=67108863&f,_>=18?(_-=18,T+=1,this.words[T]|=f>>>26):_+=8;else for(p=(d.length-g)%2==0?g+1:g;p=18?(_-=18,T+=1,this.words[T]|=f>>>26):_+=8;this._strip()},i.prototype._parseBase=function(d,g,m){this.words=[0],this.length=1;for(var p=0,f=1;f<=67108863;f*=g)p++;p--,f=f/g|0;for(var _=d.length-m,T=_%p,L=Math.min(_,_-T)+m,B=0,$=m;$1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=C}catch{i.prototype.inspect=C}else i.prototype.inspect=C;function C(){return(this.red?""}var O=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],z=[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],H=[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];function ee(d,g,m){m.negative=g.negative^d.negative;var p=d.length+g.length|0;m.length=p,p=p-1|0;var f=0|d.words[0],_=0|g.words[0],T=f*_,L=67108863&T,B=T/67108864|0;m.words[0]=L;for(var $=1;$>>26,q=67108863&B,F=Math.min($,g.length-1),K=Math.max(0,$-d.length+1);K<=F;K++){var Z=$-K|0;Y+=(T=(f=0|d.words[Z])*(_=0|g.words[K])+q)/67108864|0,q=67108863&T}m.words[$]=0|q,B=0|Y}return B!==0?m.words[$]=0|B:m.length--,m._strip()}i.prototype.toString=function(d,g){var m;if(g=0|g||1,(d=d||10)===16||d==="hex"){m="";for(var p=0,f=0,_=0;_>>24-p&16777215,(p+=2)>=26&&(p-=26,_--),m=f!==0||_!==this.length-1?O[6-L.length]+L+m:L+m}for(f!==0&&(m=f.toString(16)+m);m.length%g!=0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(d===(0|d)&&d>=2&&d<=36){var B=z[d],$=H[d];m="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var q=Y.modrn($).toString(d);m=(Y=Y.idivn($)).isZero()?q+m:O[B-q.length]+q+m}for(this.isZero()&&(m="0"+m);m.length%g!=0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=67108864*this.words[1]:this.length===3&&this.words[2]===1?d+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},i.prototype.toJSON=function(){return this.toString(16,2)},h&&(i.prototype.toBuffer=function(d,g){return this.toArrayLike(h,d,g)}),i.prototype.toArray=function(d,g){return this.toArrayLike(Array,d,g)},i.prototype.toArrayLike=function(d,g,m){this._strip();var p=this.byteLength(),f=m||Math.max(1,p);r(p<=f,"byte array longer than desired length"),r(f>0,"Requested array length <= 0");var _=function(T,L){return T.allocUnsafe?T.allocUnsafe(L):new T(L)}(d,f);return this["_toArrayLike"+(g==="le"?"LE":"BE")](_,p),_},i.prototype._toArrayLikeLE=function(d,g){for(var m=0,p=0,f=0,_=0;f>8&255),m>16&255),_===6?(m>24&255),p=0,_=0):(p=T>>>24,_+=2)}if(m=0&&(d[m--]=T>>8&255),m>=0&&(d[m--]=T>>16&255),_===6?(m>=0&&(d[m--]=T>>24&255),p=0,_=0):(p=T>>>24,_+=2)}if(m>=0)for(d[m--]=p;m>=0;)d[m--]=0},Math.clz32?i.prototype._countBits=function(d){return 32-Math.clz32(d)}:i.prototype._countBits=function(d){var g=d,m=0;return g>=4096&&(m+=13,g>>>=13),g>=64&&(m+=7,g>>>=7),g>=8&&(m+=4,g>>>=4),g>=2&&(m+=2,g>>>=2),m+g},i.prototype._zeroBits=function(d){if(d===0)return 26;var g=d,m=0;return!(8191&g)&&(m+=13,g>>>=13),!(127&g)&&(m+=7,g>>>=7),!(15&g)&&(m+=4,g>>>=4),!(3&g)&&(m+=2,g>>>=2),!(1&g)&&m++,m},i.prototype.bitLength=function(){var d=this.words[this.length-1],g=this._countBits(d);return 26*(this.length-1)+g},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,g=0;gd.length?this.clone().ior(d):d.clone().ior(this)},i.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},i.prototype.iuand=function(d){var g;g=this.length>d.length?d:this;for(var m=0;md.length?this.clone().iand(d):d.clone().iand(this)},i.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},i.prototype.iuxor=function(d){var g,m;this.length>d.length?(g=this,m=d):(g=d,m=this);for(var p=0;pd.length?this.clone().ixor(d):d.clone().ixor(this)},i.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},i.prototype.inotn=function(d){r(typeof d=="number"&&d>=0);var g=0|Math.ceil(d/26),m=d%26;this._expand(g),m>0&&g--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-m),this._strip()},i.prototype.notn=function(d){return this.clone().inotn(d)},i.prototype.setn=function(d,g){r(typeof d=="number"&&d>=0);var m=d/26|0,p=d%26;return this._expand(m+1),this.words[m]=g?this.words[m]|1<d.length?(m=this,p=d):(m=d,p=this);for(var f=0,_=0;_>>26;for(;f!==0&&_>>26;if(this.length=m.length,f!==0)this.words[this.length]=f,this.length++;else if(m!==this)for(;_d.length?this.clone().iadd(d):d.clone().iadd(this)},i.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var g=this.iadd(d);return d.negative=1,g._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var m,p,f=this.cmp(d);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(m=this,p=d):(m=d,p=this);for(var _=0,T=0;T>26,this.words[T]=67108863&g;for(;_!==0&&T>26,this.words[T]=67108863&g;if(_===0&&T>>13,K=0|T[1],Z=8191&K,ne=K>>>13,ue=0|T[2],me=8191&ue,fe=ue>>>13,De=0|T[3],_e=8191&De,pe=De>>>13,ve=0|T[4],Se=8191&ve,Ae=ve>>>13,qe=0|T[5],Xe=8191&qe,Be=qe>>>13,gt=0|T[6],bt=8191>,ot=gt>>>13,Wt=0|T[7],vt=8191&Wt,at=Wt>>>13,Rt=0|T[8],Dt=8191&Rt,Lt=Rt>>>13,rn=0|T[9],Vt=8191&rn,Pt=rn>>>13,en=0|L[0],on=8191&en,At=en>>>13,Jt=0|L[1],tn=8191&Jt,Bt=Jt>>>13,Rn=0|L[2],wn=8191&Rn,Ut=Rn>>>13,Fn=0|L[3],kn=8191&Fn,Nt=Fn>>>13,Mn=0|L[4],yn=8191&Mn,Ft=Mn>>>13,An=0|L[5],bn=8191&An,Qt=An>>>13,Ln=0|L[6],Bn=8191&Ln,Kt=Ln>>>13,Pn=0|L[7],In=8191&Pn,qt=Pn>>>13,pn=0|L[8],Hn=8191&pn,Yt=pn>>>13,$n=0|L[9],Cn=8191&$n,On=$n>>>13;m.negative=d.negative^g.negative,m.length=19;var Fi=($+(p=Math.imul(q,on))|0)+((8191&(f=(f=Math.imul(q,At))+Math.imul(F,on)|0))<<13)|0;$=((_=Math.imul(F,At))+(f>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,p=Math.imul(Z,on),f=(f=Math.imul(Z,At))+Math.imul(ne,on)|0,_=Math.imul(ne,At);var ji=($+(p=p+Math.imul(q,tn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Bt)|0)+Math.imul(F,tn)|0))<<13)|0;$=((_=_+Math.imul(F,Bt)|0)+(f>>>13)|0)+(ji>>>26)|0,ji&=67108863,p=Math.imul(me,on),f=(f=Math.imul(me,At))+Math.imul(fe,on)|0,_=Math.imul(fe,At),p=p+Math.imul(Z,tn)|0,f=(f=f+Math.imul(Z,Bt)|0)+Math.imul(ne,tn)|0,_=_+Math.imul(ne,Bt)|0;var xi=($+(p=p+Math.imul(q,wn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Ut)|0)+Math.imul(F,wn)|0))<<13)|0;$=((_=_+Math.imul(F,Ut)|0)+(f>>>13)|0)+(xi>>>26)|0,xi&=67108863,p=Math.imul(_e,on),f=(f=Math.imul(_e,At))+Math.imul(pe,on)|0,_=Math.imul(pe,At),p=p+Math.imul(me,tn)|0,f=(f=f+Math.imul(me,Bt)|0)+Math.imul(fe,tn)|0,_=_+Math.imul(fe,Bt)|0,p=p+Math.imul(Z,wn)|0,f=(f=f+Math.imul(Z,Ut)|0)+Math.imul(ne,wn)|0,_=_+Math.imul(ne,Ut)|0;var vi=($+(p=p+Math.imul(q,kn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Nt)|0)+Math.imul(F,kn)|0))<<13)|0;$=((_=_+Math.imul(F,Nt)|0)+(f>>>13)|0)+(vi>>>26)|0,vi&=67108863,p=Math.imul(Se,on),f=(f=Math.imul(Se,At))+Math.imul(Ae,on)|0,_=Math.imul(Ae,At),p=p+Math.imul(_e,tn)|0,f=(f=f+Math.imul(_e,Bt)|0)+Math.imul(pe,tn)|0,_=_+Math.imul(pe,Bt)|0,p=p+Math.imul(me,wn)|0,f=(f=f+Math.imul(me,Ut)|0)+Math.imul(fe,wn)|0,_=_+Math.imul(fe,Ut)|0,p=p+Math.imul(Z,kn)|0,f=(f=f+Math.imul(Z,Nt)|0)+Math.imul(ne,kn)|0,_=_+Math.imul(ne,Nt)|0;var Vi=($+(p=p+Math.imul(q,yn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Ft)|0)+Math.imul(F,yn)|0))<<13)|0;$=((_=_+Math.imul(F,Ft)|0)+(f>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,p=Math.imul(Xe,on),f=(f=Math.imul(Xe,At))+Math.imul(Be,on)|0,_=Math.imul(Be,At),p=p+Math.imul(Se,tn)|0,f=(f=f+Math.imul(Se,Bt)|0)+Math.imul(Ae,tn)|0,_=_+Math.imul(Ae,Bt)|0,p=p+Math.imul(_e,wn)|0,f=(f=f+Math.imul(_e,Ut)|0)+Math.imul(pe,wn)|0,_=_+Math.imul(pe,Ut)|0,p=p+Math.imul(me,kn)|0,f=(f=f+Math.imul(me,Nt)|0)+Math.imul(fe,kn)|0,_=_+Math.imul(fe,Nt)|0,p=p+Math.imul(Z,yn)|0,f=(f=f+Math.imul(Z,Ft)|0)+Math.imul(ne,yn)|0,_=_+Math.imul(ne,Ft)|0;var dr=($+(p=p+Math.imul(q,bn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Qt)|0)+Math.imul(F,bn)|0))<<13)|0;$=((_=_+Math.imul(F,Qt)|0)+(f>>>13)|0)+(dr>>>26)|0,dr&=67108863,p=Math.imul(bt,on),f=(f=Math.imul(bt,At))+Math.imul(ot,on)|0,_=Math.imul(ot,At),p=p+Math.imul(Xe,tn)|0,f=(f=f+Math.imul(Xe,Bt)|0)+Math.imul(Be,tn)|0,_=_+Math.imul(Be,Bt)|0,p=p+Math.imul(Se,wn)|0,f=(f=f+Math.imul(Se,Ut)|0)+Math.imul(Ae,wn)|0,_=_+Math.imul(Ae,Ut)|0,p=p+Math.imul(_e,kn)|0,f=(f=f+Math.imul(_e,Nt)|0)+Math.imul(pe,kn)|0,_=_+Math.imul(pe,Nt)|0,p=p+Math.imul(me,yn)|0,f=(f=f+Math.imul(me,Ft)|0)+Math.imul(fe,yn)|0,_=_+Math.imul(fe,Ft)|0,p=p+Math.imul(Z,bn)|0,f=(f=f+Math.imul(Z,Qt)|0)+Math.imul(ne,bn)|0,_=_+Math.imul(ne,Qt)|0;var jn=($+(p=p+Math.imul(q,Bn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Kt)|0)+Math.imul(F,Bn)|0))<<13)|0;$=((_=_+Math.imul(F,Kt)|0)+(f>>>13)|0)+(jn>>>26)|0,jn&=67108863,p=Math.imul(vt,on),f=(f=Math.imul(vt,At))+Math.imul(at,on)|0,_=Math.imul(at,At),p=p+Math.imul(bt,tn)|0,f=(f=f+Math.imul(bt,Bt)|0)+Math.imul(ot,tn)|0,_=_+Math.imul(ot,Bt)|0,p=p+Math.imul(Xe,wn)|0,f=(f=f+Math.imul(Xe,Ut)|0)+Math.imul(Be,wn)|0,_=_+Math.imul(Be,Ut)|0,p=p+Math.imul(Se,kn)|0,f=(f=f+Math.imul(Se,Nt)|0)+Math.imul(Ae,kn)|0,_=_+Math.imul(Ae,Nt)|0,p=p+Math.imul(_e,yn)|0,f=(f=f+Math.imul(_e,Ft)|0)+Math.imul(pe,yn)|0,_=_+Math.imul(pe,Ft)|0,p=p+Math.imul(me,bn)|0,f=(f=f+Math.imul(me,Qt)|0)+Math.imul(fe,bn)|0,_=_+Math.imul(fe,Qt)|0,p=p+Math.imul(Z,Bn)|0,f=(f=f+Math.imul(Z,Kt)|0)+Math.imul(ne,Bn)|0,_=_+Math.imul(ne,Kt)|0;var yi=($+(p=p+Math.imul(q,In)|0)|0)+((8191&(f=(f=f+Math.imul(q,qt)|0)+Math.imul(F,In)|0))<<13)|0;$=((_=_+Math.imul(F,qt)|0)+(f>>>13)|0)+(yi>>>26)|0,yi&=67108863,p=Math.imul(Dt,on),f=(f=Math.imul(Dt,At))+Math.imul(Lt,on)|0,_=Math.imul(Lt,At),p=p+Math.imul(vt,tn)|0,f=(f=f+Math.imul(vt,Bt)|0)+Math.imul(at,tn)|0,_=_+Math.imul(at,Bt)|0,p=p+Math.imul(bt,wn)|0,f=(f=f+Math.imul(bt,Ut)|0)+Math.imul(ot,wn)|0,_=_+Math.imul(ot,Ut)|0,p=p+Math.imul(Xe,kn)|0,f=(f=f+Math.imul(Xe,Nt)|0)+Math.imul(Be,kn)|0,_=_+Math.imul(Be,Nt)|0,p=p+Math.imul(Se,yn)|0,f=(f=f+Math.imul(Se,Ft)|0)+Math.imul(Ae,yn)|0,_=_+Math.imul(Ae,Ft)|0,p=p+Math.imul(_e,bn)|0,f=(f=f+Math.imul(_e,Qt)|0)+Math.imul(pe,bn)|0,_=_+Math.imul(pe,Qt)|0,p=p+Math.imul(me,Bn)|0,f=(f=f+Math.imul(me,Kt)|0)+Math.imul(fe,Bn)|0,_=_+Math.imul(fe,Kt)|0,p=p+Math.imul(Z,In)|0,f=(f=f+Math.imul(Z,qt)|0)+Math.imul(ne,In)|0,_=_+Math.imul(ne,qt)|0;var Ui=($+(p=p+Math.imul(q,Hn)|0)|0)+((8191&(f=(f=f+Math.imul(q,Yt)|0)+Math.imul(F,Hn)|0))<<13)|0;$=((_=_+Math.imul(F,Yt)|0)+(f>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,p=Math.imul(Vt,on),f=(f=Math.imul(Vt,At))+Math.imul(Pt,on)|0,_=Math.imul(Pt,At),p=p+Math.imul(Dt,tn)|0,f=(f=f+Math.imul(Dt,Bt)|0)+Math.imul(Lt,tn)|0,_=_+Math.imul(Lt,Bt)|0,p=p+Math.imul(vt,wn)|0,f=(f=f+Math.imul(vt,Ut)|0)+Math.imul(at,wn)|0,_=_+Math.imul(at,Ut)|0,p=p+Math.imul(bt,kn)|0,f=(f=f+Math.imul(bt,Nt)|0)+Math.imul(ot,kn)|0,_=_+Math.imul(ot,Nt)|0,p=p+Math.imul(Xe,yn)|0,f=(f=f+Math.imul(Xe,Ft)|0)+Math.imul(Be,yn)|0,_=_+Math.imul(Be,Ft)|0,p=p+Math.imul(Se,bn)|0,f=(f=f+Math.imul(Se,Qt)|0)+Math.imul(Ae,bn)|0,_=_+Math.imul(Ae,Qt)|0,p=p+Math.imul(_e,Bn)|0,f=(f=f+Math.imul(_e,Kt)|0)+Math.imul(pe,Bn)|0,_=_+Math.imul(pe,Kt)|0,p=p+Math.imul(me,In)|0,f=(f=f+Math.imul(me,qt)|0)+Math.imul(fe,In)|0,_=_+Math.imul(fe,qt)|0,p=p+Math.imul(Z,Hn)|0,f=(f=f+Math.imul(Z,Yt)|0)+Math.imul(ne,Hn)|0,_=_+Math.imul(ne,Yt)|0;var Ai=($+(p=p+Math.imul(q,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(q,On)|0)+Math.imul(F,Cn)|0))<<13)|0;$=((_=_+Math.imul(F,On)|0)+(f>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,p=Math.imul(Vt,tn),f=(f=Math.imul(Vt,Bt))+Math.imul(Pt,tn)|0,_=Math.imul(Pt,Bt),p=p+Math.imul(Dt,wn)|0,f=(f=f+Math.imul(Dt,Ut)|0)+Math.imul(Lt,wn)|0,_=_+Math.imul(Lt,Ut)|0,p=p+Math.imul(vt,kn)|0,f=(f=f+Math.imul(vt,Nt)|0)+Math.imul(at,kn)|0,_=_+Math.imul(at,Nt)|0,p=p+Math.imul(bt,yn)|0,f=(f=f+Math.imul(bt,Ft)|0)+Math.imul(ot,yn)|0,_=_+Math.imul(ot,Ft)|0,p=p+Math.imul(Xe,bn)|0,f=(f=f+Math.imul(Xe,Qt)|0)+Math.imul(Be,bn)|0,_=_+Math.imul(Be,Qt)|0,p=p+Math.imul(Se,Bn)|0,f=(f=f+Math.imul(Se,Kt)|0)+Math.imul(Ae,Bn)|0,_=_+Math.imul(Ae,Kt)|0,p=p+Math.imul(_e,In)|0,f=(f=f+Math.imul(_e,qt)|0)+Math.imul(pe,In)|0,_=_+Math.imul(pe,qt)|0,p=p+Math.imul(me,Hn)|0,f=(f=f+Math.imul(me,Yt)|0)+Math.imul(fe,Hn)|0,_=_+Math.imul(fe,Yt)|0;var Ki=($+(p=p+Math.imul(Z,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Z,On)|0)+Math.imul(ne,Cn)|0))<<13)|0;$=((_=_+Math.imul(ne,On)|0)+(f>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,p=Math.imul(Vt,wn),f=(f=Math.imul(Vt,Ut))+Math.imul(Pt,wn)|0,_=Math.imul(Pt,Ut),p=p+Math.imul(Dt,kn)|0,f=(f=f+Math.imul(Dt,Nt)|0)+Math.imul(Lt,kn)|0,_=_+Math.imul(Lt,Nt)|0,p=p+Math.imul(vt,yn)|0,f=(f=f+Math.imul(vt,Ft)|0)+Math.imul(at,yn)|0,_=_+Math.imul(at,Ft)|0,p=p+Math.imul(bt,bn)|0,f=(f=f+Math.imul(bt,Qt)|0)+Math.imul(ot,bn)|0,_=_+Math.imul(ot,Qt)|0,p=p+Math.imul(Xe,Bn)|0,f=(f=f+Math.imul(Xe,Kt)|0)+Math.imul(Be,Bn)|0,_=_+Math.imul(Be,Kt)|0,p=p+Math.imul(Se,In)|0,f=(f=f+Math.imul(Se,qt)|0)+Math.imul(Ae,In)|0,_=_+Math.imul(Ae,qt)|0,p=p+Math.imul(_e,Hn)|0,f=(f=f+Math.imul(_e,Yt)|0)+Math.imul(pe,Hn)|0,_=_+Math.imul(pe,Yt)|0;var ri=($+(p=p+Math.imul(me,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(me,On)|0)+Math.imul(fe,Cn)|0))<<13)|0;$=((_=_+Math.imul(fe,On)|0)+(f>>>13)|0)+(ri>>>26)|0,ri&=67108863,p=Math.imul(Vt,kn),f=(f=Math.imul(Vt,Nt))+Math.imul(Pt,kn)|0,_=Math.imul(Pt,Nt),p=p+Math.imul(Dt,yn)|0,f=(f=f+Math.imul(Dt,Ft)|0)+Math.imul(Lt,yn)|0,_=_+Math.imul(Lt,Ft)|0,p=p+Math.imul(vt,bn)|0,f=(f=f+Math.imul(vt,Qt)|0)+Math.imul(at,bn)|0,_=_+Math.imul(at,Qt)|0,p=p+Math.imul(bt,Bn)|0,f=(f=f+Math.imul(bt,Kt)|0)+Math.imul(ot,Bn)|0,_=_+Math.imul(ot,Kt)|0,p=p+Math.imul(Xe,In)|0,f=(f=f+Math.imul(Xe,qt)|0)+Math.imul(Be,In)|0,_=_+Math.imul(Be,qt)|0,p=p+Math.imul(Se,Hn)|0,f=(f=f+Math.imul(Se,Yt)|0)+Math.imul(Ae,Hn)|0,_=_+Math.imul(Ae,Yt)|0;var ii=($+(p=p+Math.imul(_e,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(_e,On)|0)+Math.imul(pe,Cn)|0))<<13)|0;$=((_=_+Math.imul(pe,On)|0)+(f>>>13)|0)+(ii>>>26)|0,ii&=67108863,p=Math.imul(Vt,yn),f=(f=Math.imul(Vt,Ft))+Math.imul(Pt,yn)|0,_=Math.imul(Pt,Ft),p=p+Math.imul(Dt,bn)|0,f=(f=f+Math.imul(Dt,Qt)|0)+Math.imul(Lt,bn)|0,_=_+Math.imul(Lt,Qt)|0,p=p+Math.imul(vt,Bn)|0,f=(f=f+Math.imul(vt,Kt)|0)+Math.imul(at,Bn)|0,_=_+Math.imul(at,Kt)|0,p=p+Math.imul(bt,In)|0,f=(f=f+Math.imul(bt,qt)|0)+Math.imul(ot,In)|0,_=_+Math.imul(ot,qt)|0,p=p+Math.imul(Xe,Hn)|0,f=(f=f+Math.imul(Xe,Yt)|0)+Math.imul(Be,Hn)|0,_=_+Math.imul(Be,Yt)|0;var kr=($+(p=p+Math.imul(Se,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Se,On)|0)+Math.imul(Ae,Cn)|0))<<13)|0;$=((_=_+Math.imul(Ae,On)|0)+(f>>>13)|0)+(kr>>>26)|0,kr&=67108863,p=Math.imul(Vt,bn),f=(f=Math.imul(Vt,Qt))+Math.imul(Pt,bn)|0,_=Math.imul(Pt,Qt),p=p+Math.imul(Dt,Bn)|0,f=(f=f+Math.imul(Dt,Kt)|0)+Math.imul(Lt,Bn)|0,_=_+Math.imul(Lt,Kt)|0,p=p+Math.imul(vt,In)|0,f=(f=f+Math.imul(vt,qt)|0)+Math.imul(at,In)|0,_=_+Math.imul(at,qt)|0,p=p+Math.imul(bt,Hn)|0,f=(f=f+Math.imul(bt,Yt)|0)+Math.imul(ot,Hn)|0,_=_+Math.imul(ot,Yt)|0;var qr=($+(p=p+Math.imul(Xe,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Xe,On)|0)+Math.imul(Be,Cn)|0))<<13)|0;$=((_=_+Math.imul(Be,On)|0)+(f>>>13)|0)+(qr>>>26)|0,qr&=67108863,p=Math.imul(Vt,Bn),f=(f=Math.imul(Vt,Kt))+Math.imul(Pt,Bn)|0,_=Math.imul(Pt,Kt),p=p+Math.imul(Dt,In)|0,f=(f=f+Math.imul(Dt,qt)|0)+Math.imul(Lt,In)|0,_=_+Math.imul(Lt,qt)|0,p=p+Math.imul(vt,Hn)|0,f=(f=f+Math.imul(vt,Yt)|0)+Math.imul(at,Hn)|0,_=_+Math.imul(at,Yt)|0;var Ti=($+(p=p+Math.imul(bt,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(bt,On)|0)+Math.imul(ot,Cn)|0))<<13)|0;$=((_=_+Math.imul(ot,On)|0)+(f>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,p=Math.imul(Vt,In),f=(f=Math.imul(Vt,qt))+Math.imul(Pt,In)|0,_=Math.imul(Pt,qt),p=p+Math.imul(Dt,Hn)|0,f=(f=f+Math.imul(Dt,Yt)|0)+Math.imul(Lt,Hn)|0,_=_+Math.imul(Lt,Yt)|0;var Oi=($+(p=p+Math.imul(vt,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(vt,On)|0)+Math.imul(at,Cn)|0))<<13)|0;$=((_=_+Math.imul(at,On)|0)+(f>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,p=Math.imul(Vt,Hn),f=(f=Math.imul(Vt,Yt))+Math.imul(Pt,Hn)|0,_=Math.imul(Pt,Yt);var xo=($+(p=p+Math.imul(Dt,Cn)|0)|0)+((8191&(f=(f=f+Math.imul(Dt,On)|0)+Math.imul(Lt,Cn)|0))<<13)|0;$=((_=_+Math.imul(Lt,On)|0)+(f>>>13)|0)+(xo>>>26)|0,xo&=67108863;var ca=($+(p=Math.imul(Vt,Cn))|0)+((8191&(f=(f=Math.imul(Vt,On))+Math.imul(Pt,Cn)|0))<<13)|0;return $=((_=Math.imul(Pt,On))+(f>>>13)|0)+(ca>>>26)|0,ca&=67108863,B[0]=Fi,B[1]=ji,B[2]=xi,B[3]=vi,B[4]=Vi,B[5]=dr,B[6]=jn,B[7]=yi,B[8]=Ui,B[9]=Ai,B[10]=Ki,B[11]=ri,B[12]=ii,B[13]=kr,B[14]=qr,B[15]=Ti,B[16]=Oi,B[17]=xo,B[18]=ca,$!==0&&(B[19]=$,m.length++),m};function se(d,g,m){m.negative=g.negative^d.negative,m.length=d.length+g.length;for(var p=0,f=0,_=0;_>>26)|0)>>>26,T&=67108863}m.words[_]=L,p=T,T=f}return p!==0?m.words[_]=p:m.length--,m._strip()}function oe(d,g,m){return se(d,g,m)}Math.imul||(te=ee),i.prototype.mulTo=function(d,g){var m=this.length+d.length;return this.length===10&&d.length===10?te(this,d,g):m<63?ee(this,d,g):m<1024?se(this,d,g):oe(this,d,g)},i.prototype.mul=function(d){var g=new i(null);return g.words=new Array(this.length+d.length),this.mulTo(d,g)},i.prototype.mulf=function(d){var g=new i(null);return g.words=new Array(this.length+d.length),oe(this,d,g)},i.prototype.imul=function(d){return this.clone().mulTo(d,this)},i.prototype.imuln=function(d){var g=d<0;g&&(d=-d),r(typeof d=="number"),r(d<67108864);for(var m=0,p=0;p>=26,m+=f/67108864|0,m+=_>>>26,this.words[p]=67108863&_}return m!==0&&(this.words[p]=m,this.length++),g?this.ineg():this},i.prototype.muln=function(d){return this.clone().imuln(d)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(d){var g=function(_){for(var T=new Array(_.bitLength()),L=0;L>>$&1}return T}(d);if(g.length===0)return new i(1);for(var m=this,p=0;p=0);var g,m=d%26,p=(d-m)/26,f=67108863>>>26-m<<26-m;if(m!==0){var _=0;for(g=0;g>>26-m}_&&(this.words[g]=_,this.length++)}if(p!==0){for(g=this.length-1;g>=0;g--)this.words[g+p]=this.words[g];for(g=0;g=0),p=g?(g-g%26)/26:0;var f=d%26,_=Math.min((d-f)/26,this.length),T=67108863^67108863>>>f<_)for(this.length-=_,B=0;B=0&&($!==0||B>=p);B--){var Y=0|this.words[B];this.words[B]=$<<26-f|Y>>>f,$=Y&T}return L&&$!==0&&(L.words[L.length++]=$),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(d,g,m){return r(this.negative===0),this.iushrn(d,g,m)},i.prototype.shln=function(d){return this.clone().ishln(d)},i.prototype.ushln=function(d){return this.clone().iushln(d)},i.prototype.shrn=function(d){return this.clone().ishrn(d)},i.prototype.ushrn=function(d){return this.clone().iushrn(d)},i.prototype.testn=function(d){r(typeof d=="number"&&d>=0);var g=d%26,m=(d-g)/26,p=1<=0);var g=d%26,m=(d-g)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(g!==0&&m++,this.length=Math.min(m,this.length),g!==0){var p=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},i.prototype.isubn=function(d){if(r(typeof d=="number"),r(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(L/67108864|0),this.words[p+m]=67108863&f}for(;p>26,this.words[p+m]=67108863&f;if(T===0)return this._strip();for(r(T===-1),T=0,p=0;p>26,this.words[p]=67108863&f;return this.negative=1,this._strip()},i.prototype._wordDiv=function(d,g){var m=(this.length,d.length),p=this.clone(),f=d,_=0|f.words[f.length-1];(m=26-this._countBits(_))!=0&&(f=f.ushln(m),p.iushln(m),_=0|f.words[f.length-1]);var T,L=p.length-f.length;if(g!=="mod"){(T=new i(null)).length=L+1,T.words=new Array(T.length);for(var B=0;B=0;Y--){var q=67108864*(0|p.words[f.length+Y])+(0|p.words[f.length+Y-1]);for(q=Math.min(q/_|0,67108863),p._ishlnsubmul(f,q,Y);p.negative!==0;)q--,p.negative=0,p._ishlnsubmul(f,1,Y),p.isZero()||(p.negative^=1);T&&(T.words[Y]=q)}return T&&T._strip(),p._strip(),g!=="div"&&m!==0&&p.iushrn(m),{div:T||null,mod:p}},i.prototype.divmod=function(d,g,m){return r(!d.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&d.negative===0?(_=this.neg().divmod(d,g),g!=="mod"&&(p=_.div.neg()),g!=="div"&&(f=_.mod.neg(),m&&f.negative!==0&&f.iadd(d)),{div:p,mod:f}):this.negative===0&&d.negative!==0?(_=this.divmod(d.neg(),g),g!=="mod"&&(p=_.div.neg()),{div:p,mod:_.mod}):this.negative&d.negative?(_=this.neg().divmod(d.neg(),g),g!=="div"&&(f=_.mod.neg(),m&&f.negative!==0&&f.isub(d)),{div:_.div,mod:f}):d.length>this.length||this.cmp(d)<0?{div:new i(0),mod:this}:d.length===1?g==="div"?{div:this.divn(d.words[0]),mod:null}:g==="mod"?{div:null,mod:new i(this.modrn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new i(this.modrn(d.words[0]))}:this._wordDiv(d,g);var p,f,_},i.prototype.div=function(d){return this.divmod(d,"div",!1).div},i.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},i.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},i.prototype.divRound=function(d){var g=this.divmod(d);if(g.mod.isZero())return g.div;var m=g.div.negative!==0?g.mod.isub(d):g.mod,p=d.ushrn(1),f=d.andln(1),_=m.cmp(p);return _<0||f===1&&_===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},i.prototype.modrn=function(d){var g=d<0;g&&(d=-d),r(d<=67108863);for(var m=(1<<26)%d,p=0,f=this.length-1;f>=0;f--)p=(m*p+(0|this.words[f]))%d;return g?-p:p},i.prototype.modn=function(d){return this.modrn(d)},i.prototype.idivn=function(d){var g=d<0;g&&(d=-d),r(d<=67108863);for(var m=0,p=this.length-1;p>=0;p--){var f=(0|this.words[p])+67108864*m;this.words[p]=f/d|0,m=f%d}return this._strip(),g?this.ineg():this},i.prototype.divn=function(d){return this.clone().idivn(d)},i.prototype.egcd=function(d){r(d.negative===0),r(!d.isZero());var g=this,m=d.clone();g=g.negative!==0?g.umod(d):g.clone();for(var p=new i(1),f=new i(0),_=new i(0),T=new i(1),L=0;g.isEven()&&m.isEven();)g.iushrn(1),m.iushrn(1),++L;for(var B=m.clone(),$=g.clone();!g.isZero();){for(var Y=0,q=1;!(g.words[0]&q)&&Y<26;++Y,q<<=1);if(Y>0)for(g.iushrn(Y);Y-- >0;)(p.isOdd()||f.isOdd())&&(p.iadd(B),f.isub($)),p.iushrn(1),f.iushrn(1);for(var F=0,K=1;!(m.words[0]&K)&&F<26;++F,K<<=1);if(F>0)for(m.iushrn(F);F-- >0;)(_.isOdd()||T.isOdd())&&(_.iadd(B),T.isub($)),_.iushrn(1),T.iushrn(1);g.cmp(m)>=0?(g.isub(m),p.isub(_),f.isub(T)):(m.isub(g),_.isub(p),T.isub(f))}return{a:_,b:T,gcd:m.iushln(L)}},i.prototype._invmp=function(d){r(d.negative===0),r(!d.isZero());var g=this,m=d.clone();g=g.negative!==0?g.umod(d):g.clone();for(var p,f=new i(1),_=new i(0),T=m.clone();g.cmpn(1)>0&&m.cmpn(1)>0;){for(var L=0,B=1;!(g.words[0]&B)&&L<26;++L,B<<=1);if(L>0)for(g.iushrn(L);L-- >0;)f.isOdd()&&f.iadd(T),f.iushrn(1);for(var $=0,Y=1;!(m.words[0]&Y)&&$<26;++$,Y<<=1);if($>0)for(m.iushrn($);$-- >0;)_.isOdd()&&_.iadd(T),_.iushrn(1);g.cmp(m)>=0?(g.isub(m),f.isub(_)):(m.isub(g),_.isub(f))}return(p=g.cmpn(1)===0?f:_).cmpn(0)<0&&p.iadd(d),p},i.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var g=this.clone(),m=d.clone();g.negative=0,m.negative=0;for(var p=0;g.isEven()&&m.isEven();p++)g.iushrn(1),m.iushrn(1);for(;;){for(;g.isEven();)g.iushrn(1);for(;m.isEven();)m.iushrn(1);var f=g.cmp(m);if(f<0){var _=g;g=m,m=_}else if(f===0||m.cmpn(1)===0)break;g.isub(m)}return m.iushln(p)},i.prototype.invm=function(d){return this.egcd(d).a.umod(d)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(d){return this.words[0]&d},i.prototype.bincn=function(d){r(typeof d=="number");var g=d%26,m=(d-g)/26,p=1<>>26,T&=67108863,this.words[_]=T}return f!==0&&(this.words[_]=f,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(d){var g,m=d<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;if(this._strip(),this.length>1)g=1;else{m&&(d=-d),r(d<=67108863,"Number is too big");var p=0|this.words[0];g=p===d?0:pd.length)return 1;if(this.length=0;m--){var p=0|this.words[m],f=0|d.words[m];if(p!==f){pf&&(g=1);break}}return g},i.prototype.gtn=function(d){return this.cmpn(d)===1},i.prototype.gt=function(d){return this.cmp(d)===1},i.prototype.gten=function(d){return this.cmpn(d)>=0},i.prototype.gte=function(d){return this.cmp(d)>=0},i.prototype.ltn=function(d){return this.cmpn(d)===-1},i.prototype.lt=function(d){return this.cmp(d)===-1},i.prototype.lten=function(d){return this.cmpn(d)<=0},i.prototype.lte=function(d){return this.cmp(d)<=0},i.prototype.eqn=function(d){return this.cmpn(d)===0},i.prototype.eq=function(d){return this.cmp(d)===0},i.red=function(d){return new S(d)},i.prototype.toRed=function(d){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(d){return this.red=d,this},i.prototype.forceRed=function(d){return r(!this.red,"Already a number in reduction context"),this._forceRed(d)},i.prototype.redAdd=function(d){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},i.prototype.redIAdd=function(d){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},i.prototype.redSub=function(d){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},i.prototype.redISub=function(d){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},i.prototype.redShl=function(d){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},i.prototype.redMul=function(d){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},i.prototype.redIMul=function(d){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(d){return r(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var Ee={k256:null,p224:null,p192:null,p25519:null};function we(d,g){this.name=d,this.p=new i(g,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function Ce(){we.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function ze(){we.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Fe(){we.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function $e(){we.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(d){if(typeof d=="string"){var g=i._prime(d);this.m=g.p,this.prime=g}else r(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}function P(d){S.call(this,d),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}we.prototype._tmp=function(){var d=new i(null);return d.words=new Array(Math.ceil(this.n/13)),d},we.prototype.ireduce=function(d){var g,m=d;do this.split(m,this.tmp),g=(m=(m=this.imulK(m)).iadd(this.tmp)).bitLength();while(g>this.n);var p=g0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},we.prototype.split=function(d,g){d.iushrn(this.n,0,g)},we.prototype.imulK=function(d){return d.imul(this.k)},a(Ce,we),Ce.prototype.split=function(d,g){for(var m=4194303,p=Math.min(d.length,9),f=0;f>>22,_=T}_>>>=22,d.words[f-10]=_,_===0&&d.length>10?d.length-=10:d.length-=9},Ce.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var g=0,m=0;m>>=26,d.words[m]=f,g=p}return g!==0&&(d.words[d.length++]=g),d},i._prime=function(d){if(Ee[d])return Ee[d];var g;if(d==="k256")g=new Ce;else if(d==="p224")g=new ze;else if(d==="p192")g=new Fe;else{if(d!=="p25519")throw new Error("Unknown prime "+d);g=new $e}return Ee[d]=g,g},S.prototype._verify1=function(d){r(d.negative===0,"red works only with positives"),r(d.red,"red works only with red numbers")},S.prototype._verify2=function(d,g){r((d.negative|g.negative)==0,"red works only with positives"),r(d.red&&d.red===g.red,"red works only with red numbers")},S.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):(M(d,d.umod(this.m)._forceRed(this)),d)},S.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},S.prototype.add=function(d,g){this._verify2(d,g);var m=d.add(g);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},S.prototype.iadd=function(d,g){this._verify2(d,g);var m=d.iadd(g);return m.cmp(this.m)>=0&&m.isub(this.m),m},S.prototype.sub=function(d,g){this._verify2(d,g);var m=d.sub(g);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},S.prototype.isub=function(d,g){this._verify2(d,g);var m=d.isub(g);return m.cmpn(0)<0&&m.iadd(this.m),m},S.prototype.shl=function(d,g){return this._verify1(d),this.imod(d.ushln(g))},S.prototype.imul=function(d,g){return this._verify2(d,g),this.imod(d.imul(g))},S.prototype.mul=function(d,g){return this._verify2(d,g),this.imod(d.mul(g))},S.prototype.isqr=function(d){return this.imul(d,d.clone())},S.prototype.sqr=function(d){return this.mul(d,d)},S.prototype.sqrt=function(d){if(d.isZero())return d.clone();var g=this.m.andln(3);if(r(g%2==1),g===3){var m=this.m.add(new i(1)).iushrn(2);return this.pow(d,m)}for(var p=this.m.subn(1),f=0;!p.isZero()&&p.andln(1)===0;)f++,p.iushrn(1);r(!p.isZero());var _=new i(1).toRed(this),T=_.redNeg(),L=this.m.subn(1).iushrn(1),B=this.m.bitLength();for(B=new i(2*B*B).toRed(this);this.pow(B,L).cmp(T)!==0;)B.redIAdd(T);for(var $=this.pow(B,p),Y=this.pow(d,p.addn(1).iushrn(1)),q=this.pow(d,p),F=f;q.cmp(_)!==0;){for(var K=q,Z=0;K.cmp(_)!==0;Z++)K=K.redSqr();r(Z=0;p--){for(var B=g.words[p],$=L-1;$>=0;$--){var Y=B>>$&1;f!==m[0]&&(f=this.sqr(f)),Y!==0||_!==0?(_<<=1,_|=Y,(++T==4||p===0&&$===0)&&(f=this.mul(f,m[_]),T=0,_=0)):T=0}L=26}return f},S.prototype.convertTo=function(d){var g=d.umod(this.m);return g===d?g.clone():g},S.prototype.convertFrom=function(d){var g=d.clone();return g.red=null,g},i.mont=function(d){return new P(d)},a(P,S),P.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},P.prototype.convertFrom=function(d){var g=this.imod(d.mul(this.rinv));return g.red=null,g},P.prototype.imul=function(d,g){if(d.isZero()||g.isZero())return d.words[0]=0,d.length=1,d;var m=d.imul(g),p=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=m.isub(p).iushrn(this.shift),_=f;return f.cmp(this.m)>=0?_=f.isub(this.m):f.cmpn(0)<0&&(_=f.iadd(this.m)),_._forceRed(this)},P.prototype.mul=function(d,g){if(d.isZero()||g.isZero())return new i(0)._forceRed(this);var m=d.mul(g),p=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=m.isub(p).iushrn(this.shift),_=f;return f.cmp(this.m)>=0?_=f.isub(this.m):f.cmpn(0)<0&&(_=f.iadd(this.m)),_._forceRed(this)},P.prototype.invm=function(d){return this.imod(d._invmp(this.m).mul(this.r2))._forceRed(this)}})(e,b)})(VI);var Ku,YI=VI.exports,Fl={},Nk={},GI={},Dk={},Ew=G,a2=Ew.Buffer,Hu={};for(Ku in Ew)Ew.hasOwnProperty(Ku)&&Ku!=="SlowBuffer"&&Ku!=="Buffer"&&(Hu[Ku]=Ew[Ku]);var s2=Hu.Buffer={};for(Ku in a2)a2.hasOwnProperty(Ku)&&Ku!=="allocUnsafe"&&Ku!=="allocUnsafeSlow"&&(s2[Ku]=a2[Ku]);if(Hu.Buffer.prototype=a2.prototype,s2.from&&s2.from!==Uint8Array.from||(s2.from=function(e,t,n){if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&e.length===void 0)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return a2(e,t,n)}),s2.alloc||(s2.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=a2(e);return t&&t.length!==0?typeof n=="string"?r.fill(t,n):r.fill(t):r.fill(0),r}),!Hu.kStringMaxLength)try{Hu.kStringMaxLength=mi.binding("buffer").kStringMaxLength}catch{}Hu.constants||(Hu.constants={MAX_LENGTH:Hu.kMaxLength},Hu.kStringMaxLength&&(Hu.constants.MAX_STRING_LENGTH=Hu.kStringMaxLength));var Bk=Hu,kw={};const $Y=wr;function $u(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function u2(e,t){this.path=e,this.rethrow(t)}kw.Reporter=$u,$u.prototype.isError=function(e){return e instanceof u2},$u.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},$u.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},$u.prototype.enterKey=function(e){return this._reporterState.path.push(e)},$u.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},$u.prototype.leaveKey=function(e,t,n){const r=this._reporterState;this.exitKey(e),r.obj!==null&&(r.obj[t]=n)},$u.prototype.path=function(){return this._reporterState.path.join("/")},$u.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},$u.prototype.leaveObject=function(e){const t=this._reporterState,n=t.obj;return t.obj=e,n},$u.prototype.error=function(e){let t;const n=this._reporterState,r=e instanceof u2;if(t=r?e:new u2(n.path.map(function(a){return"["+JSON.stringify(a)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw t;return r||n.errors.push(t),t},$u.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},$Y(u2,Error),u2.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,u2),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this};var Vp={};const qY=wr,Mw=kw.Reporter,l2=Bk.Buffer;function qu(e,t){Mw.call(this,t),l2.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function c2(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(n){return c2.isEncoderBuffer(n)||(n=new c2(n,t)),this.length+=n.length,n},this);else if(typeof e=="number"){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if(typeof e=="string")this.value=e,this.length=l2.byteLength(e);else{if(!l2.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}qY(qu,Mw),Vp.DecoderBuffer=qu,qu.isDecoderBuffer=function(e){return e instanceof qu||typeof e=="object"&&l2.isBuffer(e.base)&&e.constructor.name==="DecoderBuffer"&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.save=="function"&&typeof e.restore=="function"&&typeof e.isEmpty=="function"&&typeof e.readUInt8=="function"&&typeof e.skip=="function"&&typeof e.raw=="function"},qu.prototype.save=function(){return{offset:this.offset,reporter:Mw.prototype.save.call(this)}},qu.prototype.restore=function(e){const t=new qu(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,Mw.prototype.restore.call(this,e.reporter),t},qu.prototype.isEmpty=function(){return this.offset===this.length},qu.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},qu.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const n=new qu(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},qu.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},Vp.EncoderBuffer=c2,c2.isEncoderBuffer=function(e){return e instanceof c2||typeof e=="object"&&e.constructor.name==="EncoderBuffer"&&typeof e.length=="number"&&typeof e.join=="function"},c2.prototype.join=function(e,t){return e||(e=l2.alloc(this.length)),t||(t=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):(typeof this.value=="number"?e[t]=this.value:typeof this.value=="string"?e.write(this.value,t):l2.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e};const WY=kw.Reporter,VY=Vp.EncoderBuffer,YY=Vp.DecoderBuffer,Ja=Bu,ZI=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],GY=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(ZI);function hi(e,t,n){const r={};this._baseState=r,r.name=n,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}var zk=hi;const ZY=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];hi.prototype.clone=function(){const e=this._baseState,t={};ZY.forEach(function(r){t[r]=e[r]});const n=new this.constructor(t.parent);return n._baseState=t,n},hi.prototype._wrap=function(){const e=this._baseState;GY.forEach(function(t){this[t]=function(){const n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},hi.prototype._init=function(e){const t=this._baseState;Ja(t.parent===null),e.call(this),t.children=t.children.filter(function(n){return n._baseState.parent===this},this),Ja.equal(t.children.length,1,"Root node can have only one child")},hi.prototype._useArgs=function(e){const t=this._baseState,n=e.filter(function(r){return r instanceof this.constructor},this);e=e.filter(function(r){return!(r instanceof this.constructor)},this),n.length!==0&&(Ja(t.children===null),t.children=n,n.forEach(function(r){r._baseState.parent=this},this)),e.length!==0&&(Ja(t.args===null),t.args=e,t.reverseArgs=e.map(function(r){if(typeof r!="object"||r.constructor!==Object)return r;const a={};return Object.keys(r).forEach(function(i){i==(0|i)&&(i|=0);const h=r[i];a[h]=i}),a}))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach(function(e){hi.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),ZI.forEach(function(e){hi.prototype[e]=function(){const t=this._baseState,n=Array.prototype.slice.call(arguments);return Ja(t.tag===null),t.tag=e,this._useArgs(n),this}}),hi.prototype.use=function(e){Ja(e);const t=this._baseState;return Ja(t.use===null),t.use=e,this},hi.prototype.optional=function(){return this._baseState.optional=!0,this},hi.prototype.def=function(e){const t=this._baseState;return Ja(t.default===null),t.default=e,t.optional=!0,this},hi.prototype.explicit=function(e){const t=this._baseState;return Ja(t.explicit===null&&t.implicit===null),t.explicit=e,this},hi.prototype.implicit=function(e){const t=this._baseState;return Ja(t.explicit===null&&t.implicit===null),t.implicit=e,this},hi.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,t.length!==0&&this._useArgs(t),this},hi.prototype.key=function(e){const t=this._baseState;return Ja(t.key===null),t.key=e,this},hi.prototype.any=function(){return this._baseState.any=!0,this},hi.prototype.choice=function(e){const t=this._baseState;return Ja(t.choice===null),t.choice=e,this._useArgs(Object.keys(e).map(function(n){return e[n]})),this},hi.prototype.contains=function(e){const t=this._baseState;return Ja(t.use===null),t.contains=e,this},hi.prototype._decode=function(e,t){const n=this._baseState;if(n.parent===null)return e.wrapResult(n.children[0]._decode(e,t));let r,a=n.default,i=!0,h=null;if(n.key!==null&&(h=e.enterKey(n.key)),n.optional){let y=null;if(n.explicit!==null?y=n.explicit:n.implicit!==null?y=n.implicit:n.tag!==null&&(y=n.tag),y!==null||n.any){if(i=this._peekTag(e,y,n.any),e.isError(i))return i}else{const k=e.save();try{n.choice===null?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),i=!0}catch{i=!1}e.restore(k)}}if(n.obj&&i&&(r=e.enterObject()),i){if(n.explicit!==null){const k=this._decodeTag(e,n.explicit);if(e.isError(k))return k;e=k}const y=e.offset;if(n.use===null&&n.choice===null){let k;n.any&&(k=e.save());const E=this._decodeTag(e,n.implicit!==null?n.implicit:n.tag,n.any);if(e.isError(E))return E;n.any?a=e.raw(k):e=E}if(t&&t.track&&n.tag!==null&&t.track(e.path(),y,e.length,"tagged"),t&&t.track&&n.tag!==null&&t.track(e.path(),e.offset,e.length,"content"),n.any||(a=n.choice===null?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t)),e.isError(a))return a;if(n.any||n.choice!==null||n.children===null||n.children.forEach(function(k){k._decode(e,t)}),n.contains&&(n.tag==="octstr"||n.tag==="bitstr")){const k=new YY(a);a=this._getUse(n.contains,e._reporterState.obj)._decode(k,t)}}return n.obj&&i&&(a=e.leaveObject(r)),n.key===null||a===null&&i!==!0?h!==null&&e.exitKey(h):e.leaveKey(h,n.key,a),a},hi.prototype._decodeGeneric=function(e,t,n){const r=this._baseState;return e==="seq"||e==="set"?null:e==="seqof"||e==="setof"?this._decodeList(t,e,r.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):e==="objid"&&r.args?this._decodeObjid(t,r.args[0],r.args[1],n):e==="objid"?this._decodeObjid(t,null,null,n):e==="gentime"||e==="utctime"?this._decodeTime(t,e,n):e==="null_"?this._decodeNull(t,n):e==="bool"?this._decodeBool(t,n):e==="objDesc"?this._decodeStr(t,e,n):e==="int"||e==="enum"?this._decodeInt(t,r.args&&r.args[0],n):r.use!==null?this._getUse(r.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},hi.prototype._getUse=function(e,t){const n=this._baseState;return n.useDecoder=this._use(e,t),Ja(n.useDecoder._baseState.parent===null),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},hi.prototype._decodeChoice=function(e,t){const n=this._baseState;let r=null,a=!1;return Object.keys(n.choice).some(function(i){const h=e.save(),y=n.choice[i];try{const k=y._decode(e,t);if(e.isError(k))return!1;r={type:i,value:k},a=!0}catch{return e.restore(h),!1}return!0},this),a?r:e.error("Choice not matched")},hi.prototype._createEncoderBuffer=function(e){return new VY(e,this.reporter)},hi.prototype._encode=function(e,t,n){const r=this._baseState;if(r.default!==null&&r.default===e)return;const a=this._encodeValue(e,t,n);return a===void 0||this._skipDefault(a,t,n)?void 0:a},hi.prototype._encodeValue=function(e,t,n){const r=this._baseState;if(r.parent===null)return r.children[0]._encode(e,t||new WY);let a=null;if(this.reporter=t,r.optional&&e===void 0){if(r.default===null)return;e=r.default}let i=null,h=!1;if(r.any)a=this._createEncoderBuffer(e);else if(r.choice)a=this._encodeChoice(e,t);else if(r.contains)i=this._getUse(r.contains,n)._encode(e,t),h=!0;else if(r.children)i=r.children.map(function(y){if(y._baseState.tag==="null_")return y._encode(null,t,e);if(y._baseState.key===null)return t.error("Child should have a key");const k=t.enterKey(y._baseState.key);if(typeof e!="object")return t.error("Child expected, but input is not object");const E=y._encode(e[y._baseState.key],t,e);return t.leaveKey(k),E},this).filter(function(y){return y}),i=this._createEncoderBuffer(i);else if(r.tag==="seqof"||r.tag==="setof"){if(!r.args||r.args.length!==1)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const y=this.clone();y._baseState.implicit=null,i=this._createEncoderBuffer(e.map(function(k){const E=this._baseState;return this._getUse(E.args[0],e)._encode(k,t)},y))}else r.use!==null?a=this._getUse(r.use,n)._encode(e,t):(i=this._encodePrimitive(r.tag,e),h=!0);if(!r.any&&r.choice===null){const y=r.implicit!==null?r.implicit:r.tag,k=r.implicit===null?"universal":"context";y===null?r.use===null&&t.error("Tag could be omitted only for .use()"):r.use===null&&(a=this._encodeComposite(y,h,k,i))}return r.explicit!==null&&(a=this._encodeComposite(r.explicit,!1,"context",a)),a},hi.prototype._encodeChoice=function(e,t){const n=this._baseState,r=n.choice[e.type];return r||Ja(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(e.value,t)},hi.prototype._encodePrimitive=function(e,t){const n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if(e==="objid"&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if(e==="objid")return this._encodeObjid(t,null,null);if(e==="gentime"||e==="utctime")return this._encodeTime(t,e);if(e==="null_")return this._encodeNull();if(e==="int"||e==="enum")return this._encodeInt(t,n.args&&n.reverseArgs[0]);if(e==="bool")return this._encodeBool(t);if(e==="objDesc")return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},hi.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},hi.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)};var Cw={};(function(e){function t(n){const r={};return Object.keys(n).forEach(function(a){(0|a)==a&&(a|=0);const i=n[a];r[i]=a}),r}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=t(e.tag)})(Cw);const QY=wr,gd=Bk.Buffer,QI=zk,Fk=Cw;function XI(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new jl,this.tree._init(e.body)}var JI=XI;function jl(e){QI.call(this,"der",e)}function Wu(e){return e<10?"0"+e:e}XI.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},QY(jl,QI),jl.prototype._encodeComposite=function(e,t,n,r){const a=function(y,k,E,M){let C;if(y==="seqof"?y="seq":y==="setof"&&(y="set"),Fk.tagByName.hasOwnProperty(y))C=Fk.tagByName[y];else{if(typeof y!="number"||(0|y)!==y)return M.error("Unknown tag: "+y);C=y}return C>=31?M.error("Multi-octet tag encoding unsupported"):(k||(C|=32),C|=Fk.tagClassByName[E||"universal"]<<6,C)}(e,t,n,this.reporter);if(r.length<128){const y=gd.alloc(2);return y[0]=a,y[1]=r.length,this._createEncoderBuffer([y,r])}let i=1;for(let y=r.length;y>=256;y>>=8)i++;const h=gd.alloc(2+i);h[0]=a,h[1]=128|i;for(let y=1+i,k=r.length;k>0;y--,k>>=8)h[y]=255&k;return this._createEncoderBuffer([h,r])},jl.prototype._encodeStr=function(e,t){if(t==="bitstr")return this._createEncoderBuffer([0|e.unused,e.data]);if(t==="bmpstr"){const n=gd.alloc(2*e.length);for(let r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let r=0;for(let h=0;h=128;y>>=7)r++}const a=gd.alloc(r);let i=a.length-1;for(let h=e.length-1;h>=0;h--){let y=e[h];for(a[i--]=127&y;(y>>=7)>0;)a[i--]=128|127&y}return this._createEncoderBuffer(a)},jl.prototype._encodeTime=function(e,t){let n;const r=new Date(e);return t==="gentime"?n=[Wu(r.getUTCFullYear()),Wu(r.getUTCMonth()+1),Wu(r.getUTCDate()),Wu(r.getUTCHours()),Wu(r.getUTCMinutes()),Wu(r.getUTCSeconds()),"Z"].join(""):t==="utctime"?n=[Wu(r.getUTCFullYear()%100),Wu(r.getUTCMonth()+1),Wu(r.getUTCDate()),Wu(r.getUTCHours()),Wu(r.getUTCMinutes()),Wu(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},jl.prototype._encodeNull=function(){return this._createEncoderBuffer("")},jl.prototype._encodeInt=function(e,t){if(typeof e=="string"){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if(typeof e!="number"&&!gd.isBuffer(e)){const a=e.toArray();!e.sign&&128&a[0]&&a.unshift(0),e=gd.from(a)}if(gd.isBuffer(e)){let a=e.length;e.length===0&&a++;const i=gd.alloc(a);return e.copy(i),e.length===0&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let n=1;for(let a=e;a>=256;a>>=8)n++;const r=new Array(n);for(let a=r.length-1;a>=0;a--)r[a]=255&e,e>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(gd.from(r))},jl.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},jl.prototype._use=function(e,t){return typeof e=="function"&&(e=e(t)),e._getEncoder("der").tree},jl.prototype._skipDefault=function(e,t,n){const r=this._baseState;let a;if(r.default===null)return!1;const i=e.join();if(r.defaultBuffer===void 0&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),i.length!==r.defaultBuffer.length)return!1;for(a=0;a>6],a=(32&n)==0;if((31&n)==31){let i=n;for(n=0;(128&i)==128;){if(i=e.readUInt8(t),e.isError(i))return i;n<<=7,n|=127&i}}else n&=31;return{cls:r,primitive:a,tag:n,tagStr:nL.tag[n]}}function oL(e,t,n){let r=e.readUInt8(n);if(e.isError(r))return r;if(!t&&r===128)return null;if(!(128&r))return r;const a=127&r;if(a>4)return e.error("length octect is too long");r=0;for(let i=0;i0&&z.ishrn(H),z}function E(C,O,z){var H,ee;do{for(H=e.alloc(0);8*H.length=y)throw new Error("invalid sig")}return Yk=function(h,y,k,E,M){var C=r(k);if(C.type==="ec"){if(E!=="ecdsa"&&E!=="ecdsa/rsa")throw new Error("wrong public key type");return function(oe,Ee,we){var Ce=a[we.data.algorithm.curve.join(".")];if(!Ce)throw new Error("unknown curve "+we.data.algorithm.curve.join("."));var ze=new n(Ce),Fe=we.data.subjectPrivateKey.data;return ze.verify(Ee,oe,Fe)}(h,y,C)}if(C.type==="dsa"){if(E!=="dsa")throw new Error("wrong public key type");return function(oe,Ee,we){var Ce=we.data.p,ze=we.data.q,Fe=we.data.g,$e=we.data.pub_key,S=r.signature.decode(oe,"der"),P=S.s,d=S.r;i(P,ze),i(d,ze);var g=t.mont(Ce),m=P.invm(ze);return Fe.toRed(g).redPow(new t(Ee).mul(m).mod(ze)).fromRed().mul($e.toRed(g).redPow(d.mul(m).mod(ze)).fromRed()).mod(Ce).mod(ze).cmp(d)===0}(h,y,C)}if(E!=="rsa"&&E!=="ecdsa/rsa")throw new Error("wrong public key type");y=e.concat([M,y]);for(var O=C.modulus.byteLength(),z=[1],H=0;y.length+z.length+2k-O-2)throw new Error("message too long");var z=Hl.alloc(k-E-O-2),H=k-C-1,ee=Qk(C),te=kL(Hl.concat([M,z,Hl.alloc(1,1),y],H),EL(ee,H)),se=kL(ee,EL(te,C));return new Xk(Hl.concat([Hl.alloc(1),se,te],k))}(i,t);else if(r===1)a=function(h,y,k){var E,M=y.length,C=h.modulus.byteLength();if(M>C-11)throw new Error("message too long");return E=k?Hl.alloc(C-M-3,255):function(O){for(var z,H=Hl.allocUnsafe(O),ee=0,te=Qk(2*O),se=0;ee=0)throw new Error("data too long for modulus")}return n?BG(a,i):DG(a,i)},FG=Aw,ML=bL,CL=wL,xL=Uo,jG=wk,UG=oy,KG=SL,_y=br().Buffer,HG=function(e,t,n){var r;r=e.padding?e.padding:n?1:4;var a,i=FG(e),h=i.modulus.byteLength();if(t.length>h||new xL(t).cmp(i.modulus)>=0)throw new Error("decryption error");a=n?KG(new xL(t),i):jG(t,i);var y=_y.alloc(h-a.length);if(a=_y.concat([y,a],h),r===4)return function(k,E){var M=k.modulus.byteLength(),C=UG("sha1").update(_y.alloc(0)).digest(),O=C.length;if(E[0]!==0)throw new Error("decryption error");var z=E.slice(1,O+1),H=E.slice(O+1),ee=CL(z,ML(H,O)),te=CL(H,ML(ee,M-O-1));if(function(oe,Ee){oe=_y.from(oe),Ee=_y.from(Ee);var we=0,Ce=oe.length;oe.length!==Ee.length&&(we++,Ce=Math.min(oe.length,Ee.length));for(var ze=-1;++ze=E.length){z++;break}var H=E.slice(2,O-1);if((C.toString("hex")!=="0002"&&!M||C.toString("hex")!=="0001"&&M)&&z++,H.length<8&&z++,z)throw new Error("decryption error");return E.slice(O)}(0,a,n);if(r===3)return a;throw new Error("unknown padding")};(function(e){e.publicEncrypt=zG,e.privateDecrypt=HG,e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}})(yL);var Sy={};function AL(){throw new Error(`secure random number generation not supported by this browser +use chrome, FireFox or Internet Explorer 11`)}var TL,RL=br(),PL=RL.Buffer,IL=RL.kMaxLength,Jk=b.crypto||b.msCrypto,LL=Math.pow(2,32)-1;function OL(e,t){if(typeof e!="number"||e!=e)throw new TypeError("offset must be a number");if(e>LL||e<0)throw new TypeError("offset must be a uint32");if(e>IL||e>t)throw new RangeError("offset out of range")}function NL(e,t,n){if(typeof e!="number"||e!=e)throw new TypeError("size must be a number");if(e>LL||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>IL)throw new RangeError("buffer too small")}function DL(e,t,n,r){var a=e.buffer,i=new Uint8Array(a,t,n);return Jk.getRandomValues(i),r?void pr(function(){r(null,e)}):e}function Tw(){if(TL)return Q;TL=1,Q.randomBytes=Q.rng=Q.pseudoRandomBytes=Q.prng=Uv,Q.createHash=Q.Hash=oy,Q.createHmac=Q.Hmac=tP;var e=kW,t=Object.keys(e),n=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);Q.getHashes=function(){return n};var r=Q8;Q.pbkdf2=r.pbkdf2,Q.pbkdf2Sync=r.pbkdf2Sync;var a=Dl;Q.Cipher=a.Cipher,Q.createCipher=a.createCipher,Q.Cipheriv=a.Cipheriv,Q.createCipheriv=a.createCipheriv,Q.Decipher=a.Decipher,Q.createDecipher=a.createDecipher,Q.Decipheriv=a.Decipheriv,Q.createDecipheriv=a.createDecipheriv,Q.getCiphers=a.getCiphers,Q.listCiphers=a.listCiphers;var i=function(){if(uI)return Kp;uI=1;var E=aI(),M=bV,C=wV(),O={binary:!0,hex:!0,base64:!0};return Kp.DiffieHellmanGroup=Kp.createDiffieHellmanGroup=Kp.getDiffieHellman=function(z){var H=new je(M[z].prime,"hex"),ee=new je(M[z].gen,"hex");return new C(H,ee)},Kp.createDiffieHellman=Kp.DiffieHellman=function z(H,ee,te,se){return di(ee)||O[ee]===void 0?z(H,"binary",ee,te):(ee=ee||"binary",se=se||"binary",di(te=te||new je([2]))||(te=new je(te,se)),typeof H=="number"?new C(E(H,te),te,!0):(di(H)||(H=new je(H,ee)),new C(H,te,!0)))},Kp}();Q.DiffieHellmanGroup=i.DiffieHellmanGroup,Q.createDiffieHellmanGroup=i.createDiffieHellmanGroup,Q.getDiffieHellman=i.getDiffieHellman,Q.createDiffieHellman=i.createDiffieHellman,Q.DiffieHellman=i.DiffieHellman;var h=function(){if(mL)return pL;mL=1;var E=br().Buffer,M=oy,C=Oh,O=wr,z=TG(),H=RG(),ee=nP;function te(we){C.Writable.call(this);var Ce=ee[we];if(!Ce)throw new Error("Unknown message digest");this._hashType=Ce.hash,this._hash=M(Ce.hash),this._tag=Ce.id,this._signType=Ce.sign}function se(we){C.Writable.call(this);var Ce=ee[we];if(!Ce)throw new Error("Unknown message digest");this._hash=M(Ce.hash),this._tag=Ce.id,this._signType=Ce.sign}function oe(we){return new te(we)}function Ee(we){return new se(we)}return Object.keys(ee).forEach(function(we){ee[we].id=E.from(ee[we].id,"hex"),ee[we.toLowerCase()]=ee[we]}),O(te,C.Writable),te.prototype._write=function(we,Ce,ze){this._hash.update(we),ze()},te.prototype.update=function(we,Ce){return typeof we=="string"&&(we=E.from(we,Ce)),this._hash.update(we),this},te.prototype.sign=function(we,Ce){this.end();var ze=this._hash.digest(),Fe=z(ze,we,this._hashType,this._signType,this._tag);return Ce?Fe.toString(Ce):Fe},O(se,C.Writable),se.prototype._write=function(we,Ce,ze){this._hash.update(we),ze()},se.prototype.update=function(we,Ce){return typeof we=="string"&&(we=E.from(we,Ce)),this._hash.update(we),this},se.prototype.verify=function(we,Ce,ze){typeof Ce=="string"&&(Ce=E.from(Ce,ze)),this.end();var Fe=this._hash.digest();return H(Ce,Fe,we,this._signType,this._tag)},pL={Sign:oe,Verify:Ee,createSign:oe,createVerify:Ee}}();Q.createSign=h.createSign,Q.Sign=h.Sign,Q.createVerify=h.createVerify,Q.Verify=h.Verify,Q.createECDH=function(){if(gL)return Gk;gL=1;var E=Ok(),M=Uo;Gk=function(H){return new O(H)};var C={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function O(H){this.curveType=C[H],this.curveType||(this.curveType={name:H}),this.curve=new E.ec(this.curveType.name),this.keys=void 0}function z(H,ee,te){Array.isArray(H)||(H=H.toArray());var se=new je(H);if(te&&se.length{switch(e){case"sha256":case"sha3-256":case"blake2s256":return 32;case"sha512":case"sha3-512":case"blake2b512":return 64;case"sha224":case"sha3-224":return 28;case"sha384":case"sha3-384":return 48;case"sha1":return 20;case"md5":return 16;default:{let t=zL[e];return t===void 0&&(t=$G(e).digest().length,zL[e]=t),t}}},jL=(e,t,n,r)=>{const a=Yp.isBuffer(n)?n:Yp.from(n),i=r&&r.length?Yp.from(r):Yp.alloc(t,0);return BL(e,i).update(a).digest()},UL=(e,t,n,r,a)=>{const i=Yp.isBuffer(a)?a:Yp.from(a||""),h=i.length,y=Math.ceil(r/t);if(y>255)throw new Error(`OKM length ${r} is too long for ${e} hash`);const k=Yp.alloc(t*y+h+1);for(let E=1,M=0,C=0;E<=y;++E)i.copy(k,C),k[C+h]=E,BL(e,n).update(k.slice(M,C+h+1)).digest().copy(k,C),M=C,C+=t;return k.slice(0,r)};function KL(e,t,{salt:n="",info:r="",hash:a="SHA-256"}={}){a=a.toLowerCase().replace("-","");const i=FL(a),h=jL(a,i,e,n);return UL(a,i,h,t,r)}Object.defineProperties(KL,{hash_length:{configurable:!1,enumerable:!1,writable:!1,value:FL},extract:{configurable:!1,enumerable:!1,writable:!1,value:jL},expand:{configurable:!1,enumerable:!1,writable:!1,value:UL}});var HL=KL;const f2="Impossible case. Please create issue.",$L="The tweak was out of range or the resulted private key is invalid",qL="The tweak was out of range or equal to zero",qG="Unknow error on context randomization",WG="Private Key is invalid",Gp="Public Key could not be parsed",Rw="Public Key serialization error",VG="The sum of the public keys is not valid",Ey="Signature could not be parsed",YG="The nonce generation function failed, or the private key was invalid",GG="Public key could not be recover",ZG="Scalar was invalid (zero or overflow)";function Vu(e,t){if(!e)throw new Error(t)}function Nr(e,t,n){if(Vu(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),n!==void 0)if(Array.isArray(n)){const r=`Expected ${e} to be an Uint8Array with length [${n.join(", ")}]`;Vu(n.includes(t.length),r)}else{const r=`Expected ${e} to be an Uint8Array with length ${n}`;Vu(t.length===n,r)}}function Zp(e){Vu(d2(e)==="Boolean","Expected compressed to be a Boolean")}function $l(e=n=>new Uint8Array(n),t){return typeof e=="function"&&(e=e(t)),Nr("output",e,t),e}function d2(e){return Object.prototype.toString.call(e).slice(8,-1)}var WL={},QG="6.5.4",uu={},VL={exports:{}};(function(e){(function(t,n){function r(S,P){if(!S)throw new Error(P||"Assertion failed")}function a(S,P){S.super_=P;var d=function(){};d.prototype=P.prototype,S.prototype=new d,S.prototype.constructor=S}function i(S,P,d){if(i.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&(P!=="le"&&P!=="be"||(d=P,P=10),this._init(S||0,P||10,d||"be"))}var h;typeof t=="object"?t.exports=i:n.BN=i,i.BN=i,i.wordSize=26;try{h=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:G.Buffer}catch{}function y(S,P){var d=S.charCodeAt(P);return d>=65&&d<=70?d-55:d>=97&&d<=102?d-87:d-48&15}function k(S,P,d){var g=y(S,d);return d-1>=P&&(g|=y(S,d-1)<<4),g}function E(S,P,d,g){for(var m=0,p=Math.min(S.length,d),f=P;f=49?_-49+10:_>=17?_-17+10:_}return m}i.isBN=function(S){return S instanceof i||S!==null&&typeof S=="object"&&S.constructor.wordSize===i.wordSize&&Array.isArray(S.words)},i.max=function(S,P){return S.cmp(P)>0?S:P},i.min=function(S,P){return S.cmp(P)<0?S:P},i.prototype._init=function(S,P,d){if(typeof S=="number")return this._initNumber(S,P,d);if(typeof S=="object")return this._initArray(S,P,d);P==="hex"&&(P=16),r(P===(0|P)&&P>=2&&P<=36);var g=0;(S=S.toString().replace(/\s+/g,""))[0]==="-"&&(g++,this.negative=1),g=0;g-=3)p=S[g]|S[g-1]<<8|S[g-2]<<16,this.words[m]|=p<>>26-f&67108863,(f+=24)>=26&&(f-=26,m++);else if(d==="le")for(g=0,m=0;g>>26-f&67108863,(f+=24)>=26&&(f-=26,m++);return this.strip()},i.prototype._parseHex=function(S,P,d){this.length=Math.ceil((S.length-P)/6),this.words=new Array(this.length);for(var g=0;g=P;g-=2)m=k(S,P,g)<=18?(p-=18,f+=1,this.words[f]|=m>>>26):p+=8;else for(g=(S.length-P)%2==0?P+1:P;g=18?(p-=18,f+=1,this.words[f]|=m>>>26):p+=8;this.strip()},i.prototype._parseBase=function(S,P,d){this.words=[0],this.length=1;for(var g=0,m=1;m<=67108863;m*=P)g++;g--,m=m/P|0;for(var p=S.length-d,f=p%g,_=Math.min(p,p-f)+d,T=0,L=d;L<_;L+=g)T=E(S,L,L+g,P),this.imuln(m),this.words[0]+T<67108864?this.words[0]+=T:this._iaddn(T);if(f!==0){var B=1;for(T=E(S,L,S.length,P),L=0;L1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var M=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function z(S,P,d){d.negative=P.negative^S.negative;var g=S.length+P.length|0;d.length=g,g=g-1|0;var m=0|S.words[0],p=0|P.words[0],f=m*p,_=67108863&f,T=f/67108864|0;d.words[0]=_;for(var L=1;L>>26,$=67108863&T,Y=Math.min(L,P.length-1),q=Math.max(0,L-S.length+1);q<=Y;q++){var F=L-q|0;B+=(f=(m=0|S.words[F])*(p=0|P.words[q])+$)/67108864|0,$=67108863&f}d.words[L]=0|$,T=0|B}return T!==0?d.words[L]=0|T:d.length--,d.strip()}i.prototype.toString=function(S,P){var d;if(P=0|P||1,(S=S||10)===16||S==="hex"){d="";for(var g=0,m=0,p=0;p>>24-g&16777215)!=0||p!==this.length-1?M[6-_.length]+_+d:_+d,(g+=2)>=26&&(g-=26,p--)}for(m!==0&&(d=m.toString(16)+d);d.length%P!=0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(S===(0|S)&&S>=2&&S<=36){var T=C[S],L=O[S];d="";var B=this.clone();for(B.negative=0;!B.isZero();){var $=B.modn(L).toString(S);d=(B=B.idivn(L)).isZero()?$+d:M[T-$.length]+$+d}for(this.isZero()&&(d="0"+d);d.length%P!=0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var S=this.words[0];return this.length===2?S+=67108864*this.words[1]:this.length===3&&this.words[2]===1?S+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-S:S},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(S,P){return r(h!==void 0),this.toArrayLike(h,S,P)},i.prototype.toArray=function(S,P){return this.toArrayLike(Array,S,P)},i.prototype.toArrayLike=function(S,P,d){var g=this.byteLength(),m=d||Math.max(1,g);r(g<=m,"byte array longer than desired length"),r(m>0,"Requested array length <= 0"),this.strip();var p,f,_=P==="le",T=new S(m),L=this.clone();if(_){for(f=0;!L.isZero();f++)p=L.andln(255),L.iushrn(8),T[f]=p;for(;f=4096&&(d+=13,P>>>=13),P>=64&&(d+=7,P>>>=7),P>=8&&(d+=4,P>>>=4),P>=2&&(d+=2,P>>>=2),d+P},i.prototype._zeroBits=function(S){if(S===0)return 26;var P=S,d=0;return!(8191&P)&&(d+=13,P>>>=13),!(127&P)&&(d+=7,P>>>=7),!(15&P)&&(d+=4,P>>>=4),!(3&P)&&(d+=2,P>>>=2),!(1&P)&&d++,d},i.prototype.bitLength=function(){var S=this.words[this.length-1],P=this._countBits(S);return 26*(this.length-1)+P},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var S=0,P=0;PS.length?this.clone().ior(S):S.clone().ior(this)},i.prototype.uor=function(S){return this.length>S.length?this.clone().iuor(S):S.clone().iuor(this)},i.prototype.iuand=function(S){var P;P=this.length>S.length?S:this;for(var d=0;dS.length?this.clone().iand(S):S.clone().iand(this)},i.prototype.uand=function(S){return this.length>S.length?this.clone().iuand(S):S.clone().iuand(this)},i.prototype.iuxor=function(S){var P,d;this.length>S.length?(P=this,d=S):(P=S,d=this);for(var g=0;gS.length?this.clone().ixor(S):S.clone().ixor(this)},i.prototype.uxor=function(S){return this.length>S.length?this.clone().iuxor(S):S.clone().iuxor(this)},i.prototype.inotn=function(S){r(typeof S=="number"&&S>=0);var P=0|Math.ceil(S/26),d=S%26;this._expand(P),d>0&&P--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-d),this.strip()},i.prototype.notn=function(S){return this.clone().inotn(S)},i.prototype.setn=function(S,P){r(typeof S=="number"&&S>=0);var d=S/26|0,g=S%26;return this._expand(d+1),this.words[d]=P?this.words[d]|1<S.length?(d=this,g=S):(d=S,g=this);for(var m=0,p=0;p>>26;for(;m!==0&&p>>26;if(this.length=d.length,m!==0)this.words[this.length]=m,this.length++;else if(d!==this)for(;pS.length?this.clone().iadd(S):S.clone().iadd(this)},i.prototype.isub=function(S){if(S.negative!==0){S.negative=0;var P=this.iadd(S);return S.negative=1,P._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(S),this.negative=1,this._normSign();var d,g,m=this.cmp(S);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;m>0?(d=this,g=S):(d=S,g=this);for(var p=0,f=0;f>26,this.words[f]=67108863&P;for(;p!==0&&f>26,this.words[f]=67108863&P;if(p===0&&f>>13,q=0|f[1],F=8191&q,K=q>>>13,Z=0|f[2],ne=8191&Z,ue=Z>>>13,me=0|f[3],fe=8191&me,De=me>>>13,_e=0|f[4],pe=8191&_e,ve=_e>>>13,Se=0|f[5],Ae=8191&Se,qe=Se>>>13,Xe=0|f[6],Be=8191&Xe,gt=Xe>>>13,bt=0|f[7],ot=8191&bt,Wt=bt>>>13,vt=0|f[8],at=8191&vt,Rt=vt>>>13,Dt=0|f[9],Lt=8191&Dt,rn=Dt>>>13,Vt=0|_[0],Pt=8191&Vt,en=Vt>>>13,on=0|_[1],At=8191&on,Jt=on>>>13,tn=0|_[2],Bt=8191&tn,Rn=tn>>>13,wn=0|_[3],Ut=8191&wn,Fn=wn>>>13,kn=0|_[4],Nt=8191&kn,Mn=kn>>>13,yn=0|_[5],Ft=8191&yn,An=yn>>>13,bn=0|_[6],Qt=8191&bn,Ln=bn>>>13,Bn=0|_[7],Kt=8191&Bn,Pn=Bn>>>13,In=0|_[8],qt=8191&In,pn=In>>>13,Hn=0|_[9],Yt=8191&Hn,$n=Hn>>>13;d.negative=S.negative^P.negative,d.length=19;var Cn=(L+(g=Math.imul($,Pt))|0)+((8191&(m=(m=Math.imul($,en))+Math.imul(Y,Pt)|0))<<13)|0;L=((p=Math.imul(Y,en))+(m>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,g=Math.imul(F,Pt),m=(m=Math.imul(F,en))+Math.imul(K,Pt)|0,p=Math.imul(K,en);var On=(L+(g=g+Math.imul($,At)|0)|0)+((8191&(m=(m=m+Math.imul($,Jt)|0)+Math.imul(Y,At)|0))<<13)|0;L=((p=p+Math.imul(Y,Jt)|0)+(m>>>13)|0)+(On>>>26)|0,On&=67108863,g=Math.imul(ne,Pt),m=(m=Math.imul(ne,en))+Math.imul(ue,Pt)|0,p=Math.imul(ue,en),g=g+Math.imul(F,At)|0,m=(m=m+Math.imul(F,Jt)|0)+Math.imul(K,At)|0,p=p+Math.imul(K,Jt)|0;var Fi=(L+(g=g+Math.imul($,Bt)|0)|0)+((8191&(m=(m=m+Math.imul($,Rn)|0)+Math.imul(Y,Bt)|0))<<13)|0;L=((p=p+Math.imul(Y,Rn)|0)+(m>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,g=Math.imul(fe,Pt),m=(m=Math.imul(fe,en))+Math.imul(De,Pt)|0,p=Math.imul(De,en),g=g+Math.imul(ne,At)|0,m=(m=m+Math.imul(ne,Jt)|0)+Math.imul(ue,At)|0,p=p+Math.imul(ue,Jt)|0,g=g+Math.imul(F,Bt)|0,m=(m=m+Math.imul(F,Rn)|0)+Math.imul(K,Bt)|0,p=p+Math.imul(K,Rn)|0;var ji=(L+(g=g+Math.imul($,Ut)|0)|0)+((8191&(m=(m=m+Math.imul($,Fn)|0)+Math.imul(Y,Ut)|0))<<13)|0;L=((p=p+Math.imul(Y,Fn)|0)+(m>>>13)|0)+(ji>>>26)|0,ji&=67108863,g=Math.imul(pe,Pt),m=(m=Math.imul(pe,en))+Math.imul(ve,Pt)|0,p=Math.imul(ve,en),g=g+Math.imul(fe,At)|0,m=(m=m+Math.imul(fe,Jt)|0)+Math.imul(De,At)|0,p=p+Math.imul(De,Jt)|0,g=g+Math.imul(ne,Bt)|0,m=(m=m+Math.imul(ne,Rn)|0)+Math.imul(ue,Bt)|0,p=p+Math.imul(ue,Rn)|0,g=g+Math.imul(F,Ut)|0,m=(m=m+Math.imul(F,Fn)|0)+Math.imul(K,Ut)|0,p=p+Math.imul(K,Fn)|0;var xi=(L+(g=g+Math.imul($,Nt)|0)|0)+((8191&(m=(m=m+Math.imul($,Mn)|0)+Math.imul(Y,Nt)|0))<<13)|0;L=((p=p+Math.imul(Y,Mn)|0)+(m>>>13)|0)+(xi>>>26)|0,xi&=67108863,g=Math.imul(Ae,Pt),m=(m=Math.imul(Ae,en))+Math.imul(qe,Pt)|0,p=Math.imul(qe,en),g=g+Math.imul(pe,At)|0,m=(m=m+Math.imul(pe,Jt)|0)+Math.imul(ve,At)|0,p=p+Math.imul(ve,Jt)|0,g=g+Math.imul(fe,Bt)|0,m=(m=m+Math.imul(fe,Rn)|0)+Math.imul(De,Bt)|0,p=p+Math.imul(De,Rn)|0,g=g+Math.imul(ne,Ut)|0,m=(m=m+Math.imul(ne,Fn)|0)+Math.imul(ue,Ut)|0,p=p+Math.imul(ue,Fn)|0,g=g+Math.imul(F,Nt)|0,m=(m=m+Math.imul(F,Mn)|0)+Math.imul(K,Nt)|0,p=p+Math.imul(K,Mn)|0;var vi=(L+(g=g+Math.imul($,Ft)|0)|0)+((8191&(m=(m=m+Math.imul($,An)|0)+Math.imul(Y,Ft)|0))<<13)|0;L=((p=p+Math.imul(Y,An)|0)+(m>>>13)|0)+(vi>>>26)|0,vi&=67108863,g=Math.imul(Be,Pt),m=(m=Math.imul(Be,en))+Math.imul(gt,Pt)|0,p=Math.imul(gt,en),g=g+Math.imul(Ae,At)|0,m=(m=m+Math.imul(Ae,Jt)|0)+Math.imul(qe,At)|0,p=p+Math.imul(qe,Jt)|0,g=g+Math.imul(pe,Bt)|0,m=(m=m+Math.imul(pe,Rn)|0)+Math.imul(ve,Bt)|0,p=p+Math.imul(ve,Rn)|0,g=g+Math.imul(fe,Ut)|0,m=(m=m+Math.imul(fe,Fn)|0)+Math.imul(De,Ut)|0,p=p+Math.imul(De,Fn)|0,g=g+Math.imul(ne,Nt)|0,m=(m=m+Math.imul(ne,Mn)|0)+Math.imul(ue,Nt)|0,p=p+Math.imul(ue,Mn)|0,g=g+Math.imul(F,Ft)|0,m=(m=m+Math.imul(F,An)|0)+Math.imul(K,Ft)|0,p=p+Math.imul(K,An)|0;var Vi=(L+(g=g+Math.imul($,Qt)|0)|0)+((8191&(m=(m=m+Math.imul($,Ln)|0)+Math.imul(Y,Qt)|0))<<13)|0;L=((p=p+Math.imul(Y,Ln)|0)+(m>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,g=Math.imul(ot,Pt),m=(m=Math.imul(ot,en))+Math.imul(Wt,Pt)|0,p=Math.imul(Wt,en),g=g+Math.imul(Be,At)|0,m=(m=m+Math.imul(Be,Jt)|0)+Math.imul(gt,At)|0,p=p+Math.imul(gt,Jt)|0,g=g+Math.imul(Ae,Bt)|0,m=(m=m+Math.imul(Ae,Rn)|0)+Math.imul(qe,Bt)|0,p=p+Math.imul(qe,Rn)|0,g=g+Math.imul(pe,Ut)|0,m=(m=m+Math.imul(pe,Fn)|0)+Math.imul(ve,Ut)|0,p=p+Math.imul(ve,Fn)|0,g=g+Math.imul(fe,Nt)|0,m=(m=m+Math.imul(fe,Mn)|0)+Math.imul(De,Nt)|0,p=p+Math.imul(De,Mn)|0,g=g+Math.imul(ne,Ft)|0,m=(m=m+Math.imul(ne,An)|0)+Math.imul(ue,Ft)|0,p=p+Math.imul(ue,An)|0,g=g+Math.imul(F,Qt)|0,m=(m=m+Math.imul(F,Ln)|0)+Math.imul(K,Qt)|0,p=p+Math.imul(K,Ln)|0;var dr=(L+(g=g+Math.imul($,Kt)|0)|0)+((8191&(m=(m=m+Math.imul($,Pn)|0)+Math.imul(Y,Kt)|0))<<13)|0;L=((p=p+Math.imul(Y,Pn)|0)+(m>>>13)|0)+(dr>>>26)|0,dr&=67108863,g=Math.imul(at,Pt),m=(m=Math.imul(at,en))+Math.imul(Rt,Pt)|0,p=Math.imul(Rt,en),g=g+Math.imul(ot,At)|0,m=(m=m+Math.imul(ot,Jt)|0)+Math.imul(Wt,At)|0,p=p+Math.imul(Wt,Jt)|0,g=g+Math.imul(Be,Bt)|0,m=(m=m+Math.imul(Be,Rn)|0)+Math.imul(gt,Bt)|0,p=p+Math.imul(gt,Rn)|0,g=g+Math.imul(Ae,Ut)|0,m=(m=m+Math.imul(Ae,Fn)|0)+Math.imul(qe,Ut)|0,p=p+Math.imul(qe,Fn)|0,g=g+Math.imul(pe,Nt)|0,m=(m=m+Math.imul(pe,Mn)|0)+Math.imul(ve,Nt)|0,p=p+Math.imul(ve,Mn)|0,g=g+Math.imul(fe,Ft)|0,m=(m=m+Math.imul(fe,An)|0)+Math.imul(De,Ft)|0,p=p+Math.imul(De,An)|0,g=g+Math.imul(ne,Qt)|0,m=(m=m+Math.imul(ne,Ln)|0)+Math.imul(ue,Qt)|0,p=p+Math.imul(ue,Ln)|0,g=g+Math.imul(F,Kt)|0,m=(m=m+Math.imul(F,Pn)|0)+Math.imul(K,Kt)|0,p=p+Math.imul(K,Pn)|0;var jn=(L+(g=g+Math.imul($,qt)|0)|0)+((8191&(m=(m=m+Math.imul($,pn)|0)+Math.imul(Y,qt)|0))<<13)|0;L=((p=p+Math.imul(Y,pn)|0)+(m>>>13)|0)+(jn>>>26)|0,jn&=67108863,g=Math.imul(Lt,Pt),m=(m=Math.imul(Lt,en))+Math.imul(rn,Pt)|0,p=Math.imul(rn,en),g=g+Math.imul(at,At)|0,m=(m=m+Math.imul(at,Jt)|0)+Math.imul(Rt,At)|0,p=p+Math.imul(Rt,Jt)|0,g=g+Math.imul(ot,Bt)|0,m=(m=m+Math.imul(ot,Rn)|0)+Math.imul(Wt,Bt)|0,p=p+Math.imul(Wt,Rn)|0,g=g+Math.imul(Be,Ut)|0,m=(m=m+Math.imul(Be,Fn)|0)+Math.imul(gt,Ut)|0,p=p+Math.imul(gt,Fn)|0,g=g+Math.imul(Ae,Nt)|0,m=(m=m+Math.imul(Ae,Mn)|0)+Math.imul(qe,Nt)|0,p=p+Math.imul(qe,Mn)|0,g=g+Math.imul(pe,Ft)|0,m=(m=m+Math.imul(pe,An)|0)+Math.imul(ve,Ft)|0,p=p+Math.imul(ve,An)|0,g=g+Math.imul(fe,Qt)|0,m=(m=m+Math.imul(fe,Ln)|0)+Math.imul(De,Qt)|0,p=p+Math.imul(De,Ln)|0,g=g+Math.imul(ne,Kt)|0,m=(m=m+Math.imul(ne,Pn)|0)+Math.imul(ue,Kt)|0,p=p+Math.imul(ue,Pn)|0,g=g+Math.imul(F,qt)|0,m=(m=m+Math.imul(F,pn)|0)+Math.imul(K,qt)|0,p=p+Math.imul(K,pn)|0;var yi=(L+(g=g+Math.imul($,Yt)|0)|0)+((8191&(m=(m=m+Math.imul($,$n)|0)+Math.imul(Y,Yt)|0))<<13)|0;L=((p=p+Math.imul(Y,$n)|0)+(m>>>13)|0)+(yi>>>26)|0,yi&=67108863,g=Math.imul(Lt,At),m=(m=Math.imul(Lt,Jt))+Math.imul(rn,At)|0,p=Math.imul(rn,Jt),g=g+Math.imul(at,Bt)|0,m=(m=m+Math.imul(at,Rn)|0)+Math.imul(Rt,Bt)|0,p=p+Math.imul(Rt,Rn)|0,g=g+Math.imul(ot,Ut)|0,m=(m=m+Math.imul(ot,Fn)|0)+Math.imul(Wt,Ut)|0,p=p+Math.imul(Wt,Fn)|0,g=g+Math.imul(Be,Nt)|0,m=(m=m+Math.imul(Be,Mn)|0)+Math.imul(gt,Nt)|0,p=p+Math.imul(gt,Mn)|0,g=g+Math.imul(Ae,Ft)|0,m=(m=m+Math.imul(Ae,An)|0)+Math.imul(qe,Ft)|0,p=p+Math.imul(qe,An)|0,g=g+Math.imul(pe,Qt)|0,m=(m=m+Math.imul(pe,Ln)|0)+Math.imul(ve,Qt)|0,p=p+Math.imul(ve,Ln)|0,g=g+Math.imul(fe,Kt)|0,m=(m=m+Math.imul(fe,Pn)|0)+Math.imul(De,Kt)|0,p=p+Math.imul(De,Pn)|0,g=g+Math.imul(ne,qt)|0,m=(m=m+Math.imul(ne,pn)|0)+Math.imul(ue,qt)|0,p=p+Math.imul(ue,pn)|0;var Ui=(L+(g=g+Math.imul(F,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(F,$n)|0)+Math.imul(K,Yt)|0))<<13)|0;L=((p=p+Math.imul(K,$n)|0)+(m>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,g=Math.imul(Lt,Bt),m=(m=Math.imul(Lt,Rn))+Math.imul(rn,Bt)|0,p=Math.imul(rn,Rn),g=g+Math.imul(at,Ut)|0,m=(m=m+Math.imul(at,Fn)|0)+Math.imul(Rt,Ut)|0,p=p+Math.imul(Rt,Fn)|0,g=g+Math.imul(ot,Nt)|0,m=(m=m+Math.imul(ot,Mn)|0)+Math.imul(Wt,Nt)|0,p=p+Math.imul(Wt,Mn)|0,g=g+Math.imul(Be,Ft)|0,m=(m=m+Math.imul(Be,An)|0)+Math.imul(gt,Ft)|0,p=p+Math.imul(gt,An)|0,g=g+Math.imul(Ae,Qt)|0,m=(m=m+Math.imul(Ae,Ln)|0)+Math.imul(qe,Qt)|0,p=p+Math.imul(qe,Ln)|0,g=g+Math.imul(pe,Kt)|0,m=(m=m+Math.imul(pe,Pn)|0)+Math.imul(ve,Kt)|0,p=p+Math.imul(ve,Pn)|0,g=g+Math.imul(fe,qt)|0,m=(m=m+Math.imul(fe,pn)|0)+Math.imul(De,qt)|0,p=p+Math.imul(De,pn)|0;var Ai=(L+(g=g+Math.imul(ne,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(ne,$n)|0)+Math.imul(ue,Yt)|0))<<13)|0;L=((p=p+Math.imul(ue,$n)|0)+(m>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,g=Math.imul(Lt,Ut),m=(m=Math.imul(Lt,Fn))+Math.imul(rn,Ut)|0,p=Math.imul(rn,Fn),g=g+Math.imul(at,Nt)|0,m=(m=m+Math.imul(at,Mn)|0)+Math.imul(Rt,Nt)|0,p=p+Math.imul(Rt,Mn)|0,g=g+Math.imul(ot,Ft)|0,m=(m=m+Math.imul(ot,An)|0)+Math.imul(Wt,Ft)|0,p=p+Math.imul(Wt,An)|0,g=g+Math.imul(Be,Qt)|0,m=(m=m+Math.imul(Be,Ln)|0)+Math.imul(gt,Qt)|0,p=p+Math.imul(gt,Ln)|0,g=g+Math.imul(Ae,Kt)|0,m=(m=m+Math.imul(Ae,Pn)|0)+Math.imul(qe,Kt)|0,p=p+Math.imul(qe,Pn)|0,g=g+Math.imul(pe,qt)|0,m=(m=m+Math.imul(pe,pn)|0)+Math.imul(ve,qt)|0,p=p+Math.imul(ve,pn)|0;var Ki=(L+(g=g+Math.imul(fe,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(fe,$n)|0)+Math.imul(De,Yt)|0))<<13)|0;L=((p=p+Math.imul(De,$n)|0)+(m>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,g=Math.imul(Lt,Nt),m=(m=Math.imul(Lt,Mn))+Math.imul(rn,Nt)|0,p=Math.imul(rn,Mn),g=g+Math.imul(at,Ft)|0,m=(m=m+Math.imul(at,An)|0)+Math.imul(Rt,Ft)|0,p=p+Math.imul(Rt,An)|0,g=g+Math.imul(ot,Qt)|0,m=(m=m+Math.imul(ot,Ln)|0)+Math.imul(Wt,Qt)|0,p=p+Math.imul(Wt,Ln)|0,g=g+Math.imul(Be,Kt)|0,m=(m=m+Math.imul(Be,Pn)|0)+Math.imul(gt,Kt)|0,p=p+Math.imul(gt,Pn)|0,g=g+Math.imul(Ae,qt)|0,m=(m=m+Math.imul(Ae,pn)|0)+Math.imul(qe,qt)|0,p=p+Math.imul(qe,pn)|0;var ri=(L+(g=g+Math.imul(pe,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(pe,$n)|0)+Math.imul(ve,Yt)|0))<<13)|0;L=((p=p+Math.imul(ve,$n)|0)+(m>>>13)|0)+(ri>>>26)|0,ri&=67108863,g=Math.imul(Lt,Ft),m=(m=Math.imul(Lt,An))+Math.imul(rn,Ft)|0,p=Math.imul(rn,An),g=g+Math.imul(at,Qt)|0,m=(m=m+Math.imul(at,Ln)|0)+Math.imul(Rt,Qt)|0,p=p+Math.imul(Rt,Ln)|0,g=g+Math.imul(ot,Kt)|0,m=(m=m+Math.imul(ot,Pn)|0)+Math.imul(Wt,Kt)|0,p=p+Math.imul(Wt,Pn)|0,g=g+Math.imul(Be,qt)|0,m=(m=m+Math.imul(Be,pn)|0)+Math.imul(gt,qt)|0,p=p+Math.imul(gt,pn)|0;var ii=(L+(g=g+Math.imul(Ae,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(Ae,$n)|0)+Math.imul(qe,Yt)|0))<<13)|0;L=((p=p+Math.imul(qe,$n)|0)+(m>>>13)|0)+(ii>>>26)|0,ii&=67108863,g=Math.imul(Lt,Qt),m=(m=Math.imul(Lt,Ln))+Math.imul(rn,Qt)|0,p=Math.imul(rn,Ln),g=g+Math.imul(at,Kt)|0,m=(m=m+Math.imul(at,Pn)|0)+Math.imul(Rt,Kt)|0,p=p+Math.imul(Rt,Pn)|0,g=g+Math.imul(ot,qt)|0,m=(m=m+Math.imul(ot,pn)|0)+Math.imul(Wt,qt)|0,p=p+Math.imul(Wt,pn)|0;var kr=(L+(g=g+Math.imul(Be,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(Be,$n)|0)+Math.imul(gt,Yt)|0))<<13)|0;L=((p=p+Math.imul(gt,$n)|0)+(m>>>13)|0)+(kr>>>26)|0,kr&=67108863,g=Math.imul(Lt,Kt),m=(m=Math.imul(Lt,Pn))+Math.imul(rn,Kt)|0,p=Math.imul(rn,Pn),g=g+Math.imul(at,qt)|0,m=(m=m+Math.imul(at,pn)|0)+Math.imul(Rt,qt)|0,p=p+Math.imul(Rt,pn)|0;var qr=(L+(g=g+Math.imul(ot,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(ot,$n)|0)+Math.imul(Wt,Yt)|0))<<13)|0;L=((p=p+Math.imul(Wt,$n)|0)+(m>>>13)|0)+(qr>>>26)|0,qr&=67108863,g=Math.imul(Lt,qt),m=(m=Math.imul(Lt,pn))+Math.imul(rn,qt)|0,p=Math.imul(rn,pn);var Ti=(L+(g=g+Math.imul(at,Yt)|0)|0)+((8191&(m=(m=m+Math.imul(at,$n)|0)+Math.imul(Rt,Yt)|0))<<13)|0;L=((p=p+Math.imul(Rt,$n)|0)+(m>>>13)|0)+(Ti>>>26)|0,Ti&=67108863;var Oi=(L+(g=Math.imul(Lt,Yt))|0)+((8191&(m=(m=Math.imul(Lt,$n))+Math.imul(rn,Yt)|0))<<13)|0;return L=((p=Math.imul(rn,$n))+(m>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,T[0]=Cn,T[1]=On,T[2]=Fi,T[3]=ji,T[4]=xi,T[5]=vi,T[6]=Vi,T[7]=dr,T[8]=jn,T[9]=yi,T[10]=Ui,T[11]=Ai,T[12]=Ki,T[13]=ri,T[14]=ii,T[15]=kr,T[16]=qr,T[17]=Ti,T[18]=Oi,L!==0&&(T[19]=L,d.length++),d};function ee(S,P,d){return new te().mulp(S,P,d)}function te(S,P){this.x=S,this.y=P}Math.imul||(H=z),i.prototype.mulTo=function(S,P){var d,g=this.length+S.length;return d=this.length===10&&S.length===10?H(this,S,P):g<63?z(this,S,P):g<1024?function(m,p,f){f.negative=p.negative^m.negative,f.length=m.length+p.length;for(var _=0,T=0,L=0;L>>26)|0)>>>26,B&=67108863}f.words[L]=$,_=B,B=T}return _!==0?f.words[L]=_:f.length--,f.strip()}(this,S,P):ee(this,S,P),d},te.prototype.makeRBT=function(S){for(var P=new Array(S),d=i.prototype._countBits(S)-1,g=0;g>=1;return g},te.prototype.permute=function(S,P,d,g,m,p){for(var f=0;f>>=1)m++;return 1<>>=13,d[2*p+1]=8191&m,m>>>=13;for(p=2*P;p>=26,P+=g/67108864|0,P+=m>>>26,this.words[d]=67108863&m}return P!==0&&(this.words[d]=P,this.length++),this},i.prototype.muln=function(S){return this.clone().imuln(S)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(S){var P=function(p){for(var f=new Array(p.bitLength()),_=0;_>>L}return f}(S);if(P.length===0)return new i(1);for(var d=this,g=0;g=0);var P,d=S%26,g=(S-d)/26,m=67108863>>>26-d<<26-d;if(d!==0){var p=0;for(P=0;P>>26-d}p&&(this.words[P]=p,this.length++)}if(g!==0){for(P=this.length-1;P>=0;P--)this.words[P+g]=this.words[P];for(P=0;P=0),g=P?(P-P%26)/26:0;var m=S%26,p=Math.min((S-m)/26,this.length),f=67108863^67108863>>>m<p)for(this.length-=p,T=0;T=0&&(L!==0||T>=g);T--){var B=0|this.words[T];this.words[T]=L<<26-m|B>>>m,L=B&f}return _&&L!==0&&(_.words[_.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(S,P,d){return r(this.negative===0),this.iushrn(S,P,d)},i.prototype.shln=function(S){return this.clone().ishln(S)},i.prototype.ushln=function(S){return this.clone().iushln(S)},i.prototype.shrn=function(S){return this.clone().ishrn(S)},i.prototype.ushrn=function(S){return this.clone().iushrn(S)},i.prototype.testn=function(S){r(typeof S=="number"&&S>=0);var P=S%26,d=(S-P)/26,g=1<=0);var P=S%26,d=(S-P)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(P!==0&&d++,this.length=Math.min(d,this.length),P!==0){var g=67108863^67108863>>>P<=67108864;P++)this.words[P]-=67108864,P===this.length-1?this.words[P+1]=1:this.words[P+1]++;return this.length=Math.max(this.length,P+1),this},i.prototype.isubn=function(S){if(r(typeof S=="number"),r(S<67108864),S<0)return this.iaddn(-S);if(this.negative!==0)return this.negative=0,this.iaddn(S),this.negative=1,this;if(this.words[0]-=S,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var P=0;P>26)-(_/67108864|0),this.words[g+d]=67108863&m}for(;g>26,this.words[g+d]=67108863&m;if(f===0)return this.strip();for(r(f===-1),f=0,g=0;g>26,this.words[g]=67108863&m;return this.negative=1,this.strip()},i.prototype._wordDiv=function(S,P){var d=(this.length,S.length),g=this.clone(),m=S,p=0|m.words[m.length-1];(d=26-this._countBits(p))!=0&&(m=m.ushln(d),g.iushln(d),p=0|m.words[m.length-1]);var f,_=g.length-m.length;if(P!=="mod"){(f=new i(null)).length=_+1,f.words=new Array(f.length);for(var T=0;T=0;B--){var $=67108864*(0|g.words[m.length+B])+(0|g.words[m.length+B-1]);for($=Math.min($/p|0,67108863),g._ishlnsubmul(m,$,B);g.negative!==0;)$--,g.negative=0,g._ishlnsubmul(m,1,B),g.isZero()||(g.negative^=1);f&&(f.words[B]=$)}return f&&f.strip(),g.strip(),P!=="div"&&d!==0&&g.iushrn(d),{div:f||null,mod:g}},i.prototype.divmod=function(S,P,d){return r(!S.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:this.negative!==0&&S.negative===0?(p=this.neg().divmod(S,P),P!=="mod"&&(g=p.div.neg()),P!=="div"&&(m=p.mod.neg(),d&&m.negative!==0&&m.iadd(S)),{div:g,mod:m}):this.negative===0&&S.negative!==0?(p=this.divmod(S.neg(),P),P!=="mod"&&(g=p.div.neg()),{div:g,mod:p.mod}):this.negative&S.negative?(p=this.neg().divmod(S.neg(),P),P!=="div"&&(m=p.mod.neg(),d&&m.negative!==0&&m.isub(S)),{div:p.div,mod:m}):S.length>this.length||this.cmp(S)<0?{div:new i(0),mod:this}:S.length===1?P==="div"?{div:this.divn(S.words[0]),mod:null}:P==="mod"?{div:null,mod:new i(this.modn(S.words[0]))}:{div:this.divn(S.words[0]),mod:new i(this.modn(S.words[0]))}:this._wordDiv(S,P);var g,m,p},i.prototype.div=function(S){return this.divmod(S,"div",!1).div},i.prototype.mod=function(S){return this.divmod(S,"mod",!1).mod},i.prototype.umod=function(S){return this.divmod(S,"mod",!0).mod},i.prototype.divRound=function(S){var P=this.divmod(S);if(P.mod.isZero())return P.div;var d=P.div.negative!==0?P.mod.isub(S):P.mod,g=S.ushrn(1),m=S.andln(1),p=d.cmp(g);return p<0||m===1&&p===0?P.div:P.div.negative!==0?P.div.isubn(1):P.div.iaddn(1)},i.prototype.modn=function(S){r(S<=67108863);for(var P=(1<<26)%S,d=0,g=this.length-1;g>=0;g--)d=(P*d+(0|this.words[g]))%S;return d},i.prototype.idivn=function(S){r(S<=67108863);for(var P=0,d=this.length-1;d>=0;d--){var g=(0|this.words[d])+67108864*P;this.words[d]=g/S|0,P=g%S}return this.strip()},i.prototype.divn=function(S){return this.clone().idivn(S)},i.prototype.egcd=function(S){r(S.negative===0),r(!S.isZero());var P=this,d=S.clone();P=P.negative!==0?P.umod(S):P.clone();for(var g=new i(1),m=new i(0),p=new i(0),f=new i(1),_=0;P.isEven()&&d.isEven();)P.iushrn(1),d.iushrn(1),++_;for(var T=d.clone(),L=P.clone();!P.isZero();){for(var B=0,$=1;!(P.words[0]&$)&&B<26;++B,$<<=1);if(B>0)for(P.iushrn(B);B-- >0;)(g.isOdd()||m.isOdd())&&(g.iadd(T),m.isub(L)),g.iushrn(1),m.iushrn(1);for(var Y=0,q=1;!(d.words[0]&q)&&Y<26;++Y,q<<=1);if(Y>0)for(d.iushrn(Y);Y-- >0;)(p.isOdd()||f.isOdd())&&(p.iadd(T),f.isub(L)),p.iushrn(1),f.iushrn(1);P.cmp(d)>=0?(P.isub(d),g.isub(p),m.isub(f)):(d.isub(P),p.isub(g),f.isub(m))}return{a:p,b:f,gcd:d.iushln(_)}},i.prototype._invmp=function(S){r(S.negative===0),r(!S.isZero());var P=this,d=S.clone();P=P.negative!==0?P.umod(S):P.clone();for(var g,m=new i(1),p=new i(0),f=d.clone();P.cmpn(1)>0&&d.cmpn(1)>0;){for(var _=0,T=1;!(P.words[0]&T)&&_<26;++_,T<<=1);if(_>0)for(P.iushrn(_);_-- >0;)m.isOdd()&&m.iadd(f),m.iushrn(1);for(var L=0,B=1;!(d.words[0]&B)&&L<26;++L,B<<=1);if(L>0)for(d.iushrn(L);L-- >0;)p.isOdd()&&p.iadd(f),p.iushrn(1);P.cmp(d)>=0?(P.isub(d),m.isub(p)):(d.isub(P),p.isub(m))}return(g=P.cmpn(1)===0?m:p).cmpn(0)<0&&g.iadd(S),g},i.prototype.gcd=function(S){if(this.isZero())return S.abs();if(S.isZero())return this.abs();var P=this.clone(),d=S.clone();P.negative=0,d.negative=0;for(var g=0;P.isEven()&&d.isEven();g++)P.iushrn(1),d.iushrn(1);for(;;){for(;P.isEven();)P.iushrn(1);for(;d.isEven();)d.iushrn(1);var m=P.cmp(d);if(m<0){var p=P;P=d,d=p}else if(m===0||d.cmpn(1)===0)break;P.isub(d)}return d.iushln(g)},i.prototype.invm=function(S){return this.egcd(S).a.umod(S)},i.prototype.isEven=function(){return(1&this.words[0])==0},i.prototype.isOdd=function(){return(1&this.words[0])==1},i.prototype.andln=function(S){return this.words[0]&S},i.prototype.bincn=function(S){r(typeof S=="number");var P=S%26,d=(S-P)/26,g=1<>>26,f&=67108863,this.words[p]=f}return m!==0&&(this.words[p]=m,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(S){var P,d=S<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;if(this.strip(),this.length>1)P=1;else{d&&(S=-S),r(S<=67108863,"Number is too big");var g=0|this.words[0];P=g===S?0:gS.length)return 1;if(this.length=0;d--){var g=0|this.words[d],m=0|S.words[d];if(g!==m){gm&&(P=1);break}}return P},i.prototype.gtn=function(S){return this.cmpn(S)===1},i.prototype.gt=function(S){return this.cmp(S)===1},i.prototype.gten=function(S){return this.cmpn(S)>=0},i.prototype.gte=function(S){return this.cmp(S)>=0},i.prototype.ltn=function(S){return this.cmpn(S)===-1},i.prototype.lt=function(S){return this.cmp(S)===-1},i.prototype.lten=function(S){return this.cmpn(S)<=0},i.prototype.lte=function(S){return this.cmp(S)<=0},i.prototype.eqn=function(S){return this.cmpn(S)===0},i.prototype.eq=function(S){return this.cmp(S)===0},i.red=function(S){return new Fe(S)},i.prototype.toRed=function(S){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),S.convertTo(this)._forceRed(S)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(S){return this.red=S,this},i.prototype.forceRed=function(S){return r(!this.red,"Already a number in reduction context"),this._forceRed(S)},i.prototype.redAdd=function(S){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,S)},i.prototype.redIAdd=function(S){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,S)},i.prototype.redSub=function(S){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,S)},i.prototype.redISub=function(S){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,S)},i.prototype.redShl=function(S){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,S)},i.prototype.redMul=function(S){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.mul(this,S)},i.prototype.redIMul=function(S){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,S),this.red.imul(this,S)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(S){return r(this.red&&!S.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,S)};var se={k256:null,p224:null,p192:null,p25519:null};function oe(S,P){this.name=S,this.p=new i(P,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function Ee(){oe.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function we(){oe.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Ce(){oe.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function ze(){oe.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Fe(S){if(typeof S=="string"){var P=i._prime(S);this.m=P.p,this.prime=P}else r(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}function $e(S){Fe.call(this,S),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}oe.prototype._tmp=function(){var S=new i(null);return S.words=new Array(Math.ceil(this.n/13)),S},oe.prototype.ireduce=function(S){var P,d=S;do this.split(d,this.tmp),P=(d=(d=this.imulK(d)).iadd(this.tmp)).bitLength();while(P>this.n);var g=P0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},oe.prototype.split=function(S,P){S.iushrn(this.n,0,P)},oe.prototype.imulK=function(S){return S.imul(this.k)},a(Ee,oe),Ee.prototype.split=function(S,P){for(var d=4194303,g=Math.min(S.length,9),m=0;m>>22,p=f}p>>>=22,S.words[m-10]=p,p===0&&S.length>10?S.length-=10:S.length-=9},Ee.prototype.imulK=function(S){S.words[S.length]=0,S.words[S.length+1]=0,S.length+=2;for(var P=0,d=0;d>>=26,S.words[d]=m,P=g}return P!==0&&(S.words[S.length++]=P),S},i._prime=function(S){if(se[S])return se[S];var P;if(S==="k256")P=new Ee;else if(S==="p224")P=new we;else if(S==="p192")P=new Ce;else{if(S!=="p25519")throw new Error("Unknown prime "+S);P=new ze}return se[S]=P,P},Fe.prototype._verify1=function(S){r(S.negative===0,"red works only with positives"),r(S.red,"red works only with red numbers")},Fe.prototype._verify2=function(S,P){r((S.negative|P.negative)==0,"red works only with positives"),r(S.red&&S.red===P.red,"red works only with red numbers")},Fe.prototype.imod=function(S){return this.prime?this.prime.ireduce(S)._forceRed(this):S.umod(this.m)._forceRed(this)},Fe.prototype.neg=function(S){return S.isZero()?S.clone():this.m.sub(S)._forceRed(this)},Fe.prototype.add=function(S,P){this._verify2(S,P);var d=S.add(P);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},Fe.prototype.iadd=function(S,P){this._verify2(S,P);var d=S.iadd(P);return d.cmp(this.m)>=0&&d.isub(this.m),d},Fe.prototype.sub=function(S,P){this._verify2(S,P);var d=S.sub(P);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},Fe.prototype.isub=function(S,P){this._verify2(S,P);var d=S.isub(P);return d.cmpn(0)<0&&d.iadd(this.m),d},Fe.prototype.shl=function(S,P){return this._verify1(S),this.imod(S.ushln(P))},Fe.prototype.imul=function(S,P){return this._verify2(S,P),this.imod(S.imul(P))},Fe.prototype.mul=function(S,P){return this._verify2(S,P),this.imod(S.mul(P))},Fe.prototype.isqr=function(S){return this.imul(S,S.clone())},Fe.prototype.sqr=function(S){return this.mul(S,S)},Fe.prototype.sqrt=function(S){if(S.isZero())return S.clone();var P=this.m.andln(3);if(r(P%2==1),P===3){var d=this.m.add(new i(1)).iushrn(2);return this.pow(S,d)}for(var g=this.m.subn(1),m=0;!g.isZero()&&g.andln(1)===0;)m++,g.iushrn(1);r(!g.isZero());var p=new i(1).toRed(this),f=p.redNeg(),_=this.m.subn(1).iushrn(1),T=this.m.bitLength();for(T=new i(2*T*T).toRed(this);this.pow(T,_).cmp(f)!==0;)T.redIAdd(f);for(var L=this.pow(T,g),B=this.pow(S,g.addn(1).iushrn(1)),$=this.pow(S,g),Y=m;$.cmp(p)!==0;){for(var q=$,F=0;q.cmp(p)!==0;F++)q=q.redSqr();r(F=0;g--){for(var T=P.words[g],L=_-1;L>=0;L--){var B=T>>L&1;m!==d[0]&&(m=this.sqr(m)),B!==0||p!==0?(p<<=1,p|=B,(++f==4||g===0&&L===0)&&(m=this.mul(m,d[p]),f=0,p=0)):f=0}_=26}return m},Fe.prototype.convertTo=function(S){var P=S.umod(this.m);return P===S?P.clone():P},Fe.prototype.convertFrom=function(S){var P=S.clone();return P.red=null,P},i.mont=function(S){return new $e(S)},a($e,Fe),$e.prototype.convertTo=function(S){return this.imod(S.ushln(this.shift))},$e.prototype.convertFrom=function(S){var P=this.imod(S.mul(this.rinv));return P.red=null,P},$e.prototype.imul=function(S,P){if(S.isZero()||P.isZero())return S.words[0]=0,S.length=1,S;var d=S.imul(P),g=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(g).iushrn(this.shift),p=m;return m.cmp(this.m)>=0?p=m.isub(this.m):m.cmpn(0)<0&&(p=m.iadd(this.m)),p._forceRed(this)},$e.prototype.mul=function(S,P){if(S.isZero()||P.isZero())return new i(0)._forceRed(this);var d=S.mul(P),g=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=d.isub(g).iushrn(this.shift),p=m;return m.cmp(this.m)>=0?p=m.isub(this.m):m.cmpn(0)<0&&(p=m.iadd(this.m)),p._forceRed(this)},$e.prototype.invm=function(S){return this.imod(S._invmp(this.m).mul(this.r2))._forceRed(this)}})(e,b)})(VL);var vd=VL.exports,Qp=YL;function YL(e,t){if(!e)throw new Error(t||"Assertion failed")}YL.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var e5={};(function(e){var t=e;function n(a){return a.length===1?"0"+a:a}function r(a){for(var i="",h=0;h>8,M=255&k;E?h.push(E,M):h.push(M)}return h},t.zero2=n,t.toHex=r,t.encode=function(a,i){return i==="hex"?r(a):a}})(e5),function(e){var t=e,n=vd,r=Qp,a=e5;t.assert=r,t.toArray=a.toArray,t.zero2=a.zero2,t.toHex=a.toHex,t.encode=a.encode,t.getNAF=function(i,h,y){var k=new Array(Math.max(i.bitLength(),y)+1);k.fill(0);for(var E=1<(E>>1)-1?(E>>1)-z:z,M.isubn(O)):O=0,k[C]=O,M.iushrn(1)}return k},t.getJSF=function(i,h){var y=[[],[]];i=i.clone(),h=h.clone();for(var k,E=0,M=0;i.cmpn(-E)>0||h.cmpn(-M)>0;){var C,O,z=i.andln(3)+E&3,H=h.andln(3)+M&3;z===3&&(z=-1),H===3&&(H=-1),C=1&z?(k=i.andln(7)+E&7)!=3&&k!==5||H!==2?z:-z:0,y[0].push(C),O=1&H?(k=h.andln(7)+M&7)!=3&&k!==5||z!==2?H:-H:0,y[1].push(O),2*E===C+1&&(E=1-E),2*M===O+1&&(M=1-M),i.iushrn(1),h.iushrn(1)}return y},t.cachedProperty=function(i,h,y){var k="_"+h;i.prototype[h]=function(){return this[k]!==void 0?this[k]:this[k]=y.call(this)}},t.parseBytes=function(i){return typeof i=="string"?t.toArray(i,"hex"):i},t.intFromLE=function(i){return new n(i,"hex","le")}}(uu);var t5,n5={exports:{}};function Kh(e){this.rand=e}if(n5.exports=function(e){return t5||(t5=new Kh(null)),t5.generate(e)},n5.exports.Rand=Kh,Kh.prototype.generate=function(e){return this._rand(e)},Kh.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Lw=Hh;function Yu(e,t){this.curve=e,this.type=t,this.precomputed=null}Hh.prototype.point=function(){throw new Error("Not implemented")},Hh.prototype.validate=function(){throw new Error("Not implemented")},Hh.prototype._fixedNafMul=function(e,t){Iw(e.precomputed);var n=e._getDoubles(),r=Pw(t,1,this._bitLength),a=(1<=i;k--)h=(h<<1)+r[k];y.push(h)}for(var E=this.jpoint(null,null,null),M=this.jpoint(null,null,null),C=a;C>0;C--){for(i=0;i=0;y--){for(var k=0;y>=0&&i[y]===0;y--)k++;if(y>=0&&k++,h=h.dblp(k),y<0)break;var E=i[y];Iw(E!==0),h=e.type==="affine"?E>0?h.mixedAdd(a[E-1>>1]):h.mixedAdd(a[-E-1>>1].neg()):E>0?h.add(a[E-1>>1]):h.add(a[-E-1>>1].neg())}return e.type==="affine"?h.toP():h},Hh.prototype._wnafMulAdd=function(e,t,n,r,a){var i,h,y,k=this._wnafT1,E=this._wnafT2,M=this._wnafT3,C=0;for(i=0;i=1;i-=2){var z=i-1,H=i;if(k[z]===1&&k[H]===1){var ee=[t[z],null,null,t[H]];t[z].y.cmp(t[H].y)===0?(ee[1]=t[z].add(t[H]),ee[2]=t[z].toJ().mixedAdd(t[H].neg())):t[z].y.cmp(t[H].y.redNeg())===0?(ee[1]=t[z].toJ().mixedAdd(t[H]),ee[2]=t[z].add(t[H].neg())):(ee[1]=t[z].toJ().mixedAdd(t[H]),ee[2]=t[z].toJ().mixedAdd(t[H].neg()));var te=[-3,-1,-5,-7,0,7,5,1,3],se=XG(n[z],n[H]);for(C=Math.max(se[0].length,C),M[z]=new Array(C),M[H]=new Array(C),h=0;h=0;i--){for(var ze=0;i>=0;){var Fe=!0;for(h=0;h=0&&ze++,we=we.dblp(ze),i<0)break;for(h=0;h0?y=E[h][$e-1>>1]:$e<0&&(y=E[h][-$e-1>>1].neg()),we=y.type==="affine"?we.mixedAdd(y):we.add(y))}}for(i=0;i=Math.ceil((e.bitLength()+1)/t.step)},Yu.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,a=0;a=0&&(i=t,h=n),r.negative&&(r=r.neg(),a=a.neg()),i.negative&&(i=i.neg(),h=h.neg()),[{a:r,b:a},{a:i,b:h}]},Gu.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],a=r.b.mul(e).divRound(this.n),i=n.b.neg().mul(e).divRound(this.n),h=a.mul(n.a),y=i.mul(r.a),k=a.mul(n.b),E=i.mul(r.b);return{k1:e.sub(h).sub(y),k2:k.add(E).neg()}},Gu.prototype.pointFromX=function(e,t){(e=new io(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(r.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var a=r.fromRed().isOdd();return(t&&!a||!t&&a)&&(r=r.redNeg()),this.point(e,r)},Gu.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),a=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return n.redSqr().redISub(a).cmpn(0)===0},Gu.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,a=this._endoWnafT2,i=0;i":""},qo.prototype.isInfinity=function(){return this.inf},qo.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},qo.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),a=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),i=a.redSqr().redISub(this.x.redAdd(this.x)),h=a.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,h)},qo.prototype.getX=function(){return this.x.fromRed()},qo.prototype.getY=function(){return this.y.fromRed()},qo.prototype.mul=function(e){return e=new io(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)},qo.prototype.mulAdd=function(e,t,n){var r=[this,t],a=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,a):this.curve._wnafMulAdd(1,r,a,2)},qo.prototype.jmulAdd=function(e,t,n){var r=[this,t],a=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,a,!0):this.curve._wnafMulAdd(1,r,a,2,!0)},qo.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)},qo.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(a){return a.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},qo.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o5(sa,h2.BasePoint),Gu.prototype.jpoint=function(e,t,n){return new sa(this,e,t,n)},sa.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},sa.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},sa.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),a=e.x.redMul(n),i=this.y.redMul(t.redMul(e.z)),h=e.y.redMul(n.redMul(this.z)),y=r.redSub(a),k=i.redSub(h);if(y.cmpn(0)===0)return k.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var E=y.redSqr(),M=E.redMul(y),C=r.redMul(E),O=k.redSqr().redIAdd(M).redISub(C).redISub(C),z=k.redMul(C.redISub(O)).redISub(i.redMul(M)),H=this.z.redMul(e.z).redMul(y);return this.curve.jpoint(O,z,H)},sa.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),a=this.y,i=e.y.redMul(t).redMul(this.z),h=n.redSub(r),y=a.redSub(i);if(h.cmpn(0)===0)return y.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var k=h.redSqr(),E=k.redMul(h),M=n.redMul(k),C=y.redSqr().redIAdd(E).redISub(M).redISub(M),O=y.redMul(M.redISub(C)).redISub(a.redMul(E)),z=this.z.redMul(h);return this.curve.jpoint(C,O,z)},sa.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t=0)return!1;if(n.redIAdd(a),this.x.cmp(n)===0)return!0}},sa.prototype.inspect=function(){return this.isInfinity()?"":""},sa.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var p2=vd,QL=Ow,Nw=Lw,tZ=uu;function m2(e){Nw.call(this,"mont",e),this.a=new p2(e.a,16).toRed(this.red),this.b=new p2(e.b,16).toRed(this.red),this.i4=new p2(4).toRed(this.red).redInvm(),this.two=new p2(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}QL(m2,Nw);var nZ=m2;function Wo(e,t,n){Nw.BasePoint.call(this,e,"projective"),t===null&&n===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new p2(t,16),this.z=new p2(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}m2.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return r.redSqrt().redSqr().cmp(r)===0},QL(Wo,Nw.BasePoint),m2.prototype.decodePoint=function(e,t){return this.point(tZ.toArray(e,t),1)},m2.prototype.point=function(e,t){return new Wo(this,e,t)},m2.prototype.pointFromJSON=function(e){return Wo.fromJSON(this,e)},Wo.prototype.precompute=function(){},Wo.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Wo.fromJSON=function(e,t){return new Wo(e,t[0],t[1]||e.one)},Wo.prototype.inspect=function(){return this.isInfinity()?"":""},Wo.prototype.isInfinity=function(){return this.z.cmpn(0)===0},Wo.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),a=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,a)},Wo.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Wo.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),a=e.x.redAdd(e.z),i=e.x.redSub(e.z).redMul(n),h=a.redMul(r),y=t.z.redMul(i.redAdd(h).redSqr()),k=t.x.redMul(i.redISub(h).redSqr());return this.curve.point(y,k)},Wo.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var i=a.length-1;i>=0;i--)a[i]===0?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},Wo.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Wo.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Wo.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},Wo.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Wo.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var yd=vd,XL=Ow,Dw=Lw,rZ=uu.assert;function of(e){this.twisted=(0|e.a)!=1,this.mOneA=this.twisted&&(0|e.a)==-1,this.extended=this.mOneA,Dw.call(this,"edwards",e),this.a=new yd(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new yd(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new yd(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),rZ(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(0|e.c)==1}XL(of,Dw);var iZ=of;function Ci(e,t,n,r,a){Dw.BasePoint.call(this,e,"projective"),t===null&&n===null&&r===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 yd(t,16),this.y=new yd(n,16),this.z=r?new yd(r,16):this.curve.one,this.t=a&&new yd(a,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()))))}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,t,n,r){return this.point(e,t,n,r)},of.prototype.pointFromX=function(e,t){(e=new yd(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=this.c2.redSub(this.a.redMul(n)),a=this.one.redSub(this.c2.redMul(this.d).redMul(n)),i=r.redMul(a.redInvm()),h=i.redSqrt();if(h.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var y=h.fromRed().isOdd();return(t&&!y||!t&&y)&&(h=h.redNeg()),this.point(e,h)},of.prototype.pointFromY=function(e,t){(e=new yd(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr(),r=n.redSub(this.c2),a=n.redMul(this.d).redMul(this.c2).redSub(this.a),i=r.redMul(a.redInvm());if(i.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var h=i.redSqrt();if(h.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==t&&(h=h.redNeg()),this.point(h,e)},of.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),a=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return r.cmp(a)===0},XL(Ci,Dw.BasePoint),of.prototype.pointFromJSON=function(e){return Ci.fromJSON(this,e)},of.prototype.point=function(e,t,n,r){return new Ci(this,e,t,n,r)},Ci.fromJSON=function(e,t){return new Ci(e,t[0],t[1],t[2])},Ci.prototype.inspect=function(){return this.isInfinity()?"":""},Ci.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Ci.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),a=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),i=r.redAdd(t),h=i.redSub(n),y=r.redSub(t),k=a.redMul(h),E=i.redMul(y),M=a.redMul(y),C=h.redMul(i);return this.curve.point(k,E,C,M)},Ci.prototype._projDbl=function(){var e,t,n,r,a,i,h=this.x.redAdd(this.y).redSqr(),y=this.x.redSqr(),k=this.y.redSqr();if(this.curve.twisted){var E=(r=this.curve._mulA(y)).redAdd(k);this.zOne?(e=h.redSub(y).redSub(k).redMul(E.redSub(this.curve.two)),t=E.redMul(r.redSub(k)),n=E.redSqr().redSub(E).redSub(E)):(a=this.z.redSqr(),i=E.redSub(a).redISub(a),e=h.redSub(y).redISub(k).redMul(i),t=E.redMul(r.redSub(k)),n=E.redMul(i))}else r=y.redAdd(k),a=this.curve._mulC(this.z).redSqr(),i=r.redSub(a).redSub(a),e=this.curve._mulC(h.redISub(r)).redMul(i),t=this.curve._mulC(r).redMul(y.redISub(k)),n=r.redMul(i);return this.curve.point(e,t,n)},Ci.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Ci.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),a=this.z.redMul(e.z.redAdd(e.z)),i=n.redSub(t),h=a.redSub(r),y=a.redAdd(r),k=n.redAdd(t),E=i.redMul(h),M=y.redMul(k),C=i.redMul(k),O=h.redMul(y);return this.curve.point(E,M,O,C)},Ci.prototype._projAdd=function(e){var t,n,r=this.z.redMul(e.z),a=r.redSqr(),i=this.x.redMul(e.x),h=this.y.redMul(e.y),y=this.curve.d.redMul(i).redMul(h),k=a.redSub(y),E=a.redAdd(y),M=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(h),C=r.redMul(k).redMul(M);return this.curve.twisted?(t=r.redMul(E).redMul(h.redSub(this.curve._mulA(i))),n=k.redMul(E)):(t=r.redMul(E).redMul(h.redSub(i)),n=this.curve._mulC(k).redMul(E)),this.curve.point(C,t,n)},Ci.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Ci.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Ci.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},Ci.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},Ci.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},Ci.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Ci.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Ci.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Ci.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},Ci.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),this.x.cmp(t)===0)return!0}},Ci.prototype.toP=Ci.prototype.normalize,Ci.prototype.mixedAdd=Ci.prototype.add,function(e){var t=e;t.base=Lw,t.short=eZ,t.mont=nZ,t.edwards=iZ}(r5);var Bw={},zw={},Tr={},oZ=Qp,aZ=Ow;function sZ(e,t){return(64512&e.charCodeAt(t))==55296&&!(t<0||t+1>=e.length)&&(64512&e.charCodeAt(t+1))==56320}function JL(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function eO(e){return e.length===1?"0"+e:e}function tO(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}Tr.inherits=aZ,Tr.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if(typeof e=="string")if(t){if(t==="hex")for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),a=0;a>6|192,n[r++]=63&i|128):sZ(e,a)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++a)),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=63&i|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=63&i|128)}else for(a=0;a>>0}return i},Tr.split32=function(e,t){for(var n=new Array(4*e.length),r=0,a=0;r>>24,n[a+1]=i>>>16&255,n[a+2]=i>>>8&255,n[a+3]=255&i):(n[a+3]=i>>>24,n[a+2]=i>>>16&255,n[a+1]=i>>>8&255,n[a]=255&i)}return n},Tr.rotr32=function(e,t){return e>>>t|e<<32-t},Tr.rotl32=function(e,t){return e<>>32-t},Tr.sum32=function(e,t){return e+t>>>0},Tr.sum32_3=function(e,t,n){return e+t+n>>>0},Tr.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},Tr.sum32_5=function(e,t,n,r,a){return e+t+n+r+a>>>0},Tr.sum64=function(e,t,n,r){var a=e[t],i=r+e[t+1]>>>0,h=(i>>0,e[t+1]=i},Tr.sum64_hi=function(e,t,n,r){return(t+r>>>0>>0},Tr.sum64_lo=function(e,t,n,r){return t+r>>>0},Tr.sum64_4_hi=function(e,t,n,r,a,i,h,y){var k=0,E=t;return k+=(E=E+r>>>0)>>0)>>0)>>0},Tr.sum64_4_lo=function(e,t,n,r,a,i,h,y){return t+r+i+y>>>0},Tr.sum64_5_hi=function(e,t,n,r,a,i,h,y,k,E){var M=0,C=t;return M+=(C=C+r>>>0)>>0)>>0)>>0)>>0},Tr.sum64_5_lo=function(e,t,n,r,a,i,h,y,k,E){return t+r+i+y+E>>>0},Tr.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},Tr.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},Tr.shr64_hi=function(e,t,n){return e>>>n},Tr.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var g2={},nO=Tr,uZ=Qp;function Fw(){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}g2.BlockHash=Fw,Fw.prototype.update=function(e,t){if(e=nO.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=nO.join32(e,0,e.length-n,this.endian);for(var r=0;r>>24&255,r[a++]=e>>>16&255,r[a++]=e>>>8&255,r[a++]=255&e}else for(r[a++]=255&e,r[a++]=e>>>8&255,r[a++]=e>>>16&255,r[a++]=e>>>24&255,r[a++]=0,r[a++]=0,r[a++]=0,r[a++]=0,i=8;i>>3},af.g1_256=function(e){return sf(e,17)^sf(e,19)^e>>>10};var y2=Tr,lZ=g2,cZ=af,a5=y2.rotl32,My=y2.sum32,fZ=y2.sum32_5,dZ=cZ.ft_1,aO=lZ.BlockHash,hZ=[1518500249,1859775393,2400959708,3395469782];function uf(){if(!(this instanceof uf))return new uf;aO.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}y2.inherits(uf,aO);var pZ=uf;uf.blockSize=512,uf.outSize=160,uf.hmacStrength=80,uf.padLength=64,uf.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;rthis.blockSize&&(e=new this.Hash().update(e).digest()),tQ(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var iQ=qh;qh.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},qh.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(r=n,n=t,t=null),n&&(n=e1.toArray(n,r||"hex"),this._update(n));for(var a=[];a.length"};var Uw=vd,d5=uu,sQ=d5.assert;function Kw(e,t){if(e instanceof Kw)return e;this._importDER(e,t)||(sQ(e.r&&e.s,"Signature without r or s"),this.r=new Uw(e.r,16),this.s=new Uw(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var uQ=Kw;function lQ(){this.place=0}function h5(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(r===0||r>4)return!1;for(var a=0,i=0,h=t.place;i>>=0;return!(a<=127)&&(t.place=h,a)}function EO(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}Kw.prototype._importDER=function(e,t){e=d5.toArray(e,t);var n=new lQ;if(e[n.place++]!==48)return!1;var r=h5(e,n);if(r===!1||r+n.place!==e.length||e[n.place++]!==2)return!1;var a=h5(e,n);if(a===!1)return!1;var i=e.slice(n.place,a+n.place);if(n.place+=a,e[n.place++]!==2)return!1;var h=h5(e,n);if(h===!1||e.length!==h+n.place)return!1;var y=e.slice(n.place,h+n.place);if(i[0]===0){if(!(128&i[1]))return!1;i=i.slice(1)}if(y[0]===0){if(!(128&y[1]))return!1;y=y.slice(1)}return this.r=new Uw(i),this.s=new Uw(y),this.recoveryParam=null,!0},Kw.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=EO(t),n=EO(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];p5(r,t.length),(r=r.concat(t)).push(2),p5(r,n.length);var a=r.concat(n),i=[48];return p5(i,a.length),i=i.concat(a),d5.encode(i,e)};var t1=vd,kO=iQ,m5=Bw,cQ=ZL,MO=uu.assert,g5=aQ,Hw=uQ;function Zu(e){if(!(this instanceof Zu))return new Zu(e);typeof e=="string"&&(MO(Object.prototype.hasOwnProperty.call(m5,e),"Unknown curve "+e),e=m5[e]),e instanceof m5.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var fQ=Zu;Zu.prototype.keyPair=function(e){return new g5(this,e)},Zu.prototype.keyFromPrivate=function(e,t){return g5.fromPrivate(this,e,t)},Zu.prototype.keyFromPublic=function(e,t){return g5.fromPublic(this,e,t)},Zu.prototype.genKeyPair=function(e){e||(e={});for(var t=new kO({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||cQ(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new t1(2));;){var a=new t1(t.generate(n));if(!(a.cmp(r)>0))return a.iaddn(1),this.keyFromPrivate(a)}},Zu.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Zu.prototype.sign=function(e,t,n,r){typeof n=="object"&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new t1(e,16));for(var a=this.n.byteLength(),i=t.getPrivate().toArray("be",a),h=e.toArray("be",a),y=new kO({hash:this.hash,entropy:i,nonce:h,pers:r.pers,persEnc:r.persEnc||"utf8"}),k=this.n.sub(new t1(1)),E=0;;E++){var M=r.k?r.k(E):new t1(y.generate(this.n.byteLength()));if(!((M=this._truncateToN(M,!0)).cmpn(1)<=0||M.cmp(k)>=0)){var C=this.g.mul(M);if(!C.isInfinity()){var O=C.getX(),z=O.umod(this.n);if(z.cmpn(0)!==0){var H=M.invm(this.n).mul(z.mul(t.getPrivate()).iadd(e));if((H=H.umod(this.n)).cmpn(0)!==0){var ee=(C.getY().isOdd()?1:0)|(O.cmp(z)!==0?2:0);return r.canonical&&H.cmp(this.nh)>0&&(H=this.n.sub(H),ee^=1),new Hw({r:z,s:H,recoveryParam:ee})}}}}}},Zu.prototype.verify=function(e,t,n,r){e=this._truncateToN(new t1(e,16)),n=this.keyFromPublic(n,r);var a=(t=new Hw(t,"hex")).r,i=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var h,y=i.invm(this.n),k=y.mul(e).umod(this.n),E=y.mul(a).umod(this.n);return this.curve._maxwellTrick?!(h=this.g.jmulAdd(k,n.getPublic(),E)).isInfinity()&&h.eqXToP(a):!(h=this.g.mulAdd(k,n.getPublic(),E)).isInfinity()&&h.getX().umod(this.n).cmp(a)===0},Zu.prototype.recoverPubKey=function(e,t,n,r){MO((3&n)===n,"The recovery param is more than two bits"),t=new Hw(t,r);var a=this.n,i=new t1(e),h=t.r,y=t.s,k=1&n,E=n>>1;if(h.cmp(this.curve.p.umod(this.curve.n))>=0&&E)throw new Error("Unable to find sencond key candinate");h=E?this.curve.pointFromX(h.add(this.curve.n),k):this.curve.pointFromX(h,k);var M=t.r.invm(a),C=a.sub(i).mul(M).umod(a),O=y.mul(M).umod(a);return this.g.mulAdd(C,h,O)},Zu.prototype.getKeyRecoveryParam=function(e,t,n,r){if((t=new Hw(t,r)).recoveryParam!==null)return t.recoveryParam;for(var a=0;a<4;a++){var i;try{i=this.recoverPubKey(e,t,a)}catch{continue}if(i.eq(n))return a}throw new Error("Unable to find valid recovery factor")};var xy=uu,CO=xy.assert,xO=xy.parseBytes,S2=xy.cachedProperty;function Vo(e,t){this.eddsa=e,this._secret=xO(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=xO(t.pub)}Vo.fromPublic=function(e,t){return t instanceof Vo?t:new Vo(e,{pub:t})},Vo.fromSecret=function(e,t){return t instanceof Vo?t:new Vo(e,{secret:t})},Vo.prototype.secret=function(){return this._secret},S2(Vo,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),S2(Vo,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),S2(Vo,"privBytes",function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),S2(Vo,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),S2(Vo,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),S2(Vo,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Vo.prototype.sign=function(e){return CO(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Vo.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Vo.prototype.getSecret=function(e){return CO(this._secret,"KeyPair is public only"),xy.encode(this.secret(),e)},Vo.prototype.getPublic=function(e){return xy.encode(this.pubBytes(),e)};var dQ=Vo,hQ=vd,$w=uu,pQ=$w.assert,qw=$w.cachedProperty,mQ=$w.parseBytes;function n1(e,t){this.eddsa=e,typeof t!="object"&&(t=mQ(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),pQ(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof hQ&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}qw(n1,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),qw(n1,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),qw(n1,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),qw(n1,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),n1.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},n1.prototype.toHex=function(){return $w.encode(this.toBytes(),"hex").toUpperCase()};var gQ=n1,vQ=zw,yQ=Bw,E2=uu,bQ=E2.assert,AO=E2.parseBytes,TO=dQ,RO=gQ;function Rs(e){if(bQ(e==="ed25519","only tested with ed25519 so far"),!(this instanceof Rs))return new Rs(e);e=yQ[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=vQ.sha512}var wQ=Rs;Rs.prototype.sign=function(e,t){e=AO(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),a=this.g.mul(r),i=this.encodePoint(a),h=this.hashInt(i,n.pubBytes(),e).mul(n.priv()),y=r.add(h).umod(this.curve.n);return this.makeSignature({R:a,S:y,Rencoded:i})},Rs.prototype.verify=function(e,t,n){e=AO(e),t=this.makeSignature(t);var r=this.keyFromPublic(n),a=this.hashInt(t.Rencoded(),r.pubBytes(),e),i=this.g.mul(t.S());return t.R().add(r.pub().mul(a)).eq(i)},Rs.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=0)return null;a=a.toRed(Rr.red);let i=a.redSqr().redIMul(a).redIAdd(Rr.b).redSqrt();return n===3!==i.isOdd()&&(i=i.redNeg()),hf.keyPair({pub:{x:a,y:i}})}(t,e.subarray(1,33));case 4:case 6:case 7:return e.length!==65?null:function(n,r,a){let i=new gi(r),h=new gi(a);if(i.cmp(Rr.p)>=0||h.cmp(Rr.p)>=0||(i=i.toRed(Rr.red),h=h.toRed(Rr.red),(n===6||n===7)&&h.isOdd()!==(n===7)))return null;const y=i.redSqr().redIMul(i);return h.redSqr().redISub(y.redIAdd(Rr.b)).isZero()?hf.keyPair({pub:{x:i,y:h}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function r1(e,t){const n=t.encode(null,e.length===33);for(let r=0;r0,privateKeyVerify(e){const t=new gi(e);return t.cmp(Rr.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new gi(e),n=Rr.n.sub(t).umod(Rr.n).toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakAdd(e,t){const n=new gi(t);if(n.cmp(Rr.n)>=0||(n.iadd(new gi(e)),n.cmp(Rr.n)>=0&&n.isub(Rr.n),n.isZero()))return 1;const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakMul(e,t){let n=new gi(t);if(n.cmp(Rr.n)>=0||n.isZero())return 1;n.imul(new gi(e)),n.cmp(Rr.n)>=0&&(n=n.umod(Rr.n));const r=n.toArrayLike(Uint8Array,"be",32);return e.set(r),0},publicKeyVerify:e=>Wh(e)===null?1:0,publicKeyCreate(e,t){const n=new gi(t);return n.cmp(Rr.n)>=0||n.isZero()?1:(r1(e,hf.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const n=Wh(t);return n===null?1:(r1(e,n.getPublic()),0)},publicKeyNegate(e,t){const n=Wh(t);if(n===null)return 1;const r=n.getPublic();return r.y=r.y.redNeg(),r1(e,r),0},publicKeyCombine(e,t){const n=new Array(t.length);for(let a=0;a=0)return 2;const a=r.getPublic().add(Rr.g.mul(n));return a.isInfinity()?2:(r1(e,a),0)},publicKeyTweakMul(e,t,n){const r=Wh(t);return r===null?1:(n=new gi(n)).cmp(Rr.n)>=0||n.isZero()?2:(r1(e,r.getPublic().mul(n)),0)},signatureNormalize(e){const t=new gi(e.subarray(0,32)),n=new gi(e.subarray(32,64));return t.cmp(Rr.n)>=0||n.cmp(Rr.n)>=0?1:(n.cmp(hf.nh)===1&&e.set(Rr.n.sub(n).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const n=t.subarray(0,32),r=t.subarray(32,64);if(new gi(n).cmp(Rr.n)>=0||new gi(r).cmp(Rr.n)>=0)return 1;const{output:a}=e;let i=a.subarray(4,37);i[0]=0,i.set(n,1);let h=33,y=0;for(;h>1&&i[y]===0&&!(128&i[y+1]);--h,++y);if(i=i.subarray(y),128&i[0]||h>1&&i[0]===0&&!(128&i[1]))return 1;let k=a.subarray(39,72);k[0]=0,k.set(r,1);let E=33,M=0;for(;E>1&&k[M]===0&&!(128&k[M+1]);--E,++M);return k=k.subarray(M),128&k[0]||E>1&&k[0]===0&&!(128&k[1])?1:(e.outputlen=6+h+E,a[0]=48,a[1]=e.outputlen-2,a[2]=2,a[3]=i.length,a.set(i,4),a[4+h]=2,a[5+h]=k.length,a.set(k,6+h),0)},signatureImport(e,t){if(t.length<8||t.length>72||t[0]!==48||t[1]!==t.length-2||t[2]!==2)return 1;const n=t[3];if(n===0||5+n>=t.length||t[4+n]!==2)return 1;const r=t[5+n];if(r===0||6+n+r!==t.length||128&t[4]||n>1&&t[4]===0&&!(128&t[5])||128&t[n+6]||r>1&&t[n+6]===0&&!(128&t[n+7]))return 1;let a=t.subarray(4,4+n);if(a.length===33&&a[0]===0&&(a=a.subarray(1)),a.length>32)return 1;let i=t.subarray(6+n);if(i.length===33&&i[0]===0&&(i=i.slice(1)),i.length>32)throw new Error("S length is too long");let h=new gi(a);h.cmp(Rr.n)>=0&&(h=new gi(0));let y=new gi(t.subarray(6+n));return y.cmp(Rr.n)>=0&&(y=new gi(0)),e.set(h.toArrayLike(Uint8Array,"be",32),0),e.set(y.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,n,r,a){if(a){const y=a;a=k=>{const E=y(t,n,null,r,k);if(!(E instanceof Uint8Array&&E.length===32))throw new Error("This is the way");return new gi(E)}}const i=new gi(n);if(i.cmp(Rr.n)>=0||i.isZero())return 1;let h;try{h=hf.sign(t,n,{canonical:!0,k:a,pers:r})}catch{return 1}return e.signature.set(h.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(h.s.toArrayLike(Uint8Array,"be",32),32),e.recid=h.recoveryParam,0},ecdsaVerify(e,t,n){const r={r:e.subarray(0,32),s:e.subarray(32,64)},a=new gi(r.r),i=new gi(r.s);if(a.cmp(Rr.n)>=0||i.cmp(Rr.n)>=0)return 1;if(i.cmp(hf.nh)===1||a.isZero()||i.isZero())return 3;const h=Wh(n);if(h===null)return 2;const y=h.getPublic();return hf.verify(t,r,y)?0:3},ecdsaRecover(e,t,n,r){const a={r:t.slice(0,32),s:t.slice(32,64)},i=new gi(a.r),h=new gi(a.s);if(i.cmp(Rr.n)>=0||h.cmp(Rr.n)>=0)return 1;if(i.isZero()||h.isZero())return 2;let y;try{y=hf.recoverPubKey(r,a,n)}catch{return 2}return r1(e,y),0},ecdh(e,t,n,r,a,i,h){const y=Wh(t);if(y===null)return 1;const k=new gi(n);if(k.cmp(Rr.n)>=0||k.isZero())return 2;const E=y.getPublic().mul(k);if(a===void 0){const M=E.encode(null,!0),C=hf.hash().update(M).digest();for(let O=0;O<32;++O)e[O]=C[O]}else{i||(i=new Uint8Array(32));const M=E.getX().toArray("be",32);for(let z=0;z<32;++z)i[z]=M[z];h||(h=new Uint8Array(32));const C=E.getY().toArray("be",32);for(let z=0;z<32;++z)h[z]=C[z];const O=a(i,h,r);if(!(O instanceof Uint8Array&&O.length===e.length))return 2;e.set(O)}return 0}},v5=(e=>({contextRandomize(t){if(Vu(t===null||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),t!==null&&Nr("seed",t,32),e.contextRandomize(t)===1)throw new Error(qG)},privateKeyVerify:t=>(Nr("private key",t,32),e.privateKeyVerify(t)===0),privateKeyNegate(t){switch(Nr("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(f2)}},privateKeyTweakAdd(t,n){switch(Nr("private key",t,32),Nr("tweak",n,32),e.privateKeyTweakAdd(t,n)){case 0:return t;case 1:throw new Error($L)}},privateKeyTweakMul(t,n){switch(Nr("private key",t,32),Nr("tweak",n,32),e.privateKeyTweakMul(t,n)){case 0:return t;case 1:throw new Error(qL)}},publicKeyVerify:t=>(Nr("public key",t,[33,65]),e.publicKeyVerify(t)===0),publicKeyCreate(t,n=!0,r){switch(Nr("private key",t,32),Zp(n),r=$l(r,n?33:65),e.publicKeyCreate(r,t)){case 0:return r;case 1:throw new Error(WG);case 2:throw new Error(Rw)}},publicKeyConvert(t,n=!0,r){switch(Nr("public key",t,[33,65]),Zp(n),r=$l(r,n?33:65),e.publicKeyConvert(r,t)){case 0:return r;case 1:throw new Error(Gp);case 2:throw new Error(Rw)}},publicKeyNegate(t,n=!0,r){switch(Nr("public key",t,[33,65]),Zp(n),r=$l(r,n?33:65),e.publicKeyNegate(r,t)){case 0:return r;case 1:throw new Error(Gp);case 2:throw new Error(f2);case 3:throw new Error(Rw)}},publicKeyCombine(t,n=!0,r){Vu(Array.isArray(t),"Expected public keys to be an Array"),Vu(t.length>0,"Expected public keys array will have more than zero items");for(const a of t)Nr("public key",a,[33,65]);switch(Zp(n),r=$l(r,n?33:65),e.publicKeyCombine(r,t)){case 0:return r;case 1:throw new Error(Gp);case 2:throw new Error(VG);case 3:throw new Error(Rw)}},publicKeyTweakAdd(t,n,r=!0,a){switch(Nr("public key",t,[33,65]),Nr("tweak",n,32),Zp(r),a=$l(a,r?33:65),e.publicKeyTweakAdd(a,t,n)){case 0:return a;case 1:throw new Error(Gp);case 2:throw new Error($L)}},publicKeyTweakMul(t,n,r=!0,a){switch(Nr("public key",t,[33,65]),Nr("tweak",n,32),Zp(r),a=$l(a,r?33:65),e.publicKeyTweakMul(a,t,n)){case 0:return a;case 1:throw new Error(Gp);case 2:throw new Error(qL)}},signatureNormalize(t){switch(Nr("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(Ey)}},signatureExport(t,n){Nr("signature",t,64);const r={output:n=$l(n,72),outputlen:72};switch(e.signatureExport(r,t)){case 0:return n.slice(0,r.outputlen);case 1:throw new Error(Ey);case 2:throw new Error(f2)}},signatureImport(t,n){switch(Nr("signature",t),n=$l(n,64),e.signatureImport(n,t)){case 0:return n;case 1:throw new Error(Ey);case 2:throw new Error(f2)}},ecdsaSign(t,n,r={},a){Nr("message",t,32),Nr("private key",n,32),Vu(d2(r)==="Object","Expected options to be an Object"),r.data!==void 0&&Nr("options.data",r.data),r.noncefn!==void 0&&Vu(d2(r.noncefn)==="Function","Expected options.noncefn to be a Function");const i={signature:a=$l(a,64),recid:null};switch(e.ecdsaSign(i,t,n,r.data,r.noncefn)){case 0:return i;case 1:throw new Error(YG);case 2:throw new Error(f2)}},ecdsaVerify(t,n,r){switch(Nr("signature",t,64),Nr("message",n,32),Nr("public key",r,[33,65]),e.ecdsaVerify(t,n,r)){case 0:return!0;case 3:return!1;case 1:throw new Error(Ey);case 2:throw new Error(Gp)}},ecdsaRecover(t,n,r,a=!0,i){switch(Nr("signature",t,64),Vu(d2(n)==="Number"&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),Nr("message",r,32),Zp(a),i=$l(i,a?33:65),e.ecdsaRecover(i,t,n,r)){case 0:return i;case 1:throw new Error(Ey);case 2:throw new Error(GG);case 3:throw new Error(f2)}},ecdh(t,n,r={},a){switch(Nr("public key",t,[33,65]),Nr("private key",n,32),Vu(d2(r)==="Object","Expected options to be an Object"),r.data!==void 0&&Nr("options.data",r.data),r.hashfn!==void 0?(Vu(d2(r.hashfn)==="Function","Expected options.hashfn to be a Function"),r.xbuf!==void 0&&Nr("options.xbuf",r.xbuf,32),r.ybuf!==void 0&&Nr("options.ybuf",r.ybuf,32),Nr("output",a)):a=$l(a,32),e.ecdh(a,t,n,r.data,r.hashfn,r.xbuf,r.ybuf)){case 0:return a;case 1:throw new Error(Gp);case 2:throw new Error(ZG)}}}))(_Q),Ps={},Ww={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SECRET_KEY_LENGTH=e.AES_IV_PLUS_TAG_LENGTH=e.AES_TAG_LENGTH=e.AES_IV_LENGTH=e.UNCOMPRESSED_PUBLIC_KEY_SIZE=void 0,e.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,e.AES_IV_LENGTH=16,e.AES_TAG_LENGTH=16,e.AES_IV_PLUS_TAG_LENGTH=e.AES_IV_LENGTH+e.AES_TAG_LENGTH,e.SECRET_KEY_LENGTH=32})(Ww);var SQ=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.aesDecrypt=Ps.aesEncrypt=Ps.getValidSecret=Ps.decodeHex=Ps.remove0x=void 0;var Vw=Tw(),EQ=SQ(v5),k2=Ww;function PO(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e}Ps.remove0x=PO,Ps.decodeHex=function(e){return je.from(PO(e),"hex")},Ps.getValidSecret=function(){var e;do e=(0,Vw.randomBytes)(k2.SECRET_KEY_LENGTH);while(!EQ.default.privateKeyVerify(e));return e},Ps.aesEncrypt=function(e,t){var n=(0,Vw.randomBytes)(k2.AES_IV_LENGTH),r=(0,Vw.createCipheriv)("aes-256-gcm",e,n),a=je.concat([r.update(t),r.final()]),i=r.getAuthTag();return je.concat([n,i,a])},Ps.aesDecrypt=function(e,t){var n=t.slice(0,k2.AES_IV_LENGTH),r=t.slice(k2.AES_IV_LENGTH,k2.AES_IV_PLUS_TAG_LENGTH),a=t.slice(k2.AES_IV_PLUS_TAG_LENGTH),i=(0,Vw.createDecipheriv)("aes-256-gcm",e,n);return i.setAuthTag(r),je.concat([i.update(a),i.final()])};var Yw={},IO=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yw,"__esModule",{value:!0});var kQ=IO(HL),LO=IO(v5),MQ=Ps,CQ=Ww,xQ=function(){function e(t){this.uncompressed=je.from(LO.default.publicKeyConvert(t,!1)),this.compressed=je.from(LO.default.publicKeyConvert(t,!0))}return e.fromHex=function(t){var n=(0,MQ.decodeHex)(t);if(n.length===CQ.UNCOMPRESSED_PUBLIC_KEY_SIZE-1){var r=je.from([4]);return new e(je.concat([r,n]))}return new e(n)},e.prototype.toHex=function(t){return t===void 0&&(t=!0),t?this.compressed.toString("hex"):this.uncompressed.toString("hex")},e.prototype.decapsulate=function(t){var n=je.concat([this.uncompressed,t.multiply(this)]);return(0,kQ.default)(n,32,{hash:"SHA-256"})},e.prototype.equals=function(t){return this.uncompressed.equals(t.uncompressed)},e}();Yw.default=xQ;var y5=b&&b.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ge,"__esModule",{value:!0});var AQ=y5(HL),b5=y5(v5),OO=Ps,TQ=y5(Yw),RQ=function(){function e(t){if(this.secret=t||(0,OO.getValidSecret)(),!b5.default.privateKeyVerify(this.secret))throw new Error("Invalid private key");this.publicKey=new TQ.default(je.from(b5.default.publicKeyCreate(this.secret)))}return e.fromHex=function(t){return new e((0,OO.decodeHex)(t))},e.prototype.toHex=function(){return"0x".concat(this.secret.toString("hex"))},e.prototype.encapsulate=function(t){var n=je.concat([this.publicKey.uncompressed,this.multiply(t)]);return(0,AQ.default)(n,32,{hash:"SHA-256"})},e.prototype.multiply=function(t){return je.from(b5.default.publicKeyTweakMul(t.compressed,this.secret,!1))},e.prototype.equals=function(t){return this.secret.equals(t.secret)},e}();ge.default=RQ,function(e){var t=b&&b.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var n=ge;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t(n).default}});var r=Yw;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return t(r).default}})}(Ph),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.decrypt=e.encrypt=void 0;var t=Ph,n=Ps,r=Ww;e.encrypt=function(i,h){var y=new t.PrivateKey,k=i instanceof je?new t.PublicKey(i):t.PublicKey.fromHex(i),E=y.encapsulate(k),M=(0,n.aesEncrypt)(E,h);return je.concat([y.publicKey.uncompressed,M])},e.decrypt=function(i,h){var y=i instanceof je?new t.PrivateKey(i):t.PrivateKey.fromHex(i),k=new t.PublicKey(h.slice(0,r.UNCOMPRESSED_PUBLIC_KEY_SIZE)),E=h.slice(r.UNCOMPRESSED_PUBLIC_KEY_SIZE),M=k.decapsulate(y);return(0,n.aesDecrypt)(M,E)};var a=Ph;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return a.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return a.PublicKey}}),e.utils={aesDecrypt:n.aesDecrypt,aesEncrypt:n.aesEncrypt,decodeHex:n.decodeHex,getValidSecret:n.getValidSecret,remove0x:n.remove0x}}(Fo);var NO={exports:{}};(function(e,t){(function(n){var r=Object.hasOwnProperty,a=Array.isArray?Array.isArray:function(f){return Object.prototype.toString.call(f)==="[object Array]"},i=typeof mi=="object"&&!0,h=typeof Symbol=="function",y=typeof Reflect=="object",k=typeof setImmediate=="function"?setImmediate:setTimeout,E=h?y&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(f){var _=Object.getOwnPropertyNames(f);return _.push.apply(_,Object.getOwnPropertySymbols(f)),_}:Object.keys;function M(){this._events={},this._conf&&C.call(this,this._conf)}function C(f){f&&(this._conf=f,f.delimiter&&(this.delimiter=f.delimiter),f.maxListeners!==n&&(this._maxListeners=f.maxListeners),f.wildcard&&(this.wildcard=f.wildcard),f.newListener&&(this._newListener=f.newListener),f.removeListener&&(this._removeListener=f.removeListener),f.verboseMemoryLeak&&(this.verboseMemoryLeak=f.verboseMemoryLeak),f.ignoreErrors&&(this.ignoreErrors=f.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function O(f,_){var T="(node) warning: possible EventEmitter memory leak detected. "+f+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(T+=" Event name: "+_+"."),mi!==void 0&&mi.emitWarning){var L=new Error(T);L.name="MaxListenersExceededWarning",L.emitter=this,L.count=f,mi.emitWarning(L)}else console.error(T),console.trace&&console.trace()}var z=function(f,_,T){var L=arguments.length;switch(L){case 0:return[];case 1:return[f];case 2:return[f,_];case 3:return[f,_,T];default:for(var B=new Array(L);L--;)B[L]=arguments[L];return B}};function H(f,_){for(var T={},L=f.length,B=0,$=0;$0;)if(q===f[F])return $;Y(_)}}Object.assign(ee.prototype,{subscribe:function(f,_,T){var L=this,B=this._target,$=this._emitter,Y=this._listeners,q=function(){var F=z.apply(null,arguments),K={data:F,name:_,original:f};T?T.call(B,K)!==!1&&$.emit.apply($,[K.name].concat(F)):$.emit.apply($,[_].concat(F))};if(Y[f])throw Error("Event '"+f+"' is already listening");this._listenersCount++,$._newListener&&$._removeListener&&!L._onNewListener?(this._onNewListener=function(F){F===_&&Y[f]===null&&(Y[f]=q,L._on.call(B,f,q))},$.on("newListener",this._onNewListener),this._onRemoveListener=function(F){F===_&&!$.hasListeners(F)&&Y[f]&&(Y[f]=null,L._off.call(B,f,q))},Y[f]=null,$.on("removeListener",this._onRemoveListener)):(Y[f]=q,L._on.call(B,f,q))},unsubscribe:function(f){var _,T,L,B=this,$=this._listeners,Y=this._emitter,q=this._off,F=this._target;if(f&&typeof f!="string")throw TypeError("event must be a string");function K(){B._onNewListener&&(Y.off("newListener",B._onNewListener),Y.off("removeListener",B._onRemoveListener),B._onNewListener=null,B._onRemoveListener=null);var Z=ze.call(Y,B);Y._observers.splice(Z,1)}if(f){if(!(_=$[f]))return;q.call(F,f,_),delete $[f],--this._listenersCount||K()}else{for(L=(T=E($)).length;L-- >0;)f=T[L],q.call(F,f,$[f]);this._listeners={},this._listenersCount=0,K()}}});var Ee=oe(["function"]),we=oe(["object","function"]);function Ce(f,_,T){var L,B,$,Y=0,q=new f(function(F,K,Z){function ne(){B&&(B=null),Y&&(clearTimeout(Y),Y=0)}T=te(T,{timeout:0,overload:!1},{timeout:function(fe,De){return(typeof(fe*=1)!="number"||fe<0||!Number.isFinite(fe))&&De("timeout must be a positive number"),fe}}),L=!T.overload&&typeof f.prototype.cancel=="function"&&typeof Z=="function";var ue=function(fe){ne(),F(fe)},me=function(fe){ne(),K(fe)};L?_(ue,me,Z):(B=[function(fe){me(fe||Error("canceled"))}],_(ue,me,function(fe){if($)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof fe!="function")throw TypeError("onCancel callback must be a function");B.push(fe)}),$=!0),T.timeout>0&&(Y=setTimeout(function(){var fe=Error("timeout");fe.code="ETIMEDOUT",Y=0,q.cancel(fe),K(fe)},T.timeout))});return L||(q.cancel=function(F){if(B){for(var K=B.length,Z=1;Z0;)(ue=pe[q])!=="_listeners"&&(ve=Fe(f,_,T[ue],L+1,B))&&(Se?Se.push.apply(Se,ve):Se=ve);return Se}if(Ae==="**"){for((_e=L+1===B||L+2===B&&qe==="*")&&T._listeners&&(Se=Fe(f,_,T,B,B)),q=(pe=E(T)).length;q-- >0;)(ue=pe[q])!=="_listeners"&&(ue==="*"||ue==="**"?(T[ue]._listeners&&!_e&&(ve=Fe(f,_,T[ue],B,B))&&(Se?Se.push.apply(Se,ve):Se=ve),ve=Fe(f,_,T[ue],L,B)):ve=Fe(f,_,T[ue],ue===qe?L+2:L,B),ve&&(Se?Se.push.apply(Se,ve):Se=ve));return Se}T[Ae]&&(Se=Fe(f,_,T[Ae],L+1,B))}if((me=T["*"])&&Fe(f,_,me,L+1,B),fe=T["**"])if(L0;)(ue=pe[q])!=="_listeners"&&(ue===qe?Fe(f,_,fe[ue],L+2,B):ue===Ae?Fe(f,_,fe[ue],L+1,B):((De={})[ue]=fe[ue],Fe(f,_,{"**":De},L+1,B)));else fe._listeners?Fe(f,_,fe,B,B):fe["*"]&&fe["*"]._listeners&&Fe(f,_,fe["*"],B,B);return Se}function $e(f,_,T){var L,B,$=0,Y=0,q=this.delimiter,F=q.length;if(typeof f=="string")if((L=f.indexOf(q))!==-1){B=new Array(5);do B[$++]=f.slice(Y,L),Y=L+F;while((L=f.indexOf(q,Y))!==-1);B[$++]=f.slice(Y)}else B=[f],$=1;else B=f,$=f.length;if($>1){for(L=0;L+1<$;L++)if(B[L]==="**"&&B[L+1]==="**")return}var K,Z=this.listenerTree;for(L=0;L<$;L++)if(Z=Z[K=B[L]]||(Z[K]={}),L===$-1)return Z._listeners?(typeof Z._listeners=="function"&&(Z._listeners=[Z._listeners]),T?Z._listeners.unshift(_):Z._listeners.push(_),!Z._listeners.warned&&this._maxListeners>0&&Z._listeners.length>this._maxListeners&&(Z._listeners.warned=!0,O.call(this,Z._listeners.length,K))):Z._listeners=_,!0;return!0}function S(f,_,T,L){for(var B,$,Y,q,F=E(f),K=F.length,Z=f._listeners;K-- >0;)B=f[$=F[K]],Y=$==="_listeners"?T:T?T.concat($):[$],q=L||typeof $=="symbol",Z&&_.push(q?Y:Y.join(this.delimiter)),typeof B=="object"&&S.call(this,B,_,Y,q);return _}function P(f){for(var _,T,L,B=E(f),$=B.length;$-- >0;)(_=f[T=B[$]])&&(L=!0,T==="_listeners"||P(_)||delete f[T]);return L}function d(f,_,T){this.emitter=f,this.event=_,this.listener=T}function g(f,_,T){if(T===!0)B=!0;else if(T===!1)L=!0;else{if(!T||typeof T!="object")throw TypeError("options should be an object or true");var L=T.async,B=T.promisify,$=T.nextTick,Y=T.objectify}if(L||$||B){var q=_,F=_._origin||_;if($&&!i)throw Error("process.nextTick is not supported");B===n&&(B=_.constructor.name==="AsyncFunction"),_=function(){var K=arguments,Z=this,ne=this.event;return B?$?Promise.resolve():new Promise(function(ue){k(ue)}).then(function(){return Z.event=ne,q.apply(Z,K)}):($?pr:k)(function(){Z.event=ne,q.apply(Z,K)})},_._async=!0,_._origin=F}return[_,Y?new d(this,f,_):this]}function m(f){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,C.call(this,f)}d.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},m.EventEmitter2=m,m.prototype.listenTo=function(f,_,T){if(typeof f!="object")throw TypeError("target musts be an object");var L=this;function B($){if(typeof $!="object")throw TypeError("events must be an object");var Y,q=T.reducers,F=ze.call(L,f);Y=F===-1?new ee(L,f,T):L._observers[F];for(var K,Z=E($),ne=Z.length,ue=typeof q=="function",me=0;me0;)L=T[B],f&&L._target!==f||(L.unsubscribe(_),$=!0);return $},m.prototype.delimiter=".",m.prototype.setMaxListeners=function(f){f!==n&&(this._maxListeners=f,this._conf||(this._conf={}),this._conf.maxListeners=f)},m.prototype.getMaxListeners=function(){return this._maxListeners},m.prototype.event="",m.prototype.once=function(f,_,T){return this._once(f,_,!1,T)},m.prototype.prependOnceListener=function(f,_,T){return this._once(f,_,!0,T)},m.prototype._once=function(f,_,T,L){return this._many(f,1,_,T,L)},m.prototype.many=function(f,_,T,L){return this._many(f,_,T,!1,L)},m.prototype.prependMany=function(f,_,T,L){return this._many(f,_,T,!0,L)},m.prototype._many=function(f,_,T,L,B){var $=this;if(typeof T!="function")throw new Error("many only accepts instances of Function");function Y(){return--_==0&&$.off(f,Y),T.apply(this,arguments)}return Y._origin=T,this._on(f,Y,L,B)},m.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||M.call(this);var f,_,T,L,B,$,Y=arguments[0],q=this.wildcard;if(Y==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(q&&(f=Y,Y!=="newListener"&&Y!=="removeListener"&&typeof Y=="object")){if(T=Y.length,h){for(L=0;L3)for(_=new Array(K-1),B=1;B3)for(T=new Array(Z-1),$=1;$0&&this._events[f].length>this._maxListeners&&(this._events[f].warned=!0,O.call(this,this._events[f].length,f))):this._events[f]=_,$)},m.prototype.off=function(f,_){if(typeof _!="function")throw new Error("removeListener only takes instances of Function");var T,L=[];if(this.wildcard){var B=typeof f=="string"?f.split(this.delimiter):f.slice();if(!(L=Fe.call(this,null,B,this.listenerTree,0)))return this}else{if(!this._events[f])return this;T=this._events[f],L.push({_listeners:T})}for(var $=0;$0){for(T=0,L=(_=this._all).length;T0;)typeof(T=Y[_[B]])=="function"?L.push(T):L.push.apply(L,T);return L}if(this.wildcard){if(!($=this.listenerTree))return[];var q=[],F=typeof f=="string"?f.split(this.delimiter):f.slice();return Fe.call(this,q,F,$,0),q}return Y&&(T=Y[f])?typeof T=="function"?[T]:T:[]},m.prototype.eventNames=function(f){var _=this._events;return this.wildcard?S.call(this,this.listenerTree,[],null,f):_?E(_):[]},m.prototype.listenerCount=function(f){return this.listeners(f).length},m.prototype.hasListeners=function(f){if(this.wildcard){var _=[],T=typeof f=="string"?f.split(this.delimiter):f.slice();return Fe.call(this,_,T,this.listenerTree,0),_.length>0}var L=this._events,B=this._all;return!!(B&&B.length||L&&(f===n?E(L).length:L[f]))},m.prototype.listenersAny=function(){return this._all?this._all:[]},m.prototype.waitFor=function(f,_){var T=this,L=typeof _;return L==="number"?_={timeout:_}:L==="function"&&(_={filter:_}),Ce((_=te(_,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:Ee,Promise:se})).Promise,function(B,$,Y){function q(){var F=_.filter;if(!F||F.apply(T,arguments))if(T.off(f,q),_.handleError){var K=arguments[0];K?$(K):B(z.apply(null,arguments).slice(1))}else B(z.apply(null,arguments))}Y(function(){T.off(f,q)}),T._on(f,q,!1)},{timeout:_.timeout,overload:_.overload})};var p=m.prototype;Object.defineProperties(m,{defaultMaxListeners:{get:function(){return p._maxListeners},set:function(f){if(typeof f!="number"||f<0||Number.isNaN(f))throw TypeError("n must be a non-negative number");p._maxListeners=f},enumerable:!0},once:{value:function(f,_,T){return Ce((T=te(T,{Promise,timeout:0,overload:!1},{Promise:se})).Promise,function(L,B,$){var Y;if(typeof f.addEventListener=="function")return Y=function(){L(z.apply(null,arguments))},$(function(){f.removeEventListener(_,Y)}),void f.addEventListener(_,Y,{once:!0});var q,F=function(){q&&f.removeListener("error",q),L(z.apply(null,arguments))};_!=="error"&&(q=function(K){f.removeListener(_,F),B(K)},f.once("error",q)),$(function(){q&&f.removeListener("error",q),f.removeListener(_,F)}),f.once(_,F)},{timeout:T.timeout,overload:T.overload})},writable:!0,configurable:!0}}),Object.defineProperties(p,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=m})()})(NO);var w5,_5=NO.exports,PQ=new Uint8Array(16);function IQ(){if(!w5&&!(w5=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w5(PQ)}var LQ=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function S5(e){return typeof e=="string"&&LQ.test(e)}for(var ua=[],E5=0;E5<256;++E5)ua.push((E5+256).toString(16).substr(1));function DO(e,t,n){var r=(e=e||{}).random||(e.rng||IQ)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,h=(ua[a[i+0]]+ua[a[i+1]]+ua[a[i+2]]+ua[a[i+3]]+"-"+ua[a[i+4]]+ua[a[i+5]]+"-"+ua[a[i+6]]+ua[a[i+7]]+"-"+ua[a[i+8]]+ua[a[i+9]]+"-"+ua[a[i+10]]+ua[a[i+11]]+ua[a[i+12]]+ua[a[i+13]]+ua[a[i+14]]+ua[a[i+15]]).toLowerCase();if(!S5(h))throw TypeError("Stringified UUID is invalid");return h}(r)}const pf=Object.create(null);pf.open="0",pf.close="1",pf.ping="2",pf.pong="3",pf.message="4",pf.upgrade="5",pf.noop="6";const Gw=Object.create(null);Object.keys(pf).forEach(e=>{Gw[pf[e]]=e});const OQ={type:"error",data:"parser error"},BO=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",zO=typeof ArrayBuffer=="function",FO=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,k5=({type:e,data:t},n,r)=>BO&&t instanceof Blob?n?r(t):jO(t,r):zO&&(t instanceof ArrayBuffer||FO(t))?n?r(t):jO(new Blob([t]),r):r(pf[e]+(t||"")),jO=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function UO(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let M5;function NQ(e,t){return BO&&e.data instanceof Blob?e.data.arrayBuffer().then(UO).then(t):zO&&(e.data instanceof ArrayBuffer||FO(e.data))?t(UO(e.data)):void k5(e,!1,n=>{M5||(M5=new TextEncoder),t(M5.encode(n))})}const DQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ay=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<64;e++)Ay[DQ.charCodeAt(e)]=e;const BQ=typeof ArrayBuffer=="function",C5=(e,t)=>{if(typeof e!="string")return{type:"message",data:KO(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:zQ(e.substring(1),t)}:Gw[n]?e.length>1?{type:Gw[n],data:e.substring(1)}:{type:Gw[n]}:OQ},zQ=(e,t)=>{if(BQ){const n=(r=>{let a,i,h,y,k,E=.75*r.length,M=r.length,C=0;r[r.length-1]==="="&&(E--,r[r.length-2]==="="&&E--);const O=new ArrayBuffer(E),z=new Uint8Array(O);for(a=0;a>4,z[C++]=(15&h)<<4|y>>2,z[C++]=(3&y)<<6|63&k;return O})(e);return KO(n,t)}return{base64:!0,data:e}},KO=(e,t)=>t==="blob"?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,HO="";let x5;function yo(e){if(e)return function(t){for(var n in yo.prototype)t[n]=yo.prototype[n];return t}(e)}yo.prototype.on=yo.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},yo.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},yo.prototype.off=yo.prototype.removeListener=yo.prototype.removeAllListeners=yo.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var a=0;a(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const FQ=Qu.setTimeout,jQ=Qu.clearTimeout;function Zw(e,t){t.useNativeTimers?(e.setTimeoutFn=FQ.bind(Qu),e.clearTimeoutFn=jQ.bind(Qu)):(e.setTimeoutFn=Qu.setTimeout.bind(Qu),e.clearTimeoutFn=Qu.clearTimeout.bind(Qu))}class UQ extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class A5 extends yo{constructor(t){super(),this.writable=!1,Zw(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,n,r){return super.emitReserved("error",new UQ(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return this.readyState!=="opening"&&this.readyState!=="open"||(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=C5(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=function(r){let a="";for(let i in r)r.hasOwnProperty(i)&&(a.length&&(a+="&"),a+=encodeURIComponent(i)+"="+encodeURIComponent(r[i]));return a}(t);return n.length?"?"+n:""}}const qO="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),T5=64,KQ={};let WO,VO=0,Qw=0;function YO(e){let t="";do t=qO[e%T5]+t,e=Math.floor(e/T5);while(e>0);return t}function GO(){const e=YO(+new Date);return e!==WO?(VO=0,WO=e):e+"."+YO(VO++)}for(;Qw{var a;r.readyState===3&&((a=this.opts.cookieJar)===null||a===void 0||a.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(a){return void this.setTimeoutFn(()=>{this.onError(a)},0)}typeof document<"u"&&(this.index=mf.requestsCount++,mf.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(this.xhr!==void 0&&this.xhr!==null){if(this.xhr.onreadystatechange=$Q,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete mf.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function XO(){for(let e in mf.requests)mf.requests.hasOwnProperty(e)&&mf.requests[e].abort()}mf.requestsCount=0,mf.requests={},typeof document<"u"&&(typeof attachEvent=="function"?attachEvent("onunload",XO):typeof addEventListener=="function"&&addEventListener("onpagehide"in Qu?"pagehide":"unload",XO,!1));const R5=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Xw=Qu.WebSocket||Qu.MozWebSocket,JO=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";function WQ(e,t){return e.type==="message"&&typeof e.data!="string"&&t[0]>=48&&t[0]<=54}const VQ={websocket:class extends A5{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=JO?{}:$O(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=JO?new Xw(e,t,n):t?new Xw(e,t):new Xw(e)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(a)}catch{}r&&R5(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=GO()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Xw}},webtransport:class extends A5{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=e.readable.getReader();let n;this.writer=e.writable.getWriter();const r=()=>{t.read().then(({done:i,value:h})=>{i||(n||h.byteLength!==1||h[0]!==54?(this.onPacket(function(y,k,E){x5||(x5=new TextDecoder);const M=k||y[0]<48||y[0]>54;return C5(M?y:x5.decode(y),E)}(h,n,"arraybuffer")),n=!1):n=!0,r())}).catch(i=>{})};r();const a=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write(new TextEncoder().encode(a)).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t{WQ(n,a)&&this.writer.write(Uint8Array.of(54)),this.writer.write(a).then(()=>{r&&R5(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}},polling:class extends A5{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}const t=e&&e.forceBase64;this.supportsBinary=qQ&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let n=0;this.polling&&(n++,this.once("pollComplete",function(){--n||t()})),this.writable||(n++,this.once("drain",function(){--n||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((t,n)=>{const r=t.split(HO),a=[];for(let i=0;i{if(this.readyState==="opening"&&t.type==="open"&&this.onOpen(),t.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)}),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,((t,n)=>{const r=t.length,a=new Array(r);let i=0;t.forEach((h,y)=>{k5(h,!1,k=>{a[y]=k,++i===r&&n(a.join(HO))})})})(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=GO()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new mf(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(r,a)=>{this.onError("xhr post error",r,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,n)=>{this.onError("xhr poll error",t,n)}),this.pollXhr=e}}},YQ=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,GQ=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function P5(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let a=YQ.exec(e||""),i={},h=14;for(;h--;)i[GQ[h]]=a[h]||"";return n!=-1&&r!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(y,k){const E=/\/{2,9}/g,M=k.replace(E,"/").split("/");return k.slice(0,1)!="/"&&k.length!==0||M.splice(0,1),k.slice(-1)=="/"&&M.splice(M.length-1,1),M}(0,i.path),i.queryKey=function(y,k){const E={};return k.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(M,C,O){C&&(E[C]=O)}),E}(0,i.query),i}let eN=class dv extends yo{constructor(t,n={}){super(),this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=P5(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=P5(n.host).host),Zw(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=function(r){let a={},i=r.split("&");for(let h=0,y=i.length;h{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=4,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new VQ[t](r)}open(){let t;if(this.opts.rememberUpgrade&&dv.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(this.transports.length===0)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch{return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;dv.priorWebsocketSuccess=!1;const a=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",C=>{if(!r)if(C.type==="pong"&&C.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;dv.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(M(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=n.name,this.emitReserved("upgradeError",O)}}))};function i(){r||(r=!0,M(),n.close(),n=null)}const h=C=>{const O=new Error("probe error: "+C);O.transport=n.name,i(),this.emitReserved("upgradeError",O)};function y(){h("transport closed")}function k(){h("socket closed")}function E(C){n&&C.name!==n.name&&i()}const M=()=>{n.removeListener("open",a),n.removeListener("error",h),n.removeListener("close",y),this.off("close",k),this.off("upgrading",E)};n.once("open",a),n.once("error",h),n.once("close",y),this.once("close",k),this.once("upgrading",E),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",dv.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r=57344?y+=3:(k++,y+=4);return y}(n):Math.ceil(1.33*(n.byteLength||n.size))),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}var n;return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;(r=r||{}).compress=r.compress!==!1;const i={type:t,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return this.readyState!=="opening"&&this.readyState!=="open"||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){dv.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){this.readyState!=="opening"&&this.readyState!=="open"&&this.readyState!=="closing"||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const a=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,tN=Object.prototype.toString,XQ=typeof Blob=="function"||typeof Blob<"u"&&tN.call(Blob)==="[object BlobConstructor]",JQ=typeof File=="function"||typeof File<"u"&&tN.call(File)==="[object FileConstructor]";function I5(e){return ZQ&&(e instanceof ArrayBuffer||QQ(e))||XQ&&e instanceof Blob||JQ&&e instanceof File}function Jw(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let h=0;h{this.io.clearTimeoutFn(i),n.apply(this,[null,...h])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((a,i)=>{n.push((h,y)=>r?h?i(h):a(y):a(h)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>{if(r===this._queue[0])return a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue()}),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Pr.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Pr.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Pr.EVENT:case Pr.BINARY_EVENT:this.onevent(t);break;case Pr.ACK:case Pr.BINARY_ACK:this.onack(t);break;case Pr.DISCONNECT:this.ondisconnect();break;case Pr.CONNECT_ERROR:this.destroy();const n=new Error(t.data.message);n.data=t.data.data,this.emitReserved("connect_error",n)}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:Pr.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Pr.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}M2.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},M2.prototype.reset=function(){this.attempts=0},M2.prototype.setMin=function(e){this.ms=e},M2.prototype.setMax=function(e){this.max=e},M2.prototype.setJitter=function(e){this.jitter=e};class D5 extends yo{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),(n=n||{}).path=n.path||"/socket.io",this.opts=n,Zw(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new M2({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||iX;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new eN(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=Vl(n,"open",function(){r.onopen(),t&&t()}),i=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),t?t(y):this.maybeReconnectOnOpen()},h=Vl(n,"error",i);if(this._timeout!==!1){const y=this._timeout,k=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},y);this.opts.autoUnref&&k.unref(),this.subs.push(()=>{this.clearTimeoutFn(k)})}return this.subs.push(a),this.subs.push(h),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Vl(t,"ping",this.onping.bind(this)),Vl(t,"data",this.ondata.bind(this)),Vl(t,"error",this.onerror.bind(this)),Vl(t,"close",this.onclose.bind(this)),Vl(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){R5(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new rN(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ty={};function e7(e,t){typeof e=="object"&&(t=e,e=void 0);const n=function(k,E="",M){let C=k;M=M||typeof location<"u"&&location,k==null&&(k=M.protocol+"//"+M.host),typeof k=="string"&&(k.charAt(0)==="/"&&(k=k.charAt(1)==="/"?M.protocol+k:M.host+k),/^(https?|wss?):\/\//.test(k)||(k=M!==void 0?M.protocol+"//"+k:"https://"+k),C=P5(k)),C.port||(/^(http|ws)$/.test(C.protocol)?C.port="80":/^(http|ws)s$/.test(C.protocol)&&(C.port="443")),C.path=C.path||"/";const O=C.host.indexOf(":")!==-1?"["+C.host+"]":C.host;return C.id=C.protocol+"://"+O+":"+C.port+E,C.href=C.protocol+"://"+O+(M&&M.port===C.port?"":":"+C.port),C}(e,(t=t||{}).path||"/socket.io"),r=n.source,a=n.id,i=n.path,h=Ty[a]&&i in Ty[a].nsps;let y;return t.forceNew||t["force new connection"]||t.multiplex===!1||h?y=new D5(r,t):(Ty[a]||(Ty[a]=new D5(r,t)),y=Ty[a]),n.query&&!t.query&&(t.query=n.queryKey),y.socket(n.path,t)}function ir(e,t,n,r){return new(n||(n=Promise))(function(a,i){function h(E){try{k(r.next(E))}catch(M){i(M)}}function y(E){try{k(r.throw(E))}catch(M){i(M)}}function k(E){var M;E.done?a(E.value):(M=E.value,M instanceof n?M:new n(function(C){C(M)})).then(h,y)}k((r=r.apply(e,[])).next())})}Object.assign(e7,{Manager:D5,Socket:rN,io:e7,connect:e7}),typeof SuppressedError=="function"&&SuppressedError;var Ry=l!==void 0?l:typeof self<"u"?self:typeof window<"u"?window:{};function iN(){throw new Error("setTimeout has not been defined")}function oN(){throw new Error("clearTimeout has not been defined")}var Vh=iN,Yh=oN;function aN(e){if(Vh===setTimeout)return setTimeout(e,0);if((Vh===iN||!Vh)&&setTimeout)return Vh=setTimeout,setTimeout(e,0);try{return Vh(e,0)}catch{try{return Vh.call(null,e,0)}catch{return Vh.call(this,e,0)}}}typeof Ry.setTimeout=="function"&&(Vh=setTimeout),typeof Ry.clearTimeout=="function"&&(Yh=clearTimeout);var i1,_d=[],C2=!1,t7=-1;function aX(){C2&&i1&&(C2=!1,i1.length?_d=i1.concat(_d):t7=-1,_d.length&&sN())}function sN(){if(!C2){var e=aN(aX);C2=!0;for(var t=_d.length;t;){for(i1=_d,_d=[];++t71)for(var n=1;n{if(ee==="%%")return"%";H++;const se=t.formatters[te];if(typeof se=="function"){const oe=M[H];ee=se.call(C,oe),M.splice(H,1),H--}return ee}),t.formatArgs.call(C,M),(C.log||t.log).apply(C,M)}return E.namespace=a,E.useColors=t.useColors(),E.color=t.selectColor(a),E.extend=n,E.destroy=t.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>k!==null?k:(h!==t.namespaces&&(h=t.namespaces,y=t.enabled(a)),y),set:M=>{k=M}}),typeof t.init=="function"&&t.init(E),E}function n(a,i){const h=t(this.namespace+(i===void 0?":":i)+a);return h.log=this.log,h}function r(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(a){return a instanceof Error?a.stack||a.message:a},t.disable=function(){const a=[...t.names.map(r),...t.skips.map(r).map(i=>"-"+i)].join(",");return t.enable(""),a},t.enable=function(a){let i;t.save(a),t.namespaces=a,t.names=[],t.skips=[];const h=(typeof a=="string"?a:"").split(/[\s,]+/),y=h.length;for(i=0;i=1.5*C;return Math.round(E/C)+" "+O+(z?"s":"")}return lN=function(E,M){M=M||{};var C=typeof E;if(C==="string"&&E.length>0)return function(O){if(!((O=String(O)).length>100)){var z=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(O);if(z){var H=parseFloat(z[1]);switch((z[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*H;case"weeks":case"week":case"w":return 6048e5*H;case"days":case"day":case"d":return H*y;case"hours":case"hour":case"hrs":case"hr":case"h":return H*h;case"minutes":case"minute":case"mins":case"min":case"m":return H*i;case"seconds":case"second":case"secs":case"sec":case"s":return H*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return H;default:return}}}}(E);if(C==="number"&&isFinite(E))return M.long?function(O){var z=Math.abs(O);return z>=y?k(O,z,y,"day"):z>=h?k(O,z,h,"hour"):z>=i?k(O,z,i,"minute"):z>=a?k(O,z,a,"second"):O+" ms"}(E):function(O){var z=Math.abs(O);return z>=y?Math.round(O/y)+"d":z>=h?Math.round(O/h)+"h":z>=i?Math.round(O/i)+"m":z>=a?Math.round(O/a)+"s":O+"ms"}(E);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(E))}}(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(a=>{t[a]=e[a]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(a){let i=0;for(let h=0;h{y!=="%%"&&(i++,y==="%c"&&(h=i))}),r.splice(h,0,a)},t.save=function(r){try{r?t.storage.setItem("debug",r):t.storage.removeItem("debug")}catch{}},t.load=function(){let r;try{r=t.storage.getItem("debug")}catch{}return!r&&B5!==void 0&&"env"in B5&&(r=B5.env.DEBUG),r},t.useColors=function(){return!(typeof window>"u"||!window.process||window.process.type!=="renderer"&&!window.process.__nwjs)||(typeof navigator>"u"||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch{}}(),t.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=gX(t);const{formatters:n}=e.exports;n.j=function(r){try{return JSON.stringify(r)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}}})(z5,z5.exports);var gf=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(z5.exports);const fN=gf("KeyExchange:Layer"),dN=gf("SocketService:Layer"),hN=gf("Ecies:Layer"),pN=gf("RemoteCommunication:Layer");fN.color="##95c44e",dN.color="#f638d7",hN.color="#465b9c",pN.color="#47a2be";const ct={KeyExchange:fN,SocketService:dN,Ecies:hN,RemoteCommunication:pN};let Py,n7=[],F5=[];function vX(e){return ir(this,void 0,void 0,function*(){if(!Py||!e)return;(function(){const a=F5;F5=n7,n7=a})();const t=Py.endsWith("/")?`${Py}evt`:`${Py}/evt`,n=Object.assign({},e);if(delete n.params,e.params)for(const[a,i]of Object.entries(e.params))n[a]=i;const r=JSON.stringify(n);ct.RemoteCommunication(`[sendBufferedEvents] Sending ${n7.length} analytics events to ${t}`);try{const a=yield ie(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r}),i=yield a.text();ct.RemoteCommunication(`[sendBufferedEvents] Response: ${i}`),n7.length=0}catch(a){console.warn("Error sending analytics",a)}})}const Sd=(e,t)=>ir(void 0,void 0,void 0,function*(){var n;Py=t,n=e,F5.push(n),vX(e).catch(()=>{})});var vf=[],Xu=[],yX=typeof Uint8Array<"u"?Uint8Array:Array,j5=!1;function mN(){j5=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)vf[t]=e[t],Xu[e.charCodeAt(t)]=t;Xu[45]=62,Xu[95]=63}function bX(e,t,n){for(var r,a,i=[],h=t;h>18&63]+vf[a>>12&63]+vf[a>>6&63]+vf[63&a]);return i.join("")}function gN(e){var t;j5||mN();for(var n=e.length,r=n%3,a="",i=[],h=16383,y=0,k=n-r;yk?k:y+h));return r===1?(t=e[n-1],a+=vf[t>>2],a+=vf[t<<4&63],a+="=="):r===2&&(t=(e[n-2]<<8)+e[n-1],a+=vf[t>>10],a+=vf[t>>4&63],a+=vf[t<<2&63],a+="="),i.push(a),i.join("")}function r7(e,t,n,r,a){var i,h,y=8*a-r-1,k=(1<>1,M=-7,C=n?a-1:0,O=n?-1:1,z=e[t+C];for(C+=O,i=z&(1<<-M)-1,z>>=-M,M+=y;M>0;i=256*i+e[t+C],C+=O,M-=8);for(h=i&(1<<-M)-1,i>>=-M,M+=r;M>0;h=256*h+e[t+C],C+=O,M-=8);if(i===0)i=1-E;else{if(i===k)return h?NaN:1/0*(z?-1:1);h+=Math.pow(2,r),i-=E}return(z?-1:1)*h*Math.pow(2,i-r)}function vN(e,t,n,r,a,i){var h,y,k,E=8*i-a-1,M=(1<>1,O=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=r?0:i-1,H=r?1:-1,ee=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(y=isNaN(t)?1:0,h=M):(h=Math.floor(Math.log(t)/Math.LN2),t*(k=Math.pow(2,-h))<1&&(h--,k*=2),(t+=h+C>=1?O/k:O*Math.pow(2,1-C))*k>=2&&(h++,k/=2),h+C>=M?(y=0,h=M):h+C>=1?(y=(t*k-1)*Math.pow(2,a),h+=C):(y=t*Math.pow(2,C-1)*Math.pow(2,a),h=0));a>=8;e[n+z]=255&y,z+=H,y/=256,a-=8);for(h=h<0;e[n+z]=255&h,z+=H,h/=256,E-=8);e[n+z-H]|=128*ee}var wX={}.toString,yN=Array.isArray||function(e){return wX.call(e)=="[object Array]"};function i7(){return zt.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ed(e,t){if(i7()=i7())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i7().toString(16)+" bytes");return 0|e}function yf(e){return!(e==null||!e._isBuffer)}function _N(e,t){if(yf(e))return e.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;typeof e!="string"&&(e=""+e);var n=e.length;if(n===0)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return s7(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return RN(e).length;default:if(r)return s7(e).length;t=(""+t).toLowerCase(),r=!0}}function _X(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return RX(this,t,n);case"utf8":case"utf-8":return MN(this,t,n);case"ascii":return AX(this,t,n);case"latin1":case"binary":return TX(this,t,n);case"base64":return xX(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return PX(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function a1(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function SN(e,t,n,r,a){if(e.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=a?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(a)return-1;n=e.length-1}else if(n<0){if(!a)return-1;n=0}if(typeof t=="string"&&(t=zt.from(t,r)),yf(t))return t.length===0?-1:EN(e,t,n,r,a);if(typeof t=="number")return t&=255,zt.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):EN(e,[t],n,r,a);throw new TypeError("val must be string, number or Buffer")}function EN(e,t,n,r,a){var i,h=1,y=e.length,k=t.length;if(r!==void 0&&((r=String(r).toLowerCase())==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(e.length<2||t.length<2)return-1;h=2,y/=2,k/=2,n/=2}function E(z,H){return h===1?z[H]:z.readUInt16BE(H*h)}if(a){var M=-1;for(i=n;iy&&(n=y-k),i=n;i>=0;i--){for(var C=!0,O=0;Oa&&(r=a):r=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var h=0;h>8,k=h%256,E.push(k),E.push(y);return E}(t,e.length-n),e,n,r)}function xX(e,t,n){return t===0&&n===e.length?gN(e):gN(e.slice(t,n))}function MN(e,t,n){n=Math.min(e.length,n);for(var r=[],a=t;a239?4:E>223?3:E>191?2:1;if(a+C<=n)switch(C){case 1:E<128&&(M=E);break;case 2:(192&(i=e[a+1]))==128&&(k=(31&E)<<6|63&i)>127&&(M=k);break;case 3:i=e[a+1],h=e[a+2],(192&i)==128&&(192&h)==128&&(k=(15&E)<<12|(63&i)<<6|63&h)>2047&&(k<55296||k>57343)&&(M=k);break;case 4:i=e[a+1],h=e[a+2],y=e[a+3],(192&i)==128&&(192&h)==128&&(192&y)==128&&(k=(15&E)<<18|(63&i)<<12|(63&h)<<6|63&y)>65535&&k<1114112&&(M=k)}M===null?(M=65533,C=1):M>65535&&(M-=65536,r.push(M>>>10&1023|55296),M=56320|1023&M),r.push(M),a+=C}return function(O){var z=O.length;if(z<=CN)return String.fromCharCode.apply(String,O);for(var H="",ee=0;ee0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},zt.prototype.compare=function(e,t,n,r,a){if(!yf(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),a===void 0&&(a=this.length),t<0||n>e.length||r<0||a>this.length)throw new RangeError("out of range index");if(r>=a&&t>=n)return 0;if(r>=a)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(a>>>=0)-(r>>>=0),h=(n>>>=0)-(t>>>=0),y=Math.min(i,h),k=this.slice(r,a),E=e.slice(t,n),M=0;Ma)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return SX(this,e,t,n);case"utf8":case"utf-8":return EX(this,e,t,n);case"ascii":return kN(this,e,t,n);case"latin1":case"binary":return kX(this,e,t,n);case"base64":return MX(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return CX(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},zt.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var CN=4096;function AX(e,t,n){var r="";n=Math.min(e.length,n);for(var a=t;ar)&&(n=r);for(var a="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function Is(e,t,n,r,a,i){if(!yf(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function o7(e,t,n,r){t<0&&(t=65535+t+1);for(var a=0,i=Math.min(e.length-n,2);a>>8*(r?a:1-a)}function a7(e,t,n,r){t<0&&(t=4294967295+t+1);for(var a=0,i=Math.min(e.length-n,4);a>>8*(r?a:3-a)&255}function xN(e,t,n,r,a,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function AN(e,t,n,r,a){return a||xN(e,0,n,4),vN(e,t,n,r,23,4),n+4}function TN(e,t,n,r,a){return a||xN(e,0,n,8),vN(e,t,n,r,52,8),n+8}zt.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=t===void 0?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(a*=256);)r+=this[e+--t]*a;return r},zt.prototype.readUInt8=function(e,t){return t||Yo(e,1,this.length),this[e]},zt.prototype.readUInt16LE=function(e,t){return t||Yo(e,2,this.length),this[e]|this[e+1]<<8},zt.prototype.readUInt16BE=function(e,t){return t||Yo(e,2,this.length),this[e]<<8|this[e+1]},zt.prototype.readUInt32LE=function(e,t){return t||Yo(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},zt.prototype.readUInt32BE=function(e,t){return t||Yo(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},zt.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Yo(e,t,this.length);for(var r=this[e],a=1,i=0;++i=(a*=128)&&(r-=Math.pow(2,8*t)),r},zt.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Yo(e,t,this.length);for(var r=t,a=1,i=this[e+--r];r>0&&(a*=256);)i+=this[e+--r]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},zt.prototype.readInt8=function(e,t){return t||Yo(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},zt.prototype.readInt16LE=function(e,t){t||Yo(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},zt.prototype.readInt16BE=function(e,t){t||Yo(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},zt.prototype.readInt32LE=function(e,t){return t||Yo(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},zt.prototype.readInt32BE=function(e,t){return t||Yo(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},zt.prototype.readFloatLE=function(e,t){return t||Yo(e,4,this.length),r7(this,e,!0,23,4)},zt.prototype.readFloatBE=function(e,t){return t||Yo(e,4,this.length),r7(this,e,!1,23,4)},zt.prototype.readDoubleLE=function(e,t){return t||Yo(e,8,this.length),r7(this,e,!0,52,8)},zt.prototype.readDoubleBE=function(e,t){return t||Yo(e,8,this.length),r7(this,e,!1,52,8)},zt.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||Is(this,e,t,n,Math.pow(2,8*n)-1,0);var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+n},zt.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,1,255,0),zt.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},zt.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,2,65535,0),zt.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):o7(this,e,t,!0),t+2},zt.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,2,65535,0),zt.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):o7(this,e,t,!1),t+2},zt.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,4,4294967295,0),zt.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):a7(this,e,t,!0),t+4},zt.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,4,4294967295,0),zt.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):a7(this,e,t,!1),t+4},zt.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Is(this,e,t,n,a-1,-a)}var i=0,h=1,y=0;for(this[t]=255&e;++i>0)-y&255;return t+n},zt.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var a=Math.pow(2,8*n-1);Is(this,e,t,n,a-1,-a)}var i=n-1,h=1,y=0;for(this[t+i]=255&e;--i>=0&&(h*=256);)e<0&&y===0&&this[t+i+1]!==0&&(y=1),this[t+i]=(e/h>>0)-y&255;return t+n},zt.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,1,127,-128),zt.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},zt.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,2,32767,-32768),zt.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):o7(this,e,t,!0),t+2},zt.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,2,32767,-32768),zt.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):o7(this,e,t,!1),t+2},zt.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,4,2147483647,-2147483648),zt.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):a7(this,e,t,!0),t+4},zt.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Is(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),zt.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):a7(this,e,t,!1),t+4},zt.prototype.writeFloatLE=function(e,t,n){return AN(this,e,t,!0,n)},zt.prototype.writeFloatBE=function(e,t,n){return AN(this,e,t,!1,n)},zt.prototype.writeDoubleLE=function(e,t,n){return TN(this,e,t,!0,n)},zt.prototype.writeDoubleBE=function(e,t,n){return TN(this,e,t,!1,n)},zt.prototype.copy=function(e,t,n,r){if(n||(n=0),r||r===0||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--a)e[a+t]=this[a+n];else if(i<1e3||!zt.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,n=n===void 0?this.length:n>>>0,e||(e=0),typeof e=="number")for(i=t;i55295&&n<57344){if(!a){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(h+1===r){(t-=3)>-1&&i.push(239,191,189);continue}a=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),a=n;continue}n=65536+(a-55296<<10|n-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function RN(e){return function(t){var n,r,a,i,h,y;j5||mN();var k=t.length;if(k%4>0)throw new Error("Invalid string. Length must be a multiple of 4");h=t[k-2]==="="?2:t[k-1]==="="?1:0,y=new yX(3*k/4-h),a=h>0?k-4:k;var E=0;for(n=0,r=0;n>16&255,y[E++]=i>>8&255,y[E++]=255&i;return h===2?(i=Xu[t.charCodeAt(n)]<<2|Xu[t.charCodeAt(n+1)]>>4,y[E++]=255&i):h===1&&(i=Xu[t.charCodeAt(n)]<<10|Xu[t.charCodeAt(n+1)]<<4|Xu[t.charCodeAt(n+2)]>>2,y[E++]=i>>8&255,y[E++]=255&i),y}(function(t){if((t=function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}(t).replace(IX,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(e))}function u7(e,t,n,r){for(var a=0;a=t.length||a>=e.length);++a)t[a+n]=e[a];return a}function PN(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}class $5{constructor(t){this.enabled=!0,t!=null&&t.debug&&gf.enable("Ecies:Layer"),t!=null&&t.privateKey?this.ecies=Fo.PrivateKey.fromHex(t.privateKey):this.ecies=new Fo.PrivateKey,ct.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),ct.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),ct.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new Fo.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(t,n){let r=t;if(this.enabled)try{ct.Ecies("[ECIES: encrypt()] using otherPublicKey",n);const a=zt.from(t),i=Fo.encrypt(n,a);r=zt.from(i).toString("base64")}catch(a){throw ct.Ecies("[ECIES: encrypt()] error encrypt:",a),ct.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),ct.Ecies("[ECIES: encrypt()] data: ",t),ct.Ecies("[ECIES: encrypt()] otherkey: ",n),a}return r}decrypt(t){let n=t;if(this.enabled)try{ct.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const r=zt.from(t.toString(),"base64");n=Fo.decrypt(this.ecies.toHex(),r).toString()}catch(r){throw ct.Ecies("[ECIES: decrypt()] error decrypt",r),ct.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),ct.Ecies("[ECIES: decrypt()] encryptedData: ",t),r}return n}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){ct.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var Gh={name:"@metamask/sdk-communication-layer",version:"0.30.0",description:"",homepage:"https://github.com/MetaMask/metamask-sdk#readme",bugs:{url:"https://github.com/MetaMask/metamask-sdk/issues"},repository:{type:"git",url:"https://github.com/MetaMask/metamask-sdk.git",directory:"packages/sdk-communication-layer"},main:"dist/node/cjs/metamask-sdk-communication-layer.js",unpkg:"dist/browser/umd/metamask-sdk-communication-layer.js",module:"dist/node/es/metamask-sdk-communication-layer.js",browser:"dist/browser/es/metamask-sdk-communication-layer.js","react-native":"dist/react-native/es/metamask-sdk-communication-layer.js",types:"dist/browser/es/src/index.d.ts",files:["/dist"],scripts:{build:"rimraf dist && rollup -c --bundleConfigAsCjs","build:tsc":"tsc","build:dev":"rimraf dist && NODE_ENV=dev rollup -c --bundleConfigAsCjs","build:post-tsc":"echo 'N/A'","build:pre-tsc":"echo 'N/A'",size:"size-limit",clean:"rimraf ./dist",lint:"yarn lint:eslint && yarn lint:misc --check","lint:changelog":"../../scripts/validate-changelog.sh @metamask/sdk-communication-layer","lint:eslint":"eslint . --cache --ext js,ts","lint:fix":"yarn lint:eslint --fix && yarn lint:misc --write","lint:misc":"prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore","publish:preview":"yarn npm publish --tag preview",prepack:"../../scripts/prepack.sh",reset:"yarn clean && rimraf ./node_modules/",test:'jest --testPathIgnorePatterns "/e2e/"',"test:e2e":'jest --testPathPattern "/e2e/"',"test:coverage":"jest --coverage","test:ci":'jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js --testPathIgnorePatterns "/e2e/"',"test:dev":"jest",watch:"rollup -c --bundleConfigAsCjs -w"},dependencies:{bufferutil:"^4.0.8","date-fns":"^2.29.3",debug:"^4.3.4","utf-8-validate":"^5.0.2",uuid:"^8.3.2"},devDependencies:{"@jest/globals":"^29.3.1","@lavamoat/allow-scripts":"^2.3.1","@metamask/auto-changelog":"3.1.0","@metamask/eslint-config":"^6.0.0","@metamask/eslint-config-nodejs":"^6.0.0","@metamask/eslint-config-typescript":"^6.0.0","@rollup/plugin-commonjs":"^25.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-terser":"^0.4.1","@size-limit/preset-big-lib":"^11.0.2","@types/jest":"^29.2.4","@types/node":"^20.1.3","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0","cross-fetch":"^4.0.0",eciesjs:"^0.3.16",eslint:"^7.30.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","eslint-plugin-jest":"^24.4.0","eslint-plugin-jsdoc":"^36.1.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^3.4.0",eventemitter2:"^6.4.7",jest:"^29.3.1",prettier:"^2.3.0",rimraf:"^3.0.2",rollup:"^3.21.7","rollup-plugin-jscc":"^2.0.0","rollup-plugin-natives":"^0.7.5","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-node-globals":"^1.4.0","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-sizes":"^1.0.6","rollup-plugin-typescript2":"^0.31.2","rollup-plugin-visualizer":"^5.9.2","size-limit":"^11.0.2","socket.io-client":"^4.5.1","stream-browserify":"^3.0.0","ts-jest":"^29.0.3","ts-node":"^10.9.1",typescript:"^4.3.2"},peerDependencies:{"cross-fetch":"^4.0.0",eciesjs:"^0.3.16",eventemitter2:"^6.4.7","readable-stream":"^3.6.2","socket.io-client":"^4.5.1"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},lavamoat:{allowScripts:{"@lavamoat/preinstall-always-fail":!1,canvas:!0,"eciesjs>secp256k1":!1,"socket.io-client>engine.io-client>ws>bufferutil":!1,"socket.io-client>engine.io-client>ws>utf-8-validate":!1,bufferutil:!1,"utf-8-validate":!1}}};const s1="https://metamask-sdk.api.cx.metamask.io/",OX=["websocket"],A2=6048e5,NX=3e3,DX={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",ETH_REQUESTACCOUNTS:"eth_requestAccounts"};function IN(e){const{context:t}=e;ct.RemoteCommunication(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}var l7,ni,ho;o.ConnectionStatus=void 0,o.EventType=void 0,o.MessageType=void 0,function(e){e.DISCONNECTED="disconnected",e.WAITING="waiting",e.TIMEOUT="timeout",e.LINKED="linked",e.PAUSED="paused",e.TERMINATED="terminated"}(o.ConnectionStatus||(o.ConnectionStatus={})),function(e){e.KEY_INFO="key_info",e.SERVICE_STATUS="service_status",e.PROVIDER_UPDATE="provider_update",e.RPC_UPDATE="rpc_update",e.KEYS_EXCHANGED="keys_exchanged",e.JOIN_CHANNEL="join_channel",e.PUBLIC_KEY="public_key",e.CHANNEL_CREATED="channel_created",e.CLIENTS_CONNECTED="clients_connected",e.CLIENTS_DISCONNECTED="clients_disconnected",e.CLIENTS_WAITING="clients_waiting",e.CLIENTS_READY="clients_ready",e.REJECTED="rejected",e.WALLET_INIT="wallet_init",e.CHANNEL_PERSISTENCE="channel_persistence",e.CONFIG="config",e.MESSAGE_ACK="ack",e.SOCKET_DISCONNECTED="socket_disconnected",e.SOCKET_RECONNECT="socket_reconnect",e.OTP="otp",e.SDK_RPC_CALL="sdk_rpc_call",e.AUTHORIZED="authorized",e.CONNECTION_STATUS="connection_status",e.MESSAGE="message",e.TERMINATE="terminate"}(o.EventType||(o.EventType={})),function(e){e.KEY_EXCHANGE="key_exchange"}(l7||(l7={})),function(e){e.KEY_HANDSHAKE_START="key_handshake_start",e.KEY_HANDSHAKE_CHECK="key_handshake_check",e.KEY_HANDSHAKE_SYN="key_handshake_SYN",e.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",e.KEY_HANDSHAKE_ACK="key_handshake_ACK",e.KEY_HANDSHAKE_WALLET="key_handshake_wallet",e.KEY_HANDSHAKE_NONE="none"}(ni||(ni={}));class BX extends _5.EventEmitter2{constructor({communicationLayer:t,otherPublicKey:n,context:r,ecies:a,logging:i}){super(),this.keysExchanged=!1,this.step=ni.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=r,this.communicationLayer=t,a!=null&&a.privateKey&&n&&(ct.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${n} set keysExchanged to true!`,a),this.keysExchanged=!0),this.myECIES=new $5(Object.assign(Object.assign({},a),{debug:i==null?void 0:i.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=(i==null?void 0:i.keyExchangeLayer)===!0,n&&this.setOtherPublicKey(n),this.communicationLayer.on(l7.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(t){const{relayPersistence:n}=this.communicationLayer.remote.state;if(ct.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,t),n)return void ct.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:r}=t;this.keysExchanged&&ct.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(o.EventType.KEY_INFO,r.type),r.type===ni.KEY_HANDSHAKE_SYN?(this.checkStep([ni.KEY_HANDSHAKE_NONE,ni.KEY_HANDSHAKE_ACK]),ct.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",r),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:ni.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(a=>{ct.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",a)}),this.setStep(ni.KEY_HANDSHAKE_ACK)):r.type===ni.KEY_HANDSHAKE_SYNACK?(this.checkStep([ni.KEY_HANDSHAKE_SYNACK,ni.KEY_HANDSHAKE_ACK,ni.KEY_HANDSHAKE_NONE]),ct.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:ni.KEY_HANDSHAKE_ACK}).catch(a=>{ct.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",a)}),this.keysExchanged=!0,this.setStep(ni.KEY_HANDSHAKE_ACK),this.emit(o.EventType.KEYS_EXCHANGED)):r.type===ni.KEY_HANDSHAKE_ACK&&(ct.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([ni.KEY_HANDSHAKE_ACK,ni.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(ni.KEY_HANDSHAKE_ACK),this.emit(o.EventType.KEYS_EXCHANGED))}resetKeys(t){this.clean(),this.myECIES=new $5(t)}clean(){ct.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(ni.KEY_HANDSHAKE_NONE),this.emit(o.EventType.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:t,force:n}){const{relayPersistence:r,protocolVersion:a}=this.communicationLayer.remote.state,i=a>=2;if(r)return ct.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"),void console.log(`[KeyExchange: start()] relayPersistence=${r}`);ct.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${a} isOriginator=${t} step=${this.step} force=${n} relayPersistence=${r} keysExchanged=${this.keysExchanged}`),t?!(this.keysExchanged||this.step!==ni.KEY_HANDSHAKE_NONE&&this.step!==ni.KEY_HANDSHAKE_SYNACK)||n?(ct.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${n}) -- step=${this.step}`,this.step),this.clean(),this.setStep(ni.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:ni.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(h=>{ct.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",h)})):ct.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&n!==!0?ct.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):i?this.communicationLayer.sendMessage({type:ni.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(h=>{ct.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",h)}):(this.communicationLayer.sendMessage({type:ni.KEY_HANDSHAKE_START}).catch(h=>{ct.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",h)}),this.clean())}setStep(t){this.step=t,this.emit(o.EventType.KEY_INFO,t)}checkStep(t){t.length>0&&t.indexOf(this.step.toString())===-1&&console.warn(`[KeyExchange: checkStep()] Wrong Step "${this.step}" not within ${t}`)}setRelayPersistence({localKey:t,otherKey:n}){this.otherPublicKey=n,this.myECIES=new $5({privateKey:t,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(t){this.keysExchanged=t}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(t){ct.KeyExchange("[KeyExchange: setOtherPubKey()]",t),this.otherPublicKey=t}encryptMessage(t){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(t,this.otherPublicKey)}decryptMessage(t){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(t)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const t={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(t)}}(function(e){e.TERMINATE="terminate",e.ANSWER="answer",e.OFFER="offer",e.CANDIDATE="candidate",e.JSONRPC="jsonrpc",e.WALLET_INFO="wallet_info",e.WALLET_INIT="wallet_init",e.ORIGINATOR_INFO="originator_info",e.PAUSE="pause",e.OTP="otp",e.AUTHORIZED="authorized",e.PING="ping",e.READY="ready"})(o.MessageType||(o.MessageType={})),function(e){e.REQUEST="sdk_connect_request_started",e.REQUEST_MOBILE="sdk_connect_request_started_mobile",e.RECONNECT="sdk_reconnect_request_started",e.CONNECTED="sdk_connection_established",e.CONNECTED_MOBILE="sdk_connection_established_mobile",e.AUTHORIZED="sdk_connection_authorized",e.REJECTED="sdk_connection_rejected",e.TERMINATED="sdk_connection_terminated",e.DISCONNECTED="sdk_disconnected",e.SDK_USE_EXTENSION="sdk_use_extension",e.SDK_RPC_REQUEST="sdk_rpc_request",e.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",e.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",e.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",e.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(ho||(ho={}));const c7=(e,t,n)=>ir(void 0,void 0,void 0,function*(){var r,a,i,h,y,k;const{remote:E,state:M}=e,{channelId:C,isOriginator:O}=M;if(t==="error_terminated")return ct.SocketService(`handleJoinChannelResults: Channel ${C} terminated`),void e.emit(o.EventType.TERMINATE);if(!n)return void ct.SocketService(`handleJoinChannelResults: No result for channel ${C}`);const{persistence:z,walletKey:H,rejected:ee}=n;if(ct.SocketService(`handleJoinChannelResults: Channel ${C} persistence=${z} walletKey=${H} rejected=${ee}`),ee)return ct.SocketService(`handleJoinChannelResults: Channel ${C} rejected`),yield e.remote.disconnect({terminate:!0}),e.remote.emit(o.EventType.REJECTED,{channelId:C}),void e.remote.emitServiceStatusEvent();if(H&&!(!((r=E.state.channelConfig)===null||r===void 0)&&r.otherKey)){e.getKeyExchange().setOtherPublicKey(H),(a=e.state.keyExchange)===null||a===void 0||a.setKeysExchanged(!0),E.state.ready=!0,E.state.authorized=!0,E.emit(o.EventType.AUTHORIZED);const{communicationLayer:te,storageManager:se}=E.state,oe=Object.assign(Object.assign({},E.state.channelConfig),{channelId:(i=E.state.channelId)!==null&&i!==void 0?i:"",validUntil:Date.now()+A2,localKey:te==null?void 0:te.getKeyInfo().ecies.private,otherKey:H});e.sendMessage({type:ni.KEY_HANDSHAKE_ACK}).catch(Ee=>{console.error(Ee)}),(h=e.state.socket)===null||h===void 0||h.emit(o.MessageType.PING,{id:C,clientType:O?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield se==null?void 0:se.persistChannelConfig(oe),E.emitServiceStatusEvent(),E.setConnectionStatus(o.ConnectionStatus.LINKED)}z&&(e.emit(o.EventType.CHANNEL_PERSISTENCE),(y=e.state.keyExchange)===null||y===void 0||y.setKeysExchanged(!0),E.state.ready=!0,E.state.authorized=!0,E.emit(o.EventType.AUTHORIZED),Sd(Object.assign(Object.assign({id:C??"",event:O?ho.CONNECTED:ho.CONNECTED_MOBILE},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:Gh.version,walletVersion:(k=e.remote.state.walletInfo)===null||k===void 0?void 0:k.version}),M.communicationServerUrl).catch(te=>{console.error("Cannot send analytics",te)}))}),T2=e=>new Promise(t=>{setTimeout(t,e)}),LN=(e,t,n=200)=>ir(void 0,void 0,void 0,function*(){let r;const a=Date.now();let i=!1;for(;!i;){if(i=Date.now()-a>3e5,r=t[e],r.elapsedTime!==void 0)return r;yield T2(n)}throw new Error(`RPC ${e} timed out`)}),q5=e=>ir(void 0,void 0,void 0,function*(){const{state:t}=e,{socket:n,channelId:r,context:a,isOriginator:i,isReconnecting:h}=t;if(h)return ct.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",e),!1;if(!n)return ct.SocketService("[SocketService: reconnectSocket()] socket is not defined",e),!1;if(!r)return!1;const{connected:y}=n;t.isReconnecting=!0,t.reconnectionAttempts=0,ct.SocketService(`[SocketService: reconnectSocket()] connected=${y} trying to reconnect after socketio disconnection`,e);try{for(;t.reconnectionAttempts<3;){if(ct.SocketService(`[SocketService: reconnectSocket()] Attempt ${t.reconnectionAttempts+1} of 3`,e),yield T2(200),n.connected)return ct.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(o.MessageType.PING,{id:r,clientType:i?"dapp":"wallet",context:"on_channel_config",message:""}),!0;t.resumed=!0,n.connect(),e.emit(o.EventType.SOCKET_RECONNECT);try{if(yield new Promise((k,E)=>{n.emit(o.EventType.JOIN_CHANNEL,{channelId:r,context:`${a}connect_again`,clientType:i?"dapp":"wallet"},(M,C)=>ir(void 0,void 0,void 0,function*(){try{yield c7(e,M,C),k()}catch(O){E(O)}}))}),yield T2(100),n.connected)return ct.SocketService(`Reconnection successful on attempt ${t.reconnectionAttempts+1}`),!0}catch(k){ct.SocketService(`Error during reconnection attempt ${t.reconnectionAttempts+1}:`,k)}t.reconnectionAttempts+=1,t.reconnectionAttempts<3&&(yield T2(200))}return ct.SocketService("Failed to reconnect after 3 attempts"),!1}finally{t.isReconnecting=!1,t.reconnectionAttempts=0}});function ON(e,t){var n;return ir(this,void 0,void 0,function*(){const r=(n=e.state.keyExchange)===null||n===void 0?void 0:n.encryptMessage(JSON.stringify(t)),a={id:e.state.channelId,context:e.state.context,clientType:e.state.isOriginator?"dapp":"wallet",message:r,plaintext:e.state.hasPlaintext?JSON.stringify(t):void 0};return ct.SocketService(`[SocketService: encryptAndSendMessage()] context=${e.state.context}`,a),t.type===o.MessageType.TERMINATE&&(e.state.manualDisconnect=!0),new Promise((i,h)=>{var y;(y=e.state.socket)===null||y===void 0||y.emit(o.EventType.MESSAGE,a,(k,E)=>{var M;k&&(ct.SocketService(`[SocketService: encryptAndSendMessage()] error=${k}`),h(k)),ct.SocketService("[encryptAndSendMessage] response",E),i((M=E==null?void 0:E.success)!==null&&M!==void 0&&M)})})})}var R2;(function(e){e.RPC_CHECK="rpcCheck",e.SKIPPED_RPC="skippedRpc"})(R2||(R2={}));const NN=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(e=>e.toLowerCase());function zX(e,t){var n,r,a;return ir(this,void 0,void 0,function*(){if(!e.state.channelId)throw ct.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");if(ct.SocketService(`[SocketService: handleSendMessage()] context=${e.state.context} areKeysExchanged=${(n=e.state.keyExchange)===null||n===void 0?void 0:n.areKeysExchanged()}`,t),(r=t==null?void 0:t.type)===null||r===void 0?void 0:r.startsWith("key_handshake"))return function(h,y){var k;ct.SocketService(`[SocketService: handleKeyHandshake()] context=${h.state.context}`,y),(k=h.state.socket)===null||k===void 0||k.emit(o.EventType.MESSAGE,{id:h.state.channelId,context:h.state.context,clientType:h.state.isOriginator?"dapp":"wallet",message:y})}(e,t),!0;(function(h,y){var k;if(!(!((k=h.state.keyExchange)===null||k===void 0)&&k.areKeysExchanged())&&!h.remote.state.relayPersistence)throw ct.SocketService(`[SocketService: validateKeyExchange()] context=${h.state.context} ERROR keys not exchanged`,y),console.error("[SocketService: validateKeyExchange()] ERROR keys not exchanged",y),new Error("Keys not exchanged BBB")})(e,t),function(h,y){var k;const E=(k=y==null?void 0:y.method)!==null&&k!==void 0?k:"",M=y==null?void 0:y.id;h.state.isOriginator&&M&&(h.state.rpcMethodTracker[M]={id:M,timestamp:Date.now(),method:E},h.emit(o.EventType.RPC_UPDATE,h.state.rpcMethodTracker[M]))}(e,t);const i=yield ON(e,t);return e.remote.state.analytics&&e.remote.state.isOriginator&&t.method&&NN.includes(t.method.toLowerCase())&&Sd({id:(a=e.remote.state.channelId)!==null&&a!==void 0?a:"",event:ho.SDK_RPC_REQUEST,params:{method:t.method,from:"mobile"}},e.remote.state.communicationServerUrl).catch(h=>{console.error("[handleSendMessage] Cannot send analytics",h)}),function(h,y){var k;return ir(this,void 0,void 0,function*(){const E=y==null?void 0:y.id,M=(k=y==null?void 0:y.method)!==null&&k!==void 0?k:"";if(h.state.isOriginator&&E)try{const C=LN(E,h.state.rpcMethodTracker,200).then(H=>({type:R2.RPC_CHECK,result:H})),O=ir(this,void 0,void 0,function*(){const H=yield(({rpcId:te,instance:se})=>ir(void 0,void 0,void 0,function*(){for(;se.state.lastRpcId===te||se.state.lastRpcId===void 0;)yield T2(200);return se.state.lastRpcId}))({instance:h,rpcId:E}),ee=yield LN(H,h.state.rpcMethodTracker,200);return{type:R2.SKIPPED_RPC,result:ee}}),z=yield Promise.race([C,O]);if(z.type===R2.RPC_CHECK){const H=z.result;ct.SocketService(`[SocketService:handleRpcReplies()] id=${y.id} ${M} ( ${H.elapsedTime} ms)`,H.result)}else{if(z.type!==R2.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${E}`);{const{result:H}=z;console.warn(`[SocketService handleRpcReplies()] RPC METHOD HAS BEEN SKIPPED rpcid=${E} method=${M}`,H);const ee=Object.assign(Object.assign({},h.state.rpcMethodTracker[E]),{error:new Error("SDK_CONNECTION_ISSUE")});h.emit(o.EventType.RPC_UPDATE,ee);const te={data:Object.assign(Object.assign({},ee),{jsonrpc:"2.0"}),name:"metamask-provider"};h.emit(o.EventType.MESSAGE,{message:te})}}}catch(C){throw console.warn(`[SocketService handleRpcReplies()] Error rpcId=${y.id} ${M}`,C),C}})}(e,t).catch(h=>{console.warn("[handleSendMessage] Error handleRpcReplies",h)}),i})}const FX=[{event:o.EventType.CLIENTS_CONNECTED,handler:function(e,t){return n=>ir(this,void 0,void 0,function*(){var r,a,i,h,y,k,E,M,C,O,z;const H=(a=(r=e.remote.state.channelConfig)===null||r===void 0?void 0:r.relayPersistence)!==null&&a!==void 0&&a;if(ct.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected-${t}' relayPersistence=${H} resumed=${e.state.resumed} clientsPaused=${e.state.clientsPaused} keysExchanged=${(i=e.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()} isOriginator=${e.state.isOriginator}`),e.emit(o.EventType.CLIENTS_CONNECTED,{isOriginator:e.state.isOriginator,keysExchanged:(h=e.state.keyExchange)===null||h===void 0?void 0:h.areKeysExchanged(),context:e.state.context}),e.state.resumed)e.state.isOriginator||(ct.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} 'clients_connected' / keysExchanged=${(y=e.state.keyExchange)===null||y===void 0?void 0:y.areKeysExchanged()} -- backward compatibility`),(k=e.state.keyExchange)===null||k===void 0||k.start({isOriginator:(E=e.state.isOriginator)!==null&&E!==void 0&&E})),e.state.resumed=!1;else if(e.state.clientsPaused)ct.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!e.state.isOriginator){const ee=!H;ct.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${(M=e.state.keyExchange)===null||M===void 0?void 0:M.areKeysExchanged()} -- force=${ee} -- backward compatibility`),ct.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${(C=e.state.keyExchange)===null||C===void 0?void 0:C.areKeysExchanged()} -- force=${ee} -- backward compatibility`),(O=e.state.keyExchange)===null||O===void 0||O.start({isOriginator:(z=e.state.isOriginator)!==null&&z!==void 0&&z,force:ee})}e.state.clientsConnected=!0,e.state.clientsPaused=!1})}},{event:o.EventType.CHANNEL_CREATED,handler:function(e,t){return n=>{ct.SocketService(`[SocketService: handleChannelCreated()] context=${e.state.context} on 'channel_created-${t}'`,n),e.emit(o.EventType.CHANNEL_CREATED,n)}}},{event:o.EventType.CLIENTS_DISCONNECTED,handler:function(e,t){return()=>{var n;e.state.clientsConnected=!1,ct.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}'`),e.remote.state.relayPersistence?ct.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}' - relayPersistence enabled, skipping key exchange cleanup.`):(e.state.isOriginator&&!e.state.clientsPaused&&((n=e.state.keyExchange)===null||n===void 0||n.clean()),e.emit(o.EventType.CLIENTS_DISCONNECTED,t))}}},{event:o.EventType.CONFIG,handler:function(e,t){return n=>ir(this,void 0,void 0,function*(){var r,a,i;ct.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${t}'`,n);const{persistence:h,walletKey:y}=n;e.state.isOriginator&&e.remote.state.channelConfig?(n.walletKey&&!e.remote.state.channelConfig.otherKey&&(ct.SocketService(`Setting wallet key ${y}`),e.remote.state.channelConfig.otherKey=y,e.getKeyExchange().setOtherPublicKey(n.walletKey),(r=e.state.keyExchange)===null||r===void 0||r.setKeysExchanged(!0),yield e.remote.sendMessage({type:ni.KEY_HANDSHAKE_ACK}),yield e.remote.sendMessage({type:o.MessageType.PING}),yield(a=e.remote.state.storageManager)===null||a===void 0?void 0:a.persistChannelConfig(e.remote.state.channelConfig)),h!==!0||e.remote.state.channelConfig.relayPersistence||(ct.SocketService(`Setting relay persistence ${h}`),e.remote.state.channelConfig.relayPersistence=h,e.remote.state.relayPersistence=!0,e.remote.emit(o.EventType.CHANNEL_PERSISTENCE),e.remote.state.authorized=!0,e.remote.state.ready=!0,e.remote.emit(o.EventType.AUTHORIZED),yield(i=e.remote.state.storageManager)===null||i===void 0?void 0:i.persistChannelConfig(e.remote.state.channelConfig))):e.state.isOriginator||n.persistence&&(e.remote.state.relayPersistence=!0,e.remote.emit(o.EventType.CHANNEL_PERSISTENCE))})}},{event:o.EventType.MESSAGE,handler:function(e,t){return n=>{var r,a,i,h,y,k,E,M,C,O,z,H,ee,te,se,oe,Ee,we;const{ackId:Ce,message:ze,error:Fe}=n,$e=(r=e.remote.state.relayPersistence)!==null&&r!==void 0&&r;if(ct.SocketService(`[SocketService handleMessage()] relayPersistence=${$e} context=${e.state.context} on 'message' ${t} keysExchanged=${(a=e.state.keyExchange)===null||a===void 0?void 0:a.areKeysExchanged()}`,n),Fe)throw ct.SocketService(` + [SocketService handleMessage()] context=${e.state.context}::on 'message' error=${Fe}`),new Error(Fe);const S=typeof ze=="string";if(!S&&(ze==null?void 0:ze.type)===ni.KEY_HANDSHAKE_START)return $e?void console.warn("[SocketService handleMessage()] Ignoring key exchange message because relay persistence is activated",ze):(ct.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,ze),void((i=e.state.keyExchange)===null||i===void 0||i.start({isOriginator:(h=e.state.isOriginator)!==null&&h!==void 0&&h,force:!0})));if(!S&&(!((y=ze==null?void 0:ze.type)===null||y===void 0)&&y.startsWith("key_handshake")))return $e?void console.warn("[SocketService handleMessage()] Ignoring key exchange message because relay persistence is activated",ze):(ct.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' emit KEY_EXCHANGE`,ze),void e.emit(l7.KEY_EXCHANGE,{message:ze,context:e.state.context}));if(S&&!(!((k=e.state.keyExchange)===null||k===void 0)&&k.areKeysExchanged())){let g=!1;try{ct.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' trying to decrypt message`),(E=e.state.keyExchange)===null||E===void 0||E.decryptMessage(ze),g=!0}catch(m){ct.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' error`,m)}if(!g)return e.state.isOriginator?(C=e.state.keyExchange)===null||C===void 0||C.start({isOriginator:(O=e.state.isOriginator)!==null&&O!==void 0&&O}):e.sendMessage({type:ni.KEY_HANDSHAKE_START}).catch(m=>{console.error(`[SocketService handleMessage()] context=${e.state.context}::on 'message' error`,m)}),void ct.SocketService(`Message ignored because invalid key exchange status. step=${(z=e.state.keyExchange)===null||z===void 0?void 0:z.getKeyInfo().step}`,(H=e.state.keyExchange)===null||H===void 0?void 0:H.getKeyInfo(),ze);ct.SocketService("Invalid key exchange status detected --- updating it."),(M=e.state.keyExchange)===null||M===void 0||M.setKeysExchanged(!0)}else if(!S&&(ze!=null&&ze.type))return console.warn("[SocketService handleMessage() ::on 'message' received non encrypted unkwown message"),void e.emit(o.EventType.MESSAGE,ze);if(!S)return console.warn("[SocketService handleMessage() ::on 'message' received unkwown message",ze),void e.emit(o.EventType.MESSAGE,ze);const P=(ee=e.state.keyExchange)===null||ee===void 0?void 0:ee.decryptMessage(ze),d=JSON.parse(P??"{}");if(Ce&&(Ce==null?void 0:Ce.length)>0&&(ct.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' ackid=${Ce} channelId=${t}`),(te=e.state.socket)===null||te===void 0||te.emit(o.EventType.MESSAGE_ACK,{ackId:Ce,channelId:t,clientType:e.state.isOriginator?"dapp":"wallet"})),(d==null?void 0:d.type)===o.MessageType.PAUSE?e.state.clientsPaused=!0:e.state.clientsPaused=!1,e.state.isOriginator&&d.data){const g=d.data,m=e.state.rpcMethodTracker[g.id];if(m){const p=Date.now()-m.timestamp;ct.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received answer for id=${g.id} method=${m.method} responseTime=${p}`,d),e.remote.state.analytics&&NN.includes(m.method.toLowerCase())&&Sd(Object.assign(Object.assign({id:(se=e.remote.state.channelId)!==null&&se!==void 0?se:"",event:ho.SDK_RPC_REQUEST_DONE,sdkVersion:e.remote.state.sdkVersion,commLayerVersion:Gh.version},e.remote.state.originatorInfo),{walletVersion:(oe=e.remote.state.walletInfo)===null||oe===void 0?void 0:oe.version,params:{method:m.method,from:"mobile"}}),e.remote.state.communicationServerUrl).catch(_=>{console.error("Cannot send analytics",_)});const f=Object.assign(Object.assign({},m),{result:g.result,error:g.error?{code:(Ee=g.error)===null||Ee===void 0?void 0:Ee.code,message:(we=g.error)===null||we===void 0?void 0:we.message}:void 0,elapsedTime:p});e.state.rpcMethodTracker[g.id]=f,e.emit(o.EventType.RPC_UPDATE,f)}}e.emit(o.EventType.MESSAGE,{message:d})}}},{event:o.EventType.REJECTED,handler:function(e,t){return n=>ir(this,void 0,void 0,function*(){var r;e.state.isOriginator&&!e.remote.state.ready?(ct.SocketService(`[SocketService: handleChannelRejected()] context=${e.state.context} channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`,e.remote.state.originatorInfo),Sd(Object.assign(Object.assign({id:t,event:ho.REJECTED},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:Gh.version,walletVersion:(r=e.remote.state.walletInfo)===null||r===void 0?void 0:r.version}),e.remote.state.communicationServerUrl).catch(a=>{console.error("handleChannelRejected:: Error emitting analytics event",a)}),yield e.remote.disconnect({terminate:!0}),e.remote.emit(o.EventType.REJECTED,{channelId:t}),e.remote.setConnectionStatus(o.ConnectionStatus.DISCONNECTED)):ct.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`)})}},{event:"clients_waiting_to_join",handler:function(e,t){return n=>{ct.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${e.state.context} on 'clients_waiting_to_join-${t}'`,n),e.emit(o.EventType.CLIENTS_WAITING,n)}}}],jX=[{event:o.EventType.KEY_INFO,handler:function(e){return t=>{ct.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",t),e.emit(o.EventType.KEY_INFO,t)}}},{event:o.EventType.KEYS_EXCHANGED,handler:function(e){return()=>{var t,n,r;ct.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${(t=e.state.keyExchange)===null||t===void 0?void 0:t.areKeysExchanged()}`);const{channelConfig:a}=e.remote.state;if(a){const h=e.getKeyExchange().getKeyInfo().ecies;a.localKey=h.private,a.otherKey=h.otherPubKey,e.remote.state.channelConfig=a,(n=e.remote.state.storageManager)===null||n===void 0||n.persistChannelConfig(a).catch(y=>{console.error("Error persisting channel config",y)})}e.emit(o.EventType.KEYS_EXCHANGED,{keysExchanged:(r=e.state.keyExchange)===null||r===void 0?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});const i={keyInfo:e.getKeyInfo()};e.emit(o.EventType.SERVICE_STATUS,i)}}}];function DN(e,t){ct.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} setting socket listeners for channel ${t}...`);const{socket:n}=e.state,{keyExchange:r}=e.state;n&&e.state.isOriginator&&(e.state.debug&&(n==null||n.io.on("error",a=>{ct.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=error`,a)}),n==null||n.io.on("reconnect",a=>{ct.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect`,a),q5(e).catch(i=>{})}),n==null||n.io.on("reconnect_error",a=>{ct.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_error`,a)}),n==null||n.io.on("reconnect_failed",()=>{ct.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_failed`)})),n==null||n.on("disconnect",a=>(ct.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${a}' begin recovery...`),function(i){return h=>{ct.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${i.state.manualDisconnect}`,h),i.state.manualDisconnect||(i.emit(o.EventType.SOCKET_DISCONNECTED),q5(i).catch(y=>{console.error("SocketService::handleDisconnect Error reconnecting socket",y)}))}}(e)(a)))),FX.forEach(({event:a,handler:i})=>{const h=`${a}-${t}`;n==null||n.on(h,i(e,t))}),jX.forEach(({event:a,handler:i})=>{r==null||r.on(a,i(e))}),e.state.setupChannelListeners=!0}class UX extends _5.EventEmitter2{constructor(t){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=t;const{reconnect:n,communicationLayerPreference:r,communicationServerUrl:a,context:i,remote:h,logging:y}=t;this.state.resumed=n,this.state.context=i,this.state.isOriginator=h.state.isOriginator,this.state.communicationLayerPreference=r,this.state.debug=(y==null?void 0:y.serviceLayer)===!0,this.remote=h,(y==null?void 0:y.serviceLayer)===!0&&gf.enable("SocketService:Layer"),this.state.communicationServerUrl=a,this.state.hasPlaintext=this.state.communicationServerUrl!==s1&&(y==null?void 0:y.plaintext)===!0,ct.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var t;const{otherPublicKey:n,ecies:r,logging:a}=this.options,i={autoConnect:!1,transports:OX,withCredentials:!0},h=this.state.communicationServerUrl;ct.SocketService(`[SocketService: initSocket()] Socket IO url: ${h}`),this.state.socket=e7(h,i),function(k){if(typeof window<"u"&&typeof document<"u"&&(ct.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,k),!k.state.focusListenerAdded)){const E=()=>{ct.SocketService("Document has focus --- reconnecting socket"),q5(k).catch(M=>{console.error("setupSocketFocusListeners Error reconnecting socket",M)})};window.addEventListener("focus",E),k.state.focusListenerAdded=!0,k.state.removeFocusListener=()=>{window.removeEventListener("focus",E),k.state.focusListenerAdded=!1}}}(this);const y={communicationLayer:this,otherPublicKey:n,sendPublicKey:!1,context:(t=this.state.context)!==null&&t!==void 0?t:"",ecies:r,logging:a};this.state.keyExchange=new BX(y)}resetKeys(){return ct.SocketService("[SocketService: resetKeys()] Resetting keys."),void((t=this.state.keyExchange)===null||t===void 0||t.resetKeys());var t}createChannel(){return ir(this,void 0,void 0,function*(){return function(t){var n,r,a;return ir(this,void 0,void 0,function*(){if(ct.SocketService(`[SocketService: createChannel()] context=${t.state.context}`),t.state.socket||t.initSocket(),(n=t.state.socket)===null||n===void 0?void 0:n.connected)throw console.error("[SocketService: createChannel()] socket already connected"),new Error("socket already connected");(r=t.state.socket)===null||r===void 0||r.connect(),t.state.manualDisconnect=!1,t.state.isOriginator=!0;const i=DO();t.state.channelId=i,DN(t,i),yield new Promise((y,k)=>{var E;(E=t.state.socket)===null||E===void 0||E.emit(o.EventType.JOIN_CHANNEL,{channelId:i,context:`${t.state.context}createChannel`,clientType:"dapp"},(M,C)=>ir(this,void 0,void 0,function*(){try{yield c7(t,M,C),y()}catch(O){k(O)}}))});const h=(a=t.state.keyExchange)===null||a===void 0?void 0:a.getKeyInfo();return{channelId:i,pubKey:(h==null?void 0:h.ecies.public)||"",privKey:(h==null?void 0:h.ecies.private)||""}})}(this)})}connectToChannel({channelId:t,withKeyExchange:n=!1,authorized:r}){return function({options:a,instance:i}){return ir(this,void 0,void 0,function*(){const{channelId:h,authorized:y,withKeyExchange:k}=a,{state:E,remote:M}=i,{isOriginator:C=!1,socket:O,keyExchange:z}=E,{channelConfig:H}=M.state;if(O!=null&&O.connected)throw console.error("[SocketService: connectToChannel()] socket already connected"),new Error("socket already connected");if(C&&(H!=null&&H.relayPersistence)){const{localKey:ee,otherKey:te}=H;ee&&te?z==null||z.setRelayPersistence({localKey:ee,otherKey:te}):console.warn("Missing keys in relay persistence",H)}return Object.assign(E,{manualDisconnect:!1,withKeyExchange:k,isOriginator:C,channelId:h}),O==null||O.connect(),DN(i,h),!C&&y&&(z==null||z.setKeysExchanged(!0),Object.assign(M.state,{ready:!0,authorized:!0})),new Promise(ee=>{var te;const se=(te=z==null?void 0:z.getKeyInfo())===null||te===void 0?void 0:te.ecies.public,oe=y&&!C?se:void 0;O==null||O.emit(o.EventType.JOIN_CHANNEL,{channelId:h,context:`${E.context}_connectToChannel`,clientType:C?"dapp":"wallet",publicKey:oe},(Ee,we)=>ir(this,void 0,void 0,function*(){yield c7(i,Ee,we),ee()}))})})}({options:{channelId:t,withKeyExchange:n,authorized:r},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var t,n;(n=(t=this).state.socket)===null||n===void 0||n.emit(o.EventType.MESSAGE,{id:t.state.channelId,context:t.state.context,message:{type:ni.KEY_HANDSHAKE_CHECK,pubkey:t.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(t){return ir(this,void 0,void 0,function*(){return zX(this,t)})}ping(){return function(t){var n,r;return ir(this,void 0,void 0,function*(){ct.SocketService(`[SocketService: ping()] context=${t.state.context} originator=${t.state.isOriginator} keysExchanged=${(n=t.state.keyExchange)===null||n===void 0?void 0:n.areKeysExchanged()}`),(r=t.state.socket)===null||r===void 0||r.emit(o.MessageType.PING,{id:t.state.channelId,context:"ping",clientType:t.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(t){var n,r;return ir(this,void 0,void 0,function*(){ct.SocketService(`[SocketService: pause()] context=${t.state.context}`),t.state.manualDisconnect=!0,!((n=t.state.keyExchange)===null||n===void 0)&&n.areKeysExchanged()&&(yield t.sendMessage({type:o.MessageType.PAUSE})),(r=t.state.socket)===null||r===void 0||r.disconnect()})}(this)}isConnected(){var t;return(t=this.state.socket)===null||t===void 0?void 0:t.connected}resume(){return function(t){return ir(this,void 0,void 0,function*(){const{state:n,remote:r}=t,{socket:a,channelId:i,context:h,keyExchange:y,isOriginator:k}=n,{isOriginator:E}=r.state;if(ct.SocketService(`[SocketService: resume()] channelId=${i} context=${h} connected=${a==null?void 0:a.connected} manualDisconnect=${n.manualDisconnect} resumed=${n.resumed} keysExchanged=${y==null?void 0:y.areKeysExchanged()}`),!i)throw ct.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");a!=null&&a.connected?(ct.SocketService("[SocketService: resume()] already connected."),a.emit(o.MessageType.PING,{id:i,clientType:E?"dapp":"wallet",context:"on_channel_config",message:""}),r.hasRelayPersistence()||y!=null&&y.areKeysExchanged()||(k?yield t.sendMessage({type:o.MessageType.READY}):y==null||y.start({isOriginator:!1}))):(a==null||a.connect(),ct.SocketService(`[SocketService: resume()] after connecting socket --> connected=${a==null?void 0:a.connected}`),a==null||a.emit(o.EventType.JOIN_CHANNEL,{channelId:i,context:`${h}_resume`,clientType:E?"dapp":"wallet"},(M,C)=>ir(this,void 0,void 0,function*(){try{yield c7(t,M,C)}catch(O){console.warn("Error reconnecting to channel",O)}}))),n.manualDisconnect=!1,n.resumed=!0})}(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(t){return function(n,r){var a,i,h,y,k;ct.SocketService(`[SocketService: disconnect()] context=${n.state.context}`,r),r!=null&&r.terminate&&((i=(a=n.state).removeFocusListener)===null||i===void 0||i.call(a),n.state.channelId=r.channelId,(h=n.state.socket)===null||h===void 0||h.removeAllListeners(),(y=n.state.keyExchange)===null||y===void 0||y.clean(),n.remote.state.ready=!1,n.state.socket=void 0,n.state.rpcMethodTracker={}),n.state.manualDisconnect=!0,(k=n.state.socket)===null||k===void 0||k.disconnect()}(this,t)}}var BN;function KX(e){return()=>ir(this,void 0,void 0,function*(){var t,n,r;const{state:a}=e;if(a.authorized)return;yield ir(this,void 0,void 0,function*(){for(;!a.walletInfo;)yield T2(500)});const i="7.3".localeCompare(((t=a.walletInfo)===null||t===void 0?void 0:t.version)||"");if(ct.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${(n=a.walletInfo)===null||n===void 0?void 0:n.version} compareValue=${i}`),i!==1)return;const h=a.platformType===o.PlatformType.MobileWeb||a.platformType===o.PlatformType.ReactNative||a.platformType===o.PlatformType.MetaMaskMobileWebview;ct.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${a.platformType} secure=${h} channel=${a.channelId} walletVersion=${(r=a.walletInfo)===null||r===void 0?void 0:r.version}`),h&&(a.authorized=!0,e.emit(o.EventType.AUTHORIZED))})}function HX(e){return t=>{const{state:n}=e;ct.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${t}`),e.emit(o.EventType.CHANNEL_CREATED,t)}}function $X(e,t){return()=>{var n,r,a,i;const{state:h}=e;if(ct.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${h.channelId} keysExchanged=${(r=(n=h.communicationLayer)===null||n===void 0?void 0:n.getKeyInfo())===null||r===void 0?void 0:r.keysExchanged}`),h.analytics){const y=h.isOriginator?ho.REQUEST:ho.REQUEST_MOBILE;Sd(Object.assign(Object.assign({id:(a=h.channelId)!==null&&a!==void 0?a:"",event:h.reconnection?ho.RECONNECT:y},h.originatorInfo),{commLayer:t,sdkVersion:h.sdkVersion,walletVersion:(i=h.walletInfo)===null||i===void 0?void 0:i.version,commLayerVersion:Gh.version}),h.communicationServerUrl).catch(k=>{console.error("Cannot send analytics",k)})}h.clientsConnected=!0,h.originatorInfoSent=!1,e.emit(o.EventType.CLIENTS_CONNECTED)}}function qX(e){return t=>{const{state:n}=e;ct.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${n.context} on 'clients_disconnected' channelId=${t}`),n.relayPersistence||(n.clientsConnected=!1,n.ready=!1,n.authorized=!1),e.emit(o.EventType.CLIENTS_DISCONNECTED,n.channelId),e.setConnectionStatus(o.ConnectionStatus.DISCONNECTED)}}function WX(e){return t=>{var n;const{state:r}=e;if(ct.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${t} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),e.setConnectionStatus(o.ConnectionStatus.WAITING),e.emit(o.EventType.CLIENTS_WAITING,t),r.originatorConnectStarted){ct.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);const a=((n=r.autoConnectOptions)===null||n===void 0?void 0:n.timeout)||3e3,i=setTimeout(()=>{ct.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${a}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||e.setConnectionStatus(o.ConnectionStatus.TIMEOUT),clearTimeout(i)},a)}}}function VX(e,t){return n=>{var r,a,i,h,y,k,E,M;const{state:C}=e;if(ct.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${C.context} on commLayer.'keys_exchanged' channel=${C.channelId}`,n),(a=(r=C.communicationLayer)===null||r===void 0?void 0:r.getKeyInfo())===null||a===void 0?void 0:a.keysExchanged){const O=Object.assign(Object.assign({},C.channelConfig),{channelId:(i=C.channelId)!==null&&i!==void 0?i:"",validUntil:((h=C.channelConfig)===null||h===void 0?void 0:h.validUntil)||A2,localKey:C.communicationLayer.getKeyInfo().ecies.private,otherKey:C.communicationLayer.getKeyInfo().ecies.otherPubKey});(y=C.storageManager)===null||y===void 0||y.persistChannelConfig(O).catch(z=>{console.error("Error persisting channel config",z)}),e.setConnectionStatus(o.ConnectionStatus.LINKED)}(function(O,z){var H,ee,te,se,oe,Ee,we,Ce;const{state:ze}=O;ct.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${ze.channelId}`,z);const Fe=Object.assign(Object.assign({},ze.channelConfig),{channelId:(H=ze.channelId)!==null&&H!==void 0?H:"",validUntil:(te=(ee=ze.channelConfig)===null||ee===void 0?void 0:ee.validUntil)!==null&&te!==void 0?te:0,relayPersistence:ze.relayPersistence,localKey:(oe=(se=ze.communicationLayer)===null||se===void 0?void 0:se.state.keyExchange)===null||oe===void 0?void 0:oe.getKeyInfo().ecies.private,otherKey:(we=(Ee=ze.communicationLayer)===null||Ee===void 0?void 0:Ee.state.keyExchange)===null||we===void 0?void 0:we.getKeyInfo().ecies.otherPubKey,lastActive:z.getTime()});(Ce=ze.storageManager)===null||Ce===void 0||Ce.persistChannelConfig(Fe)})(e,new Date),C.analytics&&C.channelId&&Sd(Object.assign(Object.assign({id:C.channelId,event:n.isOriginator?ho.CONNECTED:ho.CONNECTED_MOBILE},C.originatorInfo),{sdkVersion:C.sdkVersion,commLayer:t,commLayerVersion:Gh.version,walletVersion:(k=C.walletInfo)===null||k===void 0?void 0:k.version}),C.communicationServerUrl).catch(O=>{console.error("Cannot send analytics",O)}),C.isOriginator=n.isOriginator,n.isOriginator||((E=C.communicationLayer)===null||E===void 0||E.sendMessage({type:o.MessageType.READY}),C.ready=!0,C.paused=!1),n.isOriginator&&!C.originatorInfoSent&&((M=C.communicationLayer)===null||M===void 0||M.sendMessage({type:o.MessageType.ORIGINATOR_INFO,originatorInfo:C.originatorInfo,originator:C.originatorInfo}),C.originatorInfoSent=!0)}}function YX(e){return t=>{let n=t;t.message&&(n=n.message),function(r,a){const{state:i}=a;if(ct.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${i.context} on 'message' typeof=${typeof r}`,r),a.state.ready=!0,i.isOriginator||r.type!==o.MessageType.ORIGINATOR_INFO)if(i.isOriginator&&r.type===o.MessageType.WALLET_INFO)(function(h,y){const{state:k}=h;k.walletInfo=y.walletInfo,k.paused=!1})(a,r);else{if(i.isOriginator&&r.type===o.MessageType.WALLET_INIT)(function(h,y){var k,E,M;return ir(this,void 0,void 0,function*(){const{state:C}=h;if(C.isOriginator){const O=y.data||{};if(typeof O=="object"&&"accounts"in O&&"chainId"in O&&"walletKey"in O)try{const{channelConfig:z}=h.state;if(ct.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(z,null,2)),z){const H=O.accounts,ee=O.chainId,te=O.walletKey;let se,oe=!1;"deeplinkProtocol"in O&&(oe=!!O.deeplinkProtocol,h.state.deeplinkProtocolAvailable=oe),"walletVersion"in O&&(se=O.walletVersion),yield(k=h.state.storageManager)===null||k===void 0?void 0:k.persistChannelConfig(Object.assign(Object.assign({},z),{otherKey:te,walletVersion:se,deeplinkProtocolAvailable:oe,relayPersistence:!0})),yield(E=h.state.storageManager)===null||E===void 0?void 0:E.persistAccounts(H),yield(M=h.state.storageManager)===null||M===void 0?void 0:M.persistChainId(ee)}h.emit(o.EventType.WALLET_INIT,{accounts:O.accounts,chainId:O.chainId})}catch(z){console.error('RemoteCommunication::on "wallet_init" -- error',z)}else console.error('RemoteCommunication::on "wallet_init" -- invalid data format',O)}})})(a,r).catch(h=>{ct.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${h}`)});else if(r.type===o.MessageType.TERMINATE)(function(h){return ir(this,void 0,void 0,function*(){const{state:y}=h;y.isOriginator&&(yield FN({options:{terminate:!0,sendMessage:!1},instance:h}),h.emit(o.EventType.TERMINATE))})})(a).catch(h=>{ct.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${h}`)});else if(r.type===o.MessageType.PAUSE)(function(h){const{state:y}=h;y.paused=!0,h.setConnectionStatus(o.ConnectionStatus.PAUSED)})(a);else if(r.type===o.MessageType.READY&&i.isOriginator)(function(h){const{state:y}=h;h.setConnectionStatus(o.ConnectionStatus.LINKED);const k=y.paused;y.paused=!1,h.emit(o.EventType.CLIENTS_READY,{isOriginator:y.isOriginator,walletInfo:y.walletInfo}),k&&(y.authorized=!0,h.emit(o.EventType.AUTHORIZED))})(a);else{if(r.type===o.MessageType.OTP&&i.isOriginator)return void function(h,y){var k;const{state:E}=h;h.emit(o.EventType.OTP,y.otpAnswer),"6.6".localeCompare(((k=E.walletInfo)===null||k===void 0?void 0:k.version)||"")===1&&(console.warn("RemoteCommunication::on 'otp' -- backward compatibility <6.6 -- triger eth_requestAccounts"),h.emit(o.EventType.SDK_RPC_CALL,{method:DX.ETH_REQUESTACCOUNTS,params:[]}))}(a,r);r.type===o.MessageType.AUTHORIZED&&i.isOriginator&&function(h){const{state:y}=h;y.authorized=!0,h.emit(o.EventType.AUTHORIZED)}(a)}a.emit(o.EventType.MESSAGE,r)}else(function(h,y){var k;const{state:E}=h;(k=E.communicationLayer)===null||k===void 0||k.sendMessage({type:o.MessageType.WALLET_INFO,walletInfo:E.walletInfo}),E.originatorInfo=y.originatorInfo||y.originator,h.emit(o.EventType.CLIENTS_READY,{isOriginator:E.isOriginator,originatorInfo:E.originatorInfo}),E.paused=!1})(a,r)}(n,e)}}function GX(e){return()=>{const{state:t}=e;ct.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),t.ready=!1,t.authorized=!1,IN(t),e.emitServiceStatusEvent({context:"socket_reconnect"})}}function ZX(e){return()=>{const{state:t}=e;ct.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),t.ready=!1}}function QX(e){return()=>ir(this,void 0,void 0,function*(){var t,n,r,a,i,h,y;const{state:k}=e;ct.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${k.context}`),e.state.ready=!0,e.state.clientsConnected=!0,e.state.authorized=!0,e.state.relayPersistence=!0,(t=e.state.communicationLayer)===null||t===void 0||t.getKeyExchange().setKeysExchanged(!0),e.emit(o.EventType.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),e.emit(o.EventType.AUTHORIZED),e.emit(o.EventType.CLIENTS_READY),e.emit(o.EventType.CHANNEL_PERSISTENCE);try{k.channelConfig=Object.assign(Object.assign({},k.channelConfig),{localKey:(n=k.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:(r=k.communicationLayer)===null||r===void 0?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:(a=k.channelId)!==null&&a!==void 0?a:"",validUntil:(h=(i=k.channelConfig)===null||i===void 0?void 0:i.validUntil)!==null&&h!==void 0?h:A2,relayPersistence:!0}),yield(y=k.storageManager)===null||y===void 0?void 0:y.persistChannelConfig(k.channelConfig)}catch(E){console.error("Error persisting channel config",E)}})}function zN({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,ecies:r,communicationServerUrl:a=s1,instance:i}){var h,y,k,E,M,C,O,z,H,ee,te;const{state:se}=i;if(ct.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(se,null,2)),e!==o.CommunicationLayerPreference.SOCKET)throw new Error("Invalid communication protocol");se.communicationLayer=new UX({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,transports:se.transports,communicationServerUrl:a,context:se.context,ecies:r,logging:se.logging,remote:i});let oe=typeof document<"u"&&document.URL||"",Ee=typeof document<"u"&&document.title||"";!((h=se.dappMetadata)===null||h===void 0)&&h.url&&(oe=se.dappMetadata.url),!((y=se.dappMetadata)===null||y===void 0)&&y.name&&(Ee=se.dappMetadata.name);const we=(C=(E=(k=se.dappMetadata)===null||k===void 0?void 0:k.name)!==null&&E!==void 0?E:(M=se.dappMetadata)===null||M===void 0?void 0:M.url)!==null&&C!==void 0?C:"N/A",Ce=typeof window<"u"&&window.location!==void 0&&(O=window.location.hostname)!==null&&O!==void 0?O:we,ze={url:oe,title:Ee,source:(z=se.dappMetadata)===null||z===void 0?void 0:z.source,dappId:Ce,icon:((H=se.dappMetadata)===null||H===void 0?void 0:H.iconUrl)||((ee=se.dappMetadata)===null||ee===void 0?void 0:ee.base64Icon),platform:se.platformType,apiVersion:Gh.version,connector:(te=se.dappMetadata)===null||te===void 0?void 0:te.connector};se.originatorInfo=ze;const Fe={[o.EventType.AUTHORIZED]:KX(i),[o.EventType.MESSAGE]:YX(i),[o.EventType.CHANNEL_PERSISTENCE]:QX(i),[o.EventType.CLIENTS_CONNECTED]:$X(i,e),[o.EventType.KEYS_EXCHANGED]:VX(i,e),[o.EventType.SOCKET_DISCONNECTED]:ZX(i),[o.EventType.SOCKET_RECONNECT]:GX(i),[o.EventType.CLIENTS_DISCONNECTED]:qX(i),[o.EventType.KEY_INFO]:()=>{},[o.EventType.CHANNEL_CREATED]:HX(i),[o.EventType.CLIENTS_WAITING]:WX(i),[o.EventType.RPC_UPDATE]:$e=>{i.emit(o.EventType.RPC_UPDATE,$e)}};for(const[$e,S]of Object.entries(Fe))try{se.communicationLayer.on($e,S)}catch(P){console.error(`Error registering handler for ${$e}:`,P)}}function FN({options:e,instance:t}){return ir(this,void 0,void 0,function*(){const{state:n}=t;return ct.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${n.channelId}`,e),new Promise((r,a)=>{var i,h,y,k,E,M;e!=null&&e.terminate?(t.state.ready&&Sd({id:(i=t.state.channelId)!==null&&i!==void 0?i:"",event:ho.TERMINATED},t.state.communicationServerUrl).catch(C=>{console.error("[handleSendMessage] Cannot send analytics",C)}),n.ready=!1,n.paused=!1,(h=n.storageManager)===null||h===void 0||h.terminate((y=n.channelId)!==null&&y!==void 0?y:""),t.state.terminated=!0,e.sendMessage?!((k=n.communicationLayer)===null||k===void 0)&&k.getKeyInfo().keysExchanged&&t.state.communicationLayer&&ON(t.state.communicationLayer,{type:o.MessageType.TERMINATE}).then(()=>{console.warn("[disconnect] Terminate message sent to the other peer"),r(!0)}).catch(C=>{a(C)}):r(!0),n.authorized=!1,n.relayPersistence=!1,n.channelId=DO(),e.channelId=n.channelId,n.channelConfig=void 0,n.originatorConnectStarted=!1,(E=n.communicationLayer)===null||E===void 0||E.disconnect(e),t.setConnectionStatus(o.ConnectionStatus.TERMINATED)):((M=n.communicationLayer)===null||M===void 0||M.disconnect(e),t.setConnectionStatus(o.ConnectionStatus.DISCONNECTED),r(!0))})})}o.CommunicationLayerPreference=void 0,o.PlatformType=void 0,function(e){e.SOCKET="socket"}(o.CommunicationLayerPreference||(o.CommunicationLayerPreference={})),function(e){e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native"}(o.PlatformType||(o.PlatformType={}));class XX extends _5.EventEmitter2{constructor(t){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:s1,context:"",persist:!1,clientsConnected:!1,sessionDuration:A2,originatorConnectStarted:!1,debug:!1,_connectionStatus:o.ConnectionStatus.DISCONNECTED},this._options=t;const{platformType:n,communicationLayerPreference:r,otherPublicKey:a,reconnect:i,walletInfo:h,dappMetadata:y,protocolVersion:k,transports:E,context:M,relayPersistence:C,ecies:O,analytics:z=!1,storage:H,sdkVersion:ee,communicationServerUrl:te=s1,logging:se,autoConnect:oe={timeout:NX}}=t;this.state.otherPublicKey=a,this.state.dappMetadata=y,this.state.walletInfo=h,this.state.transports=E,this.state.platformType=n,this.state.analytics=z,this.state.protocolVersion=k??1,this.state.isOriginator=!a,this.state.relayPersistence=C,this.state.communicationServerUrl=te,this.state.context=M,this.state.terminated=!1,this.state.sdkVersion=ee,this.setMaxListeners(50),this.setConnectionStatus(o.ConnectionStatus.DISCONNECTED),H!=null&&H.duration&&(this.state.sessionDuration=A2),this.state.storageOptions=H,this.state.autoConnectOptions=oe,this.state.debug=(se==null?void 0:se.remoteLayer)===!0,(se==null?void 0:se.remoteLayer)===!0&&gf.enable("RemoteCommunication:Layer"),(se==null?void 0:se.serviceLayer)===!0&&gf.enable("SocketService:Layer"),(se==null?void 0:se.eciesLayer)===!0&&gf.enable("ECIES:Layer"),(se==null?void 0:se.keyExchangeLayer)===!0&&gf.enable("KeyExchange:Layer"),this.state.logging=se,H!=null&&H.storageManager&&(this.state.storageManager=H.storageManager),ct.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${k} relayPersistence=${C} isOriginator=${this.state.isOriginator} communicationLayerPreference=${r} otherPublicKey=${a} reconnect=${i}`),this.state.isOriginator||zN({communicationLayerPreference:r,otherPublicKey:a,reconnect:i,ecies:O,communicationServerUrl:te,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){var t;return ir(this,void 0,void 0,function*(){if(this.state.storageManager){const n=yield this.state.storageManager.getPersistedChannelConfig({});n&&(this.state.channelConfig=n,this.state.channelId=n.channelId,this.state.deeplinkProtocolAvailable=(t=n.deeplinkProtocolAvailable)!==null&&t!==void 0&&t,n.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(o.ConnectionStatus.LINKED),yield this.connectToChannel({channelId:n.channelId})))}zN({communicationLayerPreference:o.CommunicationLayerPreference.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return ir(this,void 0,void 0,function*(){return yield function(t){var n;return ir(this,void 0,void 0,function*(){const{state:r}=t;if(!r.storageManager)return void ct.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const a=yield r.storageManager.getPersistedChannelConfig({});if(ct.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${r.originatorConnectStarted} channelConfig`,a),(n=r.communicationLayer)===null||n===void 0?void 0:n.isConnected())return ct.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),a;if(a){if(a.validUntil>Date.now())return r.channelConfig=a,r.originatorConnectStarted=!0,r.channelId=a==null?void 0:a.channelId,r.reconnection=!0,a;ct.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}r.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return ir(this,void 0,void 0,function*(){return function(t){var n,r,a,i,h,y;return ir(this,void 0,void 0,function*(){if(!t.communicationLayer)throw new Error("communication layer not initialized");if(t.ready)throw new Error("Channel already connected");if(t.channelId&&(!((n=t.communicationLayer)===null||n===void 0)&&n.isConnected()))return t.channelConfig=Object.assign(Object.assign({},t.channelConfig),{channelId:t.channelId,validUntil:Date.now()+t.sessionDuration}),(r=t.storageManager)===null||r===void 0||r.persistChannelConfig(t.channelConfig),{channelId:t.channelId,privKey:(i=(a=t.communicationLayer)===null||a===void 0?void 0:a.getKeyInfo())===null||i===void 0?void 0:i.ecies.private,pubKey:(y=(h=t.communicationLayer)===null||h===void 0?void 0:h.getKeyInfo())===null||y===void 0?void 0:y.ecies.public};ct.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const k=yield t.communicationLayer.createChannel();ct.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",k);const E=Object.assign(Object.assign({},t.channelConfig),{channelId:k.channelId,localKey:k.privKey,validUntil:Date.now()+t.sessionDuration});return t.channelId=k.channelId,t.channelConfig=E,{channelId:t.channelId,pubKey:k.pubKey,privKey:k.privKey}})}(this.state)})}clean(){return IN(this.state)}connectToChannel({channelId:t,withKeyExchange:n,authorized:r}){return function({channelId:a,withKeyExchange:i,authorized:h,state:y}){var k,E,M;return ir(this,void 0,void 0,function*(){if(!S5(a))throw ct.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${y.context} invalid channel channelId=${a}`),new Error(`Invalid channel ${a}`);if(ct.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${y.context} channelId=${a} withKeyExchange=${i}`),(k=y.communicationLayer)===null||k===void 0?void 0:k.isConnected())return void ct.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${y.context} already connected - interrupt connection.`);y.channelId=a,yield(E=y.communicationLayer)===null||E===void 0?void 0:E.connectToChannel({channelId:a,authorized:h,withKeyExchange:i});const C=Object.assign(Object.assign({},y.channelConfig),{channelId:a,validUntil:Date.now()+y.sessionDuration});y.channelConfig=C,(M=y.storageManager)===null||M===void 0||M.persistChannelConfig(C)})}({channelId:t,authorized:r,withKeyExchange:n,state:this.state})}sendMessage(t){return function(n,r){var a,i;return ir(this,void 0,void 0,function*(){const{state:h}=n;ct.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${h.context} paused=${h.paused} ready=${h.ready} relayPersistence=${h.relayPersistence} authorized=${h.authorized} socket=${(a=h.communicationLayer)===null||a===void 0?void 0:a.isConnected()} clientsConnected=${h.clientsConnected} status=${h._connectionStatus}`,r),h.relayPersistence||h.ready&&(!((i=h.communicationLayer)===null||i===void 0)&&i.isConnected())&&h.clientsConnected||(ct.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${h.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(y=>{n.once(o.EventType.CLIENTS_READY,y)}),ct.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${h.context} AFTER SKIP / READY -- sending pending message`));try{return yield function(k,E){return ir(this,void 0,void 0,function*(){return new Promise(M=>{var C;const{state:O}=k;ct.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${O.context} ready=${O.ready} authorized=${O.authorized} method=${E.method}`),!O.isOriginator||O.authorized||O.relayPersistence?(C=O.communicationLayer)===null||C===void 0||C.sendMessage(E).then(z=>{M(z)}).catch(z=>{console.error(`[RemoteCommunication: handleAuthorization()] context=${O.context} ERROR`,z),M(!1)}):k.once(o.EventType.AUTHORIZED,()=>{var z;ct.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${O.context} AFTER SKIP / AUTHORIZED -- sending pending message`),(z=O.communicationLayer)===null||z===void 0||z.sendMessage(E).then(H=>{M(H)}).catch(H=>{console.error(`[RemoteCommunication: handleAuthorization()] context=${O.context} ERROR`,H),M(!1)})})})})}(n,r)}catch(y){throw console.error(`[RemoteCommunication: sendMessage()] context=${h.context} ERROR`,y),y}})}(this,t)}testStorage(){return ir(this,void 0,void 0,function*(){return function(t){var n;return ir(this,void 0,void 0,function*(){const r=yield(n=t.storageManager)===null||n===void 0?void 0:n.getPersistedChannelConfig();ct.RemoteCommunication("[RemoteCommunication: testStorage()] res",r)})}(this.state)})}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var t;return(t=this.state.communicationLayer)===null||t===void 0?void 0:t.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){var t;return ir(this,void 0,void 0,function*(){ct.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield(t=this.state.communicationLayer)===null||t===void 0?void 0:t.ping()})}testLogger(){ct.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),ct.SocketService(`testLogger() channel=${this.state.channelId}`),ct.Ecies(`testLogger() channel=${this.state.channelId}`),ct.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var t;ct.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),(t=this.state.communicationLayer)===null||t===void 0||t.keyCheck()}setConnectionStatus(t){this.state._connectionStatus!==t&&(this.state._connectionStatus=t,this.emit(o.EventType.CONNECTION_STATUS,t),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(t={}){this.emit(o.EventType.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var t;return(t=this.state.communicationLayer)===null||t===void 0?void 0:t.getKeyInfo()}resetKeys(){var t;(t=this.state.communicationLayer)===null||t===void 0||t.resetKeys()}setOtherPublicKey(t){var n;const r=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange();if(!r)throw new Error("KeyExchange is not initialized.");r.getOtherPublicKey()!==t&&r.setOtherPublicKey(t)}pause(){var t;return ir(this,void 0,void 0,function*(){ct.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield(t=this.state.communicationLayer)===null||t===void 0?void 0:t.pause(),this.setConnectionStatus(o.ConnectionStatus.PAUSED)})}getVersion(){return Gh.version}hasRelayPersistence(){var t;return(t=this.state.relayPersistence)!==null&&t!==void 0&&t}resume(){return ir(this,void 0,void 0,function*(){return function(t){var n;return ir(this,void 0,void 0,function*(){const{state:r}=t;ct.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),yield(n=r.communicationLayer)===null||n===void 0?void 0:n.resume(),t.setConnectionStatus(o.ConnectionStatus.LINKED)})}(this)})}encrypt(t){var n,r,a;const i=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange(),h=i==null?void 0:i.getOtherPublicKey();if(!h)throw new Error("KeyExchange not completed");return(a=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||a===void 0?void 0:a.encrypt(t,h)}decrypt(t){var n,r,a;if(!(!((n=this.state.communicationLayer)===null||n===void 0)&&n.state.eciesInstance))throw new Error("ECIES instance is not initialized");return(a=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||a===void 0?void 0:a.decrypt(t)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var t;return(t=this.state.communicationLayer)===null||t===void 0?void 0:t.getRPCMethodTracker()}reject({channelId:t}){return function({channelId:n,state:r}){var a,i,h;return ir(this,void 0,void 0,function*(){if(!S5(n))throw ct.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} invalid channel channelId=${n}`),new Error(`Invalid channel ${n}`);if(r.isOriginator)return void ct.RemoteCommunication(`[RemoteCommunication: reject()] context=${r.context} isOriginator=${r.isOriginator} channelId=${n}`);const{socket:y}=(i=(a=r.communicationLayer)===null||a===void 0?void 0:a.state)!==null&&i!==void 0?i:{};y!=null&&y.connected||(ct.RemoteCommunication(`[RemoteCommunication: reject()] context=${r.context} socket already connected`),y==null||y.connect()),Sd(Object.assign(Object.assign({id:n,event:ho.REJECTED},r.originatorInfo),{sdkVersion:r.sdkVersion,commLayerVersion:Gh.version,walletVersion:(h=r.walletInfo)===null||h===void 0?void 0:h.version}),r.communicationServerUrl).catch(k=>{console.error("rejectChannel:: Error emitting analytics event",k)}),yield new Promise((k,E)=>{y==null||y.emit(o.EventType.REJECTED,{channelId:n},(M,C)=>{ct.RemoteCommunication(`[RemoteCommunication: reject()] context=${r.context} socket=${y==null?void 0:y.id}`,{error:M,response:C}),M?E(M):k(C)})})})}({channelId:t,state:this.state})}disconnect(t){return ir(this,void 0,void 0,function*(){return FN({options:t,instance:this})})}}function Tn(e,t,n,r){return new(n||(n=Promise))(function(a,i){function h(E){try{k(r.next(E))}catch(M){i(M)}}function y(E){try{k(r.throw(E))}catch(M){i(M)}}function k(E){E.done?a(E.value):function(M){return M instanceof n?M:new n(function(C){C(M)})}(E.value).then(h,y)}k((r=r.apply(e,[])).next())})}function W5(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function V5(e,t,n,r,a){if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}(function(e){e.RENEW="renew",e.LINK="link"})(BN||(BN={})),typeof SuppressedError=="function"&&SuppressedError;var JX="ERC721",eJ="ERC1155",tJ={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{chainIdDeprecation:`MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead. +For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,networkVersionDeprecation:`MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead. +For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,selectedAddressDeprecation:`MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead. +For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,enableDeprecation:`MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead. +For more information, see: https://eips.ethereum.org/EIPS/eip-1102`,sendDeprecation:`MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead. +For more information, see: https://eips.ethereum.org/EIPS/eip-1193`,events:{close:`MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead. +For more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect`,data:`MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead. +For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message`,networkChanged:`MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead. +For more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged`,notification:`MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead. +For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message`},rpc:{ethDecryptDeprecation:`MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future. +For more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686`,ethGetEncryptionPublicKeyDeprecation:`MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future. +For more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686`,walletWatchAssetNFTExperimental:`MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future. +For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle`},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}},oo=tJ;function nJ(e){const t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,a)=>{var i;t.ethDecryptDeprecation||n.method!=="eth_decrypt"?t.ethGetEncryptionPublicKeyDeprecation||n.method!=="eth_getEncryptionPublicKey"?!t.walletWatchAssetNFTExperimental&&n.method==="wallet_watchAsset"&&[JX,eJ].includes(((i=n.params)==null?void 0:i.type)||"")&&(e.warn(oo.warnings.rpc.walletWatchAssetNFTExperimental),t.walletWatchAssetNFTExperimental=!0):(e.warn(oo.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(oo.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0),a()}}var jN=4294967295,UN=Math.floor(Math.random()*jN);function rJ(){return(e,t,n,r)=>{const a=e.id,i=UN=(UN+1)%jN;e.id=i,t.id=i,n(h=>{e.id=a,t.id=a,h()})}}var Y5=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Zh=(e,t,n)=>(Y5(e,t,"read from private field"),n?n.call(e):t.get(e)),Yl=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},f7=(e,t,n,r)=>(Y5(e,t,"write to private field"),t.set(e,n),n),es=(e,t,n)=>(Y5(e,t,"access private method"),n),Qh={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},KN={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function HN(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}var d7=(e,t)=>Object.hasOwnProperty.call(e,t);class iJ extends TypeError{constructor(t,n){let r;const{message:a,explanation:i,...h}=t,{path:y}=t,k=y.length===0?a:`At path: ${y.join(".")} -- ${a}`;super(i??k),i!=null&&(this.cause=k),Object.assign(this,h),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...n()])}}function kd(e){return typeof e=="object"&&e!=null}function bf(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function oJ(e,t,n,r){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:a,branch:i}=t,{type:h}=n,{refinement:y,message:k=`Expected a value of type \`${h}\`${y?` with refinement \`${y}\``:""}, but received: \`${bf(r)}\``}=e;return{value:r,type:h,refinement:y,key:a[a.length-1],path:a,branch:i,...e,message:k}}function*$N(e,t,n,r){(function(a){return kd(a)&&typeof a[Symbol.iterator]=="function"})(e)||(e=[e]);for(const a of e){const i=oJ(a,t,n,r);i&&(yield i)}}function*G5(e,t,n={}){const{path:r=[],branch:a=[e],coerce:i=!1,mask:h=!1}=n,y={path:r,branch:a};if(i&&(e=t.coercer(e,y),h&&t.type!=="type"&&kd(t.schema)&&kd(e)&&!Array.isArray(e)))for(const E in e)t.schema[E]===void 0&&delete e[E];let k="valid";for(const E of t.validator(e,y))E.explanation=n.message,k="not_valid",yield[E,void 0];for(let[E,M,C]of t.entries(e,y)){const O=G5(M,C,{path:E===void 0?r:[...r,E],branch:E===void 0?a:[...a,M],coerce:i,mask:h,message:n.message});for(const z of O)z[0]?(k=z[0].refinement!=null?"not_refined":"not_valid",yield[z[0],void 0]):i&&(M=z[1],E===void 0?e=M:e instanceof Map?e.set(E,M):e instanceof Set?e.add(M):kd(e)&&(M!==void 0||E in e)&&(e[E]=M))}if(k!=="not_valid")for(const E of t.refiner(e,y))E.explanation=n.message,k="not_refined",yield[E,void 0];k==="valid"&&(yield[void 0,e])}class Gl{constructor(t){const{type:n,schema:r,validator:a,refiner:i,coercer:h=k=>k,entries:y=function*(){}}=t;this.type=n,this.schema=r,this.entries=y,this.coercer=h,this.validator=a?(k,E)=>$N(a(k,E),E,this,k):()=>[],this.refiner=i?(k,E)=>$N(i(k,E),E,this,k):()=>[]}assert(t,n){return qN(t,this,n)}create(t,n){return WN(t,this,n)}is(t){return P2(t,this)}mask(t,n){return function(r,a,i){const h=Iy(r,a,{coerce:!0,mask:!0,message:i});if(h[0])throw h[0];return h[1]}(t,this,n)}validate(t,n={}){return Iy(t,this,n)}}function qN(e,t,n){const r=Iy(e,t,{message:n});if(r[0])throw r[0]}function WN(e,t,n){const r=Iy(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function P2(e,t){return!Iy(e,t)[0]}function Iy(e,t,n={}){const r=G5(e,t,n),a=function(i){const{done:h,value:y}=i.next();return h?void 0:y}(r);return a[0]?[new iJ(a[0],function*(){for(const i of r)i[0]&&(yield i[0])}),void 0]:[void 0,a[1]]}function Xh(e,t){return new Gl({type:e,schema:null,validator:t})}function VN(e){let t;return new Gl({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function YN(e){return new Gl({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||`Expected an array value, but received: ${bf(t)}`})}function GN(e){const t=bf(e),n=typeof e;return new Gl({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${bf(r)}`})}function ZN(){return Xh("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${bf(e)}`)}function QN(e){const t=e?Object.keys(e):[],n=Xh("never",()=>!1);return new Gl({type:"object",schema:e||null,*entries(r){if(e&&kd(r)){const a=new Set(Object.keys(r));for(const i of t)a.delete(i),yield[i,r[i],e[i]];for(const i of a)yield[i,r[i],n]}},validator:r=>kd(r)||`Expected an object, but received: ${bf(r)}`,coercer:r=>kd(r)?{...r}:r})}function XN(e){return new Gl({...e,validator:(t,n)=>t===void 0||e.validator(t,n),refiner:(t,n)=>t===void 0||e.refiner(t,n)})}function JN(e,t){return new Gl({type:"record",schema:null,*entries(n){if(kd(n))for(const r in n){const a=n[r];yield[r,r,e],yield[r,a,t]}},validator:n=>kd(n)||`Expected an object, but received: ${bf(n)}`})}function Jh(){return Xh("string",e=>typeof e=="string"||`Expected a string, but received: ${bf(e)}`)}function h7(e){const t=e.map(n=>n.type).join(" | ");return new Gl({type:"union",schema:null,coercer(n){for(const r of e){const[a,i]=r.validate(n,{coerce:!0});if(!a)return i}return n},validator(n,r){const a=[];for(const i of e){const[...h]=G5(n,i,r),[y]=h;if(!y[0])return[];for(const[k]of h)k&&a.push(k)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${bf(n)}`,...a]}})}function aJ(e){return function(t){return function(n){return typeof n=="object"&&n!==null&&"message"in n}(t)&&typeof t.message=="string"?t.message:function(n){return n==null}(t)?"":String(t)}(e).replace(/\.$/u,"")}function sJ(e,t){var r,a;return n=e,typeof((a=(r=n==null?void 0:n.prototype)==null?void 0:r.constructor)==null?void 0:a.name)=="string"?new e({message:t}):e({message:t});var n}var uJ=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}},Ly=e=>QN(e);function eD({path:e,branch:t}){const n=e[e.length-1];return d7(t[t.length-2],n)}function p7(e){return new Gl({...e,type:`optional ${e.type}`,validator:(t,n)=>!eD(n)||e.validator(t,n),refiner:(t,n)=>!eD(n)||e.refiner(t,n)})}var m7,tD,nD,g7=h7([GN(null),Xh("boolean",e=>typeof e=="boolean"),Xh("finite number",e=>P2(e,ZN())&&Number.isFinite(e)),Jh(),YN(VN(()=>g7)),JN(Jh(),VN(()=>g7))]),Oy=(m7=g7,tD=Xh("any",()=>!0),nD=e=>(function(t,n,r="Assertion failed",a=uJ){try{qN(t,n)}catch(i){throw sJ(a,`${r}: ${aJ(i)}.`)}}(e,g7),JSON.parse(JSON.stringify(e,(t,n)=>{if(t!=="__proto__"&&t!=="constructor")return n}))),new Gl({...m7,coercer:(e,t)=>P2(e,tD)?m7.coercer(nD(e,t),t):m7.coercer(e,t)}));function Z5(e){try{return function(t){WN(t,Oy)}(e),!0}catch{return!1}}var Ny=GN("2.0"),v7=function(e){return new Gl({...e,validator:(t,n)=>t===null||e.validator(t,n),refiner:(t,n)=>t===null||e.refiner(t,n)})}(h7([ZN(),Jh()])),Q5=Ly({code:Xh("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${bf(e)}`),message:Jh(),data:p7(Oy),stack:p7(Jh())}),rD=h7([JN(Jh(),Oy),YN(Oy)]),lJ=Ly({id:v7,jsonrpc:Ny,method:Jh(),params:p7(rD)}),cJ=Ly({jsonrpc:Ny,method:Jh(),params:p7(rD)});function iD(e){return P2(e,lJ)}function oD(e){return P2(e,Q5)}QN({id:v7,jsonrpc:Ny,result:XN(Xh("unknown",()=>!0)),error:XN(Q5)}),h7([Ly({id:v7,jsonrpc:Ny,result:Oy}),Ly({id:v7,jsonrpc:Ny,error:Q5})]);var aD,sD,X5={exports:{}};function fJ(){if(sD)return aD;sD=1;var e=1e3,t=60*e,n=60*t,r=24*n,a=7*r,i=365.25*r;function h(y,k,E,M){var C=k>=1.5*E;return Math.round(y/E)+" "+M+(C?"s":"")}return aD=function(y,k){k=k||{};var E=typeof y;if(E==="string"&&y.length>0)return function(M){if(!((M=String(M)).length>100)){var C=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(M);if(C){var O=parseFloat(C[1]);switch((C[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return O*i;case"weeks":case"week":case"w":return O*a;case"days":case"day":case"d":return O*r;case"hours":case"hour":case"hrs":case"hr":case"h":return O*n;case"minutes":case"minute":case"mins":case"min":case"m":return O*t;case"seconds":case"second":case"secs":case"sec":case"s":return O*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return O;default:return}}}}(y);if(E==="number"&&isFinite(y))return k.long?function(M){var C=Math.abs(M);return C>=r?h(M,C,r,"day"):C>=n?h(M,C,n,"hour"):C>=t?h(M,C,t,"minute"):C>=e?h(M,C,e,"second"):M+" ms"}(y):function(M){var C=Math.abs(M);return C>=r?Math.round(M/r)+"d":C>=n?Math.round(M/n)+"h":C>=t?Math.round(M/t)+"m":C>=e?Math.round(M/e)+"s":M+"ms"}(y);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(y))}}var dJ=function(e){function t(a){let i,h,y,k=null;function E(...M){if(!E.enabled)return;const C=E,O=Number(new Date),z=O-(i||O);C.diff=z,C.prev=i,C.curr=O,i=O,M[0]=t.coerce(M[0]),typeof M[0]!="string"&&M.unshift("%O");let H=0;M[0]=M[0].replace(/%([a-zA-Z%])/g,(ee,te)=>{if(ee==="%%")return"%";H++;const se=t.formatters[te];if(typeof se=="function"){const oe=M[H];ee=se.call(C,oe),M.splice(H,1),H--}return ee}),t.formatArgs.call(C,M),(C.log||t.log).apply(C,M)}return E.namespace=a,E.useColors=t.useColors(),E.color=t.selectColor(a),E.extend=n,E.destroy=t.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>k!==null?k:(h!==t.namespaces&&(h=t.namespaces,y=t.enabled(a)),y),set:M=>{k=M}}),typeof t.init=="function"&&t.init(E),E}function n(a,i){const h=t(this.namespace+(i===void 0?":":i)+a);return h.log=this.log,h}function r(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(a){return a instanceof Error?a.stack||a.message:a},t.disable=function(){const a=[...t.names.map(r),...t.skips.map(r).map(i=>"-"+i)].join(",");return t.enable(""),a},t.enable=function(a){let i;t.save(a),t.namespaces=a,t.names=[],t.skips=[];const h=(typeof a=="string"?a:"").split(/[\s,]+/),y=h.length;for(i=0;i{t[a]=e[a]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(a){let i=0;for(let h=0;h{y!=="%%"&&(i++,y==="%c"&&(h=i))}),r.splice(h,0,a)},t.save=function(r){try{r?t.storage.setItem("debug",r):t.storage.removeItem("debug")}catch{}},t.load=function(){let r;try{r=t.storage.getItem("debug")}catch{}return!r&&mi!==void 0&&"env"in mi&&(r=mi.env.DEBUG),r},t.useColors=function(){return!(typeof window>"u"||!window.process||window.process.type!=="renderer"&&!window.process.__nwjs)||(typeof navigator>"u"||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch{}}(),t.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=dJ(t);const{formatters:n}=e.exports;n.j=function(r){try{return JSON.stringify(r)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}}})(X5,X5.exports);var Dy=R(X5.exports),uD=Qh.internal,hJ="Unspecified error message. This is a bug, please report it.",pJ={code:uD,message:lD(uD)},mJ="Unspecified server error.";function lD(e,t=hJ){if(function(n){return Number.isInteger(n)}(e)){const n=e.toString();if(d7(KN,n))return KN[n].message;if(function(r){return r>=-32099&&r<=-32e3}(e))return mJ}return t}function cD(e,{fallbackError:t=pJ,shouldIncludeStack:n=!0}={}){if(!oD(t))throw new Error("Must provide fallback error with integer number code and string message.");const r=function(a,i){return a&&typeof a=="object"&&"serialize"in a&&typeof a.serialize=="function"?a.serialize():oD(a)?a:{...i,data:{cause:fD(a)}}}(e,t);return n||delete r.stack,r}function fD(e){return Array.isArray(e)?e.map(t=>Z5(t)?t:HN(t)?dD(t):null):HN(e)?dD(e):Z5(e)?e:null}function dD(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{const r=e[n];return Z5(r)&&(t[n]=r),t},{})}var hD=By;By.default=By,By.stable=gD,By.stableStringify=gD;var y7="[...]",pD="[Circular]",u1=[],l1=[];function mD(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function By(e,t,n,r){var a;r===void 0&&(r=mD()),J5(e,"",0,[],void 0,0,r);try{a=l1.length===0?JSON.stringify(e,t,n):JSON.stringify(e,vD(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;u1.length!==0;){var i=u1.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return a}function I2(e,t,n,r){var a=Object.getOwnPropertyDescriptor(r,n);a.get!==void 0?a.configurable?(Object.defineProperty(r,n,{value:e}),u1.push([r,n,t,a])):l1.push([t,n,e]):(r[n]=e,u1.push([r,n,t]))}function J5(e,t,n,r,a,i,h){var y;if(i+=1,typeof e=="object"&&e!==null){for(y=0;yh.depthLimit||h.edgesLimit!==void 0&&n+1>h.edgesLimit)return void I2(y7,e,t,a);if(r.push(e),Array.isArray(e))for(y=0;yt?1:0}function gD(e,t,n,r){r===void 0&&(r=mD());var a,i=eM(e,"",0,[],void 0,0,r)||e;try{a=l1.length===0?JSON.stringify(i,t,n):JSON.stringify(i,vD(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;u1.length!==0;){var h=u1.pop();h.length===4?Object.defineProperty(h[0],h[1],h[3]):h[0][h[1]]=h[2]}}return a}function eM(e,t,n,r,a,i,h){var y;if(i+=1,typeof e=="object"&&e!==null){for(y=0;yh.depthLimit||h.edgesLimit!==void 0&&n+1>h.edgesLimit)return void I2(y7,e,t,a);if(r.push(e),Array.isArray(e))for(y=0;y0)for(var r=0;rbJ(Qh.invalidRequest,e);function bJ(e,t){const[n,r]=function(a){if(a){if(typeof a=="string")return[a];if(typeof a=="object"&&!Array.isArray(a)){const{message:i,data:h}=a;if(i&&typeof i!="string")throw new Error("Must specify string message.");return[i??void 0,h]}}return[]}(t);return new Md(e,n??lD(e),r)}var yD={};Object.defineProperty(yD,"__esModule",{value:!0});const wJ=EE;function bD(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}let _J=class extends wJ.EventEmitter{emit(e,...t){let n=e==="error";const r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){let i;if(t.length>0&&([i]=t),i instanceof Error)throw i;const h=new Error("Unhandled error."+(i?` (${i.message})`:""));throw h.context=i,h}const a=r[e];if(a===void 0)return!1;if(typeof a=="function")bD(a,this,t);else{const i=a.length,h=function(y){const k=y.length,E=new Array(k);for(let M=0;M{"destroy"in t&&typeof t.destroy=="function"&&t.destroy()}),f7(this,e0,[]),f7(this,b7,!0)}push(t){es(this,Fy,w7).call(this),Zh(this,e0).push(t)}handle(t,n){if(es(this,Fy,w7).call(this),n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?n?es(this,_7,tM).call(this,t,n):es(this,_7,tM).call(this,t):n?es(this,S7,nM).call(this,t,n):this._promiseHandle(t)}asMiddleware(){return es(this,Fy,w7).call(this),async(t,n,r,a)=>{var i,h;try{const[y,k,E]=await es(i=RS,E7,iM).call(i,t,n,Zh(this,e0));return k?(await es(h=RS,jy,k7).call(h,E),a(y)):r(async M=>{var C;try{await es(C=RS,jy,k7).call(C,E)}catch(O){return M(O)}return M()})}catch(y){return a(y)}}}async _promiseHandle(t){return new Promise((n,r)=>{es(this,S7,nM).call(this,t,(a,i)=>{a&&i===void 0?r(a):n(i)}).catch(r)})}};b7=new WeakMap,e0=new WeakMap,L2=new WeakMap,Fy=new WeakSet,w7=function(){if(Zh(this,b7))throw new Error("This engine is destroyed and can no longer be used.")},_7=new WeakSet,tM=async function(e,t){try{if(e.length===0){const r=[{id:null,jsonrpc:"2.0",error:new Md(Qh.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return t?t(null,r):r}const n=(await Promise.all(e.map(this._promiseHandle.bind(this)))).filter(r=>r!==void 0);return t?t(null,n):n}catch(n){if(t)return t(n);throw n}},S7=new WeakSet,nM=async function(e,t){var n;if(!e||Array.isArray(e)||typeof e!="object"){const h=new Md(Qh.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(h,{id:null,jsonrpc:"2.0",error:h})}if(typeof e.method!="string"){const h=new Md(Qh.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return Zh(this,L2)&&!iD(e)?t(null):t(h,{id:e.id??null,jsonrpc:"2.0",error:h})}if(Zh(this,L2)&&function(h){return P2(h,cJ)}(e)&&!iD(e)){try{await Zh(this,L2).call(this,e)}catch(h){return t(h)}return t(null)}let r=null;const a={...e},i={id:a.id,jsonrpc:a.jsonrpc};try{await es(n=Zl,rM,wD).call(n,a,i,Zh(this,e0))}catch(h){r=h}return r&&(delete i.result,i.error||(i.error=cD(r))),t(r,i)},rM=new WeakSet,wD=async function(e,t,n){var r,a,i;const[h,y,k]=await es(r=Zl,E7,iM).call(r,e,t,n);if(es(a=Zl,aM,SD).call(a,e,t,y),await es(i=Zl,jy,k7).call(i,k),h)throw h},E7=new WeakSet,iM=async function(e,t,n){var r;const a=[];let i=null,h=!1;for(const y of n)if([i,h]=await es(r=Zl,oM,_D).call(r,e,t,y,a),h)break;return[i,h,a.reverse()]},oM=new WeakSet,_D=async function(e,t,n,r){return new Promise(a=>{const i=y=>{const k=y||t.error;k&&(t.error=cD(k)),a([k,!0])},h=y=>{t.error?i(t.error):(y&&(typeof y!="function"&&i(new Md(Qh.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof y}" for request: +${sM(e)}`,{request:e})),r.push(y)),a([null,!1]))};try{n(e,t,h,i)}catch(y){i(y)}})},jy=new WeakSet,k7=async function(e){for(const t of e)await new Promise((n,r)=>{t(a=>a?r(a):n())})},aM=new WeakSet,SD=function(e,t,n){if(!d7(t,"result")&&!d7(t,"error"))throw new Md(Qh.internal,`JsonRpcEngine: Response has no error or result for request: +${sM(e)}`,{request:e});if(!n)throw new Md(Qh.internal,`JsonRpcEngine: Nothing ended request: +${sM(e)}`,{request:e})},Yl(Zl,rM),Yl(Zl,E7),Yl(Zl,oM),Yl(Zl,jy),Yl(Zl,aM);var SJ=Zl;function sM(e){return JSON.stringify(e,null,2)}var kD=Object.freeze(["eth_subscription"]),EJ=(e=console)=>[rJ(),kJ(e),nJ(e)];function kJ(e){return(t,n,r)=>{typeof t.method=="string"&&t.method||(n.error=zy({message:"The request 'method' must be a non-empty string.",data:t})),r(a=>{const{error:i}=n;return i&&e.error(`MetaMask - RPC Error: ${i.message}`,i),a()})}}var M7=(e,t,n=!0)=>(r,a)=>{r||a.error?t(r||a.error):!n||Array.isArray(a)?e(a):e(a.result)},MD=e=>!!e&&typeof e=="string"&&e.startsWith("0x"),CD=()=>{};async function xD(e,t){try{const n=await async function(){return{name:MJ(window),icon:await CJ(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:n},CD)}catch(n){t.error({message:oo.errors.sendSiteMetadata(),originalError:n})}}function MJ(e){const{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}async function CJ(e){const{document:t}=e,n=t.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await xJ(r.href))return r.href;return null}async function xJ(e){return new Promise((t,n)=>{try{const r=document.createElement("img");r.onload=()=>t(!0),r.onerror=()=>t(!1),r.src=e}catch(r){n(r)}})}var AD=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},wf=(e,t,n)=>(AD(e,t,"read from private field"),n?n.call(e):t.get(e)),uM=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Cd=(e,t,n,r)=>(AD(e,t,"write to private field"),t.set(e,n),n);function TD(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}class AJ extends Sr{emit(t,...n){let r=t==="error";const a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){let h;if(n.length>0&&([h]=n),h instanceof Error)throw h;const y=new Error("Unhandled error."+(h?` (${h.message})`:""));throw y.context=h,y}const i=a[t];if(i===void 0)return!1;if(typeof i=="function")TD(i,this,n);else{const h=i.length,y=function(k){const E=k.length,M=new Array(E);for(let C=0;Ca.push(i)),this._rpcEngine=a}get chainId(){return wf(this,t0)}get selectedAddress(){return wf(this,c1)}isConnected(){return this._state.isConnected}async request(t){if(!t||typeof t!="object"||Array.isArray(t))throw zy({message:oo.errors.invalidRequestArgs(),data:t});const{method:n,params:r}=t;if(typeof n!="string"||n.length===0)throw zy({message:oo.errors.invalidRequestMethod(),data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw zy({message:oo.errors.invalidRequestParams(),data:t});const a=r==null?{method:n}:{method:n,params:r};return new Promise((i,h)=>{this._rpcRequest(a,M7(i,h))})}_initializeState(t){if(this._state.initialized)throw new Error("Provider already initialized.");if(t){const{accounts:n,chainId:r,isUnlocked:a,networkVersion:i}=t;this._handleConnect(r),this._handleChainChanged({chainId:r,networkVersion:i}),this._handleUnlockStateChanged({accounts:n,isUnlocked:a}),this._handleAccountsChanged(n)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(t,n){let r=n;return Array.isArray(t)||(t.jsonrpc||(t.jsonrpc="2.0"),t.method!=="eth_accounts"&&t.method!=="eth_requestAccounts"||(r=(a,i)=>{this._handleAccountsChanged(i.result??[],t.method==="eth_accounts"),n(a,i)})),this._rpcEngine.handle(t,r)}_handleConnect(t){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:t}),this._log.debug(oo.info.connected(t)))}_handleDisconnect(t,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!t){let r;this._state.isConnected=!1,t?(r=new Md(1013,n??oo.errors.disconnected()),this._log.debug(r)):(r=new Md(1011,n??oo.errors.permanentlyDisconnected()),this._log.error(r),Cd(this,t0,null),this._state.accounts=null,Cd(this,c1,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}_handleChainChanged({chainId:t}={}){MD(t)?(this._handleConnect(t),t!==wf(this,t0)&&(Cd(this,t0,t),this._state.initialized&&this.emit("chainChanged",wf(this,t0)))):this._log.error(oo.errors.invalidNetworkParams(),{chainId:t})}_handleAccountsChanged(t,n=!1){let r=t;Array.isArray(t)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",t),r=[]);for(const a of t)if(typeof a!="string"){this._log.error("MetaMask: Received non-string account. Please report this bug.",t),r=[];break}if(!RJ(this._state.accounts,r)&&(n&&this._state.accounts!==null&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",r),this._state.accounts=r,wf(this,c1)!==r[0]&&Cd(this,c1,r[0]||null),this._state.initialized)){const a=[...r];this.emit("accountsChanged",a)}}_handleUnlockStateChanged({accounts:t,isUnlocked:n}={}){typeof n=="boolean"?n!==this._state.isUnlocked&&(this._state.isUnlocked=n,this._handleAccountsChanged(t??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};t0=new WeakMap,c1=new WeakMap,RD._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var PJ=RD;function IJ(e={}){const t={},n=new Oh.Duplex({objectMode:!0,read:()=>{},write:function(i,h,y){let k=null;try{i.id?function(E){const{id:M}=E;if(M===null)return;const C=t[M];C?(delete t[M],Object.assign(C.res,E),setTimeout(C.end)):console.warn(`StreamMiddleware - Unknown response id "${M}"`)}(i):function(E){e!=null&&e.retryOnMessage&&E.method===e.retryOnMessage&&Object.values(t).forEach(({req:M,retryCount:C=0})=>{if(!M.id)return;if(C>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${M.id}"`);const O=t[M.id];O&&(O.retryCount=C+1),a(M)}),r.emit("notification",E)}(i)}catch(E){k=E}y(k)}}),r=new ED;return{events:r,middleware:(i,h,y,k)=>{t[i.id]={req:i,res:h,next:y,end:k},a(i)},stream:n};function a(i){n.push(i)}}var C7={},lM={exports:{}},LJ=function e(t,n){if(t&&n)return e(t)(n);if(typeof t!="function")throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(a){r[a]=t[a]}),r;function r(){for(var a=new Array(arguments.length),i=0;it.destroy(n||void 0)),t}ignoreStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=LD}_read(){}_write(e,t,n){const{name:r,data:a}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();const i=this._substreams[r];return i?(i!==LD&&i.push(a),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}};C7.ObjectMultiplex=jJ;var UJ=R(C7.ObjectMultiplex);const _f=e=>e!==null&&typeof e=="object"&&typeof e.pipe=="function";_f.writable=e=>_f(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object",_f.readable=e=>_f(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object",_f.duplex=e=>_f.writable(e)&&_f.readable(e),_f.transform=e=>_f.duplex(e)&&typeof e._transform=="function";var Sf,KJ=_f,HJ=class extends PJ{constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:a=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:a}),!KJ.duplex(e))throw new Error(oo.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const i=new UJ;Oh.pipeline(e,i,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=IJ({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),Oh.pipeline(this._jsonRpcConnection.stream,i.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",h=>{const{method:y,params:k}=h;y==="metamask_accountsChanged"?this._handleAccountsChanged(k):y==="metamask_unlockStateChanged"?this._handleUnlockStateChanged(k):y==="metamask_chainChanged"?this._handleChainChanged(k):kD.includes(y)?this.emit("message",{type:y,data:k}):y==="METAMASK_STREAM_FAILURE"&&e.destroy(new Error(oo.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(t){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",t)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;t!=null&&t.stack&&(n+=` +${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){MD(e)&&(n=>!!n&&typeof n=="string")(t)?t==="loading"?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(oo.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}},$J=class extends HJ{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:a}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:EJ(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},uM(this,Sf,void 0),this._initializeStateAsync(),Cd(this,Sf,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",i=>{const{method:h}=i;kD.includes(h)&&(this.emit("data",i),this.emit("notification",i.params.result))}),a)if(document.readyState==="complete")xD(this._rpcEngine,this._log);else{const i=()=>{xD(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",i)};window.addEventListener("DOMContentLoaded",i)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(oo.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(oo.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),wf(this,Sf)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(oo.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),wf(this,Sf)&&!e&&Cd(this,Sf,null)}_warnOfDeprecation(e){var t;((t=this._sentWarnings)==null?void 0:t.events[e])===!1&&(this._log.warn(oo.warnings.events[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(oo.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},M7(e,t))}catch(n){t(n)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(oo.warnings.sendDeprecation),this._sentWarnings.send=!0),typeof e!="string"||t&&!Array.isArray(t)?e&&typeof e=="object"&&typeof t=="function"?this._rpcRequest(e,t):this._sendSync(e):new Promise((n,r)=>{try{this._rpcRequest({method:e,params:t},M7(n,r,!1))}catch(a){r(a)}})}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(e,CD),t=!0;break;case"net_version":t=wf(this,Sf)??null;break;default:throw new Error(oo.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(e=>{this.on("_initialized",()=>e())}),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw zy({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,M7(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(oo.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==wf(this,Sf)&&(Cd(this,Sf,t),this._state.initialized&&this.emit("networkChanged",wf(this,Sf)))}};Sf=new WeakMap;const ht=Dy("MM_SDK");ht.color="#FFAC1C";var OD={},n0={};Object.defineProperty(n0,"__esModule",{value:!0}),n0.EthereumProviderError=n0.EthereumRpcError=void 0;const qJ=hD;class ND extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),this.stack&&(t.stack=this.stack),t}toString(){return qJ.default(this.serialize(),WJ,2)}}function WJ(e,t){if(t!=="[Circular]")return t}n0.EthereumRpcError=ND,n0.EthereumProviderError=class extends ND{constructor(e,t,n){if(!function(r){return Number.isInteger(r)&&r>=1e3&&r<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var fM={},r0={};Object.defineProperty(r0,"__esModule",{value:!0}),r0.errorValues=r0.errorCodes=void 0,r0.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},r0.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=r0,n=n0,r=t.errorCodes.rpc.internal,a="Unspecified error message. This is a bug, please report it.",i={code:r,message:h(r)};function h(C,O=a){if(Number.isInteger(C)){const z=C.toString();if(M(t.errorValues,z))return t.errorValues[z].message;if(k(C))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return O}function y(C){if(!Number.isInteger(C))return!1;const O=C.toString();return!!t.errorValues[O]||!!k(C)}function k(C){return C>=-32099&&C<=-32e3}function E(C){return C&&typeof C=="object"&&!Array.isArray(C)?Object.assign({},C):C}function M(C,O){return Object.prototype.hasOwnProperty.call(C,O)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=h,e.isValidCode=y,e.serializeError=function(C,{fallbackError:O=i,shouldIncludeStack:z=!1}={}){var H,ee;if(!O||!Number.isInteger(O.code)||typeof O.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(C instanceof n.EthereumRpcError)return C.serialize();const te={};if(C&&typeof C=="object"&&!Array.isArray(C)&&M(C,"code")&&y(C.code)){const oe=C;te.code=oe.code,oe.message&&typeof oe.message=="string"?(te.message=oe.message,M(oe,"data")&&(te.data=oe.data)):(te.message=h(te.code),te.data={originalError:E(C)})}else{te.code=O.code;const oe=(H=C)===null||H===void 0?void 0:H.message;te.message=oe&&typeof oe=="string"?oe:O.message,te.data={originalError:E(C)}}const se=(ee=C)===null||ee===void 0?void 0:ee.stack;return z&&C&&se&&typeof se=="string"&&(te.stack=se),te}}(fM);var T7={};Object.defineProperty(T7,"__esModule",{value:!0}),T7.ethErrors=void 0;const dM=n0,DD=fM,Na=r0;function Ju(e,t){const[n,r]=BD(t);return new dM.EthereumRpcError(e,n||DD.getMessageFromCode(e),r)}function Uy(e,t){const[n,r]=BD(t);return new dM.EthereumProviderError(e,n||DD.getMessageFromCode(e),r)}function BD(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}T7.ethErrors={rpc:{parse:e=>Ju(Na.errorCodes.rpc.parse,e),invalidRequest:e=>Ju(Na.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Ju(Na.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Ju(Na.errorCodes.rpc.methodNotFound,e),internal:e=>Ju(Na.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Ju(t,e)},invalidInput:e=>Ju(Na.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Ju(Na.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Ju(Na.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Ju(Na.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Ju(Na.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Ju(Na.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Uy(Na.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>Uy(Na.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>Uy(Na.errorCodes.provider.unsupportedMethod,e),disconnected:e=>Uy(Na.errorCodes.provider.disconnected,e),chainDisconnected:e=>Uy(Na.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new dM.EthereumProviderError(t,n,r)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=n0;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=fM;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=T7;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const a=r0;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return a.errorCodes}})}(OD);const Vn={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},R7={[Vn.ETH_REQUESTACCOUNTS]:!0,[Vn.ETH_SENDTRANSACTION]:!0,[Vn.ETH_SIGNTRANSACTION]:!0,[Vn.ETH_SIGN]:!0,[Vn.PERSONAL_SIGN]:!0,[Vn.ETH_ACCOUNTS]:!1,[Vn.ETH_CHAINID]:!1,[Vn.PERSONAL_SIGN]:!0,[Vn.ETH_SIGNTYPEDDATA]:!0,[Vn.ETH_SIGNTYPEDDATA_V3]:!0,[Vn.ETH_SIGNTYPEDDATA_V4]:!0,[Vn.WALLET_REQUESTPERMISSIONS]:!0,[Vn.WALLET_GETPERMISSIONS]:!0,[Vn.WALLET_WATCHASSET]:!0,[Vn.WALLET_ADDETHEREUMCHAIN]:!0,[Vn.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[Vn.METAMASK_CONNECTSIGN]:!0,[Vn.METAMASK_CONNECTWITH]:!0,[Vn.PERSONAL_EC_RECOVER]:!0,[Vn.METAMASK_BATCH]:!0,[Vn.METAMASK_OPEN]:!0},VJ=Object.keys(R7).map(e=>e.toLowerCase()),zD=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),hM=".sdk-comm",P7="providerType",pM=".MMSDK_cached_address",mM=".MMSDK_cached_chainId",Ef={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"};class YJ{constructor({enabled:t}={enabled:!1}){this.enabled=!1,this.enabled=t}persistChannelConfig(t){return Tn(this,void 0,void 0,function*(){const n=JSON.stringify(t);ht(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,t),localStorage.setItem(hM,n)})}getPersistedChannelConfig(){return Tn(this,void 0,void 0,function*(){let t;try{if(ht(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),t=localStorage.getItem(hM),ht("[StorageManagerWeb: getPersistedChannelConfig()]",t),!t)return;const n=JSON.parse(t);return ht("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",n),n}catch(n){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",n)}})}persistAccounts(t){return Tn(this,void 0,void 0,function*(){ht(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,t);const n=JSON.stringify(t);localStorage.setItem(pM,n)})}getCachedAccounts(){return Tn(this,void 0,void 0,function*(){try{const t=localStorage.getItem(pM);return t?JSON.parse(t):[]}catch(t){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",t),t}})}persistChainId(t){return Tn(this,void 0,void 0,function*(){ht(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,t),localStorage.setItem(mM,t)})}getCachedChainId(){return Tn(this,void 0,void 0,function*(){try{const t=localStorage.getItem(mM);return t??void 0}catch(t){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",t),t}})}terminate(){return Tn(this,void 0,void 0,function*(){ht(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(hM)})}}const FD=e=>new YJ(e);class jD extends $J{constructor({connectionStream:t,shouldSendMetadata:n,autoRequestAccounts:r=!1}){super(t,{logger:console,maxEventListeners:100,shouldSendMetadata:n}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},ht(`[SDKProvider: constructor()] autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r}forceInitializeState(){return Tn(this,void 0,void 0,function*(){return ht(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){ht("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var t;const{accounts:n}=this._state;return n&&n.length!==0?((t=n[0])===null||t===void 0?void 0:t.toLowerCase())||"":(ht("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(t){this.state=Object.assign(Object.assign({},this.state),t)}handleAccountsChanged(t,n){return this._handleAccountsChanged(t,n)}handleDisconnect({terminate:t=!1}){(function({terminate:n=!1,instance:r}){const{state:a}=r;ht(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${n}`,r),n&&(r._state.accounts=null,r._state.isUnlocked=!1,r._state.isPermanentlyDisconnected=!0,r._state.initialized=!1),r._handleAccountsChanged([]),r._state.isConnected=!1,r.emit("disconnect",OD.ethErrors.provider.disconnected()),a.providerStateRequested=!1})({terminate:t,instance:this})}_initializeStateAsync(){return Tn(this,void 0,void 0,function*(){return function(t){var n,r;return Tn(this,void 0,void 0,function*(){t.state===void 0&&(t.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});const{state:a}=t;let i;if(a.providerStateRequested)ht("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let h;a.providerStateRequested=!0;let y=null,k=!1,E=!1;const M=FD({enabled:!0});if(M){const C=yield M.getPersistedChannelConfig({});k=(n=C==null?void 0:C.relayPersistence)!==null&&n!==void 0&&n,h=yield M.getCachedChainId();const O=yield M.getCachedAccounts();O.length>0&&(y=O[0])}if(ht(`[SDKProvider: initializeStateAsync()] relayPersistence=${k}`,{relayPersistence:k,cachedChainId:h,cachedSelectedAddress:y}),k)if(h&&y)i={accounts:[y],chainId:h,isUnlocked:!1},E=!0;else try{i=yield t.request({method:"metamask_getProviderState"})}catch(C){return t._log.error("MetaMask: Failed to get initial state. Please report this bug.",C),void(a.providerStateRequested=!1)}if(((r=i==null?void 0:i.accounts)===null||r===void 0?void 0:r.length)===0)if(t.getSelectedAddress())i.accounts=[t.getSelectedAddress()];else{ht("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");const C=yield t.request({method:"eth_requestAccounts",params:[]});i.accounts=C}t._initializeState(i),a.providerStateRequested=!1,E&&(t._state.isConnected=!0,t.emit("connect",{chainId:i==null?void 0:i.chainId}))}})}(this)})}_initializeState(t){return ht("[SDKProvider: _initializeState()]",t),function(n,r,a){return ht("[SDKProvider: initializeState()] set state._initialized to false"),n._state.initialized=!1,r(a)}(this,super._initializeState.bind(this),t)}_handleChainChanged({chainId:t,networkVersion:n}={}){this.state.chainId=t,this.state.networkVersion=n,function({instance:r,chainId:a,networkVersion:i,superHandleChainChanged:h}){ht(`[SDKProvider: handleChainChanged()] chainId=${a} networkVersion=${i}`);let y=i;i||(ht("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),y="1"),r._state.isConnected=!0,r.emit("connect",{chainId:a}),h({chainId:a,networkVersion:y})}({instance:this,chainId:t,networkVersion:n,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var UD={exports:{}};(function(e,t){(function(n){var r=Object.hasOwnProperty,a=Array.isArray?Array.isArray:function(f){return Object.prototype.toString.call(f)==="[object Array]"},i=typeof mi=="object"&&!0,h=typeof Symbol=="function",y=typeof Reflect=="object",k=typeof setImmediate=="function"?setImmediate:setTimeout,E=h?y&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(f){var _=Object.getOwnPropertyNames(f);return _.push.apply(_,Object.getOwnPropertySymbols(f)),_}:Object.keys;function M(){this._events={},this._conf&&C.call(this,this._conf)}function C(f){f&&(this._conf=f,f.delimiter&&(this.delimiter=f.delimiter),f.maxListeners!==n&&(this._maxListeners=f.maxListeners),f.wildcard&&(this.wildcard=f.wildcard),f.newListener&&(this._newListener=f.newListener),f.removeListener&&(this._removeListener=f.removeListener),f.verboseMemoryLeak&&(this.verboseMemoryLeak=f.verboseMemoryLeak),f.ignoreErrors&&(this.ignoreErrors=f.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function O(f,_){var T="(node) warning: possible EventEmitter memory leak detected. "+f+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(T+=" Event name: "+_+"."),mi!==void 0&&mi.emitWarning){var L=new Error(T);L.name="MaxListenersExceededWarning",L.emitter=this,L.count=f,mi.emitWarning(L)}else console.error(T),console.trace&&console.trace()}var z=function(f,_,T){var L=arguments.length;switch(L){case 0:return[];case 1:return[f];case 2:return[f,_];case 3:return[f,_,T];default:for(var B=new Array(L);L--;)B[L]=arguments[L];return B}};function H(f,_){for(var T={},L=f.length,B=0,$=0;$0;)if(q===f[F])return $;Y(_)}}Object.assign(ee.prototype,{subscribe:function(f,_,T){var L=this,B=this._target,$=this._emitter,Y=this._listeners,q=function(){var F=z.apply(null,arguments),K={data:F,name:_,original:f};T?T.call(B,K)!==!1&&$.emit.apply($,[K.name].concat(F)):$.emit.apply($,[_].concat(F))};if(Y[f])throw Error("Event '"+f+"' is already listening");this._listenersCount++,$._newListener&&$._removeListener&&!L._onNewListener?(this._onNewListener=function(F){F===_&&Y[f]===null&&(Y[f]=q,L._on.call(B,f,q))},$.on("newListener",this._onNewListener),this._onRemoveListener=function(F){F===_&&!$.hasListeners(F)&&Y[f]&&(Y[f]=null,L._off.call(B,f,q))},Y[f]=null,$.on("removeListener",this._onRemoveListener)):(Y[f]=q,L._on.call(B,f,q))},unsubscribe:function(f){var _,T,L,B=this,$=this._listeners,Y=this._emitter,q=this._off,F=this._target;if(f&&typeof f!="string")throw TypeError("event must be a string");function K(){B._onNewListener&&(Y.off("newListener",B._onNewListener),Y.off("removeListener",B._onRemoveListener),B._onNewListener=null,B._onRemoveListener=null);var Z=ze.call(Y,B);Y._observers.splice(Z,1)}if(f){if(!(_=$[f]))return;q.call(F,f,_),delete $[f],--this._listenersCount||K()}else{for(L=(T=E($)).length;L-- >0;)f=T[L],q.call(F,f,$[f]);this._listeners={},this._listenersCount=0,K()}}});var Ee=oe(["function"]),we=oe(["object","function"]);function Ce(f,_,T){var L,B,$,Y=0,q=new f(function(F,K,Z){function ne(){B&&(B=null),Y&&(clearTimeout(Y),Y=0)}T=te(T,{timeout:0,overload:!1},{timeout:function(fe,De){return(typeof(fe*=1)!="number"||fe<0||!Number.isFinite(fe))&&De("timeout must be a positive number"),fe}}),L=!T.overload&&typeof f.prototype.cancel=="function"&&typeof Z=="function";var ue=function(fe){ne(),F(fe)},me=function(fe){ne(),K(fe)};L?_(ue,me,Z):(B=[function(fe){me(fe||Error("canceled"))}],_(ue,me,function(fe){if($)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof fe!="function")throw TypeError("onCancel callback must be a function");B.push(fe)}),$=!0),T.timeout>0&&(Y=setTimeout(function(){var fe=Error("timeout");fe.code="ETIMEDOUT",Y=0,q.cancel(fe),K(fe)},T.timeout))});return L||(q.cancel=function(F){if(B){for(var K=B.length,Z=1;Z0;)(ue=pe[q])!=="_listeners"&&(ve=Fe(f,_,T[ue],L+1,B))&&(Se?Se.push.apply(Se,ve):Se=ve);return Se}if(Ae==="**"){for((_e=L+1===B||L+2===B&&qe==="*")&&T._listeners&&(Se=Fe(f,_,T,B,B)),q=(pe=E(T)).length;q-- >0;)(ue=pe[q])!=="_listeners"&&(ue==="*"||ue==="**"?(T[ue]._listeners&&!_e&&(ve=Fe(f,_,T[ue],B,B))&&(Se?Se.push.apply(Se,ve):Se=ve),ve=Fe(f,_,T[ue],L,B)):ve=Fe(f,_,T[ue],ue===qe?L+2:L,B),ve&&(Se?Se.push.apply(Se,ve):Se=ve));return Se}T[Ae]&&(Se=Fe(f,_,T[Ae],L+1,B))}if((me=T["*"])&&Fe(f,_,me,L+1,B),fe=T["**"])if(L0;)(ue=pe[q])!=="_listeners"&&(ue===qe?Fe(f,_,fe[ue],L+2,B):ue===Ae?Fe(f,_,fe[ue],L+1,B):((De={})[ue]=fe[ue],Fe(f,_,{"**":De},L+1,B)));else fe._listeners?Fe(f,_,fe,B,B):fe["*"]&&fe["*"]._listeners&&Fe(f,_,fe["*"],B,B);return Se}function $e(f,_,T){var L,B,$=0,Y=0,q=this.delimiter,F=q.length;if(typeof f=="string")if((L=f.indexOf(q))!==-1){B=new Array(5);do B[$++]=f.slice(Y,L),Y=L+F;while((L=f.indexOf(q,Y))!==-1);B[$++]=f.slice(Y)}else B=[f],$=1;else B=f,$=f.length;if($>1){for(L=0;L+1<$;L++)if(B[L]==="**"&&B[L+1]==="**")return}var K,Z=this.listenerTree;for(L=0;L<$;L++)if(Z=Z[K=B[L]]||(Z[K]={}),L===$-1)return Z._listeners?(typeof Z._listeners=="function"&&(Z._listeners=[Z._listeners]),T?Z._listeners.unshift(_):Z._listeners.push(_),!Z._listeners.warned&&this._maxListeners>0&&Z._listeners.length>this._maxListeners&&(Z._listeners.warned=!0,O.call(this,Z._listeners.length,K))):Z._listeners=_,!0;return!0}function S(f,_,T,L){for(var B,$,Y,q,F=E(f),K=F.length,Z=f._listeners;K-- >0;)B=f[$=F[K]],Y=$==="_listeners"?T:T?T.concat($):[$],q=L||typeof $=="symbol",Z&&_.push(q?Y:Y.join(this.delimiter)),typeof B=="object"&&S.call(this,B,_,Y,q);return _}function P(f){for(var _,T,L,B=E(f),$=B.length;$-- >0;)(_=f[T=B[$]])&&(L=!0,T==="_listeners"||P(_)||delete f[T]);return L}function d(f,_,T){this.emitter=f,this.event=_,this.listener=T}function g(f,_,T){if(T===!0)B=!0;else if(T===!1)L=!0;else{if(!T||typeof T!="object")throw TypeError("options should be an object or true");var L=T.async,B=T.promisify,$=T.nextTick,Y=T.objectify}if(L||$||B){var q=_,F=_._origin||_;if($&&!i)throw Error("process.nextTick is not supported");B===n&&(B=_.constructor.name==="AsyncFunction"),_=function(){var K=arguments,Z=this,ne=this.event;return B?$?Promise.resolve():new Promise(function(ue){k(ue)}).then(function(){return Z.event=ne,q.apply(Z,K)}):($?pr:k)(function(){Z.event=ne,q.apply(Z,K)})},_._async=!0,_._origin=F}return[_,Y?new d(this,f,_):this]}function m(f){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,C.call(this,f)}d.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},m.EventEmitter2=m,m.prototype.listenTo=function(f,_,T){if(typeof f!="object")throw TypeError("target musts be an object");var L=this;function B($){if(typeof $!="object")throw TypeError("events must be an object");var Y,q=T.reducers,F=ze.call(L,f);Y=F===-1?new ee(L,f,T):L._observers[F];for(var K,Z=E($),ne=Z.length,ue=typeof q=="function",me=0;me0;)L=T[B],f&&L._target!==f||(L.unsubscribe(_),$=!0);return $},m.prototype.delimiter=".",m.prototype.setMaxListeners=function(f){f!==n&&(this._maxListeners=f,this._conf||(this._conf={}),this._conf.maxListeners=f)},m.prototype.getMaxListeners=function(){return this._maxListeners},m.prototype.event="",m.prototype.once=function(f,_,T){return this._once(f,_,!1,T)},m.prototype.prependOnceListener=function(f,_,T){return this._once(f,_,!0,T)},m.prototype._once=function(f,_,T,L){return this._many(f,1,_,T,L)},m.prototype.many=function(f,_,T,L){return this._many(f,_,T,!1,L)},m.prototype.prependMany=function(f,_,T,L){return this._many(f,_,T,!0,L)},m.prototype._many=function(f,_,T,L,B){var $=this;if(typeof T!="function")throw new Error("many only accepts instances of Function");function Y(){return--_==0&&$.off(f,Y),T.apply(this,arguments)}return Y._origin=T,this._on(f,Y,L,B)},m.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||M.call(this);var f,_,T,L,B,$,Y=arguments[0],q=this.wildcard;if(Y==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(q&&(f=Y,Y!=="newListener"&&Y!=="removeListener"&&typeof Y=="object")){if(T=Y.length,h){for(L=0;L3)for(_=new Array(K-1),B=1;B3)for(T=new Array(Z-1),$=1;$0&&this._events[f].length>this._maxListeners&&(this._events[f].warned=!0,O.call(this,this._events[f].length,f))):this._events[f]=_,$)},m.prototype.off=function(f,_){if(typeof _!="function")throw new Error("removeListener only takes instances of Function");var T,L=[];if(this.wildcard){var B=typeof f=="string"?f.split(this.delimiter):f.slice();if(!(L=Fe.call(this,null,B,this.listenerTree,0)))return this}else{if(!this._events[f])return this;T=this._events[f],L.push({_listeners:T})}for(var $=0;$0){for(T=0,L=(_=this._all).length;T0;)typeof(T=Y[_[B]])=="function"?L.push(T):L.push.apply(L,T);return L}if(this.wildcard){if(!($=this.listenerTree))return[];var q=[],F=typeof f=="string"?f.split(this.delimiter):f.slice();return Fe.call(this,q,F,$,0),q}return Y&&(T=Y[f])?typeof T=="function"?[T]:T:[]},m.prototype.eventNames=function(f){var _=this._events;return this.wildcard?S.call(this,this.listenerTree,[],null,f):_?E(_):[]},m.prototype.listenerCount=function(f){return this.listeners(f).length},m.prototype.hasListeners=function(f){if(this.wildcard){var _=[],T=typeof f=="string"?f.split(this.delimiter):f.slice();return Fe.call(this,_,T,this.listenerTree,0),_.length>0}var L=this._events,B=this._all;return!!(B&&B.length||L&&(f===n?E(L).length:L[f]))},m.prototype.listenersAny=function(){return this._all?this._all:[]},m.prototype.waitFor=function(f,_){var T=this,L=typeof _;return L==="number"?_={timeout:_}:L==="function"&&(_={filter:_}),Ce((_=te(_,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:Ee,Promise:se})).Promise,function(B,$,Y){function q(){var F=_.filter;if(!F||F.apply(T,arguments))if(T.off(f,q),_.handleError){var K=arguments[0];K?$(K):B(z.apply(null,arguments).slice(1))}else B(z.apply(null,arguments))}Y(function(){T.off(f,q)}),T._on(f,q,!1)},{timeout:_.timeout,overload:_.overload})};var p=m.prototype;Object.defineProperties(m,{defaultMaxListeners:{get:function(){return p._maxListeners},set:function(f){if(typeof f!="number"||f<0||Number.isNaN(f))throw TypeError("n must be a non-negative number");p._maxListeners=f},enumerable:!0},once:{value:function(f,_,T){return Ce((T=te(T,{Promise,timeout:0,overload:!1},{Promise:se})).Promise,function(L,B,$){var Y;if(typeof f.addEventListener=="function")return Y=function(){L(z.apply(null,arguments))},$(function(){f.removeEventListener(_,Y)}),void f.addEventListener(_,Y,{once:!0});var q,F=function(){q&&f.removeListener("error",q),L(z.apply(null,arguments))};_!=="error"&&(q=function(K){f.removeListener(_,F),B(K)},f.once("error",q)),$(function(){q&&f.removeListener("error",q),f.removeListener(_,F)}),f.once(_,F)},{timeout:T.timeout,overload:T.overload})},writable:!0,configurable:!0}}),Object.defineProperties(p,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=m})()})(UD);var GJ=R(UD.exports);const ZJ={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class I7{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||ZJ,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]||(this.observers[r]=new Map);const a=this.observers[r].get(n)||0;this.observers[r].set(n,a+1)}),this}off(t,n){this.observers[t]&&(n?this.observers[t].delete(n):delete this.observers[t])}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a{let[h,y]=i;for(let k=0;k{let[h,y]=i;for(let k=0;k{e=r,t=a});return n.resolve=e,n.reject=t,n}function KD(e){return e==null?"":""+e}const QJ=/###/g;function Hy(e,t,n){function r(y){return y&&y.indexOf("###")>-1?y.replace(QJ,"."):y}function a(){return!e||typeof e=="string"}const i=typeof t!="string"?t:t.split(".");let h=0;for(;h":">",'"':""","'":"'","/":"/"};function JJ(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>XJ[t]):e}const e4=[" ",",","?","!",";"],t4=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20);function gM(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let a=e;for(let i=0;i-1&&k0?e.replace("_","-"):e}class qD extends L7{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,h=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let y;t.indexOf(".")>-1?y=t.split("."):(y=[t,n],r&&(Array.isArray(r)?y.push(...r):typeof r=="string"&&i?y.push(...r.split(i)):y.push(r)));const k=O7(this.data,y);return!k&&!n&&!r&&t.indexOf(".")>-1&&(t=y[0],n=y[1],r=y.slice(2).join(".")),k||!h||typeof r!="string"?k:gM(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,a){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const h=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let y=[t,n];r&&(y=y.concat(h?r.split(h):r)),t.indexOf(".")>-1&&(y=t.split("."),a=n,n=y[1]),this.addNamespaces(n),HD(this.data,y,a),i.silent||this.emit("added",t,n,r,a)}addResources(t,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(typeof r[i]=="string"||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});a.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,a,i){let h=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},y=[t,n];t.indexOf(".")>-1&&(y=t.split("."),a=r,r=n,n=y[1]),this.addNamespaces(n);let k=O7(this.data,y)||{};h.skipCopy||(r=JSON.parse(JSON.stringify(r))),a?$D(k,r,i):k={...k,...r},HD(this.data,y,k),h.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(r=>n[r]&&Object.keys(n[r]).length>0)}toJSON(){return this.data}}var WD={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,a))}),t}};const VD={};class D7 extends L7{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),function(r,a,i){["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(h=>{a[h]&&(i[h]=a[h])})}(0,t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=kf.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const h=r&&t.indexOf(r)>-1,y=!(this.options.userDefinedKeySeparator||n.keySeparator||this.options.userDefinedNsSeparator||n.nsSeparator||function(k,E,M){E=E||"",M=M||"";const C=e4.filter(H=>E.indexOf(H)<0&&M.indexOf(H)<0);if(C.length===0)return!0;const O=t4.getRegExp(`(${C.map(H=>H==="?"?"\\?":H).join("|")})`);let z=!O.test(k);if(!z){const H=k.indexOf(M);H>0&&!O.test(k.substring(0,H))&&(z=!0)}return z}(t,r,a));if(h&&!y){const k=t.match(this.interpolator.nestingRegexp);if(k&&k.length>0)return{key:t,namespaces:i};const E=t.split(r);(r!==a||r===a&&this.options.ns.indexOf(E[0])>-1)&&(i=E.shift()),t=E.join(a)}return typeof i=="string"&&(i=[i]),{key:t,namespaces:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const a=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:h,namespaces:y}=this.extractFromKey(t[t.length-1],n),k=y[y.length-1],E=n.lng||this.language,M=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(E&&E.toLowerCase()==="cimode"){if(M){const oe=n.nsSeparator||this.options.nsSeparator;return a?{res:`${k}${oe}${h}`,usedKey:h,exactUsedKey:h,usedLng:E,usedNS:k,usedParams:this.getUsedParamsDetails(n)}:`${k}${oe}${h}`}return a?{res:h,usedKey:h,exactUsedKey:h,usedLng:E,usedNS:k,usedParams:this.getUsedParamsDetails(n)}:h}const C=this.resolve(t,n);let O=C&&C.res;const z=C&&C.usedKey||h,H=C&&C.exactUsedKey||h,ee=Object.prototype.toString.apply(O),te=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,se=!this.i18nFormat||this.i18nFormat.handleAsObject;if(se&&O&&typeof O!="string"&&typeof O!="boolean"&&typeof O!="number"&&["[object Number]","[object Function]","[object RegExp]"].indexOf(ee)<0&&(typeof te!="string"||!Array.isArray(O))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const oe=this.options.returnedObjectHandler?this.options.returnedObjectHandler(z,O,{...n,ns:y}):`key '${h} (${this.language})' returned an object instead of string.`;return a?(C.res=oe,C.usedParams=this.getUsedParamsDetails(n),C):oe}if(i){const oe=Array.isArray(O),Ee=oe?[]:{},we=oe?H:z;for(const Ce in O)if(Object.prototype.hasOwnProperty.call(O,Ce)){const ze=`${we}${i}${Ce}`;Ee[Ce]=this.translate(ze,{...n,joinArrays:!1,ns:y}),Ee[Ce]===ze&&(Ee[Ce]=O[Ce])}O=Ee}}else if(se&&typeof te=="string"&&Array.isArray(O))O=O.join(te),O&&(O=this.extendTranslation(O,t,n,r));else{let oe=!1,Ee=!1;const we=n.count!==void 0&&typeof n.count!="string",Ce=D7.hasDefaultValue(n),ze=we?this.pluralResolver.getSuffix(E,n.count,n):"",Fe=n.ordinal&&we?this.pluralResolver.getSuffix(E,n.count,{ordinal:!1}):"",$e=we&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),S=$e&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${ze}`]||n[`defaultValue${Fe}`]||n.defaultValue;!this.isValidLookup(O)&&Ce&&(oe=!0,O=S),this.isValidLookup(O)||(Ee=!0,O=h);const P=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Ee?void 0:O,d=Ce&&S!==O&&this.options.updateMissing;if(Ee||oe||d){if(this.logger.log(d?"updateKey":"missingKey",E,k,h,d?S:O),i){const f=this.resolve(h,{...n,keySeparator:!1});f&&f.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let g=[];const m=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&m&&m[0])for(let f=0;f{const L=Ce&&T!==O?T:P;this.options.missingKeyHandler?this.options.missingKeyHandler(f,k,_,L,d,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(f,k,_,L,d,n),this.emit("missingKey",f,k,_,O)};this.options.saveMissing&&(this.options.saveMissingPlurals&&we?g.forEach(f=>{const _=this.pluralResolver.getSuffixes(f,n);$e&&n[`defaultValue${this.options.pluralSeparator}zero`]&&_.indexOf(`${this.options.pluralSeparator}zero`)<0&&_.push(`${this.options.pluralSeparator}zero`),_.forEach(T=>{p([f],h+T,n[`defaultValue${T}`]||S)})}):p(g,h,S))}O=this.extendTranslation(O,t,n,C,r),Ee&&O===h&&this.options.appendNamespaceToMissingKey&&(O=`${k}:${h}`),(Ee||oe)&&this.options.parseMissingKeyHandler&&(O=this.options.compatibilityAPI!=="v1"?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${k}:${h}`:h,oe?O:void 0):this.options.parseMissingKeyHandler(O))}return a?(C.res=O,C.usedParams=this.getUsedParamsDetails(n),C):O}extendTranslation(t,n,r,a,i){var h=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const E=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let M;if(E){const O=t.match(this.interpolator.nestingRegexp);M=O&&O.length}let C=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(C={...this.options.interpolation.defaultVariables,...C}),t=this.interpolator.interpolate(t,C,r.lng||this.language,r),E){const O=t.match(this.interpolator.nestingRegexp);M<(O&&O.length)&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&a&&a.res&&(r.lng=a.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var O=arguments.length,z=new Array(O),H=0;H1&&arguments[1]!==void 0?arguments[1]:{};return typeof t=="string"&&(t=[t]),t.forEach(k=>{if(this.isValidLookup(n))return;const E=this.extractFromKey(k,y),M=E.key;r=M;let C=E.namespaces;this.options.fallbackNS&&(C=C.concat(this.options.fallbackNS));const O=y.count!==void 0&&typeof y.count!="string",z=O&&!y.ordinal&&y.count===0&&this.pluralResolver.shouldUseIntlApi(),H=y.context!==void 0&&(typeof y.context=="string"||typeof y.context=="number")&&y.context!=="",ee=y.lngs?y.lngs:this.languageUtils.toResolveHierarchy(y.lng||this.language,y.fallbackLng);C.forEach(te=>{this.isValidLookup(n)||(h=te,!VD[`${ee[0]}-${te}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(h)&&(VD[`${ee[0]}-${te}`]=!0,this.logger.warn(`key "${r}" for languages "${ee.join(", ")}" won't get resolved as namespace "${h}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),ee.forEach(se=>{if(this.isValidLookup(n))return;i=se;const oe=[M];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(oe,M,se,te,y);else{let we;O&&(we=this.pluralResolver.getSuffix(se,y.count,y));const Ce=`${this.options.pluralSeparator}zero`,ze=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(O&&(oe.push(M+we),y.ordinal&&we.indexOf(ze)===0&&oe.push(M+we.replace(ze,this.options.pluralSeparator)),z&&oe.push(M+Ce)),H){const Fe=`${M}${this.options.contextSeparator}${y.context}`;oe.push(Fe),O&&(oe.push(Fe+we),y.ordinal&&we.indexOf(ze)===0&&oe.push(Fe+we.replace(ze,this.options.pluralSeparator)),z&&oe.push(Fe+Ce))}}let Ee;for(;Ee=oe.pop();)this.isValidLookup(n)||(a=Ee,n=this.getResource(se,te,Ee,y))}))})}),{res:n,usedKey:r,exactUsedKey:a,usedLng:i,usedNS:h}}isValidLookup(t){return!(t===void 0||!this.options.returnNull&&t===null||!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,a):this.resourceStore.getResource(t,n,r,a)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&typeof t.replace!="string";let a=r?t.replace:t;if(r&&t.count!==void 0&&(a.count=t.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!r){a={...a};for(const i of n)delete a[i]}return a}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,12)&&t[r]!==void 0)return!0;return!1}}function vM(e){return e.charAt(0).toUpperCase()+e.slice(1)}class YD{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=kf.create("languageUtils")}getScriptPartFromCode(t){if(!(t=N7(t))||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2?null:(n.pop(),n[n.length-1].toLowerCase()==="x"?null:this.formatLanguageCode(n.join("-")))}getLanguagePartFromCode(t){if(!(t=N7(t))||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(a=>a.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=vM(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=vM(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=vM(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const a=this.formatLanguageCode(r);this.options.supportedLngs&&!this.isSupportedCode(a)||(n=a)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const a=this.getLanguagePartFromCode(r);if(this.isSupportedCode(a))return n=a;n=this.options.supportedLngs.find(i=>i===a?i:i.indexOf("-")<0&&a.indexOf("-")<0?void 0:i.indexOf("-")>0&&a.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===a||i.indexOf(a)===0&&a.length>1?i:void 0)}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),a=[],i=h=>{h&&(this.isSupportedCode(h)?a.push(h):this.logger.warn(`rejecting language code not found in supportedLngs: ${h}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):typeof t=="string"&&i(this.formatLanguageCode(t)),r.forEach(h=>{a.indexOf(h)<0&&i(this.formatLanguageCode(h))}),a}}let n4=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],r4={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const i4=["v1","v2","v3"],o4=["v4"],GD={zero:0,one:1,two:2,few:3,many:4,other:5};class a4{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=kf.create("pluralResolver"),this.options.compatibilityJSON&&!o4.includes(this.options.compatibilityJSON)||typeof Intl<"u"&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=function(){const r={};return n4.forEach(a=>{a.lngs.forEach(i=>{r[i]={numbers:a.nr,plurals:r4[a.fc]}})}),r}()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(N7(t==="dev"?"en":t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(a=>`${n}${a}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((a,i)=>GD[a]-GD[i]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):r.numbers.map(a=>this.getSuffix(t,a,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const a=this.getRule(t,r);return a?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:this.getSuffixRetroCompatible(a,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let a=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(a===2?a="plural":a===1&&(a=""));const i=()=>this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString();return this.options.compatibilityJSON==="v1"?a===1?"":typeof a=="number"?`_plural_${a.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!i4.includes(this.options.compatibilityJSON)}}function ZD(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",a=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],i=function(h,y,k){const E=O7(h,k);return E!==void 0?E:O7(y,k)}(e,t,n);return!i&&a&&typeof n=="string"&&(i=gM(e,n,r),i===void 0&&(i=gM(t,n,r))),i}class s4{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=kf.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:a,prefix:i,prefixEscaped:h,suffix:y,suffixEscaped:k,formatSeparator:E,unescapeSuffix:M,unescapePrefix:C,nestingPrefix:O,nestingPrefixEscaped:z,nestingSuffix:H,nestingSuffixEscaped:ee,nestingOptionsSeparator:te,maxReplaces:se,alwaysFormat:oe}=t.interpolation;this.escape=n!==void 0?n:JJ,this.escapeValue=r===void 0||r,this.useRawValueToEscape=a!==void 0&&a,this.prefix=i?O2(i):h||"{{",this.suffix=y?O2(y):k||"}}",this.formatSeparator=E||",",this.unescapePrefix=M?"":C||"-",this.unescapeSuffix=this.unescapePrefix?"":M||"",this.nestingPrefix=O?O2(O):z||O2("$t("),this.nestingSuffix=H?O2(H):ee||O2(")"),this.nestingOptionsSeparator=te||",",this.maxReplaces=se||1e3,this.alwaysFormat=oe!==void 0&&oe,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,a){let i,h,y;const k=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function E(z){return z.replace(/\$/g,"$$$$")}const M=z=>{if(z.indexOf(this.formatSeparator)<0){const se=ZD(n,k,z,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(se,void 0,r,{...a,...n,interpolationkey:z}):se}const H=z.split(this.formatSeparator),ee=H.shift().trim(),te=H.join(this.formatSeparator).trim();return this.format(ZD(n,k,ee,this.options.keySeparator,this.options.ignoreJSONStructure),te,r,{...a,...n,interpolationkey:ee})};this.resetRegExp();const C=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,O=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:z=>E(z)},{regex:this.regexp,safeValue:z=>this.escapeValue?E(this.escape(z)):E(z)}].forEach(z=>{for(y=0;i=z.regex.exec(t);){const H=i[1].trim();if(h=M(H),h===void 0)if(typeof C=="function"){const te=C(t,i,a);h=typeof te=="string"?te:""}else if(a&&Object.prototype.hasOwnProperty.call(a,H))h="";else{if(O){h=i[0];continue}this.logger.warn(`missed to pass in variable ${H} for interpolating ${t}`),h=""}else typeof h=="string"||this.useRawValueToEscape||(h=KD(h));const ee=z.safeValue(h);if(t=t.replace(i[0],ee),O?(z.regex.lastIndex+=h.length,z.regex.lastIndex-=i[0].length):z.regex.lastIndex=0,y++,y>=this.maxReplaces)break}}),t}nest(t,n){let r,a,i,h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};function y(k,E){const M=this.nestingOptionsSeparator;if(k.indexOf(M)<0)return k;const C=k.split(new RegExp(`${M}[ ]*{`));let O=`{${C[1]}`;k=C[0],O=this.interpolate(O,i);const z=O.match(/'/g),H=O.match(/"/g);(z&&z.length%2==0&&!H||H.length%2!=0)&&(O=O.replace(/'/g,'"'));try{i=JSON.parse(O),E&&(i={...E,...i})}catch(ee){return this.logger.warn(`failed parsing options string in nesting for key ${k}`,ee),`${k}${M}${O}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,k}for(;r=this.nestingRegexp.exec(t);){let k=[];i={...h},i=i.replace&&typeof i.replace!="string"?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;let E=!1;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const M=r[1].split(this.formatSeparator).map(C=>C.trim());r[1]=M.shift(),k=M,E=!0}if(a=n(y.call(this,r[1].trim(),i),i),a&&r[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=KD(a)),a||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${t}`),a=""),E&&(a=k.reduce((M,C)=>this.format(M,C,h.lng,{...h,interpolationkey:r[1].trim()}),a.trim())),t=t.replace(r[0],a),this.regexp.lastIndex=0}return t}}function N2(e){const t={};return function(n,r,a){const i=r+JSON.stringify(a);let h=t[i];return h||(h=e(N7(r),a),t[i]=h),h(n)}}class u4{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=kf.create("formatter"),this.options=t,this.formats={number:N2((n,r)=>{const a=new Intl.NumberFormat(n,{...r});return i=>a.format(i)}),currency:N2((n,r)=>{const a=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>a.format(i)}),datetime:N2((n,r)=>{const a=new Intl.DateTimeFormat(n,{...r});return i=>a.format(i)}),relativetime:N2((n,r)=>{const a=new Intl.RelativeTimeFormat(n,{...r});return i=>a.format(i,r.range||"day")}),list:N2((n,r)=>{const a=new Intl.ListFormat(n,{...r});return i=>a.format(i)})},this.init(t)}init(t){const n=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=N2(n)}format(t,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((h,y)=>{const{formatName:k,formatOptions:E}=function(M){let C=M.toLowerCase().trim();const O={};if(M.indexOf("(")>-1){const z=M.split("(");C=z[0].toLowerCase().trim();const H=z[1].substring(0,z[1].length-1);C==="currency"&&H.indexOf(":")<0?O.currency||(O.currency=H.trim()):C==="relativetime"&&H.indexOf(":")<0?O.range||(O.range=H.trim()):H.split(";").forEach(ee=>{if(ee){const[te,...se]=ee.split(":"),oe=se.join(":").trim().replace(/^'+|'+$/g,""),Ee=te.trim();O[Ee]||(O[Ee]=oe),oe==="false"&&(O[Ee]=!1),oe==="true"&&(O[Ee]=!0),isNaN(oe)||(O[Ee]=parseInt(oe,10))}})}return{formatName:C,formatOptions:O}}(y);if(this.formats[k]){let M=h;try{const C=a&&a.formatParams&&a.formatParams[a.interpolationkey]||{},O=C.locale||C.lng||a.locale||a.lng||r;M=this.formats[k](h,O,{...E,...a,...C})}catch(C){this.logger.warn(C)}return M}return this.logger.warn(`there was no format function for ${k}`),h},t)}}class l4 extends L7{constructor(t,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=a,this.logger=kf.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,a.backend,a)}queueLoad(t,n,r,a){const i={},h={},y={},k={};return t.forEach(E=>{let M=!0;n.forEach(C=>{const O=`${E}|${C}`;!r.reload&&this.store.hasResourceBundle(E,C)?this.state[O]=2:this.state[O]<0||(this.state[O]===1?h[O]===void 0&&(h[O]=!0):(this.state[O]=1,M=!1,h[O]===void 0&&(h[O]=!0),i[O]===void 0&&(i[O]=!0),k[C]===void 0&&(k[C]=!0)))}),M||(y[E]=!0)}),(Object.keys(i).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(i),pending:Object.keys(h),toLoadLanguages:Object.keys(y),toLoadNamespaces:Object.keys(k)}}loaded(t,n,r){const a=t.split("|"),i=a[0],h=a[1];n&&this.emit("failedLoading",i,h,n),r&&this.store.addResourceBundle(i,h,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2;const y={};this.queue.forEach(k=>{(function(E,M,C,O){const{obj:z,k:H}=Hy(E,M,Object);z[H]=z[H]||[],z[H].push(C)})(k.loaded,[i],h),function(E,M){E.pending[M]!==void 0&&(delete E.pending[M],E.pendingCount--)}(k,t),n&&k.errors.push(n),k.pendingCount!==0||k.done||(Object.keys(k.loaded).forEach(E=>{y[E]||(y[E]={});const M=k.loaded[E];M.length&&M.forEach(C=>{y[E][C]===void 0&&(y[E][C]=!0)})}),k.done=!0,k.errors.length?k.callback(k.errors):k.callback())}),this.emit("loaded",y),this.queue=this.queue.filter(k=>!k.done)}read(t,n,r){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,h=arguments.length>5?arguments[5]:void 0;if(!t.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:t,ns:n,fcName:r,tried:a,wait:i,callback:h});this.readingCalls++;const y=(E,M)=>{if(this.readingCalls--,this.waitingReads.length>0){const C=this.waitingReads.shift();this.read(C.lng,C.ns,C.fcName,C.tried,C.wait,C.callback)}E&&M&&a{this.read.call(this,t,n,r,a+1,2*i,h)},i):h(E,M)},k=this.backend[r].bind(this.backend);if(k.length!==2)return k(t,n,y);try{const E=k(t,n);E&&typeof E.then=="function"?E.then(M=>y(null,M)).catch(y):y(null,E)}catch(E){y(E)}}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const i=this.queueLoad(t,n,r,a);if(!i.toLoad.length)return i.pending.length||a(),null;i.toLoad.forEach(h=>{this.loadOne(h)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),a=r[0],i=r[1];this.read(a,i,"read",void 0,void 0,(h,y)=>{h&&this.logger.warn(`${n}loading namespace ${i} for language ${a} failed`,h),!h&&y&&this.logger.log(`${n}loaded namespace ${i} for language ${a}`,y),this.loaded(t,h,y)})}saveMissing(t,n,r,a,i){let h=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},y=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n))this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(r!=null&&r!==""){if(this.backend&&this.backend.create){const k={...h,isUpdate:i},E=this.backend.create.bind(this.backend);if(E.length<6)try{let M;M=E.length===5?E(t,n,r,a,k):E(t,n,r,a),M&&typeof M.then=="function"?M.then(C=>y(null,C)).catch(y):y(null,M)}catch(M){y(M)}else E(t,n,r,a,y,k)}t&&t[0]&&this.store.addResource(t[0],n,r,a)}}}function QD(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){let t={};if(typeof e[1]=="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function XD(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function B7(){}class $y extends L7{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;var r;if(super(),this.options=XD(t),this.services={},this.logger=kf,this.modules={external:[]},r=this,Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(a=>{typeof r[a]=="function"&&(r[a]=r[a].bind(r))}),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const a=QD();function i(k){return k?typeof k=="function"?new k:k:null}if(this.options={...a,...this.options,...XD(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...a.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator),!this.options.isClone){let k;this.modules.logger?kf.init(i(this.modules.logger),this.options):kf.init(null,this.options),this.modules.formatter?k=this.modules.formatter:typeof Intl<"u"&&(k=u4);const E=new YD(this.options);this.store=new qD(this.options.resources,this.options);const M=this.services;M.logger=kf,M.resourceStore=this.store,M.languageUtils=E,M.pluralResolver=new a4(E,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!k||this.options.interpolation.format&&this.options.interpolation.format!==a.interpolation.format||(M.formatter=i(k),M.formatter.init(M,this.options),this.options.interpolation.format=M.formatter.format.bind(M.formatter)),M.interpolator=new s4(this.options),M.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},M.backendConnector=new l4(i(this.modules.backend),M.resourceStore,M,this.options),M.backendConnector.on("*",function(C){for(var O=arguments.length,z=new Array(O>1?O-1:0),H=1;H1?O-1:0),H=1;H{C.init&&C.init(this)})}if(this.format=this.options.interpolation.format,r||(r=B7),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const k=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);k.length>0&&k[0]!=="dev"&&(this.options.lng=k[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(k=>{this[k]=function(){return t.store[k](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(k=>{this[k]=function(){return t.store[k](...arguments),t}});const h=Ky(),y=()=>{const k=(E,M)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),h.resolve(M),r(E,M)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return k(null,this.t.bind(this));this.changeLanguage(this.options.lng,k)};return this.options.resources||!this.options.initImmediate?y():setTimeout(y,0),h}loadResources(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:B7;const r=typeof t=="string"?t:this.language;if(typeof t=="function"&&(n=t),!this.options.resources||this.options.partialBundledLanguages){if(r&&r.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const a=[],i=h=>{h&&h!=="cimode"&&this.services.languageUtils.toResolveHierarchy(h).forEach(y=>{y!=="cimode"&&a.indexOf(y)<0&&a.push(y)})};r?i(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>i(h)),this.options.preload&&this.options.preload.forEach(h=>i(h)),this.services.backendConnector.load(a,this.options.ns,h=>{h||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),n(h)})}else n(null)}reloadResources(t,n,r){const a=Ky();return t||(t=this.languages),n||(n=this.options.ns),r||(r=B7),this.services.backendConnector.reload(t,n,i=>{a.resolve(),r(i)}),a}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&WD.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(t&&this.languages&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const a=Ky();this.emit("languageChanging",t);const i=k=>{this.language=k,this.languages=this.services.languageUtils.toResolveHierarchy(k),this.resolvedLanguage=void 0,this.setResolvedLanguage(k)},h=(k,E)=>{E?(i(E),this.translator.changeLanguage(E),this.isLanguageChangingTo=void 0,this.emit("languageChanged",E),this.logger.log("languageChanged",E)):this.isLanguageChangingTo=void 0,a.resolve(function(){return r.t(...arguments)}),n&&n(k,function(){return r.t(...arguments)})},y=k=>{t||k||!this.services.languageDetector||(k=[]);const E=typeof k=="string"?k:this.services.languageUtils.getBestMatchFromCodes(k);E&&(this.language||i(E),this.translator.language||this.translator.changeLanguage(E),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(E)),this.loadResources(E,M=>{h(M,E)})};return t||!this.services.languageDetector||this.services.languageDetector.async?!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(y):this.services.languageDetector.detect(y):y(t):y(this.services.languageDetector.detect()),a}getFixedT(t,n,r){var a=this;const i=function(h,y){let k;if(typeof y!="object"){for(var E=arguments.length,M=new Array(E>2?E-2:0),C=2;C`${k.keyPrefix}${O}${H}`):k.keyPrefix?`${k.keyPrefix}${O}${h}`:h,a.t(z,k)};return typeof t=="string"?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],a=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const h=(y,k)=>{const E=this.services.backendConnector.state[`${y}|${k}`];return E===-1||E===2};if(n.precheck){const y=n.precheck(this,h);if(y!==void 0)return y}return!(!this.hasResourceBundle(r,t)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!h(r,t)||a&&!h(i,t)))}loadNamespaces(t,n){const r=Ky();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Ky();typeof t=="string"&&(t=[t]);const a=this.options.preload||[],i=t.filter(h=>a.indexOf(h)<0&&this.services.languageUtils.isSupportedCode(h));return i.length?(this.options.preload=a.concat(i),this.loadResources(h=>{r.resolve(),n&&n(h)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=this.services&&this.services.languageUtils||new YD(QD());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(n.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new $y(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:B7;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const a={...this.options,...t,isClone:!0},i=new $y(a);return t.debug===void 0&&t.prefix===void 0||(i.logger=i.logger.clone(t)),["store","services","language"].forEach(h=>{i[h]=this[h]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new qD(this.store.data,a),i.services.resourceStore=i.store),i.translator=new D7(i.services,a),i.translator.on("*",function(h){for(var y=arguments.length,k=new Array(y>1?y-1:0),E=1;Esecp256k1":!1,"socket.io-client>engine.io-client>ws>bufferutil":!1,"socket.io-client>engine.io-client>ws>utf-8-validate":!1,"@metamask/sdk-communication-layer>bufferutil":!1,"@metamask/sdk-communication-layer>eciesjs>secp256k1":!1,"@metamask/sdk-communication-layer>utf-8-validate":!1}}};(function(e){e.INPAGE="metamask-inpage",e.CONTENT_SCRIPT="metamask-contentscript",e.PROVIDER="metamask-provider"})(qy||(qy={}));const JD="direct",Wy="https://metamask.app.link/connect",Vy="metamask://connect",eB={NAME:"MetaMask",RDNS:"io.metamask"},f4=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,Ls={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};var yM;o.PROVIDER_UPDATE_TYPE=void 0,(yM=o.PROVIDER_UPDATE_TYPE||(o.PROVIDER_UPDATE_TYPE={})).TERMINATE="terminate",yM.EXTENSION="extension",yM.INITIALIZED="initialized";const d4=typeof window<"u"&&window.localStorage;function h4({instance:e,msg:t}){return Tn(this,void 0,void 0,function*(){if(e._initialized||(ht("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield e.init()),ht(`[MetaMaskSDK: connectAndSign()] activeProvider=${e.activeProvider}`),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=function(r){return/^0x([0-9A-Fa-f]{2})*$/u.test(r)}(t)?t:function(r){let a;if(typeof Buffer<"u")a=Buffer.from(r,"utf8").toString("hex");else if(typeof TextEncoder<"u"){const i=new TextEncoder().encode(r);a=Array.from(i).map(h=>h.toString(16).padStart(2,"0")).join("")}else{if(typeof ku!="object"||!("Buffer"in ku))throw new Error("Unable to convert string to hex: No available method.");a=ku.Buffer.from(r,"utf8").toString("hex")}return`0x${a}`}(t);return e.activeProvider.request({method:Vn.METAMASK_CONNECTWITH,params:[{method:Vn.PERSONAL_SIGN,params:[n]}]})})}function tB(e){var t,n;return Tn(this,void 0,void 0,function*(){ht("[MetaMaskSDK: connectWithExtensionProvider()] ",e),e.sdkProvider=e.activeProvider,e.activeProvider=window.extension,window.ethereum=window.extension;try{const r=yield(t=window.extension)===null||t===void 0?void 0:t.request({method:"eth_requestAccounts"});ht(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${r}`)}catch(r){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",r)}localStorage.setItem(P7,"extension"),e.extensionActive=!0,e.emit(Ls.ProviderUpdate,o.PROVIDER_UPDATE_TYPE.EXTENSION),e.options.enableAnalytics&&((n=e.analytics)===null||n===void 0||n.send({event:ho.SDK_USE_EXTENSION}))})}function Yy(e){return Yy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yy(e)}function p4(e){var t=function(n,r){if(Yy(n)!=="object"||n===null)return n;var a=n[Symbol.toPrimitive];if(a!==void 0){var i=a.call(n,r);if(Yy(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(e,"string");return Yy(t)==="symbol"?t:String(t)}function m4(e,t){for(var n=0;n4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+60*n*1e3)),r&&(a.domain=r),document.cookie=function(i,h,y){var k=y||{};k.path=k.path||"/";var E=encodeURIComponent(h),M="".concat(i,"=").concat(E);if(k.maxAge>0){var C=k.maxAge-0;if(Number.isNaN(C))throw new Error("maxAge should be a Number");M+="; Max-Age=".concat(Math.floor(C))}if(k.domain){if(!rB.test(k.domain))throw new TypeError("option domain is invalid");M+="; Domain=".concat(k.domain)}if(k.path){if(!rB.test(k.path))throw new TypeError("option path is invalid");M+="; Path=".concat(k.path)}if(k.expires){if(typeof k.expires.toUTCString!="function")throw new TypeError("option expires is invalid");M+="; Expires=".concat(k.expires.toUTCString())}if(k.httpOnly&&(M+="; HttpOnly"),k.secure&&(M+="; Secure"),k.sameSite)switch(typeof k.sameSite=="string"?k.sameSite.toLowerCase():k.sameSite){case!0:M+="; SameSite=Strict";break;case"lax":M+="; SameSite=Lax";break;case"strict":M+="; SameSite=Strict";break;case"none":M+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return M}(e,encodeURIComponent(t),a)},b4=function(e){for(var t="".concat(e,"="),n=document.cookie.split(";"),r=0;r-1&&(n=window.location.hash.substring(window.location.hash.indexOf("?")));for(var r=n.substring(1).split("&"),a=0;a0&&r[a].substring(0,i)===e.lookupQuerystring&&(t=r[a].substring(i+1))}}return t}},Gy=null,iB=function(){if(Gy!==null)return Gy;try{Gy=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Gy=!1}return Gy},S4={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&iB()){var n=window.localStorage.getItem(e.lookupLocalStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&iB()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Zy=null,oB=function(){if(Zy!==null)return Zy;try{Zy=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Zy=!1}return Zy},E4={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&oB()){var n=window.sessionStorage.getItem(e.lookupSessionStorage);n&&(t=n)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&oB()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},k4={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var n=0;n0?t:void 0}},M4={name:"htmlTag",lookup:function(e){var t,n=e.htmlTag||(typeof document<"u"?document.documentElement:null);return n&&typeof n.getAttribute=="function"&&(t=n.getAttribute("lang")),t}},C4={name:"path",lookup:function(e){var t;if(typeof window<"u"){var n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(n instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof n[e.lookupFromPathIndex]!="string")return;t=n[e.lookupFromPathIndex].replace("/","")}else t=n[0].replace("/","")}return t}},x4={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,n=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[t]}},aB=function(){function e(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(function(i,h){if(!(i instanceof h))throw new TypeError("Cannot call a class as a function")})(this,e),this.type="languageDetector",this.detectors={},this.init(r,a)}var t,n;return t=e,n=[{key:"init",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=r||{languageUtils:{}},this.options=function(h){return g4.call(v4.call(arguments,1),function(y){if(y)for(var k in y)h[k]===void 0&&(h[k]=y[k])}),h}(a,this.options||{},{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(h){return h}}),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(h){return h.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(w4),this.addDetector(_4),this.addDetector(S4),this.addDetector(E4),this.addDetector(k4),this.addDetector(M4),this.addDetector(C4),this.addDetector(x4)}},{key:"addDetector",value:function(r){this.detectors[r.name]=r}},{key:"detect",value:function(r){var a=this;r||(r=this.options.order);var i=[];return r.forEach(function(h){if(a.detectors[h]){var y=a.detectors[h].lookup(a.options);y&&typeof y=="string"&&(y=[y]),y&&(i=i.concat(y))}}),i=i.map(function(h){return a.options.convertDetectedLanguage(h)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(r,a){var i=this;a||(a=this.options.caches),a&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(r)>-1||a.forEach(function(h){i.detectors[h]&&i.detectors[h].cacheUserLanguage(r,i.options)}))}}],n&&m4(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();aB.type="languageDetector";var sB={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",SCAN_TO_CONNECT:"Scan to connect and sign with",CONNECT_WITH_EXTENSION:"Connect With MetaMask Extension",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION:"Install MetaMask Extension"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}},A4={DESKTOP:"Escritorio",MOBILE:"Móvil",META_MASK_MOBILE_APP:"Aplicación móvil de MetaMask",SCAN_TO_CONNECT:"Escanear para conectar y firmar con",CONNECT_WITH_EXTENSION:"Conectar con la Extensión de MetaMask",INSTALL_MODAL:{TRUSTED_BY_USERS:"Confiado por más de 30 millones de usuarios para comprar, almacenar, enviar e intercambiar cripto de manera segura",LEADING_CRYPTO_WALLET:"La principal billetera de criptomonedas y pasarela hacia aplicaciones blockchain construidas en Ethereum Mainnet, Polygon, Optimism y muchas otras redes",CONTROL_DIGITAL_INTERACTIONS:"Te da el control de tus interacciones digitales al hacer que el poder de la criptografía sea más accesible",INSTALL_META_MASK_EXTENSION:"Instalar la Extensión de MetaMask"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Por favor, abre la aplicación de billetera MetaMask y selecciona el código en la pantalla O desconecta",OPEN_META_MASK_CONTINUE:"Abre la aplicación de MetaMask para continuar con tu sesión.",NUMBER_AFTER_OPEN_NOTICE:"Si no aparece un número después de abrir MetaMask, por favor haz clic en desconectar y vuelve a escanear el código QR.",DISCONNECT:"Desconectar"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Toma el control de tu cripto y explora la blockchain con la billetera en la que confían más de 30 millones de personas en todo el mundo"},META_MASK_MODAL:{ADDRESS_COPIED:"¡Dirección copiada al portapapeles!",DISCONNECT:"Desconectar",ACTIVE_NETWORK:"Red activa"}},T4={DESKTOP:"Bureau",MOBILE:"Mobile",META_MASK_MOBILE_APP:"Application mobile MetaMask",SCAN_TO_CONNECT:"Scannez pour vous connecter et signer avec",CONNECT_WITH_EXTENSION:"Connectez-vous avec l'extension MetaMask",INSTALL_MODAL:{TRUSTED_BY_USERS:"Fait confiance à plus de 30 millions d'utilisateurs pour acheter, stocker, envoyer et échanger des crypto en toute sécurité",LEADING_CRYPTO_WALLET:"Le portefeuille crypto leader et la passerelle vers des applications blockchain basées sur Ethereum Mainnet, Polygon, Optimism, et de nombreux autres réseaux",CONTROL_DIGITAL_INTERACTIONS:"Vous donne le contrôle de vos interactions numériques en rendant la puissance de la cryptographie plus accessible",INSTALL_META_MASK_EXTENSION:"Installez l'extension MetaMask"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Veuillez ouvrir l'application MetaMask et sélectionnez le code à l'écran OU déconnectez-vous",OPEN_META_MASK_CONTINUE:"Ouvrez l'application MetaMask pour continuer votre session.",NUMBER_AFTER_OPEN_NOTICE:"Si un numéro n'apparaît pas après avoir ouvert MetaMask, veuillez cliquer sur déconnecter et rescanner le QRCode.",DISCONNECT:"Déconnecter"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Prenez le contrôle de votre crypto et explorez la blockchain avec le portefeuille fait confiance par plus de 30 millions de personnes à travers le monde"},META_MASK_MODAL:{ADDRESS_COPIED:"Adresse copiée dans le presse-papiers!",DISCONNECT:"Déconnecter",ACTIVE_NETWORK:"Réseau actif"}},R4={DESKTOP:"שולחן עבודה",MOBILE:"נייד",META_MASK_MOBILE_APP:"אפליקציית מטא מאסק לנייד",SCAN_TO_CONNECT:"סרוק כדי להתחבר ולחתום עם",CONNECT_WITH_EXTENSION:"התחבר עם התוסף של מטא מאסק",INSTALL_MODAL:{TRUSTED_BY_USERS:"מהימנים על ידי למעלה מ-30 מיליון משתמשים לקנות, לאחסן, לשלוח ולהחליף מטבע קריפטוגרפי בבטחה",LEADING_CRYPTO_WALLET:"ארנק הקריפטו המוביל והשער ליישומי בלוקצ'יין המתוכנתים על אתריום, פוליגון, ורשתות רבות נוספות",CONTROL_DIGITAL_INTERACTIONS:"מכניס אותך לשליטה על האינטראקציות הדיגיטליות שלך על ידי הפיכת כוח הקריפטוגרפיה לנגיש יותר",INSTALL_META_MASK_EXTENSION:"התקן את ההרחבה של מטא מאסק"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"אנא פתח את אפליקציית ארנק מטא מאסק ובחר את הקוד שמופיע על המסך או התנתק",OPEN_META_MASK_CONTINUE:"פתח את האפליקציה של מטא מאסק כדי להמשיך בפעולה שלך.",NUMBER_AFTER_OPEN_NOTICE:"אם מספר אינו מופיע לאחר פתיחת מטא מאסק, אנא לחץ על התנתקות וסרוק מחדש את ה-QRCode.",DISCONNECT:"התנתק"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"קח שליטה על הקריפטו שלך וחקור את הבלוקצ'יין עם הארנק האמין שבשימוש על ידי למעלה מ-30 מיליון אנשים ברחבי העולם"},META_MASK_MODAL:{ADDRESS_COPIED:"הכתובת הועתקה ללוח!",DISCONNECT:"התנתק",ACTIVE_NETWORK:"רשת פעילה"}},P4={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"App mobile MetaMask",SCAN_TO_CONNECT:"Scansiona per connetterti e firmare con",CONNECT_WITH_EXTENSION:"Connettiti con l'estensione MetaMask",INSTALL_MODAL:{TRUSTED_BY_USERS:"Ritenuto affidabile da oltre 30 milioni di utenti per acquistare, conservare, inviare e scambiare cripto in modo sicuro",LEADING_CRYPTO_WALLET:"Il principale portafoglio cripto e gateway per applicazioni blockchain funzionanti su Ethereum Mainnet, Polygon, Optimism e molte altre reti",CONTROL_DIGITAL_INTERACTIONS:"Ti da il controllo delle tue interazioni digitali rendendo piu' accessibile il potere della crittografia",INSTALL_META_MASK_EXTENSION:"Installa l'estensione MetaMask"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Si prega di aprire l'app mobile MetaMask Wallet e selezionare il codice sullo schermo OPPURE scollegarsi",OPEN_META_MASK_CONTINUE:"Apri l'app mobile MetaMask per continuare con la tua sessione.",NUMBER_AFTER_OPEN_NOTICE:"Se, dopo aver aperto MetaMask, non appare alcun numero, si prega di fare clic su disconnetti e ris canzionare il QRCode.",DISCONNECT:"Disconnetti"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Prendi il controllo delle tue cripto e esplora la blockchain con il portafoglio ritenuto affidabile da oltre 30 milioni di persone in tutto il mondo"},META_MASK_MODAL:{ADDRESS_COPIED:"Indirizzo copiato negli appunti!",DISCONNECT:"Disconnetti",ACTIVE_NETWORK:"Rete attiva"}},I4={DESKTOP:"Desktop",MOBILE:"Móvel",META_MASK_MOBILE_APP:"Aplicativo móvel MetaMask",SCAN_TO_CONNECT:"Escanear para conectar e assinar com",CONNECT_WITH_EXTENSION:"Conectar com a extensão MetaMask",INSTALL_MODAL:{TRUSTED_BY_USERS:"Confiado por mais de 30 milhões de usuários para comprar, armazenar, enviar e trocar cripto com segurança",LEADING_CRYPTO_WALLET:"A principal carteira de cripto & portal para aplicativos blockchain construídos em Ethereum Mainnet, Polygon, Optimism, e muitas outras redes",CONTROL_DIGITAL_INTERACTIONS:"Coloca você no controle de suas interações digitais, tornando o poder da criptografia mais acessível",INSTALL_META_MASK_EXTENSION:"Instalar a extensão MetaMask"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Por favor, abra o aplicativo MetaMask e selecione o código na tela OU desconecte",OPEN_META_MASK_CONTINUE:"Abra o aplicativo MetaMask para continuar sua sessão.",NUMBER_AFTER_OPEN_NOTICE:"Se um número não aparecer após abrir o MetaMask, por favor clique em desconectar e re-escaneie o QRCode.",DISCONNECT:"Desconectar"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Assuma o controle de sua cripto e explore a blockchain com a carteira confiada por mais de 30 milhões de pessoas em todo o mundo"},META_MASK_MODAL:{ADDRESS_COPIED:"Endereço copiado para a área de transferência!",DISCONNECT:"Desconectar",ACTIVE_NETWORK:"Rede ativa"}},L4={DESKTOP:"Masaüstü",MOBILE:"Mobil",META_MASK_MOBILE_APP:"MetaMask mobil uygulama",SCAN_TO_CONNECT:"Bağlanmak ve imzalamak için tarayın",CONNECT_WITH_EXTENSION:"MetaMask Eklentisi ile Bağlan",INSTALL_MODAL:{TRUSTED_BY_USERS:"Kriptoyu güvenle satın almak, saklamak, göndermek ve değiştirmek için 30 milyondan fazla kullanıcı tarafından güvenilir",LEADING_CRYPTO_WALLET:"Ethereum Ana Ağı, Polygon, Optimism ve birçok diğer ağda kurulu blockchain uygulamalarına erişim sağlayan öncü kripto cüzdanı",CONTROL_DIGITAL_INTERACTIONS:"Kriptografinin gücünü daha erişilebilir kılarak dijital etkileşimlerinizin kontrolünü size verir",INSTALL_META_MASK_EXTENSION:"MetaMask Eklentisini Yükleyin"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Lütfen MetaMask cüzdan uygulamasını açın ve ekrandaki kodu seçin YA DA bağlantıyı kesin",OPEN_META_MASK_CONTINUE:"Oturumunuzla devam etmek için MetaMask uygulamasını açın.",NUMBER_AFTER_OPEN_NOTICE:"MetaMask'ı açtıktan sonra bir numara görünmezse, lütfen bağlantıyı kesin ve QR Kodunu tekrar tarayın.",DISCONNECT:"Bağlantıyı Kes"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Kriptonuzu kontrol edin ve dünya genelinde 30 milyondan fazla kişi tarafından güvenilen cüzdanla blockchain'i keşfedin"},META_MASK_MODAL:{ADDRESS_COPIED:"Adres panoya kopyalandı!",DISCONNECT:"Bağlantıyı Kes",ACTIVE_NETWORK:"Aktif Ağ"}};function z7(e){let t;if(typeof Buffer<"u")t=Buffer.from(e,"utf8").toString("base64");else if(typeof btoa=="function")t=btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/gu,(n,r)=>String.fromCharCode(parseInt(r,16))));else{if(typeof ku!="object"||!("Buffer"in ku))throw new Error("Unable to base64 encode: No available method.");t=ku.Buffer.from(e,"utf8").toString("base64")}return t}class Ql{constructor({shouldSetOnWindow:t,connectionStream:n,shouldSendMetadata:r=!1,shouldShimWeb3:a,sdkInstance:i}){const h=new jD({connectionStream:n,shouldSendMetadata:r,shouldSetOnWindow:t,shouldShimWeb3:a,autoRequestAccounts:!1}),y=new Proxy(h,{deleteProperty:()=>!0});var k;this.provider=y,this.sdkInstance=i,t&&typeof window<"u"&&(k=h,window.ethereum=k,window.dispatchEvent(new Event("ethereum#initialized"))),a&&typeof window<"u"&&function(E,M=console){let C=!1,O=!1;if(!window.web3){const z="__isMetaMaskShim__";let H={currentProvider:E};Object.defineProperty(H,z,{value:!0,enumerable:!0,configurable:!1,writable:!1}),H=new Proxy(H,{get:(ee,te,...se)=>(te!=="currentProvider"||C?te==="currentProvider"||te===z||O||(O=!0,M.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),E.request({method:"metamask_logWeb3ShimUsage"}).catch(oe=>{M.debug("MetaMask: Failed to log web3 shim usage.",oe)})):(C=!0,M.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(ee,te,...se)),set:(...ee)=>(M.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...ee))}),Object.defineProperty(window,"web3",{value:H,enumerable:!1,configurable:!0,writable:!0})}}(this.provider),this.provider.on("display_uri",E=>{this.sdkInstance.emit(Ls.DisplayURI,E)}),this.provider.on("_initialized",()=>{const E={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(Ls.Initialized,E),ht("[Ethereum: constructor()] provider initialized",E)})}static init(t){var n;return ht("[Ethereum: init()] Initializing Ethereum service"),this.instance=new Ql(t),(n=this.instance)===null||n===void 0?void 0:n.provider}static destroy(){}static getInstance(){var t;if(!(!((t=this.instance)===null||t===void 0)&&t.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var t;if(!(!((t=this.instance)===null||t===void 0)&&t.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}function O4(e,t,n,r){var a,i,h,y,k,E,M,C,O,z,H,ee,te,se,oe,Ee,we,Ce,ze,Fe;return Tn(this,void 0,void 0,function*(){const $e=(a=e.state.remote)===null||a===void 0?void 0:a.isReady(),S=(i=e.state.remote)===null||i===void 0?void 0:i.isConnected(),P=(h=e.state.remote)===null||h===void 0?void 0:h.isPaused(),d=Ql.getProvider(),g=(y=e.state.remote)===null||y===void 0?void 0:y.getChannelId(),m=(k=e.state.remote)===null||k===void 0?void 0:k.isAuthorized(),{deeplinkProtocol:p}=e.state,{method:f,data:_,triggeredInstaller:T}=(Y=>{var q,F,K,Z;let ne;je.isBuffer(Y)?(ne=Y.toJSON(),ne._isBuffer=!0):ne=Y;const ue=(q=ne==null?void 0:ne.data)===null||q===void 0?void 0:q.method;let me=!1;return typeof((F=ne==null?void 0:ne.data)===null||F===void 0?void 0:F.params)=="object"&&((Z=(K=ne==null?void 0:ne.data)===null||K===void 0?void 0:K.params)===null||Z===void 0?void 0:Z.__triggeredInstaller)===!0&&(me=!0,ne.data.params=ne.data.params.wrappedParams),{method:ue,data:ne,triggeredInstaller:me}})(t);if(ht(`[RCPMS: write()] method='${f}' isRemoteReady=${$e} channelId=${g} isSocketConnected=${S} isRemotePaused=${P} providerConnected=${d.isConnected()}`,t),!g)return f!==Vn.METAMASK_GETPROVIDERSTATE&&ht(`[RCPMS: write()] ${f} --> channelId is undefined`),r(new Error("disconnected"));ht(`[RCPMS: write()] remote.isPaused()=${(E=e.state.remote)===null||E===void 0?void 0:E.isPaused()} authorized=${m} ready=${$e} socketConnected=${S}`,t);const L=(M=e.state.platformManager)===null||M===void 0?void 0:M.isSecure(),B=(O=(C=e.state.platformManager)===null||C===void 0?void 0:C.isMobileWeb())!==null&&O!==void 0&&O,$=(H=(z=e.state.remote)===null||z===void 0?void 0:z.hasDeeplinkProtocol())!==null&&H!==void 0&&H&&B&&m;try{if($&&!T||(ee=e.state.remote)===null||ee===void 0||ee.sendMessage(_==null?void 0:_.data).then(()=>{ht(`[RCPMS: _write()] ${f} sent successfully`)}).catch(F=>{ht("[RCPMS: _write()] error sending message",F)}),!L)return ht(`[RCPMS: _write()] unsecure platform for method ${f} -- return callback`),r();if(T)return ht("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const Y=(oe=(se=(te=e.state.remote)===null||te===void 0?void 0:te.getKeyInfo())===null||se===void 0?void 0:se.ecies.public)!==null&&oe!==void 0?oe:"";let q=encodeURI(`channelId=${g}&pubkey=${Y}&comm=socket&t=d&v=2`);if($){const F=JSON.stringify(_==null?void 0:_.data),K=(Ee=e.state.remote)===null||Ee===void 0?void 0:Ee.encrypt(F);if(!K)return ht("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));q+=`&scheme=${p}&rpc=${z7(K)}`}if(!(!((we=e.state.platformManager)===null||we===void 0)&&we.isMetaMaskInstalled()))return ht("[RCPMS: _write()] prevent deeplink until installation is completed."),r();R7[f]?(ht(`[RCPMS: _write()] redirect link for '${f}' socketConnected=${S} connect?${q}`),(Ce=e.state.platformManager)===null||Ce===void 0||Ce.openDeeplink(`${Wy}?${q}`,`${Vy}?${q}`,"_self")):!((ze=e.state.remote)===null||ze===void 0)&&ze.isPaused()?(ht(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${f}`),(Fe=e.state.platformManager)===null||Fe===void 0||Fe.openDeeplink(`${Wy}?redirect=true&${q}`,`${Vy}?redirect=true&${q}`,"_self")):ht(`[RCPMS: _write()] method ${f} doesn't need redirect.`)}catch(Y){return ht("[RCPMS: _write()] error sending message",Y),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}class N4 extends Oh.Duplex{constructor({name:t,remote:n,deeplinkProtocol:r,platformManager:a}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=t,this.state.remote=n,this.state.deeplinkProtocol=r,this.state.platformManager=a,this._onMessage=this._onMessage.bind(this),this.state.remote.on(o.EventType.MESSAGE,this._onMessage)}_write(t,n,r){return Tn(this,void 0,void 0,function*(){return O4(this,t,0,r)})}_read(){}_onMessage(t){return function(n,r){try{if(ht("[RCPMS: onMessage()] message",r),!r||typeof r!="object"||typeof(r==null?void 0:r.data)!="object")return;if(!(r!=null&&r.name))return void ht("[RCPMS: onMessage()] ignore message without name",r);if((r==null?void 0:r.name)!==qy.PROVIDER)return void ht(`[RCPMS: onMessage()] ignore message with wrong name message=${r}`);if(je.isBuffer(r)){const a=je.from(r);n.push(a)}else n.push(r)}catch(a){ht(`[RCPMS: onMessage()] ignore message error err=${a}`)}}(this,t)}start(){}}var bM={exports:{}};(function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||b!==void 0&&b,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(h){var y=i!==void 0&&i||typeof self<"u"&&self||y!==void 0&&y,k="URLSearchParams"in y,E="Symbol"in y&&"iterator"in Symbol,M="FileReader"in y&&"Blob"in y&&function(){try{return new Blob,!0}catch{return!1}}(),C="FormData"in y,O="ArrayBuffer"in y;if(O)var z=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],H=ArrayBuffer.isView||function(p){return p&&z.indexOf(Object.prototype.toString.call(p))>-1};function ee(p){if(typeof p!="string"&&(p=String(p)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(p)||p==="")throw new TypeError('Invalid character in header field name: "'+p+'"');return p.toLowerCase()}function te(p){return typeof p!="string"&&(p=String(p)),p}function se(p){var f={next:function(){var _=p.shift();return{done:_===void 0,value:_}}};return E&&(f[Symbol.iterator]=function(){return f}),f}function oe(p){this.map={},p instanceof oe?p.forEach(function(f,_){this.append(_,f)},this):Array.isArray(p)?p.forEach(function(f){this.append(f[0],f[1])},this):p&&Object.getOwnPropertyNames(p).forEach(function(f){this.append(f,p[f])},this)}function Ee(p){if(p.bodyUsed)return Promise.reject(new TypeError("Already read"));p.bodyUsed=!0}function we(p){return new Promise(function(f,_){p.onload=function(){f(p.result)},p.onerror=function(){_(p.error)}})}function Ce(p){var f=new FileReader,_=we(f);return f.readAsArrayBuffer(p),_}function ze(p){if(p.slice)return p.slice(0);var f=new Uint8Array(p.byteLength);return f.set(new Uint8Array(p)),f.buffer}function Fe(){return this.bodyUsed=!1,this._initBody=function(p){var f;this.bodyUsed=this.bodyUsed,this._bodyInit=p,p?typeof p=="string"?this._bodyText=p:M&&Blob.prototype.isPrototypeOf(p)?this._bodyBlob=p:C&&FormData.prototype.isPrototypeOf(p)?this._bodyFormData=p:k&&URLSearchParams.prototype.isPrototypeOf(p)?this._bodyText=p.toString():O&&M&&(f=p)&&DataView.prototype.isPrototypeOf(f)?(this._bodyArrayBuffer=ze(p.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):O&&(ArrayBuffer.prototype.isPrototypeOf(p)||H(p))?this._bodyArrayBuffer=ze(p):this._bodyText=p=Object.prototype.toString.call(p):this._bodyText="",this.headers.get("content-type")||(typeof p=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):k&&URLSearchParams.prototype.isPrototypeOf(p)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},M&&(this.blob=function(){var p=Ee(this);if(p)return p;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?Ee(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(Ce)}),this.text=function(){var p,f,_,T=Ee(this);if(T)return T;if(this._bodyBlob)return p=this._bodyBlob,_=we(f=new FileReader),f.readAsText(p),_;if(this._bodyArrayBuffer)return Promise.resolve(function(L){for(var B=new Uint8Array(L),$=new Array(B.length),Y=0;Y-1?B:L}(f.method||this.method||"GET"),this.mode=f.mode||this.mode||null,this.signal=f.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&_)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(_),!(this.method!=="GET"&&this.method!=="HEAD"||f.cache!=="no-store"&&f.cache!=="no-cache")){var T=/([?&])_=[^&]*/;T.test(this.url)?this.url=this.url.replace(T,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function P(p){var f=new FormData;return p.trim().split("&").forEach(function(_){if(_){var T=_.split("="),L=T.shift().replace(/\+/g," "),B=T.join("=").replace(/\+/g," ");f.append(decodeURIComponent(L),decodeURIComponent(B))}}),f}function d(p,f){if(!(this instanceof d))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');f||(f={}),this.type="default",this.status=f.status===void 0?200:f.status,this.ok=this.status>=200&&this.status<300,this.statusText=f.statusText===void 0?"":""+f.statusText,this.headers=new oe(f.headers),this.url=f.url||"",this._initBody(p)}S.prototype.clone=function(){return new S(this,{body:this._bodyInit})},Fe.call(S.prototype),Fe.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new oe(this.headers),url:this.url})},d.error=function(){var p=new d(null,{status:0,statusText:""});return p.type="error",p};var g=[301,302,303,307,308];d.redirect=function(p,f){if(g.indexOf(f)===-1)throw new RangeError("Invalid status code");return new d(null,{status:f,headers:{location:p}})},h.DOMException=y.DOMException;try{new h.DOMException}catch{h.DOMException=function(f,_){this.message=f,this.name=_;var T=Error(f);this.stack=T.stack},h.DOMException.prototype=Object.create(Error.prototype),h.DOMException.prototype.constructor=h.DOMException}function m(p,f){return new Promise(function(_,T){var L=new S(p,f);if(L.signal&&L.signal.aborted)return T(new h.DOMException("Aborted","AbortError"));var B=new XMLHttpRequest;function $(){B.abort()}B.onload=function(){var Y,q,F={status:B.status,statusText:B.statusText,headers:(Y=B.getAllResponseHeaders()||"",q=new oe,Y.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(Z){return Z.indexOf(` +`)===0?Z.substr(1,Z.length):Z}).forEach(function(Z){var ne=Z.split(":"),ue=ne.shift().trim();if(ue){var me=ne.join(":").trim();q.append(ue,me)}}),q)};F.url="responseURL"in B?B.responseURL:F.headers.get("X-Request-URL");var K="response"in B?B.response:B.responseText;setTimeout(function(){_(new d(K,F))},0)},B.onerror=function(){setTimeout(function(){T(new TypeError("Network request failed"))},0)},B.ontimeout=function(){setTimeout(function(){T(new TypeError("Network request failed"))},0)},B.onabort=function(){setTimeout(function(){T(new h.DOMException("Aborted","AbortError"))},0)},B.open(L.method,function(Y){try{return Y===""&&y.location.href?y.location.href:Y}catch{return Y}}(L.url),!0),L.credentials==="include"?B.withCredentials=!0:L.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&(M?B.responseType="blob":O&&L.headers.get("Content-Type")&&L.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(B.responseType="arraybuffer")),!f||typeof f.headers!="object"||f.headers instanceof oe?L.headers.forEach(function(Y,q){B.setRequestHeader(q,Y)}):Object.getOwnPropertyNames(f.headers).forEach(function(Y){B.setRequestHeader(Y,te(f.headers[Y]))}),L.signal&&(L.signal.addEventListener("abort",$),B.onreadystatechange=function(){B.readyState===4&&L.signal.removeEventListener("abort",$)}),B.send(L._bodyInit===void 0?null:L._bodyInit)})}m.polyfill=!0,y.fetch||(y.fetch=m,y.Headers=oe,y.Request=S,y.Response=d),h.Headers=oe,h.Request=S,h.Response=d,h.fetch=m})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var a=n.fetch?n:r;(t=a.fetch).default=a.fetch,t.fetch=a.fetch,t.Headers=a.Headers,t.Request=a.Request,t.Response=a.Response,e.exports=t})(bM,bM.exports);var D4=R(bM.exports);let uB=1;const lB=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)}),B4=({checkInstallationOnAllCalls:e=!1,communicationLayerPreference:t,injectProvider:n,shouldShimWeb3:r,platformManager:a,installer:i,sdk:h,remoteConnection:y,debug:k})=>Tn(void 0,void 0,void 0,function*(){var E,M;const C=(({name:P,remoteConnection:d})=>{if(!d||!(d!=null&&d.getConnector()))throw new Error("Missing remote connection parameter");return new N4({name:P,remote:d==null?void 0:d.getConnector(),deeplinkProtocol:d==null?void 0:d.state.deeplinkProtocol,platformManager:d==null?void 0:d.getPlatformManager()})})({name:qy.INPAGE,target:qy.CONTENT_SCRIPT,platformManager:a,communicationLayerPreference:t,remoteConnection:y}),O=a.getPlatformType(),z=h.options.dappMetadata,H=`Sdk/Javascript SdkVersion/${f1.version} Platform/${O} dApp/${(E=z.url)!==null&&E!==void 0?E:z.name} dAppTitle/${z.name}`;let ee=null,te=null;const se=(M=h.options.storage)===null||M===void 0?void 0:M.storageManager;if(se){try{const P=yield se.getCachedAccounts();P.length>0&&(ee=P[0])}catch(P){console.error(`[initializeMobileProvider] failed to get cached addresses: ${P}`)}try{const P=yield se.getCachedChainId();P&&(te=P)}catch(P){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${P}`)}}ht(`[initializeMobileProvider] cachedAccountAddress: ${ee}, cachedChainId: ${te}`);const oe=!(!n||O===o.PlatformType.NonBrowser||O===o.PlatformType.ReactNative),Ee=Ql.init({shouldSetOnWindow:oe,connectionStream:C,shouldShimWeb3:r,sdkInstance:h});let we=!1;const Ce=P=>{console.log(`[initializeMobileProvider] setInitializing: ${P}`),we=P},ze=()=>we,Fe=(P,d,g,m)=>Tn(void 0,void 0,void 0,function*(){var p,f,_,T,L,B,$,Y,q;const F=Ql.getProvider();if(we){F.emit("display_uri",(y==null?void 0:y.state.qrcodeLink)||""),y==null||y.showActiveModal();let pe=ze();for(;pe;){const ve=ze(),Se=y==null?void 0:y.isAuthorized();pe=ve&&!Se,ht(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${ve} authorized: ${Se}`),yield lB(1e3)}return ht("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),g(...d)}const K=a.isMetaMaskInstalled(),Z=y==null?void 0:y.isConnected();let ne=null,ue=null,me=null;if(ne=(p=F.getSelectedAddress())!==null&&p!==void 0?p:ee,me=F.getChainId()||te,ne&&se&&ne!==ee&&se.persistAccounts([ne]).catch(pe=>{console.error(`[initializeMobileProvider] failed to persist account: ${pe}`)}),me&&(te=me,se&&se.persistChainId(me).catch(pe=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${pe}`)})),ht("[initializeMobileProvider: sendRequest()]",{selectedAddress:ne,chainId:me}),m&&ht(`[initializeMobileProvider: sendRequest()] method=${P} ongoing=${we} selectedAddress=${ne} isInstalled=${K} checkInstallationOnAllCalls=${e} socketConnected=${Z}`),ne&&P.toLowerCase()===Vn.ETH_ACCOUNTS.toLowerCase())return[ne];if(me&&P.toLowerCase()===Vn.ETH_CHAINID.toLowerCase())return me;const fe=[Vn.ETH_REQUESTACCOUNTS,Vn.WALLET_REQUESTPERMISSIONS,Vn.METAMASK_CONNECTSIGN,Vn.METAMASK_CONNECTWITH],De=!R7[P],_e=(f=h.options.readonlyRPCMap)===null||f===void 0?void 0:f[me];if(_e&&De)try{const pe=(_=d==null?void 0:d[0])===null||_===void 0?void 0:_.params,ve=yield(({rpcEndpoint:Se,method:Ae,sdkInfo:qe,params:Xe})=>Tn(void 0,void 0,void 0,function*(){const Be=JSON.stringify({jsonrpc:"2.0",method:Ae,params:Xe,id:(uB+=1,uB)}),gt={Accept:"application/json","Content-Type":"application/json"};let bt;Se.includes("infura")&&(gt["Metamask-Sdk-Info"]=qe);try{bt=yield D4(Se,{method:"POST",headers:gt,body:Be})}catch(ot){throw ot instanceof Error?new Error(`Failed to fetch from RPC: ${ot.message}`):new Error(`Failed to fetch from RPC: ${ot}`)}if(!bt.ok)throw new Error(`Server responded with a status of ${bt.status}`);return(yield bt.json()).result}))({rpcEndpoint:_e,sdkInfo:H,method:P,params:pe||[]});return m&&ht(`initializeProvider::ReadOnlyRPCResponse ${ve}`),ve}catch(pe){console.warn(`[initializeMobileProvider: sendRequest()] method=${P} readOnlyRPCRequest failed:`,pe)}if((!K||K&&!Z)&&P!==Vn.METAMASK_GETPROVIDERSTATE){const pe=((T=d==null?void 0:d[0])===null||T===void 0?void 0:T.params)||[];if(fe.indexOf(P)!==-1||e){Ce(!0);const ve=P===Vn.METAMASK_CONNECTWITH,Se=`${Date.now()}`;try{yield i.start({wait:!1,connectWith:ve?{method:P,id:Se,params:pe}:void 0}),yield new Promise((Ae,qe)=>{y!=null&&y.isAuthorized()&&(ht("[initializeMobileProvider: sendRequest()] already authorized"),Ae(!0)),y==null||y.getConnector().once(o.EventType.AUTHORIZED,()=>{Ae(!0)}),h.once(o.EventType.PROVIDER_UPDATE,Xe=>{ht(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${Xe}`),Xe===o.PROVIDER_UPDATE_TYPE.EXTENSION?qe(o.EventType.PROVIDER_UPDATE):qe(new Error("Connection Terminated"))})})}catch(Ae){if(o.PROVIDER_UPDATE_TYPE.EXTENSION===Ae){if(ht(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${P} on the active provider`),P.toLowerCase()===Vn.METAMASK_CONNECTSIGN.toLowerCase()){const qe=yield(L=h.getProvider())===null||L===void 0?void 0:L.request({method:Vn.ETH_REQUESTACCOUNTS,params:[]});if(!qe.length)throw new Error("SDK state invalid -- undefined accounts");const Xe=yield(B=h.getProvider())===null||B===void 0?void 0:B.request({method:Vn.PERSONAL_SIGN,params:[pe[0],qe[0]]});return h.emit(Ls.ConnectWithResponse,Xe),Xe}if(P.toLowerCase()===Vn.METAMASK_CONNECTWITH.toLowerCase()){const[qe]=pe,Xe=yield(({method:Be,sdk:gt,params:bt})=>Tn(void 0,void 0,void 0,function*(){var ot,Wt,vt,at;if(!gt.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");ht("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",Be,bt);const Rt=yield(ot=gt.getProvider())===null||ot===void 0?void 0:ot.request({method:Vn.ETH_REQUESTACCOUNTS,params:[]});if(!Rt.length)throw new Error("SDK state invalid -- undefined accounts");if((Be==null?void 0:Be.toLowerCase())===Vn.PERSONAL_SIGN.toLowerCase()){const Dt={method:Be,params:[bt[0],Rt[0]]};return yield(Wt=gt.getProvider())===null||Wt===void 0?void 0:Wt.request(Dt)}if((Be==null?void 0:Be.toLowerCase())===Vn.ETH_SENDTRANSACTION.toLowerCase()){const Dt={method:Be,params:[Object.assign(Object.assign({},bt[0]),{from:Rt[0]})]};return yield(vt=gt.getProvider())===null||vt===void 0?void 0:vt.request(Dt)}return zD.includes(Be.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${Be} -- not handled by the extension -- call separately`),Rt):yield(at=gt.getProvider())===null||at===void 0?void 0:at.request({method:Be,params:bt})}))({method:qe.method,sdk:h,params:qe.params});return h.emit(Ls.ConnectWithResponse,Xe),Xe}return ht(`[initializeMobileProvider: sendRequest()] sending '${P}' on active provider`,pe),yield($=h.getProvider())===null||$===void 0?void 0:$.request({method:P,params:pe})}throw Ae===o.EventType.REJECTED?(y==null||y.closeModal(),(Y=h.getProvider())===null||Y===void 0||Y.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001})):(ht(`[initializeMobileProvider: sendRequest()] failed to start installer: ${Ae}`),Ae)}finally{Ce(!1)}if(P===Vn.ETH_REQUESTACCOUNTS)return ue=yield new Promise(Ae=>{const qe=setInterval(()=>{const{accounts:Xe}=F.getState();Xe&&(clearInterval(qe),Ae(Xe))},100)}),ht(`[initializeMobileProvider: sendRequest()] selectedAddress: ${ne} --- SKIP rpc call`),ue;if(P===Vn.METAMASK_CONNECTWITH)try{let Ae=0;const qe=5,Xe=({resolve:ot,reject:Wt})=>{Ae+=1;const vt=y==null?void 0:y.getConnector().getRPCMethodTracker(),at=vt==null?void 0:vt[Se];return ht(`TRACKER: update method ${Se}`,at),at!=null&&at.result?(ht("[initializeMobileProvider: sendRequest()] found result",at.result),h.emit(Ls.ConnectWithResponse,at.result),void ot(at.result)):at!=null&&at.error?(ht("[initializeMobileProvider: sendRequest()] found error",at.error),void Wt(at.error)):Ae>=qe?(ht("[initializeMobileProvider: sendRequest()] max message count reached without result"),void Wt(new Error("Max message count reached without result"))):void ht("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let Be,gt;const bt=yield new Promise((ot,Wt)=>{const vt=y==null?void 0:y.getConnector().getRPCMethodTracker();ht(`TRACKER: method ${Se}`,vt),vt!=null&&vt[Se].result?(ht("[initializeMobileProvider: sendRequest()] found result",vt==null?void 0:vt[Se].result),ot(vt==null?void 0:vt[Se].result)):vt!=null&&vt[Se].error&&(ht("[initializeMobileProvider: sendRequest()] found error",vt==null?void 0:vt[Se].error),Wt(vt==null?void 0:vt[Se].error)),gt=()=>Xe({resolve:ot,reject:Wt}),Be=y==null?void 0:y.getConnector().on(o.EventType.RPC_UPDATE,gt)});return gt&&(Be==null||Be.off(o.EventType.RPC_UPDATE,gt)),ht("TRACKER: result",bt),bt}catch(Ae){throw ht("[initializeMobileProvider: sendRequest()] error:",Ae),Ae}return d[0]&&typeof d[0]=="object"&&(d[0].params={__triggeredInstaller:!0,wrappedParams:d[0].params}),g(...d)}if(a.isSecure()&&R7[P])return g(...d);if(h.isExtensionActive())return ht(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${P}' to it`,d,pe),yield(q=h.getProvider())===null||q===void 0?void 0:q.request({method:P,params:pe});throw ht(`[initializeMobileProvider: sendRequest()] method=${P} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const pe=yield g(...d);if(ht(`[initializeMobileProvider: sendRequest()] method=${P} rpcResponse`,pe),P===Vn.WALLET_REQUESTPERMISSIONS){const ve=pe.reduce((Se,Ae)=>{var qe;if(Ae.parentCapability==="eth_accounts"){const Xe=(qe=Ae.caveats.find(Be=>Be.type==="restrictReturnedAccounts"))===null||qe===void 0?void 0:qe.value;Xe&&Se.push(...Xe)}return Se},[]);ht("[initializeMobileProvider: sendRequest()] accountsToPersist:",ve),ve.length>0&&(F.handleAccountsChanged(ve,!1),se==null||se.persistAccounts(ve))}return pe}catch(pe){throw console.error("[initializeMobileProvider: sendRequest()] error:",pe),pe}}),{request:$e}=Ee;Ee.request=(...P)=>Tn(void 0,void 0,void 0,function*(){return Fe(P==null?void 0:P[0].method,P,$e,k)});const{send:S}=Ee;return Ee.send=(...P)=>Tn(void 0,void 0,void 0,function*(){return Fe(P==null?void 0:P[0],P,S,k)}),ht("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),C.start(),Ee});function z4(e){var t,n,r,a;return Tn(this,void 0,void 0,function*(){const{options:i}=e,h={communicationLayerPreference:(t=i.communicationLayerPreference)!==null&&t!==void 0?t:o.CommunicationLayerPreference.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:i.checkInstallationOnAllCalls,injectProvider:(n=i.injectProvider)===null||n===void 0||n,shouldShimWeb3:(r=i.shouldShimWeb3)===null||r===void 0||r,extensionOnly:(a=i.extensionOnly)===null||a===void 0||a,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug},y=yield B4(h);e.activeProvider=y,function(k){var E,M,C,O;(M=(E=k.remoteConnection)===null||E===void 0?void 0:E.getConnector())===null||M===void 0||M.on(Ls.ConnectionStatus,z=>{k.emit(Ls.ConnectionStatus,z)}),(O=(C=k.remoteConnection)===null||C===void 0?void 0:C.getConnector())===null||O===void 0||O.on(Ls.ServiceStatus,z=>{k.emit(Ls.ServiceStatus,z)})}(e)})}var F7,j7,U7;const F4="sdk";class j4{constructor({serverUrl:t,enabled:n,originatorInfo:r}){F7.set(this,s1),j7.set(this,void 0),U7.set(this,void 0),V5(this,F7,t),V5(this,U7,r),V5(this,j7,n==null||n)}send({event:t,params:n}){if(!W5(this,j7))return;const r=Object.assign(Object.assign({id:F4,event:t,sdkVersion:f1.version},W5(this,U7)),{params:n});ht(`[Analytics: send()] event: ${t}`,r),Sd(r,W5(this,F7)).catch(a=>{ht(`[Analytics: send()] error: ${a}`)})}}F7=new WeakMap,j7=new WeakMap,U7=new WeakMap;const U4=()=>{if(typeof document>"u")return;let e;const t=document.getElementsByTagName("link");for(let n=0;n1&&arguments[1]!==void 0?arguments[1]:0,n=(la[e[t+0]]+la[e[t+1]]+la[e[t+2]]+la[e[t+3]]+"-"+la[e[t+4]]+la[e[t+5]]+"-"+la[e[t+6]]+la[e[t+7]]+"-"+la[e[t+8]]+la[e[t+9]]+"-"+la[e[t+10]]+la[e[t+11]]+la[e[t+12]]+la[e[t+13]]+la[e[t+14]]+la[e[t+15]]).toLowerCase();if(!function(r){return typeof r=="string"&&q4.test(r)}(n))throw TypeError("Stringified UUID is invalid");return n}function V4(e,t,n){var r=(e=e||{}).random||(e.rng||$4)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,W4(r)}function cB(e){var t,n,r;const{dappMetadata:a}=e,i=function({url:M,name:C}){var O;const z=z7(M+C);if(!localStorage)return"";let H=(O=localStorage.getItem(z))!==null&&O!==void 0?O:"";if(!H){H=V4();try{localStorage.setItem(z,H)}catch{return""}}return H}({url:(t=a==null?void 0:a.url)!==null&&t!==void 0?t:"no_url",name:(n=a==null?void 0:a.name)!==null&&n!==void 0?n:"no_name"}),h=(r=e.platformManager)===null||r===void 0?void 0:r.getPlatformType(),y=h===o.PlatformType.DesktopWeb,k=h===o.PlatformType.MetaMaskMobileWebview;let E="N/A";return y?E="extension":k&&(E="mobile"),{id:i,from:E}}const K7=({provider:e,sdkInstance:t})=>{if("state"in e)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>r==="request"?function(a){var i,h;return Tn(this,void 0,void 0,function*(){ht("[wrapExtensionProvider()] Overwriting request method",a);const{method:y,params:k}=a,E=VJ.includes(y.toLowerCase()),{id:M,from:C}=cB(t);if(E&&((i=t.analytics)===null||i===void 0||i.send({event:ho.SDK_RPC_REQUEST,params:{method:y,from:C,id:M}})),y===Vn.METAMASK_BATCH&&Array.isArray(k))return(({target:z,args:H,trackEvent:ee,sdkInstance:te})=>Tn(void 0,void 0,void 0,function*(){var se,oe;if(H.method!=="metamask_batch")throw new Error("Invalid usage");const Ee=[],we=(se=H==null?void 0:H.params)!==null&&se!==void 0?se:[];for(const Fe of we){const $e=yield z==null?void 0:z.request({method:Fe.method,params:Fe.params});Ee.push($e)}const{id:Ce,from:ze}=cB(te);return ee&&((oe=te.analytics)===null||oe===void 0||oe.send({event:ho.SDK_RPC_REQUEST_DONE,params:{method:H.method,from:ze,id:Ce}})),Ee}))({target:n,args:a,trackEvent:E,sdkInstance:t});if(y.toLowerCase()===Vn.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(k))return(({target:z,params:H})=>Tn(void 0,void 0,void 0,function*(){const ee=yield z.request({method:Vn.ETH_REQUESTACCOUNTS,params:[]});if(!ee.length)throw new Error("SDK state invalid -- undefined accounts");return yield z.request({method:Vn.PERSONAL_SIGN,params:[H[0],ee[0]]})}))({target:n,params:k});if(y.toLowerCase()===Vn.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(k))return(({target:z,params:H})=>Tn(void 0,void 0,void 0,function*(){const[ee]=H,te=ee.method,se=ee.params,oe=yield z.request({method:Vn.ETH_REQUESTACCOUNTS,params:[]});if(!oe.length)throw new Error("SDK state invalid -- undefined accounts");return(te==null?void 0:te.toLowerCase())===Vn.PERSONAL_SIGN.toLowerCase()?yield z.request({method:te,params:[se[0],oe[0]]}):(te==null?void 0:te.toLowerCase())===Vn.ETH_SENDTRANSACTION.toLowerCase()?yield z.request({method:te,params:[Object.assign(Object.assign({},se[0]),{from:oe[0]})]}):zD.includes(te.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${te} -- not handled by the extension -- call separately`),oe):yield z.request({method:te,params:se})}))({target:n,params:k});let O;try{return O=yield n.request(a),O}finally{E&&((h=t.analytics)===null||h===void 0||h.send({event:ho.SDK_RPC_REQUEST_DONE,params:{method:y,from:C,id:M}}))}})}:r==="getChainId"?function(){return e.chainId}:r==="getNetworkVersion"?function(){return e.networkVersion}:r==="getSelectedAddress"?function(){return e.selectedAddress}:r==="isConnected"?function(){return e._state.isConnected}:n[r]})};var H7;function Y4({mustBeMetaMask:e,sdkInstance:t}){return Tn(this,void 0,void 0,function*(){if(typeof window>"u")throw new Error("window not available");let n;try{return n=yield new Promise((r,a)=>{const i=setTimeout(()=>{a(new Error("eip6963RequestProvider timed out"))},500);window.addEventListener(H7.Announce,h=>{const y=h,{detail:{info:k,provider:E}={}}=y,{name:M,rdns:C,uuid:O}=k??{};f4.test(O)&&M.startsWith(eB.NAME)&&C===eB.RDNS&&(clearTimeout(i),r(E))}),window.dispatchEvent(new Event(H7.Request))}),K7({provider:n,sdkInstance:t})}catch{const{ethereum:a}=window;if(!a)throw new Error("Ethereum not found in window object");if("providers"in a){if(Array.isArray(a.providers)){const i=e?a.providers.find(h=>fB(h)):a.providers[0];if(!i)throw new Error("No suitable provider found");return K7({provider:i,sdkInstance:t})}}else if(e&&!fB(a))throw new Error("MetaMask provider not found in Ethereum");return K7({provider:a,sdkInstance:t})}})}function fB(e){if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const t=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of t)if(e[n])return!1;return!0}(function(e){e.Announce="eip6963:announceProvider",e.Request="eip6963:requestProvider"})(H7||(H7={}));const G4=e=>Tn(void 0,void 0,void 0,function*(){const{options:t}=e,{infuraAPIKey:n}=t;if(!n)return;const r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};e.options.readonlyRPCMap?e.options.readonlyRPCMap=Object.assign(Object.assign({},e.options.readonlyRPCMap),r):e.options.readonlyRPCMap=r});var dB={exports:{}};(function(e,t){e.exports=function(n){var r={};function a(i){if(r[i])return r[i].exports;var h=r[i]={i,l:!1,exports:{}};return n[i].call(h.exports,h,h.exports,a),h.l=!0,h.exports}return a.m=n,a.c=r,a.d=function(i,h,y){a.o(i,h)||Object.defineProperty(i,h,{enumerable:!0,get:y})},a.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},a.t=function(i,h){if(1&h&&(i=a(i)),8&h||4&h&&typeof i=="object"&&i&&i.__esModule)return i;var y=Object.create(null);if(a.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:i}),2&h&&typeof i!="string")for(var k in i)a.d(y,k,(function(E){return i[E]}).bind(null,k));return y},a.n=function(i){var h=i&&i.__esModule?function(){return i.default}:function(){return i};return a.d(h,"a",h),h},a.o=function(i,h){return Object.prototype.hasOwnProperty.call(i,h)},a.p="",a(a.s=90)}({17:function(n,r,a){r.__esModule=!0,r.default=void 0;var i=a(18),h=function(){function y(){}return y.getFirstMatch=function(k,E){var M=E.match(k);return M&&M.length>0&&M[1]||""},y.getSecondMatch=function(k,E){var M=E.match(k);return M&&M.length>1&&M[2]||""},y.matchAndReturnConst=function(k,E,M){if(k.test(E))return M},y.getWindowsVersionName=function(k){switch(k){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},y.getMacOSVersionName=function(k){var E=k.split(".").splice(0,2).map(function(M){return parseInt(M,10)||0});if(E.push(0),E[0]===10)switch(E[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},y.getAndroidVersionName=function(k){var E=k.split(".").splice(0,2).map(function(M){return parseInt(M,10)||0});if(E.push(0),!(E[0]===1&&E[1]<5))return E[0]===1&&E[1]<6?"Cupcake":E[0]===1&&E[1]>=6?"Donut":E[0]===2&&E[1]<2?"Eclair":E[0]===2&&E[1]===2?"Froyo":E[0]===2&&E[1]>2?"Gingerbread":E[0]===3?"Honeycomb":E[0]===4&&E[1]<1?"Ice Cream Sandwich":E[0]===4&&E[1]<4?"Jelly Bean":E[0]===4&&E[1]>=4?"KitKat":E[0]===5?"Lollipop":E[0]===6?"Marshmallow":E[0]===7?"Nougat":E[0]===8?"Oreo":E[0]===9?"Pie":void 0},y.getVersionPrecision=function(k){return k.split(".").length},y.compareVersions=function(k,E,M){M===void 0&&(M=!1);var C=y.getVersionPrecision(k),O=y.getVersionPrecision(E),z=Math.max(C,O),H=0,ee=y.map([k,E],function(te){var se=z-y.getVersionPrecision(te),oe=te+new Array(se+1).join(".0");return y.map(oe.split("."),function(Ee){return new Array(20-Ee.length).join("0")+Ee}).reverse()});for(M&&(H=z-Math.min(C,O)),z-=1;z>=H;){if(ee[0][z]>ee[1][z])return 1;if(ee[0][z]===ee[1][z]){if(z===H)return 0;z-=1}else if(ee[0][z]1?O-1:0),H=1;H0){var we=Object.keys(te),Ce=E.default.find(we,function(d){return ee.isOS(d)});if(Ce){var ze=this.satisfies(te[Ce]);if(ze!==void 0)return ze}var Fe=E.default.find(we,function(d){return ee.isPlatform(d)});if(Fe){var $e=this.satisfies(te[Fe]);if($e!==void 0)return $e}}if(Ee>0){var S=Object.keys(oe),P=E.default.find(S,function(d){return ee.isBrowser(d,!0)});if(P!==void 0)return this.compareVersion(oe[P])}},z.isBrowser=function(H,ee){ee===void 0&&(ee=!1);var te=this.getBrowserName().toLowerCase(),se=H.toLowerCase(),oe=E.default.getBrowserTypeByAlias(se);return ee&&oe&&(se=oe.toLowerCase()),se===te},z.compareVersion=function(H){var ee=[0],te=H,se=!1,oe=this.getBrowserVersion();if(typeof oe=="string")return H[0]===">"||H[0]==="<"?(te=H.substr(1),H[1]==="="?(se=!0,te=H.substr(2)):ee=[],H[0]===">"?ee.push(1):ee.push(-1)):H[0]==="="?te=H.substr(1):H[0]==="~"&&(se=!0,te=H.substr(1)),ee.indexOf(E.default.compareVersions(oe,te,se))>-1},z.isOS=function(H){return this.getOSName(!0)===String(H).toLowerCase()},z.isPlatform=function(H){return this.getPlatformType(!0)===String(H).toLowerCase()},z.isEngine=function(H){return this.getEngineName(!0)===String(H).toLowerCase()},z.is=function(H,ee){return ee===void 0&&(ee=!1),this.isBrowser(H,ee)||this.isOS(H)||this.isPlatform(H)},z.some=function(H){var ee=this;return H===void 0&&(H=[]),H.some(function(te){return ee.is(te)})},O}();r.default=C,n.exports=r.default},92:function(n,r,a){r.__esModule=!0,r.default=void 0;var i,h=(i=a(17))&&i.__esModule?i:{default:i},y=/version\/(\d+(\.?_?\d+)+)/i,k=[{test:[/googlebot/i],describe:function(E){var M={name:"Googlebot"},C=h.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/opera/i],describe:function(E){var M={name:"Opera"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/opr\/|opios/i],describe:function(E){var M={name:"Opera"},C=h.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/SamsungBrowser/i],describe:function(E){var M={name:"Samsung Internet for Android"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/Whale/i],describe:function(E){var M={name:"NAVER Whale Browser"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/MZBrowser/i],describe:function(E){var M={name:"MZ Browser"},C=h.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/focus/i],describe:function(E){var M={name:"Focus"},C=h.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/swing/i],describe:function(E){var M={name:"Swing"},C=h.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/coast/i],describe:function(E){var M={name:"Opera Coast"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(E){var M={name:"Opera Touch"},C=h.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/yabrowser/i],describe:function(E){var M={name:"Yandex Browser"},C=h.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/ucbrowser/i],describe:function(E){var M={name:"UC Browser"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/Maxthon|mxios/i],describe:function(E){var M={name:"Maxthon"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/epiphany/i],describe:function(E){var M={name:"Epiphany"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/puffin/i],describe:function(E){var M={name:"Puffin"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/sleipnir/i],describe:function(E){var M={name:"Sleipnir"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/k-meleon/i],describe:function(E){var M={name:"K-Meleon"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/micromessenger/i],describe:function(E){var M={name:"WeChat"},C=h.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/qqbrowser/i],describe:function(E){var M={name:/qqbrowserlite/i.test(E)?"QQ Browser Lite":"QQ Browser"},C=h.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/msie|trident/i],describe:function(E){var M={name:"Internet Explorer"},C=h.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/\sedg\//i],describe:function(E){var M={name:"Microsoft Edge"},C=h.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/edg([ea]|ios)/i],describe:function(E){var M={name:"Microsoft Edge"},C=h.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/vivaldi/i],describe:function(E){var M={name:"Vivaldi"},C=h.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/seamonkey/i],describe:function(E){var M={name:"SeaMonkey"},C=h.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/sailfish/i],describe:function(E){var M={name:"Sailfish"},C=h.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,E);return C&&(M.version=C),M}},{test:[/silk/i],describe:function(E){var M={name:"Amazon Silk"},C=h.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/phantom/i],describe:function(E){var M={name:"PhantomJS"},C=h.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/slimerjs/i],describe:function(E){var M={name:"SlimerJS"},C=h.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(E){var M={name:"BlackBerry"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/(web|hpw)[o0]s/i],describe:function(E){var M={name:"WebOS Browser"},C=h.default.getFirstMatch(y,E)||h.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/bada/i],describe:function(E){var M={name:"Bada"},C=h.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/tizen/i],describe:function(E){var M={name:"Tizen"},C=h.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/qupzilla/i],describe:function(E){var M={name:"QupZilla"},C=h.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/firefox|iceweasel|fxios/i],describe:function(E){var M={name:"Firefox"},C=h.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/electron/i],describe:function(E){var M={name:"Electron"},C=h.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/MiuiBrowser/i],describe:function(E){var M={name:"Miui"},C=h.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/chromium/i],describe:function(E){var M={name:"Chromium"},C=h.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,E)||h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/chrome|crios|crmo/i],describe:function(E){var M={name:"Chrome"},C=h.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/GSA/i],describe:function(E){var M={name:"Google Search"},C=h.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:function(E){var M=!E.test(/like android/i),C=E.test(/android/i);return M&&C},describe:function(E){var M={name:"Android Browser"},C=h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/playstation 4/i],describe:function(E){var M={name:"PlayStation 4"},C=h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/safari|applewebkit/i],describe:function(E){var M={name:"Safari"},C=h.default.getFirstMatch(y,E);return C&&(M.version=C),M}},{test:[/.*/i],describe:function(E){var M=E.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:h.default.getFirstMatch(M,E),version:h.default.getSecondMatch(M,E)}}}];r.default=k,n.exports=r.default},93:function(n,r,a){r.__esModule=!0,r.default=void 0;var i,h=(i=a(17))&&i.__esModule?i:{default:i},y=a(18),k=[{test:[/Roku\/DVP/],describe:function(E){var M=h.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,E);return{name:y.OS_MAP.Roku,version:M}}},{test:[/windows phone/i],describe:function(E){var M=h.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,E);return{name:y.OS_MAP.WindowsPhone,version:M}}},{test:[/windows /i],describe:function(E){var M=h.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,E),C=h.default.getWindowsVersionName(M);return{name:y.OS_MAP.Windows,version:M,versionName:C}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(E){var M={name:y.OS_MAP.iOS},C=h.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,E);return C&&(M.version=C),M}},{test:[/macintosh/i],describe:function(E){var M=h.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,E).replace(/[_\s]/g,"."),C=h.default.getMacOSVersionName(M),O={name:y.OS_MAP.MacOS,version:M};return C&&(O.versionName=C),O}},{test:[/(ipod|iphone|ipad)/i],describe:function(E){var M=h.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,E).replace(/[_\s]/g,".");return{name:y.OS_MAP.iOS,version:M}}},{test:function(E){var M=!E.test(/like android/i),C=E.test(/android/i);return M&&C},describe:function(E){var M=h.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,E),C=h.default.getAndroidVersionName(M),O={name:y.OS_MAP.Android,version:M};return C&&(O.versionName=C),O}},{test:[/(web|hpw)[o0]s/i],describe:function(E){var M=h.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,E),C={name:y.OS_MAP.WebOS};return M&&M.length&&(C.version=M),C}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(E){var M=h.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,E)||h.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,E)||h.default.getFirstMatch(/\bbb(\d+)/i,E);return{name:y.OS_MAP.BlackBerry,version:M}}},{test:[/bada/i],describe:function(E){var M=h.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,E);return{name:y.OS_MAP.Bada,version:M}}},{test:[/tizen/i],describe:function(E){var M=h.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,E);return{name:y.OS_MAP.Tizen,version:M}}},{test:[/linux/i],describe:function(){return{name:y.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:y.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(E){var M=h.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,E);return{name:y.OS_MAP.PlayStation4,version:M}}}];r.default=k,n.exports=r.default},94:function(n,r,a){r.__esModule=!0,r.default=void 0;var i,h=(i=a(17))&&i.__esModule?i:{default:i},y=a(18),k=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(E){var M=h.default.getFirstMatch(/(can-l01)/i,E)&&"Nova",C={type:y.PLATFORMS_MAP.mobile,vendor:"Huawei"};return M&&(C.model=M),C}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:y.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:y.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:y.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:y.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:y.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:y.PLATFORMS_MAP.tablet}}},{test:function(E){var M=E.test(/ipod|iphone/i),C=E.test(/like (ipod|iphone)/i);return M&&!C},describe:function(E){var M=h.default.getFirstMatch(/(ipod|iphone)/i,E);return{type:y.PLATFORMS_MAP.mobile,vendor:"Apple",model:M}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:y.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:y.PLATFORMS_MAP.mobile}}},{test:function(E){return E.getBrowserName(!0)==="blackberry"},describe:function(){return{type:y.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(E){return E.getBrowserName(!0)==="bada"},describe:function(){return{type:y.PLATFORMS_MAP.mobile}}},{test:function(E){return E.getBrowserName()==="windows phone"},describe:function(){return{type:y.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(E){var M=Number(String(E.getOSVersion()).split(".")[0]);return E.getOSName(!0)==="android"&&M>=3},describe:function(){return{type:y.PLATFORMS_MAP.tablet}}},{test:function(E){return E.getOSName(!0)==="android"},describe:function(){return{type:y.PLATFORMS_MAP.mobile}}},{test:function(E){return E.getOSName(!0)==="macos"},describe:function(){return{type:y.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(E){return E.getOSName(!0)==="windows"},describe:function(){return{type:y.PLATFORMS_MAP.desktop}}},{test:function(E){return E.getOSName(!0)==="linux"},describe:function(){return{type:y.PLATFORMS_MAP.desktop}}},{test:function(E){return E.getOSName(!0)==="playstation 4"},describe:function(){return{type:y.PLATFORMS_MAP.tv}}},{test:function(E){return E.getOSName(!0)==="roku"},describe:function(){return{type:y.PLATFORMS_MAP.tv}}}];r.default=k,n.exports=r.default},95:function(n,r,a){r.__esModule=!0,r.default=void 0;var i,h=(i=a(17))&&i.__esModule?i:{default:i},y=a(18),k=[{test:function(E){return E.getBrowserName(!0)==="microsoft edge"},describe:function(E){if(/\sedg\//i.test(E))return{name:y.ENGINE_MAP.Blink};var M=h.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,E);return{name:y.ENGINE_MAP.EdgeHTML,version:M}}},{test:[/trident/i],describe:function(E){var M={name:y.ENGINE_MAP.Trident},C=h.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:function(E){return E.test(/presto/i)},describe:function(E){var M={name:y.ENGINE_MAP.Presto},C=h.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:function(E){var M=E.test(/gecko/i),C=E.test(/like gecko/i);return M&&!C},describe:function(E){var M={name:y.ENGINE_MAP.Gecko},C=h.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:y.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(E){var M={name:y.ENGINE_MAP.WebKit},C=h.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,E);return C&&(M.version=C),M}}];r.default=k,n.exports=r.default}})})(dB);var hB=R(dB.exports);class Z4{constructor({useDeepLink:t,preferredOpenLink:n,debug:r=!1}){this.state={platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=t,this.state.preferredOpenLink=n,this.state.debug=r}openDeeplink(t,n,r){return function(a,i,h,y){const{state:k}=a;ht(`[PlatfformManager: openDeeplink()] universalLink --> ${i}`),ht(`[PlatfformManager: openDeeplink()] deepLink --> ${h}`);try{if(k.preferredOpenLink)return void k.preferredOpenLink(k.useDeeplink?h:i,y);if(ht(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${k.useDeeplink} link=${k.useDeeplink?h:i}`),k.useDeeplink)typeof window<"u"&&(window.location.href=h);else if(typeof document<"u"){const E=document.createElement("a");E.href=i,E.target="_self",E.rel="noreferrer noopener",E.click()}}catch(E){console.log("[PlatfformManager: openDeeplink()] can't open link",E)}}(this,t,n,r)}isReactNative(){var t;return this.isNotBrowser()&&typeof window<"u"&&(window==null?void 0:window.navigator)&&((t=window.navigator)===null||t===void 0?void 0:t.product)==="ReactNative"}isMetaMaskInstalled(){return function(){const t=Ql.getProvider()||(window==null?void 0:window.ethereum);return ht(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${t==null?void 0:t.isMetaMask} isConnected=${t==null?void 0:t.isConnected()}`),(t==null?void 0:t.isMetaMask)&&(t==null?void 0:t.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var t,n;const r=hB.parse(window.navigator.userAgent);return((t=r==null?void 0:r.platform)===null||t===void 0?void 0:t.type)==="mobile"||((n=r==null?void 0:r.platform)===null||n===void 0?void 0:n.type)==="tablet"}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return typeof window<"u"&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===o.PlatformType.MobileWeb}isNotBrowser(){var t;return typeof window>"u"||!(window!=null&&window.navigator)||ku!==void 0&&((t=ku==null?void 0:ku.navigator)===null||t===void 0?void 0:t.product)==="ReactNative"||(navigator==null?void 0:navigator.product)==="ReactNative"}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isBrowser(){return!this.isNotBrowser()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(t){const{state:n}=t;return n.platformType?n.platformType:t.isReactNative()?o.PlatformType.ReactNative:t.isNotBrowser()?o.PlatformType.NonBrowser:t.isMetaMaskMobileWebView()?o.PlatformType.MetaMaskMobileWebview:t.isMobile()?o.PlatformType.MobileWeb:o.PlatformType.DesktopWeb}(this)}}const Q4=e=>Tn(void 0,void 0,void 0,function*(){const{options:t}=e,{readonlyRPCMap:n}=t;if(n)try{ht("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),e.setReadOnlyRPCCalls(!0)}catch{throw new Error("Invalid Infura Settings")}});function X4(e,t,n,r){return new(n||(n=Promise))(function(a,i){function h(E){try{k(r.next(E))}catch(M){i(M)}}function y(E){try{k(r.throw(E))}catch(M){i(M)}}function k(E){E.done?a(E.value):function(M){return M instanceof n?M:new n(function(C){C(M)})}(E.value).then(h,y)}k((r=r.apply(e,[])).next())})}function J4(e,t){var n,r,a,i,h={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function y(k){return function(E){return function(M){if(n)throw new TypeError("Generator is already executing.");for(;h;)try{if(n=1,r&&(a=2&M[0]?r.return:M[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,M[1])).done)return a;switch(r=0,a&&(M=[2&M[0],a.value]),M[0]){case 0:case 1:a=M;break;case 4:return h.label++,{value:M[1],done:!1};case 5:h.label++,r=M[1],M=[0];continue;case 7:M=h.ops.pop(),h.trys.pop();continue;default:if(!((a=(a=h.trys).length>0&&a[a.length-1])||M[0]!==6&&M[0]!==2)){h=0;continue}if(M[0]===3&&(!a||M[1]>a[0]&&M[1]1?Ve-1:0),Ct=1;Ct1?Ve-1:0),Ct=1;Ct1){for(var Dn=Array(Yn),qn=0;qn1){for(var Fr=Array(qn),Gr=0;Gr import('./MyComponent')) + +Did you accidentally put curly braces around the import?`,Ct),"default"in Ct||_(`lazy: Expected the result of a dynamic import() call. Instead received: %s + +Your code should look like: + const MyComponent = lazy(() => import('./MyComponent'))`,Ct),Ct.default}throw de._result}function kn(de){return typeof de=="string"||typeof de=="function"||!!(de===a||de===h||m||de===i||de===M||de===C||g||de===H||S||P||d)||typeof de=="object"&&de!==null&&(de.$$typeof===z||de.$$typeof===O||de.$$typeof===y||de.$$typeof===k||de.$$typeof===E||de.$$typeof===tn||de.getModuleId!==void 0)}function Nt(){var de=oe.current;return de===null&&_(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: +1. You might have mismatching versions of React and the renderer (such as React DOM) +2. You might be breaking the Rules of Hooks +3. You might have more than one copy of React in the same app +See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),de}tn=Symbol.for("react.module.reference");var Mn,yn,Ft,An,bn,Qt,Ln,Bn=0;function Kt(){}Kt.__reactDisabledLog=!0;var Pn,In=p.ReactCurrentDispatcher;function qt(de,Ve,pt){if(Pn===void 0)try{throw Error()}catch(xt){var Ct=xt.stack.trim().match(/\n( *(at )?)/);Pn=Ct&&Ct[1]||""}return` +`+Pn+de}var pn,Hn=!1,Yt=typeof WeakMap=="function"?WeakMap:Map;function $n(de,Ve){if(!de||Hn)return"";var pt,Ct=pn.get(de);if(Ct!==void 0)return Ct;Hn=!0;var xt,Nn=Error.prepareStackTrace;Error.prepareStackTrace=void 0,xt=In.current,In.current=null,function(){if(Bn===0){Mn=console.log,yn=console.info,Ft=console.warn,An=console.error,bn=console.group,Qt=console.groupCollapsed,Ln=console.groupEnd;var Qn={configurable:!0,enumerable:!0,value:Kt,writable:!0};Object.defineProperties(console,{info:Qn,log:Qn,warn:Qn,error:Qn,group:Qn,groupCollapsed:Qn,groupEnd:Qn})}Bn++}();try{if(Ve){var un=function(){throw Error()};if(Object.defineProperty(un.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(un,[])}catch(Qn){pt=Qn}Reflect.construct(de,[],un)}else{try{un.call()}catch(Qn){pt=Qn}de.call(un.prototype)}}else{try{throw Error()}catch(Qn){pt=Qn}de()}}catch(Qn){if(Qn&&pt&&typeof Qn.stack=="string"){for(var xn=Qn.stack.split(` +`),or=pt.stack.split(` +`),Yn=xn.length-1,Dn=or.length-1;Yn>=1&&Dn>=0&&xn[Yn]!==or[Dn];)Dn--;for(;Yn>=1&&Dn>=0;Yn--,Dn--)if(xn[Yn]!==or[Dn]){if(Yn!==1||Dn!==1)do if(Yn--,--Dn<0||xn[Yn]!==or[Dn]){var qn=` +`+xn[Yn].replace(" at new "," at ");return de.displayName&&qn.includes("")&&(qn=qn.replace("",de.displayName)),typeof de=="function"&&pn.set(de,qn),qn}while(Yn>=1&&Dn>=0);break}}}finally{Hn=!1,In.current=xt,function(){if(--Bn==0){var Qn={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},Qn,{value:Mn}),info:Y({},Qn,{value:yn}),warn:Y({},Qn,{value:Ft}),error:Y({},Qn,{value:An}),group:Y({},Qn,{value:bn}),groupCollapsed:Y({},Qn,{value:Qt}),groupEnd:Y({},Qn,{value:Ln})})}Bn<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=Nn}var Fr=de?de.displayName||de.name:"",Gr=Fr?qt(Fr):"";return typeof de=="function"&&pn.set(de,Gr),Gr}function Cn(de,Ve,pt){if(de==null)return"";if(typeof de=="function")return $n(de,function(un){var xn=un.prototype;return!(!xn||!xn.isReactComponent)}(de));if(typeof de=="string")return qt(de);switch(de){case M:return qt("Suspense");case C:return qt("SuspenseList")}if(typeof de=="object")switch(de.$$typeof){case E:return $n(de.render,!1);case O:return Cn(de.type,Ve,pt);case z:var Ct=de,xt=Ct._payload,Nn=Ct._init;try{return Cn(Nn(xt),Ve,pt)}catch{}}return""}pn=new Yt;var On,Fi={},ji=p.ReactDebugCurrentFrame;function xi(de){if(de){var Ve=de._owner,pt=Cn(de.type,de._source,Ve?Ve.type:null);ji.setExtraStackFrame(pt)}else ji.setExtraStackFrame(null)}function vi(de){if(de){var Ve=de._owner;$e(Cn(de.type,de._source,Ve?Ve.type:null))}else $e(null)}function Vi(){if(Ce.current){var de=Ae(Ce.current.type);if(de)return` + +Check the render method of \``+de+"`."}return""}On=!1;var dr={};function jn(de,Ve){if(de._store&&!de._store.validated&&de.key==null){de._store.validated=!0;var pt=function(xt){var Nn=Vi();if(!Nn){var un=typeof xt=="string"?xt:xt.displayName||xt.name;un&&(Nn=` + +Check the top-level render call using <`+un+">.")}return Nn}(Ve);if(!dr[pt]){dr[pt]=!0;var Ct="";de&&de._owner&&de._owner!==Ce.current&&(Ct=" It was passed a child from "+Ae(de._owner.type)+"."),vi(de),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',pt,Ct),vi(null)}}}function yi(de,Ve){if(typeof de=="object"){if(_e(de))for(var pt=0;pt",xn=" Did you accidentally export a JSX literal instead of a component?"):un=typeof de,_("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",un,xn)}var or=at.apply(this,arguments);if(or==null)return or;if(Nn)for(var Yn=2;Yn"u"&&_("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var Yn=new MessageChannel;Yn.port1.onmessage=or,Yn.port2.postMessage(void 0)}}ii(xt)}(function(){Ct.length===0?(we.current=null,Ve(de)):Oi(de,Ve,pt)})}catch(xt){pt(xt)}else Ve(de)}var xo=!1;function ca(de){if(!xo){xo=!0;var Ve=0;try{for(;Ve is not supported and will be removed in a future major release. Did you mean to render instead?")),Ve.Provider},set:function(un){Ve.Provider=un}},_currentValue:{get:function(){return Ve._currentValue},set:function(un){Ve._currentValue=un}},_currentValue2:{get:function(){return Ve._currentValue2},set:function(un){Ve._currentValue2=un}},_threadCount:{get:function(){return Ve._threadCount},set:function(un){Ve._threadCount=un}},Consumer:{get:function(){return pt||(pt=!0,_("Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),Ve.Consumer}},displayName:{get:function(){return Ve.displayName},set:function(un){xt||(f("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",un),xt=!0)}}}),Ve.Consumer=Nn,Ve._currentRenderer=null,Ve._currentRenderer2=null,Ve},t.createElement=Mf,t.createFactory=oi,t.createRef=function(){var de={current:null};return Object.seal(de),de},t.forwardRef=function(de){de!=null&&de.$$typeof===O?_("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof de!="function"?_("forwardRef requires a render function but was given %s.",de===null?"null":typeof de):de.length!==0&&de.length!==2&&_("forwardRef render functions accept exactly two parameters: props and ref. %s",de.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),de!=null&&(de.defaultProps==null&&de.propTypes==null||_("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var Ve,pt={$$typeof:E,render:de};return Object.defineProperty(pt,"displayName",{enumerable:!1,configurable:!0,get:function(){return Ve},set:function(Ct){Ve=Ct,de.name||de.displayName||(de.displayName=Ct)}}),pt},t.isValidElement=Dt,t.lazy=function(de){var Ve,pt,Ct={$$typeof:z,_payload:{_status:Bt,_result:de},_init:Fn};return Object.defineProperties(Ct,{defaultProps:{configurable:!0,get:function(){return Ve},set:function(xt){_("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),Ve=xt,Object.defineProperty(Ct,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return pt},set:function(xt){_("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),pt=xt,Object.defineProperty(Ct,"propTypes",{enumerable:!0})}}}),Ct},t.memo=function(de,Ve){kn(de)||_("memo: The first argument must be a component. Instead received: %s",de===null?"null":typeof de);var pt,Ct={$$typeof:O,type:de,compare:Ve===void 0?null:Ve};return Object.defineProperty(Ct,"displayName",{enumerable:!1,configurable:!0,get:function(){return pt},set:function(xt){pt=xt,de.name||de.displayName||(de.displayName=xt)}}),Ct},t.startTransition=function(de,Ve){var pt=Ee.transition;Ee.transition={};var Ct=Ee.transition;Ee.transition._updatedFibers=new Set;try{de()}finally{Ee.transition=pt,pt===null&&Ct._updatedFibers&&(Ct._updatedFibers.size>10&&f("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),Ct._updatedFibers.clear())}},t.unstable_act=function(de){var Ve=kr;kr++,we.current===null&&(we.current=[]);var pt,Ct=we.isBatchingLegacy;try{if(we.isBatchingLegacy=!0,pt=de(),!Ct&&we.didScheduleLegacyUpdate){var xt=we.current;xt!==null&&(we.didScheduleLegacyUpdate=!1,ca(xt))}}catch(Dn){throw Ti(Ve),Dn}finally{we.isBatchingLegacy=Ct}if(pt!==null&&typeof pt=="object"&&typeof pt.then=="function"){var Nn=pt,un=!1,xn={then:function(Dn,qn){un=!0,Nn.then(function(Fr){Ti(Ve),kr===0?Oi(Fr,Dn,qn):Dn(Fr)},function(Fr){Ti(Ve),qn(Fr)})}};return qr||typeof Promise>"u"||Promise.resolve().then(function(){}).then(function(){un||(qr=!0,_("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),xn}var or=pt;if(Ti(Ve),kr===0){var Yn=we.current;return Yn!==null&&(ca(Yn),we.current=null),{then:function(Dn,qn){we.current===null?(we.current=[],Oi(or,Dn,qn)):Dn(or)}}}return{then:function(Dn,qn){Dn(or)}}},t.useCallback=function(de,Ve){return Nt().useCallback(de,Ve)},t.useContext=function(de){var Ve=Nt();if(de._context!==void 0){var pt=de._context;pt.Consumer===de?_("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):pt.Provider===de&&_("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return Ve.useContext(de)},t.useDebugValue=function(de,Ve){return Nt().useDebugValue(de,Ve)},t.useDeferredValue=function(de){return Nt().useDeferredValue(de)},t.useEffect=function(de,Ve){return Nt().useEffect(de,Ve)},t.useId=function(){return Nt().useId()},t.useImperativeHandle=function(de,Ve,pt){return Nt().useImperativeHandle(de,Ve,pt)},t.useInsertionEffect=function(de,Ve){return Nt().useInsertionEffect(de,Ve)},t.useLayoutEffect=function(de,Ve){return Nt().useLayoutEffect(de,Ve)},t.useMemo=function(de,Ve){return Nt().useMemo(de,Ve)},t.useReducer=function(de,Ve,pt){return Nt().useReducer(de,Ve,pt)},t.useRef=function(de){return Nt().useRef(de)},t.useState=function(de){return Nt().useState(de)},t.useSyncExternalStore=function(de,Ve,pt){return Nt().useSyncExternalStore(de,Ve,pt)},t.useTransition=function(){return Nt().useTransition()},t.version="18.2.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(q7,q7.exports)),q7.exports}function EM(){return kB||(kB=1,mi.env.NODE_ENV==="production"?SM.exports=ree():SM.exports=iee()),SM.exports}q7.exports;var MB,CB,xB,AB,D2={},kM={exports:{}},Os={},MM={exports:{}},TB={},RB={};function oee(){return CB||(CB=1,function(e){mi.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=!1,n=!1;function r(q,F){var K=q.length;q.push(F),function(Z,ne,ue){for(var me=ue;me>0;){var fe=me-1>>>1,De=Z[fe];if(!(h(De,ne)>0))return;Z[fe]=ne,Z[me]=De,me=fe}}(q,F,K)}function a(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var F=q[0],K=q.pop();return K!==F&&(q[0]=K,function(Z,ne,ue){for(var me=0,fe=Z.length,De=fe>>>1;meue)||Z&&!m());){var me=z.callback;if(typeof me=="function"){z.callback=null,H=z.priorityLevel;var fe=me(z.expirationTime<=ue);ue=e.unstable_now(),typeof fe=="function"?z.callback=fe:z===a(M)&&i(M),Ce(ue)}else i(M);z=a(M)}if(z!==null)return!0;var De=a(C);return De!==null&&B(ze,De.startTime-ue),!1}(q,F)}finally{z=null,H=K,ee=!1}}typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var $e=!1,S=null,P=-1,d=5,g=-1;function m(){return!(e.unstable_now()-g125?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):d=q>0?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return H},e.unstable_getFirstCallbackNode=function(){return a(M)},e.unstable_next=function(q){var F;switch(H){case 1:case 2:case 3:F=3;break;default:F=H}var K=H;H=F;try{return q()}finally{H=K}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=Y,e.unstable_runWithPriority=function(q,F){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var K=H;H=q;try{return F()}finally{H=K}},e.unstable_scheduleCallback=function(q,F,K){var Z,ne,ue=e.unstable_now();if(typeof K=="object"&&K!==null){var me=K.delay;Z=typeof me=="number"&&me>0?ue+me:ue}else Z=ue;switch(q){case 1:ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}var fe=Z+ne,De={id:O++,callback:F,priorityLevel:q,startTime:Z,expirationTime:fe,sortIndex:-1};return Z>ue?(De.sortIndex=Z,r(C,De),a(M)===null&&De===a(C)&&(se?$():se=!0,B(ze,Z-ue))):(De.sortIndex=fe,r(M,De),te||ee||(te=!0,L(Fe))),De},e.unstable_shouldYield=m,e.unstable_wrapCallback=function(q){var F=H;return function(){var K=H;H=F;try{return q.apply(this,arguments)}finally{H=K}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(RB)),RB}function PB(){return xB||(xB=1,mi.env.NODE_ENV==="production"?MM.exports=(MB||(MB=1,function(e){function t(L,B){var $=L.length;L.push(B);e:for(;0<$;){var Y=$-1>>>1,q=L[Y];if(!(0>>1;Ya(Z,$))nea(ue,Z)?(L[Y]=ue,L[ne]=$,Y=ne):(L[Y]=Z,L[K]=$,Y=K);else{if(!(nea(ue,$)))break e;L[Y]=ue,L[ne]=$,Y=ne}}}return B}function a(L,B){var $=L.sortIndex-B.sortIndex;return $!==0?$:L.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var h=Date,y=h.now();e.unstable_now=function(){return h.now()-y}}var k=[],E=[],M=1,C=null,O=3,z=!1,H=!1,ee=!1,te=typeof setTimeout=="function"?setTimeout:null,se=typeof clearTimeout=="function"?clearTimeout:null,oe=typeof setImmediate<"u"?setImmediate:null;function Ee(L){for(var B=n(E);B!==null;){if(B.callback===null)r(E);else{if(!(B.startTime<=L))break;r(E),B.sortIndex=B.expirationTime,t(k,B)}B=n(E)}}function we(L){if(ee=!1,Ee(L),!H)if(n(k)!==null)H=!0,_(Ce);else{var B=n(E);B!==null&&T(we,B.startTime-L)}}function Ce(L,B){H=!1,ee&&(ee=!1,se(S),S=-1),z=!0;var $=O;try{for(Ee(B),C=n(k);C!==null&&(!(C.expirationTime>B)||L&&!g());){var Y=C.callback;if(typeof Y=="function"){C.callback=null,O=C.priorityLevel;var q=Y(C.expirationTime<=B);B=e.unstable_now(),typeof q=="function"?C.callback=q:C===n(k)&&r(k),Ee(B)}else r(k);C=n(k)}if(C!==null)var F=!0;else{var K=n(E);K!==null&&T(we,K.startTime-B),F=!1}return F}finally{C=null,O=$,z=!1}}typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var ze,Fe=!1,$e=null,S=-1,P=5,d=-1;function g(){return!(e.unstable_now()-dL||125Y?(L.sortIndex=$,t(E,L),n(k)===null&&L===n(E)&&(ee?(se(S),S=-1):ee=!0,T(we,$-Y))):(L.sortIndex=q,t(k,L),H||z||(H=!0,_(Ce))),L},e.unstable_shouldYield=g,e.unstable_wrapCallback=function(L){var B=O;return function(){var $=O;O=B;try{return L.apply(this,arguments)}finally{O=$}}}}(TB)),TB):MM.exports=oee()),MM.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */function aee(){if(AB)return Os;AB=1;var e=EM(),t=PB();function n(c){for(var v="https://reactjs.org/docs/error-decoder.html?invariant="+c,x=1;x"u"||window.document===void 0||window.document.createElement===void 0),k=Object.prototype.hasOwnProperty,E=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,M={},C={};function O(c,v,x,N,W,J,ce){this.acceptsBooleans=v===2||v===3||v===4,this.attributeName=N,this.attributeNamespace=W,this.mustUseProperty=x,this.propertyName=c,this.type=v,this.sanitizeURL=J,this.removeEmptyString=ce}var z={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(c){z[c]=new O(c,0,!1,c,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(c){var v=c[0];z[v]=new O(v,1,!1,c[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(c){z[c]=new O(c,2,!1,c.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(c){z[c]=new O(c,2,!1,c,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(c){z[c]=new O(c,3,!1,c.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(c){z[c]=new O(c,3,!0,c,null,!1,!1)}),["capture","download"].forEach(function(c){z[c]=new O(c,4,!1,c,null,!1,!1)}),["cols","rows","size","span"].forEach(function(c){z[c]=new O(c,6,!1,c,null,!1,!1)}),["rowSpan","start"].forEach(function(c){z[c]=new O(c,5,!1,c.toLowerCase(),null,!1,!1)});var H=/[\-:]([a-z])/g;function ee(c){return c[1].toUpperCase()}function te(c,v,x,N){var W=z.hasOwnProperty(v)?z[v]:null;(W!==null?W.type!==0:N||!(2ce}return!1}(v,x,W,N)&&(x=null),N||W===null?function(J){return!!k.call(C,J)||!k.call(M,J)&&(E.test(J)?C[J]=!0:(M[J]=!0,!1))}(v)&&(x===null?c.removeAttribute(v):c.setAttribute(v,""+x)):W.mustUseProperty?c[W.propertyName]=x===null?W.type!==3&&"":x:(v=W.attributeName,N=W.attributeNamespace,x===null?c.removeAttribute(v):(x=(W=W.type)===3||W===4&&x===!0?"":""+x,N?c.setAttributeNS(N,v,x):c.setAttribute(v,x))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(c){var v=c.replace(H,ee);z[v]=new O(v,1,!1,c,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(c){var v=c.replace(H,ee);z[v]=new O(v,1,!1,c,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(c){var v=c.replace(H,ee);z[v]=new O(v,1,!1,c,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(c){z[c]=new O(c,1,!1,c.toLowerCase(),null,!1,!1)}),z.xlinkHref=new O("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(c){z[c]=new O(c,1,!1,c.toLowerCase(),null,!0,!0)});var se=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,oe=Symbol.for("react.element"),Ee=Symbol.for("react.portal"),we=Symbol.for("react.fragment"),Ce=Symbol.for("react.strict_mode"),ze=Symbol.for("react.profiler"),Fe=Symbol.for("react.provider"),$e=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),f=Symbol.iterator;function _(c){return c===null||typeof c!="object"?null:typeof(c=f&&c[f]||c["@@iterator"])=="function"?c:null}var T,L=Object.assign;function B(c){if(T===void 0)try{throw Error()}catch(x){var v=x.stack.trim().match(/\n( *(at )?)/);T=v&&v[1]||""}return` +`+T+c}var $=!1;function Y(c,v){if(!c||$)return"";$=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(v)if(v=function(){throw Error()},Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(Ze){var N=Ze}Reflect.construct(c,[],v)}else{try{v.call()}catch(Ze){N=Ze}c.call(v.prototype)}else{try{throw Error()}catch(Ze){N=Ze}c()}}catch(Ze){if(Ze&&N&&typeof Ze.stack=="string"){for(var W=Ze.stack.split(` +`),J=N.stack.split(` +`),ce=W.length-1,Pe=J.length-1;1<=ce&&0<=Pe&&W[ce]!==J[Pe];)Pe--;for(;1<=ce&&0<=Pe;ce--,Pe--)if(W[ce]!==J[Pe]){if(ce!==1||Pe!==1)do if(ce--,0>--Pe||W[ce]!==J[Pe]){var Ne=` +`+W[ce].replace(" at new "," at ");return c.displayName&&Ne.includes("")&&(Ne=Ne.replace("",c.displayName)),Ne}while(1<=ce&&0<=Pe);break}}}finally{$=!1,Error.prepareStackTrace=x}return(c=c?c.displayName||c.name:"")?B(c):""}function q(c){switch(c.tag){case 5:return B(c.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return Y(c.type,!1);case 11:return Y(c.type.render,!1);case 1:return Y(c.type,!0);default:return""}}function F(c){if(c==null)return null;if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case we:return"Fragment";case Ee:return"Portal";case ze:return"Profiler";case Ce:return"StrictMode";case P:return"Suspense";case d:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case $e:return(c.displayName||"Context")+".Consumer";case Fe:return(c._context.displayName||"Context")+".Provider";case S:var v=c.render;return(c=c.displayName)||(c=(c=v.displayName||v.name||"")!==""?"ForwardRef("+c+")":"ForwardRef"),c;case g:return(v=c.displayName||null)!==null?v:F(c.type)||"Memo";case m:v=c._payload,c=c._init;try{return F(c(v))}catch{}}return null}function K(c){var v=c.type;switch(c.tag){case 24:return"Cache";case 9:return(v.displayName||"Context")+".Consumer";case 10:return(v._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=(c=v.render).displayName||c.name||"",v.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return v;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return F(v);case 8:return v===Ce?"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 v=="function")return v.displayName||v.name||null;if(typeof v=="string")return v}return null}function Z(c){switch(typeof c){case"boolean":case"number":case"string":case"undefined":case"object":return c;default:return""}}function ne(c){var v=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(v==="checkbox"||v==="radio")}function ue(c){c._valueTracker||(c._valueTracker=function(v){var x=ne(v)?"checked":"value",N=Object.getOwnPropertyDescriptor(v.constructor.prototype,x),W=""+v[x];if(!v.hasOwnProperty(x)&&N!==void 0&&typeof N.get=="function"&&typeof N.set=="function"){var J=N.get,ce=N.set;return Object.defineProperty(v,x,{configurable:!0,get:function(){return J.call(this)},set:function(Pe){W=""+Pe,ce.call(this,Pe)}}),Object.defineProperty(v,x,{enumerable:N.enumerable}),{getValue:function(){return W},setValue:function(Pe){W=""+Pe},stopTracking:function(){v._valueTracker=null,delete v[x]}}}}(c))}function me(c){if(!c)return!1;var v=c._valueTracker;if(!v)return!0;var x=v.getValue(),N="";return c&&(N=ne(c)?c.checked?"true":"false":c.value),(c=N)!==x&&(v.setValue(c),!0)}function fe(c){if((c=c||(typeof document<"u"?document:void 0))===void 0)return null;try{return c.activeElement||c.body}catch{return c.body}}function De(c,v){var x=v.checked;return L({},v,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:x??c._wrapperState.initialChecked})}function _e(c,v){var x=v.defaultValue==null?"":v.defaultValue,N=v.checked!=null?v.checked:v.defaultChecked;x=Z(v.value!=null?v.value:x),c._wrapperState={initialChecked:N,initialValue:x,controlled:v.type==="checkbox"||v.type==="radio"?v.checked!=null:v.value!=null}}function pe(c,v){(v=v.checked)!=null&&te(c,"checked",v,!1)}function ve(c,v){pe(c,v);var x=Z(v.value),N=v.type;if(x!=null)N==="number"?(x===0&&c.value===""||c.value!=x)&&(c.value=""+x):c.value!==""+x&&(c.value=""+x);else if(N==="submit"||N==="reset")return void c.removeAttribute("value");v.hasOwnProperty("value")?Ae(c,v.type,x):v.hasOwnProperty("defaultValue")&&Ae(c,v.type,Z(v.defaultValue)),v.checked==null&&v.defaultChecked!=null&&(c.defaultChecked=!!v.defaultChecked)}function Se(c,v,x){if(v.hasOwnProperty("value")||v.hasOwnProperty("defaultValue")){var N=v.type;if(!(N!=="submit"&&N!=="reset"||v.value!==void 0&&v.value!==null))return;v=""+c._wrapperState.initialValue,x||v===c.value||(c.value=v),c.defaultValue=v}(x=c.name)!==""&&(c.name=""),c.defaultChecked=!!c._wrapperState.initialChecked,x!==""&&(c.name=x)}function Ae(c,v,x){v==="number"&&fe(c.ownerDocument)===c||(x==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+x&&(c.defaultValue=""+x))}var qe=Array.isArray;function Xe(c,v,x,N){if(c=c.options,v){v={};for(var W=0;W"+v.valueOf().toString()+"",v=at.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;v.firstChild;)c.appendChild(v.firstChild)}},typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,v,x,N){MSApp.execUnsafeLocalFunction(function(){return Rt(c,v)})}:Rt);function Lt(c,v){if(v){var x=c.firstChild;if(x&&x===c.lastChild&&x.nodeType===3)return void(x.nodeValue=v)}c.textContent=v}var rn={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},Vt=["Webkit","ms","Moz","O"];function Pt(c,v,x){return v==null||typeof v=="boolean"||v===""?"":x||typeof v!="number"||v===0||rn.hasOwnProperty(c)&&rn[c]?(""+v).trim():v+"px"}function en(c,v){for(var x in c=c.style,v)if(v.hasOwnProperty(x)){var N=x.indexOf("--")===0,W=Pt(x,v[x],N);x==="float"&&(x="cssFloat"),N?c.setProperty(x,W):c[x]=W}}Object.keys(rn).forEach(function(c){Vt.forEach(function(v){v=v+c.charAt(0).toUpperCase()+c.substring(1),rn[v]=rn[c]})});var on=L({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 At(c,v){if(v){if(on[c]&&(v.children!=null||v.dangerouslySetInnerHTML!=null))throw Error(n(137,c));if(v.dangerouslySetInnerHTML!=null){if(v.children!=null)throw Error(n(60));if(typeof v.dangerouslySetInnerHTML!="object"||!("__html"in v.dangerouslySetInnerHTML))throw Error(n(61))}if(v.style!=null&&typeof v.style!="object")throw Error(n(62))}}function Jt(c,v){if(c.indexOf("-")===-1)return typeof v.is=="string";switch(c){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 tn=null;function Bt(c){return(c=c.target||c.srcElement||window).correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var Rn=null,wn=null,Ut=null;function Fn(c){if(c=M1(c)){if(typeof Rn!="function")throw Error(n(280));var v=c.stateNode;v&&(v=C1(v),Rn(c.stateNode,c.type,v))}}function kn(c){wn?Ut?Ut.push(c):Ut=[c]:wn=c}function Nt(){if(wn){var c=wn,v=Ut;if(Ut=wn=null,Fn(c),v)for(c=0;c>>=0)==0?32:31-(Ti(c)/Oi|0)|0},Ti=Math.log,Oi=Math.LN2,xo=64,ca=4194304;function Mf(c){switch(c&-c){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 4194240&c;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&c;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function xd(c,v){var x=c.pendingLanes;if(x===0)return 0;var N=0,W=c.suspendedLanes,J=c.pingedLanes,ce=268435455&x;if(ce!==0){var Pe=ce&~W;Pe!==0?N=Mf(Pe):(J&=ce)!=0&&(N=Mf(J))}else(ce=x&~W)!=0?N=Mf(ce):J!==0&&(N=Mf(J));if(N===0)return 0;if(v!==0&&v!==N&&!(v&W)&&((W=N&-N)>=(J=v&-v)||W===16&&4194240&J))return v;if(4&N&&(N|=16&x),(v=c.entangledLanes)!==0)for(c=c.entanglements,v&=N;0x;x++)v.push(c);return v}function pt(c,v,x){c.pendingLanes|=v,v!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),(c=c.eventTimes)[v=31-qr(v)]=x}function Ct(c,v){var x=c.entangledLanes|=v;for(c=c.entanglements;x;){var N=31-qr(x),W=1<=tl),sb=" ",X7=!1;function J7(c,v){switch(c){case"keyup":return IM.indexOf(v.keyCode)!==-1;case"keydown":return v.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function e9(c){return typeof(c=c.detail)=="object"&&"data"in c?c.data:null}var Pd=!1,LM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ub(c){var v=c&&c.nodeName&&c.nodeName.toLowerCase();return v==="input"?!!LM[c.type]:v==="textarea"}function t9(c,v,x,N){kn(N),0<(v=il(v,"onChange")).length&&(x=new Jy("onChange","change",null,x,N),c.push({event:x,listeners:v}))}var q2=null,Id=null;function Ld(c){u9(c,0)}function Od(c){if(me(Bs(c)))return c}function n9(c,v){if(c==="change")return v}var Nd=!1;if(y){var lb;if(y){var cb="oninput"in document;if(!cb){var r9=document.createElement("div");r9.setAttribute("oninput","return;"),cb=typeof r9.oninput=="function"}lb=cb}else lb=!1;Nd=lb&&(!document.documentMode||9=v)return{node:N,offset:v-c};c=x}e:{for(;N;){if(N.nextSibling){N=N.nextSibling;break e}N=N.parentNode}N=void 0}N=s9(N)}}function W2(c,v){return!(!c||!v)&&(c===v||(!c||c.nodeType!==3)&&(v&&v.nodeType===3?W2(c,v.parentNode):"contains"in c?c.contains(v):!!c.compareDocumentPosition&&!!(16&c.compareDocumentPosition(v))))}function d0(){for(var c=window,v=fe();v instanceof c.HTMLIFrameElement;){try{var x=typeof v.contentWindow.location.href=="string"}catch{x=!1}if(!x)break;v=fe((c=v.contentWindow).document)}return v}function hb(c){var v=c&&c.nodeName&&c.nodeName.toLowerCase();return v&&(v==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||v==="textarea"||c.contentEditable==="true")}function w1(c){var v=d0(),x=c.focusedElem,N=c.selectionRange;if(v!==x&&x&&x.ownerDocument&&W2(x.ownerDocument.documentElement,x)){if(N!==null&&hb(x)){if(v=N.start,(c=N.end)===void 0&&(c=v),"selectionStart"in x)x.selectionStart=v,x.selectionEnd=Math.min(c,x.value.length);else if((c=(v=x.ownerDocument||document)&&v.defaultView||window).getSelection){c=c.getSelection();var W=x.textContent.length,J=Math.min(N.start,W);N=N.end===void 0?J:Math.min(N.end,W),!c.extend&&J>N&&(W=N,N=J,J=W),W=db(x,J);var ce=db(x,N);W&&ce&&(c.rangeCount!==1||c.anchorNode!==W.node||c.anchorOffset!==W.offset||c.focusNode!==ce.node||c.focusOffset!==ce.offset)&&((v=v.createRange()).setStart(W.node,W.offset),c.removeAllRanges(),J>N?(c.addRange(v),c.extend(ce.node,ce.offset)):(v.setEnd(ce.node,ce.offset),c.addRange(v)))}}for(v=[],c=x;c=c.parentNode;)c.nodeType===1&&v.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x=document.documentMode,Af=null,Tf=null,nl=null,V2=!1;function mb(c,v,x){var N=x.window===x?x.document:x.nodeType===9?x:x.ownerDocument;V2||Af==null||Af!==fe(N)||(N="selectionStart"in(N=Af)&&hb(N)?{start:N.selectionStart,end:N.selectionEnd}:{anchorNode:(N=(N.ownerDocument&&N.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:N.anchorOffset,focusNode:N.focusNode,focusOffset:N.focusOffset},nl&&b1(nl,N)||(nl=N,0<(N=il(Tf,"onSelect")).length&&(v=new Jy("onSelect","select",null,v,x),c.push({event:v,listeners:N}),v.target=Af)))}function _1(c,v){var x={};return x[c.toLowerCase()]=v.toLowerCase(),x["Webkit"+c]="webkit"+v,x["Moz"+c]="moz"+v,x}var Dd={animationend:_1("Animation","AnimationEnd"),animationiteration:_1("Animation","AnimationIteration"),animationstart:_1("Animation","AnimationStart"),transitionend:_1("Transition","TransitionEnd")},Y2={},G2={};function Z2(c){if(Y2[c])return Y2[c];if(!Dd[c])return c;var v,x=Dd[c];for(v in x)if(x.hasOwnProperty(v)&&v in G2)return Y2[c]=x[v];return c}y&&(G2=document.createElement("div").style,"AnimationEvent"in window||(delete Dd.animationend.animation,delete Dd.animationiteration.animation,delete Dd.animationstart.animation),"TransitionEvent"in window||delete Dd.transitionend.transition);var gb=Z2("animationend"),h0=Z2("animationiteration"),Q2=Z2("animationstart"),p0=Z2("transitionend"),vb=new Map,yb="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function rl(c,v){vb.set(c,v),i(v,[c])}for(var bb=0;bbzd||(c.current=ng[zd],ng[zd]=null,zd--)}function ci(c,v){zd++,ng[zd]=c.current,c.current=v}var Nf={},To=rc(Nf),ma=rc(!1),Fd=Nf;function y0(c,v){var x=c.type.contextTypes;if(!x)return Nf;var N=c.stateNode;if(N&&N.__reactInternalMemoizedUnmaskedChildContext===v)return N.__reactInternalMemoizedMaskedChildContext;var W,J={};for(W in x)J[W]=v[W];return N&&((c=c.stateNode).__reactInternalMemoizedUnmaskedChildContext=v,c.__reactInternalMemoizedMaskedChildContext=J),J}function ns(c){return c.childContextTypes!=null}function so(){bi(ma),bi(To)}function l9(c,v,x){if(To.current!==Nf)throw Error(n(168));ci(To,v),ci(ma,x)}function x1(c,v,x){var N=c.stateNode;if(v=v.childContextTypes,typeof N.getChildContext!="function")return x;for(var W in N=N.getChildContext())if(!(W in v))throw Error(n(108,K(c)||"Unknown",W));return L({},x,N)}function b0(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Nf,Fd=To.current,ci(To,c),ci(ma,ma.current),!0}function Df(c,v,x){var N=c.stateNode;if(!N)throw Error(n(169));x?(c=x1(c,v,Fd),N.__reactInternalMemoizedMergedChildContext=c,bi(ma),bi(To),ci(To,c)):bi(ma),ci(ma,x)}var ic=null,w0=!1,Sb=!1;function c9(c){ic===null?ic=[c]:ic.push(c)}function rs(){if(!Sb&&ic!==null){Sb=!0;var c=0,v=xt;try{var x=ic;for(xt=1;c>=ce,W-=ce,hu=1<<32-qr(v)+W|x<cr?(nr=ln,ln=null):nr=ln.sibling;var er=ft(dt,ln,ut[cr],Et);if(er===null){ln===null&&(ln=nr);break}c&&ln&&er.alternate===null&&v(dt,ln),We=J(er,We,cr),lr===null?cn=er:lr.sibling=er,lr=er,ln=nr}if(cr===ut.length)return x(dt,ln),wi&&Fs(dt,cr),cn;if(ln===null){for(;crcr?(nr=ln,ln=null):nr=ln.sibling;var Ur=ft(dt,ln,er.value,Et);if(Ur===null){ln===null&&(ln=nr);break}c&&ln&&Ur.alternate===null&&v(dt,ln),We=J(Ur,We,cr),lr===null?cn=Ur:lr.sibling=Ur,lr=Ur,ln=nr}if(er.done)return x(dt,ln),wi&&Fs(dt,cr),cn;if(ln===null){for(;!er.done;cr++,er=ut.next())(er=mt(dt,er.value,Et))!==null&&(We=J(er,We,cr),lr===null?cn=er:lr.sibling=er,lr=er);return wi&&Fs(dt,cr),cn}for(ln=N(dt,ln);!er.done;cr++,er=ut.next())(er=yt(ln,dt,cr,er.value,Et))!==null&&(c&&er.alternate!==null&&ln.delete(er.key===null?cr:er.key),We=J(er,We,cr),lr===null?cn=er:lr.sibling=er,lr=er);return c&&ln.forEach(function(sh){return v(dt,sh)}),wi&&Fs(dt,cr),cn}return function dt(We,ut,Et,cn){if(typeof Et=="object"&&Et!==null&&Et.type===we&&Et.key===null&&(Et=Et.props.children),typeof Et=="object"&&Et!==null){switch(Et.$$typeof){case oe:e:{for(var lr=Et.key,ln=ut;ln!==null;){if(ln.key===lr){if((lr=Et.type)===we){if(ln.tag===7){x(We,ln.sibling),(ut=W(ln,Et.props.children)).return=We,We=ut;break e}}else if(ln.elementType===lr||typeof lr=="object"&&lr!==null&&lr.$$typeof===m&&k0(lr)===ln.type){x(We,ln.sibling),(ut=W(ln,Et.props)).ref=$d(We,ln,Et),ut.return=We,We=ut;break e}x(We,ln);break}v(We,ln),ln=ln.sibling}Et.type===we?((ut=Ua(Et.props.children,We.mode,cn,Et.key)).return=We,We=ut):((cn=oh(Et.type,Et.key,Et.props,null,We.mode,cn)).ref=$d(We,ut,Et),cn.return=We,We=cn)}return ce(We);case Ee:e:{for(ln=Et.key;ut!==null;){if(ut.key===ln){if(ut.tag===4&&ut.stateNode.containerInfo===Et.containerInfo&&ut.stateNode.implementation===Et.implementation){x(We,ut.sibling),(ut=W(ut,Et.children||[])).return=We,We=ut;break e}x(We,ut);break}v(We,ut),ut=ut.sibling}(ut=kc(Et,We.mode,cn)).return=We,We=ut}return ce(We);case m:return dt(We,ut,(ln=Et._init)(Et._payload),cn)}if(qe(Et))return Ot(We,ut,Et,cn);if(_(Et))return Ht(We,ut,Et,cn);I1(We,Et)}return typeof Et=="string"&&Et!==""||typeof Et=="number"?(Et=""+Et,ut!==null&&ut.tag===6?(x(We,ut.sibling),(ut=W(ut,Et)).return=We,We=ut):(x(We,ut),(ut=Ec(Et,We.mode,cn)).return=We,We=ut),ce(We)):x(We,ut)}}var cl=Cb(!0),Bf=Cb(!1),Ro={},fl=rc(Ro),Qr=rc(Ro),qd=rc(Ro);function sc(c){if(c===Ro)throw Error(n(174));return c}function Wd(c,v){switch(ci(qd,v),ci(Qr,c),ci(fl,Ro),c=v.nodeType){case 9:case 11:v=(v=v.documentElement)?v.namespaceURI:vt(null,"");break;default:v=vt(v=(c=c===8?v.parentNode:v).namespaceURI||null,c=c.tagName)}bi(fl),ci(fl,v)}function uc(){bi(fl),bi(Qr),bi(qd)}function d9(c){sc(qd.current);var v=sc(fl.current),x=vt(v,c.type);v!==x&&(ci(Qr,c),ci(fl,x))}function L1(c){Qr.current===c&&(bi(fl),bi(Qr))}var Ri=rc(0);function O1(c){for(var v=c;v!==null;){if(v.tag===13){var x=v.memoizedState;if(x!==null&&((x=x.dehydrated)===null||x.data==="$?"||x.data==="$!"))return v}else if(v.tag===19&&v.memoizedProps.revealOrder!==void 0){if(128&v.flags)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===c)break;for(;v.sibling===null;){if(v.return===null||v.return===c)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}var M0=[];function hg(){for(var c=0;cx?x:4,c(!0);var N=lc.transition;lc.transition={};try{c(!1),v()}finally{xt=x,lc.transition=N}}function T0(){return ls().memoizedState}function v9(c,v,x){var N=wc(c);x={lane:N,action:x,hasEagerState:!1,eagerState:null,next:null},Tb(c)?y9(v,x):(x=ag(c,v,x,N))!==null&&($s(x,c,N,Xo()),R0(x,v,N))}function vg(c,v,x){var N=wc(c),W={lane:N,action:x,hasEagerState:!1,eagerState:null,next:null};if(Tb(c))y9(v,W);else{var J=c.alternate;if(c.lanes===0&&(J===null||J.lanes===0)&&(J=v.lastRenderedReducer)!==null)try{var ce=v.lastRenderedState,Pe=J(ce,x);if(W.hasEagerState=!0,W.eagerState=Pe,cu(Pe,ce)){var Ne=v.interleaved;return Ne===null?(W.next=W,A1(v)):(W.next=Ne.next,Ne.next=W),void(v.interleaved=W)}}catch{}(x=ag(c,v,W,N))!==null&&($s(x,c,N,W=Xo()),R0(x,v,N))}}function Tb(c){var v=c.alternate;return c===Xr||v!==null&&v===Xr}function y9(c,v){Jn=cc=!0;var x=c.pending;x===null?v.next=v:(v.next=x.next,x.next=v),c.pending=v}function R0(c,v,x){if(4194240&x){var N=v.lanes;x|=N&=c.pendingLanes,v.lanes=x,Ct(c,x)}}var Ff={readContext:Go,useCallback:wo,useContext:wo,useEffect:wo,useImperativeHandle:wo,useInsertionEffect:wo,useLayoutEffect:wo,useMemo:wo,useReducer:wo,useRef:wo,useState:wo,useDebugValue:wo,useDeferredValue:wo,useTransition:wo,useMutableSource:wo,useSyncExternalStore:wo,useId:wo,unstable_isNewReconciler:!1},P0={readContext:Go,useCallback:function(c,v){return wu().memoizedState=[c,v===void 0?null:v],c},useContext:Go,useEffect:p9,useImperativeHandle:function(c,v,x){return x=x!=null?x.concat([c]):null,F1(4194308,4,hc.bind(null,v,c),x)},useLayoutEffect:function(c,v){return F1(4194308,4,c,v)},useInsertionEffect:function(c,v){return F1(4,2,c,v)},useMemo:function(c,v){var x=wu();return v=v===void 0?null:v,c=c(),x.memoizedState=[c,v],c},useReducer:function(c,v,x){var N=wu();return v=x!==void 0?x(v):v,N.memoizedState=N.baseState=v,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:v},N.queue=c,c=c.dispatch=v9.bind(null,Xr,c),[N.memoizedState,c]},useRef:function(c){return c={current:c},wu().memoizedState=c},useState:_u,useDebugValue:Gd,useDeferredValue:function(c){return wu().memoizedState=c},useTransition:function(){var c=_u(!1),v=c[0];return c=g9.bind(null,c[1]),wu().memoizedState=c,[v,c]},useMutableSource:function(){},useSyncExternalStore:function(c,v,x){var N=Xr,W=wu();if(wi){if(x===void 0)throw Error(n(407));x=x()}else{if(x=v(),Vr===null)throw Error(n(349));30&bu||cs(N,v,x)}W.memoizedState=x;var J={value:x,getSnapshot:v};return W.queue=J,p9(fc.bind(null,N,J,c),[c]),N.flags|=2048,lo(9,dl.bind(null,N,J,x,v),void 0,null),x},useId:function(){var c=wu(),v=Vr.identifierPrefix;if(wi){var x=os;v=":"+v+"R"+(x=(hu&~(1<<32-qr(hu)-1)).toString(32)+x),0<(x=zf++)&&(v+="H"+x.toString(32)),v+=":"}else v=":"+v+"r"+(x=h9++).toString(32)+":";return c.memoizedState=v},unstable_isNewReconciler:!1},Rb={readContext:Go,useCallback:A0,useContext:Go,useEffect:j1,useImperativeHandle:pc,useInsertionEffect:U1,useLayoutEffect:dc,useMemo:mc,useReducer:B1,useRef:gg,useState:function(){return B1(C0)},useDebugValue:Gd,useDeferredValue:function(c){return m9(ls(),uo.memoizedState,c)},useTransition:function(){return[B1(C0)[0],ls().memoizedState]},useMutableSource:xb,useSyncExternalStore:Ab,useId:T0,unstable_isNewReconciler:!1},b9={readContext:Go,useCallback:A0,useContext:Go,useEffect:j1,useImperativeHandle:pc,useInsertionEffect:U1,useLayoutEffect:dc,useMemo:mc,useReducer:mg,useRef:gg,useState:function(){return mg(C0)},useDebugValue:Gd,useDeferredValue:function(c){var v=ls();return uo===null?v.memoizedState=c:m9(v,uo.memoizedState,c)},useTransition:function(){return[mg(C0)[0],ls().memoizedState]},useMutableSource:xb,useSyncExternalStore:Ab,useId:T0,unstable_isNewReconciler:!1};function I0(c,v){try{var x="",N=v;do x+=q(N),N=N.return;while(N);var W=x}catch(J){W=` +Error generating stack: `+J.message+` +`+J.stack}return{value:c,source:v,stack:W,digest:null}}function Pb(c,v,x){return{value:c,source:null,stack:x??null,digest:v??null}}function K1(c,v){try{console.error(v.value)}catch(x){setTimeout(function(){throw x})}}var yg=typeof WeakMap=="function"?WeakMap:Map;function bg(c,v,x){(x=yu(-1,x)).tag=3,x.payload={element:null};var N=v.value;return x.callback=function(){yc||(yc=!0,G1=N),K1(0,v)},x}function Ib(c,v,x){(x=yu(-1,x)).tag=3;var N=c.type.getDerivedStateFromError;if(typeof N=="function"){var W=v.value;x.payload=function(){return N(W)},x.callback=function(){K1(0,v)}}var J=c.stateNode;return J!==null&&typeof J.componentDidCatch=="function"&&(x.callback=function(){K1(0,v),typeof N!="function"&&(Hs===null?Hs=new Set([this]):Hs.add(this));var ce=v.stack;this.componentDidCatch(v.value,{componentStack:ce!==null?ce:""})}),x}function L0(c,v,x){var N=c.pingCache;if(N===null){N=c.pingCache=new yg;var W=new Set;N.set(v,W)}else(W=N.get(v))===void 0&&(W=new Set,N.set(v,W));W.has(x)||(W.add(x),c=t6.bind(null,c,v,x),v.then(c,c))}function wg(c){do{var v;if((v=c.tag===13)&&(v=(v=c.memoizedState)===null||v.dehydrated!==null),v)return c;c=c.return}while(c!==null);return null}function H1(c,v,x,N,W){return 1&c.mode?(c.flags|=65536,c.lanes=W,c):(c===v?c.flags|=65536:(c.flags|=128,x.flags|=131072,x.flags&=-52805,x.tag===1&&(x.alternate===null?x.tag=17:((v=yu(-1,1)).tag=2,ll(x,v,1))),x.lanes|=1),c)}var w9=se.ReactCurrentOwner,ga=!1;function Po(c,v,x,N){v.child=c===null?Bf(v,null,x,N):cl(v,c.child,x,N)}function $1(c,v,x,N,W){x=x.render;var J=v.ref;return gu(v,W),N=pg(c,v,x,N,J,W),x=D1(),c===null||ga?(wi&&x&&rg(v),v.flags|=1,Po(c,v,N,W),v.child):(v.updateQueue=c.updateQueue,v.flags&=-2053,c.lanes&=~W,gc(c,v,W))}function Lb(c,v,x,N,W){if(c===null){var J=x.type;return typeof J!="function"||Jo(J)||J.defaultProps!==void 0||x.compare!==null||x.defaultProps!==void 0?((c=oh(x.type,null,N,v,v.mode,W)).ref=v.ref,c.return=v,v.child=c):(v.tag=15,v.type=J,ja(c,v,J,N,W))}if(J=c.child,(c.lanes&W)==0){var ce=J.memoizedProps;if((x=(x=x.compare)!==null?x:b1)(ce,N)&&c.ref===v.ref)return gc(c,v,W)}return v.flags|=1,(c=qs(J,N)).ref=v.ref,c.return=v,v.child=c}function ja(c,v,x,N,W){if(c!==null){var J=c.memoizedProps;if(b1(J,N)&&c.ref===v.ref){if(ga=!1,v.pendingProps=N=J,(c.lanes&W)==0)return v.lanes=c.lanes,gc(c,v,W);131072&c.flags&&(ga=!0)}}return Zd(c,v,x,N,W)}function _g(c,v,x){var N=v.pendingProps,W=N.children,J=c!==null?c.memoizedState:null;if(N.mode==="hidden")if(!(1&v.mode))v.memoizedState={baseLanes:0,cachePool:null,transitions:null},ci(Xd,ds),ds|=x;else{if(!(1073741824&x))return c=J!==null?J.baseLanes|x:x,v.lanes=v.childLanes=1073741824,v.memoizedState={baseLanes:c,cachePool:null,transitions:null},v.updateQueue=null,ci(Xd,ds),ds|=c,null;v.memoizedState={baseLanes:0,cachePool:null,transitions:null},N=J!==null?J.baseLanes:x,ci(Xd,ds),ds|=N}else J!==null?(N=J.baseLanes|x,v.memoizedState=null):N=x,ci(Xd,ds),ds|=N;return Po(c,v,W,x),v.child}function Sg(c,v){var x=v.ref;(c===null&&x!==null||c!==null&&c.ref!==x)&&(v.flags|=512,v.flags|=2097152)}function Zd(c,v,x,N,W){var J=ns(x)?Fd:To.current;return J=y0(v,J),gu(v,W),x=pg(c,v,x,N,J,W),N=D1(),c===null||ga?(wi&&N&&rg(v),v.flags|=1,Po(c,v,x,W),v.child):(v.updateQueue=c.updateQueue,v.flags&=-2053,c.lanes&=~W,gc(c,v,W))}function Qd(c,v,x,N,W){if(ns(x)){var J=!0;b0(v)}else J=!1;if(gu(v,W),v.stateNode===null)N0(c,v),fg(v,x,N),P1(v,x,N,W),N=!0;else if(c===null){var ce=v.stateNode,Pe=v.memoizedProps;ce.props=Pe;var Ne=ce.context,Ze=x.contextType;Ze=typeof Ze=="object"&&Ze!==null?Go(Ze):y0(v,Ze=ns(x)?Fd:To.current);var rt=x.getDerivedStateFromProps,mt=typeof rt=="function"||typeof ce.getSnapshotBeforeUpdate=="function";mt||typeof ce.UNSAFE_componentWillReceiveProps!="function"&&typeof ce.componentWillReceiveProps!="function"||(Pe!==N||Ne!==Ze)&&dg(v,ce,N,Ze),ul=!1;var ft=v.memoizedState;ce.state=ft,E0(v,N,ce,W),Ne=v.memoizedState,Pe!==N||ft!==Ne||ma.current||ul?(typeof rt=="function"&&(R1(v,x,rt,N),Ne=v.memoizedState),(Pe=ul||Hd(v,x,Pe,N,ft,Ne,Ze))?(mt||typeof ce.UNSAFE_componentWillMount!="function"&&typeof ce.componentWillMount!="function"||(typeof ce.componentWillMount=="function"&&ce.componentWillMount(),typeof ce.UNSAFE_componentWillMount=="function"&&ce.UNSAFE_componentWillMount()),typeof ce.componentDidMount=="function"&&(v.flags|=4194308)):(typeof ce.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=N,v.memoizedState=Ne),ce.props=N,ce.state=Ne,ce.context=Ze,N=Pe):(typeof ce.componentDidMount=="function"&&(v.flags|=4194308),N=!1)}else{ce=v.stateNode,sg(c,v),Pe=v.memoizedProps,Ze=v.type===v.elementType?Pe:Tt(v.type,Pe),ce.props=Ze,mt=v.pendingProps,ft=ce.context,Ne=typeof(Ne=x.contextType)=="object"&&Ne!==null?Go(Ne):y0(v,Ne=ns(x)?Fd:To.current);var yt=x.getDerivedStateFromProps;(rt=typeof yt=="function"||typeof ce.getSnapshotBeforeUpdate=="function")||typeof ce.UNSAFE_componentWillReceiveProps!="function"&&typeof ce.componentWillReceiveProps!="function"||(Pe!==mt||ft!==Ne)&&dg(v,ce,N,Ne),ul=!1,ft=v.memoizedState,ce.state=ft,E0(v,N,ce,W);var Ot=v.memoizedState;Pe!==mt||ft!==Ot||ma.current||ul?(typeof yt=="function"&&(R1(v,x,yt,N),Ot=v.memoizedState),(Ze=ul||Hd(v,x,Ze,N,ft,Ot,Ne)||!1)?(rt||typeof ce.UNSAFE_componentWillUpdate!="function"&&typeof ce.componentWillUpdate!="function"||(typeof ce.componentWillUpdate=="function"&&ce.componentWillUpdate(N,Ot,Ne),typeof ce.UNSAFE_componentWillUpdate=="function"&&ce.UNSAFE_componentWillUpdate(N,Ot,Ne)),typeof ce.componentDidUpdate=="function"&&(v.flags|=4),typeof ce.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof ce.componentDidUpdate!="function"||Pe===c.memoizedProps&&ft===c.memoizedState||(v.flags|=4),typeof ce.getSnapshotBeforeUpdate!="function"||Pe===c.memoizedProps&&ft===c.memoizedState||(v.flags|=1024),v.memoizedProps=N,v.memoizedState=Ot),ce.props=N,ce.state=Ot,ce.context=Ne,N=Ze):(typeof ce.componentDidUpdate!="function"||Pe===c.memoizedProps&&ft===c.memoizedState||(v.flags|=4),typeof ce.getSnapshotBeforeUpdate!="function"||Pe===c.memoizedProps&&ft===c.memoizedState||(v.flags|=1024),N=!1)}return q1(c,v,x,N,J,W)}function q1(c,v,x,N,W,J){Sg(c,v);var ce=(128&v.flags)!=0;if(!N&&!ce)return W&&Df(v,x,!1),gc(c,v,J);N=v.stateNode,w9.current=v;var Pe=ce&&typeof x.getDerivedStateFromError!="function"?null:N.render();return v.flags|=1,c!==null&&ce?(v.child=cl(v,c.child,null,J),v.child=cl(v,null,Pe,J)):Po(c,v,Pe,J),v.memoizedState=N.state,W&&Df(v,x,!0),v.child}function O0(c){var v=c.stateNode;v.pendingContext?l9(0,v.pendingContext,v.pendingContext!==v.context):v.context&&l9(0,v.context,!1),Wd(c,v.containerInfo)}function _9(c,v,x,N,W){return _0(),kb(W),v.flags|=256,Po(c,v,x,N),v.child}var W1,Eg,S9,kg,Ob={dehydrated:null,treeContext:null,retryLane:0};function Nb(c){return{baseLanes:c,cachePool:null,transitions:null}}function Db(c,v,x){var N,W=v.pendingProps,J=Ri.current,ce=!1,Pe=(128&v.flags)!=0;if((N=Pe)||(N=(c===null||c.memoizedState!==null)&&(2&J)!=0),N?(ce=!0,v.flags&=-129):c!==null&&c.memoizedState===null||(J|=1),ci(Ri,1&J),c===null)return Dr(v),(c=v.memoizedState)!==null&&(c=c.dehydrated)!==null?(1&v.mode?c.data==="$!"?v.lanes=8:v.lanes=1073741824:v.lanes=1,null):(Pe=W.children,c=W.fallback,ce?(W=v.mode,ce=v.child,Pe={mode:"hidden",children:Pe},!(1&W)&&ce!==null?(ce.childLanes=0,ce.pendingProps=Pe):ce=rm(Pe,W,0,null),c=Ua(c,W,x,null),ce.return=v,c.return=v,ce.sibling=c,v.child=ce,v.child.memoizedState=Nb(x),v.memoizedState=Ob,c):Bb(v,Pe));if((J=c.memoizedState)!==null&&(N=J.dehydrated)!==null)return function(Ze,rt,mt,ft,yt,Ot,Ht){if(mt)return 256&rt.flags?(rt.flags&=-257,Mg(Ze,rt,Ht,ft=Pb(Error(n(422))))):rt.memoizedState!==null?(rt.child=Ze.child,rt.flags|=128,null):(Ot=ft.fallback,yt=rt.mode,ft=rm({mode:"visible",children:ft.children},yt,0,null),(Ot=Ua(Ot,yt,Ht,null)).flags|=2,ft.return=rt,Ot.return=rt,ft.sibling=Ot,rt.child=ft,1&rt.mode&&cl(rt,Ze.child,null,Ht),rt.child.memoizedState=Nb(Ht),rt.memoizedState=Ob,Ot);if(!(1&rt.mode))return Mg(Ze,rt,Ht,null);if(yt.data==="$!"){if(ft=yt.nextSibling&&yt.nextSibling.dataset)var dt=ft.dgst;return ft=dt,Mg(Ze,rt,Ht,ft=Pb(Ot=Error(n(419)),ft,void 0))}if(dt=(Ht&Ze.childLanes)!=0,ga||dt){if((ft=Vr)!==null){switch(Ht&-Ht){case 4:yt=2;break;case 16:yt=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:yt=32;break;case 536870912:yt=268435456;break;default:yt=0}(yt=yt&(ft.suspendedLanes|Ht)?0:yt)!==0&&yt!==Ot.retryLane&&(Ot.retryLane=yt,vu(Ze,yt),$s(ft,Ze,yt,-1))}return X1(),Mg(Ze,rt,Ht,ft=Pb(Error(n(421))))}return yt.data==="$?"?(rt.flags|=128,rt.child=Ze.child,rt=tm.bind(null,Ze),yt._reactRetry=rt,null):(Ze=Ot.treeContext,ss=sl(yt.nextSibling),as=rt,wi=!0,js=null,Ze!==null&&(Zr[zs++]=hu,Zr[zs++]=os,Zr[zs++]=jd,hu=Ze.id,os=Ze.overflow,jd=rt),(rt=Bb(rt,ft.children)).flags|=4096,rt)}(c,v,Pe,W,N,J,x);if(ce){ce=W.fallback,Pe=v.mode,N=(J=c.child).sibling;var Ne={mode:"hidden",children:W.children};return!(1&Pe)&&v.child!==J?((W=v.child).childLanes=0,W.pendingProps=Ne,v.deletions=null):(W=qs(J,Ne)).subtreeFlags=14680064&J.subtreeFlags,N!==null?ce=qs(N,ce):(ce=Ua(ce,Pe,x,null)).flags|=2,ce.return=v,W.return=v,W.sibling=ce,v.child=W,W=ce,ce=v.child,Pe=(Pe=c.child.memoizedState)===null?Nb(x):{baseLanes:Pe.baseLanes|x,cachePool:null,transitions:Pe.transitions},ce.memoizedState=Pe,ce.childLanes=c.childLanes&~x,v.memoizedState=Ob,W}return c=(ce=c.child).sibling,W=qs(ce,{mode:"visible",children:W.children}),!(1&v.mode)&&(W.lanes=x),W.return=v,W.sibling=null,c!==null&&((x=v.deletions)===null?(v.deletions=[c],v.flags|=16):x.push(c)),v.child=W,v.memoizedState=null,W}function Bb(c,v){return(v=rm({mode:"visible",children:v},c.mode,0,null)).return=c,c.child=v}function Mg(c,v,x,N){return N!==null&&kb(N),cl(v,c.child,null,x),(c=Bb(v,v.pendingProps.children)).flags|=2,v.memoizedState=null,c}function E9(c,v,x){c.lanes|=v;var N=c.alternate;N!==null&&(N.lanes|=v),Ud(c.return,v,x)}function zb(c,v,x,N,W){var J=c.memoizedState;J===null?c.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:N,tail:x,tailMode:W}:(J.isBackwards=v,J.rendering=null,J.renderingStartTime=0,J.last=N,J.tail=x,J.tailMode=W)}function k9(c,v,x){var N=v.pendingProps,W=N.revealOrder,J=N.tail;if(Po(c,v,N.children,x),(2&(N=Ri.current))!=0)N=1&N|2,v.flags|=128;else{if(c!==null&&128&c.flags)e:for(c=v.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&E9(c,x,v);else if(c.tag===19)E9(c,x,v);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===v)break e;for(;c.sibling===null;){if(c.return===null||c.return===v)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}N&=1}if(ci(Ri,N),(1&v.mode)==0)v.memoizedState=null;else switch(W){case"forwards":for(x=v.child,W=null;x!==null;)(c=x.alternate)!==null&&O1(c)===null&&(W=x),x=x.sibling;(x=W)===null?(W=v.child,v.child=null):(W=x.sibling,x.sibling=null),zb(v,!1,W,x,J);break;case"backwards":for(x=null,W=v.child,v.child=null;W!==null;){if((c=W.alternate)!==null&&O1(c)===null){v.child=W;break}c=W.sibling,W.sibling=x,x=W,W=c}zb(v,!0,x,null,J);break;case"together":zb(v,!1,null,null,void 0);break;default:v.memoizedState=null}return v.child}function N0(c,v){!(1&v.mode)&&c!==null&&(c.alternate=null,v.alternate=null,v.flags|=2)}function gc(c,v,x){if(c!==null&&(v.dependencies=c.dependencies),Kf|=v.lanes,(x&v.childLanes)==0)return null;if(c!==null&&v.child!==c.child)throw Error(n(153));if(v.child!==null){for(x=qs(c=v.child,c.pendingProps),v.child=x,x.return=v;c.sibling!==null;)c=c.sibling,(x=x.sibling=qs(c,c.pendingProps)).return=v;x.sibling=null}return v.child}function V1(c,v){if(!wi)switch(c.tailMode){case"hidden":v=c.tail;for(var x=null;v!==null;)v.alternate!==null&&(x=v),v=v.sibling;x===null?c.tail=null:x.sibling=null;break;case"collapsed":x=c.tail;for(var N=null;x!==null;)x.alternate!==null&&(N=x),x=x.sibling;N===null?v||c.tail===null?c.tail=null:c.tail.sibling=null:N.sibling=null}}function Zo(c){var v=c.alternate!==null&&c.alternate.child===c.child,x=0,N=0;if(v)for(var W=c.child;W!==null;)x|=W.lanes|W.childLanes,N|=14680064&W.subtreeFlags,N|=14680064&W.flags,W.return=c,W=W.sibling;else for(W=c.child;W!==null;)x|=W.lanes|W.childLanes,N|=W.subtreeFlags,N|=W.flags,W.return=c,W=W.sibling;return c.subtreeFlags|=N,c.childLanes=x,v}function DM(c,v,x){var N=v.pendingProps;switch(ig(v),v.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zo(v),null;case 1:case 17:return ns(v.type)&&so(),Zo(v),null;case 3:return N=v.stateNode,uc(),bi(ma),bi(To),hg(),N.pendingContext&&(N.context=N.pendingContext,N.pendingContext=null),c!==null&&c.child!==null||(us(v)?v.flags|=4:c===null||c.memoizedState.isDehydrated&&!(256&v.flags)||(v.flags|=1024,js!==null&&(gl(js),js=null))),Eg(c,v),Zo(v),null;case 5:L1(v);var W=sc(qd.current);if(x=v.type,c!==null&&v.stateNode!=null)S9(c,v,x,N,W),c.ref!==v.ref&&(v.flags|=512,v.flags|=2097152);else{if(!N){if(v.stateNode===null)throw Error(n(166));return Zo(v),null}if(c=sc(fl.current),us(v)){N=v.stateNode,x=v.type;var J=v.memoizedProps;switch(N[bo]=v,N[Of]=J,c=(1&v.mode)!=0,x){case"dialog":li("cancel",N),li("close",N);break;case"iframe":case"object":case"embed":li("load",N);break;case"video":case"audio":for(W=0;W<\/script>",c=c.removeChild(c.firstChild)):typeof N.is=="string"?c=ce.createElement(x,{is:N.is}):(c=ce.createElement(x),x==="select"&&(ce=c,N.multiple?ce.multiple=!0:N.size&&(ce.size=N.size))):c=ce.createElementNS(c,x),c[bo]=v,c[Of]=N,W1(c,v,!1,!1),v.stateNode=c;e:{switch(ce=Jt(x,N),x){case"dialog":li("cancel",c),li("close",c),W=N;break;case"iframe":case"object":case"embed":li("load",c),W=N;break;case"video":case"audio":for(W=0;Wj0&&(v.flags|=128,N=!0,V1(J,!1),v.lanes=4194304)}else{if(!N)if((c=O1(ce))!==null){if(v.flags|=128,N=!0,(x=c.updateQueue)!==null&&(v.updateQueue=x,v.flags|=4),V1(J,!0),J.tail===null&&J.tailMode==="hidden"&&!ce.alternate&&!wi)return Zo(v),null}else 2*dr()-J.renderingStartTime>j0&&x!==1073741824&&(v.flags|=128,N=!0,V1(J,!1),v.lanes=4194304);J.isBackwards?(ce.sibling=v.child,v.child=ce):((x=J.last)!==null?x.sibling=ce:v.child=ce,J.last=ce)}return J.tail!==null?(v=J.tail,J.rendering=v,J.tail=v.sibling,J.renderingStartTime=dr(),v.sibling=null,x=Ri.current,ci(Ri,N?1&x|2:1&x),v):(Zo(v),null);case 22:case 23:return Ig(),N=v.memoizedState!==null,c!==null&&c.memoizedState!==null!==N&&(v.flags|=8192),N&&1&v.mode?1073741824&ds&&(Zo(v),6&v.subtreeFlags&&(v.flags|=8192)):Zo(v),null;case 24:case 25:return null}throw Error(n(156,v.tag))}function BM(c,v){switch(ig(v),v.tag){case 1:return ns(v.type)&&so(),65536&(c=v.flags)?(v.flags=-65537&c|128,v):null;case 3:return uc(),bi(ma),bi(To),hg(),65536&(c=v.flags)&&!(128&c)?(v.flags=-65537&c|128,v):null;case 5:return L1(v),null;case 13:if(bi(Ri),(c=v.memoizedState)!==null&&c.dehydrated!==null){if(v.alternate===null)throw Error(n(340));_0()}return 65536&(c=v.flags)?(v.flags=-65537&c|128,v):null;case 19:return bi(Ri),null;case 4:return uc(),null;case 10:return Us(v.type._context),null;case 22:case 23:return Ig(),null;default:return null}}W1=function(c,v){for(var x=v.child;x!==null;){if(x.tag===5||x.tag===6)c.appendChild(x.stateNode);else if(x.tag!==4&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===v)break;for(;x.sibling===null;){if(x.return===null||x.return===v)return;x=x.return}x.sibling.return=x.return,x=x.sibling}},Eg=function(){},S9=function(c,v,x,N){var W=c.memoizedProps;if(W!==N){c=v.stateNode,sc(fl.current);var J,ce=null;switch(x){case"input":W=De(c,W),N=De(c,N),ce=[];break;case"select":W=L({},W,{value:void 0}),N=L({},N,{value:void 0}),ce=[];break;case"textarea":W=Be(c,W),N=Be(c,N),ce=[];break;default:typeof W.onClick!="function"&&typeof N.onClick=="function"&&(c.onclick=za)}for(Ze in At(x,N),x=null,W)if(!N.hasOwnProperty(Ze)&&W.hasOwnProperty(Ze)&&W[Ze]!=null)if(Ze==="style"){var Pe=W[Ze];for(J in Pe)Pe.hasOwnProperty(J)&&(x||(x={}),x[J]="")}else Ze!=="dangerouslySetInnerHTML"&&Ze!=="children"&&Ze!=="suppressContentEditableWarning"&&Ze!=="suppressHydrationWarning"&&Ze!=="autoFocus"&&(a.hasOwnProperty(Ze)?ce||(ce=[]):(ce=ce||[]).push(Ze,null));for(Ze in N){var Ne=N[Ze];if(Pe=W!=null?W[Ze]:void 0,N.hasOwnProperty(Ze)&&Ne!==Pe&&(Ne!=null||Pe!=null))if(Ze==="style")if(Pe){for(J in Pe)!Pe.hasOwnProperty(J)||Ne&&Ne.hasOwnProperty(J)||(x||(x={}),x[J]="");for(J in Ne)Ne.hasOwnProperty(J)&&Pe[J]!==Ne[J]&&(x||(x={}),x[J]=Ne[J])}else x||(ce||(ce=[]),ce.push(Ze,x)),x=Ne;else Ze==="dangerouslySetInnerHTML"?(Ne=Ne?Ne.__html:void 0,Pe=Pe?Pe.__html:void 0,Ne!=null&&Pe!==Ne&&(ce=ce||[]).push(Ze,Ne)):Ze==="children"?typeof Ne!="string"&&typeof Ne!="number"||(ce=ce||[]).push(Ze,""+Ne):Ze!=="suppressContentEditableWarning"&&Ze!=="suppressHydrationWarning"&&(a.hasOwnProperty(Ze)?(Ne!=null&&Ze==="onScroll"&&li("scroll",c),ce||Pe===Ne||(ce=[])):(ce=ce||[]).push(Ze,Ne))}x&&(ce=ce||[]).push("style",x);var Ze=ce;(v.updateQueue=Ze)&&(v.flags|=4)}},kg=function(c,v,x,N){x!==N&&(v.flags|=4)};var Cg=!1,Qo=!1,M9=typeof WeakSet=="function"?WeakSet:Set,mn=null;function hl(c,v){var x=c.ref;if(x!==null)if(typeof x=="function")try{x(null)}catch(N){Ni(c,v,N)}else x.current=null}function C9(c,v,x){try{x()}catch(N){Ni(c,v,N)}}var Fb=!1;function D0(c,v,x){var N=v.updateQueue;if((N=N!==null?N.lastEffect:null)!==null){var W=N=N.next;do{if((W.tag&c)===c){var J=W.destroy;W.destroy=void 0,J!==void 0&&C9(v,x,J)}W=W.next}while(W!==N)}}function Y1(c,v){if((v=(v=v.updateQueue)!==null?v.lastEffect:null)!==null){var x=v=v.next;do{if((x.tag&c)===c){var N=x.create;x.destroy=N()}x=x.next}while(x!==v)}}function xg(c){var v=c.ref;if(v!==null){var x=c.stateNode;c.tag,c=x,typeof v=="function"?v(c):v.current=c}}function jb(c){var v=c.alternate;v!==null&&(c.alternate=null,jb(v)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(v=c.stateNode)!==null&&(delete v[bo],delete v[Of],delete v[E1],delete v[k1],delete v[v0]),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function Ub(c){return c.tag===5||c.tag===3||c.tag===4}function Kb(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||Ub(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(2&c.flags||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(2&c.flags))return c.stateNode}}function jf(c,v,x){var N=c.tag;if(N===5||N===6)c=c.stateNode,v?x.nodeType===8?x.parentNode.insertBefore(c,v):x.insertBefore(c,v):(x.nodeType===8?(v=x.parentNode).insertBefore(c,x):(v=x).appendChild(c),(x=x._reactRootContainer)!=null||v.onclick!==null||(v.onclick=za));else if(N!==4&&(c=c.child)!==null)for(jf(c,v,x),c=c.sibling;c!==null;)jf(c,v,x),c=c.sibling}function Hb(c,v,x){var N=c.tag;if(N===5||N===6)c=c.stateNode,v?x.insertBefore(c,v):x.appendChild(c);else if(N!==4&&(c=c.child)!==null)for(Hb(c,v,x),c=c.sibling;c!==null;)Hb(c,v,x),c=c.sibling}var va=null,pl=!1;function Uf(c,v,x){for(x=x.child;x!==null;)$b(c,v,x),x=x.sibling}function $b(c,v,x){if(kr&&typeof kr.onCommitFiberUnmount=="function")try{kr.onCommitFiberUnmount(ii,x)}catch{}switch(x.tag){case 5:Qo||hl(x,v);case 6:var N=va,W=pl;va=null,Uf(c,v,x),pl=W,(va=N)!==null&&(pl?(c=va,x=x.stateNode,c.nodeType===8?c.parentNode.removeChild(x):c.removeChild(x)):va.removeChild(x.stateNode));break;case 18:va!==null&&(pl?(c=va,x=x.stateNode,c.nodeType===8?tg(c.parentNode,x):c.nodeType===1&&tg(c,x),a0(c)):tg(va,x.stateNode));break;case 4:N=va,W=pl,va=x.stateNode.containerInfo,pl=!0,Uf(c,v,x),va=N,pl=W;break;case 0:case 11:case 14:case 15:if(!Qo&&(N=x.updateQueue)!==null&&(N=N.lastEffect)!==null){W=N=N.next;do{var J=W,ce=J.destroy;J=J.tag,ce!==void 0&&(2&J||4&J)&&C9(x,v,ce),W=W.next}while(W!==N)}Uf(c,v,x);break;case 1:if(!Qo&&(hl(x,v),typeof(N=x.stateNode).componentWillUnmount=="function"))try{N.props=x.memoizedProps,N.state=x.memoizedState,N.componentWillUnmount()}catch(Pe){Ni(x,v,Pe)}Uf(c,v,x);break;case 21:Uf(c,v,x);break;case 22:1&x.mode?(Qo=(N=Qo)||x.memoizedState!==null,Uf(c,v,x),Qo=N):Uf(c,v,x);break;default:Uf(c,v,x)}}function qb(c){var v=c.updateQueue;if(v!==null){c.updateQueue=null;var x=c.stateNode;x===null&&(x=c.stateNode=new M9),v.forEach(function(N){var W=P9.bind(null,c,N);x.has(N)||(x.add(N),N.then(W,W))})}}function fs(c,v){var x=v.deletions;if(x!==null)for(var N=0;NW&&(W=ce),N&=~J}if(N=W,10<(N=(120>(N=dr()-N)?120:480>N?480:1080>N?1080:1920>N?1920:3e3>N?3e3:4320>N?4320:1960*zM(N/1960))-N)){c.timeoutHandle=wb(vl.bind(null,c,ya,Hf),N);break}vl(c,ya,Hf);break;default:throw Error(n(329))}}}return ba(c,dr()),c.callbackNode===x?Xb.bind(null,c):null}function Pg(c,v){var x=F0;return c.current.memoizedState.isDehydrated&&(nh(c,v).flags|=256),(c=rh(c,v))!==2&&(v=ya,ya=x,v!==null&&gl(v)),c}function gl(c){ya===null?ya=c:ya.push.apply(ya,c)}function $f(c,v){for(v&=~Zb,v&=~Rg,c.suspendedLanes|=v,c.pingedLanes&=~v,c=c.expirationTimes;0c?16:c,bc===null)var N=!1;else{if(c=bc,bc=null,Jd=0,(6&jr)!=0)throw Error(n(331));var W=jr;for(jr|=4,mn=c.current;mn!==null;){var J=mn,ce=J.child;if(16&mn.flags){var Pe=J.deletions;if(Pe!==null){for(var Ne=0;Nedr()-Qb?nh(c,0):Zb|=x),ba(c,v)}function em(c,v){v===0&&(1&c.mode?(v=ca,!(130023424&(ca<<=1))&&(ca=4194304)):v=1);var x=Xo();(c=vu(c,v))!==null&&(pt(c,v,x),ba(c,x))}function tm(c){var v=c.memoizedState,x=0;v!==null&&(x=v.retryLane),em(c,x)}function P9(c,v){var x=0;switch(c.tag){case 13:var N=c.stateNode,W=c.memoizedState;W!==null&&(x=W.retryLane);break;case 19:N=c.stateNode;break;default:throw Error(n(314))}N!==null&&N.delete(v),em(c,x)}function nm(c,v){return ji(c,v)}function I9(c,v,x,N){this.tag=c,this.key=x,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=v,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 hs(c,v,x,N){return new I9(c,v,x,N)}function Jo(c){return!(!(c=c.prototype)||!c.isReactComponent)}function qs(c,v){var x=c.alternate;return x===null?((x=hs(c.tag,v,c.key,c.mode)).elementType=c.elementType,x.type=c.type,x.stateNode=c.stateNode,x.alternate=c,c.alternate=x):(x.pendingProps=v,x.type=c.type,x.flags=0,x.subtreeFlags=0,x.deletions=null),x.flags=14680064&c.flags,x.childLanes=c.childLanes,x.lanes=c.lanes,x.child=c.child,x.memoizedProps=c.memoizedProps,x.memoizedState=c.memoizedState,x.updateQueue=c.updateQueue,v=c.dependencies,x.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},x.sibling=c.sibling,x.index=c.index,x.ref=c.ref,x}function oh(c,v,x,N,W,J){var ce=2;if(N=c,typeof c=="function")Jo(c)&&(ce=1);else if(typeof c=="string")ce=5;else e:switch(c){case we:return Ua(x.children,W,J,v);case Ce:ce=8,W|=8;break;case ze:return(c=hs(12,x,v,2|W)).elementType=ze,c.lanes=J,c;case P:return(c=hs(13,x,v,W)).elementType=P,c.lanes=J,c;case d:return(c=hs(19,x,v,W)).elementType=d,c.lanes=J,c;case p:return rm(x,W,J,v);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case Fe:ce=10;break e;case $e:ce=9;break e;case S:ce=11;break e;case g:ce=14;break e;case m:ce=16,N=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return(v=hs(ce,x,v,W)).elementType=c,v.type=N,v.lanes=J,v}function Ua(c,v,x,N){return(c=hs(7,c,N,v)).lanes=x,c}function rm(c,v,x,N){return(c=hs(22,c,N,v)).elementType=p,c.lanes=x,c.stateNode={isHidden:!1},c}function Ec(c,v,x){return(c=hs(6,c,null,v)).lanes=x,c}function kc(c,v,x){return(v=hs(4,c.children!==null?c.children:[],c.key,v)).lanes=x,v.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},v}function Og(c,v,x,N,W){this.tag=v,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ve(0),this.expirationTimes=Ve(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ve(0),this.identifierPrefix=N,this.onRecoverableError=W,this.mutableSourceEagerHydrationData=null}function n6(c,v,x,N,W,J,ce,Pe,Ne){return c=new Og(c,v,x,Pe,Ne),v===1?(v=1,J===!0&&(v|=8)):v=0,J=hs(3,null,null,v),c.current=J,J.stateNode=c,J.memoizedState={element:N,isDehydrated:x,cache:null,transitions:null,pendingSuspenseBoundaries:null},T1(J),c}function L9(c){if(!c)return Nf;e:{if(Yt(c=c._reactInternals)!==c||c.tag!==1)throw Error(n(170));var v=c;do{switch(v.tag){case 3:v=v.stateNode.context;break e;case 1:if(ns(v.type)){v=v.stateNode.__reactInternalMemoizedMergedChildContext;break e}}v=v.return}while(v!==null);throw Error(n(171))}if(c.tag===1){var x=c.type;if(ns(x))return x1(c,x,v)}return v}function im(c,v,x,N,W,J,ce,Pe,Ne){return(c=n6(x,N,!0,c,0,J,0,Pe,Ne)).context=L9(null),x=c.current,(J=yu(N=Xo(),W=wc(x))).callback=v??null,ll(x,J,W),c.current.lanes=W,pt(c,W,N),ba(c,N),c}function ah(c,v,x,N){var W=v.current,J=Xo(),ce=wc(W);return x=L9(x),v.context===null?v.context=x:v.pendingContext=x,(v=yu(J,ce)).payload={element:c},(N=N===void 0?null:N)!==null&&(v.callback=N),(c=ll(W,v,ce))!==null&&($s(c,W,ce,J),S0(c,W,ce)),ce}function om(c){return(c=c.current).child?(c.child.tag,c.child.stateNode):null}function O9(c,v){if((c=c.memoizedState)!==null&&c.dehydrated!==null){var x=c.retryLane;c.retryLane=x!==0&&x1?u-1:0),A=1;A1?u-1:0),A=1;A"u"||window.document===void 0||window.document.createElement===void 0),ve=Object.prototype.hasOwnProperty;function Se(s){return typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object"}function Ae(s){try{return qe(s),!1}catch{return!0}}function qe(s){return""+s}function Xe(s,u){if(Ae(s))return i("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before before using it here.",u,Se(s)),qe(s)}function Be(s){if(Ae(s))return i("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before before using it here.",Se(s)),qe(s)}var gt=0,bt=3,ot=4,Wt=5,vt=6,at=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Rt=at+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Dt=new RegExp("^["+at+"]["+Rt+"]*$"),Lt={},rn={};function Vt(s){return!!ve.call(rn,s)||!ve.call(Lt,s)&&(Dt.test(s)?(rn[s]=!0,!0):(Lt[s]=!0,i("Invalid attribute name: `%s`",s),!1))}function Pt(s,u,w){return u!==null?u.type===gt:!w&&s.length>2&&(s[0]==="o"||s[0]==="O")&&(s[1]==="n"||s[1]==="N")}function en(s,u,w,A){if(w!==null&&w.type===gt)return!1;switch(typeof u){case"function":case"symbol":return!0;case"boolean":if(A)return!1;if(w!==null)return!w.acceptsBooleans;var I=s.toLowerCase().slice(0,5);return I!=="data-"&&I!=="aria-";default:return!1}}function on(s,u,w,A){if(u==null||en(s,u,w,A))return!0;if(A)return!1;if(w!==null)switch(w.type){case bt:return!u;case ot:return u===!1;case Wt:return isNaN(u);case vt:return isNaN(u)||u<1}return!1}function At(s){return tn.hasOwnProperty(s)?tn[s]:null}function Jt(s,u,w,A,I,j,V){this.acceptsBooleans=u===2||u===bt||u===ot,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=w,this.propertyName=s,this.type=u,this.sanitizeURL=j,this.removeEmptyString=V}var tn={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(function(s){tn[s]=new Jt(s,gt,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var u=s[0],w=s[1];tn[u]=new Jt(u,1,!1,w,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){tn[s]=new Jt(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){tn[s]=new Jt(s,2,!1,s,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(function(s){tn[s]=new Jt(s,bt,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){tn[s]=new Jt(s,bt,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){tn[s]=new Jt(s,ot,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){tn[s]=new Jt(s,vt,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){tn[s]=new Jt(s,Wt,!1,s.toLowerCase(),null,!1,!1)});var Bt=/[\-\:]([a-z])/g,Rn=function(s){return s[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(function(s){var u=s.replace(Bt,Rn);tn[u]=new Jt(u,1,!1,s,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(function(s){var u=s.replace(Bt,Rn);tn[u]=new Jt(u,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var u=s.replace(Bt,Rn);tn[u]=new Jt(u,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){tn[s]=new Jt(s,1,!1,s.toLowerCase(),null,!1,!1)}),tn.xlinkHref=new Jt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){tn[s]=new Jt(s,1,!1,s.toLowerCase(),null,!0,!0)});var wn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i,Ut=!1;function Fn(s){!Ut&&wn.test(s)&&(Ut=!0,i("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.",JSON.stringify(s)))}function kn(s,u,w,A){if(A.mustUseProperty)return s[A.propertyName];Xe(w,u),A.sanitizeURL&&Fn(""+w);var I=A.attributeName,j=null;if(A.type===ot){if(s.hasAttribute(I)){var V=s.getAttribute(I);return V===""||(on(u,w,A,!1)?V:V===""+w?w:V)}}else if(s.hasAttribute(I)){if(on(u,w,A,!1))return s.getAttribute(I);if(A.type===bt)return w;j=s.getAttribute(I)}return on(u,w,A,!1)?j===null?w:j:j===""+w?w:j}function Nt(s,u,w,A){if(Vt(u)){if(!s.hasAttribute(u))return w===void 0?void 0:null;var I=s.getAttribute(u);return Xe(w,u),I===""+w?w:I}}function Mn(s,u,w,A){var I=At(u);if(!Pt(u,I,A))if(on(u,w,I,A)&&(w=null),A||I===null){if(Vt(u)){var j=u;w===null?s.removeAttribute(j):(Xe(w,u),s.setAttribute(j,""+w))}}else if(I.mustUseProperty){var V=I.propertyName;if(w===null){var X=I.type;s[V]=X!==bt&&""}else s[V]=w}else{var re=I.attributeName,le=I.attributeNamespace;if(w===null)s.removeAttribute(re);else{var be,Le=I.type;Le===bt||Le===ot&&w===!0?be="":(Xe(w,re),be=""+w,I.sanitizeURL&&Fn(be.toString())),le?s.setAttributeNS(le,re,be):s.setAttribute(re,be)}}}var yn=Symbol.for("react.element"),Ft=Symbol.for("react.portal"),An=Symbol.for("react.fragment"),bn=Symbol.for("react.strict_mode"),Qt=Symbol.for("react.profiler"),Ln=Symbol.for("react.provider"),Bn=Symbol.for("react.context"),Kt=Symbol.for("react.forward_ref"),Pn=Symbol.for("react.suspense"),In=Symbol.for("react.suspense_list"),qt=Symbol.for("react.memo"),pn=Symbol.for("react.lazy"),Hn=Symbol.for("react.offscreen"),Yt=Symbol.iterator,$n="@@iterator";function Cn(s){if(s===null||typeof s!="object")return null;var u=Yt&&s[Yt]||s[$n];return typeof u=="function"?u:null}var On,Fi,ji,xi,vi,Vi,dr,jn=Object.assign,yi=0;function Ui(){}Ui.__reactDisabledLog=!0;var Ai,Ki=n.ReactCurrentDispatcher;function ri(s,u,w){if(Ai===void 0)try{throw Error()}catch(I){var A=I.stack.trim().match(/\n( *(at )?)/);Ai=A&&A[1]||""}return` +`+Ai+s}var ii,kr=!1,qr=typeof WeakMap=="function"?WeakMap:Map;function Ti(s,u){if(!s||kr)return"";var w,A=ii.get(s);if(A!==void 0)return A;kr=!0;var I,j=Error.prepareStackTrace;Error.prepareStackTrace=void 0,I=Ki.current,Ki.current=null,function(){if(yi===0){On=console.log,Fi=console.info,ji=console.warn,xi=console.error,vi=console.group,Vi=console.groupCollapsed,dr=console.groupEnd;var Me={configurable:!0,enumerable:!0,value:Ui,writable:!0};Object.defineProperties(console,{info:Me,log:Me,warn:Me,error:Me,group:Me,groupCollapsed:Me,groupEnd:Me})}yi++}();try{if(u){var V=function(){throw Error()};if(Object.defineProperty(V.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(V,[])}catch(Me){w=Me}Reflect.construct(s,[],V)}else{try{V.call()}catch(Me){w=Me}s.call(V.prototype)}}else{try{throw Error()}catch(Me){w=Me}s()}}catch(Me){if(Me&&w&&typeof Me.stack=="string"){for(var X=Me.stack.split(` +`),re=w.stack.split(` +`),le=X.length-1,be=re.length-1;le>=1&&be>=0&&X[le]!==re[be];)be--;for(;le>=1&&be>=0;le--,be--)if(X[le]!==re[be]){if(le!==1||be!==1)do if(le--,--be<0||X[le]!==re[be]){var Le=` +`+X[le].replace(" at new "," at ");return s.displayName&&Le.includes("")&&(Le=Le.replace("",s.displayName)),typeof s=="function"&&ii.set(s,Le),Le}while(le>=1&&be>=0);break}}}finally{kr=!1,Ki.current=I,function(){if(--yi==0){var Me={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:jn({},Me,{value:On}),info:jn({},Me,{value:Fi}),warn:jn({},Me,{value:ji}),error:jn({},Me,{value:xi}),group:jn({},Me,{value:vi}),groupCollapsed:jn({},Me,{value:Vi}),groupEnd:jn({},Me,{value:dr})})}yi<0&&i("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=j}var Oe=s?s.displayName||s.name:"",Te=Oe?ri(Oe):"";return typeof s=="function"&&ii.set(s,Te),Te}function Oi(s,u,w){return Ti(s,!1)}function xo(s,u,w){if(s==null)return"";if(typeof s=="function")return Ti(s,!(!(A=s.prototype)||!A.isReactComponent));var A;if(typeof s=="string")return ri(s);switch(s){case Pn:return ri("Suspense");case In:return ri("SuspenseList")}if(typeof s=="object")switch(s.$$typeof){case Kt:return Oi(s.render);case qt:return xo(s.type,u,w);case pn:var I=s,j=I._payload,V=I._init;try{return xo(V(j),u,w)}catch{}}return""}function ca(s){switch(s._debugOwner&&s._debugOwner.type,s._debugSource,s.tag){case O:return ri(s.type);case Fe:return ri("Lazy");case we:return ri("Suspense");case P:return ri("SuspenseList");case y:case E:case ze:return Oi(s.type);case oe:return Oi(s.type.render);case k:return Ti(s.type,!0);default:return""}}function Mf(s){try{var u="",w=s;do u+=ca(w),w=w.return;while(w);return u}catch(A){return` +Error generating stack: `+A.message+` +`+A.stack}}function xd(s){return s.displayName||"Context"}function oi(s){if(s==null)return null;if(typeof s.tag=="number"&&i("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case An:return"Fragment";case Ft:return"Portal";case Qt:return"Profiler";case bn:return"StrictMode";case Pn:return"Suspense";case In:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case Bn:return xd(s)+".Consumer";case Ln:return xd(s._context)+".Provider";case Kt:return function(j,V,X){var re=j.displayName;if(re)return re;var le=V.displayName||V.name||"";return le!==""?X+"("+le+")":X}(s,s.render,"ForwardRef");case qt:var u=s.displayName||null;return u!==null?u:oi(s.type)||"Memo";case pn:var w=s,A=w._payload,I=w._init;try{return oi(I(A))}catch{return null}}return null}function i0(s){return s.displayName||"Context"}function de(s){var u,w,A,I,j=s.tag,V=s.type;switch(j){case p:return"Cache";case te:return i0(V)+".Consumer";case se:return i0(V._context)+".Provider";case S:return"DehydratedFragment";case oe:return u=V,A="ForwardRef",I=(w=V.render).displayName||w.name||"",u.displayName||(I!==""?A+"("+I+")":A);case H:return"Fragment";case O:return V;case C:return"Portal";case M:return"Root";case z:return"Text";case Fe:return oi(V);case ee:return V===bn?"StrictMode":"Mode";case g:return"Offscreen";case Ee:return"Profiler";case d:return"Scope";case we:return"Suspense";case P:return"SuspenseList";case f:return"TracingMarker";case k:case y:case $e:case E:case Ce:case ze:if(typeof V=="function")return V.displayName||V.name||null;if(typeof V=="string")return V}return null}ii=new qr;var Ve=n.ReactDebugCurrentFrame,pt=null,Ct=!1;function xt(){if(pt===null)return null;var s=pt._debugOwner;return s!=null?de(s):null}function Nn(){return pt===null?"":Mf(pt)}function un(){Ve.getCurrentStack=null,pt=null,Ct=!1}function xn(s){Ve.getCurrentStack=s===null?null:Nn,pt=s,Ct=!1}function or(s){Ct=s}function Yn(s){return""+s}function Dn(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return Be(s),s;default:return""}}var qn={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0};function Fr(s,u){qn[u.type]||u.onChange||u.onInput||u.readOnly||u.disabled||u.value==null||i("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`."),u.onChange||u.readOnly||u.disabled||u.checked==null||i("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")}function Gr(s){var u=s.type,w=s.nodeName;return w&&w.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function Qn(s){return s._valueTracker}function Hi(s){Qn(s)||(s._valueTracker=function(u){var w=Gr(u)?"checked":"value",A=Object.getOwnPropertyDescriptor(u.constructor.prototype,w);Be(u[w]);var I=""+u[w];if(!u.hasOwnProperty(w)&&A!==void 0&&typeof A.get=="function"&&typeof A.set=="function"){var j=A.get,V=A.set;Object.defineProperty(u,w,{configurable:!0,get:function(){return j.call(this)},set:function(re){Be(re),I=""+re,V.call(this,re)}}),Object.defineProperty(u,w,{enumerable:A.enumerable});var X={getValue:function(){return I},setValue:function(re){Be(re),I=""+re},stopTracking:function(){(function(re){re._valueTracker=null})(u),delete u[w]}};return X}}(s))}function Ao(s){if(!s)return!1;var u=Qn(s);if(!u)return!0;var w=u.getValue(),A=function(I){var j="";return I?j=Gr(I)?I.checked?"true":"false":I.value:j}(s);return A!==w&&(u.setValue(A),!0)}function Ns(s){if((s=s||(typeof document<"u"?document:void 0))===void 0)return null;try{return s.activeElement||s.body}catch{return s.body}}var Ds=!1,d1=!1,h1=!1,Cf=!1;function o0(s){return s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}function xf(s,u){var w=s,A=u.checked;return jn({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:A??w._wrapperState.initialChecked})}function Qy(s,u){Fr(0,u),u.checked===void 0||u.defaultChecked===void 0||d1||(i("%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",xt()||"A component",u.type),d1=!0),u.value===void 0||u.defaultValue===void 0||Ds||(i("%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components",xt()||"A component",u.type),Ds=!0);var w=s,A=u.defaultValue==null?"":u.defaultValue;w._wrapperState={initialChecked:u.checked!=null?u.checked:u.defaultChecked,initialValue:Dn(u.value!=null?u.value:A),controlled:o0(u)}}function W7(s,u){var w=s,A=u.checked;A!=null&&Mn(w,"checked",A,!1)}function Ad(s,u){var w=s,A=o0(u);w._wrapperState.controlled||!A||Cf||(i("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),Cf=!0),!w._wrapperState.controlled||A||h1||(i("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components"),h1=!0),W7(s,u);var I=Dn(u.value),j=u.type;if(I!=null)j==="number"?(I===0&&w.value===""||w.value!=I)&&(w.value=Yn(I)):w.value!==Yn(I)&&(w.value=Yn(I));else if(j==="submit"||j==="reset")return void w.removeAttribute("value");u.hasOwnProperty("value")?u0(w,u.type,I):u.hasOwnProperty("defaultValue")&&u0(w,u.type,Dn(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(w.defaultChecked=!!u.defaultChecked)}function a0(s,u,w){var A=s;if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var I=u.type;if(!(I!=="submit"&&I!=="reset"||u.value!==void 0&&u.value!==null))return;var j=Yn(A._wrapperState.initialValue);w||j!==A.value&&(A.value=j),A.defaultValue=j}var V=A.name;V!==""&&(A.name=""),A.defaultChecked=!A.defaultChecked,A.defaultChecked=!!A._wrapperState.initialChecked,V!==""&&(A.name=V)}function s0(s,u){var w=s;Ad(w,u),function(A,I){var j=I.name;if(I.type==="radio"&&j!=null){for(var V=A;V.parentNode;)V=V.parentNode;Xe(j,"name");for(var X=V.querySelectorAll("input[name="+JSON.stringify(""+j)+'][type="radio"]'),re=0;re.")))}):u.dangerouslySetInnerHTML!=null&&(B2||(B2=!0,i("Pass a `value` prop if you set dangerouslyInnerHTML so React knows which value should be selected.")))),u.selected==null||V7||(i("Use the `defaultValue` or `value` props on must be a scalar value if `multiple` is false.%s",j,z2())}}})(u),w._wrapperState={wasMultiple:!!u.multiple},u.value===void 0||u.defaultValue===void 0||m1||(i("Select elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled select element and remove one of these props. More info: https://reactjs.org/link/controlled-components"),m1=!0)}var Xy=!1;function fa(s,u){var w=s;if(u.dangerouslySetInnerHTML!=null)throw new Error("`dangerouslySetInnerHTML` does not make sense on