@dcl/auth-site 2.0.3-13140883255.commit-dc78e44 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{p as Jr,a as Q6,c as _r,b as qu,B as at,h as In,d as ew,r as tw,e as rw,m as iw,u as nw,i as Uu,f as F1,j as L1,k as sw,g as pt,l as Ii,n as Di,o as Bu,q as v0,_ as aw}from"./index-76c346f2.js";import{t as ow}from"./tslib.es6-c2094241.js";var b0=globalThis&&globalThis.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,o;i<s;i++)(o||!(i in e))&&(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return r.concat(o||Array.prototype.slice.call(e))},cw=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),fw=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=Jr.platform}return r}(),hw=function(){function r(e,t,i,s){this.name=e,this.version=t,this.os=i,this.bot=s,this.type="bot-device"}return r}(),uw=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),dw=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),lw=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,pw=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,m0=3,gw=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",lw]],y0=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function vw(r){return r?w0(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new dw:typeof navigator<"u"?w0(navigator.userAgent):yw()}function bw(r){return r!==""&&gw.reduce(function(e,t){var i=t[0],s=t[1];if(e)return e;var o=s.exec(r);return!!o&&[i,o]},!1)}function w0(r){var e=bw(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new uw;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<m0&&(s=b0(b0([],s,!0),ww(m0-s.length),!0)):s=[];var o=s.join("."),f=mw(r),h=pw.exec(r);return h&&h[1]?new hw(t,o,f,h[1]):new cw(t,o,f)}function mw(r){for(var e=0,t=y0.length;e<t;e++){var i=y0[e],s=i[0],o=i[1],f=o.exec(r);if(f)return s}return null}function yw(){var r=typeof Jr<"u"&&Jr.version;return r?new fw(Jr.version.slice(1)):null}function ww(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var me={};const co=Q6(ow);var zh={},za={},_0;function _w(){if(_0)return za;_0=1,Object.defineProperty(za,"__esModule",{value:!0}),za.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return za.delay=r,za}var ys={},Kh={},ws={},E0;function Ew(){return E0||(E0=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.ONE_THOUSAND=ws.ONE_HUNDRED=void 0,ws.ONE_HUNDRED=100,ws.ONE_THOUSAND=1e3),ws}var Hh={},x0;function xw(){return x0||(x0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Hh)),Hh}var S0;function q1(){return S0||(S0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=co;e.__exportStar(Ew(),r),e.__exportStar(xw(),r)}(Kh)),Kh}var I0;function Sw(){if(I0)return ys;I0=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.fromMiliseconds=ys.toMiliseconds=void 0;const r=q1();function e(i){return i*r.ONE_THOUSAND}ys.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return ys.fromMiliseconds=t,ys}var A0;function Iw(){return A0||(A0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=co;e.__exportStar(_w(),r),e.__exportStar(Sw(),r)}(zh)),zh}var ta={},P0;function Aw(){if(P0)return ta;P0=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const s=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:s})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return ta.Watch=r,ta.default=r,ta}var kh={},Ka={},D0;function Pw(){if(D0)return Ka;D0=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.IWatch=void 0;class r{}return Ka.IWatch=r,Ka}var M0;function Dw(){return M0||(M0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),co.__exportStar(Pw(),r)}(kh)),kh}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=co;e.__exportStar(Iw(),r),e.__exportStar(Aw(),r),e.__exportStar(Dw(),r),e.__exportStar(q1(),r)})(me);var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getLocalStorage=Bt.getLocalStorageOrThrow=Bt.getCrypto=Bt.getCryptoOrThrow=U1=Bt.getLocation=Bt.getLocationOrThrow=zu=Bt.getNavigator=Bt.getNavigatorOrThrow=fo=Bt.getDocument=Bt.getDocumentOrThrow=Bt.getFromWindowOrThrow=Bt.getFromWindow=void 0;function Rs(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Bt.getFromWindow=Rs;function pa(r){const e=Rs(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Bt.getFromWindowOrThrow=pa;function Mw(){return pa("document")}Bt.getDocumentOrThrow=Mw;function Ow(){return Rs("document")}var fo=Bt.getDocument=Ow;function Rw(){return pa("navigator")}Bt.getNavigatorOrThrow=Rw;function Cw(){return Rs("navigator")}var zu=Bt.getNavigator=Cw;function Nw(){return pa("location")}Bt.getLocationOrThrow=Nw;function Tw(){return Rs("location")}var U1=Bt.getLocation=Tw;function $w(){return pa("crypto")}Bt.getCryptoOrThrow=$w;function Fw(){return Rs("crypto")}Bt.getCrypto=Fw;function Lw(){return pa("localStorage")}Bt.getLocalStorageOrThrow=Lw;function qw(){return Rs("localStorage")}Bt.getLocalStorage=qw;var Ku={};Object.defineProperty(Ku,"__esModule",{value:!0});var B1=Ku.getWindowMetadata=void 0;const O0=Bt;function Uw(){let r,e;try{r=O0.getDocumentOrThrow(),e=O0.getLocationOrThrow()}catch{return null}function t(){const y=r.getElementsByTagName("link"),P=[];for(let S=0;S<y.length;S++){const A=y[S],F=A.getAttribute("rel");if(F&&F.toLowerCase().indexOf("icon")>-1){const V=A.getAttribute("href");if(V)if(V.toLowerCase().indexOf("https:")===-1&&V.toLowerCase().indexOf("http:")===-1&&V.indexOf("//")!==0){let J=e.protocol+"//"+e.host;if(V.indexOf("/")===0)J+=V;else{const B=e.pathname.split("/");B.pop();const Y=B.join("/");J+=Y+"/"+V}P.push(J)}else if(V.indexOf("//")===0){const J=e.protocol+V;P.push(J)}else P.push(V)}}return P}function i(...y){const P=r.getElementsByTagName("meta");for(let S=0;S<P.length;S++){const A=P[S],F=["itemprop","property","name"].map(V=>A.getAttribute(V)).filter(V=>V?y.includes(V):!1);if(F.length&&F){const V=A.getAttribute("content");if(V)return V}}return""}function s(){let y=i("name","og:site_name","og:title","twitter:title");return y||(y=r.title),y}function o(){return i("description","og:description","twitter:description","keywords")}const f=s(),h=o(),u=e.origin,d=t();return{description:h,url:u,icons:d,name:f}}B1=Ku.getWindowMetadata=Uw;var ro={},Bw=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),z1="%[a-f0-9]{2}",R0=new RegExp("("+z1+")|([^%]+?)","gi"),C0=new RegExp("("+z1+")+","gi");function bu(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],bu(t),bu(i))}function zw(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(R0)||[],t=1;t<e.length;t++)r=bu(e,t).join(""),e=r.match(R0)||[];return r}}function Kw(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=C0.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=zw(t[0]);i!==t[0]&&(e[t[0]]=i)}t=C0.exec(r)}e["%C2"]="�";for(var s=Object.keys(e),o=0;o<s.length;o++){var f=s[o];r=r.replace(new RegExp(f,"g"),e[f])}return r}var Hw=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return Kw(r)}},kw=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},jw=function(r,e){for(var t={},i=Object.keys(r),s=Array.isArray(e),o=0;o<i.length;o++){var f=i[o],h=r[f];(s?e.indexOf(f)!==-1:e(f,h,r))&&(t[f]=h)}return t};(function(r){const e=Bw,t=Hw,i=kw,s=jw,o=B=>B==null,f=Symbol("encodeFragmentIdentifier");function h(B){switch(B.arrayFormat){case"index":return Y=>(L,k)=>{const W=L.length;return k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,[g(Y,B),"[",W,"]"].join("")]:[...L,[g(Y,B),"[",g(W,B),"]=",g(k,B)].join("")]};case"bracket":return Y=>(L,k)=>k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,[g(Y,B),"[]"].join("")]:[...L,[g(Y,B),"[]=",g(k,B)].join("")];case"colon-list-separator":return Y=>(L,k)=>k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,[g(Y,B),":list="].join("")]:[...L,[g(Y,B),":list=",g(k,B)].join("")];case"comma":case"separator":case"bracket-separator":{const Y=B.arrayFormat==="bracket-separator"?"[]=":"=";return L=>(k,W)=>W===void 0||B.skipNull&&W===null||B.skipEmptyString&&W===""?k:(W=W===null?"":W,k.length===0?[[g(L,B),Y,g(W,B)].join("")]:[[k,g(W,B)].join(B.arrayFormatSeparator)])}default:return Y=>(L,k)=>k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,g(Y,B)]:[...L,[g(Y,B),"=",g(k,B)].join("")]}}function u(B){let Y;switch(B.arrayFormat){case"index":return(L,k,W)=>{if(Y=/\[(\d*)\]$/.exec(L),L=L.replace(/\[\d*\]$/,""),!Y){W[L]=k;return}W[L]===void 0&&(W[L]={}),W[L][Y[1]]=k};case"bracket":return(L,k,W)=>{if(Y=/(\[\])$/.exec(L),L=L.replace(/\[\]$/,""),!Y){W[L]=k;return}if(W[L]===void 0){W[L]=[k];return}W[L]=[].concat(W[L],k)};case"colon-list-separator":return(L,k,W)=>{if(Y=/(:list)$/.exec(L),L=L.replace(/:list$/,""),!Y){W[L]=k;return}if(W[L]===void 0){W[L]=[k];return}W[L]=[].concat(W[L],k)};case"comma":case"separator":return(L,k,W)=>{const m=typeof k=="string"&&k.includes(B.arrayFormatSeparator),N=typeof k=="string"&&!m&&y(k,B).includes(B.arrayFormatSeparator);k=N?y(k,B):k;const ne=m||N?k.split(B.arrayFormatSeparator).map(pe=>y(pe,B)):k===null?k:y(k,B);W[L]=ne};case"bracket-separator":return(L,k,W)=>{const m=/(\[\])$/.test(L);if(L=L.replace(/\[\]$/,""),!m){W[L]=k&&y(k,B);return}const N=k===null?[]:k.split(B.arrayFormatSeparator).map(ne=>y(ne,B));if(W[L]===void 0){W[L]=N;return}W[L]=[].concat(W[L],N)};default:return(L,k,W)=>{if(W[L]===void 0){W[L]=k;return}W[L]=[].concat(W[L],k)}}}function d(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(B,Y){return Y.encode?Y.strict?e(B):encodeURIComponent(B):B}function y(B,Y){return Y.decode?t(B):B}function P(B){return Array.isArray(B)?B.sort():typeof B=="object"?P(Object.keys(B)).sort((Y,L)=>Number(Y)-Number(L)).map(Y=>B[Y]):B}function S(B){const Y=B.indexOf("#");return Y!==-1&&(B=B.slice(0,Y)),B}function A(B){let Y="";const L=B.indexOf("#");return L!==-1&&(Y=B.slice(L)),Y}function F(B){B=S(B);const Y=B.indexOf("?");return Y===-1?"":B.slice(Y+1)}function V(B,Y){return Y.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):Y.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function J(B,Y){Y=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},Y),d(Y.arrayFormatSeparator);const L=u(Y),k=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return k;for(const W of B.split("&")){if(W==="")continue;let[m,N]=i(Y.decode?W.replace(/\+/g," "):W,"=");N=N===void 0?null:["comma","separator","bracket-separator"].includes(Y.arrayFormat)?N:y(N,Y),L(y(m,Y),N,k)}for(const W of Object.keys(k)){const m=k[W];if(typeof m=="object"&&m!==null)for(const N of Object.keys(m))m[N]=V(m[N],Y);else k[W]=V(m,Y)}return Y.sort===!1?k:(Y.sort===!0?Object.keys(k).sort():Object.keys(k).sort(Y.sort)).reduce((W,m)=>{const N=k[m];return N&&typeof N=="object"&&!Array.isArray(N)?W[m]=P(N):W[m]=N,W},Object.create(null))}r.extract=F,r.parse=J,r.stringify=(B,Y)=>{if(!B)return"";Y=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},Y),d(Y.arrayFormatSeparator);const L=N=>Y.skipNull&&o(B[N])||Y.skipEmptyString&&B[N]==="",k=h(Y),W={};for(const N of Object.keys(B))L(N)||(W[N]=B[N]);const m=Object.keys(W);return Y.sort!==!1&&m.sort(Y.sort),m.map(N=>{const ne=B[N];return ne===void 0?"":ne===null?g(N,Y):Array.isArray(ne)?ne.length===0&&Y.arrayFormat==="bracket-separator"?g(N,Y)+"[]":ne.reduce(k(N),[]).join("&"):g(N,Y)+"="+g(ne,Y)}).filter(N=>N.length>0).join("&")},r.parseUrl=(B,Y)=>{Y=Object.assign({decode:!0},Y);const[L,k]=i(B,"#");return Object.assign({url:L.split("?")[0]||"",query:J(F(B),Y)},Y&&Y.parseFragmentIdentifier&&k?{fragmentIdentifier:y(k,Y)}:{})},r.stringifyUrl=(B,Y)=>{Y=Object.assign({encode:!0,strict:!0,[f]:!0},Y);const L=S(B.url).split("?")[0]||"",k=r.extract(B.url),W=r.parse(k,{sort:!1}),m=Object.assign(W,B.query);let N=r.stringify(m,Y);N&&(N=`?${N}`);let ne=A(B.url);return B.fragmentIdentifier&&(ne=`#${Y[f]?g(B.fragmentIdentifier,Y):B.fragmentIdentifier}`),`${L}${N}${ne}`},r.pick=(B,Y,L)=>{L=Object.assign({parseFragmentIdentifier:!0,[f]:!1},L);const{url:k,query:W,fragmentIdentifier:m}=r.parseUrl(B,L);return r.stringifyUrl({url:k,query:s(W,Y),fragmentIdentifier:m},L)},r.exclude=(B,Y,L)=>{const k=Array.isArray(Y)?W=>!Y.includes(W):(W,m)=>!Y(W,m);return r.pick(B,k,L)}})(ro);var K1={exports:{}};(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",s=i?window:{};s.JS_SHA3_NO_WINDOW&&(i=!1);var o=!i&&typeof self=="object",f=!s.JS_SHA3_NO_NODE_JS&&typeof Jr=="object"&&Jr.versions&&Jr.versions.node;f?s=_r:o&&(s=self);var h=!s.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,u=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],P=[1,256,65536,16777216],S=[6,1536,393216,100663296],A=[0,8,16,24],F=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],V=[224,256,384,512],J=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],Y={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),u&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});for(var L=function(E,te,U){return function(j){return new ae(E,te,E).update(j)[U]()}},k=function(E,te,U){return function(j,z){return new ae(E,te,z).update(j)[U]()}},W=function(E,te,U){return function(j,z,v,K){return _["cshake"+E].update(j,z,v,K)[U]()}},m=function(E,te,U){return function(j,z,v,K){return _["kmac"+E].update(j,z,v,K)[U]()}},N=function(E,te,U,j){for(var z=0;z<B.length;++z){var v=B[z];E[v]=te(U,j,v)}return E},ne=function(E,te){var U=L(E,te,"hex");return U.create=function(){return new ae(E,te,E)},U.update=function(j){return U.create().update(j)},N(U,L,E,te)},pe=function(E,te){var U=k(E,te,"hex");return U.create=function(j){return new ae(E,te,j)},U.update=function(j,z){return U.create(z).update(j)},N(U,k,E,te)},q=function(E,te){var U=Y[E],j=W(E,te,"hex");return j.create=function(z,v,K){return!v&&!K?_["shake"+E].create(z):new ae(E,te,z).bytepad([v,K],U)},j.update=function(z,v,K,re){return j.create(v,K,re).update(z)},N(j,W,E,te)},l=function(E,te){var U=Y[E],j=m(E,te,"hex");return j.create=function(z,v,K){return new ie(E,te,v).bytepad(["KMAC",K],U).bytepad([z],U)},j.update=function(z,v,K,re){return j.create(z,K,re).update(v)},N(j,m,E,te)},w=[{name:"keccak",padding:P,bits:V,createMethod:ne},{name:"sha3",padding:S,bits:V,createMethod:ne},{name:"shake",padding:g,bits:J,createMethod:pe},{name:"cshake",padding:y,bits:J,createMethod:q},{name:"kmac",padding:y,bits:J,createMethod:l}],_={},x=[],R=0;R<w.length;++R)for(var $=w[R],T=$.bits,D=0;D<T.length;++D){var p=$.name+"_"+T[D];if(x.push(p),_[p]=$.createMethod(T[D],$.padding),$.name!=="sha3"){var M=$.name+T[D];x.push(M),_[M]=_[p]}}function ae(E,te,U){this.blocks=[],this.s=[],this.padding=te,this.outputBits=U,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(E<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var j=0;j<50;++j)this.s[j]=0}ae.prototype.update=function(E){if(this.finalized)throw new Error(t);var te,U=typeof E;if(U!=="string"){if(U==="object"){if(E===null)throw new Error(e);if(u&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!u||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);te=!0}for(var j=this.blocks,z=this.byteCount,v=E.length,K=this.blockCount,re=0,ce=this.s,ge,ve;re<v;){if(this.reset)for(this.reset=!1,j[0]=this.block,ge=1;ge<K+1;++ge)j[ge]=0;if(te)for(ge=this.start;re<v&&ge<z;++re)j[ge>>2]|=E[re]<<A[ge++&3];else for(ge=this.start;re<v&&ge<z;++re)ve=E.charCodeAt(re),ve<128?j[ge>>2]|=ve<<A[ge++&3]:ve<2048?(j[ge>>2]|=(192|ve>>6)<<A[ge++&3],j[ge>>2]|=(128|ve&63)<<A[ge++&3]):ve<55296||ve>=57344?(j[ge>>2]|=(224|ve>>12)<<A[ge++&3],j[ge>>2]|=(128|ve>>6&63)<<A[ge++&3],j[ge>>2]|=(128|ve&63)<<A[ge++&3]):(ve=65536+((ve&1023)<<10|E.charCodeAt(++re)&1023),j[ge>>2]|=(240|ve>>18)<<A[ge++&3],j[ge>>2]|=(128|ve>>12&63)<<A[ge++&3],j[ge>>2]|=(128|ve>>6&63)<<A[ge++&3],j[ge>>2]|=(128|ve&63)<<A[ge++&3]);if(this.lastByteIndex=ge,ge>=z){for(this.start=ge-z,this.block=j[K],ge=0;ge<K;++ge)ce[ge]^=j[ge];ue(ce),this.reset=!0}else this.start=ge}return this},ae.prototype.encode=function(E,te){var U=E&255,j=1,z=[U];for(E=E>>8,U=E&255;U>0;)z.unshift(U),E=E>>8,U=E&255,++j;return te?z.push(j):z.unshift(j),this.update(z),z.length},ae.prototype.encodeString=function(E){var te,U=typeof E;if(U!=="string"){if(U==="object"){if(E===null)throw new Error(e);if(u&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!u||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);te=!0}var j=0,z=E.length;if(te)j=z;else for(var v=0;v<E.length;++v){var K=E.charCodeAt(v);K<128?j+=1:K<2048?j+=2:K<55296||K>=57344?j+=3:(K=65536+((K&1023)<<10|E.charCodeAt(++v)&1023),j+=4)}return j+=this.encode(j*8),this.update(E),j},ae.prototype.bytepad=function(E,te){for(var U=this.encode(te),j=0;j<E.length;++j)U+=this.encodeString(E[j]);var z=te-U%te,v=[];return v.length=z,this.update(v),this},ae.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,te=this.lastByteIndex,U=this.blockCount,j=this.s;if(E[te>>2]|=this.padding[te&3],this.lastByteIndex===this.byteCount)for(E[0]=E[U],te=1;te<U+1;++te)E[te]=0;for(E[U-1]|=2147483648,te=0;te<U;++te)j[te]^=E[te];ue(j)}},ae.prototype.toString=ae.prototype.hex=function(){this.finalize();for(var E=this.blockCount,te=this.s,U=this.outputBlocks,j=this.extraBytes,z=0,v=0,K="",re;v<U;){for(z=0;z<E&&v<U;++z,++v)re=te[z],K+=d[re>>4&15]+d[re&15]+d[re>>12&15]+d[re>>8&15]+d[re>>20&15]+d[re>>16&15]+d[re>>28&15]+d[re>>24&15];v%E===0&&(ue(te),z=0)}return j&&(re=te[z],K+=d[re>>4&15]+d[re&15],j>1&&(K+=d[re>>12&15]+d[re>>8&15]),j>2&&(K+=d[re>>20&15]+d[re>>16&15])),K},ae.prototype.arrayBuffer=function(){this.finalize();var E=this.blockCount,te=this.s,U=this.outputBlocks,j=this.extraBytes,z=0,v=0,K=this.outputBits>>3,re;j?re=new ArrayBuffer(U+1<<2):re=new ArrayBuffer(K);for(var ce=new Uint32Array(re);v<U;){for(z=0;z<E&&v<U;++z,++v)ce[v]=te[z];v%E===0&&ue(te)}return j&&(ce[z]=te[z],re=re.slice(0,K)),re},ae.prototype.buffer=ae.prototype.arrayBuffer,ae.prototype.digest=ae.prototype.array=function(){this.finalize();for(var E=this.blockCount,te=this.s,U=this.outputBlocks,j=this.extraBytes,z=0,v=0,K=[],re,ce;v<U;){for(z=0;z<E&&v<U;++z,++v)re=v<<2,ce=te[z],K[re]=ce&255,K[re+1]=ce>>8&255,K[re+2]=ce>>16&255,K[re+3]=ce>>24&255;v%E===0&&ue(te)}return j&&(re=v<<2,ce=te[z],K[re]=ce&255,j>1&&(K[re+1]=ce>>8&255),j>2&&(K[re+2]=ce>>16&255)),K};function ie(E,te,U){ae.call(this,E,te,U)}ie.prototype=new ae,ie.prototype.finalize=function(){return this.encode(this.outputBits,!0),ae.prototype.finalize.call(this)};var ue=function(E){var te,U,j,z,v,K,re,ce,ge,ve,Me,Ke,$e,Fe,He,_e,Ie,Le,De,xe,qe,ye,Se,Je,Ee,Oe,tt,Re,Ce,it,ct,ut,cr,ft,mt,Ar,Et,ke,xt,je,We,It,Ue,Xe,Nt,Ge,Ze,Pt,Ye,Ve,_t,Qe,et,$i,Mt,Ot,Yt,fi,hi,ui,di,li,fr;for(j=0;j<48;j+=2)z=E[0]^E[10]^E[20]^E[30]^E[40],v=E[1]^E[11]^E[21]^E[31]^E[41],K=E[2]^E[12]^E[22]^E[32]^E[42],re=E[3]^E[13]^E[23]^E[33]^E[43],ce=E[4]^E[14]^E[24]^E[34]^E[44],ge=E[5]^E[15]^E[25]^E[35]^E[45],ve=E[6]^E[16]^E[26]^E[36]^E[46],Me=E[7]^E[17]^E[27]^E[37]^E[47],Ke=E[8]^E[18]^E[28]^E[38]^E[48],$e=E[9]^E[19]^E[29]^E[39]^E[49],te=Ke^(K<<1|re>>>31),U=$e^(re<<1|K>>>31),E[0]^=te,E[1]^=U,E[10]^=te,E[11]^=U,E[20]^=te,E[21]^=U,E[30]^=te,E[31]^=U,E[40]^=te,E[41]^=U,te=z^(ce<<1|ge>>>31),U=v^(ge<<1|ce>>>31),E[2]^=te,E[3]^=U,E[12]^=te,E[13]^=U,E[22]^=te,E[23]^=U,E[32]^=te,E[33]^=U,E[42]^=te,E[43]^=U,te=K^(ve<<1|Me>>>31),U=re^(Me<<1|ve>>>31),E[4]^=te,E[5]^=U,E[14]^=te,E[15]^=U,E[24]^=te,E[25]^=U,E[34]^=te,E[35]^=U,E[44]^=te,E[45]^=U,te=ce^(Ke<<1|$e>>>31),U=ge^($e<<1|Ke>>>31),E[6]^=te,E[7]^=U,E[16]^=te,E[17]^=U,E[26]^=te,E[27]^=U,E[36]^=te,E[37]^=U,E[46]^=te,E[47]^=U,te=ve^(z<<1|v>>>31),U=Me^(v<<1|z>>>31),E[8]^=te,E[9]^=U,E[18]^=te,E[19]^=U,E[28]^=te,E[29]^=U,E[38]^=te,E[39]^=U,E[48]^=te,E[49]^=U,Fe=E[0],He=E[1],Ge=E[11]<<4|E[10]>>>28,Ze=E[10]<<4|E[11]>>>28,Re=E[20]<<3|E[21]>>>29,Ce=E[21]<<3|E[20]>>>29,ui=E[31]<<9|E[30]>>>23,di=E[30]<<9|E[31]>>>23,It=E[40]<<18|E[41]>>>14,Ue=E[41]<<18|E[40]>>>14,ft=E[2]<<1|E[3]>>>31,mt=E[3]<<1|E[2]>>>31,_e=E[13]<<12|E[12]>>>20,Ie=E[12]<<12|E[13]>>>20,Pt=E[22]<<10|E[23]>>>22,Ye=E[23]<<10|E[22]>>>22,it=E[33]<<13|E[32]>>>19,ct=E[32]<<13|E[33]>>>19,li=E[42]<<2|E[43]>>>30,fr=E[43]<<2|E[42]>>>30,$i=E[5]<<30|E[4]>>>2,Mt=E[4]<<30|E[5]>>>2,Ar=E[14]<<6|E[15]>>>26,Et=E[15]<<6|E[14]>>>26,Le=E[25]<<11|E[24]>>>21,De=E[24]<<11|E[25]>>>21,Ve=E[34]<<15|E[35]>>>17,_t=E[35]<<15|E[34]>>>17,ut=E[45]<<29|E[44]>>>3,cr=E[44]<<29|E[45]>>>3,Je=E[6]<<28|E[7]>>>4,Ee=E[7]<<28|E[6]>>>4,Ot=E[17]<<23|E[16]>>>9,Yt=E[16]<<23|E[17]>>>9,ke=E[26]<<25|E[27]>>>7,xt=E[27]<<25|E[26]>>>7,xe=E[36]<<21|E[37]>>>11,qe=E[37]<<21|E[36]>>>11,Qe=E[47]<<24|E[46]>>>8,et=E[46]<<24|E[47]>>>8,Xe=E[8]<<27|E[9]>>>5,Nt=E[9]<<27|E[8]>>>5,Oe=E[18]<<20|E[19]>>>12,tt=E[19]<<20|E[18]>>>12,fi=E[29]<<7|E[28]>>>25,hi=E[28]<<7|E[29]>>>25,je=E[38]<<8|E[39]>>>24,We=E[39]<<8|E[38]>>>24,ye=E[48]<<14|E[49]>>>18,Se=E[49]<<14|E[48]>>>18,E[0]=Fe^~_e&Le,E[1]=He^~Ie&De,E[10]=Je^~Oe&Re,E[11]=Ee^~tt&Ce,E[20]=ft^~Ar&ke,E[21]=mt^~Et&xt,E[30]=Xe^~Ge&Pt,E[31]=Nt^~Ze&Ye,E[40]=$i^~Ot&fi,E[41]=Mt^~Yt&hi,E[2]=_e^~Le&xe,E[3]=Ie^~De&qe,E[12]=Oe^~Re&it,E[13]=tt^~Ce&ct,E[22]=Ar^~ke&je,E[23]=Et^~xt&We,E[32]=Ge^~Pt&Ve,E[33]=Ze^~Ye&_t,E[42]=Ot^~fi&ui,E[43]=Yt^~hi&di,E[4]=Le^~xe&ye,E[5]=De^~qe&Se,E[14]=Re^~it&ut,E[15]=Ce^~ct&cr,E[24]=ke^~je&It,E[25]=xt^~We&Ue,E[34]=Pt^~Ve&Qe,E[35]=Ye^~_t&et,E[44]=fi^~ui&li,E[45]=hi^~di&fr,E[6]=xe^~ye&Fe,E[7]=qe^~Se&He,E[16]=it^~ut&Je,E[17]=ct^~cr&Ee,E[26]=je^~It&ft,E[27]=We^~Ue&mt,E[36]=Ve^~Qe&Xe,E[37]=_t^~et&Nt,E[46]=ui^~li&$i,E[47]=di^~fr&Mt,E[8]=ye^~Fe&_e,E[9]=Se^~He&Ie,E[18]=ut^~Je&Oe,E[19]=cr^~Ee&tt,E[28]=It^~ft&Ar,E[29]=Ue^~mt&Et,E[38]=Qe^~Xe&Ge,E[39]=et^~Nt&Ze,E[48]=li^~$i&Ot,E[49]=fr^~Mt&Yt,E[0]^=F[j],E[1]^=F[j+1]};if(h)r.exports=_;else for(R=0;R<x.length;++R)s[x[R]]=_[x[R]]})()})(K1);var Ww=K1.exports;const Gw=qu(Ww),Vw="logger/5.7.0";let N0=!1,T0=!1;const Nc={debug:1,default:2,info:2,warning:3,error:4,off:5};let $0=Nc.default,jh=null;function Jw(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const F0=Jw();var mu;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(mu||(mu={}));var ki;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(ki||(ki={}));const L0="0123456789abcdef";class kt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();Nc[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!($0>Nc[i])&&console.log.apply(console,t)}debug(...e){this._log(kt.levels.DEBUG,e)}info(...e){this._log(kt.levels.INFO,e)}warn(...e){this._log(kt.levels.WARNING,e)}makeError(e,t,i){if(T0)return this.makeError("censored error",t,{});t||(t=kt.errors.UNKNOWN_ERROR),i||(i={});const s=[];Object.keys(i).forEach(u=>{const d=i[u];try{if(d instanceof Uint8Array){let g="";for(let y=0;y<d.length;y++)g+=L0[d[y]>>4],g+=L0[d[y]&15];s.push(u+"=Uint8Array(0x"+g+")")}else s.push(u+"="+JSON.stringify(d))}catch{s.push(u+"="+JSON.stringify(i[u].toString()))}}),s.push(`code=${t}`),s.push(`version=${this.version}`);const o=e;let f="";switch(t){case ki.NUMERIC_FAULT:{f="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":f+="-"+u;break;case"negative-power":case"negative-width":f+="-unsupported";break;case"unbound-bitwise-result":f+="-unbound-result";break}break}case ki.CALL_EXCEPTION:case ki.INSUFFICIENT_FUNDS:case ki.MISSING_NEW:case ki.NONCE_EXPIRED:case ki.REPLACEMENT_UNDERPRICED:case ki.TRANSACTION_REPLACED:case ki.UNPREDICTABLE_GAS_LIMIT:f=t;break}f&&(e+=" [ See: https://links.ethers.org/v5-errors-"+f+" ]"),s.length&&(e+=" ("+s.join(", ")+")");const h=new Error(e);return h.reason=o,h.code=t,Object.keys(i).forEach(function(u){h[u]=i[u]}),h}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,kt.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,s){e||this.throwError(t,i,s)}assertArgument(e,t,i,s){e||this.throwArgumentError(t,i,s)}checkNormalize(e){F0&&this.throwError("platform missing String.prototype.normalize",kt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:F0})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,kt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,kt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,kt.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,kt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",kt.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",kt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",kt.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return jh||(jh=new kt(Vw)),jh}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",kt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),N0){if(!e)return;this.globalLogger().throwError("error censorship permanent",kt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}T0=!!e,N0=!!t}static setLogLevel(e){const t=Nc[e.toLowerCase()];if(t==null){kt.globalLogger().warn("invalid log level - "+e);return}$0=t}static from(e){return new kt(e)}}kt.errors=ki;kt.levels=mu;const Yw="bytes/5.7.0",er=new kt(Yw);function H1(r){return!!r.toHexString}function fa(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return fa(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function Xw(r){return cn(r)&&!(r.length%2)||Hu(r)}function q0(r){return typeof r=="number"&&r==r&&r%1===0}function Hu(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!q0(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!q0(t)||t<0||t>=256)return!1}return!0}function nr(r,e){if(e||(e={}),typeof r=="number"){er.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),fa(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),H1(r)&&(r=r.toHexString()),cn(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":er.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let s=0;s<t.length;s+=2)i.push(parseInt(t.substring(s,s+2),16));return fa(new Uint8Array(i))}return Hu(r)?fa(new Uint8Array(r)):er.throwArgumentError("invalid arrayify value","value",r)}function Zw(r){const e=r.map(s=>nr(s)),t=e.reduce((s,o)=>s+o.length,0),i=new Uint8Array(t);return e.reduce((s,o)=>(i.set(o,s),s+o.length),0),fa(i)}function Qw(r,e){r=nr(r),r.length>e&&er.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),fa(t)}function cn(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const Wh="0123456789abcdef";function Vr(r,e){if(e||(e={}),typeof r=="number"){er.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=Wh[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),H1(r))return r.toHexString();if(cn(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":er.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(Hu(r)){let t="0x";for(let i=0;i<r.length;i++){let s=r[i];t+=Wh[(s&240)>>4]+Wh[s&15]}return t}return er.throwArgumentError("invalid hexlify value","value",r)}function e5(r){if(typeof r!="string")r=Vr(r);else if(!cn(r)||r.length%2)return null;return(r.length-2)/2}function U0(r,e,t){return typeof r!="string"?r=Vr(r):(!cn(r)||r.length%2)&&er.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function ha(r,e){for(typeof r!="string"?r=Vr(r):cn(r)||er.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&er.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function k1(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Xw(r)){let t=nr(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=Vr(t.slice(0,32)),e.s=Vr(t.slice(32,64))):t.length===65?(e.r=Vr(t.slice(0,32)),e.s=Vr(t.slice(32,64)),e.v=t[64]):er.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:er.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=Vr(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const s=Qw(nr(e._vs),32);e._vs=Vr(s);const o=s[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&er.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),s[0]&=127;const f=Vr(s);e.s==null?e.s=f:e.s!==f&&er.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?er.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const s=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==s&&er.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!cn(e.r)?er.throwArgumentError("signature missing or invalid r","signature",r):e.r=ha(e.r,32),e.s==null||!cn(e.s)?er.throwArgumentError("signature missing or invalid s","signature",r):e.s=ha(e.s,32);const t=nr(e.s);t[0]>=128&&er.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=Vr(t);e._vs&&(cn(e._vs)||er.throwArgumentError("signature invalid _vs","signature",r),e._vs=ha(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&er.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function ku(r){return"0x"+Gw.keccak_256(nr(r))}var t5=at.BN;function r5(r){return new t5(r,36).toString(16)}const i5="strings/5.7.0",n5=new kt(i5);var Hc;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(Hc||(Hc={}));var B0;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(B0||(B0={}));function Gh(r,e=Hc.current){e!=Hc.current&&(n5.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const s=r.charCodeAt(i);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){i++;const o=r.charCodeAt(i);if(i>=r.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const f=65536+((s&1023)<<10)+(o&1023);t.push(f>>18|240),t.push(f>>12&63|128),t.push(f>>6&63|128),t.push(f&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return nr(t)}const s5=`Ethereum Signed Message:
1
+ import{p as Jr,a as Q6,c as _r,b as qu,B as at,h as In,d as ew,r as tw,e as rw,m as iw,u as nw,i as Uu,f as F1,j as L1,k as sw,g as pt,l as Ii,n as Di,o as Bu,q as v0,_ as aw}from"./index-96a8fdf1.js";import{t as ow}from"./tslib.es6-c2094241.js";var b0=globalThis&&globalThis.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,s=e.length,o;i<s;i++)(o||!(i in e))&&(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return r.concat(o||Array.prototype.slice.call(e))},cw=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),fw=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=Jr.platform}return r}(),hw=function(){function r(e,t,i,s){this.name=e,this.version=t,this.os=i,this.bot=s,this.type="bot-device"}return r}(),uw=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),dw=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),lw=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,pw=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,m0=3,gw=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",lw]],y0=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function vw(r){return r?w0(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new dw:typeof navigator<"u"?w0(navigator.userAgent):yw()}function bw(r){return r!==""&&gw.reduce(function(e,t){var i=t[0],s=t[1];if(e)return e;var o=s.exec(r);return!!o&&[i,o]},!1)}function w0(r){var e=bw(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new uw;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<m0&&(s=b0(b0([],s,!0),ww(m0-s.length),!0)):s=[];var o=s.join("."),f=mw(r),h=pw.exec(r);return h&&h[1]?new hw(t,o,f,h[1]):new cw(t,o,f)}function mw(r){for(var e=0,t=y0.length;e<t;e++){var i=y0[e],s=i[0],o=i[1],f=o.exec(r);if(f)return s}return null}function yw(){var r=typeof Jr<"u"&&Jr.version;return r?new fw(Jr.version.slice(1)):null}function ww(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var me={};const co=Q6(ow);var zh={},za={},_0;function _w(){if(_0)return za;_0=1,Object.defineProperty(za,"__esModule",{value:!0}),za.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return za.delay=r,za}var ys={},Kh={},ws={},E0;function Ew(){return E0||(E0=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.ONE_THOUSAND=ws.ONE_HUNDRED=void 0,ws.ONE_HUNDRED=100,ws.ONE_THOUSAND=1e3),ws}var Hh={},x0;function xw(){return x0||(x0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Hh)),Hh}var S0;function q1(){return S0||(S0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=co;e.__exportStar(Ew(),r),e.__exportStar(xw(),r)}(Kh)),Kh}var I0;function Sw(){if(I0)return ys;I0=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.fromMiliseconds=ys.toMiliseconds=void 0;const r=q1();function e(i){return i*r.ONE_THOUSAND}ys.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return ys.fromMiliseconds=t,ys}var A0;function Iw(){return A0||(A0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=co;e.__exportStar(_w(),r),e.__exportStar(Sw(),r)}(zh)),zh}var ta={},P0;function Aw(){if(P0)return ta;P0=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const s=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:s})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return ta.Watch=r,ta.default=r,ta}var kh={},Ka={},D0;function Pw(){if(D0)return Ka;D0=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.IWatch=void 0;class r{}return Ka.IWatch=r,Ka}var M0;function Dw(){return M0||(M0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),co.__exportStar(Pw(),r)}(kh)),kh}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=co;e.__exportStar(Iw(),r),e.__exportStar(Aw(),r),e.__exportStar(Dw(),r),e.__exportStar(q1(),r)})(me);var Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getLocalStorage=Bt.getLocalStorageOrThrow=Bt.getCrypto=Bt.getCryptoOrThrow=U1=Bt.getLocation=Bt.getLocationOrThrow=zu=Bt.getNavigator=Bt.getNavigatorOrThrow=fo=Bt.getDocument=Bt.getDocumentOrThrow=Bt.getFromWindowOrThrow=Bt.getFromWindow=void 0;function Rs(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}Bt.getFromWindow=Rs;function pa(r){const e=Rs(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}Bt.getFromWindowOrThrow=pa;function Mw(){return pa("document")}Bt.getDocumentOrThrow=Mw;function Ow(){return Rs("document")}var fo=Bt.getDocument=Ow;function Rw(){return pa("navigator")}Bt.getNavigatorOrThrow=Rw;function Cw(){return Rs("navigator")}var zu=Bt.getNavigator=Cw;function Nw(){return pa("location")}Bt.getLocationOrThrow=Nw;function Tw(){return Rs("location")}var U1=Bt.getLocation=Tw;function $w(){return pa("crypto")}Bt.getCryptoOrThrow=$w;function Fw(){return Rs("crypto")}Bt.getCrypto=Fw;function Lw(){return pa("localStorage")}Bt.getLocalStorageOrThrow=Lw;function qw(){return Rs("localStorage")}Bt.getLocalStorage=qw;var Ku={};Object.defineProperty(Ku,"__esModule",{value:!0});var B1=Ku.getWindowMetadata=void 0;const O0=Bt;function Uw(){let r,e;try{r=O0.getDocumentOrThrow(),e=O0.getLocationOrThrow()}catch{return null}function t(){const y=r.getElementsByTagName("link"),P=[];for(let S=0;S<y.length;S++){const A=y[S],F=A.getAttribute("rel");if(F&&F.toLowerCase().indexOf("icon")>-1){const V=A.getAttribute("href");if(V)if(V.toLowerCase().indexOf("https:")===-1&&V.toLowerCase().indexOf("http:")===-1&&V.indexOf("//")!==0){let J=e.protocol+"//"+e.host;if(V.indexOf("/")===0)J+=V;else{const B=e.pathname.split("/");B.pop();const Y=B.join("/");J+=Y+"/"+V}P.push(J)}else if(V.indexOf("//")===0){const J=e.protocol+V;P.push(J)}else P.push(V)}}return P}function i(...y){const P=r.getElementsByTagName("meta");for(let S=0;S<P.length;S++){const A=P[S],F=["itemprop","property","name"].map(V=>A.getAttribute(V)).filter(V=>V?y.includes(V):!1);if(F.length&&F){const V=A.getAttribute("content");if(V)return V}}return""}function s(){let y=i("name","og:site_name","og:title","twitter:title");return y||(y=r.title),y}function o(){return i("description","og:description","twitter:description","keywords")}const f=s(),h=o(),u=e.origin,d=t();return{description:h,url:u,icons:d,name:f}}B1=Ku.getWindowMetadata=Uw;var ro={},Bw=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),z1="%[a-f0-9]{2}",R0=new RegExp("("+z1+")|([^%]+?)","gi"),C0=new RegExp("("+z1+")+","gi");function bu(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],bu(t),bu(i))}function zw(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(R0)||[],t=1;t<e.length;t++)r=bu(e,t).join(""),e=r.match(R0)||[];return r}}function Kw(r){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=C0.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=zw(t[0]);i!==t[0]&&(e[t[0]]=i)}t=C0.exec(r)}e["%C2"]="�";for(var s=Object.keys(e),o=0;o<s.length;o++){var f=s[o];r=r.replace(new RegExp(f,"g"),e[f])}return r}var Hw=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return Kw(r)}},kw=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},jw=function(r,e){for(var t={},i=Object.keys(r),s=Array.isArray(e),o=0;o<i.length;o++){var f=i[o],h=r[f];(s?e.indexOf(f)!==-1:e(f,h,r))&&(t[f]=h)}return t};(function(r){const e=Bw,t=Hw,i=kw,s=jw,o=B=>B==null,f=Symbol("encodeFragmentIdentifier");function h(B){switch(B.arrayFormat){case"index":return Y=>(L,k)=>{const W=L.length;return k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,[g(Y,B),"[",W,"]"].join("")]:[...L,[g(Y,B),"[",g(W,B),"]=",g(k,B)].join("")]};case"bracket":return Y=>(L,k)=>k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,[g(Y,B),"[]"].join("")]:[...L,[g(Y,B),"[]=",g(k,B)].join("")];case"colon-list-separator":return Y=>(L,k)=>k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,[g(Y,B),":list="].join("")]:[...L,[g(Y,B),":list=",g(k,B)].join("")];case"comma":case"separator":case"bracket-separator":{const Y=B.arrayFormat==="bracket-separator"?"[]=":"=";return L=>(k,W)=>W===void 0||B.skipNull&&W===null||B.skipEmptyString&&W===""?k:(W=W===null?"":W,k.length===0?[[g(L,B),Y,g(W,B)].join("")]:[[k,g(W,B)].join(B.arrayFormatSeparator)])}default:return Y=>(L,k)=>k===void 0||B.skipNull&&k===null||B.skipEmptyString&&k===""?L:k===null?[...L,g(Y,B)]:[...L,[g(Y,B),"=",g(k,B)].join("")]}}function u(B){let Y;switch(B.arrayFormat){case"index":return(L,k,W)=>{if(Y=/\[(\d*)\]$/.exec(L),L=L.replace(/\[\d*\]$/,""),!Y){W[L]=k;return}W[L]===void 0&&(W[L]={}),W[L][Y[1]]=k};case"bracket":return(L,k,W)=>{if(Y=/(\[\])$/.exec(L),L=L.replace(/\[\]$/,""),!Y){W[L]=k;return}if(W[L]===void 0){W[L]=[k];return}W[L]=[].concat(W[L],k)};case"colon-list-separator":return(L,k,W)=>{if(Y=/(:list)$/.exec(L),L=L.replace(/:list$/,""),!Y){W[L]=k;return}if(W[L]===void 0){W[L]=[k];return}W[L]=[].concat(W[L],k)};case"comma":case"separator":return(L,k,W)=>{const m=typeof k=="string"&&k.includes(B.arrayFormatSeparator),N=typeof k=="string"&&!m&&y(k,B).includes(B.arrayFormatSeparator);k=N?y(k,B):k;const ne=m||N?k.split(B.arrayFormatSeparator).map(pe=>y(pe,B)):k===null?k:y(k,B);W[L]=ne};case"bracket-separator":return(L,k,W)=>{const m=/(\[\])$/.test(L);if(L=L.replace(/\[\]$/,""),!m){W[L]=k&&y(k,B);return}const N=k===null?[]:k.split(B.arrayFormatSeparator).map(ne=>y(ne,B));if(W[L]===void 0){W[L]=N;return}W[L]=[].concat(W[L],N)};default:return(L,k,W)=>{if(W[L]===void 0){W[L]=k;return}W[L]=[].concat(W[L],k)}}}function d(B){if(typeof B!="string"||B.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(B,Y){return Y.encode?Y.strict?e(B):encodeURIComponent(B):B}function y(B,Y){return Y.decode?t(B):B}function P(B){return Array.isArray(B)?B.sort():typeof B=="object"?P(Object.keys(B)).sort((Y,L)=>Number(Y)-Number(L)).map(Y=>B[Y]):B}function S(B){const Y=B.indexOf("#");return Y!==-1&&(B=B.slice(0,Y)),B}function A(B){let Y="";const L=B.indexOf("#");return L!==-1&&(Y=B.slice(L)),Y}function F(B){B=S(B);const Y=B.indexOf("?");return Y===-1?"":B.slice(Y+1)}function V(B,Y){return Y.parseNumbers&&!Number.isNaN(Number(B))&&typeof B=="string"&&B.trim()!==""?B=Number(B):Y.parseBooleans&&B!==null&&(B.toLowerCase()==="true"||B.toLowerCase()==="false")&&(B=B.toLowerCase()==="true"),B}function J(B,Y){Y=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},Y),d(Y.arrayFormatSeparator);const L=u(Y),k=Object.create(null);if(typeof B!="string"||(B=B.trim().replace(/^[?#&]/,""),!B))return k;for(const W of B.split("&")){if(W==="")continue;let[m,N]=i(Y.decode?W.replace(/\+/g," "):W,"=");N=N===void 0?null:["comma","separator","bracket-separator"].includes(Y.arrayFormat)?N:y(N,Y),L(y(m,Y),N,k)}for(const W of Object.keys(k)){const m=k[W];if(typeof m=="object"&&m!==null)for(const N of Object.keys(m))m[N]=V(m[N],Y);else k[W]=V(m,Y)}return Y.sort===!1?k:(Y.sort===!0?Object.keys(k).sort():Object.keys(k).sort(Y.sort)).reduce((W,m)=>{const N=k[m];return N&&typeof N=="object"&&!Array.isArray(N)?W[m]=P(N):W[m]=N,W},Object.create(null))}r.extract=F,r.parse=J,r.stringify=(B,Y)=>{if(!B)return"";Y=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},Y),d(Y.arrayFormatSeparator);const L=N=>Y.skipNull&&o(B[N])||Y.skipEmptyString&&B[N]==="",k=h(Y),W={};for(const N of Object.keys(B))L(N)||(W[N]=B[N]);const m=Object.keys(W);return Y.sort!==!1&&m.sort(Y.sort),m.map(N=>{const ne=B[N];return ne===void 0?"":ne===null?g(N,Y):Array.isArray(ne)?ne.length===0&&Y.arrayFormat==="bracket-separator"?g(N,Y)+"[]":ne.reduce(k(N),[]).join("&"):g(N,Y)+"="+g(ne,Y)}).filter(N=>N.length>0).join("&")},r.parseUrl=(B,Y)=>{Y=Object.assign({decode:!0},Y);const[L,k]=i(B,"#");return Object.assign({url:L.split("?")[0]||"",query:J(F(B),Y)},Y&&Y.parseFragmentIdentifier&&k?{fragmentIdentifier:y(k,Y)}:{})},r.stringifyUrl=(B,Y)=>{Y=Object.assign({encode:!0,strict:!0,[f]:!0},Y);const L=S(B.url).split("?")[0]||"",k=r.extract(B.url),W=r.parse(k,{sort:!1}),m=Object.assign(W,B.query);let N=r.stringify(m,Y);N&&(N=`?${N}`);let ne=A(B.url);return B.fragmentIdentifier&&(ne=`#${Y[f]?g(B.fragmentIdentifier,Y):B.fragmentIdentifier}`),`${L}${N}${ne}`},r.pick=(B,Y,L)=>{L=Object.assign({parseFragmentIdentifier:!0,[f]:!1},L);const{url:k,query:W,fragmentIdentifier:m}=r.parseUrl(B,L);return r.stringifyUrl({url:k,query:s(W,Y),fragmentIdentifier:m},L)},r.exclude=(B,Y,L)=>{const k=Array.isArray(Y)?W=>!Y.includes(W):(W,m)=>!Y(W,m);return r.pick(B,k,L)}})(ro);var K1={exports:{}};(function(r){(function(){var e="input is invalid type",t="finalize already called",i=typeof window=="object",s=i?window:{};s.JS_SHA3_NO_WINDOW&&(i=!1);var o=!i&&typeof self=="object",f=!s.JS_SHA3_NO_NODE_JS&&typeof Jr=="object"&&Jr.versions&&Jr.versions.node;f?s=_r:o&&(s=self);var h=!s.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,u=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),g=[31,7936,2031616,520093696],y=[4,1024,262144,67108864],P=[1,256,65536,16777216],S=[6,1536,393216,100663296],A=[0,8,16,24],F=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],V=[224,256,384,512],J=[128,256],B=["hex","buffer","arrayBuffer","array","digest"],Y={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),u&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});for(var L=function(E,te,U){return function(j){return new ae(E,te,E).update(j)[U]()}},k=function(E,te,U){return function(j,z){return new ae(E,te,z).update(j)[U]()}},W=function(E,te,U){return function(j,z,v,K){return _["cshake"+E].update(j,z,v,K)[U]()}},m=function(E,te,U){return function(j,z,v,K){return _["kmac"+E].update(j,z,v,K)[U]()}},N=function(E,te,U,j){for(var z=0;z<B.length;++z){var v=B[z];E[v]=te(U,j,v)}return E},ne=function(E,te){var U=L(E,te,"hex");return U.create=function(){return new ae(E,te,E)},U.update=function(j){return U.create().update(j)},N(U,L,E,te)},pe=function(E,te){var U=k(E,te,"hex");return U.create=function(j){return new ae(E,te,j)},U.update=function(j,z){return U.create(z).update(j)},N(U,k,E,te)},q=function(E,te){var U=Y[E],j=W(E,te,"hex");return j.create=function(z,v,K){return!v&&!K?_["shake"+E].create(z):new ae(E,te,z).bytepad([v,K],U)},j.update=function(z,v,K,re){return j.create(v,K,re).update(z)},N(j,W,E,te)},l=function(E,te){var U=Y[E],j=m(E,te,"hex");return j.create=function(z,v,K){return new ie(E,te,v).bytepad(["KMAC",K],U).bytepad([z],U)},j.update=function(z,v,K,re){return j.create(z,K,re).update(v)},N(j,m,E,te)},w=[{name:"keccak",padding:P,bits:V,createMethod:ne},{name:"sha3",padding:S,bits:V,createMethod:ne},{name:"shake",padding:g,bits:J,createMethod:pe},{name:"cshake",padding:y,bits:J,createMethod:q},{name:"kmac",padding:y,bits:J,createMethod:l}],_={},x=[],R=0;R<w.length;++R)for(var $=w[R],T=$.bits,D=0;D<T.length;++D){var p=$.name+"_"+T[D];if(x.push(p),_[p]=$.createMethod(T[D],$.padding),$.name!=="sha3"){var M=$.name+T[D];x.push(M),_[M]=_[p]}}function ae(E,te,U){this.blocks=[],this.s=[],this.padding=te,this.outputBits=U,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(E<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var j=0;j<50;++j)this.s[j]=0}ae.prototype.update=function(E){if(this.finalized)throw new Error(t);var te,U=typeof E;if(U!=="string"){if(U==="object"){if(E===null)throw new Error(e);if(u&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!u||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);te=!0}for(var j=this.blocks,z=this.byteCount,v=E.length,K=this.blockCount,re=0,ce=this.s,ge,ve;re<v;){if(this.reset)for(this.reset=!1,j[0]=this.block,ge=1;ge<K+1;++ge)j[ge]=0;if(te)for(ge=this.start;re<v&&ge<z;++re)j[ge>>2]|=E[re]<<A[ge++&3];else for(ge=this.start;re<v&&ge<z;++re)ve=E.charCodeAt(re),ve<128?j[ge>>2]|=ve<<A[ge++&3]:ve<2048?(j[ge>>2]|=(192|ve>>6)<<A[ge++&3],j[ge>>2]|=(128|ve&63)<<A[ge++&3]):ve<55296||ve>=57344?(j[ge>>2]|=(224|ve>>12)<<A[ge++&3],j[ge>>2]|=(128|ve>>6&63)<<A[ge++&3],j[ge>>2]|=(128|ve&63)<<A[ge++&3]):(ve=65536+((ve&1023)<<10|E.charCodeAt(++re)&1023),j[ge>>2]|=(240|ve>>18)<<A[ge++&3],j[ge>>2]|=(128|ve>>12&63)<<A[ge++&3],j[ge>>2]|=(128|ve>>6&63)<<A[ge++&3],j[ge>>2]|=(128|ve&63)<<A[ge++&3]);if(this.lastByteIndex=ge,ge>=z){for(this.start=ge-z,this.block=j[K],ge=0;ge<K;++ge)ce[ge]^=j[ge];ue(ce),this.reset=!0}else this.start=ge}return this},ae.prototype.encode=function(E,te){var U=E&255,j=1,z=[U];for(E=E>>8,U=E&255;U>0;)z.unshift(U),E=E>>8,U=E&255,++j;return te?z.push(j):z.unshift(j),this.update(z),z.length},ae.prototype.encodeString=function(E){var te,U=typeof E;if(U!=="string"){if(U==="object"){if(E===null)throw new Error(e);if(u&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!u||!ArrayBuffer.isView(E)))throw new Error(e)}else throw new Error(e);te=!0}var j=0,z=E.length;if(te)j=z;else for(var v=0;v<E.length;++v){var K=E.charCodeAt(v);K<128?j+=1:K<2048?j+=2:K<55296||K>=57344?j+=3:(K=65536+((K&1023)<<10|E.charCodeAt(++v)&1023),j+=4)}return j+=this.encode(j*8),this.update(E),j},ae.prototype.bytepad=function(E,te){for(var U=this.encode(te),j=0;j<E.length;++j)U+=this.encodeString(E[j]);var z=te-U%te,v=[];return v.length=z,this.update(v),this},ae.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,te=this.lastByteIndex,U=this.blockCount,j=this.s;if(E[te>>2]|=this.padding[te&3],this.lastByteIndex===this.byteCount)for(E[0]=E[U],te=1;te<U+1;++te)E[te]=0;for(E[U-1]|=2147483648,te=0;te<U;++te)j[te]^=E[te];ue(j)}},ae.prototype.toString=ae.prototype.hex=function(){this.finalize();for(var E=this.blockCount,te=this.s,U=this.outputBlocks,j=this.extraBytes,z=0,v=0,K="",re;v<U;){for(z=0;z<E&&v<U;++z,++v)re=te[z],K+=d[re>>4&15]+d[re&15]+d[re>>12&15]+d[re>>8&15]+d[re>>20&15]+d[re>>16&15]+d[re>>28&15]+d[re>>24&15];v%E===0&&(ue(te),z=0)}return j&&(re=te[z],K+=d[re>>4&15]+d[re&15],j>1&&(K+=d[re>>12&15]+d[re>>8&15]),j>2&&(K+=d[re>>20&15]+d[re>>16&15])),K},ae.prototype.arrayBuffer=function(){this.finalize();var E=this.blockCount,te=this.s,U=this.outputBlocks,j=this.extraBytes,z=0,v=0,K=this.outputBits>>3,re;j?re=new ArrayBuffer(U+1<<2):re=new ArrayBuffer(K);for(var ce=new Uint32Array(re);v<U;){for(z=0;z<E&&v<U;++z,++v)ce[v]=te[z];v%E===0&&ue(te)}return j&&(ce[z]=te[z],re=re.slice(0,K)),re},ae.prototype.buffer=ae.prototype.arrayBuffer,ae.prototype.digest=ae.prototype.array=function(){this.finalize();for(var E=this.blockCount,te=this.s,U=this.outputBlocks,j=this.extraBytes,z=0,v=0,K=[],re,ce;v<U;){for(z=0;z<E&&v<U;++z,++v)re=v<<2,ce=te[z],K[re]=ce&255,K[re+1]=ce>>8&255,K[re+2]=ce>>16&255,K[re+3]=ce>>24&255;v%E===0&&ue(te)}return j&&(re=v<<2,ce=te[z],K[re]=ce&255,j>1&&(K[re+1]=ce>>8&255),j>2&&(K[re+2]=ce>>16&255)),K};function ie(E,te,U){ae.call(this,E,te,U)}ie.prototype=new ae,ie.prototype.finalize=function(){return this.encode(this.outputBits,!0),ae.prototype.finalize.call(this)};var ue=function(E){var te,U,j,z,v,K,re,ce,ge,ve,Me,Ke,$e,Fe,He,_e,Ie,Le,De,xe,qe,ye,Se,Je,Ee,Oe,tt,Re,Ce,it,ct,ut,cr,ft,mt,Ar,Et,ke,xt,je,We,It,Ue,Xe,Nt,Ge,Ze,Pt,Ye,Ve,_t,Qe,et,$i,Mt,Ot,Yt,fi,hi,ui,di,li,fr;for(j=0;j<48;j+=2)z=E[0]^E[10]^E[20]^E[30]^E[40],v=E[1]^E[11]^E[21]^E[31]^E[41],K=E[2]^E[12]^E[22]^E[32]^E[42],re=E[3]^E[13]^E[23]^E[33]^E[43],ce=E[4]^E[14]^E[24]^E[34]^E[44],ge=E[5]^E[15]^E[25]^E[35]^E[45],ve=E[6]^E[16]^E[26]^E[36]^E[46],Me=E[7]^E[17]^E[27]^E[37]^E[47],Ke=E[8]^E[18]^E[28]^E[38]^E[48],$e=E[9]^E[19]^E[29]^E[39]^E[49],te=Ke^(K<<1|re>>>31),U=$e^(re<<1|K>>>31),E[0]^=te,E[1]^=U,E[10]^=te,E[11]^=U,E[20]^=te,E[21]^=U,E[30]^=te,E[31]^=U,E[40]^=te,E[41]^=U,te=z^(ce<<1|ge>>>31),U=v^(ge<<1|ce>>>31),E[2]^=te,E[3]^=U,E[12]^=te,E[13]^=U,E[22]^=te,E[23]^=U,E[32]^=te,E[33]^=U,E[42]^=te,E[43]^=U,te=K^(ve<<1|Me>>>31),U=re^(Me<<1|ve>>>31),E[4]^=te,E[5]^=U,E[14]^=te,E[15]^=U,E[24]^=te,E[25]^=U,E[34]^=te,E[35]^=U,E[44]^=te,E[45]^=U,te=ce^(Ke<<1|$e>>>31),U=ge^($e<<1|Ke>>>31),E[6]^=te,E[7]^=U,E[16]^=te,E[17]^=U,E[26]^=te,E[27]^=U,E[36]^=te,E[37]^=U,E[46]^=te,E[47]^=U,te=ve^(z<<1|v>>>31),U=Me^(v<<1|z>>>31),E[8]^=te,E[9]^=U,E[18]^=te,E[19]^=U,E[28]^=te,E[29]^=U,E[38]^=te,E[39]^=U,E[48]^=te,E[49]^=U,Fe=E[0],He=E[1],Ge=E[11]<<4|E[10]>>>28,Ze=E[10]<<4|E[11]>>>28,Re=E[20]<<3|E[21]>>>29,Ce=E[21]<<3|E[20]>>>29,ui=E[31]<<9|E[30]>>>23,di=E[30]<<9|E[31]>>>23,It=E[40]<<18|E[41]>>>14,Ue=E[41]<<18|E[40]>>>14,ft=E[2]<<1|E[3]>>>31,mt=E[3]<<1|E[2]>>>31,_e=E[13]<<12|E[12]>>>20,Ie=E[12]<<12|E[13]>>>20,Pt=E[22]<<10|E[23]>>>22,Ye=E[23]<<10|E[22]>>>22,it=E[33]<<13|E[32]>>>19,ct=E[32]<<13|E[33]>>>19,li=E[42]<<2|E[43]>>>30,fr=E[43]<<2|E[42]>>>30,$i=E[5]<<30|E[4]>>>2,Mt=E[4]<<30|E[5]>>>2,Ar=E[14]<<6|E[15]>>>26,Et=E[15]<<6|E[14]>>>26,Le=E[25]<<11|E[24]>>>21,De=E[24]<<11|E[25]>>>21,Ve=E[34]<<15|E[35]>>>17,_t=E[35]<<15|E[34]>>>17,ut=E[45]<<29|E[44]>>>3,cr=E[44]<<29|E[45]>>>3,Je=E[6]<<28|E[7]>>>4,Ee=E[7]<<28|E[6]>>>4,Ot=E[17]<<23|E[16]>>>9,Yt=E[16]<<23|E[17]>>>9,ke=E[26]<<25|E[27]>>>7,xt=E[27]<<25|E[26]>>>7,xe=E[36]<<21|E[37]>>>11,qe=E[37]<<21|E[36]>>>11,Qe=E[47]<<24|E[46]>>>8,et=E[46]<<24|E[47]>>>8,Xe=E[8]<<27|E[9]>>>5,Nt=E[9]<<27|E[8]>>>5,Oe=E[18]<<20|E[19]>>>12,tt=E[19]<<20|E[18]>>>12,fi=E[29]<<7|E[28]>>>25,hi=E[28]<<7|E[29]>>>25,je=E[38]<<8|E[39]>>>24,We=E[39]<<8|E[38]>>>24,ye=E[48]<<14|E[49]>>>18,Se=E[49]<<14|E[48]>>>18,E[0]=Fe^~_e&Le,E[1]=He^~Ie&De,E[10]=Je^~Oe&Re,E[11]=Ee^~tt&Ce,E[20]=ft^~Ar&ke,E[21]=mt^~Et&xt,E[30]=Xe^~Ge&Pt,E[31]=Nt^~Ze&Ye,E[40]=$i^~Ot&fi,E[41]=Mt^~Yt&hi,E[2]=_e^~Le&xe,E[3]=Ie^~De&qe,E[12]=Oe^~Re&it,E[13]=tt^~Ce&ct,E[22]=Ar^~ke&je,E[23]=Et^~xt&We,E[32]=Ge^~Pt&Ve,E[33]=Ze^~Ye&_t,E[42]=Ot^~fi&ui,E[43]=Yt^~hi&di,E[4]=Le^~xe&ye,E[5]=De^~qe&Se,E[14]=Re^~it&ut,E[15]=Ce^~ct&cr,E[24]=ke^~je&It,E[25]=xt^~We&Ue,E[34]=Pt^~Ve&Qe,E[35]=Ye^~_t&et,E[44]=fi^~ui&li,E[45]=hi^~di&fr,E[6]=xe^~ye&Fe,E[7]=qe^~Se&He,E[16]=it^~ut&Je,E[17]=ct^~cr&Ee,E[26]=je^~It&ft,E[27]=We^~Ue&mt,E[36]=Ve^~Qe&Xe,E[37]=_t^~et&Nt,E[46]=ui^~li&$i,E[47]=di^~fr&Mt,E[8]=ye^~Fe&_e,E[9]=Se^~He&Ie,E[18]=ut^~Je&Oe,E[19]=cr^~Ee&tt,E[28]=It^~ft&Ar,E[29]=Ue^~mt&Et,E[38]=Qe^~Xe&Ge,E[39]=et^~Nt&Ze,E[48]=li^~$i&Ot,E[49]=fr^~Mt&Yt,E[0]^=F[j],E[1]^=F[j+1]};if(h)r.exports=_;else for(R=0;R<x.length;++R)s[x[R]]=_[x[R]]})()})(K1);var Ww=K1.exports;const Gw=qu(Ww),Vw="logger/5.7.0";let N0=!1,T0=!1;const Nc={debug:1,default:2,info:2,warning:3,error:4,off:5};let $0=Nc.default,jh=null;function Jw(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const F0=Jw();var mu;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(mu||(mu={}));var ki;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(ki||(ki={}));const L0="0123456789abcdef";class kt{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const i=e.toLowerCase();Nc[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!($0>Nc[i])&&console.log.apply(console,t)}debug(...e){this._log(kt.levels.DEBUG,e)}info(...e){this._log(kt.levels.INFO,e)}warn(...e){this._log(kt.levels.WARNING,e)}makeError(e,t,i){if(T0)return this.makeError("censored error",t,{});t||(t=kt.errors.UNKNOWN_ERROR),i||(i={});const s=[];Object.keys(i).forEach(u=>{const d=i[u];try{if(d instanceof Uint8Array){let g="";for(let y=0;y<d.length;y++)g+=L0[d[y]>>4],g+=L0[d[y]&15];s.push(u+"=Uint8Array(0x"+g+")")}else s.push(u+"="+JSON.stringify(d))}catch{s.push(u+"="+JSON.stringify(i[u].toString()))}}),s.push(`code=${t}`),s.push(`version=${this.version}`);const o=e;let f="";switch(t){case ki.NUMERIC_FAULT:{f="NUMERIC_FAULT";const u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":f+="-"+u;break;case"negative-power":case"negative-width":f+="-unsupported";break;case"unbound-bitwise-result":f+="-unbound-result";break}break}case ki.CALL_EXCEPTION:case ki.INSUFFICIENT_FUNDS:case ki.MISSING_NEW:case ki.NONCE_EXPIRED:case ki.REPLACEMENT_UNDERPRICED:case ki.TRANSACTION_REPLACED:case ki.UNPREDICTABLE_GAS_LIMIT:f=t;break}f&&(e+=" [ See: https://links.ethers.org/v5-errors-"+f+" ]"),s.length&&(e+=" ("+s.join(", ")+")");const h=new Error(e);return h.reason=o,h.code=t,Object.keys(i).forEach(function(u){h[u]=i[u]}),h}throwError(e,t,i){throw this.makeError(e,t,i)}throwArgumentError(e,t,i){return this.throwError(e,kt.errors.INVALID_ARGUMENT,{argument:t,value:i})}assert(e,t,i,s){e||this.throwError(t,i,s)}assertArgument(e,t,i,s){e||this.throwArgumentError(t,i,s)}checkNormalize(e){F0&&this.throwError("platform missing String.prototype.normalize",kt.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:F0})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,kt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,kt.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,i){i?i=": "+i:i="",e<t&&this.throwError("missing argument"+i,kt.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+i,kt.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",kt.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",kt.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",kt.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return jh||(jh=new kt(Vw)),jh}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",kt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),N0){if(!e)return;this.globalLogger().throwError("error censorship permanent",kt.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}T0=!!e,N0=!!t}static setLogLevel(e){const t=Nc[e.toLowerCase()];if(t==null){kt.globalLogger().warn("invalid log level - "+e);return}$0=t}static from(e){return new kt(e)}}kt.errors=ki;kt.levels=mu;const Yw="bytes/5.7.0",er=new kt(Yw);function H1(r){return!!r.toHexString}function fa(r){return r.slice||(r.slice=function(){const e=Array.prototype.slice.call(arguments);return fa(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}function Xw(r){return cn(r)&&!(r.length%2)||Hu(r)}function q0(r){return typeof r=="number"&&r==r&&r%1===0}function Hu(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!q0(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){const t=r[e];if(!q0(t)||t<0||t>=256)return!1}return!0}function nr(r,e){if(e||(e={}),typeof r=="number"){er.checkSafeUint53(r,"invalid arrayify value");const t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),fa(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),H1(r)&&(r=r.toHexString()),cn(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":er.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let s=0;s<t.length;s+=2)i.push(parseInt(t.substring(s,s+2),16));return fa(new Uint8Array(i))}return Hu(r)?fa(new Uint8Array(r)):er.throwArgumentError("invalid arrayify value","value",r)}function Zw(r){const e=r.map(s=>nr(s)),t=e.reduce((s,o)=>s+o.length,0),i=new Uint8Array(t);return e.reduce((s,o)=>(i.set(o,s),s+o.length),0),fa(i)}function Qw(r,e){r=nr(r),r.length>e&&er.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(r,e-r.length),fa(t)}function cn(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}const Wh="0123456789abcdef";function Vr(r,e){if(e||(e={}),typeof r=="number"){er.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=Wh[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),H1(r))return r.toHexString();if(cn(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":er.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(Hu(r)){let t="0x";for(let i=0;i<r.length;i++){let s=r[i];t+=Wh[(s&240)>>4]+Wh[s&15]}return t}return er.throwArgumentError("invalid hexlify value","value",r)}function e5(r){if(typeof r!="string")r=Vr(r);else if(!cn(r)||r.length%2)return null;return(r.length-2)/2}function U0(r,e,t){return typeof r!="string"?r=Vr(r):(!cn(r)||r.length%2)&&er.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}function ha(r,e){for(typeof r!="string"?r=Vr(r):cn(r)||er.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&er.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}function k1(r){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Xw(r)){let t=nr(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=Vr(t.slice(0,32)),e.s=Vr(t.slice(32,64))):t.length===65?(e.r=Vr(t.slice(0,32)),e.s=Vr(t.slice(32,64)),e.v=t[64]):er.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:er.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=Vr(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){const s=Qw(nr(e._vs),32);e._vs=Vr(s);const o=s[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&er.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),s[0]&=127;const f=Vr(s);e.s==null?e.s=f:e.s!==f&&er.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?er.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const s=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==s&&er.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!cn(e.r)?er.throwArgumentError("signature missing or invalid r","signature",r):e.r=ha(e.r,32),e.s==null||!cn(e.s)?er.throwArgumentError("signature missing or invalid s","signature",r):e.s=ha(e.s,32);const t=nr(e.s);t[0]>=128&&er.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);const i=Vr(t);e._vs&&(cn(e._vs)||er.throwArgumentError("signature invalid _vs","signature",r),e._vs=ha(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&er.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function ku(r){return"0x"+Gw.keccak_256(nr(r))}var t5=at.BN;function r5(r){return new t5(r,36).toString(16)}const i5="strings/5.7.0",n5=new kt(i5);var Hc;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(Hc||(Hc={}));var B0;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(B0||(B0={}));function Gh(r,e=Hc.current){e!=Hc.current&&(n5.checkNormalize(),r=r.normalize(e));let t=[];for(let i=0;i<r.length;i++){const s=r.charCodeAt(i);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){i++;const o=r.charCodeAt(i);if(i>=r.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const f=65536+((s&1023)<<10)+(o&1023);t.push(f>>18|240),t.push(f>>12&63|128),t.push(f>>6&63|128),t.push(f&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return nr(t)}const s5=`Ethereum Signed Message:
2
2
  `;function j1(r){return typeof r=="string"&&(r=Gh(r)),ku(Zw([Gh(s5),Gh(String(r.length)),r]))}const a5="address/5.7.0",Ya=new kt(a5);function z0(r){cn(r,20)||Ya.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const i=nr(ku(t));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(i[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const o5=9007199254740991;function c5(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const ju={};for(let r=0;r<10;r++)ju[String(r)]=String(r);for(let r=0;r<26;r++)ju[String.fromCharCode(65+r)]=String(10+r);const K0=Math.floor(c5(o5));function f5(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(i=>ju[i]).join("");for(;e.length>=K0;){let i=e.substring(0,K0);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function h5(r){let e=null;if(typeof r!="string"&&Ya.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=z0(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&Ya.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==f5(r)&&Ya.throwArgumentError("bad icap checksum","address",r),e=r5(r.substring(4));e.length<40;)e="0"+e;e=z0("0x"+e)}else Ya.throwArgumentError("invalid address","address",r);return e}globalThis&&globalThis.__awaiter;function Ha(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}function ga(r,e,t){return t={path:e,exports:{},require:function(i,s){return u5(i,s??t.path)}},r(t,t.exports),t.exports}function u5(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Wu=W1;function W1(r,e){if(!r)throw new Error(e||"Assertion failed")}W1.equal=function(e,t,i){if(e!=t)throw new Error(i||"Assertion failed: "+e+" != "+t)};var ji=ga(function(r,e){var t=e;function i(f,h){if(Array.isArray(f))return f.slice();if(!f)return[];var u=[];if(typeof f!="string"){for(var d=0;d<f.length;d++)u[d]=f[d]|0;return u}if(h==="hex"){f=f.replace(/[^a-z0-9]+/ig,""),f.length%2!==0&&(f="0"+f);for(var d=0;d<f.length;d+=2)u.push(parseInt(f[d]+f[d+1],16))}else for(var d=0;d<f.length;d++){var g=f.charCodeAt(d),y=g>>8,P=g&255;y?u.push(y,P):u.push(P)}return u}t.toArray=i;function s(f){return f.length===1?"0"+f:f}t.zero2=s;function o(f){for(var h="",u=0;u<f.length;u++)h+=s(f[u].toString(16));return h}t.toHex=o,t.encode=function(h,u){return u==="hex"?o(h):h}}),ai=ga(function(r,e){var t=e;t.assert=Wu,t.toArray=ji.toArray,t.zero2=ji.zero2,t.toHex=ji.toHex,t.encode=ji.encode;function i(u,d,g){var y=new Array(Math.max(u.bitLength(),g)+1);y.fill(0);for(var P=1<<d+1,S=u.clone(),A=0;A<y.length;A++){var F,V=S.andln(P-1);S.isOdd()?(V>(P>>1)-1?F=(P>>1)-V:F=V,S.isubn(F)):F=0,y[A]=F,S.iushrn(1)}return y}t.getNAF=i;function s(u,d){var g=[[],[]];u=u.clone(),d=d.clone();for(var y=0,P=0,S;u.cmpn(-y)>0||d.cmpn(-P)>0;){var A=u.andln(3)+y&3,F=d.andln(3)+P&3;A===3&&(A=-1),F===3&&(F=-1);var V;A&1?(S=u.andln(7)+y&7,(S===3||S===5)&&F===2?V=-A:V=A):V=0,g[0].push(V);var J;F&1?(S=d.andln(7)+P&7,(S===3||S===5)&&A===2?J=-F:J=F):J=0,g[1].push(J),2*y===V+1&&(y=1-y),2*P===J+1&&(P=1-P),u.iushrn(1),d.iushrn(1)}return g}t.getJSF=s;function o(u,d,g){var y="_"+d;u.prototype[d]=function(){return this[y]!==void 0?this[y]:this[y]=g.call(this)}}t.cachedProperty=o;function f(u){return typeof u=="string"?t.toArray(u,"hex"):u}t.parseBytes=f;function h(u){return new at(u,"hex","le")}t.intFromLE=h}),kc=ai.getNAF,d5=ai.getJSF,jc=ai.assert;function Yn(r,e){this.type=r,this.p=new at(e.p,16),this.red=e.prime?at.red(e.prime):at.mont(this.p),this.zero=new at(0).toRed(this.red),this.one=new at(1).toRed(this.red),this.two=new at(2).toRed(this.red),this.n=e.n&&new at(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Cs=Yn;Yn.prototype.point=function(){throw new Error("Not implemented")};Yn.prototype.validate=function(){throw new Error("Not implemented")};Yn.prototype._fixedNafMul=function(e,t){jc(e.precomputed);var i=e._getDoubles(),s=kc(t,1,this._bitLength),o=(1<<i.step+1)-(i.step%2===0?2:1);o/=3;var f=[],h,u;for(h=0;h<s.length;h+=i.step){u=0;for(var d=h+i.step-1;d>=h;d--)u=(u<<1)+s[d];f.push(u)}for(var g=this.jpoint(null,null,null),y=this.jpoint(null,null,null),P=o;P>0;P--){for(h=0;h<f.length;h++)u=f[h],u===P?y=y.mixedAdd(i.points[h]):u===-P&&(y=y.mixedAdd(i.points[h].neg()));g=g.add(y)}return g.toP()};Yn.prototype._wnafMul=function(e,t){var i=4,s=e._getNAFPoints(i);i=s.wnd;for(var o=s.points,f=kc(t,i,this._bitLength),h=this.jpoint(null,null,null),u=f.length-1;u>=0;u--){for(var d=0;u>=0&&f[u]===0;u--)d++;if(u>=0&&d++,h=h.dblp(d),u<0)break;var g=f[u];jc(g!==0),e.type==="affine"?g>0?h=h.mixedAdd(o[g-1>>1]):h=h.mixedAdd(o[-g-1>>1].neg()):g>0?h=h.add(o[g-1>>1]):h=h.add(o[-g-1>>1].neg())}return e.type==="affine"?h.toP():h};Yn.prototype._wnafMulAdd=function(e,t,i,s,o){var f=this._wnafT1,h=this._wnafT2,u=this._wnafT3,d=0,g,y,P;for(g=0;g<s;g++){P=t[g];var S=P._getNAFPoints(e);f[g]=S.wnd,h[g]=S.points}for(g=s-1;g>=1;g-=2){var A=g-1,F=g;if(f[A]!==1||f[F]!==1){u[A]=kc(i[A],f[A],this._bitLength),u[F]=kc(i[F],f[F],this._bitLength),d=Math.max(u[A].length,d),d=Math.max(u[F].length,d);continue}var V=[t[A],null,null,t[F]];t[A].y.cmp(t[F].y)===0?(V[1]=t[A].add(t[F]),V[2]=t[A].toJ().mixedAdd(t[F].neg())):t[A].y.cmp(t[F].y.redNeg())===0?(V[1]=t[A].toJ().mixedAdd(t[F]),V[2]=t[A].add(t[F].neg())):(V[1]=t[A].toJ().mixedAdd(t[F]),V[2]=t[A].toJ().mixedAdd(t[F].neg()));var J=[-3,-1,-5,-7,0,7,5,1,3],B=d5(i[A],i[F]);for(d=Math.max(B[0].length,d),u[A]=new Array(d),u[F]=new Array(d),y=0;y<d;y++){var Y=B[0][y]|0,L=B[1][y]|0;u[A][y]=J[(Y+1)*3+(L+1)],u[F][y]=0,h[A]=V}}var k=this.jpoint(null,null,null),W=this._wnafT4;for(g=d;g>=0;g--){for(var m=0;g>=0;){var N=!0;for(y=0;y<s;y++)W[y]=u[y][g]|0,W[y]!==0&&(N=!1);if(!N)break;m++,g--}if(g>=0&&m++,k=k.dblp(m),g<0)break;for(y=0;y<s;y++){var ne=W[y];ne!==0&&(ne>0?P=h[y][ne-1>>1]:ne<0&&(P=h[y][-ne-1>>1].neg()),P.type==="affine"?k=k.mixedAdd(P):k=k.add(P))}}for(g=0;g<s;g++)h[g]=null;return o?k:k.toP()};function Mi(r,e){this.curve=r,this.type=e,this.precomputed=null}Yn.BasePoint=Mi;Mi.prototype.eq=function(){throw new Error("Not implemented")};Mi.prototype.validate=function(){return this.curve.validate(this)};Yn.prototype.decodePoint=function(e,t){e=ai.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?jc(e[e.length-1]%2===0):e[0]===7&&jc(e[e.length-1]%2===1);var s=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return s}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")};Mi.prototype.encodeCompressed=function(e){return this.encode(e,!0)};Mi.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))};Mi.prototype.encode=function(e,t){return ai.encode(this._encode(t),e)};Mi.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this};Mi.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1};Mi.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],s=this,o=0;o<t;o+=e){for(var f=0;f<e;f++)s=s.dbl();i.push(s)}return{step:e,points:i}};Mi.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,s=i===1?null:this.dbl(),o=1;o<i;o++)t[o]=t[o-1].add(s);return{wnd:e,points:t}};Mi.prototype._getBeta=function(){return null};Mi.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var Gu=ga(function(r){typeof Object.create=="function"?r.exports=function(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(t,i){if(i){t.super_=i;var s=function(){};s.prototype=i.prototype,t.prototype=new s,t.prototype.constructor=t}}}),l5=ai.assert;function Oi(r){Cs.call(this,"short",r),this.a=new at(r.a,16).toRed(this.red),this.b=new at(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Gu(Oi,Cs);var p5=Oi;Oi.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new at(e.beta,16).toRed(this.red);else{var s=this._getEndoRoots(this.p);t=s[0].cmp(s[1])<0?s[0]:s[1],t=t.toRed(this.red)}if(e.lambda)i=new at(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))===0?i=o[0]:(i=o[1],l5(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var f;return e.basis?f=e.basis.map(function(h){return{a:new at(h.a,16),b:new at(h.b,16)}}):f=this._getEndoBasis(i),{beta:t,lambda:i,basis:f}}};Oi.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:at.mont(e),i=new at(2).toRed(t).redInvm(),s=i.redNeg(),o=new at(3).toRed(t).redNeg().redSqrt().redMul(i),f=s.redAdd(o).fromRed(),h=s.redSub(o).fromRed();return[f,h]};Oi.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,s=this.n.clone(),o=new at(1),f=new at(0),h=new at(0),u=new at(1),d,g,y,P,S,A,F,V=0,J,B;i.cmpn(0)!==0;){var Y=s.div(i);J=s.sub(Y.mul(i)),B=h.sub(Y.mul(o));var L=u.sub(Y.mul(f));if(!y&&J.cmp(t)<0)d=F.neg(),g=o,y=J.neg(),P=B;else if(y&&++V===2)break;F=J,s=i,i=J,h=o,o=B,u=f,f=L}S=J.neg(),A=B;var k=y.sqr().add(P.sqr()),W=S.sqr().add(A.sqr());return W.cmp(k)>=0&&(S=d,A=g),y.negative&&(y=y.neg(),P=P.neg()),S.negative&&(S=S.neg(),A=A.neg()),[{a:y,b:P},{a:S,b:A}]};Oi.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],s=t[1],o=s.b.mul(e).divRound(this.n),f=i.b.neg().mul(e).divRound(this.n),h=o.mul(i.a),u=f.mul(s.a),d=o.mul(i.b),g=f.mul(s.b),y=e.sub(h).sub(u),P=d.add(g).neg();return{k1:y,k2:P}};Oi.prototype.pointFromX=function(e,t){e=new at(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),s=i.redSqrt();if(s.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var o=s.fromRed().isOdd();return(t&&!o||!t&&o)&&(s=s.redNeg()),this.point(e,s)};Oi.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,s=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(s).redIAdd(this.b);return i.redSqr().redISub(o).cmpn(0)===0};Oi.prototype._endoWnafMulAdd=function(e,t,i){for(var s=this._endoWnafT1,o=this._endoWnafT2,f=0;f<e.length;f++){var h=this._endoSplit(t[f]),u=e[f],d=u._getBeta();h.k1.negative&&(h.k1.ineg(),u=u.neg(!0)),h.k2.negative&&(h.k2.ineg(),d=d.neg(!0)),s[f*2]=u,s[f*2+1]=d,o[f*2]=h.k1,o[f*2+1]=h.k2}for(var g=this._wnafMulAdd(1,s,o,f*2,i),y=0;y<f*2;y++)s[y]=null,o[y]=null;return g};function mr(r,e,t,i){Cs.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new at(e,16),this.y=new at(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Gu(mr,Cs.BasePoint);Oi.prototype.point=function(e,t,i){return new mr(this,e,t,i)};Oi.prototype.pointFromJSON=function(e,t){return mr.fromJSON(this,e,t)};mr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,s=function(o){return i.point(o.x.redMul(i.endo.beta),o.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(s)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(s)}}}return t}};mr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};mr.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var s=e.point(t[0],t[1],i);if(!t[2])return s;function o(h){return e.point(h[0],h[1],i)}var f=t[2];return s.precomputed={beta:null,doubles:f.doubles&&{step:f.doubles.step,points:[s].concat(f.doubles.points.map(o))},naf:f.naf&&{wnd:f.naf.wnd,points:[s].concat(f.naf.points.map(o))}},s};mr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};mr.prototype.isInfinity=function(){return this.inf};mr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),s=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,s)};mr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),s=e.redInvm(),o=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(s),f=o.redSqr().redISub(this.x.redAdd(this.x)),h=o.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,h)};mr.prototype.getX=function(){return this.x.fromRed()};mr.prototype.getY=function(){return this.y.fromRed()};mr.prototype.mul=function(e){return e=new at(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)};mr.prototype.mulAdd=function(e,t,i){var s=[this,t],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(s,o):this.curve._wnafMulAdd(1,s,o,2)};mr.prototype.jmulAdd=function(e,t,i){var s=[this,t],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(s,o,!0):this.curve._wnafMulAdd(1,s,o,2,!0)};mr.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)};mr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,s=function(o){return o.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(s)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(s)}}}return t};mr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Er(r,e,t,i){Cs.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new at(0)):(this.x=new at(e,16),this.y=new at(t,16),this.z=new at(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Gu(Er,Cs.BasePoint);Oi.prototype.jpoint=function(e,t,i){return new Er(this,e,t,i)};Er.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),s=this.y.redMul(t).redMul(e);return this.curve.point(i,s)};Er.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Er.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),s=this.x.redMul(t),o=e.x.redMul(i),f=this.y.redMul(t.redMul(e.z)),h=e.y.redMul(i.redMul(this.z)),u=s.redSub(o),d=f.redSub(h);if(u.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=u.redSqr(),y=g.redMul(u),P=s.redMul(g),S=d.redSqr().redIAdd(y).redISub(P).redISub(P),A=d.redMul(P.redISub(S)).redISub(f.redMul(y)),F=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(S,A,F)};Er.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,s=e.x.redMul(t),o=this.y,f=e.y.redMul(t).redMul(this.z),h=i.redSub(s),u=o.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=h.redSqr(),g=d.redMul(h),y=i.redMul(d),P=u.redSqr().redIAdd(g).redISub(y).redISub(y),S=u.redMul(y.redISub(P)).redISub(o.redMul(g)),A=this.z.redMul(h);return this.curve.jpoint(P,S,A)};Er.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var s=this.curve.a,o=this.curve.tinv,f=this.x,h=this.y,u=this.z,d=u.redSqr().redSqr(),g=h.redAdd(h);for(t=0;t<e;t++){var y=f.redSqr(),P=g.redSqr(),S=P.redSqr(),A=y.redAdd(y).redIAdd(y).redIAdd(s.redMul(d)),F=f.redMul(P),V=A.redSqr().redISub(F.redAdd(F)),J=F.redISub(V),B=A.redMul(J);B=B.redIAdd(B).redISub(S);var Y=g.redMul(u);t+1<e&&(d=d.redMul(S)),f=V,u=Y,g=B}return this.curve.jpoint(f,g.redMul(o),u)};Er.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Er.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var s=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(s).redISub(f);h=h.redIAdd(h);var u=s.redAdd(s).redIAdd(s),d=u.redSqr().redISub(h).redISub(h),g=f.redIAdd(f);g=g.redIAdd(g),g=g.redIAdd(g),e=d,t=u.redMul(h.redISub(d)).redISub(g),i=this.y.redAdd(this.y)}else{var y=this.x.redSqr(),P=this.y.redSqr(),S=P.redSqr(),A=this.x.redAdd(P).redSqr().redISub(y).redISub(S);A=A.redIAdd(A);var F=y.redAdd(y).redIAdd(y),V=F.redSqr(),J=S.redIAdd(S);J=J.redIAdd(J),J=J.redIAdd(J),e=V.redISub(A).redISub(A),t=F.redMul(A.redISub(e)).redISub(J),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)};Er.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var s=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(s).redISub(f);h=h.redIAdd(h);var u=s.redAdd(s).redIAdd(s).redIAdd(this.curve.a),d=u.redSqr().redISub(h).redISub(h);e=d;var g=f.redIAdd(f);g=g.redIAdd(g),g=g.redIAdd(g),t=u.redMul(h.redISub(d)).redISub(g),i=this.y.redAdd(this.y)}else{var y=this.z.redSqr(),P=this.y.redSqr(),S=this.x.redMul(P),A=this.x.redSub(y).redMul(this.x.redAdd(y));A=A.redAdd(A).redIAdd(A);var F=S.redIAdd(S);F=F.redIAdd(F);var V=F.redAdd(F);e=A.redSqr().redISub(V),i=this.y.redAdd(this.z).redSqr().redISub(P).redISub(y);var J=P.redSqr();J=J.redIAdd(J),J=J.redIAdd(J),J=J.redIAdd(J),t=A.redMul(F.redISub(e)).redISub(J)}return this.curve.jpoint(e,t,i)};Er.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,s=this.z,o=s.redSqr().redSqr(),f=t.redSqr(),h=i.redSqr(),u=f.redAdd(f).redIAdd(f).redIAdd(e.redMul(o)),d=t.redAdd(t);d=d.redIAdd(d);var g=d.redMul(h),y=u.redSqr().redISub(g.redAdd(g)),P=g.redISub(y),S=h.redSqr();S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var A=u.redMul(P).redISub(S),F=i.redAdd(i).redMul(s);return this.curve.jpoint(y,A,F)};Er.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),s=t.redSqr(),o=e.redAdd(e).redIAdd(e),f=o.redSqr(),h=this.x.redAdd(t).redSqr().redISub(e).redISub(s);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(f);var u=h.redSqr(),d=s.redIAdd(s);d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var g=o.redIAdd(h).redSqr().redISub(f).redISub(u).redISub(d),y=t.redMul(g);y=y.redIAdd(y),y=y.redIAdd(y);var P=this.x.redMul(u).redISub(y);P=P.redIAdd(P),P=P.redIAdd(P);var S=this.y.redMul(g.redMul(d.redISub(g)).redISub(h.redMul(u)));S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var A=this.z.redAdd(h).redSqr().redISub(i).redISub(u);return this.curve.jpoint(P,S,A)};Er.prototype.mul=function(e,t){return e=new at(e,t),this.curve._wnafMul(this,e)};Er.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var s=t.redMul(this.z),o=i.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(s)).cmpn(0)===0};Er.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var s=e.clone(),o=this.curve.redN.redMul(t);;){if(s.iadd(this.curve.n),s.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(o),this.x.cmp(i)===0)return!0}};Er.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Er.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Tc=ga(function(r,e){var t=e;t.base=Cs,t.short=p5,t.mont=null,t.edwards=null}),$c=ga(function(r,e){var t=e,i=ai.assert;function s(h){h.type==="short"?this.curve=new Tc.short(h):h.type==="edwards"?this.curve=new Tc.edwards(h):this.curve=new Tc.mont(h),this.g=this.curve.g,this.n=this.curve.n,this.hash=h.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=s;function o(h,u){Object.defineProperty(t,h,{configurable:!0,enumerable:!0,get:function(){var d=new s(u);return Object.defineProperty(t,h,{configurable:!0,enumerable:!0,value:d}),d}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:In.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:In.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:In.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:In.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:In.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:In.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:In.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var f;try{f=null.crash()}catch{f=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:In.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]})});function Jn(r){if(!(this instanceof Jn))return new Jn(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ji.toArray(r.entropy,r.entropyEnc||"hex"),t=ji.toArray(r.nonce,r.nonceEnc||"hex"),i=ji.toArray(r.pers,r.persEnc||"hex");Wu(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,i)}var G1=Jn;Jn.prototype._init=function(e,t,i){var s=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(s),this._reseed=1,this.reseedInterval=281474976710656};Jn.prototype._hmac=function(){return new In.hmac(this.hash,this.K)};Jn.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};Jn.prototype.reseed=function(e,t,i,s){typeof t!="string"&&(s=i,i=t,t=null),e=ji.toArray(e,t),i=ji.toArray(i,s),Wu(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};Jn.prototype.generate=function(e,t,i,s){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(s=i,i=t,t=null),i&&(i=ji.toArray(i,s||"hex"),this._update(i));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var f=o.slice(0,e);return this._update(i),this._reseed++,ji.encode(f,t)};var yu=ai.assert;function Or(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Vu=Or;Or.fromPublic=function(e,t,i){return t instanceof Or?t:new Or(e,{pub:t,pubEnc:i})};Or.fromPrivate=function(e,t,i){return t instanceof Or?t:new Or(e,{priv:t,privEnc:i})};Or.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Or.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub};Or.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Or.prototype._importPrivate=function(e,t){this.priv=new at(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)};Or.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?yu(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&yu(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)};Or.prototype.derive=function(e){return e.validate()||yu(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Or.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)};Or.prototype.verify=function(e,t){return this.ec.verify(e,t,this)};Or.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var g5=ai.assert;function cf(r,e){if(r instanceof cf)return r;this._importDER(r,e)||(g5(r.r&&r.s,"Signature without r or s"),this.r=new at(r.r,16),this.s=new at(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var ff=cf;function v5(){this.place=0}function Vh(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4)return!1;for(var s=0,o=0,f=e.place;o<i;o++,f++)s<<=8,s|=r[f],s>>>=0;return s<=127?!1:(e.place=f,s)}function H0(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}cf.prototype._importDER=function(e,t){e=ai.toArray(e,t);var i=new v5;if(e[i.place++]!==48)return!1;var s=Vh(e,i);if(s===!1||s+i.place!==e.length||e[i.place++]!==2)return!1;var o=Vh(e,i);if(o===!1)return!1;var f=e.slice(i.place,o+i.place);if(i.place+=o,e[i.place++]!==2)return!1;var h=Vh(e,i);if(h===!1||e.length!==h+i.place)return!1;var u=e.slice(i.place,h+i.place);if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;return this.r=new at(f),this.s=new at(u),this.recoveryParam=null,!0};function Jh(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}cf.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=H0(t),i=H0(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var s=[2];Jh(s,t.length),s=s.concat(t),s.push(2),Jh(s,i.length);var o=s.concat(i),f=[48];return Jh(f,o.length),f=f.concat(o),ai.encode(f,e)};var b5=function(){throw new Error("unsupported")},V1=ai.assert;function Ai(r){if(!(this instanceof Ai))return new Ai(r);typeof r=="string"&&(V1(Object.prototype.hasOwnProperty.call($c,r),"Unknown curve "+r),r=$c[r]),r instanceof $c.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var m5=Ai;Ai.prototype.keyPair=function(e){return new Vu(this,e)};Ai.prototype.keyFromPrivate=function(e,t){return Vu.fromPrivate(this,e,t)};Ai.prototype.keyFromPublic=function(e,t){return Vu.fromPublic(this,e,t)};Ai.prototype.genKeyPair=function(e){e||(e={});for(var t=new G1({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||b5(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),s=this.n.sub(new at(2));;){var o=new at(t.generate(i));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Ai.prototype._truncateToN=function(e,t){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};Ai.prototype.sign=function(e,t,i,s){typeof i=="object"&&(s=i,i=null),s||(s={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new at(e,16));for(var o=this.n.byteLength(),f=t.getPrivate().toArray("be",o),h=e.toArray("be",o),u=new G1({hash:this.hash,entropy:f,nonce:h,pers:s.pers,persEnc:s.persEnc||"utf8"}),d=this.n.sub(new at(1)),g=0;;g++){var y=s.k?s.k(g):new at(u.generate(this.n.byteLength()));if(y=this._truncateToN(y,!0),!(y.cmpn(1)<=0||y.cmp(d)>=0)){var P=this.g.mul(y);if(!P.isInfinity()){var S=P.getX(),A=S.umod(this.n);if(A.cmpn(0)!==0){var F=y.invm(this.n).mul(A.mul(t.getPrivate()).iadd(e));if(F=F.umod(this.n),F.cmpn(0)!==0){var V=(P.getY().isOdd()?1:0)|(S.cmp(A)!==0?2:0);return s.canonical&&F.cmp(this.nh)>0&&(F=this.n.sub(F),V^=1),new ff({r:A,s:F,recoveryParam:V})}}}}}};Ai.prototype.verify=function(e,t,i,s){e=this._truncateToN(new at(e,16)),i=this.keyFromPublic(i,s),t=new ff(t,"hex");var o=t.r,f=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;var h=f.invm(this.n),u=h.mul(e).umod(this.n),d=h.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(u,i.getPublic(),d),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(u,i.getPublic(),d),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)};Ai.prototype.recoverPubKey=function(r,e,t,i){V1((3&t)===t,"The recovery param is more than two bits"),e=new ff(e,i);var s=this.n,o=new at(r),f=e.r,h=e.s,u=t&1,d=t>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");d?f=this.curve.pointFromX(f.add(this.curve.n),u):f=this.curve.pointFromX(f,u);var g=e.r.invm(s),y=s.sub(o).mul(g).umod(s),P=h.mul(g).umod(s);return this.g.mulAdd(y,f,P)};Ai.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new ff(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var s=0;s<4;s++){var o;try{o=this.recoverPubKey(r,e,s)}catch{continue}if(o.eq(t))return s}throw new Error("Unable to find valid recovery factor")};var y5=ga(function(r,e){var t=e;t.version="6.5.4",t.utils=ai,t.rand=function(){throw new Error("unsupported")},t.curve=Tc,t.curves=$c,t.ec=m5,t.eddsa=null}),w5=y5.ec;const _5="signing-key/5.7.0",wu=new kt(_5);let Yh=null;function on(){return Yh||(Yh=new w5("secp256k1")),Yh}class E5{constructor(e){Ha(this,"curve","secp256k1"),Ha(this,"privateKey",Vr(e)),e5(this.privateKey)!==32&&wu.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=on().keyFromPrivate(nr(this.privateKey));Ha(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ha(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ha(this,"_isSigningKey",!0)}_addPoint(e){const t=on().keyFromPublic(nr(this.publicKey)),i=on().keyFromPublic(nr(e));return"0x"+t.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const t=on().keyFromPrivate(nr(this.privateKey)),i=nr(e);i.length!==32&&wu.throwArgumentError("bad digest length","digest",e);const s=t.sign(i,{canonical:!0});return k1({recoveryParam:s.recoveryParam,r:ha("0x"+s.r.toString(16),32),s:ha("0x"+s.s.toString(16),32)})}computeSharedSecret(e){const t=on().keyFromPrivate(nr(this.privateKey)),i=on().keyFromPublic(nr(J1(e)));return ha("0x"+t.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function x5(r,e){const t=k1(e),i={r:nr(t.r),s:nr(t.s)};return"0x"+on().recoverPubKey(nr(r),i,t.recoveryParam).encode("hex",!1)}function J1(r,e){const t=nr(r);if(t.length===32){const i=new E5(t);return e?"0x"+on().keyFromPrivate(t).getPublic(!0,"hex"):i.publicKey}else{if(t.length===33)return e?Vr(t):"0x"+on().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+on().keyFromPublic(t).getPublic(!0,"hex"):Vr(t)}return wu.throwArgumentError("invalid public or private key","key","[REDACTED]")}var k0;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(k0||(k0={}));function S5(r){const e=J1(r);return h5(U0(ku(U0(e,1)),12))}function I5(r,e){return S5(x5(nr(r),e))}var Ju={},hf={},ot={},Y1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(h,u){var d=h>>>16&65535,g=h&65535,y=u>>>16&65535,P=u&65535;return g*P+(d*P+g*y<<16>>>0)|0}r.mul=Math.imul||e;function t(h,u){return h+u|0}r.add=t;function i(h,u){return h-u|0}r.sub=i;function s(h,u){return h<<u|h>>>32-u}r.rotl=s;function o(h,u){return h<<32-u|h>>>u}r.rotr=o;function f(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h}r.isInteger=Number.isInteger||f,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(h){return r.isInteger(h)&&h>=-r.MAX_SAFE_INTEGER&&h<=r.MAX_SAFE_INTEGER}})(Y1);Object.defineProperty(ot,"__esModule",{value:!0});var X1=Y1;function A5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}ot.readInt16BE=A5;function P5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}ot.readUint16BE=P5;function D5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}ot.readInt16LE=D5;function M5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}ot.readUint16LE=M5;function Z1(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}ot.writeUint16BE=Z1;ot.writeInt16BE=Z1;function Q1(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}ot.writeUint16LE=Q1;ot.writeInt16LE=Q1;function _u(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}ot.readInt32BE=_u;function Eu(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}ot.readUint32BE=Eu;function xu(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}ot.readInt32LE=xu;function Su(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}ot.readUint32LE=Su;function Wc(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}ot.writeUint32BE=Wc;ot.writeInt32BE=Wc;function Gc(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}ot.writeUint32LE=Gc;ot.writeInt32LE=Gc;function O5(r,e){e===void 0&&(e=0);var t=_u(r,e),i=_u(r,e+4);return t*4294967296+i-(i>>31)*4294967296}ot.readInt64BE=O5;function R5(r,e){e===void 0&&(e=0);var t=Eu(r,e),i=Eu(r,e+4);return t*4294967296+i}ot.readUint64BE=R5;function C5(r,e){e===void 0&&(e=0);var t=xu(r,e),i=xu(r,e+4);return i*4294967296+t-(t>>31)*4294967296}ot.readInt64LE=C5;function N5(r,e){e===void 0&&(e=0);var t=Su(r,e),i=Su(r,e+4);return i*4294967296+t}ot.readUint64LE=N5;function eg(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Wc(r/4294967296>>>0,e,t),Wc(r>>>0,e,t+4),e}ot.writeUint64BE=eg;ot.writeInt64BE=eg;function tg(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Gc(r>>>0,e,t),Gc(r/4294967296>>>0,e,t+4),e}ot.writeUint64LE=tg;ot.writeInt64LE=tg;function T5(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,s=1,o=r/8+t-1;o>=t;o--)i+=e[o]*s,s*=256;return i}ot.readUintBE=T5;function $5(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,s=1,o=t;o<t+r/8;o++)i+=e[o]*s,s*=256;return i}ot.readUintLE=$5;function F5(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!X1.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var s=1,o=r/8+i-1;o>=i;o--)t[o]=e/s&255,s*=256;return t}ot.writeUintBE=F5;function L5(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!X1.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var s=1,o=i;o<i+r/8;o++)t[o]=e/s&255,s*=256;return t}ot.writeUintLE=L5;function q5(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}ot.readFloat32BE=q5;function U5(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}ot.readFloat32LE=U5;function B5(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}ot.readFloat64BE=B5;function z5(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}ot.readFloat64LE=z5;function K5(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r),e}ot.writeFloat32BE=K5;function H5(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r,!0),e}ot.writeFloat32LE=H5;function k5(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r),e}ot.writeFloat64BE=k5;function j5(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r,!0),e}ot.writeFloat64LE=j5;var oi={};Object.defineProperty(oi,"__esModule",{value:!0});function W5(r){for(var e=0;e<r.length;e++)r[e]=0;return r}oi.wipe=W5;Object.defineProperty(hf,"__esModule",{value:!0});var Mr=ot,Iu=oi,G5=20;function V5(r,e,t){for(var i=1634760805,s=857760878,o=2036477234,f=1797285236,h=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],d=t[11]<<24|t[10]<<16|t[9]<<8|t[8],g=t[15]<<24|t[14]<<16|t[13]<<8|t[12],y=t[19]<<24|t[18]<<16|t[17]<<8|t[16],P=t[23]<<24|t[22]<<16|t[21]<<8|t[20],S=t[27]<<24|t[26]<<16|t[25]<<8|t[24],A=t[31]<<24|t[30]<<16|t[29]<<8|t[28],F=e[3]<<24|e[2]<<16|e[1]<<8|e[0],V=e[7]<<24|e[6]<<16|e[5]<<8|e[4],J=e[11]<<24|e[10]<<16|e[9]<<8|e[8],B=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,L=s,k=o,W=f,m=h,N=u,ne=d,pe=g,q=y,l=P,w=S,_=A,x=F,R=V,$=J,T=B,D=0;D<G5;D+=2)Y=Y+m|0,x^=Y,x=x>>>32-16|x<<16,q=q+x|0,m^=q,m=m>>>32-12|m<<12,L=L+N|0,R^=L,R=R>>>32-16|R<<16,l=l+R|0,N^=l,N=N>>>32-12|N<<12,k=k+ne|0,$^=k,$=$>>>32-16|$<<16,w=w+$|0,ne^=w,ne=ne>>>32-12|ne<<12,W=W+pe|0,T^=W,T=T>>>32-16|T<<16,_=_+T|0,pe^=_,pe=pe>>>32-12|pe<<12,k=k+ne|0,$^=k,$=$>>>32-8|$<<8,w=w+$|0,ne^=w,ne=ne>>>32-7|ne<<7,W=W+pe|0,T^=W,T=T>>>32-8|T<<8,_=_+T|0,pe^=_,pe=pe>>>32-7|pe<<7,L=L+N|0,R^=L,R=R>>>32-8|R<<8,l=l+R|0,N^=l,N=N>>>32-7|N<<7,Y=Y+m|0,x^=Y,x=x>>>32-8|x<<8,q=q+x|0,m^=q,m=m>>>32-7|m<<7,Y=Y+N|0,T^=Y,T=T>>>32-16|T<<16,w=w+T|0,N^=w,N=N>>>32-12|N<<12,L=L+ne|0,x^=L,x=x>>>32-16|x<<16,_=_+x|0,ne^=_,ne=ne>>>32-12|ne<<12,k=k+pe|0,R^=k,R=R>>>32-16|R<<16,q=q+R|0,pe^=q,pe=pe>>>32-12|pe<<12,W=W+m|0,$^=W,$=$>>>32-16|$<<16,l=l+$|0,m^=l,m=m>>>32-12|m<<12,k=k+pe|0,R^=k,R=R>>>32-8|R<<8,q=q+R|0,pe^=q,pe=pe>>>32-7|pe<<7,W=W+m|0,$^=W,$=$>>>32-8|$<<8,l=l+$|0,m^=l,m=m>>>32-7|m<<7,L=L+ne|0,x^=L,x=x>>>32-8|x<<8,_=_+x|0,ne^=_,ne=ne>>>32-7|ne<<7,Y=Y+N|0,T^=Y,T=T>>>32-8|T<<8,w=w+T|0,N^=w,N=N>>>32-7|N<<7;Mr.writeUint32LE(Y+i|0,r,0),Mr.writeUint32LE(L+s|0,r,4),Mr.writeUint32LE(k+o|0,r,8),Mr.writeUint32LE(W+f|0,r,12),Mr.writeUint32LE(m+h|0,r,16),Mr.writeUint32LE(N+u|0,r,20),Mr.writeUint32LE(ne+d|0,r,24),Mr.writeUint32LE(pe+g|0,r,28),Mr.writeUint32LE(q+y|0,r,32),Mr.writeUint32LE(l+P|0,r,36),Mr.writeUint32LE(w+S|0,r,40),Mr.writeUint32LE(_+A|0,r,44),Mr.writeUint32LE(x+F|0,r,48),Mr.writeUint32LE(R+V|0,r,52),Mr.writeUint32LE($+J|0,r,56),Mr.writeUint32LE(T+B|0,r,60)}function rg(r,e,t,i,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var o,f;if(s===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");o=new Uint8Array(16),f=o.length-e.length,o.set(e,f)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");o=e,f=s}for(var h=new Uint8Array(64),u=0;u<t.length;u+=64){V5(h,o,r);for(var d=u;d<u+64&&d<t.length;d++)i[d]=t[d]^h[d-u];Y5(o,0,f)}return Iu.wipe(h),s===0&&Iu.wipe(o),i}hf.streamXOR=rg;function J5(r,e,t,i){return i===void 0&&(i=0),Iu.wipe(t),rg(r,e,t,t,i)}hf.stream=J5;function Y5(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var ig={},Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});function X5(r,e,t){return~(r-1)&e|r-1&t}Xn.select=X5;function Z5(r,e){return(r|0)-(e|0)-1>>>31&1}Xn.lessOrEqual=Z5;function ng(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}Xn.compare=ng;function Q5(r,e){return r.length===0||e.length===0?!1:ng(r,e)!==0}Xn.equal=Q5;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Xn,t=oi;r.DIGEST_LENGTH=16;var i=function(){function f(h){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var u=h[0]|h[1]<<8;this._r[0]=u&8191;var d=h[2]|h[3]<<8;this._r[1]=(u>>>13|d<<3)&8191;var g=h[4]|h[5]<<8;this._r[2]=(d>>>10|g<<6)&7939;var y=h[6]|h[7]<<8;this._r[3]=(g>>>7|y<<9)&8191;var P=h[8]|h[9]<<8;this._r[4]=(y>>>4|P<<12)&255,this._r[5]=P>>>1&8190;var S=h[10]|h[11]<<8;this._r[6]=(P>>>14|S<<2)&8191;var A=h[12]|h[13]<<8;this._r[7]=(S>>>11|A<<5)&8065;var F=h[14]|h[15]<<8;this._r[8]=(A>>>8|F<<8)&8191,this._r[9]=F>>>5&127,this._pad[0]=h[16]|h[17]<<8,this._pad[1]=h[18]|h[19]<<8,this._pad[2]=h[20]|h[21]<<8,this._pad[3]=h[22]|h[23]<<8,this._pad[4]=h[24]|h[25]<<8,this._pad[5]=h[26]|h[27]<<8,this._pad[6]=h[28]|h[29]<<8,this._pad[7]=h[30]|h[31]<<8}return f.prototype._blocks=function(h,u,d){for(var g=this._fin?0:2048,y=this._h[0],P=this._h[1],S=this._h[2],A=this._h[3],F=this._h[4],V=this._h[5],J=this._h[6],B=this._h[7],Y=this._h[8],L=this._h[9],k=this._r[0],W=this._r[1],m=this._r[2],N=this._r[3],ne=this._r[4],pe=this._r[5],q=this._r[6],l=this._r[7],w=this._r[8],_=this._r[9];d>=16;){var x=h[u+0]|h[u+1]<<8;y+=x&8191;var R=h[u+2]|h[u+3]<<8;P+=(x>>>13|R<<3)&8191;var $=h[u+4]|h[u+5]<<8;S+=(R>>>10|$<<6)&8191;var T=h[u+6]|h[u+7]<<8;A+=($>>>7|T<<9)&8191;var D=h[u+8]|h[u+9]<<8;F+=(T>>>4|D<<12)&8191,V+=D>>>1&8191;var p=h[u+10]|h[u+11]<<8;J+=(D>>>14|p<<2)&8191;var M=h[u+12]|h[u+13]<<8;B+=(p>>>11|M<<5)&8191;var ae=h[u+14]|h[u+15]<<8;Y+=(M>>>8|ae<<8)&8191,L+=ae>>>5|g;var ie=0,ue=ie;ue+=y*k,ue+=P*(5*_),ue+=S*(5*w),ue+=A*(5*l),ue+=F*(5*q),ie=ue>>>13,ue&=8191,ue+=V*(5*pe),ue+=J*(5*ne),ue+=B*(5*N),ue+=Y*(5*m),ue+=L*(5*W),ie+=ue>>>13,ue&=8191;var E=ie;E+=y*W,E+=P*k,E+=S*(5*_),E+=A*(5*w),E+=F*(5*l),ie=E>>>13,E&=8191,E+=V*(5*q),E+=J*(5*pe),E+=B*(5*ne),E+=Y*(5*N),E+=L*(5*m),ie+=E>>>13,E&=8191;var te=ie;te+=y*m,te+=P*W,te+=S*k,te+=A*(5*_),te+=F*(5*w),ie=te>>>13,te&=8191,te+=V*(5*l),te+=J*(5*q),te+=B*(5*pe),te+=Y*(5*ne),te+=L*(5*N),ie+=te>>>13,te&=8191;var U=ie;U+=y*N,U+=P*m,U+=S*W,U+=A*k,U+=F*(5*_),ie=U>>>13,U&=8191,U+=V*(5*w),U+=J*(5*l),U+=B*(5*q),U+=Y*(5*pe),U+=L*(5*ne),ie+=U>>>13,U&=8191;var j=ie;j+=y*ne,j+=P*N,j+=S*m,j+=A*W,j+=F*k,ie=j>>>13,j&=8191,j+=V*(5*_),j+=J*(5*w),j+=B*(5*l),j+=Y*(5*q),j+=L*(5*pe),ie+=j>>>13,j&=8191;var z=ie;z+=y*pe,z+=P*ne,z+=S*N,z+=A*m,z+=F*W,ie=z>>>13,z&=8191,z+=V*k,z+=J*(5*_),z+=B*(5*w),z+=Y*(5*l),z+=L*(5*q),ie+=z>>>13,z&=8191;var v=ie;v+=y*q,v+=P*pe,v+=S*ne,v+=A*N,v+=F*m,ie=v>>>13,v&=8191,v+=V*W,v+=J*k,v+=B*(5*_),v+=Y*(5*w),v+=L*(5*l),ie+=v>>>13,v&=8191;var K=ie;K+=y*l,K+=P*q,K+=S*pe,K+=A*ne,K+=F*N,ie=K>>>13,K&=8191,K+=V*m,K+=J*W,K+=B*k,K+=Y*(5*_),K+=L*(5*w),ie+=K>>>13,K&=8191;var re=ie;re+=y*w,re+=P*l,re+=S*q,re+=A*pe,re+=F*ne,ie=re>>>13,re&=8191,re+=V*N,re+=J*m,re+=B*W,re+=Y*k,re+=L*(5*_),ie+=re>>>13,re&=8191;var ce=ie;ce+=y*_,ce+=P*w,ce+=S*l,ce+=A*q,ce+=F*pe,ie=ce>>>13,ce&=8191,ce+=V*ne,ce+=J*N,ce+=B*m,ce+=Y*W,ce+=L*k,ie+=ce>>>13,ce&=8191,ie=(ie<<2)+ie|0,ie=ie+ue|0,ue=ie&8191,ie=ie>>>13,E+=ie,y=ue,P=E,S=te,A=U,F=j,V=z,J=v,B=K,Y=re,L=ce,u+=16,d-=16}this._h[0]=y,this._h[1]=P,this._h[2]=S,this._h[3]=A,this._h[4]=F,this._h[5]=V,this._h[6]=J,this._h[7]=B,this._h[8]=Y,this._h[9]=L},f.prototype.finish=function(h,u){u===void 0&&(u=0);var d=new Uint16Array(10),g,y,P,S;if(this._leftover){for(S=this._leftover,this._buffer[S++]=1;S<16;S++)this._buffer[S]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(g=this._h[1]>>>13,this._h[1]&=8191,S=2;S<10;S++)this._h[S]+=g,g=this._h[S]>>>13,this._h[S]&=8191;for(this._h[0]+=g*5,g=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=g,g=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=g,d[0]=this._h[0]+5,g=d[0]>>>13,d[0]&=8191,S=1;S<10;S++)d[S]=this._h[S]+g,g=d[S]>>>13,d[S]&=8191;for(d[9]-=8192,y=(g^1)-1,S=0;S<10;S++)d[S]&=y;for(y=~y,S=0;S<10;S++)this._h[S]=this._h[S]&y|d[S];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,P=this._h[0]+this._pad[0],this._h[0]=P&65535,S=1;S<8;S++)P=(this._h[S]+this._pad[S]|0)+(P>>>16)|0,this._h[S]=P&65535;return h[u+0]=this._h[0]>>>0,h[u+1]=this._h[0]>>>8,h[u+2]=this._h[1]>>>0,h[u+3]=this._h[1]>>>8,h[u+4]=this._h[2]>>>0,h[u+5]=this._h[2]>>>8,h[u+6]=this._h[3]>>>0,h[u+7]=this._h[3]>>>8,h[u+8]=this._h[4]>>>0,h[u+9]=this._h[4]>>>8,h[u+10]=this._h[5]>>>0,h[u+11]=this._h[5]>>>8,h[u+12]=this._h[6]>>>0,h[u+13]=this._h[6]>>>8,h[u+14]=this._h[7]>>>0,h[u+15]=this._h[7]>>>8,this._finished=!0,this},f.prototype.update=function(h){var u=0,d=h.length,g;if(this._leftover){g=16-this._leftover,g>d&&(g=d);for(var y=0;y<g;y++)this._buffer[this._leftover+y]=h[u+y];if(d-=g,u+=g,this._leftover+=g,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(g=d-d%16,this._blocks(h,u,g),u+=g,d-=g),d){for(var y=0;y<d;y++)this._buffer[this._leftover+y]=h[u+y];this._leftover+=d}return this},f.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var h=new Uint8Array(16);return this.finish(h),h},f.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},f}();r.Poly1305=i;function s(f,h){var u=new i(f);u.update(h);var d=u.digest();return u.clean(),d}r.oneTimeAuth=s;function o(f,h){return f.length!==r.DIGEST_LENGTH||h.length!==r.DIGEST_LENGTH?!1:e.equal(f,h)}r.equal=o})(ig);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=hf,t=ig,i=oi,s=ot,o=Xn;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var f=new Uint8Array(16),h=function(){function u(d){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,d.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(d)}return u.prototype.seal=function(d,g,y,P){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var S=new Uint8Array(16);S.set(d,S.length-d.length);var A=new Uint8Array(32);e.stream(this._key,S,A,4);var F=g.length+this.tagLength,V;if(P){if(P.length!==F)throw new Error("ChaCha20Poly1305: incorrect destination length");V=P}else V=new Uint8Array(F);return e.streamXOR(this._key,S,g,V,4),this._authenticate(V.subarray(V.length-this.tagLength,V.length),A,V.subarray(0,V.length-this.tagLength),y),i.wipe(S),V},u.prototype.open=function(d,g,y,P){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(g.length<this.tagLength)return null;var S=new Uint8Array(16);S.set(d,S.length-d.length);var A=new Uint8Array(32);e.stream(this._key,S,A,4);var F=new Uint8Array(this.tagLength);if(this._authenticate(F,A,g.subarray(0,g.length-this.tagLength),y),!o.equal(F,g.subarray(g.length-this.tagLength,g.length)))return null;var V=g.length-this.tagLength,J;if(P){if(P.length!==V)throw new Error("ChaCha20Poly1305: incorrect destination length");J=P}else J=new Uint8Array(V);return e.streamXOR(this._key,S,g.subarray(0,g.length-this.tagLength),J,4),i.wipe(S),J},u.prototype.clean=function(){return i.wipe(this._key),this},u.prototype._authenticate=function(d,g,y,P){var S=new t.Poly1305(g);P&&(S.update(P),P.length%16>0&&S.update(f.subarray(P.length%16))),S.update(y),y.length%16>0&&S.update(f.subarray(y.length%16));var A=new Uint8Array(8);P&&s.writeUint64LE(P.length,A),S.update(A),s.writeUint64LE(y.length,A),S.update(A);for(var F=S.digest(),V=0;V<F.length;V++)d[V]=F[V];S.clean(),i.wipe(F),i.wipe(A)},u}();r.ChaCha20Poly1305=h})(Ju);var sg={},ho={},Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});function e_(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Yu.isSerializableHash=e_;Object.defineProperty(ho,"__esModule",{value:!0});var tn=Yu,t_=Xn,r_=oi,ag=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var s=0;s<i.length;s++)i[s]^=54;this._inner.update(i);for(var s=0;s<i.length;s++)i[s]^=106;this._outer.update(i),tn.isSerializableHash(this._inner)&&tn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),r_.wipe(i)}return r.prototype.reset=function(){if(!tn.isSerializableHash(this._inner)||!tn.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){tn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),tn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!tn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!tn.isSerializableHash(this._inner)||!tn.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!tn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();ho.HMAC=ag;function i_(r,e,t){var i=new ag(r,e);i.update(t);var s=i.digest();return i.clean(),s}ho.hmac=i_;ho.equal=t_.equal;Object.defineProperty(sg,"__esModule",{value:!0});var j0=ho,W0=oi,n_=function(){function r(e,t,i,s){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=s;var o=j0.hmac(this._hash,i,t);this._hmac=new j0.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),W0.wipe(this._buffer),W0.wipe(this._counter),this._bufpos=0},r}(),s_=sg.HKDF=n_,Zn={},uf={},df={};Object.defineProperty(df,"__esModule",{value:!0});df.BrowserRandomSource=void 0;const G0=65536;class a_{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let i=0;i<t.length;i+=G0)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,G0)));return t}}df.BrowserRandomSource=a_;var lf={};Object.defineProperty(lf,"__esModule",{value:!0});lf.NodeRandomSource=void 0;const o_=oi;class c_{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof ew<"u"){const e=tw();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let s=0;s<i.length;s++)i[s]=t[s];return(0,o_.wipe)(t),i}}lf.NodeRandomSource=c_;Object.defineProperty(uf,"__esModule",{value:!0});uf.SystemRandomSource=void 0;const f_=df,h_=lf;class u_{constructor(){if(this.isAvailable=!1,this.name="",this._source=new f_.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new h_.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}uf.SystemRandomSource=u_;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=uf,t=ot,i=oi;r.defaultRandomSource=new e.SystemRandomSource;function s(d,g=r.defaultRandomSource){return g.randomBytes(d)}r.randomBytes=s;function o(d=r.defaultRandomSource){const g=s(4,d),y=(0,t.readUint32LE)(g);return(0,i.wipe)(g),y}r.randomUint32=o;const f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function h(d,g=f,y=r.defaultRandomSource){if(g.length<2)throw new Error("randomString charset is too short");if(g.length>256)throw new Error("randomString charset is too long");let P="";const S=g.length,A=256-256%S;for(;d>0;){const F=s(Math.ceil(d*256/A),y);for(let V=0;V<F.length&&d>0;V++){const J=F[V];J<A&&(P+=g.charAt(J%S),d--)}(0,i.wipe)(F)}return P}r.randomString=h;function u(d,g=f,y=r.defaultRandomSource){const P=Math.ceil(d/(Math.log(g.length)/Math.LN2));return h(P,g,y)}r.randomStringForEntropy=u})(Zn);var uo={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ot,t=oi;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function h(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},h.prototype.update=function(u,d){if(d===void 0&&(d=u.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var g=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&d>0;)this._buffer[this._bufferLength++]=u[g++],d--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(g=o(this._temp,this._state,u,g,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=u[g++],d--;return this},h.prototype.finish=function(u){if(!this._finished){var d=this._bytesHashed,g=this._bufferLength,y=d/536870912|0,P=d<<3,S=d%64<56?64:128;this._buffer[g]=128;for(var A=g+1;A<S-8;A++)this._buffer[A]=0;e.writeUint32BE(y,this._buffer,S-8),e.writeUint32BE(P,this._buffer,S-4),o(this._temp,this._state,this._buffer,0,S),this._finished=!0}for(var A=0;A<this.digestLength/4;A++)e.writeUint32BE(this._state[A],u,A*4);return this},h.prototype.digest=function(){var u=new Uint8Array(this.digestLength);return this.finish(u),u},h.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},h.prototype.restoreState=function(u){return this._state.set(u.state),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(u){t.wipe(u.state),u.buffer&&t.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},h}();r.SHA256=i;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function o(h,u,d,g,y){for(;y>=64;){for(var P=u[0],S=u[1],A=u[2],F=u[3],V=u[4],J=u[5],B=u[6],Y=u[7],L=0;L<16;L++){var k=g+L*4;h[L]=e.readUint32BE(d,k)}for(var L=16;L<64;L++){var W=h[L-2],m=(W>>>17|W<<32-17)^(W>>>19|W<<32-19)^W>>>10;W=h[L-15];var N=(W>>>7|W<<32-7)^(W>>>18|W<<32-18)^W>>>3;h[L]=(m+h[L-7]|0)+(N+h[L-16]|0)}for(var L=0;L<64;L++){var m=(((V>>>6|V<<26)^(V>>>11|V<<21)^(V>>>25|V<<7))+(V&J^~V&B)|0)+(Y+(s[L]+h[L]|0)|0)|0,N=((P>>>2|P<<32-2)^(P>>>13|P<<32-13)^(P>>>22|P<<32-22))+(P&S^P&A^S&A)|0;Y=B,B=J,J=V,V=F+m|0,F=A,A=S,S=P,P=m+N|0}u[0]+=P,u[1]+=S,u[2]+=A,u[3]+=F,u[4]+=V,u[5]+=J,u[6]+=B,u[7]+=Y,g+=64,y-=64}return g}function f(h){var u=new i;u.update(h);var d=u.digest();return u.clean(),d}r.hash=f})(uo);var Xu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=Zn,t=oi;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(L){const k=new Float64Array(16);if(L)for(let W=0;W<L.length;W++)k[W]=L[W];return k}const s=new Uint8Array(32);s[0]=9;const o=i([56129,1]);function f(L){let k=1;for(let W=0;W<16;W++){let m=L[W]+k+65535;k=Math.floor(m/65536),L[W]=m-k*65536}L[0]+=k-1+37*(k-1)}function h(L,k,W){const m=~(W-1);for(let N=0;N<16;N++){const ne=m&(L[N]^k[N]);L[N]^=ne,k[N]^=ne}}function u(L,k){const W=i(),m=i();for(let N=0;N<16;N++)m[N]=k[N];f(m),f(m),f(m);for(let N=0;N<2;N++){W[0]=m[0]-65517;for(let pe=1;pe<15;pe++)W[pe]=m[pe]-65535-(W[pe-1]>>16&1),W[pe-1]&=65535;W[15]=m[15]-32767-(W[14]>>16&1);const ne=W[15]>>16&1;W[14]&=65535,h(m,W,1-ne)}for(let N=0;N<16;N++)L[2*N]=m[N]&255,L[2*N+1]=m[N]>>8}function d(L,k){for(let W=0;W<16;W++)L[W]=k[2*W]+(k[2*W+1]<<8);L[15]&=32767}function g(L,k,W){for(let m=0;m<16;m++)L[m]=k[m]+W[m]}function y(L,k,W){for(let m=0;m<16;m++)L[m]=k[m]-W[m]}function P(L,k,W){let m,N,ne=0,pe=0,q=0,l=0,w=0,_=0,x=0,R=0,$=0,T=0,D=0,p=0,M=0,ae=0,ie=0,ue=0,E=0,te=0,U=0,j=0,z=0,v=0,K=0,re=0,ce=0,ge=0,ve=0,Me=0,Ke=0,$e=0,Fe=0,He=W[0],_e=W[1],Ie=W[2],Le=W[3],De=W[4],xe=W[5],qe=W[6],ye=W[7],Se=W[8],Je=W[9],Ee=W[10],Oe=W[11],tt=W[12],Re=W[13],Ce=W[14],it=W[15];m=k[0],ne+=m*He,pe+=m*_e,q+=m*Ie,l+=m*Le,w+=m*De,_+=m*xe,x+=m*qe,R+=m*ye,$+=m*Se,T+=m*Je,D+=m*Ee,p+=m*Oe,M+=m*tt,ae+=m*Re,ie+=m*Ce,ue+=m*it,m=k[1],pe+=m*He,q+=m*_e,l+=m*Ie,w+=m*Le,_+=m*De,x+=m*xe,R+=m*qe,$+=m*ye,T+=m*Se,D+=m*Je,p+=m*Ee,M+=m*Oe,ae+=m*tt,ie+=m*Re,ue+=m*Ce,E+=m*it,m=k[2],q+=m*He,l+=m*_e,w+=m*Ie,_+=m*Le,x+=m*De,R+=m*xe,$+=m*qe,T+=m*ye,D+=m*Se,p+=m*Je,M+=m*Ee,ae+=m*Oe,ie+=m*tt,ue+=m*Re,E+=m*Ce,te+=m*it,m=k[3],l+=m*He,w+=m*_e,_+=m*Ie,x+=m*Le,R+=m*De,$+=m*xe,T+=m*qe,D+=m*ye,p+=m*Se,M+=m*Je,ae+=m*Ee,ie+=m*Oe,ue+=m*tt,E+=m*Re,te+=m*Ce,U+=m*it,m=k[4],w+=m*He,_+=m*_e,x+=m*Ie,R+=m*Le,$+=m*De,T+=m*xe,D+=m*qe,p+=m*ye,M+=m*Se,ae+=m*Je,ie+=m*Ee,ue+=m*Oe,E+=m*tt,te+=m*Re,U+=m*Ce,j+=m*it,m=k[5],_+=m*He,x+=m*_e,R+=m*Ie,$+=m*Le,T+=m*De,D+=m*xe,p+=m*qe,M+=m*ye,ae+=m*Se,ie+=m*Je,ue+=m*Ee,E+=m*Oe,te+=m*tt,U+=m*Re,j+=m*Ce,z+=m*it,m=k[6],x+=m*He,R+=m*_e,$+=m*Ie,T+=m*Le,D+=m*De,p+=m*xe,M+=m*qe,ae+=m*ye,ie+=m*Se,ue+=m*Je,E+=m*Ee,te+=m*Oe,U+=m*tt,j+=m*Re,z+=m*Ce,v+=m*it,m=k[7],R+=m*He,$+=m*_e,T+=m*Ie,D+=m*Le,p+=m*De,M+=m*xe,ae+=m*qe,ie+=m*ye,ue+=m*Se,E+=m*Je,te+=m*Ee,U+=m*Oe,j+=m*tt,z+=m*Re,v+=m*Ce,K+=m*it,m=k[8],$+=m*He,T+=m*_e,D+=m*Ie,p+=m*Le,M+=m*De,ae+=m*xe,ie+=m*qe,ue+=m*ye,E+=m*Se,te+=m*Je,U+=m*Ee,j+=m*Oe,z+=m*tt,v+=m*Re,K+=m*Ce,re+=m*it,m=k[9],T+=m*He,D+=m*_e,p+=m*Ie,M+=m*Le,ae+=m*De,ie+=m*xe,ue+=m*qe,E+=m*ye,te+=m*Se,U+=m*Je,j+=m*Ee,z+=m*Oe,v+=m*tt,K+=m*Re,re+=m*Ce,ce+=m*it,m=k[10],D+=m*He,p+=m*_e,M+=m*Ie,ae+=m*Le,ie+=m*De,ue+=m*xe,E+=m*qe,te+=m*ye,U+=m*Se,j+=m*Je,z+=m*Ee,v+=m*Oe,K+=m*tt,re+=m*Re,ce+=m*Ce,ge+=m*it,m=k[11],p+=m*He,M+=m*_e,ae+=m*Ie,ie+=m*Le,ue+=m*De,E+=m*xe,te+=m*qe,U+=m*ye,j+=m*Se,z+=m*Je,v+=m*Ee,K+=m*Oe,re+=m*tt,ce+=m*Re,ge+=m*Ce,ve+=m*it,m=k[12],M+=m*He,ae+=m*_e,ie+=m*Ie,ue+=m*Le,E+=m*De,te+=m*xe,U+=m*qe,j+=m*ye,z+=m*Se,v+=m*Je,K+=m*Ee,re+=m*Oe,ce+=m*tt,ge+=m*Re,ve+=m*Ce,Me+=m*it,m=k[13],ae+=m*He,ie+=m*_e,ue+=m*Ie,E+=m*Le,te+=m*De,U+=m*xe,j+=m*qe,z+=m*ye,v+=m*Se,K+=m*Je,re+=m*Ee,ce+=m*Oe,ge+=m*tt,ve+=m*Re,Me+=m*Ce,Ke+=m*it,m=k[14],ie+=m*He,ue+=m*_e,E+=m*Ie,te+=m*Le,U+=m*De,j+=m*xe,z+=m*qe,v+=m*ye,K+=m*Se,re+=m*Je,ce+=m*Ee,ge+=m*Oe,ve+=m*tt,Me+=m*Re,Ke+=m*Ce,$e+=m*it,m=k[15],ue+=m*He,E+=m*_e,te+=m*Ie,U+=m*Le,j+=m*De,z+=m*xe,v+=m*qe,K+=m*ye,re+=m*Se,ce+=m*Je,ge+=m*Ee,ve+=m*Oe,Me+=m*tt,Ke+=m*Re,$e+=m*Ce,Fe+=m*it,ne+=38*E,pe+=38*te,q+=38*U,l+=38*j,w+=38*z,_+=38*v,x+=38*K,R+=38*re,$+=38*ce,T+=38*ge,D+=38*ve,p+=38*Me,M+=38*Ke,ae+=38*$e,ie+=38*Fe,N=1,m=ne+N+65535,N=Math.floor(m/65536),ne=m-N*65536,m=pe+N+65535,N=Math.floor(m/65536),pe=m-N*65536,m=q+N+65535,N=Math.floor(m/65536),q=m-N*65536,m=l+N+65535,N=Math.floor(m/65536),l=m-N*65536,m=w+N+65535,N=Math.floor(m/65536),w=m-N*65536,m=_+N+65535,N=Math.floor(m/65536),_=m-N*65536,m=x+N+65535,N=Math.floor(m/65536),x=m-N*65536,m=R+N+65535,N=Math.floor(m/65536),R=m-N*65536,m=$+N+65535,N=Math.floor(m/65536),$=m-N*65536,m=T+N+65535,N=Math.floor(m/65536),T=m-N*65536,m=D+N+65535,N=Math.floor(m/65536),D=m-N*65536,m=p+N+65535,N=Math.floor(m/65536),p=m-N*65536,m=M+N+65535,N=Math.floor(m/65536),M=m-N*65536,m=ae+N+65535,N=Math.floor(m/65536),ae=m-N*65536,m=ie+N+65535,N=Math.floor(m/65536),ie=m-N*65536,m=ue+N+65535,N=Math.floor(m/65536),ue=m-N*65536,ne+=N-1+37*(N-1),N=1,m=ne+N+65535,N=Math.floor(m/65536),ne=m-N*65536,m=pe+N+65535,N=Math.floor(m/65536),pe=m-N*65536,m=q+N+65535,N=Math.floor(m/65536),q=m-N*65536,m=l+N+65535,N=Math.floor(m/65536),l=m-N*65536,m=w+N+65535,N=Math.floor(m/65536),w=m-N*65536,m=_+N+65535,N=Math.floor(m/65536),_=m-N*65536,m=x+N+65535,N=Math.floor(m/65536),x=m-N*65536,m=R+N+65535,N=Math.floor(m/65536),R=m-N*65536,m=$+N+65535,N=Math.floor(m/65536),$=m-N*65536,m=T+N+65535,N=Math.floor(m/65536),T=m-N*65536,m=D+N+65535,N=Math.floor(m/65536),D=m-N*65536,m=p+N+65535,N=Math.floor(m/65536),p=m-N*65536,m=M+N+65535,N=Math.floor(m/65536),M=m-N*65536,m=ae+N+65535,N=Math.floor(m/65536),ae=m-N*65536,m=ie+N+65535,N=Math.floor(m/65536),ie=m-N*65536,m=ue+N+65535,N=Math.floor(m/65536),ue=m-N*65536,ne+=N-1+37*(N-1),L[0]=ne,L[1]=pe,L[2]=q,L[3]=l,L[4]=w,L[5]=_,L[6]=x,L[7]=R,L[8]=$,L[9]=T,L[10]=D,L[11]=p,L[12]=M,L[13]=ae,L[14]=ie,L[15]=ue}function S(L,k){P(L,k,k)}function A(L,k){const W=i();for(let m=0;m<16;m++)W[m]=k[m];for(let m=253;m>=0;m--)S(W,W),m!==2&&m!==4&&P(W,W,k);for(let m=0;m<16;m++)L[m]=W[m]}function F(L,k){const W=new Uint8Array(32),m=new Float64Array(80),N=i(),ne=i(),pe=i(),q=i(),l=i(),w=i();for(let $=0;$<31;$++)W[$]=L[$];W[31]=L[31]&127|64,W[0]&=248,d(m,k);for(let $=0;$<16;$++)ne[$]=m[$];N[0]=q[0]=1;for(let $=254;$>=0;--$){const T=W[$>>>3]>>>($&7)&1;h(N,ne,T),h(pe,q,T),g(l,N,pe),y(N,N,pe),g(pe,ne,q),y(ne,ne,q),S(q,l),S(w,N),P(N,pe,N),P(pe,ne,l),g(l,N,pe),y(N,N,pe),S(ne,N),y(pe,q,w),P(N,pe,o),g(N,N,q),P(pe,pe,N),P(N,q,w),P(q,ne,m),S(ne,l),h(N,ne,T),h(pe,q,T)}for(let $=0;$<16;$++)m[$+16]=N[$],m[$+32]=pe[$],m[$+48]=ne[$],m[$+64]=q[$];const _=m.subarray(32),x=m.subarray(16);A(_,_),P(x,x,_);const R=new Uint8Array(32);return u(R,x),R}r.scalarMult=F;function V(L){return F(L,s)}r.scalarMultBase=V;function J(L){if(L.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const k=new Uint8Array(L);return{publicKey:V(k),secretKey:k}}r.generateKeyPairFromSeed=J;function B(L){const k=(0,e.randomBytes)(32,L),W=J(k);return(0,t.wipe)(k),W}r.generateKeyPair=B;function Y(L,k,W=!1){if(L.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(k.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const m=F(L,k);if(W){let N=0;for(let ne=0;ne<m.length;ne++)N|=m[ne];if(N===0)throw new Error("X25519: invalid shared key")}return m}r.sharedKey=Y})(Xu);function og(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function Fc(r,e){e||(e=r.reduce((s,o)=>s+o.length,0));const t=og(e);let i=0;for(const s of r)t.set(s,i),i+=s.length;return t}function d_(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var s=0;s<r.length;s++){var o=r.charAt(s),f=o.charCodeAt(0);if(t[f]!==255)throw new TypeError(o+" is ambiguous");t[f]=s}var h=r.length,u=r.charAt(0),d=Math.log(h)/Math.log(256),g=Math.log(256)/Math.log(h);function y(A){if(A instanceof Uint8Array||(ArrayBuffer.isView(A)?A=new Uint8Array(A.buffer,A.byteOffset,A.byteLength):Array.isArray(A)&&(A=Uint8Array.from(A))),!(A instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(A.length===0)return"";for(var F=0,V=0,J=0,B=A.length;J!==B&&A[J]===0;)J++,F++;for(var Y=(B-J)*g+1>>>0,L=new Uint8Array(Y);J!==B;){for(var k=A[J],W=0,m=Y-1;(k!==0||W<V)&&m!==-1;m--,W++)k+=256*L[m]>>>0,L[m]=k%h>>>0,k=k/h>>>0;if(k!==0)throw new Error("Non-zero carry");V=W,J++}for(var N=Y-V;N!==Y&&L[N]===0;)N++;for(var ne=u.repeat(F);N<Y;++N)ne+=r.charAt(L[N]);return ne}function P(A){if(typeof A!="string")throw new TypeError("Expected String");if(A.length===0)return new Uint8Array;var F=0;if(A[F]!==" "){for(var V=0,J=0;A[F]===u;)V++,F++;for(var B=(A.length-F)*d+1>>>0,Y=new Uint8Array(B);A[F];){var L=t[A.charCodeAt(F)];if(L===255)return;for(var k=0,W=B-1;(L!==0||k<J)&&W!==-1;W--,k++)L+=h*Y[W]>>>0,Y[W]=L%256>>>0,L=L/256>>>0;if(L!==0)throw new Error("Non-zero carry");J=k,F++}if(A[F]!==" "){for(var m=B-J;m!==B&&Y[m]===0;)m++;for(var N=new Uint8Array(V+(B-m)),ne=V;m!==B;)N[ne++]=Y[m++];return N}}}function S(A){var F=P(A);if(F)return F;throw new Error(`Non-${e} character`)}return{encode:y,decodeUnsafe:P,decode:S}}var l_=d_,p_=l_;const g_=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},v_=r=>new TextEncoder().encode(r),b_=r=>new TextDecoder().decode(r);class m_{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class y_{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return cg(this,e)}}class w_{constructor(e){this.decoders=e}or(e){return cg(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const cg=(r,e)=>new w_({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class __{constructor(e,t,i,s){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=s,this.encoder=new m_(e,t,i),this.decoder=new y_(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pf=({name:r,prefix:e,encode:t,decode:i})=>new __(r,e,t,i),lo=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:s}=p_(t,e);return pf({prefix:r,name:e,encode:i,decode:o=>g_(s(o))})},E_=(r,e,t,i)=>{const s={};for(let g=0;g<e.length;++g)s[e[g]]=g;let o=r.length;for(;r[o-1]==="=";)--o;const f=new Uint8Array(o*t/8|0);let h=0,u=0,d=0;for(let g=0;g<o;++g){const y=s[r[g]];if(y===void 0)throw new SyntaxError(`Non-${i} character`);u=u<<t|y,h+=t,h>=8&&(h-=8,f[d++]=255&u>>h)}if(h>=t||255&u<<8-h)throw new SyntaxError("Unexpected end of data");return f},x_=(r,e,t)=>{const i=e[e.length-1]==="=",s=(1<<t)-1;let o="",f=0,h=0;for(let u=0;u<r.length;++u)for(h=h<<8|r[u],f+=8;f>t;)f-=t,o+=e[s&h>>f];if(f&&(o+=e[s&h<<t-f]),i)for(;o.length*t&7;)o+="=";return o},xr=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>pf({prefix:e,name:r,encode(s){return x_(s,i,t)},decode(s){return E_(s,i,t,r)}}),S_=pf({prefix:"\0",name:"identity",encode:r=>b_(r),decode:r=>v_(r)}),I_=Object.freeze(Object.defineProperty({__proto__:null,identity:S_},Symbol.toStringTag,{value:"Module"})),A_=xr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),P_=Object.freeze(Object.defineProperty({__proto__:null,base2:A_},Symbol.toStringTag,{value:"Module"})),D_=xr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),M_=Object.freeze(Object.defineProperty({__proto__:null,base8:D_},Symbol.toStringTag,{value:"Module"})),O_=lo({prefix:"9",name:"base10",alphabet:"0123456789"}),R_=Object.freeze(Object.defineProperty({__proto__:null,base10:O_},Symbol.toStringTag,{value:"Module"})),C_=xr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),N_=xr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),T_=Object.freeze(Object.defineProperty({__proto__:null,base16:C_,base16upper:N_},Symbol.toStringTag,{value:"Module"})),$_=xr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),F_=xr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),L_=xr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),q_=xr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),U_=xr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),B_=xr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),z_=xr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),K_=xr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),H_=xr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),k_=Object.freeze(Object.defineProperty({__proto__:null,base32:$_,base32hex:U_,base32hexpad:z_,base32hexpadupper:K_,base32hexupper:B_,base32pad:L_,base32padupper:q_,base32upper:F_,base32z:H_},Symbol.toStringTag,{value:"Module"})),j_=lo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),W_=lo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),G_=Object.freeze(Object.defineProperty({__proto__:null,base36:j_,base36upper:W_},Symbol.toStringTag,{value:"Module"})),V_=lo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),J_=lo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Y_=Object.freeze(Object.defineProperty({__proto__:null,base58btc:V_,base58flickr:J_},Symbol.toStringTag,{value:"Module"})),X_=xr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Z_=xr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Q_=xr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),e8=xr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),t8=Object.freeze(Object.defineProperty({__proto__:null,base64:X_,base64pad:Z_,base64url:Q_,base64urlpad:e8},Symbol.toStringTag,{value:"Module"})),fg=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),r8=fg.reduce((r,e,t)=>(r[t]=e,r),[]),i8=fg.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function n8(r){return r.reduce((e,t)=>(e+=r8[t],e),"")}function s8(r){const e=[];for(const t of r){const i=i8[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const a8=pf({prefix:"🚀",name:"base256emoji",encode:n8,decode:s8}),o8=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:a8},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const V0={...I_,...P_,...M_,...R_,...T_,...k_,...G_,...Y_,...t8,...o8};function hg(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const J0=hg("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Xh=hg("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=og(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),ug={utf8:J0,"utf-8":J0,hex:V0.base16,latin1:Xh,ascii:Xh,binary:Xh,...V0};function pr(r,e="utf8"){const t=ug[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}function gr(r,e="utf8"){const t=ug[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var dg={};const c8="elliptic",f8="6.6.0",h8="EC cryptography",u8="lib/elliptic.js",d8=["lib"],l8={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/"},p8={type:"git",url:"git@github.com:indutny/elliptic"},g8=["EC","Elliptic","curve","Cryptography"],v8="Fedor Indutny <fedor@indutny.com>",b8="MIT",m8={url:"https://github.com/indutny/elliptic/issues"},y8="https://github.com/indutny/elliptic",w8={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"},_8={"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"},E8={name:c8,version:f8,description:h8,main:u8,files:d8,scripts:l8,repository:p8,keywords:g8,author:v8,license:b8,bugs:m8,homepage:y8,devDependencies:w8,dependencies:_8};var ci={},Zu={exports:{}};Zu.exports;(function(r){(function(e,t){function i(q,l){if(!q)throw new Error(l||"Assertion failed")}function s(q,l){q.super_=l;var w=function(){};w.prototype=l.prototype,q.prototype=new w,q.prototype.constructor=q}function o(q,l,w){if(o.isBN(q))return q;this.negative=0,this.words=null,this.length=0,this.red=null,q!==null&&((l==="le"||l==="be")&&(w=l,l=10),this._init(q||0,l||10,w||"be"))}typeof e=="object"?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;var f;try{typeof window<"u"&&typeof window.Buffer<"u"?f=window.Buffer:f=rw.Buffer}catch{}o.isBN=function(l){return l instanceof o?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===o.wordSize&&Array.isArray(l.words)},o.max=function(l,w){return l.cmp(w)>0?l:w},o.min=function(l,w){return l.cmp(w)<0?l:w},o.prototype._init=function(l,w,_){if(typeof l=="number")return this._initNumber(l,w,_);if(typeof l=="object")return this._initArray(l,w,_);w==="hex"&&(w=16),i(w===(w|0)&&w>=2&&w<=36),l=l.toString().replace(/\s+/g,"");var x=0;l[0]==="-"&&(x++,this.negative=1),x<l.length&&(w===16?this._parseHex(l,x,_):(this._parseBase(l,w,x),_==="le"&&this._initArray(this.toArray(),w,_)))},o.prototype._initNumber=function(l,w,_){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(i(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),_==="le"&&this._initArray(this.toArray(),w,_)},o.prototype._initArray=function(l,w,_){if(i(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var R,$,T=0;if(_==="be")for(x=l.length-1,R=0;x>=0;x-=3)$=l[x]|l[x-1]<<8|l[x-2]<<16,this.words[R]|=$<<T&67108863,this.words[R+1]=$>>>26-T&67108863,T+=24,T>=26&&(T-=26,R++);else if(_==="le")for(x=0,R=0;x<l.length;x+=3)$=l[x]|l[x+1]<<8|l[x+2]<<16,this.words[R]|=$<<T&67108863,this.words[R+1]=$>>>26-T&67108863,T+=24,T>=26&&(T-=26,R++);return this.strip()};function h(q,l){var w=q.charCodeAt(l);return w>=65&&w<=70?w-55:w>=97&&w<=102?w-87:w-48&15}function u(q,l,w){var _=h(q,w);return w-1>=l&&(_|=h(q,w-1)<<4),_}o.prototype._parseHex=function(l,w,_){this.length=Math.ceil((l.length-w)/6),this.words=new Array(this.length);for(var x=0;x<this.length;x++)this.words[x]=0;var R=0,$=0,T;if(_==="be")for(x=l.length-1;x>=w;x-=2)T=u(l,w,x)<<R,this.words[$]|=T&67108863,R>=18?(R-=18,$+=1,this.words[$]|=T>>>26):R+=8;else{var D=l.length-w;for(x=D%2===0?w+1:w;x<l.length;x+=2)T=u(l,w,x)<<R,this.words[$]|=T&67108863,R>=18?(R-=18,$+=1,this.words[$]|=T>>>26):R+=8}this.strip()};function d(q,l,w,_){for(var x=0,R=Math.min(q.length,w),$=l;$<R;$++){var T=q.charCodeAt($)-48;x*=_,T>=49?x+=T-49+10:T>=17?x+=T-17+10:x+=T}return x}o.prototype._parseBase=function(l,w,_){this.words=[0],this.length=1;for(var x=0,R=1;R<=67108863;R*=w)x++;x--,R=R/w|0;for(var $=l.length-_,T=$%x,D=Math.min($,$-T)+_,p=0,M=_;M<D;M+=x)p=d(l,M,M+x,w),this.imuln(R),this.words[0]+p<67108864?this.words[0]+=p:this._iaddn(p);if(T!==0){var ae=1;for(p=d(l,M,l.length,w),M=0;M<T;M++)ae*=w;this.imuln(ae),this.words[0]+p<67108864?this.words[0]+=p:this._iaddn(p)}this.strip()},o.prototype.copy=function(l){l.words=new Array(this.length);for(var w=0;w<this.length;w++)l.words[w]=this.words[w];l.length=this.length,l.negative=this.negative,l.red=this.red},o.prototype.clone=function(){var l=new o(null);return this.copy(l),l},o.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var g=["","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"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(l,w){l=l||10,w=w|0||1;var _;if(l===16||l==="hex"){_="";for(var x=0,R=0,$=0;$<this.length;$++){var T=this.words[$],D=((T<<x|R)&16777215).toString(16);R=T>>>24-x&16777215,x+=2,x>=26&&(x-=26,$--),R!==0||$!==this.length-1?_=g[6-D.length]+D+_:_=D+_}for(R!==0&&(_=R.toString(16)+_);_.length%w!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}if(l===(l|0)&&l>=2&&l<=36){var p=y[l],M=P[l];_="";var ae=this.clone();for(ae.negative=0;!ae.isZero();){var ie=ae.modn(M).toString(l);ae=ae.idivn(M),ae.isZero()?_=ie+_:_=g[p-ie.length]+ie+_}for(this.isZero()&&(_="0"+_);_.length%w!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}i(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(l,w){return i(typeof f<"u"),this.toArrayLike(f,l,w)},o.prototype.toArray=function(l,w){return this.toArrayLike(Array,l,w)},o.prototype.toArrayLike=function(l,w,_){var x=this.byteLength(),R=_||Math.max(1,x);i(x<=R,"byte array longer than desired length"),i(R>0,"Requested array length <= 0"),this.strip();var $=w==="le",T=new l(R),D,p,M=this.clone();if($){for(p=0;!M.isZero();p++)D=M.andln(255),M.iushrn(8),T[p]=D;for(;p<R;p++)T[p]=0}else{for(p=0;p<R-x;p++)T[p]=0;for(p=0;!M.isZero();p++)D=M.andln(255),M.iushrn(8),T[R-p-1]=D}return T},Math.clz32?o.prototype._countBits=function(l){return 32-Math.clz32(l)}:o.prototype._countBits=function(l){var w=l,_=0;return w>=4096&&(_+=13,w>>>=13),w>=64&&(_+=7,w>>>=7),w>=8&&(_+=4,w>>>=4),w>=2&&(_+=2,w>>>=2),_+w},o.prototype._zeroBits=function(l){if(l===0)return 26;var w=l,_=0;return w&8191||(_+=13,w>>>=13),w&127||(_+=7,w>>>=7),w&15||(_+=4,w>>>=4),w&3||(_+=2,w>>>=2),w&1||_++,_},o.prototype.bitLength=function(){var l=this.words[this.length-1],w=this._countBits(l);return(this.length-1)*26+w};function S(q){for(var l=new Array(q.bitLength()),w=0;w<l.length;w++){var _=w/26|0,x=w%26;l[w]=(q.words[_]&1<<x)>>>x}return l}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,w=0;w<this.length;w++){var _=this._zeroBits(this.words[w]);if(l+=_,_!==26)break}return l},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},o.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var w=0;w<l.length;w++)this.words[w]=this.words[w]|l.words[w];return this.strip()},o.prototype.ior=function(l){return i((this.negative|l.negative)===0),this.iuor(l)},o.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},o.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},o.prototype.iuand=function(l){var w;this.length>l.length?w=l:w=this;for(var _=0;_<w.length;_++)this.words[_]=this.words[_]&l.words[_];return this.length=w.length,this.strip()},o.prototype.iand=function(l){return i((this.negative|l.negative)===0),this.iuand(l)},o.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},o.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},o.prototype.iuxor=function(l){var w,_;this.length>l.length?(w=this,_=l):(w=l,_=this);for(var x=0;x<_.length;x++)this.words[x]=w.words[x]^_.words[x];if(this!==w)for(;x<w.length;x++)this.words[x]=w.words[x];return this.length=w.length,this.strip()},o.prototype.ixor=function(l){return i((this.negative|l.negative)===0),this.iuxor(l)},o.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},o.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},o.prototype.inotn=function(l){i(typeof l=="number"&&l>=0);var w=Math.ceil(l/26)|0,_=l%26;this._expand(w),_>0&&w--;for(var x=0;x<w;x++)this.words[x]=~this.words[x]&67108863;return _>0&&(this.words[x]=~this.words[x]&67108863>>26-_),this.strip()},o.prototype.notn=function(l){return this.clone().inotn(l)},o.prototype.setn=function(l,w){i(typeof l=="number"&&l>=0);var _=l/26|0,x=l%26;return this._expand(_+1),w?this.words[_]=this.words[_]|1<<x:this.words[_]=this.words[_]&~(1<<x),this.strip()},o.prototype.iadd=function(l){var w;if(this.negative!==0&&l.negative===0)return this.negative=0,w=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,w=this.isub(l),l.negative=1,w._normSign();var _,x;this.length>l.length?(_=this,x=l):(_=l,x=this);for(var R=0,$=0;$<x.length;$++)w=(_.words[$]|0)+(x.words[$]|0)+R,this.words[$]=w&67108863,R=w>>>26;for(;R!==0&&$<_.length;$++)w=(_.words[$]|0)+R,this.words[$]=w&67108863,R=w>>>26;if(this.length=_.length,R!==0)this.words[this.length]=R,this.length++;else if(_!==this)for(;$<_.length;$++)this.words[$]=_.words[$];return this},o.prototype.add=function(l){var w;return l.negative!==0&&this.negative===0?(l.negative=0,w=this.sub(l),l.negative^=1,w):l.negative===0&&this.negative!==0?(this.negative=0,w=l.sub(this),this.negative=1,w):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},o.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var w=this.iadd(l);return l.negative=1,w._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var _=this.cmp(l);if(_===0)return this.negative=0,this.length=1,this.words[0]=0,this;var x,R;_>0?(x=this,R=l):(x=l,R=this);for(var $=0,T=0;T<R.length;T++)w=(x.words[T]|0)-(R.words[T]|0)+$,$=w>>26,this.words[T]=w&67108863;for(;$!==0&&T<x.length;T++)w=(x.words[T]|0)+$,$=w>>26,this.words[T]=w&67108863;if($===0&&T<x.length&&x!==this)for(;T<x.length;T++)this.words[T]=x.words[T];return this.length=Math.max(this.length,T),x!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(l){return this.clone().isub(l)};function A(q,l,w){w.negative=l.negative^q.negative;var _=q.length+l.length|0;w.length=_,_=_-1|0;var x=q.words[0]|0,R=l.words[0]|0,$=x*R,T=$&67108863,D=$/67108864|0;w.words[0]=T;for(var p=1;p<_;p++){for(var M=D>>>26,ae=D&67108863,ie=Math.min(p,l.length-1),ue=Math.max(0,p-q.length+1);ue<=ie;ue++){var E=p-ue|0;x=q.words[E]|0,R=l.words[ue]|0,$=x*R+ae,M+=$/67108864|0,ae=$&67108863}w.words[p]=ae|0,D=M|0}return D!==0?w.words[p]=D|0:w.length--,w.strip()}var F=function(l,w,_){var x=l.words,R=w.words,$=_.words,T=0,D,p,M,ae=x[0]|0,ie=ae&8191,ue=ae>>>13,E=x[1]|0,te=E&8191,U=E>>>13,j=x[2]|0,z=j&8191,v=j>>>13,K=x[3]|0,re=K&8191,ce=K>>>13,ge=x[4]|0,ve=ge&8191,Me=ge>>>13,Ke=x[5]|0,$e=Ke&8191,Fe=Ke>>>13,He=x[6]|0,_e=He&8191,Ie=He>>>13,Le=x[7]|0,De=Le&8191,xe=Le>>>13,qe=x[8]|0,ye=qe&8191,Se=qe>>>13,Je=x[9]|0,Ee=Je&8191,Oe=Je>>>13,tt=R[0]|0,Re=tt&8191,Ce=tt>>>13,it=R[1]|0,ct=it&8191,ut=it>>>13,cr=R[2]|0,ft=cr&8191,mt=cr>>>13,Ar=R[3]|0,Et=Ar&8191,ke=Ar>>>13,xt=R[4]|0,je=xt&8191,We=xt>>>13,It=R[5]|0,Ue=It&8191,Xe=It>>>13,Nt=R[6]|0,Ge=Nt&8191,Ze=Nt>>>13,Pt=R[7]|0,Ye=Pt&8191,Ve=Pt>>>13,_t=R[8]|0,Qe=_t&8191,et=_t>>>13,$i=R[9]|0,Mt=$i&8191,Ot=$i>>>13;_.negative=l.negative^w.negative,_.length=19,D=Math.imul(ie,Re),p=Math.imul(ie,Ce),p=p+Math.imul(ue,Re)|0,M=Math.imul(ue,Ce);var Yt=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,D=Math.imul(te,Re),p=Math.imul(te,Ce),p=p+Math.imul(U,Re)|0,M=Math.imul(U,Ce),D=D+Math.imul(ie,ct)|0,p=p+Math.imul(ie,ut)|0,p=p+Math.imul(ue,ct)|0,M=M+Math.imul(ue,ut)|0;var fi=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(fi>>>26)|0,fi&=67108863,D=Math.imul(z,Re),p=Math.imul(z,Ce),p=p+Math.imul(v,Re)|0,M=Math.imul(v,Ce),D=D+Math.imul(te,ct)|0,p=p+Math.imul(te,ut)|0,p=p+Math.imul(U,ct)|0,M=M+Math.imul(U,ut)|0,D=D+Math.imul(ie,ft)|0,p=p+Math.imul(ie,mt)|0,p=p+Math.imul(ue,ft)|0,M=M+Math.imul(ue,mt)|0;var hi=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(hi>>>26)|0,hi&=67108863,D=Math.imul(re,Re),p=Math.imul(re,Ce),p=p+Math.imul(ce,Re)|0,M=Math.imul(ce,Ce),D=D+Math.imul(z,ct)|0,p=p+Math.imul(z,ut)|0,p=p+Math.imul(v,ct)|0,M=M+Math.imul(v,ut)|0,D=D+Math.imul(te,ft)|0,p=p+Math.imul(te,mt)|0,p=p+Math.imul(U,ft)|0,M=M+Math.imul(U,mt)|0,D=D+Math.imul(ie,Et)|0,p=p+Math.imul(ie,ke)|0,p=p+Math.imul(ue,Et)|0,M=M+Math.imul(ue,ke)|0;var ui=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(ui>>>26)|0,ui&=67108863,D=Math.imul(ve,Re),p=Math.imul(ve,Ce),p=p+Math.imul(Me,Re)|0,M=Math.imul(Me,Ce),D=D+Math.imul(re,ct)|0,p=p+Math.imul(re,ut)|0,p=p+Math.imul(ce,ct)|0,M=M+Math.imul(ce,ut)|0,D=D+Math.imul(z,ft)|0,p=p+Math.imul(z,mt)|0,p=p+Math.imul(v,ft)|0,M=M+Math.imul(v,mt)|0,D=D+Math.imul(te,Et)|0,p=p+Math.imul(te,ke)|0,p=p+Math.imul(U,Et)|0,M=M+Math.imul(U,ke)|0,D=D+Math.imul(ie,je)|0,p=p+Math.imul(ie,We)|0,p=p+Math.imul(ue,je)|0,M=M+Math.imul(ue,We)|0;var di=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(di>>>26)|0,di&=67108863,D=Math.imul($e,Re),p=Math.imul($e,Ce),p=p+Math.imul(Fe,Re)|0,M=Math.imul(Fe,Ce),D=D+Math.imul(ve,ct)|0,p=p+Math.imul(ve,ut)|0,p=p+Math.imul(Me,ct)|0,M=M+Math.imul(Me,ut)|0,D=D+Math.imul(re,ft)|0,p=p+Math.imul(re,mt)|0,p=p+Math.imul(ce,ft)|0,M=M+Math.imul(ce,mt)|0,D=D+Math.imul(z,Et)|0,p=p+Math.imul(z,ke)|0,p=p+Math.imul(v,Et)|0,M=M+Math.imul(v,ke)|0,D=D+Math.imul(te,je)|0,p=p+Math.imul(te,We)|0,p=p+Math.imul(U,je)|0,M=M+Math.imul(U,We)|0,D=D+Math.imul(ie,Ue)|0,p=p+Math.imul(ie,Xe)|0,p=p+Math.imul(ue,Ue)|0,M=M+Math.imul(ue,Xe)|0;var li=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(li>>>26)|0,li&=67108863,D=Math.imul(_e,Re),p=Math.imul(_e,Ce),p=p+Math.imul(Ie,Re)|0,M=Math.imul(Ie,Ce),D=D+Math.imul($e,ct)|0,p=p+Math.imul($e,ut)|0,p=p+Math.imul(Fe,ct)|0,M=M+Math.imul(Fe,ut)|0,D=D+Math.imul(ve,ft)|0,p=p+Math.imul(ve,mt)|0,p=p+Math.imul(Me,ft)|0,M=M+Math.imul(Me,mt)|0,D=D+Math.imul(re,Et)|0,p=p+Math.imul(re,ke)|0,p=p+Math.imul(ce,Et)|0,M=M+Math.imul(ce,ke)|0,D=D+Math.imul(z,je)|0,p=p+Math.imul(z,We)|0,p=p+Math.imul(v,je)|0,M=M+Math.imul(v,We)|0,D=D+Math.imul(te,Ue)|0,p=p+Math.imul(te,Xe)|0,p=p+Math.imul(U,Ue)|0,M=M+Math.imul(U,Xe)|0,D=D+Math.imul(ie,Ge)|0,p=p+Math.imul(ie,Ze)|0,p=p+Math.imul(ue,Ge)|0,M=M+Math.imul(ue,Ze)|0;var fr=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(fr>>>26)|0,fr&=67108863,D=Math.imul(De,Re),p=Math.imul(De,Ce),p=p+Math.imul(xe,Re)|0,M=Math.imul(xe,Ce),D=D+Math.imul(_e,ct)|0,p=p+Math.imul(_e,ut)|0,p=p+Math.imul(Ie,ct)|0,M=M+Math.imul(Ie,ut)|0,D=D+Math.imul($e,ft)|0,p=p+Math.imul($e,mt)|0,p=p+Math.imul(Fe,ft)|0,M=M+Math.imul(Fe,mt)|0,D=D+Math.imul(ve,Et)|0,p=p+Math.imul(ve,ke)|0,p=p+Math.imul(Me,Et)|0,M=M+Math.imul(Me,ke)|0,D=D+Math.imul(re,je)|0,p=p+Math.imul(re,We)|0,p=p+Math.imul(ce,je)|0,M=M+Math.imul(ce,We)|0,D=D+Math.imul(z,Ue)|0,p=p+Math.imul(z,Xe)|0,p=p+Math.imul(v,Ue)|0,M=M+Math.imul(v,Xe)|0,D=D+Math.imul(te,Ge)|0,p=p+Math.imul(te,Ze)|0,p=p+Math.imul(U,Ge)|0,M=M+Math.imul(U,Ze)|0,D=D+Math.imul(ie,Ye)|0,p=p+Math.imul(ie,Ve)|0,p=p+Math.imul(ue,Ye)|0,M=M+Math.imul(ue,Ve)|0;var Gi=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,D=Math.imul(ye,Re),p=Math.imul(ye,Ce),p=p+Math.imul(Se,Re)|0,M=Math.imul(Se,Ce),D=D+Math.imul(De,ct)|0,p=p+Math.imul(De,ut)|0,p=p+Math.imul(xe,ct)|0,M=M+Math.imul(xe,ut)|0,D=D+Math.imul(_e,ft)|0,p=p+Math.imul(_e,mt)|0,p=p+Math.imul(Ie,ft)|0,M=M+Math.imul(Ie,mt)|0,D=D+Math.imul($e,Et)|0,p=p+Math.imul($e,ke)|0,p=p+Math.imul(Fe,Et)|0,M=M+Math.imul(Fe,ke)|0,D=D+Math.imul(ve,je)|0,p=p+Math.imul(ve,We)|0,p=p+Math.imul(Me,je)|0,M=M+Math.imul(Me,We)|0,D=D+Math.imul(re,Ue)|0,p=p+Math.imul(re,Xe)|0,p=p+Math.imul(ce,Ue)|0,M=M+Math.imul(ce,Xe)|0,D=D+Math.imul(z,Ge)|0,p=p+Math.imul(z,Ze)|0,p=p+Math.imul(v,Ge)|0,M=M+Math.imul(v,Ze)|0,D=D+Math.imul(te,Ye)|0,p=p+Math.imul(te,Ve)|0,p=p+Math.imul(U,Ye)|0,M=M+Math.imul(U,Ve)|0,D=D+Math.imul(ie,Qe)|0,p=p+Math.imul(ie,et)|0,p=p+Math.imul(ue,Qe)|0,M=M+Math.imul(ue,et)|0;var es=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(es>>>26)|0,es&=67108863,D=Math.imul(Ee,Re),p=Math.imul(Ee,Ce),p=p+Math.imul(Oe,Re)|0,M=Math.imul(Oe,Ce),D=D+Math.imul(ye,ct)|0,p=p+Math.imul(ye,ut)|0,p=p+Math.imul(Se,ct)|0,M=M+Math.imul(Se,ut)|0,D=D+Math.imul(De,ft)|0,p=p+Math.imul(De,mt)|0,p=p+Math.imul(xe,ft)|0,M=M+Math.imul(xe,mt)|0,D=D+Math.imul(_e,Et)|0,p=p+Math.imul(_e,ke)|0,p=p+Math.imul(Ie,Et)|0,M=M+Math.imul(Ie,ke)|0,D=D+Math.imul($e,je)|0,p=p+Math.imul($e,We)|0,p=p+Math.imul(Fe,je)|0,M=M+Math.imul(Fe,We)|0,D=D+Math.imul(ve,Ue)|0,p=p+Math.imul(ve,Xe)|0,p=p+Math.imul(Me,Ue)|0,M=M+Math.imul(Me,Xe)|0,D=D+Math.imul(re,Ge)|0,p=p+Math.imul(re,Ze)|0,p=p+Math.imul(ce,Ge)|0,M=M+Math.imul(ce,Ze)|0,D=D+Math.imul(z,Ye)|0,p=p+Math.imul(z,Ve)|0,p=p+Math.imul(v,Ye)|0,M=M+Math.imul(v,Ve)|0,D=D+Math.imul(te,Qe)|0,p=p+Math.imul(te,et)|0,p=p+Math.imul(U,Qe)|0,M=M+Math.imul(U,et)|0,D=D+Math.imul(ie,Mt)|0,p=p+Math.imul(ie,Ot)|0,p=p+Math.imul(ue,Mt)|0,M=M+Math.imul(ue,Ot)|0;var Vi=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(Vi>>>26)|0,Vi&=67108863,D=Math.imul(Ee,ct),p=Math.imul(Ee,ut),p=p+Math.imul(Oe,ct)|0,M=Math.imul(Oe,ut),D=D+Math.imul(ye,ft)|0,p=p+Math.imul(ye,mt)|0,p=p+Math.imul(Se,ft)|0,M=M+Math.imul(Se,mt)|0,D=D+Math.imul(De,Et)|0,p=p+Math.imul(De,ke)|0,p=p+Math.imul(xe,Et)|0,M=M+Math.imul(xe,ke)|0,D=D+Math.imul(_e,je)|0,p=p+Math.imul(_e,We)|0,p=p+Math.imul(Ie,je)|0,M=M+Math.imul(Ie,We)|0,D=D+Math.imul($e,Ue)|0,p=p+Math.imul($e,Xe)|0,p=p+Math.imul(Fe,Ue)|0,M=M+Math.imul(Fe,Xe)|0,D=D+Math.imul(ve,Ge)|0,p=p+Math.imul(ve,Ze)|0,p=p+Math.imul(Me,Ge)|0,M=M+Math.imul(Me,Ze)|0,D=D+Math.imul(re,Ye)|0,p=p+Math.imul(re,Ve)|0,p=p+Math.imul(ce,Ye)|0,M=M+Math.imul(ce,Ve)|0,D=D+Math.imul(z,Qe)|0,p=p+Math.imul(z,et)|0,p=p+Math.imul(v,Qe)|0,M=M+Math.imul(v,et)|0,D=D+Math.imul(te,Mt)|0,p=p+Math.imul(te,Ot)|0,p=p+Math.imul(U,Mt)|0,M=M+Math.imul(U,Ot)|0;var ts=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(ts>>>26)|0,ts&=67108863,D=Math.imul(Ee,ft),p=Math.imul(Ee,mt),p=p+Math.imul(Oe,ft)|0,M=Math.imul(Oe,mt),D=D+Math.imul(ye,Et)|0,p=p+Math.imul(ye,ke)|0,p=p+Math.imul(Se,Et)|0,M=M+Math.imul(Se,ke)|0,D=D+Math.imul(De,je)|0,p=p+Math.imul(De,We)|0,p=p+Math.imul(xe,je)|0,M=M+Math.imul(xe,We)|0,D=D+Math.imul(_e,Ue)|0,p=p+Math.imul(_e,Xe)|0,p=p+Math.imul(Ie,Ue)|0,M=M+Math.imul(Ie,Xe)|0,D=D+Math.imul($e,Ge)|0,p=p+Math.imul($e,Ze)|0,p=p+Math.imul(Fe,Ge)|0,M=M+Math.imul(Fe,Ze)|0,D=D+Math.imul(ve,Ye)|0,p=p+Math.imul(ve,Ve)|0,p=p+Math.imul(Me,Ye)|0,M=M+Math.imul(Me,Ve)|0,D=D+Math.imul(re,Qe)|0,p=p+Math.imul(re,et)|0,p=p+Math.imul(ce,Qe)|0,M=M+Math.imul(ce,et)|0,D=D+Math.imul(z,Mt)|0,p=p+Math.imul(z,Ot)|0,p=p+Math.imul(v,Mt)|0,M=M+Math.imul(v,Ot)|0;var rs=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(rs>>>26)|0,rs&=67108863,D=Math.imul(Ee,Et),p=Math.imul(Ee,ke),p=p+Math.imul(Oe,Et)|0,M=Math.imul(Oe,ke),D=D+Math.imul(ye,je)|0,p=p+Math.imul(ye,We)|0,p=p+Math.imul(Se,je)|0,M=M+Math.imul(Se,We)|0,D=D+Math.imul(De,Ue)|0,p=p+Math.imul(De,Xe)|0,p=p+Math.imul(xe,Ue)|0,M=M+Math.imul(xe,Xe)|0,D=D+Math.imul(_e,Ge)|0,p=p+Math.imul(_e,Ze)|0,p=p+Math.imul(Ie,Ge)|0,M=M+Math.imul(Ie,Ze)|0,D=D+Math.imul($e,Ye)|0,p=p+Math.imul($e,Ve)|0,p=p+Math.imul(Fe,Ye)|0,M=M+Math.imul(Fe,Ve)|0,D=D+Math.imul(ve,Qe)|0,p=p+Math.imul(ve,et)|0,p=p+Math.imul(Me,Qe)|0,M=M+Math.imul(Me,et)|0,D=D+Math.imul(re,Mt)|0,p=p+Math.imul(re,Ot)|0,p=p+Math.imul(ce,Mt)|0,M=M+Math.imul(ce,Ot)|0;var Ji=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(Ji>>>26)|0,Ji&=67108863,D=Math.imul(Ee,je),p=Math.imul(Ee,We),p=p+Math.imul(Oe,je)|0,M=Math.imul(Oe,We),D=D+Math.imul(ye,Ue)|0,p=p+Math.imul(ye,Xe)|0,p=p+Math.imul(Se,Ue)|0,M=M+Math.imul(Se,Xe)|0,D=D+Math.imul(De,Ge)|0,p=p+Math.imul(De,Ze)|0,p=p+Math.imul(xe,Ge)|0,M=M+Math.imul(xe,Ze)|0,D=D+Math.imul(_e,Ye)|0,p=p+Math.imul(_e,Ve)|0,p=p+Math.imul(Ie,Ye)|0,M=M+Math.imul(Ie,Ve)|0,D=D+Math.imul($e,Qe)|0,p=p+Math.imul($e,et)|0,p=p+Math.imul(Fe,Qe)|0,M=M+Math.imul(Fe,et)|0,D=D+Math.imul(ve,Mt)|0,p=p+Math.imul(ve,Ot)|0,p=p+Math.imul(Me,Mt)|0,M=M+Math.imul(Me,Ot)|0;var Nn=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,D=Math.imul(Ee,Ue),p=Math.imul(Ee,Xe),p=p+Math.imul(Oe,Ue)|0,M=Math.imul(Oe,Xe),D=D+Math.imul(ye,Ge)|0,p=p+Math.imul(ye,Ze)|0,p=p+Math.imul(Se,Ge)|0,M=M+Math.imul(Se,Ze)|0,D=D+Math.imul(De,Ye)|0,p=p+Math.imul(De,Ve)|0,p=p+Math.imul(xe,Ye)|0,M=M+Math.imul(xe,Ve)|0,D=D+Math.imul(_e,Qe)|0,p=p+Math.imul(_e,et)|0,p=p+Math.imul(Ie,Qe)|0,M=M+Math.imul(Ie,et)|0,D=D+Math.imul($e,Mt)|0,p=p+Math.imul($e,Ot)|0,p=p+Math.imul(Fe,Mt)|0,M=M+Math.imul(Fe,Ot)|0;var Tn=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,D=Math.imul(Ee,Ge),p=Math.imul(Ee,Ze),p=p+Math.imul(Oe,Ge)|0,M=Math.imul(Oe,Ze),D=D+Math.imul(ye,Ye)|0,p=p+Math.imul(ye,Ve)|0,p=p+Math.imul(Se,Ye)|0,M=M+Math.imul(Se,Ve)|0,D=D+Math.imul(De,Qe)|0,p=p+Math.imul(De,et)|0,p=p+Math.imul(xe,Qe)|0,M=M+Math.imul(xe,et)|0,D=D+Math.imul(_e,Mt)|0,p=p+Math.imul(_e,Ot)|0,p=p+Math.imul(Ie,Mt)|0,M=M+Math.imul(Ie,Ot)|0;var Cr=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(Cr>>>26)|0,Cr&=67108863,D=Math.imul(Ee,Ye),p=Math.imul(Ee,Ve),p=p+Math.imul(Oe,Ye)|0,M=Math.imul(Oe,Ve),D=D+Math.imul(ye,Qe)|0,p=p+Math.imul(ye,et)|0,p=p+Math.imul(Se,Qe)|0,M=M+Math.imul(Se,et)|0,D=D+Math.imul(De,Mt)|0,p=p+Math.imul(De,Ot)|0,p=p+Math.imul(xe,Mt)|0,M=M+Math.imul(xe,Ot)|0;var is=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(is>>>26)|0,is&=67108863,D=Math.imul(Ee,Qe),p=Math.imul(Ee,et),p=p+Math.imul(Oe,Qe)|0,M=Math.imul(Oe,et),D=D+Math.imul(ye,Mt)|0,p=p+Math.imul(ye,Ot)|0,p=p+Math.imul(Se,Mt)|0,M=M+Math.imul(Se,Ot)|0;var ns=(T+D|0)+((p&8191)<<13)|0;T=(M+(p>>>13)|0)+(ns>>>26)|0,ns&=67108863,D=Math.imul(Ee,Mt),p=Math.imul(Ee,Ot),p=p+Math.imul(Oe,Mt)|0,M=Math.imul(Oe,Ot);var ss=(T+D|0)+((p&8191)<<13)|0;return T=(M+(p>>>13)|0)+(ss>>>26)|0,ss&=67108863,$[0]=Yt,$[1]=fi,$[2]=hi,$[3]=ui,$[4]=di,$[5]=li,$[6]=fr,$[7]=Gi,$[8]=es,$[9]=Vi,$[10]=ts,$[11]=rs,$[12]=Ji,$[13]=Nn,$[14]=Tn,$[15]=Cr,$[16]=is,$[17]=ns,$[18]=ss,T!==0&&($[19]=T,_.length++),_};Math.imul||(F=A);function V(q,l,w){w.negative=l.negative^q.negative,w.length=q.length+l.length;for(var _=0,x=0,R=0;R<w.length-1;R++){var $=x;x=0;for(var T=_&67108863,D=Math.min(R,l.length-1),p=Math.max(0,R-q.length+1);p<=D;p++){var M=R-p,ae=q.words[M]|0,ie=l.words[p]|0,ue=ae*ie,E=ue&67108863;$=$+(ue/67108864|0)|0,E=E+T|0,T=E&67108863,$=$+(E>>>26)|0,x+=$>>>26,$&=67108863}w.words[R]=T,_=$,$=x}return _!==0?w.words[R]=_:w.length--,w.strip()}function J(q,l,w){var _=new B;return _.mulp(q,l,w)}o.prototype.mulTo=function(l,w){var _,x=this.length+l.length;return this.length===10&&l.length===10?_=F(this,l,w):x<63?_=A(this,l,w):x<1024?_=V(this,l,w):_=J(this,l,w),_};function B(q,l){this.x=q,this.y=l}B.prototype.makeRBT=function(l){for(var w=new Array(l),_=o.prototype._countBits(l)-1,x=0;x<l;x++)w[x]=this.revBin(x,_,l);return w},B.prototype.revBin=function(l,w,_){if(l===0||l===_-1)return l;for(var x=0,R=0;R<w;R++)x|=(l&1)<<w-R-1,l>>=1;return x},B.prototype.permute=function(l,w,_,x,R,$){for(var T=0;T<$;T++)x[T]=w[l[T]],R[T]=_[l[T]]},B.prototype.transform=function(l,w,_,x,R,$){this.permute($,l,w,_,x,R);for(var T=1;T<R;T<<=1)for(var D=T<<1,p=Math.cos(2*Math.PI/D),M=Math.sin(2*Math.PI/D),ae=0;ae<R;ae+=D)for(var ie=p,ue=M,E=0;E<T;E++){var te=_[ae+E],U=x[ae+E],j=_[ae+E+T],z=x[ae+E+T],v=ie*j-ue*z;z=ie*z+ue*j,j=v,_[ae+E]=te+j,x[ae+E]=U+z,_[ae+E+T]=te-j,x[ae+E+T]=U-z,E!==D&&(v=p*ie-M*ue,ue=p*ue+M*ie,ie=v)}},B.prototype.guessLen13b=function(l,w){var _=Math.max(w,l)|1,x=_&1,R=0;for(_=_/2|0;_;_=_>>>1)R++;return 1<<R+1+x},B.prototype.conjugate=function(l,w,_){if(!(_<=1))for(var x=0;x<_/2;x++){var R=l[x];l[x]=l[_-x-1],l[_-x-1]=R,R=w[x],w[x]=-w[_-x-1],w[_-x-1]=-R}},B.prototype.normalize13b=function(l,w){for(var _=0,x=0;x<w/2;x++){var R=Math.round(l[2*x+1]/w)*8192+Math.round(l[2*x]/w)+_;l[x]=R&67108863,R<67108864?_=0:_=R/67108864|0}return l},B.prototype.convert13b=function(l,w,_,x){for(var R=0,$=0;$<w;$++)R=R+(l[$]|0),_[2*$]=R&8191,R=R>>>13,_[2*$+1]=R&8191,R=R>>>13;for($=2*w;$<x;++$)_[$]=0;i(R===0),i((R&-8192)===0)},B.prototype.stub=function(l){for(var w=new Array(l),_=0;_<l;_++)w[_]=0;return w},B.prototype.mulp=function(l,w,_){var x=2*this.guessLen13b(l.length,w.length),R=this.makeRBT(x),$=this.stub(x),T=new Array(x),D=new Array(x),p=new Array(x),M=new Array(x),ae=new Array(x),ie=new Array(x),ue=_.words;ue.length=x,this.convert13b(l.words,l.length,T,x),this.convert13b(w.words,w.length,M,x),this.transform(T,$,D,p,x,R),this.transform(M,$,ae,ie,x,R);for(var E=0;E<x;E++){var te=D[E]*ae[E]-p[E]*ie[E];p[E]=D[E]*ie[E]+p[E]*ae[E],D[E]=te}return this.conjugate(D,p,x),this.transform(D,p,ue,$,x,R),this.conjugate(ue,$,x),this.normalize13b(ue,x),_.negative=l.negative^w.negative,_.length=l.length+w.length,_.strip()},o.prototype.mul=function(l){var w=new o(null);return w.words=new Array(this.length+l.length),this.mulTo(l,w)},o.prototype.mulf=function(l){var w=new o(null);return w.words=new Array(this.length+l.length),J(this,l,w)},o.prototype.imul=function(l){return this.clone().mulTo(l,this)},o.prototype.imuln=function(l){i(typeof l=="number"),i(l<67108864);for(var w=0,_=0;_<this.length;_++){var x=(this.words[_]|0)*l,R=(x&67108863)+(w&67108863);w>>=26,w+=x/67108864|0,w+=R>>>26,this.words[_]=R&67108863}return w!==0&&(this.words[_]=w,this.length++),this},o.prototype.muln=function(l){return this.clone().imuln(l)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(l){var w=S(l);if(w.length===0)return new o(1);for(var _=this,x=0;x<w.length&&w[x]===0;x++,_=_.sqr());if(++x<w.length)for(var R=_.sqr();x<w.length;x++,R=R.sqr())w[x]!==0&&(_=_.mul(R));return _},o.prototype.iushln=function(l){i(typeof l=="number"&&l>=0);var w=l%26,_=(l-w)/26,x=67108863>>>26-w<<26-w,R;if(w!==0){var $=0;for(R=0;R<this.length;R++){var T=this.words[R]&x,D=(this.words[R]|0)-T<<w;this.words[R]=D|$,$=T>>>26-w}$&&(this.words[R]=$,this.length++)}if(_!==0){for(R=this.length-1;R>=0;R--)this.words[R+_]=this.words[R];for(R=0;R<_;R++)this.words[R]=0;this.length+=_}return this.strip()},o.prototype.ishln=function(l){return i(this.negative===0),this.iushln(l)},o.prototype.iushrn=function(l,w,_){i(typeof l=="number"&&l>=0);var x;w?x=(w-w%26)/26:x=0;var R=l%26,$=Math.min((l-R)/26,this.length),T=67108863^67108863>>>R<<R,D=_;if(x-=$,x=Math.max(0,x),D){for(var p=0;p<$;p++)D.words[p]=this.words[p];D.length=$}if($!==0)if(this.length>$)for(this.length-=$,p=0;p<this.length;p++)this.words[p]=this.words[p+$];else this.words[0]=0,this.length=1;var M=0;for(p=this.length-1;p>=0&&(M!==0||p>=x);p--){var ae=this.words[p]|0;this.words[p]=M<<26-R|ae>>>R,M=ae&T}return D&&M!==0&&(D.words[D.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(l,w,_){return i(this.negative===0),this.iushrn(l,w,_)},o.prototype.shln=function(l){return this.clone().ishln(l)},o.prototype.ushln=function(l){return this.clone().iushln(l)},o.prototype.shrn=function(l){return this.clone().ishrn(l)},o.prototype.ushrn=function(l){return this.clone().iushrn(l)},o.prototype.testn=function(l){i(typeof l=="number"&&l>=0);var w=l%26,_=(l-w)/26,x=1<<w;if(this.length<=_)return!1;var R=this.words[_];return!!(R&x)},o.prototype.imaskn=function(l){i(typeof l=="number"&&l>=0);var w=l%26,_=(l-w)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=_)return this;if(w!==0&&_++,this.length=Math.min(_,this.length),w!==0){var x=67108863^67108863>>>w<<w;this.words[this.length-1]&=x}return this.strip()},o.prototype.maskn=function(l){return this.clone().imaskn(l)},o.prototype.iaddn=function(l){return i(typeof l=="number"),i(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},o.prototype._iaddn=function(l){this.words[0]+=l;for(var w=0;w<this.length&&this.words[w]>=67108864;w++)this.words[w]-=67108864,w===this.length-1?this.words[w+1]=1:this.words[w+1]++;return this.length=Math.max(this.length,w+1),this},o.prototype.isubn=function(l){if(i(typeof l=="number"),i(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var w=0;w<this.length&&this.words[w]<0;w++)this.words[w]+=67108864,this.words[w+1]-=1;return this.strip()},o.prototype.addn=function(l){return this.clone().iaddn(l)},o.prototype.subn=function(l){return this.clone().isubn(l)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(l,w,_){var x=l.length+_,R;this._expand(x);var $,T=0;for(R=0;R<l.length;R++){$=(this.words[R+_]|0)+T;var D=(l.words[R]|0)*w;$-=D&67108863,T=($>>26)-(D/67108864|0),this.words[R+_]=$&67108863}for(;R<this.length-_;R++)$=(this.words[R+_]|0)+T,T=$>>26,this.words[R+_]=$&67108863;if(T===0)return this.strip();for(i(T===-1),T=0,R=0;R<this.length;R++)$=-(this.words[R]|0)+T,T=$>>26,this.words[R]=$&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(l,w){var _=this.length-l.length,x=this.clone(),R=l,$=R.words[R.length-1]|0,T=this._countBits($);_=26-T,_!==0&&(R=R.ushln(_),x.iushln(_),$=R.words[R.length-1]|0);var D=x.length-R.length,p;if(w!=="mod"){p=new o(null),p.length=D+1,p.words=new Array(p.length);for(var M=0;M<p.length;M++)p.words[M]=0}var ae=x.clone()._ishlnsubmul(R,1,D);ae.negative===0&&(x=ae,p&&(p.words[D]=1));for(var ie=D-1;ie>=0;ie--){var ue=(x.words[R.length+ie]|0)*67108864+(x.words[R.length+ie-1]|0);for(ue=Math.min(ue/$|0,67108863),x._ishlnsubmul(R,ue,ie);x.negative!==0;)ue--,x.negative=0,x._ishlnsubmul(R,1,ie),x.isZero()||(x.negative^=1);p&&(p.words[ie]=ue)}return p&&p.strip(),x.strip(),w!=="div"&&_!==0&&x.iushrn(_),{div:p||null,mod:x}},o.prototype.divmod=function(l,w,_){if(i(!l.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var x,R,$;return this.negative!==0&&l.negative===0?($=this.neg().divmod(l,w),w!=="mod"&&(x=$.div.neg()),w!=="div"&&(R=$.mod.neg(),_&&R.negative!==0&&R.iadd(l)),{div:x,mod:R}):this.negative===0&&l.negative!==0?($=this.divmod(l.neg(),w),w!=="mod"&&(x=$.div.neg()),{div:x,mod:$.mod}):this.negative&l.negative?($=this.neg().divmod(l.neg(),w),w!=="div"&&(R=$.mod.neg(),_&&R.negative!==0&&R.isub(l)),{div:$.div,mod:R}):l.length>this.length||this.cmp(l)<0?{div:new o(0),mod:this}:l.length===1?w==="div"?{div:this.divn(l.words[0]),mod:null}:w==="mod"?{div:null,mod:new o(this.modn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new o(this.modn(l.words[0]))}:this._wordDiv(l,w)},o.prototype.div=function(l){return this.divmod(l,"div",!1).div},o.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},o.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},o.prototype.divRound=function(l){var w=this.divmod(l);if(w.mod.isZero())return w.div;var _=w.div.negative!==0?w.mod.isub(l):w.mod,x=l.ushrn(1),R=l.andln(1),$=_.cmp(x);return $<0||R===1&&$===0?w.div:w.div.negative!==0?w.div.isubn(1):w.div.iaddn(1)},o.prototype.modn=function(l){i(l<=67108863);for(var w=(1<<26)%l,_=0,x=this.length-1;x>=0;x--)_=(w*_+(this.words[x]|0))%l;return _},o.prototype.idivn=function(l){i(l<=67108863);for(var w=0,_=this.length-1;_>=0;_--){var x=(this.words[_]|0)+w*67108864;this.words[_]=x/l|0,w=x%l}return this.strip()},o.prototype.divn=function(l){return this.clone().idivn(l)},o.prototype.egcd=function(l){i(l.negative===0),i(!l.isZero());var w=this,_=l.clone();w.negative!==0?w=w.umod(l):w=w.clone();for(var x=new o(1),R=new o(0),$=new o(0),T=new o(1),D=0;w.isEven()&&_.isEven();)w.iushrn(1),_.iushrn(1),++D;for(var p=_.clone(),M=w.clone();!w.isZero();){for(var ae=0,ie=1;!(w.words[0]&ie)&&ae<26;++ae,ie<<=1);if(ae>0)for(w.iushrn(ae);ae-- >0;)(x.isOdd()||R.isOdd())&&(x.iadd(p),R.isub(M)),x.iushrn(1),R.iushrn(1);for(var ue=0,E=1;!(_.words[0]&E)&&ue<26;++ue,E<<=1);if(ue>0)for(_.iushrn(ue);ue-- >0;)($.isOdd()||T.isOdd())&&($.iadd(p),T.isub(M)),$.iushrn(1),T.iushrn(1);w.cmp(_)>=0?(w.isub(_),x.isub($),R.isub(T)):(_.isub(w),$.isub(x),T.isub(R))}return{a:$,b:T,gcd:_.iushln(D)}},o.prototype._invmp=function(l){i(l.negative===0),i(!l.isZero());var w=this,_=l.clone();w.negative!==0?w=w.umod(l):w=w.clone();for(var x=new o(1),R=new o(0),$=_.clone();w.cmpn(1)>0&&_.cmpn(1)>0;){for(var T=0,D=1;!(w.words[0]&D)&&T<26;++T,D<<=1);if(T>0)for(w.iushrn(T);T-- >0;)x.isOdd()&&x.iadd($),x.iushrn(1);for(var p=0,M=1;!(_.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(_.iushrn(p);p-- >0;)R.isOdd()&&R.iadd($),R.iushrn(1);w.cmp(_)>=0?(w.isub(_),x.isub(R)):(_.isub(w),R.isub(x))}var ae;return w.cmpn(1)===0?ae=x:ae=R,ae.cmpn(0)<0&&ae.iadd(l),ae},o.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var w=this.clone(),_=l.clone();w.negative=0,_.negative=0;for(var x=0;w.isEven()&&_.isEven();x++)w.iushrn(1),_.iushrn(1);do{for(;w.isEven();)w.iushrn(1);for(;_.isEven();)_.iushrn(1);var R=w.cmp(_);if(R<0){var $=w;w=_,_=$}else if(R===0||_.cmpn(1)===0)break;w.isub(_)}while(!0);return _.iushln(x)},o.prototype.invm=function(l){return this.egcd(l).a.umod(l)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(l){return this.words[0]&l},o.prototype.bincn=function(l){i(typeof l=="number");var w=l%26,_=(l-w)/26,x=1<<w;if(this.length<=_)return this._expand(_+1),this.words[_]|=x,this;for(var R=x,$=_;R!==0&&$<this.length;$++){var T=this.words[$]|0;T+=R,R=T>>>26,T&=67108863,this.words[$]=T}return R!==0&&(this.words[$]=R,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(l){var w=l<0;if(this.negative!==0&&!w)return-1;if(this.negative===0&&w)return 1;this.strip();var _;if(this.length>1)_=1;else{w&&(l=-l),i(l<=67108863,"Number is too big");var x=this.words[0]|0;_=x===l?0:x<l?-1:1}return this.negative!==0?-_|0:_},o.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var w=this.ucmp(l);return this.negative!==0?-w|0:w},o.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var w=0,_=this.length-1;_>=0;_--){var x=this.words[_]|0,R=l.words[_]|0;if(x!==R){x<R?w=-1:x>R&&(w=1);break}}return w},o.prototype.gtn=function(l){return this.cmpn(l)===1},o.prototype.gt=function(l){return this.cmp(l)===1},o.prototype.gten=function(l){return this.cmpn(l)>=0},o.prototype.gte=function(l){return this.cmp(l)>=0},o.prototype.ltn=function(l){return this.cmpn(l)===-1},o.prototype.lt=function(l){return this.cmp(l)===-1},o.prototype.lten=function(l){return this.cmpn(l)<=0},o.prototype.lte=function(l){return this.cmp(l)<=0},o.prototype.eqn=function(l){return this.cmpn(l)===0},o.prototype.eq=function(l){return this.cmp(l)===0},o.red=function(l){return new ne(l)},o.prototype.toRed=function(l){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(l){return this.red=l,this},o.prototype.forceRed=function(l){return i(!this.red,"Already a number in reduction context"),this._forceRed(l)},o.prototype.redAdd=function(l){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},o.prototype.redIAdd=function(l){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},o.prototype.redSub=function(l){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},o.prototype.redISub=function(l){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},o.prototype.redShl=function(l){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},o.prototype.redMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},o.prototype.redIMul=function(l){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(l){return i(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var Y={k256:null,p224:null,p192:null,p25519:null};function L(q,l){this.name=q,this.p=new o(l,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}L.prototype._tmp=function(){var l=new o(null);return l.words=new Array(Math.ceil(this.n/13)),l},L.prototype.ireduce=function(l){var w=l,_;do this.split(w,this.tmp),w=this.imulK(w),w=w.iadd(this.tmp),_=w.bitLength();while(_>this.n);var x=_<this.n?-1:w.ucmp(this.p);return x===0?(w.words[0]=0,w.length=1):x>0?w.isub(this.p):w.strip!==void 0?w.strip():w._strip(),w},L.prototype.split=function(l,w){l.iushrn(this.n,0,w)},L.prototype.imulK=function(l){return l.imul(this.k)};function k(){L.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(k,L),k.prototype.split=function(l,w){for(var _=4194303,x=Math.min(l.length,9),R=0;R<x;R++)w.words[R]=l.words[R];if(w.length=x,l.length<=9){l.words[0]=0,l.length=1;return}var $=l.words[9];for(w.words[w.length++]=$&_,R=10;R<l.length;R++){var T=l.words[R]|0;l.words[R-10]=(T&_)<<4|$>>>22,$=T}$>>>=22,l.words[R-10]=$,$===0&&l.length>10?l.length-=10:l.length-=9},k.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var w=0,_=0;_<l.length;_++){var x=l.words[_]|0;w+=x*977,l.words[_]=w&67108863,w=x*64+(w/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function W(){L.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(W,L);function m(){L.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(m,L);function N(){L.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(N,L),N.prototype.imulK=function(l){for(var w=0,_=0;_<l.length;_++){var x=(l.words[_]|0)*19+w,R=x&67108863;x>>>=26,l.words[_]=R,w=x}return w!==0&&(l.words[l.length++]=w),l},o._prime=function(l){if(Y[l])return Y[l];var w;if(l==="k256")w=new k;else if(l==="p224")w=new W;else if(l==="p192")w=new m;else if(l==="p25519")w=new N;else throw new Error("Unknown prime "+l);return Y[l]=w,w};function ne(q){if(typeof q=="string"){var l=o._prime(q);this.m=l.p,this.prime=l}else i(q.gtn(1),"modulus must be greater than 1"),this.m=q,this.prime=null}ne.prototype._verify1=function(l){i(l.negative===0,"red works only with positives"),i(l.red,"red works only with red numbers")},ne.prototype._verify2=function(l,w){i((l.negative|w.negative)===0,"red works only with positives"),i(l.red&&l.red===w.red,"red works only with red numbers")},ne.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):l.umod(this.m)._forceRed(this)},ne.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},ne.prototype.add=function(l,w){this._verify2(l,w);var _=l.add(w);return _.cmp(this.m)>=0&&_.isub(this.m),_._forceRed(this)},ne.prototype.iadd=function(l,w){this._verify2(l,w);var _=l.iadd(w);return _.cmp(this.m)>=0&&_.isub(this.m),_},ne.prototype.sub=function(l,w){this._verify2(l,w);var _=l.sub(w);return _.cmpn(0)<0&&_.iadd(this.m),_._forceRed(this)},ne.prototype.isub=function(l,w){this._verify2(l,w);var _=l.isub(w);return _.cmpn(0)<0&&_.iadd(this.m),_},ne.prototype.shl=function(l,w){return this._verify1(l),this.imod(l.ushln(w))},ne.prototype.imul=function(l,w){return this._verify2(l,w),this.imod(l.imul(w))},ne.prototype.mul=function(l,w){return this._verify2(l,w),this.imod(l.mul(w))},ne.prototype.isqr=function(l){return this.imul(l,l.clone())},ne.prototype.sqr=function(l){return this.mul(l,l)},ne.prototype.sqrt=function(l){if(l.isZero())return l.clone();var w=this.m.andln(3);if(i(w%2===1),w===3){var _=this.m.add(new o(1)).iushrn(2);return this.pow(l,_)}for(var x=this.m.subn(1),R=0;!x.isZero()&&x.andln(1)===0;)R++,x.iushrn(1);i(!x.isZero());var $=new o(1).toRed(this),T=$.redNeg(),D=this.m.subn(1).iushrn(1),p=this.m.bitLength();for(p=new o(2*p*p).toRed(this);this.pow(p,D).cmp(T)!==0;)p.redIAdd(T);for(var M=this.pow(p,x),ae=this.pow(l,x.addn(1).iushrn(1)),ie=this.pow(l,x),ue=R;ie.cmp($)!==0;){for(var E=ie,te=0;E.cmp($)!==0;te++)E=E.redSqr();i(te<ue);var U=this.pow(M,new o(1).iushln(ue-te-1));ae=ae.redMul(U),M=U.redSqr(),ie=ie.redMul(M),ue=te}return ae},ne.prototype.invm=function(l){var w=l._invmp(this.m);return w.negative!==0?(w.negative=0,this.imod(w).redNeg()):this.imod(w)},ne.prototype.pow=function(l,w){if(w.isZero())return new o(1).toRed(this);if(w.cmpn(1)===0)return l.clone();var _=4,x=new Array(1<<_);x[0]=new o(1).toRed(this),x[1]=l;for(var R=2;R<x.length;R++)x[R]=this.mul(x[R-1],l);var $=x[0],T=0,D=0,p=w.bitLength()%26;for(p===0&&(p=26),R=w.length-1;R>=0;R--){for(var M=w.words[R],ae=p-1;ae>=0;ae--){var ie=M>>ae&1;if($!==x[0]&&($=this.sqr($)),ie===0&&T===0){D=0;continue}T<<=1,T|=ie,D++,!(D!==_&&(R!==0||ae!==0))&&($=this.mul($,x[T]),D=0,T=0)}p=26}return $},ne.prototype.convertTo=function(l){var w=l.umod(this.m);return w===l?w.clone():w},ne.prototype.convertFrom=function(l){var w=l.clone();return w.red=null,w},o.mont=function(l){return new pe(l)};function pe(q){ne.call(this,q),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(pe,ne),pe.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},pe.prototype.convertFrom=function(l){var w=this.imod(l.mul(this.rinv));return w.red=null,w},pe.prototype.imul=function(l,w){if(l.isZero()||w.isZero())return l.words[0]=0,l.length=1,l;var _=l.imul(w),x=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=_.isub(x).iushrn(this.shift),$=R;return R.cmp(this.m)>=0?$=R.isub(this.m):R.cmpn(0)<0&&($=R.iadd(this.m)),$._forceRed(this)},pe.prototype.mul=function(l,w){if(l.isZero()||w.isZero())return new o(0)._forceRed(this);var _=l.mul(w),x=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=_.isub(x).iushrn(this.shift),$=R;return R.cmp(this.m)>=0?$=R.isub(this.m):R.cmpn(0)<0&&($=R.iadd(this.m)),$._forceRed(this)},pe.prototype.invm=function(l){var w=this.imod(l._invmp(this.m).mul(this.r2));return w._forceRed(this)}})(r,_r)})(Zu);var Cn=Zu.exports;(function(r){var e=r,t=Cn,i=iw,s=nw;e.assert=i,e.toArray=s.toArray,e.zero2=s.zero2,e.toHex=s.toHex,e.encode=s.encode;function o(g,y,P){var S=new Array(Math.max(g.bitLength(),P)+1),A;for(A=0;A<S.length;A+=1)S[A]=0;var F=1<<y+1,V=g.clone();for(A=0;A<S.length;A++){var J,B=V.andln(F-1);V.isOdd()?(B>(F>>1)-1?J=(F>>1)-B:J=B,V.isubn(J)):J=0,S[A]=J,V.iushrn(1)}return S}e.getNAF=o;function f(g,y){var P=[[],[]];g=g.clone(),y=y.clone();for(var S=0,A=0,F;g.cmpn(-S)>0||y.cmpn(-A)>0;){var V=g.andln(3)+S&3,J=y.andln(3)+A&3;V===3&&(V=-1),J===3&&(J=-1);var B;V&1?(F=g.andln(7)+S&7,(F===3||F===5)&&J===2?B=-V:B=V):B=0,P[0].push(B);var Y;J&1?(F=y.andln(7)+A&7,(F===3||F===5)&&V===2?Y=-J:Y=J):Y=0,P[1].push(Y),2*S===B+1&&(S=1-S),2*A===Y+1&&(A=1-A),g.iushrn(1),y.iushrn(1)}return P}e.getJSF=f;function h(g,y,P){var S="_"+y;g.prototype[y]=function(){return this[S]!==void 0?this[S]:this[S]=P.call(this)}}e.cachedProperty=h;function u(g){return typeof g=="string"?e.toArray(g,"hex"):g}e.parseBytes=u;function d(g){return new t(g,"hex","le")}e.intFromLE=d})(ci);var Qu={},_s=Cn,po=ci,Vc=po.getNAF,x8=po.getJSF,Jc=po.assert;function Qn(r,e){this.type=r,this.p=new _s(e.p,16),this.red=e.prime?_s.red(e.prime):_s.mont(this.p),this.zero=new _s(0).toRed(this.red),this.one=new _s(1).toRed(this.red),this.two=new _s(2).toRed(this.red),this.n=e.n&&new _s(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var gf=Qn;Qn.prototype.point=function(){throw new Error("Not implemented")};Qn.prototype.validate=function(){throw new Error("Not implemented")};Qn.prototype._fixedNafMul=function(e,t){Jc(e.precomputed);var i=e._getDoubles(),s=Vc(t,1,this._bitLength),o=(1<<i.step+1)-(i.step%2===0?2:1);o/=3;var f=[],h,u;for(h=0;h<s.length;h+=i.step){u=0;for(var d=h+i.step-1;d>=h;d--)u=(u<<1)+s[d];f.push(u)}for(var g=this.jpoint(null,null,null),y=this.jpoint(null,null,null),P=o;P>0;P--){for(h=0;h<f.length;h++)u=f[h],u===P?y=y.mixedAdd(i.points[h]):u===-P&&(y=y.mixedAdd(i.points[h].neg()));g=g.add(y)}return g.toP()};Qn.prototype._wnafMul=function(e,t){var i=4,s=e._getNAFPoints(i);i=s.wnd;for(var o=s.points,f=Vc(t,i,this._bitLength),h=this.jpoint(null,null,null),u=f.length-1;u>=0;u--){for(var d=0;u>=0&&f[u]===0;u--)d++;if(u>=0&&d++,h=h.dblp(d),u<0)break;var g=f[u];Jc(g!==0),e.type==="affine"?g>0?h=h.mixedAdd(o[g-1>>1]):h=h.mixedAdd(o[-g-1>>1].neg()):g>0?h=h.add(o[g-1>>1]):h=h.add(o[-g-1>>1].neg())}return e.type==="affine"?h.toP():h};Qn.prototype._wnafMulAdd=function(e,t,i,s,o){var f=this._wnafT1,h=this._wnafT2,u=this._wnafT3,d=0,g,y,P;for(g=0;g<s;g++){P=t[g];var S=P._getNAFPoints(e);f[g]=S.wnd,h[g]=S.points}for(g=s-1;g>=1;g-=2){var A=g-1,F=g;if(f[A]!==1||f[F]!==1){u[A]=Vc(i[A],f[A],this._bitLength),u[F]=Vc(i[F],f[F],this._bitLength),d=Math.max(u[A].length,d),d=Math.max(u[F].length,d);continue}var V=[t[A],null,null,t[F]];t[A].y.cmp(t[F].y)===0?(V[1]=t[A].add(t[F]),V[2]=t[A].toJ().mixedAdd(t[F].neg())):t[A].y.cmp(t[F].y.redNeg())===0?(V[1]=t[A].toJ().mixedAdd(t[F]),V[2]=t[A].add(t[F].neg())):(V[1]=t[A].toJ().mixedAdd(t[F]),V[2]=t[A].toJ().mixedAdd(t[F].neg()));var J=[-3,-1,-5,-7,0,7,5,1,3],B=x8(i[A],i[F]);for(d=Math.max(B[0].length,d),u[A]=new Array(d),u[F]=new Array(d),y=0;y<d;y++){var Y=B[0][y]|0,L=B[1][y]|0;u[A][y]=J[(Y+1)*3+(L+1)],u[F][y]=0,h[A]=V}}var k=this.jpoint(null,null,null),W=this._wnafT4;for(g=d;g>=0;g--){for(var m=0;g>=0;){var N=!0;for(y=0;y<s;y++)W[y]=u[y][g]|0,W[y]!==0&&(N=!1);if(!N)break;m++,g--}if(g>=0&&m++,k=k.dblp(m),g<0)break;for(y=0;y<s;y++){var ne=W[y];ne!==0&&(ne>0?P=h[y][ne-1>>1]:ne<0&&(P=h[y][-ne-1>>1].neg()),P.type==="affine"?k=k.mixedAdd(P):k=k.add(P))}}for(g=0;g<s;g++)h[g]=null;return o?k:k.toP()};function Ri(r,e){this.curve=r,this.type=e,this.precomputed=null}Qn.BasePoint=Ri;Ri.prototype.eq=function(){throw new Error("Not implemented")};Ri.prototype.validate=function(){return this.curve.validate(this)};Qn.prototype.decodePoint=function(e,t){e=po.toArray(e,t);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?Jc(e[e.length-1]%2===0):e[0]===7&&Jc(e[e.length-1]%2===1);var s=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return s}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")};Ri.prototype.encodeCompressed=function(e){return this.encode(e,!0)};Ri.prototype._encode=function(e){var t=this.curve.p.byteLength(),i=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",t))};Ri.prototype.encode=function(e,t){return po.encode(this._encode(t),e)};Ri.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this};Ri.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1};Ri.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],s=this,o=0;o<t;o+=e){for(var f=0;f<e;f++)s=s.dbl();i.push(s)}return{step:e,points:i}};Ri.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],i=(1<<e)-1,s=i===1?null:this.dbl(),o=1;o<i;o++)t[o]=t[o-1].add(s);return{wnd:e,points:t}};Ri.prototype._getBeta=function(){return null};Ri.prototype.dblp=function(e){for(var t=this,i=0;i<e;i++)t=t.dbl();return t};var S8=ci,Jt=Cn,ed=Uu,va=gf,I8=S8.assert;function Ci(r){va.call(this,"short",r),this.a=new Jt(r.a,16).toRed(this.red),this.b=new Jt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}ed(Ci,va);var A8=Ci;Ci.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,i;if(e.beta)t=new Jt(e.beta,16).toRed(this.red);else{var s=this._getEndoRoots(this.p);t=s[0].cmp(s[1])<0?s[0]:s[1],t=t.toRed(this.red)}if(e.lambda)i=new Jt(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))===0?i=o[0]:(i=o[1],I8(this.g.mul(i).x.cmp(this.g.x.redMul(t))===0))}var f;return e.basis?f=e.basis.map(function(h){return{a:new Jt(h.a,16),b:new Jt(h.b,16)}}):f=this._getEndoBasis(i),{beta:t,lambda:i,basis:f}}};Ci.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Jt.mont(e),i=new Jt(2).toRed(t).redInvm(),s=i.redNeg(),o=new Jt(3).toRed(t).redNeg().redSqrt().redMul(i),f=s.redAdd(o).fromRed(),h=s.redSub(o).fromRed();return[f,h]};Ci.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,s=this.n.clone(),o=new Jt(1),f=new Jt(0),h=new Jt(0),u=new Jt(1),d,g,y,P,S,A,F,V=0,J,B;i.cmpn(0)!==0;){var Y=s.div(i);J=s.sub(Y.mul(i)),B=h.sub(Y.mul(o));var L=u.sub(Y.mul(f));if(!y&&J.cmp(t)<0)d=F.neg(),g=o,y=J.neg(),P=B;else if(y&&++V===2)break;F=J,s=i,i=J,h=o,o=B,u=f,f=L}S=J.neg(),A=B;var k=y.sqr().add(P.sqr()),W=S.sqr().add(A.sqr());return W.cmp(k)>=0&&(S=d,A=g),y.negative&&(y=y.neg(),P=P.neg()),S.negative&&(S=S.neg(),A=A.neg()),[{a:y,b:P},{a:S,b:A}]};Ci.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],s=t[1],o=s.b.mul(e).divRound(this.n),f=i.b.neg().mul(e).divRound(this.n),h=o.mul(i.a),u=f.mul(s.a),d=o.mul(i.b),g=f.mul(s.b),y=e.sub(h).sub(u),P=d.add(g).neg();return{k1:y,k2:P}};Ci.prototype.pointFromX=function(e,t){e=new Jt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),s=i.redSqrt();if(s.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var o=s.fromRed().isOdd();return(t&&!o||!t&&o)&&(s=s.redNeg()),this.point(e,s)};Ci.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,s=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(s).redIAdd(this.b);return i.redSqr().redISub(o).cmpn(0)===0};Ci.prototype._endoWnafMulAdd=function(e,t,i){for(var s=this._endoWnafT1,o=this._endoWnafT2,f=0;f<e.length;f++){var h=this._endoSplit(t[f]),u=e[f],d=u._getBeta();h.k1.negative&&(h.k1.ineg(),u=u.neg(!0)),h.k2.negative&&(h.k2.ineg(),d=d.neg(!0)),s[f*2]=u,s[f*2+1]=d,o[f*2]=h.k1,o[f*2+1]=h.k2}for(var g=this._wnafMulAdd(1,s,o,f*2,i),y=0;y<f*2;y++)s[y]=null,o[y]=null;return g};function yr(r,e,t,i){va.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Jt(e,16),this.y=new Jt(t,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}ed(yr,va.BasePoint);Ci.prototype.point=function(e,t,i){return new yr(this,e,t,i)};Ci.prototype.pointFromJSON=function(e,t){return yr.fromJSON(this,e,t)};yr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,s=function(o){return i.point(o.x.redMul(i.endo.beta),o.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(s)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(s)}}}return t}};yr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};yr.fromJSON=function(e,t,i){typeof t=="string"&&(t=JSON.parse(t));var s=e.point(t[0],t[1],i);if(!t[2])return s;function o(h){return e.point(h[0],h[1],i)}var f=t[2];return s.precomputed={beta:null,doubles:f.doubles&&{step:f.doubles.step,points:[s].concat(f.doubles.points.map(o))},naf:f.naf&&{wnd:f.naf.wnd,points:[s].concat(f.naf.points.map(o))}},s};yr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};yr.prototype.isInfinity=function(){return this.inf};yr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),s=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,s)};yr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),s=e.redInvm(),o=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(s),f=o.redSqr().redISub(this.x.redAdd(this.x)),h=o.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,h)};yr.prototype.getX=function(){return this.x.fromRed()};yr.prototype.getY=function(){return this.y.fromRed()};yr.prototype.mul=function(e){return e=new Jt(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)};yr.prototype.mulAdd=function(e,t,i){var s=[this,t],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(s,o):this.curve._wnafMulAdd(1,s,o,2)};yr.prototype.jmulAdd=function(e,t,i){var s=[this,t],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(s,o,!0):this.curve._wnafMulAdd(1,s,o,2,!0)};yr.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)};yr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,s=function(o){return o.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(s)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(s)}}}return t};yr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Sr(r,e,t,i){va.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Jt(0)):(this.x=new Jt(e,16),this.y=new Jt(t,16),this.z=new Jt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}ed(Sr,va.BasePoint);Ci.prototype.jpoint=function(e,t,i){return new Sr(this,e,t,i)};Sr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),s=this.y.redMul(t).redMul(e);return this.curve.point(i,s)};Sr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Sr.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),s=this.x.redMul(t),o=e.x.redMul(i),f=this.y.redMul(t.redMul(e.z)),h=e.y.redMul(i.redMul(this.z)),u=s.redSub(o),d=f.redSub(h);if(u.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=u.redSqr(),y=g.redMul(u),P=s.redMul(g),S=d.redSqr().redIAdd(y).redISub(P).redISub(P),A=d.redMul(P.redISub(S)).redISub(f.redMul(y)),F=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(S,A,F)};Sr.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,s=e.x.redMul(t),o=this.y,f=e.y.redMul(t).redMul(this.z),h=i.redSub(s),u=o.redSub(f);if(h.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=h.redSqr(),g=d.redMul(h),y=i.redMul(d),P=u.redSqr().redIAdd(g).redISub(y).redISub(y),S=u.redMul(y.redISub(P)).redISub(o.redMul(g)),A=this.z.redMul(h);return this.curve.jpoint(P,S,A)};Sr.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var i=this;for(t=0;t<e;t++)i=i.dbl();return i}var s=this.curve.a,o=this.curve.tinv,f=this.x,h=this.y,u=this.z,d=u.redSqr().redSqr(),g=h.redAdd(h);for(t=0;t<e;t++){var y=f.redSqr(),P=g.redSqr(),S=P.redSqr(),A=y.redAdd(y).redIAdd(y).redIAdd(s.redMul(d)),F=f.redMul(P),V=A.redSqr().redISub(F.redAdd(F)),J=F.redISub(V),B=A.redMul(J);B=B.redIAdd(B).redISub(S);var Y=g.redMul(u);t+1<e&&(d=d.redMul(S)),f=V,u=Y,g=B}return this.curve.jpoint(f,g.redMul(o),u)};Sr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Sr.prototype._zeroDbl=function(){var e,t,i;if(this.zOne){var s=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(s).redISub(f);h=h.redIAdd(h);var u=s.redAdd(s).redIAdd(s),d=u.redSqr().redISub(h).redISub(h),g=f.redIAdd(f);g=g.redIAdd(g),g=g.redIAdd(g),e=d,t=u.redMul(h.redISub(d)).redISub(g),i=this.y.redAdd(this.y)}else{var y=this.x.redSqr(),P=this.y.redSqr(),S=P.redSqr(),A=this.x.redAdd(P).redSqr().redISub(y).redISub(S);A=A.redIAdd(A);var F=y.redAdd(y).redIAdd(y),V=F.redSqr(),J=S.redIAdd(S);J=J.redIAdd(J),J=J.redIAdd(J),e=V.redISub(A).redISub(A),t=F.redMul(A.redISub(e)).redISub(J),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,t,i)};Sr.prototype._threeDbl=function(){var e,t,i;if(this.zOne){var s=this.x.redSqr(),o=this.y.redSqr(),f=o.redSqr(),h=this.x.redAdd(o).redSqr().redISub(s).redISub(f);h=h.redIAdd(h);var u=s.redAdd(s).redIAdd(s).redIAdd(this.curve.a),d=u.redSqr().redISub(h).redISub(h);e=d;var g=f.redIAdd(f);g=g.redIAdd(g),g=g.redIAdd(g),t=u.redMul(h.redISub(d)).redISub(g),i=this.y.redAdd(this.y)}else{var y=this.z.redSqr(),P=this.y.redSqr(),S=this.x.redMul(P),A=this.x.redSub(y).redMul(this.x.redAdd(y));A=A.redAdd(A).redIAdd(A);var F=S.redIAdd(S);F=F.redIAdd(F);var V=F.redAdd(F);e=A.redSqr().redISub(V),i=this.y.redAdd(this.z).redSqr().redISub(P).redISub(y);var J=P.redSqr();J=J.redIAdd(J),J=J.redIAdd(J),J=J.redIAdd(J),t=A.redMul(F.redISub(e)).redISub(J)}return this.curve.jpoint(e,t,i)};Sr.prototype._dbl=function(){var e=this.curve.a,t=this.x,i=this.y,s=this.z,o=s.redSqr().redSqr(),f=t.redSqr(),h=i.redSqr(),u=f.redAdd(f).redIAdd(f).redIAdd(e.redMul(o)),d=t.redAdd(t);d=d.redIAdd(d);var g=d.redMul(h),y=u.redSqr().redISub(g.redAdd(g)),P=g.redISub(y),S=h.redSqr();S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var A=u.redMul(P).redISub(S),F=i.redAdd(i).redMul(s);return this.curve.jpoint(y,A,F)};Sr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr(),s=t.redSqr(),o=e.redAdd(e).redIAdd(e),f=o.redSqr(),h=this.x.redAdd(t).redSqr().redISub(e).redISub(s);h=h.redIAdd(h),h=h.redAdd(h).redIAdd(h),h=h.redISub(f);var u=h.redSqr(),d=s.redIAdd(s);d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var g=o.redIAdd(h).redSqr().redISub(f).redISub(u).redISub(d),y=t.redMul(g);y=y.redIAdd(y),y=y.redIAdd(y);var P=this.x.redMul(u).redISub(y);P=P.redIAdd(P),P=P.redIAdd(P);var S=this.y.redMul(g.redMul(d.redISub(g)).redISub(h.redMul(u)));S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var A=this.z.redAdd(h).redSqr().redISub(i).redISub(u);return this.curve.jpoint(P,S,A)};Sr.prototype.mul=function(e,t){return e=new Jt(e,t),this.curve._wnafMul(this,e)};Sr.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var s=t.redMul(this.z),o=i.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(s)).cmpn(0)===0};Sr.prototype.eqXToP=function(e){var t=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(i)===0)return!0;for(var s=e.clone(),o=this.curve.redN.redMul(t);;){if(s.iadd(this.curve.n),s.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(o),this.x.cmp(i)===0)return!0}};Sr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Sr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ca=Cn,lg=Uu,vf=gf,P8=ci;function ba(r){vf.call(this,"mont",r),this.a=new ca(r.a,16).toRed(this.red),this.b=new ca(r.b,16).toRed(this.red),this.i4=new ca(4).toRed(this.red).redInvm(),this.two=new ca(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}lg(ba,vf);var D8=ba;ba.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),s=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),o=s.redSqrt();return o.redSqr().cmp(s)===0};function br(r,e,t){vf.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new ca(e,16),this.z=new ca(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}lg(br,vf.BasePoint);ba.prototype.decodePoint=function(e,t){return this.point(P8.toArray(e,t),1)};ba.prototype.point=function(e,t){return new br(this,e,t)};ba.prototype.pointFromJSON=function(e){return br.fromJSON(this,e)};br.prototype.precompute=function(){};br.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};br.fromJSON=function(e,t){return new br(e,t[0],t[1]||e.one)};br.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};br.prototype.isInfinity=function(){return this.z.cmpn(0)===0};br.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),s=i.redSqr(),o=t.redSub(s),f=t.redMul(s),h=o.redMul(s.redAdd(this.curve.a24.redMul(o)));return this.curve.point(f,h)};br.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};br.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),s=this.x.redSub(this.z),o=e.x.redAdd(e.z),f=e.x.redSub(e.z),h=f.redMul(i),u=o.redMul(s),d=t.z.redMul(h.redAdd(u).redSqr()),g=t.x.redMul(h.redISub(u).redSqr());return this.curve.point(d,g)};br.prototype.mul=function(e){for(var t=e.clone(),i=this,s=this.curve.point(null,null),o=this,f=[];t.cmpn(0)!==0;t.iushrn(1))f.push(t.andln(1));for(var h=f.length-1;h>=0;h--)f[h]===0?(i=i.diffAdd(s,o),s=s.dbl()):(s=i.diffAdd(s,o),i=i.dbl());return s};br.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};br.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};br.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};br.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};br.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var M8=ci,Dn=Cn,pg=Uu,bf=gf,O8=M8.assert;function dn(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,bf.call(this,"edwards",r),this.a=new Dn(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Dn(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Dn(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),O8(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}pg(dn,bf);var R8=dn;dn.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};dn.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};dn.prototype.jpoint=function(e,t,i,s){return this.point(e,t,i,s)};dn.prototype.pointFromX=function(e,t){e=new Dn(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),s=this.c2.redSub(this.a.redMul(i)),o=this.one.redSub(this.c2.redMul(this.d).redMul(i)),f=s.redMul(o.redInvm()),h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");var u=h.fromRed().isOdd();return(t&&!u||!t&&u)&&(h=h.redNeg()),this.point(e,h)};dn.prototype.pointFromY=function(e,t){e=new Dn(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),s=i.redSub(this.c2),o=i.redMul(this.d).redMul(this.c2).redSub(this.a),f=s.redMul(o.redInvm());if(f.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var h=f.redSqrt();if(h.redSqr().redSub(f).cmp(this.zero)!==0)throw new Error("invalid point");return h.fromRed().isOdd()!==t&&(h=h.redNeg()),this.point(h,e)};dn.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),i=e.y.redSqr(),s=t.redMul(this.a).redAdd(i),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));return s.cmp(o)===0};function zt(r,e,t,i,s){bf.BasePoint.call(this,r,"projective"),e===null&&t===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Dn(e,16),this.y=new Dn(t,16),this.z=i?new Dn(i,16):this.curve.one,this.t=s&&new Dn(s,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()))))}pg(zt,bf.BasePoint);dn.prototype.pointFromJSON=function(e){return zt.fromJSON(this,e)};dn.prototype.point=function(e,t,i,s){return new zt(this,e,t,i,s)};zt.fromJSON=function(e,t){return new zt(e,t[0],t[1],t[2])};zt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};zt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};zt.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var s=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),f=s.redAdd(t),h=f.redSub(i),u=s.redSub(t),d=o.redMul(h),g=f.redMul(u),y=o.redMul(u),P=h.redMul(f);return this.curve.point(d,g,P,y)};zt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),i=this.y.redSqr(),s,o,f,h,u,d;if(this.curve.twisted){h=this.curve._mulA(t);var g=h.redAdd(i);this.zOne?(s=e.redSub(t).redSub(i).redMul(g.redSub(this.curve.two)),o=g.redMul(h.redSub(i)),f=g.redSqr().redSub(g).redSub(g)):(u=this.z.redSqr(),d=g.redSub(u).redISub(u),s=e.redSub(t).redISub(i).redMul(d),o=g.redMul(h.redSub(i)),f=g.redMul(d))}else h=t.redAdd(i),u=this.curve._mulC(this.z).redSqr(),d=h.redSub(u).redSub(u),s=this.curve._mulC(e.redISub(h)).redMul(d),o=this.curve._mulC(h).redMul(t.redISub(i)),f=h.redMul(d);return this.curve.point(s,o,f)};zt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};zt.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),s=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),f=i.redSub(t),h=o.redSub(s),u=o.redAdd(s),d=i.redAdd(t),g=f.redMul(h),y=u.redMul(d),P=f.redMul(d),S=h.redMul(u);return this.curve.point(g,y,S,P)};zt.prototype._projAdd=function(e){var t=this.z.redMul(e.z),i=t.redSqr(),s=this.x.redMul(e.x),o=this.y.redMul(e.y),f=this.curve.d.redMul(s).redMul(o),h=i.redSub(f),u=i.redAdd(f),d=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(o),g=t.redMul(h).redMul(d),y,P;return this.curve.twisted?(y=t.redMul(u).redMul(o.redSub(this.curve._mulA(s))),P=h.redMul(u)):(y=t.redMul(u).redMul(o.redSub(s)),P=this.curve._mulC(h).redMul(u)),this.curve.point(g,y,P)};zt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};zt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};zt.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)};zt.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)};zt.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};zt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};zt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};zt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};zt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};zt.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var i=e.clone(),s=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(s),this.x.cmp(t)===0)return!0}};zt.prototype.toP=zt.prototype.normalize;zt.prototype.mixedAdd=zt.prototype.add;(function(r){var e=r;e.base=gf,e.short=A8,e.mont=D8,e.edwards=R8})(Qu);var mf={},Zh,Y0;function C8(){return Y0||(Y0=1,Zh={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Zh}(function(r){var e=r,t=F1,i=Qu,s=ci,o=s.assert;function f(d){d.type==="short"?this.curve=new i.short(d):d.type==="edwards"?this.curve=new i.edwards(d):this.curve=new i.mont(d),this.g=this.curve.g,this.n=this.curve.n,this.hash=d.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=f;function h(d,g){Object.defineProperty(e,d,{configurable:!0,enumerable:!0,get:function(){var y=new f(g);return Object.defineProperty(e,d,{configurable:!0,enumerable:!0,value:y}),y}})}h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=C8()}catch{u=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})})(mf);var N8=Cn,T8=ci,Au=T8.assert;function Rr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var $8=Rr;Rr.fromPublic=function(e,t,i){return t instanceof Rr?t:new Rr(e,{pub:t,pubEnc:i})};Rr.fromPrivate=function(e,t,i){return t instanceof Rr?t:new Rr(e,{priv:t,privEnc:i})};Rr.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};Rr.prototype.getPublic=function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub};Rr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};Rr.prototype._importPrivate=function(e,t){this.priv=new N8(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)};Rr.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Au(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Au(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)};Rr.prototype.derive=function(e){return e.validate()||Au(e.validate(),"public point not validated"),e.mul(this.priv).getX()};Rr.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)};Rr.prototype.verify=function(e,t,i){return this.ec.verify(e,t,this,void 0,i)};Rr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Yc=Cn,td=ci,F8=td.assert;function yf(r,e){if(r instanceof yf)return r;this._importDER(r,e)||(F8(r.r&&r.s,"Signature without r or s"),this.r=new Yc(r.r,16),this.s=new Yc(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var L8=yf;function q8(){this.place=0}function Qh(r,e){var t=r[e.place++];if(!(t&128))return t;var i=t&15;if(i===0||i>4||r[e.place]===0)return!1;for(var s=0,o=0,f=e.place;o<i;o++,f++)s<<=8,s|=r[f],s>>>=0;return s<=127?!1:(e.place=f,s)}function X0(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}yf.prototype._importDER=function(e,t){e=td.toArray(e,t);var i=new q8;if(e[i.place++]!==48)return!1;var s=Qh(e,i);if(s===!1||s+i.place!==e.length||e[i.place++]!==2)return!1;var o=Qh(e,i);if(o===!1||e[i.place]&128)return!1;var f=e.slice(i.place,o+i.place);if(i.place+=o,e[i.place++]!==2)return!1;var h=Qh(e,i);if(h===!1||e.length!==h+i.place||e[i.place]&128)return!1;var u=e.slice(i.place,h+i.place);if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;if(u[0]===0)if(u[1]&128)u=u.slice(1);else return!1;return this.r=new Yc(f),this.s=new Yc(u),this.recoveryParam=null,!0};function eu(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}yf.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),i[0]&128&&(i=[0].concat(i)),t=X0(t),i=X0(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var s=[2];eu(s,t.length),s=s.concat(t),s.push(2),eu(s,i.length);var o=s.concat(i),f=[48];return eu(f,o.length),f=f.concat(o),td.encode(f,e)};var Mn=Cn,gg=sw,U8=ci,tu=mf,B8=L1(),vg=U8.assert,rd=$8,wf=L8;function Pi(r){if(!(this instanceof Pi))return new Pi(r);typeof r=="string"&&(vg(Object.prototype.hasOwnProperty.call(tu,r),"Unknown curve "+r),r=tu[r]),r instanceof tu.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var z8=Pi;Pi.prototype.keyPair=function(e){return new rd(this,e)};Pi.prototype.keyFromPrivate=function(e,t){return rd.fromPrivate(this,e,t)};Pi.prototype.keyFromPublic=function(e,t){return rd.fromPublic(this,e,t)};Pi.prototype.genKeyPair=function(e){e||(e={});for(var t=new gg({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||B8(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),s=this.n.sub(new Mn(2));;){var o=new Mn(t.generate(i));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Pi.prototype._truncateToN=function(e,t,i){var s;if(Mn.isBN(e)||typeof e=="number")e=new Mn(e,16),s=e.byteLength();else if(typeof e=="object")s=e.length,e=new Mn(e,16);else{var o=e.toString();s=o.length+1>>>1,e=new Mn(o,16)}typeof i!="number"&&(i=s*8);var f=i-this.n.bitLength();return f>0&&(e=e.ushrn(f)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};Pi.prototype.sign=function(e,t,i,s){typeof i=="object"&&(s=i,i=null),s||(s={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,s.msgBitLength);for(var o=this.n.byteLength(),f=t.getPrivate().toArray("be",o),h=e.toArray("be",o),u=new gg({hash:this.hash,entropy:f,nonce:h,pers:s.pers,persEnc:s.persEnc||"utf8"}),d=this.n.sub(new Mn(1)),g=0;;g++){var y=s.k?s.k(g):new Mn(u.generate(this.n.byteLength()));if(y=this._truncateToN(y,!0),!(y.cmpn(1)<=0||y.cmp(d)>=0)){var P=this.g.mul(y);if(!P.isInfinity()){var S=P.getX(),A=S.umod(this.n);if(A.cmpn(0)!==0){var F=y.invm(this.n).mul(A.mul(t.getPrivate()).iadd(e));if(F=F.umod(this.n),F.cmpn(0)!==0){var V=(P.getY().isOdd()?1:0)|(S.cmp(A)!==0?2:0);return s.canonical&&F.cmp(this.nh)>0&&(F=this.n.sub(F),V^=1),new wf({r:A,s:F,recoveryParam:V})}}}}}};Pi.prototype.verify=function(e,t,i,s,o){o||(o={}),e=this._truncateToN(e,!1,o.msgBitLength),i=this.keyFromPublic(i,s),t=new wf(t,"hex");var f=t.r,h=t.s;if(f.cmpn(1)<0||f.cmp(this.n)>=0||h.cmpn(1)<0||h.cmp(this.n)>=0)return!1;var u=h.invm(this.n),d=u.mul(e).umod(this.n),g=u.mul(f).umod(this.n),y;return this.curve._maxwellTrick?(y=this.g.jmulAdd(d,i.getPublic(),g),y.isInfinity()?!1:y.eqXToP(f)):(y=this.g.mulAdd(d,i.getPublic(),g),y.isInfinity()?!1:y.getX().umod(this.n).cmp(f)===0)};Pi.prototype.recoverPubKey=function(r,e,t,i){vg((3&t)===t,"The recovery param is more than two bits"),e=new wf(e,i);var s=this.n,o=new Mn(r),f=e.r,h=e.s,u=t&1,d=t>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");d?f=this.curve.pointFromX(f.add(this.curve.n),u):f=this.curve.pointFromX(f,u);var g=e.r.invm(s),y=s.sub(o).mul(g).umod(s),P=h.mul(g).umod(s);return this.g.mulAdd(y,f,P)};Pi.prototype.getKeyRecoveryParam=function(r,e,t,i){if(e=new wf(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var s=0;s<4;s++){var o;try{o=this.recoverPubKey(r,e,s)}catch{continue}if(o.eq(t))return s}throw new Error("Unable to find valid recovery factor")};var go=ci,bg=go.assert,Z0=go.parseBytes,ma=go.cachedProperty;function vr(r,e){this.eddsa=r,this._secret=Z0(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Z0(e.pub)}vr.fromPublic=function(e,t){return t instanceof vr?t:new vr(e,{pub:t})};vr.fromSecret=function(e,t){return t instanceof vr?t:new vr(e,{secret:t})};vr.prototype.secret=function(){return this._secret};ma(vr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});ma(vr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});ma(vr,"privBytes",function(){var e=this.eddsa,t=this.hash(),i=e.encodingLength-1,s=t.slice(0,e.encodingLength);return s[0]&=248,s[i]&=127,s[i]|=64,s});ma(vr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});ma(vr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});ma(vr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});vr.prototype.sign=function(e){return bg(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};vr.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)};vr.prototype.getSecret=function(e){return bg(this._secret,"KeyPair is public only"),go.encode(this.secret(),e)};vr.prototype.getPublic=function(e){return go.encode(this.pubBytes(),e)};var K8=vr,H8=Cn,_f=ci,Q0=_f.assert,Ef=_f.cachedProperty,k8=_f.parseBytes;function Ns(r,e){this.eddsa=r,typeof e!="object"&&(e=k8(e)),Array.isArray(e)&&(Q0(e.length===r.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),Q0(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof H8&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Ef(Ns,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Ef(Ns,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Ef(Ns,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Ef(Ns,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Ns.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Ns.prototype.toHex=function(){return _f.encode(this.toBytes(),"hex").toUpperCase()};var j8=Ns,W8=F1,G8=mf,la=ci,V8=la.assert,mg=la.parseBytes,yg=K8,ep=j8;function Yr(r){if(V8(r==="ed25519","only tested with ed25519 so far"),!(this instanceof Yr))return new Yr(r);r=G8[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=W8.sha512}var J8=Yr;Yr.prototype.sign=function(e,t){e=mg(e);var i=this.keyFromSecret(t),s=this.hashInt(i.messagePrefix(),e),o=this.g.mul(s),f=this.encodePoint(o),h=this.hashInt(f,i.pubBytes(),e).mul(i.priv()),u=s.add(h).umod(this.curve.n);return this.makeSignature({R:o,S:u,Rencoded:f})};Yr.prototype.verify=function(e,t,i){if(e=mg(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var s=this.keyFromPublic(i),o=this.hashInt(t.Rencoded(),s.pubBytes(),e),f=this.g.mul(t.S()),h=t.R().add(s.pub().mul(o));return h.eq(f)};Yr.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return la.intFromLE(e.digest()).umod(this.curve.n)};Yr.prototype.keyFromPublic=function(e){return yg.fromPublic(this,e)};Yr.prototype.keyFromSecret=function(e){return yg.fromSecret(this,e)};Yr.prototype.makeSignature=function(e){return e instanceof ep?e:new ep(this,e)};Yr.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t};Yr.prototype.decodePoint=function(e){e=la.parseBytes(e);var t=e.length-1,i=e.slice(0,t).concat(e[t]&-129),s=(e[t]&128)!==0,o=la.intFromLE(i);return this.curve.pointFromY(o,s)};Yr.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};Yr.prototype.decodeInt=function(e){return la.intFromLE(e)};Yr.prototype.isPoint=function(e){return e instanceof this.pointClass};(function(r){var e=r;e.version=E8.version,e.utils=ci,e.rand=L1(),e.curve=Qu,e.curves=mf,e.ec=z8,e.eddsa=J8})(dg);var id={},wg={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ot,t=oi;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function h(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return h.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},h.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},h.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},h.prototype.update=function(u,d){if(d===void 0&&(d=u.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var g=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&d>0;)this._buffer[this._bufferLength++]=u[g++],d--;this._bufferLength===this.blockSize&&(o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(g=o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,u,g,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=u[g++],d--;return this},h.prototype.finish=function(u){if(!this._finished){var d=this._bytesHashed,g=this._bufferLength,y=d/536870912|0,P=d<<3,S=d%128<112?128:256;this._buffer[g]=128;for(var A=g+1;A<S-8;A++)this._buffer[A]=0;e.writeUint32BE(y,this._buffer,S-8),e.writeUint32BE(P,this._buffer,S-4),o(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,S),this._finished=!0}for(var A=0;A<this.digestLength/8;A++)e.writeUint32BE(this._stateHi[A],u,A*8),e.writeUint32BE(this._stateLo[A],u,A*8+4);return this},h.prototype.digest=function(){var u=new Uint8Array(this.digestLength);return this.finish(u),u},h.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},h.prototype.restoreState=function(u){return this._stateHi.set(u.stateHi),this._stateLo.set(u.stateLo),this._bufferLength=u.bufferLength,u.buffer&&this._buffer.set(u.buffer),this._bytesHashed=u.bytesHashed,this._finished=!1,this},h.prototype.cleanSavedState=function(u){t.wipe(u.stateHi),t.wipe(u.stateLo),u.buffer&&t.wipe(u.buffer),u.bufferLength=0,u.bytesHashed=0},h}();r.SHA512=i;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function o(h,u,d,g,y,P,S){for(var A=d[0],F=d[1],V=d[2],J=d[3],B=d[4],Y=d[5],L=d[6],k=d[7],W=g[0],m=g[1],N=g[2],ne=g[3],pe=g[4],q=g[5],l=g[6],w=g[7],_,x,R,$,T,D,p,M;S>=128;){for(var ae=0;ae<16;ae++){var ie=8*ae+P;h[ae]=e.readUint32BE(y,ie),u[ae]=e.readUint32BE(y,ie+4)}for(var ae=0;ae<80;ae++){var ue=A,E=F,te=V,U=J,j=B,z=Y,v=L,K=k,re=W,ce=m,ge=N,ve=ne,Me=pe,Ke=q,$e=l,Fe=w;if(_=k,x=w,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=(B>>>14|pe<<32-14)^(B>>>18|pe<<32-18)^(pe>>>41-32|B<<32-(41-32)),x=(pe>>>14|B<<32-14)^(pe>>>18|B<<32-18)^(B>>>41-32|pe<<32-(41-32)),T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,_=B&Y^~B&L,x=pe&q^~pe&l,T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,_=s[ae*2],x=s[ae*2+1],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,_=h[ae%16],x=u[ae%16],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,R=p&65535|M<<16,$=T&65535|D<<16,_=R,x=$,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=(A>>>28|W<<32-28)^(W>>>34-32|A<<32-(34-32))^(W>>>39-32|A<<32-(39-32)),x=(W>>>28|A<<32-28)^(A>>>34-32|W<<32-(34-32))^(A>>>39-32|W<<32-(39-32)),T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,_=A&F^A&V^F&V,x=W&m^W&N^m&N,T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,K=p&65535|M<<16,Fe=T&65535|D<<16,_=U,x=ve,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=R,x=$,T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,U=p&65535|M<<16,ve=T&65535|D<<16,F=ue,V=E,J=te,B=U,Y=j,L=z,k=v,A=K,m=re,N=ce,ne=ge,pe=ve,q=Me,l=Ke,w=$e,W=Fe,ae%16===15)for(var ie=0;ie<16;ie++)_=h[ie],x=u[ie],T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=h[(ie+9)%16],x=u[(ie+9)%16],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,R=h[(ie+1)%16],$=u[(ie+1)%16],_=(R>>>1|$<<32-1)^(R>>>8|$<<32-8)^R>>>7,x=($>>>1|R<<32-1)^($>>>8|R<<32-8)^($>>>7|R<<32-7),T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,R=h[(ie+14)%16],$=u[(ie+14)%16],_=(R>>>19|$<<32-19)^($>>>61-32|R<<32-(61-32))^R>>>6,x=($>>>19|R<<32-19)^(R>>>61-32|$<<32-(61-32))^($>>>6|R<<32-6),T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,h[ie]=p&65535|M<<16,u[ie]=T&65535|D<<16}_=A,x=W,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[0],x=g[0],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[0]=A=p&65535|M<<16,g[0]=W=T&65535|D<<16,_=F,x=m,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[1],x=g[1],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[1]=F=p&65535|M<<16,g[1]=m=T&65535|D<<16,_=V,x=N,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[2],x=g[2],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[2]=V=p&65535|M<<16,g[2]=N=T&65535|D<<16,_=J,x=ne,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[3],x=g[3],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[3]=J=p&65535|M<<16,g[3]=ne=T&65535|D<<16,_=B,x=pe,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[4],x=g[4],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[4]=B=p&65535|M<<16,g[4]=pe=T&65535|D<<16,_=Y,x=q,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[5],x=g[5],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[5]=Y=p&65535|M<<16,g[5]=q=T&65535|D<<16,_=L,x=l,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[6],x=g[6],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[6]=L=p&65535|M<<16,g[6]=l=T&65535|D<<16,_=k,x=w,T=x&65535,D=x>>>16,p=_&65535,M=_>>>16,_=d[7],x=g[7],T+=x&65535,D+=x>>>16,p+=_&65535,M+=_>>>16,D+=T>>>16,p+=D>>>16,M+=p>>>16,d[7]=k=p&65535|M<<16,g[7]=w=T&65535|D<<16,P+=128,S-=128}return P}function f(h){var u=new i;u.update(h);var d=u.digest();return u.clean(),d}r.hash=f})(wg);(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=Zn,t=wg,i=oi;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function s(U){const j=new Float64Array(16);if(U)for(let z=0;z<U.length;z++)j[z]=U[z];return j}const o=new Uint8Array(32);o[0]=9;const f=s(),h=s([1]),u=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),P=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(U,j){for(let z=0;z<16;z++)U[z]=j[z]|0}function A(U){let j=1;for(let z=0;z<16;z++){let v=U[z]+j+65535;j=Math.floor(v/65536),U[z]=v-j*65536}U[0]+=j-1+37*(j-1)}function F(U,j,z){const v=~(z-1);for(let K=0;K<16;K++){const re=v&(U[K]^j[K]);U[K]^=re,j[K]^=re}}function V(U,j){const z=s(),v=s();for(let K=0;K<16;K++)v[K]=j[K];A(v),A(v),A(v);for(let K=0;K<2;K++){z[0]=v[0]-65517;for(let ce=1;ce<15;ce++)z[ce]=v[ce]-65535-(z[ce-1]>>16&1),z[ce-1]&=65535;z[15]=v[15]-32767-(z[14]>>16&1);const re=z[15]>>16&1;z[14]&=65535,F(v,z,1-re)}for(let K=0;K<16;K++)U[2*K]=v[K]&255,U[2*K+1]=v[K]>>8}function J(U,j){let z=0;for(let v=0;v<32;v++)z|=U[v]^j[v];return(1&z-1>>>8)-1}function B(U,j){const z=new Uint8Array(32),v=new Uint8Array(32);return V(z,U),V(v,j),J(z,v)}function Y(U){const j=new Uint8Array(32);return V(j,U),j[0]&1}function L(U,j){for(let z=0;z<16;z++)U[z]=j[2*z]+(j[2*z+1]<<8);U[15]&=32767}function k(U,j,z){for(let v=0;v<16;v++)U[v]=j[v]+z[v]}function W(U,j,z){for(let v=0;v<16;v++)U[v]=j[v]-z[v]}function m(U,j,z){let v,K,re=0,ce=0,ge=0,ve=0,Me=0,Ke=0,$e=0,Fe=0,He=0,_e=0,Ie=0,Le=0,De=0,xe=0,qe=0,ye=0,Se=0,Je=0,Ee=0,Oe=0,tt=0,Re=0,Ce=0,it=0,ct=0,ut=0,cr=0,ft=0,mt=0,Ar=0,Et=0,ke=z[0],xt=z[1],je=z[2],We=z[3],It=z[4],Ue=z[5],Xe=z[6],Nt=z[7],Ge=z[8],Ze=z[9],Pt=z[10],Ye=z[11],Ve=z[12],_t=z[13],Qe=z[14],et=z[15];v=j[0],re+=v*ke,ce+=v*xt,ge+=v*je,ve+=v*We,Me+=v*It,Ke+=v*Ue,$e+=v*Xe,Fe+=v*Nt,He+=v*Ge,_e+=v*Ze,Ie+=v*Pt,Le+=v*Ye,De+=v*Ve,xe+=v*_t,qe+=v*Qe,ye+=v*et,v=j[1],ce+=v*ke,ge+=v*xt,ve+=v*je,Me+=v*We,Ke+=v*It,$e+=v*Ue,Fe+=v*Xe,He+=v*Nt,_e+=v*Ge,Ie+=v*Ze,Le+=v*Pt,De+=v*Ye,xe+=v*Ve,qe+=v*_t,ye+=v*Qe,Se+=v*et,v=j[2],ge+=v*ke,ve+=v*xt,Me+=v*je,Ke+=v*We,$e+=v*It,Fe+=v*Ue,He+=v*Xe,_e+=v*Nt,Ie+=v*Ge,Le+=v*Ze,De+=v*Pt,xe+=v*Ye,qe+=v*Ve,ye+=v*_t,Se+=v*Qe,Je+=v*et,v=j[3],ve+=v*ke,Me+=v*xt,Ke+=v*je,$e+=v*We,Fe+=v*It,He+=v*Ue,_e+=v*Xe,Ie+=v*Nt,Le+=v*Ge,De+=v*Ze,xe+=v*Pt,qe+=v*Ye,ye+=v*Ve,Se+=v*_t,Je+=v*Qe,Ee+=v*et,v=j[4],Me+=v*ke,Ke+=v*xt,$e+=v*je,Fe+=v*We,He+=v*It,_e+=v*Ue,Ie+=v*Xe,Le+=v*Nt,De+=v*Ge,xe+=v*Ze,qe+=v*Pt,ye+=v*Ye,Se+=v*Ve,Je+=v*_t,Ee+=v*Qe,Oe+=v*et,v=j[5],Ke+=v*ke,$e+=v*xt,Fe+=v*je,He+=v*We,_e+=v*It,Ie+=v*Ue,Le+=v*Xe,De+=v*Nt,xe+=v*Ge,qe+=v*Ze,ye+=v*Pt,Se+=v*Ye,Je+=v*Ve,Ee+=v*_t,Oe+=v*Qe,tt+=v*et,v=j[6],$e+=v*ke,Fe+=v*xt,He+=v*je,_e+=v*We,Ie+=v*It,Le+=v*Ue,De+=v*Xe,xe+=v*Nt,qe+=v*Ge,ye+=v*Ze,Se+=v*Pt,Je+=v*Ye,Ee+=v*Ve,Oe+=v*_t,tt+=v*Qe,Re+=v*et,v=j[7],Fe+=v*ke,He+=v*xt,_e+=v*je,Ie+=v*We,Le+=v*It,De+=v*Ue,xe+=v*Xe,qe+=v*Nt,ye+=v*Ge,Se+=v*Ze,Je+=v*Pt,Ee+=v*Ye,Oe+=v*Ve,tt+=v*_t,Re+=v*Qe,Ce+=v*et,v=j[8],He+=v*ke,_e+=v*xt,Ie+=v*je,Le+=v*We,De+=v*It,xe+=v*Ue,qe+=v*Xe,ye+=v*Nt,Se+=v*Ge,Je+=v*Ze,Ee+=v*Pt,Oe+=v*Ye,tt+=v*Ve,Re+=v*_t,Ce+=v*Qe,it+=v*et,v=j[9],_e+=v*ke,Ie+=v*xt,Le+=v*je,De+=v*We,xe+=v*It,qe+=v*Ue,ye+=v*Xe,Se+=v*Nt,Je+=v*Ge,Ee+=v*Ze,Oe+=v*Pt,tt+=v*Ye,Re+=v*Ve,Ce+=v*_t,it+=v*Qe,ct+=v*et,v=j[10],Ie+=v*ke,Le+=v*xt,De+=v*je,xe+=v*We,qe+=v*It,ye+=v*Ue,Se+=v*Xe,Je+=v*Nt,Ee+=v*Ge,Oe+=v*Ze,tt+=v*Pt,Re+=v*Ye,Ce+=v*Ve,it+=v*_t,ct+=v*Qe,ut+=v*et,v=j[11],Le+=v*ke,De+=v*xt,xe+=v*je,qe+=v*We,ye+=v*It,Se+=v*Ue,Je+=v*Xe,Ee+=v*Nt,Oe+=v*Ge,tt+=v*Ze,Re+=v*Pt,Ce+=v*Ye,it+=v*Ve,ct+=v*_t,ut+=v*Qe,cr+=v*et,v=j[12],De+=v*ke,xe+=v*xt,qe+=v*je,ye+=v*We,Se+=v*It,Je+=v*Ue,Ee+=v*Xe,Oe+=v*Nt,tt+=v*Ge,Re+=v*Ze,Ce+=v*Pt,it+=v*Ye,ct+=v*Ve,ut+=v*_t,cr+=v*Qe,ft+=v*et,v=j[13],xe+=v*ke,qe+=v*xt,ye+=v*je,Se+=v*We,Je+=v*It,Ee+=v*Ue,Oe+=v*Xe,tt+=v*Nt,Re+=v*Ge,Ce+=v*Ze,it+=v*Pt,ct+=v*Ye,ut+=v*Ve,cr+=v*_t,ft+=v*Qe,mt+=v*et,v=j[14],qe+=v*ke,ye+=v*xt,Se+=v*je,Je+=v*We,Ee+=v*It,Oe+=v*Ue,tt+=v*Xe,Re+=v*Nt,Ce+=v*Ge,it+=v*Ze,ct+=v*Pt,ut+=v*Ye,cr+=v*Ve,ft+=v*_t,mt+=v*Qe,Ar+=v*et,v=j[15],ye+=v*ke,Se+=v*xt,Je+=v*je,Ee+=v*We,Oe+=v*It,tt+=v*Ue,Re+=v*Xe,Ce+=v*Nt,it+=v*Ge,ct+=v*Ze,ut+=v*Pt,cr+=v*Ye,ft+=v*Ve,mt+=v*_t,Ar+=v*Qe,Et+=v*et,re+=38*Se,ce+=38*Je,ge+=38*Ee,ve+=38*Oe,Me+=38*tt,Ke+=38*Re,$e+=38*Ce,Fe+=38*it,He+=38*ct,_e+=38*ut,Ie+=38*cr,Le+=38*ft,De+=38*mt,xe+=38*Ar,qe+=38*Et,K=1,v=re+K+65535,K=Math.floor(v/65536),re=v-K*65536,v=ce+K+65535,K=Math.floor(v/65536),ce=v-K*65536,v=ge+K+65535,K=Math.floor(v/65536),ge=v-K*65536,v=ve+K+65535,K=Math.floor(v/65536),ve=v-K*65536,v=Me+K+65535,K=Math.floor(v/65536),Me=v-K*65536,v=Ke+K+65535,K=Math.floor(v/65536),Ke=v-K*65536,v=$e+K+65535,K=Math.floor(v/65536),$e=v-K*65536,v=Fe+K+65535,K=Math.floor(v/65536),Fe=v-K*65536,v=He+K+65535,K=Math.floor(v/65536),He=v-K*65536,v=_e+K+65535,K=Math.floor(v/65536),_e=v-K*65536,v=Ie+K+65535,K=Math.floor(v/65536),Ie=v-K*65536,v=Le+K+65535,K=Math.floor(v/65536),Le=v-K*65536,v=De+K+65535,K=Math.floor(v/65536),De=v-K*65536,v=xe+K+65535,K=Math.floor(v/65536),xe=v-K*65536,v=qe+K+65535,K=Math.floor(v/65536),qe=v-K*65536,v=ye+K+65535,K=Math.floor(v/65536),ye=v-K*65536,re+=K-1+37*(K-1),K=1,v=re+K+65535,K=Math.floor(v/65536),re=v-K*65536,v=ce+K+65535,K=Math.floor(v/65536),ce=v-K*65536,v=ge+K+65535,K=Math.floor(v/65536),ge=v-K*65536,v=ve+K+65535,K=Math.floor(v/65536),ve=v-K*65536,v=Me+K+65535,K=Math.floor(v/65536),Me=v-K*65536,v=Ke+K+65535,K=Math.floor(v/65536),Ke=v-K*65536,v=$e+K+65535,K=Math.floor(v/65536),$e=v-K*65536,v=Fe+K+65535,K=Math.floor(v/65536),Fe=v-K*65536,v=He+K+65535,K=Math.floor(v/65536),He=v-K*65536,v=_e+K+65535,K=Math.floor(v/65536),_e=v-K*65536,v=Ie+K+65535,K=Math.floor(v/65536),Ie=v-K*65536,v=Le+K+65535,K=Math.floor(v/65536),Le=v-K*65536,v=De+K+65535,K=Math.floor(v/65536),De=v-K*65536,v=xe+K+65535,K=Math.floor(v/65536),xe=v-K*65536,v=qe+K+65535,K=Math.floor(v/65536),qe=v-K*65536,v=ye+K+65535,K=Math.floor(v/65536),ye=v-K*65536,re+=K-1+37*(K-1),U[0]=re,U[1]=ce,U[2]=ge,U[3]=ve,U[4]=Me,U[5]=Ke,U[6]=$e,U[7]=Fe,U[8]=He,U[9]=_e,U[10]=Ie,U[11]=Le,U[12]=De,U[13]=xe,U[14]=qe,U[15]=ye}function N(U,j){m(U,j,j)}function ne(U,j){const z=s();let v;for(v=0;v<16;v++)z[v]=j[v];for(v=253;v>=0;v--)N(z,z),v!==2&&v!==4&&m(z,z,j);for(v=0;v<16;v++)U[v]=z[v]}function pe(U,j){const z=s();let v;for(v=0;v<16;v++)z[v]=j[v];for(v=250;v>=0;v--)N(z,z),v!==1&&m(z,z,j);for(v=0;v<16;v++)U[v]=z[v]}function q(U,j){const z=s(),v=s(),K=s(),re=s(),ce=s(),ge=s(),ve=s(),Me=s(),Ke=s();W(z,U[1],U[0]),W(Ke,j[1],j[0]),m(z,z,Ke),k(v,U[0],U[1]),k(Ke,j[0],j[1]),m(v,v,Ke),m(K,U[3],j[3]),m(K,K,d),m(re,U[2],j[2]),k(re,re,re),W(ce,v,z),W(ge,re,K),k(ve,re,K),k(Me,v,z),m(U[0],ce,ge),m(U[1],Me,ve),m(U[2],ve,ge),m(U[3],ce,Me)}function l(U,j,z){for(let v=0;v<4;v++)F(U[v],j[v],z)}function w(U,j){const z=s(),v=s(),K=s();ne(K,j[2]),m(z,j[0],K),m(v,j[1],K),V(U,v),U[31]^=Y(z)<<7}function _(U,j,z){S(U[0],f),S(U[1],h),S(U[2],h),S(U[3],f);for(let v=255;v>=0;--v){const K=z[v/8|0]>>(v&7)&1;l(U,j,K),q(j,U),q(U,U),l(U,j,K)}}function x(U,j){const z=[s(),s(),s(),s()];S(z[0],g),S(z[1],y),S(z[2],h),m(z[3],g,y),_(U,z,j)}function R(U){if(U.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const j=(0,t.hash)(U);j[0]&=248,j[31]&=127,j[31]|=64;const z=new Uint8Array(32),v=[s(),s(),s(),s()];x(v,j),w(z,v);const K=new Uint8Array(64);return K.set(U),K.set(z,32),{publicKey:z,secretKey:K}}r.generateKeyPairFromSeed=R;function $(U){const j=(0,e.randomBytes)(32,U),z=R(j);return(0,i.wipe)(j),z}r.generateKeyPair=$;function T(U){if(U.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(U.subarray(32))}r.extractPublicKeyFromSecretKey=T;const D=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function p(U,j){let z,v,K,re;for(v=63;v>=32;--v){for(z=0,K=v-32,re=v-12;K<re;++K)j[K]+=z-16*j[v]*D[K-(v-32)],z=Math.floor((j[K]+128)/256),j[K]-=z*256;j[K]+=z,j[v]=0}for(z=0,K=0;K<32;K++)j[K]+=z-(j[31]>>4)*D[K],z=j[K]>>8,j[K]&=255;for(K=0;K<32;K++)j[K]-=z*D[K];for(v=0;v<32;v++)j[v+1]+=j[v]>>8,U[v]=j[v]&255}function M(U){const j=new Float64Array(64);for(let z=0;z<64;z++)j[z]=U[z];for(let z=0;z<64;z++)U[z]=0;p(U,j)}function ae(U,j){const z=new Float64Array(64),v=[s(),s(),s(),s()],K=(0,t.hash)(U.subarray(0,32));K[0]&=248,K[31]&=127,K[31]|=64;const re=new Uint8Array(64);re.set(K.subarray(32),32);const ce=new t.SHA512;ce.update(re.subarray(32)),ce.update(j);const ge=ce.digest();ce.clean(),M(ge),x(v,ge),w(re,v),ce.reset(),ce.update(re.subarray(0,32)),ce.update(U.subarray(32)),ce.update(j);const ve=ce.digest();M(ve);for(let Me=0;Me<32;Me++)z[Me]=ge[Me];for(let Me=0;Me<32;Me++)for(let Ke=0;Ke<32;Ke++)z[Me+Ke]+=ve[Me]*K[Ke];return p(re.subarray(32),z),re}r.sign=ae;function ie(U,j){const z=s(),v=s(),K=s(),re=s(),ce=s(),ge=s(),ve=s();return S(U[2],h),L(U[1],j),N(K,U[1]),m(re,K,u),W(K,K,U[2]),k(re,U[2],re),N(ce,re),N(ge,ce),m(ve,ge,ce),m(z,ve,K),m(z,z,re),pe(z,z),m(z,z,K),m(z,z,re),m(z,z,re),m(U[0],z,re),N(v,U[0]),m(v,v,re),B(v,K)&&m(U[0],U[0],P),N(v,U[0]),m(v,v,re),B(v,K)?-1:(Y(U[0])===j[31]>>7&&W(U[0],f,U[0]),m(U[3],U[0],U[1]),0)}function ue(U,j,z){const v=new Uint8Array(32),K=[s(),s(),s(),s()],re=[s(),s(),s(),s()];if(z.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(ie(re,U))return!1;const ce=new t.SHA512;ce.update(z.subarray(0,32)),ce.update(U),ce.update(j);const ge=ce.digest();return M(ge),_(K,re,ge),x(re,z.subarray(32)),q(K,re),w(v,K),!J(z,v)}r.verify=ue;function E(U){let j=[s(),s(),s(),s()];if(ie(j,U))throw new Error("Ed25519: invalid public key");let z=s(),v=s(),K=j[1];k(z,h,K),W(v,h,K),ne(v,v),m(z,z,v);let re=new Uint8Array(32);return V(re,z),re}r.convertPublicKeyToX25519=E;function te(U){const j=(0,t.hash)(U.subarray(0,32));j[0]&=248,j[31]&=127,j[31]|=64;const z=new Uint8Array(j.subarray(0,32));return(0,i.wipe)(j),z}r.convertSecretKeyToX25519=te})(id);const Y8="EdDSA",X8="JWT",Xc=".",xf="base64url",_g="utf8",Eg="utf8",Z8=":",Q8="did",e4="key",tp="base58btc",t4="z",r4="K36",i4=32,n4=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),s4=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function Ds(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return s4(r)}catch{return r}}function Rn(r){return typeof r=="string"?r:n4(r)||""}function rp(r){return Ds(gr(pr(r,xf),_g))}function Zc(r){return gr(pr(Rn(r),_g),xf)}function xg(r){const e=pr(r4,tp),t=t4+gr(Fc([e,r]),tp);return[Q8,e4,t].join(Z8)}function a4(r){return gr(r,xf)}function o4(r){return pr(r,xf)}function c4(r){return pr([Zc(r.header),Zc(r.payload)].join(Xc),Eg)}function f4(r){return[Zc(r.header),Zc(r.payload),a4(r.signature)].join(Xc)}function Pu(r){const e=r.split(Xc),t=rp(e[0]),i=rp(e[1]),s=o4(e[2]),o=pr(e.slice(0,2).join(Xc),Eg);return{header:t,payload:i,signature:s,data:o}}function ip(r=Zn.randomBytes(i4)){return id.generateKeyPairFromSeed(r)}async function h4(r,e,t,i,s=me.fromMiliseconds(Date.now())){const o={alg:Y8,typ:X8},f=xg(i.publicKey),h=s+t,u={iss:f,sub:r,aud:e,iat:s,exp:h},d=c4({header:o,payload:u}),g=id.sign(i.secretKey,d);return f4({header:o,payload:u,signature:g})}const u4={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},d4=":";function ua(r){const[e,t]=r.split(d4);return{namespace:e,reference:t}}function np(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const s=r[i];t.push(...s.accounts)}),t}function Sg(r,e){return r.includes(":")?[r]:e.chains||[]}var l4=Object.defineProperty,sp=Object.getOwnPropertySymbols,p4=Object.prototype.hasOwnProperty,g4=Object.prototype.propertyIsEnumerable,ap=(r,e,t)=>e in r?l4(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,op=(r,e)=>{for(var t in e||(e={}))p4.call(e,t)&&ap(r,t,e[t]);if(sp)for(var t of sp(e))g4.call(e,t)&&ap(r,t,e[t]);return r};const v4="ReactNative",ni={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},b4="js";function Qc(){return typeof Jr<"u"&&typeof Jr.versions<"u"&&typeof Jr.versions.node<"u"}function ya(){return!fo()&&!!zu()&&navigator.product===v4}function vo(){return!Qc()&&!!zu()&&!!fo()}function bo(){return ya()?ni.reactNative:Qc()?ni.node:vo()?ni.browser:ni.unknown}function m4(){var r;try{return ya()&&typeof pt<"u"&&typeof(pt==null?void 0:pt.Application)<"u"?(r=pt.Application)==null?void 0:r.applicationId:void 0}catch{return}}function y4(r,e){let t=ro.parse(r);return t=op(op({},t),e),r=ro.stringify(t),r}function Ig(){return B1()||{name:"",description:"",url:"",icons:[""]}}function w4(){if(bo()===ni.reactNative&&typeof pt<"u"&&typeof(pt==null?void 0:pt.Platform)<"u"){const{OS:t,Version:i}=pt.Platform;return[t,i].join("-")}const r=vw();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function _4(){var r;const e=bo();return e===ni.browser?[e,((r=U1())==null?void 0:r.host)||"unknown"].join(":"):e}function Ag(r,e,t){const i=w4(),s=_4();return[[r,e].join("-"),[b4,t].join("-"),i,s].join("/")}function E4({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:s,projectId:o,useOnCloseEvent:f,bundleId:h}){const u=t.split("?"),d=Ag(r,e,i),g={auth:s,ua:d,projectId:o,useOnCloseEvent:f||void 0,origin:h||void 0},y=y4(u[1]||"",g);return u[0]+"?"+y}function As(r,e){return r.filter(t=>e.includes(t)).length===r.length}function Pg(r){return Object.fromEntries(r.entries())}function Dg(r){return new Map(Object.entries(r))}function Ss(r=me.FIVE_MINUTES,e){const t=me.toMiliseconds(r||me.FIVE_MINUTES);let i,s,o;return{resolve:f=>{o&&i&&(clearTimeout(o),i(f))},reject:f=>{o&&s&&(clearTimeout(o),s(f))},done:()=>new Promise((f,h)=>{o=setTimeout(()=>{h(new Error(e))},t),i=f,s=h})}}function da(r,e,t){return new Promise(async(i,s)=>{const o=setTimeout(()=>s(new Error(t)),e);try{const f=await r;i(f)}catch(f){s(f)}clearTimeout(o)})}function Mg(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function x4(r){return Mg("topic",r)}function S4(r){return Mg("id",r)}function Og(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function or(r,e){return me.fromMiliseconds((e||Date.now())+me.toMiliseconds(r))}function jn(r){return Date.now()>=me.toMiliseconds(r)}function vt(r,e){return`${r}${e?`:${e}`:""}`}function Lc(r=[],e=[]){return[...new Set([...r,...e])]}async function I4({id:r,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const s=typeof t=="string"?JSON.parse(t):t,o=s==null?void 0:s.href;if(typeof o!="string")return;const f=A4(o,r,e),h=bo();if(h===ni.browser){if(!((i=fo())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}f.startsWith("https://")||f.startsWith("http://")?window.open(f,"_blank","noreferrer noopener"):window.open(f,D4()?"_blank":"_self","noreferrer noopener")}else h===ni.reactNative&&typeof(pt==null?void 0:pt.Linking)<"u"&&await pt.Linking.openURL(f)}catch(s){console.error(s)}}function A4(r,e,t){const i=`requestId=${e}&sessionTopic=${t}`;r.endsWith("/")&&(r=r.slice(0,-1));let s=`${r}`;if(r.startsWith("https://t.me")){const o=r.includes("?")?"&startapp=":"?startapp=";s=`${s}${o}${M4(i,!0)}`}else s=`${s}/wc?${i}`;return s}async function P4(r,e){let t="";try{if(vo()&&(t=localStorage.getItem(e),t))return t;t=await r.getItem(e)}catch(i){console.error(i)}return t}function cp(r,e){if(!r.includes(e))return null;const t=r.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function fp(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function nd(){return typeof Jr<"u"&&{}.IS_VITEST==="true"}function D4(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function M4(r,e=!1){const t=Ii.from(r).toString("base64");return e?t.replace(/[=]/g,""):t}function Rg(r){return Ii.from(r,"base64").toString("utf-8")}const O4="https://rpc.walletconnect.org/v1";async function R4(r,e,t,i,s,o){switch(t.t){case"eip191":return C4(r,e,t.s);case"eip1271":return await N4(r,e,t.s,i,s,o);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function C4(r,e,t){return I5(j1(e),t).toLowerCase()===r.toLowerCase()}async function N4(r,e,t,i,s,o){const f=ua(i);if(!f.namespace||!f.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const h="0x1626ba7e",u="0000000000000000000000000000000000000000000000000000000000000040",d="0000000000000000000000000000000000000000000000000000000000000041",g=t.substring(2),y=j1(e).substring(2),P=h+y+u+d+g,S=await fetch(`${o||O4}/?chainId=${i}&projectId=${s}`,{method:"POST",body:JSON.stringify({id:T4(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:P},"latest"]})}),{result:A}=await S.json();return A?A.slice(0,h.length).toLowerCase()===h.toLowerCase():!1}catch(h){return console.error("isValidEip1271Signature: ",h),!1}}function T4(){return Date.now()+Math.floor(Math.random()*1e3)}var $4=Object.defineProperty,F4=Object.defineProperties,L4=Object.getOwnPropertyDescriptors,hp=Object.getOwnPropertySymbols,q4=Object.prototype.hasOwnProperty,U4=Object.prototype.propertyIsEnumerable,up=(r,e,t)=>e in r?$4(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,B4=(r,e)=>{for(var t in e||(e={}))q4.call(e,t)&&up(r,t,e[t]);if(hp)for(var t of hp(e))U4.call(e,t)&&up(r,t,e[t]);return r},z4=(r,e)=>F4(r,L4(e));const K4="did:pkh:",sd=r=>r==null?void 0:r.split(":"),H4=r=>{const e=r&&sd(r);if(e)return r.includes(K4)?e[3]:e[1]},Du=r=>{const e=r&&sd(r);if(e)return e[2]+":"+e[3]},ef=r=>{const e=r&&sd(r);if(e)return e.pop()};async function dp(r){const{cacao:e,projectId:t}=r,{s:i,p:s}=e,o=Cg(s,s.iss),f=ef(s.iss);return await R4(f,o,i,Du(s.iss),t)}const Cg=(r,e)=>{const t=`${r.domain} wants you to sign in with your Ethereum account:`,i=ef(e);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=r.statement||void 0;const o=`URI: ${r.aud||r.uri}`,f=`Version: ${r.version}`,h=`Chain ID: ${H4(e)}`,u=`Nonce: ${r.nonce}`,d=`Issued At: ${r.iat}`,g=r.exp?`Expiration Time: ${r.exp}`:void 0,y=r.nbf?`Not Before: ${r.nbf}`:void 0,P=r.requestId?`Request ID: ${r.requestId}`:void 0,S=r.resources?`Resources:${r.resources.map(F=>`
3
3
  - ${F}`).join("")}`:void 0,A=qc(r.resources);if(A){const F=io(A);s=Z4(s,F)}return[t,i,"",s,"",o,f,h,u,d,g,y,P,S].filter(F=>F!=null).join(`
4
4
  `)};function k4(r){return Ii.from(JSON.stringify(r)).toString("base64")}function j4(r){return JSON.parse(Ii.from(r,"base64").toString("utf-8"))}function Ms(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const e=Object.keys(r.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=r.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(s=>{const o=i[s];if(!Array.isArray(o))throw new Error(`Ability limits ${s} must be an array of objects, found: ${o}`);if(!o.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);o.forEach(f=>{if(typeof f!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${f}`)})})})}function W4(r,e,t,i={}){return t==null||t.sort((s,o)=>s.localeCompare(o)),{att:{[r]:G4(e,t,i)}}}function G4(r,e,t={}){e=e==null?void 0:e.sort((s,o)=>s.localeCompare(o));const i=e.map(s=>({[`${r}/${s}`]:[t]}));return Object.assign({},...i)}function Ng(r){return Ms(r),`urn:recap:${k4(r).replace(/=/g,"")}`}function io(r){const e=j4(r.replace("urn:recap:",""));return Ms(e),e}function V4(r,e,t){const i=W4(r,e,t);return Ng(i)}function J4(r){return r&&r.includes("urn:recap:")}function Y4(r,e){const t=io(r),i=io(e),s=X4(t,i);return Ng(s)}function X4(r,e){Ms(r),Ms(e);const t=Object.keys(r.att).concat(Object.keys(e.att)).sort((s,o)=>s.localeCompare(o)),i={att:{}};return t.forEach(s=>{var o,f;Object.keys(((o=r.att)==null?void 0:o[s])||{}).concat(Object.keys(((f=e.att)==null?void 0:f[s])||{})).sort((h,u)=>h.localeCompare(u)).forEach(h=>{var u,d;i.att[s]=z4(B4({},i.att[s]),{[h]:((u=r.att[s])==null?void 0:u[h])||((d=e.att[s])==null?void 0:d[h])})})}),i}function Z4(r="",e){Ms(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(t))return r;const i=[];let s=0;Object.keys(e.att).forEach(h=>{const u=Object.keys(e.att[h]).map(y=>({ability:y.split("/")[0],action:y.split("/")[1]}));u.sort((y,P)=>y.action.localeCompare(P.action));const d={};u.forEach(y=>{d[y.ability]||(d[y.ability]=[]),d[y.ability].push(y.action)});const g=Object.keys(d).map(y=>(s++,`(${s}) '${y}': '${d[y].join("', '")}' for '${h}'.`));i.push(g.join(", ").replace(".,","."))});const o=i.join(" "),f=`${t}${o}`;return`${r?r+" ":""}${f}`}function lp(r){var e;const t=io(r);Ms(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(s=>s.split("/")[1]):[]}function pp(r){const e=io(r);Ms(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(s=>{var o;(o=s==null?void 0:s[0])!=null&&o.chains&&t.push(s[0].chains)})}),[...new Set(t.flat())]}function qc(r){if(!r)return;const e=r==null?void 0:r[r.length-1];return J4(e)?e:void 0}const Tg="base10",Ur="base16",Gn="base64pad",ka="base64url",mo="utf8",$g=0,On=1,yo=2,Q4=0,gp=1,Qa=12,ad=32;function e9(){const r=Xu.generateKeyPair();return{privateKey:gr(r.secretKey,Ur),publicKey:gr(r.publicKey,Ur)}}function Mu(){const r=Zn.randomBytes(ad);return gr(r,Ur)}function t9(r,e){const t=Xu.sharedKey(pr(r,Ur),pr(e,Ur),!0),i=new s_(uo.SHA256,t).expand(ad);return gr(i,Ur)}function Uc(r){const e=uo.hash(pr(r,Ur));return gr(e,Ur)}function Pn(r){const e=uo.hash(pr(r,mo));return gr(e,Ur)}function Fg(r){return pr(`${r}`,Tg)}function Os(r){return Number(gr(r,Tg))}function r9(r){const e=Fg(typeof r.type<"u"?r.type:$g);if(Os(e)===On&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?pr(r.senderPublicKey,Ur):void 0,i=typeof r.iv<"u"?pr(r.iv,Ur):Zn.randomBytes(Qa),s=new Ju.ChaCha20Poly1305(pr(r.symKey,Ur)).seal(i,pr(r.message,mo));return Lg({type:e,sealed:s,iv:i,senderPublicKey:t,encoding:r.encoding})}function i9(r,e){const t=Fg(yo),i=Zn.randomBytes(Qa),s=pr(r,mo);return Lg({type:t,sealed:s,iv:i,encoding:e})}function n9(r){const e=new Ju.ChaCha20Poly1305(pr(r.symKey,Ur)),{sealed:t,iv:i}=no({encoded:r.encoded,encoding:r==null?void 0:r.encoding}),s=e.open(i,t);if(s===null)throw new Error("Failed to decrypt");return gr(s,mo)}function s9(r,e){const{sealed:t}=no({encoded:r,encoding:e});return gr(t,mo)}function Lg(r){const{encoding:e=Gn}=r;if(Os(r.type)===yo)return gr(Fc([r.type,r.sealed]),e);if(Os(r.type)===On){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return gr(Fc([r.type,r.senderPublicKey,r.iv,r.sealed]),e)}return gr(Fc([r.type,r.iv,r.sealed]),e)}function no(r){const{encoded:e,encoding:t=Gn}=r,i=pr(e,t),s=i.slice(Q4,gp),o=gp;if(Os(s)===On){const d=o+ad,g=d+Qa,y=i.slice(o,d),P=i.slice(d,g),S=i.slice(g);return{type:s,sealed:S,iv:P,senderPublicKey:y}}if(Os(s)===yo){const d=i.slice(o),g=Zn.randomBytes(Qa);return{type:s,sealed:d,iv:g}}const f=o+Qa,h=i.slice(o,f),u=i.slice(f);return{type:s,sealed:u,iv:h}}function a9(r,e){const t=no({encoded:r,encoding:e==null?void 0:e.encoding});return qg({type:Os(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?gr(t.senderPublicKey,Ur):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function qg(r){const e=(r==null?void 0:r.type)||$g;if(e===On){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function vp(r){return r.type===On&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function bp(r){return r.type===yo}function o9(r){return new dg.ec("p256").keyFromPublic({x:Ii.from(r.x,"base64").toString("hex"),y:Ii.from(r.y,"base64").toString("hex")},"hex")}function c9(r){let e=r.replace(/-/g,"+").replace(/_/g,"/");const t=e.length%4;return t>0&&(e+="=".repeat(4-t)),e}function f9(r){return Ii.from(c9(r),"base64")}function h9(r,e){const[t,i,s]=r.split("."),o=f9(s);if(o.length!==64)throw new Error("Invalid signature length");const f=o.slice(0,32).toString("hex"),h=o.slice(32,64).toString("hex"),u=`${t}.${i}`,d=new uo.SHA256().update(Ii.from(u)).digest(),g=o9(e),y=Ii.from(d).toString("hex");if(!g.verify(y,{r:f,s:h}))throw new Error("Invalid signature");return Pu(r).payload}const u9="irn";function Ou(r){return(r==null?void 0:r.relay)||{protocol:u9}}function Xa(r){const e=u4[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var d9=Object.defineProperty,l9=Object.defineProperties,p9=Object.getOwnPropertyDescriptors,mp=Object.getOwnPropertySymbols,g9=Object.prototype.hasOwnProperty,v9=Object.prototype.propertyIsEnumerable,yp=(r,e,t)=>e in r?d9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,wp=(r,e)=>{for(var t in e||(e={}))g9.call(e,t)&&yp(r,t,e[t]);if(mp)for(var t of mp(e))v9.call(e,t)&&yp(r,t,e[t]);return r},b9=(r,e)=>l9(r,p9(e));function m9(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(s=>{if(s.startsWith(i)){const o=s.replace(i,""),f=r[s];t[o]=f}}),t}function _p(r){if(!r.includes("wc:")){const u=Rg(r);u!=null&&u.includes("wc:")&&(r=u)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),s=r.substring(e+1,t).split("@"),o=typeof t<"u"?r.substring(t):"",f=ro.parse(o),h=typeof f.methods=="string"?f.methods.split(","):void 0;return{protocol:i,topic:y9(s[0]),version:parseInt(s[1],10),symKey:f.symKey,relay:m9(f),methods:h,expiryTimestamp:f.expiryTimestamp?parseInt(f.expiryTimestamp,10):void 0}}function y9(r){return r.startsWith("//")?r.substring(2):r}function w9(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(s=>{const o=t+e+s;r[s]&&(i[o]=r[s])}),i}function Ep(r){return`${r.protocol}:${r.topic}@${r.version}?`+ro.stringify(wp(b9(wp({symKey:r.symKey},w9(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function Ac(r,e,t){return`${r}?wc_ev=${t}&topic=${e}`}function wa(r){const e=[];return r.forEach(t=>{const[i,s]=t.split(":");e.push(`${i}:${s}`)}),e}function _9(r){const e=[];return Object.values(r).forEach(t=>{e.push(...wa(t.accounts))}),e}function E9(r,e){const t=[];return Object.values(r).forEach(i=>{wa(i.accounts).includes(e)&&t.push(...i.methods)}),t}function x9(r,e){const t=[];return Object.values(r).forEach(i=>{wa(i.accounts).includes(e)&&t.push(...i.events)}),t}function od(r){return r.includes(":")}function Za(r){return od(r)?r.split(":")[0]:r}function S9(r){const e={};return r==null||r.forEach(t=>{const[i,s]=t.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(t),e[i].chains.push(`${i}:${s}`)}),e}function xp(r,e){e=e.map(i=>i.replace("did:pkh:",""));const t=S9(e);for(const[i,s]of Object.entries(t))s.methods?s.methods=Lc(s.methods,r):s.methods=r,s.events=["chainChanged","accountsChanged"];return t}const I9={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},A9={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function be(r,e){const{message:t,code:i}=A9[r];return{message:e?`${t} ${e}`:t,code:i}}function Ct(r,e){const{message:t,code:i}=I9[r];return{message:e?`${t} ${e}`:t,code:i}}function hn(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function so(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function qr(r){return typeof r>"u"}function tr(r,e){return e&&qr(r)?!0:typeof r=="string"&&!!r.trim().length}function cd(r,e){return e&&qr(r)?!0:typeof r=="number"&&!isNaN(r)}function P9(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),s=Object.keys(t);let o=!0;return As(s,i)?(i.forEach(f=>{const{accounts:h,methods:u,events:d}=r.namespaces[f],g=wa(h),y=t[f];(!As(Sg(f,y),g)||!As(y.methods,u)||!As(y.events,d))&&(o=!1)}),o):!1}function tf(r){return tr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function D9(r){if(tr(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&tf(t)}}return!1}function M9(r){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(tr(r,!1)){if(e(r))return!0;const t=Rg(r);return e(t)}}catch{}return!1}function O9(r){var e;return(e=r==null?void 0:r.proposer)==null?void 0:e.publicKey}function R9(r){return r==null?void 0:r.topic}function C9(r,e){let t=null;return tr(r==null?void 0:r.publicKey,!1)||(t=be("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Sp(r){let e=!0;return hn(r)?r.length&&(e=r.every(t=>tr(t,!1))):e=!1,e}function N9(r,e,t){let i=null;return hn(e)&&e.length?e.forEach(s=>{i||tf(s)||(i=Ct("UNSUPPORTED_CHAINS",`${t}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):tf(r)||(i=Ct("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function T9(r,e,t){let i=null;return Object.entries(r).forEach(([s,o])=>{if(i)return;const f=N9(s,Sg(s,o),`${e} ${t}`);f&&(i=f)}),i}function $9(r,e){let t=null;return hn(r)?r.forEach(i=>{t||D9(i)||(t=Ct("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Ct("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function F9(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const s=$9(i==null?void 0:i.accounts,`${e} namespace`);s&&(t=s)}),t}function L9(r,e){let t=null;return Sp(r==null?void 0:r.methods)?Sp(r==null?void 0:r.events)||(t=Ct("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Ct("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function Ug(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const s=L9(i,`${e}, namespace`);s&&(t=s)}),t}function q9(r,e,t){let i=null;if(r&&so(r)){const s=Ug(r,e);s&&(i=s);const o=T9(r,e,t);o&&(i=o)}else i=be("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function ru(r,e){let t=null;if(r&&so(r)){const i=Ug(r,e);i&&(t=i);const s=F9(r,e);s&&(t=s)}else t=be("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function Bg(r){return tr(r.protocol,!0)}function U9(r,e){let t=!1;return e&&!r?t=!0:r&&hn(r)&&r.length&&r.forEach(i=>{t=Bg(i)}),t}function B9(r){return typeof r=="number"}function Gr(r){return typeof r<"u"&&typeof r!==null}function z9(r){return!(!r||typeof r!="object"||!r.code||!cd(r.code,!1)||!r.message||!tr(r.message,!1))}function K9(r){return!(qr(r)||!tr(r.method,!1))}function H9(r){return!(qr(r)||qr(r.result)&&qr(r.error)||!cd(r.id,!1)||!tr(r.jsonrpc,!1))}function k9(r){return!(qr(r)||!tr(r.name,!1))}function Ip(r,e){return!(!tf(e)||!_9(r).includes(e))}function j9(r,e,t){return tr(t,!1)?E9(r,e).includes(t):!1}function W9(r,e,t){return tr(t,!1)?x9(r,e).includes(t):!1}function Ap(r,e,t){let i=null;const s=G9(r),o=V9(e),f=Object.keys(s),h=Object.keys(o),u=Pp(Object.keys(r)),d=Pp(Object.keys(e)),g=u.filter(y=>!d.includes(y));return g.length&&(i=be("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
@@ -33,5 +33,5 @@ __p += '`),wt&&(le+=`' +
33
33
  function print() { __p += __j.call(arguments, '') }
34
34
  `:`;
35
35
  `)+le+`return __p
36
- }`;var dt=l0(function(){return At(C,Ne+"return "+le).apply(t,G)});if(dt.source=le,Oh(dt))throw dt;return dt}function a6(n){return Dt(n).toLowerCase()}function o6(n){return Dt(n).toUpperCase()}function c6(n,a,c){if(n=Dt(n),n&&(c||a===t))return Ed(n);if(!n||!(a=ei(a)))return n;var b=Li(n),I=Li(a),C=xd(b,I),G=Sd(b,I)+1;return Hn(b,C,G).join("")}function f6(n,a,c){if(n=Dt(n),n&&(c||a===t))return n.slice(0,Ad(n)+1);if(!n||!(a=ei(a)))return n;var b=Li(n),I=Sd(b,Li(a))+1;return Hn(b,0,I).join("")}function h6(n,a,c){if(n=Dt(n),n&&(c||a===t))return n.replace(Pt,"");if(!n||!(a=ei(a)))return n;var b=Li(n),I=xd(b,Li(a));return Hn(b,I).join("")}function u6(n,a){var c=pe,b=q;if(Wt(a)){var I="separator"in a?a.separator:I;c="length"in a?ht(a.length):c,b="omission"in a?ei(a.omission):b}n=Dt(n);var C=n.length;if(Hs(n)){var G=Li(n);C=G.length}if(c>=C)return n;var X=c-ks(b);if(X<1)return b;var ee=G?Hn(G,0,X).join(""):n.slice(0,X);if(I===t)return ee+b;if(G&&(X+=ee.length-X),Rh(I)){if(n.slice(X).search(I)){var fe,he=ee;for(I.global||(I=Gf(I.source,Dt(Yt.exec(I))+"g")),I.lastIndex=0;fe=I.exec(he);)var le=fe.index;ee=ee.slice(0,le===t?X:le)}}else if(n.indexOf(ei(I),X)!=X){var we=ee.lastIndexOf(I);we>-1&&(ee=ee.slice(0,we))}return ee+b}function d6(n){return n=Dt(n),n&&ke.test(n)?n.replace(Ar,zv):n}var l6=Xs(function(n,a,c){return n+(c?" ":"")+a.toUpperCase()}),Th=pl("toUpperCase");function d0(n,a,c){return n=Dt(n),a=c?t:a,a===t?Fv(n)?kv(n):Pv(n):n.match(a)||[]}var l0=lt(function(n,a){try{return hr(n,t,a)}catch(c){return Oh(c)?c:new rt(c)}}),p6=mn(function(n,a){return gi(a,function(c){c=en(c),vn(n,c,Dh(n[c],n))}),n});function g6(n){var a=n==null?0:n.length,c=Te();return n=a?jt(n,function(b){if(typeof b[1]!="function")throw new vi(f);return[c(b[0]),b[1]]}):[],lt(function(b){for(var I=-1;++I<a;){var C=n[I];if(hr(C[0],this,b))return hr(C[1],this,b)}})}function v6(n){return zb(mi(n,y))}function $h(n){return function(){return n}}function b6(n,a){return n==null||n!==n?a:n}var m6=vl(),y6=vl(!0);function jr(n){return n}function Fh(n){return Wd(typeof n=="function"?n:mi(n,y))}function w6(n){return Vd(mi(n,y))}function _6(n,a){return Jd(n,mi(a,y))}var E6=lt(function(n,a){return function(c){return Ta(c,n,a)}}),x6=lt(function(n,a){return function(c){return Ta(n,c,a)}});function Lh(n,a,c){var b=ur(a),I=ac(a,b);c==null&&!(Wt(a)&&(I.length||!b.length))&&(c=a,a=n,n=this,I=ac(a,ur(a)));var C=!(Wt(c)&&"chain"in c)||!!c.chain,G=wn(n);return gi(I,function(X){var ee=a[X];n[X]=ee,G&&(n.prototype[X]=function(){var fe=this.__chain__;if(C||fe){var he=n(this.__wrapped__),le=he.__actions__=Kr(this.__actions__);return le.push({func:ee,args:arguments,thisArg:n}),he.__chain__=fe,he}return ee.apply(n,Ln([this.value()],arguments))})}),n}function S6(){return yt._===this&&(yt._=Yv),this}function qh(){}function I6(n){return n=ht(n),lt(function(a){return Yd(a,n)})}var A6=gh(jt),P6=gh(bd),D6=gh(Bf);function p0(n){return Eh(n)?zf(en(n)):nm(n)}function M6(n){return function(a){return n==null?t:gs(n,a)}}var O6=ml(),R6=ml(!0);function Uh(){return[]}function Bh(){return!1}function C6(){return{}}function N6(){return""}function T6(){return!0}function $6(n,a){if(n=ht(n),n<1||n>T)return[];var c=M,b=Pr(n,M);a=Te(a),n-=M;for(var I=kf(b,a);++c<n;)a(c);return I}function F6(n){return st(n)?jt(n,en):ti(n)?[n]:Kr(Tl(Dt(n)))}function L6(n){var a=++Vv;return Dt(n)+a}var q6=dc(function(n,a){return n+a},0),U6=vh("ceil"),B6=dc(function(n,a){return n/a},1),z6=vh("floor");function K6(n){return n&&n.length?sc(n,jr,th):t}function H6(n,a){return n&&n.length?sc(n,Te(a,2),th):t}function k6(n){return wd(n,jr)}function j6(n,a){return wd(n,Te(a,2))}function W6(n){return n&&n.length?sc(n,jr,sh):t}function G6(n,a){return n&&n.length?sc(n,Te(a,2),sh):t}var V6=dc(function(n,a){return n*a},1),J6=vh("round"),Y6=dc(function(n,a){return n-a},0);function X6(n){return n&&n.length?Hf(n,jr):0}function Z6(n,a){return n&&n.length?Hf(n,Te(a,2)):0}return O.after=w2,O.ary=jl,O.assign=o3,O.assignIn=s0,O.assignInWith=Ic,O.assignWith=c3,O.at=f3,O.before=Wl,O.bind=Dh,O.bindAll=p6,O.bindKey=Gl,O.castArray=C2,O.chain=Kl,O.chunk=zm,O.compact=Km,O.concat=Hm,O.cond=g6,O.conforms=v6,O.constant=$h,O.countBy=Xy,O.create=h3,O.curry=Vl,O.curryRight=Jl,O.debounce=Yl,O.defaults=u3,O.defaultsDeep=d3,O.defer=_2,O.delay=E2,O.difference=km,O.differenceBy=jm,O.differenceWith=Wm,O.drop=Gm,O.dropRight=Vm,O.dropRightWhile=Jm,O.dropWhile=Ym,O.fill=Xm,O.filter=Qy,O.flatMap=r2,O.flatMapDeep=i2,O.flatMapDepth=n2,O.flatten=ql,O.flattenDeep=Zm,O.flattenDepth=Qm,O.flip=x2,O.flow=m6,O.flowRight=y6,O.fromPairs=ey,O.functions=y3,O.functionsIn=w3,O.groupBy=s2,O.initial=ry,O.intersection=iy,O.intersectionBy=ny,O.intersectionWith=sy,O.invert=E3,O.invertBy=x3,O.invokeMap=o2,O.iteratee=Fh,O.keyBy=c2,O.keys=ur,O.keysIn=kr,O.map=yc,O.mapKeys=I3,O.mapValues=A3,O.matches=w6,O.matchesProperty=_6,O.memoize=_c,O.merge=P3,O.mergeWith=a0,O.method=E6,O.methodOf=x6,O.mixin=Lh,O.negate=Ec,O.nthArg=I6,O.omit=D3,O.omitBy=M3,O.once=S2,O.orderBy=f2,O.over=A6,O.overArgs=I2,O.overEvery=P6,O.overSome=D6,O.partial=Mh,O.partialRight=Xl,O.partition=h2,O.pick=O3,O.pickBy=o0,O.property=p0,O.propertyOf=M6,O.pull=fy,O.pullAll=Bl,O.pullAllBy=hy,O.pullAllWith=uy,O.pullAt=dy,O.range=O6,O.rangeRight=R6,O.rearg=A2,O.reject=l2,O.remove=ly,O.rest=P2,O.reverse=Ah,O.sampleSize=g2,O.set=C3,O.setWith=N3,O.shuffle=v2,O.slice=py,O.sortBy=y2,O.sortedUniq=_y,O.sortedUniqBy=Ey,O.split=r6,O.spread=D2,O.tail=xy,O.take=Sy,O.takeRight=Iy,O.takeRightWhile=Ay,O.takeWhile=Py,O.tap=Ky,O.throttle=M2,O.thru=mc,O.toArray=r0,O.toPairs=c0,O.toPairsIn=f0,O.toPath=F6,O.toPlainObject=n0,O.transform=T3,O.unary=O2,O.union=Dy,O.unionBy=My,O.unionWith=Oy,O.uniq=Ry,O.uniqBy=Cy,O.uniqWith=Ny,O.unset=$3,O.unzip=Ph,O.unzipWith=zl,O.update=F3,O.updateWith=L3,O.values=ea,O.valuesIn=q3,O.without=Ty,O.words=d0,O.wrap=R2,O.xor=$y,O.xorBy=Fy,O.xorWith=Ly,O.zip=qy,O.zipObject=Uy,O.zipObjectDeep=By,O.zipWith=zy,O.entries=c0,O.entriesIn=f0,O.extend=s0,O.extendWith=Ic,Lh(O,O),O.add=q6,O.attempt=l0,O.camelCase=K3,O.capitalize=h0,O.ceil=U6,O.clamp=U3,O.clone=N2,O.cloneDeep=$2,O.cloneDeepWith=F2,O.cloneWith=T2,O.conformsTo=L2,O.deburr=u0,O.defaultTo=b6,O.divide=B6,O.endsWith=H3,O.eq=Ui,O.escape=k3,O.escapeRegExp=j3,O.every=Zy,O.find=e2,O.findIndex=Fl,O.findKey=l3,O.findLast=t2,O.findLastIndex=Ll,O.findLastKey=p3,O.floor=z6,O.forEach=Hl,O.forEachRight=kl,O.forIn=g3,O.forInRight=v3,O.forOwn=b3,O.forOwnRight=m3,O.get=Ch,O.gt=q2,O.gte=U2,O.has=_3,O.hasIn=Nh,O.head=Ul,O.identity=jr,O.includes=a2,O.indexOf=ty,O.inRange=B3,O.invoke=S3,O.isArguments=ms,O.isArray=st,O.isArrayBuffer=B2,O.isArrayLike=Hr,O.isArrayLikeObject=Zt,O.isBoolean=z2,O.isBuffer=kn,O.isDate=K2,O.isElement=H2,O.isEmpty=k2,O.isEqual=j2,O.isEqualWith=W2,O.isError=Oh,O.isFinite=G2,O.isFunction=wn,O.isInteger=Zl,O.isLength=xc,O.isMap=Ql,O.isMatch=V2,O.isMatchWith=J2,O.isNaN=Y2,O.isNative=X2,O.isNil=Q2,O.isNull=Z2,O.isNumber=e0,O.isObject=Wt,O.isObjectLike=Gt,O.isPlainObject=Ba,O.isRegExp=Rh,O.isSafeInteger=e3,O.isSet=t0,O.isString=Sc,O.isSymbol=ti,O.isTypedArray=Qs,O.isUndefined=t3,O.isWeakMap=r3,O.isWeakSet=i3,O.join=ay,O.kebabCase=W3,O.last=wi,O.lastIndexOf=oy,O.lowerCase=G3,O.lowerFirst=V3,O.lt=n3,O.lte=s3,O.max=K6,O.maxBy=H6,O.mean=k6,O.meanBy=j6,O.min=W6,O.minBy=G6,O.stubArray=Uh,O.stubFalse=Bh,O.stubObject=C6,O.stubString=N6,O.stubTrue=T6,O.multiply=V6,O.nth=cy,O.noConflict=S6,O.noop=qh,O.now=wc,O.pad=J3,O.padEnd=Y3,O.padStart=X3,O.parseInt=Z3,O.random=z3,O.reduce=u2,O.reduceRight=d2,O.repeat=Q3,O.replace=e6,O.result=R3,O.round=J6,O.runInContext=Z,O.sample=p2,O.size=b2,O.snakeCase=t6,O.some=m2,O.sortedIndex=gy,O.sortedIndexBy=vy,O.sortedIndexOf=by,O.sortedLastIndex=my,O.sortedLastIndexBy=yy,O.sortedLastIndexOf=wy,O.startCase=i6,O.startsWith=n6,O.subtract=Y6,O.sum=X6,O.sumBy=Z6,O.template=s6,O.times=$6,O.toFinite=_n,O.toInteger=ht,O.toLength=i0,O.toLower=a6,O.toNumber=_i,O.toSafeInteger=a3,O.toString=Dt,O.toUpper=o6,O.trim=c6,O.trimEnd=f6,O.trimStart=h6,O.truncate=u6,O.unescape=d6,O.uniqueId=L6,O.upperCase=l6,O.upperFirst=Th,O.each=Hl,O.eachRight=kl,O.first=Ul,Lh(O,function(){var n={};return Zi(O,function(a,c){Rt.call(O.prototype,c)||(n[c]=a)}),n}(),{chain:!1}),O.VERSION=i,gi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){O[n].placeholder=O}),gi(["drop","take"],function(n,a){bt.prototype[n]=function(c){c=c===t?1:ar(ht(c),0);var b=this.__filtered__&&!a?new bt(this):this.clone();return b.__filtered__?b.__takeCount__=Pr(c,b.__takeCount__):b.__views__.push({size:Pr(c,M),type:n+(b.__dir__<0?"Right":"")}),b},bt.prototype[n+"Right"]=function(c){return this.reverse()[n](c).reverse()}}),gi(["filter","map","takeWhile"],function(n,a){var c=a+1,b=c==_||c==R;bt.prototype[n]=function(I){var C=this.clone();return C.__iteratees__.push({iteratee:Te(I,3),type:c}),C.__filtered__=C.__filtered__||b,C}}),gi(["head","last"],function(n,a){var c="take"+(a?"Right":"");bt.prototype[n]=function(){return this[c](1).value()[0]}}),gi(["initial","tail"],function(n,a){var c="drop"+(a?"":"Right");bt.prototype[n]=function(){return this.__filtered__?new bt(this):this[c](1)}}),bt.prototype.compact=function(){return this.filter(jr)},bt.prototype.find=function(n){return this.filter(n).head()},bt.prototype.findLast=function(n){return this.reverse().find(n)},bt.prototype.invokeMap=lt(function(n,a){return typeof n=="function"?new bt(this):this.map(function(c){return Ta(c,n,a)})}),bt.prototype.reject=function(n){return this.filter(Ec(Te(n)))},bt.prototype.slice=function(n,a){n=ht(n);var c=this;return c.__filtered__&&(n>0||a<0)?new bt(c):(n<0?c=c.takeRight(-n):n&&(c=c.drop(n)),a!==t&&(a=ht(a),c=a<0?c.dropRight(-a):c.take(a-n)),c)},bt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},bt.prototype.toArray=function(){return this.take(M)},Zi(bt.prototype,function(n,a){var c=/^(?:filter|find|map|reject)|While$/.test(a),b=/^(?:head|last)$/.test(a),I=O[b?"take"+(a=="last"?"Right":""):a],C=b||/^find/.test(a);I&&(O.prototype[a]=function(){var G=this.__wrapped__,X=b?[1]:arguments,ee=G instanceof bt,fe=X[0],he=ee||st(G),le=function(gt){var wt=I.apply(O,Ln([gt],X));return b&&we?wt[0]:wt};he&&c&&typeof fe=="function"&&fe.length!=1&&(ee=he=!1);var we=this.__chain__,Ne=!!this.__actions__.length,Be=C&&!we,dt=ee&&!Ne;if(!C&&he){G=dt?G:new bt(this);var ze=n.apply(G,X);return ze.__actions__.push({func:mc,args:[le],thisArg:t}),new bi(ze,we)}return Be&&dt?n.apply(this,X):(ze=this.thru(le),Be?b?ze.value()[0]:ze.value():ze)})}),gi(["pop","push","shift","sort","splice","unshift"],function(n){var a=ko[n],c=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",b=/^(?:pop|shift)$/.test(n);O.prototype[n]=function(){var I=arguments;if(b&&!this.__chain__){var C=this.value();return a.apply(st(C)?C:[],I)}return this[c](function(G){return a.apply(st(G)?G:[],I)})}}),Zi(bt.prototype,function(n,a){var c=O[a];if(c){var b=c.name+"";Rt.call(Vs,b)||(Vs[b]=[]),Vs[b].push({name:a,func:c})}}),Vs[uc(t,J).name]=[{name:"wrapper",func:t}],bt.prototype.clone=db,bt.prototype.reverse=lb,bt.prototype.value=pb,O.prototype.at=Hy,O.prototype.chain=ky,O.prototype.commit=jy,O.prototype.next=Wy,O.prototype.plant=Vy,O.prototype.reverse=Jy,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=Yy,O.prototype.first=O.prototype.head,Pa&&(O.prototype[Pa]=Gy),O},js=jv();Xt?((Xt.exports=js)._=js,Lt._=js):yt._=js}).call(_r)})(af,af.exports);var YI=af.exports,XI=Object.defineProperty,ZI=Object.defineProperties,QI=Object.getOwnPropertyDescriptors,v1=Object.getOwnPropertySymbols,eA=Object.prototype.hasOwnProperty,tA=Object.prototype.propertyIsEnumerable,b1=(r,e,t)=>e in r?XI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,m1=(r,e)=>{for(var t in e||(e={}))eA.call(e,t)&&b1(r,t,e[t]);if(v1)for(var t of v1(e))tA.call(e,t)&&b1(r,t,e[t]);return r},y1=(r,e)=>ZI(r,QI(e));const rA={Accept:"application/json","Content-Type":"application/json"},iA="POST",w1={headers:rA,method:iA},_1=10;let Wi=class{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Di.EventEmitter,this.isAvailable=!1,this.registering=!1,!zp(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=Rn(e),i=await(await v0(this.url,y1(m1({},w1),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!zp(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,s)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),s(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=Rn({id:1,jsonrpc:"2.0",method:"test",params:[]});await v0(e,y1(m1({},w1),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Ds(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),s=i.message||i.toString(),o=Pf(e,s);this.events.emit("payload",o)}parseError(e,t=this.url){return Jg(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>_1&&this.events.setMaxListeners(_1)}};const E1="error",nA="wss://relay.walletconnect.org",sA="wc",aA="universal_provider",x1=`${sA}@2:${aA}:`,mv="https://rpc.walletconnect.org/v1/",aa="generic",oA=`${mv}bundler`,Ti={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var cA=Object.defineProperty,fA=Object.defineProperties,hA=Object.getOwnPropertyDescriptors,S1=Object.getOwnPropertySymbols,uA=Object.prototype.hasOwnProperty,dA=Object.prototype.propertyIsEnumerable,I1=(r,e,t)=>e in r?cA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Oc=(r,e)=>{for(var t in e||(e={}))uA.call(e,t)&&I1(r,t,e[t]);if(S1)for(var t of S1(e))dA.call(e,t)&&I1(r,t,e[t]);return r},lA=(r,e)=>fA(r,hA(e));function si(r,e,t){var i;const s=ua(r);return((i=e.rpcMap)==null?void 0:i[s.reference])||`${mv}?chainId=${s.namespace}:${s.reference}&projectId=${t}`}function Ls(r){return r.includes(":")?r.split(":")[1]:r}function yv(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function pA(r,e){const t=Object.keys(e.namespaces).filter(s=>s.includes(r));if(!t.length)return[];const i=[];return t.forEach(s=>{const o=e.namespaces[s].accounts;i.push(...o)}),i}function du(r={},e={}){const t=A1(r),i=A1(e);return YI.merge(t,i)}function A1(r){var e,t,i,s;const o={};if(!so(r))return o;for(const[f,h]of Object.entries(r)){const u=od(f)?[f]:h.chains,d=h.methods||[],g=h.events||[],y=h.rpcMap||{},P=Za(f);o[P]=lA(Oc(Oc({},o[P]),h),{chains:Lc(u,(e=o[P])==null?void 0:e.chains),methods:Lc(d,(t=o[P])==null?void 0:t.methods),events:Lc(g,(i=o[P])==null?void 0:i.events),rpcMap:Oc(Oc({},y),(s=o[P])==null?void 0:s.rpcMap)})}return o}function gA(r){return r.includes(":")?r.split(":")[2]:r}function P1(r){const e={};for(const[t,i]of Object.entries(r)){const s=i.methods||[],o=i.events||[],f=i.accounts||[],h=od(t)?[t]:i.chains?i.chains:yv(i.accounts);e[t]={chains:h,methods:s,events:o,accounts:f}}return e}function lu(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const wv={},St=r=>wv[r],pu=(r,e)=>{wv[r]=e};class vA{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}var bA=Object.defineProperty,mA=Object.defineProperties,yA=Object.getOwnPropertyDescriptors,D1=Object.getOwnPropertySymbols,wA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,M1=(r,e,t)=>e in r?bA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,O1=(r,e)=>{for(var t in e||(e={}))wA.call(e,t)&&M1(r,t,e[t]);if(D1)for(var t of D1(e))_A.call(e,t)&&M1(r,t,e[t]);return r},R1=(r,e)=>mA(r,yA(e));class EA{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||si(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=parseInt(Ls(t));e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let s=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const o=parseInt(s,16);if(this.isChainApproved(o))this.setDefaultChain(`${o}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:s}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${o}`);else throw new Error(`Failed to switch to chain 'eip155:${o}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,s;const o=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const f=this.client.session.get(e.topic),h=((s=f==null?void 0:f.sessionProperties)==null?void 0:s.capabilities)||{};if(h!=null&&h[o])return h==null?void 0:h[o];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:R1(O1({},f.sessionProperties||{}),{capabilities:R1(O1({},h||{}),{[o]:u})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return u}async getCallStatus(e){var t,i;const s=this.client.session.get(e.topic),o=(t=s.sessionProperties)==null?void 0:t.bundler_name;if(o){const h=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(h,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,h)}}const f=(i=s.sessionProperties)==null?void 0:i.bundler_url;if(f)try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from custom bundler",h,f)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const s=new URL(e),o=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Vn("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!o.ok)throw new Error(`Failed to fetch user operation receipt - ${o.status}`);return await o.json()}getBundlerUrl(e,t){return`${oA}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class xA{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class SA{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class IA{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||si(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new Ni(new Wi(i,St("disableProviderPing")))}}class AA{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),s=Ls(t);e[s]=this.createHttpProvider(s,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class PA{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class DA{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class MA{constructor(e){this.name="near",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||si(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace);return typeof i>"u"?void 0:new Ni(new Wi(i,St("disableProviderPing")))}}class OA{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||si(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace);return typeof i>"u"?void 0:new Ni(new Wi(i))}}class RA{constructor(e){this.name=aa,this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(s=>{const o=ua(s);i[`${o.namespace}:${o.reference}`]=this.createHttpProvider(s)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}var CA=Object.defineProperty,NA=Object.defineProperties,TA=Object.getOwnPropertyDescriptors,C1=Object.getOwnPropertySymbols,$A=Object.prototype.hasOwnProperty,FA=Object.prototype.propertyIsEnumerable,N1=(r,e,t)=>e in r?CA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Rc=(r,e)=>{for(var t in e||(e={}))$A.call(e,t)&&N1(r,t,e[t]);if(C1)for(var t of C1(e))FA.call(e,t)&&N1(r,t,e[t]);return r},gu=(r,e)=>NA(r,TA(e));let LA=class _v{constructor(e){this.events=new Bu,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:_o(If({level:(e==null?void 0:e.logger)||E1})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new _v(e);return await t.initialize(),t}async request(e,t,i){const[s,o]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Rc({},e),chainId:`${s}:${o}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,s){const o=new Date().getTime();this.request(e,i,s).then(f=>t(null,Af(o,f))).catch(f=>t(f,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Ct("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:s}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const o=await s();if(this.session=o.session,this.session){const f=P1(this.session.namespaces);this.namespaces=du(this.namespaces,f),this.persist("namespaces",this.namespaces),this.onConnect()}return o}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:s}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await s().then(o=>{this.session=o;const f=P1(o.namespaces);this.namespaces=du(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==bv)throw o;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,s]=this.validateChain(e),o=this.getProvider(i);o.name===aa?o.setDefaultChain(`${i}:${s}`,t):o.setDefaultChain(s,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(hn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await gd.init({core:this.providerOpts.core,logger:this.providerOpts.logger||E1,relayUrl:this.providerOpts.relayUrl||nA,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Za(t)))];pu("client",this.client),pu("events",this.events),pu("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=pA(t,this.session),s=yv(i),o=du(this.namespaces,this.optionalNamespaces),f=gu(Rc({},o[t]),{accounts:i,chains:s});switch(t){case"eip155":this.rpcProviders[t]=new EA({namespace:f});break;case"algorand":this.rpcProviders[t]=new IA({namespace:f});break;case"solana":this.rpcProviders[t]=new xA({namespace:f});break;case"cosmos":this.rpcProviders[t]=new SA({namespace:f});break;case"polkadot":this.rpcProviders[t]=new vA({namespace:f});break;case"cip34":this.rpcProviders[t]=new AA({namespace:f});break;case"elrond":this.rpcProviders[t]=new PA({namespace:f});break;case"multiversx":this.rpcProviders[t]=new DA({namespace:f});break;case"near":this.rpcProviders[t]=new MA({namespace:f});break;case"tezos":this.rpcProviders[t]=new OA({namespace:f});break;default:this.rpcProviders[aa]?this.rpcProviders[aa].updateNamespace(f):this.rpcProviders[aa]=new RA({namespace:f})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const s=i.data;s&&hn(s)&&this.events.emit("accountsChanged",s.map(gA))}else if(i.name==="chainChanged"){const s=t.chainId,o=t.event.data,f=Za(s),h=lu(s)!==lu(o)?`${f}:${lu(o)}`:s;this.onChainChanged(h)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:s}=t,o=(i=this.client)==null?void 0:i.session.get(e);this.session=gu(Rc({},o),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",gu(Rc({},Ct("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Ti.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[aa]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:s}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=s,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(f=>Za(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const s=Za(Object.keys(this.namespaces)[0]),o=this.rpcProviders[s].getDefaultChain();return[s,o]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,s]=this.validateChain(e);s&&(t||this.getProvider(i).setDefaultChain(s),this.namespaces[i]?this.namespaces[i].defaultChain=s:this.namespaces[`${i}:${s}`]?this.namespaces[`${i}:${s}`].defaultChain=s:this.namespaces[`${i}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${x1}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${x1}/${e}`)}};const qA=LA,UA="wc",BA="ethereum_provider",zA=`${UA}@2:${BA}:`,KA="https://rpc.walletconnect.org/v1/",Fu=["eth_sendTransaction","personal_sign"],HA=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],Lu=["chainChanged","accountsChanged"],kA=["chainChanged","accountsChanged","message","disconnect","connect"];var jA=Object.defineProperty,WA=Object.defineProperties,GA=Object.getOwnPropertyDescriptors,T1=Object.getOwnPropertySymbols,VA=Object.prototype.hasOwnProperty,JA=Object.prototype.propertyIsEnumerable,$1=(r,e,t)=>e in r?jA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oa=(r,e)=>{for(var t in e||(e={}))VA.call(e,t)&&$1(r,t,e[t]);if(T1)for(var t of T1(e))JA.call(e,t)&&$1(r,t,e[t]);return r},vu=(r,e)=>WA(r,GA(e));function of(r){return Number(r[0].split(":")[1])}function Cc(r){return`0x${r.toString(16)}`}function YA(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:s,events:o,optionalEvents:f,rpcMap:h}=r;if(!hn(e))throw new Error("Invalid chains");const u={chains:e,methods:i||Fu,events:o||Lu,rpcMap:oa({},e.length?{[of(e)]:h[of(e)]}:{})},d=o==null?void 0:o.filter(S=>!Lu.includes(S)),g=i==null?void 0:i.filter(S=>!Fu.includes(S));if(!t&&!f&&!s&&!(d!=null&&d.length)&&!(g!=null&&g.length))return{required:e.length?u:void 0};const y=(d==null?void 0:d.length)&&(g==null?void 0:g.length)||!t,P={chains:[...new Set(y?u.chains.concat(t||[]):t)],methods:[...new Set(u.methods.concat(s!=null&&s.length?s:HA))],events:[...new Set(u.events.concat(f!=null&&f.length?f:kA))],rpcMap:h};return{required:e.length?u:void 0,optional:t.length?P:void 0}}class vd{constructor(){this.events=new Di.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=zA,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new vd;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=YA(this.rpc);try{const s=await new Promise(async(f,h)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),h(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(vu(oa({namespaces:oa({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{f(d)}).catch(d=>{h(new Error(d.message))})});if(!s)return;const o=np(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Cc(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(o,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(vu(oa({},e),{chains:this.rpc.chains}),t).then(u=>{o(u)}).catch(u=>{f(new Error(u.message))})}),s=i.session;if(s){const o=np(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Cc(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Cc(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",vu(oa({},Ct("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Cc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,s]=e.split(":");return{chainId:`${t}:${i}`,address:s}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const s=(t=e==null?void 0:e.chains)!=null?t:[],o=(i=e==null?void 0:e.optionalChains)!=null?i:[],f=s.concat(o);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const h=s.length?(e==null?void 0:e.methods)||Fu:[],u=s.length?(e==null?void 0:e.events)||Lu:[],d=(e==null?void 0:e.optionalMethods)||[],g=(e==null?void 0:e.optionalEvents)||[],y=(e==null?void 0:e.rpcMap)||this.buildRpcMap(f,e.projectId),P=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(S=>this.formatChainId(S)),optionalChains:o.map(S=>this.formatChainId(S)),methods:h,events:u,optionalMethods:d,optionalEvents:g,rpcMap:y,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:P,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(s=>{i[s]=this.getRpcUrl(s,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?of(this.rpc.chains):of(this.rpc.optionalChains),this.signer=await qA.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await aw(()=>import("./index-e7dceea4.js").then(s=>s.i),["assets/index-e7dceea4.js","assets/index-76c346f2.js","assets/index-d859290a.css"]);t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(oa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:s}=e;t&&hn(t)&&(this.rpc.chains=t.map(o=>this.formatChainId(o)),t.forEach(o=>{this.rpc.rpcMap[o]=(s==null?void 0:s[o])||this.getRpcUrl(o)})),i&&hn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(o=>this.formatChainId(o)),i.forEach(o=>{this.rpc.rpcMap[o]=(s==null?void 0:s[o])||this.getRpcUrl(o)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${KA}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const AP=vd;export{AP as EthereumProvider,kA as OPTIONAL_EVENTS,HA as OPTIONAL_METHODS,Lu as REQUIRED_EVENTS,Fu as REQUIRED_METHODS,vd as default};
37
- //# sourceMappingURL=index.es-9bf15c34.js.map
36
+ }`;var dt=l0(function(){return At(C,Ne+"return "+le).apply(t,G)});if(dt.source=le,Oh(dt))throw dt;return dt}function a6(n){return Dt(n).toLowerCase()}function o6(n){return Dt(n).toUpperCase()}function c6(n,a,c){if(n=Dt(n),n&&(c||a===t))return Ed(n);if(!n||!(a=ei(a)))return n;var b=Li(n),I=Li(a),C=xd(b,I),G=Sd(b,I)+1;return Hn(b,C,G).join("")}function f6(n,a,c){if(n=Dt(n),n&&(c||a===t))return n.slice(0,Ad(n)+1);if(!n||!(a=ei(a)))return n;var b=Li(n),I=Sd(b,Li(a))+1;return Hn(b,0,I).join("")}function h6(n,a,c){if(n=Dt(n),n&&(c||a===t))return n.replace(Pt,"");if(!n||!(a=ei(a)))return n;var b=Li(n),I=xd(b,Li(a));return Hn(b,I).join("")}function u6(n,a){var c=pe,b=q;if(Wt(a)){var I="separator"in a?a.separator:I;c="length"in a?ht(a.length):c,b="omission"in a?ei(a.omission):b}n=Dt(n);var C=n.length;if(Hs(n)){var G=Li(n);C=G.length}if(c>=C)return n;var X=c-ks(b);if(X<1)return b;var ee=G?Hn(G,0,X).join(""):n.slice(0,X);if(I===t)return ee+b;if(G&&(X+=ee.length-X),Rh(I)){if(n.slice(X).search(I)){var fe,he=ee;for(I.global||(I=Gf(I.source,Dt(Yt.exec(I))+"g")),I.lastIndex=0;fe=I.exec(he);)var le=fe.index;ee=ee.slice(0,le===t?X:le)}}else if(n.indexOf(ei(I),X)!=X){var we=ee.lastIndexOf(I);we>-1&&(ee=ee.slice(0,we))}return ee+b}function d6(n){return n=Dt(n),n&&ke.test(n)?n.replace(Ar,zv):n}var l6=Xs(function(n,a,c){return n+(c?" ":"")+a.toUpperCase()}),Th=pl("toUpperCase");function d0(n,a,c){return n=Dt(n),a=c?t:a,a===t?Fv(n)?kv(n):Pv(n):n.match(a)||[]}var l0=lt(function(n,a){try{return hr(n,t,a)}catch(c){return Oh(c)?c:new rt(c)}}),p6=mn(function(n,a){return gi(a,function(c){c=en(c),vn(n,c,Dh(n[c],n))}),n});function g6(n){var a=n==null?0:n.length,c=Te();return n=a?jt(n,function(b){if(typeof b[1]!="function")throw new vi(f);return[c(b[0]),b[1]]}):[],lt(function(b){for(var I=-1;++I<a;){var C=n[I];if(hr(C[0],this,b))return hr(C[1],this,b)}})}function v6(n){return zb(mi(n,y))}function $h(n){return function(){return n}}function b6(n,a){return n==null||n!==n?a:n}var m6=vl(),y6=vl(!0);function jr(n){return n}function Fh(n){return Wd(typeof n=="function"?n:mi(n,y))}function w6(n){return Vd(mi(n,y))}function _6(n,a){return Jd(n,mi(a,y))}var E6=lt(function(n,a){return function(c){return Ta(c,n,a)}}),x6=lt(function(n,a){return function(c){return Ta(n,c,a)}});function Lh(n,a,c){var b=ur(a),I=ac(a,b);c==null&&!(Wt(a)&&(I.length||!b.length))&&(c=a,a=n,n=this,I=ac(a,ur(a)));var C=!(Wt(c)&&"chain"in c)||!!c.chain,G=wn(n);return gi(I,function(X){var ee=a[X];n[X]=ee,G&&(n.prototype[X]=function(){var fe=this.__chain__;if(C||fe){var he=n(this.__wrapped__),le=he.__actions__=Kr(this.__actions__);return le.push({func:ee,args:arguments,thisArg:n}),he.__chain__=fe,he}return ee.apply(n,Ln([this.value()],arguments))})}),n}function S6(){return yt._===this&&(yt._=Yv),this}function qh(){}function I6(n){return n=ht(n),lt(function(a){return Yd(a,n)})}var A6=gh(jt),P6=gh(bd),D6=gh(Bf);function p0(n){return Eh(n)?zf(en(n)):nm(n)}function M6(n){return function(a){return n==null?t:gs(n,a)}}var O6=ml(),R6=ml(!0);function Uh(){return[]}function Bh(){return!1}function C6(){return{}}function N6(){return""}function T6(){return!0}function $6(n,a){if(n=ht(n),n<1||n>T)return[];var c=M,b=Pr(n,M);a=Te(a),n-=M;for(var I=kf(b,a);++c<n;)a(c);return I}function F6(n){return st(n)?jt(n,en):ti(n)?[n]:Kr(Tl(Dt(n)))}function L6(n){var a=++Vv;return Dt(n)+a}var q6=dc(function(n,a){return n+a},0),U6=vh("ceil"),B6=dc(function(n,a){return n/a},1),z6=vh("floor");function K6(n){return n&&n.length?sc(n,jr,th):t}function H6(n,a){return n&&n.length?sc(n,Te(a,2),th):t}function k6(n){return wd(n,jr)}function j6(n,a){return wd(n,Te(a,2))}function W6(n){return n&&n.length?sc(n,jr,sh):t}function G6(n,a){return n&&n.length?sc(n,Te(a,2),sh):t}var V6=dc(function(n,a){return n*a},1),J6=vh("round"),Y6=dc(function(n,a){return n-a},0);function X6(n){return n&&n.length?Hf(n,jr):0}function Z6(n,a){return n&&n.length?Hf(n,Te(a,2)):0}return O.after=w2,O.ary=jl,O.assign=o3,O.assignIn=s0,O.assignInWith=Ic,O.assignWith=c3,O.at=f3,O.before=Wl,O.bind=Dh,O.bindAll=p6,O.bindKey=Gl,O.castArray=C2,O.chain=Kl,O.chunk=zm,O.compact=Km,O.concat=Hm,O.cond=g6,O.conforms=v6,O.constant=$h,O.countBy=Xy,O.create=h3,O.curry=Vl,O.curryRight=Jl,O.debounce=Yl,O.defaults=u3,O.defaultsDeep=d3,O.defer=_2,O.delay=E2,O.difference=km,O.differenceBy=jm,O.differenceWith=Wm,O.drop=Gm,O.dropRight=Vm,O.dropRightWhile=Jm,O.dropWhile=Ym,O.fill=Xm,O.filter=Qy,O.flatMap=r2,O.flatMapDeep=i2,O.flatMapDepth=n2,O.flatten=ql,O.flattenDeep=Zm,O.flattenDepth=Qm,O.flip=x2,O.flow=m6,O.flowRight=y6,O.fromPairs=ey,O.functions=y3,O.functionsIn=w3,O.groupBy=s2,O.initial=ry,O.intersection=iy,O.intersectionBy=ny,O.intersectionWith=sy,O.invert=E3,O.invertBy=x3,O.invokeMap=o2,O.iteratee=Fh,O.keyBy=c2,O.keys=ur,O.keysIn=kr,O.map=yc,O.mapKeys=I3,O.mapValues=A3,O.matches=w6,O.matchesProperty=_6,O.memoize=_c,O.merge=P3,O.mergeWith=a0,O.method=E6,O.methodOf=x6,O.mixin=Lh,O.negate=Ec,O.nthArg=I6,O.omit=D3,O.omitBy=M3,O.once=S2,O.orderBy=f2,O.over=A6,O.overArgs=I2,O.overEvery=P6,O.overSome=D6,O.partial=Mh,O.partialRight=Xl,O.partition=h2,O.pick=O3,O.pickBy=o0,O.property=p0,O.propertyOf=M6,O.pull=fy,O.pullAll=Bl,O.pullAllBy=hy,O.pullAllWith=uy,O.pullAt=dy,O.range=O6,O.rangeRight=R6,O.rearg=A2,O.reject=l2,O.remove=ly,O.rest=P2,O.reverse=Ah,O.sampleSize=g2,O.set=C3,O.setWith=N3,O.shuffle=v2,O.slice=py,O.sortBy=y2,O.sortedUniq=_y,O.sortedUniqBy=Ey,O.split=r6,O.spread=D2,O.tail=xy,O.take=Sy,O.takeRight=Iy,O.takeRightWhile=Ay,O.takeWhile=Py,O.tap=Ky,O.throttle=M2,O.thru=mc,O.toArray=r0,O.toPairs=c0,O.toPairsIn=f0,O.toPath=F6,O.toPlainObject=n0,O.transform=T3,O.unary=O2,O.union=Dy,O.unionBy=My,O.unionWith=Oy,O.uniq=Ry,O.uniqBy=Cy,O.uniqWith=Ny,O.unset=$3,O.unzip=Ph,O.unzipWith=zl,O.update=F3,O.updateWith=L3,O.values=ea,O.valuesIn=q3,O.without=Ty,O.words=d0,O.wrap=R2,O.xor=$y,O.xorBy=Fy,O.xorWith=Ly,O.zip=qy,O.zipObject=Uy,O.zipObjectDeep=By,O.zipWith=zy,O.entries=c0,O.entriesIn=f0,O.extend=s0,O.extendWith=Ic,Lh(O,O),O.add=q6,O.attempt=l0,O.camelCase=K3,O.capitalize=h0,O.ceil=U6,O.clamp=U3,O.clone=N2,O.cloneDeep=$2,O.cloneDeepWith=F2,O.cloneWith=T2,O.conformsTo=L2,O.deburr=u0,O.defaultTo=b6,O.divide=B6,O.endsWith=H3,O.eq=Ui,O.escape=k3,O.escapeRegExp=j3,O.every=Zy,O.find=e2,O.findIndex=Fl,O.findKey=l3,O.findLast=t2,O.findLastIndex=Ll,O.findLastKey=p3,O.floor=z6,O.forEach=Hl,O.forEachRight=kl,O.forIn=g3,O.forInRight=v3,O.forOwn=b3,O.forOwnRight=m3,O.get=Ch,O.gt=q2,O.gte=U2,O.has=_3,O.hasIn=Nh,O.head=Ul,O.identity=jr,O.includes=a2,O.indexOf=ty,O.inRange=B3,O.invoke=S3,O.isArguments=ms,O.isArray=st,O.isArrayBuffer=B2,O.isArrayLike=Hr,O.isArrayLikeObject=Zt,O.isBoolean=z2,O.isBuffer=kn,O.isDate=K2,O.isElement=H2,O.isEmpty=k2,O.isEqual=j2,O.isEqualWith=W2,O.isError=Oh,O.isFinite=G2,O.isFunction=wn,O.isInteger=Zl,O.isLength=xc,O.isMap=Ql,O.isMatch=V2,O.isMatchWith=J2,O.isNaN=Y2,O.isNative=X2,O.isNil=Q2,O.isNull=Z2,O.isNumber=e0,O.isObject=Wt,O.isObjectLike=Gt,O.isPlainObject=Ba,O.isRegExp=Rh,O.isSafeInteger=e3,O.isSet=t0,O.isString=Sc,O.isSymbol=ti,O.isTypedArray=Qs,O.isUndefined=t3,O.isWeakMap=r3,O.isWeakSet=i3,O.join=ay,O.kebabCase=W3,O.last=wi,O.lastIndexOf=oy,O.lowerCase=G3,O.lowerFirst=V3,O.lt=n3,O.lte=s3,O.max=K6,O.maxBy=H6,O.mean=k6,O.meanBy=j6,O.min=W6,O.minBy=G6,O.stubArray=Uh,O.stubFalse=Bh,O.stubObject=C6,O.stubString=N6,O.stubTrue=T6,O.multiply=V6,O.nth=cy,O.noConflict=S6,O.noop=qh,O.now=wc,O.pad=J3,O.padEnd=Y3,O.padStart=X3,O.parseInt=Z3,O.random=z3,O.reduce=u2,O.reduceRight=d2,O.repeat=Q3,O.replace=e6,O.result=R3,O.round=J6,O.runInContext=Z,O.sample=p2,O.size=b2,O.snakeCase=t6,O.some=m2,O.sortedIndex=gy,O.sortedIndexBy=vy,O.sortedIndexOf=by,O.sortedLastIndex=my,O.sortedLastIndexBy=yy,O.sortedLastIndexOf=wy,O.startCase=i6,O.startsWith=n6,O.subtract=Y6,O.sum=X6,O.sumBy=Z6,O.template=s6,O.times=$6,O.toFinite=_n,O.toInteger=ht,O.toLength=i0,O.toLower=a6,O.toNumber=_i,O.toSafeInteger=a3,O.toString=Dt,O.toUpper=o6,O.trim=c6,O.trimEnd=f6,O.trimStart=h6,O.truncate=u6,O.unescape=d6,O.uniqueId=L6,O.upperCase=l6,O.upperFirst=Th,O.each=Hl,O.eachRight=kl,O.first=Ul,Lh(O,function(){var n={};return Zi(O,function(a,c){Rt.call(O.prototype,c)||(n[c]=a)}),n}(),{chain:!1}),O.VERSION=i,gi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){O[n].placeholder=O}),gi(["drop","take"],function(n,a){bt.prototype[n]=function(c){c=c===t?1:ar(ht(c),0);var b=this.__filtered__&&!a?new bt(this):this.clone();return b.__filtered__?b.__takeCount__=Pr(c,b.__takeCount__):b.__views__.push({size:Pr(c,M),type:n+(b.__dir__<0?"Right":"")}),b},bt.prototype[n+"Right"]=function(c){return this.reverse()[n](c).reverse()}}),gi(["filter","map","takeWhile"],function(n,a){var c=a+1,b=c==_||c==R;bt.prototype[n]=function(I){var C=this.clone();return C.__iteratees__.push({iteratee:Te(I,3),type:c}),C.__filtered__=C.__filtered__||b,C}}),gi(["head","last"],function(n,a){var c="take"+(a?"Right":"");bt.prototype[n]=function(){return this[c](1).value()[0]}}),gi(["initial","tail"],function(n,a){var c="drop"+(a?"":"Right");bt.prototype[n]=function(){return this.__filtered__?new bt(this):this[c](1)}}),bt.prototype.compact=function(){return this.filter(jr)},bt.prototype.find=function(n){return this.filter(n).head()},bt.prototype.findLast=function(n){return this.reverse().find(n)},bt.prototype.invokeMap=lt(function(n,a){return typeof n=="function"?new bt(this):this.map(function(c){return Ta(c,n,a)})}),bt.prototype.reject=function(n){return this.filter(Ec(Te(n)))},bt.prototype.slice=function(n,a){n=ht(n);var c=this;return c.__filtered__&&(n>0||a<0)?new bt(c):(n<0?c=c.takeRight(-n):n&&(c=c.drop(n)),a!==t&&(a=ht(a),c=a<0?c.dropRight(-a):c.take(a-n)),c)},bt.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},bt.prototype.toArray=function(){return this.take(M)},Zi(bt.prototype,function(n,a){var c=/^(?:filter|find|map|reject)|While$/.test(a),b=/^(?:head|last)$/.test(a),I=O[b?"take"+(a=="last"?"Right":""):a],C=b||/^find/.test(a);I&&(O.prototype[a]=function(){var G=this.__wrapped__,X=b?[1]:arguments,ee=G instanceof bt,fe=X[0],he=ee||st(G),le=function(gt){var wt=I.apply(O,Ln([gt],X));return b&&we?wt[0]:wt};he&&c&&typeof fe=="function"&&fe.length!=1&&(ee=he=!1);var we=this.__chain__,Ne=!!this.__actions__.length,Be=C&&!we,dt=ee&&!Ne;if(!C&&he){G=dt?G:new bt(this);var ze=n.apply(G,X);return ze.__actions__.push({func:mc,args:[le],thisArg:t}),new bi(ze,we)}return Be&&dt?n.apply(this,X):(ze=this.thru(le),Be?b?ze.value()[0]:ze.value():ze)})}),gi(["pop","push","shift","sort","splice","unshift"],function(n){var a=ko[n],c=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",b=/^(?:pop|shift)$/.test(n);O.prototype[n]=function(){var I=arguments;if(b&&!this.__chain__){var C=this.value();return a.apply(st(C)?C:[],I)}return this[c](function(G){return a.apply(st(G)?G:[],I)})}}),Zi(bt.prototype,function(n,a){var c=O[a];if(c){var b=c.name+"";Rt.call(Vs,b)||(Vs[b]=[]),Vs[b].push({name:a,func:c})}}),Vs[uc(t,J).name]=[{name:"wrapper",func:t}],bt.prototype.clone=db,bt.prototype.reverse=lb,bt.prototype.value=pb,O.prototype.at=Hy,O.prototype.chain=ky,O.prototype.commit=jy,O.prototype.next=Wy,O.prototype.plant=Vy,O.prototype.reverse=Jy,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=Yy,O.prototype.first=O.prototype.head,Pa&&(O.prototype[Pa]=Gy),O},js=jv();Xt?((Xt.exports=js)._=js,Lt._=js):yt._=js}).call(_r)})(af,af.exports);var YI=af.exports,XI=Object.defineProperty,ZI=Object.defineProperties,QI=Object.getOwnPropertyDescriptors,v1=Object.getOwnPropertySymbols,eA=Object.prototype.hasOwnProperty,tA=Object.prototype.propertyIsEnumerable,b1=(r,e,t)=>e in r?XI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,m1=(r,e)=>{for(var t in e||(e={}))eA.call(e,t)&&b1(r,t,e[t]);if(v1)for(var t of v1(e))tA.call(e,t)&&b1(r,t,e[t]);return r},y1=(r,e)=>ZI(r,QI(e));const rA={Accept:"application/json","Content-Type":"application/json"},iA="POST",w1={headers:rA,method:iA},_1=10;let Wi=class{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Di.EventEmitter,this.isAvailable=!1,this.registering=!1,!zp(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=Rn(e),i=await(await v0(this.url,y1(m1({},w1),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!zp(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,s)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),s(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=Rn({id:1,jsonrpc:"2.0",method:"test",params:[]});await v0(e,y1(m1({},w1),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Ds(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),s=i.message||i.toString(),o=Pf(e,s);this.events.emit("payload",o)}parseError(e,t=this.url){return Jg(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>_1&&this.events.setMaxListeners(_1)}};const E1="error",nA="wss://relay.walletconnect.org",sA="wc",aA="universal_provider",x1=`${sA}@2:${aA}:`,mv="https://rpc.walletconnect.org/v1/",aa="generic",oA=`${mv}bundler`,Ti={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var cA=Object.defineProperty,fA=Object.defineProperties,hA=Object.getOwnPropertyDescriptors,S1=Object.getOwnPropertySymbols,uA=Object.prototype.hasOwnProperty,dA=Object.prototype.propertyIsEnumerable,I1=(r,e,t)=>e in r?cA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Oc=(r,e)=>{for(var t in e||(e={}))uA.call(e,t)&&I1(r,t,e[t]);if(S1)for(var t of S1(e))dA.call(e,t)&&I1(r,t,e[t]);return r},lA=(r,e)=>fA(r,hA(e));function si(r,e,t){var i;const s=ua(r);return((i=e.rpcMap)==null?void 0:i[s.reference])||`${mv}?chainId=${s.namespace}:${s.reference}&projectId=${t}`}function Ls(r){return r.includes(":")?r.split(":")[1]:r}function yv(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function pA(r,e){const t=Object.keys(e.namespaces).filter(s=>s.includes(r));if(!t.length)return[];const i=[];return t.forEach(s=>{const o=e.namespaces[s].accounts;i.push(...o)}),i}function du(r={},e={}){const t=A1(r),i=A1(e);return YI.merge(t,i)}function A1(r){var e,t,i,s;const o={};if(!so(r))return o;for(const[f,h]of Object.entries(r)){const u=od(f)?[f]:h.chains,d=h.methods||[],g=h.events||[],y=h.rpcMap||{},P=Za(f);o[P]=lA(Oc(Oc({},o[P]),h),{chains:Lc(u,(e=o[P])==null?void 0:e.chains),methods:Lc(d,(t=o[P])==null?void 0:t.methods),events:Lc(g,(i=o[P])==null?void 0:i.events),rpcMap:Oc(Oc({},y),(s=o[P])==null?void 0:s.rpcMap)})}return o}function gA(r){return r.includes(":")?r.split(":")[2]:r}function P1(r){const e={};for(const[t,i]of Object.entries(r)){const s=i.methods||[],o=i.events||[],f=i.accounts||[],h=od(t)?[t]:i.chains?i.chains:yv(i.accounts);e[t]={chains:h,methods:s,events:o,accounts:f}}return e}function lu(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const wv={},St=r=>wv[r],pu=(r,e)=>{wv[r]=e};class vA{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}var bA=Object.defineProperty,mA=Object.defineProperties,yA=Object.getOwnPropertyDescriptors,D1=Object.getOwnPropertySymbols,wA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,M1=(r,e,t)=>e in r?bA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,O1=(r,e)=>{for(var t in e||(e={}))wA.call(e,t)&&M1(r,t,e[t]);if(D1)for(var t of D1(e))_A.call(e,t)&&M1(r,t,e[t]);return r},R1=(r,e)=>mA(r,yA(e));class EA{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||si(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=parseInt(Ls(t));e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let s=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const o=parseInt(s,16);if(this.isChainApproved(o))this.setDefaultChain(`${o}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:s}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${o}`);else throw new Error(`Failed to switch to chain 'eip155:${o}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,s;const o=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!o)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const f=this.client.session.get(e.topic),h=((s=f==null?void 0:f.sessionProperties)==null?void 0:s.capabilities)||{};if(h!=null&&h[o])return h==null?void 0:h[o];const u=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:R1(O1({},f.sessionProperties||{}),{capabilities:R1(O1({},h||{}),{[o]:u})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return u}async getCallStatus(e){var t,i;const s=this.client.session.get(e.topic),o=(t=s.sessionProperties)==null?void 0:t.bundler_name;if(o){const h=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(h,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,h)}}const f=(i=s.sessionProperties)==null?void 0:i.bundler_url;if(f)try{return await this.getUserOperationReceipt(f,e)}catch(h){console.warn("Failed to fetch call status from custom bundler",h,f)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const s=new URL(e),o=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Vn("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!o.ok)throw new Error(`Failed to fetch user operation receipt - ${o.status}`);return await o.json()}getBundlerUrl(e,t){return`${oA}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class xA{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class SA{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class IA{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||si(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new Ni(new Wi(i,St("disableProviderPing")))}}class AA{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),s=Ls(t);e[s]=this.createHttpProvider(s,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class PA{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class DA{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const s=Ls(t);e[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}class MA{constructor(e){this.name="near",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||si(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace);return typeof i>"u"?void 0:new Ni(new Wi(i,St("disableProviderPing")))}}class OA{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||si(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace);return typeof i>"u"?void 0:new Ni(new Wi(i))}}class RA{constructor(e){this.name=aa,this.namespace=e.namespace,this.events=St("events"),this.client=St("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Ti.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(s=>{const o=ua(s);i[`${o.namespace}:${o.reference}`]=this.createHttpProvider(s)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||si(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ni(new Wi(i,St("disableProviderPing")))}}var CA=Object.defineProperty,NA=Object.defineProperties,TA=Object.getOwnPropertyDescriptors,C1=Object.getOwnPropertySymbols,$A=Object.prototype.hasOwnProperty,FA=Object.prototype.propertyIsEnumerable,N1=(r,e,t)=>e in r?CA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Rc=(r,e)=>{for(var t in e||(e={}))$A.call(e,t)&&N1(r,t,e[t]);if(C1)for(var t of C1(e))FA.call(e,t)&&N1(r,t,e[t]);return r},gu=(r,e)=>NA(r,TA(e));let LA=class _v{constructor(e){this.events=new Bu,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:_o(If({level:(e==null?void 0:e.logger)||E1})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new _v(e);return await t.initialize(),t}async request(e,t,i){const[s,o]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Rc({},e),chainId:`${s}:${o}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,s){const o=new Date().getTime();this.request(e,i,s).then(f=>t(null,Af(o,f))).catch(f=>t(f,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Ct("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:s}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const o=await s();if(this.session=o.session,this.session){const f=P1(this.session.namespaces);this.namespaces=du(this.namespaces,f),this.persist("namespaces",this.namespaces),this.onConnect()}return o}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:s}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await s().then(o=>{this.session=o;const f=P1(o.namespaces);this.namespaces=du(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==bv)throw o;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,s]=this.validateChain(e),o=this.getProvider(i);o.name===aa?o.setDefaultChain(`${i}:${s}`,t):o.setDefaultChain(s,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(hn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await gd.init({core:this.providerOpts.core,logger:this.providerOpts.logger||E1,relayUrl:this.providerOpts.relayUrl||nA,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Za(t)))];pu("client",this.client),pu("events",this.events),pu("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=pA(t,this.session),s=yv(i),o=du(this.namespaces,this.optionalNamespaces),f=gu(Rc({},o[t]),{accounts:i,chains:s});switch(t){case"eip155":this.rpcProviders[t]=new EA({namespace:f});break;case"algorand":this.rpcProviders[t]=new IA({namespace:f});break;case"solana":this.rpcProviders[t]=new xA({namespace:f});break;case"cosmos":this.rpcProviders[t]=new SA({namespace:f});break;case"polkadot":this.rpcProviders[t]=new vA({namespace:f});break;case"cip34":this.rpcProviders[t]=new AA({namespace:f});break;case"elrond":this.rpcProviders[t]=new PA({namespace:f});break;case"multiversx":this.rpcProviders[t]=new DA({namespace:f});break;case"near":this.rpcProviders[t]=new MA({namespace:f});break;case"tezos":this.rpcProviders[t]=new OA({namespace:f});break;default:this.rpcProviders[aa]?this.rpcProviders[aa].updateNamespace(f):this.rpcProviders[aa]=new RA({namespace:f})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const s=i.data;s&&hn(s)&&this.events.emit("accountsChanged",s.map(gA))}else if(i.name==="chainChanged"){const s=t.chainId,o=t.event.data,f=Za(s),h=lu(s)!==lu(o)?`${f}:${lu(o)}`:s;this.onChainChanged(h)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:s}=t,o=(i=this.client)==null?void 0:i.session.get(e);this.session=gu(Rc({},o),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",gu(Rc({},Ct("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Ti.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[aa]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:s}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=s,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(f=>Za(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const s=Za(Object.keys(this.namespaces)[0]),o=this.rpcProviders[s].getDefaultChain();return[s,o]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,s]=this.validateChain(e);s&&(t||this.getProvider(i).setDefaultChain(s),this.namespaces[i]?this.namespaces[i].defaultChain=s:this.namespaces[`${i}:${s}`]?this.namespaces[`${i}:${s}`].defaultChain=s:this.namespaces[`${i}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${x1}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${x1}/${e}`)}};const qA=LA,UA="wc",BA="ethereum_provider",zA=`${UA}@2:${BA}:`,KA="https://rpc.walletconnect.org/v1/",Fu=["eth_sendTransaction","personal_sign"],HA=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],Lu=["chainChanged","accountsChanged"],kA=["chainChanged","accountsChanged","message","disconnect","connect"];var jA=Object.defineProperty,WA=Object.defineProperties,GA=Object.getOwnPropertyDescriptors,T1=Object.getOwnPropertySymbols,VA=Object.prototype.hasOwnProperty,JA=Object.prototype.propertyIsEnumerable,$1=(r,e,t)=>e in r?jA(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oa=(r,e)=>{for(var t in e||(e={}))VA.call(e,t)&&$1(r,t,e[t]);if(T1)for(var t of T1(e))JA.call(e,t)&&$1(r,t,e[t]);return r},vu=(r,e)=>WA(r,GA(e));function of(r){return Number(r[0].split(":")[1])}function Cc(r){return`0x${r.toString(16)}`}function YA(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:s,events:o,optionalEvents:f,rpcMap:h}=r;if(!hn(e))throw new Error("Invalid chains");const u={chains:e,methods:i||Fu,events:o||Lu,rpcMap:oa({},e.length?{[of(e)]:h[of(e)]}:{})},d=o==null?void 0:o.filter(S=>!Lu.includes(S)),g=i==null?void 0:i.filter(S=>!Fu.includes(S));if(!t&&!f&&!s&&!(d!=null&&d.length)&&!(g!=null&&g.length))return{required:e.length?u:void 0};const y=(d==null?void 0:d.length)&&(g==null?void 0:g.length)||!t,P={chains:[...new Set(y?u.chains.concat(t||[]):t)],methods:[...new Set(u.methods.concat(s!=null&&s.length?s:HA))],events:[...new Set(u.events.concat(f!=null&&f.length?f:kA))],rpcMap:h};return{required:e.length?u:void 0,optional:t.length?P:void 0}}class vd{constructor(){this.events=new Di.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=zA,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new vd;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=YA(this.rpc);try{const s=await new Promise(async(f,h)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),h(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(vu(oa({namespaces:oa({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{f(d)}).catch(d=>{h(new Error(d.message))})});if(!s)return;const o=np(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Cc(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(o,f)=>{var h;this.rpc.showQrModal&&((h=this.modal)==null||h.subscribeModal(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(vu(oa({},e),{chains:this.rpc.chains}),t).then(u=>{o(u)}).catch(u=>{f(new Error(u.message))})}),s=i.session;if(s){const o=np(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Cc(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Cc(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",vu(oa({},Ct("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Cc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,s]=e.split(":");return{chainId:`${t}:${i}`,address:s}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const s=(t=e==null?void 0:e.chains)!=null?t:[],o=(i=e==null?void 0:e.optionalChains)!=null?i:[],f=s.concat(o);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const h=s.length?(e==null?void 0:e.methods)||Fu:[],u=s.length?(e==null?void 0:e.events)||Lu:[],d=(e==null?void 0:e.optionalMethods)||[],g=(e==null?void 0:e.optionalEvents)||[],y=(e==null?void 0:e.rpcMap)||this.buildRpcMap(f,e.projectId),P=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(S=>this.formatChainId(S)),optionalChains:o.map(S=>this.formatChainId(S)),methods:h,events:u,optionalMethods:d,optionalEvents:g,rpcMap:y,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:P,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(s=>{i[s]=this.getRpcUrl(s,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?of(this.rpc.chains):of(this.rpc.optionalChains),this.signer=await qA.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await aw(()=>import("./index-1dfdbd7b.js").then(s=>s.i),["assets/index-1dfdbd7b.js","assets/index-96a8fdf1.js","assets/index-f7e3ccab.css"]);t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(oa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:s}=e;t&&hn(t)&&(this.rpc.chains=t.map(o=>this.formatChainId(o)),t.forEach(o=>{this.rpc.rpcMap[o]=(s==null?void 0:s[o])||this.getRpcUrl(o)})),i&&hn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(o=>this.formatChainId(o)),i.forEach(o=>{this.rpc.rpcMap[o]=(s==null?void 0:s[o])||this.getRpcUrl(o)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${KA}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const AP=vd;export{AP as EthereumProvider,kA as OPTIONAL_EVENTS,HA as OPTIONAL_METHODS,Lu as REQUIRED_EVENTS,Fu as REQUIRED_METHODS,vd as default};
37
+ //# sourceMappingURL=index.es-9777727c.js.map