From 16587d665735d175dadad7cba1406194794bc35d Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Thu, 29 Apr 2021 18:46:28 +0200 Subject: [PATCH] chore: change event emitter --- dist/index.min.js | 49 +++++++++++++++++++ dist/src/address-manager/index.d.ts | 7 ++- dist/src/address-manager/index.d.ts.map | 2 +- dist/src/circuit/listener.d.ts | 1 - dist/src/circuit/listener.d.ts.map | 2 +- dist/src/connection-manager/index.d.ts | 7 ++- dist/src/connection-manager/index.d.ts.map | 2 +- .../connection-manager/latency-monitor.d.ts | 7 ++- .../latency-monitor.d.ts.map | 2 +- .../visibility-change-emitter.d.ts | 14 +++--- .../visibility-change-emitter.d.ts.map | 2 +- dist/src/index.d.ts | 7 ++- dist/src/index.d.ts.map | 2 +- dist/src/metrics/stats.d.ts | 8 +-- dist/src/metrics/stats.d.ts.map | 2 +- dist/src/peer-store/index.d.ts | 7 ++- dist/src/peer-store/index.d.ts.map | 2 +- dist/src/types.d.ts | 18 ------- src/address-manager/index.js | 4 +- src/circuit/listener.js | 2 - src/connection-manager/index.js | 4 +- src/connection-manager/latency-monitor.js | 4 +- .../visibility-change-emitter.js | 4 +- src/index.js | 4 +- src/metrics/stats.js | 4 +- src/peer-store/index.js | 4 +- src/types.d.ts | 18 ------- 27 files changed, 89 insertions(+), 100 deletions(-) create mode 100644 dist/index.min.js diff --git a/dist/index.min.js b/dist/index.min.js new file mode 100644 index 00000000..97f808c5 --- /dev/null +++ b/dist/index.min.js @@ -0,0 +1,49 @@ +(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2p = factory()}(typeof self !== 'undefined' ? self : this, function () { +var Libp2p=(()=>{var e_=Object.defineProperty;var Mp=(t,e)=>()=>(t&&(e=t(t=0)),e),C=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),t_=(t,e)=>{for(var r in e)e_(t,r,{get:e[r],enumerable:!0})};var Su=C((JU,Op)=>{var Qs=1e3,Js=Qs*60,Xs=Js*60,os=Xs*24,r_=os*7,i_=os*365.25;Op.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return n_(t);if(r==="number"&&isFinite(t))return e.long?a_(t):s_(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function n_(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!!e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*i_;case"weeks":case"week":case"w":return r*r_;case"days":case"day":case"d":return r*os;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Xs;case"minutes":case"minute":case"mins":case"min":case"m":return r*Js;case"seconds":case"second":case"secs":case"sec":case"s":return r*Qs;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function s_(t){var e=Math.abs(t);return e>=os?Math.round(t/os)+"d":e>=Xs?Math.round(t/Xs)+"h":e>=Js?Math.round(t/Js)+"m":e>=Qs?Math.round(t/Qs)+"s":t+"ms"}function a_(t){var e=Math.abs(t);return e>=os?Kc(t,e,os,"day"):e>=Xs?Kc(t,e,Xs,"hour"):e>=Js?Kc(t,e,Js,"minute"):e>=Qs?Kc(t,e,Qs,"second"):t+" ms"}function Kc(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var Lp=C((XU,Dp)=>{function o_(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=n,r.enabled=a,r.humanize=Su(),r.destroy=f,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let l=0;for(let b=0;b{if(Q==="%%")return"%";K++;let Y=r.formatters[$];if(typeof Y=="function"){let J=g[K];Q=Y.call(A,J),g.splice(K,1),K--}return Q}),r.formatArgs.call(A,g),(A.log||r.log).apply(A,g)}return p.namespace=u,p.useColors=r.useColors(),p.color=r.selectColor(u),p.extend=i,p.destroy=r.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>b===null?r.enabled(u):b,set:g=>{b=g}}),typeof r.init=="function"&&r.init(p),p}function i(u,l){let b=r(this.namespace+(typeof l=="undefined"?":":l)+u);return b.log=this.log,b}function n(u){r.save(u),r.names=[],r.skips=[];let l,b=(typeof u=="string"?u:"").split(/[\s,]+/),p=b.length;for(l=0;l"-"+l)].join(",");return r.enable(""),u}function a(u){if(u[u.length-1]==="*")return!0;let l,b;for(l=0,b=r.skips.length;l{Ir.formatArgs=c_;Ir.save=f_;Ir.load=u_;Ir.useColors=l_;Ir.storage=d_();Ir.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ir.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function l_(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function c_(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Vc.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}Ir.log=console.debug||console.log||(()=>{});function f_(t){try{t?Ir.storage.setItem("debug",t):Ir.storage.removeItem("debug")}catch(e){}}function u_(){let t;try{t=Ir.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function d_(){try{return localStorage}catch(t){}}Vc.exports=Lp()(Ir);var{formatters:h_}=Vc.exports;h_.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ji=C((ZU,Au)=>{"use strict";var Zs=typeof Reflect=="object"?Reflect:null,qp=Zs&&typeof Zs.apply=="function"?Zs.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},zc;Zs&&typeof Zs.ownKeys=="function"?zc=Zs.ownKeys:Object.getOwnPropertySymbols?zc=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:zc=function(e){return Object.getOwnPropertyNames(e)};function p_(t){console&&console.warn&&console.warn(t)}var Up=Number.isNaN||function(e){return e!==e};function Ze(){Ze.init.call(this)}Au.exports=Ze;Au.exports.once=b_;Ze.EventEmitter=Ze;Ze.prototype._events=void 0;Ze.prototype._eventsCount=0;Ze.prototype._maxListeners=void 0;var Fp=10;function jc(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ze,"defaultMaxListeners",{enumerable:!0,get:function(){return Fp},set:function(t){if(typeof t!="number"||t<0||Up(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Fp=t}});Ze.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Ze.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Up(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Kp(t){return t._maxListeners===void 0?Ze.defaultMaxListeners:t._maxListeners}Ze.prototype.getMaxListeners=function(){return Kp(this)};Ze.prototype.emit=function(e){for(var r=[],i=1;i0&&(a=r[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")qp(c,this,r);else for(var f=c.length,u=Vp(c,f),i=0;i0&&a.length>n&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=t,o.type=e,o.count=a.length,p_(o)}return t}Ze.prototype.addListener=function(e,r){return zp(this,e,r,!1)};Ze.prototype.on=Ze.prototype.addListener;Ze.prototype.prependListener=function(e,r){return zp(this,e,r,!0)};function y_(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function jp(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=y_.bind(i);return n.listener=r,i.wrapFn=n,n}Ze.prototype.once=function(e,r){return jc(r),this.on(e,jp(this,e,r)),this};Ze.prototype.prependOnceListener=function(e,r){return jc(r),this.prependListener(e,jp(this,e,r)),this};Ze.prototype.removeListener=function(e,r){var i,n,s,a,o;if(jc(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount==0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===r||i[a].listener===r){o=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():g_(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,o||r)}return this};Ze.prototype.off=Ze.prototype.removeListener;Ze.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),a;for(n=0;n=0;n--)this.removeListener(e,r[n]);return this};function Hp(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?v_(n):Vp(n,n.length)}Ze.prototype.listeners=function(e){return Hp(this,e,!0)};Ze.prototype.rawListeners=function(e){return Hp(this,e,!1)};Ze.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Gp.call(t,e)};Ze.prototype.listenerCount=Gp;function Gp(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Ze.prototype.eventNames=function(){return this._eventsCount>0?zc(this._events):[]};function Vp(t,e){for(var r=new Array(e),i=0;i{"use strict";function Wp(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function x_(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return Wp(t,r)}catch(i){r.message=t.message,r.stack=t.stack;let n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),Wp(new n,r)}}Yp.exports=x_});var Jp=C((tF,Qp)=>{"use strict";function w_(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,V=new Uint8Array(K);F!==B;){for(var Q=p[F],$=0,Y=K-1;(Q!==0||$>>0,V[Y]=Q%a>>>0,Q=Q/a>>>0;if(Q!==0)throw new Error("Non-zero carry");A=$,F++}for(var J=K-A;J!==K&&V[J]===0;)J++;for(var se=o.repeat(g);J>>0,K=new Uint8Array(B);p[g];){var V=e[p.charCodeAt(g)];if(V===255)return;for(var Q=0,$=B-1;(V!==0||Q>>0,K[$]=V%256>>>0,V=V/256>>>0;if(V!==0)throw new Error("Non-zero carry");F=Q,g++}if(p[g]!==" "){for(var Y=B-F;Y!==B&&K[Y]===0;)Y++;for(var J=new Uint8Array(A+(B-Y)),se=A;Y!==B;)J[se++]=K[Y++];return J}}}function b(p){var g=l(p);if(g)return g;throw new Error("Non-base"+a+" character")}return{encode:u,decodeUnsafe:l,decode:b}}Qp.exports=w_});var Hc=C((rF,Xp)=>{"use strict";var E_=new TextDecoder,S_=t=>E_.decode(t),A_=new TextEncoder,__=t=>A_.encode(t);function C_(t,e){let r=new Uint8Array(e),i=0;for(let n of t)r.set(n,i),i+=n.length;return r}Xp.exports={decodeText:S_,encodeText:__,concat:C_}});var t1=C((iF,Zp)=>{"use strict";var{encodeText:I_}=Hc(),e1=class{constructor(e,r,i,n){this.name=e,this.code=r,this.codeBuf=I_(this.code),this.alphabet=n,this.codec=i(n)}encode(e){return this.codec.encode(e)}decode(e){for(let r of e)if(this.alphabet&&this.alphabet.indexOf(r)<0)throw new Error(`invalid character '${r}' in '${e}'`);return this.codec.decode(e)}};Zp.exports=e1});var i1=C((nF,r1)=>{"use strict";var T_=(t,e,r)=>{let i={};for(let f=0;f=8&&(a-=8,s[c++]=255&o>>a)}if(a>=r||255&o<<8-a)throw new SyntaxError("Unexpected end of data");return s},k_=(t,e,r)=>{let i=e[e.length-1]==="=",n=(1<r;)a-=r,s+=e[n&o>>a];if(a&&(s+=e[n&o<e=>({encode(r){return k_(r,e,t)},decode(r){return T_(r,e,t)}});r1.exports={rfc4648:R_}});var o1=C((sF,n1)=>{"use strict";var To=Jp(),B_=t1(),{rfc4648:nr}=i1(),{decodeText:P_,encodeText:N_}=Hc(),M_=()=>({encode:P_,decode:N_}),s1=[["identity","\0",M_,""],["base2","0",nr(1),"01"],["base8","7",nr(3),"01234567"],["base10","9",To,"0123456789"],["base16","f",nr(4),"0123456789abcdef"],["base16upper","F",nr(4),"0123456789ABCDEF"],["base32hex","v",nr(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",nr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",nr(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",nr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",nr(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",nr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",nr(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",nr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",nr(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",To,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",To,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",To,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",To,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",nr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",nr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",nr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",nr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],a1=s1.reduce((t,e)=>(t[e[0]]=new B_(e[0],e[1],e[2],e[3]),t),{}),O_=s1.reduce((t,e)=>(t[e[1]]=a1[e[0]],t),{});n1.exports={names:a1,codes:O_}});var xn=C((Hi,c1)=>{"use strict";var ea=o1(),{encodeText:D_,decodeText:Gc,concat:f1}=Hc();function q_(t,e){if(!e)throw new Error("requires an encoded Uint8Array");let{name:r,codeBuf:i}=cs(t);return L_(r,e),f1([i,e],i.length+e.length)}function U_(t,e){let r=cs(t),i=D_(r.encode(e));return f1([r.codeBuf,i],r.codeBuf.length+i.length)}function F_(t){t instanceof Uint8Array&&(t=Gc(t));let e=t[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(e)&&(t=t.toLowerCase()),cs(t[0]).decode(t.substring(1))}function K_(t){if(t instanceof Uint8Array&&(t=Gc(t)),Object.prototype.toString.call(t)!=="[object String]")return!1;try{return cs(t[0]).name}catch(e){return!1}}function L_(t,e){cs(t).decode(Gc(e))}function cs(t){if(Object.prototype.hasOwnProperty.call(ea.names,t))return ea.names[t];if(Object.prototype.hasOwnProperty.call(ea.codes,t))return ea.codes[t];throw new Error(`Unsupported encoding: ${t}`)}function V_(t){return t instanceof Uint8Array&&(t=Gc(t)),cs(t[0])}Hi=c1.exports=q_;Hi.encode=U_;Hi.decode=F_;Hi.isEncoded=K_;Hi.encoding=cs;Hi.encodingFromData=V_;var z_=Object.freeze(ea.names),j_=Object.freeze(ea.codes);Hi.names=z_;Hi.codes=j_});var h1=C((aF,u1)=>{u1.exports=l1;var d1=128,H_=127,G_=~H_,$_=Math.pow(2,31);function l1(t,e,r){e=e||[],r=r||0;for(var i=r;t>=$_;)e[r++]=t&255|d1,t/=128;for(;t&G_;)e[r++]=t&255|d1,t>>>=7;return e[r]=t|0,l1.bytes=r-i+1,e}});var y1=C((oF,p1)=>{p1.exports=_u;var Y_=128,b1=127;function _u(t,e){var r=0,e=e||0,i=0,n=e,s,a=t.length;do{if(n>=a)throw _u.bytes=0,new RangeError("Could not decode varint");s=t[n++],r+=i<28?(s&b1)<=Y_);return _u.bytes=n-e,r}});var v1=C((cF,g1)=>{var W_=Math.pow(2,7),Q_=Math.pow(2,14),J_=Math.pow(2,21),X_=Math.pow(2,28),Z_=Math.pow(2,35),e9=Math.pow(2,42),t9=Math.pow(2,49),r9=Math.pow(2,56),i9=Math.pow(2,63);g1.exports=function(t){return t{m1.exports={encode:h1(),decode:y1(),encodingLength:v1()}});var E1=C((uF,w1)=>{"use strict";var n9=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});w1.exports={names:n9}});var Lt=C((lF,S1)=>{"use strict";var{encoding:s9}=xn(),a9=new TextDecoder("utf8");function o9(t){let e="";for(let r=0;r{"use strict";var{encoding:f9}=xn(),u9=new TextEncoder;function l9(t){let e=new Uint8Array(t.length);for(let r=0;r{"use strict";function h9(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));let r=new Uint8Array(e),i=0;for(let n of t)r.set(n,i),i+=n.length;return r}_1.exports=h9});var fs=C((pF,C1)=>{"use strict";var I1=xn(),ta=x1(),{names:ko}=E1(),$c=Lt(),p9=qt(),b9=Zr(),ra={};for(let t in ko){let e=t;ra[ko[e]]=e}Object.freeze(ra);function y9(t){if(!(t instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return $c(t,"base16")}function g9(t){return p9(t,"base16")}function v9(t){if(!(t instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return $c(I1.encode("base58btc",t)).slice(1)}function m9(t){let e=t instanceof Uint8Array?$c(t):t;return I1.decode("z"+e)}function k1(t){if(!(t instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(t.length<2)throw new Error("multihash too short. must be > 2 bytes.");let e=ta.decode(t);if(!T1(e))throw new Error(`multihash unknown function code: 0x${e.toString(16)}`);t=t.slice(ta.decode.bytes);let r=ta.decode(t);if(r<0)throw new Error(`multihash invalid length: ${r}`);if(t=t.slice(ta.decode.bytes),t.length!==r)throw new Error(`multihash length inconsistent: 0x${$c(t,"base16")}`);return{code:e,name:ra[e],length:r,digest:t}}function x9(t,e,r){if(!t||e===void 0)throw new Error("multihash encode requires at least two args: digest, code");let i=R1(e);if(!(t instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(r==null&&(r=t.length),r&&t.length!==r)throw new Error("digest length should be equal to specified length.");let n=ta.encode(i),s=ta.encode(r);return b9([n,s,t],n.length+s.length+t.length)}function R1(t){let e=t;if(typeof t=="string"){if(ko[t]===void 0)throw new Error(`Unrecognized hash function named: ${t}`);e=ko[t]}if(typeof e!="number")throw new Error(`Hash function code should be a number. Got: ${e}`);if(ra[e]===void 0&&!Cu(e))throw new Error(`Unrecognized function code: ${e}`);return e}function Cu(t){return t>0&&t<16}function T1(t){return!!(Cu(t)||ra[t])}function B1(t){k1(t)}function w9(t){return B1(t),t.subarray(0,2)}C1.exports={names:ko,codes:ra,toHexString:y9,fromHexString:g9,toB58String:v9,fromB58String:m9,decode:k1,encode:x9,coerceCode:R1,isAppCode:Cu,validate:B1,prefix:w9,isValidCode:T1}});var O1=C((bF,P1)=>{P1.exports=N1;var M1=128,E9=127,S9=~E9,A9=Math.pow(2,31);function N1(t,e,r){e=e||[],r=r||0;for(var i=r;t>=A9;)e[r++]=t&255|M1,t/=128;for(;t&S9;)e[r++]=t&255|M1,t>>>=7;return e[r]=t|0,N1.bytes=r-i+1,e}});var q1=C((yF,D1)=>{D1.exports=Iu;var _9=128,L1=127;function Iu(t,e){var r=0,e=e||0,i=0,n=e,s,a=t.length;do{if(n>=a)throw Iu.bytes=0,new RangeError("Could not decode varint");s=t[n++],r+=i<28?(s&L1)<=_9);return Iu.bytes=n-e,r}});var F1=C((gF,U1)=>{var C9=Math.pow(2,7),I9=Math.pow(2,14),T9=Math.pow(2,21),k9=Math.pow(2,28),R9=Math.pow(2,35),B9=Math.pow(2,42),P9=Math.pow(2,49),N9=Math.pow(2,56),M9=Math.pow(2,63);U1.exports=function(t){return t{K1.exports={encode:O1(),decode:q1(),encodingLength:F1()}});var ku=C((mF,V1)=>{"use strict";var z1=Tu(),O9=Lt(),D9=qt();V1.exports={numberToUint8Array:L9,uint8ArrayToNumber:j1,varintUint8ArrayEncode:q9,varintEncode:U9};function j1(t){return parseInt(O9(t,"base16"),16)}function L9(t){let e=t.toString(16);return e.length%2==1&&(e="0"+e),D9(e,"base16")}function q9(t){return Uint8Array.from(z1.encode(j1(t)))}function U9(t){return Uint8Array.from(z1.encode(t))}});var G1=C((xF,H1)=>{"use strict";var F9=Object.freeze({identity:0,cidv1:1,cidv2:2,cidv3:3,ip4:4,tcp:6,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,dccp:33,"murmur3-128":34,"murmur3-32":35,ip6:41,ip6zone:42,path:47,multicodec:48,multihash:49,multiaddr:50,multibase:51,dns:53,dns4:54,dns6:55,dnsaddr:56,protobuf:80,cbor:81,raw:85,"dbl-sha2-256":86,rlp:96,bencode:99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp:132,"dag-jose":133,"dag-cose":134,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,docid:206,"stellar-block":208,"stellar-tx":209,md4:212,md5:213,bmt:214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet:230,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"bls12_381-g1g2-pub":238,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp:273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt:301,utp:302,unix:400,thread:406,p2p:421,ipfs:421,https:443,onion:444,onion3:445,garlic64:446,garlic32:447,tls:448,quic:460,ws:477,wss:478,"p2p-websocket-star":479,http:480,json:512,messagepack:513,"libp2p-peer-record":769,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"p256-pub":4608,"p384-pub":4609,"p521-pub":4610,"ed448-pub":4611,"x448-pub":4612,"ed25519-priv":4864,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332,"skynet-ns":11639056});H1.exports={baseTable:F9}});var Y1=C((wF,$1)=>{"use strict";var{baseTable:Ru}=G1(),K9=ku().varintEncode,Bu={},Pu={},Yc={};for(let t in Ru){let e=t,r=Ru[e];Bu[e]=K9(r);let i=e.toUpperCase().replace(/-/g,"_");Pu[i]=r,Yc[r]||(Yc[r]=e)}Object.freeze(Bu);Object.freeze(Pu);Object.freeze(Yc);var V9=Object.freeze(Ru);$1.exports={nameToVarint:Bu,constantToCode:Pu,nameToCode:V9,codeToName:Yc}});var Mu=C((EF,W1)=>{"use strict";var Wc=Tu(),z9=Zr(),Q1=ku(),{nameToVarint:Qc,constantToCode:j9,nameToCode:J1,codeToName:Nu}=Y1();function H9(t,e){let r;if(t instanceof Uint8Array)r=Q1.varintUint8ArrayEncode(t);else if(Qc[t])r=Qc[t];else throw new Error("multicodec not recognized");return z9([r,e],r.length+e.length)}function G9(t){return Wc.decode(t),t.slice(Wc.decode.bytes)}function X1(t){let e=Wc.decode(t),r=Nu[e];if(r===void 0)throw new Error(`Code "${e}" not found`);return r}function Z1(t){return Nu[t]}function e2(t){let e=J1[t];if(e===void 0)throw new Error(`Codec "${t}" not found`);return e}function t2(t){return Wc.decode(t)}function r2(t){let e=Qc[t];if(e===void 0)throw new Error(`Codec "${t}" not found`);return e}function i2(t){return Q1.varintEncode(t)}function $9(t){return X1(t)}function Y9(t){return Z1(t)}function W9(t){return e2(t)}function Q9(t){return t2(t)}function J9(t){return r2(t)}function X9(t){return Array.from(i2(t))}W1.exports={addPrefix:H9,rmPrefix:G9,getNameFromData:X1,getNameFromCode:Z1,getCodeFromName:e2,getCodeFromData:t2,getVarintFromName:r2,getVarintFromCode:i2,getCodec:$9,getName:Y9,getNumber:W9,getCode:Q9,getCodeVarint:J9,getVarint:X9,...j9,nameToVarint:Qc,nameToCode:J1,codeToName:Nu}});var s2=C((SF,n2)=>{"use strict";var Z9=fs(),e7={checkCIDComponents:function(t){if(t==null)return"null values are not valid CIDs";if(!(t.version===0||t.version===1))return"Invalid version, must be a number equal to 1 or 0";if(typeof t.codec!="string")return"codec must be string";if(t.version===0){if(t.codec!=="dag-pb")return"codec must be 'dag-pb' for CIDv0";if(t.multibaseName!=="base58btc")return"multibaseName must be 'base58btc' for CIDv0"}if(!(t.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{Z9.validate(t.multihash)}catch(e){let r=e.message;return r||(r="Multihash validation failed"),r}}};n2.exports=e7});var Mr=C((AF,a2)=>{"use strict";function t7(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{"use strict";var Jc=fs(),Ou=xn(),us=Mu(),r7=s2(),c2=Zr(),i7=Lt(),n7=Mr(),Xc=us.nameToCode,s7=Object.keys(Xc).reduce((t,e)=>(t[Xc[e]]=e,t),{}),f2=Symbol.for("@ipld/js-cid/CID"),ei=class{constructor(e,r,i,n){if(this.version,this.codec,this.multihash,Object.defineProperty(this,f2,{value:!0}),ei.isCID(e)){let s=e;this.version=s.version,this.codec=s.codec,this.multihash=s.multihash,this.multibaseName=s.multibaseName||(s.version===0?"base58btc":"base32");return}if(typeof e=="string"){let s=Ou.isEncoded(e);if(s){let a=Ou.decode(e);this.version=parseInt(a[0].toString(),16),this.codec=us.getCodec(a.slice(1)),this.multihash=us.rmPrefix(a.slice(1)),this.multibaseName=s}else this.version=0,this.codec="dag-pb",this.multihash=Jc.fromB58String(e),this.multibaseName="base58btc";ei.validateCID(this),Object.defineProperty(this,"string",{value:e});return}if(e instanceof Uint8Array){let s=parseInt(e[0].toString(),16);if(s===1){let a=e;this.version=s,this.codec=us.getCodec(a.slice(1)),this.multihash=us.rmPrefix(a.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";ei.validateCID(this);return}this.version=e,typeof r=="number"&&(r=s7[r]),this.codec=r,this.multihash=i,this.multibaseName=n||(e===0?"base58btc":"base32"),ei.validateCID(this)}get bytes(){let e=this._bytes;if(!e){if(this.version===0)e=this.multihash;else if(this.version===1){let r=us.getCodeVarint(this.codec);e=c2([[1],r,this.multihash],1+r.byteLength+this.multihash.byteLength)}else throw new Error("unsupported version");Object.defineProperty(this,"_bytes",{value:e})}return e}get prefix(){let e=us.getCodeVarint(this.codec),r=Jc.prefix(this.multihash);return c2([[this.version],e,r],1+e.byteLength+r.byteLength)}get code(){return Xc[this.codec]}toV0(){if(this.codec!=="dag-pb")throw new Error("Cannot convert a non dag-pb CID to CIDv0");let{name:e,length:r}=Jc.decode(this.multihash);if(e!=="sha2-256")throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(r!==32)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new ei(0,this.codec,this.multihash)}toV1(){return new ei(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&this.string.length!==0&&e===this.multibaseName)return this.string;let r;if(this.version===0){if(e!=="base58btc")throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");r=Jc.toB58String(this.multihash)}else if(this.version===1)r=i7(Ou.encode(e,this.bytes));else throw new Error("unsupported version");return e===this.multibaseName&&Object.defineProperty(this,"string",{value:r}),r}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&n7(this.multihash,e.multihash)}static validateCID(e){let r=r7.checkCIDComponents(e);if(r)throw new Error(r)}static isCID(e){return e instanceof ei||Boolean(e&&e[f2])}};ei.codecs=Xc;o2.exports=ei});var l2=C((CF,u2)=>{"use strict";u2.exports=a7;function a7(t,e){for(var r=new Array(arguments.length-1),i=0,n=2,s=!0;n{"use strict";var Zc=d2;Zc.length=function(e){var r=e.length;if(!r)return 0;for(var i=0;--r%4>1&&e.charAt(r)==="=";)++i;return Math.ceil(e.length*3)/4-i};var ia=new Array(64),h2=new Array(123);for(var yi=0;yi<64;)h2[ia[yi]=yi<26?yi+65:yi<52?yi+71:yi<62?yi-4:yi-59|43]=yi++;Zc.encode=function(e,r,i){for(var n=null,s=[],a=0,o=0,c;r>2],c=(f&3)<<4,o=1;break;case 1:s[a++]=ia[c|f>>4],c=(f&15)<<2,o=2;break;case 2:s[a++]=ia[c|f>>6],s[a++]=ia[f&63],o=0;break}a>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),a=0)}return o&&(s[a++]=ia[c],s[a++]=61,o===1&&(s[a++]=61)),n?(a&&n.push(String.fromCharCode.apply(String,s.slice(0,a))),n.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var p2="invalid encoding";Zc.decode=function(e,r,i){for(var n=i,s=0,a,o=0;o1)break;if((c=h2[c])===void 0)throw Error(p2);switch(s){case 0:a=c,s=1;break;case 1:r[i++]=a<<2|(c&48)>>4,a=c,s=2;break;case 2:r[i++]=(a&15)<<4|(c&60)>>2,a=c,s=3;break;case 3:r[i++]=(a&3)<<6|c,s=0;break}}if(s===1)throw Error(p2);return i-n};Zc.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var g2=C((TF,y2)=>{"use strict";y2.exports=ef;function ef(){this._listeners={}}ef.prototype.on=function(e,r,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:i||this}),this};ef.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"use strict";v2.exports=m2(m2);function m2(t){return typeof Float32Array!="undefined"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),i=r[3]===128;function n(c,f,u){e[0]=c,f[u]=r[0],f[u+1]=r[1],f[u+2]=r[2],f[u+3]=r[3]}function s(c,f,u){e[0]=c,f[u]=r[3],f[u+1]=r[2],f[u+2]=r[1],f[u+3]=r[0]}t.writeFloatLE=i?n:s,t.writeFloatBE=i?s:n;function a(c,f){return r[0]=c[f],r[1]=c[f+1],r[2]=c[f+2],r[3]=c[f+3],e[0]}function o(c,f){return r[3]=c[f],r[2]=c[f+1],r[1]=c[f+2],r[0]=c[f+3],e[0]}t.readFloatLE=i?a:o,t.readFloatBE=i?o:a}():function(){function e(i,n,s,a){var o=n<0?1:0;if(o&&(n=-n),n===0)i(1/n>0?0:2147483648,s,a);else if(isNaN(n))i(2143289344,s,a);else if(n>34028234663852886e22)i((o<<31|2139095040)>>>0,s,a);else if(n<11754943508222875e-54)i((o<<31|Math.round(n/1401298464324817e-60))>>>0,s,a);else{var c=Math.floor(Math.log(n)/Math.LN2),f=Math.round(n*Math.pow(2,-c)*8388608)&8388607;i((o<<31|c+127<<23|f)>>>0,s,a)}}t.writeFloatLE=e.bind(null,x2),t.writeFloatBE=e.bind(null,w2);function r(i,n,s){var a=i(n,s),o=(a>>31)*2+1,c=a>>>23&255,f=a&8388607;return c===255?f?NaN:o*Infinity:c===0?o*1401298464324817e-60*f:o*Math.pow(2,c-150)*(f+8388608)}t.readFloatLE=r.bind(null,E2),t.readFloatBE=r.bind(null,S2)}(),typeof Float64Array!="undefined"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),i=r[7]===128;function n(c,f,u){e[0]=c,f[u]=r[0],f[u+1]=r[1],f[u+2]=r[2],f[u+3]=r[3],f[u+4]=r[4],f[u+5]=r[5],f[u+6]=r[6],f[u+7]=r[7]}function s(c,f,u){e[0]=c,f[u]=r[7],f[u+1]=r[6],f[u+2]=r[5],f[u+3]=r[4],f[u+4]=r[3],f[u+5]=r[2],f[u+6]=r[1],f[u+7]=r[0]}t.writeDoubleLE=i?n:s,t.writeDoubleBE=i?s:n;function a(c,f){return r[0]=c[f],r[1]=c[f+1],r[2]=c[f+2],r[3]=c[f+3],r[4]=c[f+4],r[5]=c[f+5],r[6]=c[f+6],r[7]=c[f+7],e[0]}function o(c,f){return r[7]=c[f],r[6]=c[f+1],r[5]=c[f+2],r[4]=c[f+3],r[3]=c[f+4],r[2]=c[f+5],r[1]=c[f+6],r[0]=c[f+7],e[0]}t.readDoubleLE=i?a:o,t.readDoubleBE=i?o:a}():function(){function e(i,n,s,a,o,c){var f=a<0?1:0;if(f&&(a=-a),a===0)i(0,o,c+n),i(1/a>0?0:2147483648,o,c+s);else if(isNaN(a))i(0,o,c+n),i(2146959360,o,c+s);else if(a>17976931348623157e292)i(0,o,c+n),i((f<<31|2146435072)>>>0,o,c+s);else{var u;if(a<22250738585072014e-324)u=a/5e-324,i(u>>>0,o,c+n),i((f<<31|u/4294967296)>>>0,o,c+s);else{var l=Math.floor(Math.log(a)/Math.LN2);l===1024&&(l=1023),u=a*Math.pow(2,-l),i(u*4503599627370496>>>0,o,c+n),i((f<<31|l+1023<<20|u*1048576&1048575)>>>0,o,c+s)}}}t.writeDoubleLE=e.bind(null,x2,0,4),t.writeDoubleBE=e.bind(null,w2,4,0);function r(i,n,s,a,o){var c=i(a,o+n),f=i(a,o+s),u=(f>>31)*2+1,l=f>>>20&2047,b=4294967296*(f&1048575)+c;return l===2047?b?NaN:u*Infinity:l===0?u*5e-324*b:u*Math.pow(2,l-1075)*(b+4503599627370496)}t.readDoubleLE=r.bind(null,E2,0,4),t.readDoubleBE=r.bind(null,S2,4,0)}(),t}function x2(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function w2(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function E2(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function S2(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var _2=C((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var I2=C(C2=>{"use strict";var Du=C2;Du.length=function(e){for(var r=0,i=0,n=0;n191&&c<224?a[o++]=(c&31)<<6|e[r++]&63:c>239&&c<365?(c=((c&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,a[o++]=55296+(c>>10),a[o++]=56320+(c&1023)):a[o++]=(c&15)<<12|(e[r++]&63)<<6|e[r++]&63,o>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,a)),o=0);return s?(o&&s.push(String.fromCharCode.apply(String,a.slice(0,o))),s.join("")):String.fromCharCode.apply(String,a.slice(0,o))};Du.write=function(e,r,i){for(var n=i,s,a,o=0;o>6|192,r[i++]=s&63|128):(s&64512)==55296&&((a=e.charCodeAt(o+1))&64512)==56320?(s=65536+((s&1023)<<10)+(a&1023),++o,r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128);return i-n}});var k2=C((BF,T2)=>{"use strict";T2.exports=o7;function o7(t,e,r){var i=r||8192,n=i>>>1,s=null,a=i;return function(c){if(c<1||c>n)return t(c);a+c>i&&(s=t(i),a=0);var f=e.call(s,a,a+=c);return a&7&&(a=(a|7)+1),f}}});var B2=C((PF,R2)=>{"use strict";R2.exports=Gt;var Bo=wn();function Gt(t,e){this.lo=t>>>0,this.hi=e>>>0}var ls=Gt.zero=new Gt(0,0);ls.toNumber=function(){return 0};ls.zzEncode=ls.zzDecode=function(){return this};ls.length=function(){return 1};var c7=Gt.zeroHash="\0\0\0\0\0\0\0\0";Gt.fromNumber=function(e){if(e===0)return ls;var r=e<0;r&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return r&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new Gt(i,n)};Gt.from=function(e){if(typeof e=="number")return Gt.fromNumber(e);if(Bo.isString(e))if(Bo.Long)e=Bo.Long.fromString(e);else return Gt.fromNumber(parseInt(e,10));return e.low||e.high?new Gt(e.low>>>0,e.high>>>0):ls};Gt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,i=~this.hi>>>0;return r||(i=i+1>>>0),-(r+i*4294967296)}return this.lo+this.hi*4294967296};Gt.prototype.toLong=function(e){return Bo.Long?new Bo.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var En=String.prototype.charCodeAt;Gt.fromHash=function(e){return e===c7?ls:new Gt((En.call(e,0)|En.call(e,1)<<8|En.call(e,2)<<16|En.call(e,3)<<24)>>>0,(En.call(e,4)|En.call(e,5)<<8|En.call(e,6)<<16|En.call(e,7)<<24)>>>0)};Gt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Gt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Gt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Gt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:i<128?9:10}});var wn=C(Lu=>{"use strict";var Ae=Lu;Ae.asPromise=l2();Ae.base64=b2();Ae.EventEmitter=g2();Ae.float=A2();Ae.inquire=_2();Ae.utf8=I2();Ae.pool=k2();Ae.LongBits=B2();Ae.isNode=Boolean(typeof globalThis!="undefined"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);Ae.global=Ae.isNode&&globalThis||typeof window!="undefined"&&window||typeof self!="undefined"&&self||Lu;Ae.emptyArray=Object.freeze?Object.freeze([]):[];Ae.emptyObject=Object.freeze?Object.freeze({}):{};Ae.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ae.isString=function(e){return typeof e=="string"||e instanceof String};Ae.isObject=function(e){return e&&typeof e=="object"};Ae.isset=Ae.isSet=function(e,r){var i=e[r];return i!=null&&e.hasOwnProperty(r)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};Ae.Buffer=function(){try{var t=Ae.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(e){return null}}();Ae._Buffer_from=null;Ae._Buffer_allocUnsafe=null;Ae.newBuffer=function(e){return typeof e=="number"?Ae.Buffer?Ae._Buffer_allocUnsafe(e):new Ae.Array(e):Ae.Buffer?Ae._Buffer_from(e):typeof Uint8Array=="undefined"?e:new Uint8Array(e)};Ae.Array=typeof Uint8Array!="undefined"?Uint8Array:Array;Ae.Long=Ae.global.dcodeIO&&Ae.global.dcodeIO.Long||Ae.global.Long||Ae.inquire("long");Ae.key2Re=/^true|false|0|1$/;Ae.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ae.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ae.longToHash=function(e){return e?Ae.LongBits.from(e).toHash():Ae.LongBits.zeroHash};Ae.longFromHash=function(e,r){var i=Ae.LongBits.fromHash(e);return Ae.Long?Ae.Long.fromBits(i.lo,i.hi,r):i.toNumber(Boolean(r))};function P2(t,e,r){for(var i=Object.keys(e),n=0;n-1;--s)if(r[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};Ae.oneOfSetter=function(e){return function(r){for(var i=0;i{"use strict";M2.exports=je;var Or=wn(),qu,tf=Or.LongBits,O2=Or.base64,D2=Or.utf8;function Po(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Uu(){}function f7(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function je(){this.len=0,this.head=new Po(Uu,0,0),this.tail=this.head,this.states=null}var L2=function(){return Or.Buffer?function(){return(je.create=function(){return new qu})()}:function(){return new je}};je.create=L2();je.alloc=function(e){return new Or.Array(e)};Or.Array!==Array&&(je.alloc=Or.pool(je.alloc,Or.Array.prototype.subarray));je.prototype._push=function(e,r,i){return this.tail=this.tail.next=new Po(e,r,i),this.len+=r,this};function Fu(t,e,r){e[r]=t&255}function u7(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Ku(t,e){this.len=t,this.next=void 0,this.val=e}Ku.prototype=Object.create(Po.prototype);Ku.prototype.fn=u7;je.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Ku((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};je.prototype.int32=function(e){return e<0?this._push(Vu,10,tf.fromNumber(e)):this.uint32(e)};je.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Vu(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}je.prototype.uint64=function(e){var r=tf.from(e);return this._push(Vu,r.length(),r)};je.prototype.int64=je.prototype.uint64;je.prototype.sint64=function(e){var r=tf.from(e).zzEncode();return this._push(Vu,r.length(),r)};je.prototype.bool=function(e){return this._push(Fu,1,e?1:0)};function zu(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}je.prototype.fixed32=function(e){return this._push(zu,4,e>>>0)};je.prototype.sfixed32=je.prototype.fixed32;je.prototype.fixed64=function(e){var r=tf.from(e);return this._push(zu,4,r.lo)._push(zu,4,r.hi)};je.prototype.sfixed64=je.prototype.fixed64;je.prototype.float=function(e){return this._push(Or.float.writeFloatLE,4,e)};je.prototype.double=function(e){return this._push(Or.float.writeDoubleLE,8,e)};var l7=Or.Array.prototype.set?function(e,r,i){r.set(e,i)}:function(e,r,i){for(var n=0;n>>0;if(!r)return this._push(Fu,1,0);if(Or.isString(e)){var i=je.alloc(r=O2.length(e));O2.decode(e,i,0),e=i}return this.uint32(r)._push(l7,r,e)};je.prototype.string=function(e){var r=D2.length(e);return r?this.uint32(r)._push(D2.write,r,e):this._push(Fu,1,0)};je.prototype.fork=function(){return this.states=new f7(this),this.head=this.tail=new Po(Uu,0,0),this.len=0,this};je.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Po(Uu,0,0),this.len=0),this};je.prototype.ldelim=function(){var e=this.head,r=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=r,this.len+=i),this};je.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,r,i),i+=e.len,e=e.next;return r};je._configure=function(t){qu=t,je.create=L2(),qu._configure()}});var F2=C((OF,q2)=>{"use strict";q2.exports=gi;var U2=ju();(gi.prototype=Object.create(U2.prototype)).constructor=gi;var Sn=wn();function gi(){U2.call(this)}gi._configure=function(){gi.alloc=Sn._Buffer_allocUnsafe,gi.writeBytesBuffer=Sn.Buffer&&Sn.Buffer.prototype instanceof Uint8Array&&Sn.Buffer.prototype.set.name==="set"?function(e,r,i){r.set(e,i)}:function(e,r,i){if(e.copy)e.copy(r,i,0,e.length);else for(var n=0;n>>0;return this.uint32(r),r&&this._push(gi.writeBytesBuffer,r,e),this};function d7(t,e,r){t.length<40?Sn.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}gi.prototype.string=function(e){var r=Sn.Buffer.byteLength(e);return this.uint32(r),r&&this._push(d7,r,e),this};gi._configure()});var $u=C((DF,K2)=>{"use strict";K2.exports=Ot;var vi=wn(),Hu,V2=vi.LongBits,h7=vi.utf8;function ti(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Ot(t){this.buf=t,this.pos=0,this.len=t.length}var z2=typeof Uint8Array!="undefined"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Ot(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Ot(e);throw Error("illegal buffer")},j2=function(){return vi.Buffer?function(r){return(Ot.create=function(n){return vi.Buffer.isBuffer(n)?new Hu(n):z2(n)})(r)}:z2};Ot.create=j2();Ot.prototype._slice=vi.Array.prototype.subarray||vi.Array.prototype.slice;Ot.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,ti(this,10);return e}}();Ot.prototype.int32=function(){return this.uint32()|0};Ot.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Gu(){var t=new V2(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw ti(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw ti(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Ot.prototype.bool=function(){return this.uint32()!==0};function rf(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Ot.prototype.fixed32=function(){if(this.pos+4>this.len)throw ti(this,4);return rf(this.buf,this.pos+=4)};Ot.prototype.sfixed32=function(){if(this.pos+4>this.len)throw ti(this,4);return rf(this.buf,this.pos+=4)|0};function H2(){if(this.pos+8>this.len)throw ti(this,8);return new V2(rf(this.buf,this.pos+=4),rf(this.buf,this.pos+=4))}Ot.prototype.float=function(){if(this.pos+4>this.len)throw ti(this,4);var e=vi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Ot.prototype.double=function(){if(this.pos+8>this.len)throw ti(this,4);var e=vi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Ot.prototype.bytes=function(){var e=this.uint32(),r=this.pos,i=this.pos+e;if(i>this.len)throw ti(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,i):r===i?new this.buf.constructor(0):this._slice.call(this.buf,r,i)};Ot.prototype.string=function(){var e=this.bytes();return h7.read(e,0,e.length)};Ot.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ti(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ti(this);while(this.buf[this.pos++]&128);return this};Ot.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!=4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Ot._configure=function(t){Hu=t,Ot.create=j2(),Hu._configure();var e=vi.Long?"toLong":"toNumber";vi.merge(Ot.prototype,{int64:function(){return Gu.call(this)[e](!1)},uint64:function(){return Gu.call(this)[e](!0)},sint64:function(){return Gu.call(this).zzDecode()[e](!1)},fixed64:function(){return H2.call(this)[e](!0)},sfixed64:function(){return H2.call(this)[e](!1)}})}});var W2=C((LF,G2)=>{"use strict";G2.exports=ds;var $2=$u();(ds.prototype=Object.create($2.prototype)).constructor=ds;var Y2=wn();function ds(t){$2.call(this,t)}ds._configure=function(){Y2.Buffer&&(ds.prototype._slice=Y2.Buffer.prototype.slice)};ds.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};ds._configure()});var J2=C((qF,Q2)=>{"use strict";Q2.exports=No;var Yu=wn();(No.prototype=Object.create(Yu.EventEmitter.prototype)).constructor=No;function No(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Yu.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(r)}No.prototype.rpcCall=function t(e,r,i,n,s){if(!n)throw TypeError("request must be specified");var a=this;if(!s)return Yu.asPromise(t,a,e,r,i,n);if(!a.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return a.rpcImpl(e,r[a.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(c,f){if(c)return a.emit("error",c,e),s(c);if(f===null){a.end(!0);return}if(!(f instanceof i))try{f=i[a.responseDelimited?"decodeDelimited":"decode"](f)}catch(u){return a.emit("error",u,e),s(u)}return a.emit("data",f,e),s(null,f)})}catch(o){a.emit("error",o,e),setTimeout(function(){s(o)},0);return}};No.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Z2=C(X2=>{"use strict";var p7=X2;p7.Service=J2()});var tb=C((FF,eb)=>{"use strict";eb.exports={}});var nb=C(rb=>{"use strict";var xr=rb;xr.build="minimal";xr.Writer=ju();xr.BufferWriter=F2();xr.Reader=$u();xr.BufferReader=W2();xr.util=wn();xr.rpc=Z2();xr.roots=tb();xr.configure=ib;function ib(){xr.util._configure(),xr.Writer._configure(xr.BufferWriter),xr.Reader._configure(xr.BufferReader)}ib()});var Gi=C((VF,sb)=>{"use strict";sb.exports=nb()});var sf=C((zF,ab)=>{"use strict";var hs=Gi(),nf=hs.Reader,ob=hs.Writer,fr=hs.util,Dr=hs.roots["libp2p-crypto-keys"]||(hs.roots["libp2p-crypto-keys"]={});Dr.KeyType=function(){var t={},e=Object.create(t);return e[t[0]="RSA"]=0,e[t[1]="Ed25519"]=1,e[t[2]="Secp256k1"]=2,e}();Dr.PublicKey=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.Type=r.int32();break;case 2:s.Data=r.bytes();break;default:r.skipType(a&7);break}}if(!s.hasOwnProperty("Type"))throw fr.ProtocolError("missing required 'Type'",{instance:s});if(!s.hasOwnProperty("Data"))throw fr.ProtocolError("missing required 'Data'",{instance:s});return s},t.fromObject=function(r){if(r instanceof Dr.PublicKey)return r;var i=new Dr.PublicKey;switch(r.Type){case"RSA":case 0:i.Type=0;break;case"Ed25519":case 1:i.Type=1;break;case"Secp256k1":case 2:i.Type=2;break}return r.Data!=null&&(typeof r.Data=="string"?fr.base64.decode(r.Data,i.Data=fr.newBuffer(fr.base64.length(r.Data)),0):r.Data.length&&(i.Data=r.Data)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(n.Type=i.enums===String?"RSA":0,i.bytes===String?n.Data="":(n.Data=[],i.bytes!==Array&&(n.Data=fr.newBuffer(n.Data)))),r.Type!=null&&r.hasOwnProperty("Type")&&(n.Type=i.enums===String?Dr.KeyType[r.Type]:r.Type),r.Data!=null&&r.hasOwnProperty("Data")&&(n.Data=i.bytes===String?fr.base64.encode(r.Data,0,r.Data.length):i.bytes===Array?Array.prototype.slice.call(r.Data):r.Data),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,hs.util.toJSONOptions)},t}();Dr.PrivateKey=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.Type=r.int32();break;case 2:s.Data=r.bytes();break;default:r.skipType(a&7);break}}if(!s.hasOwnProperty("Type"))throw fr.ProtocolError("missing required 'Type'",{instance:s});if(!s.hasOwnProperty("Data"))throw fr.ProtocolError("missing required 'Data'",{instance:s});return s},t.fromObject=function(r){if(r instanceof Dr.PrivateKey)return r;var i=new Dr.PrivateKey;switch(r.Type){case"RSA":case 0:i.Type=0;break;case"Ed25519":case 1:i.Type=1;break;case"Secp256k1":case 2:i.Type=2;break}return r.Data!=null&&(typeof r.Data=="string"?fr.base64.decode(r.Data,i.Data=fr.newBuffer(fr.base64.length(r.Data)),0):r.Data.length&&(i.Data=r.Data)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(n.Type=i.enums===String?"RSA":0,i.bytes===String?n.Data="":(n.Data=[],i.bytes!==Array&&(n.Data=fr.newBuffer(n.Data)))),r.Type!=null&&r.hasOwnProperty("Type")&&(n.Type=i.enums===String?Dr.KeyType[r.Type]:r.Type),r.Data!=null&&r.hasOwnProperty("Data")&&(n.Data=i.bytes===String?fr.base64.encode(r.Data,0,r.Data.length):i.bytes===Array?Array.prototype.slice.call(r.Data):r.Data),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,hs.util.toJSONOptions)},t}();ab.exports=Dr});var De=C((jF,cb)=>{cb.exports={options:{usePureJavaScript:!1}}});var lb=C((HF,fb)=>{var Wu={};fb.exports=Wu;var ub={};Wu.encode=function(t,e,r){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');var i="";if(!(t instanceof Uint8Array))i=b7(t,e);else{var n=0,s=e.length,a=e.charAt(0),o=[0];for(n=0;n0;)o.push(f%s),f=f/s|0}for(n=0;t[n]===0&&n=0;--n)i+=e[o[n]]}if(r){var u=new RegExp(".{1,"+r+"}","g");i=i.match(u).join(`\r +`)}return i};Wu.decode=function(t,e){if(typeof t!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var r=ub[e];if(!r){r=ub[e]=[];for(var i=0;i>=8;for(;f>0;)a.push(f&255),f>>=8}for(var u=0;t[u]===s&&u0;)s.push(o%i),o=o/i|0}var c="";for(r=0;t.at(r)===0&&r=0;--r)c+=e[s[r]];return c}});var et=C((GF,db)=>{var hb=De(),pb=lb(),H=db.exports=hb.util=hb.util||{};(function(){if(typeof process!="undefined"&&process.nextTick&&!process.browser){H.nextTick=process.nextTick,typeof setImmediate=="function"?H.setImmediate=setImmediate:H.setImmediate=H.nextTick;return}if(typeof setImmediate=="function"){H.setImmediate=function(){return setImmediate.apply(void 0,arguments)},H.nextTick=function(o){return setImmediate(o)};return}if(H.setImmediate=function(o){setTimeout(o,0)},typeof window!="undefined"&&typeof window.postMessage=="function"){let o=function(c){if(c.source===window&&c.data===t){c.stopPropagation();var f=e.slice();e.length=0,f.forEach(function(u){u()})}};var a=o,t="forge.setImmediate",e=[];H.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(t,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver!="undefined"){var r=Date.now(),i=!0,n=document.createElement("div"),e=[];new MutationObserver(function(){var c=e.slice();e.length=0,c.forEach(function(f){f()})}).observe(n,{attributes:!0});var s=H.setImmediate;H.setImmediate=function(c){Date.now()-r>15?(r=Date.now(),s(c)):(e.push(c),e.length===1&&n.setAttribute("a",i=!i))}}H.nextTick=H.setImmediate})();H.isNodejs=typeof process!="undefined"&&process.versions&&process.versions.node;H.globalScope=function(){return H.isNodejs?globalThis:typeof self=="undefined"?window:self}();H.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};H.isArrayBuffer=function(t){return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer};H.isArrayBufferView=function(t){return t&&H.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function Mo(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}H.ByteBuffer=Qu;function Qu(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(H.isArrayBuffer(t)||H.isArrayBufferView(t))if(typeof Buffer!="undefined"&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(i){for(var r=0;ry7&&(this.data.substr(0,1),this._constructedStringLength=0)};H.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};H.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};H.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};H.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this};H.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};H.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(H.encodeUtf8(t))};H.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};H.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};H.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};H.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};H.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};H.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))};H.ByteStringBuffer.prototype.putInt=function(t,e){Mo(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};H.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<0);return e};H.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e};H.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};H.ByteStringBuffer.prototype.bytes=function(t){return typeof t=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};H.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};H.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this};H.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};H.ByteStringBuffer.prototype.copy=function(){var t=H.createBuffer(this.data);return t.read=this.read,t};H.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};H.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};H.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this};H.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+e);return i.set(r),this.data=new DataView(i.buffer),this};H.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};H.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this};H.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};H.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};H.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this};H.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};H.DataBuffer.prototype.putInt=function(t,e){Mo(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};H.DataBuffer.prototype.putSignedInt=function(t,e){return Mo(e),this.accommodate(e/8),t<0&&(t+=2<0);return e};H.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e};H.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};H.DataBuffer.prototype.bytes=function(t){return typeof t=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};H.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};H.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};H.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};H.DataBuffer.prototype.copy=function(){return new H.DataBuffer(this)};H.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};H.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};H.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};H.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};H.xorBytes=function(t,e,r){for(var i="",n="",s="",a=0,o=0;r>0;--r,++a)n=t.charCodeAt(a)^e.charCodeAt(a),o>=10&&(i+=s,s="",o=0),s+=String.fromCharCode(n),++o;return i+=s,i};H.hexToBytes=function(t){var e="",r=0;for(t.length&!0&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var An="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_n=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],bb="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";H.encode64=function(t,e){for(var r="",i="",n,s,a,o=0;o>2),r+=An.charAt((n&3)<<4|s>>4),isNaN(s)?r+="==":(r+=An.charAt((s&15)<<2|a>>6),r+=isNaN(a)?"=":An.charAt(a&63)),e&&r.length>e&&(i+=r.substr(0,e)+`\r +`,r=r.substr(e));return i+=r,i};H.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,i,n,s,a=0;a>4),n!==64&&(e+=String.fromCharCode((i&15)<<4|n>>2),s!==64&&(e+=String.fromCharCode((n&3)<<6|s)));return e};H.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};H.decodeUtf8=function(t){return decodeURIComponent(escape(t))};H.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:pb.encode,decode:pb.decode}};H.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};H.binary.raw.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(t.length)),r=r||0;for(var n=r,s=0;s>2),r+=An.charAt((n&3)<<4|s>>4),isNaN(s)?r+="==":(r+=An.charAt((s&15)<<2|a>>6),r+=isNaN(a)?"=":An.charAt(a&63)),e&&r.length>e&&(i+=r.substr(0,e)+`\r +`,r=r.substr(e));return i+=r,i};H.binary.base64.decode=function(t,e,r){var i=e;i||(i=new Uint8Array(Math.ceil(t.length/4)*3)),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var n,s,a,o,c=0,f=r;c>4,a!==64&&(i[f++]=(s&15)<<4|a>>2,o!==64&&(i[f++]=(a&3)<<6|o));return e?f-r:i.subarray(0,f)};H.binary.base58.encode=function(t,e){return H.binary.baseN.encode(t,bb,e)};H.binary.base58.decode=function(t,e){return H.binary.baseN.decode(t,bb,e)};H.text={utf8:{},utf16:{}};H.text.utf8.encode=function(t,e,r){t=H.encodeUtf8(t);var i=e;i||(i=new Uint8Array(t.length)),r=r||0;for(var n=r,s=0;s0?(c=s[a].substring(0,o),f=s[a].substring(o+1)):(c=s[a],f=null),c in n||(n[c]=[]),!(c in Object.prototype)&&f!==null&&n[c].push(unescape(f))}return n},r;return typeof t=="undefined"?(of===null&&(typeof window!="undefined"&&window.location&&window.location.search?of=e(window.location.search.substring(1)):of={}),r=of):r=e(t),r};H.parseFragment=function(t){var e=t,r="",i=t.indexOf("?");i>0&&(e=t.substring(0,i),r=t.substring(i+1));var n=e.split("/");n.length>0&&n[0]===""&&n.shift();var s=r===""?{}:H.getQueryVariables(r);return{pathString:e,queryString:r,path:n,query:s}};H.makeRequest=function(t){var e=H.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(i){return typeof i=="undefined"?e.path:e.path[i]},getQuery:function(i,n){var s;return typeof i=="undefined"?s=e.query:(s=e.query[i],s&&typeof n!="undefined"&&(s=s[n])),s},getQueryLast:function(i,n){var s,a=r.getQuery(i);return a?s=a[a.length-1]:s=n,s}};return r};H.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var i=jQuery.param(e||{});return r=r||"",t+(i.length>0?"?"+i:"")+(r.length>0?"#"+r:"")};H.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};H.format=function(t){for(var e=/%./g,r,i,n=0,s=[],a=0;r=e.exec(t);){i=t.substring(a,e.lastIndex-2),i.length>0&&s.push(i),a=e.lastIndex;var o=r[0][1];switch(o){case"s":case"o":n");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(t.substring(a)),s.join("")};H.formatNumber=function(t,e,r,i){var n=t,s=isNaN(e=Math.abs(e))?2:e,a=r===void 0?",":r,o=i===void 0?".":i,c=n<0?"-":"",f=parseInt(n=Math.abs(+n||0).toFixed(s),10)+"",u=f.length>3?f.length%3:0;return c+(u?f.substr(0,u)+o:"")+f.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?a+Math.abs(n-f).toFixed(s).slice(2):"")};H.formatSize=function(t){return t>=1073741824?t=H.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=H.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=H.formatNumber(t/1024,0)+" KiB":t=H.formatNumber(t,0)+" bytes",t};H.bytesFromIP=function(t){return t.indexOf(".")!==-1?H.bytesFromIPv4(t):t.indexOf(":")!==-1?H.bytesFromIPv6(t):null};H.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=H.createBuffer(),r=0;rr[i].end-r[i].start&&(i=r.length-1))}e.push(s)}if(r.length>0){var c=r[i];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};H.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in H&&!t.update)return e(null,H.cores);if(typeof navigator!="undefined"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return H.cores=navigator.hardwareConcurrency,e(null,H.cores);if(typeof Worker=="undefined")return H.cores=1,e(null,H.cores);if(typeof Blob=="undefined")return H.cores=2,e(null,H.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){for(var o=Date.now(),c=o+4;Date.now()p.st&&u.stu.st&&p.st{var Oo=De();Oo.pki=Oo.pki||{};var Zu=yb.exports=Oo.pki.oids=Oo.oids=Oo.oids||{};function ue(t,e){Zu[t]=e,Zu[e]=t}function Qe(t,e){Zu[t]=e}ue("1.2.840.113549.1.1.1","rsaEncryption");ue("1.2.840.113549.1.1.4","md5WithRSAEncryption");ue("1.2.840.113549.1.1.5","sha1WithRSAEncryption");ue("1.2.840.113549.1.1.7","RSAES-OAEP");ue("1.2.840.113549.1.1.8","mgf1");ue("1.2.840.113549.1.1.9","pSpecified");ue("1.2.840.113549.1.1.10","RSASSA-PSS");ue("1.2.840.113549.1.1.11","sha256WithRSAEncryption");ue("1.2.840.113549.1.1.12","sha384WithRSAEncryption");ue("1.2.840.113549.1.1.13","sha512WithRSAEncryption");ue("1.3.101.112","EdDSA25519");ue("1.2.840.10040.4.3","dsa-with-sha1");ue("1.3.14.3.2.7","desCBC");ue("1.3.14.3.2.26","sha1");ue("2.16.840.1.101.3.4.2.1","sha256");ue("2.16.840.1.101.3.4.2.2","sha384");ue("2.16.840.1.101.3.4.2.3","sha512");ue("1.2.840.113549.2.5","md5");ue("1.2.840.113549.1.7.1","data");ue("1.2.840.113549.1.7.2","signedData");ue("1.2.840.113549.1.7.3","envelopedData");ue("1.2.840.113549.1.7.4","signedAndEnvelopedData");ue("1.2.840.113549.1.7.5","digestedData");ue("1.2.840.113549.1.7.6","encryptedData");ue("1.2.840.113549.1.9.1","emailAddress");ue("1.2.840.113549.1.9.2","unstructuredName");ue("1.2.840.113549.1.9.3","contentType");ue("1.2.840.113549.1.9.4","messageDigest");ue("1.2.840.113549.1.9.5","signingTime");ue("1.2.840.113549.1.9.6","counterSignature");ue("1.2.840.113549.1.9.7","challengePassword");ue("1.2.840.113549.1.9.8","unstructuredAddress");ue("1.2.840.113549.1.9.14","extensionRequest");ue("1.2.840.113549.1.9.20","friendlyName");ue("1.2.840.113549.1.9.21","localKeyId");ue("1.2.840.113549.1.9.22.1","x509Certificate");ue("1.2.840.113549.1.12.10.1.1","keyBag");ue("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");ue("1.2.840.113549.1.12.10.1.3","certBag");ue("1.2.840.113549.1.12.10.1.4","crlBag");ue("1.2.840.113549.1.12.10.1.5","secretBag");ue("1.2.840.113549.1.12.10.1.6","safeContentsBag");ue("1.2.840.113549.1.5.13","pkcs5PBES2");ue("1.2.840.113549.1.5.12","pkcs5PBKDF2");ue("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");ue("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");ue("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");ue("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");ue("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");ue("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");ue("1.2.840.113549.2.7","hmacWithSHA1");ue("1.2.840.113549.2.8","hmacWithSHA224");ue("1.2.840.113549.2.9","hmacWithSHA256");ue("1.2.840.113549.2.10","hmacWithSHA384");ue("1.2.840.113549.2.11","hmacWithSHA512");ue("1.2.840.113549.3.7","des-EDE3-CBC");ue("2.16.840.1.101.3.4.1.2","aes128-CBC");ue("2.16.840.1.101.3.4.1.22","aes192-CBC");ue("2.16.840.1.101.3.4.1.42","aes256-CBC");ue("2.5.4.3","commonName");ue("2.5.4.5","serialName");ue("2.5.4.6","countryName");ue("2.5.4.7","localityName");ue("2.5.4.8","stateOrProvinceName");ue("2.5.4.9","streetAddress");ue("2.5.4.10","organizationName");ue("2.5.4.11","organizationalUnitName");ue("2.5.4.13","description");ue("2.5.4.15","businessCategory");ue("2.5.4.17","postalCode");ue("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");ue("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");ue("2.16.840.1.113730.1.1","nsCertType");ue("2.16.840.1.113730.1.13","nsComment");Qe("2.5.29.1","authorityKeyIdentifier");Qe("2.5.29.2","keyAttributes");Qe("2.5.29.3","certificatePolicies");Qe("2.5.29.4","keyUsageRestriction");Qe("2.5.29.5","policyMapping");Qe("2.5.29.6","subtreesConstraint");Qe("2.5.29.7","subjectAltName");Qe("2.5.29.8","issuerAltName");Qe("2.5.29.9","subjectDirectoryAttributes");Qe("2.5.29.10","basicConstraints");Qe("2.5.29.11","nameConstraints");Qe("2.5.29.12","policyConstraints");Qe("2.5.29.13","basicConstraints");ue("2.5.29.14","subjectKeyIdentifier");ue("2.5.29.15","keyUsage");Qe("2.5.29.16","privateKeyUsagePeriod");ue("2.5.29.17","subjectAltName");ue("2.5.29.18","issuerAltName");ue("2.5.29.19","basicConstraints");Qe("2.5.29.20","cRLNumber");Qe("2.5.29.21","cRLReason");Qe("2.5.29.22","expirationDate");Qe("2.5.29.23","instructionCode");Qe("2.5.29.24","invalidityDate");Qe("2.5.29.25","cRLDistributionPoints");Qe("2.5.29.26","issuingDistributionPoint");Qe("2.5.29.27","deltaCRLIndicator");Qe("2.5.29.28","issuingDistributionPoint");Qe("2.5.29.29","certificateIssuer");Qe("2.5.29.30","nameConstraints");ue("2.5.29.31","cRLDistributionPoints");ue("2.5.29.32","certificatePolicies");Qe("2.5.29.33","policyMappings");Qe("2.5.29.34","policyConstraints");ue("2.5.29.35","authorityKeyIdentifier");Qe("2.5.29.36","policyConstraints");ue("2.5.29.37","extKeyUsage");Qe("2.5.29.46","freshestCRL");Qe("2.5.29.54","inhibitAnyPolicy");ue("1.3.6.1.4.1.11129.2.4.2","timestampList");ue("1.3.6.1.5.5.7.1.1","authorityInfoAccess");ue("1.3.6.1.5.5.7.3.1","serverAuth");ue("1.3.6.1.5.5.7.3.2","clientAuth");ue("1.3.6.1.5.5.7.3.3","codeSigning");ue("1.3.6.1.5.5.7.3.4","emailProtection");ue("1.3.6.1.5.5.7.3.8","timeStamping")});var $i=C((YF,gb)=>{var Ct=De();et();na();var ye=gb.exports=Ct.asn1=Ct.asn1||{};ye.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};ye.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};ye.create=function(t,e,r,i,n){if(Ct.util.isArray(i)){for(var s=[],a=0;ae){var i=new Error("Too few bytes to parse DER.");throw i.available=t.length(),i.remaining=e,i.requested=r,i}}var E7=function(t,e){var r=t.getByte();if(e--,r!==128){var i,n=r&128;if(!n)i=r;else{var s=r&127;Do(t,e,s),i=t.getInt(s<<3)}if(i<0)throw new Error("Negative length: "+i);return i}};ye.fromDer=function(t,e){return e===void 0&&(e={strict:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=Ct.util.createBuffer(t)),cf(t,t.length(),0,e)};function cf(t,e,r,i){var n;Do(t,e,2);var s=t.getByte();e--;var a=s&192,o=s&31;n=t.length();var c=E7(t,e);if(e-=n-t.length(),c!==void 0&&c>e){if(i.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=t.length(),f.remaining=e,f.requested=c,f}c=e}var u,l,b=(s&32)==32;if(b)if(u=[],c===void 0)for(;;){if(Do(t,e,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),e-=2;break}n=t.length(),u.push(cf(t,e,r+1,i)),e-=n-t.length()}else for(;c>0;)n=t.length(),u.push(cf(t,c,r+1,i)),e-=n-t.length(),c-=n-t.length();if(u===void 0&&a===ye.Class.UNIVERSAL&&o===ye.Type.BITSTRING&&(l=t.bytes(c)),u===void 0&&i.decodeBitStrings&&a===ye.Class.UNIVERSAL&&o===ye.Type.BITSTRING&&c>1){var p=t.read,g=e,A=0;if(o===ye.Type.BITSTRING&&(Do(t,e,1),A=t.getByte(),e--),A===0)try{n=t.length();var F={verbose:i.verbose,strict:!0,decodeBitStrings:!0},B=cf(t,e,r+1,F),K=n-t.length();e-=K,o==ye.Type.BITSTRING&&K++;var V=B.tagClass;K===c&&(V===ye.Class.UNIVERSAL||V===ye.Class.CONTEXT_SPECIFIC)&&(u=[B])}catch($){}u===void 0&&(t.read=p,e=g)}if(u===void 0){if(c===void 0){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(o===ye.Type.BMPSTRING)for(u="";c>0;c-=2)Do(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(c)}var Q=l===void 0?null:{bitStringContents:l};return ye.create(a,o,b,u,Q)}ye.toDer=function(t){var e=Ct.util.createBuffer(),r=t.tagClass|t.type,i=Ct.util.createBuffer(),n=!1;if("bitStringContents"in t&&(n=!0,t.original&&(n=ye.equals(t,t.original))),n)i.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:i.putByte(0);for(var s=0;s1&&(t.value.charCodeAt(0)===0&&(t.value.charCodeAt(1)&128)==0||t.value.charCodeAt(0)===255&&(t.value.charCodeAt(1)&128)==128)?i.putBytes(t.value.substr(1)):i.putBytes(t.value);if(e.putByte(r),i.length()<=127)e.putByte(i.length()&127);else{var a=i.length(),o="";do o+=String.fromCharCode(a&255),a=a>>>8;while(a>0);e.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)e.putByte(o.charCodeAt(s))}return e.putBuffer(i),e};ye.oidToDer=function(t){var e=t.split("."),r=Ct.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var i,n,s,a,o=2;o>>7,i||(a|=128),n.push(a),i=!1;while(s>0);for(var c=n.length-1;c>=0;--c)r.putByte(n[c])}return r};ye.derToOid=function(t){var e;typeof t=="string"&&(t=Ct.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var i=0;t.length()>0;)r=t.getByte(),i=i<<7,r&128?i+=r&127:(e+="."+(i+r),i=0);return e};ye.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(t.substr(2,2),10)-1,n=parseInt(t.substr(4,2),10),s=parseInt(t.substr(6,2),10),a=parseInt(t.substr(8,2),10),o=0;if(t.length>11){var c=t.charAt(10),f=10;c!=="+"&&c!=="-"&&(o=parseInt(t.substr(10,2),10),f+=2)}if(e.setUTCFullYear(r,i,n),e.setUTCHours(s,a,o,0),f&&(c=t.charAt(f),c==="+"||c==="-")){var u=parseInt(t.substr(f+1,2),10),l=parseInt(t.substr(f+4,2),10),b=u*60+l;b*=6e4,c==="+"?e.setTime(+e-b):e.setTime(+e+b)}return e};ye.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),i=parseInt(t.substr(4,2),10)-1,n=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),a=parseInt(t.substr(10,2),10),o=parseInt(t.substr(12,2),10),c=0,f=0,u=!1;t.charAt(t.length-1)==="Z"&&(u=!0);var l=t.length-5,b=t.charAt(l);if(b==="+"||b==="-"){var p=parseInt(t.substr(l+1,2),10),g=parseInt(t.substr(l+4,2),10);f=p*60+g,f*=6e4,b==="+"&&(f*=-1),u=!0}return t.charAt(14)==="."&&(c=parseFloat(t.substr(14),10)*1e3),u?(e.setUTCFullYear(r,i,n),e.setUTCHours(s,a,o,c),e.setTime(+e+f)):(e.setFullYear(r,i,n),e.setHours(s,a,o,c)),e};ye.dateToUtcTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var i=0;i=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r};ye.derToInteger=function(t){typeof t=="string"&&(t=Ct.util.createBuffer(t));var e=t.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)};ye.validate=function(t,e,r,i){var n=!1;if((t.tagClass===e.tagClass||typeof e.tagClass=="undefined")&&(t.type===e.type||typeof e.type=="undefined"))if(t.constructed===e.constructed||typeof e.constructed=="undefined"){if(n=!0,e.value&&Ct.util.isArray(e.value))for(var s=0,a=0;n&&a0&&(i+=` +`);for(var n="",s=0;s1?i+="0x"+Ct.util.bytesToHex(t.value.slice(1)):i+="(none)",t.value.length>0){var f=t.value.charCodeAt(0);f==1?i+=" (1 unused bit shown)":f>1&&(i+=" ("+f+" unused bits shown)")}}else t.type===ye.Type.OCTETSTRING?(vb.test(t.value)||(i+="("+t.value+") "),i+="0x"+Ct.util.bytesToHex(t.value)):t.type===ye.Type.UTF8?i+=Ct.util.decodeUtf8(t.value):t.type===ye.Type.PRINTABLESTRING||t.type===ye.Type.IA5String?i+=t.value:vb.test(t.value)?i+="0x"+Ct.util.bytesToHex(t.value):t.value.length===0?i+="[null]":i+=t.value}return i}});var tl=C((WF,mb)=>{var $t=De();et();mb.exports=$t.cipher=$t.cipher||{};$t.cipher.algorithms=$t.cipher.algorithms||{};$t.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=$t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new $t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};$t.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=$t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new $t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};$t.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),$t.cipher.algorithms[t]=e};$t.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in $t.cipher.algorithms?$t.cipher.algorithms[t]:null};var el=$t.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};el.prototype.start=function(t){t=t||{};var e={};for(var r in t)e[r]=t[r];e.decrypt=this._decrypt,this._finish=!1,this._input=$t.util.createBuffer(),this.output=t.output||$t.util.createBuffer(),this.mode.start(e)};el.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};el.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return t(this.blockSize,r,!1)},this.mode.unpad=function(r){return t(this.blockSize,r,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var il=C((QF,xb)=>{var Yt=De();et();Yt.cipher=Yt.cipher||{};var Ue=xb.exports=Yt.cipher.modes=Yt.cipher.modes||{};Ue.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Ue.ecb.prototype.start=function(t){};Ue.ecb.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return i>this.blockSize<<2?!1:(t.truncate(i),!0)};Ue.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Ue.cbc.prototype.start=function(t){if(t.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in t)this._iv=ff(t.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};Ue.cbc.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var i=0;i0))return!0;for(var i=0;i0)return!1;var r=t.length(),i=t.at(r-1);return i>this.blockSize<<2?!1:(t.truncate(i),!0)};Ue.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Yt.util.createBuffer(),this._partialBytes=0};Ue.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=ff(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Ue.cfb.prototype.encrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n0)t.read-=this.blockSize;else for(var n=0;n0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0};Ue.cfb.prototype.decrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n0)t.read-=this.blockSize;else for(var n=0;n0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0};Ue.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Yt.util.createBuffer(),this._partialBytes=0};Ue.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=ff(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Ue.ofb.prototype.encrypt=function(t,e,r){var i=t.length();if(t.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n0)t.read-=this.blockSize;else for(var n=0;n0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0};Ue.ofb.prototype.decrypt=Ue.ofb.prototype.encrypt;Ue.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Yt.util.createBuffer(),this._partialBytes=0};Ue.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=ff(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Ue.ctr.prototype.encrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize)for(var n=0;n0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}uf(this._inBlock)};Ue.ctr.prototype.decrypt=Ue.ctr.prototype.encrypt;Ue.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Yt.util.createBuffer(),this._partialBytes=0,this._R=3774873600};Ue.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e=Yt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Yt.util.createBuffer(t.additionalData):r=Yt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Yt.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=e.length();if(i===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(rl(i*8)))}this._inBlock=this._j0.slice(0),uf(this._inBlock),this._partialBytes=0,r=Yt.util.createBuffer(r),this._aDataLength=rl(r.length()*8);var n=r.length()%this.blockSize;for(n&&r.fillWithByte(0,this.blockSize-n),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};Ue.gcm.prototype.encrypt=function(t,e,r){var i=t.length();if(i===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&i>=this.blockSize){for(var n=0;n0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),uf(this._inBlock)};Ue.gcm.prototype.decrypt=function(t,e,r){var i=t.length();if(i0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),uf(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n0;--i)e[i]=t[i]>>>1|(t[i-1]&1)<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)};Ue.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var i=r/8|0,n=t[i]>>>(7-r%8)*4&15,s=this._m[r][n];e[0]^=s[0],e[1]^=s[1],e[2]^=s[2],e[3]^=s[3]}return e};Ue.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)};Ue.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,i=4*r,n=16*r,s=new Array(n),a=0;a>>1,n=new Array(r);n[i]=t.slice(0);for(var s=i>>>1;s>0;)this.pow(n[2*s],n[s]=[]),s>>=1;for(s=2;s4){var r=t;t=Yt.util.createBuffer();for(var i=0;i{var st=De();tl();il();et();wb.exports=st.aes=st.aes||{};st.aes.startEncrypting=function(t,e,r,i){var n=lf({key:t,output:r,decrypt:!1,mode:i});return n.start(e),n};st.aes.createEncryptionCipher=function(t,e){return lf({key:t,output:null,decrypt:!1,mode:e})};st.aes.startDecrypting=function(t,e,r,i){var n=lf({key:t,output:r,decrypt:!0,mode:i});return n.start(e),n};st.aes.createDecryptionCipher=function(t,e){return lf({key:t,output:null,decrypt:!0,mode:e})};st.aes.Algorithm=function(t,e){nl||Eb();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(i,n){return sl(r._w,i,n,!1)},decrypt:function(i,n){return sl(r._w,i,n,!0)}}}),r._init=!1};st.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e=t.key,r;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=st.util.createBuffer(e);else if(st.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=st.util.createBuffer();for(var i=0;i>>2;for(var i=0;i>8^o&255^99,yr[r]=o,al[o]=r,c=t[o],n=t[r],s=t[n],a=t[s],f=c<<24^o<<16^o<<8^(o^c),u=(n^s^a)<<24^(r^a)<<16^(r^s^a)<<8^(r^n^a);for(var l=0;l<4;++l)ps[l][r]=f,ri[l][o]=u,f=f<<24|f>>>8,u=u<<24|u>>>8;r===0?r=i=1:(r=n^t[t[t[n^a]]],i^=t[t[i]])}}function Sb(t,e){for(var r=t.slice(0),i,n=1,s=r.length,a=s+6+1,o=aa*a,c=s;c>>16&255]<<24^yr[i>>>8&255]<<16^yr[i&255]<<8^yr[i>>>24]^Ab[n]<<24,n++):s>6&&c%s==4&&(i=yr[i>>>24]<<24^yr[i>>>16&255]<<16^yr[i>>>8&255]<<8^yr[i&255]),r[c]=r[c-s]^i;if(e){var f,u=ri[0],l=ri[1],b=ri[2],p=ri[3],g=r.slice(0);o=r.length;for(var c=0,A=o-aa;c>>24]]^l[yr[f>>>16&255]]^b[yr[f>>>8&255]]^p[yr[f&255]];r=g}return r}function sl(t,e,r,i){var n=t.length/4-1,s,a,o,c,f;i?(s=ri[0],a=ri[1],o=ri[2],c=ri[3],f=al):(s=ps[0],a=ps[1],o=ps[2],c=ps[3],f=yr);var u,l,b,p,g,A,F;u=e[0]^t[0],l=e[i?3:1]^t[1],b=e[2]^t[2],p=e[i?1:3]^t[3];for(var B=3,K=1;K>>24]^a[l>>>16&255]^o[b>>>8&255]^c[p&255]^t[++B],A=s[l>>>24]^a[b>>>16&255]^o[p>>>8&255]^c[u&255]^t[++B],F=s[b>>>24]^a[p>>>16&255]^o[u>>>8&255]^c[l&255]^t[++B],p=s[p>>>24]^a[u>>>16&255]^o[l>>>8&255]^c[b&255]^t[++B],u=g,l=A,b=F;r[0]=f[u>>>24]<<24^f[l>>>16&255]<<16^f[b>>>8&255]<<8^f[p&255]^t[++B],r[i?3:1]=f[l>>>24]<<24^f[b>>>16&255]<<16^f[p>>>8&255]<<8^f[u&255]^t[++B],r[2]=f[b>>>24]<<24^f[p>>>16&255]<<16^f[u>>>8&255]<<8^f[l&255]^t[++B],r[i?1:3]=f[p>>>24]<<24^f[u>>>16&255]<<16^f[l>>>8&255]<<8^f[b&255]^t[++B]}function lf(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,i;t.decrypt?i=st.cipher.createDecipher(r,t.key):i=st.cipher.createCipher(r,t.key);var n=i.start;return i.start=function(s,a){var o=null;a instanceof st.util.ByteBuffer&&(o=a,a={}),a=a||{},a.output=o,a.iv=s,n.call(i,a)},i}});var hf=C((XF,_b)=>{var It=De();tl();il();et();_b.exports=It.des=It.des||{};It.des.startEncrypting=function(t,e,r,i){var n=df({key:t,output:r,decrypt:!1,mode:i||(e===null?"ECB":"CBC")});return n.start(e),n};It.des.createEncryptionCipher=function(t,e){return df({key:t,output:null,decrypt:!1,mode:e})};It.des.startDecrypting=function(t,e,r,i){var n=df({key:t,output:r,decrypt:!0,mode:i||(e===null?"ECB":"CBC")});return n.start(e),n};It.des.createDecryptionCipher=function(t,e){return df({key:t,output:null,decrypt:!0,mode:e})};It.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(i,n){return Cb(r._keys,i,n,!1)},decrypt:function(i,n){return Cb(r._keys,i,n,!0)}}}),r._init=!1};It.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=It.util.createBuffer(t.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=S7(e),this._init=!0}};mi("DES-ECB",It.cipher.modes.ecb);mi("DES-CBC",It.cipher.modes.cbc);mi("DES-CFB",It.cipher.modes.cfb);mi("DES-OFB",It.cipher.modes.ofb);mi("DES-CTR",It.cipher.modes.ctr);mi("3DES-ECB",It.cipher.modes.ecb);mi("3DES-CBC",It.cipher.modes.cbc);mi("3DES-CFB",It.cipher.modes.cfb);mi("3DES-OFB",It.cipher.modes.ofb);mi("3DES-CTR",It.cipher.modes.ctr);function mi(t,e){var r=function(){return new It.des.Algorithm(t,e)};It.cipher.registerAlgorithm(t,r)}var A7=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],_7=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],C7=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],I7=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],T7=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],k7=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],R7=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],B7=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function S7(t){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],u=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],b=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],A=t.length()>8?3:1,F=[],B=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],K=0,V,Q=0;Q>>4^Y)&252645135,Y^=V,$^=V<<4,V=(Y>>>-16^$)&65535,$^=V,Y^=V<<-16,V=($>>>2^Y)&858993459,Y^=V,$^=V<<2,V=(Y>>>-16^$)&65535,$^=V,Y^=V<<-16,V=($>>>1^Y)&1431655765,Y^=V,$^=V<<1,V=(Y>>>8^$)&16711935,$^=V,Y^=V<<8,V=($>>>1^Y)&1431655765,Y^=V,$^=V<<1,V=$<<8|Y>>>20&240,$=Y<<24|Y<<8&16711680|Y>>>8&65280|Y>>>24&240,Y=V;for(var J=0;J>>26,Y=Y<<2|Y>>>26):($=$<<1|$>>>27,Y=Y<<1|Y>>>27),$&=-15,Y&=-15;var se=e[$>>>28]|r[$>>>24&15]|i[$>>>20&15]|n[$>>>16&15]|s[$>>>12&15]|a[$>>>8&15]|o[$>>>4&15],ne=c[Y>>>28]|f[Y>>>24&15]|u[Y>>>20&15]|l[Y>>>16&15]|b[Y>>>12&15]|p[Y>>>8&15]|g[Y>>>4&15];V=(ne>>>16^se)&65535,F[K++]=se^V,F[K++]=ne^V<<16}}return F}function Cb(t,e,r,i){var n=t.length===32?3:9,s;n===3?s=i?[30,-2,-2]:[0,32,2]:s=i?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var a,o=e[0],c=e[1];a=(o>>>4^c)&252645135,c^=a,o^=a<<4,a=(o>>>16^c)&65535,c^=a,o^=a<<16,a=(c>>>2^o)&858993459,o^=a,c^=a<<2,a=(c>>>8^o)&16711935,o^=a,c^=a<<8,a=(o>>>1^c)&1431655765,c^=a,o^=a<<1,o=o<<1|o>>>31,c=c<<1|c>>>31;for(var f=0;f>>4|c<<28)^t[b+1];a=o,o=c,c=a^(_7[p>>>24&63]|I7[p>>>16&63]|k7[p>>>8&63]|B7[p&63]|A7[g>>>24&63]|C7[g>>>16&63]|T7[g>>>8&63]|R7[g&63])}a=o,o=c,c=a}o=o>>>1|o<<31,c=c>>>1|c<<31,a=(o>>>1^c)&1431655765,c^=a,o^=a<<1,a=(c>>>8^o)&16711935,o^=a,c^=a<<8,a=(c>>>2^o)&858993459,o^=a,c^=a<<2,a=(o>>>16^c)&65535,c^=a,o^=a<<16,a=(o>>>4^c)&252645135,c^=a,o^=a<<4,r[0]=o,r[1]=c}function df(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,i;t.decrypt?i=It.cipher.createDecipher(r,t.key):i=It.cipher.createCipher(r,t.key);var n=i.start;return i.start=function(s,a){var o=null;a instanceof It.util.ByteBuffer&&(o=a,a={}),a=a||{},a.output=o,a.iv=s,n.call(i,a)},i}});var Cn=C((ZF,Ib)=>{var pf=De();Ib.exports=pf.md=pf.md||{};pf.md.algorithms=pf.md.algorithms||{}});var kb=C((eK,Tb)=>{var Yi=De();Cn();et();var P7=Tb.exports=Yi.hmac=Yi.hmac||{};P7.create=function(){var t=null,e=null,r=null,i=null,n={};return n.start=function(s,a){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in Yi.md.algorithms)e=Yi.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else e=s;if(a===null)a=t;else{if(typeof a=="string")a=Yi.util.createBuffer(a);else if(Yi.util.isArray(a)){var o=a;a=Yi.util.createBuffer();for(var c=0;ce.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),r=Yi.util.createBuffer(),i=Yi.util.createBuffer(),f=a.length();for(var c=0;c{});var ol=C((iK,Rb)=>{var gr=De();kb();Cn();et();var N7=gr.pkcs5=gr.pkcs5||{},Wi;gr.util.isNodejs&&!gr.options.usePureJavaScript&&(Wi=Lo());Rb.exports=gr.pbkdf2=N7.pbkdf2=function(t,e,r,i,n,s){if(typeof n=="function"&&(s=n,n=null),gr.util.isNodejs&&!gr.options.usePureJavaScript&&Wi.pbkdf2&&(n===null||typeof n!="object")&&(Wi.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),s?Wi.pbkdf2Sync.length===4?Wi.pbkdf2(t,e,r,i,function(V,Q){if(V)return s(V);s(null,Q.toString("binary"))}):Wi.pbkdf2(t,e,r,i,n,function(V,Q){if(V)return s(V);s(null,Q.toString("binary"))}):Wi.pbkdf2Sync.length===4?Wi.pbkdf2Sync(t,e,r,i).toString("binary"):Wi.pbkdf2Sync(t,e,r,i,n).toString("binary");if((typeof n=="undefined"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in gr.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=gr.md[n].create()}var a=n.digestLength;if(i>4294967295*a){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var c=Math.ceil(i/a),f=i-(c-1)*a,u=gr.hmac.create();u.start(n,t);var l="",b,p,g;if(!s){for(var A=1;A<=c;++A){u.start(null,null),u.update(e),u.update(gr.util.int32ToBytes(A)),b=g=u.digest().getBytes();for(var F=2;F<=r;++F)u.start(null,null),u.update(g),p=u.digest().getBytes(),b=gr.util.xorBytes(b,p,a),g=p;l+=Ac)return s(null,l);u.start(null,null),u.update(e),u.update(gr.util.int32ToBytes(A)),b=g=u.digest().getBytes(),F=2,K()}function K(){if(F<=r)return u.start(null,null),u.update(g),p=u.digest().getBytes(),b=gr.util.xorBytes(b,p,a),g=p,++F,gr.util.setImmediate(K);l+=A{var bf=De();et();var Pb=Bb.exports=bf.pem=bf.pem||{};Pb.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r +`,i;if(t.procType&&(i={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=yf(i)),t.contentDomain&&(i={name:"Content-Domain",values:[t.contentDomain]},r+=yf(i)),t.dekInfo&&(i={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&i.values.push(t.dekInfo.parameters),r+=yf(i)),t.headers)for(var n=0;n65&&a!==-1){var o=e[a];o===","?(++a,e=e.substr(0,a)+`\r + `+e.substr(a)):e=e.substr(0,a)+`\r +`+o+e.substr(a+1),s=n-a-1,a=-1,++n}else(e[n]===" "||e[n]===" "||e[n]===",")&&(a=n);return e}function M7(t){return t.replace(/^\s+/,"")}});var qb=C((sK,Nb)=>{var xi=De();Cn();et();var Mb=Nb.exports=xi.sha256=xi.sha256||{};xi.md.sha256=xi.md.algorithms.sha256=Mb;Mb.create=function(){Ob||O7();var t=null,e=xi.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return i.start=function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,s=0;s>>0,a>>>0];for(var o=i.fullMessageLength.length-1;o>=0;--o)i.fullMessageLength[o]+=a[1],a[1]=a[0]+(i.fullMessageLength[o]/4294967296>>>0),i.fullMessageLength[o]=i.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(n),Db(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),i},i.digest=function(){var n=xi.util.createBuffer();n.putBytes(e.bytes());var s=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,a=s&i.blockLength-1;n.putBytes(cl.substr(0,i.blockLength-a));for(var o,c,f=i.fullMessageLength[0]*8,u=0;u>>0,f+=c,n.putInt32(f>>>0),f=o>>>0;n.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};Db(l,r,n);var b=xi.util.createBuffer();return b.putInt32(l.h0),b.putInt32(l.h1),b.putInt32(l.h2),b.putInt32(l.h3),b.putInt32(l.h4),b.putInt32(l.h5),b.putInt32(l.h6),b.putInt32(l.h7),b},i};var cl=null,Ob=!1,Lb=null;function O7(){cl=String.fromCharCode(128),cl+=xi.util.fillString(String.fromCharCode(0),64),Lb=[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],Ob=!0}function Db(t,e,r){for(var i,n,s,a,o,c,f,u,l,b,p,g,A,F,B,K=r.length();K>=64;){for(f=0;f<16;++f)e[f]=r.getInt32();for(;f<64;++f)i=e[f-2],i=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,n=e[f-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,e[f]=i+e[f-7]+n+e[f-16]|0;for(u=t.h0,l=t.h1,b=t.h2,p=t.h3,g=t.h4,A=t.h5,F=t.h6,B=t.h7,f=0;f<64;++f)a=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),o=F^g&(A^F),s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),c=u&l|b&(u^l),i=B+a+o+Lb[f]+e[f],n=s+c,B=F,F=A,A=g,g=p+i>>>0,p=b,b=l,l=u,u=i+n>>>0;t.h0=t.h0+u|0,t.h1=t.h1+l|0,t.h2=t.h2+b|0,t.h3=t.h3+p|0,t.h4=t.h4+g|0,t.h5=t.h5+A|0,t.h6=t.h6+F|0,t.h7=t.h7+B|0,K-=64}}});var Fb=C((aK,Ub)=>{var wi=De();et();var vf=null;wi.util.isNodejs&&!wi.options.usePureJavaScript&&!process.versions["node-webkit"]&&(vf=Lo());var D7=Ub.exports=wi.prng=wi.prng||{};D7.create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,i=new Array(32),n=0;n<32;++n)i[n]=r.create();e.pools=i,e.pool=0,e.generate=function(f,u){if(!u)return e.generateSync(f);var l=e.plugin.cipher,b=e.plugin.increment,p=e.plugin.formatKey,g=e.plugin.formatSeed,A=wi.util.createBuffer();e.key=null,F();function F(B){if(B)return u(B);if(A.length()>=f)return u(null,A.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return wi.util.nextTick(function(){s(F)});var K=l(e.key,e.seed);e.generated+=K.length,A.putBytes(K),e.key=p(l(e.key,b(e.seed))),e.seed=g(l(e.key,e.seed)),wi.util.setImmediate(F)}},e.generateSync=function(f){var u=e.plugin.cipher,l=e.plugin.increment,b=e.plugin.formatKey,p=e.plugin.formatSeed;e.key=null;for(var g=wi.util.createBuffer();g.length()1048575&&(e.key=null),e.key===null&&a();var A=u(e.key,e.seed);e.generated+=A.length,g.putBytes(A),e.key=b(u(e.key,l(e.seed))),e.seed=p(u(e.key,e.seed))}return g.getBytes(f)};function s(f){if(e.pools[0].messageLength>=32)return o(),f();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(l,b){if(l)return f(l);e.collect(b),o(),f()})}function a(){if(e.pools[0].messageLength>=32)return o();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),o()}function o(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var u=1,l=0;l<32;++l)e.reseeds%u==0&&(f.update(e.pools[l].digest().getBytes()),e.pools[l].start()),u=u<<1;e.keyBytes=f.digest().getBytes(),f.start(),f.update(e.keyBytes);var b=f.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(b),e.generated=0}function c(f){var u=null,l=wi.util.globalScope,b=l.crypto||l.msCrypto;b&&b.getRandomValues&&(u=function($){return b.getRandomValues($)});var p=wi.util.createBuffer();if(u)for(;p.length()>16),K+=(B&32767)<<16,K+=B>>15,K=(K&2147483647)+(K>>31),Q=K&4294967295;for(var F=0;F<3;++F)V=Q>>>(F<<3),V^=Math.floor(Math.random()*256),p.putByte(String.fromCharCode(V&255))}return p.getBytes(f)}return vf?(e.seedFile=function(f,u){vf.randomBytes(f,function(l,b){if(l)return u(l);u(null,b.toString())})},e.seedFileSync=function(f){return vf.randomBytes(f).toString()}):(e.seedFile=function(f,u){try{u(null,c(f))}catch(l){u(l)}},e.seedFileSync=c),e.collect=function(f){for(var u=f.length,l=0;l>b&255);e.collect(l)},e.registerWorker=function(f){if(f===self)e.seedFile=function(l,b){function p(g){var A=g.data;A.forge&&A.forge.prng&&(self.removeEventListener("message",p),b(A.forge.prng.err,A.forge.prng.bytes))}self.addEventListener("message",p),self.postMessage({forge:{prng:{needed:l}}})};else{var u=function(l){var b=l.data;b.forge&&b.forge.prng&&e.seedFile(b.forge.prng.needed,function(p,g){f.postMessage({forge:{prng:{err:p,bytes:g}}})})};f.addEventListener("message",u)}},e}});var In=C((oK,fl)=>{var Wt=De();oa();qb();Fb();et();(function(){if(Wt.random&&Wt.random.getBytes){fl.exports=Wt.random;return}(function(t){var e={},r=new Array(4),i=Wt.util.createBuffer();e.formatKey=function(l){var b=Wt.util.createBuffer(l);return l=new Array(4),l[0]=b.getInt32(),l[1]=b.getInt32(),l[2]=b.getInt32(),l[3]=b.getInt32(),Wt.aes._expandKey(l,!1)},e.formatSeed=function(l){var b=Wt.util.createBuffer(l);return l=new Array(4),l[0]=b.getInt32(),l[1]=b.getInt32(),l[2]=b.getInt32(),l[3]=b.getInt32(),l},e.cipher=function(l,b){return Wt.aes._updateBlock(l,b,r,!1),i.putInt32(r[0]),i.putInt32(r[1]),i.putInt32(r[2]),i.putInt32(r[3]),i.getBytes()},e.increment=function(l){return++l[3],l},e.md=Wt.md.sha256;function n(){var l=Wt.prng.create(e);return l.getBytes=function(b,p){return l.generate(b,p)},l.getBytesSync=function(b){return l.generate(b)},l}var s=n(),a=null,o=Wt.util.globalScope,c=o.crypto||o.msCrypto;if(c&&c.getRandomValues&&(a=function(l){return c.getRandomValues(l)}),Wt.options.usePureJavaScript||!Wt.util.isNodejs&&!a){if(typeof window=="undefined"||window.document===void 0,s.collectInt(+new Date,32),typeof navigator!="undefined"){var f="";for(var u in navigator)try{typeof navigator[u]=="string"&&(f+=navigator[u])}catch(l){}s.collect(f),f=null}t&&(t().mousemove(function(l){s.collectInt(l.clientX,16),s.collectInt(l.clientY,16)}),t().keypress(function(l){s.collectInt(l.charCode,8)}))}if(!Wt.random)Wt.random=s;else for(var u in s)Wt.random[u]=s[u];Wt.random.createInstance=n,fl.exports=Wt.random})(typeof jQuery!="undefined"?jQuery:null)})()});var jb=C((cK,Kb)=>{var wr=De();et();var ul=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Vb=[1,2,3,5],L7=function(t,e){return t<>16-e},q7=function(t,e){return(t&65535)>>e|t<<16-e&65535};Kb.exports=wr.rc2=wr.rc2||{};wr.rc2.expandKey=function(t,e){typeof t=="string"&&(t=wr.util.createBuffer(t)),e=e||128;var r=t,i=t.length(),n=e,s=Math.ceil(n/8),a=255>>(n&7),o;for(o=i;o<128;o++)r.putByte(ul[r.at(o-1)+r.at(o-i)&255]);for(r.setAt(128-s,ul[r.at(128-s)&a]),o=127-s;o>=0;o--)r.setAt(o,ul[r.at(o+1)^r.at(o+s)]);return r};var zb=function(t,e,r){var i=!1,n=null,s=null,a=null,o,c,f,u,l=[];for(t=wr.rc2.expandKey(t,e),f=0;f<64;f++)l.push(t.getInt16Le());r?(o=function(g){for(f=0;f<4;f++)g[f]+=l[u]+(g[(f+3)%4]&g[(f+2)%4])+(~g[(f+3)%4]&g[(f+1)%4]),g[f]=L7(g[f],Vb[f]),u++},c=function(g){for(f=0;f<4;f++)g[f]+=l[g[(f+3)%4]&63]}):(o=function(g){for(f=3;f>=0;f--)g[f]=q7(g[f],Vb[f]),g[f]-=l[u]+(g[(f+3)%4]&g[(f+2)%4])+(~g[(f+3)%4]&g[(f+1)%4]),u--},c=function(g){for(f=3;f>=0;f--)g[f]-=l[g[(f+3)%4]&63]});var b=function(g){var A=[];for(f=0;f<4;f++){var F=n.getInt16Le();a!==null&&(r?F^=a.getInt16Le():a.putInt16Le(F)),A.push(F&65535)}u=r?0:63;for(var B=0;B=8;)b([[5,o],[1,c],[6,o],[1,c],[5,o]])},finish:function(g){var A=!0;if(r)if(g)A=g(8,n,!r);else{var F=n.length()===8?8:8-n.length();n.fillWithByte(F,F)}if(A&&(i=!0,p.update()),!r&&(A=n.length()===0,A))if(g)A=g(8,s,!r);else{var B=s.length(),K=s.at(B-1);K>B?A=!1:s.truncate(K)}return A}},p};wr.rc2.startEncrypting=function(t,e,r){var i=wr.rc2.createEncryptionCipher(t,128);return i.start(e,r),i};wr.rc2.createEncryptionCipher=function(t,e){return zb(t,e,!0)};wr.rc2.startDecrypting=function(t,e,r){var i=wr.rc2.createDecryptionCipher(t,128);return i.start(e,r),i};wr.rc2.createDecryptionCipher=function(t,e){return zb(t,e,!1)}});var Uo=C((fK,Hb)=>{var ll=De();Hb.exports=ll.jsbn=ll.jsbn||{};var Qi,U7=244837814094590,Gb=(U7&16777215)==15715070;function ce(t,e,r){this.data=[],t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}ll.jsbn.BigInteger=ce;function He(){return new ce(null)}function F7(t,e,r,i,n,s){for(;--s>=0;){var a=e*this.data[t++]+r.data[i]+n;n=Math.floor(a/67108864),r.data[i++]=a&67108863}return n}function K7(t,e,r,i,n,s){for(var a=e&32767,o=e>>15;--s>=0;){var c=this.data[t]&32767,f=this.data[t++]>>15,u=o*c+f*a;c=a*c+((u&32767)<<15)+r.data[i]+(n&1073741823),n=(c>>>30)+(u>>>15)+o*f+(n>>>30),r.data[i++]=c&1073741823}return n}function $b(t,e,r,i,n,s){for(var a=e&16383,o=e>>14;--s>=0;){var c=this.data[t]&16383,f=this.data[t++]>>14,u=o*c+f*a;c=a*c+((u&16383)<<14)+r.data[i]+n,n=(c>>28)+(u>>14)+o*f,r.data[i++]=c&268435455}return n}typeof navigator=="undefined"?(ce.prototype.am=$b,Qi=28):Gb&&navigator.appName=="Microsoft Internet Explorer"?(ce.prototype.am=K7,Qi=30):Gb&&navigator.appName!="Netscape"?(ce.prototype.am=F7,Qi=26):(ce.prototype.am=$b,Qi=28);ce.prototype.DB=Qi;ce.prototype.DM=(1<=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s}function j7(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function Tn(t){var e=He();return e.fromInt(t),e}function H7(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var i=t.length,n=!1,s=0;--i>=0;){var a=r==8?t[i]&255:Wb(t,i);if(a<0){t.charAt(i)=="-"&&(n=!0);continue}n=!1,s==0?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<>this.DB-s):this.data[this.t-1]|=a<=this.DB&&(s-=this.DB)}r==8&&(t[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t}function $7(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<0)for(o>o)>0&&(n=!0,s=Yb(i));a>=0;)o>(o+=this.DB-e)):(i=this.data[a]>>(o-=e)&r,o<=0&&(o+=this.DB,--a)),i>0&&(n=!0),n&&(s+=Yb(i));return n?s:"0"}function Y7(){var t=He();return ce.ZERO.subTo(this,t),t}function W7(){return this.s<0?this.negate():this}function Q7(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this.data[r]-t.data[r])!=0)return e;return 0}function xf(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function J7(){return this.t<=0?0:this.DB*(this.t-1)+xf(this.data[this.t-1]^this.s&this.DM)}function X7(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s}function Z7(t,e){for(var r=t;r=0;--o)e.data[o+s+1]=this.data[o]>>i|a,a=(this.data[o]&n)<=0;--o)e.data[o]=0;e.data[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}function tC(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var i=t%this.DB,n=this.DB-i,s=(1<>i;for(var a=r+1;a>i;i>0&&(e.data[this.t-r-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e.data[r++]=this.DV+i:i>0&&(e.data[r++]=i),e.t=r,e.clamp()}function iC(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e.data[n]=0;for(n=0;n=0;)t.data[r]=0;for(r=0;r=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()}function sC(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t0?(i.lShiftTo(c,s),n.lShiftTo(c,r)):(i.copyTo(s),n.copyTo(r));var f=s.t,u=s.data[f-1];if(u!=0){var l=u*(1<1?s.data[f-2]>>this.F2:0),b=this.FV/l,p=(1<=0&&(r.data[r.t++]=1,r.subTo(B,r)),ce.ONE.dlShiftTo(f,B),B.subTo(s,s);s.t=0;){var K=r.data[--A]==u?this.DM:Math.floor(r.data[A]*b+(r.data[A-1]+g)*p);if((r.data[A]+=s.am(0,K,r,F,0,f))0&&r.rShiftTo(c,r),a<0&&ce.ZERO.subTo(r,r)}}}function aC(t){var e=He();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(ce.ZERO)>0&&t.subTo(e,e),e}function bs(t){this.m=t}function oC(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function cC(t){return t}function fC(t){t.divRemTo(this.m,null,t)}function uC(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function lC(t,e){t.squareTo(e),this.reduce(e)}bs.prototype.convert=oC;bs.prototype.revert=cC;bs.prototype.reduce=fC;bs.prototype.mulTo=uC;bs.prototype.sqrTo=lC;function dC(){if(this.t<1)return 0;var t=this.data[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function ys(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function pC(t){var e=He();return t.copyTo(e),this.reduce(e),e}function bC(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,i,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function yC(t,e){t.squareTo(e),this.reduce(e)}function gC(t,e,r){t.multiplyTo(e,r),this.reduce(r)}ys.prototype.convert=hC;ys.prototype.revert=pC;ys.prototype.reduce=bC;ys.prototype.mulTo=gC;ys.prototype.sqrTo=yC;function vC(){return(this.t>0?this.data[0]&1:this.s)==0}function mC(t,e){if(t>4294967295||t<1)return ce.ONE;var r=He(),i=He(),n=e.convert(this),s=xf(t)-1;for(n.copyTo(r);--s>=0;)if(e.sqrTo(r,i),(t&1<0)e.mulTo(i,n,r);else{var a=r;r=i,i=a}return e.revert(r)}function xC(t,e){var r;return t<256||e.isEven()?r=new bs(e):r=new ys(e),this.exp(t,r)}ce.prototype.copyTo=z7;ce.prototype.fromInt=j7;ce.prototype.fromString=H7;ce.prototype.clamp=G7;ce.prototype.dlShiftTo=X7;ce.prototype.drShiftTo=Z7;ce.prototype.lShiftTo=eC;ce.prototype.rShiftTo=tC;ce.prototype.subTo=rC;ce.prototype.multiplyTo=iC;ce.prototype.squareTo=nC;ce.prototype.divRemTo=sC;ce.prototype.invDigit=dC;ce.prototype.isEven=vC;ce.prototype.exp=mC;ce.prototype.toString=$7;ce.prototype.negate=Y7;ce.prototype.abs=W7;ce.prototype.compareTo=Q7;ce.prototype.bitLength=J7;ce.prototype.mod=aC;ce.prototype.modPowInt=xC;ce.ZERO=Tn(0);ce.ONE=Tn(1);function wC(){var t=He();return this.copyTo(t),t}function EC(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}function AC(){return this.t==0?this.s:this.data[0]<<16>>16}function _C(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function CC(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function IC(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=Tn(r),n=He(),s=He(),a="";for(this.divRemTo(i,n,s);n.signum()>0;)a=(r+s.intValue()).toString(t).substr(1)+a,n.divRemTo(i,n,s);return s.intValue().toString(t)+a}function TC(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,s=0,a=0,o=0;o=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),n&&ce.ZERO.subTo(this,this)}function kC(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(ce.ONE.shiftLeft(t-1),hl,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(ce.ONE.shiftLeft(t-1),this);else{var i=new Array,n=t&7;i.length=(t>>3)+1,e.nextBytes(i),n>0?i[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<=0;)r<8?(i=(this.data[t]&(1<>(r+=this.DB-8)):(i=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),(i&128)!=0&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e}function BC(t){return this.compareTo(t)==0}function PC(t){return this.compareTo(t)<0?this:t}function NC(t){return this.compareTo(t)>0?this:t}function MC(t,e,r){var i,n,s=Math.min(t.t,this.t);for(i=0;i>=16,e+=16),(t&255)==0&&(t>>=8,e+=8),(t&15)==0&&(t>>=4,e+=4),(t&3)==0&&(t>>=2,e+=2),(t&1)==0&&++e,e}function jC(){for(var t=0;t=this.t?this.s!=0:(this.data[e]&1<>=this.DB;if(t.t>=this.DB;i+=this.s}else{for(i+=this.s;r>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e.data[r++]=i:i<-1&&(e.data[r++]=this.DV+i),e.t=r,e.clamp()}function ZC(t){var e=He();return this.addTo(t,e),e}function eI(t){var e=He();return this.subTo(t,e),e}function tI(t){var e=He();return this.multiplyTo(t,e),e}function rI(t){var e=He();return this.divRemTo(t,e,null),e}function iI(t){var e=He();return this.divRemTo(t,null,e),e}function nI(t){var e=He(),r=He();return this.divRemTo(t,e,r),new Array(e,r)}function sI(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function aI(t,e){if(t!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}function qo(){}function Xb(t){return t}function oI(t,e,r){t.multiplyTo(e,r)}function cI(t,e){t.squareTo(e)}qo.prototype.convert=Xb;qo.prototype.revert=Xb;qo.prototype.mulTo=oI;qo.prototype.sqrTo=cI;function fI(t){return this.exp(t,new qo)}function uI(t,e,r){var i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;var n;for(n=r.t-this.t;i=0;)r.data[i]=0;for(i=Math.max(e-this.t,0);i2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=He();return t.copyTo(e),this.reduce(e),e}function hI(t){return t}function pI(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function bI(t,e){t.squareTo(e),this.reduce(e)}function yI(t,e,r){t.multiplyTo(e,r),this.reduce(r)}fa.prototype.convert=dI;fa.prototype.revert=hI;fa.prototype.reduce=pI;fa.prototype.mulTo=yI;fa.prototype.sqrTo=bI;function gI(t,e){var r=t.bitLength(),i,n=Tn(1),s;if(r<=0)return n;r<18?i=1:r<48?i=3:r<144?i=4:r<768?i=5:i=6,r<8?s=new bs(e):e.isEven()?s=new fa(e):s=new ys(e);var a=new Array,o=3,c=i-1,f=(1<1){var u=He();for(s.sqrTo(a[1],u);o<=f;)a[o]=He(),s.mulTo(u,a[o-2],a[o]),o+=2}var l=t.t-1,b,p=!0,g=He(),A;for(r=xf(t.data[l])-1;l>=0;){for(r>=c?b=t.data[l]>>r-c&f:(b=(t.data[l]&(1<0&&(b|=t.data[l-1]>>this.DB+r-c)),o=i;(b&1)==0;)b>>=1,--o;if((r-=o)<0&&(r+=this.DB,--l),p)a[b].copyTo(n),p=!1;else{for(;o>1;)s.sqrTo(n,g),s.sqrTo(g,n),o-=2;o>0?s.sqrTo(n,g):(A=n,n=g,g=A),s.mulTo(g,a[b],n)}for(;l>=0&&(t.data[l]&1<0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function mI(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this.data[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this.data[i])%t;return r}function xI(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return ce.ZERO;for(var r=t.clone(),i=this.clone(),n=Tn(1),s=Tn(0),a=Tn(0),o=Tn(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!n.isEven()||!s.isEven())&&(n.addTo(this,n),s.subTo(t,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);r.compareTo(i)>=0?(r.subTo(i,r),e&&n.subTo(a,n),s.subTo(o,s)):(i.subTo(r,i),e&&a.subTo(n,a),o.subTo(s,o))}if(i.compareTo(ce.ONE)!=0)return ce.ZERO;if(o.compareTo(t)>=0)return o.subtract(t);if(o.signum()<0)o.addTo(t,o);else return o;return o.signum()<0?o.add(t):o}var ii=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],wI=(1<<26)/ii[ii.length-1];function EI(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=ii[ii.length-1]){for(e=0;e=0);var o=s.modPow(i,this);if(o.compareTo(ce.ONE)!=0&&o.compareTo(e)!=0){for(var c=1;c++{var Ei=De();Cn();et();var ey=Zb.exports=Ei.sha1=Ei.sha1||{};Ei.md.sha1=Ei.md.algorithms.sha1=ey;ey.create=function(){ty||_I();var t=null,e=Ei.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return i.start=function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,s=0;s>>0,a>>>0];for(var o=i.fullMessageLength.length-1;o>=0;--o)i.fullMessageLength[o]+=a[1],a[1]=a[0]+(i.fullMessageLength[o]/4294967296>>>0),i.fullMessageLength[o]=i.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(n),ry(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),i},i.digest=function(){var n=Ei.util.createBuffer();n.putBytes(e.bytes());var s=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize,a=s&i.blockLength-1;n.putBytes(pl.substr(0,i.blockLength-a));for(var o,c,f=i.fullMessageLength[0]*8,u=0;u>>0,f+=c,n.putInt32(f>>>0),f=o>>>0;n.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};ry(l,r,n);var b=Ei.util.createBuffer();return b.putInt32(l.h0),b.putInt32(l.h1),b.putInt32(l.h2),b.putInt32(l.h3),b.putInt32(l.h4),b},i};var pl=null,ty=!1;function _I(){pl=String.fromCharCode(128),pl+=Ei.util.fillString(String.fromCharCode(0),64),ty=!0}function ry(t,e,r){for(var i,n,s,a,o,c,f,u,l=r.length();l>=64;){for(n=t.h0,s=t.h1,a=t.h2,o=t.h3,c=t.h4,u=0;u<16;++u)i=r.getInt32(),e[u]=i,f=o^s&(a^o),i=(n<<5|n>>>27)+f+c+1518500249+i,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<20;++u)i=e[u-3]^e[u-8]^e[u-14]^e[u-16],i=i<<1|i>>>31,e[u]=i,f=o^s&(a^o),i=(n<<5|n>>>27)+f+c+1518500249+i,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<32;++u)i=e[u-3]^e[u-8]^e[u-14]^e[u-16],i=i<<1|i>>>31,e[u]=i,f=s^a^o,i=(n<<5|n>>>27)+f+c+1859775393+i,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<40;++u)i=e[u-6]^e[u-16]^e[u-28]^e[u-32],i=i<<2|i>>>30,e[u]=i,f=s^a^o,i=(n<<5|n>>>27)+f+c+1859775393+i,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<60;++u)i=e[u-6]^e[u-16]^e[u-28]^e[u-32],i=i<<2|i>>>30,e[u]=i,f=s&a|o&(s^a),i=(n<<5|n>>>27)+f+c+2400959708+i,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=n,n=i;for(;u<80;++u)i=e[u-6]^e[u-16]^e[u-28]^e[u-32],i=i<<2|i>>>30,e[u]=i,f=s^a^o,i=(n<<5|n>>>27)+f+c+3395469782+i,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=n,n=i;t.h0=t.h0+n|0,t.h1=t.h1+s|0,t.h2=t.h2+a|0,t.h3=t.h3+o|0,t.h4=t.h4+c|0,l-=64}}});var ay=C((lK,ny)=>{var Si=De();et();In();iy();var sy=ny.exports=Si.pkcs1=Si.pkcs1||{};sy.encode_rsa_oaep=function(t,e,r){var i,n,s,a;typeof r=="string"?(i=r,n=arguments[3]||void 0,s=arguments[4]||void 0):r&&(i=r.label||void 0,n=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md)),s?s.start():s=Si.md.sha1.create(),a||(a=s);var o=Math.ceil(t.n.bitLength()/8),c=o-2*s.digestLength-2;if(e.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=e.length,f.maxLength=c,f}i||(i=""),s.update(i,"raw");for(var u=s.digest(),l="",b=c-e.length,p=0;p>24&255,s>>16&255,s>>8&255,s&255);r.start(),r.update(t+a),i+=r.digest().getBytes()}return i.substring(0,e)}});var oy=C((dK,bl)=>{var kn=De();et();Uo();In();(function(){if(kn.prime){bl.exports=kn.prime;return}var t=bl.exports=kn.prime=kn.prime||{},e=kn.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],i=new e(null);i.fromInt(30);var n=function(l,b){return l|b};t.generateProbablePrime=function(l,b,p){typeof b=="function"&&(p=b,b={}),b=b||{};var g=b.algorithm||"PRIMEINC";typeof g=="string"&&(g={name:g}),g.options=g.options||{};var A=b.prng||kn.random,F={nextBytes:function(B){for(var K=A.getBytesSync(B.length),V=0;Vb&&(l=f(b,p)),l.isProbablePrime(A))return B(null,l);l.dAddOffset(r[g++%8],0)}while(F<0||+new Date-Kl&&(A=f(l,b));var w=A.toString(16);O.target.postMessage({hex:w,workLoad:B}),A.dAddOffset(K,0)}}}}function f(l,b){var p=new e(l,b),g=l-1;return p.testBit(g)||p.bitwiseTo(e.ONE.shiftLeft(g),n,p),p.dAddOffset(31-p.mod(i).byteValue(),0),p}function u(l){return l<=100?27:l<=150?18:l<=200?15:l<=250?12:l<=300?9:l<=350?8:l<=400?7:l<=500?6:l<=600?5:l<=800?4:l<=1250?3:2}})()});var Fo=C((hK,cy)=>{var Re=De();$i();Uo();na();ay();oy();In();et();typeof Ve=="undefined"&&(Ve=Re.jsbn.BigInteger);var Ve,yl=Re.util.isNodejs?Lo():null,Z=Re.asn1,qr=Re.util;Re.pki=Re.pki||{};cy.exports=Re.pki.rsa=Re.rsa=Re.rsa||{};var Be=Re.pki,CI=[6,4,2,4,2,4,6,2],II={name:"PrivateKeyInfo",tagClass:Z.Class.UNIVERSAL,type:Z.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Z.Class.UNIVERSAL,type:Z.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Z.Class.UNIVERSAL,type:Z.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Z.Class.UNIVERSAL,type:Z.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},TI={name:"RSAPrivateKey",tagClass:Z.Class.UNIVERSAL,type:Z.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},kI={name:"RSAPublicKey",tagClass:Z.Class.UNIVERSAL,type:Z.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:Z.Class.UNIVERSAL,type:Z.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},RI=Re.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Z.Class.UNIVERSAL,type:Z.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Z.Class.UNIVERSAL,type:Z.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Z.Class.UNIVERSAL,type:Z.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:Z.Class.UNIVERSAL,type:Z.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:Z.Class.UNIVERSAL,type:Z.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},BI=function(t){var e;if(t.algorithm in Be.oids)e=Be.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var i=Z.oidToDer(e).getBytes(),n=Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[]),s=Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[]);s.value.push(Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,i)),s.value.push(Z.create(Z.Class.UNIVERSAL,Z.Type.NULL,!1,""));var a=Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,t.digest().getBytes());return n.value.push(s),n.value.push(a),Z.toDer(n).getBytes()},fy=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(Ve.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(Ve.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var i;do i=new Ve(Re.util.bytesToHex(Re.random.getBytes(e.n.bitLength()/8)),16);while(i.compareTo(e.n)>=0||!i.gcd(e.n).equals(Ve.ONE));t=t.multiply(i.modPow(e.e,e.n)).mod(e.n);for(var n=t.mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);n.compareTo(s)<0;)n=n.add(e.p);var a=n.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return a=a.multiply(i.modInverse(e.n)).mod(e.n),a};Be.rsa.encrypt=function(t,e,r){var i=r,n,s=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(i=r===2,n=uy(t,e,r)):(n=Re.util.createBuffer(),n.putBytes(t));for(var a=new Ve(n.toHex(),16),o=fy(a,e,i),c=o.toString(16),f=Re.util.createBuffer(),u=s-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(Re.util.hexToBytes(c)),f.getBytes()};Be.rsa.decrypt=function(t,e,r,i){var n=Math.ceil(e.n.bitLength()/8);if(t.length!==n){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=n,s}var a=new Ve(Re.util.createBuffer(t).toHex(),16);if(a.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=fy(a,e,r),c=o.toString(16),f=Re.util.createBuffer(),u=n-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(Re.util.hexToBytes(c)),i!==!1?Ef(f.getBytes(),e,r):f.getBytes()};Be.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var i=r.prng||Re.random,n={nextBytes:function(o){for(var c=i.getBytesSync(o.length),f=0;f>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw new Error("Invalid key generation algorithm: "+s);return a};Be.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new Ve(null);r.fromInt(30);for(var i=0,n=function(l,b){return l|b},s=+new Date,a,o=0;t.keys===null&&(e<=0||oc?t.pqState=0:t.num.isProbablePrime(PI(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(CI[i++%8],0):t.pqState===2?t.pqState=t.num.subtract(Ve.ONE).gcd(t.e).compareTo(Ve.ONE)===0?3:0:t.pqState===3&&(t.pqState=0,t.p===null?t.p=t.num:t.q=t.num,t.p!==null&&t.q!==null&&++t.state,t.num=null)}else if(t.state===1)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(t.state===2)t.p1=t.p.subtract(Ve.ONE),t.q1=t.q.subtract(Ve.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(Ve.ONE)===0?++t.state:(t.p=null,t.q=null,t.state=0);else if(t.state===4)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(t.state===5){var u=t.e.modInverse(t.phi);t.keys={privateKey:Be.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:Be.rsa.setPublicKey(t.n,t.e)}}a=+new Date,o+=a-s,s=a}return t.keys!==null};Be.rsa.generateKeyPair=function(t,e,r,i){if(arguments.length===1?typeof t=="object"?(r=t,t=void 0):typeof t=="function"&&(i=t,t=void 0):arguments.length===2?typeof t=="number"?typeof e=="function"?(i=e,e=void 0):typeof e!="number"&&(r=e,e=void 0):(r=t,i=e,t=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof r=="function"&&(i=r,r=void 0):(i=r,r=e,e=void 0)),r=r||{},t===void 0&&(t=r.bits||2048),e===void 0&&(e=r.e||65537),!Re.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(i){if(ly("generateKeyPair"))return yl.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,c,f){if(o)return i(o);i(null,{privateKey:Be.privateKeyFromPem(f),publicKey:Be.publicKeyFromPem(c)})});if(dy("generateKey")&&dy("exportKey"))return qr.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:py(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return qr.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){i(o)}).then(function(o){if(o){var c=Be.privateKeyFromAsn1(Z.fromDer(Re.util.createBuffer(o)));i(null,{privateKey:c,publicKey:Be.setRsaPublicKey(c.n,c.e)})}});if(hy("generateKey")&&hy("exportKey")){var n=qr.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:py(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(o){var c=o.target.result,f=qr.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);f.oncomplete=function(u){var l=u.target.result,b=Be.privateKeyFromAsn1(Z.fromDer(Re.util.createBuffer(l)));i(null,{privateKey:b,publicKey:Be.setRsaPublicKey(b.n,b.e)})},f.onerror=function(u){i(u)}},n.onerror=function(o){i(o)};return}}else if(ly("generateKeyPairSync")){var s=yl.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Be.privateKeyFromPem(s.privateKey),publicKey:Be.publicKeyFromPem(s.publicKey)}}}var a=Be.rsa.createKeyPairGenerationState(t,e,r);if(!i)return Be.rsa.stepKeyPairGenerationState(a,0),a.keys;NI(a,r,i)};Be.setRsaPublicKey=Be.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(i,n,s){if(typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSAES-PKCS1-V1_5"),n==="RSAES-PKCS1-V1_5")n={encode:function(o,c,f){return uy(o,c,2).getBytes()}};else if(n==="RSA-OAEP"||n==="RSAES-OAEP")n={encode:function(o,c){return Re.pkcs1.encode_rsa_oaep(c,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(n)!==-1)n={encode:function(o){return o}};else if(typeof n=="string")throw new Error('Unsupported encryption scheme: "'+n+'".');var a=n.encode(i,r,!0);return Be.rsa.encrypt(a,r,!0)},r.verify=function(i,n,s){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),s==="RSASSA-PKCS1-V1_5"?s={verify:function(o,c){c=Ef(c,r,!0);var f=Z.fromDer(c);return o===f.value[1].value}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(o,c){return c=Ef(c,r,!0),o===c}});var a=Be.rsa.decrypt(n,r,!0,!1);return s.verify(i,a,r.n.bitLength())},r};Be.setRsaPrivateKey=Be.rsa.setPrivateKey=function(t,e,r,i,n,s,a,o){var c={n:t,e,d:r,p:i,q:n,dP:s,dQ:a,qInv:o};return c.decrypt=function(f,u,l){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var b=Be.rsa.decrypt(f,c,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:Ef};else if(u==="RSA-OAEP"||u==="RSAES-OAEP")u={decode:function(p,g){return Re.pkcs1.decode_rsa_oaep(g,p,l)}};else if(["RAW","NONE","NULL",null].indexOf(u)!==-1)u={decode:function(p){return p}};else throw new Error('Unsupported encryption scheme: "'+u+'".');return u.decode(b,c,!1)},c.sign=function(f,u){var l=!1;typeof u=="string"&&(u=u.toUpperCase()),u===void 0||u==="RSASSA-PKCS1-V1_5"?(u={encode:BI},l=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return f}},l=1);var b=u.encode(f,c.n.bitLength());return Be.rsa.encrypt(b,c,l)},c};Be.wrapRsaPrivateKey=function(t){return Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Z.integerToDer(0).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(Be.oids.rsaEncryption).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.NULL,!1,"")]),Z.create(Z.Class.UNIVERSAL,Z.Type.OCTETSTRING,!1,Z.toDer(t).getBytes())])};Be.privateKeyFromAsn1=function(t){var e={},r=[];if(Z.validate(t,II,e,r)&&(t=Z.fromDer(Re.util.createBuffer(e.privateKey))),e={},r=[],!Z.validate(t,TI,e,r)){var i=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw i.errors=r,i}var n,s,a,o,c,f,u,l;return n=Re.util.createBuffer(e.privateKeyModulus).toHex(),s=Re.util.createBuffer(e.privateKeyPublicExponent).toHex(),a=Re.util.createBuffer(e.privateKeyPrivateExponent).toHex(),o=Re.util.createBuffer(e.privateKeyPrime1).toHex(),c=Re.util.createBuffer(e.privateKeyPrime2).toHex(),f=Re.util.createBuffer(e.privateKeyExponent1).toHex(),u=Re.util.createBuffer(e.privateKeyExponent2).toHex(),l=Re.util.createBuffer(e.privateKeyCoefficient).toHex(),Be.setRsaPrivateKey(new Ve(n,16),new Ve(s,16),new Ve(a,16),new Ve(o,16),new Ve(c,16),new Ve(f,16),new Ve(u,16),new Ve(l,16))};Be.privateKeyToAsn1=Be.privateKeyToRSAPrivateKey=function(t){return Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Z.integerToDer(0).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.n)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.e)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.d)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.p)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.q)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.dP)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.dQ)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.qInv))])};Be.publicKeyFromAsn1=function(t){var e={},r=[];if(Z.validate(t,RI,e,r)){var i=Z.derToOid(e.publicKeyOid);if(i!==Be.oids.rsaEncryption){var n=new Error("Cannot read public key. Unknown OID.");throw n.oid=i,n}t=e.rsaPublicKey}if(r=[],!Z.validate(t,kI,e,r)){var n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw n.errors=r,n}var s=Re.util.createBuffer(e.publicKeyModulus).toHex(),a=Re.util.createBuffer(e.publicKeyExponent).toHex();return Be.setRsaPublicKey(new Ve(s,16),new Ve(a,16))};Be.publicKeyToAsn1=Be.publicKeyToSubjectPublicKeyInfo=function(t){return Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.OID,!1,Z.oidToDer(Be.oids.rsaEncryption).getBytes()),Z.create(Z.Class.UNIVERSAL,Z.Type.NULL,!1,"")]),Z.create(Z.Class.UNIVERSAL,Z.Type.BITSTRING,!1,[Be.publicKeyToRSAPublicKey(t)])])};Be.publicKeyToRSAPublicKey=function(t){return Z.create(Z.Class.UNIVERSAL,Z.Type.SEQUENCE,!0,[Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.n)),Z.create(Z.Class.UNIVERSAL,Z.Type.INTEGER,!1,Ai(t.e))])};function uy(t,e,r){var i=Re.util.createBuffer(),n=Math.ceil(e.n.bitLength()/8);if(t.length>n-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=t.length,s.max=n-11,s}i.putByte(0),i.putByte(r);var a=n-3-t.length,o;if(r===0||r===1){o=r===0?0:255;for(var c=0;c0;){for(var f=0,u=Re.random.getBytes(a),c=0;c1;){if(s.getByte()!==255){--s.read;break}++c}else if(o===2)for(c=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++c}var u=s.getByte();if(u!==0||c!==n-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function NI(t,e,r){typeof e=="function"&&(r=e,e={}),e=e||{};var i={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(i.prng=e.prng),n();function n(){s(t.pBits,function(o,c){if(o)return r(o);if(t.p=c,t.q!==null)return a(o,t.q);s(t.qBits,a)})}function s(o,c){Re.prime.generateProbablePrime(o,i,c)}function a(o,c){if(o)return r(o);if(t.q=c,t.p.compareTo(t.q)<0){var f=t.p;t.p=t.q,t.q=f}if(t.p.subtract(Ve.ONE).gcd(t.e).compareTo(Ve.ONE)!==0){t.p=null,n();return}if(t.q.subtract(Ve.ONE).gcd(t.e).compareTo(Ve.ONE)!==0){t.q=null,s(t.qBits,a);return}if(t.p1=t.p.subtract(Ve.ONE),t.q1=t.q.subtract(Ve.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(Ve.ONE)!==0){t.p=t.q=null,n();return}if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits){t.q=null,s(t.qBits,a);return}var u=t.e.modInverse(t.phi);t.keys={privateKey:Be.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:Be.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function Ai(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=Re.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&(r.charCodeAt(1)&128)==0||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)==128)?r.substr(1):r}function PI(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function ly(t){return Re.util.isNodejs&&typeof yl[t]=="function"}function dy(t){return typeof qr.globalScope!="undefined"&&typeof qr.globalScope.crypto=="object"&&typeof qr.globalScope.crypto.subtle=="object"&&typeof qr.globalScope.crypto.subtle[t]=="function"}function hy(t){return typeof qr.globalScope!="undefined"&&typeof qr.globalScope.msCrypto=="object"&&typeof qr.globalScope.msCrypto.subtle=="object"&&typeof qr.globalScope.msCrypto.subtle[t]=="function"}function py(t){for(var e=Re.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),i=0;i{var me=De();oa();$i();hf();Cn();na();ol();gf();In();jb();Fo();et();typeof yy=="undefined"&&(yy=me.jsbn.BigInteger);var yy,re=me.asn1,Oe=me.pki=me.pki||{};by.exports=Oe.pbe=me.pbe=me.pbe||{};var gs=Oe.oids,MI={name:"EncryptedPrivateKeyInfo",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:re.Class.UNIVERSAL,type:re.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:re.Class.UNIVERSAL,type:re.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},OI={name:"PBES2Algorithms",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:re.Class.UNIVERSAL,type:re.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:re.Class.UNIVERSAL,type:re.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:re.Class.UNIVERSAL,type:re.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:re.Class.UNIVERSAL,type:re.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:re.Class.UNIVERSAL,type:re.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:re.Class.UNIVERSAL,type:re.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:re.Class.UNIVERSAL,type:re.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},DI={name:"pkcs-12PbeParams",tagClass:re.Class.UNIVERSAL,type:re.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:re.Class.UNIVERSAL,type:re.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:re.Class.UNIVERSAL,type:re.Type.INTEGER,constructed:!1,capture:"iterations"}]};Oe.encryptPrivateKeyInfo=function(t,e,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i=me.random.getBytesSync(r.saltSize),n=r.count,s=re.integerToDer(n),a,o,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var f,u,l;switch(r.algorithm){case"aes128":a=16,f=16,u=gs["aes128-CBC"],l=me.aes.createEncryptionCipher;break;case"aes192":a=24,f=16,u=gs["aes192-CBC"],l=me.aes.createEncryptionCipher;break;case"aes256":a=32,f=16,u=gs["aes256-CBC"],l=me.aes.createEncryptionCipher;break;case"des":a=8,f=8,u=gs.desCBC,l=me.des.createEncryptionCipher;break;default:var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}var p="hmacWith"+r.prfAlgorithm.toUpperCase(),g=gy(p),A=me.pkcs5.pbkdf2(e,i,n,a,g),F=me.random.getBytesSync(f),B=l(A);B.start(F),B.update(re.toDer(t)),B.finish(),c=B.output.getBytes();var K=LI(i,s,a,p);o=re.create(re.Class.UNIVERSAL,re.Type.SEQUENCE,!0,[re.create(re.Class.UNIVERSAL,re.Type.OID,!1,re.oidToDer(gs.pkcs5PBES2).getBytes()),re.create(re.Class.UNIVERSAL,re.Type.SEQUENCE,!0,[re.create(re.Class.UNIVERSAL,re.Type.SEQUENCE,!0,[re.create(re.Class.UNIVERSAL,re.Type.OID,!1,re.oidToDer(gs.pkcs5PBKDF2).getBytes()),K]),re.create(re.Class.UNIVERSAL,re.Type.SEQUENCE,!0,[re.create(re.Class.UNIVERSAL,re.Type.OID,!1,re.oidToDer(u).getBytes()),re.create(re.Class.UNIVERSAL,re.Type.OCTETSTRING,!1,F)])])])}else if(r.algorithm==="3des"){a=24;var V=new me.util.ByteBuffer(i),A=Oe.pbe.generatePkcs12Key(e,V,1,n,a),F=Oe.pbe.generatePkcs12Key(e,V,2,n,a),B=me.des.createEncryptionCipher(A);B.start(F),B.update(re.toDer(t)),B.finish(),c=B.output.getBytes(),o=re.create(re.Class.UNIVERSAL,re.Type.SEQUENCE,!0,[re.create(re.Class.UNIVERSAL,re.Type.OID,!1,re.oidToDer(gs["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),re.create(re.Class.UNIVERSAL,re.Type.SEQUENCE,!0,[re.create(re.Class.UNIVERSAL,re.Type.OCTETSTRING,!1,i),re.create(re.Class.UNIVERSAL,re.Type.INTEGER,!1,s.getBytes())])])}else{var b=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw b.algorithm=r.algorithm,b}var Q=re.create(re.Class.UNIVERSAL,re.Type.SEQUENCE,!0,[o,re.create(re.Class.UNIVERSAL,re.Type.OCTETSTRING,!1,c)]);return Q};Oe.decryptPrivateKeyInfo=function(t,e){var r=null,i={},n=[];if(!re.validate(t,MI,i,n)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var a=re.derToOid(i.encryptionOid),o=Oe.pbe.getCipher(a,i.encryptionParams,e),c=me.util.createBuffer(i.encryptedData);return o.update(c),o.finish()&&(r=re.fromDer(o.output)),r};Oe.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:re.toDer(t).getBytes()};return me.pem.encode(r,{maxline:e})};Oe.encryptedPrivateKeyFromPem=function(t){var e=me.pem.decode(t)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return re.fromDer(e.body)};Oe.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var i=Oe.wrapRsaPrivateKey(Oe.privateKeyToAsn1(t));return i=Oe.encryptPrivateKeyInfo(i,e,r),Oe.encryptedPrivateKeyToPem(i)}var n,s,a,o;switch(r.algorithm){case"aes128":n="AES-128-CBC",a=16,s=me.random.getBytesSync(16),o=me.aes.createEncryptionCipher;break;case"aes192":n="AES-192-CBC",a=24,s=me.random.getBytesSync(16),o=me.aes.createEncryptionCipher;break;case"aes256":n="AES-256-CBC",a=32,s=me.random.getBytesSync(16),o=me.aes.createEncryptionCipher;break;case"3des":n="DES-EDE3-CBC",a=24,s=me.random.getBytesSync(8),o=me.des.createEncryptionCipher;break;case"des":n="DES-CBC",a=8,s=me.random.getBytesSync(8),o=me.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var f=me.pbe.opensslDeriveBytes(e,s.substr(0,8),a),u=o(f);u.start(s),u.update(re.toDer(Oe.privateKeyToAsn1(t))),u.finish();var l={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:n,parameters:me.util.bytesToHex(s).toUpperCase()},body:u.output.getBytes()};return me.pem.encode(l)};Oe.decryptRsaPrivateKey=function(t,e){var r=null,i=me.pem.decode(t)[0];if(i.type!=="ENCRYPTED PRIVATE KEY"&&i.type!=="PRIVATE KEY"&&i.type!=="RSA PRIVATE KEY"){var n=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw n.headerType=n,n}if(i.procType&&i.procType.type==="ENCRYPTED"){var s,a;switch(i.dekInfo.algorithm){case"DES-CBC":s=8,a=me.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,a=me.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,a=me.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,a=me.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,a=me.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,a=function(l){return me.rc2.createDecryptionCipher(l,40)};break;case"RC2-64-CBC":s=8,a=function(l){return me.rc2.createDecryptionCipher(l,64)};break;case"RC2-128-CBC":s=16,a=function(l){return me.rc2.createDecryptionCipher(l,128)};break;default:var n=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".');throw n.algorithm=i.dekInfo.algorithm,n}var o=me.util.hexToBytes(i.dekInfo.parameters),c=me.pbe.opensslDeriveBytes(e,o.substr(0,8),s),f=a(c);if(f.start(o),f.update(me.util.createBuffer(i.body)),f.finish())r=f.output.getBytes();else return r}else r=i.body;return i.type==="ENCRYPTED PRIVATE KEY"?r=Oe.decryptPrivateKeyInfo(re.fromDer(r),e):r=re.fromDer(r),r!==null&&(r=Oe.privateKeyFromAsn1(r)),r};Oe.pbe.generatePkcs12Key=function(t,e,r,i,n,s){var a,o;if(typeof s=="undefined"||s===null){if(!("sha1"in me.md))throw new Error('"sha1" hash algorithm unavailable.');s=me.md.sha1.create()}var c=s.digestLength,f=s.blockLength,u=new me.util.ByteBuffer,l=new me.util.ByteBuffer;if(t!=null){for(o=0;o=0;o--)y=y>>8,y+=se.at(o)+d.at(o),d.setAt(o,y&255);O.putBuffer(d)}V=O,u.putBuffer(Y)}return u.truncate(u.length()-n),u};Oe.pbe.getCipher=function(t,e,r){switch(t){case Oe.oids.pkcs5PBES2:return Oe.pbe.getCipherForPBES2(t,e,r);case Oe.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Oe.oids["pbewithSHAAnd40BitRC2-CBC"]:return Oe.pbe.getCipherForPKCS12PBE(t,e,r);default:var i=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw i.oid=t,i.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],i}};Oe.pbe.getCipherForPBES2=function(t,e,r){var i={},n=[];if(!re.validate(e,OI,i,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}if(t=re.derToOid(i.kdfOid),t!==Oe.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=t,s.supportedOids=["pkcs5PBKDF2"],s}if(t=re.derToOid(i.encOid),t!==Oe.oids["aes128-CBC"]&&t!==Oe.oids["aes192-CBC"]&&t!==Oe.oids["aes256-CBC"]&&t!==Oe.oids["des-EDE3-CBC"]&&t!==Oe.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=t,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var a=i.kdfSalt,o=me.util.createBuffer(i.kdfIterationCount);o=o.getInt(o.length()<<3);var c,f;switch(Oe.oids[t]){case"aes128-CBC":c=16,f=me.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=me.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=me.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=me.des.createDecryptionCipher;break;case"desCBC":c=8,f=me.des.createDecryptionCipher;break}var u=vy(i.prfOid),l=me.pkcs5.pbkdf2(r,a,o,c,u),b=i.encIv,p=f(l);return p.start(b),p};Oe.pbe.getCipherForPKCS12PBE=function(t,e,r){var i={},n=[];if(!re.validate(e,DI,i,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var a=me.util.createBuffer(i.salt),o=me.util.createBuffer(i.iterations);o=o.getInt(o.length()<<3);var c,f,u;switch(t){case Oe.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,f=8,u=me.des.startDecrypting;break;case Oe.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,f=8,u=function(A,F){var B=me.rc2.createDecryptionCipher(A,40);return B.start(F,null),B};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=t,s}var l=vy(i.prfOid),b=Oe.pbe.generatePkcs12Key(r,a,1,o,c,l);l.start();var p=Oe.pbe.generatePkcs12Key(r,a,2,o,f,l);return u(b,p)};Oe.pbe.opensslDeriveBytes=function(t,e,r,i){if(typeof i=="undefined"||i===null){if(!("md5"in me.md))throw new Error('"md5" hash algorithm unavailable.');i=me.md.md5.create()}e===null&&(e="");for(var n=[my(i,t+e)],s=16,a=1;s{"use strict";xy.get=(t=self)=>{let e=t.crypto||t.msCrypto;if(!e||!e.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}});var vl=C((yK,wy)=>{"use strict";var qI=Zr(),Ey=qt(),UI=Ko();function FI({algorithm:t="AES-GCM",nonceLength:e=12,keyLength:r=16,digest:i="SHA-256",saltLength:n=16,iterations:s=32767}={}){let a=UI.get();r*=8;async function o(f,u){let l=a.getRandomValues(new Uint8Array(n)),b=a.getRandomValues(new Uint8Array(e)),p={name:t,iv:b},g={name:"PBKDF2",salt:l,iterations:s,hash:{name:i}},A=await a.subtle.importKey("raw",Ey(u),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),F=await a.subtle.deriveKey(g,A,{name:t,length:r},!0,["encrypt"]),B=await a.subtle.encrypt(p,F,f);return qI([l,p.iv,new Uint8Array(B)])}async function c(f,u){let l=f.slice(0,n),b=f.slice(n,n+e),p=f.slice(n+e),g={name:t,iv:b},A={name:"PBKDF2",salt:l,iterations:s,hash:{name:i}},F=await a.subtle.importKey("raw",Ey(u),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),B=await a.subtle.deriveKey(A,F,{name:t,length:r},!0,["decrypt"]),K=await a.subtle.decrypt(g,B,p);return new Uint8Array(K)}return{encrypt:o,decrypt:c}}wy.exports={create:FI}});var Ay=C((gK,Sy)=>{"use strict";var KI=xn(),VI=vl();Sy.exports={import:async function(t,e){let i=KI.names.base64.decode(t);return await VI.create().decrypt(i,e)}}});var la=C((vK,_y)=>{"use strict";var zI=fs(),ua=self.crypto||self.msCrypto,ml=async(t,e)=>{if(typeof self=="undefined"||!ua)throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");switch(e){case"sha1":return new Uint8Array(await ua.subtle.digest({name:"SHA-1"},t));case"sha2-256":return new Uint8Array(await ua.subtle.digest({name:"SHA-256"},t));case"sha2-512":return new Uint8Array(await ua.subtle.digest({name:"SHA-512"},t));case"dbl-sha2-256":{let r=await ua.subtle.digest({name:"SHA-256"},t);return new Uint8Array(await ua.subtle.digest({name:"SHA-256"},r))}default:throw new Error(`${e} is not a supported algorithm`)}};_y.exports={factory:t=>async e=>ml(e,t),digest:ml,multihashing:async(t,e,r)=>{let i=await ml(t,e);return zI.encode(i,e,r)}}});var Sf=C((mK,Cy)=>{var _t=De();Cn();et();var Vo=Cy.exports=_t.sha512=_t.sha512||{};_t.md.sha512=_t.md.algorithms.sha512=Vo;var Iy=_t.sha384=_t.sha512.sha384=_t.sha512.sha384||{};Iy.create=function(){return Vo.create("SHA-384")};_t.md.sha384=_t.md.algorithms.sha384=Iy;_t.sha512.sha256=_t.sha512.sha256||{create:function(){return Vo.create("SHA-512/256")}};_t.md["sha512/256"]=_t.md.algorithms["sha512/256"]=_t.sha512.sha256;_t.sha512.sha224=_t.sha512.sha224||{create:function(){return Vo.create("SHA-512/224")}};_t.md["sha512/224"]=_t.md.algorithms["sha512/224"]=_t.sha512.sha224;Vo.create=function(t){if(Ty||jI(),typeof t=="undefined"&&(t="SHA-512"),!(t in vs))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=vs[t],r=null,i=_t.util.createBuffer(),n=new Array(80),s=0;s<80;++s)n[s]=new Array(2);var a=64;switch(t){case"SHA-384":a=48;break;case"SHA-512/256":a=32;break;case"SHA-512/224":a=28;break}var o={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:a,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var c=o.messageLengthSize/4,f=0;f>>0,u>>>0];for(var l=o.fullMessageLength.length-1;l>=0;--l)o.fullMessageLength[l]+=u[1],u[1]=u[0]+(o.fullMessageLength[l]/4294967296>>>0),o.fullMessageLength[l]=o.fullMessageLength[l]>>>0,u[0]=u[1]/4294967296>>>0;return i.putBytes(c),ky(r,n,i),(i.read>2048||i.length()===0)&&i.compact(),o},o.digest=function(){var c=_t.util.createBuffer();c.putBytes(i.bytes());var f=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,u=f&o.blockLength-1;c.putBytes(xl.substr(0,o.blockLength-u));for(var l,b,p=o.fullMessageLength[0]*8,g=0;g>>0,p+=b,c.putInt32(p>>>0),p=l>>>0;c.putInt32(p);for(var A=new Array(r.length),g=0;g=128;){for(R=0;R<16;++R)e[R][0]=r.getInt32()>>>0,e[R][1]=r.getInt32()>>>0;for(;R<80;++R)P=e[R-2],L=P[0],D=P[1],i=((L>>>19|D<<13)^(D>>>29|L<<3)^L>>>6)>>>0,n=((L<<13|D>>>19)^(D<<3|L>>>29)^(L<<26|D>>>6))>>>0,M=e[R-15],L=M[0],D=M[1],s=((L>>>1|D<<31)^(L>>>8|D<<24)^L>>>7)>>>0,a=((L<<31|D>>>1)^(L<<24|D>>>8)^(L<<25|D>>>7))>>>0,h=e[R-7],fe=e[R-16],D=n+h[1]+a+fe[1],e[R][0]=i+h[0]+s+fe[0]+(D/4294967296>>>0)>>>0,e[R][1]=D>>>0;for(A=t[0][0],F=t[0][1],B=t[1][0],K=t[1][1],V=t[2][0],Q=t[2][1],$=t[3][0],Y=t[3][1],J=t[4][0],se=t[4][1],ne=t[5][0],O=t[5][1],d=t[6][0],y=t[6][1],w=t[7][0],I=t[7][1],R=0;R<80;++R)f=((J>>>14|se<<18)^(J>>>18|se<<14)^(se>>>9|J<<23))>>>0,u=((J<<18|se>>>14)^(J<<14|se>>>18)^(se<<23|J>>>9))>>>0,l=(d^J&(ne^d))>>>0,b=(y^se&(O^y))>>>0,o=((A>>>28|F<<4)^(F>>>2|A<<30)^(F>>>7|A<<25))>>>0,c=((A<<4|F>>>28)^(F<<30|A>>>2)^(F<<25|A>>>7))>>>0,p=(A&B|V&(A^B))>>>0,g=(F&K|Q&(F^K))>>>0,D=I+u+b+wl[R][1]+e[R][1],i=w+f+l+wl[R][0]+e[R][0]+(D/4294967296>>>0)>>>0,n=D>>>0,D=c+g,s=o+p+(D/4294967296>>>0)>>>0,a=D>>>0,w=d,I=y,d=ne,y=O,ne=J,O=se,D=Y+n,J=$+i+(D/4294967296>>>0)>>>0,se=D>>>0,$=V,Y=Q,V=B,Q=K,B=A,K=F,D=n+a,A=i+s+(D/4294967296>>>0)>>>0,F=D>>>0;D=t[0][1]+F,t[0][0]=t[0][0]+A+(D/4294967296>>>0)>>>0,t[0][1]=D>>>0,D=t[1][1]+K,t[1][0]=t[1][0]+B+(D/4294967296>>>0)>>>0,t[1][1]=D>>>0,D=t[2][1]+Q,t[2][0]=t[2][0]+V+(D/4294967296>>>0)>>>0,t[2][1]=D>>>0,D=t[3][1]+Y,t[3][0]=t[3][0]+$+(D/4294967296>>>0)>>>0,t[3][1]=D>>>0,D=t[4][1]+se,t[4][0]=t[4][0]+J+(D/4294967296>>>0)>>>0,t[4][1]=D>>>0,D=t[5][1]+O,t[5][0]=t[5][0]+ne+(D/4294967296>>>0)>>>0,t[5][1]=D>>>0,D=t[6][1]+y,t[6][0]=t[6][0]+d+(D/4294967296>>>0)>>>0,t[6][1]=D>>>0,D=t[7][1]+I,t[7][0]=t[7][0]+w+(D/4294967296>>>0)>>>0,t[7][1]=D>>>0,W-=128}}});var Ry=C(El=>{var HI=De();$i();var Qt=HI.asn1;El.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};El.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Qt.Class.UNIVERSAL,type:Qt.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var Bl=C((wK,By)=>{var sr=De();Uo();In();Sf();et();var Py=Ry(),GI=Py.publicKeyValidator,$I=Py.privateKeyValidator;typeof Ny=="undefined"&&(Ny=sr.jsbn.BigInteger);var Ny,Sl=sr.util.ByteBuffer,Er=typeof Buffer=="undefined"?Uint8Array:Buffer;sr.pki=sr.pki||{};By.exports=sr.pki.ed25519=sr.ed25519=sr.ed25519||{};var Fe=sr.ed25519;Fe.constants={};Fe.constants.PUBLIC_KEY_BYTE_LENGTH=32;Fe.constants.PRIVATE_KEY_BYTE_LENGTH=64;Fe.constants.SEED_BYTE_LENGTH=32;Fe.constants.SIGN_BYTE_LENGTH=64;Fe.constants.HASH_BYTE_LENGTH=64;Fe.generateKeyPair=function(t){t=t||{};var e=t.seed;if(e===void 0)e=sr.random.getBytesSync(Fe.constants.SEED_BYTE_LENGTH);else if(typeof e=="string"){if(e.length!==Fe.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+Fe.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');e=Ji({message:e,encoding:"binary"});for(var r=new Er(Fe.constants.PUBLIC_KEY_BYTE_LENGTH),i=new Er(Fe.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)i[n]=e[n];return YI(r,i),{publicKey:r,privateKey:i}};Fe.privateKeyFromAsn1=function(t){var e={},r=[],i=sr.asn1.validate(t,$I,e,r);if(!i){var n=new Error("Invalid Key.");throw n.errors=r,n}var s=sr.asn1.derToOid(e.privateKeyOid),a=sr.oids.EdDSA25519;if(s!==a)throw new Error('Invalid OID "'+s+'"; OID must be "'+a+'".');var o=e.privateKey,c=Ji({message:sr.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:c}};Fe.publicKeyFromAsn1=function(t){var e={},r=[],i=sr.asn1.validate(t,GI,e,r);if(!i){var n=new Error("Invalid Key.");throw n.errors=r,n}var s=sr.asn1.derToOid(e.publicKeyOid),a=sr.oids.EdDSA25519;if(s!==a)throw new Error('Invalid OID "'+s+'"; OID must be "'+a+'".');var o=e.ed25519PublicKey;if(o.length!==Fe.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return Ji({message:o,encoding:"binary"})};Fe.publicKeyFromPrivateKey=function(t){t=t||{};var e=Ji({message:t.privateKey,encoding:"binary"});if(e.length!==Fe.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Fe.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new Er(Fe.constants.PUBLIC_KEY_BYTE_LENGTH),i=0;i=0};function Ji(t){var e=t.message;if(e instanceof Uint8Array||e instanceof Er)return e;var r=t.encoding;if(e===void 0)if(t.md)e=t.md.digest().getBytes(),r="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof e=="string"&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof e=="string"){if(typeof Buffer!="undefined")return Buffer.from(e,r);e=new Sl(e,r)}else if(!(e instanceof Sl))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var i=new Er(e.length()),n=0;n=32;--i){for(r=0,n=i-32,s=i-12;n>8,e[n]-=r*256;e[n]+=r,e[i]=0}for(r=0,n=0;n<32;++n)e[n]+=r-(e[31]>>4)*_l[n],r=e[n]>>8,e[n]&=255;for(n=0;n<32;++n)e[n]-=r*_l[n];for(i=0;i<32;++i)e[i+1]+=e[i]>>8,t[i]=e[i]&255}function Tl(t){for(var e=new Float64Array(64),r=0;r<64;++r)e[r]=t[r],t[r]=0;Dy(t,e)}function kl(t,e){var r=Ce(),i=Ce(),n=Ce(),s=Ce(),a=Ce(),o=Ce(),c=Ce(),f=Ce(),u=Ce();ha(r,t[1],t[0]),ha(u,e[1],e[0]),tt(r,r,u),da(i,t[0],t[1]),da(u,e[0],e[1]),tt(i,i,u),tt(n,t[3],e[3]),tt(n,n,XI),tt(s,t[2],e[2]),da(s,s,s),ha(a,i,r),ha(o,s,n),da(c,s,n),da(f,i,r),tt(t[0],a,o),tt(t[1],f,c),tt(t[2],c,o),tt(t[3],a,f)}function Fy(t,e,r){for(var i=0;i<4;++i)Uy(t[i],e[i],r)}function Cl(t,e){var r=Ce(),i=Ce(),n=Ce();tT(n,e[2]),tt(r,e[0],n),tt(i,e[1],n),_f(t,i),t[31]^=Ky(r)<<7}function _f(t,e){var r,i,n,s=Ce(),a=Ce();for(r=0;r<16;++r)a[r]=e[r];for(Rl(a),Rl(a),Rl(a),i=0;i<2;++i){for(s[0]=a[0]-65517,r=1;r<15;++r)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,Uy(a,s,1-n)}for(r=0;r<16;r++)t[2*r]=a[r]&255,t[2*r+1]=a[r]>>8}function eT(t,e){var r=Ce(),i=Ce(),n=Ce(),s=Ce(),a=Ce(),o=Ce(),c=Ce();return Rn(t[2],Af),rT(t[1],e),ms(n,t[1]),tt(s,n,JI),ha(n,n,t[2]),da(s,t[2],s),ms(a,s),ms(o,a),tt(c,o,a),tt(r,c,n),tt(r,r,s),iT(r,r),tt(r,r,n),tt(r,r,s),tt(r,r,s),tt(t[0],r,s),ms(i,t[0]),tt(i,i,s),Vy(i,n)&&tt(t[0],t[0],ZI),ms(i,t[0]),tt(i,i,s),Vy(i,n)?-1:(Ky(t[0])===e[31]>>7&&ha(t[0],Al,t[0]),tt(t[3],t[0],t[1]),0)}function rT(t,e){var r;for(r=0;r<16;++r)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function iT(t,e){var r=Ce(),i;for(i=0;i<16;++i)r[i]=e[i];for(i=250;i>=0;--i)ms(r,r),i!==1&&tt(r,r,e);for(i=0;i<16;++i)t[i]=r[i]}function Vy(t,e){var r=new Er(32),i=new Er(32);return _f(r,t),_f(i,e),Ly(r,0,i,0)}function Ly(t,e,r,i){return nT(t,e,r,i,32)}function nT(t,e,r,i,n){var s,a=0;for(s=0;s>>8)-1}function Ky(t){var e=new Er(32);return _f(e,t),e[0]&1}function qy(t,e,r){var i,n;for(Rn(t[0],Al),Rn(t[1],Af),Rn(t[2],Af),Rn(t[3],Al),n=255;n>=0;--n)i=r[n/8|0]>>(n&7)&1,Fy(t,e,i),kl(e,t),kl(t,t),Fy(t,e,i)}function Il(t,e){var r=[Ce(),Ce(),Ce(),Ce()];Rn(r[0],My),Rn(r[1],Oy),Rn(r[2],Af),tt(r[3],My,Oy),qy(t,r,e)}function Rn(t,e){var r;for(r=0;r<16;r++)t[r]=e[r]|0}function tT(t,e){var r=Ce(),i;for(i=0;i<16;++i)r[i]=e[i];for(i=253;i>=0;--i)ms(r,r),i!==2&&i!==4&&tt(r,r,e);for(i=0;i<16;++i)t[i]=r[i]}function Rl(t){var e,r,i=1;for(e=0;e<16;++e)r=t[e]+i+65535,i=Math.floor(r/65536),t[e]=r-i*65536;t[0]+=i-1+37*(i-1)}function Uy(t,e,r){for(var i,n=~(r-1),s=0;s<16;++s)i=n&(t[s]^e[s]),t[s]^=i,e[s]^=i}function Ce(t){var e,r=new Float64Array(16);if(t)for(e=0;e{"use strict";var Cf=65536;function sT(t){let e=new Uint8Array(t),r=0;if(t>0)if(t>Cf)for(;rt?(crypto.getRandomValues(e.subarray(r,r+(t-r))),r+=t-r):(crypto.getRandomValues(e.subarray(r,r+Cf)),r+=Cf);else crypto.getRandomValues(e);return e}zy.exports=sT});var If=C((SK,Hy)=>{"use strict";var aT=jy(),oT=Pe();Hy.exports=function(t){if(isNaN(t)||t<=0)throw oT(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return aT(t)}});var Tf=C(jo=>{"use strict";et();Uo();var cT=De(),fT=qt(),Gy=Lt(),$y=Zr();jo.bigIntegerToUintBase64url=(t,e)=>{let r=Uint8Array.from(t.abs().toByteArray());if(r=r[0]===0?r.slice(1):r,e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=$y([new Uint8Array(e-r.length),r])}return Gy(r,"base64url")};jo.base64urlToBigInteger=t=>{let e=jo.base64urlToBuffer(t);return new cT.jsbn.BigInteger(Gy(e,"base16"),16)};jo.base64urlToBuffer=(t,e)=>{let r=fT(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=$y([new Uint8Array(e-r.length),r])}return r}});var Qy=C(Ho=>{"use strict";$i();Fo();var Bn=De(),{bigIntegerToUintBase64url:_i,base64urlToBigInteger:Ci}=Tf(),Yy=qt(),Wy=Lt();Ho.pkcs1ToJwk=function(t){let e=Bn.asn1.fromDer(Wy(t,"ascii")),r=Bn.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:_i(r.n),e:_i(r.e),d:_i(r.d),p:_i(r.p),q:_i(r.q),dp:_i(r.dP),dq:_i(r.dQ),qi:_i(r.qInv),alg:"RS256",kid:"2011-04-29"}};Ho.jwkToPkcs1=function(t){let e=Bn.pki.privateKeyToAsn1({n:Ci(t.n),e:Ci(t.e),d:Ci(t.d),p:Ci(t.p),q:Ci(t.q),dP:Ci(t.dp),dQ:Ci(t.dq),qInv:Ci(t.qi)});return Yy(Bn.asn1.toDer(e).getBytes(),"ascii")};Ho.pkixToJwk=function(t){let e=Bn.asn1.fromDer(Wy(t,"ascii")),r=Bn.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:_i(r.n),e:_i(r.e),alg:"RS256",kid:"2011-04-29"}};Ho.jwkToPkix=function(t){let e=Bn.pki.publicKeyToAsn1({n:Ci(t.n),e:Ci(t.e)});return Yy(Bn.asn1.toDer(e).getBytes(),"ascii")}});var eg=C((CK,Jy)=>{"use strict";Fo();var Xy=De(),{base64urlToBigInteger:uT}=Tf();function Zy(t,e){return e.map(r=>uT(t[r]))}function lT(t){return Xy.pki.setRsaPrivateKey(...Zy(t,["n","e","d","p","q","dp","dq","qi"]))}function dT(t){return Xy.pki.setRsaPublicKey(...Zy(t,["n","e"]))}Jy.exports={jwk2pub:dT,jwk2priv:lT}});var ig=C(Xi=>{"use strict";var Zi=Ko(),hT=If(),pT=Lt(),bT=qt();Xi.utils=Qy();Xi.generateKey=async function(t){let e=await Zi.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await tg(e);return{privateKey:r[0],publicKey:r[1]}};Xi.unmarshalPrivateKey=async function(t){let r=[await Zi.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await yT(t)],i=await tg({privateKey:r[0],publicKey:r[1]});return{privateKey:i[0],publicKey:i[1]}};Xi.getRandomValues=hT;Xi.hashAndSign=async function(t,e){let r=await Zi.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await Zi.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(e));return new Uint8Array(i,i.byteOffset,i.byteLength)};Xi.hashAndVerify=async function(t,e,r){let i=await Zi.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Zi.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,e,r)};function tg(t){return Promise.all([Zi.get().subtle.exportKey("jwk",t.privateKey),Zi.get().subtle.exportKey("jwk",t.publicKey)])}function yT(t){return Zi.get().subtle.importKey("jwk",{kty:t.kty,n:t.n,e:t.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}var{jwk2pub:gT,jwk2priv:vT}=eg();function rg(t,e,r,i){let n=e?gT(t):vT(t),s=pT(Uint8Array.from(r),"ascii"),a=i(s,n);return bT(a,"ascii")}Xi.encrypt=function(t,e){return rg(t,!0,e,(r,i)=>i.encrypt(r))};Xi.decrypt=function(t,e){return rg(t,!1,e,(r,i)=>i.decrypt(r))}});var kf=C((TK,ng)=>{"use strict";var mT=xn(),xT=vl();ng.exports={export:async function(t,e){let i=await xT.create().encrypt(t,e);return mT.names.base64.encode(i)}}});var fg=C((kK,sg)=>{"use strict";var ag=la(),og=Pe(),cg=Mr(),wT=Lt();Sf();Bl();var Rf=De(),Ur=ig(),Bf=sf(),ET=kf(),Pf=class{constructor(e){this._key=e}async verify(e,r){return Ur.hashAndVerify(this._key,r,e)}marshal(){return Ur.utils.jwkToPkix(this._key)}get bytes(){return Bf.PublicKey.encode({Type:Bf.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return Ur.encrypt(this._key,e)}equals(e){return cg(this.bytes,e.bytes)}async hash(){return ag.multihashing(this.bytes,"sha2-256")}},Go=class{constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return Ur.getRandomValues(16)}async sign(e){return Ur.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw og(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new Pf(this._publicKey)}decrypt(e){return Ur.decrypt(this._key,e)}marshal(){return Ur.utils.jwkToPkcs1(this._key)}get bytes(){return Bf.PrivateKey.encode({Type:Bf.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return cg(this.bytes,e.bytes)}async hash(){return ag.multihashing(this.bytes,"sha2-256")}async id(){let e=await this.public.hash();return wT(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let i=new Rf.util.ByteBuffer(this.marshal()),n=Rf.asn1.fromDer(i),s=Rf.pki.privateKeyFromAsn1(n),a={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return Rf.pki.encryptRsaPrivateKey(s,e,a)}else{if(r==="libp2p-key")return ET.export(this.bytes,e);throw og(new Error(`export format '${r}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}};async function ST(t){let e=Ur.utils.pkcs1ToJwk(t),r=await Ur.unmarshalPrivateKey(e);return new Go(r.privateKey,r.publicKey)}function AT(t){let e=Ur.utils.pkixToJwk(t);return new Pf(e)}async function _T(t){let e=await Ur.unmarshalPrivateKey(t);return new Go(e.privateKey,e.publicKey)}async function CT(t){let e=await Ur.generateKey(t);return new Go(e.privateKey,e.publicKey)}sg.exports={RsaPublicKey:Pf,RsaPrivateKey:Go,unmarshalRsaPublicKey:AT,unmarshalRsaPrivateKey:ST,generateKeyPair:CT,fromJwk:_T}});var ug=C(xs=>{"use strict";Bl();var pa=De();xs.publicKeyLength=pa.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH;xs.privateKeyLength=pa.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH;xs.generateKey=async function(){return pa.pki.ed25519.generateKeyPair()};xs.generateKeyFromSeed=async function(t){return pa.pki.ed25519.generateKeyPair({seed:t})};xs.hashAndSign=async function(t,e){return pa.pki.ed25519.sign({message:e,privateKey:t})};xs.hashAndVerify=async function(t,e,r){return pa.pki.ed25519.verify({signature:e,message:r,publicKey:t})}});var yg=C((BK,lg)=>{"use strict";var dg=la(),hg=Pe(),pg=Mr(),bg=fs(),ur=ug(),Nf=sf(),IT=kf(),Mf=class{constructor(e){this._key=ba(e,ur.publicKeyLength)}async verify(e,r){return ur.hashAndVerify(this._key,r,e)}marshal(){return this._key}get bytes(){return Nf.PublicKey.encode({Type:Nf.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return pg(this.bytes,e.bytes)}async hash(){return dg.multihashing(this.bytes,"sha2-256")}},ya=class{constructor(e,r){this._key=ba(e,ur.privateKeyLength),this._publicKey=ba(r,ur.publicKeyLength)}async sign(e){return ur.hashAndSign(this._key,e)}get public(){return new Mf(this._publicKey)}marshal(){return this._key}get bytes(){return Nf.PrivateKey.encode({Type:Nf.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return pg(this.bytes,e.bytes)}async hash(){return dg.multihashing(this.bytes,"sha2-256")}async id(){let e=bg.encode(this.public.bytes,"identity");return await bg.toB58String(e)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return IT.export(this.bytes,e);throw hg(new Error(`export format '${r}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}};function TT(t){if(t.length>ur.privateKeyLength){t=ba(t,ur.privateKeyLength+ur.publicKeyLength);let i=t.slice(0,ur.privateKeyLength),n=t.slice(ur.privateKeyLength,t.length);return new ya(i,n)}t=ba(t,ur.privateKeyLength);let e=t.slice(0,ur.privateKeyLength),r=t.slice(ur.publicKeyLength);return new ya(e,r)}function kT(t){return t=ba(t,ur.publicKeyLength),new Mf(t)}async function RT(){let{privateKey:t,publicKey:e}=await ur.generateKey();return new ya(t,e)}async function BT(t){let{privateKey:e,publicKey:r}=await ur.generateKeyFromSeed(t);return new ya(e,r)}function ba(t,e){if(t=Uint8Array.from(t||[]),t.length!==e)throw hg(new Error(`Key must be a Uint8Array of length ${e}, got ${t.length}`),"ERR_INVALID_KEY_TYPE");return t}lg.exports={Ed25519PublicKey:Mf,Ed25519PrivateKey:ya,unmarshalEd25519PrivateKey:TT,unmarshalEd25519PublicKey:kT,generateKeyPair:RT,generateKeyPairFromSeed:BT}});var vg=C((PK,gg)=>{var Ge={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function Fr(t,e){if(!t)throw new Error(e)}function ze(t,e,r){if(Fr(e instanceof Uint8Array,`Expected ${t} to be an Uint8Array`),r!==void 0)if(Array.isArray(r)){let i=r.join(", "),n=`Expected ${t} to be an Uint8Array with length [${i}]`;Fr(r.includes(e.length),n)}else{let i=`Expected ${t} to be an Uint8Array with length ${r}`;Fr(e.length===r,i)}}function ws(t){Fr(ga(t)==="Boolean","Expected compressed to be a Boolean")}function ni(t=r=>new Uint8Array(r),e){return typeof t=="function"&&(t=t(e)),ze("output",t,e),t}function ga(t){return Object.prototype.toString.call(t).slice(8,-1)}gg.exports=t=>({contextRandomize(e){switch(Fr(e===null||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),e!==null&&ze("seed",e,32),t.contextRandomize(e)){case 1:throw new Error(Ge.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(e){return ze("private key",e,32),t.privateKeyVerify(e)===0},privateKeyNegate(e){switch(ze("private key",e,32),t.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(Ge.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(e,r){switch(ze("private key",e,32),ze("tweak",r,32),t.privateKeyTweakAdd(e,r)){case 0:return e;case 1:throw new Error(Ge.TWEAK_ADD)}},privateKeyTweakMul(e,r){switch(ze("private key",e,32),ze("tweak",r,32),t.privateKeyTweakMul(e,r)){case 0:return e;case 1:throw new Error(Ge.TWEAK_MUL)}},publicKeyVerify(e){return ze("public key",e,[33,65]),t.publicKeyVerify(e)===0},publicKeyCreate(e,r=!0,i){switch(ze("private key",e,32),ws(r),i=ni(i,r?33:65),t.publicKeyCreate(i,e)){case 0:return i;case 1:throw new Error(Ge.SECKEY_INVALID);case 2:throw new Error(Ge.PUBKEY_SERIALIZE)}},publicKeyConvert(e,r=!0,i){switch(ze("public key",e,[33,65]),ws(r),i=ni(i,r?33:65),t.publicKeyConvert(i,e)){case 0:return i;case 1:throw new Error(Ge.PUBKEY_PARSE);case 2:throw new Error(Ge.PUBKEY_SERIALIZE)}},publicKeyNegate(e,r=!0,i){switch(ze("public key",e,[33,65]),ws(r),i=ni(i,r?33:65),t.publicKeyNegate(i,e)){case 0:return i;case 1:throw new Error(Ge.PUBKEY_PARSE);case 2:throw new Error(Ge.IMPOSSIBLE_CASE);case 3:throw new Error(Ge.PUBKEY_SERIALIZE)}},publicKeyCombine(e,r=!0,i){Fr(Array.isArray(e),"Expected public keys to be an Array"),Fr(e.length>0,"Expected public keys array will have more than zero items");for(let n of e)ze("public key",n,[33,65]);switch(ws(r),i=ni(i,r?33:65),t.publicKeyCombine(i,e)){case 0:return i;case 1:throw new Error(Ge.PUBKEY_PARSE);case 2:throw new Error(Ge.PUBKEY_COMBINE);case 3:throw new Error(Ge.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(e,r,i=!0,n){switch(ze("public key",e,[33,65]),ze("tweak",r,32),ws(i),n=ni(n,i?33:65),t.publicKeyTweakAdd(n,e,r)){case 0:return n;case 1:throw new Error(Ge.PUBKEY_PARSE);case 2:throw new Error(Ge.TWEAK_ADD)}},publicKeyTweakMul(e,r,i=!0,n){switch(ze("public key",e,[33,65]),ze("tweak",r,32),ws(i),n=ni(n,i?33:65),t.publicKeyTweakMul(n,e,r)){case 0:return n;case 1:throw new Error(Ge.PUBKEY_PARSE);case 2:throw new Error(Ge.TWEAK_MUL)}},signatureNormalize(e){switch(ze("signature",e,64),t.signatureNormalize(e)){case 0:return e;case 1:throw new Error(Ge.SIG_PARSE)}},signatureExport(e,r){ze("signature",e,64),r=ni(r,72);let i={output:r,outputlen:72};switch(t.signatureExport(i,e)){case 0:return r.slice(0,i.outputlen);case 1:throw new Error(Ge.SIG_PARSE);case 2:throw new Error(Ge.IMPOSSIBLE_CASE)}},signatureImport(e,r){switch(ze("signature",e),r=ni(r,64),t.signatureImport(r,e)){case 0:return r;case 1:throw new Error(Ge.SIG_PARSE);case 2:throw new Error(Ge.IMPOSSIBLE_CASE)}},ecdsaSign(e,r,i={},n){ze("message",e,32),ze("private key",r,32),Fr(ga(i)==="Object","Expected options to be an Object"),i.data!==void 0&&ze("options.data",i.data),i.noncefn!==void 0&&Fr(ga(i.noncefn)==="Function","Expected options.noncefn to be a Function"),n=ni(n,64);let s={signature:n,recid:null};switch(t.ecdsaSign(s,e,r,i.data,i.noncefn)){case 0:return s;case 1:throw new Error(Ge.SIGN);case 2:throw new Error(Ge.IMPOSSIBLE_CASE)}},ecdsaVerify(e,r,i){switch(ze("signature",e,64),ze("message",r,32),ze("public key",i,[33,65]),t.ecdsaVerify(e,r,i)){case 0:return!0;case 3:return!1;case 1:throw new Error(Ge.SIG_PARSE);case 2:throw new Error(Ge.PUBKEY_PARSE)}},ecdsaRecover(e,r,i,n=!0,s){switch(ze("signature",e,64),Fr(ga(r)==="Number"&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),ze("message",i,32),ws(n),s=ni(s,n?33:65),t.ecdsaRecover(s,e,r,i)){case 0:return s;case 1:throw new Error(Ge.SIG_PARSE);case 2:throw new Error(Ge.RECOVER);case 3:throw new Error(Ge.IMPOSSIBLE_CASE)}},ecdh(e,r,i={},n){switch(ze("public key",e,[33,65]),ze("private key",r,32),Fr(ga(i)==="Object","Expected options to be an Object"),i.data!==void 0&&ze("options.data",i.data),i.hashfn!==void 0?(Fr(ga(i.hashfn)==="Function","Expected options.hashfn to be a Function"),i.xbuf!==void 0&&ze("options.xbuf",i.xbuf,32),i.ybuf!==void 0&&ze("options.ybuf",i.ybuf,32),ze("output",n)):n=ni(n,32),t.ecdh(n,e,r,i.data,i.hashfn,i.xbuf,i.ybuf)){case 0:return n;case 1:throw new Error(Ge.PUBKEY_PARSE);case 2:throw new Error(Ge.ECDH)}}})});var xg=C((NK,mg)=>{mg.exports={_from:"elliptic@^6.5.2",_id:"elliptic@6.5.4",_inBundle:!1,_integrity:"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.5.2",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.5.2",saveSpec:null,fetchSpec:"^6.5.2"},_requiredBy:["/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",_shasum:"da37cebd31e79a1367e941b592ed1fbebd58abbb",_spec:"elliptic@^6.5.2",_where:"/Users/vsantos/work/pl/gh/libp2p/js-libp2p/node_modules/secp256k1",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.5.4"}});var wg=C(()=>{});var Ii=C((Eg,Pl)=>{(function(t,e){"use strict";function r(O,d){if(!O)throw new Error(d||"Assertion failed")}function i(O,d){O.super_=d;var y=function(){};y.prototype=d.prototype,O.prototype=new y,O.prototype.constructor=O}function n(O,d,y){if(n.isBN(O))return O;this.negative=0,this.words=null,this.length=0,this.red=null,O!==null&&((d==="le"||d==="be")&&(y=d,d=10),this._init(O||0,d||10,y||"be"))}typeof t=="object"?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?s=window.Buffer:s=wg().Buffer}catch(O){}n.isBN=function(d){return d instanceof n?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===n.wordSize&&Array.isArray(d.words)},n.max=function(d,y){return d.cmp(y)>0?d:y},n.min=function(d,y){return d.cmp(y)<0?d:y},n.prototype._init=function(d,y,w){if(typeof d=="number")return this._initNumber(d,y,w);if(typeof d=="object")return this._initArray(d,y,w);y==="hex"&&(y=16),r(y===(y|0)&&y>=2&&y<=36),d=d.toString().replace(/\s+/g,"");var I=0;d[0]==="-"&&(I++,this.negative=1),I=0;I-=3)L=d[I]|d[I-1]<<8|d[I-2]<<16,this.words[R]|=L<>>26-D&67108863,D+=24,D>=26&&(D-=26,R++);else if(w==="le")for(I=0,R=0;I>>26-D&67108863,D+=24,D>=26&&(D-=26,R++);return this.strip()};function a(O,d){var y=O.charCodeAt(d);return y>=65&&y<=70?y-55:y>=97&&y<=102?y-87:y-48&15}function o(O,d,y){var w=a(O,y);return y-1>=d&&(w|=a(O,y-1)<<4),w}n.prototype._parseHex=function(d,y,w){this.length=Math.ceil((d.length-y)/6),this.words=new Array(this.length);for(var I=0;I=y;I-=2)D=o(d,y,I)<=18?(R-=18,L+=1,this.words[L]|=D>>>26):R+=8;else{var P=d.length-y;for(I=P%2==0?y+1:y;I=18?(R-=18,L+=1,this.words[L]|=D>>>26):R+=8}this.strip()};function c(O,d,y,w){for(var I=0,R=Math.min(O.length,y),L=d;L=49?I+=D-49+10:D>=17?I+=D-17+10:I+=D}return I}n.prototype._parseBase=function(d,y,w){this.words=[0],this.length=1;for(var I=0,R=1;R<=67108863;R*=y)I++;I--,R=R/y|0;for(var L=d.length-w,D=L%I,P=Math.min(L,L-D)+w,h=0,M=w;M1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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];n.prototype.toString=function(d,y){d=d||10,y=y|0||1;var w;if(d===16||d==="hex"){w="";for(var I=0,R=0,L=0;L>>24-I&16777215,R!==0||L!==this.length-1?w=f[6-P.length]+P+w:w=P+w,I+=2,I>=26&&(I-=26,L--)}for(R!==0&&(w=R.toString(16)+w);w.length%y!=0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(d===(d|0)&&d>=2&&d<=36){var h=u[d],M=l[d];w="";var fe=this.clone();for(fe.negative=0;!fe.isZero();){var W=fe.modn(M).toString(d);fe=fe.idivn(M),fe.isZero()?w=W+w:w=f[h-W.length]+W+w}for(this.isZero()&&(w="0"+w);w.length%y!=0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(d,y){return r(typeof s!="undefined"),this.toArrayLike(s,d,y)},n.prototype.toArray=function(d,y){return this.toArrayLike(Array,d,y)},n.prototype.toArrayLike=function(d,y,w){var I=this.byteLength(),R=w||Math.max(1,I);r(I<=R,"byte array longer than desired length"),r(R>0,"Requested array length <= 0"),this.strip();var L=y==="le",D=new d(R),P,h,M=this.clone();if(L){for(h=0;!M.isZero();h++)P=M.andln(255),M.iushrn(8),D[h]=P;for(;h=4096&&(w+=13,y>>>=13),y>=64&&(w+=7,y>>>=7),y>=8&&(w+=4,y>>>=4),y>=2&&(w+=2,y>>>=2),w+y},n.prototype._zeroBits=function(d){if(d===0)return 26;var y=d,w=0;return(y&8191)==0&&(w+=13,y>>>=13),(y&127)==0&&(w+=7,y>>>=7),(y&15)==0&&(w+=4,y>>>=4),(y&3)==0&&(w+=2,y>>>=2),(y&1)==0&&w++,w},n.prototype.bitLength=function(){var d=this.words[this.length-1],y=this._countBits(d);return(this.length-1)*26+y};function b(O){for(var d=new Array(O.bitLength()),y=0;y>>I}return d}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,y=0;yd.length?this.clone().ior(d):d.clone().ior(this)},n.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},n.prototype.iuand=function(d){var y;this.length>d.length?y=d:y=this;for(var w=0;wd.length?this.clone().iand(d):d.clone().iand(this)},n.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},n.prototype.iuxor=function(d){var y,w;this.length>d.length?(y=this,w=d):(y=d,w=this);for(var I=0;Id.length?this.clone().ixor(d):d.clone().ixor(this)},n.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},n.prototype.inotn=function(d){r(typeof d=="number"&&d>=0);var y=Math.ceil(d/26)|0,w=d%26;this._expand(y),w>0&&y--;for(var I=0;I0&&(this.words[I]=~this.words[I]&67108863>>26-w),this.strip()},n.prototype.notn=function(d){return this.clone().inotn(d)},n.prototype.setn=function(d,y){r(typeof d=="number"&&d>=0);var w=d/26|0,I=d%26;return this._expand(w+1),y?this.words[w]=this.words[w]|1<d.length?(w=this,I=d):(w=d,I=this);for(var R=0,L=0;L>>26;for(;R!==0&&L>>26;if(this.length=w.length,R!==0)this.words[this.length]=R,this.length++;else if(w!==this)for(;Ld.length?this.clone().iadd(d):d.clone().iadd(this)},n.prototype.isub=function(d){if(d.negative!==0){d.negative=0;var y=this.iadd(d);return d.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var w=this.cmp(d);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var I,R;w>0?(I=this,R=d):(I=d,R=this);for(var L=0,D=0;D>26,this.words[D]=y&67108863;for(;L!==0&&D>26,this.words[D]=y&67108863;if(L===0&&D>>26,fe=P&67108863,W=Math.min(h,d.length-1),he=Math.max(0,h-O.length+1);he<=W;he++){var ve=h-he|0;I=O.words[ve]|0,R=d.words[he]|0,L=I*R+fe,M+=L/67108864|0,fe=L&67108863}y.words[h]=fe|0,P=M|0}return P!==0?y.words[h]=P|0:y.length--,y.strip()}var g=function(d,y,w){var I=d.words,R=y.words,L=w.words,D=0,P,h,M,fe=I[0]|0,W=fe&8191,he=fe>>>13,ve=I[1]|0,x=ve&8191,X=ve>>>13,te=I[2]|0,v=te&8191,S=te>>>13,N=I[3]|0,q=N&8191,m=N>>>13,k=I[4]|0,T=k&8191,_=k>>>13,U=I[5]|0,G=U&8191,z=U>>>13,ee=I[6]|0,ae=ee&8191,oe=ee>>>13,Ee=I[7]|0,le=Ee&8191,xe=Ee>>>13,_e=I[8]|0,Se=_e&8191,we=_e>>>13,Me=I[9]|0,Ye=Me&8191,Je=Me>>>13,Ht=R[0]|0,We=Ht&8191,qe=Ht>>>13,Rt=R[1]|0,Te=Rt&8191,ct=Rt>>>13,Zn=R[2]|0,ft=Zn&8191,ut=Zn>>>13,es=R[3]|0,lt=es&8191,dt=es>>>13,ts=R[4]|0,ht=ts&8191,pt=ts>>>13,rs=R[5]|0,bt=rs&8191,yt=rs>>>13,is=R[6]|0,gt=is&8191,vt=is>>>13,ns=R[7]|0,mt=ns&8191,xt=ns>>>13,ss=R[8]|0,wt=ss&8191,Et=ss>>>13,as=R[9]|0,St=as&8191,At=as>>>13;w.negative=d.negative^y.negative,w.length=19,P=Math.imul(W,We),h=Math.imul(W,qe),h=h+Math.imul(he,We)|0,M=Math.imul(he,qe);var dn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(dn>>>26)|0,dn&=67108863,P=Math.imul(x,We),h=Math.imul(x,qe),h=h+Math.imul(X,We)|0,M=Math.imul(X,qe),P=P+Math.imul(W,Te)|0,h=h+Math.imul(W,ct)|0,h=h+Math.imul(he,Te)|0,M=M+Math.imul(he,ct)|0;var hn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(hn>>>26)|0,hn&=67108863,P=Math.imul(v,We),h=Math.imul(v,qe),h=h+Math.imul(S,We)|0,M=Math.imul(S,qe),P=P+Math.imul(x,Te)|0,h=h+Math.imul(x,ct)|0,h=h+Math.imul(X,Te)|0,M=M+Math.imul(X,ct)|0,P=P+Math.imul(W,ft)|0,h=h+Math.imul(W,ut)|0,h=h+Math.imul(he,ft)|0,M=M+Math.imul(he,ut)|0;var pn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(pn>>>26)|0,pn&=67108863,P=Math.imul(q,We),h=Math.imul(q,qe),h=h+Math.imul(m,We)|0,M=Math.imul(m,qe),P=P+Math.imul(v,Te)|0,h=h+Math.imul(v,ct)|0,h=h+Math.imul(S,Te)|0,M=M+Math.imul(S,ct)|0,P=P+Math.imul(x,ft)|0,h=h+Math.imul(x,ut)|0,h=h+Math.imul(X,ft)|0,M=M+Math.imul(X,ut)|0,P=P+Math.imul(W,lt)|0,h=h+Math.imul(W,dt)|0,h=h+Math.imul(he,lt)|0,M=M+Math.imul(he,dt)|0;var bn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(bn>>>26)|0,bn&=67108863,P=Math.imul(T,We),h=Math.imul(T,qe),h=h+Math.imul(_,We)|0,M=Math.imul(_,qe),P=P+Math.imul(q,Te)|0,h=h+Math.imul(q,ct)|0,h=h+Math.imul(m,Te)|0,M=M+Math.imul(m,ct)|0,P=P+Math.imul(v,ft)|0,h=h+Math.imul(v,ut)|0,h=h+Math.imul(S,ft)|0,M=M+Math.imul(S,ut)|0,P=P+Math.imul(x,lt)|0,h=h+Math.imul(x,dt)|0,h=h+Math.imul(X,lt)|0,M=M+Math.imul(X,dt)|0,P=P+Math.imul(W,ht)|0,h=h+Math.imul(W,pt)|0,h=h+Math.imul(he,ht)|0,M=M+Math.imul(he,pt)|0;var yn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(yn>>>26)|0,yn&=67108863,P=Math.imul(G,We),h=Math.imul(G,qe),h=h+Math.imul(z,We)|0,M=Math.imul(z,qe),P=P+Math.imul(T,Te)|0,h=h+Math.imul(T,ct)|0,h=h+Math.imul(_,Te)|0,M=M+Math.imul(_,ct)|0,P=P+Math.imul(q,ft)|0,h=h+Math.imul(q,ut)|0,h=h+Math.imul(m,ft)|0,M=M+Math.imul(m,ut)|0,P=P+Math.imul(v,lt)|0,h=h+Math.imul(v,dt)|0,h=h+Math.imul(S,lt)|0,M=M+Math.imul(S,dt)|0,P=P+Math.imul(x,ht)|0,h=h+Math.imul(x,pt)|0,h=h+Math.imul(X,ht)|0,M=M+Math.imul(X,pt)|0,P=P+Math.imul(W,bt)|0,h=h+Math.imul(W,yt)|0,h=h+Math.imul(he,bt)|0,M=M+Math.imul(he,yt)|0;var gn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(gn>>>26)|0,gn&=67108863,P=Math.imul(ae,We),h=Math.imul(ae,qe),h=h+Math.imul(oe,We)|0,M=Math.imul(oe,qe),P=P+Math.imul(G,Te)|0,h=h+Math.imul(G,ct)|0,h=h+Math.imul(z,Te)|0,M=M+Math.imul(z,ct)|0,P=P+Math.imul(T,ft)|0,h=h+Math.imul(T,ut)|0,h=h+Math.imul(_,ft)|0,M=M+Math.imul(_,ut)|0,P=P+Math.imul(q,lt)|0,h=h+Math.imul(q,dt)|0,h=h+Math.imul(m,lt)|0,M=M+Math.imul(m,dt)|0,P=P+Math.imul(v,ht)|0,h=h+Math.imul(v,pt)|0,h=h+Math.imul(S,ht)|0,M=M+Math.imul(S,pt)|0,P=P+Math.imul(x,bt)|0,h=h+Math.imul(x,yt)|0,h=h+Math.imul(X,bt)|0,M=M+Math.imul(X,yt)|0,P=P+Math.imul(W,gt)|0,h=h+Math.imul(W,vt)|0,h=h+Math.imul(he,gt)|0,M=M+Math.imul(he,vt)|0;var vn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(vn>>>26)|0,vn&=67108863,P=Math.imul(le,We),h=Math.imul(le,qe),h=h+Math.imul(xe,We)|0,M=Math.imul(xe,qe),P=P+Math.imul(ae,Te)|0,h=h+Math.imul(ae,ct)|0,h=h+Math.imul(oe,Te)|0,M=M+Math.imul(oe,ct)|0,P=P+Math.imul(G,ft)|0,h=h+Math.imul(G,ut)|0,h=h+Math.imul(z,ft)|0,M=M+Math.imul(z,ut)|0,P=P+Math.imul(T,lt)|0,h=h+Math.imul(T,dt)|0,h=h+Math.imul(_,lt)|0,M=M+Math.imul(_,dt)|0,P=P+Math.imul(q,ht)|0,h=h+Math.imul(q,pt)|0,h=h+Math.imul(m,ht)|0,M=M+Math.imul(m,pt)|0,P=P+Math.imul(v,bt)|0,h=h+Math.imul(v,yt)|0,h=h+Math.imul(S,bt)|0,M=M+Math.imul(S,yt)|0,P=P+Math.imul(x,gt)|0,h=h+Math.imul(x,vt)|0,h=h+Math.imul(X,gt)|0,M=M+Math.imul(X,vt)|0,P=P+Math.imul(W,mt)|0,h=h+Math.imul(W,xt)|0,h=h+Math.imul(he,mt)|0,M=M+Math.imul(he,xt)|0;var mn=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(mn>>>26)|0,mn&=67108863,P=Math.imul(Se,We),h=Math.imul(Se,qe),h=h+Math.imul(we,We)|0,M=Math.imul(we,qe),P=P+Math.imul(le,Te)|0,h=h+Math.imul(le,ct)|0,h=h+Math.imul(xe,Te)|0,M=M+Math.imul(xe,ct)|0,P=P+Math.imul(ae,ft)|0,h=h+Math.imul(ae,ut)|0,h=h+Math.imul(oe,ft)|0,M=M+Math.imul(oe,ut)|0,P=P+Math.imul(G,lt)|0,h=h+Math.imul(G,dt)|0,h=h+Math.imul(z,lt)|0,M=M+Math.imul(z,dt)|0,P=P+Math.imul(T,ht)|0,h=h+Math.imul(T,pt)|0,h=h+Math.imul(_,ht)|0,M=M+Math.imul(_,pt)|0,P=P+Math.imul(q,bt)|0,h=h+Math.imul(q,yt)|0,h=h+Math.imul(m,bt)|0,M=M+Math.imul(m,yt)|0,P=P+Math.imul(v,gt)|0,h=h+Math.imul(v,vt)|0,h=h+Math.imul(S,gt)|0,M=M+Math.imul(S,vt)|0,P=P+Math.imul(x,mt)|0,h=h+Math.imul(x,xt)|0,h=h+Math.imul(X,mt)|0,M=M+Math.imul(X,xt)|0,P=P+Math.imul(W,wt)|0,h=h+Math.imul(W,Et)|0,h=h+Math.imul(he,wt)|0,M=M+Math.imul(he,Et)|0;var du=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(du>>>26)|0,du&=67108863,P=Math.imul(Ye,We),h=Math.imul(Ye,qe),h=h+Math.imul(Je,We)|0,M=Math.imul(Je,qe),P=P+Math.imul(Se,Te)|0,h=h+Math.imul(Se,ct)|0,h=h+Math.imul(we,Te)|0,M=M+Math.imul(we,ct)|0,P=P+Math.imul(le,ft)|0,h=h+Math.imul(le,ut)|0,h=h+Math.imul(xe,ft)|0,M=M+Math.imul(xe,ut)|0,P=P+Math.imul(ae,lt)|0,h=h+Math.imul(ae,dt)|0,h=h+Math.imul(oe,lt)|0,M=M+Math.imul(oe,dt)|0,P=P+Math.imul(G,ht)|0,h=h+Math.imul(G,pt)|0,h=h+Math.imul(z,ht)|0,M=M+Math.imul(z,pt)|0,P=P+Math.imul(T,bt)|0,h=h+Math.imul(T,yt)|0,h=h+Math.imul(_,bt)|0,M=M+Math.imul(_,yt)|0,P=P+Math.imul(q,gt)|0,h=h+Math.imul(q,vt)|0,h=h+Math.imul(m,gt)|0,M=M+Math.imul(m,vt)|0,P=P+Math.imul(v,mt)|0,h=h+Math.imul(v,xt)|0,h=h+Math.imul(S,mt)|0,M=M+Math.imul(S,xt)|0,P=P+Math.imul(x,wt)|0,h=h+Math.imul(x,Et)|0,h=h+Math.imul(X,wt)|0,M=M+Math.imul(X,Et)|0,P=P+Math.imul(W,St)|0,h=h+Math.imul(W,At)|0,h=h+Math.imul(he,St)|0,M=M+Math.imul(he,At)|0;var hu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(hu>>>26)|0,hu&=67108863,P=Math.imul(Ye,Te),h=Math.imul(Ye,ct),h=h+Math.imul(Je,Te)|0,M=Math.imul(Je,ct),P=P+Math.imul(Se,ft)|0,h=h+Math.imul(Se,ut)|0,h=h+Math.imul(we,ft)|0,M=M+Math.imul(we,ut)|0,P=P+Math.imul(le,lt)|0,h=h+Math.imul(le,dt)|0,h=h+Math.imul(xe,lt)|0,M=M+Math.imul(xe,dt)|0,P=P+Math.imul(ae,ht)|0,h=h+Math.imul(ae,pt)|0,h=h+Math.imul(oe,ht)|0,M=M+Math.imul(oe,pt)|0,P=P+Math.imul(G,bt)|0,h=h+Math.imul(G,yt)|0,h=h+Math.imul(z,bt)|0,M=M+Math.imul(z,yt)|0,P=P+Math.imul(T,gt)|0,h=h+Math.imul(T,vt)|0,h=h+Math.imul(_,gt)|0,M=M+Math.imul(_,vt)|0,P=P+Math.imul(q,mt)|0,h=h+Math.imul(q,xt)|0,h=h+Math.imul(m,mt)|0,M=M+Math.imul(m,xt)|0,P=P+Math.imul(v,wt)|0,h=h+Math.imul(v,Et)|0,h=h+Math.imul(S,wt)|0,M=M+Math.imul(S,Et)|0,P=P+Math.imul(x,St)|0,h=h+Math.imul(x,At)|0,h=h+Math.imul(X,St)|0,M=M+Math.imul(X,At)|0;var pu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(pu>>>26)|0,pu&=67108863,P=Math.imul(Ye,ft),h=Math.imul(Ye,ut),h=h+Math.imul(Je,ft)|0,M=Math.imul(Je,ut),P=P+Math.imul(Se,lt)|0,h=h+Math.imul(Se,dt)|0,h=h+Math.imul(we,lt)|0,M=M+Math.imul(we,dt)|0,P=P+Math.imul(le,ht)|0,h=h+Math.imul(le,pt)|0,h=h+Math.imul(xe,ht)|0,M=M+Math.imul(xe,pt)|0,P=P+Math.imul(ae,bt)|0,h=h+Math.imul(ae,yt)|0,h=h+Math.imul(oe,bt)|0,M=M+Math.imul(oe,yt)|0,P=P+Math.imul(G,gt)|0,h=h+Math.imul(G,vt)|0,h=h+Math.imul(z,gt)|0,M=M+Math.imul(z,vt)|0,P=P+Math.imul(T,mt)|0,h=h+Math.imul(T,xt)|0,h=h+Math.imul(_,mt)|0,M=M+Math.imul(_,xt)|0,P=P+Math.imul(q,wt)|0,h=h+Math.imul(q,Et)|0,h=h+Math.imul(m,wt)|0,M=M+Math.imul(m,Et)|0,P=P+Math.imul(v,St)|0,h=h+Math.imul(v,At)|0,h=h+Math.imul(S,St)|0,M=M+Math.imul(S,At)|0;var bu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(bu>>>26)|0,bu&=67108863,P=Math.imul(Ye,lt),h=Math.imul(Ye,dt),h=h+Math.imul(Je,lt)|0,M=Math.imul(Je,dt),P=P+Math.imul(Se,ht)|0,h=h+Math.imul(Se,pt)|0,h=h+Math.imul(we,ht)|0,M=M+Math.imul(we,pt)|0,P=P+Math.imul(le,bt)|0,h=h+Math.imul(le,yt)|0,h=h+Math.imul(xe,bt)|0,M=M+Math.imul(xe,yt)|0,P=P+Math.imul(ae,gt)|0,h=h+Math.imul(ae,vt)|0,h=h+Math.imul(oe,gt)|0,M=M+Math.imul(oe,vt)|0,P=P+Math.imul(G,mt)|0,h=h+Math.imul(G,xt)|0,h=h+Math.imul(z,mt)|0,M=M+Math.imul(z,xt)|0,P=P+Math.imul(T,wt)|0,h=h+Math.imul(T,Et)|0,h=h+Math.imul(_,wt)|0,M=M+Math.imul(_,Et)|0,P=P+Math.imul(q,St)|0,h=h+Math.imul(q,At)|0,h=h+Math.imul(m,St)|0,M=M+Math.imul(m,At)|0;var yu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(yu>>>26)|0,yu&=67108863,P=Math.imul(Ye,ht),h=Math.imul(Ye,pt),h=h+Math.imul(Je,ht)|0,M=Math.imul(Je,pt),P=P+Math.imul(Se,bt)|0,h=h+Math.imul(Se,yt)|0,h=h+Math.imul(we,bt)|0,M=M+Math.imul(we,yt)|0,P=P+Math.imul(le,gt)|0,h=h+Math.imul(le,vt)|0,h=h+Math.imul(xe,gt)|0,M=M+Math.imul(xe,vt)|0,P=P+Math.imul(ae,mt)|0,h=h+Math.imul(ae,xt)|0,h=h+Math.imul(oe,mt)|0,M=M+Math.imul(oe,xt)|0,P=P+Math.imul(G,wt)|0,h=h+Math.imul(G,Et)|0,h=h+Math.imul(z,wt)|0,M=M+Math.imul(z,Et)|0,P=P+Math.imul(T,St)|0,h=h+Math.imul(T,At)|0,h=h+Math.imul(_,St)|0,M=M+Math.imul(_,At)|0;var gu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(gu>>>26)|0,gu&=67108863,P=Math.imul(Ye,bt),h=Math.imul(Ye,yt),h=h+Math.imul(Je,bt)|0,M=Math.imul(Je,yt),P=P+Math.imul(Se,gt)|0,h=h+Math.imul(Se,vt)|0,h=h+Math.imul(we,gt)|0,M=M+Math.imul(we,vt)|0,P=P+Math.imul(le,mt)|0,h=h+Math.imul(le,xt)|0,h=h+Math.imul(xe,mt)|0,M=M+Math.imul(xe,xt)|0,P=P+Math.imul(ae,wt)|0,h=h+Math.imul(ae,Et)|0,h=h+Math.imul(oe,wt)|0,M=M+Math.imul(oe,Et)|0,P=P+Math.imul(G,St)|0,h=h+Math.imul(G,At)|0,h=h+Math.imul(z,St)|0,M=M+Math.imul(z,At)|0;var vu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(vu>>>26)|0,vu&=67108863,P=Math.imul(Ye,gt),h=Math.imul(Ye,vt),h=h+Math.imul(Je,gt)|0,M=Math.imul(Je,vt),P=P+Math.imul(Se,mt)|0,h=h+Math.imul(Se,xt)|0,h=h+Math.imul(we,mt)|0,M=M+Math.imul(we,xt)|0,P=P+Math.imul(le,wt)|0,h=h+Math.imul(le,Et)|0,h=h+Math.imul(xe,wt)|0,M=M+Math.imul(xe,Et)|0,P=P+Math.imul(ae,St)|0,h=h+Math.imul(ae,At)|0,h=h+Math.imul(oe,St)|0,M=M+Math.imul(oe,At)|0;var mu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(mu>>>26)|0,mu&=67108863,P=Math.imul(Ye,mt),h=Math.imul(Ye,xt),h=h+Math.imul(Je,mt)|0,M=Math.imul(Je,xt),P=P+Math.imul(Se,wt)|0,h=h+Math.imul(Se,Et)|0,h=h+Math.imul(we,wt)|0,M=M+Math.imul(we,Et)|0,P=P+Math.imul(le,St)|0,h=h+Math.imul(le,At)|0,h=h+Math.imul(xe,St)|0,M=M+Math.imul(xe,At)|0;var xu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(xu>>>26)|0,xu&=67108863,P=Math.imul(Ye,wt),h=Math.imul(Ye,Et),h=h+Math.imul(Je,wt)|0,M=Math.imul(Je,Et),P=P+Math.imul(Se,St)|0,h=h+Math.imul(Se,At)|0,h=h+Math.imul(we,St)|0,M=M+Math.imul(we,At)|0;var wu=(D+P|0)+((h&8191)<<13)|0;D=(M+(h>>>13)|0)+(wu>>>26)|0,wu&=67108863,P=Math.imul(Ye,St),h=Math.imul(Ye,At),h=h+Math.imul(Je,St)|0,M=Math.imul(Je,At);var Eu=(D+P|0)+((h&8191)<<13)|0;return D=(M+(h>>>13)|0)+(Eu>>>26)|0,Eu&=67108863,L[0]=dn,L[1]=hn,L[2]=pn,L[3]=bn,L[4]=yn,L[5]=gn,L[6]=vn,L[7]=mn,L[8]=du,L[9]=hu,L[10]=pu,L[11]=bu,L[12]=yu,L[13]=gu,L[14]=vu,L[15]=mu,L[16]=xu,L[17]=wu,L[18]=Eu,D!==0&&(L[19]=D,w.length++),w};Math.imul||(g=p);function A(O,d,y){y.negative=d.negative^O.negative,y.length=O.length+d.length;for(var w=0,I=0,R=0;R>>26)|0,I+=L>>>26,L&=67108863}y.words[R]=D,w=L,L=I}return w!==0?y.words[R]=w:y.length--,y.strip()}function F(O,d,y){var w=new B;return w.mulp(O,d,y)}n.prototype.mulTo=function(d,y){var w,I=this.length+d.length;return this.length===10&&d.length===10?w=g(this,d,y):I<63?w=p(this,d,y):I<1024?w=A(this,d,y):w=F(this,d,y),w};function B(O,d){this.x=O,this.y=d}B.prototype.makeRBT=function(d){for(var y=new Array(d),w=n.prototype._countBits(d)-1,I=0;I>=1;return I},B.prototype.permute=function(d,y,w,I,R,L){for(var D=0;D>>1)R++;return 1<>>13,w[2*L+1]=R&8191,R=R>>>13;for(L=2*y;L>=26,y+=I/67108864|0,y+=R>>>26,this.words[w]=R&67108863}return y!==0&&(this.words[w]=y,this.length++),this},n.prototype.muln=function(d){return this.clone().imuln(d)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(d){var y=b(d);if(y.length===0)return new n(1);for(var w=this,I=0;I=0);var y=d%26,w=(d-y)/26,I=67108863>>>26-y<<26-y,R;if(y!==0){var L=0;for(R=0;R>>26-y}L&&(this.words[R]=L,this.length++)}if(w!==0){for(R=this.length-1;R>=0;R--)this.words[R+w]=this.words[R];for(R=0;R=0);var I;y?I=(y-y%26)/26:I=0;var R=d%26,L=Math.min((d-R)/26,this.length),D=67108863^67108863>>>R<L)for(this.length-=L,h=0;h=0&&(M!==0||h>=I);h--){var fe=this.words[h]|0;this.words[h]=M<<26-R|fe>>>R,M=fe&D}return P&&M!==0&&(P.words[P.length++]=M),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(d,y,w){return r(this.negative===0),this.iushrn(d,y,w)},n.prototype.shln=function(d){return this.clone().ishln(d)},n.prototype.ushln=function(d){return this.clone().iushln(d)},n.prototype.shrn=function(d){return this.clone().ishrn(d)},n.prototype.ushrn=function(d){return this.clone().iushrn(d)},n.prototype.testn=function(d){r(typeof d=="number"&&d>=0);var y=d%26,w=(d-y)/26,I=1<=0);var y=d%26,w=(d-y)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(y!==0&&w++,this.length=Math.min(w,this.length),y!==0){var I=67108863^67108863>>>y<=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},n.prototype.isubn=function(d){if(r(typeof d=="number"),r(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y>26)-(P/67108864|0),this.words[R+w]=L&67108863}for(;R>26,this.words[R+w]=L&67108863;if(D===0)return this.strip();for(r(D===-1),D=0,R=0;R>26,this.words[R]=L&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(d,y){var w=this.length-d.length,I=this.clone(),R=d,L=R.words[R.length-1]|0,D=this._countBits(L);w=26-D,w!==0&&(R=R.ushln(w),I.iushln(w),L=R.words[R.length-1]|0);var P=I.length-R.length,h;if(y!=="mod"){h=new n(null),h.length=P+1,h.words=new Array(h.length);for(var M=0;M=0;W--){var he=(I.words[R.length+W]|0)*67108864+(I.words[R.length+W-1]|0);for(he=Math.min(he/L|0,67108863),I._ishlnsubmul(R,he,W);I.negative!==0;)he--,I.negative=0,I._ishlnsubmul(R,1,W),I.isZero()||(I.negative^=1);h&&(h.words[W]=he)}return h&&h.strip(),I.strip(),y!=="div"&&w!==0&&I.iushrn(w),{div:h||null,mod:I}},n.prototype.divmod=function(d,y,w){if(r(!d.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var I,R,L;return this.negative!==0&&d.negative===0?(L=this.neg().divmod(d,y),y!=="mod"&&(I=L.div.neg()),y!=="div"&&(R=L.mod.neg(),w&&R.negative!==0&&R.iadd(d)),{div:I,mod:R}):this.negative===0&&d.negative!==0?(L=this.divmod(d.neg(),y),y!=="mod"&&(I=L.div.neg()),{div:I,mod:L.mod}):(this.negative&d.negative)!=0?(L=this.neg().divmod(d.neg(),y),y!=="div"&&(R=L.mod.neg(),w&&R.negative!==0&&R.isub(d)),{div:L.div,mod:R}):d.length>this.length||this.cmp(d)<0?{div:new n(0),mod:this}:d.length===1?y==="div"?{div:this.divn(d.words[0]),mod:null}:y==="mod"?{div:null,mod:new n(this.modn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new n(this.modn(d.words[0]))}:this._wordDiv(d,y)},n.prototype.div=function(d){return this.divmod(d,"div",!1).div},n.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},n.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},n.prototype.divRound=function(d){var y=this.divmod(d);if(y.mod.isZero())return y.div;var w=y.div.negative!==0?y.mod.isub(d):y.mod,I=d.ushrn(1),R=d.andln(1),L=w.cmp(I);return L<0||R===1&&L===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},n.prototype.modn=function(d){r(d<=67108863);for(var y=(1<<26)%d,w=0,I=this.length-1;I>=0;I--)w=(y*w+(this.words[I]|0))%d;return w},n.prototype.idivn=function(d){r(d<=67108863);for(var y=0,w=this.length-1;w>=0;w--){var I=(this.words[w]|0)+y*67108864;this.words[w]=I/d|0,y=I%d}return this.strip()},n.prototype.divn=function(d){return this.clone().idivn(d)},n.prototype.egcd=function(d){r(d.negative===0),r(!d.isZero());var y=this,w=d.clone();y.negative!==0?y=y.umod(d):y=y.clone();for(var I=new n(1),R=new n(0),L=new n(0),D=new n(1),P=0;y.isEven()&&w.isEven();)y.iushrn(1),w.iushrn(1),++P;for(var h=w.clone(),M=y.clone();!y.isZero();){for(var fe=0,W=1;(y.words[0]&W)==0&&fe<26;++fe,W<<=1);if(fe>0)for(y.iushrn(fe);fe-- >0;)(I.isOdd()||R.isOdd())&&(I.iadd(h),R.isub(M)),I.iushrn(1),R.iushrn(1);for(var he=0,ve=1;(w.words[0]&ve)==0&&he<26;++he,ve<<=1);if(he>0)for(w.iushrn(he);he-- >0;)(L.isOdd()||D.isOdd())&&(L.iadd(h),D.isub(M)),L.iushrn(1),D.iushrn(1);y.cmp(w)>=0?(y.isub(w),I.isub(L),R.isub(D)):(w.isub(y),L.isub(I),D.isub(R))}return{a:L,b:D,gcd:w.iushln(P)}},n.prototype._invmp=function(d){r(d.negative===0),r(!d.isZero());var y=this,w=d.clone();y.negative!==0?y=y.umod(d):y=y.clone();for(var I=new n(1),R=new n(0),L=w.clone();y.cmpn(1)>0&&w.cmpn(1)>0;){for(var D=0,P=1;(y.words[0]&P)==0&&D<26;++D,P<<=1);if(D>0)for(y.iushrn(D);D-- >0;)I.isOdd()&&I.iadd(L),I.iushrn(1);for(var h=0,M=1;(w.words[0]&M)==0&&h<26;++h,M<<=1);if(h>0)for(w.iushrn(h);h-- >0;)R.isOdd()&&R.iadd(L),R.iushrn(1);y.cmp(w)>=0?(y.isub(w),I.isub(R)):(w.isub(y),R.isub(I))}var fe;return y.cmpn(1)===0?fe=I:fe=R,fe.cmpn(0)<0&&fe.iadd(d),fe},n.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var y=this.clone(),w=d.clone();y.negative=0,w.negative=0;for(var I=0;y.isEven()&&w.isEven();I++)y.iushrn(1),w.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;w.isEven();)w.iushrn(1);var R=y.cmp(w);if(R<0){var L=y;y=w,w=L}else if(R===0||w.cmpn(1)===0)break;y.isub(w)}while(!0);return w.iushln(I)},n.prototype.invm=function(d){return this.egcd(d).a.umod(d)},n.prototype.isEven=function(){return(this.words[0]&1)==0},n.prototype.isOdd=function(){return(this.words[0]&1)==1},n.prototype.andln=function(d){return this.words[0]&d},n.prototype.bincn=function(d){r(typeof d=="number");var y=d%26,w=(d-y)/26,I=1<>>26,D&=67108863,this.words[L]=D}return R!==0&&(this.words[L]=R,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(d){var y=d<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this.strip();var w;if(this.length>1)w=1;else{y&&(d=-d),r(d<=67108863,"Number is too big");var I=this.words[0]|0;w=I===d?0:Id.length)return 1;if(this.length=0;w--){var I=this.words[w]|0,R=d.words[w]|0;if(I!==R){IR&&(y=1);break}}return y},n.prototype.gtn=function(d){return this.cmpn(d)===1},n.prototype.gt=function(d){return this.cmp(d)===1},n.prototype.gten=function(d){return this.cmpn(d)>=0},n.prototype.gte=function(d){return this.cmp(d)>=0},n.prototype.ltn=function(d){return this.cmpn(d)===-1},n.prototype.lt=function(d){return this.cmp(d)===-1},n.prototype.lten=function(d){return this.cmpn(d)<=0},n.prototype.lte=function(d){return this.cmp(d)<=0},n.prototype.eqn=function(d){return this.cmpn(d)===0},n.prototype.eq=function(d){return this.cmp(d)===0},n.red=function(d){return new se(d)},n.prototype.toRed=function(d){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(d){return this.red=d,this},n.prototype.forceRed=function(d){return r(!this.red,"Already a number in reduction context"),this._forceRed(d)},n.prototype.redAdd=function(d){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},n.prototype.redIAdd=function(d){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},n.prototype.redSub=function(d){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},n.prototype.redISub=function(d){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},n.prototype.redShl=function(d){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},n.prototype.redMul=function(d){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},n.prototype.redIMul=function(d){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(d){return r(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var K={k256:null,p224:null,p192:null,p25519:null};function V(O,d){this.name=O,this.p=new n(d,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V.prototype._tmp=function(){var d=new n(null);return d.words=new Array(Math.ceil(this.n/13)),d},V.prototype.ireduce=function(d){var y=d,w;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),w=y.bitLength();while(w>this.n);var I=w0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},V.prototype.split=function(d,y){d.iushrn(this.n,0,y)},V.prototype.imulK=function(d){return d.imul(this.k)};function Q(){V.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Q,V),Q.prototype.split=function(d,y){for(var w=4194303,I=Math.min(d.length,9),R=0;R>>22,L=D}L>>>=22,d.words[R-10]=L,L===0&&d.length>10?d.length-=10:d.length-=9},Q.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var y=0,w=0;w>>=26,d.words[w]=R,y=I}return y!==0&&(d.words[d.length++]=y),d},n._prime=function(d){if(K[d])return K[d];var y;if(d==="k256")y=new Q;else if(d==="p224")y=new $;else if(d==="p192")y=new Y;else if(d==="p25519")y=new J;else throw new Error("Unknown prime "+d);return K[d]=y,y};function se(O){if(typeof O=="string"){var d=n._prime(O);this.m=d.p,this.prime=d}else r(O.gtn(1),"modulus must be greater than 1"),this.m=O,this.prime=null}se.prototype._verify1=function(d){r(d.negative===0,"red works only with positives"),r(d.red,"red works only with red numbers")},se.prototype._verify2=function(d,y){r((d.negative|y.negative)==0,"red works only with positives"),r(d.red&&d.red===y.red,"red works only with red numbers")},se.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):d.umod(this.m)._forceRed(this)},se.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},se.prototype.add=function(d,y){this._verify2(d,y);var w=d.add(y);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},se.prototype.iadd=function(d,y){this._verify2(d,y);var w=d.iadd(y);return w.cmp(this.m)>=0&&w.isub(this.m),w},se.prototype.sub=function(d,y){this._verify2(d,y);var w=d.sub(y);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},se.prototype.isub=function(d,y){this._verify2(d,y);var w=d.isub(y);return w.cmpn(0)<0&&w.iadd(this.m),w},se.prototype.shl=function(d,y){return this._verify1(d),this.imod(d.ushln(y))},se.prototype.imul=function(d,y){return this._verify2(d,y),this.imod(d.imul(y))},se.prototype.mul=function(d,y){return this._verify2(d,y),this.imod(d.mul(y))},se.prototype.isqr=function(d){return this.imul(d,d.clone())},se.prototype.sqr=function(d){return this.mul(d,d)},se.prototype.sqrt=function(d){if(d.isZero())return d.clone();var y=this.m.andln(3);if(r(y%2==1),y===3){var w=this.m.add(new n(1)).iushrn(2);return this.pow(d,w)}for(var I=this.m.subn(1),R=0;!I.isZero()&&I.andln(1)===0;)R++,I.iushrn(1);r(!I.isZero());var L=new n(1).toRed(this),D=L.redNeg(),P=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new n(2*h*h).toRed(this);this.pow(h,P).cmp(D)!==0;)h.redIAdd(D);for(var M=this.pow(h,I),fe=this.pow(d,I.addn(1).iushrn(1)),W=this.pow(d,I),he=R;W.cmp(L)!==0;){for(var ve=W,x=0;ve.cmp(L)!==0;x++)ve=ve.redSqr();r(x=0;R--){for(var M=y.words[R],fe=h-1;fe>=0;fe--){var W=M>>fe&1;if(L!==I[0]&&(L=this.sqr(L)),W===0&&D===0){P=0;continue}D<<=1,D|=W,P++,!(P!==w&&(R!==0||fe!==0))&&(L=this.mul(L,I[D]),P=0,D=0)}h=26}return L},se.prototype.convertTo=function(d){var y=d.umod(this.m);return y===d?y.clone():y},se.prototype.convertFrom=function(d){var y=d.clone();return y.red=null,y},n.mont=function(d){return new ne(d)};function ne(O){se.call(this,O),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ne,se),ne.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},ne.prototype.convertFrom=function(d){var y=this.imod(d.mul(this.rinv));return y.red=null,y},ne.prototype.imul=function(d,y){if(d.isZero()||y.isZero())return d.words[0]=0,d.length=1,d;var w=d.imul(y),I=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=w.isub(I).iushrn(this.shift),L=R;return R.cmp(this.m)>=0?L=R.isub(this.m):R.cmpn(0)<0&&(L=R.iadd(this.m)),L._forceRed(this)},ne.prototype.mul=function(d,y){if(d.isZero()||y.isZero())return new n(0)._forceRed(this);var w=d.mul(y),I=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=w.isub(I).iushrn(this.shift),L=R;return R.cmp(this.m)>=0?L=R.isub(this.m):R.cmpn(0)<0&&(L=R.iadd(this.m)),L._forceRed(this)},ne.prototype.invm=function(d){var y=this.imod(d._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(typeof Pl=="undefined"||Pl,Eg)});var Pn=C((DK,Sg)=>{Sg.exports=Ag;function Ag(t,e){if(!t)throw new Error(e||"Assertion failed")}Ag.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)}});var Nl=C(_g=>{"use strict";var Of=_g;function PT(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t!="string"){for(var i=0;i>8,a=n&255;s?r.push(s,a):r.push(a)}return r}Of.toArray=PT;function Cg(t){return t.length===1?"0"+t:t}Of.zero2=Cg;function Ig(t){for(var e="",r=0;r{"use strict";var si=Tg,NT=Ii(),MT=Pn(),Df=Nl();si.assert=MT;si.toArray=Df.toArray;si.zero2=Df.zero2;si.toHex=Df.toHex;si.encode=Df.encode;function OT(t,e,r){var i=new Array(Math.max(t.bitLength(),r)+1);i.fill(0);for(var n=1<(n>>1)-1?o=(n>>1)-c:o=c,s.isubn(o)):o=0,i[a]=o,s.iushrn(1)}return i}si.getNAF=OT;function DT(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var i=0,n=0,s;t.cmpn(-i)>0||e.cmpn(-n)>0;){var a=t.andln(3)+i&3,o=e.andln(3)+n&3;a===3&&(a=-1),o===3&&(o=-1);var c;(a&1)==0?c=0:(s=t.andln(7)+i&7,(s===3||s===5)&&o===2?c=-a:c=a),r[0].push(c);var f;(o&1)==0?f=0:(s=e.andln(7)+n&7,(s===3||s===5)&&a===2?f=-o:f=o),r[1].push(f),2*i===c+1&&(i=1-i),2*n===f+1&&(n=1-n),t.iushrn(1),e.iushrn(1)}return r}si.getJSF=DT;function LT(t,e,r){var i="_"+e;t.prototype[e]=function(){return this[i]!==void 0?this[i]:this[i]=r.call(this)}}si.cachedProperty=LT;function qT(t){return typeof t=="string"?si.toArray(t,"hex"):t}si.parseBytes=qT;function UT(t){return new NT(t,"hex","le")}si.intFromLE=UT});var Ll=C((UK,Ml)=>{var Ol;Ml.exports=function(e){return Ol||(Ol=new Nn(null)),Ol.generate(e)};function Nn(t){this.rand=t}Ml.exports.Rand=Nn;Nn.prototype.generate=function(e){return this._rand(e)};Nn.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),i=0;i{"use strict";var Es=Ii(),$o=Tr(),Lf=$o.getNAF,FT=$o.getJSF,qf=$o.assert;function Mn(t,e){this.type=t,this.p=new Es(e.p,16),this.red=e.prime?Es.red(e.prime):Es.mont(this.p),this.zero=new Es(0).toRed(this.red),this.one=new Es(1).toRed(this.red),this.two=new Es(2).toRed(this.red),this.n=e.n&&new Es(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}kg.exports=Mn;Mn.prototype.point=function(){throw new Error("Not implemented")};Mn.prototype.validate=function(){throw new Error("Not implemented")};Mn.prototype._fixedNafMul=function(e,r){qf(e.precomputed);var i=e._getDoubles(),n=Lf(r,1,this._bitLength),s=(1<=o;f--)c=(c<<1)+n[f];a.push(c)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),b=s;b>0;b--){for(o=0;o=0;c--){for(var f=0;c>=0&&a[c]===0;c--)f++;if(c>=0&&f++,o=o.dblp(f),c<0)break;var u=a[c];qf(u!==0),e.type==="affine"?u>0?o=o.mixedAdd(s[u-1>>1]):o=o.mixedAdd(s[-u-1>>1].neg()):u>0?o=o.add(s[u-1>>1]):o=o.add(s[-u-1>>1].neg())}return e.type==="affine"?o.toP():o};Mn.prototype._wnafMulAdd=function(e,r,i,n,s){var a=this._wnafT1,o=this._wnafT2,c=this._wnafT3,f=0,u,l,b;for(u=0;u=1;u-=2){var g=u-1,A=u;if(a[g]!==1||a[A]!==1){c[g]=Lf(i[g],a[g],this._bitLength),c[A]=Lf(i[A],a[A],this._bitLength),f=Math.max(c[g].length,f),f=Math.max(c[A].length,f);continue}var F=[r[g],null,null,r[A]];r[g].y.cmp(r[A].y)===0?(F[1]=r[g].add(r[A]),F[2]=r[g].toJ().mixedAdd(r[A].neg())):r[g].y.cmp(r[A].y.redNeg())===0?(F[1]=r[g].toJ().mixedAdd(r[A]),F[2]=r[g].add(r[A].neg())):(F[1]=r[g].toJ().mixedAdd(r[A]),F[2]=r[g].toJ().mixedAdd(r[A].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],K=FT(i[g],i[A]);for(f=Math.max(K[0].length,f),c[g]=new Array(f),c[A]=new Array(f),l=0;l=0;u--){for(var J=0;u>=0;){var se=!0;for(l=0;l=0&&J++,$=$.dblp(J),u<0)break;for(l=0;l0?b=o[l][ne-1>>1]:ne<0&&(b=o[l][-ne-1>>1].neg()),b.type==="affine"?$=$.mixedAdd(b):$=$.add(b))}}for(u=0;u=Math.ceil((e.bitLength()+1)/r.step):!1};Kr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s{typeof Object.create=="function"?ql.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ql.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var Bg=C((VK,Rg)=>{"use strict";var KT=Tr(),Bt=Ii(),Ul=Wo(),va=Yo(),VT=KT.assert;function Vr(t){va.call(this,"short",t),this.a=new Bt(t.a,16).toRed(this.red),this.b=new Bt(t.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(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Ul(Vr,va);Rg.exports=Vr;Vr.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new Bt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new Bt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],VT(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var a;return e.basis?a=e.basis.map(function(o){return{a:new Bt(o.a,16),b:new Bt(o.b,16)}}):a=this._getEndoBasis(i),{beta:r,lambda:i,basis:a}}};Vr.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:Bt.mont(e),i=new Bt(2).toRed(r).redInvm(),n=i.redNeg(),s=new Bt(3).toRed(r).redNeg().redSqrt().redMul(i),a=n.redAdd(s).fromRed(),o=n.redSub(s).fromRed();return[a,o]};Vr.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new Bt(1),a=new Bt(0),o=new Bt(0),c=new Bt(1),f,u,l,b,p,g,A,F=0,B,K;i.cmpn(0)!==0;){var V=n.div(i);B=n.sub(V.mul(i)),K=o.sub(V.mul(s));var Q=c.sub(V.mul(a));if(!l&&B.cmp(r)<0)f=A.neg(),u=s,l=B.neg(),b=K;else if(l&&++F==2)break;A=B,n=i,i=B,o=s,s=K,c=a,a=Q}p=B.neg(),g=K;var $=l.sqr().add(b.sqr()),Y=p.sqr().add(g.sqr());return Y.cmp($)>=0&&(p=f,g=u),l.negative&&(l=l.neg(),b=b.neg()),p.negative&&(p=p.neg(),g=g.neg()),[{a:l,b},{a:p,b:g}]};Vr.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),a=i.b.neg().mul(e).divRound(this.n),o=s.mul(i.a),c=a.mul(n.a),f=s.mul(i.b),u=a.mul(n.b),l=e.sub(o).sub(c),b=f.add(u).neg();return{k1:l,k2:b}};Vr.prototype.pointFromX=function(e,r){e=new Bt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)};Vr.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0};Vr.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,a=0;a":""};Jt.prototype.isInfinity=function(){return this.inf};Jt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)};Jt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),a=s.redSqr().redISub(this.x.redAdd(this.x)),o=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)};Jt.prototype.getX=function(){return this.x.fromRed()};Jt.prototype.getY=function(){return this.y.fromRed()};Jt.prototype.mul=function(e){return e=new Bt(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)};Jt.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)};Jt.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)};Jt.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)};Jt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r};Jt.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 ar(t,e,r,i){va.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Bt(0)):(this.x=new Bt(e,16),this.y=new Bt(r,16),this.z=new Bt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ul(ar,va.BasePoint);Vr.prototype.jpoint=function(e,r,i){return new ar(this,e,r,i)};ar.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)};ar.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};ar.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),a=this.y.redMul(r.redMul(e.z)),o=e.y.redMul(i.redMul(this.z)),c=n.redSub(s),f=a.redSub(o);if(c.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=c.redSqr(),l=u.redMul(c),b=n.redMul(u),p=f.redSqr().redIAdd(l).redISub(b).redISub(b),g=f.redMul(b.redISub(p)).redISub(a.redMul(l)),A=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(p,g,A)};ar.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,a=e.y.redMul(r).redMul(this.z),o=i.redSub(n),c=s.redSub(a);if(o.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),u=f.redMul(o),l=i.redMul(f),b=c.redSqr().redIAdd(u).redISub(l).redISub(l),p=c.redMul(l.redISub(b)).redISub(s.redMul(u)),g=this.z.redMul(o);return this.curve.jpoint(b,p,g)};ar.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}};ar.prototype.inspect=function(){return this.isInfinity()?"":""};ar.prototype.isInfinity=function(){return this.z.cmpn(0)===0}});var Mg=C((zK,Pg)=>{"use strict";var ma=Ii(),Ng=Wo(),Uf=Yo(),zT=Tr();function xa(t){Uf.call(this,"mont",t),this.a=new ma(t.a,16).toRed(this.red),this.b=new ma(t.b,16).toRed(this.red),this.i4=new ma(4).toRed(this.red).redInvm(),this.two=new ma(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}Ng(xa,Uf);Pg.exports=xa;xa.prototype.validate=function(e){var r=e.normalize().x,i=r.redSqr(),n=i.redMul(r).redAdd(i.redMul(this.a)).redAdd(r),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Xt(t,e,r){Uf.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new ma(e,16),this.z=new ma(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Ng(Xt,Uf.BasePoint);xa.prototype.decodePoint=function(e,r){return this.point(zT.toArray(e,r),1)};xa.prototype.point=function(e,r){return new Xt(this,e,r)};xa.prototype.pointFromJSON=function(e){return Xt.fromJSON(this,e)};Xt.prototype.precompute=function(){};Xt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Xt.fromJSON=function(e,r){return new Xt(e,r[0],r[1]||e.one)};Xt.prototype.inspect=function(){return this.isInfinity()?"":""};Xt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Xt.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=r.redSub(n),a=r.redMul(n),o=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,o)};Xt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Xt.prototype.diffAdd=function(e,r){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),o=a.redMul(i),c=s.redMul(n),f=r.z.redMul(o.redAdd(c).redSqr()),u=r.x.redMul(o.redISub(c).redSqr());return this.curve.point(f,u)};Xt.prototype.mul=function(e){for(var r=e.clone(),i=this,n=this.curve.point(null,null),s=this,a=[];r.cmpn(0)!==0;r.iushrn(1))a.push(r.andln(1));for(var o=a.length-1;o>=0;o--)a[o]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n};Xt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Xt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Xt.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Xt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Xt.prototype.getX=function(){return this.normalize(),this.x.fromRed()}});var Lg=C((jK,Og)=>{"use strict";var jT=Tr(),en=Ii(),Dg=Wo(),Ff=Yo(),HT=jT.assert;function Ti(t){this.twisted=(t.a|0)!=1,this.mOneA=this.twisted&&(t.a|0)==-1,this.extended=this.mOneA,Ff.call(this,"edwards",t),this.a=new en(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new en(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new en(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),HT(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)==1}Dg(Ti,Ff);Og.exports=Ti;Ti.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};Ti.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};Ti.prototype.jpoint=function(e,r,i,n){return this.point(e,r,i,n)};Ti.prototype.pointFromX=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),a=n.redMul(s.redInvm()),o=a.redSqrt();if(o.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var c=o.fromRed().isOdd();return(r&&!c||!r&&c)&&(o=o.redNeg()),this.point(e,o)};Ti.prototype.pointFromY=function(e,r){e=new en(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),a=n.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var o=a.redSqrt();if(o.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return o.fromRed().isOdd()!==r&&(o=o.redNeg()),this.point(o,e)};Ti.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),i=e.y.redSqr(),n=r.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(i)));return n.cmp(s)===0};function at(t,e,r,i,n){Ff.BasePoint.call(this,t,"projective"),e===null&&r===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 en(e,16),this.y=new en(r,16),this.z=i?new en(i,16):this.curve.one,this.t=n&&new en(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}Dg(at,Ff.BasePoint);Ti.prototype.pointFromJSON=function(e){return at.fromJSON(this,e)};Ti.prototype.point=function(e,r,i,n){return new at(this,e,r,i,n)};at.fromJSON=function(e,r){return new at(e,r[0],r[1],r[2])};at.prototype.inspect=function(){return this.isInfinity()?"":""};at.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};at.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),a=n.redAdd(r),o=a.redSub(i),c=n.redSub(r),f=s.redMul(o),u=a.redMul(c),l=s.redMul(c),b=o.redMul(a);return this.curve.point(f,u,b,l)};at.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),i=this.y.redSqr(),n,s,a,o,c,f;if(this.curve.twisted){o=this.curve._mulA(r);var u=o.redAdd(i);this.zOne?(n=e.redSub(r).redSub(i).redMul(u.redSub(this.curve.two)),s=u.redMul(o.redSub(i)),a=u.redSqr().redSub(u).redSub(u)):(c=this.z.redSqr(),f=u.redSub(c).redISub(c),n=e.redSub(r).redISub(i).redMul(f),s=u.redMul(o.redSub(i)),a=u.redMul(f))}else o=r.redAdd(i),c=this.curve._mulC(this.z).redSqr(),f=o.redSub(c).redSub(c),n=this.curve._mulC(e.redISub(o)).redMul(f),s=this.curve._mulC(o).redMul(r.redISub(i)),a=o.redMul(f);return this.curve.point(n,s,a)};at.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};at.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=i.redSub(r),o=s.redSub(n),c=s.redAdd(n),f=i.redAdd(r),u=a.redMul(o),l=c.redMul(f),b=a.redMul(f),p=o.redMul(c);return this.curve.point(u,l,p,b)};at.prototype._projAdd=function(e){var r=this.z.redMul(e.z),i=r.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(n).redMul(s),o=i.redSub(a),c=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),u=r.redMul(o).redMul(f),l,b;return this.curve.twisted?(l=r.redMul(c).redMul(s.redSub(this.curve._mulA(n))),b=o.redMul(c)):(l=r.redMul(c).redMul(s.redSub(n)),b=this.curve._mulC(o).redMul(c)),this.curve.point(u,l,b)};at.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};at.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};at.prototype.mulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!1)};at.prototype.jmulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!0)};at.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};at.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};at.prototype.getX=function(){return this.normalize(),this.x.fromRed()};at.prototype.getY=function(){return this.normalize(),this.y.fromRed()};at.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};at.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===0)return!0}};at.prototype.toP=at.prototype.normalize;at.prototype.mixedAdd=at.prototype.add});var Fl=C(qg=>{"use strict";var Kf=qg;Kf.base=Yo();Kf.short=Bg();Kf.mont=Mg();Kf.edwards=Lg()});var ai=C(rt=>{"use strict";var GT=Pn(),$T=Wo();rt.inherits=$T;function YT(t,e){return(t.charCodeAt(e)&64512)!=55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)==56320}function WT(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!=0&&(t="0"+t),n=0;n>6|192,r[i++]=s&63|128):YT(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}rt.htonl=Fg;function JT(t,e){for(var r="",i=0;i>>0}return s}rt.join32=XT;function ZT(t,e){for(var r=new Array(t.length*4),i=0,n=0;i>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}rt.split32=ZT;function ek(t,e){return t>>>e|t<<32-e}rt.rotr32=ek;function tk(t,e){return t<>>32-e}rt.rotl32=tk;function rk(t,e){return t+e>>>0}rt.sum32=rk;function ik(t,e,r){return t+e+r>>>0}rt.sum32_3=ik;function nk(t,e,r,i){return t+e+r+i>>>0}rt.sum32_4=nk;function sk(t,e,r,i,n){return t+e+r+i+n>>>0}rt.sum32_5=sk;function ak(t,e,r,i){var n=t[e],s=t[e+1],a=i+s>>>0,o=(a>>0,t[e+1]=a}rt.sum64=ak;function ok(t,e,r,i){var n=e+i>>>0,s=(n>>0}rt.sum64_hi=ok;function ck(t,e,r,i){var n=e+i;return n>>>0}rt.sum64_lo=ck;function fk(t,e,r,i,n,s,a,o){var c=0,f=e;f=f+i>>>0,c+=f>>0,c+=f>>0,c+=f>>0}rt.sum64_4_hi=fk;function uk(t,e,r,i,n,s,a,o){var c=e+i+s+o;return c>>>0}rt.sum64_4_lo=uk;function lk(t,e,r,i,n,s,a,o,c,f){var u=0,l=e;l=l+i>>>0,u+=l>>0,u+=l>>0,u+=l>>0,u+=l>>0}rt.sum64_5_hi=lk;function dk(t,e,r,i,n,s,a,o,c,f){var u=e+i+s+o+f;return u>>>0}rt.sum64_5_lo=dk;function hk(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}rt.rotr64_hi=hk;function pk(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}rt.rotr64_lo=pk;function bk(t,e,r){return t>>>r}rt.shr64_hi=bk;function yk(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}rt.shr64_lo=yk});var wa=C(Vg=>{"use strict";var zg=ai(),gk=Pn();function Vf(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Vg.BlockHash=Vf;Vf.prototype.update=function(e,r){if(e=zg.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=zg.join32(e,0,e.length-i,this.endian);for(var n=0;n>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,a=8;a{"use strict";var vk=ai(),ki=vk.rotr32;function mk(t,e,r,i){if(t===0)return jg(e,r,i);if(t===1||t===3)return Gg(e,r,i);if(t===2)return Hg(e,r,i)}tn.ft_1=mk;function jg(t,e,r){return t&e^~t&r}tn.ch32=jg;function Hg(t,e,r){return t&e^t&r^e&r}tn.maj32=Hg;function Gg(t,e,r){return t^e^r}tn.p32=Gg;function xk(t){return ki(t,2)^ki(t,13)^ki(t,22)}tn.s0_256=xk;function wk(t){return ki(t,6)^ki(t,11)^ki(t,25)}tn.s1_256=wk;function Ek(t){return ki(t,7)^ki(t,18)^t>>>3}tn.g0_256=Ek;function Sk(t){return ki(t,17)^ki(t,19)^t>>>10}tn.g1_256=Sk});var Wg=C((WK,$g)=>{"use strict";var Ea=ai(),Ak=wa(),_k=Kl(),Vl=Ea.rotl32,Qo=Ea.sum32,Ck=Ea.sum32_5,Ik=_k.ft_1,Yg=Ak.BlockHash,Tk=[1518500249,1859775393,2400959708,3395469782];function Ri(){if(!(this instanceof Ri))return new Ri;Yg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ea.inherits(Ri,Yg);$g.exports=Ri;Ri.blockSize=512;Ri.outSize=160;Ri.hmacStrength=80;Ri.padLength=64;Ri.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n{"use strict";var Sa=ai(),kk=wa(),Aa=Kl(),Rk=Pn(),oi=Sa.sum32,Bk=Sa.sum32_4,Pk=Sa.sum32_5,Nk=Aa.ch32,Mk=Aa.maj32,Ok=Aa.s0_256,Dk=Aa.s1_256,Lk=Aa.g0_256,qk=Aa.g1_256,Jg=kk.BlockHash,Uk=[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 Bi(){if(!(this instanceof Bi))return new Bi;Jg.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Uk,this.W=new Array(64)}Sa.inherits(Bi,Jg);Qg.exports=Bi;Bi.blockSize=512;Bi.outSize=256;Bi.hmacStrength=192;Bi.padLength=64;Bi.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n{"use strict";var jl=ai(),Zg=zl();function rn(){if(!(this instanceof rn))return new rn;Zg.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}jl.inherits(rn,Zg);Xg.exports=rn;rn.blockSize=512;rn.outSize=224;rn.hmacStrength=192;rn.padLength=64;rn.prototype._digest=function(e){return e==="hex"?jl.toHex32(this.h.slice(0,7),"big"):jl.split32(this.h.slice(0,7),"big")}});var $l=C((XK,tv)=>{"use strict";var Sr=ai(),Fk=wa(),Kk=Pn(),Pi=Sr.rotr64_hi,Ni=Sr.rotr64_lo,rv=Sr.shr64_hi,iv=Sr.shr64_lo,On=Sr.sum64,Hl=Sr.sum64_hi,Gl=Sr.sum64_lo,Vk=Sr.sum64_4_hi,zk=Sr.sum64_4_lo,jk=Sr.sum64_5_hi,Hk=Sr.sum64_5_lo,nv=Fk.BlockHash,Gk=[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 ci(){if(!(this instanceof ci))return new ci;nv.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Gk,this.W=new Array(160)}Sr.inherits(ci,nv);tv.exports=ci;ci.blockSize=1024;ci.outSize=512;ci.hmacStrength=192;ci.padLength=128;ci.prototype._prepareBlock=function(e,r){for(var i=this.W,n=0;n<32;n++)i[n]=e[r+n];for(;n{"use strict";var Yl=ai(),av=$l();function nn(){if(!(this instanceof nn))return new nn;av.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Yl.inherits(nn,av);sv.exports=nn;nn.blockSize=1024;nn.outSize=384;nn.hmacStrength=192;nn.padLength=128;nn.prototype._digest=function(e){return e==="hex"?Yl.toHex32(this.h.slice(0,12),"big"):Yl.split32(this.h.slice(0,12),"big")}});var cv=C(_a=>{"use strict";_a.sha1=Wg();_a.sha224=ev();_a.sha256=zl();_a.sha384=ov();_a.sha512=$l()});var pv=C(fv=>{"use strict";var Ss=ai(),sR=wa(),zf=Ss.rotl32,uv=Ss.sum32,Jo=Ss.sum32_3,lv=Ss.sum32_4,dv=sR.BlockHash;function Mi(){if(!(this instanceof Mi))return new Mi;dv.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Ss.inherits(Mi,dv);fv.ripemd160=Mi;Mi.blockSize=512;Mi.outSize=160;Mi.hmacStrength=192;Mi.padLength=64;Mi.prototype._update=function(e,r){for(var i=this.h[0],n=this.h[1],s=this.h[2],a=this.h[3],o=this.h[4],c=i,f=n,u=s,l=a,b=o,p=0;p<80;p++){var g=uv(zf(lv(i,hv(p,n,s,a),e[cR[p]+r],aR(p)),uR[p]),o);i=o,o=a,a=zf(s,10),s=n,n=g,g=uv(zf(lv(c,hv(79-p,f,u,l),e[fR[p]+r],oR(p)),lR[p]),b),c=b,b=l,l=zf(u,10),u=f,f=g}g=Jo(this.h[1],s,l),this.h[1]=Jo(this.h[2],a,b),this.h[2]=Jo(this.h[3],o,c),this.h[3]=Jo(this.h[4],i,f),this.h[4]=Jo(this.h[0],n,u),this.h[0]=g};Mi.prototype._digest=function(e){return e==="hex"?Ss.toHex32(this.h,"little"):Ss.split32(this.h,"little")};function hv(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function aR(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function oR(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var cR=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],fR=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],uR=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],lR=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var yv=C((rV,bv)=>{"use strict";var dR=ai(),hR=Pn();function Ca(t,e,r){if(!(this instanceof Ca))return new Ca(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(dR.toArray(e,r))}bv.exports=Ca;Ca.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),hR(e.length<=this.blockSize);for(var r=e.length;r{var or=gv;or.utils=ai();or.common=wa();or.sha=cv();or.ripemd=pv();or.hmac=yv();or.sha1=or.sha.sha1;or.sha256=or.sha.sha256;or.sha224=or.sha.sha224;or.sha384=or.sha.sha384;or.sha512=or.sha.sha512;or.ripemd160=or.ripemd.ripemd160});var mv=C((nV,vv)=>{vv.exports={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"]]}}});var Hf=C(xv=>{"use strict";var Wl=xv,Dn=jf(),Ql=Fl(),pR=Tr(),wv=pR.assert;function Ev(t){t.type==="short"?this.curve=new Ql.short(t):t.type==="edwards"?this.curve=new Ql.edwards(t):this.curve=new Ql.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,wv(this.g.validate(),"Invalid curve"),wv(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}Wl.PresetCurve=Ev;function Ln(t,e){Object.defineProperty(Wl,t,{configurable:!0,enumerable:!0,get:function(){var r=new Ev(e);return Object.defineProperty(Wl,t,{configurable:!0,enumerable:!0,value:r}),r}})}Ln("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:Dn.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});Ln("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:Dn.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});Ln("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:Dn.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});Ln("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:Dn.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"]});Ln("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:Dn.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"]});Ln("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Dn.sha256,gRed:!1,g:["9"]});Ln("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:Dn.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var Jl;try{Jl=mv()}catch(t){Jl=void 0}Ln("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:Dn.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",Jl]})});var _v=C((aV,Sv)=>{"use strict";var bR=jf(),As=Nl(),Av=Pn();function qn(t){if(!(this instanceof qn))return new qn(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=As.toArray(t.entropy,t.entropyEnc||"hex"),r=As.toArray(t.nonce,t.nonceEnc||"hex"),i=As.toArray(t.pers,t.persEnc||"hex");Av(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}Sv.exports=qn;qn.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};qn.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=As.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length{"use strict";var yR=Ii(),gR=Tr(),Xl=gR.assert;function lr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}Cv.exports=lr;lr.fromPublic=function(e,r,i){return r instanceof lr?r:new lr(e,{pub:r,pubEnc:i})};lr.fromPrivate=function(e,r,i){return r instanceof lr?r:new lr(e,{priv:r,privEnc:i})};lr.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"}};lr.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};lr.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};lr.prototype._importPrivate=function(e,r){this.priv=new yR(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};lr.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?Xl(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Xl(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,r)};lr.prototype.derive=function(e){return e.validate()||Xl(e.validate(),"public point not validated"),e.mul(this.priv).getX()};lr.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)};lr.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};lr.prototype.inspect=function(){return""}});var Rv=C((cV,Tv)=>{"use strict";var Gf=Ii(),Zl=Tr(),vR=Zl.assert;function $f(t,e){if(t instanceof $f)return t;this._importDER(t,e)||(vR(t.r&&t.s,"Signature without r or s"),this.r=new Gf(t.r,16),this.s=new Gf(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}Tv.exports=$f;function mR(){this.place=0}function ed(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,s=0,a=e.place;s>>=0;return n<=127?!1:(e.place=a,n)}function kv(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}$f.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=kv(r),i=kv(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];td(n,r.length),n=n.concat(r),n.push(2),td(n,i.length);var s=n.concat(i),a=[48];return td(a,s.length),a=a.concat(s),Zl.encode(a,e)}});var Mv=C((fV,Bv)=>{"use strict";var _s=Ii(),Pv=_v(),xR=Tr(),rd=Hf(),wR=Ll(),Nv=xR.assert,id=Iv(),Yf=Rv();function zr(t){if(!(this instanceof zr))return new zr(t);typeof t=="string"&&(Nv(Object.prototype.hasOwnProperty.call(rd,t),"Unknown curve "+t),t=rd[t]),t instanceof rd.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}Bv.exports=zr;zr.prototype.keyPair=function(e){return new id(this,e)};zr.prototype.keyFromPrivate=function(e,r){return id.fromPrivate(this,e,r)};zr.prototype.keyFromPublic=function(e,r){return id.fromPublic(this,e,r)};zr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Pv({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||wR(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new _s(2));;){var s=new _s(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}};zr.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};zr.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new _s(e,16));for(var s=this.n.byteLength(),a=r.getPrivate().toArray("be",s),o=e.toArray("be",s),c=new Pv({hash:this.hash,entropy:a,nonce:o,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new _s(1)),u=0;;u++){var l=n.k?n.k(u):new _s(c.generate(this.n.byteLength()));if(l=this._truncateToN(l,!0),!(l.cmpn(1)<=0||l.cmp(f)>=0)){var b=this.g.mul(l);if(!b.isInfinity()){var p=b.getX(),g=p.umod(this.n);if(g.cmpn(0)!==0){var A=l.invm(this.n).mul(g.mul(r.getPrivate()).iadd(e));if(A=A.umod(this.n),A.cmpn(0)!==0){var F=(b.getY().isOdd()?1:0)|(p.cmp(g)!==0?2:0);return n.canonical&&A.cmp(this.nh)>0&&(A=this.n.sub(A),F^=1),new Yf({r:g,s:A,recoveryParam:F})}}}}}};zr.prototype.verify=function(e,r,i,n){e=this._truncateToN(new _s(e,16)),i=this.keyFromPublic(i,n),r=new Yf(r,"hex");var s=r.r,a=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var o=a.invm(this.n),c=o.mul(e).umod(this.n),f=o.mul(s).umod(this.n),u;return this.curve._maxwellTrick?(u=this.g.jmulAdd(c,i.getPublic(),f),u.isInfinity()?!1:u.eqXToP(s)):(u=this.g.mulAdd(c,i.getPublic(),f),u.isInfinity()?!1:u.getX().umod(this.n).cmp(s)===0)};zr.prototype.recoverPubKey=function(t,e,r,i){Nv((3&r)===r,"The recovery param is more than two bits"),e=new Yf(e,i);var n=this.n,s=new _s(t),a=e.r,o=e.s,c=r&1,f=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");f?a=this.curve.pointFromX(a.add(this.curve.n),c):a=this.curve.pointFromX(a,c);var u=e.r.invm(n),l=n.sub(s).mul(u).umod(n),b=o.mul(u).umod(n);return this.g.mulAdd(l,a,b)};zr.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new Yf(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch(a){continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")}});var qv=C((uV,Ov)=>{"use strict";var Xo=Tr(),Dv=Xo.assert,Lv=Xo.parseBytes,Ia=Xo.cachedProperty;function Zt(t,e){this.eddsa=t,this._secret=Lv(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=Lv(e.pub)}Zt.fromPublic=function(e,r){return r instanceof Zt?r:new Zt(e,{pub:r})};Zt.fromSecret=function(e,r){return r instanceof Zt?r:new Zt(e,{secret:r})};Zt.prototype.secret=function(){return this._secret};Ia(Zt,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Ia(Zt,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Ia(Zt,"privBytes",function(){var e=this.eddsa,r=this.hash(),i=e.encodingLength-1,n=r.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n});Ia(Zt,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Ia(Zt,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Ia(Zt,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Zt.prototype.sign=function(e){return Dv(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Zt.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Zt.prototype.getSecret=function(e){return Dv(this._secret,"KeyPair is public only"),Xo.encode(this.secret(),e)};Zt.prototype.getPublic=function(e){return Xo.encode(this.pubBytes(),e)};Ov.exports=Zt});var Fv=C((lV,Uv)=>{"use strict";var ER=Ii(),Wf=Tr(),SR=Wf.assert,Qf=Wf.cachedProperty,AR=Wf.parseBytes;function Cs(t,e){this.eddsa=t,typeof e!="object"&&(e=AR(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),SR(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof ER&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}Qf(Cs,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Qf(Cs,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Qf(Cs,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Qf(Cs,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Cs.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Cs.prototype.toHex=function(){return Wf.encode(this.toBytes(),"hex").toUpperCase()};Uv.exports=Cs});var Hv=C((dV,Kv)=>{"use strict";var _R=jf(),CR=Hf(),Ta=Tr(),IR=Ta.assert,Vv=Ta.parseBytes,zv=qv(),jv=Fv();function Ar(t){if(IR(t==="ed25519","only tested with ed25519 so far"),!(this instanceof Ar))return new Ar(t);t=CR[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=_R.sha512}Kv.exports=Ar;Ar.prototype.sign=function(e,r){e=Vv(e);var i=this.keyFromSecret(r),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),a=this.encodePoint(s),o=this.hashInt(a,i.pubBytes(),e).mul(i.priv()),c=n.add(o).umod(this.curve.n);return this.makeSignature({R:s,S:c,Rencoded:a})};Ar.prototype.verify=function(e,r,i){e=Vv(e),r=this.makeSignature(r);var n=this.keyFromPublic(i),s=this.hashInt(r.Rencoded(),n.pubBytes(),e),a=this.g.mul(r.S()),o=r.R().add(n.pub().mul(s));return o.eq(a)};Ar.prototype.hashInt=function(){for(var e=this.hash(),r=0;r{"use strict";var Is=Gv;Is.version=xg().version;Is.utils=Tr();Is.rand=Ll();Is.curve=Fl();Is.curves=Hf();Is.ec=Mv();Is.eddsa=Hv()});var Wv=C((pV,Yv)=>{var TR=$v().ec,Oi=new TR("secp256k1"),Ke=Oi.curve,it=Ke.n.constructor;function kR(t,e){let r=new it(e);if(r.cmp(Ke.p)>=0)return null;r=r.toRed(Ke.red);let i=r.redSqr().redIMul(r).redIAdd(Ke.b).redSqrt();return t===3!==i.isOdd()&&(i=i.redNeg()),Oi.keyPair({pub:{x:r,y:i}})}function RR(t,e,r){let i=new it(e),n=new it(r);if(i.cmp(Ke.p)>=0||n.cmp(Ke.p)>=0||(i=i.toRed(Ke.red),n=n.toRed(Ke.red),(t===6||t===7)&&n.isOdd()!==(t===7)))return null;let s=i.redSqr().redIMul(i);return n.redSqr().redISub(s.redIAdd(Ke.b)).isZero()?Oi.keyPair({pub:{x:i,y:n}}):null}function Un(t){let e=t[0];switch(e){case 2:case 3:return t.length!==33?null:kR(e,t.subarray(1,33));case 4:case 6:case 7:return t.length!==65?null:RR(e,t.subarray(1,33),t.subarray(33,65));default:return null}}function Ts(t,e){let r=e.encode(null,t.length===33);for(let i=0;i=0||(r.iadd(new it(t)),r.cmp(Ke.n)>=0&&r.isub(Ke.n),r.isZero()))return 1;let i=r.toArrayLike(Uint8Array,"be",32);return t.set(i),0},privateKeyTweakMul(t,e){let r=new it(e);if(r.cmp(Ke.n)>=0||r.isZero())return 1;r.imul(new it(t)),r.cmp(Ke.n)>=0&&(r=r.umod(Ke.n));let i=r.toArrayLike(Uint8Array,"be",32);return t.set(i),0},publicKeyVerify(t){return Un(t)===null?1:0},publicKeyCreate(t,e){let r=new it(e);if(r.cmp(Ke.n)>=0||r.isZero())return 1;let i=Oi.keyFromPrivate(e).getPublic();return Ts(t,i),0},publicKeyConvert(t,e){let r=Un(e);if(r===null)return 1;let i=r.getPublic();return Ts(t,i),0},publicKeyNegate(t,e){let r=Un(e);if(r===null)return 1;let i=r.getPublic();return i.y=i.y.redNeg(),Ts(t,i),0},publicKeyCombine(t,e){let r=new Array(e.length);for(let n=0;n=0)return 2;let n=i.getPublic().add(Ke.g.mul(r));return n.isInfinity()?2:(Ts(t,n),0)},publicKeyTweakMul(t,e,r){let i=Un(e);if(i===null)return 1;if(r=new it(r),r.cmp(Ke.n)>=0||r.isZero())return 2;let n=i.getPublic().mul(r);return Ts(t,n),0},signatureNormalize(t){let e=new it(t.subarray(0,32)),r=new it(t.subarray(32,64));return e.cmp(Ke.n)>=0||r.cmp(Ke.n)>=0?1:(r.cmp(Oi.nh)===1&&t.set(Ke.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(t,e){let r=e.subarray(0,32),i=e.subarray(32,64);if(new it(r).cmp(Ke.n)>=0||new it(i).cmp(Ke.n)>=0)return 1;let{output:n}=t,s=n.subarray(4,4+33);s[0]=0,s.set(r,1);let a=33,o=0;for(;a>1&&s[o]===0&&!(s[o+1]&128);--a,++o);if(s=s.subarray(o),s[0]&128||a>1&&s[0]===0&&!(s[1]&128))return 1;let c=n.subarray(6+33,6+33+33);c[0]=0,c.set(i,1);let f=33,u=0;for(;f>1&&c[u]===0&&!(c[u+1]&128);--f,++u);return c=c.subarray(u),c[0]&128||f>1&&c[0]===0&&!(c[1]&128)?1:(t.outputlen=6+a+f,n[0]=48,n[1]=t.outputlen-2,n[2]=2,n[3]=s.length,n.set(s,4),n[4+a]=2,n[5+a]=c.length,n.set(c,6+a),0)},signatureImport(t,e){if(e.length<8||e.length>72||e[0]!==48||e[1]!==e.length-2||e[2]!==2)return 1;let r=e[3];if(r===0||5+r>=e.length||e[4+r]!==2)return 1;let i=e[5+r];if(i===0||6+r+i!==e.length||e[4]&128||r>1&&e[4]===0&&!(e[5]&128)||e[r+6]&128||i>1&&e[r+6]===0&&!(e[r+7]&128))return 1;let n=e.subarray(4,4+r);if(n.length===33&&n[0]===0&&(n=n.subarray(1)),n.length>32)return 1;let s=e.subarray(6+r);if(s.length===33&&s[0]===0&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let a=new it(n);a.cmp(Ke.n)>=0&&(a=new it(0));let o=new it(e.subarray(6+r));return o.cmp(Ke.n)>=0&&(o=new it(0)),t.set(a.toArrayLike(Uint8Array,"be",32),0),t.set(o.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(t,e,r,i,n){if(n){let o=n;n=c=>{let f=o(e,r,null,i,c);if(!(f instanceof Uint8Array&&f.length===32))throw new Error("This is the way");return new it(f)}}let s=new it(r);if(s.cmp(Ke.n)>=0||s.isZero())return 1;let a;try{a=Oi.sign(e,r,{canonical:!0,k:n,pers:i})}catch(o){return 1}return t.signature.set(a.r.toArrayLike(Uint8Array,"be",32),0),t.signature.set(a.s.toArrayLike(Uint8Array,"be",32),32),t.recid=a.recoveryParam,0},ecdsaVerify(t,e,r){let i={r:t.subarray(0,32),s:t.subarray(32,64)},n=new it(i.r),s=new it(i.s);if(n.cmp(Ke.n)>=0||s.cmp(Ke.n)>=0)return 1;if(s.cmp(Oi.nh)===1||n.isZero()||s.isZero())return 3;let a=Un(r);if(a===null)return 2;let o=a.getPublic();return Oi.verify(e,i,o)?0:3},ecdsaRecover(t,e,r,i){let n={r:e.slice(0,32),s:e.slice(32,64)},s=new it(n.r),a=new it(n.s);if(s.cmp(Ke.n)>=0||a.cmp(Ke.n)>=0)return 1;if(s.isZero()||a.isZero())return 2;let o;try{o=Oi.recoverPubKey(i,n,r)}catch(c){return 2}return Ts(t,o),0},ecdh(t,e,r,i,n,s,a){let o=Un(e);if(o===null)return 1;let c=new it(r);if(c.cmp(Ke.n)>=0||c.isZero())return 2;let f=o.getPublic().mul(c);if(n===void 0){let u=f.encode(null,!0),l=Oi.hash().update(u).digest();for(let b=0;b<32;++b)t[b]=l[b]}else{s||(s=new Uint8Array(32));let u=f.getX().toArray("be",32);for(let g=0;g<32;++g)s[g]=u[g];a||(a=new Uint8Array(32));let l=f.getY().toArray("be",32);for(let g=0;g<32;++g)a[g]=l[g];let b=n(s,a,i);if(!(b instanceof Uint8Array&&b.length===t.length))return 2;t.set(b)}return 0}}});var Jv=C((bV,Qv)=>{Qv.exports=vg()(Wv())});var tm=C((yV,Xv)=>{"use strict";var fi=Jv(),Zv=la(),em="sha2-256";Xv.exports=t=>{let e=32;function r(){let u;do u=t(32);while(!fi.privateKeyVerify(u));return u}async function i(u,l){let b=await Zv.digest(l,em),p=fi.ecdsaSign(b,u);return fi.signatureExport(p.signature)}async function n(u,l,b){let p=await Zv.digest(b,em);return l=fi.signatureImport(l),fi.ecdsaVerify(l,p,u)}function s(u){if(!fi.publicKeyVerify(u))throw new Error("Invalid public key");return fi.publicKeyConvert(u,!0)}function a(u){return fi.publicKeyConvert(u,!1)}function o(u){if(!fi.privateKeyVerify(u))throw new Error("Invalid private key")}function c(u){if(!fi.publicKeyVerify(u))throw new Error("Invalid public key")}function f(u){return o(u),fi.publicKeyCreate(u)}return{generateKey:r,privateKeyLength:e,hashAndSign:i,hashAndVerify:n,compressPublicKey:s,decompressPublicKey:a,validatePrivateKey:o,validatePublicKey:c,computePublicKey:f}}});var sm=C((gV,rm)=>{"use strict";var im=la(),BR=Pe(),nm=Mr(),PR=Lt(),NR=kf();rm.exports=(t,e,r)=>{r=r||tm()(e);class i{constructor(f){r.validatePublicKey(f),this._key=f}verify(f,u){return r.hashAndVerify(this._key,u,f)}marshal(){return r.compressPublicKey(this._key)}get bytes(){return t.PublicKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(f){return nm(this.bytes,f.bytes)}hash(){return im.multihashing(this.bytes,"sha2-256")}}class n{constructor(f,u){this._key=f,this._publicKey=u||r.computePublicKey(f),r.validatePrivateKey(this._key),r.validatePublicKey(this._publicKey)}sign(f){return r.hashAndSign(this._key,f)}get public(){return new i(this._publicKey)}marshal(){return this._key}get bytes(){return t.PrivateKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(f){return nm(this.bytes,f.bytes)}hash(){return im.multihashing(this.bytes,"sha2-256")}async id(){let f=await this.public.hash();return PR(f,"base58btc")}async export(f,u="libp2p-key"){if(u==="libp2p-key")return NR.export(this.bytes,f);throw BR(new Error(`export format '${u}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function s(c){return new n(c)}function a(c){return new i(c)}async function o(){let c=await r.generateKey();return new n(c)}return{Secp256k1PublicKey:i,Secp256k1PrivateKey:n,unmarshalSecp256k1PrivateKey:s,unmarshalSecp256k1PublicKey:a,generateKeyPair:o}}});var om=C((vV,am)=>{"use strict";am.exports={SHA1:20,SHA256:32,SHA512:64}});var nd=C(cm=>{"use strict";var fm=Ko(),MR=om(),OR={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},DR=async(t,e)=>{let r=await fm.get().subtle.sign({name:"HMAC"},t,e);return new Uint8Array(r,r.byteOffset,r.byteLength)};cm.create=async function(t,e){let r=OR[t],i=await fm.get().subtle.importKey("raw",e,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{async digest(n){return DR(i,n)},length:MR[t]}}});var pm=C((xV,um)=>{"use strict";var lm=Pe(),dm=Zr(),LR=qt(),qR=nd(),hm={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};um.exports=async(t,e,r)=>{let i=hm[t];if(!i){let K=Object.keys(hm).join(" / ");throw lm(new Error(`unknown cipher type '${t}'. Must be ${K}`),"ERR_INVALID_CIPHER_TYPE")}if(!e)throw lm(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");let n=i.keySize,s=i.ivSize,a=20,o=LR("key expansion"),c=2*(s+n+a),f=await qR.create(e,r),u=await f.digest(o),l=[],b=0;for(;bc&&(V=c-b),l.push(K),b+=V,u=await f.digest(u)}let p=c/2,g=dm(l),A=g.slice(0,p),F=g.slice(p,c),B=K=>({iv:K.slice(0,s),cipherKey:K.slice(s,s+n),macKey:K.slice(s+n)});return{k1:B(A),k2:B(F)}}});var ym=C((wV,bm)=>{"use strict";var UR=Pe();bm.exports=function(t,e){if(!t.includes(e)){let r=t.join(" / ");throw UR(new Error(`Unknown curve: ${e}. Must be ${r}`),"ERR_INVALID_CURVE")}}});var Em=C(gm=>{"use strict";var FR=Pe(),Zo=Ko(),{base64urlToBuffer:vm}=Tf(),KR=ym(),sd=Lt(),VR=Zr(),zR=Mr(),mm={"P-256":256,"P-384":384,"P-521":521};gm.generateEphmeralKeyPair=async function(t){KR(Object.keys(mm),t);let e=await Zo.get().subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]),r=async(n,s)=>{let a;s?a=await Zo.get().subtle.importKey("jwk",HR(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):a=e.privateKey;let o=[await Zo.get().subtle.importKey("jwk",xm(t,n),{name:"ECDH",namedCurve:t},!1,[]),a],c=await Zo.get().subtle.deriveBits({name:"ECDH",namedCurve:t,public:o[0]},o[1],mm[t]);return new Uint8Array(c,c.byteOffset,c.byteLength)},i=await Zo.get().subtle.exportKey("jwk",e.publicKey);return{key:jR(i),genSharedKey:r}};var wm={"P-256":32,"P-384":48,"P-521":66};function jR(t){let e=wm[t.crv];return VR([Uint8Array.from([4]),vm(t.x,e),vm(t.y,e)],1+e*2)}function xm(t,e){let r=wm[t];if(zR(!e.slice(0,1),Uint8Array.from([4])))throw FR(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:t,x:sd(e.slice(1,r+1),"base64url"),y:sd(e.slice(1+r),"base64url"),ext:!0}}var HR=(t,e)=>({...xm(t,e.public),d:sd(e.private,"base64url")})});var Am=C((SV,Sm)=>{"use strict";var GR=Em();Sm.exports=async t=>GR.generateEphmeralKeyPair(t)});var Xf=C((AV,_m)=>{"use strict";var Di=sf();$i();gl();var ad=De(),ec=Pe(),$R=qt(),YR=Ay(),jr={rsa:fg(),ed25519:yg(),secp256k1:sm()(Di,If())},Jf={message:"secp256k1 support requires libp2p-crypto-secp256k1 package",code:"ERR_MISSING_PACKAGE"};function ka(t){let e=jr[t.toLowerCase()];if(!e){let r=Object.keys(jr).join(" / ");throw ec(new Error(`invalid or unsupported key type ${t}. Must be ${r}`),"ERR_UNSUPPORTED_KEY_TYPE")}return e}var WR=async(t,e)=>ka(t).generateKeyPair(e),QR=async(t,e,r)=>{let i=ka(t);if(t.toLowerCase()!=="ed25519")throw ec(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return i.generateKeyPairFromSeed(e,r)},JR=t=>{let e=Di.PublicKey.decode(t),r=e.Data;switch(e.Type){case Di.KeyType.RSA:return jr.rsa.unmarshalRsaPublicKey(r);case Di.KeyType.Ed25519:return jr.ed25519.unmarshalEd25519PublicKey(r);case Di.KeyType.Secp256k1:if(jr.secp256k1)return jr.secp256k1.unmarshalSecp256k1PublicKey(r);throw ec(new Error(Jf.message),Jf.code);default:ka(e.Type)}},XR=(t,e)=>(e=(e||"rsa").toLowerCase(),ka(e),t.bytes),Cm=async t=>{let e=Di.PrivateKey.decode(t),r=e.Data;switch(e.Type){case Di.KeyType.RSA:return jr.rsa.unmarshalRsaPrivateKey(r);case Di.KeyType.Ed25519:return jr.ed25519.unmarshalEd25519PrivateKey(r);case Di.KeyType.Secp256k1:if(jr.secp256k1)return jr.secp256k1.unmarshalSecp256k1PrivateKey(r);throw ec(new Error(Jf.message),Jf.code);default:ka(e.Type)}},ZR=(t,e)=>(e=(e||"rsa").toLowerCase(),ka(e),t.bytes),eB=async(t,e)=>{try{let n=await YR.import(t,e);return Cm(n)}catch(n){}let r=ad.pki.decryptRsaPrivateKey(t,e);if(r===null)throw ec(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let i=ad.asn1.toDer(ad.pki.privateKeyToAsn1(r));return i=$R(i.getBytes(),"ascii"),jr.rsa.unmarshalRsaPrivateKey(i)};_m.exports={supportedKeys:jr,keysPBM:Di,keyStretcher:pm(),generateEphemeralKeyPair:Am(),generateKeyPair:WR,generateKeyPairFromSeed:QR,unmarshalPublicKey:JR,marshalPublicKey:XR,unmarshalPrivateKey:Cm,marshalPrivateKey:ZR,import:eB}});var Im=C((_V,od)=>{"use strict";function tB(t,{className:e,symbolName:r}){let i=Symbol.for(r),n={[e]:class extends t{constructor(...s){super(...s);Object.defineProperty(this,i,{value:!0})}get[Symbol.toStringTag](){return e}}}[e];return n[`is${e}`]=s=>!!(s&&s[i]),n}function rB(t,{className:e,symbolName:r,withoutNew:i}){let n=Symbol.for(r),s={[e]:function(...a){if(i&&!(this instanceof s))return new s(...a);let o=t.call(this,...a)||this;return o&&!o[n]&&Object.defineProperty(o,n,{value:!0}),o}}[e];return s.prototype=Object.create(t.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get(){return e}}),s[`is${e}`]=a=>!!(a&&a[n]),s}od.exports=tB;od.exports.proto=rB});var Rm=C((CV,Tm)=>{"use strict";var Ra=Gi(),km=Ra.Reader,iB=Ra.Writer,Vt=Ra.util,tc=Ra.roots["libp2p-peer-id"]||(Ra.roots["libp2p-peer-id"]={});tc.PeerIdProto=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.id=r.bytes();break;case 2:s.pubKey=r.bytes();break;case 3:s.privKey=r.bytes();break;default:r.skipType(a&7);break}}if(!s.hasOwnProperty("id"))throw Vt.ProtocolError("missing required 'id'",{instance:s});return s},t.fromObject=function(r){if(r instanceof tc.PeerIdProto)return r;var i=new tc.PeerIdProto;return r.id!=null&&(typeof r.id=="string"?Vt.base64.decode(r.id,i.id=Vt.newBuffer(Vt.base64.length(r.id)),0):r.id.length&&(i.id=r.id)),r.pubKey!=null&&(typeof r.pubKey=="string"?Vt.base64.decode(r.pubKey,i.pubKey=Vt.newBuffer(Vt.base64.length(r.pubKey)),0):r.pubKey.length&&(i.pubKey=r.pubKey)),r.privKey!=null&&(typeof r.privKey=="string"?Vt.base64.decode(r.privKey,i.privKey=Vt.newBuffer(Vt.base64.length(r.privKey)),0):r.privKey.length&&(i.privKey=r.privKey)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(i.bytes===String?n.id="":(n.id=[],i.bytes!==Array&&(n.id=Vt.newBuffer(n.id))),i.bytes===String?n.pubKey="":(n.pubKey=[],i.bytes!==Array&&(n.pubKey=Vt.newBuffer(n.pubKey))),i.bytes===String?n.privKey="":(n.privKey=[],i.bytes!==Array&&(n.privKey=Vt.newBuffer(n.privKey)))),r.id!=null&&r.hasOwnProperty("id")&&(n.id=i.bytes===String?Vt.base64.encode(r.id,0,r.id.length):i.bytes===Array?Array.prototype.slice.call(r.id):r.id),r.pubKey!=null&&r.hasOwnProperty("pubKey")&&(n.pubKey=i.bytes===String?Vt.base64.encode(r.pubKey,0,r.pubKey.length):i.bytes===Array?Array.prototype.slice.call(r.pubKey):r.pubKey),r.privKey!=null&&r.hasOwnProperty("privKey")&&(n.privKey=i.bytes===String?Vt.base64.encode(r.privKey,0,r.privKey.length):i.bytes===Array?Array.prototype.slice.call(r.privKey):r.privKey),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Ra.util.toJSONOptions)},t}();Tm.exports=tc});var Ut=C((kr,Bm)=>{"use strict";var ks=fs(),cd=Ro(),Li=Xf(),nB=Im(),{PeerIdProto:Pm}=Rm(),Rs=Mr(),rc=qt(),sB=Lt(),Nm=class{constructor(e,r,i){if(!(e instanceof Uint8Array))throw new Error("invalid id provided");if(r&&i&&!Rs(r.public.bytes,i.bytes))throw new Error("inconsistent arguments");this._id=e,this._idB58String=ks.toB58String(this.id),this._privKey=r,this._pubKey=i}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{let e=ks.decode(this.id);e.name==="identity"&&(this._pubKey=Li.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return Li.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return Li.marshalPrivateKey(this.privKey)}marshal(e){return Pm.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let r=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:Mm(this.marshalPrivKey()),pubKey:Mm(this.marshalPubKey())}}toHexString(){return ks.toHexString(this.id)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){let e=new cd(1,"libp2p-key",this.id,"base32");Object.defineProperty(this,"_idCIDString",{value:e.toBaseEncodedString("base32"),enumerable:!1})}return this._idCIDString}equals(e){if(e instanceof Uint8Array)return Rs(this.id,e);if(e.id)return Rs(this.id,e.id);throw new Error("not valid Id")}isEqual(e){return this.equals(e)}isValid(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&Rs(this.privKey.public.bytes,this.pubKey.bytes))}hasInlinePublicKey(){try{if(ks.decode(this.id).name==="identity")return!0}catch(e){}return!1}},qi=nB(Nm,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});kr=Bm.exports=qi;var ic=t=>t.bytes.length<=42?ks.encode(t.bytes,"identity"):t.hash(),fd=async(t,e)=>{let r=await ic(e);return new qi(r,t,e)};kr.create=async t=>{t=t||{},t.bits=t.bits||2048,t.keyType=t.keyType||"RSA";let e=await Li.generateKeyPair(t.keyType,t.bits);return fd(e,e.public)};kr.createFromHexString=t=>new qi(ks.fromHexString(t));kr.createFromBytes=t=>new qi(t);kr.createFromB58String=t=>kr.createFromCID(t);var aB=t=>t.codec==="libp2p-key"||t.codec==="dag-pb";kr.createFromCID=t=>{if(t=cd.isCID(t)?t:new cd(t),!aB(t))throw new Error("Supplied PeerID CID has invalid multicodec: "+t.codec);return new qi(t.multihash)};kr.createFromPubKey=async t=>{let e=t;if(typeof e=="string"&&(e=rc(t,"base64pad")),!(e instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");let r=await Li.unmarshalPublicKey(e);return fd(null,r)};kr.createFromPrivKey=async t=>{if(typeof t=="string"&&(t=rc(t,"base64pad")),!(t instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");let e=await Li.unmarshalPrivateKey(t);return fd(e,e.public)};kr.createFromJSON=async t=>{let e=ks.fromB58String(t.id),r=t.privKey&&rc(t.privKey,"base64pad"),i=t.pubKey&&rc(t.pubKey,"base64pad"),n=i&&await Li.unmarshalPublicKey(i);if(!r)return new qi(e,null,n);let s=await Li.unmarshalPrivateKey(r),a=await ic(s.public),o;if(n&&(o=await ic(n)),n&&!Rs(a,o))throw new Error("Public and private key do not match");if(e&&!Rs(a,e))throw new Error("Id and private key do not match");return new qi(e,s,n)};kr.createFromProtobuf=async t=>{typeof t=="string"&&(t=rc(t,"base16"));let{id:e,privKey:r,pubKey:i}=Pm.decode(t);r=r?await Li.unmarshalPrivateKey(r):!1,i=i?await Li.unmarshalPublicKey(i):!1;let n,s;if(r&&(s=await ic(r.public)),i&&(n=await ic(i)),r){if(i&&!Rs(s,n))throw new Error("Public and private key do not match");return new qi(s,r,r.public)}if(i)return new qi(n,null,i);if(e)return new qi(e);throw new Error("Protobuf did not contain any usable key material")};kr.isPeerId=t=>Boolean(typeof t=="object"&&t._id&&t._idB58String);function Mm(t){if(t)return sB(t,"base64pad")}});var ld=C((IV,Om)=>{"use strict";var Dm="[a-fA-F\\d:]",Fn=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Dm})|(?<=${Dm})(?=\\s|$))`:"",ui="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",Ft="[a-fA-F\\d]{1,4}",Zf=` +(?: +(?:${Ft}:){7}(?:${Ft}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8 +(?:${Ft}:){6}(?:${ui}|:${Ft}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4 +(?:${Ft}:){5}(?::${ui}|(?::${Ft}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4 +(?:${Ft}:){4}(?:(?::${Ft}){0,1}:${ui}|(?::${Ft}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4 +(?:${Ft}:){3}(?:(?::${Ft}){0,2}:${ui}|(?::${Ft}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4 +(?:${Ft}:){2}(?:(?::${Ft}){0,3}:${ui}|(?::${Ft}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4 +(?:${Ft}:){1}(?:(?::${Ft}){0,4}:${ui}|(?::${Ft}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4 +(?::(?:(?::${Ft}){0,5}:${ui}|(?::${Ft}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4 +)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1 +`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),oB=new RegExp(`(?:^${ui}$)|(?:^${Zf}$)`),cB=new RegExp(`^${ui}$`),fB=new RegExp(`^${Zf}$`),ud=t=>t&&t.exact?oB:new RegExp(`(?:${Fn(t)}${ui}${Fn(t)})|(?:${Fn(t)}${Zf}${Fn(t)})`,"g");ud.v4=t=>t&&t.exact?cB:new RegExp(`${Fn(t)}${ui}${Fn(t)}`,"g");ud.v6=t=>t&&t.exact?fB:new RegExp(`${Fn(t)}${Zf}${Fn(t)}`,"g");Om.exports=ud});var qm=C((TV,Lm)=>{"use strict";var dd=ld(),Ba=t=>dd({exact:!0}).test(t);Ba.v4=t=>dd.v4({exact:!0}).test(t);Ba.v6=t=>dd.v6({exact:!0}).test(t);Ba.version=t=>Ba(t)?Ba.v4(t)?4:6:void 0;Lm.exports=Ba});var zm=C((kV,Um)=>{"use strict";var hd=qm(),Fm=Lt(),uB=hd,pd=hd.v4,Km=hd.v6,Vm=function(t,e,r){r=~~r;let i;if(pd(t))i=e||new Uint8Array(r+4),t.split(/\./g).map(function(s){i[r++]=parseInt(s,10)&255});else if(Km(t)){let s=t.split(":",8),a;for(a=0;a0;a--)o.push("0");s.splice.apply(s,o)}for(i=e||new Uint8Array(r+16),a=0;a>8&255,i[r++]=o&255}}if(!i)throw Error("Invalid ip address: "+t);return i},lB=function(t,e,r){e=~~e,r=r||t.length-e;let i=[],n,s=new DataView(t.buffer);if(r===4){for(let a=0;a{"use strict";function _r(t){if(typeof t=="number"){if(_r.codes[t])return _r.codes[t];throw new Error("no protocol with code: "+t)}else if(typeof t=="string"){if(_r.names[t])return _r.names[t];throw new Error("no protocol with name: "+t)}throw new Error("invalid protocol id type: "+t)}var Hr=-1;_r.lengthPrefixedVarSize=Hr;_r.V=Hr;_r.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,Hr,"ip6zone"],[53,Hr,"dns","resolvable"],[54,Hr,"dns4","resolvable"],[55,Hr,"dns6","resolvable"],[56,Hr,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,Hr,"unix",!1,"path"],[421,Hr,"ipfs"],[421,Hr,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,Hr,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,Hr,"memory"]];_r.names={};_r.codes={};_r.table.map(t=>{let e=Hm.apply(null,t);return _r.codes[e.code]=e,_r.names[e.name]=e,null});_r.object=Hm;function Hm(t,e,r,i,n){return{code:t,size:e,name:r,resolvable:Boolean(i),path:Boolean(n)}}jm.exports=_r});var Ym=C((BV,Gm)=>{Gm.exports=bd;var $m=128,dB=127,hB=~dB,pB=Math.pow(2,31);function bd(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw bd.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var i=r;t>=pB;)e[r++]=t&255|$m,t/=128;for(;t&hB;)e[r++]=t&255|$m,t>>>=7;return e[r]=t|0,bd.bytes=r-i+1,e}});var Jm=C((PV,Wm)=>{Wm.exports=yd;var bB=128,Qm=127;function yd(t,e){var r=0,e=e||0,i=0,n=e,s,a=t.length;do{if(n>=a||i>49)throw yd.bytes=0,new RangeError("Could not decode varint");s=t[n++],r+=i<28?(s&Qm)<=bB);return yd.bytes=n-e,r}});var Zm=C((NV,Xm)=>{var yB=Math.pow(2,7),gB=Math.pow(2,14),vB=Math.pow(2,21),mB=Math.pow(2,28),xB=Math.pow(2,35),wB=Math.pow(2,42),EB=Math.pow(2,49),SB=Math.pow(2,56),AB=Math.pow(2,63);Xm.exports=function(t){return t{e3.exports={encode:Ym(),decode:Jm(),encodingLength:Zm()}});var c3=C((OV,t3)=>{"use strict";var e0=zm(),r3=nc(),_B=Ro(),i3=xn(),Pa=Bs(),t0=Lt(),n3=qt(),r0=Zr();t3.exports=sc;function sc(t,e){return e instanceof Uint8Array?sc.toString(t,e):sc.toBytes(t,e)}sc.toString=function(e,r){switch(r3(e).code){case 4:case 41:return CB(r);case 6:case 273:case 33:case 132:return s3(r).toString();case 53:case 54:case 55:case 56:case 400:case 777:return IB(r);case 421:return TB(r);case 444:return a3(r);case 445:return a3(r);default:return t0(r,"base16")}};sc.toBytes=function(e,r){switch(r3(e).code){case 4:return o3(r);case 41:return o3(r);case 6:case 273:case 33:case 132:return gd(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:case 777:return kB(r);case 421:return RB(r);case 444:return BB(r);case 445:return PB(r);default:return n3(r,"base16")}};function o3(t){if(!e0.isIP(t))throw new Error("invalid ip address");return e0.toBytes(t)}function CB(t){let e=e0.toString(t);if(!e||!e0.isIP(e))throw new Error("invalid ip address");return e}function gd(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function s3(t){return new DataView(t.buffer).getUint16(0)}function kB(t){let e=n3(t),r=Uint8Array.from(Pa.encode(e.length));return r0([r,e],r.length+e.length)}function IB(t){let e=Pa.decode(t);if(t=t.slice(Pa.decode.bytes),t.length!==e)throw new Error("inconsistent lengths");return t0(t)}function RB(t){let e=new _B(t).multihash,r=Uint8Array.from(Pa.encode(e.length));return r0([r,e],r.length+e.length)}function TB(t){let e=Pa.decode(t),r=t.slice(Pa.decode.bytes);if(r.length!==e)throw new Error("inconsistent lengths");return t0(r,"base58btc")}function BB(t){let e=t.split(":");if(e.length!==2)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(e[0].length!==16)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion address.");let r=i3.decode("b"+e[0]),i=parseInt(e[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");let n=gd(i);return r0([r,n],r.length+n.length)}function PB(t){let e=t.split(":");if(e.length!==2)throw new Error("failed to parse onion addr: "+e+" does not contain a port number");if(e[0].length!==56)throw new Error("failed to parse onion addr: "+e[0]+" not a Tor onion3 address.");let r=i3.decode("b"+e[0]),i=parseInt(e[1],10);if(i<1||i>65536)throw new Error("Port number is not in range(1, 65536)");let n=gd(i);return r0([r,n],r.length+n.length)}function a3(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),i=t0(e,"base32"),n=s3(r);return i+":"+n}});var x3=C((DV,f3)=>{"use strict";var u3=c3(),vd=nc(),ac=Bs(),l3=Zr(),NB=Lt();f3.exports={stringToStringTuples:d3,stringTuplesToString:h3,tuplesToStringTuples:b3,stringTuplesToTuples:p3,bytesToTuples:md,tuplesToBytes:y3,bytesToString:MB,stringToBytes:v3,fromString:OB,fromBytes:m3,validateBytes:xd,isValidBytes:DB,cleanPath:i0,ParseError:wd,protoFromTuple:oc,sizeForAddr:g3};function d3(t){let e=[],r=t.split("/").slice(1);if(r.length===1&&r[0]==="")return[];for(let i=0;i=r.length)throw wd("invalid address: "+t);if(s.path){e.push([n,i0(r.slice(i).join("/"))]);break}e.push([n,r[i]])}return e}function h3(t){let e=[];return t.map(r=>{let i=oc(r);return e.push(i.name),r.length>1&&e.push(r[1]),null}),i0(e.join("/"))}function p3(t){return t.map(e=>{Array.isArray(e)||(e=[e]);let r=oc(e);return e.length>1?[r.code,u3.toBytes(r.code,e[1])]:[r.code]})}function b3(t){return t.map(e=>{let r=oc(e);return e[1]?[r.code,u3.toString(r.code,e[1])]:[r.code]})}function y3(t){return m3(l3(t.map(e=>{let r=oc(e),i=Uint8Array.from(ac.encode(r.code));return e.length>1&&(i=l3([i,e[1]])),i})))}function g3(t,e){return t.size>0?t.size/8:t.size===0?0:ac.decode(e)+ac.decode.bytes}function md(t){let e=[],r=0;for(;rt.length)throw wd("Invalid address Uint8Array: "+NB(t,"base16"));e.push([i,o])}return e}function MB(t){let e=md(t),r=b3(e);return h3(r)}function v3(t){t=i0(t);let e=d3(t),r=p3(e);return y3(r)}function OB(t){return v3(t)}function m3(t){let e=xd(t);if(e)throw e;return Uint8Array.from(t)}function xd(t){try{md(t)}catch(e){return e}}function DB(t){return xd(t)===void 0}function i0(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function wd(t){return new Error("Error parsing address: "+t)}function oc(t){return vd(t[0])}});var dr=C((LV,w3)=>{"use strict";var li=x3(),Na=nc(),E3=Bs(),LB=Ro(),qB=Pe(),UB=Symbol.for("nodejs.util.inspect.custom"),Ed=Lt(),FB=Mr(),Sd=new Map,S3=Symbol.for("@multiformats/js-multiaddr/multiaddr"),vr=class{constructor(e){if(e==null&&(e=""),Object.defineProperty(this,S3,{value:!0}),e instanceof Uint8Array)this.bytes=li.fromBytes(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=li.fromString(e)}else if(vr.isMultiaddr(e))this.bytes=li.fromBytes(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return li.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){let e={},r=this.toString().split("/");return e.family=r[1]==="ip4"?4:6,e.host=r[2],e.transport=r[3],e.port=parseInt(r[4]),e}protos(){return this.protoCodes().map(e=>Object.assign({},Na(e)))}protoCodes(){let e=[],r=this.bytes,i=0;for(;ie.name)}tuples(){return li.bytesToTuples(this.bytes)}stringTuples(){let e=li.bytesToTuples(this.bytes);return li.tuplesToStringTuples(e)}encapsulate(e){return e=new vr(e),new vr(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),i=this.toString(),n=i.lastIndexOf(r);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return new vr(i.slice(0,n))}decapsulateCode(e){let r=this.tuples();for(let i=r.length-1;i>=0;i--)if(r[i][0]===e)return new vr(li.tuplesToBytes(r.slice(0,i)));return this}getPeerId(){try{let r=this.stringTuples().filter(i=>i[0]===Na.names.ipfs.code).pop();return r&&r[1]?Ed(new LB(r[1]).multihash,"base58btc"):null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter(r=>!!Na(r[0]).path)[0][1],e||(e=null)}catch(r){e=null}return e}equals(e){return FB(this.bytes,e.bytes)}async resolve(){let e=this.protos().find(n=>n.resolvable);if(!e)return[this];let r=Sd.get(e.name);if(!r)throw qB(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this)).map(n=>new vr(n))}nodeAddress(){let e=this.protoCodes(),r=this.protoNames(),i=this.toString().split("/").slice(1);if(i.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(e[0]!==4&&e[0]!==41&&e[0]!==54&&e[0]!==55)throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if(i[2]!=="tcp"&&i[2]!=="udp")throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:e[0]===41||e[0]===55?6:4,address:i[1],port:parseInt(i[3])}}isThinWaistAddress(e){let r=(e||this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}static fromNodeAddress(e,r){if(!e)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");let i;switch(e.family){case 4:i="ip4";break;case 6:i="ip6";break;default:throw Error(`Invalid addr family. Got '${e.family}' instead of 4 or 6`)}return new vr("/"+[i,e.address,r,e.port].join("/"))}static isName(e){return vr.isMultiaddr(e)?e.protos().some(r=>r.resolvable):!1}static isMultiaddr(e){return e instanceof vr||Boolean(e&&e[S3])}[UB](){return""}inspect(){return""}};vr.protocols=Na;vr.resolvers=Sd;function KB(t){return new vr(t)}w3.exports={Multiaddr:vr,multiaddr:KB,protocols:Na,resolvers:Sd}});var n0=C((qV,A3)=>{"use strict";var VB=async function*(t,e){for await(let r of t)await e(r)&&(yield r)};A3.exports=VB});var C3=C((UV,_3)=>{"use strict";var zB=async function*(t,e){for await(let r of t)yield e(r)};_3.exports=zB});var T3=C((FV,I3)=>{"use strict";var jB=async function*(t,e){let r=0;if(!(e<1)){for await(let i of t)if(yield i,r++,r===e)return}};I3.exports=jB});var Ad=C((KV,k3)=>{"use strict";var HB=Pe(),GB=n0(),$B=C3(),YB=T3();function WB(t,e){return $B(t,r=>(e.addressBook.add(r.id,r.multiaddrs),r))}function QB(t){let e=new Set;return GB(t,r=>e.has(r.id.toString())?!1:(e.add(r.id.toString()),!0))}async function*JB(t,e=1){let r=0;for await(let i of t)r++,yield i;if(r{R3.exports=class{constructor(e){if(!(e>0)||(e-1&e)!=0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}}});var _d=C((HV,P3)=>{var N3=B3();P3.exports=class{constructor(e){this.hwm=e||16,this.head=new N3(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){let r=this.head;this.head=r.next=new N3(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next){let r=this.tail.next;return this.tail.next=null,this.tail=r,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}});var Id=C((GV,M3)=>{var Cd=_d();M3.exports=t=>{t=t||{};let e;typeof t=="function"?(e=t,t={}):e=t.onEnd;let r=new Cd,i,n,s,a=()=>{if(!r.isEmpty()){if(t.writev){let A,F=[];for(;!r.isEmpty();){if(A=r.shift(),A.error)throw A.error;F.push(A.value)}return{done:A.done,value:F}}let g=r.shift();if(g.error)throw g.error;return g}return s?{done:!0}:new Promise((g,A)=>{n=F=>(n=null,F.error?A(F.error):t.writev&&!F.done?g({done:F.done,value:[F.value]}):g(F),i)})},o=g=>n?n(g):(r.push(g),i),c=g=>(r=new Cd,n?n({error:g}):(r.push({error:g}),i)),f=g=>s?i:o({done:!1,value:g}),u=g=>s?i:(s=!0,g?c(g):o({done:!0})),l=()=>(r=new Cd,u(),{done:!0}),b=g=>(u(g),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:a,return:l,throw:b,push:f,end:u},!e)return i;let p=i;return i={[Symbol.asyncIterator](){return this},next(){return p.next()},throw(g){return p.throw(g),e&&(e(g),e=null),{done:!0}},return(){return p.return(),e&&(e(),e=null),{done:!0}},push:f,end(g){return p.end(g),e&&(e(g),e=null),i}},i}});var Td=C(($V,O3)=>{"use strict";var ZB=Id(),eP=async function*(...t){let e=ZB();setTimeout(async()=>{try{await Promise.all(t.map(async r=>{for await(let i of r)e.push(i)})),e.end()}catch(r){e.end(r)}},0),yield*e};O3.exports=eP});var Ui=C((YV,Ma)=>{var D3=(...t)=>{let e;for(;t.length;)e=t.shift()(e);return e},kd=t=>t&&(typeof t[Symbol.asyncIterator]=="function"||typeof t[Symbol.iterator]=="function"||typeof t.next=="function"),s0=t=>t&&typeof t.sink=="function"&&kd(t.source),tP=t=>e=>(t.sink(e),t.source),L3=(...t)=>{if(s0(t[0])){let e=t[0];t[0]=()=>e.source}else if(kd(t[0])){let e=t[0];t[0]=()=>e}if(t.length>1&&s0(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let e=1;e{"use strict";var rP=async t=>{for await(let e of t)return e};q3.exports=rP});var Bd=C((QV,U3)=>{"use strict";var iP=async t=>{for await(let e of t);};U3.exports=iP});var Pd=C((JV,F3)=>{"use strict";var Oa=new Map,nP=()=>`${Date.now()}:${Math.floor(Math.random()*1e6)}`;async function sP(t,e,r){for(;Oa.get(r);){try{await t()}catch(i){setTimeout(()=>{throw i},1);break}if(!Oa.get(r))break;await new Promise(i=>{let n=setTimeout(i,e);Oa.set(r,n)})}}function aP(t,e,r){r=r||e;let i=nP(),n=setTimeout(()=>{sP(t,e,i)},r);return Oa.set(i,n),i}function oP(t){let e=Oa.get(t);e&&(clearTimeout(e),Oa.delete(t))}F3.exports={setDelayedInterval:aP,clearDelayedInterval:oP}});var $3=C((XV,K3)=>{"use strict";var V3=Xe(),cP=Object.assign(V3("libp2p:peer-routing"),{error:V3("libp2p:peer-routing:err")}),Nd=Pe(),{storeAddresses:z3,uniquePeers:fP,requirePeers:uP}=Ad(),j3=Td(),{pipe:H3}=Ui(),lP=Rd(),dP=Bd(),hP=n0(),{setDelayedInterval:pP,clearDelayedInterval:bP}=Pd(),G3=class{constructor(e){this._peerId=e.peerId,this._peerStore=e.peerStore,this._routers=e._modules.peerRouting||[],e._dht&&e._config.dht.enabled&&this._routers.push(e._dht),this._refreshManagerOptions=e._options.peerRouting.refreshManager,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}start(){!this._routers.length||this._timeoutId||!this._refreshManagerOptions.enabled||(this._timeoutId=pP(this._findClosestPeersTask,this._refreshManagerOptions.interval,this._refreshManagerOptions.bootDelay))}async _findClosestPeersTask(){try{await dP(this.getClosestPeers(this._peerId.id))}catch(e){cP.error(e)}}stop(){bP(this._timeoutId)}async findPeer(e,r){if(!this._routers.length)throw Nd(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");let i=await H3(j3(...this._routers.map(n=>[n.findPeer(e,r)])),n=>hP(n,Boolean),n=>z3(n,this._peerStore),n=>lP(n));if(i)return i;throw Nd(new Error("not found"),"NOT_FOUND")}async*getClosestPeers(e,r={timeout:3e4}){if(!this._routers.length)throw Nd(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");yield*H3(j3(...this._routers.map(i=>i.getClosestPeers(e,r))),i=>z3(i,this._peerStore),i=>fP(i),i=>uP(i))}};K3.exports=G3});var Kt=C(Md=>{"use strict";Md.messages={NOT_STARTED_YET:"The libp2p node is not started yet",DHT_DISABLED:"DHT is not available",CONN_ENCRYPTION_REQUIRED:"At least one connection encryption module is required"};Md.codes={DHT_DISABLED:"ERR_DHT_DISABLED",PUBSUB_NOT_STARTED:"ERR_PUBSUB_NOT_STARTED",DHT_NOT_STARTED:"ERR_DHT_NOT_STARTED",CONN_ENCRYPTION_REQUIRED:"ERR_CONN_ENCRYPTION_REQUIRED",ERR_INVALID_PROTOCOLS_FOR_STREAM:"ERR_INVALID_PROTOCOLS_FOR_STREAM",ERR_CONNECTION_ENDED:"ERR_CONNECTION_ENDED",ERR_CONNECTION_FAILED:"ERR_CONNECTION_FAILED",ERR_NODE_NOT_STARTED:"ERR_NODE_NOT_STARTED",ERR_ALREADY_ABORTED:"ERR_ALREADY_ABORTED",ERR_NO_VALID_ADDRESSES:"ERR_NO_VALID_ADDRESSES",ERR_RELAYED_DIAL:"ERR_RELAYED_DIAL",ERR_DIALED_SELF:"ERR_DIALED_SELF",ERR_DISCOVERED_SELF:"ERR_DISCOVERED_SELF",ERR_DUPLICATE_TRANSPORT:"ERR_DUPLICATE_TRANSPORT",ERR_ENCRYPTION_FAILED:"ERR_ENCRYPTION_FAILED",ERR_HOP_REQUEST_FAILED:"ERR_HOP_REQUEST_FAILED",ERR_INVALID_KEY:"ERR_INVALID_KEY",ERR_INVALID_MESSAGE:"ERR_INVALID_MESSAGE",ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_INVALID_PEER:"ERR_INVALID_PEER",ERR_MUXER_UNAVAILABLE:"ERR_MUXER_UNAVAILABLE",ERR_TIMEOUT:"ERR_TIMEOUT",ERR_TRANSPORT_UNAVAILABLE:"ERR_TRANSPORT_UNAVAILABLE",ERR_TRANSPORT_DIAL_FAILED:"ERR_TRANSPORT_DIAL_FAILED",ERR_UNSUPPORTED_PROTOCOL:"ERR_UNSUPPORTED_PROTOCOL",ERR_INVALID_MULTIADDR:"ERR_INVALID_MULTIADDR",ERR_SIGNATURE_NOT_VALID:"ERR_SIGNATURE_NOT_VALID"}});var Q3=C((ez,Y3)=>{"use strict";var cc=Pe(),{messages:Od,codes:Dd}=Kt(),{storeAddresses:yP,uniquePeers:gP,requirePeers:vP,maybeLimitSource:mP}=Ad(),xP=Td(),{pipe:wP}=Ui(),W3=class{constructor(e){this.libp2p=e,this.routers=e._modules.contentRouting||[],this.dht=e._dht,this.dht&&e._config.dht.enabled&&this.routers.push(this.dht)}async*findProviders(e,r={}){if(!this.routers.length)throw cc(new Error("No content this.routers available"),"NO_ROUTERS_AVAILABLE");yield*wP(xP(...this.routers.map(i=>i.findProviders(e,r))),i=>yP(i,this.libp2p.peerStore),i=>gP(i),i=>mP(i,r.maxNumProviders),i=>vP(i))}async provide(e){if(!this.routers.length)throw cc(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");await Promise.all(this.routers.map(r=>r.provide(e)))}put(e,r,i){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw cc(new Error(Od.NOT_STARTED_YET),Dd.DHT_NOT_STARTED);return this.dht.put(e,r,i)}get(e,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw cc(new Error(Od.NOT_STARTED_YET),Dd.DHT_NOT_STARTED);return this.dht.get(e,r)}async getMany(e,r,i){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw cc(new Error(Od.NOT_STARTED_YET),Dd.DHT_NOT_STARTED);return this.dht.getMany(e,r,i)}};Y3.exports=W3});var Ld=C((tz,J3)=>{"use strict";var EP=Ut(),{Multiaddr:X3}=dr(),Z3=Pe(),{codes:e4}=Kt();function SP(t){typeof t=="string"&&(t=new X3(t));let e;if(X3.isMultiaddr(t)){e=t;let r=t.getPeerId();if(!r)throw Z3(new Error(`${t} does not have a valid peer type`),e4.ERR_INVALID_MULTIADDR);try{t=EP.createFromB58String(r)}catch(i){throw Z3(new Error(`${t} is not a valid peer type`),e4.ERR_INVALID_MULTIADDR)}}return{id:t,multiaddrs:e?[e]:void 0}}J3.exports=SP});var r4=C((rz,t4)=>{"use strict";t4.exports=t=>{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}});var fc=C((i4,n4)=>{"use strict";var a0=r4(),{hasOwnProperty:s4}=Object.prototype,{propertyIsEnumerable:AP}=Object,Da=(t,e,r)=>Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0}),_P=i4,a4={concatArrays:!1,ignoreUndefined:!1},o0=t=>{let e=[];for(let r in t)s4.call(t,r)&&e.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(t);for(let i of r)AP.call(t,i)&&e.push(i)}return e};function La(t){return Array.isArray(t)?CP(t):a0(t)?IP(t):t}function CP(t){let e=t.slice(0,0);return o0(t).forEach(r=>{Da(e,r,La(t[r]))}),e}function IP(t){let e=Object.getPrototypeOf(t)===null?Object.create(null):{};return o0(t).forEach(r=>{Da(e,r,La(t[r]))}),e}var o4=(t,e,r,i)=>(r.forEach(n=>{typeof e[n]=="undefined"&&i.ignoreUndefined||(n in t&&t[n]!==Object.getPrototypeOf(t)?Da(t,n,qd(t[n],e[n],i)):Da(t,n,La(e[n])))}),t),TP=(t,e,r)=>{let i=t.slice(0,0),n=0;return[t,e].forEach(s=>{let a=[];for(let o=0;o!a.includes(o)),r)}),i};function qd(t,e,r){return r.concatArrays&&Array.isArray(t)&&Array.isArray(e)?TP(t,e,r):!a0(e)||!a0(t)?La(e):o4(t,e,o0(e),r)}n4.exports=function(...t){let e=qd(La(a4),this!==_P&&this||{},a4),r={_:{}};for(let i of t)if(i!==void 0){if(!a0(i))throw new TypeError("`"+i+"` is not an Option Object");r=qd(r,{_:i},e)}return r._}});var u4=C((iz,c4)=>{"use strict";c4.exports=f4;var kP=Su(),Kn=f4.prototype,RP=new Date%1e9;function BP(){return(Math.random()*1e9>>>0)+RP++}function f4(t){t=t||{},this.id=t.id||BP(),this.max=t.max||Infinity,this.items=t.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(t.lastModified||new Date);for(var e,r,i=this.items.length;i--;)e=this.items[i],r=new Date(e.expires)-new Date,this._lookup[e.key]=e,r>0?this.expire(e.key,r):r<=0&&this.delete(e.key)}Kn.has=function(t){return t in this._lookup};Kn.get=function(t){if(!this.has(t))return null;var e=this._lookup[t];return e.refresh&&this.expire(t,e.refresh),this.items.splice(this.items.indexOf(e),1),this.items.push(e),e.value};Kn.meta=function(t){if(!this.has(t))return null;var e=this._lookup[t];return"meta"in e?e.meta:null};Kn.set=function(t,e,r){var i=this._lookup[t],n=this._lookup[t]={key:t,value:e};return this.lastModified=new Date,i?(clearTimeout(i.timeout),this.items.splice(this.items.indexOf(i),1,n)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(n),this.size++),r&&("ttl"in r&&this.expire(t,r.ttl),"meta"in r&&(n.meta=r.meta),r.refresh&&(n.refresh=r.ttl)),this};Kn.delete=function(t){var e=this._lookup[t];return e?(this.lastModified=new Date,this.items.splice(this.items.indexOf(e),1),clearTimeout(e.timeout),delete this._lookup[t],this.size--,this):!1};Kn.expire=function(t,e){var r=e||0,i=this._lookup[t];if(!i)return this;if(typeof r=="string"&&(r=kP(e)),typeof r!="number")throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),r),i.expires=Number(new Date)+r,this};Kn.clear=function(){for(var t=this.items.length;t--;)this.delete(this.items[t].key);return this};Kn.toJSON=function(){for(var t=new Array(this.items.length),e,r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}});var uc=C((qa,l4)=>{"use strict";var PP=function(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof sn!="undefined")return sn;throw new Error("unable to locate global object")},sn=PP();l4.exports=qa=sn.fetch;sn.fetch&&(qa.default=sn.fetch.bind(sn));qa.Headers=sn.Headers;qa.Request=sn.Request;qa.Response=sn.Response});var d4=C((nz,Ud)=>{"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?Ud.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:Ud.exports={default:uc().default,Headers:uc().Headers,Request:uc().Request,Response:uc().Response}});var h4=C((sz,c0)=>{"use strict";var{default:NP,Headers:MP}=d4();function OP({serverResolver:t,hostname:e,recordType:r}){return`${t}?name=${e}&type=${r}`}c0.exports.buildResource=OP;function DP(t){return NP(t,{headers:new MP({accept:"application/dns-json"})})}c0.exports.fetch=DP;function LP(t,e){return`${e}_${t}`}c0.exports.getCacheKey=LP});var y4=C((az,p4)=>{"use strict";var b4=Xe(),f0=b4("dns-over-http-resolver");f0.error=b4("dns-over-http-resolver:error");var qP=u4(),{buildResource:Fd,fetch:Kd,getCacheKey:Ua}=h4(),u0=class{constructor({maxCache:e=100}={}){this._cache=new qP({max:e}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"]}getServers(){return this._servers}_getShuffledServers(){let e=[].concat(this._servers);for(let r=e.length-1;r>0;r--){let i=Math.floor(Math.random()*r),n=e[r];e[r]=e[i],e[i]=n}return e}setServers(e){this._servers=e}resolve(e,r="A"){switch(r){case"A":return this.resolve4(e);case"AAAA":return this.resolve6(e);case"TXT":return this.resolveTxt(e);default:throw new Error(`${r} is not supported`)}}async resolve4(e){let r="A",i=this._cache.get(Ua(e,r));if(i)return i;for(let n of this._getShuffledServers())try{let a=await(await Kd(Fd({serverResolver:n,hostname:e,recordType:r}))).json(),o=a.Answer.map(f=>f.data),c=Math.min(a.Answer.map(f=>f.TTL));return this._cache.set(Ua(e,r),o,{ttl:c}),o}catch(s){f0.error(`${n} could not resolve ${e} record ${r}`)}throw new Error(`Could not resolve ${e} record ${r}`)}async resolve6(e){let r="AAAA",i=this._cache.get(Ua(e,r));if(i)return i;for(let n of this._getShuffledServers())try{let a=await(await Kd(Fd({serverResolver:n,hostname:e,recordType:r}))).json(),o=a.Answer.map(f=>f.data),c=Math.min(a.Answer.map(f=>f.TTL));return this._cache.set(Ua(e,r),o,{ttl:c}),o}catch(s){f0.error(`${n} could not resolve ${e} record ${r}`)}throw new Error(`Could not resolve ${e} record ${r}`)}async resolveTxt(e){let r="TXT",i=this._cache.get(Ua(e,r));if(i)return i;for(let n of this._getShuffledServers())try{let a=await(await Kd(Fd({serverResolver:n,hostname:e,recordType:r}))).json(),o=a.Answer.map(f=>[f.data.replace(/['"]+/g,"")]),c=Math.min(a.Answer.map(f=>f.TTL));return this._cache.set(Ua(e,r),o,{ttl:c}),o}catch(s){f0.error(`${n} could not resolve ${e} record ${r}`)}throw new Error(`Could not resolve ${e} record ${r}`)}};u0.Resolver=u0;p4.exports=u0});var v4=C((oz,g4)=>{"use strict";var UP=y4();g4.exports=UP});var x4=C((cz,m4)=>{"use strict";var FP=nc(),{code:KP}=FP("dnsaddr");async function VP(t){let e=v4(),r=new e,i=t.getPeerId(),[,n]=t.stringTuples().find(([o])=>o===KP)||[],a=(await r.resolveTxt(`_dnsaddr.${n}`)).flat().map(o=>o.split("=")[1]);return i&&(a=a.filter(o=>o.includes(i))),a}m4.exports={dnsaddrResolver:VP}});var l0=C((fz,w4)=>{"use strict";w4.exports={DIAL_TIMEOUT:3e4,MAX_PARALLEL_DIALS:100,MAX_PER_PEER_DIALS:4,METRICS:{computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[60*1e3,5*60*1e3,15*60*1e3],maxOldPeersRetention:50}}});var Vd=C((uz,E4)=>{E4.exports={name:"libp2p",version:"0.31.0",description:"JavaScript implementation of libp2p, a modular peer to peer network stack",leadMaintainer:"Jacob Heun ",main:"src/index.js",types:"dist/src/index.d.ts",typesVersions:{"*":{"src/*":["dist/src/*","dist/src/*/index"]}},files:["dist","src"],scripts:{lint:"aegir lint",build:"aegir build","build:proto":"npm run build:proto:circuit && npm run build:proto:identify && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope","build:proto:circuit":"pbjs -t static-module -w commonjs -r libp2p-circuit --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/circuit/protocol/index.js ./src/circuit/protocol/index.proto","build:proto:identify":"pbjs -t static-module -w commonjs -r libp2p-identify --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/identify/message.js ./src/identify/message.proto","build:proto:plaintext":"pbjs -t static-module -w commonjs -r libp2p-plaintext --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/insecure/proto.js ./src/insecure/proto.proto","build:proto:address-book":"pbjs -t static-module -w commonjs -r libp2p-address-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/address-book.js ./src/peer-store/persistent/pb/address-book.proto","build:proto:proto-book":"pbjs -t static-module -w commonjs -r libp2p-proto-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/proto-book.js ./src/peer-store/persistent/pb/proto-book.proto","build:proto:peer-record":"pbjs -t static-module -w commonjs -r libp2p-peer-record --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/peer-record/peer-record.js ./src/record/peer-record/peer-record.proto","build:proto:envelope":"pbjs -t static-module -w commonjs -r libp2p-envelope --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/envelope/envelope.js ./src/record/envelope/envelope.proto","build:proto-types":"npm run build:proto-types:circuit && npm run build:proto-types:identify && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope","build:proto-types:circuit":"pbts -o src/circuit/protocol/index.d.ts src/circuit/protocol/index.js","build:proto-types:identify":"pbts -o src/identify/message.d.ts src/identify/message.js","build:proto-types:plaintext":"pbts -o src/insecure/proto.d.ts src/insecure/proto.js","build:proto-types:address-book":"pbts -o src/peer-store/persistent/pb/address-book.d.ts src/peer-store/persistent/pb/address-book.js","build:proto-types:proto-book":"pbts -o src/peer-store/persistent/pb/proto-book.d.ts src/peer-store/persistent/pb/proto-book.js","build:proto-types:peer-record":"pbts -o src/record/peer-record/peer-record.d.ts src/record/peer-record/peer-record.js","build:proto-types:envelope":"pbts -o src/record/envelope/envelope.d.ts src/record/envelope/envelope.js",test:"aegir test","test:ts":"aegir build --no-bundle && npm run test --prefix test/ts-use","test:node":'aegir test -t node -f "./test/**/*.{node,spec}.js"',"test:browser":"aegir test -t browser","test:examples":"cd examples && npm run test:all",prepare:"aegir build --no-bundle",release:"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser",coverage:"nyc --reporter=text --reporter=lcov npm run test:node"},repository:{type:"git",url:"https://github.com/libp2p/js-libp2p.git"},keywords:["libp2p","network","p2p","peer","peer-to-peer","IPFS"],bugs:{url:"https://github.com/libp2p/js-libp2p/issues"},homepage:"https://libp2p.io",license:"MIT",engines:{node:">=14.0.0"},browser:{"@motrix/nat-api":!1},eslintConfig:{extends:"ipfs",ignorePatterns:["!.aegir.js","test/ts-use"]},dependencies:{"@motrix/nat-api":"^0.3.1","abort-controller":"^3.0.0","aggregate-error":"^3.1.0","any-signal":"^2.1.1","bignumber.js":"^9.0.1",cids:"^1.1.5","class-is":"^1.1.0",debug:"^4.3.1","err-code":"^3.0.0","es6-promisify":"^6.1.1",events:"^3.3.0",hashlru:"^2.3.0","interface-datastore":"^4.0.0","ipfs-utils":"^6.0.0","it-all":"^1.0.4","it-buffer":"^0.1.2","it-drain":"^1.0.3","it-filter":"^1.0.1","it-first":"^1.0.4","it-handshake":"^2.0.0","it-length-prefixed":"^5.0.2","it-map":"^1.0.4","it-merge":"1.0.0","it-pipe":"^1.1.0","it-take":"1.0.0","libp2p-crypto":"^0.19.0","libp2p-interfaces":"libp2p/js-libp2p-interfaces#fix/event-emitter-with-local-types","libp2p-utils":"^0.3.1",mafmt:"^9.0.0","merge-options":"^3.0.4","moving-average":"vasco-santos/moving-average#fix/ts-2309-multiple-exports",multiaddr:"^9.0.1",multicodec:"^3.0.1","multihashing-async":"^2.1.2","multistream-select":"^2.0.0","mutable-proxy":"^1.0.0","node-forge":"^0.10.0","p-any":"^3.0.0","p-fifo":"^1.0.0","p-retry":"^4.4.0","p-settle":"^4.1.1","peer-id":"^0.14.2","private-ip":"^2.1.0",protobufjs:"^6.10.2",retimer:"^3.0.0","sanitize-filename":"^1.6.3","set-delayed-interval":"^1.0.0","streaming-iterables":"^5.0.2","timeout-abort-controller":"^1.1.1",varint:"^6.0.0",xsalsa20:"^1.1.0"},devDependencies:{"@nodeutils/defaults-deep":"^1.1.0","@types/es6-promisify":"^6.0.0","@types/node-forge":"^0.9.7","@types/varint":"^6.0.0","abortable-iterator":"^3.0.0",aegir:"^33.1.1",buffer:"^6.0.3",delay:"^5.0.0","interop-libp2p":"^0.3.0","into-stream":"^6.0.0","ipfs-http-client":"^49.0.4","it-concat":"^1.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0",libp2p:".","libp2p-bootstrap":"^0.12.3","libp2p-delegated-content-routing":"^0.10.0","libp2p-delegated-peer-routing":"^0.9.0","libp2p-floodsub":"^0.25.0","libp2p-gossipsub":"^0.9.0","libp2p-kad-dht":"^0.22.0","libp2p-mdns":"^0.16.0","libp2p-mplex":"^0.10.1","libp2p-noise":"^3.0.0","libp2p-tcp":"^0.15.1","libp2p-webrtc-star":"^0.22.0","libp2p-websockets":"^0.15.0",multihashes:"^4.0.2",nock:"^13.0.3","p-defer":"^3.0.0","p-times":"^3.0.0","p-wait-for":"^3.2.0",rimraf:"^3.0.2",sinon:"^10.0.0",uint8arrays:"^2.1.3",util:"^0.12.3"},contributors:["David Dias ","Vasco Santos ","Jacob Heun ","Alex Potsides ","Alan Shaw ","Cayman ","Pedro Teixeira ","Friedel Ziegelmayer ","Maciej Kr\xFCger ","Hugo Dias ","dirkmc ","Volker Mische ","Richard Littauer ","a1300 ","Elven ","Giovanni T. Parra ","\u1D20\u026A\u1D04\u1D1B\u1D0F\u0280 \u0299\u1D0A\u1D07\u029F\u1D0B\u029C\u1D0F\u029F\u1D0D ","Thomas Eizinger ","Samlior ","Ryan Bell ","Andrew Nesbitt ","Didrik Nordstr\xF6m ","Nuno Nogueira ","Philipp Muens ","Smite Chow ","Soeren ","S\xF6nke Hahn ","TJKoury ","Tiago Alves ","Yusef Napora ","Zane Starr ","ebinks ","isan_rivkin ","robertkiel ","RasmusErik Voel Jensen ","Aleksei ","Bernd Strehl ","Chris Bratlien ","Cindy Wu ","Daijiro Wachi ","Diogo Silva ","Dmitriy Ryajov ","Ethan Lam ","Fei Liu ","Felipe Martins ","Florian-Merle ","Francis Gulotta ","Franck Royer ","Henrique Dias ","Irakli Gozalishvili ","Joel Gustafson ","Julien Bouquillon ","Kevin Kwok ","Kevin Lacker ","Miguel Mota "]}});var zd=C((lz,lc)=>{"use strict";var zP=Vd().version;lc.exports.PROTOCOL_VERSION="ipfs/0.1.0";lc.exports.AGENT_VERSION=`js-libp2p/${zP}`;lc.exports.MULTICODEC_IDENTIFY="/ipfs/id/1.0.0";lc.exports.MULTICODEC_IDENTIFY_PUSH="/ipfs/id/push/1.0.0"});var d0=C((dz,S4)=>{"use strict";var A4=60*1e3;S4.exports={ADVERTISE_BOOT_DELAY:15*A4,ADVERTISE_TTL:30*A4,CIRCUIT_PROTO_CODE:290,HOP_METADATA_KEY:"hop_relay",HOP_METADATA_VALUE:"true",RELAY_RENDEZVOUS_NS:"/libp2p/relay"}});var _4=C(dc=>{(function(){var t,e,r,i,n,s,a,o;o=function(c){var f,u,l,b;return f=(c&255<<24)>>>24,u=(c&255<<16)>>>16,l=(c&255<<8)>>>8,b=c&255,[f,u,l,b].join(".")},a=function(c){var f,u,l,b,p,g;for(f=[],l=b=0;b<=3&&c.length!==0;l=++b){if(l>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}g=e(c),p=g[0],u=g[1],c=c.substring(u),f.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(f.length){case 1:if(f[0]>4294967295)throw new Error("Invalid IP");return f[0]>>>0;case 2:if(f[0]>255||f[1]>16777215)throw new Error("Invalid IP");return(f[0]<<24|f[1])>>>0;case 3:if(f[0]>255||f[1]>255||f[2]>65535)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2])>>>0;case 4:if(f[0]>255||f[1]>255||f[2]>255||f[3]>255)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2]<<8|f[3])>>>0;default:throw new Error("Invalid IP")}},r=function(c){return c.charCodeAt(0)},i=r("0"),s=r("a"),n=r("A"),e=function(c){var f,u,l,b,p;for(b=0,f=10,u="9",l=0,c.length>1&&c[l]==="0"&&(c[l+1]==="x"||c[l+1]==="X"?(l+=2,f=16):"0"<=c[l+1]&&c[l+1]<="9"&&(l++,f=8,u="7")),p=l;l>>0;else if(f===16)if("a"<=c[l]&&c[l]<="f")b=b*f+(10+r(c[l])-s)>>>0;else if("A"<=c[l]&&c[l]<="F")b=b*f+(10+r(c[l])-n)>>>0;else break;else break;if(b>4294967295)throw new Error("too large");l++}if(l===p)throw new Error("empty octet");return[b,l]},t=function(){function c(f,u){var l,b,p,g;if(typeof f!="string")throw new Error("Missing `net' parameter");if(u||(g=f.split("/",2),f=g[0],u=g[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=a(u)}catch(A){throw l=A,new Error("Invalid mask: "+u)}for(b=p=32;p>=0;b=--p)if(this.maskLong===4294967295<<32-b>>>0){this.bitmask=b;break}}else if(u||u===0)this.bitmask=parseInt(u,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(a(f)&this.maskLong)>>>0}catch(A){throw l=A,new Error("Invalid net address: "+f)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);this.size=Math.pow(2,32-this.bitmask),this.base=o(this.netLong),this.mask=o(this.maskLong),this.hostmask=o(~this.maskLong),this.first=this.bitmask<=30?o(this.netLong+1):this.base,this.last=this.bitmask<=30?o(this.netLong+this.size-2):o(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?o(this.netLong+this.size-1):void 0}return c.prototype.contains=function(f){return typeof f=="string"&&(f.indexOf("/")>0||f.split(".").length!==4)&&(f=new c(f)),f instanceof c?this.contains(f.base)&&this.contains(f.broadcast||f.last):(a(f)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},c.prototype.next=function(f){return f==null&&(f=1),new c(o(this.netLong+this.size*f),this.mask)},c.prototype.forEach=function(f){var u,l,b;for(b=a(this.first),l=a(this.last),u=0;b<=l;)f(o(b),b,u),u++,b++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),dc.ip2long=a,dc.long2ip=o,dc.Netmask=t}).call(dc)});var T4=C((pz,C4)=>{var jP=_4().Netmask,I4=ld(),HP=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],GP=HP.map(t=>new jP(t));function $P(t){for(let e of GP)if(e.contains(t))return!0;return!1}function YP(t){return/^::$/.test(t)||/^::1$/.test(t)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}C4.exports=t=>I4.v6().test(t)?YP(t):I4().test(t)||t.startsWith("0")?$P(t):!1});var jd=C((bz,k4)=>{"use strict";k4.exports=T4()});var B4=C((yz,R4)=>{"use strict";var WP=jd();function QP(t){let{address:e}=t.nodeAddress();return WP(e)}R4.exports=QP});var Hd=C((gz,P4)=>{"use strict";var N4=B4();function JP(t,e){let r=N4(t.multiaddr),i=N4(e.multiaddr);return r&&!i?1:!r&&i||t.isCertified&&!e.isCertified?-1:!t.isCertified&&e.isCertified?1:0}function XP(t){return[...t].sort(JP)}P4.exports.publicAddressesFirst=XP});var O4=C((vz,Gd)=>{"use strict";var M4=async t=>{try{let e=await t;return{isFulfilled:!0,isRejected:!1,value:e}}catch(e){return{isFulfilled:!1,isRejected:!0,reason:e}}};Gd.exports=M4;Gd.exports.default=M4});var L4=C((mz,$d)=>{"use strict";var D4=(t,...e)=>new Promise(r=>{r(t(...e))});$d.exports=D4;$d.exports.default=D4});var U4=C((xz,Yd)=>{"use strict";var ZP=L4(),q4=t=>{if(!((Number.isInteger(t)||t===Infinity)&&t>0))return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));let e=[],r=0,i=()=>{r--,e.length>0&&e.shift()()},n=(o,c,...f)=>{r++;let u=ZP(o,...f);c(u),u.then(i,i)},s=(o,c,...f)=>{rnew Promise(f=>s(o,f,...c));return Object.defineProperties(a,{activeCount:{get:()=>r},pendingCount:{get:()=>e.length},clearQueue:{value:()=>{e.length=0}}}),a};Yd.exports=q4;Yd.exports.default=q4});var K4=C((wz,F4)=>{"use strict";var Wd=O4(),eN=U4();F4.exports=async(t,e={})=>{let{concurrency:r=Infinity}=e,i=eN(r);return Promise.all(t.map(n=>n&&typeof n.then=="function"?Wd(n):typeof n=="function"?Wd(i(()=>n())):Wd(Promise.resolve(n))))}});var j4=C((Ez,V4)=>{"use strict";var Fa=Gi(),z4=Fa.Reader,tN=Fa.Writer,Tt=Fa.util,hc=Fa.roots["libp2p-envelope"]||(Fa.roots["libp2p-envelope"]={});hc.Envelope=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.publicKey=r.bytes();break;case 2:s.payloadType=r.bytes();break;case 3:s.payload=r.bytes();break;case 5:s.signature=r.bytes();break;default:r.skipType(a&7);break}}return s},t.fromObject=function(r){if(r instanceof hc.Envelope)return r;var i=new hc.Envelope;return r.publicKey!=null&&(typeof r.publicKey=="string"?Tt.base64.decode(r.publicKey,i.publicKey=Tt.newBuffer(Tt.base64.length(r.publicKey)),0):r.publicKey.length&&(i.publicKey=r.publicKey)),r.payloadType!=null&&(typeof r.payloadType=="string"?Tt.base64.decode(r.payloadType,i.payloadType=Tt.newBuffer(Tt.base64.length(r.payloadType)),0):r.payloadType.length&&(i.payloadType=r.payloadType)),r.payload!=null&&(typeof r.payload=="string"?Tt.base64.decode(r.payload,i.payload=Tt.newBuffer(Tt.base64.length(r.payload)),0):r.payload.length&&(i.payload=r.payload)),r.signature!=null&&(typeof r.signature=="string"?Tt.base64.decode(r.signature,i.signature=Tt.newBuffer(Tt.base64.length(r.signature)),0):r.signature.length&&(i.signature=r.signature)),i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(i.bytes===String?n.publicKey="":(n.publicKey=[],i.bytes!==Array&&(n.publicKey=Tt.newBuffer(n.publicKey))),i.bytes===String?n.payloadType="":(n.payloadType=[],i.bytes!==Array&&(n.payloadType=Tt.newBuffer(n.payloadType))),i.bytes===String?n.payload="":(n.payload=[],i.bytes!==Array&&(n.payload=Tt.newBuffer(n.payload))),i.bytes===String?n.signature="":(n.signature=[],i.bytes!==Array&&(n.signature=Tt.newBuffer(n.signature)))),r.publicKey!=null&&r.hasOwnProperty("publicKey")&&(n.publicKey=i.bytes===String?Tt.base64.encode(r.publicKey,0,r.publicKey.length):i.bytes===Array?Array.prototype.slice.call(r.publicKey):r.publicKey),r.payloadType!=null&&r.hasOwnProperty("payloadType")&&(n.payloadType=i.bytes===String?Tt.base64.encode(r.payloadType,0,r.payloadType.length):i.bytes===Array?Array.prototype.slice.call(r.payloadType):r.payloadType),r.payload!=null&&r.hasOwnProperty("payload")&&(n.payload=i.bytes===String?Tt.base64.encode(r.payload,0,r.payload.length):i.bytes===Array?Array.prototype.slice.call(r.payload):r.payload),r.signature!=null&&r.hasOwnProperty("signature")&&(n.signature=i.bytes===String?Tt.base64.encode(r.signature,0,r.signature.length):i.bytes===Array?Array.prototype.slice.call(r.signature):r.signature),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Fa.util.toJSONOptions)},t}();V4.exports=hc});var p0=C((Sz,H4)=>{"use strict";var rN=Pe(),iN=Zr(),nN=qt(),sN=Xf(),aN=Ut(),Qd=Bs(),h0=Mr(),{codes:oN}=Kt(),{Envelope:G4}=j4(),Vn=class{constructor({peerId:e,payloadType:r,payload:i,signature:n}){this.peerId=e,this.payloadType=r,this.payload=i,this.signature=n,this._marshal=void 0}marshal(){if(this._marshal)return this._marshal;let e=sN.marshalPublicKey(this.peerId.pubKey);return this._marshal=G4.encode({publicKey:e,payloadType:this.payloadType,payload:this.payload,signature:this.signature}).finish(),this._marshal}equals(e){return h0(this.peerId.pubKey.bytes,e.peerId.pubKey.bytes)&&h0(this.payloadType,e.payloadType)&&h0(this.payload,e.payload)&&h0(this.signature,e.signature)}validate(e){let r=$4(e,this.payloadType,this.payload);return this.peerId.pubKey.verify(r,this.signature)}},$4=(t,e,r)=>{let i=nN(t),n=Qd.encode(i.byteLength),s=Qd.encode(e.length),a=Qd.encode(r.length);return iN([new Uint8Array(n),i,new Uint8Array(s),e,new Uint8Array(a),r])};Vn.createFromProtobuf=async t=>{let e=G4.decode(t),r=await aN.createFromPubKey(e.publicKey);return new Vn({peerId:r,payloadType:e.payloadType,payload:e.payload,signature:e.signature})};Vn.seal=async(t,e)=>{let r=t.domain,i=t.codec,n=t.marshal(),s=$4(r,i,n),a=await e.privKey.sign(s);return new Vn({peerId:e,payloadType:i,payload:n,signature:a})};Vn.openAndCertify=async(t,e)=>{let r=await Vn.createFromProtobuf(t);if(!await r.validate(e))throw rN(new Error("envelope signature is not valid for the given domain"),oN.ERR_SIGNATURE_NOT_VALID);return r};H4.exports=Vn});var W4=C((Az,Y4)=>{"use strict";function cN(t,e){return t.length===e.length&&e.sort()&&t.sort().every((r,i)=>e[i].equals(r))}Y4.exports=cN});var X4=C((_z,Q4)=>{"use strict";var Ps=Gi(),b0=Ps.Reader,J4=Ps.Writer,Pt=Ps.util,Gr=Ps.roots["libp2p-peer-record"]||(Ps.roots["libp2p-peer-record"]={});Gr.PeerRecord=function(){function t(e){if(this.addresses=[],e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.peerId=r.bytes();break;case 2:s.seq=r.uint64();break;case 3:s.addresses&&s.addresses.length||(s.addresses=[]),s.addresses.push(Gr.PeerRecord.AddressInfo.decode(r,r.uint32()));break;default:r.skipType(a&7);break}}return s},t.fromObject=function(r){if(r instanceof Gr.PeerRecord)return r;var i=new Gr.PeerRecord;if(r.peerId!=null&&(typeof r.peerId=="string"?Pt.base64.decode(r.peerId,i.peerId=Pt.newBuffer(Pt.base64.length(r.peerId)),0):r.peerId.length&&(i.peerId=r.peerId)),r.seq!=null&&(Pt.Long?(i.seq=Pt.Long.fromValue(r.seq)).unsigned=!0:typeof r.seq=="string"?i.seq=parseInt(r.seq,10):typeof r.seq=="number"?i.seq=r.seq:typeof r.seq=="object"&&(i.seq=new Pt.LongBits(r.seq.low>>>0,r.seq.high>>>0).toNumber(!0))),r.addresses){if(!Array.isArray(r.addresses))throw TypeError(".PeerRecord.addresses: array expected");i.addresses=[];for(var n=0;n>>0,r.seq.high>>>0).toNumber(!0):r.seq),r.addresses&&r.addresses.length){n.addresses=[];for(var a=0;a>>3){case 1:a.multiaddr=i.bytes();break;default:i.skipType(o&7);break}}return a},e.fromObject=function(i){if(i instanceof Gr.PeerRecord.AddressInfo)return i;var n=new Gr.PeerRecord.AddressInfo;return i.multiaddr!=null&&(typeof i.multiaddr=="string"?Pt.base64.decode(i.multiaddr,n.multiaddr=Pt.newBuffer(Pt.base64.length(i.multiaddr)),0):i.multiaddr.length&&(n.multiaddr=i.multiaddr)),n},e.toObject=function(i,n){n||(n={});var s={};return n.defaults&&(n.bytes===String?s.multiaddr="":(s.multiaddr=[],n.bytes!==Array&&(s.multiaddr=Pt.newBuffer(s.multiaddr)))),i.multiaddr!=null&&i.hasOwnProperty("multiaddr")&&(s.multiaddr=n.bytes===String?Pt.base64.encode(i.multiaddr,0,i.multiaddr.length):n.bytes===Array?Array.prototype.slice.call(i.multiaddr):i.multiaddr),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Ps.util.toJSONOptions)},e}(),t}();Q4.exports=Gr});var tx=C((Cz,Z4)=>{"use strict";var ex=Mu(),fN=ex.getName(ex.LIBP2P_PEER_RECORD)||"libp2p-peer-record",uN=Uint8Array.from([3,1]);Z4.exports={ENVELOPE_DOMAIN_PEER_RECORD:fN,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:uN}});var y0=C((Iz,rx)=>{"use strict";var{Multiaddr:lN}=dr(),dN=Ut(),hN=W4(),{PeerRecord:ix}=X4(),{ENVELOPE_DOMAIN_PEER_RECORD:nx,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:pN}=tx(),Ns=class{constructor({peerId:e,multiaddrs:r=[],seqNumber:i=Date.now()}){this.domain=nx,this.codec=pN,this.peerId=e,this.multiaddrs=r,this.seqNumber=i,this._marshal=void 0}marshal(){return this._marshal?this._marshal:(this._marshal=ix.encode({peerId:this.peerId.toBytes(),seq:this.seqNumber,addresses:this.multiaddrs.map(e=>({multiaddr:e.bytes}))}).finish(),this._marshal)}equals(e){return!(!(e instanceof Ns)||!this.peerId.equals(e.peerId)||this.seqNumber!==e.seqNumber||!hN(this.multiaddrs,e.multiaddrs))}};Ns.createFromProtobuf=t=>{let e=ix.decode(t),r=dN.createFromBytes(e.peerId),i=(e.addresses||[]).map(s=>new lN(s.multiaddr)),n=Number(e.seq);return new Ns({peerId:r,multiaddrs:i,seqNumber:n})};Ns.DOMAIN=nx;rx.exports=Ns});var Jd=C((Tz,sx)=>{"use strict";var bN=p0(),yN=y0();async function gN(t){let e=new yN({peerId:t.peerId,multiaddrs:t.multiaddrs}),r=await bN.seal(e,t.peerId);t.peerStore.addressBook.consumePeerRecord(r)}sx.exports.updateSelfPeerRecord=gN});var Zd=C((kz,ax)=>{"use strict";var ox=Xe(),Ms=Object.assign(ox("libp2p:transports"),{error:ox("libp2p:transports:err")}),vN=K4(),{codes:Ka}=Kt(),pc=Pe(),{updateSelfPeerRecord:cx}=Jd(),Xd=class{constructor({libp2p:e,upgrader:r,faultTolerance:i=g0.FATAL_ALL}){this.libp2p=e,this.upgrader=r,this._transports=new Map,this._listeners=new Map,this._listenerOptions=new Map,this.faultTolerance=i}add(e,r,i={}){if(Ms("adding %s",e),!e)throw pc(new Error(`Transport must have a valid key, was given '${e}'`),Ka.ERR_INVALID_KEY);if(this._transports.has(e))throw pc(new Error("There is already a transport with this key"),Ka.ERR_DUPLICATE_TRANSPORT);let n=new r({...i,libp2p:this.libp2p,upgrader:this.upgrader});this._transports.set(e,n),this._listenerOptions.set(e,i.listenerOptions||{}),this._listeners.has(e)||this._listeners.set(e,[])}async close(){let e=[];for(let[r,i]of this._listeners)for(Ms("closing listeners for %s",r);i.length;){let n=i.pop();n.removeAllListeners("listening"),n.removeAllListeners("close"),e.push(n.close())}await Promise.all(e),Ms("all listeners closed");for(let r of this._listeners.keys())this._listeners.set(r,[])}async dial(e,r){let i=this.transportForMultiaddr(e);if(!i)throw pc(new Error(`No transport available for address ${String(e)}`),Ka.ERR_TRANSPORT_UNAVAILABLE);try{return await i.dial(e,r)}catch(n){throw n.code||(n.code=Ka.ERR_TRANSPORT_DIAL_FAILED),n}}getAddrs(){let e=[];for(let r of this._listeners.values())for(let i of r)e=[...e,...i.getAddrs()];return e}getTransports(){return this._transports.values()}transportForMultiaddr(e){for(let r of this._transports.values())if(r.filter([e]).length)return r;return null}async listen(e){if(!e||e.length===0){Ms("no addresses were provided for listening, this node is dial only");return}let r=[];for(let[i,n]of this._transports.entries()){let s=n.filter(e),a=[];for(let f of s){Ms("creating listener for %s on %s",i,f);let u=n.createListener(this._listenerOptions.get(i));this._listeners.get(i).push(u),u.on("listening",()=>cx(this.libp2p)),u.on("close",()=>cx(this.libp2p)),a.push(u.listen(f))}if(a.length===0){r.push(i);continue}if(!(await vN(a)).find(f=>f.isFulfilled===!0)&&this.faultTolerance!==g0.NO_FATAL)throw pc(new Error(`Transport (${i}) could not listen on any available address`),Ka.ERR_NO_VALID_ADDRESSES)}if(r.length===this._transports.size){let i=`no valid addresses were provided for transports [${r}]`;if(this.faultTolerance===g0.FATAL_ALL)throw pc(new Error(i),Ka.ERR_NO_VALID_ADDRESSES);Ms(`libp2p in dial mode only: ${i}`)}}async remove(e){if(Ms("removing %s",e),this._listeners.has(e))for(let r of this._listeners.get(e))r.removeAllListeners("listening"),r.removeAllListeners("close"),await r.close();this._transports.delete(e),this._listeners.delete(e)}async removeAll(){let e=[];for(let r of this._transports.keys())e.push(this.remove(r));await Promise.all(e)}},g0={FATAL_ALL:0,NO_FATAL:1};Xd.FaultTolerance=g0;ax.exports=Xd});var lx=C((Rz,fx)=>{"use strict";var mN=fc(),{dnsaddrResolver:xN}=x4(),eh=l0(),{AGENT_VERSION:wN}=zd(),ux=d0(),{publicAddressesFirst:EN}=Hd(),{FaultTolerance:SN}=Zd(),AN={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:t=>t},connectionManager:{minConnections:25},transportManager:{faultTolerance:SN.FATAL_ALL},dialer:{maxParallelDials:eh.MAX_PARALLEL_DIALS,maxDialsPerPeer:eh.MAX_PER_PEER_DIALS,dialTimeout:eh.DIAL_TIMEOUT,resolvers:{dnsaddr:xN},addressSorter:EN},host:{agentVersion:wN},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{dht:{enabled:!1,kBucketSize:20,randomWalk:{enabled:!1,queriesPerPeriod:1,interval:3e5,timeout:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0,gateway:null,externalIp:null,pmp:{enabled:!1}},peerDiscovery:{autoDial:!0},pubsub:{enabled:!0},relay:{enabled:!0,advertise:{bootDelay:ux.ADVERTISE_BOOT_DELAY,enabled:!1,ttl:ux.ADVERTISE_TTL},hop:{enabled:!1,active:!1},autoRelay:{enabled:!1,maxListeners:2}},transport:{}}};fx.exports.validate=t=>{let e=mN(AN,t);if(e.modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return e}});var px=C((Bz,dx)=>{"use strict";var{EventEmitter:_N}=ji(),{Multiaddr:bc}=dr(),CN=Ut(),hx=class extends _N{constructor(e,{listen:r=[],announce:i=[]}={}){super();this.peerId=e,this.listen=new Set(r.map(n=>n.toString())),this.announce=new Set(i.map(n=>n.toString())),this.observed=new Set}getListenAddrs(){return Array.from(this.listen).map(e=>new bc(e))}getAnnounceAddrs(){return Array.from(this.announce).map(e=>new bc(e))}getObservedAddrs(){return Array.from(this.observed).map(e=>new bc(e))}addObservedAddr(e){let r=new bc(e),i=r.getPeerId();i&&CN.createFromB58String(i).equals(this.peerId)&&(r=r.decapsulate(new bc(`/p2p/${this.peerId}`)));let n=r.toString();this.observed.has(n)||(this.observed.add(n),this.emit("change:addresses"))}};dx.exports=hx});var gx=C((Pz,bx)=>{"use strict";var{EventEmitter:IN}=ji(),th=Xe()("latency-monitor:VisibilityChangeEmitter"),yx=class extends IN{constructor(){super();if(typeof document=="undefined"){th('This is not a browser, no "document" found. Stopping.');return}this._initializeVisibilityVarNames(),this._addVisibilityChangeListener()}_initializeVisibilityVarNames(){let e,r;typeof document.hidden!="undefined"?(e="hidden",r="visibilitychange"):typeof document.mozHidden!="undefined"?(e="mozHidden",r="mozvisibilitychange"):typeof document.msHidden!="undefined"?(e="msHidden",r="msvisibilitychange"):typeof document.webkitHidden!="undefined"&&(e="webkitHidden",r="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=r}_addVisibilityChangeListener(){typeof document.addEventListener=="undefined"||typeof document[this._hidden]=="undefined"?th("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(!(this._hidden===void 0||document[this._hidden]===void 0))return!document[this._hidden]}_handleVisibilityChange(){let e=!document[this._hidden];th(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}};bx.exports=yx});var xx=C((Nz,vx)=>{"use strict";var{EventEmitter:TN}=ji(),kN=gx(),an=Xe()("latency-monitor:LatencyMonitor"),mx=class extends TN{constructor({latencyCheckIntervalMs:e,dataEmitIntervalMs:r,asyncTestFn:i,latencyRandomPercentage:n}={}){super();let s=this;s.latencyCheckIntervalMs=e||500,s.latencyRandomPercentage=n||10,s._latecyCheckMultiply=2*(s.latencyRandomPercentage/100)*s.latencyCheckIntervalMs,s._latecyCheckSubtract=s._latecyCheckMultiply/2,s.dataEmitIntervalMs=r===null||r===0?void 0:r||5*1e3,an("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",s.latencyCheckIntervalMs,s.dataEmitIntervalMs),s.dataEmitIntervalMs?an("Expecting ~%s events per summary",s.latencyCheckIntervalMs/s.dataEmitIntervalMs):an("Not emitting summaries"),s.asyncTestFn=i,globalThis.process&&globalThis.process.hrtime?(an("Using process.hrtime for timing"),s.now=globalThis.process.hrtime,s.getDeltaMS=a=>{let o=s.now(a);return o[0]*1e3+o[1]/1e6}):typeof window!="undefined"&&window.performance&&window.performance.now?(an("Using performance.now for timing"),s.now=window.performance.now.bind(window.performance),s.getDeltaMS=a=>Math.round(s.now()-a)):(an("Using Date.now for timing"),s.now=Date.now,s.getDeltaMS=a=>s.now()-a),s._latencyData=s._initLatencyData(),RN()&&(s._visibilityChangeEmitter=new kN,s._visibilityChangeEmitter.on("visibilityChange",a=>{a?s._startTimers():(s._emitSummary(),s._stopTimers())})),(!s._visibilityChangeEmitter||s._visibilityChangeEmitter.isVisible())&&s._startTimers()}_startTimers(){this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval(()=>this._emitSummary(),this.dataEmitIntervalMs),typeof this._emitIntervalID.unref=="function"&&this._emitIntervalID.unref()))}_stopTimers(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}_emitSummary(){let e=this.getSummary();e.events>0&&this.emit("data",e)}getSummary(){let e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),an("Summary: %O",e),e}_checkLatency(){let e=this,r=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,i={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+r),startTime:e.now()},n=()=>{if(!this._checkLatencyID)return;let s=e.getDeltaMS(i.startTime)-i.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,s),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,s),e._latencyData.totalMs+=s,an("MS: %s Data: %O",s,e._latencyData)};an("localData: %O",i),this._checkLatencyID=setTimeout(()=>{e.asyncTestFn?(i.deltaOffset=0,i.startTime=e.now(),e.asyncTestFn(n)):(i.deltaOffset-=1,n())},i.deltaOffset),typeof this._checkLatencyID.unref=="function"&&this._checkLatencyID.unref()}_initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}};function RN(){return typeof window!="undefined"}vx.exports=mx});var Ex=C((Mz,wx)=>{"use strict";wx.exports=function(){return Date.now()}});var rh=C((Oz,Sx)=>{"use strict";var v0=Ex(),Ax=class{constructor(e,r,i){let n=this;this._started=v0(),this._rescheduled=0,this._scheduled=r,this._args=i,this._triggered=!1,this._timerWrapper=()=>{n._rescheduled>0?(n._scheduled=n._rescheduled-(v0()-n._started),n._schedule(n._scheduled)):(n._triggered=!0,e.apply(null,n._args))},this._timer=setTimeout(this._timerWrapper,r)}reschedule(e){e||(e=this._scheduled);let r=v0();r+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=r,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=v0(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}};function BN(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("timeout needed");let t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e{"use strict";var Cx=Xe(),di=Object.assign(Cx("libp2p:connection-manager"),{error:Cx("libp2p:connection-manager:err")}),Ix=Pe(),PN=fc(),NN=xx(),m0=rh(),{EventEmitter:MN}=ji(),ON=Ut(),{codes:{ERR_INVALID_PARAMETERS:Tx}}=Kt(),DN={maxConnections:Infinity,minConnections:0,maxData:Infinity,maxSentData:Infinity,maxReceivedData:Infinity,maxEventLoopDelay:Infinity,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,defaultPeerValue:1},kx=class extends MN{constructor(e,r={}){super();if(this._libp2p=e,this._peerId=e.peerId.toB58String(),this._options=PN.call({ignoreUndefined:!0},DN,r),this._options.maxConnectionse+r.length,0)}start(){this._libp2p.metrics&&(this._timer=this._timer||m0(this._checkMetrics,this._options.pollInterval)),this._latencyMonitor=new NN({latencyCheckIntervalMs:this._options.pollInterval,dataEmitIntervalMs:this._options.pollInterval}),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure),this._started=!0,di("started"),this._options.autoDial&&this._autoDial()}async stop(){this._autoDialTimeout&&this._autoDialTimeout.clear(),this._timer&&this._timer.clear(),this._latencyMonitor&&this._latencyMonitor.removeListener("data",this._onLatencyMeasure),this._started=!1,await this._close(),di("stopped")}async _close(){let e=[];for(let r of this.connections.values())for(let i of r)e.push(i.close());await Promise.all(e),this.connections.clear()}setPeerValue(e,r){if(r<0||r>1)throw new Error("value should be a number between 0 and 1");this._peerValues.set(e.toB58String(),r)}_checkMetrics(){if(this._libp2p.metrics){let e=this._libp2p.metrics.global.movingAverages,r=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxReceivedData",r);let i=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxSentData",i);let n=r+i;this._checkMaxLimit("maxData",n),di("metrics update",n),this._timer=m0(this._checkMetrics,this._options.pollInterval)}}onConnect(e){let r=e.remotePeer,i=r.toB58String(),n=this.connections.get(i);this.emit("peer:connect",e),n?n.push(e):this.connections.set(i,[e]),this._libp2p.peerStore.keyBook.set(r,r.pubKey),this._peerValues.has(i)||this._peerValues.set(i,this._options.defaultPeerValue),this._checkMaxLimit("maxConnections",this.size)}onDisconnect(e){let r=e.remotePeer.toB58String(),i=this.connections.get(r);i&&i.length>1?(i=i.filter(n=>n.id!==e.id),this.connections.set(r,i)):i&&(this.connections.delete(r),this._peerValues.delete(e.remotePeer.toB58String()),this.emit("peer:disconnect",e))}get(e){let r=this.getAll(e);return r.length?r[0]:null}getAll(e){if(!ON.isPeerId(e))throw Ix(new Error("peerId must be an instance of peer-id"),Tx);let r=e.toB58String(),i=this.connections.get(r);return i?i.filter(n=>n.stat.status==="open"):[]}_onLatencyMeasure(e){this._checkMaxLimit("maxEventLoopDelay",e.avgMs)}_checkMaxLimit(e,r){let i=this._options[e];di("checking limit of %s. current value: %d of %d",e,r,i),r>i&&(di("%s: limit exceeded: %s, %d",this._peerId,e,r),this._maybeDisconnectOne())}async _autoDial(){let e=this._options.minConnections;if(this.size>=e){this._autoDialTimeout=m0(this._autoDial,this._options.autoDialInterval);return}let r=Array.from(this._libp2p.peerStore.peers.values()).sort((i,n)=>n.protocols&&n.protocols.length&&(!i.protocols||!i.protocols.length)||n.id.pubKey&&!i.id.pubKey?1:-1);for(let i=0;ii[1]-n[1])));di("%s: sorted peer values: %j",this._peerId,e);let r=e[0];if(r){let i=r[0];di("%s: lowest value peer is %s",this._peerId,i),di("%s: closing a connection to %j",this._peerId,i);for(let n of this.connections.values())if(n[0].remotePeer.toB58String()===i){n[0].close();break}}}}};_x.exports=kx});var Kx=C((Lz,Bx)=>{"use strict";var{Multiaddr:ih}=dr(),Px=Ie("dns4"),Nx=Ie("dns6"),Mx=Ie("dnsaddr"),Os=hr(Ie("dns"),Mx,Px,Nx),yc=hr(Ie("ip4"),Ie("ip6")),Va=hr(Le(yc,Ie("tcp")),Le(Os,Ie("tcp"))),nh=Le(yc,Ie("udp")),Ox=Le(nh,Ie("utp")),Dx=Le(nh,Ie("quic")),za=hr(Le(Va,Ie("ws")),Le(Os,Ie("ws"))),ja=hr(Le(Va,Ie("wss")),Le(Os,Ie("wss"))),x0=hr(Le(Va,Ie("http")),Le(yc,Ie("http")),Le(Os,Ie("http"))),w0=hr(Le(Va,Ie("https")),Le(yc,Ie("https")),Le(Os,Ie("https"))),sh=hr(Le(za,Ie("p2p-webrtc-star"),Ie("p2p")),Le(ja,Ie("p2p-webrtc-star"),Ie("p2p")),Le(za,Ie("p2p-webrtc-star")),Le(ja,Ie("p2p-webrtc-star"))),LN=hr(Le(za,Ie("p2p-websocket-star"),Ie("p2p")),Le(ja,Ie("p2p-websocket-star"),Ie("p2p")),Le(za,Ie("p2p-websocket-star")),Le(ja,Ie("p2p-websocket-star"))),ah=hr(Le(x0,Ie("p2p-webrtc-direct"),Ie("p2p")),Le(w0,Ie("p2p-webrtc-direct"),Ie("p2p")),Le(x0,Ie("p2p-webrtc-direct")),Le(w0,Ie("p2p-webrtc-direct"))),Ha=hr(za,ja,x0,w0,sh,ah,Va,Ox,Dx,Os),qN=hr(Le(Ha,Ie("p2p-stardust"),Ie("p2p")),Le(Ha,Ie("p2p-stardust"))),zn=hr(Le(Ha,Ie("p2p")),sh,ah,Ie("p2p")),Lx=hr(Le(zn,Ie("p2p-circuit"),zn),Le(zn,Ie("p2p-circuit")),Le(Ie("p2p-circuit"),zn),Le(Ha,Ie("p2p-circuit")),Le(Ie("p2p-circuit"),Ha),Ie("p2p-circuit")),qx=()=>hr(Le(Lx,qx),Lx),Ga=qx(),Ux=hr(Le(Ga,zn,Ga),Le(zn,Ga),Le(Ga,zn),Ga,zn);Bx.exports={DNS:Os,DNS4:Px,DNS6:Nx,DNSADDR:Mx,IP:yc,TCP:Va,UDP:nh,QUIC:Dx,UTP:Ox,HTTP:x0,HTTPS:w0,WebSockets:za,WebSocketsSecure:ja,WebSocketStar:LN,WebRTCStar:sh,WebRTCDirect:ah,Reliable:Ha,Stardust:qN,Circuit:Ga,P2P:Ux,IPFS:Ux};function Fx(t){function e(r){if(!ih.isMultiaddr(r))try{r=new ih(r)}catch(n){return!1}let i=t(r.protoNames());return i===null?!1:i===!0||i===!1?i:i.length===0}return e}function Le(...t){function e(r){if(r.length(i=typeof n=="function"?n().partialMatch(r):n.partialMatch(r),Array.isArray(i)&&(r=i),i===null)),i}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:Fx(e),partialMatch:e}}function hr(...t){function e(i){let n=null;return t.some(s=>{let a=typeof s=="function"?s().partialMatch(i):s.partialMatch(i);return a?(n=a,!0):!1}),n}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:Fx(e),partialMatch:e}}function Ie(t){let e=t;function r(n){if(typeof n=="string")try{n=new ih(n)}catch(a){return!1}let s=n.protoNames();return s.length===1&&s[0]===e}function i(n){return n.length===0?null:n[0]===e?n.slice(1):null}return{toString:function(){return e},matches:r,partialMatch:i}}});var $a=C((qz,Vx)=>{"use strict";var Ds=Gi(),E0=Ds.Reader,zx=Ds.Writer,$r=Ds.util,er=Ds.roots["libp2p-circuit"]||(Ds.roots["libp2p-circuit"]={});er.CircuitRelay=function(){function t(e){if(e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.type=r.int32();break;case 2:s.srcPeer=er.CircuitRelay.Peer.decode(r,r.uint32());break;case 3:s.dstPeer=er.CircuitRelay.Peer.decode(r,r.uint32());break;case 4:s.code=r.int32();break;default:r.skipType(a&7);break}}return s},t.fromObject=function(r){if(r instanceof er.CircuitRelay)return r;var i=new er.CircuitRelay;switch(r.type){case"HOP":case 1:i.type=1;break;case"STOP":case 2:i.type=2;break;case"STATUS":case 3:i.type=3;break;case"CAN_HOP":case 4:i.type=4;break}if(r.srcPeer!=null){if(typeof r.srcPeer!="object")throw TypeError(".CircuitRelay.srcPeer: object expected");i.srcPeer=er.CircuitRelay.Peer.fromObject(r.srcPeer)}if(r.dstPeer!=null){if(typeof r.dstPeer!="object")throw TypeError(".CircuitRelay.dstPeer: object expected");i.dstPeer=er.CircuitRelay.Peer.fromObject(r.dstPeer)}switch(r.code){case"SUCCESS":case 100:i.code=100;break;case"HOP_SRC_ADDR_TOO_LONG":case 220:i.code=220;break;case"HOP_DST_ADDR_TOO_LONG":case 221:i.code=221;break;case"HOP_SRC_MULTIADDR_INVALID":case 250:i.code=250;break;case"HOP_DST_MULTIADDR_INVALID":case 251:i.code=251;break;case"HOP_NO_CONN_TO_DST":case 260:i.code=260;break;case"HOP_CANT_DIAL_DST":case 261:i.code=261;break;case"HOP_CANT_OPEN_DST_STREAM":case 262:i.code=262;break;case"HOP_CANT_SPEAK_RELAY":case 270:i.code=270;break;case"HOP_CANT_RELAY_TO_SELF":case 280:i.code=280;break;case"STOP_SRC_ADDR_TOO_LONG":case 320:i.code=320;break;case"STOP_DST_ADDR_TOO_LONG":case 321:i.code=321;break;case"STOP_SRC_MULTIADDR_INVALID":case 350:i.code=350;break;case"STOP_DST_MULTIADDR_INVALID":case 351:i.code=351;break;case"STOP_RELAY_REFUSED":case 390:i.code=390;break;case"MALFORMED_MESSAGE":case 400:i.code=400;break}return i},t.toObject=function(r,i){i||(i={});var n={};return i.defaults&&(n.type=i.enums===String?"HOP":1,n.srcPeer=null,n.dstPeer=null,n.code=i.enums===String?"SUCCESS":100),r.type!=null&&r.hasOwnProperty("type")&&(n.type=i.enums===String?er.CircuitRelay.Type[r.type]:r.type),r.srcPeer!=null&&r.hasOwnProperty("srcPeer")&&(n.srcPeer=er.CircuitRelay.Peer.toObject(r.srcPeer,i)),r.dstPeer!=null&&r.hasOwnProperty("dstPeer")&&(n.dstPeer=er.CircuitRelay.Peer.toObject(r.dstPeer,i)),r.code!=null&&r.hasOwnProperty("code")&&(n.code=i.enums===String?er.CircuitRelay.Status[r.code]:r.code),n},t.prototype.toJSON=function(){return this.constructor.toObject(this,Ds.util.toJSONOptions)},t.Status=function(){var e={},r=Object.create(e);return r[e[100]="SUCCESS"]=100,r[e[220]="HOP_SRC_ADDR_TOO_LONG"]=220,r[e[221]="HOP_DST_ADDR_TOO_LONG"]=221,r[e[250]="HOP_SRC_MULTIADDR_INVALID"]=250,r[e[251]="HOP_DST_MULTIADDR_INVALID"]=251,r[e[260]="HOP_NO_CONN_TO_DST"]=260,r[e[261]="HOP_CANT_DIAL_DST"]=261,r[e[262]="HOP_CANT_OPEN_DST_STREAM"]=262,r[e[270]="HOP_CANT_SPEAK_RELAY"]=270,r[e[280]="HOP_CANT_RELAY_TO_SELF"]=280,r[e[320]="STOP_SRC_ADDR_TOO_LONG"]=320,r[e[321]="STOP_DST_ADDR_TOO_LONG"]=321,r[e[350]="STOP_SRC_MULTIADDR_INVALID"]=350,r[e[351]="STOP_DST_MULTIADDR_INVALID"]=351,r[e[390]="STOP_RELAY_REFUSED"]=390,r[e[400]="MALFORMED_MESSAGE"]=400,r}(),t.Type=function(){var e={},r=Object.create(e);return r[e[1]="HOP"]=1,r[e[2]="STOP"]=2,r[e[3]="STATUS"]=3,r[e[4]="CAN_HOP"]=4,r}(),t.Peer=function(){function e(r){if(this.addrs=[],r)for(var i=Object.keys(r),n=0;n>>3){case 1:a.id=i.bytes();break;case 2:a.addrs&&a.addrs.length||(a.addrs=[]),a.addrs.push(i.bytes());break;default:i.skipType(o&7);break}}if(!a.hasOwnProperty("id"))throw $r.ProtocolError("missing required 'id'",{instance:a});return a},e.fromObject=function(i){if(i instanceof er.CircuitRelay.Peer)return i;var n=new er.CircuitRelay.Peer;if(i.id!=null&&(typeof i.id=="string"?$r.base64.decode(i.id,n.id=$r.newBuffer($r.base64.length(i.id)),0):i.id.length&&(n.id=i.id)),i.addrs){if(!Array.isArray(i.addrs))throw TypeError(".CircuitRelay.Peer.addrs: array expected");n.addrs=[];for(var s=0;s{jx.exports=function(e){if(e){if(typeof e[Symbol.iterator]=="function")return e[Symbol.iterator]();if(typeof e[Symbol.asyncIterator]=="function")return e[Symbol.asyncIterator]();if(typeof e.next=="function")return e}throw new Error("argument is not an iterator or iterable")}});var $x=C((Kz,Gx)=>{Gx.exports=class extends Error{constructor(e,r){super(e||"The operation was aborted");this.type="aborted",this.code=r||"ABORT_ERR"}}});var Jx=C((Vz,Ls)=>{var UN=Hx(),oh=$x(),Yx=(t,e,r)=>ch(t,Array.isArray(e)?e:[{signal:e,options:r}]),ch=(t,e)=>{t=UN(t),e=e.map(({signal:i,options:n})=>({signal:i,options:n||{}}));async function*r(){let i,n=()=>{i&&i()};for(let{signal:s}of e)s.addEventListener("abort",n);for(;;){let s;try{for(let{signal:o,options:c}of e)if(o.aborted){let{abortMessage:f,abortCode:u}=c;throw new oh(f,u)}let a=new Promise((o,c)=>{i=()=>{let{options:f}=e.find(({signal:b})=>b.aborted),{abortMessage:u,abortCode:l}=f;c(new oh(u,l))}});s=await Promise.race([a,t.next()]),i=null}catch(a){for(let{signal:f}of e)f.removeEventListener("abort",n);let o=e.find(({signal:f})=>f.aborted),c=a.type==="aborted"&&o;if(c&&o.options.onAbort&&await o.options.onAbort(t),typeof t.return=="function"&&await t.return(),c&&o.options.returnOnAbort)return;throw a}if(s.done)break;yield s.value}for(let{signal:s}of e)s.removeEventListener("abort",n)}return r()},Qx=(t,e,r)=>Wx(t,Array.isArray(e)?e:[{signal:e,options:r}]),Wx=(t,e)=>r=>t(ch(r,e)),KN=(t,e,r)=>FN(t,Array.isArray(e)?e:[{signal:e,options:r}]),FN=(t,e)=>({sink:Wx(t.sink,e),source:ch(t.source,e)});Ls.exports=Yx;Ls.exports.AbortError=oh;Ls.exports.source=Yx;Ls.exports.sink=Qx;Ls.exports.transform=Qx;Ls.exports.duplex=KN});var e6=C((zz,Xx)=>{"use strict";var{source:Zx}=Jx(),VN=Xe(),zN=VN("libp2p:stream:converter");function jN({stream:t,remoteAddr:e,localAddr:r},i={}){let{sink:n,source:s}=t,a={async sink(c){i.signal&&(c=Zx(c,i.signal));try{await n(c)}catch(f){f.type!=="aborted"&&zN(f)}o()},source:i.signal?Zx(s,i.signal):s,conn:t,localAddr:r,remoteAddr:e,timeline:{open:Date.now(),close:void 0},close(){return n(new Uint8Array(0)),o()}};function o(){return a.timeline.close||(a.timeline.close=Date.now()),Promise.resolve()}return a}Xx.exports=jN});var gc=C((jz,t6)=>{"use strict";t6.exports={relay:"/libp2p/circuit/relay/0.1.0"}});var i6=C((Hz,r6)=>{"use strict";var{EventEmitter:HN}=ji(),{Multiaddr:GN}=dr();r6.exports=t=>{let e=new Map;async function r(s){let a=String(s).split("/p2p-circuit").find(f=>f!==""),o=await t.dial(new GN(a)),c=o.remoteAddr.encapsulate("/p2p-circuit");e.set(o.remotePeer.toB58String(),c),n.emit("listening")}function i(){let s=[];for(let a of e.values())s.push(a);return s}let n=Object.assign(new HN,{close:()=>Promise.resolve(),listen:r,getAddrs:i});return t.connectionManager.on("peer:disconnect",s=>{e.delete(s.remotePeer.toB58String())&&n.emit("close")}),n}});var fh=C((Gz,n6)=>{"use strict";var{Multiaddr:s6}=dr(),{CircuitRelay:qs}=$a();function a6(t,e){t.write({type:qs.Type.STATUS,code:e})}function $N(t,e){try{t.dstPeer&&t.dstPeer.addrs&&t.dstPeer.addrs.forEach(r=>new s6(r))}catch(r){throw a6(e,t.type===qs.Type.HOP?qs.Status.HOP_DST_MULTIADDR_INVALID:qs.Status.STOP_DST_MULTIADDR_INVALID),r}try{t.srcPeer&&t.srcPeer.addrs&&t.srcPeer.addrs.forEach(r=>new s6(r))}catch(r){throw a6(e,t.type===qs.Type.HOP?qs.Status.HOP_SRC_MULTIADDR_INVALID:qs.Status.STOP_SRC_MULTIADDR_INVALID),r}}n6.exports={validateAddrs:$N}});var c6=C(S0=>{"use strict";S0.byteLength=YN;S0.toByteArray=WN;S0.fromByteArray=QN;var Fi=[],Yr=[],JN=typeof Uint8Array!="undefined"?Uint8Array:Array,uh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ya=0,XN=uh.length;Ya0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function YN(t){var e=o6(t),r=e[0],i=e[1];return(r+i)*3/4-i}function ZN(t,e,r){return(e+r)*3/4-r}function WN(t){var e,r=o6(t),i=r[0],n=r[1],s=new JN(ZN(t,i,n)),a=0,o=n>0?i-4:i,c;for(c=0;c>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=Yr[t.charCodeAt(c)]<<2|Yr[t.charCodeAt(c+1)]>>4,s[a++]=e&255),n===1&&(e=Yr[t.charCodeAt(c)]<<10|Yr[t.charCodeAt(c+1)]<<4|Yr[t.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function eM(t){return Fi[t>>18&63]+Fi[t>>12&63]+Fi[t>>6&63]+Fi[t&63]}function tM(t,e,r){for(var i,n=[],s=e;so?o:a+s));return i===1?(e=t[r-1],n.push(Fi[e>>2]+Fi[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(Fi[e>>10]+Fi[e>>4&63]+Fi[e<<2&63]+"=")),n.join("")}});var f6=C(lh=>{lh.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,c=(1<>1,u=-7,l=r?n-1:0,b=r?-1:1,p=t[e+l];for(l+=b,s=p&(1<<-u)-1,p>>=-u,u+=o;u>0;s=s*256+t[e+l],l+=b,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+l],l+=b,u-=8);if(s===0)s=1-f;else{if(s===c)return a?NaN:(p?-1:1)*Infinity;a=a+Math.pow(2,i),s=s-f}return(p?-1:1)*a*Math.pow(2,s-i)};lh.write=function(t,e,r,i,n,s){var a,o,c,f=s*8-n-1,u=(1<>1,b=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,g=i?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===Infinity?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+l>=1?e+=b/c:e+=b*Math.pow(2,1-l),e*c>=2&&(a++,c/=2),a+l>=u?(o=0,a=u):a+l>=1?(o=(e*c-1)*Math.pow(2,n),a=a+l):(o=e*Math.pow(2,l-1)*Math.pow(2,n),a=0));n>=8;t[r+p]=o&255,p+=g,o/=256,n-=8);for(a=a<0;t[r+p]=a&255,p+=g,a/=256,f-=8);t[r+p-g]|=A*128}});var Hn=C(Wa=>{"use strict";var dh=c6(),Qa=f6(),u6=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Wa.Buffer=ie;Wa.SlowBuffer=rM;Wa.INSPECT_MAX_BYTES=50;var A0=2147483647;Wa.kMaxLength=A0;ie.TYPED_ARRAY_SUPPORT=iM();!ie.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function iM(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(ie.prototype,"parent",{enumerable:!0,get:function(){if(!!ie.isBuffer(this))return this.buffer}});Object.defineProperty(ie.prototype,"offset",{enumerable:!0,get:function(){if(!!ie.isBuffer(this))return this.byteOffset}});function on(t){if(t>A0)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,ie.prototype),e}function ie(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return hh(t)}return l6(t,e,r)}ie.poolSize=8192;function l6(t,e,r){if(typeof t=="string")return nM(t,e);if(ArrayBuffer.isView(t))return sM(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Ki(t,ArrayBuffer)||t&&Ki(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Ki(t,SharedArrayBuffer)||t&&Ki(t.buffer,SharedArrayBuffer)))return ph(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return ie.from(i,e,r);let n=aM(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return ie.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}ie.from=function(t,e,r){return l6(t,e,r)};Object.setPrototypeOf(ie.prototype,Uint8Array.prototype);Object.setPrototypeOf(ie,Uint8Array);function d6(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function oM(t,e,r){return d6(t),t<=0?on(t):e!==void 0?typeof r=="string"?on(t).fill(e,r):on(t).fill(e):on(t)}ie.alloc=function(t,e,r){return oM(t,e,r)};function hh(t){return d6(t),on(t<0?0:bh(t)|0)}ie.allocUnsafe=function(t){return hh(t)};ie.allocUnsafeSlow=function(t){return hh(t)};function nM(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ie.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=h6(t,e)|0,i=on(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function yh(t){let e=t.length<0?0:bh(t.length)|0,r=on(e);for(let i=0;i=A0)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+A0.toString(16)+" bytes");return t|0}function rM(t){return+t!=t&&(t=0),ie.alloc(+t)}ie.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ie.prototype};ie.compare=function(e,r){if(Ki(e,Uint8Array)&&(e=ie.from(e,e.offset,e.byteLength)),Ki(r,Uint8Array)&&(r=ie.from(r,r.offset,r.byteLength)),!ie.isBuffer(e)||!ie.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,a=Math.min(i,n);sn.length?(ie.isBuffer(a)||(a=ie.from(a)),a.copy(n,s)):Uint8Array.prototype.set.call(n,a,s);else if(ie.isBuffer(a))a.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return n};function h6(t,e){if(ie.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Ki(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return vh(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return p6(t).length;default:if(n)return i?-1:vh(t).length;e=(""+e).toLowerCase(),n=!0}}ie.byteLength=h6;function hM(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return lM(this,e,r);case"utf8":case"utf-8":return b6(this,e,r);case"ascii":return fM(this,e,r);case"latin1":case"binary":return uM(this,e,r);case"base64":return cM(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dM(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}ie.prototype._isBuffer=!0;function Us(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}ie.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};u6&&(ie.prototype[u6]=ie.prototype.inspect);ie.prototype.compare=function(e,r,i,n,s){if(Ki(e,Uint8Array)&&(e=ie.from(e,e.offset,e.byteLength)),!ie.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let a=s-n,o=i-r,c=Math.min(a,o),f=this.slice(n,s),u=e.slice(r,i);for(let l=0;l2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,gh(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=ie.from(e,i)),ie.isBuffer(e))return e.length===0?-1:y6(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y6(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y6(t,e,r,i,n){let s=1,a=t.length,o=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,o/=2,r/=2}function c(u,l){return s===1?u[l]:u.readUInt16BE(l*s)}let f;if(n){let u=-1;for(f=r;fa&&(r=a-o),f=r;f>=0;f--){let u=!0;for(let l=0;ln&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let a;for(a=0;a>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return pM(this,e,r,i);case"utf8":case"utf-8":return bM(this,e,r,i);case"ascii":case"latin1":case"binary":return gM(this,e,r,i);case"base64":return vM(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xM(this,e,r,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}};ie.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function cM(t,e,r){return e===0&&r===t.length?dh.fromByteArray(t):dh.fromByteArray(t.slice(e,r))}function b6(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+o<=r){let c,f,u,l;switch(o){case 1:s<128&&(a=s);break;case 2:c=t[n+1],(c&192)==128&&(l=(s&31)<<6|c&63,l>127&&(a=l));break;case 3:c=t[n+1],f=t[n+2],(c&192)==128&&(f&192)==128&&(l=(s&15)<<12|(c&63)<<6|f&63,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:c=t[n+1],f=t[n+2],u=t[n+3],(c&192)==128&&(f&192)==128&&(u&192)==128&&(l=(s&15)<<18|(c&63)<<12|(f&63)<<6|u&63,l>65535&&l<1114112&&(a=l))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=o}return wM(i)}var v6=4096;function wM(t){let e=t.length;if(e<=v6)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii)&&(r=i);let n="";for(let s=e;si&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),rr)throw new RangeError("Trying to access beyond buffer length")}ie.prototype.readUintLE=ie.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||tr(e,r,this.length);let n=this[e],s=1,a=0;for(;++a>>0,r=r>>>0,i||tr(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};ie.prototype.readUint8=ie.prototype.readUInt8=function(e,r){return e=e>>>0,r||tr(e,1,this.length),this[e]};ie.prototype.readUint16LE=ie.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||tr(e,2,this.length),this[e]|this[e+1]<<8};ie.prototype.readUint16BE=ie.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||tr(e,2,this.length),this[e]<<8|this[e+1]};ie.prototype.readUint32LE=ie.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||tr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ie.prototype.readUint32BE=ie.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||tr(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ie.prototype.readBigUInt64LE=jn(function(e){e=e>>>0,Ja(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&vc(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Ja(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&vc(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<>>0,r=r>>>0,i||tr(e,r,this.length);let n=this[e],s=1,a=0;for(;++a=s&&(n-=Math.pow(2,8*r)),n};ie.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||tr(e,r,this.length);let n=r,s=1,a=this[e+--n];for(;n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a};ie.prototype.readInt8=function(e,r){return e=e>>>0,r||tr(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ie.prototype.readInt16LE=function(e,r){e=e>>>0,r||tr(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};ie.prototype.readInt16BE=function(e,r){e=e>>>0,r||tr(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};ie.prototype.readInt32LE=function(e,r){return e=e>>>0,r||tr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ie.prototype.readInt32BE=function(e,r){return e=e>>>0,r||tr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ie.prototype.readBigInt64LE=jn(function(e){e=e>>>0,Ja(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&vc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Ja(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&vc(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,r||tr(e,4,this.length),Qa.read(this,e,!0,23,4)};ie.prototype.readFloatBE=function(e,r){return e=e>>>0,r||tr(e,4,this.length),Qa.read(this,e,!1,23,4)};ie.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||tr(e,8,this.length),Qa.read(this,e,!0,52,8)};ie.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||tr(e,8,this.length),Qa.read(this,e,!1,52,8)};function Cr(t,e,r,i,n,s){if(!ie.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}ie.prototype.writeUintLE=ie.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;Cr(this,e,r,i,o,0)}let s=1,a=0;for(this[r]=e&255;++a>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;Cr(this,e,r,i,o,0)}let s=i-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+i};ie.prototype.writeUint8=ie.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,1,255,0),this[r]=e&255,r+1};ie.prototype.writeUint16LE=ie.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};ie.prototype.writeUint16BE=ie.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};ie.prototype.writeUint32LE=ie.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};ie.prototype.writeUint32BE=ie.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function x6(t,e,r,i,n){m6(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function w6(t,e,r,i,n){m6(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}ie.prototype.writeBigUInt64LE=jn(function(e,r=0){return x6(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ie.prototype.writeBigUInt64BE=jn(function(e,r=0){return w6(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ie.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let c=Math.pow(2,8*i-1);Cr(this,e,r,i,c-1,-c)}let s=0,a=1,o=0;for(this[r]=e&255;++s>0)-o&255;return r+i};ie.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let c=Math.pow(2,8*i-1);Cr(this,e,r,i,c-1,-c)}let s=i-1,a=1,o=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&o===0&&this[r+s+1]!==0&&(o=1),this[r+s]=(e/a>>0)-o&255;return r+i};ie.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};ie.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};ie.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};ie.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};ie.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Cr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};ie.prototype.writeBigInt64LE=jn(function(e,r=0){return x6(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ie.prototype.writeBigInt64BE=jn(function(e,r=0){return w6(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function E6(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function S6(t,e,r,i,n){return e=+e,r=r>>>0,n||E6(t,e,r,4,34028234663852886e22,-34028234663852886e22),Qa.write(t,e,r,i,23,4),r+4}ie.prototype.writeFloatLE=function(e,r,i){return S6(this,e,r,!0,i)};ie.prototype.writeFloatBE=function(e,r,i){return S6(this,e,r,!1,i)};function A6(t,e,r,i,n){return e=+e,r=r>>>0,n||E6(t,e,r,8,17976931348623157e292,-17976931348623157e292),Qa.write(t,e,r,i,52,8),r+8}ie.prototype.writeDoubleLE=function(e,r,i){return A6(this,e,r,!0,i)};ie.prototype.writeDoubleBE=function(e,r,i){return A6(this,e,r,!1,i)};ie.prototype.copy=function(e,r,i,n){if(!ie.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?n=_6(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=_6(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function _6(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function SM(t,e,r){Ja(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&vc(e,t.length-(r+1))}function m6(t,e,r,i,n,s){if(t>r||t3?e===0||e===BigInt(0)?o=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:o=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:o=`>= ${e}${a} and <= ${r}${a}`,new Xa.ERR_OUT_OF_RANGE("value",o,t)}SM(i,n,s)}function Ja(t,e){if(typeof t!="number")throw new Xa.ERR_INVALID_ARG_TYPE(e,"number",t)}function vc(t,e,r){throw Math.floor(t)!==t?(Ja(t,r),new Xa.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Xa.ERR_BUFFER_OUT_OF_BOUNDS:new Xa.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var AM=/[^+/0-9A-Za-z-_]/g;function _M(t){if(t=t.split("=")[0],t=t.trim().replace(AM,""),t.length<2)return"";for(;t.length%4!=0;)t=t+"=";return t}function vh(t,e){e=e||Infinity;let r,i=t.length,n=null,s=[];for(let a=0;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function yM(t){let e=[];for(let r=0;r>8,n=r%256,s.push(n),s.push(i);return s}function p6(t){return dh.toByteArray(_M(t))}function _0(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Ki(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function gh(t){return t!==t}var EM=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function jn(t){return typeof BigInt=="undefined"?CM:t}function CM(){throw new Error("BigInt not supported")}});var Fs=C((Jz,C6)=>{"use strict";var{Buffer:hi}=Hn(),I6=Symbol.for("BufferList");function ot(t){if(!(this instanceof ot))return new ot(t);ot._init.call(this,t)}ot._init=function(e){Object.defineProperty(this,I6,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};ot.prototype._new=function(e){return new ot(e)};ot.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;ithis.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};ot.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};ot.prototype.copy=function(e,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||hi.alloc(0);let s=!!e,a=this._offset(i),o=n-i,c=o,f=s&&r||0,u=a[1];if(i===0&&n===this.length){if(!s)return this._bufs.length===1?this._bufs[0]:hi.concat(this._bufs,this.length);for(let l=0;lb)this._bufs[l].copy(e,f,u),f+=b;else{this._bufs[l].copy(e,f,u,u+c),f+=b;break}c-=b,u&&(u=0)}return e.length>f?e.slice(0,f):e};ot.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),s=this._bufs.slice(i[0],n[0]+1);return n[1]===0?s.pop():s[s.length-1]=s[s.length-1].slice(0,n[1]),i[1]!==0&&(s[0]=s[0].slice(i[1])),this._new(s)};ot.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};ot.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};ot.prototype.duplicate=function(){let e=this._new();for(let r=0;rthis.length?this.length:e;let i=this._offset(e),n=i[0],s=i[1];for(;n=t.length){let c=a.indexOf(t,s);if(c!==-1)return this._reverseOffset([n,c]);s=a.length-t.length+1}else{let c=this._reverseOffset([n,s]);if(this._match(c,t))return c;s++}s=0}return-1};ot.prototype._match=function(t,e){if(this.length-t{"use strict";var k6=Bs(),{Buffer:IM}=Hn(),R6=(t,e,r)=>{let i=k6.encode(t,e,r);return R6.bytes=k6.encode.bytes,e||IM.from(i)};T6.exports=R6});var D6=C((Zz,C0)=>{"use strict";var{Buffer:B6}=Hn(),P6=Fs(),N6=xh(),wh=8,M6=10*1024;function O6(t){t=t||{};let e=Math.max(t.poolSize||M6,t.minPoolSize||wh),r=t.lengthEncoder||N6;return async function*(n){let s=B6.alloc(e),a=0;for await(let o of n){r(o.length,s,a);let c=s.slice(a,a+r.bytes);a+=r.bytes,s.length-a{e=e||{};let r=e.lengthEncoder||N6;return new P6([r(t.length),t.slice()])};C0.exports=O6;C0.exports.MIN_POOL_SIZE=wh;C0.exports.DEFAULT_POOL_SIZE=M6});var Eh=C((ej,L6)=>{"use strict";var q6=Bs(),{Buffer:TM}=Hn(),kM=t=>new Proxy({},{get:(e,r)=>r[0]==="l"?t[r]:t.get(parseInt(r))}),U6=t=>{let e=q6.decode(TM.isBuffer(t)?t:kM(t));return U6.bytes=q6.decode.bytes,e};L6.exports=U6});var z6=C((tj,I0)=>{"use strict";var{Buffer:RM}=Hn(),Sh=Fs(),BM=Eh(),F6=8,K6=1024*1024*4,V6=RM.alloc(0),Gn={LENGTH:"readLength",DATA:"readData"},PM={[Gn.LENGTH]:(t,e,r,i)=>{e=e.append(t);let n;try{n=i.lengthDecoder(e)}catch(s){if(e.length>i.maxLengthLength)throw Object.assign(s,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(s instanceof RangeError)return{mode:Gn.LENGTH,buffer:e,chunk:void 0,state:void 0,data:void 0};throw s}if(n>i.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return t=e.shallowSlice(i.lengthDecoder.bytes),e=new Sh,i.onLength&&i.onLength(n),n<=0?(i.onData&&i.onData(V6),{mode:Gn.LENGTH,chunk:t,buffer:e,data:V6}):{mode:Gn.DATA,chunk:t,buffer:e,state:{dataLength:n},data:void 0}},[Gn.DATA]:(t,e,r,i)=>{if(e=e.append(t),!r)throw new Error("state is required");if(e.lengthn?e.shallowSlice(n):void 0;return e=new Sh,i.onData&&i.onData(s),{mode:Gn.LENGTH,chunk:a,buffer:e,state:void 0,data:s}}};function Ah(t){t=t||{};let e={lengthDecoder:t.lengthDecoder||BM,maxLengthLength:t.maxLengthLength||F6,maxDataLength:t.maxDataLength||K6,onLength:t.onLength,onData:t.onData};return async function*(i){let n=new Sh,s=Gn.LENGTH,a;for await(let o of i){let c=o;for(;c;){let f=PM[s](c,n,a,e);s=f.mode,c=f.chunk,n=f.buffer,a=f.state,f.data&&(yield f.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}Ah.fromReader=(t,e)=>{let r=1,i={[Symbol.asyncIterator](){return this},next:async()=>{try{return await t.next(r)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{r=1}}};return Ah({...e||{},onLength:s=>{r=s}})(i)};I0.exports=Ah;I0.exports.MAX_LENGTH_LENGTH=F6;I0.exports.MAX_DATA_LENGTH=K6});var G6=C((rj,j6)=>{"use strict";var{Buffer:NM}=Hn(),H6=(t,e,r)=>(e=e||NM.allocUnsafe(4),e.writeInt32BE(t,r),e);H6.bytes=4;j6.exports=H6});var W6=C((ij,$6)=>{"use strict";var Y6=t=>{if(t.length<4)throw RangeError("Could not decode int32BE");return t.readInt32BE(0)};Y6.bytes=4;$6.exports=Y6});var mc=C(Ks=>{"use strict";Ks.encode=D6();Ks.decode=z6();Ks.varintEncode=xh();Ks.varintDecode=Eh();Ks.int32BEEncode=G6();Ks.int32BEDecode=W6()});var Ch=C((sj,Q6)=>{var _h=Fs();Q6.exports=t=>{let e=async function*(){let r=yield,i=new _h;for await(let n of t){if(!r){r=yield i.append(n),i=new _h;continue}for(i.append(n);i.length>=r;){let s=i.shallowSlice(0,r);if(i.consume(r),r=yield s,!r){i.length&&(r=yield i,i=new _h);break}}}if(r)throw Object.assign(new Error(`stream ended before ${r} bytes became available`),{code:"ERR_UNDER_READ",buffer:i})}();return e.next(),e}});var Ih=C((aj,J6)=>{"use strict";var MM=()=>{let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t};J6.exports=MM});var xc=C((oj,X6)=>{"use strict";var OM=Ch(),DM=Id(),LM=Ih();X6.exports=t=>{let e=DM(),r=OM(t.source),i=LM(),n,s=t.sink(async function*(){yield*e,yield*await i.promise}());return s.catch(o=>{n=o}),{reader:r,writer:e,stream:{sink:o=>n?Promise.reject(n):(i.resolve(o),s),source:r},rest:()=>e.end(),write:e.push,read:async()=>(await r.next()).value}}});var k0=C((cj,Z6)=>{"use strict";var e8=Xe(),T0=Object.assign(e8("libp2p:circuit:stream-handler"),{error:e8("libp2p:circuit:stream-handler:err")}),t8=mc(),qM=xc(),{CircuitRelay:r8}=$a(),i8=class{constructor({stream:e,maxLength:r=4096}){this.stream=e,this.shake=qM(this.stream),this.decoder=t8.decode.fromReader(this.shake.reader,{maxDataLength:r})}async read(){let e=await this.decoder.next();if(e.value){let r=r8.decode(e.value.slice());return T0("read message type",r.type),r}T0("read received no value, closing stream"),this.close()}write(e){T0("write message type %s",e.type),this.shake.write(t8.encode.single(r8.encode(e).finish()))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){T0("closing the stream"),this.rest().sink([])}};Z6.exports=i8});var Rh=C((fj,Th)=>{"use strict";var n8=Xe(),wc=Object.assign(n8("libp2p:circuit:stop"),{error:n8("libp2p:circuit:stop:err")}),{CircuitRelay:kh}=$a(),UM=gc(),FM=k0(),{validateAddrs:KM}=fh();Th.exports.handleStop=function({connection:e,request:r,streamHandler:i}){try{KM(r,i)}catch(n){return wc.error("invalid stop request via peer %s",e.remotePeer.toB58String(),n)}return wc("stop request is valid"),i.write({type:kh.Type.STATUS,code:kh.Status.SUCCESS}),i.rest()};Th.exports.stop=async function({connection:e,request:r}){let{stream:i}=await e.newStream([UM.relay]);wc("starting stop request to %s",e.remotePeer.toB58String());let n=new FM({stream:i});n.write(r);let s=await n.read();if(!s)return n.close();if(s.code===kh.Status.SUCCESS)return wc("stop request to %s was successful",e.remotePeer.toB58String()),n.rest();wc("stop request failed with code %d",s.code),n.close()}});var Bh=C((uj,s8)=>{"use strict";var a8=Xe(),cn=Object.assign(a8("libp2p:circuit:hop"),{error:a8("libp2p:circuit:hop:err")}),o8=Pe(),VM=Ut(),{validateAddrs:zM}=fh(),c8=k0(),{CircuitRelay:Rr}=$a(),{pipe:jM}=Ui(),{codes:f8}=Kt(),{stop:HM}=Rh(),u8=gc();async function GM({connection:t,request:e,streamHandler:r,circuit:i}){if(!i._options.hop.enabled)return cn("HOP request received but we are not acting as a relay"),r.end({type:Rr.Type.STATUS,code:Rr.Status.HOP_CANT_SPEAK_RELAY});try{zM(e,r)}catch(f){return cn.error("invalid hop request via peer %s",t.remotePeer.toB58String(),f)}if(!e.dstPeer){cn("HOP request received but we do not receive a dstPeer");return}let n=new VM(e.dstPeer.id),s=i._connectionManager.get(n);if(!s&&!i._options.hop.active)return cn("HOP request received but we are not connected to the destination peer"),r.end({type:Rr.Type.STATUS,code:Rr.Status.HOP_NO_CONN_TO_DST});if(!s)return;let a={type:Rr.Type.STOP,dstPeer:e.dstPeer,srcPeer:e.srcPeer},o;try{o=await HM({connection:s,request:a})}catch(f){return cn.error(f)}cn("hop request from %s is valid",t.remotePeer.toB58String()),r.write({type:Rr.Type.STATUS,code:Rr.Status.SUCCESS});let c=r.rest();return jM(c,o,c)}async function $M({connection:t,request:e}){let{stream:r}=await t.newStream([u8.relay]),i=new c8({stream:r});i.write(e);let n=await i.read();if(!n)throw o8(new Error("HOP request had no response"),f8.ERR_HOP_REQUEST_FAILED);if(n.code===Rr.Status.SUCCESS)return cn("hop request was successful"),i.rest();throw cn("hop request failed with code %d, closing stream",n.code),i.close(),o8(new Error(`HOP request failed with code ${n.code}`),f8.ERR_HOP_REQUEST_FAILED)}async function YM({connection:t}){let{stream:e}=await t.newStream([u8.relay]),r=new c8({stream:e});r.write({type:Rr.Type.CAN_HOP});let i=await r.read();return await r.close(),!(!i||i.code!==Rr.Status.SUCCESS)}function WM({connection:t,streamHandler:e,circuit:r}){let i=r._options.hop.enabled;cn("can hop (%s) request from %s",i,t.remotePeer.toB58String()),e.end({type:Rr.Type.STATUS,code:i?Rr.Status.SUCCESS:Rr.Status.HOP_CANT_SPEAK_RELAY})}s8.exports={handleHop:GM,hop:$M,canHop:YM,handleCanHop:WM}});var y8=C((lj,l8)=>{"use strict";var d8=Xe(),fn=Object.assign(d8("libp2p:circuit"),{error:d8("libp2p:circuit:err")}),QM=Pe(),JM=Kx(),{Multiaddr:Ec}=dr(),h8=Ut(),{CircuitRelay:Sc}=$a(),{codes:XM}=Kt(),p8=e6(),{relay:ZM}=gc(),eO=i6(),{handleCanHop:tO,handleHop:rO,hop:iO}=Bh(),{handleStop:nO}=Rh(),sO=k0(),aO=Symbol.for("@libp2p/js-libp2p-circuit/circuit"),b8=class{constructor({libp2p:e,upgrader:r}){this._dialer=e.dialer,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._upgrader=r,this._options=e._config.relay,this._libp2p=e,this.peerId=e.peerId,this._registrar.handle(ZM,this._onProtocol.bind(this))}async _onProtocol({connection:e,stream:r}){let i=new sO({stream:r}),n=await i.read();if(!n)return;let s=this,a;switch(n.type){case Sc.Type.CAN_HOP:{fn("received CAN_HOP request from %s",e.remotePeer.toB58String()),await tO({circuit:s,connection:e,streamHandler:i});break}case Sc.Type.HOP:{fn("received HOP request from %s",e.remotePeer.toB58String()),a=await rO({connection:e,request:n,streamHandler:i,circuit:s});break}case Sc.Type.STOP:{fn("received STOP request from %s",e.remotePeer.toB58String()),a=await nO({connection:e,request:n,streamHandler:i});break}default:fn("Request of type %s not supported",n.type)}if(a){let o=new Ec(n.dstPeer.addrs[0]),c=new Ec(n.srcPeer.addrs[0]),f=p8({stream:a,remoteAddr:o,localAddr:c}),u=n.type===Sc.Type.HOP?"relay":"inbound";fn("new %s connection %s",u,f.remoteAddr);let l=await this._upgrader.upgradeInbound(f);fn("%s connection %s upgraded",u,f.remoteAddr),this.handler&&this.handler(l)}}async dial(e,r){let i=e.toString().split("/p2p-circuit"),n=new Ec(i[0]),s=new Ec(i[i.length-1]),a=n.getPeerId(),o=s.getPeerId();if(!a||!o){let b="Circuit relay dial failed as addresses did not have peer id";throw fn.error(b),QM(new Error(b),XM.ERR_RELAYED_DIAL)}let c=h8.createFromCID(a),f=h8.createFromCID(o),u=!1,l=this._connectionManager.get(c);l||(l=await this._dialer.connectToPeer(n,r),u=!0);try{let b=await iO({connection:l,request:{type:Sc.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map(A=>A.bytes)},dstPeer:{id:f.toBytes(),addrs:[new Ec(s).bytes]}}}),p=n.encapsulate(`/p2p-circuit/p2p/${this.peerId.toB58String()}`),g=p8({stream:b,remoteAddr:e,localAddr:p});return fn("new outbound connection %s",g.remoteAddr),this._upgrader.upgradeOutbound(g)}catch(b){throw fn.error("Circuit relay dial failed",b),u&&await l.close(),b}}createListener(e,r){return typeof e=="function"&&(r=e,e={}),this.handler=r,eO(this._libp2p)}filter(e){return e=Array.isArray(e)?e:[e],e.filter(r=>JM.Circuit.matches(r))}get[Symbol.toStringTag](){return"Circuit"}static isTransport(e){return Boolean(e&&e[aO])}};l8.exports=b8});var g8=C((dj,R0)=>{(function(){"use strict";var t="input is invalid type",e="finalize already called",r=typeof window=="object",i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var n=!r&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=globalThis:n&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&typeof R0=="object"&&R0.exports,o=typeof define=="function"&&define.amd,c=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",f="0123456789abcdef".split(""),u=[31,7936,2031616,520093696],l=[4,1024,262144,67108864],b=[1,256,65536,16777216],p=[6,1536,393216,100663296],g=[0,8,16,24],A=[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],F=[224,256,384,512],B=[128,256],K=["hex","buffer","arrayBuffer","array","digest"],V={"128":168,"256":136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),c&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});for(var Q=function(x,X,te){return function(v){return new W(x,X,x).update(v)[te]()}},$=function(x,X,te){return function(v,S){return new W(x,X,S).update(v)[te]()}},Y=function(x,X,te){return function(v,S,N,q){return I["cshake"+x].update(v,S,N,q)[te]()}},J=function(x,X,te){return function(v,S,N,q){return I["kmac"+x].update(v,S,N,q)[te]()}},se=function(x,X,te,v){for(var S=0;S>5,this.byteCount=this.blockCount<<2,this.outputBlocks=te>>5,this.extraBytes=(te&31)>>3;for(var v=0;v<50;++v)this.s[v]=0}W.prototype.update=function(x){if(this.finalized)throw new Error(e);var X,te=typeof x;if(te!=="string"){if(te==="object"){if(x===null)throw new Error(t);if(c&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!c||!ArrayBuffer.isView(x)))throw new Error(t)}else throw new Error(t);X=!0}for(var v=this.blocks,S=this.byteCount,N=x.length,q=this.blockCount,m=0,k=this.s,T,_;m>2]|=x[m]<>2]|=_<>2]|=(192|_>>6)<>2]|=(128|_&63)<=57344?(v[T>>2]|=(224|_>>12)<>2]|=(128|_>>6&63)<>2]|=(128|_&63)<>2]|=(240|_>>18)<>2]|=(128|_>>12&63)<>2]|=(128|_>>6&63)<>2]|=(128|_&63)<=S){for(this.start=T-S,this.block=v[q],T=0;T>8,te=x&255;te>0;)S.unshift(te),x=x>>8,te=x&255,++v;return X?S.push(v):S.unshift(v),this.update(S),S.length},W.prototype.encodeString=function(x){var X,te=typeof x;if(te!=="string"){if(te==="object"){if(x===null)throw new Error(t);if(c&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!c||!ArrayBuffer.isView(x)))throw new Error(t)}else throw new Error(t);X=!0}var v=0,S=x.length;if(X)v=S;else for(var N=0;N=57344?v+=3:(q=65536+((q&1023)<<10|x.charCodeAt(++N)&1023),v+=4)}return v+=this.encode(v*8),this.update(x),v},W.prototype.bytepad=function(x,X){for(var te=this.encode(X),v=0;v>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(x[0]=x[te],X=1;X>4&15]+f[m&15]+f[m>>12&15]+f[m>>8&15]+f[m>>20&15]+f[m>>16&15]+f[m>>28&15]+f[m>>24&15];N%x==0&&(ve(X),S=0)}return v&&(m=X[S],q+=f[m>>4&15]+f[m&15],v>1&&(q+=f[m>>12&15]+f[m>>8&15]),v>2&&(q+=f[m>>20&15]+f[m>>16&15])),q},W.prototype.arrayBuffer=function(){this.finalize();var x=this.blockCount,X=this.s,te=this.outputBlocks,v=this.extraBytes,S=0,N=0,q=this.outputBits>>3,m;v?m=new ArrayBuffer(te+1<<2):m=new ArrayBuffer(q);for(var k=new Uint32Array(m);N>8&255,q[m+2]=k>>16&255,q[m+3]=k>>24&255;N%x==0&&ve(X)}return v&&(m=N<<2,k=X[S],q[m]=k&255,v>1&&(q[m+1]=k>>8&255),v>2&&(q[m+2]=k>>16&255)),q};function he(x,X,te){W.call(this,x,X,te)}he.prototype=new W,he.prototype.finalize=function(){return this.encode(this.outputBits,!0),W.prototype.finalize.call(this)};var ve=function(x){var X,te,v,S,N,q,m,k,T,_,U,G,z,ee,ae,oe,Ee,le,xe,_e,Se,we,Me,Ye,Je,Ht,We,qe,Rt,Te,ct,Zn,ft,ut,es,lt,dt,ts,ht,pt,rs,bt,yt,is,gt,vt,ns,mt,xt,ss,wt,Et,as,St,At,dn,hn,pn,bn,yn,gn,vn,mn;for(v=0;v<48;v+=2)S=x[0]^x[10]^x[20]^x[30]^x[40],N=x[1]^x[11]^x[21]^x[31]^x[41],q=x[2]^x[12]^x[22]^x[32]^x[42],m=x[3]^x[13]^x[23]^x[33]^x[43],k=x[4]^x[14]^x[24]^x[34]^x[44],T=x[5]^x[15]^x[25]^x[35]^x[45],_=x[6]^x[16]^x[26]^x[36]^x[46],U=x[7]^x[17]^x[27]^x[37]^x[47],G=x[8]^x[18]^x[28]^x[38]^x[48],z=x[9]^x[19]^x[29]^x[39]^x[49],X=G^(q<<1|m>>>31),te=z^(m<<1|q>>>31),x[0]^=X,x[1]^=te,x[10]^=X,x[11]^=te,x[20]^=X,x[21]^=te,x[30]^=X,x[31]^=te,x[40]^=X,x[41]^=te,X=S^(k<<1|T>>>31),te=N^(T<<1|k>>>31),x[2]^=X,x[3]^=te,x[12]^=X,x[13]^=te,x[22]^=X,x[23]^=te,x[32]^=X,x[33]^=te,x[42]^=X,x[43]^=te,X=q^(_<<1|U>>>31),te=m^(U<<1|_>>>31),x[4]^=X,x[5]^=te,x[14]^=X,x[15]^=te,x[24]^=X,x[25]^=te,x[34]^=X,x[35]^=te,x[44]^=X,x[45]^=te,X=k^(G<<1|z>>>31),te=T^(z<<1|G>>>31),x[6]^=X,x[7]^=te,x[16]^=X,x[17]^=te,x[26]^=X,x[27]^=te,x[36]^=X,x[37]^=te,x[46]^=X,x[47]^=te,X=_^(S<<1|N>>>31),te=U^(N<<1|S>>>31),x[8]^=X,x[9]^=te,x[18]^=X,x[19]^=te,x[28]^=X,x[29]^=te,x[38]^=X,x[39]^=te,x[48]^=X,x[49]^=te,ee=x[0],ae=x[1],vt=x[11]<<4|x[10]>>>28,ns=x[10]<<4|x[11]>>>28,qe=x[20]<<3|x[21]>>>29,Rt=x[21]<<3|x[20]>>>29,yn=x[31]<<9|x[30]>>>23,gn=x[30]<<9|x[31]>>>23,bt=x[40]<<18|x[41]>>>14,yt=x[41]<<18|x[40]>>>14,ut=x[2]<<1|x[3]>>>31,es=x[3]<<1|x[2]>>>31,oe=x[13]<<12|x[12]>>>20,Ee=x[12]<<12|x[13]>>>20,mt=x[22]<<10|x[23]>>>22,xt=x[23]<<10|x[22]>>>22,Te=x[33]<<13|x[32]>>>19,ct=x[32]<<13|x[33]>>>19,vn=x[42]<<2|x[43]>>>30,mn=x[43]<<2|x[42]>>>30,St=x[5]<<30|x[4]>>>2,At=x[4]<<30|x[5]>>>2,lt=x[14]<<6|x[15]>>>26,dt=x[15]<<6|x[14]>>>26,le=x[25]<<11|x[24]>>>21,xe=x[24]<<11|x[25]>>>21,ss=x[34]<<15|x[35]>>>17,wt=x[35]<<15|x[34]>>>17,Zn=x[45]<<29|x[44]>>>3,ft=x[44]<<29|x[45]>>>3,Ye=x[6]<<28|x[7]>>>4,Je=x[7]<<28|x[6]>>>4,dn=x[17]<<23|x[16]>>>9,hn=x[16]<<23|x[17]>>>9,ts=x[26]<<25|x[27]>>>7,ht=x[27]<<25|x[26]>>>7,_e=x[36]<<21|x[37]>>>11,Se=x[37]<<21|x[36]>>>11,Et=x[47]<<24|x[46]>>>8,as=x[46]<<24|x[47]>>>8,is=x[8]<<27|x[9]>>>5,gt=x[9]<<27|x[8]>>>5,Ht=x[18]<<20|x[19]>>>12,We=x[19]<<20|x[18]>>>12,pn=x[29]<<7|x[28]>>>25,bn=x[28]<<7|x[29]>>>25,pt=x[38]<<8|x[39]>>>24,rs=x[39]<<8|x[38]>>>24,we=x[48]<<14|x[49]>>>18,Me=x[49]<<14|x[48]>>>18,x[0]=ee^~oe&le,x[1]=ae^~Ee&xe,x[10]=Ye^~Ht&qe,x[11]=Je^~We&Rt,x[20]=ut^~lt&ts,x[21]=es^~dt&ht,x[30]=is^~vt&mt,x[31]=gt^~ns&xt,x[40]=St^~dn&pn,x[41]=At^~hn&bn,x[2]=oe^~le&_e,x[3]=Ee^~xe&Se,x[12]=Ht^~qe&Te,x[13]=We^~Rt&ct,x[22]=lt^~ts&pt,x[23]=dt^~ht&rs,x[32]=vt^~mt&ss,x[33]=ns^~xt&wt,x[42]=dn^~pn&yn,x[43]=hn^~bn&gn,x[4]=le^~_e&we,x[5]=xe^~Se&Me,x[14]=qe^~Te&Zn,x[15]=Rt^~ct&ft,x[24]=ts^~pt&bt,x[25]=ht^~rs&yt,x[34]=mt^~ss&Et,x[35]=xt^~wt&as,x[44]=pn^~yn&vn,x[45]=bn^~gn&mn,x[6]=_e^~we&ee,x[7]=Se^~Me&ae,x[16]=Te^~Zn&Ye,x[17]=ct^~ft&Je,x[26]=pt^~bt&ut,x[27]=rs^~yt&es,x[36]=ss^~Et&is,x[37]=wt^~as>,x[46]=yn^~vn&St,x[47]=gn^~mn&At,x[8]=we^~ee&oe,x[9]=Me^~ae&Ee,x[18]=Zn^~Ye&Ht,x[19]=ft^~Je&We,x[28]=bt^~ut<,x[29]=yt^~es&dt,x[38]=Et^~is&vt,x[39]=as^~gt&ns,x[48]=vn^~St&dn,x[49]=mn^~At&hn,x[0]^=A[v],x[1]^=A[v+1]};if(a)R0.exports=I;else{for(L=0;L{(function(t,e){"use strict";var r={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function i(p){if(!Array.isArray(p)&&!ArrayBuffer.isView(p))return!1;for(var g=0;g255)return!1;return!0}function n(p,g){return(p&65535)*g+(((p>>>16)*g&65535)<<16)}function s(p,g){return p<>>32-g}function a(p){return p^=p>>>16,p=n(p,2246822507),p^=p>>>13,p=n(p,3266489909),p^=p>>>16,p}function o(p,g){p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535],g=[g[0]>>>16,g[0]&65535,g[1]>>>16,g[1]&65535];var A=[0,0,0,0];return A[3]+=p[3]+g[3],A[2]+=A[3]>>>16,A[3]&=65535,A[2]+=p[2]+g[2],A[1]+=A[2]>>>16,A[2]&=65535,A[1]+=p[1]+g[1],A[0]+=A[1]>>>16,A[1]&=65535,A[0]+=p[0]+g[0],A[0]&=65535,[A[0]<<16|A[1],A[2]<<16|A[3]]}function c(p,g){p=[p[0]>>>16,p[0]&65535,p[1]>>>16,p[1]&65535],g=[g[0]>>>16,g[0]&65535,g[1]>>>16,g[1]&65535];var A=[0,0,0,0];return A[3]+=p[3]*g[3],A[2]+=A[3]>>>16,A[3]&=65535,A[2]+=p[2]*g[3],A[1]+=A[2]>>>16,A[2]&=65535,A[2]+=p[3]*g[2],A[1]+=A[2]>>>16,A[2]&=65535,A[1]+=p[1]*g[3],A[0]+=A[1]>>>16,A[1]&=65535,A[1]+=p[2]*g[2],A[0]+=A[1]>>>16,A[1]&=65535,A[1]+=p[3]*g[1],A[0]+=A[1]>>>16,A[1]&=65535,A[0]+=p[0]*g[3]+p[1]*g[2]+p[2]*g[1]+p[3]*g[0],A[0]&=65535,[A[0]<<16|A[1],A[2]<<16|A[3]]}function f(p,g){return g%=64,g===32?[p[1],p[0]]:g<32?[p[0]<>>32-g,p[1]<>>32-g]:(g-=32,[p[1]<>>32-g,p[0]<>>32-g])}function u(p,g){return g%=64,g===0?p:g<32?[p[0]<>>32-g,p[1]<>>1]),p=c(p,[4283543511,3981806797]),p=l(p,[0,p[0]>>>1]),p=c(p,[3301882366,444984403]),p=l(p,[0,p[0]>>>1]),p}r.x86.hash32=function(p,g){if(r.inputValidation&&!i(p))return e;g=g||0;for(var A=p.length%4,F=p.length-A,B=g,K=0,V=3432918353,Q=461845907,$=0;$>>0},r.x86.hash128=function(p,g){if(r.inputValidation&&!i(p))return e;g=g||0;for(var A=p.length%16,F=p.length-A,B=g,K=g,V=g,Q=g,$=0,Y=0,J=0,se=0,ne=597399067,O=2869860233,d=951274213,y=2716044179,w=0;w>>0).toString(16)).slice(-8)+("00000000"+(K>>>0).toString(16)).slice(-8)+("00000000"+(V>>>0).toString(16)).slice(-8)+("00000000"+(Q>>>0).toString(16)).slice(-8)},r.x64.hash128=function(p,g){if(r.inputValidation&&!i(p))return e;g=g||0;for(var A=p.length%16,F=p.length-A,B=[0,g],K=[0,g],V=[0,0],Q=[0,0],$=[2277735313,289559509],Y=[1291169091,658871167],J=0;J>>0).toString(16)).slice(-8)+("00000000"+(B[1]>>>0).toString(16)).slice(-8)+("00000000"+(K[0]>>>0).toString(16)).slice(-8)+("00000000"+(K[1]>>>0).toString(16)).slice(-8)},typeof Ac!="undefined"?(typeof B0!="undefined"&&B0.exports&&(Ac=B0.exports=r),Ac.murmurHash3=r):typeof define=="function"&&define.amd?define([],function(){return r}):(r._murmurHash3=t.murmurHash3,r.noConflict=function(){return t.murmurHash3=r._murmurHash3,r._murmurHash3=e,r.noConflict=e,r},t.murmurHash3=r)})(Ac)});var x8=C((hj,m8)=>{m8.exports=v8()});var E8=C((pj,w8)=>{"use strict";var oO=t=>{let e=new Uint8Array(4);for(let r=0;r<4;r++)e[r]=t&255,t=t>>8;return e};w8.exports={fromNumberTo32BitBuf:oO}});var Ph=C((bj,S8)=>{var cO="Input must be an string, Buffer or Uint8Array";function fO(t){var e;if(t instanceof Uint8Array)e=t;else if(t instanceof Buffer)e=new Uint8Array(t);else if(typeof t=="string")e=new Uint8Array(Buffer.from(t,"utf8"));else throw new Error(cO);return e}function uO(t){return Array.prototype.map.call(t,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function P0(t){return(4294967296+t).toString(16).substring(1)}function lO(t,e,r){for(var i=` +`+t+" = ",n=0;n{var _8=Ph();function N0(t,e,r){var i=t[e]+t[r],n=t[e+1]+t[r+1];i>=4294967296&&n++,t[e]=i,t[e+1]=n}function C8(t,e,r,i){var n=t[e]+r;r<0&&(n+=4294967296);var s=t[e+1]+i;n>=4294967296&&s++,t[e]=n,t[e+1]=s}function hO(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function $n(t,e,r,i,n,s){var a=_c[n],o=_c[n+1],c=_c[s],f=_c[s+1];N0(Ne,t,e),C8(Ne,t,a,o);var u=Ne[i]^Ne[t],l=Ne[i+1]^Ne[t+1];Ne[i]=l,Ne[i+1]=u,N0(Ne,r,i),u=Ne[e]^Ne[r],l=Ne[e+1]^Ne[r+1],Ne[e]=u>>>24^l<<8,Ne[e+1]=l>>>24^u<<8,N0(Ne,t,e),C8(Ne,t,c,f),u=Ne[i]^Ne[t],l=Ne[i+1]^Ne[t+1],Ne[i]=u>>>16^l<<16,Ne[i+1]=l>>>16^u<<16,N0(Ne,r,i),u=Ne[e]^Ne[r],l=Ne[e+1]^Ne[r+1],Ne[e]=l>>>31^u<<1,Ne[e+1]=u>>>31^l<<1}var I8=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),pO=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],pr=new Uint8Array(pO.map(function(t){return t*2})),Ne=new Uint32Array(32),_c=new Uint32Array(32);function T8(t,e){var r=0;for(r=0;r<16;r++)Ne[r]=t.h[r],Ne[r+16]=I8[r];for(Ne[24]=Ne[24]^t.t,Ne[25]=Ne[25]^t.t/4294967296,e&&(Ne[28]=~Ne[28],Ne[29]=~Ne[29]),r=0;r<32;r++)_c[r]=hO(t.b,4*r);for(r=0;r<12;r++)$n(0,8,16,24,pr[r*16+0],pr[r*16+1]),$n(2,10,18,26,pr[r*16+2],pr[r*16+3]),$n(4,12,20,28,pr[r*16+4],pr[r*16+5]),$n(6,14,22,30,pr[r*16+6],pr[r*16+7]),$n(0,10,20,30,pr[r*16+8],pr[r*16+9]),$n(2,12,22,24,pr[r*16+10],pr[r*16+11]),$n(4,14,16,26,pr[r*16+12],pr[r*16+13]),$n(6,8,18,28,pr[r*16+14],pr[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ne[r]^Ne[r+16]}function k8(t,e){if(t===0||t>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(e&&e.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:t},i=0;i<16;i++)r.h[i]=I8[i];var n=e?e.length:0;return r.h[0]^=16842752^n<<8^t,e&&(Nh(r,e),r.c=128),r}function Nh(t,e){for(var r=0;r>2]>>8*(r&3);return e}function B8(t,e,r){r=r||64,t=_8.normalizeInput(t);var i=k8(r,e);return Nh(i,t),R8(i)}function bO(t,e,r){var i=B8(t,e,r);return _8.toHex(i)}A8.exports={blake2b:B8,blake2bHex:bO,blake2bInit:k8,blake2bUpdate:Nh,blake2bFinal:R8}});var F8=C((gj,N8)=>{var M8=Ph();function yO(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Yn(t,e,r,i,n,s){$e[t]=$e[t]+$e[e]+n,$e[i]=M0($e[i]^$e[t],16),$e[r]=$e[r]+$e[i],$e[e]=M0($e[e]^$e[r],12),$e[t]=$e[t]+$e[e]+s,$e[i]=M0($e[i]^$e[t],8),$e[r]=$e[r]+$e[i],$e[e]=M0($e[e]^$e[r],7)}function M0(t,e){return t>>>e^t<<32-e}var O8=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),br=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),$e=new Uint32Array(16),cr=new Uint32Array(16);function D8(t,e){var r=0;for(r=0;r<8;r++)$e[r]=t.h[r],$e[r+8]=O8[r];for($e[12]^=t.t,$e[13]^=t.t/4294967296,e&&($e[14]=~$e[14]),r=0;r<16;r++)cr[r]=yO(t.b,4*r);for(r=0;r<10;r++)Yn(0,4,8,12,cr[br[r*16+0]],cr[br[r*16+1]]),Yn(1,5,9,13,cr[br[r*16+2]],cr[br[r*16+3]]),Yn(2,6,10,14,cr[br[r*16+4]],cr[br[r*16+5]]),Yn(3,7,11,15,cr[br[r*16+6]],cr[br[r*16+7]]),Yn(0,5,10,15,cr[br[r*16+8]],cr[br[r*16+9]]),Yn(1,6,11,12,cr[br[r*16+10]],cr[br[r*16+11]]),Yn(2,7,8,13,cr[br[r*16+12]],cr[br[r*16+13]]),Yn(3,4,9,14,cr[br[r*16+14]],cr[br[r*16+15]]);for(r=0;r<8;r++)t.h[r]^=$e[r]^$e[r+8]}function L8(t,e){if(!(t>0&&t<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=e?e.length:0;if(e&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var i={h:new Uint32Array(O8),b:new Uint32Array(64),c:0,t:0,outlen:t};return i.h[0]^=16842752^r<<8^t,r>0&&(Mh(i,e),i.c=64),i}function Mh(t,e){for(var r=0;r>2]>>8*(r&3)&255;return e}function U8(t,e,r){r=r||32,t=M8.normalizeInput(t);var i=L8(r,e);return Mh(i,t),q8(i)}function gO(t,e,r){var i=U8(t,e,r);return M8.toHex(i)}N8.exports={blake2s:U8,blake2sHex:gO,blake2sInit:L8,blake2sUpdate:Mh,blake2sFinal:q8}});var V8=C((vj,K8)=>{var Cc=P8(),Ic=F8();K8.exports={blake2b:Cc.blake2b,blake2bHex:Cc.blake2bHex,blake2bInit:Cc.blake2bInit,blake2bUpdate:Cc.blake2bUpdate,blake2bFinal:Cc.blake2bFinal,blake2s:Ic.blake2s,blake2sHex:Ic.blake2sHex,blake2sInit:Ic.blake2sInit,blake2sUpdate:Ic.blake2sUpdate,blake2sFinal:Ic.blake2sFinal}});var H8=C((mj,z8)=>{"use strict";var Za=V8(),vO=45569,mO=45633,xO={init:Za.blake2bInit,update:Za.blake2bUpdate,digest:Za.blake2bFinal},wO={init:Za.blake2sInit,update:Za.blake2sUpdate,digest:Za.blake2sFinal},j8=(t,e)=>async r=>{let i=e.init(t,null);return e.update(i,r),e.digest(i)};z8.exports=t=>{for(let e=0;e<64;e++)t[vO+e]=j8(e+1,xO);for(let e=0;e<32;e++)t[mO+e]=j8(e+1,wO)}});var Y8=C((xj,G8)=>{"use strict";var Vi=g8(),$8=x8(),{factory:O0}=la(),{fromNumberTo32BitBuf:EO}=E8(),SO=qt(),Wr=t=>async e=>{switch(t){case"sha3-224":return new Uint8Array(Vi.sha3_224.arrayBuffer(e));case"sha3-256":return new Uint8Array(Vi.sha3_256.arrayBuffer(e));case"sha3-384":return new Uint8Array(Vi.sha3_384.arrayBuffer(e));case"sha3-512":return new Uint8Array(Vi.sha3_512.arrayBuffer(e));case"shake-128":return new Uint8Array(Vi.shake128.create(128).update(e).arrayBuffer());case"shake-256":return new Uint8Array(Vi.shake256.create(256).update(e).arrayBuffer());case"keccak-224":return new Uint8Array(Vi.keccak224.arrayBuffer(e));case"keccak-256":return new Uint8Array(Vi.keccak256.arrayBuffer(e));case"keccak-384":return new Uint8Array(Vi.keccak384.arrayBuffer(e));case"keccak-512":return new Uint8Array(Vi.keccak512.arrayBuffer(e));case"murmur3-128":return SO($8.x64.hash128(e),"base16");case"murmur3-32":return EO($8.x86.hash32(e));default:throw new TypeError(`${t} is not a supported algorithm`)}},AO=t=>t;G8.exports={identity:AO,sha1:O0("sha1"),sha2256:O0("sha2-256"),sha2512:O0("sha2-512"),dblSha2256:O0("dbl-sha2-256"),sha3224:Wr("sha3-224"),sha3256:Wr("sha3-256"),sha3384:Wr("sha3-384"),sha3512:Wr("sha3-512"),shake128:Wr("shake-128"),shake256:Wr("shake-256"),keccak224:Wr("keccak-224"),keccak256:Wr("keccak-256"),keccak384:Wr("keccak-384"),keccak512:Wr("keccak-512"),murmur3128:Wr("murmur3-128"),murmur332:Wr("murmur3-32"),addBlake:H8()}});var J8=C((wj,W8)=>{"use strict";var Q8=Pe(),D0=fs(),rr=Y8(),_O=Mr();async function Qr(t,e,r){let i=await Qr.digest(t,e,r);return D0.encode(i,e,r)}Qr.multihash=D0;Qr.digest=async(t,e,r)=>{let n=await Qr.createHash(e)(t);return r?n.slice(0,r):n};Qr.createHash=function(t){if(!t)throw Q8(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");let e=D0.coerceCode(t);if(!Qr.functions[e])throw Q8(new Error(`multihash function '${t}' not yet supported`),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return Qr.functions[e]};Qr.functions={0:rr.identity,17:rr.sha1,18:rr.sha2256,19:rr.sha2512,20:rr.sha3512,21:rr.sha3384,22:rr.sha3256,23:rr.sha3224,24:rr.shake128,25:rr.shake256,26:rr.keccak224,27:rr.keccak256,28:rr.keccak384,29:rr.keccak512,34:rr.murmur3128,35:rr.murmur332,86:rr.dblSha2256};rr.addBlake(Qr.functions);Qr.validate=async(t,e)=>{let r=await Qr(t,D0.decode(e).name);return _O(e,r)};W8.exports=Qr});var Z8=C((Ej,X8)=>{"use strict";X8.exports=TextEncoder});var Oh=C((Sj,e5)=>{"use strict";var CO=Ro(),IO=J8(),TO=Z8();e5.exports.namespaceToCid=async t=>{let e=new TO().encode(t),r=await IO(e,"sha2-256");return new CO(r)}});var o5=C((Aj,t5)=>{"use strict";var r5=Xe(),i5=Object.assign(r5("libp2p:auto-relay"),{error:r5("libp2p:auto-relay:err")}),kO=qt(),RO=Lt(),{Multiaddr:BO}=dr(),PO=Ut(),{relay:NO}=gc(),{canHop:MO}=Bh(),{namespaceToCid:OO}=Oh(),{CIRCUIT_PROTO_CODE:DO,HOP_METADATA_KEY:n5,HOP_METADATA_VALUE:s5,RELAY_RENDEZVOUS_NS:LO}=d0(),a5=class{constructor({libp2p:e,maxListeners:r=1,onError:i}){this._libp2p=e,this._peerId=e.peerId,this._peerStore=e.peerStore,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._addressSorter=e.dialer.addressSorter,this.maxListeners=r,this._listenRelays=new Set,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this._peerStore.on("change:protocols",this._onProtocolChange),this._connectionManager.on("peer:disconnect",this._onPeerDisconnected),this._onError=(n,s)=>{i5.error(s||n),i&&i(n,s)}}async _onProtocolChange({peerId:e,protocols:r}){let i=e.toB58String(),n=r.find(s=>s===NO);if(!n&&this._listenRelays.has(i)){this._removeListenRelay(i);return}else if(!n||this._listenRelays.has(i))return;try{let s=this._connectionManager.get(e);if(!s)return;if(s.remoteAddr.protoCodes().includes(DO)){i5(`relayed connection to ${i} will not be used to hop on`);return}await MO({connection:s})&&(this._peerStore.metadataBook.set(e,n5,kO(s5)),await this._addListenRelay(s,i))}catch(s){this._onError(s)}}_onPeerDisconnected(e){let i=e.remotePeer.toB58String();!this._listenRelays.has(i)||this._removeListenRelay(i)}async _addListenRelay(e,r){if(this._listenRelays.size>=this.maxListeners)return;let i=this._peerStore.addressBook.getMultiaddrsForPeer(e.remotePeer,this._addressSorter);if(!i||!i.length)return;let n=`${i[0].toString()}/p2p-circuit`;this._listenRelays.add(r);try{await this._transportManager.listen([new BO(n)])}catch(s){this._onError(s),this._listenRelays.delete(r)}}_removeListenRelay(e){this._listenRelays.delete(e)&&this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(e=[]){if(this._listenRelays.size>=this.maxListeners)return;let r=[];for(let[i,n]of this._peerStore.metadataBook.data.entries()){if(this._listenRelays.has(i)||e.includes(i))continue;let s=n.get(n5);if(!s||RO(s)!==s5)continue;let a=PO.createFromCID(i),o=this._connectionManager.get(a);if(!o){r.push(a);continue}if(await this._addListenRelay(o,i),this._listenRelays.size>=this.maxListeners)return}for(let i of r)if(await this._tryToListenOnRelay(i),this._listenRelays.size>=this.maxListeners)return;try{let i=await OO(LO);for await(let n of this._libp2p.contentRouting.findProviders(i)){if(!n.multiaddrs.length)continue;let s=n.id;if(this._peerStore.addressBook.add(s,n.multiaddrs),await this._tryToListenOnRelay(s),this._listenRelays.size>=this.maxListeners)return}}catch(i){this._onError(i)}}async _tryToListenOnRelay(e){try{let r=await this._libp2p.dial(e);await this._addListenRelay(r,e.toB58String())}catch(r){this._onError(r,`could not connect and listen on known hop relay ${e.toB58String()}`)}}};t5.exports=a5});var d5=C((_j,c5)=>{"use strict";var f5=Xe(),u5=Object.assign(f5("libp2p:relay"),{error:f5("libp2p:relay:err")}),{setDelayedInterval:qO,clearDelayedInterval:UO}=Pd(),FO=o5(),{namespaceToCid:KO}=Oh(),{RELAY_RENDEZVOUS_NS:VO}=d0(),l5=class{constructor(e){this._libp2p=e,this._options={...e._config.relay},this._autoRelay=this._options.autoRelay.enabled&&new FO({libp2p:e,...this._options.autoRelay}),this._advertiseService=this._advertiseService.bind(this)}start(){this._options.hop.enabled&&this._options.advertise.enabled&&(this._timeout=qO(this._advertiseService,this._options.advertise.ttl,this._options.advertise.bootDelay))}stop(){UO(this._timeout)}async _advertiseService(){try{let e=await KO(VO);await this._libp2p.contentRouting.provide(e)}catch(e){e.code==="NO_ROUTERS_AVAILABLE"?(u5.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e),this.stop()):u5.error(e)}}};c5.exports=l5});var q0=C((Cj,L0)=>{"use strict";var{AbortController:h5,AbortSignal:zO}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;L0.exports=h5;L0.exports.AbortSignal=zO;L0.exports.default=h5});var b5=C((Ij,p5)=>{"use strict";p5.exports=function(){return Date.now()}});var g5=C((Tj,y5)=>{"use strict";var Dh=b5();function Lh(t,e,r){var i=this;this._started=Dh(),this._rescheduled=0,this._scheduled=e,this._args=r,this._timer=setTimeout(n,e);function n(){i._rescheduled>0?(i._scheduled=i._rescheduled-(Dh()-i._started),i._timer=setTimeout(n,i._scheduled),i._rescheduled=0):t.apply(null,i._args)}}Lh.prototype.reschedule=function(t){var e=Dh();return e+t-(this._started+this._scheduled)<0?!1:(this._started=e,this._rescheduled=t,!0)};Lh.prototype.clear=function(){clearTimeout(this._timer)};function jO(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("timeout needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var e=0;e{"use strict";var{AbortController:HO}=typeof self!="undefined"?self:typeof window!="undefined"?window:q0(),v5=g5(),Tc=class extends HO{constructor(e){super();this._ms=e,this._timer=v5(()=>this.abort(),e),Object.setPrototypeOf(this,Tc.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=v5(()=>this.abort(),this._ms)}};qh.exports=Tc;qh.exports.TimeoutController=Tc});var w5=C((Rj,x5)=>{"use strict";var U0;globalThis.AbortController&&globalThis.AbortSignal?U0=globalThis:U0=q0();x5.exports={AbortController:U0.AbortController,AbortSignal:U0.AbortSignal}});var Fh=C((Bj,Uh)=>{var{AbortController:GO}=w5();function E5(t){let e=new GO;function r(){e.abort();for(let i of t)!i||!i.removeEventListener||i.removeEventListener("abort",r)}for(let i of t)if(!(!i||!i.addEventListener)){if(i.aborted){r();break}i.addEventListener("abort",r)}return e.signal}Uh.exports=E5;Uh.exports.anySignal=E5});var C5=C((Nj,S5)=>{var A5=_d(),_5=Ih();S5.exports=class{constructor(){this._buffer=new A5,this._waitingConsumers=new A5}push(e){let{promise:r,resolve:i}=_5();return this._buffer.push({chunk:e,resolve:i}),this._consume(),r}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){let e=this._waitingConsumers.shift(),r=this._buffer.shift();e.resolve(r.chunk),r.resolve()}}shift(){let{promise:e,resolve:r}=_5();return this._waitingConsumers.push({resolve:r}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}});var T5=C((Mj,I5)=>{"use strict";I5.exports=(t,e=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(typeof r.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(e===0)return t;let i=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(i,r.indent.repeat(e))}});var k5=C(()=>{});var N5=C((Lj,R5)=>{"use strict";var B5=k5(),P5=/\s+at.*(?:\(|\s)(.*)\)?/,$O=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,YO=typeof B5.homedir=="undefined"?"":B5.homedir();R5.exports=(t,e)=>(e=Object.assign({pretty:!1},e),t.replace(/\\/g,"/").split(` +`).filter(r=>{let i=r.match(P5);if(i===null||!i[1])return!0;let n=i[1];return n.includes(".app/Contents/Resources/electron.asar")||n.includes(".app/Contents/Resources/default_app.asar")?!1:!$O.test(n)}).filter(r=>r.trim()!=="").map(r=>e.pretty?r.replace(P5,(i,n)=>i.replace(n,n.replace(YO,"~"))):r).join(` +`))});var D5=C((qj,M5)=>{"use strict";var WO=T5(),QO=N5(),JO=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""),O5=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);e=[...e].map(i=>i instanceof Error?i:i!==null&&typeof i=="object"?Object.assign(new Error(i.message),i):new Error(i));let r=e.map(i=>typeof i.stack=="string"?JO(QO(i.stack)):String(i)).join(` +`);r=` +`+WO(r,4),super(r),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(let e of this._errors)yield e}};M5.exports=O5});var zh=C((Uj,Kh)=>{"use strict";var Vh=class extends Error{constructor(e){super(e||"Promise was canceled");this.name="CancelError"}get isCanceled(){return!0}},kc=class{static fn(e){return(...r)=>new kc((i,n,s)=>{r.push(s),e(...r).then(i,n)})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,i)=>{this._reject=i;let n=o=>{(!this._isCanceled||!a.shouldReject)&&(this._isPending=!1,r(o))},s=o=>{this._isPending=!1,i(o)},a=o=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(o)};return Object.defineProperties(a,{shouldReject:{get:()=>this._rejectOnCancel,set:o=>{this._rejectOnCancel=o}}}),e(n,s,a)})}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r()}catch(r){this._reject(r);return}this._rejectOnCancel&&this._reject(new Vh(e))}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(kc.prototype,Promise.prototype);Kh.exports=kc;Kh.exports.CancelError=Vh});var q5=C((Fj,F0)=>{"use strict";var L5=D5(),XO=zh(),jh=class extends Error{},ZO=(t,e)=>new XO((r,i,n)=>{let{count:s,filter:a=()=>!0}=e;if(!Number.isFinite(s)){i(new TypeError(`Expected a finite number, got ${typeof e.count}`));return}let o=[],c=[],f=0,u=!1,l=new Set,b=()=>(o.length===s&&(r(o),u=!0),f-c.length{for(let g of t)!l.has(g)&&typeof g.cancel=="function"&&g.cancel()};n(p);for(let g of t)f++,(async()=>{try{let A=await g;if(u)return;if(!a(A))throw new jh("Value does not satisfy filter");o.push(A)}catch(A){c.push(A)}finally{l.add(g),!u&&b()&&p()}})();s>f&&(i(new RangeError(`Expected input to contain at least ${e.count} items, but contains ${f} items`)),p())});F0.exports=ZO;F0.exports.AggregateError=L5;F0.exports.FilterError=jh});var F5=C((Kj,Hh)=>{"use strict";var U5=q5(),eD=zh();Hh.exports=(t,e)=>{let r=U5(t,{...e,count:1});return eD.fn(async i=>{i(()=>{r.cancel()});let[n]=await r;return n})()};Hh.exports.AggregateError=U5.AggregateError});var z5=C((Vj,K5)=>{"use strict";var tD=Pe(),rD=q0().default,{anySignal:iD}=Fh(),nD=C5(),sD=F5(),V5=class{constructor({addrs:e,dialAction:r,dialer:i}){this.addrs=e,this.dialer=i,this.dialAction=r}async run(e={}){let r=this.dialer.getTokens(this.addrs.length);if(r.length<1)throw tD(new Error("No dial tokens available"),"ERR_NO_DIAL_TOKENS");let i=new nD;r.forEach(a=>i.push(a));let n=this.addrs.map(()=>new rD),s=0;try{return await sD(this.addrs.map(async(a,o)=>{let c=await i.shift(),f;try{let u=n[o].signal;f=await this.dialAction(a,{...e,signal:e.signal?iD([u,e.signal]):u}),n.splice(o,1)}finally{s++,this.addrs.length-s>=r.length?i.push(c):this.dialer.releaseToken(r.splice(r.indexOf(c),1)[0])}return f}))}finally{n.map(a=>a.abort()),r.forEach(a=>this.dialer.releaseToken(a))}}};K5.exports=V5});var Y5=C((zj,j5)=>{"use strict";var H5=Xe(),eo=Object.assign(H5("libp2p:dialer"),{error:H5("libp2p:dialer:err")}),G5=Pe(),{Multiaddr:Gh}=dr(),aD=m5(),{anySignal:oD}=Fh(),cD=z5(),{publicAddressesFirst:fD}=Hd(),uD=Ld(),{codes:$h}=Kt(),{DIAL_TIMEOUT:lD,MAX_PARALLEL_DIALS:dD,MAX_PER_PEER_DIALS:hD}=l0(),$5=class{constructor({transportManager:e,peerStore:r,addressSorter:i=fD,maxParallelDials:n=dD,dialTimeout:s=lD,maxDialsPerPeer:a=hD,resolvers:o={}}){this.transportManager=e,this.peerStore=r,this.addressSorter=i,this.maxParallelDials=n,this.timeout=s,this.maxDialsPerPeer=a,this.tokens=[...new Array(n)].map((c,f)=>f),this._pendingDials=new Map;for(let[c,f]of Object.entries(o))Gh.resolvers.set(c,f)}destroy(){for(let e of this._pendingDials.values())try{e.controller.abort()}catch(r){eo.error(r)}this._pendingDials.clear()}async connectToPeer(e,r={}){let i=await this._createDialTarget(e);if(!i.addrs.length)throw G5(new Error("The dial request has no valid addresses"),$h.ERR_NO_VALID_ADDRESSES);let n=this._pendingDials.get(i.id)||this._createPendingDial(i,r);try{let s=await n.promise;return eo("dial succeeded to %s",i.id),s}catch(s){throw n.controller.signal.aborted&&(s.code=$h.ERR_TIMEOUT),eo.error(s),s}finally{n.destroy()}}async _createDialTarget(e){let{id:r,multiaddrs:i}=uD(e);i&&this.peerStore.addressBook.add(r,i);let n=this.peerStore.addressBook.getMultiaddrsForPeer(r,this.addressSorter)||[];Gh.isMultiaddr(e)&&(n=n.filter(o=>!e.equals(o)),n.unshift(e));let s=[];for(let o of n)(await this._resolve(o)).forEach(f=>s.push(f));let a=s.filter(o=>this.transportManager.transportForMultiaddr(o));return{id:r.toB58String(),addrs:a}}_createPendingDial(e,r={}){let i=(f,u)=>{if(u.signal.aborted)throw G5(new Error("already aborted"),$h.ERR_ALREADY_ABORTED);return this.transportManager.dial(f,u)},n=new cD({addrs:e.addrs,dialAction:i,dialer:this}),s=new aD(this.timeout),a=[s.signal];r.signal&&a.push(r.signal);let o=oD(a),c={dialRequest:n,controller:s,promise:n.run({...r,signal:o}),destroy:()=>{s.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,c),c}getTokens(e){let r=Math.min(e,this.maxDialsPerPeer,this.tokens.length),i=this.tokens.splice(0,r);return eo("%d tokens request, returning %d, %d remaining",e,r,this.tokens.length),i}releaseToken(e){this.tokens.indexOf(e)>-1||(eo("token %d released",e),this.tokens.push(e))}async _resolve(e){if(!e.protoNames().includes("dnsaddr"))return[e];let i=await this._resolveRecord(e);return(await Promise.all(i.map(a=>this._resolve(a)))).flat().reduce((a,o)=>(a.find(c=>c.equals(o))||a.push(o),a),[])}async _resolveRecord(e){try{return e=new Gh(e.toString()),await e.resolve()}catch(r){return eo.error(`multiaddr ${e} could not be resolved`),[]}}};j5.exports=$5});var Q5=C((jj,W5)=>{"use strict";function pD(t){return t>=55296&&t<=56319}function bD(t){return t>=56320&&t<=57343}W5.exports=function(e,r,i){if(typeof r!="string")throw new Error("Input must be string");for(var n=r.length,s=0,a,o,c=0;ci)return r.slice(0,c-o.length+1)}return r}});var X5=C((Hj,J5)=>{"use strict";function yD(t){return t>=55296&&t<=56319}function gD(t){return t>=56320&&t<=57343}J5.exports=function(e){if(typeof e!="string")throw new Error("Input must be string");for(var r=e.length,i=0,n=null,s=null,a=0;a=128&&n<=2047?i+=2:n>=2048&&n<=65535&&(i+=3),s=n;return i}});var ew=C((Gj,Z5)=>{"use strict";var vD=Q5(),mD=X5();Z5.exports=vD.bind(null,mD)});var iw=C(($j,tw)=>{"use strict";var xD=ew(),wD=/[\/\?<>\\:\*\|"]/g,ED=/[\x00-\x1f\x80-\x9f]/g,SD=/^\.+$/,AD=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,_D=/[\. ]+$/;function rw(t,e){if(typeof t!="string")throw new Error("Input must be string");var r=t.replace(wD,e).replace(ED,e).replace(SD,e).replace(AD,e).replace(_D,e);return xD(r,255)}tw.exports=function(t,e){var r=e&&e.replacement||"",i=rw(t,r);return r===""?i:rw(i,"")}});var aw=C((Yj,nw)=>{"use strict";oa();var K0=De(),to=Lt(),sw=qt();nw.exports={createCipheriv:(t,e,r)=>{let i=K0.cipher.createCipher("AES-CTR",to(e,"ascii"));return i.start({iv:to(r,"ascii")}),{update:n=>(i.update(K0.util.createBuffer(to(n,"ascii"))),sw(i.output.getBytes(),"ascii"))}},createDecipheriv:(t,e,r)=>{let i=K0.cipher.createDecipher("AES-CTR",to(e,"ascii"));return i.start({iv:to(r,"ascii")}),{update:n=>(i.update(K0.util.createBuffer(to(n,"ascii"))),sw(i.output.getBytes(),"ascii"))}}}});var fw=C((Wj,ow)=>{"use strict";var CD=Pe(),cw={16:"aes-128-ctr",32:"aes-256-ctr"};ow.exports=function(t){let e=cw[t.length];if(!e){let r=Object.entries(cw).map(([i,n])=>`${i} (${n})`).join(" / ");throw CD(new Error(`Invalid key length ${t.length} bytes. Must be ${r}`),"ERR_INVALID_KEY_LENGTH")}return e}});var dw=C(uw=>{"use strict";var lw=aw(),ID=fw();uw.create=async function(t,e){let r=ID(t),i=lw.createCipheriv(r,t,e),n=lw.createDecipheriv(r,t,e);return{async encrypt(a){return i.update(a)},async decrypt(a){return n.update(a)}}}});var bw=C((Jj,hw)=>{"use strict";var TD=ol(),kD=et(),RD=Pe(),pw={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function BD(t,e,r,i,n){let s=pw[n];if(!s){let o=Object.keys(pw).join(" / ");throw RD(new Error(`Hash '${n}' is unknown or not supported. Must be ${o}`),"ERR_UNSUPPORTED_HASH_TYPE")}let a=TD(t,e,r,i,s);return kD.encode64(a)}hw.exports=BD});var Yh=C(ro=>{"use strict";var PD=nd(),ND=dw(),MD=Xf();ro.aes=ND;ro.hmac=PD;ro.keys=MD;ro.randomBytes=If();ro.pbkdf2=bw()});var yw,gw=Mp(()=>{yw="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"});var Wh={};t_(Wh,{customAlphabet:()=>OD,customRandom:()=>mw,nanoid:()=>DD,random:()=>vw,urlAlphabet:()=>yw});var vw,mw,OD,DD,Qh=Mp(()=>{gw();vw=t=>crypto.getRandomValues(new Uint8Array(t)),mw=(t,e,r)=>{let i=(2<{let s="";for(;;){let a=r(n),o=n;for(;o--;)if(s+=t[a[o]&i]||"",s.length===e)return s}}},OD=(t,e)=>mw(t,e,vw),DD=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let i=r[t]&63;i<36?e+=i.toString(36):i<62?e+=(i-26).toString(36).toUpperCase():i<63?e+="_":e+="-"}return e}});var Jh=C((tH,xw)=>{"use strict";var{nanoid:LD}=(Qh(),Wh),qD=Lt(),UD=qt(),ww=Symbol.for("@ipfs/interface-datastore/key"),un="/",Ew=new TextEncoder().encode(un),V0=Ew[0],Br=class{constructor(e,r){if(typeof e=="string")this._buf=UD(e);else if(e instanceof Uint8Array)this._buf=e;else throw new Error("Invalid key, should be String of Uint8Array");if(r==null&&(r=!0),r&&this.clean(),this._buf.byteLength===0||this._buf[0]!==V0)throw new Error("Invalid key")}toString(e="utf8"){return qD(this._buf,e)}uint8Array(){return this._buf}get[ww](){return!0}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new Br(e.join(un))}static random(){return new Br(LD().replace(/-/g,""))}clean(){if((!this._buf||this._buf.byteLength===0)&&(this._buf=Ew),this._buf[0]!==V0){let e=new Uint8Array(this._buf.byteLength+1);e.fill(V0,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===V0;)this._buf=this._buf.subarray(0,-1)}less(e){let r=this.list(),i=e.list();for(let n=0;na)return!1}return r.lengthr.namespaces()))])}static isKey(e){return e instanceof Br||Boolean(e&&e[ww])}};function FD(t){let e=t.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function KD(t){let e=t.split(":");return e[e.length-1]}function VD(t){return[].concat(...t)}xw.exports=Br});var Aw=C((rH,Sw)=>{"use strict";var{nanoid:zD}=(Qh(),Wh),jD=(t=e=>e)=>t(zD());Sw.exports=jD});var Cw=C((iH,_w)=>{"use strict";var HD=async t=>{let e=[];for await(let r of t)e.push(r);return e};_w.exports=HD});var Xh=C((nH,Iw)=>{"use strict";var GD=Aw(),$D=Cw(),YD=(t,e)=>async function*(){yield*(await $D(t)).sort(e)}(),WD=(t,e)=>{let r=new RegExp("^"+e);return t.replace(r,"")};Iw.exports={sortAll:YD,tmpdir:GD,replaceStartWith:WD}});var kw=C((sH,Tw)=>{"use strict";var QD=async function*(t,e){let r=0;if(!(e<1)){for await(let i of t)if(yield i,r++,r===e)return}};Tw.exports=QD});var Zh=C((aH,Rw)=>{"use strict";var{sortAll:Bw}=Xh(),Pw=Bd(),io=n0(),Nw=kw(),Mw=class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,r,i){return Promise.reject(new Error(".put is not implemented"))}get(e,r){return Promise.reject(new Error(".get is not implemented"))}has(e,r){return Promise.reject(new Error(".has is not implemented"))}delete(e,r){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,r={}){for await(let{key:i,value:n}of e)await this.put(i,n,r),yield{key:i,value:n}}async*getMany(e,r={}){for await(let i of e)yield this.get(i,r)}async*deleteMany(e,r={}){for await(let i of e)await this.delete(i,r),yield i}batch(){let e=[],r=[];return{put(i,n){e.push({key:i,value:n})},delete(i){r.push(i)},commit:async i=>{await Pw(this.putMany(e,i)),e=[],await Pw(this.deleteMany(r,i)),r=[]}}}async*_all(e,r){throw new Error("._all is not implemented")}async*_allKeys(e,r){throw new Error("._allKeys is not implemented")}query(e,r){let i=this._all(e,r);if(e.prefix!=null&&(i=io(i,n=>n.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(i=e.filters.reduce((n,s)=>io(n,s),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((n,s)=>Bw(n,s),i)),e.offset!=null){let n=0;i=io(i,()=>n++>=e.offset)}return e.limit!=null&&(i=Nw(i,e.limit)),i}queryKeys(e,r){let i=this._allKeys(e,r);if(e.prefix!=null&&(i=io(i,n=>n.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(i=e.filters.reduce((n,s)=>io(n,s),i)),Array.isArray(e.orders)&&(i=e.orders.reduce((n,s)=>Bw(n,s),i)),e.offset!=null){let n=0;i=io(i,()=>n++>=e.offset)}return e.limit!=null&&(i=Nw(i,e.limit)),i}};Rw.exports=Mw});var ep=C((oH,Ow)=>{"use strict";var Rc=Pe();function JD(t){return t=t||new Error("Cannot open database"),Rc(t,"ERR_DB_OPEN_FAILED")}function XD(t){return t=t||new Error("Delete failed"),Rc(t,"ERR_DB_DELETE_FAILED")}function ZD(t){return t=t||new Error("Write failed"),Rc(t,"ERR_DB_WRITE_FAILED")}function eL(t){return t=t||new Error("Not Found"),Rc(t,"ERR_NOT_FOUND")}function tL(t){return t=t||new Error("Aborted"),Rc(t,"ERR_ABORTED")}Ow.exports={dbOpenFailedError:JD,dbDeleteFailedError:XD,dbWriteFailedError:ZD,notFoundError:eL,abortedError:tL}});var Uw=C((cH,Dw)=>{"use strict";var Lw=Jh(),rL=Zh(),iL=ep(),qw=class extends rL{constructor(){super();this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(e,r){this.data[e.toString()]=r}async get(e){if(!await this.has(e))throw iL.notFoundError();return this.data[e.toString()]}async has(e){return this.data[e.toString()]!==void 0}async delete(e){delete this.data[e.toString()]}async*_all(){yield*Object.entries(this.data).map(([e,r])=>({key:new Lw(e),value:r}))}async*_allKeys(){yield*Object.entries(this.data).map(([e])=>new Lw(e))}};Dw.exports=qw});var tp=C((fH,Fw)=>{"use strict";var nL=Jh(),sL=Uw(),aL=Xh(),oL=ep(),cL=Zh();Fw.exports={Key:nL,MemoryDatastore:sL,utils:aL,Errors:oL,Adapter:cL}});var jw=C((uH,Kw)=>{var no=De();$i();et();var ge=no.asn1,so=Kw.exports=no.pkcs7asn1=no.pkcs7asn1||{};no.pkcs7=no.pkcs7||{};no.pkcs7.asn1=so;var Vw={name:"ContentInfo",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:ge.Class.UNIVERSAL,type:ge.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:ge.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};so.contentInfoValidator=Vw;var zw={name:"EncryptedContentInfo",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:ge.Class.UNIVERSAL,type:ge.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:ge.Class.UNIVERSAL,type:ge.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:ge.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:ge.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};so.envelopedDataValidator={name:"EnvelopedData",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:ge.Class.UNIVERSAL,type:ge.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(zw)};so.encryptedDataValidator={name:"EncryptedData",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:ge.Class.UNIVERSAL,type:ge.Type.INTEGER,constructed:!1,capture:"version"}].concat(zw)};var fL={name:"SignerInfo",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:ge.Class.UNIVERSAL,type:ge.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:ge.Class.UNIVERSAL,type:ge.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:ge.Class.UNIVERSAL,type:ge.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:ge.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:ge.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:ge.Class.UNIVERSAL,type:ge.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:ge.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};so.signedDataValidator={name:"SignedData",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:ge.Class.UNIVERSAL,type:ge.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},Vw,{name:"SignedData.Certificates",tagClass:ge.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:ge.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SET,capture:"signerInfos",optional:!0,value:[fL]}]};so.recipientInfoValidator={name:"RecipientInfo",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:ge.Class.UNIVERSAL,type:ge.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:ge.Class.UNIVERSAL,type:ge.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:ge.Class.UNIVERSAL,type:ge.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:ge.Class.UNIVERSAL,type:ge.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:ge.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:ge.Class.UNIVERSAL,type:ge.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var Gw=C((lH,Hw)=>{var Vs=De();et();Vs.mgf=Vs.mgf||{};var uL=Hw.exports=Vs.mgf.mgf1=Vs.mgf1=Vs.mgf1||{};uL.create=function(t){var e={generate:function(r,i){for(var n=new Vs.util.ByteBuffer,s=Math.ceil(i/t.digestLength),a=0;a{var z0=De();Gw();$w.exports=z0.mgf=z0.mgf||{};z0.mgf.mgf1=z0.mgf1});var Qw=C((hH,Ww)=>{var zs=De();In();et();var lL=Ww.exports=zs.pss=zs.pss||{};lL.create=function(t){arguments.length===3&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e=t.md,r=t.mgf,i=e.digestLength,n=t.salt||null;typeof n=="string"&&(n=zs.util.createBuffer(n));var s;if("saltLength"in t)s=t.saltLength;else if(n!==null)s=n.length();else throw new Error("Salt length not specified or specific salt not given.");if(n!==null&&n.length()!==s)throw new Error("Given salt length does not match length of given salt.");var a=t.prng||zs.random,o={};return o.encode=function(c,f){var u,l=f-1,b=Math.ceil(l/8),p=c.digest().getBytes();if(b>8*b-l&255;return $=String.fromCharCode($.charCodeAt(0)&~Y)+$.substr(1),$+F+String.fromCharCode(188)},o.verify=function(c,f,u){var l,b=u-1,p=Math.ceil(b/8);if(f=f.substr(-p),p>8*p-b&255;if((A.charCodeAt(0)&B)!=0)throw new Error("Bits beyond keysize not zero as expected.");var K=r.generate(F,g),V="";for(l=0;l{var pe=De();oa();$i();hf();Cn();Yw();na();gf();Qw();Fo();et();var E=pe.asn1,de=Jw.exports=pe.pki=pe.pki||{},ke=de.oids,Nt={};Nt.CN=ke.commonName;Nt.commonName="CN";Nt.C=ke.countryName;Nt.countryName="C";Nt.L=ke.localityName;Nt.localityName="L";Nt.ST=ke.stateOrProvinceName;Nt.stateOrProvinceName="ST";Nt.O=ke.organizationName;Nt.organizationName="O";Nt.OU=ke.organizationalUnitName;Nt.organizationalUnitName="OU";Nt.E=ke.emailAddress;Nt.emailAddress="E";var Xw=pe.pki.rsa.publicKeyValidator,dL={name:"Certificate",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:E.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:E.Class.UNIVERSAL,type:E.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:E.Class.UNIVERSAL,type:E.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:E.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:E.Class.UNIVERSAL,type:E.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:E.Class.UNIVERSAL,type:E.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:E.Class.UNIVERSAL,type:E.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:E.Class.UNIVERSAL,type:E.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Xw,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:E.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:E.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:E.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:E.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},hL={name:"rsapss",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:E.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:E.Class.UNIVERSAL,type:E.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:E.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:E.Class.UNIVERSAL,type:E.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:E.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:E.Class.UNIVERSAL,type:E.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:E.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:E.Class.UNIVERSAL,type:E.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},pL={name:"CertificationRequestInfo",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:E.Class.UNIVERSAL,type:E.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Xw,{name:"CertificationRequestInfo.attributes",tagClass:E.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:E.Class.UNIVERSAL,type:E.Type.SET,constructed:!0}]}]}]},bL={name:"CertificationRequest",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[pL,{name:"CertificationRequest.signatureAlgorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:E.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};de.RDNAttributesAsArray=function(t,e){for(var r=[],i,n,s,a=0;a2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(c.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(a.validity.notBefore=c[0],a.validity.notAfter=c[1],a.tbsCertificate=r.tbsCertificate,e){if(a.md=null,a.signatureOid in ke){var s=ke[a.signatureOid];switch(s){case"sha1WithRSAEncryption":a.md=pe.md.sha1.create();break;case"md5WithRSAEncryption":a.md=pe.md.md5.create();break;case"sha256WithRSAEncryption":a.md=pe.md.sha256.create();break;case"sha384WithRSAEncryption":a.md=pe.md.sha384.create();break;case"sha512WithRSAEncryption":a.md=pe.md.sha512.create();break;case"RSASSA-PSS":a.md=pe.md.sha256.create();break}}if(a.md===null){var n=new Error("Could not compute certificate digest. Unknown signature OID.");throw n.signatureOid=a.signatureOid,n}var f=E.toDer(a.tbsCertificate);a.md.update(f.getBytes())}var u=pe.md.sha1.create();a.issuer.getField=function(b){return Wn(a.issuer,b)},a.issuer.addField=function(b){Jr([b]),a.issuer.attributes.push(b)},a.issuer.attributes=de.RDNAttributesAsArray(r.certIssuer,u),r.certIssuerUniqueId&&(a.issuer.uniqueId=r.certIssuerUniqueId),a.issuer.hash=u.digest().toHex();var l=pe.md.sha1.create();return a.subject.getField=function(b){return Wn(a.subject,b)},a.subject.addField=function(b){Jr([b]),a.subject.attributes.push(b)},a.subject.attributes=de.RDNAttributesAsArray(r.certSubject,l),r.certSubjectUniqueId&&(a.subject.uniqueId=r.certSubjectUniqueId),a.subject.hash=l.digest().toHex(),r.certExtensions?a.extensions=de.certificateExtensionsFromAsn1(r.certExtensions):a.extensions=[],a.publicKey=de.publicKeyFromAsn1(r.subjectPublicKeyInfo),a};de.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r1&&(i=r.value.charCodeAt(1),n=r.value.length>2?r.value.charCodeAt(2):0),e.digitalSignature=(i&128)==128,e.nonRepudiation=(i&64)==64,e.keyEncipherment=(i&32)==32,e.dataEncipherment=(i&16)==16,e.keyAgreement=(i&8)==8,e.keyCertSign=(i&4)==4,e.cRLSign=(i&2)==2,e.encipherOnly=(i&1)==1,e.decipherOnly=(n&128)==128}else if(e.name==="basicConstraints"){var r=E.fromDer(e.value);r.value.length>0&&r.value[0].type===E.Type.BOOLEAN?e.cA=r.value[0].value.charCodeAt(0)!==0:e.cA=!1;var s=null;r.value.length>0&&r.value[0].type===E.Type.INTEGER?s=r.value[0].value:r.value.length>1&&(s=r.value[1].value),s!==null&&(e.pathLenConstraint=E.derToInteger(s))}else if(e.name==="extKeyUsage")for(var r=E.fromDer(e.value),a=0;a1&&(i=r.value.charCodeAt(1)),e.client=(i&128)==128,e.server=(i&64)==64,e.email=(i&32)==32,e.objsign=(i&16)==16,e.reserved=(i&8)==8,e.sslCA=(i&4)==4,e.emailCA=(i&2)==2,e.objCA=(i&1)==1}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.altNames=[];for(var c,r=E.fromDer(e.value),f=0;f128)throw new Error('Invalid "nsComment" content.');t.value=E.create(E.Class.UNIVERSAL,E.Type.IA5STRING,!1,t.comment)}else if(t.name==="subjectKeyIdentifier"&&e.cert){var l=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=l.toHex(),t.value=E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,l.getBytes())}else if(t.name==="authorityKeyIdentifier"&&e.cert){t.value=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);var o=t.value.value;if(t.keyIdentifier){var b=t.keyIdentifier===!0?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;o.push(E.create(E.Class.CONTEXT_SPECIFIC,0,!1,b))}if(t.authorityCertIssuer){var p=[E.create(E.Class.CONTEXT_SPECIFIC,4,!0,[ao(t.authorityCertIssuer===!0?e.cert.issuer:t.authorityCertIssuer)])];o.push(E.create(E.Class.CONTEXT_SPECIFIC,1,!0,p))}if(t.serialNumber){var g=pe.util.hexToBytes(t.serialNumber===!0?e.cert.serialNumber:t.serialNumber);o.push(E.create(E.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if(t.name==="cRLDistributionPoints"){t.value=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);for(var o=t.value.value,A=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]),F=E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[]),f,u=0;u=gL&&t0&&i.value.push(de.certificateExtensionsToAsn1(t.extensions)),i};de.getCertificationRequestInfo=function(t){var e=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(t.version).getBytes()),ao(t.subject),de.publicKeyToAsn1(t.publicKey),yL(t)]);return e};de.distinguishedNameToAsn1=function(t){return ao(t)};de.certificateToAsn1=function(t){var e=t.tbsCertificate||de.getTBSCertificate(t);return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[e,E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(t.signatureOid).getBytes()),rp(t.signatureOid,t.signatureParameters)]),E.create(E.Class.UNIVERSAL,E.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])};de.certificateExtensionsToAsn1=function(t){var e=E.create(E.Class.CONTEXT_SPECIFIC,3,!0,[]),r=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);e.value.push(r);for(var i=0;ic.validity.notAfter)&&(a={message:"Certificate is not valid yet or has expired.",error:de.certificateError.certificate_expired,notBefore:c.validity.notBefore,notAfter:c.validity.notAfter,now:n}),a===null){if(f=e[0]||t.getIssuer(c),f===null&&c.isIssuer(c)&&(u=!0,f=c),f){var l=f;pe.util.isArray(l)||(l=[l]);for(var b=!1;!b&&l.length>0;){f=l.shift();try{b=f.verify(c)}catch($){}}b||(a={message:"Certificate signature is invalid.",error:de.certificateError.bad_certificate})}a===null&&(!f||u)&&!t.hasCertificate(c)&&(a={message:"Certificate is not trusted.",error:de.certificateError.unknown_ca})}if(a===null&&f&&!c.isIssuer(f)&&(a={message:"Certificate issuer is invalid.",error:de.certificateError.bad_certificate}),a===null)for(var p={keyUsage:!0,basicConstraints:!0},g=0;a===null&&gF.pathLenConstraint&&(a={message:"Certificate basicConstraints pathLenConstraint violated.",error:de.certificateError.bad_certificate})}}var V=a===null?!0:a.error,Q=r.verify?r.verify(V,o,i):V;if(Q===!0)a=null;else throw V===!0&&(a={message:"The application rejected the certificate.",error:de.certificateError.bad_certificate}),(Q||Q===0)&&(typeof Q=="object"&&!pe.util.isArray(Q)?(Q.message&&(a.message=Q.message),Q.error&&(a.error=Q.error)):typeof Q=="string"&&(a.error=Q)),a;s=!1,++o}while(e.length>0);return!0}});var iE=C((bH,tE)=>{var be=De();oa();$i();hf();na();gf();jw();In();et();ip();var j=be.asn1,mr=tE.exports=be.pkcs7=be.pkcs7||{};mr.messageFromPem=function(t){var e=be.pem.decode(t)[0];if(e.type!=="PKCS7"){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var i=j.fromDer(e.body);return mr.messageFromAsn1(i)};mr.messageToPem=function(t,e){var r={type:"PKCS7",body:j.toDer(t.toAsn1()).getBytes()};return be.pem.encode(r,{maxline:e})};mr.messageFromAsn1=function(t){var e={},r=[];if(!j.validate(t,mr.asn1.contentInfoValidator,e,r)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw i.errors=r,i}var n=j.derToOid(e.contentType),s;switch(n){case be.pki.oids.envelopedData:s=mr.createEnvelopedData();break;case be.pki.oids.encryptedData:s=mr.createEncryptedData();break;case be.pki.oids.signedData:s=mr.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return s.fromAsn1(e.content.value[0]),s};mr.createSignedData=function(){var t=null;return t={type:be.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(i){if(sp(t,i,mr.asn1.signedDataValidator),t.certificates=[],t.crls=[],t.digestAlgorithmIdentifiers=[],t.contentInfo=null,t.signerInfos=[],t.rawCapture.certificates)for(var n=t.rawCapture.certificates.value,s=0;s0&&a.value[0].value.push(j.create(j.Class.CONTEXT_SPECIFIC,0,!0,i)),s.length>0&&a.value[0].value.push(j.create(j.Class.CONTEXT_SPECIFIC,1,!0,s)),a.value[0].value.push(j.create(j.Class.UNIVERSAL,j.Type.SET,!0,t.signerInfos)),j.create(j.Class.UNIVERSAL,j.Type.SEQUENCE,!0,[j.create(j.Class.UNIVERSAL,j.Type.OID,!1,j.oidToDer(t.type).getBytes()),a])},addSigner:function(i){var n=i.issuer,s=i.serialNumber;if(i.certificate){var a=i.certificate;typeof a=="string"&&(a=be.pki.certificateFromPem(a)),n=a.issuer.attributes,s=a.serialNumber}var o=i.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=be.pki.privateKeyFromPem(o));var c=i.digestAlgorithm||be.pki.oids.sha1;switch(c){case be.pki.oids.sha1:case be.pki.oids.sha256:case be.pki.oids.sha384:case be.pki.oids.sha512:case be.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+c)}var f=i.authenticatedAttributes||[];if(f.length>0){for(var u=!1,l=!1,b=0;b0){for(var r=j.create(j.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i=r&&n{"use strict";ip();var CL=De(),sE=CL.pki,IL=(t,e)=>{let r=sE.setRsaPublicKey(e.n,e.e),i=sE.createCertificate();i.publicKey=r,i.serialNumber="01",i.validity.notBefore=new Date,i.validity.notAfter=new Date,i.validity.notAfter.setFullYear(i.validity.notBefore.getFullYear()+10);let n=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:t.id}];return i.setSubject(n),i.setIssuer(n),i.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),i.sign(e),i};async function TL(t,e){let r=t.map(e),n=(await Promise.all(r)).findIndex(s=>s);return t[n]}nE.exports={certificateForKey:IL,findAsync:TL}});var uE=C((gH,oE)=>{"use strict";iE();gl();var Qn=De(),{certificateForKey:kL,findAsync:RL}=aE(),oo=Pe(),cE=qt(),BL=Lt(),ap=new WeakMap,fE=class{constructor(e,r){if(!e)throw oo(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e,ap.set(this,{dek:r})}async encrypt(e,r){if(!(r instanceof Uint8Array))throw oo(new Error("Plain data must be a Uint8Array"),"ERR_INVALID_PARAMS");let i=await this.keychain.findKeyByName(e),n=await this.keychain._getPrivateKey(e),s=ap.get(this).dek,a=Qn.pki.decryptRsaPrivateKey(n,s),o=await kL(i,a),c=Qn.pkcs7.createEnvelopedData();c.addRecipient(o),c.content=Qn.util.createBuffer(r),c.encrypt();let f=Qn.asn1.toDer(c.toAsn1()).getBytes();return cE(f,"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw oo(new Error("CMS data is required"),"ERR_INVALID_PARAMS");let r;try{let f=Qn.util.createBuffer(BL(e,"ascii")),u=Qn.asn1.fromDer(f);r=Qn.pkcs7.messageFromAsn1(u)}catch(f){throw oo(new Error("Invalid CMS: "+f.message),"ERR_INVALID_CMS")}let i=r.recipients.filter(f=>f.issuer.find(u=>u.shortName==="O"&&u.value==="ipfs")).filter(f=>f.issuer.find(u=>u.shortName==="CN")).map(f=>({recipient:f,keyId:f.issuer.find(u=>u.shortName==="CN").value})),n=await RL(i,async f=>{try{if(await this.keychain.findKeyById(f.keyId))return!0}catch(u){return!1}return!1});if(!n){let f=i.map(u=>u.keyId);throw oo(new Error("Decryption needs one of the key(s): "+f.join(", ")),"ERR_MISSING_KEYS",{missingKeys:f})}let s=await this.keychain.findKeyById(n.keyId);if(!s)throw oo(new Error("No key available to decrypto"),"ERR_NO_KEY");let a=await this.keychain._getPrivateKey(s.name),o=ap.get(this).dek,c=Qn.pki.decryptRsaPrivateKey(a,o);return r.decrypt(n.recipient,c),cE(r.content.getBytes(),"ascii")}};oE.exports=fE});var bE=C((vH,lE)=>{"use strict";var PL=iw(),NL=fc(),Bc=Yh(),{Key:dE}=tp(),ML=uE(),Dt=Pe(),co=Lt(),js=qt();Sf();var OL="/pkcs8/",hE="/info/",fo=new WeakMap,Hs={minKeyLength:112/8,minSaltLength:128/8,minIterationCount:1e3},op={dek:{keyLength:512/8,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function ln(t){return!t||typeof t!="string"?!1:t===PL(t.trim())}async function nt(t){let e=200,r=1e3,i=Math.random()*(r-e)+e;throw await new Promise(n=>setTimeout(n,i)),t}function Jn(t){return new dE(OL+t)}function Gs(t){return new dE(hE+t)}var pE=class{constructor(e,r){if(!e)throw new Error("store is required");if(this.store=e,this.opts=NL(op,r),this.opts.pass&&this.opts.pass.length<20)throw new Error("pass must be least 20 characters");if(this.opts.dek.keyLengthi.id===e)}catch(r){return nt(r)}}async findKeyByName(e){if(!ln(e))return nt(Dt(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));let r=Gs(e);try{let i=await this.store.get(r);return JSON.parse(co(i))}catch(i){return nt(Dt(new Error(`Key '${e}' does not exist. ${i.message}`),"ERR_KEY_NOT_FOUND"))}}async removeKey(e){let r=this;if(!ln(e)||e==="self")return nt(Dt(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));let i=Jn(e),n=await r.findKeyByName(e),s=r.store.batch();return s.delete(i),s.delete(Gs(e)),await s.commit(),n}async renameKey(e,r){let i=this;if(!ln(e)||e==="self")return nt(Dt(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!ln(r)||r==="self")return nt(Dt(new Error(`Invalid new key name '${r}'`),"ERR_NEW_KEY_NAME_INVALID"));let n=Jn(e),s=Jn(r),a=Gs(e),o=Gs(r);if(await i.store.has(s))return nt(Dt(new Error(`Key '${r}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{let f=await i.store.get(n),u=await i.store.get(a),l=JSON.parse(co(u));l.name=r;let b=i.store.batch();return b.put(s,f),b.put(o,js(JSON.stringify(l))),b.delete(n),b.delete(a),await b.commit(),l}catch(f){return nt(f)}}async exportKey(e,r){if(!ln(e))return nt(Dt(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!r)return nt(Dt(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));let i=Jn(e);try{let n=await this.store.get(i),s=co(n),a=fo.get(this).dek;return(await Bc.keys.import(s,a)).export(r)}catch(n){return nt(n)}}async importKey(e,r,i){let n=this;if(!ln(e)||e==="self")return nt(Dt(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!r)return nt(Dt(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED"));let s=Jn(e);if(await n.store.has(s))return nt(Dt(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));let o;try{o=await Bc.keys.import(r,i)}catch(l){return nt(Dt(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"))}let c;try{c=await o.id();let l=fo.get(this).dek;r=await o.export(l)}catch(l){return nt(l)}let f={name:e,id:c},u=n.store.batch();return u.put(s,js(r)),u.put(Gs(e),js(JSON.stringify(f))),await u.commit(),f}async importPeer(e,r){let i=this;if(!ln(e))return nt(Dt(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!r||!r.privKey)return nt(Dt(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));let n=r.privKey,s=Jn(e);if(await i.store.has(s))return nt(Dt(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{let o=await n.id(),c=fo.get(this).dek,f=await n.export(c),u={name:e,id:o},l=i.store.batch();return l.put(s,js(f)),l.put(Gs(e),js(JSON.stringify(u))),await l.commit(),u}catch(o){return nt(o)}}async _getPrivateKey(e){if(!ln(e))return nt(Dt(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));try{let r=Jn(e),i=await this.store.get(r);return co(i)}catch(r){return nt(Dt(new Error(`Key '${e}' does not exist. ${r.message}`),"ERR_KEY_NOT_FOUND"))}}};lE.exports=pE});var G0=C((H0,yE)=>{(function(t,e){typeof H0=="object"&&typeof yE!="undefined"?e(H0):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t.streamingIterables={}))})(H0,function(t){"use strict";async function*e(m,k){let T=[];for await(let _ of k)T.push(_),T.length===m&&(yield T,T=[]);T.length>0&&(yield T)}function*r(m,k){let T=[];for(let _ of k)T.push(_),T.length===m&&(yield T,T=[]);T.length>0&&(yield T)}function i(m,k){return k===void 0?T=>i(m,T):k[Symbol.asyncIterator]?e(m,k):r(m,k)}function n(m){if(typeof m.next=="function")return m;if(typeof m[Symbol.iterator]=="function")return m[Symbol.iterator]();if(typeof m[Symbol.asyncIterator]=="function")return m[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function s(){let m,k;return{promise:new Promise((_,U)=>{k=_,m=U}),reject:m,resolve:k}}function a(m,k){let T=n(k),_=[],U=[],G=!1,z=!1;function ee(){for(;U.length>0&&_.length>0;){let le=U.shift(),{error:xe,value:_e}=_.shift();xe?le.reject(xe):le.resolve({done:!1,value:_e})}for(;U.length>0&&z;){let{resolve:le}=U.shift();le({done:!0,value:void 0})}}async function ae(){if(!z&&!G&&!(_.length>=m)){G=!0;try{let{done:le,value:xe}=await T.next();le?z=!0:_.push({value:xe})}catch(le){z=!0,_.push({error:le})}ee(),G=!1,ae()}}async function oe(){if(_.length>0){let{error:xe,value:_e}=_.shift();if(xe)throw xe;return ae(),{done:!1,value:_e}}if(z)return{done:!0,value:void 0};let le=s();return U.push(le),ae(),le.promise}let Ee={next:oe,[Symbol.asyncIterator]:()=>Ee};return Ee}function*o(m,k){let T=[],_;try{for(let U of k)T.push(U),!(T.length<=m)&&(yield T.shift())}catch(U){_=U}for(let U of T)yield U;if(_)throw _}function c(m,k){return k===void 0?T=>c(m,T):m===0?k:k[Symbol.asyncIterator]?a(m,k):o(m,k)}async function f(m){let k=[];for await(let T of m)k.push(T);return k}function u(m){return m[Symbol.asyncIterator]?f(m):Array.from(m)}async function*l(m){for await(let k of m)yield*k}function*b(m){for(let k of m)yield*k}function p(...m){return m.find(T=>T[Symbol.asyncIterator]!==void 0)?l(m):b(m)}async function g(m){for await(let k of m);}function A(m){if(m[Symbol.asyncIterator])return g(m);for(let k of m);}async function*F(m,k){for await(let T of k)await m(T)&&(yield T)}function B(m,k){return k===void 0?T=>F(m,T):F(m,k)}async function*K(m){for await(let k of m)k&&typeof k!="string"&&(k[Symbol.iterator]||k[Symbol.asyncIterator])?yield*K(k):yield k}async function*V(m,k){for await(let T of k)yield await m(T)}function Q(m,k){return k===void 0?T=>V(m,T):V(m,k)}function $(m,k){return k===void 0?T=>$(m,T):B(T=>T!=null,K(Q(m,k)))}function Y(m,k,T){let _=n(T),U=[],G=[],z=!1,ee=!1,ae=0,oe=null;function Ee(){for(;G.length>0&&U.length>0;){let{resolve:we}=G.shift(),Me=U.shift();we({done:!1,value:Me})}for(;G.length>0&&ae===0&&z;){let{resolve:we,reject:Me}=G.shift();oe?(Me(oe),oe=null):we({done:!0,value:void 0})}}async function le(){if(z){Ee();return}if(!ee&&!(ae+U.length>=m)){ee=!0,ae++;try{let{done:we,value:Me}=await _.next();we?(z=!0,ae--,Ee()):xe(Me)}catch(we){z=!0,ae--,oe=we,Ee()}ee=!1,le()}}async function xe(we){try{let Me=await k(we);if(Me&&Me[Symbol.asyncIterator])for await(let Ye of Me)U.push(Ye);else U.push(Me)}catch(Me){z=!0,oe=Me}ae--,Ee(),le()}async function _e(){if(U.length===0){let Me=s();return G.push(Me),le(),Me.promise}let we=U.shift();return le(),{done:!1,value:we}}let Se={next:_e,[Symbol.asyncIterator]:()=>Se};return Se}function J(m,k,T){return k===void 0?(_,U)=>U?J(m,_,U):J(m,_):T===void 0?_=>J(m,k,_):B(_=>_!=null,K(Y(m,k,T)))}async function se(m){return new Promise(k=>{m.once("readable",()=>{k()})})}async function*ne(m){for(;;){let k=m.read();if(k!==null){yield k;continue}if(m._readableState.ended)break;await se(m)}}function O(m){return typeof m[Symbol.asyncIterator]=="function"?m:ne(m)}async function*d(...m){let k=new Set(m.map(n));for(;k.size>0;)for(let T of k){let _=await T.next();_.done?k.delete(T):yield _.value}}function y(m,...k){let T=m();for(let _ of k)T=_(T);return T}async function*w(m,k,T){let _=null,U=ae=>({value:k(ae)}),G=async function*(ae){for await(let oe of ae){if(_)return;yield oe}},z=y(()=>T,c(1),G,Q(U),c(m-1)),ee=n(z);for(;;){let{value:ae,done:oe}=await ee.next();if(oe)break;try{let Ee=await ae.value;_||(yield Ee)}catch(Ee){_=Ee}}if(_)throw _}function I(m,k,T){return k===void 0?(_,U)=>I(m,_,U):T===void 0?_=>I(m,k,_):m===1?Q(k,T):w(m,k,T)}function R(m,k,T){return k===void 0?(_,U)=>U?R(m,_,U):R(m,_):T===void 0?_=>R(m,k,_):B(_=>_!=null,K(I(m,k,T)))}async function*L(...m){let k=m.map(n),T=new Set,_=new Map,U=null,G=null,z=null,ee=le=>{U=le,G&&G(le)},ae=le=>{z&&z(le)},oe=()=>new Promise((le,xe)=>{if(U&&xe(U),_.size>0)return le();z=le,G=xe}),Ee=le=>{let xe=Promise.resolve(le.next()).then(async({done:_e,value:Se})=>{_e||_.set(le,Se),T.delete(xe)});T.add(xe),xe.then(ae,ee)};for(let le of k)Ee(le);for(;;){if(T.size===0&&_.size===0)return;await oe();for(let[le,xe]of _)_.delete(le),yield xe,Ee(le)}}async function D(m,k,T){let _=k;for await(let U of T)_=await m(_,U);return _}function P(m,k,T){return k===void 0?(_,U)=>U?D(m,_,U):P(m,_):T===void 0?_=>P(m,k,_):D(m,k,T)}async function*h(m,k){let T=0;for await(let _ of k)if(yield await _,T++,T>=m)break}function*M(m,k){let T=0;for(let _ of k)if(yield _,T++,T>=m)break}function fe(m,k){return k===void 0?T=>fe(m,T):k[Symbol.asyncIterator]?h(m,k):M(m,k)}async function*W(m,k){for await(let T of k)await m(T),yield T}function he(m,k){return k===void 0?T=>W(m,T):W(m,k)}function ve(m,k){let T=m[0]+k[0],_=m[1]+k[1];if(_>=1e9){let U=_%1e9;T+=(_-U)/1e9,_=U}return[T,_]}async function*x(m,k){let T=k[Symbol.asyncIterator](),_=[0,0];for(;;){let U=process.hrtime(),{value:G,done:z}=await T.next(),ee=process.hrtime(U);if(_=ve(_,ee),m.progress&&m.progress(ee,_),z)return m.total&&m.total(_),G;yield G}}function*X(m,k){let T=k[Symbol.iterator](),_=[0,0];for(;;){let U=process.hrtime(),{value:G,done:z}=T.next(),ee=process.hrtime(U);if(_=ve(_,ee),m.progress&&m.progress(ee,_),z)return m.total&&m.total(_),G;yield G}}function te(m={},k){return k===void 0?T=>te(m,T):k[Symbol.asyncIterator]!==void 0?x(m,k):X(m,k)}function v(m,k,T){let _=n(T),U=[],G=[],z=!1,ee=!1,ae=0,oe=null;function Ee(){for(;G.length>0&&U.length>0;){let{resolve:we}=G.shift(),Me=U.shift();we({done:!1,value:Me})}for(;G.length>0&&ae===0&&z;){let{resolve:we,reject:Me}=G.shift();oe?(Me(oe),oe=null):we({done:!0,value:void 0})}}async function le(){if(z){Ee();return}if(!ee&&!(ae+U.length>=m)){ee=!0,ae++;try{let{done:we,value:Me}=await _.next();we?(z=!0,ae--,Ee()):xe(Me)}catch(we){z=!0,ae--,oe=we,Ee()}ee=!1,le()}}async function xe(we){try{let Me=await k(we);U.push(Me)}catch(Me){z=!0,oe=Me}ae--,Ee(),le()}async function _e(){if(U.length===0){let Me=s();return G.push(Me),le(),Me.promise}let we=U.shift();return le(),{done:!1,value:we}}let Se={next:_e,[Symbol.asyncIterator]:()=>Se};return Se}function S(m,k,T){return k===void 0?(_,U)=>U?S(m,_,U):S(m,_):T===void 0?_=>S(m,k,_):v(m,k,T)}async function N(m,k){let T=null,_=null,U=null,G=oe=>{T=oe,_&&_(oe)},z=()=>{U&&U()},ee=()=>{m.removeListener("error",G),m.removeListener("drain",z)};m.once("error",G);let ae=()=>new Promise((oe,Ee)=>{if(T)return Ee(T);m.once("drain",z),U=oe,_=Ee});for await(let oe of k)if(m.write(oe)===!1&&await ae(),T)break;if(ee(),T)throw T}function q(m,k){return k===void 0?T=>N(m,T):N(m,k)}t.batch=i,t.buffer=c,t.collect=u,t.concat=p,t.consume=A,t.filter=B,t.flatMap=$,t.flatTransform=J,t.flatten=K,t.fromStream=O,t.getIterator=n,t.map=Q,t.merge=d,t.parallelFlatMap=R,t.parallelMap=I,t.parallelMerge=L,t.pipeline=y,t.reduce=P,t.take=fe,t.tap=he,t.time=te,t.transform=S,t.writeToStream=q,Object.defineProperty(t,"__esModule",{value:!0})})});var vE=C((mH,gE)=>{gE.exports=function(t){if(!t)throw Error("hashlru must have a max value, of type number, greater than 0");var e=0,r=Object.create(null),i=Object.create(null);function n(s,a){r[s]=a,e++,e>=t&&(e=0,i=r,r=Object.create(null))}return{has:function(s){return r[s]!==void 0||i[s]!==void 0},remove:function(s){r[s]!==void 0&&(r[s]=void 0),i[s]!==void 0&&(i[s]=void 0)},get:function(s){var a=r[s];if(a!==void 0)return a;if((a=i[s])!==void 0)return n(s,a),a},set:function(s,a){r[s]!==void 0?r[s]=a:n(s,a)},clear:function(){r=Object.create(null),i=Object.create(null)}}}});var xE=C((xH,mE)=>{"use strict";var DL=vE();mE.exports=t=>{let e=DL(t);return e.delete=e.remove,e}});var EE=C((wE,$0)=>{(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",o=1e14,c=14,f=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],l=1e7,b=1e9;function p($){var Y,J,se,ne=W.prototype={constructor:W,toString:null,valueOf:null},O=new W(1),d=20,y=4,w=-7,I=21,R=-1e7,L=1e7,D=!1,P=1,h=0,M={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},fe="0123456789abcdefghijklmnopqrstuvwxyz";function W(v,S){var N,q,m,k,T,_,U,G,z=this;if(!(z instanceof W))return new W(v,S);if(S==null){if(v&&v._isBigNumber===!0){z.s=v.s,!v.c||v.e>L?z.c=z.e=null:v.e=10;T/=10,k++);k>L?z.c=z.e=null:(z.e=k,z.c=[v]);return}G=String(v)}else{if(!r.test(G=String(v)))return se(z,G,_);z.s=G.charCodeAt(0)==45?(G=G.slice(1),-1):1}(k=G.indexOf("."))>-1&&(G=G.replace(".","")),(T=G.search(/e/i))>0?(k<0&&(k=T),k+=+G.slice(T+1),G=G.substring(0,T)):k<0&&(k=G.length)}else{if(B(S,2,fe.length,"Base"),S==10)return z=new W(v),X(z,d+z.e+1,y);if(G=String(v),_=typeof v=="number"){if(v*0!=0)return se(z,G,_,S);if(z.s=1/v<0?(G=G.slice(1),-1):1,W.DEBUG&&G.replace(/^0\.0*|\./,"").length>15)throw Error(a+v)}else z.s=G.charCodeAt(0)===45?(G=G.slice(1),-1):1;for(N=fe.slice(0,S),k=T=0,U=G.length;Tk){k=U;continue}}else if(!m&&(G==G.toUpperCase()&&(G=G.toLowerCase())||G==G.toLowerCase()&&(G=G.toUpperCase()))){m=!0,T=-1,k=0;continue}return se(z,String(v),_,S)}_=!1,G=J(G,S,10,z.s),(k=G.indexOf("."))>-1?G=G.replace(".",""):k=G.length}for(T=0;G.charCodeAt(T)===48;T++);for(U=G.length;G.charCodeAt(--U)===48;);if(G=G.slice(T,++U)){if(U-=T,_&&W.DEBUG&&U>15&&(v>f||v!==n(v)))throw Error(a+z.s*v);if((k=k-T-1)>L)z.c=z.e=null;else if(k=-b&&m<=b&&m===n(m)){if(q[0]===0){if(m===0&&q.length===1)return!0;break e}if(S=(m+1)%c,S<1&&(S+=c),String(q[0]).length==S){for(S=0;S=o||N!==n(N))break e;if(N!==0)return!0}}}else if(q===null&&m===null&&(k===null||k===1||k===-1))return!0;throw Error(s+"Invalid BigNumber: "+v)},W.maximum=W.max=function(){return ve(arguments,ne.lt)},W.minimum=W.min=function(){return ve(arguments,ne.gt)},W.random=function(){var v=9007199254740992,S=Math.random()*v&2097151?function(){return n(Math.random()*v)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(N){var q,m,k,T,_,U=0,G=[],z=new W(O);if(N==null?N=d:B(N,0,b),T=i(N/c),D)if(crypto.getRandomValues){for(q=crypto.getRandomValues(new Uint32Array(T*=2));U>>11),_>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),q[U]=m[0],q[U+1]=m[1]):(G.push(_%1e14),U+=2);U=T/2}else if(crypto.randomBytes){for(q=crypto.randomBytes(T*=7);U=9e15?crypto.randomBytes(7).copy(q,U):(G.push(_%1e14),U+=7);U=T/7}else throw D=!1,Error(s+"crypto unavailable");if(!D)for(;U=10;_/=10,U++);Um-1&&(_[T+1]==null&&(_[T+1]=0),_[T+1]+=_[T]/m|0,_[T]%=m)}return _.reverse()}return function(N,q,m,k,T){var _,U,G,z,ee,ae,oe,Ee,le=N.indexOf("."),xe=d,_e=y;for(le>=0&&(z=h,h=0,N=N.replace(".",""),Ee=new W(q),ae=Ee.pow(N.length-le),h=z,Ee.c=S(Q(A(ae.c),ae.e,"0"),10,m,v),Ee.e=Ee.c.length),oe=S(N,q,m,T?(_=fe,v):(_=v,fe)),G=z=oe.length;oe[--z]==0;oe.pop());if(!oe[0])return _.charAt(0);if(le<0?--G:(ae.c=oe,ae.e=G,ae.s=k,ae=Y(ae,Ee,xe,_e,m),oe=ae.c,ee=ae.r,G=ae.e),U=G+xe+1,le=oe[U],z=m/2,ee=ee||U<0||oe[U+1]!=null,ee=_e<4?(le!=null||ee)&&(_e==0||_e==(ae.s<0?3:2)):le>z||le==z&&(_e==4||ee||_e==6&&oe[U-1]&1||_e==(ae.s<0?8:7)),U<1||!oe[0])N=ee?Q(_.charAt(1),-xe,_.charAt(0)):_.charAt(0);else{if(oe.length=U,ee)for(--m;++oe[--U]>m;)oe[U]=0,U||(++G,oe=[1].concat(oe));for(z=oe.length;!oe[--z];);for(le=0,N="";le<=z;N+=_.charAt(oe[le++]));N=Q(N,G,_.charAt(0))}return N}}(),Y=function(){function v(q,m,k){var T,_,U,G,z=0,ee=q.length,ae=m%l,oe=m/l|0;for(q=q.slice();ee--;)U=q[ee]%l,G=q[ee]/l|0,T=oe*U+G*ae,_=ae*U+T%l*l+z,z=(_/k|0)+(T/l|0)+oe*G,q[ee]=_%k;return z&&(q=[z].concat(q)),q}function S(q,m,k,T){var _,U;if(k!=T)U=k>T?1:-1;else for(_=U=0;_m[_]?1:-1;break}return U}function N(q,m,k,T){for(var _=0;k--;)q[k]-=_,_=q[k]1;q.splice(0,1));}return function(q,m,k,T,_){var U,G,z,ee,ae,oe,Ee,le,xe,_e,Se,we,Me,Ye,Je,Ht,We,qe=q.s==m.s?1:-1,Rt=q.c,Te=m.c;if(!Rt||!Rt[0]||!Te||!Te[0])return new W(!q.s||!m.s||(Rt?Te&&Rt[0]==Te[0]:!Te)?NaN:Rt&&Rt[0]==0||!Te?qe*0:qe/0);for(le=new W(qe),xe=le.c=[],G=q.e-m.e,qe=k+G+1,_||(_=o,G=g(q.e/c)-g(m.e/c),qe=qe/c|0),z=0;Te[z]==(Rt[z]||0);z++);if(Te[z]>(Rt[z]||0)&&G--,qe<0)xe.push(1),ee=!0;else{for(Ye=Rt.length,Ht=Te.length,z=0,qe+=2,ae=n(_/(Te[0]+1)),ae>1&&(Te=v(Te,ae,_),Rt=v(Rt,ae,_),Ht=Te.length,Ye=Rt.length),Me=Ht,_e=Rt.slice(0,Ht),Se=_e.length;Se=_/2&&Je++;do{if(ae=0,U=S(Te,_e,Ht,Se),U<0){if(we=_e[0],Ht!=Se&&(we=we*_+(_e[1]||0)),ae=n(we/Je),ae>1)for(ae>=_&&(ae=_-1),oe=v(Te,ae,_),Ee=oe.length,Se=_e.length;S(oe,_e,Ee,Se)==1;)ae--,N(oe,Ht=10;qe/=10,z++);X(le,k+(le.e=z+G*c-1)+1,T,ee)}else le.e=G,le.r=+ee;return le}}();function he(v,S,N,q){var m,k,T,_,U;if(N==null?N=y:B(N,0,8),!v.c)return v.toString();if(m=v.c[0],T=v.e,S==null)U=A(v.c),U=q==1||q==2&&(T<=w||T>=I)?V(U,T):Q(U,T,"0");else if(v=X(new W(v),S,N),k=v.e,U=A(v.c),_=U.length,q==1||q==2&&(S<=k||k<=w)){for(;__){if(--S>0)for(U+=".";S--;U+="0");}else if(S+=k-_,S>0)for(k+1==_&&(U+=".");S--;U+="0");return v.s<0&&m?"-"+U:U}function ve(v,S){for(var N,q=1,m=new W(v[0]);q=10;m/=10,q++);return(N=q+N*c-1)>L?v.c=v.e=null:N=10;_/=10,m++);if(k=S-m,k<0)k+=c,T=S,U=ee[G=0],z=U/ae[m-T-1]%10|0;else if(G=i((k+1)/c),G>=ee.length)if(q){for(;ee.length<=G;ee.push(0));U=z=0,m=1,k%=c,T=k-c+1}else break e;else{for(U=_=ee[G],m=1;_>=10;_/=10,m++);k%=c,T=k-c+m,z=T<0?0:U/ae[m-T-1]%10|0}if(q=q||S<0||ee[G+1]!=null||(T<0?U:U%ae[m-T-1]),q=N<4?(z||q)&&(N==0||N==(v.s<0?3:2)):z>5||z==5&&(N==4||q||N==6&&(k>0?T>0?U/ae[m-T]:0:ee[G-1])%10&1||N==(v.s<0?8:7)),S<1||!ee[0])return ee.length=0,q?(S-=v.e+1,ee[0]=ae[(c-S%c)%c],v.e=-S||0):ee[0]=v.e=0,v;if(k==0?(ee.length=G,_=1,G--):(ee.length=G+1,_=ae[c-k],ee[G]=T>0?n(U/ae[m-T]%ae[T])*_:0),q)for(;;)if(G==0){for(k=1,T=ee[0];T>=10;T/=10,k++);for(T=ee[0]+=_,_=1;T>=10;T/=10,_++);k!=_&&(v.e++,ee[0]==o&&(ee[0]=1));break}else{if(ee[G]+=_,ee[G]!=o)break;ee[G--]=0,_=1}for(k=ee.length;ee[--k]===0;ee.pop());}v.e>L?v.c=v.e=null:v.e=I?V(S,N):Q(S,N,"0"),v.s<0?"-"+S:S)}return ne.absoluteValue=ne.abs=function(){var v=new W(this);return v.s<0&&(v.s=1),v},ne.comparedTo=function(v,S){return F(this,new W(v,S))},ne.decimalPlaces=ne.dp=function(v,S){var N,q,m,k=this;if(v!=null)return B(v,0,b),S==null?S=y:B(S,0,8),X(new W(k),v+k.e+1,S);if(!(N=k.c))return null;if(q=((m=N.length-1)-g(this.e/c))*c,m=N[m])for(;m%10==0;m/=10,q--);return q<0&&(q=0),q},ne.dividedBy=ne.div=function(v,S){return Y(this,new W(v,S),d,y)},ne.dividedToIntegerBy=ne.idiv=function(v,S){return Y(this,new W(v,S),0,1)},ne.exponentiatedBy=ne.pow=function(v,S){var N,q,m,k,T,_,U,G,z,ee=this;if(v=new W(v),v.c&&!v.isInteger())throw Error(s+"Exponent not an integer: "+te(v));if(S!=null&&(S=new W(S)),_=v.e>14,!ee.c||!ee.c[0]||ee.c[0]==1&&!ee.e&&ee.c.length==1||!v.c||!v.c[0])return z=new W(Math.pow(+te(ee),_?2-K(v):+te(v))),S?z.mod(S):z;if(U=v.s<0,S){if(S.c?!S.c[0]:!S.s)return new W(NaN);q=!U&&ee.isInteger()&&S.isInteger(),q&&(ee=ee.mod(S))}else{if(v.e>9&&(ee.e>0||ee.e<-1||(ee.e==0?ee.c[0]>1||_&&ee.c[1]>=24e7:ee.c[0]<8e13||_&&ee.c[0]<=9999975e7)))return k=(ee.s<0&&K(v),-0),ee.e>-1&&(k=1/k),new W(U?1/k:k);h&&(k=i(h/c+2))}for(_?(N=new W(.5),U&&(v.s=1),G=K(v)):(m=Math.abs(+te(v)),G=m%2),z=new W(O);;){if(G){if(z=z.times(ee),!z.c)break;k?z.c.length>k&&(z.c.length=k):q&&(z=z.mod(S))}if(m){if(m=n(m/2),m===0)break;G=m%2}else if(v=v.times(N),X(v,v.e+1,1),v.e>14)G=K(v);else{if(m=+te(v),m===0)break;G=m%2}ee=ee.times(ee),k?ee.c&&ee.c.length>k&&(ee.c.length=k):q&&(ee=ee.mod(S))}return q?z:(U&&(z=O.div(z)),S?z.mod(S):k?X(z,h,y,T):z)},ne.integerValue=function(v){var S=new W(this);return v==null?v=y:B(v,0,8),X(S,S.e+1,v)},ne.isEqualTo=ne.eq=function(v,S){return F(this,new W(v,S))===0},ne.isFinite=function(){return!!this.c},ne.isGreaterThan=ne.gt=function(v,S){return F(this,new W(v,S))>0},ne.isGreaterThanOrEqualTo=ne.gte=function(v,S){return(S=F(this,new W(v,S)))===1||S===0},ne.isInteger=function(){return!!this.c&&g(this.e/c)>this.c.length-2},ne.isLessThan=ne.lt=function(v,S){return F(this,new W(v,S))<0},ne.isLessThanOrEqualTo=ne.lte=function(v,S){return(S=F(this,new W(v,S)))===-1||S===0},ne.isNaN=function(){return!this.s},ne.isNegative=function(){return this.s<0},ne.isPositive=function(){return this.s>0},ne.isZero=function(){return!!this.c&&this.c[0]==0},ne.minus=function(v,S){var N,q,m,k,T=this,_=T.s;if(v=new W(v,S),S=v.s,!_||!S)return new W(NaN);if(_!=S)return v.s=-S,T.plus(v);var U=T.e/c,G=v.e/c,z=T.c,ee=v.c;if(!U||!G){if(!z||!ee)return z?(v.s=-S,v):new W(ee?T:NaN);if(!z[0]||!ee[0])return ee[0]?(v.s=-S,v):new W(z[0]?T:(y==3,-0))}if(U=g(U),G=g(G),z=z.slice(),_=U-G){for((k=_<0)?(_=-_,m=z):(G=U,m=ee),m.reverse(),S=_;S--;m.push(0));m.reverse()}else for(q=(k=(_=z.length)<(S=ee.length))?_:S,_=S=0;S0)for(;S--;z[N++]=0);for(S=o-1;q>_;){if(z[--q]=0;){for(N=0,ae=we[m]%xe,oe=we[m]/xe|0,T=U,k=m+T;k>m;)G=Se[--T]%xe,z=Se[T]/xe|0,_=oe*G+z*ae,G=ae*G+_%xe*xe+Ee[k]+N,N=(G/le|0)+(_/xe|0)+oe*z,Ee[k--]=G%le;Ee[k]=N}return N?++q:Ee.splice(0,1),x(v,Ee,q)},ne.negated=function(){var v=new W(this);return v.s=-v.s||null,v},ne.plus=function(v,S){var N,q=this,m=q.s;if(v=new W(v,S),S=v.s,!m||!S)return new W(NaN);if(m!=S)return v.s=-S,q.minus(v);var k=q.e/c,T=v.e/c,_=q.c,U=v.c;if(!k||!T){if(!_||!U)return new W(m/0);if(!_[0]||!U[0])return U[0]?v:new W(_[0]?q:m*0)}if(k=g(k),T=g(T),_=_.slice(),m=k-T){for(m>0?(T=k,N=U):(m=-m,N=_),N.reverse();m--;N.push(0));N.reverse()}for(m=_.length,S=U.length,m-S<0&&(N=U,U=_,_=N,S=m),m=0;S;)m=(_[--S]=_[S]+U[S]+m)/o|0,_[S]=o===_[S]?0:_[S]%o;return m&&(_=[m].concat(_),++T),x(v,_,T)},ne.precision=ne.sd=function(v,S){var N,q,m,k=this;if(v!=null&&v!==!!v)return B(v,1,b),S==null?S=y:B(S,0,8),X(new W(k),v,S);if(!(N=k.c))return null;if(m=N.length-1,q=m*c+1,m=N[m]){for(;m%10==0;m/=10,q--);for(m=N[0];m>=10;m/=10,q++);}return v&&k.e+1>q&&(q=k.e+1),q},ne.shiftedBy=function(v){return B(v,-f,f),this.times("1e"+v)},ne.squareRoot=ne.sqrt=function(){var v,S,N,q,m,k=this,T=k.c,_=k.s,U=k.e,G=d+4,z=new W("0.5");if(_!==1||!T||!T[0])return new W(!_||_<0&&(!T||T[0])?NaN:T?k:1/0);if(_=Math.sqrt(+te(k)),_==0||_==1/0?(S=A(T),(S.length+U)%2==0&&(S+="0"),_=Math.sqrt(+S),U=g((U+1)/2)-(U<0||U%2),_==1/0?S="5e"+U:(S=_.toExponential(),S=S.slice(0,S.indexOf("e")+1)+U),N=new W(S)):N=new W(_+""),N.c[0]){for(U=N.e,_=U+G,_<3&&(_=0);;)if(m=N,N=z.times(m.plus(Y(k,m,G,1))),A(m.c).slice(0,_)===(S=A(N.c)).slice(0,_))if(N.e0&&Ee>0){for(k=Ee%_||_,z=oe.substr(0,k);k0&&(z+=G+oe.slice(k)),ae&&(z="-"+z)}q=ee?z+(N.decimalSeparator||"")+((U=+N.fractionGroupSize)?ee.replace(new RegExp("\\d{"+U+"}\\B","g"),"$&"+(N.fractionGroupSeparator||"")):ee):z}return(N.prefix||"")+q+(N.suffix||"")},ne.toFraction=function(v){var S,N,q,m,k,T,_,U,G,z,ee,ae,oe=this,Ee=oe.c;if(v!=null&&(_=new W(v),!_.isInteger()&&(_.c||_.s!==1)||_.lt(O)))throw Error(s+"Argument "+(_.isInteger()?"out of range: ":"not an integer: ")+te(_));if(!Ee)return new W(oe);for(S=new W(O),G=N=new W(O),q=U=new W(O),ae=A(Ee),k=S.e=ae.length-oe.e-1,S.c[0]=u[(T=k%c)<0?c+T:T],v=!v||_.comparedTo(S)>0?k>0?S:G:_,T=L,L=1/0,_=new W(ae),U.c[0]=0;z=Y(_,S,0,1),m=N.plus(z.times(q)),m.comparedTo(v)!=1;)N=q,q=m,G=U.plus(z.times(m=G)),U=m,S=_.minus(z.times(m=S)),_=m;return m=Y(v.minus(N),q,0,1),U=U.plus(m.times(G)),N=N.plus(m.times(q)),U.s=G.s=oe.s,k=k*2,ee=Y(G,q,k,y).minus(oe).abs().comparedTo(Y(U,N,k,y).minus(oe).abs())<1?[G,q]:[U,N],L=T,ee},ne.toNumber=function(){return+te(this)},ne.toPrecision=function(v,S){return v!=null&&B(v,1,b),he(this,v,S,2)},ne.toString=function(v){var S,N=this,q=N.s,m=N.e;return m===null?q?(S="Infinity",q<0&&(S="-"+S)):S="NaN":(v==null?S=m<=w||m>=I?V(A(N.c),m):Q(A(N.c),m,"0"):v===10?(N=X(new W(N),d+m+1,y),S=Q(A(N.c),N.e,"0")):(B(v,2,fe.length,"Base"),S=J(Q(A(N.c),m,"0"),10,v,q,!0)),q<0&&N.c[0]&&(S="-"+S)),S},ne.valueOf=ne.toJSON=function(){return te(this)},ne._isBigNumber=!0,$!=null&&W.set($),W}function g($){var Y=$|0;return $>0||$===Y?Y:Y-1}function A($){for(var Y,J,se=1,ne=$.length,O=$[0]+"";seI^J?1:-1;for(y=(w=ne.length)<(I=O.length)?w:I,d=0;dO[d]^J?1:-1;return w==I?0:w>I^J?1:-1}function B($,Y,J,se){if($J||$!==n($))throw Error(s+(se||"Argument")+(typeof $=="number"?$J?" out of range: ":" not an integer: ":" not a primitive number: ")+String($))}function K($){var Y=$.c.length-1;return g($.e/c)==Y&&$.c[Y]%2!=0}function V($,Y){return($.length>1?$.charAt(0)+"."+$.slice(1):$)+(Y<0?"e":"e+")+Y}function Q($,Y,J){var se,ne;if(Y<0){for(ne=J+".";++Y;ne+=J);$=ne+$}else if(se=$.length,++Y>se){for(ne=J,Y-=se;--Y;ne+=J);$+=ne}else Y{"use strict";var LL=Math.exp;SE=AE.exports=function(e){if(typeof e!="number")throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let r,i=0,n=0,s=0,a,o={};function c(f,u){return 1-LL(-(f-u)/e)}return o.push=function(u,l){if(a){let b=c(u,a),p=l-r,g=b*p;r=b*l+(1-b)*r,i=(1-b)*(i+p*g),n=Math.sqrt(i),s=r+b*p}else r=l;a=u},o.movingAverage=function(){return r},o.variance=function(){return i},o.deviation=function(){return n},o.forecast=function(){return s},o}});var kE=C((wH,CE)=>{"use strict";var{EventEmitter:qL}=ji(),{BigNumber:Y0}=EE(),IE=_E(),UL=rh(),TE=class extends qL{constructor(e,r){super();this._options=r,this._queue=[],this._stats={dataReceived:Y0(0),dataSent:Y0(0)},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this);let i=this._options.movingAverageIntervals;for(let n=0;n{this._updateFrequencyFor(i,r,e)}),this._frequencyLastTime=e}_updateFrequencyFor(e,r,i){let n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;let a=n/(r||1)*1e3,o=this._movingAverages[e];o||(o=this._movingAverages[e]={});let c=this._options.movingAverageIntervals;for(let f=0;f{"use strict";var FL=fc(),{pipe:KL}=Ui(),{tap:BE}=G0(),VL=xE(),{METRICS:zL}=l0(),cp=kE(),fp=["dataReceived","dataSent"],jL={in:"dataReceived",out:"dataSent"},W0=class{constructor(e){this._options=FL(zL,e),this._globalStats=new cp(fp,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=VL(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._connectionManager=e.connectionManager,this._connectionManager.on("peer:disconnect",r=>{this.onPeerDisconnected(r.remotePeer)})}start(){this._running=!0}stop(){this._running=!1,this._globalStats.stop();for(let e of this._peerStats.values())e.stop();for(let e of this._protocolStats.values())e.stop()}get global(){return this._globalStats}get peers(){return Array.from(this._peerStats.keys())}forPeer(e){let r=e.toB58String();return this._peerStats.get(r)||this._oldPeers.get(r)}get protocols(){return Array.from(this._protocolStats.keys())}forProtocol(e){return this._protocolStats.get(e)}onPeerDisconnected(e){let r=e.toB58String(),i=this._peerStats.get(r);i&&(i.stop(),this._peerStats.delete(r),this._oldPeers.set(r,i))}_onMessage({remotePeer:e,protocol:r,direction:i,dataLength:n}){if(!this._running)return;let s=jL[i],a=this.forPeer(e);if(a||(a=new cp(fp,this._options),this._peerStats.set(e.toB58String(),a)),a.push(s,n),this._globalStats.push(s,n),r){let o=this.forProtocol(r);o||(o=new cp(fp,this._options),this._protocolStats.set(r,o)),o.push(s,n)}}updatePlaceholder(e,r){if(!this._running)return;let i=this.forPeer(e),n=r.toB58String(),s=this.forPeer(r),a=i;s&&(a=W0.mergeStats(s,a),this._oldPeers.delete(n)),this._peerStats.delete(e.toB58String()),this._peerStats.set(n,a),a.start()}trackStream({stream:e,remotePeer:r,protocol:i}){let n=this,s=e.source;e.source=BE(o=>n._onMessage({remotePeer:r,protocol:i,direction:"in",dataLength:o.length}))(s);let a=e.sink;return e.sink=o=>KL(o,BE(c=>n._onMessage({remotePeer:r,protocol:i,direction:"out",dataLength:c.length})),a),e}static mergeStats(e,r){return e.stop(),r.stop(),e._queue=[...e._queue,...r._queue],e}};RE.exports=W0});var Q0=C($s=>{"use strict";var NE=Fs(),ME=mc(),HL=Ui(),GL=Pe(),$L=qt(),YL=Rd(),OE=$L(` +`);$s.encode=t=>ME.encode.single(new NE([t,OE]));$s.write=(t,e)=>t.push($s.encode(e));$s.writeAll=(t,e)=>{t.push(e.reduce((r,i)=>r.append($s.encode(i)),new NE))};$s.read=async t=>{let e=1,r={[Symbol.asyncIterator](){return this},next:()=>t.next(e)},i=s=>{e=s},n=await HL(r,ME.decode({onLength:i}),YL);if(n.get(n.length-1)!==OE[0])throw GL(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return n.shallowSlice(0,-1)}});var LE=C((AH,DE)=>{"use strict";var uo=Xe()("mss:select"),WL=Pe(),lo=Q0(),QL=xc();DE.exports=async(t,e,r)=>{e=Array.isArray(e)?[...e]:[e];let{reader:i,writer:n,rest:s,stream:a}=QL(t),o=e.shift();r?(uo('select: write ["%s", "%s"]',r,o),lo.writeAll(n,[r,o])):(uo('select: write "%s"',o),lo.write(n,o));let c=(await lo.read(i)).toString();if(uo('select: read "%s"',c),c===r&&(c=(await lo.read(i)).toString(),uo('select: read "%s"',c)),c===o)return s(),{stream:a,protocol:o};for(let f of e){uo('select: write "%s"',f),lo.write(n,f);let u=(await lo.read(i)).toString();if(uo('select: read "%s" for "%s"',u,f),u===f)return s(),{stream:a,protocol:f}}throw s(),WL(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}});var up=C(qE=>{"use strict";qE.PROTOCOL_ID="/multistream/1.0.0"});var FE=C((CH,UE)=>{"use strict";var Pc=Xe()("mss:handle"),JL=Fs(),ho=Q0(),XL=xc(),{PROTOCOL_ID:lp}=up();UE.exports=async(t,e)=>{e=Array.isArray(e)?e:[e];let{writer:r,reader:i,rest:n,stream:s}=XL(t);for(;;){let a=(await ho.read(i)).toString();if(Pc('read "%s"',a),a===lp){Pc('respond with "%s" for "%s"',lp,a),ho.write(r,lp);continue}if(e.includes(a))return ho.write(r,a),Pc('respond with "%s" for "%s"',a,a),n(),{stream:s,protocol:a};if(a==="ls"){ho.write(r,new JL(e.map(o=>ho.encode(o)))),Pc('respond with "%s" for %s',e,a);continue}ho.write(r,"na"),Pc('respond with "na" for "%s"',a)}}});var zE=C((IH,KE)=>{"use strict";var ZL=Ch(),eq=Xe()("it-multistream-select:ls"),VE=Q0(),tq=xc(),rq=mc(),iq=Ui();KE.exports=async t=>{let{reader:e,writer:r,rest:i,stream:n}=tq(t);eq('write "ls"'),VE.write(r,"ls"),i();let s=await VE.read(e),a=ZL([s]),o=[];return await iq(a,rq.decode(),async c=>{for await(let f of c)o.push(f.shallowSlice(0,-1).toString())}),{stream:n,protocols:o}}});var $E=C(J0=>{"use strict";var jE=LE(),nq=FE(),sq=zE(),{PROTOCOL_ID:dp}=up();J0.PROTOCOL_ID=dp;var hp=class{constructor(e){this._stream=e,this._shaken=!1}async _handshake(){if(this._shaken)return;let{stream:e}=await jE(this._stream,dp);this._stream=e,this._shaken=!0}},HE=class extends hp{select(e){return jE(this._stream,e,this._shaken?null:dp)}async ls(){await this._handshake();let{stream:e,protocols:r}=await sq(this._stream);return this._stream=e,r}};J0.Dialer=HE;var GE=class extends hp{handle(e){return nq(this._stream,e)}};J0.Listener=GE});var WE=C((kH,YE)=>{"use strict";var aq={OPEN:"open",CLOSING:"closing",CLOSED:"closed"};YE.exports=aq});var tS=C((RH,QE)=>{"use strict";var JE=Ut(),{Multiaddr:oq}=dr(),Pr=Pe(),{OPEN:cq,CLOSING:XE,CLOSED:pp}=WE(),ZE=Symbol.for("@libp2p/interface-connection/connection"),eS=class{constructor({localAddr:e,remoteAddr:r,localPeer:i,remotePeer:n,newStream:s,close:a,getStreams:o,stat:c}){fq(e,i,n,s,a,o,c),this.id=parseInt(String(Math.random()*1e9)).toString(36)+Date.now(),this.localAddr=e,this.remoteAddr=r,this.localPeer=i,this.remotePeer=n,this._stat={...c,status:cq},this._newStream=s,this._close=a,this._getStreams=o,this.registry=new Map,this.tags=[]}get[Symbol.toStringTag](){return"Connection"}get[ZE](){return!0}static isConnection(e){return Boolean(e&&e[ZE])}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(e){if(this.stat.status===XE)throw Pr(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===pp)throw Pr(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);let{stream:r,protocol:i}=await this._newStream(e);return this.addStream(r,{protocol:i}),{stream:r,protocol:i}}addStream(e,{protocol:r,metadata:i={}}){this.registry.set(e.id,{protocol:r,...i})}removeStream(e){this.registry.delete(e)}async close(){if(this.stat.status!==pp){if(this._closing)return this._closing;this.stat.status=XE,this._closing=await this._close(),this._stat.timeline.close=Date.now(),this.stat.status=pp}}};QE.exports=eS;function fq(t,e,r,i,n,s,a){if(t&&!oq.isMultiaddr(t))throw Pr(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!JE.isPeerId(e))throw Pr(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!JE.isPeerId(r))throw Pr(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(typeof i!="function")throw Pr(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if(typeof n!="function")throw Pr(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if(typeof s!="function")throw Pr(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!a)throw Pr(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if(a.direction!=="inbound"&&a.direction!=="outbound")throw Pr(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!a.timeline)throw Pr(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!a.timeline.open)throw Pr(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!a.timeline.upgraded)throw Pr(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}});var iS=C(rS=>{"use strict";rS.Connection=tS()});var sS=C((PH,nS)=>{"use strict";function uq(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e{"use strict";var oS=Xe(),zt=Object.assign(oS("libp2p:upgrader"),{error:oS("libp2p:upgrader:err")}),Ys=Pe(),po=$E(),{Connection:lq}=iS(),dq=Ut(),{pipe:hq}=Ui(),cS=sS(),{codes:bo}=Kt(),fS=class{constructor({localPeer:e,metrics:r,cryptos:i=new Map,muxers:n=new Map,onConnectionEnd:s=()=>{},onConnection:a=()=>{}}){this.localPeer=e,this.metrics=r,this.cryptos=i,this.muxers=n,this.protector=null,this.protocols=new Map,this.onConnection=a,this.onConnectionEnd=s}async upgradeInbound(e){let r,i,n,s,a,o,c;if(this.metrics){({setTarget:o,proxy:c}=cS());let u=(Math.random()*1e9).toString(36)+Date.now();o({toB58String:()=>u}),e=this.metrics.trackStream({stream:e,remotePeer:c})}zt("Starting the inbound connection upgrade");let f=e;this.protector&&(f=await this.protector.protect(e));try{({conn:r,remotePeer:i,protocol:a}=await this._encryptInbound(this.localPeer,f,this.cryptos)),this.muxers.size?{stream:n,Muxer:s}=await this._multiplexInbound(r,this.muxers):n=r}catch(u){throw zt.error("Failed to upgrade inbound connection",u),await e.close(u),u}return this.metrics&&(this.metrics.updatePlaceholder(c,i),o(i)),zt("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:a,direction:"inbound",maConn:e,upgradedConn:n,Muxer:s,remotePeer:i})}async upgradeOutbound(e){let r=e.remoteAddr.getPeerId();if(!r)throw Ys(new Error("outbound connection must have a peer id"),bo.ERR_INVALID_MULTIADDR);let i=dq.createFromB58String(r),n,s,a,o,c,f,u;if(this.metrics){({setTarget:f,proxy:u}=cS());let b=(Math.random()*1e9).toString(36)+Date.now();f({toB58String:()=>b}),e=this.metrics.trackStream({stream:e,remotePeer:u})}zt("Starting the outbound connection upgrade");let l=e;this.protector&&(l=await this.protector.protect(e));try{({conn:n,remotePeer:s,protocol:o}=await this._encryptOutbound(this.localPeer,l,i,this.cryptos)),this.muxers.size?{stream:a,Muxer:c}=await this._multiplexOutbound(n,this.muxers):a=n}catch(b){throw zt.error("Failed to upgrade outbound connection",b),await e.close(b),b}return this.metrics&&(this.metrics.updatePlaceholder(u,s),f(s)),zt("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:o,direction:"outbound",maConn:e,upgradedConn:a,Muxer:c,remotePeer:s})}_createConnection({cryptoProtocol:e,direction:r,maConn:i,upgradedConn:n,Muxer:s,remotePeer:a}){let o,c,f;s&&(o=new s({onStream:async b=>{if(!f)return;let p=new po.Listener(b);try{let{stream:g,protocol:A}=await p.handle(Array.from(this.protocols.keys()));zt("%s: incoming stream opened on %s",r,A),this.metrics&&this.metrics.trackStream({stream:g,remotePeer:a,protocol:A}),f.addStream(b,{protocol:A}),this._onStream({connection:f,stream:{...b,...g},protocol:A})}catch(g){zt.error(g)}},onStreamEnd:b=>{f.removeStream(b.id)}}),c=async b=>{zt("%s: starting new stream on %s",r,b);let p=o.newStream(),g=new po.Dialer(p);try{let{stream:A,protocol:F}=await g.select(b);return this.metrics&&this.metrics.trackStream({stream:A,remotePeer:a,protocol:F}),{stream:{...p,...A},protocol:F}}catch(A){throw zt.error("could not create new stream",A),Ys(A,bo.ERR_UNSUPPORTED_PROTOCOL)}},hq(n,o,n).catch(zt.error));let u=i.timeline;i.timeline=new Proxy(u,{set:(...b)=>(f&&b[1]==="close"&&b[2]&&!u.close&&(async()=>{try{f.stat.status==="open"&&await f.close()}catch(p){zt.error(p)}finally{this.onConnectionEnd(f)}})(),Reflect.set(...b))}),i.timeline.upgraded=Date.now();let l=()=>{throw Ys(new Error("connection is not multiplexed"),"ERR_CONNECTION_NOT_MULTIPLEXED")};return f=new lq({localAddr:i.localAddr,remoteAddr:i.remoteAddr,localPeer:this.localPeer,remotePeer:a,stat:{direction:r,timeline:i.timeline,multiplexer:s&&s.multicodec,encryption:e},newStream:c||l,getStreams:()=>o?o.streams:l(),close:async()=>{await i.close(),o&&o.streams.map(b=>b.abort())}}),this.onConnection(f),f}_onStream({connection:e,stream:r,protocol:i}){this.protocols.get(i)({connection:e,stream:r,protocol:i})}async _encryptInbound(e,r,i){let n=new po.Listener(r),s=Array.from(i.keys());zt("handling inbound crypto protocol selection",s);try{let{stream:a,protocol:o}=await n.handle(s),c=i.get(o);if(zt("encrypting inbound connection..."),!c)throw new Error(`no crypto module found for ${o}`);return{...await c.secureInbound(e,a),protocol:o}}catch(a){throw Ys(a,bo.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,r,i,n){let s=new po.Dialer(r),a=Array.from(n.keys());zt("selecting outbound crypto protocol",a);try{let{stream:o,protocol:c}=await s.select(a),f=n.get(c);if(zt("encrypting outbound connection to %j",i),!f)throw new Error(`no crypto module found for ${c}`);return{...await f.secureOutbound(e,o,i),protocol:c}}catch(o){throw Ys(o,bo.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,r){let i=new po.Dialer(e),n=Array.from(r.keys());zt("outbound selecting muxer %s",n);try{let{stream:s,protocol:a}=await i.select(n);zt("%s selected as muxer protocol",a);let o=r.get(a);return{stream:s,Muxer:o}}catch(s){throw Ys(s,bo.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,r){let i=new po.Listener(e),n=Array.from(r.keys());zt("inbound handling muxers %s",n);try{let{stream:s,protocol:a}=await i.handle(n),o=r.get(a);return{stream:s,Muxer:o}}catch(s){throw Ys(s,bo.ERR_MUXER_UNAVAILABLE)}}};aS.exports=fS});var Nc=C((MH,lS)=>{"use strict";var bp=Pe(),dS=Ut(),{codes:{ERR_INVALID_PARAMETERS:hS}}=Kt(),pq=t=>t,pS=class{constructor({peerStore:e,eventName:r,eventProperty:i,eventTransformer:n=pq}){this._ps=e,this.eventName=r,this.eventProperty=i,this.eventTransformer=n,this.data=new Map}set(e,r){throw bp(new Error("set must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}_setData(e,r,{emit:i=!0}={}){let n=e.toB58String();this.data.set(n,r),i&&this._emit(e,r)}_emit(e,r){this._ps.emit(this.eventName,{peerId:e,[this.eventProperty]:this.eventTransformer(r)})}get(e){if(!dS.isPeerId(e))throw bp(new Error("peerId must be an instance of peer-id"),hS);let r=this.data.get(e.toB58String());return r?[...r]:void 0}delete(e){if(!dS.isPeerId(e))throw bp(new Error("peerId must be an instance of peer-id"),hS);return this.data.delete(e.toB58String())?(this._emit(e,[]),!0):!1}};lS.exports=pS});var vS=C((OH,bS)=>{"use strict";var yS=Xe(),pi=Object.assign(yS("libp2p:peer-store:address-book"),{error:yS("libp2p:peer-store:address-book:err")}),yo=Pe(),{Multiaddr:bq}=dr(),X0=Ut(),yq=Nc(),gq=y0(),{codes:{ERR_INVALID_PARAMETERS:go}}=Kt(),vq=p0(),gS=class extends yq{constructor(e){super({peerStore:e,eventName:"change:multiaddrs",eventProperty:"multiaddrs",eventTransformer:r=>r.addresses?r.addresses.map(i=>i.multiaddr):[]});this.data=new Map}consumePeerRecord(e){let r;try{r=gq.createFromProtobuf(e.payload)}catch(c){return pi.error("invalid peer record received"),!1}if(!r.peerId.equals(e.peerId))return pi("signing key does not match PeerId in the PeerRecord"),!1;if(!r.multiaddrs||!r.multiaddrs.length)return!1;let i=r.peerId,n=i.toB58String(),a=(this.data.get(n)||{record:void 0}).record;if(a&&a.seqNumber>=r.seqNumber)return!1;let o=this._toAddresses(r.multiaddrs,!0);return this._setData(i,{addresses:o,record:{raw:e.marshal(),seqNumber:r.seqNumber}}),pi(`stored provided peer record for ${n}`),!0}getRawEnvelope(e){let r=this.data.get(e.toB58String());if(!(!r||!r.record||!r.record.raw))return r.record.raw}getPeerRecord(e){let r=this.getRawEnvelope(e);if(!!r)return vq.createFromProtobuf(r)}set(e,r){if(!X0.isPeerId(e))throw pi.error("peerId must be an instance of peer-id to store data"),yo(new Error("peerId must be an instance of peer-id"),go);let i=this._toAddresses(r);if(!i.length)return this;let n=e.toB58String(),s=this.data.get(n);return s&&s.addresses&&s.addresses.length===i.length&&s.addresses.filter(o=>i.some(c=>o.multiaddr.equals(c.multiaddr))).length===s.addresses.length?(pi(`the addresses provided to store are equal to the already stored for ${n}`),this):(this._setData(e,{addresses:i,record:s&&s.record}),pi(`stored provided multiaddrs for ${n}`),s||this._ps.emit("peer",e),this)}add(e,r){if(!X0.isPeerId(e))throw pi.error("peerId must be an instance of peer-id to store data"),yo(new Error("peerId must be an instance of peer-id"),go);let i=this._toAddresses(r),n=e.toB58String();if(!i.length)return this;let s=this.data.get(n);return s&&s.addresses&&(s.addresses.forEach(a=>{i.find(o=>o.multiaddr.equals(a.multiaddr))||i.push(a)}),s.addresses.length===i.length)?(pi(`the addresses provided to store are already stored for ${n}`),this):(this._setData(e,{addresses:i,record:s&&s.record}),pi(`added provided multiaddrs for ${n}`),s&&s.addresses||this._ps.emit("peer",e),this)}get(e){if(!X0.isPeerId(e))throw yo(new Error("peerId must be an instance of peer-id"),go);let r=this.data.get(e.toB58String());return r&&r.addresses?[...r.addresses]:void 0}_toAddresses(e,r=!1){if(!e)throw pi.error("multiaddrs must be provided to store data"),yo(new Error("multiaddrs must be provided"),go);let i=[];return e.forEach(n=>{if(!bq.isMultiaddr(n))throw pi.error(`multiaddr ${n} must be an instance of multiaddr`),yo(new Error(`multiaddr ${n} must be an instance of multiaddr`),go);i.find(s=>s.multiaddr.equals(n))||i.push({multiaddr:n,isCertified:r})}),i}getMultiaddrsForPeer(e,r=i=>i){if(!X0.isPeerId(e))throw yo(new Error("peerId must be an instance of peer-id"),go);let i=this.data.get(e.toB58String());if(!(!i||!i.addresses))return r(i.addresses||[]).map(n=>{let s=n.multiaddr,a=s.getPeerId();return a&&a===e.toB58String()?s:s.encapsulate(`/p2p/${e.toB58String()}`)})}};bS.exports=gS});var CS=C((DH,mS)=>{"use strict";var xS=Xe(),wS=Object.assign(xS("libp2p:peer-store:key-book"),{error:xS("libp2p:peer-store:key-book:err")}),ES=Pe(),SS=Ut(),mq=Nc(),{codes:{ERR_INVALID_PARAMETERS:AS}}=Kt(),_S=class extends mq{constructor(e){super({peerStore:e,eventName:"change:pubkey",eventProperty:"pubkey",eventTransformer:r=>r.pubKey});this.data=new Map}set(e,r){if(!SS.isPeerId(e))throw wS.error("peerId must be an instance of peer-id to store data"),ES(new Error("peerId must be an instance of peer-id"),AS);let i=e.toB58String();return!this.data.get(i)&&r&&(e.pubKey=r,this._setData(e,e),wS(`stored provided public key for ${i}`)),this}get(e){if(!SS.isPeerId(e))throw ES(new Error("peerId must be an instance of peer-id"),AS);let r=this.data.get(e.toB58String());return r?r.pubKey:void 0}};mS.exports=_S});var RS=C((LH,IS)=>{"use strict";var TS=Xe(),yp=Object.assign(TS("libp2p:peer-store:proto-book"),{error:TS("libp2p:peer-store:proto-book:err")}),vo=Pe(),xq=Mr(),Mc=Ut(),wq=Nc(),{codes:{ERR_INVALID_PARAMETERS:mo}}=Kt(),kS=class extends wq{constructor(e){super({peerStore:e,eventName:"change:metadata",eventProperty:"metadata"});this.data=new Map}set(e,r,i){if(!Mc.isPeerId(e))throw yp.error("peerId must be an instance of peer-id to store data"),vo(new Error("peerId must be an instance of peer-id"),mo);if(typeof r!="string"||!(i instanceof Uint8Array))throw yp.error("valid key and value must be provided to store data"),vo(new Error("valid key and value must be provided"),mo);return this._setValue(e,r,i),this}_setValue(e,r,i,{emit:n=!0}={}){let s=e.toB58String(),a=this.data.get(s)||new Map,o=a.get(r);if(o&&xq(i,o)){yp(`the metadata provided to store is equal to the already stored for ${s} on ${r}`);return}a.set(r,i),this.data.set(s,a),n&&this._emit(e,r)}get(e){if(!Mc.isPeerId(e))throw vo(new Error("peerId must be an instance of peer-id"),mo);return this.data.get(e.toB58String())}getValue(e,r){if(!Mc.isPeerId(e))throw vo(new Error("peerId must be an instance of peer-id"),mo);let i=this.data.get(e.toB58String());return i&&i.get(r)}delete(e){if(!Mc.isPeerId(e))throw vo(new Error("peerId must be an instance of peer-id"),mo);return this.data.delete(e.toB58String())?(this._emit(e),!0):!1}deleteValue(e,r){if(!Mc.isPeerId(e))throw vo(new Error("peerId must be an instance of peer-id"),mo);let i=this.data.get(e.toB58String());return!i||!i.delete(r)?!1:(this._emit(e,r),!0)}};IS.exports=kS});var MS=C((qH,BS)=>{"use strict";var PS=Xe(),bi=Object.assign(PS("libp2p:peer-store:proto-book"),{error:PS("libp2p:peer-store:proto-book:err")}),xo=Pe(),gp=Ut(),Eq=Nc(),{codes:{ERR_INVALID_PARAMETERS:wo}}=Kt(),NS=class extends Eq{constructor(e){super({peerStore:e,eventName:"change:protocols",eventProperty:"protocols",eventTransformer:r=>Array.from(r)});this.data=new Map}set(e,r){if(!gp.isPeerId(e))throw bi.error("peerId must be an instance of peer-id to store data"),xo(new Error("peerId must be an instance of peer-id"),wo);if(!r)throw bi.error("protocols must be provided to store data"),xo(new Error("protocols must be provided"),wo);let i=e.toB58String(),n=this.data.get(i),s=new Set(r);return n&&((o,c)=>o.size===c.size&&[...o].every(f=>c.has(f)))(n,s)?(bi(`the protocols provided to store are equal to the already stored for ${i}`),this):(this._setData(e,s),bi(`stored provided protocols for ${i}`),this)}add(e,r){if(!gp.isPeerId(e))throw bi.error("peerId must be an instance of peer-id to store data"),xo(new Error("peerId must be an instance of peer-id"),wo);if(!r)throw bi.error("protocols must be provided to store data"),xo(new Error("protocols must be provided"),wo);let i=e.toB58String(),n=this.data.get(i)||new Set,s=new Set([...n,...r]);return n.size===s.size?(bi(`the protocols provided to store are already stored for ${i}`),this):(this._setData(e,s),bi(`added provided protocols for ${i}`),this)}remove(e,r){if(!gp.isPeerId(e))throw bi.error("peerId must be an instance of peer-id to store data"),xo(new Error("peerId must be an instance of peer-id"),wo);if(!r)throw bi.error("protocols must be provided to store data"),xo(new Error("protocols must be provided"),wo);let i=e.toB58String(),n=this.data.get(i);if(n){let s=new Set([...n].filter(a=>!r.includes(a)));if(n.size===s.size)return this;this._setData(e,s),bi(`removed provided protocols for ${i}`)}return this}};BS.exports=NS});var vp=C((UH,OS)=>{"use strict";var Sq=Pe(),{EventEmitter:Aq}=ji(),DS=Ut(),_q=vS(),Cq=CS(),Iq=RS(),Tq=MS(),{codes:{ERR_INVALID_PARAMETERS:kq}}=Kt(),LS=class extends Aq{constructor({peerId:e}){super();this._peerId=e,this.addressBook=new _q(this),this.keyBook=new Cq(this),this.metadataBook=new Iq(this),this.protoBook=new Tq(this)}start(){}stop(){}get peers(){let e=new Set([...this.addressBook.data.keys(),...this.keyBook.data.keys(),...this.protoBook.data.keys(),...this.metadataBook.data.keys()]);this._peerId&&e.delete(this._peerId.toB58String());let r=new Map;return e.forEach(i=>{r.set(i,this.get(DS.createFromCID(i)))}),r}delete(e){let r=this.addressBook.delete(e),i=this.keyBook.delete(e),n=this.protoBook.delete(e),s=this.metadataBook.delete(e);return r||i||n||s}get(e){if(!DS.isPeerId(e))throw Sq(new Error("peerId must be an instance of peer-id"),kq);let r=this.keyBook.data.get(e.toB58String()),i=this.addressBook.get(e),n=this.metadataBook.get(e),s=this.protoBook.get(e);if(!(!r&&!i&&!n&&!s))return{id:r||e,addresses:i||[],protocols:s||[],metadata:n}}};OS.exports=LS});var US=C((FH,qS)=>{"use strict";function Rq(t,e,r){let i=new t(e,r);i._subscribeAdapter=i.subscribe,i._unsubscribeAdapter=i.unsubscribe;function n(a,o){o&&i.on(a,o),i._subscribeAdapter(a)}function s(a,o){o?i.removeListener(a,o):i.removeAllListeners(a),i.listenerCount(a)===0&&i._unsubscribeAdapter(a)}return i.subscribe=n,i.unsubscribe=s,i}qS.exports=Rq});var FS=C((KH,Eo)=>{"use strict";Eo.exports.NAMESPACE_COMMON="/peers/";Eo.exports.NAMESPACE_ADDRESS="/peers/addrs/";Eo.exports.NAMESPACE_KEYS="/peers/keys/";Eo.exports.NAMESPACE_METADATA="/peers/metadata/";Eo.exports.NAMESPACE_PROTOCOL="/peers/protos/"});var VS=C((VH,KS)=>{"use strict";var Xn=Gi(),So=Xn.Reader,mp=Xn.Writer,Mt=Xn.util,jt=Xn.roots["libp2p-address-book"]||(Xn.roots["libp2p-address-book"]={});jt.Addresses=function(){function t(e){if(this.addrs=[],e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.addrs&&s.addrs.length||(s.addrs=[]),s.addrs.push(jt.Addresses.Address.decode(r,r.uint32()));break;case 2:s.certifiedRecord=jt.Addresses.CertifiedRecord.decode(r,r.uint32());break;default:r.skipType(a&7);break}}return s},t.fromObject=function(r){if(r instanceof jt.Addresses)return r;var i=new jt.Addresses;if(r.addrs){if(!Array.isArray(r.addrs))throw TypeError(".Addresses.addrs: array expected");i.addrs=[];for(var n=0;n>>3){case 1:a.multiaddr=i.bytes();break;case 2:a.isCertified=i.bool();break;default:i.skipType(o&7);break}}return a},e.fromObject=function(i){if(i instanceof jt.Addresses.Address)return i;var n=new jt.Addresses.Address;return i.multiaddr!=null&&(typeof i.multiaddr=="string"?Mt.base64.decode(i.multiaddr,n.multiaddr=Mt.newBuffer(Mt.base64.length(i.multiaddr)),0):i.multiaddr.length&&(n.multiaddr=i.multiaddr)),i.isCertified!=null&&(n.isCertified=Boolean(i.isCertified)),n},e.toObject=function(i,n){n||(n={});var s={};return n.defaults&&(n.bytes===String?s.multiaddr="":(s.multiaddr=[],n.bytes!==Array&&(s.multiaddr=Mt.newBuffer(s.multiaddr))),s.isCertified=!1),i.multiaddr!=null&&i.hasOwnProperty("multiaddr")&&(s.multiaddr=n.bytes===String?Mt.base64.encode(i.multiaddr,0,i.multiaddr.length):n.bytes===Array?Array.prototype.slice.call(i.multiaddr):i.multiaddr),i.isCertified!=null&&i.hasOwnProperty("isCertified")&&(s.isCertified=i.isCertified),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Xn.util.toJSONOptions)},e}(),t.CertifiedRecord=function(){function e(r){if(r)for(var i=Object.keys(r),n=0;n>>3){case 1:a.seq=i.uint64();break;case 2:a.raw=i.bytes();break;default:i.skipType(o&7);break}}return a},e.fromObject=function(i){if(i instanceof jt.Addresses.CertifiedRecord)return i;var n=new jt.Addresses.CertifiedRecord;return i.seq!=null&&(Mt.Long?(n.seq=Mt.Long.fromValue(i.seq)).unsigned=!0:typeof i.seq=="string"?n.seq=parseInt(i.seq,10):typeof i.seq=="number"?n.seq=i.seq:typeof i.seq=="object"&&(n.seq=new Mt.LongBits(i.seq.low>>>0,i.seq.high>>>0).toNumber(!0))),i.raw!=null&&(typeof i.raw=="string"?Mt.base64.decode(i.raw,n.raw=Mt.newBuffer(Mt.base64.length(i.raw)),0):i.raw.length&&(n.raw=i.raw)),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(Mt.Long){var a=new Mt.Long(0,0,!0);s.seq=n.longs===String?a.toString():n.longs===Number?a.toNumber():a}else s.seq=n.longs===String?"0":0;n.bytes===String?s.raw="":(s.raw=[],n.bytes!==Array&&(s.raw=Mt.newBuffer(s.raw)))}return i.seq!=null&&i.hasOwnProperty("seq")&&(typeof i.seq=="number"?s.seq=n.longs===String?String(i.seq):i.seq:s.seq=n.longs===String?Mt.Long.prototype.toString.call(i.seq):n.longs===Number?new Mt.LongBits(i.seq.low>>>0,i.seq.high>>>0).toNumber(!0):i.seq),i.raw!=null&&i.hasOwnProperty("raw")&&(s.raw=n.bytes===String?Mt.base64.encode(i.raw,0,i.raw.length):n.bytes===Array?Array.prototype.slice.call(i.raw):i.raw),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Xn.util.toJSONOptions)},e}(),t}();KS.exports=jt});var HS=C((zH,zS)=>{"use strict";var Ao=Gi(),jS=Ao.Reader,Bq=Ao.Writer,Pq=Ao.util,Oc=Ao.roots["libp2p-proto-book"]||(Ao.roots["libp2p-proto-book"]={});Oc.Protocols=function(){function t(e){if(this.protocols=[],e)for(var r=Object.keys(e),i=0;i>>3){case 1:s.protocols&&s.protocols.length||(s.protocols=[]),s.protocols.push(r.string());break;default:r.skipType(a&7);break}}return s},t.fromObject=function(r){if(r instanceof Oc.Protocols)return r;var i=new Oc.Protocols;if(r.protocols){if(!Array.isArray(r.protocols))throw TypeError(".Protocols.protocols: array expected");i.protocols=[];for(var n=0;n{"use strict";var $S=Xe(),ir=Object.assign($S("libp2p:persistent-peer-store"),{error:$S("libp2p:persistent-peer-store:err")}),{Key:Z0}=tp(),{Multiaddr:Nq}=dr(),xp=Ut(),Mq=vp(),{NAMESPACE_ADDRESS:Oq,NAMESPACE_COMMON:Dq,NAMESPACE_KEYS:Lq,NAMESPACE_METADATA:qq,NAMESPACE_PROTOCOL:Uq}=FS(),{Addresses:YS}=VS(),{Protocols:WS}=HS(),QS=class extends Mq{constructor({peerId:e,datastore:r,threshold:i=5}){super({peerId:e});this._datastore=r,this._dirtyPeers=new Set,this._dirtyMetadata=new Map,this.threshold=i,this._addDirtyPeer=this._addDirtyPeer.bind(this)}async start(){ir("PeerStore is starting"),this.on("change:protocols",this._addDirtyPeer),this.on("change:multiaddrs",this._addDirtyPeer),this.on("change:pubkey",this._addDirtyPeerKey),this.on("change:metadata",this._addDirtyPeerMetadata);for await(let e of this._datastore.query({prefix:Dq}))await this._processDatastoreEntry(e);ir("PeerStore started")}async stop(){ir("PeerStore is stopping"),this.removeAllListeners(),await this._commitData(),ir("PeerStore stopped")}_addDirtyPeer({peerId:e}){let r=e.toB58String();ir("add dirty peer",r),this._dirtyPeers.add(r),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(i=>{ir.error("error committing data",i)})}_addDirtyPeerKey({peerId:e}){if(e.hasInlinePublicKey())return;let r=e.toB58String();ir("add dirty peer key",r),this._dirtyPeers.add(r),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(i=>{ir.error("error committing data",i)})}_addDirtyPeerMetadata({peerId:e,metadata:r}){let i=e.toB58String();ir("add dirty metadata peer",i),this._dirtyPeers.add(i);let n=this._dirtyMetadata.get(i)||new Set;n.add(r),this._dirtyMetadata.set(i,n),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(s=>{ir.error("error committing data",s)})}async _commitData(){let e=Array.from(this._dirtyPeers);if(!e.length)return;this._dirtyPeers.clear(),ir("create batch commit");let r=this._datastore.batch();for(let i of e){let n=this.keyBook.data.get(i)||xp.createFromCID(i);this._batchAddressBook(n,r),!n.hasInlinePublicKey()&&this._batchKeyBook(n,r),this._batchMetadataBook(n,r),this._batchProtoBook(n,r)}await r.commit(),ir("batch committed")}_batchAddressBook(e,r){let i=e.toString(),n=new Z0(`${Oq}${i}`),s=this.addressBook.data.get(e.toB58String());try{if(!s){r.delete(n);return}let a=YS.encode({addrs:s.addresses.map(o=>({multiaddr:o.multiaddr.bytes,isCertified:o.isCertified})),certifiedRecord:s.record?{seq:s.record.seqNumber,raw:s.record.raw}:void 0}).finish();r.put(n,a)}catch(a){ir.error(a)}}_batchKeyBook(e,r){let i=e.toString(),n=new Z0(`${Lq}${i}`);try{if(!e.pubKey){r.delete(n);return}let s=e.marshalPubKey();r.put(n,s)}catch(s){ir.error(s)}}_batchMetadataBook(e,r){let i=e.toString(),n=this._dirtyMetadata.get(e.toB58String())||[];try{n.forEach(s=>{let a=new Z0(`${qq}${i}/${s}`),o=this.metadataBook.getValue(e,s);o?r.put(a,o):r.delete(a)})}catch(s){ir.error(s)}}_batchProtoBook(e,r){let i=e.toString(),n=new Z0(`${Uq}${i}`),s=this.protoBook.get(e);try{if(!s){r.delete(n);return}let a=WS.encode({protocols:s}).finish();r.put(n,a)}catch(a){ir.error(a)}}async _processDatastoreEntry({key:e,value:r}){try{let i=e.toString().split("/"),n=xp.createFromCID(i[3]),s;switch(i[2]){case"addrs":s=YS.decode(r),this.addressBook._setData(n,{addresses:s.addrs.map(a=>({multiaddr:new Nq(a.multiaddr),isCertified:Boolean(a.isCertified)})),record:s.certifiedRecord?{raw:s.certifiedRecord.raw,seqNumber:s.certifiedRecord.seq}:void 0},{emit:!1});break;case"keys":s=await xp.createFromPubKey(r),this.keyBook._setData(s,s,{emit:!1});break;case"metadata":this.metadataBook._setValue(n,i[4],r,{emit:!1});break;case"protos":s=WS.decode(r),this.protoBook._setData(n,new Set(s.protocols),{emit:!1});break;default:ir("invalid data persisted for: ",e.toString())}}catch(i){ir.error(i)}}};GS.exports=QS});var rA=C((HH,XS)=>{"use strict";var ZS=()=>{},eA=Symbol.for("@libp2p/js-interfaces/topology"),tA=class{constructor({min:e=0,max:r=Infinity,handlers:i={}}){this.min=e,this.max=r,this._onConnect=i.onConnect||ZS,this._onDisconnect=i.onDisconnect||ZS,this.peers=new Set}get[Symbol.toStringTag](){return"Topology"}get[eA](){return!0}static isTopology(e){return Boolean(e&&e[eA])}set registrar(e){this._registrar=e}disconnect(e){this._onDisconnect(e)}};XS.exports=tA});var aA=C((GH,iA)=>{"use strict";var nA=Xe(),Fq=Object.assign(nA("libp2p:registrar"),{error:nA("libp2p:registrar:err")}),Kq=Pe(),{codes:{ERR_INVALID_PARAMETERS:Vq}}=Kt(),zq=rA(),sA=class{constructor({peerStore:e,connectionManager:r}){this.peerStore=e,this.connectionManager=r,this.topologies=new Map,this._handle=void 0,this._onDisconnect=this._onDisconnect.bind(this),this.connectionManager.on("peer:disconnect",this._onDisconnect)}get handle(){return this._handle}set handle(e){this._handle=e}getConnection(e){return this.connectionManager.get(e)}register(e){if(!zq.isTopology(e))throw Fq.error("topology must be an instance of interfaces/topology"),Kq(new Error("topology must be an instance of interfaces/topology"),Vq);let r=(Math.random()*1e9).toString(36)+Date.now();return this.topologies.set(r,e),e.registrar=this,r}unregister(e){return this.topologies.delete(e)}_onDisconnect(e){for(let[,r]of this.topologies)r.disconnect(e.remotePeer)}};iA.exports=sA});var wp=C(($H,Dc)=>{"use strict";var{Buffer:eu}=Hn(),tu=Fs();Dc.exports=async function*(t){for await(let e of t)eu.isBuffer(e)?yield e:tu.isBufferList(e)?yield e.slice():yield eu.from(e)};Dc.exports.toBuffer=Dc.exports;Dc.exports.toList=async function*(t){for await(let e of t)eu.isBuffer(e)?yield new tu().append(e):tu.isBufferList(e)?yield e:yield new tu().append(eu.from(e))}});var cA=C((YH,oA)=>{"use strict";oA.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32}});var dA=C((ru,fA)=>{"use strict";var uA=Xe(),jq=Object.assign(uA("libp2p:ping"),{error:uA("libp2p:ping:err")}),Hq=Pe(),Gq=Yh(),{pipe:lA}=Ui(),{toBuffer:$q}=wp(),{collect:Yq,take:Wq}=G0(),Qq=Mr(),{PROTOCOL:iu,PING_LENGTH:Jq}=cA();async function Xq(t,e){jq("dialing %s to %s",iu,e.toB58String?e.toB58String():e);let r=await t.dial(e),{stream:i}=await r.newStream(iu),n=Date.now(),s=Gq.randomBytes(Jq),[a]=await lA([s],i,c=>Wq(1,c),$q,Yq),o=Date.now();if(!Qq(s,a))throw Hq(new Error("Received wrong ping ack"),"ERR_WRONG_PING_ACK");return o-n}function Zq(t){t.handle(iu,({stream:e})=>lA(e,e))}function eU(t){t.unhandle(iu)}ru=fA.exports=Xq;ru.mount=Zq;ru.unmount=eU});var bA=C((WH,hA)=>{"use strict";var _o=Gi(),pA=_o.Reader,tU=_o.Writer,kt=_o.util,Lc=_o.roots["libp2p-identify"]||(_o.roots["libp2p-identify"]={});Lc.Identify=function(){function t(e){if(this.listenAddrs=[],this.protocols=[],e)for(var r=Object.keys(e),i=0;i>>3){case 5:s.protocolVersion=r.string();break;case 6:s.agentVersion=r.string();break;case 1:s.publicKey=r.bytes();break;case 2:s.listenAddrs&&s.listenAddrs.length||(s.listenAddrs=[]),s.listenAddrs.push(r.bytes());break;case 4:s.observedAddr=r.bytes();break;case 3:s.protocols&&s.protocols.length||(s.protocols=[]),s.protocols.push(r.string());break;case 8:s.signedPeerRecord=r.bytes();break;default:r.skipType(a&7);break}}return s},t.fromObject=function(r){if(r instanceof Lc.Identify)return r;var i=new Lc.Identify;if(r.protocolVersion!=null&&(i.protocolVersion=String(r.protocolVersion)),r.agentVersion!=null&&(i.agentVersion=String(r.agentVersion)),r.publicKey!=null&&(typeof r.publicKey=="string"?kt.base64.decode(r.publicKey,i.publicKey=kt.newBuffer(kt.base64.length(r.publicKey)),0):r.publicKey.length&&(i.publicKey=r.publicKey)),r.listenAddrs){if(!Array.isArray(r.listenAddrs))throw TypeError(".Identify.listenAddrs: array expected");i.listenAddrs=[];for(var n=0;n{"use strict";var gA=Xe(),zi=Object.assign(gA("libp2p:identify"),{error:gA("libp2p:identify:err")}),Ep=Pe(),nu=mc(),{pipe:su}=Ui(),{collect:vA,take:mA,consume:xA}=G0(),Sp=qt(),rU=Ut(),{Multiaddr:Ap}=dr(),{toBuffer:wA}=wp(),qc=bA(),EA=p0(),SA=y0(),{MULTICODEC_IDENTIFY:_p,MULTICODEC_IDENTIFY_PUSH:au,PROTOCOL_VERSION:iU}=zd(),{codes:Cp}=Kt(),Co=class{constructor({libp2p:e}){this._libp2p=e,this.peerStore=e.peerStore,this.addressManager=e.addressManager,this.connectionManager=e.connectionManager,this.peerId=e.peerId,this.handleMessage=this.handleMessage.bind(this),this._host={protocolVersion:iU,...e._options.host},this.peerStore.metadataBook.set(this.peerId,"AgentVersion",Sp(this._host.agentVersion)),this.peerStore.metadataBook.set(this.peerId,"ProtocolVersion",Sp(this._host.protocolVersion)),this.connectionManager.on("peer:connect",r=>{this.identify(r).catch(zi.error)}),this.peerStore.on("change:multiaddrs",({peerId:r})=>{r.toString()===this.peerId.toString()&&this.pushToPeerStore()}),this.peerStore.on("change:protocols",({peerId:r})=>{r.toString()===this.peerId.toString()&&this.pushToPeerStore()})}async push(e){let r=await this.peerStore.addressBook.getRawEnvelope(this.peerId),i=this._libp2p.multiaddrs.map(a=>a.bytes),n=this.peerStore.protoBook.get(this.peerId)||[],s=e.map(async a=>{try{let{stream:o}=await a.newStream(au);await su([qc.Identify.encode({listenAddrs:i,signedPeerRecord:r,protocols:n}).finish()],nu.encode(),o,xA)}catch(o){zi.error("could not push identify update to peer",o)}});return Promise.all(s)}pushToPeerStore(){if(!this._libp2p.isStarted())return;let e=[],r;for(let i of this.peerStore.peers.values())i.protocols.includes(au)&&(r=this.connectionManager.get(i.id))&&e.push(r);this.push(e)}async identify(e){let{stream:r}=await e.newStream(_p),[i]=await su([],r,nu.decode(),mA(1),wA,vA);if(!i)throw Ep(new Error("No data could be retrieved"),Cp.ERR_CONNECTION_ENDED);let n;try{n=qc.Identify.decode(i)}catch(b){throw Ep(b,Cp.ERR_INVALID_MESSAGE)}let{publicKey:s,listenAddrs:a,protocols:o,observedAddr:c,signedPeerRecord:f}=n,u=await rU.createFromPubKey(s);if(e.remotePeer.toB58String()!==u.toB58String())throw Ep(new Error("identified peer does not match the expected peer"),Cp.ERR_INVALID_PEER);let l=Co.getCleanMultiaddr(c);try{let b=await EA.openAndCertify(f,SA.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(b)){this.peerStore.protoBook.set(u,o);return}}catch(b){zi("received invalid envelope, discard it and fallback to listenAddrs is available",b)}try{this.peerStore.addressBook.set(u,a.map(b=>new Ap(b)))}catch(b){zi.error("received invalid addrs",b)}this.peerStore.protoBook.set(u,o),this.peerStore.metadataBook.set(u,"AgentVersion",Sp(n.agentVersion)),zi("received observed address of %s",l)}handleMessage({connection:e,stream:r,protocol:i}){switch(i){case _p:return this._handleIdentify({connection:e,stream:r});case au:return this._handlePush({connection:e,stream:r});default:zi.error("cannot handle unknown protocol %s",i)}}async _handleIdentify({connection:e,stream:r}){let i=new Uint8Array(0);this.peerId.pubKey&&(i=this.peerId.pubKey.bytes);let n=await this.peerStore.addressBook.getRawEnvelope(this.peerId),s=this.peerStore.protoBook.get(this.peerId)||[],a=qc.Identify.encode({protocolVersion:this._host.protocolVersion,agentVersion:this._host.agentVersion,publicKey:i,listenAddrs:this._libp2p.multiaddrs.map(o=>o.bytes),signedPeerRecord:n,observedAddr:e.remoteAddr.bytes,protocols:s}).finish();try{await su([a],nu.encode(),r,xA)}catch(o){zi.error("could not respond to identify request",o)}}async _handlePush({connection:e,stream:r}){let i;try{let[s]=await su([],r,nu.decode(),mA(1),wA,vA);i=qc.Identify.decode(s)}catch(s){return zi.error("received invalid message",s)}let n=e.remotePeer;try{let s=await EA.openAndCertify(i.signedPeerRecord,SA.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(s)){this.peerStore.protoBook.set(n,i.protocols);return}}catch(s){zi("received invalid envelope, discard it and fallback to listenAddrs is available",s)}try{this.peerStore.addressBook.set(n,i.listenAddrs.map(s=>new Ap(s)))}catch(s){zi.error("received invalid addrs",s)}this.peerStore.protoBook.set(n,i.protocols)}static getCleanMultiaddr(e){if(e&&e.length>0)try{return new Ap(e)}catch(r){return null}return null}},nU={IDENTIFY:_p,IDENTIFY_PUSH:au};Co.multicodecs=nU;Co.Messsage=qc;yA.exports=Co});var _A=C(()=>{});var IA=C(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.promisify=ou;var CA="__ES6-PROMISIFY--CUSTOM-ARGUMENTS__";function ou(t){if(typeof t!="function")throw new TypeError("Argument to promisify must be a function");var e=t[CA],r=ou.Promise||Promise;if(typeof r!="function")throw new Error("No Promise implementation found; do you need a polyfill?");return function(){for(var i=this,n=arguments.length,s=new Array(n),a=0;a1?l-1:0),p=1;p{function sU(){return typeof window!="undefined"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process!="undefined"&&typeof process.versions=="object"&&!!process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0}TA.exports=sU});var BA=C((tG,RA)=>{"use strict";var aU=kA(),cu=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,Uc=aU(),oU=cu&&!Uc,cU=Uc&&!cu,fU=Uc&&cu,uU=typeof process!="undefined"&&typeof process.release!="undefined"&&process.release.name==="node"&&!Uc,lU=typeof importScripts=="function"&&typeof self!="undefined"&&typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope,dU=typeof process!="undefined"&&typeof process.env!="undefined"&&!1;RA.exports={isTest:dU,isElectron:Uc,isElectronMain:cU,isElectronRenderer:fU,isNode:uU,isBrowser:oU,isWebWorker:lU,isEnvWithDom:cu}});var NA=C((rG,PA)=>{function Xr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||Infinity,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}PA.exports=Xr;Xr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Xr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Xr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var i=this,n=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},r);return this._options.unref&&n.unref(),!0};Xr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Xr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Xr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Xr.prototype.start=Xr.prototype.try;Xr.prototype.errors=function(){return this._errors};Xr.prototype.attempts=function(){return this._attempts};Xr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,i=0;i=r&&(e=n,r=a)}return e}});var MA=C(Ws=>{var hU=NA();Ws.operation=function(t){var e=Ws.timeouts(t);return new hU(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Ws.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:Infinity,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],n=0;n{OA.exports=MA()});var qA=C((sG,fu)=>{"use strict";var pU=DA(),bU=["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Network request failed"],Tp=class extends Error{constructor(e){super();e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},yU=(t,e,r)=>{let i=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=i,t},gU=t=>bU.includes(t),LA=(t,e)=>new Promise((r,i)=>{e={onFailedAttempt:()=>{},retries:10,...e};let n=pU.operation(e);n.attempt(async s=>{try{r(await t(s))}catch(a){if(!(a instanceof Error)){i(new TypeError(`Non-error was thrown: "${a}". You should only throw errors.`));return}if(a instanceof Tp)n.stop(),i(a.originalError);else if(a instanceof TypeError&&!gU(a.message))n.stop(),i(a);else{yU(a,s,e);try{await e.onFailedAttempt(a)}catch(o){i(o);return}n.retry(a)||i(n.mainError())}}})});fu.exports=LA;fu.exports.default=LA;fu.exports.AbortError=Tp});var FA=C((aG,UA)=>{"use strict";function vU(t){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(t)||/^::1$/.test(t)}UA.exports=vU});var VA=C((oG,KA)=>{"use strict";var mU=FA();function xU(t){let{address:e}=t.nodeAddress();return mU(e)}KA.exports=xU});var YA=C((cG,zA)=>{"use strict";var wU=_A(),jA=Xe(),{promisify:kp}=IA(),{Multiaddr:EU}=dr(),Io=Object.assign(jA("libp2p:nat"),{error:jA("libp2p:nat:err")}),{isBrowser:HA}=BA(),Rp=qA(),SU=jd(),GA=Vd(),AU=Pe(),{codes:{ERR_INVALID_PARAMETERS:_U}}=Kt(),CU=VA(),Bp=7200;function IU(t=1024,e=65535){return Math.floor(Math.random()*(e-t+1)+t)}var $A=class{constructor({peerId:e,addressManager:r,transportManager:i,...n}){if(this._peerId=e,this._addressManager=r,this._transportManager=i,this._enabled=n.enabled,this._externalIp=n.externalIp,this._options={description:n.description||`${GA.name}@${GA.version} ${this._peerId}`,ttl:n.ttl||Bp,autoUpdate:n.keepAlive||!0,gateway:n.gateway,enablePMP:Boolean(n.pmp&&n.pmp.enabled)},this._options.ttl{Io.error(e)})}async _start(){let e=this._transportManager.getAddrs();for(let r of e){let{family:i,host:n,port:s,transport:a}=r.toOptions();if(!r.isThinWaistAddress()||a!=="tcp"||CU(r)||i!==4)continue;let o=this._getClient(),c=this._externalIp||await o.externalIp();if(SU(c))throw new Error(`${c} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`);let f=IU();Io(`opening uPnP connection from ${c}:${f} to ${n}:${s}`),await o.map({publicPort:f,privatePort:s,protocol:a.toUpperCase()}),this._addressManager.addObservedAddr(EU.fromNodeAddress({family:4,address:c,port:f},a))}}_getClient(){if(this._client)return this._client;let e=new wU(this._options),r=kp(e.map.bind(e)),i=kp(e.destroy.bind(e)),n=kp(e.externalIp.bind(e));return this._client={map:(...s)=>Rp(()=>r(...s),{onFailedAttempt:Io.error,unref:!0}),destroy:(...s)=>Rp(()=>i(...s),{onFailedAttempt:Io.error,unref:!0}),externalIp:(...s)=>Rp(()=>n(...s),{onFailedAttempt:Io.error,unref:!0})},this._client}async stop(){if(!(HA||!this._client))try{await this._client.destroy(),this._client=null}catch(e){Io.error(e)}}};zA.exports=$A});var WU=C((fG,WA)=>{"use strict";var QA=Xe(),Nr=Object.assign(QA("libp2p"),{error:QA("libp2p:err")}),{EventEmitter:TU}=ji(),Pp=Pe(),kU=Ut(),{Multiaddr:RU}=dr(),BU=$3(),PU=Q3(),Np=Ld(),{validate:NU}=lx(),{codes:uu,messages:MU}=Kt(),OU=px(),DU=Rx(),JA=y8(),LU=d5(),qU=Y5(),XA=bE(),UU=PE(),FU=Zd(),KU=uS(),VU=vp(),zU=US(),jU=JS(),HU=aA(),lu=dA(),ZA=AA(),GU=ZA.multicodecs,$U=YA(),{updateSelfPeerRecord:YU}=Jd(),Fc=class extends TU{static async create(e){if(e.peerId)return new Fc(e);let r=await kU.create();return e.peerId=r,new Fc(e)}constructor(e){super();if(this._options=NU(e),this.peerId=this._options.peerId,this.datastore=this._options.datastore,this.peerStore=this.datastore&&this._options.peerStore.persistence?new jU({peerId:this.peerId,datastore:this.datastore,...this._options.peerStore}):new VU({peerId:this.peerId}),this.addresses=this._options.addresses,this.addressManager=new OU(this.peerId,this._options.addresses),this.addressManager.on("change:addresses",()=>{YU(this).catch(i=>{Nr.error("Error updating self peer record",i)})}),this._modules=this._options.modules,this._config=this._options.config,this._transport=[],this._discovery=new Map,this.connectionManager=new DU(this,{autoDial:this._config.peerDiscovery.autoDial,...this._options.connectionManager}),this._options.metrics.enabled&&(this.metrics=new UU({...this._options.metrics,connectionManager:this.connectionManager})),this._options.keychain&&this._options.keychain.datastore){Nr("creating keychain");let i=XA.generateOptions();this.keychain=new XA(this._options.keychain.datastore,{...i,...this._options.keychain}),Nr("keychain constructed")}if(this.upgrader=new KU({localPeer:this.peerId,metrics:this.metrics,onConnection:i=>this.connectionManager.onConnect(i),onConnectionEnd:i=>this.connectionManager.onDisconnect(i)}),this.transportManager=new FU({libp2p:this,upgrader:this.upgrader,faultTolerance:this._options.transportManager.faultTolerance}),this.natManager=new $U({peerId:this.peerId,addressManager:this.addressManager,transportManager:this.transportManager,...this._options.config.nat}),this.registrar=new HU({peerStore:this.peerStore,connectionManager:this.connectionManager}),this.handle=this.handle.bind(this),this.registrar.handle=this.handle,!this._modules.connEncryption||!this._modules.connEncryption.length)throw Pp(new Error(MU.CONN_ENCRYPTION_REQUIRED),uu.CONN_ENCRYPTION_REQUIRED);if(this._modules.connEncryption.forEach(i=>{this.upgrader.cryptos.set(i.protocol,i)}),this.dialer=new qU({transportManager:this.transportManager,peerStore:this.peerStore,...this._options.dialer}),this._modules.transport.forEach(i=>{let n=i.prototype[Symbol.toStringTag],s=this._config.transport[n];this.transportManager.add(n,i,s)}),this._config.relay.enabled&&(this.transportManager.add(JA.prototype[Symbol.toStringTag],JA),this.relay=new LU(this)),this._modules.streamMuxer&&(this._modules.streamMuxer.forEach(n=>{this.upgrader.muxers.set(n.multicodec,n)}),this.identifyService=new ZA({libp2p:this}),this.handle(Object.values(GU),this.identifyService.handleMessage)),this._modules.connProtector)this.upgrader.protector=this._modules.connProtector;else if(globalThis.process!==void 0&&globalThis.process.env&&globalThis.process.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._modules.dht){let i=this._modules.dht;this._dht=new i({libp2p:this,dialer:this.dialer,peerId:this.peerId,peerStore:this.peerStore,registrar:this.registrar,datastore:this.datastore,...this._config.dht})}if(this._modules.pubsub){let i=this._modules.pubsub;this.pubsub=zU(i,this,this._config.pubsub)}this.peerRouting=new BU(this),this.contentRouting=new PU(this),lu.mount(this),this._onDiscoveryPeer=this._onDiscoveryPeer.bind(this)}emit(e,...r){return e==="error"&&!this._events.error?(Nr.error(r),!1):super.emit(e,...r)}async start(){Nr("libp2p is starting");try{await this._onStarting(),await this._onDidStart(),Nr("libp2p has started")}catch(e){throw this.emit("error",e),Nr.error("An error occurred starting libp2p",e),await this.stop(),e}}async stop(){Nr("libp2p is stopping");try{this._isStarted=!1,this.relay&&this.relay.stop(),this.peerRouting.stop();for(let e of this._discovery.values())e.removeListener("peer",this._onDiscoveryPeer);await Promise.all(Array.from(this._discovery.values(),e=>e.stop())),this._discovery=new Map,await this.peerStore.stop(),await this.connectionManager.stop(),await Promise.all([this.pubsub&&this.pubsub.stop(),this._dht&&this._dht.stop(),this.metrics&&this.metrics.stop()]),await this.natManager.stop(),await this.transportManager.close(),lu.unmount(this),this.dialer.destroy()}catch(e){e&&(Nr.error(e),this.emit("error",e))}Nr("libp2p has stopped")}async loadKeychain(){if(!!this.keychain)try{await this.keychain.findKeyByName("self")}catch(e){await this.keychain.importPeer("self",this.peerId)}}isStarted(){return this._isStarted}get connections(){return this.connectionManager.connections}dial(e,r){return this._dial(e,r)}async dialProtocol(e,r,i){if(!r||!r.length)throw Pp(new Error("no protocols were provided to open a stream"),uu.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this._dial(e,i)).newStream(r)}async _dial(e,r){let{id:i,multiaddrs:n}=Np(e);if(i.equals(this.peerId))throw Pp(new Error("Cannot dial self"),uu.ERR_DIALED_SELF);let s=this.connectionManager.get(i);return s?n&&this.peerStore.addressBook.add(i,n):s=await this.dialer.connectToPeer(e,r),s}get multiaddrs(){let e=this.addressManager.getAnnounceAddrs().map(n=>n.toString());e.length||(e=this.transportManager.getAddrs().map(n=>n.toString())),e=e.concat(this.addressManager.getObservedAddrs().map(n=>n.toString()));let r=this._options.addresses.announceFilter,i=new Set(e);return r(Array.from(i).map(n=>new RU(n)))}async hangUp(e){let{id:r}=Np(e),i=this.connectionManager.connections.get(r.toB58String());!i||await Promise.all(i.map(n=>n.close()))}ping(e){let{id:r,multiaddrs:i}=Np(e);return i?lu(this,i[0]):lu(this,r)}handle(e,r){e=Array.isArray(e)?e:[e],e.forEach(i=>{this.upgrader.protocols.set(i,r)}),this.peerStore.protoBook.add(this.peerId,e)}unhandle(e){e=Array.isArray(e)?e:[e],e.forEach(r=>{this.upgrader.protocols.delete(r)}),this.peerStore.protoBook.remove(this.peerId,e)}async _onStarting(){let e=this.addressManager.getListenAddrs();await this.transportManager.listen(e),this.natManager.start(),await this.peerStore.start(),this._config.pubsub.enabled&&this.pubsub&&this.pubsub.start(),this._config.dht.enabled&&(this._dht&&this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start()}async _onDidStart(){this._isStarted=!0,this.peerStore.on("peer",e=>{this.emit("peer:discovery",e),this._maybeConnect(e)});for(let e of this.peerStore.peers.values())this.emit("peer:discovery",e.id);this.connectionManager.start(),await this._setupPeerDiscovery(),this.relay&&this.relay.start(),this.peerRouting.start()}_onDiscoveryPeer(e){if(e.id.toB58String()===this.peerId.toB58String()){Nr.error(new Error(uu.ERR_DISCOVERED_SELF));return}e.multiaddrs&&this.peerStore.addressBook.add(e.id,e.multiaddrs),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols)}async _maybeConnect(e){if(this._config.peerDiscovery.autoDial===!0&&!this.connectionManager.get(e)&&(this._options.connectionManager.minConnections||0)>this.connectionManager.size){Nr("connecting to discovered peer %s",e.toB58String());try{await this.dialer.connectToPeer(e)}catch(i){Nr.error(`could not connect to discovered peer ${e.toB58String()} with ${i}`)}}}async _setupPeerDiscovery(){let e=r=>{let i={enabled:!0};if(r.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[r.tag]&&(i={...i,...this._config.peerDiscovery[r.tag]}),i.enabled&&!this._discovery.has(r.tag)){let n;typeof r=="function"?n=new r(Object.assign({},i,{peerId:this.peerId,libp2p:this})):n=r,n.on("peer",this._onDiscoveryPeer),this._discovery.set(r.tag,n)}};for(let r of this._modules.peerDiscovery||[])e(r);for(let r of this.transportManager.getTransports())r.discovery&&e(r.discovery);await Promise.all(Array.from(this._discovery.values(),r=>r.start()))}};WA.exports=Fc});return WU();})(); +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ +return Libp2p})); diff --git a/dist/src/address-manager/index.d.ts b/dist/src/address-manager/index.d.ts index b4768452..cc010a2e 100644 --- a/dist/src/address-manager/index.d.ts +++ b/dist/src/address-manager/index.d.ts @@ -1,5 +1,4 @@ export = AddressManager; -declare const AddressManager_base: import("../types").EventEmitterFactory; /** * @typedef {Object} AddressManagerOptions * @property {string[]} [listen = []] - list of multiaddrs string representation to listen. @@ -8,7 +7,7 @@ declare const AddressManager_base: import("../types").EventEmitterFactory; /** * @fires AddressManager#change:addresses Emitted when a addresses change. */ -declare class AddressManager extends AddressManager_base { +declare class AddressManager extends EventEmitter { /** * Responsible for managing the peer addresses. * Peers can specify their listen and announce addresses. @@ -55,11 +54,11 @@ declare class AddressManager extends AddressManager_base { addObservedAddr(addr: string | Multiaddr): void; } declare namespace AddressManager { - export { Events, AddressManagerOptions }; + export { AddressManagerOptions }; } +import { EventEmitter } from "events"; import PeerId = require("peer-id"); import { Multiaddr } from "multiaddr"; -type Events = import('../types').EventEmitterFactory; type AddressManagerOptions = { /** * - list of multiaddrs string representation to listen. diff --git a/dist/src/address-manager/index.d.ts.map b/dist/src/address-manager/index.d.ts.map index 345ddb85..c435d4a5 100644 --- a/dist/src/address-manager/index.d.ts.map +++ b/dist/src/address-manager/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/address-manager/index.js"],"names":[],"mappings":";;AAQA;;;;GAIG;AAEH;;GAEG;AACH;IACE;;;;;;;;;;;OAWG;IACH,oBALW,MAAM;;;mBAYhB;IAJC,eAAoB;IACpB,oBAAsD;IACtD,sBAA0D;IAC1D,mBAAyB;IAG3B;;;;OAIG;IACH,kBAFa,SAAS,EAAE,CAIvB;IAED;;;;OAIG;IACH,oBAFa,SAAS,EAAE,CAIvB;IAED;;;;OAIG;IACH,oBAFa,MAAM,SAAS,CAAC,CAI5B;IAED;;;;OAIG;IACH,sBAFW,MAAM,GAAG,SAAS,QAyB5B;CACF;;;;;;cA7Fa,OAAO,UAAU,EAAE,mBAAmB"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/address-manager/index.js"],"names":[],"mappings":";AAMA;;;;GAIG;AAEH;;GAEG;AACH;IACE;;;;;;;;;;;OAWG;IACH,oBALW,MAAM;;;mBAYhB;IAJC,eAAoB;IACpB,oBAAsD;IACtD,sBAA0D;IAC1D,mBAAyB;IAG3B;;;;OAIG;IACH,kBAFa,SAAS,EAAE,CAIvB;IAED;;;;OAIG;IACH,oBAFa,SAAS,EAAE,CAIvB;IAED;;;;OAIG;IACH,oBAFa,MAAM,SAAS,CAAC,CAI5B;IAED;;;;OAIG;IACH,sBAFW,MAAM,GAAG,SAAS,QAyB5B;CACF"} \ No newline at end of file diff --git a/dist/src/circuit/listener.d.ts b/dist/src/circuit/listener.d.ts index 82dd0564..85e0b4c7 100644 --- a/dist/src/circuit/listener.d.ts +++ b/dist/src/circuit/listener.d.ts @@ -1,5 +1,4 @@ declare function _exports(libp2p: import('../')): Listener; export = _exports; -export type Events = import('../types').EventEmitterFactory; export type Listener = import('libp2p-interfaces/src/transport/types').Listener; //# sourceMappingURL=listener.d.ts.map \ No newline at end of file diff --git a/dist/src/circuit/listener.d.ts.map b/dist/src/circuit/listener.d.ts.map index 57ff4328..39cc6c19 100644 --- a/dist/src/circuit/listener.d.ts.map +++ b/dist/src/circuit/listener.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../src/circuit/listener.js"],"names":[],"mappings":"AAeiB,kCAHN,OAAO,KAAK,CAAC,GACX,QAAQ,CA+DpB;;qBA1Ea,OAAO,UAAU,EAAE,mBAAmB;uBAMvC,OAAO,uCAAuC,EAAE,QAAQ"} \ No newline at end of file +{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../src/circuit/listener.js"],"names":[],"mappings":"AAaiB,kCAHN,OAAO,KAAK,CAAC,GACX,QAAQ,CA+DpB;;uBApEY,OAAO,uCAAuC,EAAE,QAAQ"} \ No newline at end of file diff --git a/dist/src/connection-manager/index.d.ts b/dist/src/connection-manager/index.d.ts index e8c53c20..bfed22c9 100644 --- a/dist/src/connection-manager/index.d.ts +++ b/dist/src/connection-manager/index.d.ts @@ -1,5 +1,4 @@ export = ConnectionManager; -declare const ConnectionManager_base: import("../types").EventEmitterFactory; /** * @typedef {import('../')} Libp2p * @typedef {import('libp2p-interfaces/src/connection').Connection} Connection @@ -23,7 +22,7 @@ declare const ConnectionManager_base: import("../types").EventEmitterFactory; * @fires ConnectionManager#peer:connect Emitted when a new peer is connected. * @fires ConnectionManager#peer:disconnect Emitted when a peer is disconnected. */ -declare class ConnectionManager extends ConnectionManager_base { +declare class ConnectionManager extends EventEmitter { /** * Responsible for managing known connections. * @@ -149,8 +148,9 @@ declare class ConnectionManager extends ConnectionManager_base { private _maybeDisconnectOne; } declare namespace ConnectionManager { - export { Events, Libp2p, Connection, ConnectionManagerOptions }; + export { Libp2p, Connection, ConnectionManagerOptions }; } +import { EventEmitter } from "events"; type Connection = import("libp2p-interfaces/src/connection/connection"); import LatencyMonitor = require("./latency-monitor"); import PeerId = require("peer-id"); @@ -201,5 +201,4 @@ type ConnectionManagerOptions = { */ autoDialInterval?: number | undefined; }; -type Events = import('../types').EventEmitterFactory; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/connection-manager/index.d.ts.map b/dist/src/connection-manager/index.d.ts.map index 2f21551d..4ab877bd 100644 --- a/dist/src/connection-manager/index.d.ts.map +++ b/dist/src/connection-manager/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.js"],"names":[],"mappings":";;AAoCA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,oBAHW,MAAM,YACN,wBAAwB,EAkClC;IA7BC,uBAAqB;IACrB,gBAA0C;IAE1C,cAAqF;IAOrF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,MAAM,CAAC,CAED;IAE5B;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,CAEP;IAE5B,kBAAqB;IACrB,YAAkB;IAClB,sBAA4B;IAoF9B;;;;;OAKG;IACH,sBAcC;IA8GD;;;;;;;OAOG;IACH,kBAqCC;IA9PD;;OAEG;IACH,mBAGC;IAED;;;OAGG;IACH,cAiBC;IAXC,4CAGE;IAkKJ;;;;;OAKG;IACH,0BAEC;IAhKD;;;;OAIG;IACH,sBAQC;IAED;;;;OAIG;IACH,wBAWC;IAED;;;;;;;OAOG;IACH,qBAJW,MAAM,SACN,MAAM,GACJ,IAAI,CAOhB;IAwBD;;;;;OAKG;IACH,sBAHW,UAAU,GACR,IAAI,CAqBhB;IAED;;;;;OAKG;IACH,yBAHW,UAAU,GACR,IAAI,CAchB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,UAAU,GAAC,IAAI,CAQ3B;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,UAAU,EAAE,CAexB;IAYD;;;;;;OAMG;IACH,uBAOC;IAiDD;;;;;OAKG;IACH,4BAiBC;CACF;;;;;;;cA1VY,OAAO,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAxBZ,OAAO,UAAU,EAAE,mBAAmB"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.js"],"names":[],"mappings":";AAkCA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,oBAHW,MAAM,YACN,wBAAwB,EAkClC;IA7BC,uBAAqB;IACrB,gBAA0C;IAE1C,cAAqF;IAOrF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,MAAM,CAAC,CAED;IAE5B;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,CAEP;IAE5B,kBAAqB;IACrB,YAAkB;IAClB,sBAA4B;IAoF9B;;;;;OAKG;IACH,sBAcC;IA8GD;;;;;;;OAOG;IACH,kBAqCC;IA9PD;;OAEG;IACH,mBAGC;IAED;;;OAGG;IACH,cAiBC;IAXC,4CAGE;IAkKJ;;;;;OAKG;IACH,0BAEC;IAhKD;;;;OAIG;IACH,sBAQC;IAED;;;;OAIG;IACH,wBAWC;IAED;;;;;;;OAOG;IACH,qBAJW,MAAM,SACN,MAAM,GACJ,IAAI,CAOhB;IAwBD;;;;;OAKG;IACH,sBAHW,UAAU,GACR,IAAI,CAqBhB;IAED;;;;;OAKG;IACH,yBAHW,UAAU,GACR,IAAI,CAchB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,UAAU,GAAC,IAAI,CAQ3B;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,UAAU,EAAE,CAexB;IAYD;;;;;;OAMG;IACH,uBAOC;IAiDD;;;;;OAKG;IACH,4BAiBC;CACF;;;;;;;;cA1VY,OAAO,KAAK,CAAC"} \ No newline at end of file diff --git a/dist/src/connection-manager/latency-monitor.d.ts b/dist/src/connection-manager/latency-monitor.d.ts index 0cd6d29e..52c2e0a5 100644 --- a/dist/src/connection-manager/latency-monitor.d.ts +++ b/dist/src/connection-manager/latency-monitor.d.ts @@ -1,5 +1,4 @@ export = LatencyMonitor; -declare const LatencyMonitor_base: import("../types").EventEmitterFactory; /** * @typedef {Object} SummaryObject * @property {number} events How many events were called @@ -32,7 +31,7 @@ declare const LatencyMonitor_base: import("../types").EventEmitterFactory; * const monitor = new LatencyMonitor({latencyCheckIntervalMs: 1000, dataEmitIntervalMs: 60000, asyncTestFn:ping}); * monitor.on('data', (summary) => console.log('Ping Pong Latency: %O', summary)); */ -declare class LatencyMonitor extends LatencyMonitor_base { +declare class LatencyMonitor extends EventEmitter { /** * @class * @param {LatencyMonitorOptions} [options] @@ -94,8 +93,9 @@ declare class LatencyMonitor extends LatencyMonitor_base { }; } declare namespace LatencyMonitor { - export { Events, SummaryObject, LatencyMonitorOptions }; + export { SummaryObject, LatencyMonitorOptions }; } +import { EventEmitter } from "events"; type SummaryObject = { /** * How many events were called @@ -136,5 +136,4 @@ type LatencyMonitorOptions = { */ latencyRandomPercentage?: number | undefined; }; -type Events = import('../types').EventEmitterFactory; //# sourceMappingURL=latency-monitor.d.ts.map \ No newline at end of file diff --git a/dist/src/connection-manager/latency-monitor.d.ts.map b/dist/src/connection-manager/latency-monitor.d.ts.map index d14e80a9..1ab65979 100644 --- a/dist/src/connection-manager/latency-monitor.d.ts.map +++ b/dist/src/connection-manager/latency-monitor.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"latency-monitor.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/latency-monitor.js"],"names":[],"mappings":";;AAaA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE;;;OAGG;IACH,sIA+DC;IA1DC,+BAA2D;IAC3D,gCAA4D;IAC5D,6BAAoG;IACpG,6BAAyD;IAEzD,uCAEkC;IASlC,kCAA8B;IAqB9B;;;;;;MAA2C;IAuB7C;;;;OAIG;IACH,qBAYC;IALG,4CAAsF;IAO1F;;;;OAIG;IACH,oBASC;IANG,4CAAgC;IAQpC;;;;OAIG;IACH,qBAKC;IAED;;;;;OAKG;IACH,cAFa,aAAa,CAmBzB;IAED;;;;;OAKG;IACH,sBAgDC;IAED;;;;;;MAQC;CACF;;;;;;;;YA9Oa,MAAM;;;;WACN,MAAM;;;;WACN,MAAM;;;;WACN,MAAM;;;;cACN,MAAM;;;;;;;;;;;;;;;;;;;;cAZN,OAAO,UAAU,EAAE,mBAAmB"} \ No newline at end of file +{"version":3,"file":"latency-monitor.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/latency-monitor.js"],"names":[],"mappings":";AAWA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IACE;;;OAGG;IACH,sIA+DC;IA1DC,+BAA2D;IAC3D,gCAA4D;IAC5D,6BAAoG;IACpG,6BAAyD;IAEzD,uCAEkC;IASlC,kCAA8B;IAqB9B;;;;;;MAA2C;IAuB7C;;;;OAIG;IACH,qBAYC;IALG,4CAAsF;IAO1F;;;;OAIG;IACH,oBASC;IANG,4CAAgC;IAQpC;;;;OAIG;IACH,qBAKC;IAED;;;;;OAKG;IACH,cAFa,aAAa,CAmBzB;IAED;;;;;OAKG;IACH,sBAgDC;IAED;;;;;;MAQC;CACF;;;;;;;;;YA9Oa,MAAM;;;;WACN,MAAM;;;;WACN,MAAM;;;;WACN,MAAM;;;;cACN,MAAM"} \ No newline at end of file diff --git a/dist/src/connection-manager/visibility-change-emitter.d.ts b/dist/src/connection-manager/visibility-change-emitter.d.ts index cd62b584..39db9574 100644 --- a/dist/src/connection-manager/visibility-change-emitter.d.ts +++ b/dist/src/connection-manager/visibility-change-emitter.d.ts @@ -1,5 +1,4 @@ export = VisibilityChangeEmitter; -declare const VisibilityChangeEmitter_base: import("../types").EventEmitterFactory; /** * Listen to page visibility change events (i.e. when the page is focused / blurred) by an event emitter. * @@ -22,7 +21,13 @@ declare const VisibilityChangeEmitter_base: import("../types").EventEmitterFacto * // To access the visibility state directly, call: * console.log('Am I focused now? ' + myVisibilityEmitter.isVisible()); */ -declare class VisibilityChangeEmitter extends VisibilityChangeEmitter_base { +declare class VisibilityChangeEmitter extends EventEmitter { + /** + * Creates a VisibilityChangeEmitter + * + * @class + */ + constructor(); /** * document.hidden and document.visibilityChange are the two variables we need to check for; * Since these variables are named differently in different browsers, this function sets @@ -58,8 +63,5 @@ declare class VisibilityChangeEmitter extends VisibilityChangeEmitter_base { */ private _handleVisibilityChange; } -declare namespace VisibilityChangeEmitter { - export { Events }; -} -type Events = import('../types').EventEmitterFactory; +import { EventEmitter } from "events"; //# sourceMappingURL=visibility-change-emitter.d.ts.map \ No newline at end of file diff --git a/dist/src/connection-manager/visibility-change-emitter.d.ts.map b/dist/src/connection-manager/visibility-change-emitter.d.ts.map index 146dffed..f1573180 100644 --- a/dist/src/connection-manager/visibility-change-emitter.d.ts.map +++ b/dist/src/connection-manager/visibility-change-emitter.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"visibility-change-emitter.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/visibility-change-emitter.js"],"names":[],"mappings":";;AAcA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAgBE;;;;;;;;OAQG;IACH,sCAkBC;IAFC,4BAAqB;IACrB,sCAAyC;IAG3C;;;;;OAKG;IACH,qCAQC;IAED;;;;;OAKG;IACH,aAFa,OAAO,GAAG,IAAI,CAQ1B;IAED;;;;;;OAMG;IACH,gCAKC;CACF;;;;cApHa,OAAO,UAAU,EAAE,mBAAmB"} \ No newline at end of file +{"version":3,"file":"visibility-change-emitter.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/visibility-change-emitter.js"],"names":[],"mappings":";AAYA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IACE;;;;OAIG;IACH,cAQC;IAED;;;;;;;;OAQG;IACH,sCAkBC;IAFC,4BAAqB;IACrB,sCAAyC;IAG3C;;;;;OAKG;IACH,qCAQC;IAED;;;;;OAKG;IACH,aAFa,OAAO,GAAG,IAAI,CAQ1B;IAED;;;;;;OAMG;IACH,gCAKC;CACF"} \ No newline at end of file diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts index 169afab3..e80b8096 100644 --- a/dist/src/index.d.ts +++ b/dist/src/index.d.ts @@ -1,5 +1,4 @@ export = Libp2p; -declare const Libp2p_base: import("./types").EventEmitterFactory; /** * @typedef {import('libp2p-interfaces/src/connection').Connection} Connection * @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream @@ -95,7 +94,7 @@ declare const Libp2p_base: import("./types").EventEmitterFactory; * @fires Libp2p#error Emitted when an error occurs * @fires Libp2p#peer:discovery Emitted when a peer is discovered */ -declare class Libp2p extends Libp2p_base { +declare class Libp2p extends EventEmitter { /** * Like `new Libp2p(options)` except it will create a `PeerId` * instance if one is not provided in options. @@ -408,8 +407,9 @@ declare class Libp2p extends Libp2p_base { private _setupPeerDiscovery; } declare namespace Libp2p { - export { Events, Connection, MuxedStream, TransportFactory, MuxerFactory, ContentRoutingModule, PeerDiscoveryFactory, PeerRoutingModule, Crypto, Pubsub, PubsubOptions, Datastore, Protector, HandlerProps, RandomWalkOptions, DhtOptions, KeychainOptions, PeerStoreOptions, PubsubLocalOptions, MetricsOptions, RelayOptions, Libp2pConfig, Libp2pModules, Libp2pOptions, constructorOptions, CreateOptions }; + export { Connection, MuxedStream, TransportFactory, MuxerFactory, ContentRoutingModule, PeerDiscoveryFactory, PeerRoutingModule, Crypto, Pubsub, PubsubOptions, Datastore, Protector, HandlerProps, RandomWalkOptions, DhtOptions, KeychainOptions, PeerStoreOptions, PubsubLocalOptions, MetricsOptions, RelayOptions, Libp2pConfig, Libp2pModules, Libp2pOptions, constructorOptions, CreateOptions }; } +import { EventEmitter } from "events"; import { Multiaddr } from "multiaddr"; type Libp2pOptions = { /** @@ -486,7 +486,6 @@ type Connection = import("libp2p-interfaces/src/connection/connection"); type CreateOptions = { peerId?: PeerId | undefined; }; -type Events = import('./types').EventEmitterFactory; type MuxedStream = import('libp2p-interfaces/src/stream-muxer/types').MuxedStream; type TransportFactory = import('libp2p-interfaces/src/transport/types').TransportFactory; type MuxerFactory = import('libp2p-interfaces/src/stream-muxer/types').MuxerFactory; diff --git a/dist/src/index.d.ts.map b/dist/src/index.d.ts.map index d0ccdb0f..2d1353ea 100644 --- a/dist/src/index.d.ts.map +++ b/dist/src/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;AAuCA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH;IACE;;;;;;OAMG;IACH,uBAHW,aAAa,GAAG,aAAa,GAC3B,QAAQ,MAAM,CAAC,CAa3B;IAED;;;;;OAKG;IACH,sBAFW,aAAa,GAAG,kBAAkB,EA+K5C;IAzKC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAAwC;IAExC,qBAAqB;IACrB,QADW,MAAM,CACiB;IAClC,8EAAwC;IAExC,qBAM0C;IAG1C;;;;;6CAAwC;IACxC,+BAA8E;IAS9E,wBAAqC;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAAmC;IACnC,kBAAoB;IACpB,0BAA2B;IAG3B,qCAGE;IAIA,6BAGE;IASF,+BAGE;IAMJ,mBAKE;IAGF,mCAIE;IAGF,uBAME;IAGF,qBAGE;IAwUJ;;;;;OAKG;IACH,kBAHW,MAAM,EAAE,GAAC,MAAM,mBACP,YAAY,KAAK,IAAI,QAUvC;IAxUC,eAIE;IAWA,yBAA4B;IAW5B,6CAA4D;IAe5D,UAQE;IAOF,qBAAqB;IACrB,+CAA8D;IAKhE,yBAAwC;IACxC,+BAA8C;IAqVhD;;;;;;OAMG;IACH,yBAQC;IAzUD;;;;OAIG;IACH,SAFa,QAAQ,IAAI,CAAC,CAezB;IAED;;;;;OAKG;IACH,QAFa,QAAQ,IAAI,CAAC,CAwCzB;IAlCG,gCAAuB;IAoC3B;;;;;;OAMG;IACH,gBAFa,QAAQ,IAAI,CAAC,CAYzB;IAED,iCAEC;IAED;;;;;OAKG;IACH,wFAEC;IAED;;;;;;;;OAQG;IACH,WALW,MAAM,GAAC,SAAS,GAAC,MAAM;;oBAGrB,QAAQ,UAAU,CAAC,CAI/B;IAED;;;;;;;;;;OAUG;IACH,mBALW,MAAM,GAAC,SAAS,GAAC,MAAM,aACvB,MAAM,EAAE,GAAC,MAAM;;;;;OAWzB;IAED;;;;;OAKG;IACH,YAJW,MAAM,GAAC,SAAS,GAAC,MAAM,iCAErB,QAAQ,UAAU,CAAC,CAkB/B;IAED;;;;;;;;;OASG;IACH,8BAiBC;IAED;;;;;OAKG;IACH,aAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,IAAI,CAAC,CAgBzB;IAED;;;;;OAKG;IACH,WAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,MAAM,CAAC,CAW3B;IAkBD;;;;;OAKG;IACH,oBAFW,MAAM,EAAE,GAAC,MAAM,QAUzB;IAED,6BA0BC;IAED;;;;OAIG;IACH,oBAuBC;IAmBD;;;;;;;OAOG;IACH,sBAaC;IAED;;;;;OAKG;IACH,4BAkDC;CACF;;;;;;;;;aA/oBa,aAAa;;;;;;;;;;;;;;;;;YAcb,MAAM;;;;;;eAzBN,4EAAkB;iBAClB,YAAY,EAAE;oBACd,MAAM,EAAE;;;;;4BAKM,GAAG,EAAE,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBApD5B,UAAU;YACV,WAAW;cACX,MAAM;;;;;;;;;;;cApDN,OAAO,SAAS,EAAE,mBAAmB;mBAmCtC,OAAO,0CAA0C,EAAE,WAAW;wBAC9D,OAAO,uCAAuC,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC;oBAC1E,OAAO,0CAA0C,EAAE,YAAY;4BAC/D,OAAO,6CAA6C,EAAE,cAAc;4BACpE,OAAO,4CAA4C,EAAE,oBAAoB;yBACzE,OAAO,0CAA0C,EAAE,WAAW;cAC9D,OAAO,oCAAoC,EAAE,MAAM;cACnD,OAAO,8BAA8B,CAAC;qBACtC,OAAO,8BAA8B,EAAE,aAAa;iBACpD,OAAO,qBAAqB,EAAE,SAAS;iBACvC,OAAO,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;iBA2Bf,OAAO;;;aAGP,OAAO;;;aAGP,OAAO"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";AAqCA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH;IACE;;;;;;OAMG;IACH,uBAHW,aAAa,GAAG,aAAa,GAC3B,QAAQ,MAAM,CAAC,CAa3B;IAED;;;;;OAKG;IACH,sBAFW,aAAa,GAAG,kBAAkB,EA+K5C;IAzKC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAAwC;IAExC,qBAAqB;IACrB,QADW,MAAM,CACiB;IAClC,8EAAwC;IAExC,qBAM0C;IAG1C;;;;;6CAAwC;IACxC,+BAA8E;IAS9E,wBAAqC;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAAmC;IACnC,kBAAoB;IACpB,0BAA2B;IAG3B,qCAGE;IAIA,6BAGE;IASF,+BAGE;IAMJ,mBAKE;IAGF,mCAIE;IAGF,uBAME;IAGF,qBAGE;IAwUJ;;;;;OAKG;IACH,kBAHW,MAAM,EAAE,GAAC,MAAM,mBACP,YAAY,KAAK,IAAI,QAUvC;IAxUC,eAIE;IAWA,yBAA4B;IAW5B,6CAA4D;IAe5D,UAQE;IAOF,qBAAqB;IACrB,+CAA8D;IAKhE,yBAAwC;IACxC,+BAA8C;IAqVhD;;;;;;OAMG;IACH,yBAQC;IAzUD;;;;OAIG;IACH,SAFa,QAAQ,IAAI,CAAC,CAezB;IAED;;;;;OAKG;IACH,QAFa,QAAQ,IAAI,CAAC,CAwCzB;IAlCG,gCAAuB;IAoC3B;;;;;;OAMG;IACH,gBAFa,QAAQ,IAAI,CAAC,CAYzB;IAED,iCAEC;IAED;;;;;OAKG;IACH,wFAEC;IAED;;;;;;;;OAQG;IACH,WALW,MAAM,GAAC,SAAS,GAAC,MAAM;;oBAGrB,QAAQ,UAAU,CAAC,CAI/B;IAED;;;;;;;;;;OAUG;IACH,mBALW,MAAM,GAAC,SAAS,GAAC,MAAM,aACvB,MAAM,EAAE,GAAC,MAAM;;;;;OAWzB;IAED;;;;;OAKG;IACH,YAJW,MAAM,GAAC,SAAS,GAAC,MAAM,iCAErB,QAAQ,UAAU,CAAC,CAkB/B;IAED;;;;;;;;;OASG;IACH,8BAiBC;IAED;;;;;OAKG;IACH,aAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,IAAI,CAAC,CAgBzB;IAED;;;;;OAKG;IACH,WAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,MAAM,CAAC,CAW3B;IAkBD;;;;;OAKG;IACH,oBAFW,MAAM,EAAE,GAAC,MAAM,QAUzB;IAED,6BA0BC;IAED;;;;OAIG;IACH,oBAuBC;IAmBD;;;;;;;OAOG;IACH,sBAaC;IAED;;;;;OAKG;IACH,4BAkDC;CACF;;;;;;;;;;aA/oBa,aAAa;;;;;;;;;;;;;;;;;YAcb,MAAM;;;;;;eAzBN,4EAAkB;iBAClB,YAAY,EAAE;oBACd,MAAM,EAAE;;;;;4BAKM,GAAG,EAAE,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBApD5B,UAAU;YACV,WAAW;cACX,MAAM;;;;;;;;;;;mBAjBP,OAAO,0CAA0C,EAAE,WAAW;wBAC9D,OAAO,uCAAuC,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC;oBAC1E,OAAO,0CAA0C,EAAE,YAAY;4BAC/D,OAAO,6CAA6C,EAAE,cAAc;4BACpE,OAAO,4CAA4C,EAAE,oBAAoB;yBACzE,OAAO,0CAA0C,EAAE,WAAW;cAC9D,OAAO,oCAAoC,EAAE,MAAM;cACnD,OAAO,8BAA8B,CAAC;qBACtC,OAAO,8BAA8B,EAAE,aAAa;iBACpD,OAAO,qBAAqB,EAAE,SAAS;iBACvC,OAAO,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;iBA2Bf,OAAO;;;aAGP,OAAO;;;aAGP,OAAO"} \ No newline at end of file diff --git a/dist/src/metrics/stats.d.ts b/dist/src/metrics/stats.d.ts index c3a1be14..44e3cdb6 100644 --- a/dist/src/metrics/stats.d.ts +++ b/dist/src/metrics/stats.d.ts @@ -1,6 +1,5 @@ export = Stats; -declare const Stats_base: import("../types").EventEmitterFactory; -declare class Stats extends Stats_base { +declare class Stats extends EventEmitter { /** * A queue based manager for stat processing * @@ -127,10 +126,7 @@ declare class Stats extends Stats_base { */ private _applyOp; } -declare namespace Stats { - export { Events }; -} +import { EventEmitter } from "events"; import { BigNumber as Big } from "bignumber.js"; import MovingAverage = require("moving-average"); -type Events = import('../types').EventEmitterFactory; //# sourceMappingURL=stats.d.ts.map \ No newline at end of file diff --git a/dist/src/metrics/stats.d.ts.map b/dist/src/metrics/stats.d.ts.map index 684a4305..cd56f674 100644 --- a/dist/src/metrics/stats.d.ts.map +++ b/dist/src/metrics/stats.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/metrics/stats.js"],"names":[],"mappings":";;AAUA;IACE;;;;;;OAMG;IACH,6BAHW,MAAM,EAAE,WACR,GAAG,EAkCb;IA7BC,cAAuB;IACvB,cAAgB;IAEhB,mDAAmD;IACnD;sBAD2B,GAAG;kBAAY,GAAG;MAI5C;IAED,2BAAoC;IACpC,2BAAgC;IAEhC,2EAA2E;IAC3E;sBAD2B,wBAAe;kBAAY,wBAAe;MAC5C;IAwH3B;;;;;;;;;;OAUG;IACH,gBAaC;IA9HD;;;;;;OAMG;IACH,SAFa,IAAI,CAMhB;IAED;;;;;OAKG;IACH,QAFa,IAAI,CAOhB;IAFG,cAAoB;IAIxB;;OAEG;IACH;sBAzD6B,GAAG;kBAAY,GAAG;MA2D9C;IAED;;OAEG;IACH;sBAvD6B,wBAAe;kBAAY,wBAAe;MAyDtE;IAED;;;;OAIG;IACH,cAkBC;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,OACN,MAAM,GACJ,IAAI,CAKhB;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,qBAKC;IA4BD;;;;;;;;OAQG;IACH,yBAQC;IAED;;;;;;;;;OASG;IACH,4BAsBC;IAED;;;;;;;;OAQG;IACH,iBAqBC;CACF;;;;;;cArQa,OAAO,UAAU,EAAE,mBAAmB"} \ No newline at end of file +{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/metrics/stats.js"],"names":[],"mappings":";AAQA;IACE;;;;;;OAMG;IACH,6BAHW,MAAM,EAAE,WACR,GAAG,EAkCb;IA7BC,cAAuB;IACvB,cAAgB;IAEhB,mDAAmD;IACnD;sBAD2B,GAAG;kBAAY,GAAG;MAI5C;IAED,2BAAoC;IACpC,2BAAgC;IAEhC,2EAA2E;IAC3E;sBAD2B,wBAAe;kBAAY,wBAAe;MAC5C;IAwH3B;;;;;;;;;;OAUG;IACH,gBAaC;IA9HD;;;;;;OAMG;IACH,SAFa,IAAI,CAMhB;IAED;;;;;OAKG;IACH,QAFa,IAAI,CAOhB;IAFG,cAAoB;IAIxB;;OAEG;IACH;sBAzD6B,GAAG;kBAAY,GAAG;MA2D9C;IAED;;OAEG;IACH;sBAvD6B,wBAAe;kBAAY,wBAAe;MAyDtE;IAED;;;;OAIG;IACH,cAkBC;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,OACN,MAAM,GACJ,IAAI,CAKhB;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,qBAKC;IA4BD;;;;;;;;OAQG;IACH,yBAQC;IAED;;;;;;;;;OASG;IACH,4BAsBC;IAED;;;;;;;;OAQG;IACH,iBAqBC;CACF"} \ No newline at end of file diff --git a/dist/src/peer-store/index.d.ts b/dist/src/peer-store/index.d.ts index ca7004f2..e73da738 100644 --- a/dist/src/peer-store/index.d.ts +++ b/dist/src/peer-store/index.d.ts @@ -1,5 +1,4 @@ export = PeerStore; -declare const PeerStore_base: import("../types").EventEmitterFactory; /** * @typedef {import('./address-book').Address} Address */ @@ -12,7 +11,7 @@ declare const PeerStore_base: import("../types").EventEmitterFactory; * @fires PeerStore#change:pubkey Emitted emitted when a peer's public key is known. * @fires PeerStore#change:metadata Emitted when the known metadata of a peer change. */ -declare class PeerStore extends PeerStore_base { +declare class PeerStore extends EventEmitter { /** * Peer object * @@ -79,8 +78,9 @@ declare class PeerStore extends PeerStore_base { get(peerId: PeerId): Peer | undefined; } declare namespace PeerStore { - export { Events, Peer, Address }; + export { Peer, Address }; } +import { EventEmitter } from "events"; import PeerId = require("peer-id"); import AddressBook = require("./address-book"); import KeyBook = require("./key-book"); @@ -107,6 +107,5 @@ type Peer = { */ metadata: Map | undefined; }; -type Events = import('../types').EventEmitterFactory; type Address = import('./address-book').Address; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/src/peer-store/index.d.ts.map b/dist/src/peer-store/index.d.ts.map index 884c40f2..bd0820fc 100644 --- a/dist/src/peer-store/index.d.ts.map +++ b/dist/src/peer-store/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-store/index.js"],"names":[],"mappings":";;AAkBA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACE;;;;;;;;OAQG;IAEH;;;;;;OAMG;IACH;QAH2B,MAAM,EAAtB,MAAM;OA2BhB;IArBC,gBAAqB;IAErB;;OAEG;IACH,yBAAwC;IAExC;;OAEG;IACH,iBAAgC;IAEhC;;OAEG;IACH,2BAA0C;IAE1C;;OAEG;IACH,qBAAoC;IAGtC;;OAEG;IACH,cAAW;IAEX;;OAEG;IACH,aAAU;IAEV;;;;OAIG;IACH,+BAiBC;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,OAAO,CASnB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,IAAI,GAAC,SAAS,CAsB1B;CACF;;;;;;;;;;;;;;;;QAnHe,MAAM;;;;eACN,OAAO,EAAE;;;;eACT,MAAM,EAAE;;;;cACR,IAAI,MAAM,EAAE,UAAU,CAAC,GAAC,SAAS;;cAnCnC,OAAO,UAAU,EAAE,mBAAmB;eAevC,OAAO,gBAAgB,EAAE,OAAO"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-store/index.js"],"names":[],"mappings":";AAgBA;;GAEG;AAEH;;;;;;;;GAQG;AACH;IACE;;;;;;;;OAQG;IAEH;;;;;;OAMG;IACH;QAH2B,MAAM,EAAtB,MAAM;OA2BhB;IArBC,gBAAqB;IAErB;;OAEG;IACH,yBAAwC;IAExC;;OAEG;IACH,iBAAgC;IAEhC;;OAEG;IACH,2BAA0C;IAE1C;;OAEG;IACH,qBAAoC;IAGtC;;OAEG;IACH,cAAW;IAEX;;OAEG;IACH,aAAU;IAEV;;;;OAIG;IACH,+BAiBC;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,OAAO,CASnB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,IAAI,GAAC,SAAS,CAsB1B;CACF;;;;;;;;;;;;;;;;;QAnHe,MAAM;;;;eACN,OAAO,EAAE;;;;eACT,MAAM,EAAE;;;;cACR,IAAI,MAAM,EAAE,UAAU,CAAC,GAAC,SAAS;;eApBpC,OAAO,gBAAgB,EAAE,OAAO"} \ No newline at end of file diff --git a/dist/src/types.d.ts b/dist/src/types.d.ts index 2bfc0461..e69de29b 100644 --- a/dist/src/types.d.ts +++ b/dist/src/types.d.ts @@ -1,18 +0,0 @@ -export interface EventEmitterFactory { - new(): EventEmitter; -} - -export interface EventEmitter { - addListener(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - on(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - once(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - removeListener(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - off(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - removeAllListeners(event?: string | symbol): EventEmitter; - setMaxListeners(n: number): EventEmitter; - getMaxListeners(): number; - listeners(event: string | symbol): Function[]; // eslint-disable-line @typescript-eslint/ban-types - rawListeners(event: string | symbol): Function[]; // eslint-disable-line @typescript-eslint/ban-types - emit(event: string | symbol, ...args: any[]): boolean; - listenerCount(event: string | symbol): number; -} diff --git a/src/address-manager/index.js b/src/address-manager/index.js index 2ee830a5..25de94b6 100644 --- a/src/address-manager/index.js +++ b/src/address-manager/index.js @@ -1,8 +1,6 @@ 'use strict' -/** @typedef {import('../types').EventEmitterFactory} Events */ -/** @type Events */ -const EventEmitter = require('events') +const { EventEmitter } = require('events') const { Multiaddr } = require('multiaddr') const PeerId = require('peer-id') diff --git a/src/circuit/listener.js b/src/circuit/listener.js index 3208395f..a3f11dc7 100644 --- a/src/circuit/listener.js +++ b/src/circuit/listener.js @@ -1,7 +1,5 @@ 'use strict' -/** @typedef {import('../types').EventEmitterFactory} Events */ -/** @type Events */ const { EventEmitter } = require('events') const { Multiaddr } = require('multiaddr') diff --git a/src/connection-manager/index.js b/src/connection-manager/index.js index 7cff6a02..7a865127 100644 --- a/src/connection-manager/index.js +++ b/src/connection-manager/index.js @@ -11,9 +11,7 @@ const LatencyMonitor = require('./latency-monitor') // @ts-ignore retimer does not have types const retimer = require('retimer') -/** @typedef {import('../types').EventEmitterFactory} Events */ -/** @type Events */ -const EventEmitter = require('events') +const { EventEmitter } = require('events') const PeerId = require('peer-id') diff --git a/src/connection-manager/latency-monitor.js b/src/connection-manager/latency-monitor.js index a8f4af81..6c3061b9 100644 --- a/src/connection-manager/latency-monitor.js +++ b/src/connection-manager/latency-monitor.js @@ -5,9 +5,7 @@ * This code is based on `latency-monitor` (https://github.com/mlucool/latency-monitor) by `mlucool` (https://github.com/mlucool), available under Apache License 2.0 (https://github.com/mlucool/latency-monitor/blob/master/LICENSE) */ -/** @typedef {import('../types').EventEmitterFactory} Events */ -/** @type Events */ -const EventEmitter = require('events') +const { EventEmitter } = require('events') const VisibilityChangeEmitter = require('./visibility-change-emitter') const debug = require('debug')('latency-monitor:LatencyMonitor') diff --git a/src/connection-manager/visibility-change-emitter.js b/src/connection-manager/visibility-change-emitter.js index bf7da71b..ebe5e7d0 100644 --- a/src/connection-manager/visibility-change-emitter.js +++ b/src/connection-manager/visibility-change-emitter.js @@ -6,9 +6,7 @@ */ 'use strict' -/** @typedef {import('../types').EventEmitterFactory} Events */ -/** @type Events */ -const EventEmitter = require('events') +const { EventEmitter } = require('events') const debug = require('debug')('latency-monitor:VisibilityChangeEmitter') diff --git a/src/index.js b/src/index.js index 592e7785..999bcb26 100644 --- a/src/index.js +++ b/src/index.js @@ -4,9 +4,7 @@ const debug = require('debug') const log = Object.assign(debug('libp2p'), { error: debug('libp2p:err') }) -/** @typedef {import('./types').EventEmitterFactory} Events */ -/** @type Events */ -const EventEmitter = require('events') +const { EventEmitter } = require('events') const errCode = require('err-code') const PeerId = require('peer-id') diff --git a/src/metrics/stats.js b/src/metrics/stats.js index c6fbf29f..c0585744 100644 --- a/src/metrics/stats.js +++ b/src/metrics/stats.js @@ -1,9 +1,7 @@ // @ts-nocheck 'use strict' -/** @typedef {import('../types').EventEmitterFactory} Events */ -/** @type Events */ -const EventEmitter = require('events') +const { EventEmitter } = require('events') const { BigNumber: Big } = require('bignumber.js') const MovingAverage = require('moving-average') const retimer = require('retimer') diff --git a/src/peer-store/index.js b/src/peer-store/index.js index 07412290..b3df1bbb 100644 --- a/src/peer-store/index.js +++ b/src/peer-store/index.js @@ -2,9 +2,7 @@ const errcode = require('err-code') -/** @typedef {import('../types').EventEmitterFactory} Events */ -/** @type Events */ -const EventEmitter = require('events') +const { EventEmitter } = require('events') const PeerId = require('peer-id') const AddressBook = require('./address-book') diff --git a/src/types.d.ts b/src/types.d.ts index 2bfc0461..e69de29b 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,18 +0,0 @@ -export interface EventEmitterFactory { - new(): EventEmitter; -} - -export interface EventEmitter { - addListener(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - on(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - once(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - removeListener(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - off(event: string | symbol, listener: (...args: any[]) => void): EventEmitter; - removeAllListeners(event?: string | symbol): EventEmitter; - setMaxListeners(n: number): EventEmitter; - getMaxListeners(): number; - listeners(event: string | symbol): Function[]; // eslint-disable-line @typescript-eslint/ban-types - rawListeners(event: string | symbol): Function[]; // eslint-disable-line @typescript-eslint/ban-types - emit(event: string | symbol, ...args: any[]): boolean; - listenerCount(event: string | symbol): number; -}