mirror of
https://github.com/logos-messaging/examples.waku.org.git
synced 2026-01-03 21:33:08 +00:00
1 line
1015 KiB
JavaScript
1 line
1015 KiB
JavaScript
var fj=Object.defineProperty,dj=(Y,K,R)=>K in Y?fj(Y,K,{enumerable:!0,configurable:!0,writable:!0,value:R}):Y[K]=R,yf=(Y,K,R)=>(dj(Y,"symbol"!=typeof K?K+"":K,R),R),AA=(Y,K,R)=>{if(!K.has(Y))throw TypeError("Cannot "+R)},ra=(Y,K,R)=>(AA(Y,K,"read from private field"),R?R.call(Y):K.get(Y)),Dp=(Y,K,R)=>{if(K.has(Y))throw TypeError("Cannot add the same private member more than once");K instanceof WeakSet?K.add(Y):K.set(Y,R)},bo=(Y,K,R,y)=>(AA(Y,K,"write to private field"),y?y.call(Y,R):K.set(Y,R),R),P_=(Y,K,R,y)=>({set _(l){bo(Y,K,l,R)},get _(){return ra(Y,K,y)}});(self.webpackChunkrelay_angular_chat=self.webpackChunkrelay_angular_chat||[]).push([[179],{1873:(Y,K,R)=>{"use strict";Y.exports=R(4729)},4729:(Y,K,R)=>{"use strict";var y=K;function l(){y.util._configure(),y.Writer._configure(y.BufferWriter),y.Reader._configure(y.BufferReader)}y.build="minimal",y.Writer=R(3542),y.BufferWriter=R(989),y.Reader=R(6913),y.BufferReader=R(1872),y.util=R(6138),y.rpc=R(9852),y.roots=R(935),y.configure=l,l()},6913:(Y,K,R)=>{"use strict";Y.exports=d;var l,y=R(6138),g=y.LongBits,b=y.utf8;function m(E,v){return RangeError("index out of range: "+E.pos+" + "+(v||1)+" > "+E.len)}function d(E){this.buf=E,this.pos=0,this.len=E.length}var v,c=typeof Uint8Array<"u"?function(v){if(v instanceof Uint8Array||Array.isArray(v))return new d(v);throw Error("illegal buffer")}:function(v){if(Array.isArray(v))return new d(v);throw Error("illegal buffer")},f=function(){return y.Buffer?function(h){return(d.create=function(A){return y.Buffer.isBuffer(A)?new l(A):c(A)})(h)}:c};function p(){var E=new g(0,0),v=0;if(!(this.len-this.pos>4)){for(;v<3;++v){if(this.pos>=this.len)throw m(this);if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*v)>>>0,this.buf[this.pos++]<128)return E}return E.lo=(E.lo|(127&this.buf[this.pos++])<<7*v)>>>0,E}for(;v<4;++v)if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*v)>>>0,this.buf[this.pos++]<128)return E;if(E.lo=(E.lo|(127&this.buf[this.pos])<<28)>>>0,E.hi=(E.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return E;if(v=0,this.len-this.pos>4){for(;v<5;++v)if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*v+3)>>>0,this.buf[this.pos++]<128)return E}else for(;v<5;++v){if(this.pos>=this.len)throw m(this);if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*v+3)>>>0,this.buf[this.pos++]<128)return E}throw Error("invalid varint encoding")}function w(E,v){return(E[v-4]|E[v-3]<<8|E[v-2]<<16|E[v-1]<<24)>>>0}function I(){if(this.pos+8>this.len)throw m(this,8);return new g(w(this.buf,this.pos+=4),w(this.buf,this.pos+=4))}d.create=f(),d.prototype._slice=y.Array.prototype.subarray||y.Array.prototype.slice,d.prototype.uint32=(v=4294967295,function(){if(v=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(v=(v|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(v=(v|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(v=(v|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(v=(v|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return v;if((this.pos+=5)>this.len)throw this.pos=this.len,m(this,10);return v}),d.prototype.int32=function(){return 0|this.uint32()},d.prototype.sint32=function(){var v=this.uint32();return v>>>1^-(1&v)|0},d.prototype.bool=function(){return 0!==this.uint32()},d.prototype.fixed32=function(){if(this.pos+4>this.len)throw m(this,4);return w(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw m(this,4);return 0|w(this.buf,this.pos+=4)},d.prototype.float=function(){if(this.pos+4>this.len)throw m(this,4);var v=y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,v},d.prototype.double=function(){if(this.pos+8>this.len)throw m(this,4);var v=y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,v},d.prototype.bytes=function(){var v=this.uint32(),h=this.pos,C=this.pos+v;if(C>this.len)throw m(this,v);return this.pos+=v,Array.isArray(this.buf)?this.buf.slice(h,C):h===C?new this.buf.constructor(0):this._slice.call(this.buf,h,C)},d.prototype.string=function(){var v=this.bytes();return b.read(v,0,v.length)},d.prototype.skip=function(v){if("number"==typeof v){if(this.pos+v>this.len)throw m(this,v);this.pos+=v}else do{if(this.pos>=this.len)throw m(this)}while(128&this.buf[this.pos++]);return this},d.prototype.skipType=function(E){switch(E){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(E=7&this.uint32());)this.skipType(E);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+E+" at offset "+this.pos)}return this},d._configure=function(E){l=E,d.create=f(),l._configure();var v=y.Long?"toLong":"toNumber";y.merge(d.prototype,{int64:function(){return p.call(this)[v](!1)},uint64:function(){return p.call(this)[v](!0)},sint64:function(){return p.call(this).zzDecode()[v](!1)},fixed64:function(){return I.call(this)[v](!0)},sfixed64:function(){return I.call(this)[v](!1)}})}},1872:(Y,K,R)=>{"use strict";Y.exports=g;var y=R(6913);(g.prototype=Object.create(y.prototype)).constructor=g;var l=R(6138);function g(b){y.call(this,b)}g._configure=function(){l.Buffer&&(g.prototype._slice=l.Buffer.prototype.slice)},g.prototype.string=function(){var m=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+m,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+m,this.len))},g._configure()},935:Y=>{"use strict";Y.exports={}},9852:(Y,K,R)=>{"use strict";K.Service=R(3939)},3939:(Y,K,R)=>{"use strict";Y.exports=l;var y=R(6138);function l(g,b,m){if("function"!=typeof g)throw TypeError("rpcImpl must be a function");y.EventEmitter.call(this),this.rpcImpl=g,this.requestDelimited=Boolean(b),this.responseDelimited=Boolean(m)}(l.prototype=Object.create(y.EventEmitter.prototype)).constructor=l,l.prototype.rpcCall=function g(b,m,d,c,f){if(!c)throw TypeError("request must be specified");var p=this;if(!f)return y.asPromise(g,p,b,m,d,c);if(p.rpcImpl)try{return p.rpcImpl(b,m[p.requestDelimited?"encodeDelimited":"encode"](c).finish(),function(I,E){if(I)return p.emit("error",I,b),f(I);if(null!==E){if(!(E instanceof d))try{E=d[p.responseDelimited?"decodeDelimited":"decode"](E)}catch(v){return p.emit("error",v,b),f(v)}return p.emit("data",E,b),f(null,E)}p.end(!0)})}catch(w){return p.emit("error",w,b),void setTimeout(function(){f(w)},0)}else setTimeout(function(){f(Error("already ended"))},0)},l.prototype.end=function(b){return this.rpcImpl&&(b||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},6723:(Y,K,R)=>{"use strict";Y.exports=l;var y=R(6138);function l(d,c){this.lo=d>>>0,this.hi=c>>>0}var g=l.zero=new l(0,0);g.toNumber=function(){return 0},g.zzEncode=g.zzDecode=function(){return this},g.length=function(){return 1};var b=l.zeroHash="\0\0\0\0\0\0\0\0";l.fromNumber=function(c){if(0===c)return g;var f=c<0;f&&(c=-c);var p=c>>>0,w=(c-p)/4294967296>>>0;return f&&(w=~w>>>0,p=~p>>>0,++p>4294967295&&(p=0,++w>4294967295&&(w=0))),new l(p,w)},l.from=function(c){if("number"==typeof c)return l.fromNumber(c);if(y.isString(c)){if(!y.Long)return l.fromNumber(parseInt(c,10));c=y.Long.fromString(c)}return c.low||c.high?new l(c.low>>>0,c.high>>>0):g},l.prototype.toNumber=function(c){if(!c&&this.hi>>>31){var f=1+~this.lo>>>0,p=~this.hi>>>0;return f||(p=p+1>>>0),-(f+4294967296*p)}return this.lo+4294967296*this.hi},l.prototype.toLong=function(c){return y.Long?new y.Long(0|this.lo,0|this.hi,Boolean(c)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(c)}};var m=String.prototype.charCodeAt;l.fromHash=function(c){return c===b?g:new l((m.call(c,0)|m.call(c,1)<<8|m.call(c,2)<<16|m.call(c,3)<<24)>>>0,(m.call(c,4)|m.call(c,5)<<8|m.call(c,6)<<16|m.call(c,7)<<24)>>>0)},l.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},l.prototype.zzEncode=function(){var c=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^c)>>>0,this.lo=(this.lo<<1^c)>>>0,this},l.prototype.zzDecode=function(){var c=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^c)>>>0,this.hi=(this.hi>>>1^c)>>>0,this},l.prototype.length=function(){var c=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,p=this.hi>>>24;return 0===p?0===f?c<16384?c<128?1:2:c<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:p<128?9:10}},6138:function(Y,K,R){"use strict";var y=K;function l(b,m,d){for(var c=Object.keys(m),f=0;f<c.length;++f)(void 0===b[c[f]]||!d)&&(b[c[f]]=m[c[f]]);return b}function g(b){function m(d,c){if(!(this instanceof m))return new m(d,c);Object.defineProperty(this,"message",{get:function(){return d}}),Error.captureStackTrace?Error.captureStackTrace(this,m):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),c&&l(this,c)}return(m.prototype=Object.create(Error.prototype)).constructor=m,Object.defineProperty(m.prototype,"name",{get:function(){return b}}),m.prototype.toString=function(){return this.name+": "+this.message},m}y.asPromise=R(1280),y.base64=R(9039),y.EventEmitter=R(9889),y.float=R(530),y.inquire=R(716),y.utf8=R(7768),y.pool=R(4479),y.LongBits=R(6723),y.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node),y.global=y.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||this,y.emptyArray=Object.freeze?Object.freeze([]):[],y.emptyObject=Object.freeze?Object.freeze({}):{},y.isInteger=Number.isInteger||function(m){return"number"==typeof m&&isFinite(m)&&Math.floor(m)===m},y.isString=function(m){return"string"==typeof m||m instanceof String},y.isObject=function(m){return m&&"object"==typeof m},y.isset=y.isSet=function(m,d){var c=m[d];return!(null==c||!m.hasOwnProperty(d))&&("object"!=typeof c||(Array.isArray(c)?c.length:Object.keys(c).length)>0)},y.Buffer=function(){try{var b=y.inquire("buffer").Buffer;return b.prototype.utf8Write?b:null}catch{return null}}(),y._Buffer_from=null,y._Buffer_allocUnsafe=null,y.newBuffer=function(m){return"number"==typeof m?y.Buffer?y._Buffer_allocUnsafe(m):new y.Array(m):y.Buffer?y._Buffer_from(m):typeof Uint8Array>"u"?m:new Uint8Array(m)},y.Array=typeof Uint8Array<"u"?Uint8Array:Array,y.Long=y.global.dcodeIO&&y.global.dcodeIO.Long||y.global.Long||y.inquire("long"),y.key2Re=/^true|false|0|1$/,y.key32Re=/^-?(?:0|[1-9][0-9]*)$/,y.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,y.longToHash=function(m){return m?y.LongBits.from(m).toHash():y.LongBits.zeroHash},y.longFromHash=function(m,d){var c=y.LongBits.fromHash(m);return y.Long?y.Long.fromBits(c.lo,c.hi,d):c.toNumber(Boolean(d))},y.merge=l,y.lcFirst=function(m){return m.charAt(0).toLowerCase()+m.substring(1)},y.newError=g,y.ProtocolError=g("ProtocolError"),y.oneOfGetter=function(m){for(var d={},c=0;c<m.length;++c)d[m[c]]=1;return function(){for(var f=Object.keys(this),p=f.length-1;p>-1;--p)if(1===d[f[p]]&&null!=this[f[p]])return f[p]}},y.oneOfSetter=function(m){return function(d){for(var c=0;c<m.length;++c)m[c]!==d&&delete this[m[c]]}},y.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},y._configure=function(){var b=y.Buffer;b?(y._Buffer_from=b.from!==Uint8Array.from&&b.from||function(d,c){return new b(d,c)},y._Buffer_allocUnsafe=b.allocUnsafe||function(d){return new b(d)}):y._Buffer_from=y._Buffer_allocUnsafe=null}},3542:(Y,K,R)=>{"use strict";Y.exports=p;var l,y=R(6138),g=y.LongBits,b=y.base64,m=y.utf8;function d(N,S,D){this.fn=N,this.len=S,this.next=void 0,this.val=D}function c(){}function f(N){this.head=N.head,this.tail=N.tail,this.len=N.len,this.next=N.states}function p(){this.len=0,this.head=new d(c,0,0),this.tail=this.head,this.states=null}var w=function(){return y.Buffer?function(){return(p.create=function(){return new l})()}:function(){return new p}};function I(N,S,D){S[D]=255&N}function v(N,S){this.len=N,this.next=void 0,this.val=S}function h(N,S,D){for(;N.hi;)S[D++]=127&N.lo|128,N.lo=(N.lo>>>7|N.hi<<25)>>>0,N.hi>>>=7;for(;N.lo>127;)S[D++]=127&N.lo|128,N.lo=N.lo>>>7;S[D++]=N.lo}function C(N,S,D){S[D]=255&N,S[D+1]=N>>>8&255,S[D+2]=N>>>16&255,S[D+3]=N>>>24}p.create=w(),p.alloc=function(S){return new y.Array(S)},y.Array!==Array&&(p.alloc=y.pool(p.alloc,y.Array.prototype.subarray)),p.prototype._push=function(S,D,M){return this.tail=this.tail.next=new d(S,D,M),this.len+=D,this},(v.prototype=Object.create(d.prototype)).fn=function E(N,S,D){for(;N>127;)S[D++]=127&N|128,N>>>=7;S[D]=N},p.prototype.uint32=function(S){return this.len+=(this.tail=this.tail.next=new v((S>>>=0)<128?1:S<16384?2:S<2097152?3:S<268435456?4:5,S)).len,this},p.prototype.int32=function(S){return S<0?this._push(h,10,g.fromNumber(S)):this.uint32(S)},p.prototype.sint32=function(S){return this.uint32((S<<1^S>>31)>>>0)},p.prototype.int64=p.prototype.uint64=function(S){var D=g.from(S);return this._push(h,D.length(),D)},p.prototype.sint64=function(S){var D=g.from(S).zzEncode();return this._push(h,D.length(),D)},p.prototype.bool=function(S){return this._push(I,1,S?1:0)},p.prototype.sfixed32=p.prototype.fixed32=function(S){return this._push(C,4,S>>>0)},p.prototype.sfixed64=p.prototype.fixed64=function(S){var D=g.from(S);return this._push(C,4,D.lo)._push(C,4,D.hi)},p.prototype.float=function(S){return this._push(y.float.writeFloatLE,4,S)},p.prototype.double=function(S){return this._push(y.float.writeDoubleLE,8,S)};var A=y.Array.prototype.set?function(S,D,M){D.set(S,M)}:function(S,D,M){for(var k=0;k<S.length;++k)D[M+k]=S[k]};p.prototype.bytes=function(S){var D=S.length>>>0;if(!D)return this._push(I,1,0);if(y.isString(S)){var M=p.alloc(D=b.length(S));b.decode(S,M,0),S=M}return this.uint32(D)._push(A,D,S)},p.prototype.string=function(S){var D=m.length(S);return D?this.uint32(D)._push(m.write,D,S):this._push(I,1,0)},p.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new d(c,0,0),this.len=0,this},p.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 d(c,0,0),this.len=0),this},p.prototype.ldelim=function(){var S=this.head,D=this.tail,M=this.len;return this.reset().uint32(M),M&&(this.tail.next=S.next,this.tail=D,this.len+=M),this},p.prototype.finish=function(){for(var S=this.head.next,D=this.constructor.alloc(this.len),M=0;S;)S.fn(S.val,D,M),M+=S.len,S=S.next;return D},p._configure=function(N){l=N,p.create=w(),l._configure()}},989:(Y,K,R)=>{"use strict";Y.exports=g;var y=R(3542);(g.prototype=Object.create(y.prototype)).constructor=g;var l=R(6138);function g(){y.call(this)}function b(m,d,c){m.length<40?l.utf8.write(m,d,c):d.utf8Write?d.utf8Write(m,c):d.write(m,c)}g._configure=function(){g.alloc=l._Buffer_allocUnsafe,g.writeBytesBuffer=l.Buffer&&l.Buffer.prototype instanceof Uint8Array&&"set"===l.Buffer.prototype.set.name?function(d,c,f){c.set(d,f)}:function(d,c,f){if(d.copy)d.copy(c,f,0,d.length);else for(var p=0;p<d.length;)c[f++]=d[p++]}},g.prototype.bytes=function(d){l.isString(d)&&(d=l._Buffer_from(d,"base64"));var c=d.length>>>0;return this.uint32(c),c&&this._push(g.writeBytesBuffer,c,d),this},g.prototype.string=function(d){var c=l.Buffer.byteLength(d);return this.uint32(c),c&&this._push(b,c,d),this},g._configure()},5876:(Y,K,R)=>{var Ks,Fa,Ua,y={};R.r(y),R.d(y,{identity:()=>M6});var l={};R.r(l),R.d(l,{base2:()=>O6});var g={};R.r(g),R.d(g,{base8:()=>k6});var b={};R.r(b),R.d(b,{base10:()=>L6});var m={};R.r(m),R.d(m,{base16:()=>B6,base16upper:()=>F6});var d={};R.r(d),R.d(d,{base32:()=>co,base32hex:()=>$6,base32hexpad:()=>G6,base32hexpadupper:()=>j6,base32hexupper:()=>K6,base32pad:()=>V6,base32padupper:()=>H6,base32upper:()=>U6,base32z:()=>z6});var c={};R.r(c),R.d(c,{base36:()=>W6,base36upper:()=>q6});var f={};R.r(f),R.d(f,{base58btc:()=>ii,base58flickr:()=>Q6});var p={};R.r(p),R.d(p,{base64:()=>ih,base64pad:()=>Y6,base64url:()=>Z6,base64urlpad:()=>X6});var w={};R.r(w),R.d(w,{base256emoji:()=>r5});var I={};R.r(I),R.d(I,{sha256:()=>di,sha512:()=>I5});var E={};R.r(E),R.d(E,{identity:()=>Fc});var v={};R.r(v),R.d(v,{code:()=>D5,decode:()=>A5,encode:()=>x5,name:()=>C5});var h={};R.r(h),R.d(h,{code:()=>M5,decode:()=>k5,encode:()=>O5,name:()=>N5});var C={};R.r(C),R.d(C,{RsaPrivateKey:()=>gh,RsaPublicKey:()=>cm,fromJwk:()=>TF,generateKeyPair:()=>CF,unmarshalRsaPrivateKey:()=>SF,unmarshalRsaPublicKey:()=>IF});var A={};R.r(A),R.d(A,{Ed25519PrivateKey:()=>Nl,Ed25519PublicKey:()=>Am,generateKeyPair:()=>XF,generateKeyPairFromSeed:()=>JF,unmarshalEd25519PrivateKey:()=>YF,unmarshalEd25519PublicKey:()=>ZF});var N={};function S(n){return"function"==typeof n}function D(n){const t=n(r=>{Error.call(r),r.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}R.r(N),R.d(N,{Secp256k1PrivateKey:()=>km,Secp256k1PublicKey:()=>Om,generateKeyPair:()=>cU,unmarshalSecp256k1PrivateKey:()=>oU,unmarshalSecp256k1PublicKey:()=>aU});const M=D(n=>function(t){n(this),this.message=t?`${t.length} errors occurred during unsubscription:\n${t.map((r,i)=>`${i+1}) ${r.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=t});function k(n,e){if(n){const t=n.indexOf(e);0<=t&&n.splice(t,1)}}class F{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;const{_parentage:t}=this;if(t)if(this._parentage=null,Array.isArray(t))for(const s of t)s.remove(this);else t.remove(this);const{initialTeardown:r}=this;if(S(r))try{r()}catch(s){e=s instanceof M?s.errors:[s]}const{_finalizers:i}=this;if(i){this._finalizers=null;for(const s of i)try{O(s)}catch(o){e=e??[],o instanceof M?e=[...e,...o.errors]:e.push(o)}}if(e)throw new M(e)}}add(e){var t;if(e&&e!==this)if(this.closed)O(e);else{if(e instanceof F){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(t=this._finalizers)&&void 0!==t?t:[]).push(e)}}_hasParent(e){const{_parentage:t}=this;return t===e||Array.isArray(t)&&t.includes(e)}_addParent(e){const{_parentage:t}=this;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e}_removeParent(e){const{_parentage:t}=this;t===e?this._parentage=null:Array.isArray(t)&&k(t,e)}remove(e){const{_finalizers:t}=this;t&&k(t,e),e instanceof F&&e._removeParent(this)}}F.EMPTY=(()=>{const n=new F;return n.closed=!0,n})();const G=F.EMPTY;function T(n){return n instanceof F||n&&"closed"in n&&S(n.remove)&&S(n.add)&&S(n.unsubscribe)}function O(n){S(n)?n():n.unsubscribe()}const V={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},L={setTimeout(n,e,...t){const{delegate:r}=L;return r?.setTimeout?r.setTimeout(n,e,...t):setTimeout(n,e,...t)},clearTimeout(n){const{delegate:e}=L;return(e?.clearTimeout||clearTimeout)(n)},delegate:void 0};function H(n){L.setTimeout(()=>{const{onUnhandledError:e}=V;if(!e)throw n;e(n)})}function ne(){}const j=q("C",void 0,void 0);function q(n,e,t){return{kind:n,value:e,error:t}}let te=null;function oe(n){if(V.useDeprecatedSynchronousErrorHandling){const e=!te;if(e&&(te={errorThrown:!1,error:null}),n(),e){const{errorThrown:t,error:r}=te;if(te=null,t)throw r}}else n()}class he extends F{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,T(e)&&e.add(this)):this.destination=Rt}static create(e,t,r){return new ve(e,t,r)}next(e){this.isStopped?nt(function Z(n){return q("N",n,void 0)}(e),this):this._next(e)}error(e){this.isStopped?nt(function ee(n){return q("E",void 0,n)}(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?nt(j,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const Pe=Function.prototype.bind;function Se(n,e){return Pe.call(n,e)}class Be{constructor(e){this.partialObserver=e}next(e){const{partialObserver:t}=this;if(t.next)try{t.next(e)}catch(r){He(r)}}error(e){const{partialObserver:t}=this;if(t.error)try{t.error(e)}catch(r){He(r)}else He(e)}complete(){const{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(t){He(t)}}}class ve extends he{constructor(e,t,r){let i;if(super(),S(e)||!e)i={next:e??void 0,error:t??void 0,complete:r??void 0};else{let s;this&&V.useDeprecatedNextContext?(s=Object.create(e),s.unsubscribe=()=>this.unsubscribe(),i={next:e.next&&Se(e.next,s),error:e.error&&Se(e.error,s),complete:e.complete&&Se(e.complete,s)}):i=e}this.destination=new Be(i)}}function He(n){V.useDeprecatedSynchronousErrorHandling?function de(n){V.useDeprecatedSynchronousErrorHandling&&te&&(te.errorThrown=!0,te.error=n)}(n):H(n)}function nt(n,e){const{onStoppedNotification:t}=V;t&&L.setTimeout(()=>t(n,e))}const Rt={closed:!0,next:ne,error:function ke(n){throw n},complete:ne},wt="function"==typeof Symbol&&Symbol.observable||"@@observable";function Ft(n){return n}let rn=(()=>{class n{constructor(t){t&&(this._subscribe=t)}lift(t){const r=new n;return r.source=this,r.operator=t,r}subscribe(t,r,i){const s=function En(n){return n&&n instanceof he||function Rr(n){return n&&S(n.next)&&S(n.error)&&S(n.complete)}(n)&&T(n)}(t)?t:new ve(t,r,i);return oe(()=>{const{operator:o,source:a}=this;s.add(o?o.call(s,a):a?this._subscribe(s):this._trySubscribe(s))}),s}_trySubscribe(t){try{return this._subscribe(t)}catch(r){t.error(r)}}forEach(t,r){return new(r=Vn(r))((i,s)=>{const o=new ve({next:a=>{try{t(a)}catch(u){s(u),o.unsubscribe()}},error:s,complete:i});this.subscribe(o)})}_subscribe(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)}[wt](){return this}pipe(...t){return function Jt(n){return 0===n.length?Ft:1===n.length?n[0]:function(t){return n.reduce((r,i)=>i(r),t)}}(t)(this)}toPromise(t){return new(t=Vn(t))((r,i)=>{let s;this.subscribe(o=>s=o,o=>i(o),()=>r(s))})}}return n.create=e=>new n(e),n})();function Vn(n){var e;return null!==(e=n??V.Promise)&&void 0!==e?e:Promise}const Oi=D(n=>function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});let qr=(()=>{class n extends rn{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(t){const r=new ns(this,this);return r.operator=t,r}_throwIfClosed(){if(this.closed)throw new Oi}next(t){oe(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const r of this.currentObservers)r.next(t)}})}error(t){oe(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=t;const{observers:r}=this;for(;r.length;)r.shift().error(t)}})}complete(){oe(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:t}=this;for(;t.length;)t.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0}_trySubscribe(t){return this._throwIfClosed(),super._trySubscribe(t)}_subscribe(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)}_innerSubscribe(t){const{hasError:r,isStopped:i,observers:s}=this;return r||i?G:(this.currentObservers=null,s.push(t),new F(()=>{this.currentObservers=null,k(s,t)}))}_checkFinalizedStatuses(t){const{hasError:r,thrownError:i,isStopped:s}=this;r?t.error(i):s&&t.complete()}asObservable(){const t=new rn;return t.source=this,t}}return n.create=(e,t)=>new ns(e,t),n})();class ns extends qr{constructor(e,t){super(),this.destination=e,this.source=t}next(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)}error(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)}complete(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)}_subscribe(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:G}}function le(n){return e=>{if(function ie(n){return S(n?.lift)}(e))return e.lift(function(t){try{return n(t,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function ge(n,e,t,r,i){return new ye(n,e,t,r,i)}class ye extends he{constructor(e,t,r,i,s,o){super(e),this.onFinalize=s,this.shouldUnsubscribe=o,this._next=t?function(a){try{t(a)}catch(u){e.error(u)}}:super._next,this._error=i?function(a){try{i(a)}catch(u){e.error(u)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){const{closed:t}=this;super.unsubscribe(),!t&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}}}function Ht(n){return this instanceof Ht?(this.v=n,this):new Ht(n)}function In(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=t.apply(n,e||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(B){r[B]&&(i[B]=function(U){return new Promise(function(W,X){s.push([B,U,W,X])>1||a(B,U)})})}function a(B,U){try{!function u(B){B.value instanceof Ht?Promise.resolve(B.value.v).then(_,x):P(s[0][2],B)}(r[B](U))}catch(W){P(s[0][3],W)}}function _(B){a("next",B)}function x(B){a("throw",B)}function P(B,U){B(U),s.shift(),s.length&&a(s[0][0],s[0][1])}}function ot(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,e=n[Symbol.asyncIterator];return e?e.call(n):(n=function at(n){var e="function"==typeof Symbol&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(n),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(o){return new Promise(function(a,u){!function i(s,o,a,u){Promise.resolve(u).then(function(_){s({value:_,done:a})},o)}(a,u,(o=n[s](o)).done,o.value)})}}}const Rn=n=>n&&"number"==typeof n.length&&"function"!=typeof n;function Fr(n){return S(n?.then)}function Sr(n){return S(n[wt])}function Pn(n){return Symbol.asyncIterator&&S(n?.[Symbol.asyncIterator])}function $t(n){return new TypeError(`You provided ${null!==n&&"object"==typeof n?"an invalid object":`'${n}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}const ce=function rt(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}();function me(n){return S(n?.[ce])}function ft(n){return In(this,arguments,function*(){const t=n.getReader();try{for(;;){const{value:r,done:i}=yield Ht(t.read());if(i)return yield Ht(void 0);yield yield Ht(r)}}finally{t.releaseLock()}})}function St(n){return S(n?.getReader)}function Tn(n){if(n instanceof rn)return n;if(null!=n){if(Sr(n))return function Ve(n){return new rn(e=>{const t=n[wt]();if(S(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}(n);if(Rn(n))return function je(n){return new rn(e=>{for(let t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()})}(n);if(Fr(n))return function Te(n){return new rn(e=>{n.then(t=>{e.closed||(e.next(t),e.complete())},t=>e.error(t)).then(null,H)})}(n);if(Pn(n))return ct(n);if(me(n))return function $e(n){return new rn(e=>{for(const t of n)if(e.next(t),e.closed)return;e.complete()})}(n);if(St(n))return function pt(n){return ct(ft(n))}(n)}throw $t(n)}function ct(n){return new rn(e=>{(function it(n,e){var t,r,i,s;return function pe(n,e,t,r){return new(t||(t=Promise))(function(s,o){function a(x){try{_(r.next(x))}catch(P){o(P)}}function u(x){try{_(r.throw(x))}catch(P){o(P)}}function _(x){x.done?s(x.value):function i(s){return s instanceof t?s:new t(function(o){o(s)})}(x.value).then(a,u)}_((r=r.apply(n,e||[])).next())})}(this,void 0,void 0,function*(){try{for(t=ot(n);!(r=yield t.next()).done;)if(e.next(r.value),e.closed)return}catch(o){i={error:o}}finally{try{r&&!r.done&&(s=t.return)&&(yield s.call(t))}finally{if(i)throw i.error}}e.complete()})})(n,e).catch(t=>e.error(t))})}function gt(n,e,t,r=0,i=!1){const s=e.schedule(function(){t(),i?n.add(this.schedule(null,r)):this.unsubscribe()},r);if(n.add(s),!i)return s}function Ct(n,e,t=1/0){return S(e)?Ct((r,i)=>function be(n,e){return le((t,r)=>{let i=0;t.subscribe(ge(r,s=>{r.next(n.call(e,s,i++))}))})}((s,o)=>e(r,s,i,o))(Tn(n(r,i))),t):("number"==typeof e&&(t=e),le((r,i)=>function Nt(n,e,t,r,i,s,o,a){const u=[];let _=0,x=0,P=!1;const B=()=>{P&&!u.length&&!_&&e.complete()},U=X=>_<r?W(X):u.push(X),W=X=>{s&&e.next(X),_++;let re=!1;Tn(t(X,x++)).subscribe(ge(e,fe=>{i?.(fe),s?U(fe):e.next(fe)},()=>{re=!0},void 0,()=>{if(re)try{for(_--;u.length&&_<r;){const fe=u.shift();o?gt(e,o,()=>W(fe)):W(fe)}B()}catch(fe){e.error(fe)}}))};return n.subscribe(ge(e,U,()=>{P=!0,B()})),()=>{a?.()}}(r,i,n,t)))}const fn=new rn(n=>n.complete());function wo(n){return n[n.length-1]}function Q(n,e=0){return le((t,r)=>{t.subscribe(ge(r,i=>gt(r,n,()=>r.next(i),e),()=>gt(r,n,()=>r.complete(),e),i=>gt(r,n,()=>r.error(i),e)))})}function J(n,e=0){return le((t,r)=>{r.add(n.schedule(()=>t.subscribe(r),e))})}function Ke(n,e){if(!n)throw new Error("Iterable cannot be null");return new rn(t=>{gt(t,e,()=>{const r=n[Symbol.asyncIterator]();gt(t,e,()=>{r.next().then(i=>{i.done?t.complete():t.next(i.value)})},0,!0)})})}function Qr(...n){const e=function sa(n){return function ia(n){return n&&S(n.schedule)}(wo(n))?n.pop():void 0}(n),t=function z(n,e){return"number"==typeof wo(n)?n.pop():e}(n,1/0),r=n;return r.length?1===r.length?Tn(r[0]):function gn(n=1/0){return Ct(Ft,n)}(t)(function ai(n,e){return e?function lr(n,e){if(null!=n){if(Sr(n))return function ue(n,e){return Tn(n).pipe(J(e),Q(e))}(n,e);if(Rn(n))return function Oe(n,e){return new rn(t=>{let r=0;return e.schedule(function(){r===n.length?t.complete():(t.next(n[r++]),t.closed||this.schedule())})})}(n,e);if(Fr(n))return function Re(n,e){return Tn(n).pipe(J(e),Q(e))}(n,e);if(Pn(n))return Ke(n,e);if(me(n))return function We(n,e){return new rn(t=>{let r;return gt(t,e,()=>{r=n[ce](),gt(t,e,()=>{let i,s;try{({value:i,done:s}=r.next())}catch(o){return void t.error(o)}s?t.complete():t.next(i)},0,!0)}),()=>S(r?.return)&&r.return()})}(n,e);if(St(n))return function Qt(n,e){return Ke(ft(n),e)}(n,e)}throw $t(n)}(n,e):Tn(n)}(r,e)):fn}function So(n,e,...t){if(!0===e)return void n();if(!1===e)return;const r=new ve({next:()=>{r.unsubscribe(),n()}});return e(...t).subscribe(r)}function Kt(n){for(let e in n)if(n[e]===Kt)return e;throw Error("Could not find renamed property on target object.")}function cn(n){if("string"==typeof n)return n;if(Array.isArray(n))return"["+n.map(cn).join(", ")+"]";if(null==n)return""+n;if(n.overriddenName)return`${n.overriddenName}`;if(n.name)return`${n.name}`;const e=n.toString();if(null==e)return""+e;const t=e.indexOf("\n");return-1===t?e:e.substring(0,t)}function ki(n,e){return null==n||""===n?null===e?"":e:null==e||""===e?n:n+" "+e}const wu=Kt({__forward_ref__:Kt});function xp(n){return n.__forward_ref__=xp,n.toString=function(){return cn(this())},n}function bt(n){return function Ap(n){return"function"==typeof n&&n.hasOwnProperty(wu)&&n.__forward_ref__===xp}(n)?n():n}class mt extends Error{constructor(e,t){super(function vf(n,e){return`NG0${Math.abs(n)}${e?": "+e.trim():""}`}(e,t)),this.code=e}}function Dt(n){return"string"==typeof n?n:null==n?"":String(n)}function Ef(n,e){throw new mt(-201,!1)}function bi(n,e){null==n&&function yn(n,e,t,r){throw new Error(`ASSERTION ERROR: ${n}`+(null==r?"":` [Expected=> ${t} ${r} ${e} <=Actual]`))}(e,n,null,"!=")}function $n(n){return{token:n.token,providedIn:n.providedIn||null,factory:n.factory,value:void 0}}function Va(n){return{providers:n.providers||[],imports:n.imports||[]}}function _f(n){return N_(n,bf)||N_(n,O_)}function N_(n,e){return n.hasOwnProperty(e)?n[e]:null}function M_(n){return n&&(n.hasOwnProperty(Rp)||n.hasOwnProperty(BA))?n[Rp]:null}const bf=Kt({\u0275prov:Kt}),Rp=Kt({\u0275inj:Kt}),O_=Kt({ngInjectableDef:Kt}),BA=Kt({ngInjectorDef:Kt});var It=(()=>((It=It||{})[It.Default=0]="Default",It[It.Host=1]="Host",It[It.Self=2]="Self",It[It.SkipSelf=4]="SkipSelf",It[It.Optional=8]="Optional",It))();let Pp;function Li(n){const e=Pp;return Pp=n,e}function k_(n,e,t){const r=_f(n);return r&&"root"==r.providedIn?void 0===r.value?r.value=r.factory():r.value:t&It.Optional?null:void 0!==e?e:void Ef(cn(n))}function Io(n){return{toString:n}.toString()}var ss=(()=>((ss=ss||{})[ss.OnPush=0]="OnPush",ss[ss.Default=1]="Default",ss))(),Ds=(()=>{return(n=Ds||(Ds={}))[n.Emulated=0]="Emulated",n[n.None=2]="None",n[n.ShadowDom=3]="ShadowDom",Ds;var n})();const Ln=(()=>typeof globalThis<"u"&&globalThis||typeof global<"u"&&global||typeof window<"u"&&window||typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&self)(),Ha={},hn=[],wf=Kt({\u0275cmp:Kt}),Np=Kt({\u0275dir:Kt}),Mp=Kt({\u0275pipe:Kt}),L_=Kt({\u0275mod:Kt}),js=Kt({\u0275fac:Kt}),Su=Kt({__NG_ELEMENT_ID__:Kt});let UA=0;function Sf(n){return Io(()=>{const t=!0===n.standalone,r={},i={type:n.type,providersResolver:null,decls:n.decls,vars:n.vars,factory:null,template:n.template||null,consts:n.consts||null,ngContentSelectors:n.ngContentSelectors,hostBindings:n.hostBindings||null,hostVars:n.hostVars||0,hostAttrs:n.hostAttrs||null,contentQueries:n.contentQueries||null,declaredInputs:r,inputs:null,outputs:null,exportAs:n.exportAs||null,onPush:n.changeDetection===ss.OnPush,directiveDefs:null,pipeDefs:null,standalone:t,dependencies:t&&n.dependencies||null,getStandaloneInjector:null,selectors:n.selectors||hn,viewQuery:n.viewQuery||null,features:n.features||null,data:n.data||{},encapsulation:n.encapsulation||Ds.Emulated,id:"c"+UA++,styles:n.styles||hn,_:null,setInput:null,schemas:n.schemas||null,tView:null},s=n.dependencies,o=n.features;return i.inputs=U_(n.inputs,r),i.outputs=U_(n.outputs),o&&o.forEach(a=>a(i)),i.directiveDefs=s?()=>("function"==typeof s?s():s).map(B_).filter(F_):null,i.pipeDefs=s?()=>("function"==typeof s?s():s).map(Xr).filter(F_):null,i})}function B_(n){return bn(n)||Zr(n)}function F_(n){return null!==n}function Iu(n){return Io(()=>({type:n.type,bootstrap:n.bootstrap||hn,declarations:n.declarations||hn,imports:n.imports||hn,exports:n.exports||hn,transitiveCompileScopes:null,schemas:n.schemas||null,id:n.id||null}))}function U_(n,e){if(null==n)return Ha;const t={};for(const r in n)if(n.hasOwnProperty(r)){let i=n[r],s=i;Array.isArray(i)&&(s=i[1],i=i[0]),t[i]=r,e&&(e[i]=s)}return t}const Bi=Sf;function bn(n){return n[wf]||null}function Zr(n){return n[Np]||null}function Xr(n){return n[Mp]||null}function ui(n){return Array.isArray(n)&&"object"==typeof n[1]}function as(n){return Array.isArray(n)&&!0===n[1]}function Lp(n){return 0!=(8&n.flags)}function Df(n){return 2==(2&n.flags)}function xf(n){return 1==(1&n.flags)}function cs(n){return null!==n.template}function jA(n){return 0!=(256&n[2])}function la(n,e){return n.hasOwnProperty(js)?n[js]:null}class qA{constructor(e,t,r){this.previousValue=e,this.currentValue=t,this.firstChange=r}isFirstChange(){return this.firstChange}}function $_(n){return n.type.prototype.ngOnChanges&&(n.setInput=YA),QA}function QA(){const n=G_(this),e=n?.current;if(e){const t=n.previous;if(t===Ha)n.previous=e;else for(let r in e)t[r]=e[r];n.current=null,this.ngOnChanges(e)}}function YA(n,e,t,r){const i=G_(n)||function ZA(n,e){return n[K_]=e}(n,{previous:Ha,current:null}),s=i.current||(i.current={}),o=i.previous,a=this.declaredInputs[t],u=o[a];s[a]=new qA(u&&u.currentValue,e,o===Ha),n[r]=e}const K_="__ngSimpleChanges__";function G_(n){return n[K_]||null}function fr(n){for(;Array.isArray(n);)n=n[0];return n}function Ii(n,e){return fr(e[n.index])}function Hp(n,e){return n.data[e]}function Ti(n,e){const t=e[n];return ui(t)?t:t[0]}function Pf(n){return 64==(64&n[2])}function To(n,e){return null==e?null:n[e]}function j_(n){n[18]=0}function $p(n,e){n[5]+=e;let t=n,r=n[3];for(;null!==r&&(1===e&&1===t[5]||-1===e&&0===t[5]);)r[5]+=e,t=r,r=r[3]}const Tt={lFrame:tb(null),bindingsEnabled:!0};function W_(){return Tt.bindingsEnabled}function Ne(){return Tt.lFrame.lView}function tn(){return Tt.lFrame.tView}function Ir(){let n=q_();for(;null!==n&&64===n.type;)n=n.parent;return n}function q_(){return Tt.lFrame.currentTNode}function xs(n,e){const t=Tt.lFrame;t.currentTNode=n,t.isParent=e}function Kp(){return Tt.lFrame.isParent}function za(){return Tt.lFrame.bindingIndex++}function pR(n,e){const t=Tt.lFrame;t.bindingIndex=t.bindingRootIndex=n,jp(e)}function jp(n){Tt.lFrame.currentDirectiveIndex=n}function Wp(n){Tt.lFrame.currentQueryIndex=n}function yR(n){const e=n[1];return 2===e.type?e.declTNode:1===e.type?n[6]:null}function J_(n,e,t){if(t&It.SkipSelf){let i=e,s=n;for(;!(i=i.parent,null!==i||t&It.Host||(i=yR(s),null===i||(s=s[15],10&i.type))););if(null===i)return!1;e=i,n=s}const r=Tt.lFrame=eb();return r.currentTNode=e,r.lView=n,!0}function qp(n){const e=eb(),t=n[1];Tt.lFrame=e,e.currentTNode=t.firstChild,e.lView=n,e.tView=t,e.contextLView=n,e.bindingIndex=t.bindingStartIndex,e.inI18n=!1}function eb(){const n=Tt.lFrame,e=null===n?null:n.child;return null===e?tb(n):e}function tb(n){const e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:n,child:null,inI18n:!1};return null!==n&&(n.child=e),e}function nb(){const n=Tt.lFrame;return Tt.lFrame=n.parent,n.currentTNode=null,n.lView=null,n}const rb=nb;function Qp(){const n=nb();n.isParent=!0,n.tView=null,n.selectedIndex=-1,n.contextLView=null,n.elementDepthCount=0,n.currentDirectiveIndex=-1,n.currentNamespace=null,n.bindingRootIndex=-1,n.bindingIndex=-1,n.currentQueryIndex=0}function ei(){return Tt.lFrame.selectedIndex}function Co(n){Tt.lFrame.selectedIndex=n}function Nf(n,e){for(let t=e.directiveStart,r=e.directiveEnd;t<r;t++){const s=n.data[t].type.prototype,{ngAfterContentInit:o,ngAfterContentChecked:a,ngAfterViewInit:u,ngAfterViewChecked:_,ngOnDestroy:x}=s;o&&(n.contentHooks||(n.contentHooks=[])).push(-t,o),a&&((n.contentHooks||(n.contentHooks=[])).push(t,a),(n.contentCheckHooks||(n.contentCheckHooks=[])).push(t,a)),u&&(n.viewHooks||(n.viewHooks=[])).push(-t,u),_&&((n.viewHooks||(n.viewHooks=[])).push(t,_),(n.viewCheckHooks||(n.viewCheckHooks=[])).push(t,_)),null!=x&&(n.destroyHooks||(n.destroyHooks=[])).push(t,x)}}function Mf(n,e,t){ib(n,e,3,t)}function Of(n,e,t,r){(3&n[2])===t&&ib(n,e,t,r)}function Yp(n,e){let t=n[2];(3&t)===e&&(t&=2047,t+=1,n[2]=t)}function ib(n,e,t,r){const s=r??-1,o=e.length-1;let a=0;for(let u=void 0!==r?65535&n[18]:0;u<o;u++)if("number"==typeof e[u+1]){if(a=e[u],null!=r&&a>=r)break}else e[u]<0&&(n[18]+=65536),(a<s||-1==s)&&(TR(n,t,e,u),n[18]=(4294901760&n[18])+u+2),u++}function TR(n,e,t,r){const i=t[r]<0,s=t[r+1],a=n[i?-t[r]:t[r]];if(i){if(n[2]>>11<n[18]>>16&&(3&n[2])===e){n[2]+=2048;try{s.call(a)}finally{}}}else try{s.call(a)}finally{}}class Pu{constructor(e,t,r){this.factory=e,this.resolving=!1,this.canSeeViewProviders=t,this.injectImpl=r}}function kf(n,e,t){let r=0;for(;r<t.length;){const i=t[r];if("number"==typeof i){if(0!==i)break;r++;const s=t[r++],o=t[r++],a=t[r++];n.setAttribute(e,o,a,s)}else{const s=i,o=t[++r];ob(s)?n.setProperty(e,s,o):n.setAttribute(e,s,o),r++}}return r}function sb(n){return 3===n||4===n||6===n}function ob(n){return 64===n.charCodeAt(0)}function Lf(n,e){if(null!==e&&0!==e.length)if(null===n||0===n.length)n=e.slice();else{let t=-1;for(let r=0;r<e.length;r++){const i=e[r];"number"==typeof i?t=i:0===t||ab(n,t,i,null,-1===t||2===t?e[++r]:null)}}return n}function ab(n,e,t,r,i){let s=0,o=n.length;if(-1===e)o=-1;else for(;s<n.length;){const a=n[s++];if("number"==typeof a){if(a===e){o=-1;break}if(a>e){o=s-1;break}}}for(;s<n.length;){const a=n[s];if("number"==typeof a)break;if(a===t){if(null===r)return void(null!==i&&(n[s+1]=i));if(r===n[s+1])return void(n[s+2]=i)}s++,null!==r&&s++,null!==i&&s++}-1!==o&&(n.splice(o,0,e),s=o+1),n.splice(s++,0,t),null!==r&&n.splice(s++,0,r),null!==i&&n.splice(s++,0,i)}function cb(n){return-1!==n}function Wa(n){return 32767&n}function qa(n,e){let t=function RR(n){return n>>16}(n),r=e;for(;t>0;)r=r[15],t--;return r}let Xp=!0;function Bf(n){const e=Xp;return Xp=n,e}let PR=0;const As={};function Mu(n,e){const t=eg(n,e);if(-1!==t)return t;const r=e[1];r.firstCreatePass&&(n.injectorIndex=e.length,Jp(r.data,n),Jp(e,null),Jp(r.blueprint,null));const i=Ff(n,e),s=n.injectorIndex;if(cb(i)){const o=Wa(i),a=qa(i,e),u=a[1].data;for(let _=0;_<8;_++)e[s+_]=a[o+_]|u[o+_]}return e[s+8]=i,s}function Jp(n,e){n.push(0,0,0,0,0,0,0,0,e)}function eg(n,e){return-1===n.injectorIndex||n.parent&&n.parent.injectorIndex===n.injectorIndex||null===e[n.injectorIndex+8]?-1:n.injectorIndex}function Ff(n,e){if(n.parent&&-1!==n.parent.injectorIndex)return n.parent.injectorIndex;let t=0,r=null,i=e;for(;null!==i;){if(r=mb(i),null===r)return-1;if(t++,i=i[15],-1!==r.injectorIndex)return r.injectorIndex|t<<16}return-1}function Uf(n,e,t){!function NR(n,e,t){let r;"string"==typeof t?r=t.charCodeAt(0)||0:t.hasOwnProperty(Su)&&(r=t[Su]),null==r&&(r=t[Su]=PR++);const i=255&r;e.data[n+(i>>5)]|=1<<i}(n,e,t)}function fb(n,e,t){if(t&It.Optional||void 0!==n)return n;Ef()}function db(n,e,t,r){if(t&It.Optional&&void 0===r&&(r=null),0==(t&(It.Self|It.Host))){const i=n[9],s=Li(void 0);try{return i?i.get(e,r,t&It.Optional):k_(e,r,t&It.Optional)}finally{Li(s)}}return fb(r,0,t)}function hb(n,e,t,r=It.Default,i){if(null!==n){if(1024&e[2]){const o=function FR(n,e,t,r,i){let s=n,o=e;for(;null!==s&&null!==o&&1024&o[2]&&!(256&o[2]);){const a=pb(s,o,t,r|It.Self,As);if(a!==As)return a;let u=s.parent;if(!u){const _=o[21];if(_){const x=_.get(t,As,r);if(x!==As)return x}u=mb(o),o=o[15]}s=u}return i}(n,e,t,r,As);if(o!==As)return o}const s=pb(n,e,t,r,As);if(s!==As)return s}return db(e,t,r,i)}function pb(n,e,t,r,i){const s=function kR(n){if("string"==typeof n)return n.charCodeAt(0)||0;const e=n.hasOwnProperty(Su)?n[Su]:void 0;return"number"==typeof e?e>=0?255&e:LR:e}(t);if("function"==typeof s){if(!J_(e,n,r))return r&It.Host?fb(i,0,r):db(e,t,r,i);try{const o=s(r);if(null!=o||r&It.Optional)return o;Ef()}finally{rb()}}else if("number"==typeof s){let o=null,a=eg(n,e),u=-1,_=r&It.Host?e[16][6]:null;for((-1===a||r&It.SkipSelf)&&(u=-1===a?Ff(n,e):e[a+8],-1!==u&&yb(r,!1)?(o=e[1],a=Wa(u),e=qa(u,e)):a=-1);-1!==a;){const x=e[1];if(gb(s,a,x.data)){const P=OR(a,e,t,o,r,_);if(P!==As)return P}u=e[a+8],-1!==u&&yb(r,e[1].data[a+8]===_)&&gb(s,a,e)?(o=x,a=Wa(u),e=qa(u,e)):a=-1}}return i}function OR(n,e,t,r,i,s){const o=e[1],a=o.data[n+8],x=function Vf(n,e,t,r,i){const s=n.providerIndexes,o=e.data,a=1048575&s,u=n.directiveStart,x=s>>20,B=i?a+x:n.directiveEnd;for(let U=r?a:a+x;U<B;U++){const W=o[U];if(U<u&&t===W||U>=u&&W.type===t)return U}if(i){const U=o[u];if(U&&cs(U)&&U.type===t)return u}return null}(a,o,t,null==r?Df(a)&&Xp:r!=o&&0!=(3&a.type),i&It.Host&&s===a);return null!==x?Ou(e,o,x,a):As}function Ou(n,e,t,r){let i=n[t];const s=e.data;if(function CR(n){return n instanceof Pu}(i)){const o=i;o.resolving&&function RA(n,e){const t=e?`. Dependency path: ${e.join(" > ")} > ${n}`:"";throw new mt(-200,`Circular dependency in DI detected for ${n}${t}`)}(function dn(n){return"function"==typeof n?n.name||n.toString():"object"==typeof n&&null!=n&&"function"==typeof n.type?n.type.name||n.type.toString():Dt(n)}(s[t]));const a=Bf(o.canSeeViewProviders);o.resolving=!0;const u=o.injectImpl?Li(o.injectImpl):null;J_(n,r,It.Default);try{i=n[t]=o.factory(void 0,s,n,r),e.firstCreatePass&&t>=r.directiveStart&&function IR(n,e,t){const{ngOnChanges:r,ngOnInit:i,ngDoCheck:s}=e.type.prototype;if(r){const o=$_(e);(t.preOrderHooks||(t.preOrderHooks=[])).push(n,o),(t.preOrderCheckHooks||(t.preOrderCheckHooks=[])).push(n,o)}i&&(t.preOrderHooks||(t.preOrderHooks=[])).push(0-n,i),s&&((t.preOrderHooks||(t.preOrderHooks=[])).push(n,s),(t.preOrderCheckHooks||(t.preOrderCheckHooks=[])).push(n,s))}(t,s[t],e)}finally{null!==u&&Li(u),Bf(a),o.resolving=!1,rb()}}return i}function gb(n,e,t){return!!(t[e+(n>>5)]&1<<n)}function yb(n,e){return!(n&It.Self||n&It.Host&&e)}class Qa{constructor(e,t){this._tNode=e,this._lView=t}get(e,t,r){return hb(this._tNode,this._lView,e,r,t)}}function LR(){return new Qa(Ir(),Ne())}function mb(n){const e=n[1],t=e.type;return 2===t?e.declTNode:1===t?n[6]:null}const Za="__parameters__";function Ja(n,e,t){return Io(()=>{const r=function rg(n){return function(...t){if(n){const r=n(...t);for(const i in r)this[i]=r[i]}}}(e);function i(...s){if(this instanceof i)return r.apply(this,s),this;const o=new i(...s);return a.annotation=o,a;function a(u,_,x){const P=u.hasOwnProperty(Za)?u[Za]:Object.defineProperty(u,Za,{value:[]})[Za];for(;P.length<=x;)P.push(null);return(P[x]=P[x]||[]).push(o),u}}return t&&(i.prototype=Object.create(t.prototype)),i.prototype.ngMetadataName=n,i.annotationCls=i,i})}class Yt{constructor(e,t){this._desc=e,this.ngMetadataName="InjectionToken",this.\u0275prov=void 0,"number"==typeof t?this.__NG_ELEMENT_ID__=t:void 0!==t&&(this.\u0275prov=$n({token:this,providedIn:t.providedIn||"root",factory:t.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}}function qs(n,e){n.forEach(t=>Array.isArray(t)?qs(t,e):e(t))}function Eb(n,e,t){e>=n.length?n.push(t):n.splice(e,0,t)}function Hf(n,e){return e>=n.length-1?n.pop():n.splice(e,1)[0]}const Fu={},ag="__NG_DI_FLAG__",Kf="ngTempTokenPath",YR=/\n/gm,Sb="__source";let Uu;function tc(n){const e=Uu;return Uu=n,e}function XR(n,e=It.Default){if(void 0===Uu)throw new mt(-203,!1);return null===Uu?k_(n,void 0,e):Uu.get(n,e&It.Optional?null:void 0,e)}function mn(n,e=It.Default){return(function FA(){return Pp}()||XR)(bt(n),e)}function cg(n){const e=[];for(let t=0;t<n.length;t++){const r=bt(n[t]);if(Array.isArray(r)){if(0===r.length)throw new mt(900,!1);let i,s=It.Default;for(let o=0;o<r.length;o++){const a=r[o],u=eP(a);"number"==typeof u?-1===u?i=a.token:s|=u:i=a}e.push(mn(i,s))}else e.push(mn(r))}return e}function Vu(n,e){return n[ag]=e,n.prototype[ag]=e,n}function eP(n){return n[ag]}const Gf=Vu(Ja("Optional"),8),jf=Vu(Ja("SkipSelf"),4);var li=(()=>((li=li||{})[li.Important=1]="Important",li[li.DashCase=2]="DashCase",li))();const hg=new Map;let vP=0;const gg="__ngContext__";function Hr(n,e){ui(e)?(n[gg]=e[20],function _P(n){hg.set(n[20],n)}(e)):n[gg]=e}function mg(n,e){return undefined(n,e)}function Gu(n){const e=n[3];return as(e)?e[3]:e}function vg(n){return Gb(n[13])}function Eg(n){return Gb(n[4])}function Gb(n){for(;null!==n&&!as(n);)n=n[4];return n}function rc(n,e,t,r,i){if(null!=r){let s,o=!1;as(r)?s=r:ui(r)&&(o=!0,r=r[0]);const a=fr(r);0===n&&null!==t?null==i?Yb(e,t,a):fa(e,t,a,i||null,!0):1===n&&null!==t?fa(e,t,a,i||null,!0):2===n?function Cg(n,e,t){const r=qf(n,e);r&&function $P(n,e,t,r){n.removeChild(e,t,r)}(n,r,e,t)}(e,a,o):3===n&&e.destroyNode(a),null!=s&&function jP(n,e,t,r,i){const s=t[7];s!==fr(t)&&rc(e,n,r,s,i);for(let a=10;a<t.length;a++){const u=t[a];ju(u[1],u,n,e,r,s)}}(e,n,s,t,i)}}function bg(n,e,t){return n.createElement(e,t)}function zb(n,e){const t=n[9],r=t.indexOf(e),i=e[3];512&e[2]&&(e[2]&=-513,$p(i,-1)),t.splice(r,1)}function wg(n,e){if(n.length<=10)return;const t=10+e,r=n[t];if(r){const i=r[17];null!==i&&i!==n&&zb(i,r),e>0&&(n[t-1][4]=r[4]);const s=Hf(n,10+e);!function OP(n,e){ju(n,e,e[11],2,null,null),e[0]=null,e[6]=null}(r[1],r);const o=s[19];null!==o&&o.detachView(s[1]),r[3]=null,r[4]=null,r[2]&=-65}return r}function Wb(n,e){if(!(128&e[2])){const t=e[11];t.destroyNode&&ju(n,e,t,3,null,null),function BP(n){let e=n[13];if(!e)return Sg(n[1],n);for(;e;){let t=null;if(ui(e))t=e[13];else{const r=e[10];r&&(t=r)}if(!t){for(;e&&!e[4]&&e!==n;)ui(e)&&Sg(e[1],e),e=e[3];null===e&&(e=n),ui(e)&&Sg(e[1],e),t=e&&e[4]}e=t}}(e)}}function Sg(n,e){if(!(128&e[2])){e[2]&=-65,e[2]|=128,function HP(n,e){let t;if(null!=n&&null!=(t=n.destroyHooks))for(let r=0;r<t.length;r+=2){const i=e[t[r]];if(!(i instanceof Pu)){const s=t[r+1];if(Array.isArray(s))for(let o=0;o<s.length;o+=2){const a=i[s[o]],u=s[o+1];try{u.call(a)}finally{}}else try{s.call(i)}finally{}}}}(n,e),function VP(n,e){const t=n.cleanup,r=e[7];let i=-1;if(null!==t)for(let s=0;s<t.length-1;s+=2)if("string"==typeof t[s]){const o=t[s+1],a="function"==typeof o?o(e):fr(e[o]),u=r[i=t[s+2]],_=t[s+3];"boolean"==typeof _?a.removeEventListener(t[s],u,_):_>=0?r[i=_]():r[i=-_].unsubscribe(),s+=2}else{const o=r[i=t[s+1]];t[s].call(o)}if(null!==r){for(let s=i+1;s<r.length;s++)(0,r[s])();e[7]=null}}(n,e),1===e[1].type&&e[11].destroy();const t=e[17];if(null!==t&&as(e[3])){t!==e[3]&&zb(t,e);const r=e[19];null!==r&&r.detachView(n)}!function bP(n){hg.delete(n[20])}(e)}}function qb(n,e,t){return function Qb(n,e,t){let r=e;for(;null!==r&&40&r.type;)r=(e=r).parent;if(null===r)return t[0];if(2&r.flags){const i=n.data[r.directiveStart].encapsulation;if(i===Ds.None||i===Ds.Emulated)return null}return Ii(r,t)}(n,e.parent,t)}function fa(n,e,t,r,i){n.insertBefore(e,t,r,i)}function Yb(n,e,t){n.appendChild(e,t)}function Zb(n,e,t,r,i){null!==r?fa(n,e,t,r,i):Yb(n,e,t)}function qf(n,e){return n.parentNode(e)}let Rg,ew=function Jb(n,e,t){return 40&n.type?Ii(n,t):null};function Qf(n,e,t,r){const i=qb(n,r,e),s=e[11],a=function Xb(n,e,t){return ew(n,e,t)}(r.parent||e[6],r,e);if(null!=i)if(Array.isArray(t))for(let u=0;u<t.length;u++)Zb(s,i,t[u],a,!1);else Zb(s,i,t,a,!1)}function Yf(n,e){if(null!==e){const t=e.type;if(3&t)return Ii(e,n);if(4&t)return Tg(-1,n[e.index]);if(8&t){const r=e.child;if(null!==r)return Yf(n,r);{const i=n[e.index];return as(i)?Tg(-1,i):fr(i)}}if(32&t)return mg(e,n)()||fr(n[e.index]);{const r=nw(n,e);return null!==r?Array.isArray(r)?r[0]:Yf(Gu(n[16]),r):Yf(n,e.next)}}return null}function nw(n,e){return null!==e?n[16][6].projection[e.projection]:null}function Tg(n,e){const t=10+n+1;if(t<e.length){const r=e[t],i=r[1].firstChild;if(null!==i)return Yf(r,i)}return e[7]}function Dg(n,e,t,r,i,s,o){for(;null!=t;){const a=r[t.index],u=t.type;if(o&&0===e&&(a&&Hr(fr(a),r),t.flags|=4),64!=(64&t.flags))if(8&u)Dg(n,e,t.child,r,i,s,!1),rc(e,n,i,a,s);else if(32&u){const _=mg(t,r);let x;for(;x=_();)rc(e,n,i,x,s);rc(e,n,i,a,s)}else 16&u?rw(n,e,r,t,i,s):rc(e,n,i,a,s);t=o?t.projectionNext:t.next}}function ju(n,e,t,r,i,s){Dg(t,r,n.firstChild,e,i,s,!1)}function rw(n,e,t,r,i,s){const o=t[16],u=o[6].projection[r.projection];if(Array.isArray(u))for(let _=0;_<u.length;_++)rc(e,n,i,u[_],s);else Dg(n,e,u,o[3],i,s,!0)}function iw(n,e,t){n.setAttribute(e,"style",t)}function xg(n,e,t){""===t?n.removeAttribute(e,"class"):n.setAttribute(e,"class",t)}const vw=new Yt("ENVIRONMENT_INITIALIZER"),Ew=new Yt("INJECTOR",-1),_w=new Yt("INJECTOR_DEF_TYPES");class bw{get(e,t=Fu){if(t===Fu){const r=new Error(`NullInjectorError: No provider for ${cn(e)}!`);throw r.name="NullInjectorError",r}return t}}function _N(...n){return{\u0275providers:ww(0,n)}}function ww(n,...e){const t=[],r=new Set;let i;return qs(e,s=>{const o=s;Lg(o,t,[],r)&&(i||(i=[]),i.push(o))}),void 0!==i&&Sw(i,t),t}function Sw(n,e){for(let t=0;t<n.length;t++){const{providers:i}=n[t];qs(i,s=>{e.push(s)})}}function Lg(n,e,t,r){if(!(n=bt(n)))return!1;let i=null,s=M_(n);const o=!s&&bn(n);if(s||o){if(o&&!o.standalone)return!1;i=n}else{const u=n.ngModule;if(s=M_(u),!s)return!1;i=u}const a=r.has(i);if(o){if(a)return!1;if(r.add(i),o.dependencies){const u="function"==typeof o.dependencies?o.dependencies():o.dependencies;for(const _ of u)Lg(_,e,t,r)}}else{if(!s)return!1;{if(null!=s.imports&&!a){let _;r.add(i);try{qs(s.imports,x=>{Lg(x,e,t,r)&&(_||(_=[]),_.push(x))})}finally{}void 0!==_&&Sw(_,e)}if(!a){const _=la(i)||(()=>new i);e.push({provide:i,useFactory:_,deps:hn},{provide:_w,useValue:i,multi:!0},{provide:vw,useValue:()=>mn(i),multi:!0})}const u=s.providers;null==u||a||qs(u,x=>{e.push(x)})}}return i!==n&&void 0!==n.providers}const bN=Kt({provide:String,useValue:Kt});function Bg(n){return null!==n&&"object"==typeof n&&bN in n}function ha(n){return"function"==typeof n}const Fg=new Yt("Set Injector scope."),ed={},SN={};let Ug;function td(){return void 0===Ug&&(Ug=new bw),Ug}class ic{}class Cw extends ic{constructor(e,t,r,i){super(),this.parent=t,this.source=r,this.scopes=i,this.records=new Map,this._ngOnDestroyHooks=new Set,this._onDestroyHooks=[],this._destroyed=!1,Hg(e,o=>this.processProvider(o)),this.records.set(Ew,sc(void 0,this)),i.has("environment")&&this.records.set(ic,sc(void 0,this));const s=this.records.get(Fg);null!=s&&"string"==typeof s.value&&this.scopes.add(s.value),this.injectorDefTypes=new Set(this.get(_w.multi,hn,It.Self))}get destroyed(){return this._destroyed}destroy(){this.assertNotDestroyed(),this._destroyed=!0;try{for(const e of this._ngOnDestroyHooks)e.ngOnDestroy();for(const e of this._onDestroyHooks)e()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),this._onDestroyHooks.length=0}}onDestroy(e){this._onDestroyHooks.push(e)}runInContext(e){this.assertNotDestroyed();const t=tc(this),r=Li(void 0);try{return e()}finally{tc(t),Li(r)}}get(e,t=Fu,r=It.Default){this.assertNotDestroyed();const i=tc(this),s=Li(void 0);try{if(!(r&It.SkipSelf)){let a=this.records.get(e);if(void 0===a){const u=function xN(n){return"function"==typeof n||"object"==typeof n&&n instanceof Yt}(e)&&_f(e);a=u&&this.injectableDefInScope(u)?sc(Vg(e),ed):null,this.records.set(e,a)}if(null!=a)return this.hydrate(e,a)}return(r&It.Self?td():this.parent).get(e,t=r&It.Optional&&t===Fu?null:t)}catch(o){if("NullInjectorError"===o.name){if((o[Kf]=o[Kf]||[]).unshift(cn(e)),i)throw o;return function tP(n,e,t,r){const i=n[Kf];throw e[Sb]&&i.unshift(e[Sb]),n.message=function nP(n,e,t,r=null){n=n&&"\n"===n.charAt(0)&&"\u0275"==n.charAt(1)?n.slice(2):n;let i=cn(e);if(Array.isArray(e))i=e.map(cn).join(" -> ");else if("object"==typeof e){let s=[];for(let o in e)if(e.hasOwnProperty(o)){let a=e[o];s.push(o+":"+("string"==typeof a?JSON.stringify(a):cn(a)))}i=`{${s.join(", ")}}`}return`${t}${r?"("+r+")":""}[${i}]: ${n.replace(YR,"\n ")}`}("\n"+n.message,i,t,r),n.ngTokenPath=i,n[Kf]=null,n}(o,e,"R3InjectorError",this.source)}throw o}finally{Li(s),tc(i)}}resolveInjectorInitializers(){const e=tc(this),t=Li(void 0);try{const r=this.get(vw.multi,hn,It.Self);for(const i of r)i()}finally{tc(e),Li(t)}}toString(){const e=[],t=this.records;for(const r of t.keys())e.push(cn(r));return`R3Injector[${e.join(", ")}]`}assertNotDestroyed(){if(this._destroyed)throw new mt(205,!1)}processProvider(e){let t=ha(e=bt(e))?e:bt(e&&e.provide);const r=function TN(n){return Bg(n)?sc(void 0,n.useValue):sc(function Dw(n,e,t){let r;if(ha(n)){const i=bt(n);return la(i)||Vg(i)}if(Bg(n))r=()=>bt(n.useValue);else if(function Tw(n){return!(!n||!n.useFactory)}(n))r=()=>n.useFactory(...cg(n.deps||[]));else if(function Iw(n){return!(!n||!n.useExisting)}(n))r=()=>mn(bt(n.useExisting));else{const i=bt(n&&(n.useClass||n.provide));if(!function CN(n){return!!n.deps}(n))return la(i)||Vg(i);r=()=>new i(...cg(n.deps))}return r}(n),ed)}(e);if(ha(e)||!0!==e.multi)this.records.get(t);else{let i=this.records.get(t);i||(i=sc(void 0,ed,!0),i.factory=()=>cg(i.multi),this.records.set(t,i)),t=e,i.multi.push(e)}this.records.set(t,r)}hydrate(e,t){return t.value===ed&&(t.value=SN,t.value=t.factory()),"object"==typeof t.value&&t.value&&function DN(n){return null!==n&&"object"==typeof n&&"function"==typeof n.ngOnDestroy}(t.value)&&this._ngOnDestroyHooks.add(t.value),t.value}injectableDefInScope(e){if(!e.providedIn)return!1;const t=bt(e.providedIn);return"string"==typeof t?"any"===t||this.scopes.has(t):this.injectorDefTypes.has(t)}}function Vg(n){const e=_f(n),t=null!==e?e.factory:la(n);if(null!==t)return t;if(n instanceof Yt)throw new mt(204,!1);if(n instanceof Function)return function IN(n){const e=n.length;if(e>0)throw function Bu(n,e){const t=[];for(let r=0;r<n;r++)t.push(e);return t}(e,"?"),new mt(204,!1);const t=function kA(n){const e=n&&(n[bf]||n[O_]);if(e){const t=function LA(n){if(n.hasOwnProperty("name"))return n.name;const e=(""+n).match(/^function\s*([^\s(]+)/);return null===e?"":e[1]}(n);return console.warn(`DEPRECATED: DI is instantiating a token "${t}" that inherits its @Injectable decorator but does not provide one itself.\nThis will become an error in a future version of Angular. Please add @Injectable() to the "${t}" class.`),e}return null}(n);return null!==t?()=>t.factory(n):()=>new n}(n);throw new mt(204,!1)}function sc(n,e,t=!1){return{factory:n,value:e,multi:t?[]:void 0}}function AN(n){return!!n.\u0275providers}function Hg(n,e){for(const t of n)Array.isArray(t)?Hg(t,e):AN(t)?Hg(t.\u0275providers,e):e(t)}class xw{}class NN{resolveComponentFactory(e){throw function PN(n){const e=Error(`No component factory found for ${cn(n)}. Did you add it to @NgModule.entryComponents?`);return e.ngComponent=n,e}(e)}}let nd=(()=>{class n{}return n.NULL=new NN,n})();function MN(){return oc(Ir(),Ne())}function oc(n,e){return new ac(Ii(n,e))}let ac=(()=>{class n{constructor(t){this.nativeElement=t}}return n.__NG_ELEMENT_ID__=MN,n})();class Rw{}let LN=(()=>{class n{}return n.\u0275prov=$n({token:n,providedIn:"root",factory:()=>null}),n})();class $g{constructor(e){this.full=e,this.major=e.split(".")[0],this.minor=e.split(".")[1],this.patch=e.split(".").slice(2).join(".")}}const BN=new $g("14.2.12"),Kg={};function jg(n){return n.ngOriginalError}class cc{constructor(){this._console=console}handleError(e){const t=this._findOriginalError(e);this._console.error("ERROR",e),t&&this._console.error("ORIGINAL ERROR",t)}_findOriginalError(e){let t=e&&jg(e);for(;t&&jg(t);)t=jg(t);return t||null}}function Mw(n,e,t){let r=n.length;for(;;){const i=n.indexOf(e,t);if(-1===i)return i;if(0===i||n.charCodeAt(i-1)<=32){const s=e.length;if(i+s===r||n.charCodeAt(i+s)<=32)return i}t=i+1}}const Ow="ng-template";function qN(n,e,t){let r=0;for(;r<n.length;){let i=n[r++];if(t&&"class"===i){if(i=n[r],-1!==Mw(i.toLowerCase(),e,0))return!0}else if(1===i){for(;r<n.length&&"string"==typeof(i=n[r++]);)if(i.toLowerCase()===e)return!0;return!1}}return!1}function kw(n){return 4===n.type&&n.value!==Ow}function QN(n,e,t){return e===(4!==n.type||t?n.value:Ow)}function YN(n,e,t){let r=4;const i=n.attrs||[],s=function JN(n){for(let e=0;e<n.length;e++)if(sb(n[e]))return e;return n.length}(i);let o=!1;for(let a=0;a<e.length;a++){const u=e[a];if("number"!=typeof u){if(!o)if(4&r){if(r=2|1&r,""!==u&&!QN(n,u,t)||""===u&&1===e.length){if(us(r))return!1;o=!0}}else{const _=8&r?u:e[++a];if(8&r&&null!==n.attrs){if(!qN(n.attrs,_,t)){if(us(r))return!1;o=!0}continue}const P=ZN(8&r?"class":u,i,kw(n),t);if(-1===P){if(us(r))return!1;o=!0;continue}if(""!==_){let B;B=P>s?"":i[P+1].toLowerCase();const U=8&r?B:null;if(U&&-1!==Mw(U,_,0)||2&r&&_!==B){if(us(r))return!1;o=!0}}}}else{if(!o&&!us(r)&&!us(u))return!1;if(o&&us(u))continue;o=!1,r=u|1&r}}return us(r)||o}function us(n){return 0==(1&n)}function ZN(n,e,t,r){if(null===e)return-1;let i=0;if(r||!t){let s=!1;for(;i<e.length;){const o=e[i];if(o===n)return i;if(3===o||6===o)s=!0;else{if(1===o||2===o){let a=e[++i];for(;"string"==typeof a;)a=e[++i];continue}if(4===o)break;if(0===o){i+=4;continue}}i+=s?1:2}return-1}return function eM(n,e){let t=n.indexOf(4);if(t>-1)for(t++;t<n.length;){const r=n[t];if("number"==typeof r)return-1;if(r===e)return t;t++}return-1}(e,n)}function Lw(n,e,t=!1){for(let r=0;r<e.length;r++)if(YN(n,e[r],t))return!0;return!1}function Bw(n,e){return n?":not("+e.trim()+")":e}function nM(n){let e=n[0],t=1,r=2,i="",s=!1;for(;t<n.length;){let o=n[t];if("string"==typeof o)if(2&r){const a=n[++t];i+="["+o+(a.length>0?'="'+a+'"':"")+"]"}else 8&r?i+="."+o:4&r&&(i+=" "+o);else""!==i&&!us(o)&&(e+=Bw(s,i),i=""),r=o,s=s||!us(r);t++}return""!==i&&(e+=Bw(s,i)),e}const xt={};function Qu(n){Fw(tn(),Ne(),ei()+n,!1)}function Fw(n,e,t,r){if(!r)if(3==(3&e[2])){const s=n.preOrderCheckHooks;null!==s&&Mf(e,s,t)}else{const s=n.preOrderHooks;null!==s&&Of(e,s,0,t)}Co(t)}function $w(n,e=null,t=null,r){const i=Kw(n,e,t,r);return i.resolveInjectorInitializers(),i}function Kw(n,e=null,t=null,r,i=new Set){const s=[t||hn,_N(n)];return r=r||("object"==typeof n?void 0:cn(n)),new Cw(s,e||td(),r||null,i)}let pa=(()=>{class n{static create(t,r){if(Array.isArray(t))return $w({name:""},r,t,"");{const i=t.name??"";return $w({name:i},t.parent,t.providers,i)}}}return n.THROW_IF_NOT_FOUND=Fu,n.NULL=new bw,n.\u0275prov=$n({token:n,providedIn:"any",factory:()=>mn(Ew)}),n.__NG_ELEMENT_ID__=-1,n})();function Ut(n,e=It.Default){const t=Ne();return null===t?mn(n,e):hb(Ir(),t,bt(n),e)}function o1(n,e){const t=n.contentQueries;if(null!==t)for(let r=0;r<t.length;r+=2){const i=t[r],s=t[r+1];if(-1!==s){const o=n.data[s];Wp(i),o.contentQueries(2,e[s],s)}}}function ad(n,e,t,r,i,s,o,a,u,_,x){const P=e.blueprint.slice();return P[0]=i,P[2]=76|r,(null!==x||n&&1024&n[2])&&(P[2]|=1024),j_(P),P[3]=P[15]=n,P[8]=t,P[10]=o||n&&n[10],P[11]=a||n&&n[11],P[12]=u||n&&n[12]||null,P[9]=_||n&&n[9]||null,P[6]=s,P[20]=function EP(){return vP++}(),P[21]=x,P[16]=2==e.type?n[16]:P,P}function fc(n,e,t,r,i){let s=n.data[e];if(null===s)s=function a0(n,e,t,r,i){const s=q_(),o=Kp(),u=n.data[e]=function UM(n,e,t,r,i,s){return{type:t,index:r,insertBeforeIndex:null,injectorIndex:e?e.injectorIndex:-1,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,propertyBindings:null,flags:0,providerIndexes:0,value:i,attrs:s,mergedAttrs:null,localNames:null,initialInputs:void 0,inputs:null,outputs:null,tViews:null,next:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}(0,o?s:s&&s.parent,t,e,r,i);return null===n.firstChild&&(n.firstChild=u),null!==s&&(o?null==s.child&&null!==u.parent&&(s.child=u):null===s.next&&(s.next=u)),u}(n,e,t,r,i),function hR(){return Tt.lFrame.inI18n}()&&(s.flags|=64);else if(64&s.type){s.type=t,s.value=r,s.attrs=i;const o=function Ru(){const n=Tt.lFrame,e=n.currentTNode;return n.isParent?e:e.parent}();s.injectorIndex=null===o?-1:o.injectorIndex}return xs(s,!0),s}function dc(n,e,t,r){if(0===t)return-1;const i=e.length;for(let s=0;s<t;s++)e.push(r),n.blueprint.push(r),n.data.push(null);return i}function c0(n,e,t){qp(e);try{const r=n.viewQuery;null!==r&&y0(1,r,t);const i=n.template;null!==i&&a1(n,e,i,1,t),n.firstCreatePass&&(n.firstCreatePass=!1),n.staticContentQueries&&o1(n,e),n.staticViewQueries&&y0(2,n.viewQuery,t);const s=n.components;null!==s&&function LM(n,e){for(let t=0;t<e.length;t++)tO(n,e[t])}(e,s)}catch(r){throw n.firstCreatePass&&(n.incompleteFirstPass=!0,n.firstCreatePass=!1),r}finally{e[2]&=-5,Qp()}}function cd(n,e,t,r){const i=e[2];if(128!=(128&i)){qp(e);try{j_(e),function Y_(n){return Tt.lFrame.bindingIndex=n}(n.bindingStartIndex),null!==t&&a1(n,e,t,2,r);const o=3==(3&i);if(o){const _=n.preOrderCheckHooks;null!==_&&Mf(e,_,null)}else{const _=n.preOrderHooks;null!==_&&Of(e,_,0,null),Yp(e,0)}if(function JM(n){for(let e=vg(n);null!==e;e=Eg(e)){if(!e[2])continue;const t=e[9];for(let r=0;r<t.length;r++){const i=t[r],s=i[3];0==(512&i[2])&&$p(s,1),i[2]|=512}}}(e),function XM(n){for(let e=vg(n);null!==e;e=Eg(e))for(let t=10;t<e.length;t++){const r=e[t],i=r[1];Pf(r)&&cd(i,r,i.template,r[8])}}(e),null!==n.contentQueries&&o1(n,e),o){const _=n.contentCheckHooks;null!==_&&Mf(e,_)}else{const _=n.contentHooks;null!==_&&Of(e,_,1),Yp(e,1)}!function OM(n,e){const t=n.hostBindingOpCodes;if(null!==t)try{for(let r=0;r<t.length;r++){const i=t[r];if(i<0)Co(~i);else{const s=i,o=t[++r],a=t[++r];pR(o,s),a(2,e[s])}}}finally{Co(-1)}}(n,e);const a=n.components;null!==a&&function kM(n,e){for(let t=0;t<e.length;t++)eO(n,e[t])}(e,a);const u=n.viewQuery;if(null!==u&&y0(2,u,r),o){const _=n.viewCheckHooks;null!==_&&Mf(e,_)}else{const _=n.viewHooks;null!==_&&Of(e,_,2),Yp(e,2)}!0===n.firstUpdatePass&&(n.firstUpdatePass=!1),e[2]&=-41,512&e[2]&&(e[2]&=-513,$p(e[3],-1))}finally{Qp()}}}function a1(n,e,t,r,i){const s=ei(),o=2&r;try{Co(-1),o&&e.length>22&&Fw(n,e,22,!1),t(r,i)}finally{Co(s)}}function u0(n,e,t){!W_()||(function GM(n,e,t,r){const i=t.directiveStart,s=t.directiveEnd;n.firstCreatePass||Mu(t,e),Hr(r,e);const o=t.initialInputs;for(let a=i;a<s;a++){const u=n.data[a],_=cs(u);_&&QM(e,t,u);const x=Ou(e,n,a,t);Hr(x,e),null!==o&&YM(0,a-i,x,u,0,o),_&&(Ti(t.index,e)[8]=x)}}(n,e,t,Ii(t,e)),128==(128&t.flags)&&function jM(n,e,t){const r=t.directiveStart,i=t.directiveEnd,s=t.index,o=function gR(){return Tt.lFrame.currentDirectiveIndex}();try{Co(s);for(let a=r;a<i;a++){const u=n.data[a],_=e[a];jp(a),(null!==u.hostBindings||0!==u.hostVars||null!==u.hostAttrs)&&g1(u,_)}}finally{Co(-1),jp(o)}}(n,e,t))}function l0(n,e,t=Ii){const r=e.localNames;if(null!==r){let i=e.index+1;for(let s=0;s<r.length;s+=2){const o=r[s+1],a=-1===o?t(e,n):n[o];n[i++]=a}}}function u1(n){const e=n.tView;return null===e||e.incompleteFirstPass?n.tView=f0(1,null,n.template,n.decls,n.vars,n.directiveDefs,n.pipeDefs,n.viewQuery,n.schemas,n.consts):e}function f0(n,e,t,r,i,s,o,a,u,_){const x=22+r,P=x+i,B=function BM(n,e){const t=[];for(let r=0;r<e;r++)t.push(r<n?null:xt);return t}(x,P),U="function"==typeof _?_():_;return B[1]={type:n,blueprint:B,template:t,queries:null,viewQuery:a,declTNode:e,data:B.slice().fill(null,x),bindingStartIndex:x,expandoStartIndex:P,hostBindingOpCodes:null,firstCreatePass:!0,firstUpdatePass:!0,staticViewQueries:!1,staticContentQueries:!1,preOrderHooks:null,preOrderCheckHooks:null,contentHooks:null,contentCheckHooks:null,viewHooks:null,viewCheckHooks:null,destroyHooks:null,cleanup:null,contentQueries:null,components:null,directiveRegistry:"function"==typeof s?s():s,pipeRegistry:"function"==typeof o?o():o,firstChild:null,schemas:u,consts:U,incompleteFirstPass:!1}}function f1(n,e,t){for(let r in n)if(n.hasOwnProperty(r)){const i=n[r];(t=null===t?{}:t).hasOwnProperty(r)?t[r].push(e,i):t[r]=[e,i]}return t}function d1(n,e){const r=e.directiveEnd,i=n.data,s=e.attrs,o=[];let a=null,u=null;for(let _=e.directiveStart;_<r;_++){const x=i[_],P=x.inputs,B=null===s||kw(e)?null:ZM(P,s);o.push(B),a=f1(P,_,a),u=f1(x.outputs,_,u)}null!==a&&(a.hasOwnProperty("class")&&(e.flags|=16),a.hasOwnProperty("style")&&(e.flags|=32)),e.initialInputs=o,e.inputs=a,e.outputs=u}function h1(n,e){const t=Ti(e,n);16&t[2]||(t[2]|=32)}function d0(n,e,t,r){let i=!1;if(W_()){const s=function zM(n,e,t){const r=n.directiveRegistry;let i=null;if(r)for(let s=0;s<r.length;s++){const o=r[s];Lw(t,o.selectors,!1)&&(i||(i=[]),Uf(Mu(t,e),n,o.type),cs(o)?(y1(n,t),i.unshift(o)):i.push(o))}return i}(n,e,t),o=null===r?null:{"":-1};if(null!==s){i=!0,m1(t,n.data.length,s.length);for(let x=0;x<s.length;x++){const P=s[x];P.providersResolver&&P.providersResolver(P)}let a=!1,u=!1,_=dc(n,e,s.length,null);for(let x=0;x<s.length;x++){const P=s[x];t.mergedAttrs=Lf(t.mergedAttrs,P.hostAttrs),v1(n,t,e,_,P),qM(_,P,o),null!==P.contentQueries&&(t.flags|=8),(null!==P.hostBindings||null!==P.hostAttrs||0!==P.hostVars)&&(t.flags|=128);const B=P.type.prototype;!a&&(B.ngOnChanges||B.ngOnInit||B.ngDoCheck)&&((n.preOrderHooks||(n.preOrderHooks=[])).push(t.index),a=!0),!u&&(B.ngOnChanges||B.ngDoCheck)&&((n.preOrderCheckHooks||(n.preOrderCheckHooks=[])).push(t.index),u=!0),_++}d1(n,t)}o&&function WM(n,e,t){if(e){const r=n.localNames=[];for(let i=0;i<e.length;i+=2){const s=t[e[i+1]];if(null==s)throw new mt(-301,!1);r.push(e[i],s)}}}(t,r,o)}return t.mergedAttrs=Lf(t.mergedAttrs,t.attrs),i}function p1(n,e,t,r,i,s){const o=s.hostBindings;if(o){let a=n.hostBindingOpCodes;null===a&&(a=n.hostBindingOpCodes=[]);const u=~e.index;(function KM(n){let e=n.length;for(;e>0;){const t=n[--e];if("number"==typeof t&&t<0)return t}return 0})(a)!=u&&a.push(u),a.push(r,i,o)}}function g1(n,e){null!==n.hostBindings&&n.hostBindings(1,e)}function y1(n,e){e.flags|=2,(n.components||(n.components=[])).push(e.index)}function qM(n,e,t){if(t){if(e.exportAs)for(let r=0;r<e.exportAs.length;r++)t[e.exportAs[r]]=n;cs(e)&&(t[""]=n)}}function m1(n,e,t){n.flags|=1,n.directiveStart=e,n.directiveEnd=e+t,n.providerIndexes=e}function v1(n,e,t,r,i){n.data[r]=i;const s=i.factory||(i.factory=la(i.type)),o=new Pu(s,cs(i),Ut);n.blueprint[r]=o,t[r]=o,p1(n,e,0,r,dc(n,t,i.hostVars,xt),i)}function QM(n,e,t){const r=Ii(e,n),i=u1(t),s=n[10],o=ud(n,ad(n,i,null,t.onPush?32:16,r,e,s,s.createRenderer(r,t),null,null,null));n[e.index]=o}function YM(n,e,t,r,i,s){const o=s[e];if(null!==o){const a=r.setInput;for(let u=0;u<o.length;){const _=o[u++],x=o[u++],P=o[u++];null!==a?r.setInput(t,P,_,x):t[x]=P}}}function ZM(n,e){let t=null,r=0;for(;r<e.length;){const i=e[r];if(0!==i)if(5!==i){if("number"==typeof i)break;n.hasOwnProperty(i)&&(null===t&&(t=[]),t.push(i,n[i],e[r+1])),r+=2}else r+=2;else r+=4}return t}function E1(n,e,t,r){return new Array(n,!0,!1,e,null,0,r,t,null,null)}function eO(n,e){const t=Ti(e,n);if(Pf(t)){const r=t[1];48&t[2]?cd(r,t,r.template,t[8]):t[5]>0&&p0(t)}}function p0(n){for(let r=vg(n);null!==r;r=Eg(r))for(let i=10;i<r.length;i++){const s=r[i];if(Pf(s))if(512&s[2]){const o=s[1];cd(o,s,o.template,s[8])}else s[5]>0&&p0(s)}const t=n[1].components;if(null!==t)for(let r=0;r<t.length;r++){const i=Ti(t[r],n);Pf(i)&&i[5]>0&&p0(i)}}function tO(n,e){const t=Ti(e,n),r=t[1];(function nO(n,e){for(let t=e.length;t<n.blueprint.length;t++)e.push(n.blueprint[t])})(r,t),c0(r,t,t[8])}function ud(n,e){return n[13]?n[14][4]=e:n[13]=e,n[14]=e,e}function g0(n){for(;n;){n[2]|=32;const e=Gu(n);if(jA(n)&&!e)return n;n=e}return null}function ld(n,e,t,r=!0){const i=e[10];i.begin&&i.begin();try{cd(n,e,n.template,t)}catch(o){throw r&&S1(e,o),o}finally{i.end&&i.end()}}function y0(n,e,t){Wp(0),e(n,t)}function _1(n){return n[7]||(n[7]=[])}function b1(n){return n.cleanup||(n.cleanup=[])}function S1(n,e){const t=n[9],r=t?t.get(cc,null):null;r&&r.handleError(e)}function m0(n,e,t,r,i){for(let s=0;s<t.length;){const o=t[s++],a=t[s++],u=e[o],_=n.data[o];null!==_.setInput?_.setInput(u,i,r,a):u[a]=i}}function Xs(n,e,t){const r=function Rf(n,e){return fr(e[n])}(e,n);!function jb(n,e,t){n.setValue(e,t)}(n[11],r,t)}function fd(n,e,t){let r=t?n.styles:null,i=t?n.classes:null,s=0;if(null!==e)for(let o=0;o<e.length;o++){const a=e[o];"number"==typeof a?s=a:1==s?i=ki(i,a):2==s&&(r=ki(r,a+": "+e[++o]+";"))}t?n.styles=r:n.stylesWithoutHost=r,t?n.classes=i:n.classesWithoutHost=i}function dd(n,e,t,r,i=!1){for(;null!==t;){const s=e[t.index];if(null!==s&&r.push(fr(s)),as(s))for(let a=10;a<s.length;a++){const u=s[a],_=u[1].firstChild;null!==_&&dd(u[1],u,_,r)}const o=t.type;if(8&o)dd(n,e,t.child,r);else if(32&o){const a=mg(t,e);let u;for(;u=a();)r.push(u)}else if(16&o){const a=nw(e,t);if(Array.isArray(a))r.push(...a);else{const u=Gu(e[16]);dd(u[1],u,a,r,!0)}}t=i?t.projectionNext:t.next}return r}class Yu{constructor(e,t){this._lView=e,this._cdRefInjectingView=t,this._appRef=null,this._attachedToViewContainer=!1}get rootNodes(){const e=this._lView,t=e[1];return dd(t,e,t.firstChild,[])}get context(){return this._lView[8]}set context(e){this._lView[8]=e}get destroyed(){return 128==(128&this._lView[2])}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){const e=this._lView[3];if(as(e)){const t=e[8],r=t?t.indexOf(this):-1;r>-1&&(wg(e,r),Hf(t,r))}this._attachedToViewContainer=!1}Wb(this._lView[1],this._lView)}onDestroy(e){!function l1(n,e,t,r){const i=_1(e);null===t?i.push(r):(i.push(t),n.firstCreatePass&&b1(n).push(r,i.length-1))}(this._lView[1],this._lView,null,e)}markForCheck(){g0(this._cdRefInjectingView||this._lView)}detach(){this._lView[2]&=-65}reattach(){this._lView[2]|=64}detectChanges(){ld(this._lView[1],this._lView,this.context)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new mt(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null,function LP(n,e){ju(n,e,e[11],2,null,null)}(this._lView[1],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new mt(902,!1);this._appRef=e}}class rO extends Yu{constructor(e){super(e),this._view=e}detectChanges(){const e=this._view;ld(e[1],e,e[8],!1)}checkNoChanges(){}get context(){return null}}class v0 extends nd{constructor(e){super(),this.ngModule=e}resolveComponentFactory(e){const t=bn(e);return new Zu(t,this.ngModule)}}function I1(n){const e=[];for(let t in n)n.hasOwnProperty(t)&&e.push({propName:n[t],templateName:t});return e}class sO{constructor(e,t){this.injector=e,this.parentInjector=t}get(e,t,r){const i=this.injector.get(e,Kg,r);return i!==Kg||t===Kg?i:this.parentInjector.get(e,t,r)}}class Zu extends xw{constructor(e,t){super(),this.componentDef=e,this.ngModule=t,this.componentType=e.type,this.selector=function rM(n){return n.map(nM).join(",")}(e.selectors),this.ngContentSelectors=e.ngContentSelectors?e.ngContentSelectors:[],this.isBoundToModule=!!t}get inputs(){return I1(this.componentDef.inputs)}get outputs(){return I1(this.componentDef.outputs)}create(e,t,r,i){let s=(i=i||this.ngModule)instanceof ic?i:i?.injector;s&&null!==this.componentDef.getStandaloneInjector&&(s=this.componentDef.getStandaloneInjector(s)||s);const o=s?new sO(e,s):e,a=o.get(Rw,null);if(null===a)throw new mt(407,!1);const u=o.get(LN,null),_=a.createRenderer(null,this.componentDef),x=this.componentDef.selectors[0][0]||"div",P=r?function FM(n,e,t){return n.selectRootElement(e,t===Ds.ShadowDom)}(_,r,this.componentDef.encapsulation):bg(_,x,function iO(n){const e=n.toLowerCase();return"svg"===e?"svg":"math"===e?"math":null}(x)),B=this.componentDef.onPush?288:272,U=f0(0,null,null,1,0,null,null,null,null,null),W=ad(null,U,null,B,null,null,a,_,u,o,null);let X,re;qp(W);try{const fe=function cO(n,e,t,r,i,s){const o=t[1];t[22]=n;const u=fc(o,22,2,"#host",null),_=u.mergedAttrs=e.hostAttrs;null!==_&&(fd(u,_,!0),null!==n&&(kf(i,n,_),null!==u.classes&&xg(i,n,u.classes),null!==u.styles&&iw(i,n,u.styles)));const x=r.createRenderer(n,e),P=ad(t,u1(e),null,e.onPush?32:16,t[22],u,r,x,s||null,null,null);return o.firstCreatePass&&(Uf(Mu(u,t),o,e.type),y1(o,u),m1(u,t.length,1)),ud(t,P),t[22]=P}(P,this.componentDef,W,a,_);if(P)if(r)kf(_,P,["ng-version",BN.full]);else{const{attrs:Ie,classes:ae}=function iM(n){const e=[],t=[];let r=1,i=2;for(;r<n.length;){let s=n[r];if("string"==typeof s)2===i?""!==s&&e.push(s,n[++r]):8===i&&t.push(s);else{if(!us(i))break;i=s}r++}return{attrs:e,classes:t}}(this.componentDef.selectors[0]);Ie&&kf(_,P,Ie),ae&&ae.length>0&&xg(_,P,ae.join(" "))}if(re=Hp(U,22),void 0!==t){const Ie=re.projection=[];for(let ae=0;ae<this.ngContentSelectors.length;ae++){const Ce=t[ae];Ie.push(null!=Ce?Array.from(Ce):null)}}X=function uO(n,e,t,r){const i=t[1],s=function $M(n,e,t){const r=Ir();n.firstCreatePass&&(t.providersResolver&&t.providersResolver(t),v1(n,r,e,dc(n,e,1,null),t),d1(n,r));const i=Ou(e,n,r.directiveStart,r);Hr(i,e);const s=Ii(r,e);return s&&Hr(s,e),i}(i,t,e);if(n[8]=t[8]=s,null!==r)for(const a of r)a(s,e);if(e.contentQueries){const a=Ir();e.contentQueries(1,s,a.directiveStart)}const o=Ir();return!i.firstCreatePass||null===e.hostBindings&&null===e.hostAttrs||(Co(o.index),p1(t[1],o,0,o.directiveStart,o.directiveEnd,e),g1(e,s)),s}(fe,this.componentDef,W,[lO]),c0(U,W,null)}finally{Qp()}return new aO(this.componentType,X,oc(re,W),W,re)}}class aO extends class RN{}{constructor(e,t,r,i,s){super(),this.location=r,this._rootLView=i,this._tNode=s,this.instance=t,this.hostView=this.changeDetectorRef=new rO(i),this.componentType=e}setInput(e,t){const r=this._tNode.inputs;let i;if(null!==r&&(i=r[e])){const s=this._rootLView;m0(s[1],s,i,e,t),h1(s,this._tNode.index)}}get injector(){return new Qa(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(e){this.hostView.onDestroy(e)}}function lO(){const n=Ir();Nf(Ne()[1],n)}let hd=null;function ga(){if(!hd){const n=Ln.Symbol;if(n&&n.iterator)hd=n.iterator;else{const e=Object.getOwnPropertyNames(Map.prototype);for(let t=0;t<e.length;++t){const r=e[t];"entries"!==r&&"size"!==r&&Map.prototype[r]===Map.prototype.entries&&(hd=r)}}}return hd}function Xu(n){return!!function _0(n){return null!==n&&("function"==typeof n||"object"==typeof n)}(n)&&(Array.isArray(n)||!(n instanceof Map)&&ga()in n)}function $r(n,e,t){return!Object.is(n[e],t)&&(n[e]=t,!0)}function gc(n,e,t,r,i,s){const a=function ya(n,e,t,r){const i=$r(n,e,t);return $r(n,e+1,r)||i}(n,function zs(){return Tt.lFrame.bindingIndex}(),t,i);return function Ws(n){const e=Tt.lFrame,t=e.bindingIndex;return e.bindingIndex=e.bindingIndex+n,t}(2),a?e+Dt(t)+r+Dt(i)+s:xt}function gd(n,e,t){const r=Ne();return $r(r,za(),e)&&function xi(n,e,t,r,i,s,o,a){const u=Ii(e,t);let x,_=e.inputs;!a&&null!=_&&(x=_[r])?(m0(n,t,x,r,i),Df(e)&&h1(t,e.index)):3&e.type&&(r=function VM(n){return"class"===n?"className":"for"===n?"htmlFor":"formaction"===n?"formAction":"innerHtml"===n?"innerHTML":"readonly"===n?"readOnly":"tabindex"===n?"tabIndex":n}(r),i=null!=o?o(i,e.value||"",r):i,s.setProperty(u,r,i))}(tn(),function qn(){const n=Tt.lFrame;return Hp(n.tView,n.selectedIndex)}(),r,n,e,r[11],t,!1),gd}function b0(n,e,t,r,i){const o=i?"class":"style";m0(n,t,e.inputs[o],o,r)}function Js(n,e,t,r){const i=Ne(),s=tn(),o=22+n,a=i[11],u=i[o]=bg(a,e,function SR(){return Tt.lFrame.currentNamespace}()),_=s.firstCreatePass?function TO(n,e,t,r,i,s,o){const a=e.consts,_=fc(e,n,2,i,To(a,s));return d0(e,t,_,To(a,o)),null!==_.attrs&&fd(_,_.attrs,!1),null!==_.mergedAttrs&&fd(_,_.mergedAttrs,!0),null!==e.queries&&e.queries.elementStart(e,_),_}(o,s,i,0,e,t,r):s.data[o];xs(_,!0);const x=_.mergedAttrs;null!==x&&kf(a,u,x);const P=_.classes;null!==P&&xg(a,u,P);const B=_.styles;return null!==B&&iw(a,u,B),64!=(64&_.flags)&&Qf(s,i,u,_),0===function sR(){return Tt.lFrame.elementDepthCount}()&&Hr(u,i),function oR(){Tt.lFrame.elementDepthCount++}(),xf(_)&&(u0(s,i,_),function c1(n,e,t){if(Lp(e)){const i=e.directiveEnd;for(let s=e.directiveStart;s<i;s++){const o=n.data[s];o.contentQueries&&o.contentQueries(1,t[s],s)}}}(s,_,i)),null!==r&&l0(i,_),Js}function eo(){let n=Ir();Kp()?function Gp(){Tt.lFrame.isParent=!1}():(n=n.parent,xs(n,!1));const e=n;!function aR(){Tt.lFrame.elementDepthCount--}();const t=tn();return t.firstCreatePass&&(Nf(t,n),Lp(n)&&t.queries.elementEnd(n)),null!=e.classesWithoutHost&&function xR(n){return 0!=(16&n.flags)}(e)&&b0(t,e,Ne(),e.classesWithoutHost,!0),null!=e.stylesWithoutHost&&function AR(n){return 0!=(32&n.flags)}(e)&&b0(t,e,Ne(),e.stylesWithoutHost,!1),eo}function w0(n,e,t,r){return Js(n,e,t,r),eo(),w0}function T0(n){return!!n&&"function"==typeof n.then}const xO=function U1(n){return!!n&&"function"==typeof n.subscribe};function C0(n,e,t,r){const i=Ne(),s=tn(),o=Ir();return function H1(n,e,t,r,i,s,o,a){const u=xf(r),x=n.firstCreatePass&&b1(n),P=e[8],B=_1(e);let U=!0;if(3&r.type||a){const re=Ii(r,e),fe=a?a(re):re,Ie=B.length,ae=a?Ue=>a(fr(Ue[r.index])):r.index;let Ce=null;if(!a&&u&&(Ce=function AO(n,e,t,r){const i=n.cleanup;if(null!=i)for(let s=0;s<i.length-1;s+=2){const o=i[s];if(o===t&&i[s+1]===r){const a=e[7],u=i[s+2];return a.length>u?a[u]:null}"string"==typeof o&&(s+=2)}return null}(n,e,i,r.index)),null!==Ce)(Ce.__ngLastListenerFn__||Ce).__ngNextListenerFn__=s,Ce.__ngLastListenerFn__=s,U=!1;else{s=K1(r,e,P,s,!1);const Ue=t.listen(fe,i,s);B.push(s,Ue),x&&x.push(i,ae,Ie,Ie+1)}}else s=K1(r,e,P,s,!1);const W=r.outputs;let X;if(U&&null!==W&&(X=W[i])){const re=X.length;if(re)for(let fe=0;fe<re;fe+=2){const xe=e[X[fe]][X[fe+1]].subscribe(s),ht=B.length;B.push(s,xe),x&&x.push(i,r.index,ht,-(ht+1))}}}(s,i,i[11],o,n,e,0,r),C0}function $1(n,e,t,r){try{return!1!==t(r)}catch(i){return S1(n,i),!1}}function K1(n,e,t,r,i){return function s(o){if(o===Function)return r;g0(2&n.flags?Ti(n.index,e):e);let u=$1(e,0,r,o),_=s.__ngNextListenerFn__;for(;_;)u=$1(e,0,_,o)&&u,_=_.__ngNextListenerFn__;return i&&!1===u&&(o.preventDefault(),o.returnValue=!1),u}}function Sc(n,e=""){const t=Ne(),r=tn(),i=n+22,s=r.firstCreatePass?fc(r,i,1,e,null):r.data[i],o=t[i]=function _g(n,e){return n.createText(e)}(t[11],e);Qf(r,t,o,s),xs(s,!1)}function A0(n){return md("",n,""),A0}function md(n,e,t){const r=Ne(),i=function pc(n,e,t,r){return $r(n,za(),t)?e+Dt(t)+r:xt}(r,n,e,t);return i!==xt&&Xs(r,ei(),i),md}function R0(n,e,t,r,i){const s=Ne(),o=gc(s,n,e,t,r,i);return o!==xt&&Xs(s,ei(),o),R0}const Tc="en-US";let OS=Tc;class Cc{}class oI extends Cc{constructor(e,t){super(),this._parent=t,this._bootstrapComponents=[],this.destroyCbs=[],this.componentFactoryResolver=new v0(this);const r=function wi(n,e){const t=n[L_]||null;if(!t&&!0===e)throw new Error(`Type ${cn(n)} does not have '\u0275mod' property.`);return t}(e);this._bootstrapComponents=function Ys(n){return n instanceof Function?n():n}(r.bootstrap),this._r3Injector=Kw(e,t,[{provide:Cc,useValue:this},{provide:nd,useValue:this.componentFactoryResolver}],cn(e),new Set(["environment"])),this._r3Injector.resolveInjectorInitializers(),this.instance=this._r3Injector.get(e)}get injector(){return this._r3Injector}destroy(){const e=this._r3Injector;!e.destroyed&&e.destroy(),this.destroyCbs.forEach(t=>t()),this.destroyCbs=null}onDestroy(e){this.destroyCbs.push(e)}}class B0 extends class mL{}{constructor(e){super(),this.moduleType=e}create(e){return new oI(this.moduleType,e)}}function U0(n){return e=>{setTimeout(n,void 0,e)}}const to=class WL extends qr{constructor(e=!1){super(),this.__isAsync=e}emit(e){super.next(e)}subscribe(e,t,r){let i=e,s=t||(()=>null),o=r;if(e&&"object"==typeof e){const u=e;i=u.next?.bind(u),s=u.error?.bind(u),o=u.complete?.bind(u)}this.__isAsync&&(s=U0(s),i&&(i=U0(i)),o&&(o=U0(o)));const a=super.subscribe({next:i,error:s,complete:o});return e instanceof F&&e.add(a),a}};let no=(()=>{class n{}return n.__NG_ELEMENT_ID__=ZL,n})();const QL=no,YL=class extends QL{constructor(e,t,r){super(),this._declarationLView=e,this._declarationTContainer=t,this.elementRef=r}createEmbeddedView(e,t){const r=this._declarationTContainer.tViews,i=ad(this._declarationLView,r,e,16,null,r.declTNode,null,null,null,null,t||null);i[17]=this._declarationLView[this._declarationTContainer.index];const o=this._declarationLView[19];return null!==o&&(i[19]=o.createEmbeddedView(r)),c0(r,i,e),new Yu(i)}};function ZL(){return function wd(n,e){return 4&n.type?new YL(e,n,oc(n,e)):null}(Ir(),Ne())}let Os=(()=>{class n{}return n.__NG_ELEMENT_ID__=XL,n})();function XL(){return function bI(n,e){let t;const r=e[n.index];if(as(r))t=r;else{let i;if(8&n.type)i=fr(r);else{const s=e[11];i=s.createComment("");const o=Ii(n,e);fa(s,qf(s,o),i,function KP(n,e){return n.nextSibling(e)}(s,o),!1)}e[n.index]=t=E1(r,e,i,n),ud(e,t)}return new EI(t,n,e)}(Ir(),Ne())}const JL=Os,EI=class extends JL{constructor(e,t,r){super(),this._lContainer=e,this._hostTNode=t,this._hostLView=r}get element(){return oc(this._hostTNode,this._hostLView)}get injector(){return new Qa(this._hostTNode,this._hostLView)}get parentInjector(){const e=Ff(this._hostTNode,this._hostLView);if(cb(e)){const t=qa(e,this._hostLView),r=Wa(e);return new Qa(t[1].data[r+8],t)}return new Qa(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(e){const t=_I(this._lContainer);return null!==t&&t[e]||null}get length(){return this._lContainer.length-10}createEmbeddedView(e,t,r){let i,s;"number"==typeof r?i=r:null!=r&&(i=r.index,s=r.injector);const o=e.createEmbeddedView(t||{},s);return this.insert(o,i),o}createComponent(e,t,r,i,s){const o=e&&!function Lu(n){return"function"==typeof n}(e);let a;if(o)a=t;else{const P=t||{};a=P.index,r=P.injector,i=P.projectableNodes,s=P.environmentInjector||P.ngModuleRef}const u=o?e:new Zu(bn(e)),_=r||this.parentInjector;if(!s&&null==u.ngModule){const B=(o?_:this.parentInjector).get(ic,null);B&&(s=B)}const x=u.create(_,i,void 0,s);return this.insert(x.hostView,a),x}insert(e,t){const r=e._lView,i=r[1];if(function iR(n){return as(n[3])}(r)){const x=this.indexOf(e);if(-1!==x)this.detach(x);else{const P=r[3],B=new EI(P,P[6],P[3]);B.detach(B.indexOf(e))}}const s=this._adjustIndex(t),o=this._lContainer;!function FP(n,e,t,r){const i=10+r,s=t.length;r>0&&(t[i-1][4]=e),r<s-10?(e[4]=t[i],Eb(t,10+r,e)):(t.push(e),e[4]=null),e[3]=t;const o=e[17];null!==o&&t!==o&&function UP(n,e){const t=n[9];e[16]!==e[3][3][16]&&(n[2]=!0),null===t?n[9]=[e]:t.push(e)}(o,e);const a=e[19];null!==a&&a.insertView(n),e[2]|=64}(i,r,o,s);const a=Tg(s,o),u=r[11],_=qf(u,o[7]);return null!==_&&function kP(n,e,t,r,i,s){r[0]=i,r[6]=e,ju(n,r,t,1,i,s)}(i,o[6],u,r,_,a),e.attachToViewContainerRef(),Eb(H0(o),s,e),e}move(e,t){return this.insert(e,t)}indexOf(e){const t=_I(this._lContainer);return null!==t?t.indexOf(e):-1}remove(e){const t=this._adjustIndex(e,-1),r=wg(this._lContainer,t);r&&(Hf(H0(this._lContainer),t),Wb(r[1],r))}detach(e){const t=this._adjustIndex(e,-1),r=wg(this._lContainer,t);return r&&null!=Hf(H0(this._lContainer),t)?new Yu(r):null}_adjustIndex(e,t=0){return e??this.length+t}};function _I(n){return n[8]}function H0(n){return n[8]||(n[8]=[])}function Id(...n){}const jI=new Yt("Application Initializer");let Td=(()=>{class n{constructor(t){this.appInits=t,this.resolve=Id,this.reject=Id,this.initialized=!1,this.done=!1,this.donePromise=new Promise((r,i)=>{this.resolve=r,this.reject=i})}runInitializers(){if(this.initialized)return;const t=[],r=()=>{this.done=!0,this.resolve()};if(this.appInits)for(let i=0;i<this.appInits.length;i++){const s=this.appInits[i]();if(T0(s))t.push(s);else if(xO(s)){const o=new Promise((a,u)=>{s.subscribe({complete:a,error:u})});t.push(o)}}Promise.all(t).then(()=>{r()}).catch(i=>{this.reject(i)}),0===t.length&&r(),this.initialized=!0}}return n.\u0275fac=function(t){return new(t||n)(mn(jI,8))},n.\u0275prov=$n({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();const ul=new Yt("AppId",{providedIn:"root",factory:function zI(){return`${Z0()}${Z0()}${Z0()}`}});function Z0(){return String.fromCharCode(97+Math.floor(25*Math.random()))}const WI=new Yt("Platform Initializer"),qI=new Yt("Platform ID",{providedIn:"platform",factory:()=>"unknown"}),N3=new Yt("appBootstrapListener"),ro=new Yt("LocaleId",{providedIn:"root",factory:()=>function JR(n,e=It.Default){return"number"!=typeof e&&(e=0|(e.optional&&8)|(e.host&&1)|(e.self&&2)|(e.skipSelf&&4)),mn(n,e)}(ro,It.Optional|It.SkipSelf)||function M3(){return typeof $localize<"u"&&$localize.locale||Tc}()}),F3=(()=>Promise.resolve(0))();function X0(n){typeof Zone>"u"?F3.then(()=>{n&&n.apply(null,null)}):Zone.current.scheduleMicroTask("scheduleMicrotask",n)}class Kr{constructor({enableLongStackTrace:e=!1,shouldCoalesceEventChangeDetection:t=!1,shouldCoalesceRunChangeDetection:r=!1}){if(this.hasPendingMacrotasks=!1,this.hasPendingMicrotasks=!1,this.isStable=!0,this.onUnstable=new to(!1),this.onMicrotaskEmpty=new to(!1),this.onStable=new to(!1),this.onError=new to(!1),typeof Zone>"u")throw new mt(908,!1);Zone.assertZonePatched();const i=this;if(i._nesting=0,i._outer=i._inner=Zone.current,Zone.AsyncStackTaggingZoneSpec){const s=Zone.AsyncStackTaggingZoneSpec;i._inner=i._inner.fork(new s("Angular"))}Zone.TaskTrackingZoneSpec&&(i._inner=i._inner.fork(new Zone.TaskTrackingZoneSpec)),e&&Zone.longStackTraceZoneSpec&&(i._inner=i._inner.fork(Zone.longStackTraceZoneSpec)),i.shouldCoalesceEventChangeDetection=!r&&t,i.shouldCoalesceRunChangeDetection=r,i.lastRequestAnimationFrameId=-1,i.nativeRequestAnimationFrame=function U3(){let n=Ln.requestAnimationFrame,e=Ln.cancelAnimationFrame;if(typeof Zone<"u"&&n&&e){const t=n[Zone.__symbol__("OriginalDelegate")];t&&(n=t);const r=e[Zone.__symbol__("OriginalDelegate")];r&&(e=r)}return{nativeRequestAnimationFrame:n,nativeCancelAnimationFrame:e}}().nativeRequestAnimationFrame,function $3(n){const e=()=>{!function H3(n){n.isCheckStableRunning||-1!==n.lastRequestAnimationFrameId||(n.lastRequestAnimationFrameId=n.nativeRequestAnimationFrame.call(Ln,()=>{n.fakeTopEventTask||(n.fakeTopEventTask=Zone.root.scheduleEventTask("fakeTopEventTask",()=>{n.lastRequestAnimationFrameId=-1,ey(n),n.isCheckStableRunning=!0,J0(n),n.isCheckStableRunning=!1},void 0,()=>{},()=>{})),n.fakeTopEventTask.invoke()}),ey(n))}(n)};n._inner=n._inner.fork({name:"angular",properties:{isAngularZone:!0},onInvokeTask:(t,r,i,s,o,a)=>{try{return ZI(n),t.invokeTask(i,s,o,a)}finally{(n.shouldCoalesceEventChangeDetection&&"eventTask"===s.type||n.shouldCoalesceRunChangeDetection)&&e(),XI(n)}},onInvoke:(t,r,i,s,o,a,u)=>{try{return ZI(n),t.invoke(i,s,o,a,u)}finally{n.shouldCoalesceRunChangeDetection&&e(),XI(n)}},onHasTask:(t,r,i,s)=>{t.hasTask(i,s),r===i&&("microTask"==s.change?(n._hasPendingMicrotasks=s.microTask,ey(n),J0(n)):"macroTask"==s.change&&(n.hasPendingMacrotasks=s.macroTask))},onHandleError:(t,r,i,s)=>(t.handleError(i,s),n.runOutsideAngular(()=>n.onError.emit(s)),!1)})}(i)}static isInAngularZone(){return typeof Zone<"u"&&!0===Zone.current.get("isAngularZone")}static assertInAngularZone(){if(!Kr.isInAngularZone())throw new mt(909,!1)}static assertNotInAngularZone(){if(Kr.isInAngularZone())throw new mt(909,!1)}run(e,t,r){return this._inner.run(e,t,r)}runTask(e,t,r,i){const s=this._inner,o=s.scheduleEventTask("NgZoneEvent: "+i,e,V3,Id,Id);try{return s.runTask(o,t,r)}finally{s.cancelTask(o)}}runGuarded(e,t,r){return this._inner.runGuarded(e,t,r)}runOutsideAngular(e){return this._outer.run(e)}}const V3={};function J0(n){if(0==n._nesting&&!n.hasPendingMicrotasks&&!n.isStable)try{n._nesting++,n.onMicrotaskEmpty.emit(null)}finally{if(n._nesting--,!n.hasPendingMicrotasks)try{n.runOutsideAngular(()=>n.onStable.emit(null))}finally{n.isStable=!0}}}function ey(n){n.hasPendingMicrotasks=!!(n._hasPendingMicrotasks||(n.shouldCoalesceEventChangeDetection||n.shouldCoalesceRunChangeDetection)&&-1!==n.lastRequestAnimationFrameId)}function ZI(n){n._nesting++,n.isStable&&(n.isStable=!1,n.onUnstable.emit(null))}function XI(n){n._nesting--,J0(n)}class K3{constructor(){this.hasPendingMicrotasks=!1,this.hasPendingMacrotasks=!1,this.isStable=!0,this.onUnstable=new to,this.onMicrotaskEmpty=new to,this.onStable=new to,this.onError=new to}run(e,t,r){return e.apply(t,r)}runGuarded(e,t,r){return e.apply(t,r)}runOutsideAngular(e){return e()}runTask(e,t,r,i){return e.apply(t,r)}}const JI=new Yt(""),Cd=new Yt("");let ry,ty=(()=>{class n{constructor(t,r,i){this._ngZone=t,this.registry=r,this._pendingCount=0,this._isZoneStable=!0,this._didWork=!1,this._callbacks=[],this.taskTrackingZone=null,ry||(function G3(n){ry=n}(i),i.addToWindow(r)),this._watchAngularEvents(),t.run(()=>{this.taskTrackingZone=typeof Zone>"u"?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){this._ngZone.onUnstable.subscribe({next:()=>{this._didWork=!0,this._isZoneStable=!1}}),this._ngZone.runOutsideAngular(()=>{this._ngZone.onStable.subscribe({next:()=>{Kr.assertNotInAngularZone(),X0(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}})})}increasePendingRequestCount(){return this._pendingCount+=1,this._didWork=!0,this._pendingCount}decreasePendingRequestCount(){if(this._pendingCount-=1,this._pendingCount<0)throw new Error("pending async requests below zero");return this._runCallbacksIfReady(),this._pendingCount}isStable(){return this._isZoneStable&&0===this._pendingCount&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())X0(()=>{for(;0!==this._callbacks.length;){let t=this._callbacks.pop();clearTimeout(t.timeoutId),t.doneCb(this._didWork)}this._didWork=!1});else{let t=this.getPendingTasks();this._callbacks=this._callbacks.filter(r=>!r.updateCb||!r.updateCb(t)||(clearTimeout(r.timeoutId),!1)),this._didWork=!0}}getPendingTasks(){return this.taskTrackingZone?this.taskTrackingZone.macroTasks.map(t=>({source:t.source,creationLocation:t.creationLocation,data:t.data})):[]}addCallback(t,r,i){let s=-1;r&&r>0&&(s=setTimeout(()=>{this._callbacks=this._callbacks.filter(o=>o.timeoutId!==s),t(this._didWork,this.getPendingTasks())},r)),this._callbacks.push({doneCb:t,timeoutId:s,updateCb:i})}whenStable(t,r,i){if(i&&!this.taskTrackingZone)throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/plugins/task-tracking" loaded?');this.addCallback(t,r,i),this._runCallbacksIfReady()}getPendingRequestCount(){return this._pendingCount}registerApplication(t){this.registry.registerApplication(t,this)}unregisterApplication(t){this.registry.unregisterApplication(t)}findProviders(t,r,i){return[]}}return n.\u0275fac=function(t){return new(t||n)(mn(Kr),mn(ny),mn(Cd))},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})(),ny=(()=>{class n{constructor(){this._applications=new Map}registerApplication(t,r){this._applications.set(t,r)}unregisterApplication(t){this._applications.delete(t)}unregisterAllApplications(){this._applications.clear()}getTestability(t){return this._applications.get(t)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(t,r=!0){return ry?.findTestabilityInTree(this,t,r)??null}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=$n({token:n,factory:n.\u0275fac,providedIn:"platform"}),n})(),Po=null;const eT=new Yt("AllowMultipleToken"),iy=new Yt("PlatformDestroyListeners");function nT(n,e,t=[]){const r=`Platform: ${e}`,i=new Yt(r);return(s=[])=>{let o=sy();if(!o||o.injector.get(eT,!1)){const a=[...t,...s,{provide:i,useValue:!0}];n?n(a):function W3(n){if(Po&&!Po.get(eT,!1))throw new mt(400,!1);Po=n;const e=n.get(iT);(function tT(n){const e=n.get(WI,null);e&&e.forEach(t=>t())})(n)}(function rT(n=[],e){return pa.create({name:e,providers:[{provide:Fg,useValue:"platform"},{provide:iy,useValue:new Set([()=>Po=null])},...n]})}(a,r))}return function Q3(n){const e=sy();if(!e)throw new mt(401,!1);return e}()}}function sy(){return Po?.get(iT)??null}let iT=(()=>{class n{constructor(t){this._injector=t,this._modules=[],this._destroyListeners=[],this._destroyed=!1}bootstrapModuleFactory(t,r){const i=function oT(n,e){let t;return t="noop"===n?new K3:("zone.js"===n?void 0:n)||new Kr(e),t}(r?.ngZone,function sT(n){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:!(!n||!n.ngZoneEventCoalescing)||!1,shouldCoalesceRunChangeDetection:!(!n||!n.ngZoneRunCoalescing)||!1}}(r)),s=[{provide:Kr,useValue:i}];return i.run(()=>{const o=pa.create({providers:s,parent:this.injector,name:t.moduleType.name}),a=t.create(o),u=a.injector.get(cc,null);if(!u)throw new mt(402,!1);return i.runOutsideAngular(()=>{const _=i.onError.subscribe({next:x=>{u.handleError(x)}});a.onDestroy(()=>{Dd(this._modules,a),_.unsubscribe()})}),function aT(n,e,t){try{const r=t();return T0(r)?r.catch(i=>{throw e.runOutsideAngular(()=>n.handleError(i)),i}):r}catch(r){throw e.runOutsideAngular(()=>n.handleError(r)),r}}(u,i,()=>{const _=a.injector.get(Td);return _.runInitializers(),_.donePromise.then(()=>(function kS(n){bi(n,"Expected localeId to be defined"),"string"==typeof n&&(OS=n.toLowerCase().replace(/_/g,"-"))}(a.injector.get(ro,Tc)||Tc),this._moduleDoBootstrap(a),a))})})}bootstrapModule(t,r=[]){const i=cT({},r);return function j3(n,e,t){const r=new B0(t);return Promise.resolve(r)}(0,0,t).then(s=>this.bootstrapModuleFactory(s,i))}_moduleDoBootstrap(t){const r=t.injector.get(oy);if(t._bootstrapComponents.length>0)t._bootstrapComponents.forEach(i=>r.bootstrap(i));else{if(!t.instance.ngDoBootstrap)throw new mt(403,!1);t.instance.ngDoBootstrap(r)}this._modules.push(t)}onDestroy(t){this._destroyListeners.push(t)}get injector(){return this._injector}destroy(){if(this._destroyed)throw new mt(404,!1);this._modules.slice().forEach(r=>r.destroy()),this._destroyListeners.forEach(r=>r());const t=this._injector.get(iy,null);t&&(t.forEach(r=>r()),t.clear()),this._destroyed=!0}get destroyed(){return this._destroyed}}return n.\u0275fac=function(t){return new(t||n)(mn(pa))},n.\u0275prov=$n({token:n,factory:n.\u0275fac,providedIn:"platform"}),n})();function cT(n,e){return Array.isArray(e)?e.reduce(cT,n):{...n,...e}}let oy=(()=>{class n{constructor(t,r,i){this._zone=t,this._injector=r,this._exceptionHandler=i,this._bootstrapListeners=[],this._views=[],this._runningTick=!1,this._stable=!0,this._destroyed=!1,this._destroyListeners=[],this.componentTypes=[],this.components=[],this._onMicrotaskEmptySubscription=this._zone.onMicrotaskEmpty.subscribe({next:()=>{this._zone.run(()=>{this.tick()})}});const s=new rn(a=>{this._stable=this._zone.isStable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks,this._zone.runOutsideAngular(()=>{a.next(this._stable),a.complete()})}),o=new rn(a=>{let u;this._zone.runOutsideAngular(()=>{u=this._zone.onStable.subscribe(()=>{Kr.assertNotInAngularZone(),X0(()=>{!this._stable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks&&(this._stable=!0,a.next(!0))})})});const _=this._zone.onUnstable.subscribe(()=>{Kr.assertInAngularZone(),this._stable&&(this._stable=!1,this._zone.runOutsideAngular(()=>{a.next(!1)}))});return()=>{u.unsubscribe(),_.unsubscribe()}});this.isStable=Qr(s,o.pipe(function is(n={}){const{connector:e=(()=>new qr),resetOnError:t=!0,resetOnComplete:r=!0,resetOnRefCountZero:i=!0}=n;return s=>{let o,a,u,_=0,x=!1,P=!1;const B=()=>{a?.unsubscribe(),a=void 0},U=()=>{B(),o=u=void 0,x=P=!1},W=()=>{const X=o;U(),X?.unsubscribe()};return le((X,re)=>{_++,!P&&!x&&B();const fe=u=u??e();re.add(()=>{_--,0===_&&!P&&!x&&(a=So(W,i))}),fe.subscribe(re),!o&&_>0&&(o=new ve({next:Ie=>fe.next(Ie),error:Ie=>{P=!0,B(),a=So(U,t,Ie),fe.error(Ie)},complete:()=>{x=!0,B(),a=So(U,r),fe.complete()}}),Tn(X).subscribe(o))})(s)}}()))}get destroyed(){return this._destroyed}get injector(){return this._injector}bootstrap(t,r){const i=t instanceof xw;if(!this._injector.get(Td).done)throw!i&&function Tu(n){const e=bn(n)||Zr(n)||Xr(n);return null!==e&&e.standalone}(t),new mt(405,false);let o;o=i?t:this._injector.get(nd).resolveComponentFactory(t),this.componentTypes.push(o.componentType);const a=function z3(n){return n.isBoundToModule}(o)?void 0:this._injector.get(Cc),_=o.create(pa.NULL,[],r||o.selector,a),x=_.location.nativeElement,P=_.injector.get(JI,null);return P?.registerApplication(x),_.onDestroy(()=>{this.detachView(_.hostView),Dd(this.components,_),P?.unregisterApplication(x)}),this._loadComponent(_),_}tick(){if(this._runningTick)throw new mt(101,!1);try{this._runningTick=!0;for(let t of this._views)t.detectChanges()}catch(t){this._zone.runOutsideAngular(()=>this._exceptionHandler.handleError(t))}finally{this._runningTick=!1}}attachView(t){const r=t;this._views.push(r),r.attachToAppRef(this)}detachView(t){const r=t;Dd(this._views,r),r.detachFromAppRef()}_loadComponent(t){this.attachView(t.hostView),this.tick(),this.components.push(t),this._injector.get(N3,[]).concat(this._bootstrapListeners).forEach(i=>i(t))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(t=>t()),this._views.slice().forEach(t=>t.destroy()),this._onMicrotaskEmptySubscription.unsubscribe()}finally{this._destroyed=!0,this._views=[],this._bootstrapListeners=[],this._destroyListeners=[]}}onDestroy(t){return this._destroyListeners.push(t),()=>Dd(this._destroyListeners,t)}destroy(){if(this._destroyed)throw new mt(406,!1);const t=this._injector;t.destroy&&!t.destroyed&&t.destroy()}get viewCount(){return this._views.length}warnIfDestroyed(){}}return n.\u0275fac=function(t){return new(t||n)(mn(Kr),mn(ic),mn(cc))},n.\u0275prov=$n({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();function Dd(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}let lT=!0;class gT{constructor(){}supports(e){return Xu(e)}create(e){return new o4(e)}}const s4=(n,e)=>e;class o4{constructor(e){this.length=0,this._linkedRecords=null,this._unlinkedRecords=null,this._previousItHead=null,this._itHead=null,this._itTail=null,this._additionsHead=null,this._additionsTail=null,this._movesHead=null,this._movesTail=null,this._removalsHead=null,this._removalsTail=null,this._identityChangesHead=null,this._identityChangesTail=null,this._trackByFn=e||s4}forEachItem(e){let t;for(t=this._itHead;null!==t;t=t._next)e(t)}forEachOperation(e){let t=this._itHead,r=this._removalsHead,i=0,s=null;for(;t||r;){const o=!r||t&&t.currentIndex<mT(r,i,s)?t:r,a=mT(o,i,s),u=o.currentIndex;if(o===r)i--,r=r._nextRemoved;else if(t=t._next,null==o.previousIndex)i++;else{s||(s=[]);const _=a-i,x=u-i;if(_!=x){for(let B=0;B<_;B++){const U=B<s.length?s[B]:s[B]=0,W=U+B;x<=W&&W<_&&(s[B]=U+1)}s[o.previousIndex]=x-_}}a!==u&&e(o,a,u)}}forEachPreviousItem(e){let t;for(t=this._previousItHead;null!==t;t=t._nextPrevious)e(t)}forEachAddedItem(e){let t;for(t=this._additionsHead;null!==t;t=t._nextAdded)e(t)}forEachMovedItem(e){let t;for(t=this._movesHead;null!==t;t=t._nextMoved)e(t)}forEachRemovedItem(e){let t;for(t=this._removalsHead;null!==t;t=t._nextRemoved)e(t)}forEachIdentityChange(e){let t;for(t=this._identityChangesHead;null!==t;t=t._nextIdentityChange)e(t)}diff(e){if(null==e&&(e=[]),!Xu(e))throw new mt(900,!1);return this.check(e)?this:null}onDestroy(){}check(e){this._reset();let i,s,o,t=this._itHead,r=!1;if(Array.isArray(e)){this.length=e.length;for(let a=0;a<this.length;a++)s=e[a],o=this._trackByFn(a,s),null!==t&&Object.is(t.trackById,o)?(r&&(t=this._verifyReinsertion(t,s,o,a)),Object.is(t.item,s)||this._addIdentityChange(t,s)):(t=this._mismatch(t,s,o,a),r=!0),t=t._next}else i=0,function EO(n,e){if(Array.isArray(n))for(let t=0;t<n.length;t++)e(n[t]);else{const t=n[ga()]();let r;for(;!(r=t.next()).done;)e(r.value)}}(e,a=>{o=this._trackByFn(i,a),null!==t&&Object.is(t.trackById,o)?(r&&(t=this._verifyReinsertion(t,a,o,i)),Object.is(t.item,a)||this._addIdentityChange(t,a)):(t=this._mismatch(t,a,o,i),r=!0),t=t._next,i++}),this.length=i;return this._truncate(t),this.collection=e,this.isDirty}get isDirty(){return null!==this._additionsHead||null!==this._movesHead||null!==this._removalsHead||null!==this._identityChangesHead}_reset(){if(this.isDirty){let e;for(e=this._previousItHead=this._itHead;null!==e;e=e._next)e._nextPrevious=e._next;for(e=this._additionsHead;null!==e;e=e._nextAdded)e.previousIndex=e.currentIndex;for(this._additionsHead=this._additionsTail=null,e=this._movesHead;null!==e;e=e._nextMoved)e.previousIndex=e.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(e,t,r,i){let s;return null===e?s=this._itTail:(s=e._prev,this._remove(e)),null!==(e=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null))?(Object.is(e.item,t)||this._addIdentityChange(e,t),this._reinsertAfter(e,s,i)):null!==(e=null===this._linkedRecords?null:this._linkedRecords.get(r,i))?(Object.is(e.item,t)||this._addIdentityChange(e,t),this._moveAfter(e,s,i)):e=this._addAfter(new a4(t,r),s,i),e}_verifyReinsertion(e,t,r,i){let s=null===this._unlinkedRecords?null:this._unlinkedRecords.get(r,null);return null!==s?e=this._reinsertAfter(s,e._prev,i):e.currentIndex!=i&&(e.currentIndex=i,this._addToMoves(e,i)),e}_truncate(e){for(;null!==e;){const t=e._next;this._addToRemovals(this._unlink(e)),e=t}null!==this._unlinkedRecords&&this._unlinkedRecords.clear(),null!==this._additionsTail&&(this._additionsTail._nextAdded=null),null!==this._movesTail&&(this._movesTail._nextMoved=null),null!==this._itTail&&(this._itTail._next=null),null!==this._removalsTail&&(this._removalsTail._nextRemoved=null),null!==this._identityChangesTail&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(e,t,r){null!==this._unlinkedRecords&&this._unlinkedRecords.remove(e);const i=e._prevRemoved,s=e._nextRemoved;return null===i?this._removalsHead=s:i._nextRemoved=s,null===s?this._removalsTail=i:s._prevRemoved=i,this._insertAfter(e,t,r),this._addToMoves(e,r),e}_moveAfter(e,t,r){return this._unlink(e),this._insertAfter(e,t,r),this._addToMoves(e,r),e}_addAfter(e,t,r){return this._insertAfter(e,t,r),this._additionsTail=null===this._additionsTail?this._additionsHead=e:this._additionsTail._nextAdded=e,e}_insertAfter(e,t,r){const i=null===t?this._itHead:t._next;return e._next=i,e._prev=t,null===i?this._itTail=e:i._prev=e,null===t?this._itHead=e:t._next=e,null===this._linkedRecords&&(this._linkedRecords=new yT),this._linkedRecords.put(e),e.currentIndex=r,e}_remove(e){return this._addToRemovals(this._unlink(e))}_unlink(e){null!==this._linkedRecords&&this._linkedRecords.remove(e);const t=e._prev,r=e._next;return null===t?this._itHead=r:t._next=r,null===r?this._itTail=t:r._prev=t,e}_addToMoves(e,t){return e.previousIndex===t||(this._movesTail=null===this._movesTail?this._movesHead=e:this._movesTail._nextMoved=e),e}_addToRemovals(e){return null===this._unlinkedRecords&&(this._unlinkedRecords=new yT),this._unlinkedRecords.put(e),e.currentIndex=null,e._nextRemoved=null,null===this._removalsTail?(this._removalsTail=this._removalsHead=e,e._prevRemoved=null):(e._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=e),e}_addIdentityChange(e,t){return e.item=t,this._identityChangesTail=null===this._identityChangesTail?this._identityChangesHead=e:this._identityChangesTail._nextIdentityChange=e,e}}class a4{constructor(e,t){this.item=e,this.trackById=t,this.currentIndex=null,this.previousIndex=null,this._nextPrevious=null,this._prev=null,this._next=null,this._prevDup=null,this._nextDup=null,this._prevRemoved=null,this._nextRemoved=null,this._nextAdded=null,this._nextMoved=null,this._nextIdentityChange=null}}class c4{constructor(){this._head=null,this._tail=null}add(e){null===this._head?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)}get(e,t){let r;for(r=this._head;null!==r;r=r._nextDup)if((null===t||t<=r.currentIndex)&&Object.is(r.trackById,e))return r;return null}remove(e){const t=e._prevDup,r=e._nextDup;return null===t?this._head=r:t._nextDup=r,null===r?this._tail=t:r._prevDup=t,null===this._head}}class yT{constructor(){this.map=new Map}put(e){const t=e.trackById;let r=this.map.get(t);r||(r=new c4,this.map.set(t,r)),r.add(e)}get(e,t){const i=this.map.get(e);return i?i.get(e,t):null}remove(e){const t=e.trackById;return this.map.get(t).remove(e)&&this.map.delete(t),e}get isEmpty(){return 0===this.map.size}clear(){this.map.clear()}}function mT(n,e,t){const r=n.previousIndex;if(null===r)return r;let i=0;return t&&r<t.length&&(i=t[r]),r+e+i}function ET(){return new Rd([new gT])}let Rd=(()=>{class n{constructor(t){this.factories=t}static create(t,r){if(null!=r){const i=r.factories.slice();t=t.concat(i)}return new n(t)}static extend(t){return{provide:n,useFactory:r=>n.create(t,r||ET()),deps:[[n,new jf,new Gf]]}}find(t){const r=this.factories.find(i=>i.supports(t));if(null!=r)return r;throw new mt(901,!1)}}return n.\u0275prov=$n({token:n,providedIn:"root",factory:ET}),n})();const h4=nT(null,"core",[]);let p4=(()=>{class n{constructor(t){}}return n.\u0275fac=function(t){return new(t||n)(mn(oy))},n.\u0275mod=Iu({type:n}),n.\u0275inj=Va({}),n})(),Pd=null;function fl(){return Pd}const so=new Yt("DocumentToken");class sB{constructor(e,t,r,i){this.$implicit=e,this.ngForOf=t,this.index=r,this.count=i}get first(){return 0===this.index}get last(){return this.index===this.count-1}get even(){return this.index%2==0}get odd(){return!this.even}}let NT=(()=>{class n{constructor(t,r,i){this._viewContainer=t,this._template=r,this._differs=i,this._ngForOf=null,this._ngForOfDirty=!0,this._differ=null}set ngForOf(t){this._ngForOf=t,this._ngForOfDirty=!0}set ngForTrackBy(t){this._trackByFn=t}get ngForTrackBy(){return this._trackByFn}set ngForTemplate(t){t&&(this._template=t)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;const t=this._ngForOf;!this._differ&&t&&(this._differ=this._differs.find(t).create(this.ngForTrackBy))}if(this._differ){const t=this._differ.diff(this._ngForOf);t&&this._applyChanges(t)}}_applyChanges(t){const r=this._viewContainer;t.forEachOperation((i,s,o)=>{if(null==i.previousIndex)r.createEmbeddedView(this._template,new sB(i.item,this._ngForOf,-1,-1),null===o?void 0:o);else if(null==o)r.remove(null===s?void 0:s);else if(null!==s){const a=r.get(s);r.move(a,o),MT(a,i)}});for(let i=0,s=r.length;i<s;i++){const a=r.get(i).context;a.index=i,a.count=s,a.ngForOf=this._ngForOf}t.forEachIdentityChange(i=>{MT(r.get(i.currentIndex),i)})}static ngTemplateContextGuard(t,r){return!0}}return n.\u0275fac=function(t){return new(t||n)(Ut(Os),Ut(no),Ut(Rd))},n.\u0275dir=Bi({type:n,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"},standalone:!0}),n})();function MT(n,e){n.context.$implicit=e.item}let kB=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=Iu({type:n}),n.\u0275inj=Va({}),n})();class Cy extends class i8 extends class m4{}{constructor(){super(...arguments),this.supportsDOMEvents=!0}}{static makeCurrent(){!function y4(n){Pd||(Pd=n)}(new Cy)}onAndCancel(e,t,r){return e.addEventListener(t,r,!1),()=>{e.removeEventListener(t,r,!1)}}dispatchEvent(e,t){e.dispatchEvent(t)}remove(e){e.parentNode&&e.parentNode.removeChild(e)}createElement(e,t){return(t=t||this.getDefaultDocument()).createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,t){return"window"===t?window:"document"===t?e:"body"===t?e.body:null}getBaseHref(e){const t=function s8(){return gl=gl||document.querySelector("base"),gl?gl.getAttribute("href"):null}();return null==t?null:function o8(n){$d=$d||document.createElement("a"),$d.setAttribute("href",n);const e=$d.pathname;return"/"===e.charAt(0)?e:`/${e}`}(t)}resetBaseElement(){gl=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return function nB(n,e){e=encodeURIComponent(e);for(const t of n.split(";")){const r=t.indexOf("="),[i,s]=-1==r?[t,""]:[t.slice(0,r),t.slice(r+1)];if(i.trim()===e)return decodeURIComponent(s)}return null}(document.cookie,e)}}let $d,gl=null;const $T=new Yt("TRANSITION_ID"),c8=[{provide:jI,useFactory:function a8(n,e,t){return()=>{t.get(Td).donePromise.then(()=>{const r=fl(),i=e.querySelectorAll(`style[ng-transition="${n}"]`);for(let s=0;s<i.length;s++)r.remove(i[s])})}},deps:[$T,so,pa],multi:!0}];let l8=(()=>{class n{build(){return new XMLHttpRequest}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})();const Kd=new Yt("EventManagerPlugins");let Gd=(()=>{class n{constructor(t,r){this._zone=r,this._eventNameToPlugin=new Map,t.forEach(i=>i.manager=this),this._plugins=t.slice().reverse()}addEventListener(t,r,i){return this._findPluginFor(r).addEventListener(t,r,i)}addGlobalEventListener(t,r,i){return this._findPluginFor(r).addGlobalEventListener(t,r,i)}getZone(){return this._zone}_findPluginFor(t){const r=this._eventNameToPlugin.get(t);if(r)return r;const i=this._plugins;for(let s=0;s<i.length;s++){const o=i[s];if(o.supports(t))return this._eventNameToPlugin.set(t,o),o}throw new Error(`No event manager plugin found for event ${t}`)}}return n.\u0275fac=function(t){return new(t||n)(mn(Kd),mn(Kr))},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})();class KT{constructor(e){this._doc=e}addGlobalEventListener(e,t,r){const i=fl().getGlobalEventTarget(this._doc,e);if(!i)throw new Error(`Unsupported event target ${i} for event ${t}`);return this.addEventListener(i,t,r)}}let GT=(()=>{class n{constructor(){this._stylesSet=new Set}addStyles(t){const r=new Set;t.forEach(i=>{this._stylesSet.has(i)||(this._stylesSet.add(i),r.add(i))}),this.onStylesAdded(r)}onStylesAdded(t){}getAllStyles(){return Array.from(this._stylesSet)}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})(),yl=(()=>{class n extends GT{constructor(t){super(),this._doc=t,this._hostNodes=new Map,this._hostNodes.set(t.head,[])}_addStylesToHost(t,r,i){t.forEach(s=>{const o=this._doc.createElement("style");o.textContent=s,i.push(r.appendChild(o))})}addHost(t){const r=[];this._addStylesToHost(this._stylesSet,t,r),this._hostNodes.set(t,r)}removeHost(t){const r=this._hostNodes.get(t);r&&r.forEach(jT),this._hostNodes.delete(t)}onStylesAdded(t){this._hostNodes.forEach((r,i)=>{this._addStylesToHost(t,i,r)})}ngOnDestroy(){this._hostNodes.forEach(t=>t.forEach(jT))}}return n.\u0275fac=function(t){return new(t||n)(mn(so))},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})();function jT(n){fl().remove(n)}const Dy={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/MathML/"},xy=/%COMP%/g;function jd(n,e,t){for(let r=0;r<e.length;r++){let i=e[r];Array.isArray(i)?jd(n,i,t):(i=i.replace(xy,n),t.push(i))}return t}function qT(n){return e=>{if("__ngUnwrap__"===e)return n;!1===n(e)&&(e.preventDefault(),e.returnValue=!1)}}let Ay=(()=>{class n{constructor(t,r,i){this.eventManager=t,this.sharedStylesHost=r,this.appId=i,this.rendererByCompId=new Map,this.defaultRenderer=new Ry(t)}createRenderer(t,r){if(!t||!r)return this.defaultRenderer;switch(r.encapsulation){case Ds.Emulated:{let i=this.rendererByCompId.get(r.id);return i||(i=new y8(this.eventManager,this.sharedStylesHost,r,this.appId),this.rendererByCompId.set(r.id,i)),i.applyToHost(t),i}case 1:case Ds.ShadowDom:return new m8(this.eventManager,this.sharedStylesHost,t,r);default:if(!this.rendererByCompId.has(r.id)){const i=jd(r.id,r.styles,[]);this.sharedStylesHost.addStyles(i),this.rendererByCompId.set(r.id,this.defaultRenderer)}return this.defaultRenderer}}begin(){}end(){}}return n.\u0275fac=function(t){return new(t||n)(mn(Gd),mn(yl),mn(ul))},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})();class Ry{constructor(e){this.eventManager=e,this.data=Object.create(null),this.destroyNode=null}destroy(){}createElement(e,t){return t?document.createElementNS(Dy[t]||t,e):document.createElement(e)}createComment(e){return document.createComment(e)}createText(e){return document.createTextNode(e)}appendChild(e,t){(YT(e)?e.content:e).appendChild(t)}insertBefore(e,t,r){e&&(YT(e)?e.content:e).insertBefore(t,r)}removeChild(e,t){e&&e.removeChild(t)}selectRootElement(e,t){let r="string"==typeof e?document.querySelector(e):e;if(!r)throw new Error(`The selector "${e}" did not match any elements`);return t||(r.textContent=""),r}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,t,r,i){if(i){t=i+":"+t;const s=Dy[i];s?e.setAttributeNS(s,t,r):e.setAttribute(t,r)}else e.setAttribute(t,r)}removeAttribute(e,t,r){if(r){const i=Dy[r];i?e.removeAttributeNS(i,t):e.removeAttribute(`${r}:${t}`)}else e.removeAttribute(t)}addClass(e,t){e.classList.add(t)}removeClass(e,t){e.classList.remove(t)}setStyle(e,t,r,i){i&(li.DashCase|li.Important)?e.style.setProperty(t,r,i&li.Important?"important":""):e.style[t]=r}removeStyle(e,t,r){r&li.DashCase?e.style.removeProperty(t):e.style[t]=""}setProperty(e,t,r){e[t]=r}setValue(e,t){e.nodeValue=t}listen(e,t,r){return"string"==typeof e?this.eventManager.addGlobalEventListener(e,t,qT(r)):this.eventManager.addEventListener(e,t,qT(r))}}function YT(n){return"TEMPLATE"===n.tagName&&void 0!==n.content}class y8 extends Ry{constructor(e,t,r,i){super(e),this.component=r;const s=jd(i+"-"+r.id,r.styles,[]);t.addStyles(s),this.contentAttr=function h8(n){return"_ngcontent-%COMP%".replace(xy,n)}(i+"-"+r.id),this.hostAttr=function p8(n){return"_nghost-%COMP%".replace(xy,n)}(i+"-"+r.id)}applyToHost(e){super.setAttribute(e,this.hostAttr,"")}createElement(e,t){const r=super.createElement(e,t);return super.setAttribute(r,this.contentAttr,""),r}}class m8 extends Ry{constructor(e,t,r,i){super(e),this.sharedStylesHost=t,this.hostEl=r,this.shadowRoot=r.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);const s=jd(i.id,i.styles,[]);for(let o=0;o<s.length;o++){const a=document.createElement("style");a.textContent=s[o],this.shadowRoot.appendChild(a)}}nodeOrShadowRoot(e){return e===this.hostEl?this.shadowRoot:e}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}appendChild(e,t){return super.appendChild(this.nodeOrShadowRoot(e),t)}insertBefore(e,t,r){return super.insertBefore(this.nodeOrShadowRoot(e),t,r)}removeChild(e,t){return super.removeChild(this.nodeOrShadowRoot(e),t)}parentNode(e){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(e)))}}let v8=(()=>{class n extends KT{constructor(t){super(t)}supports(t){return!0}addEventListener(t,r,i){return t.addEventListener(r,i,!1),()=>this.removeEventListener(t,r,i)}removeEventListener(t,r,i){return t.removeEventListener(r,i)}}return n.\u0275fac=function(t){return new(t||n)(mn(so))},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})();const ZT=["alt","control","meta","shift"],E8={"\b":"Backspace","\t":"Tab","\x7f":"Delete","\x1b":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},_8={alt:n=>n.altKey,control:n=>n.ctrlKey,meta:n=>n.metaKey,shift:n=>n.shiftKey};let b8=(()=>{class n extends KT{constructor(t){super(t)}supports(t){return null!=n.parseEventName(t)}addEventListener(t,r,i){const s=n.parseEventName(r),o=n.eventCallback(s.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>fl().onAndCancel(t,s.domEventName,o))}static parseEventName(t){const r=t.toLowerCase().split("."),i=r.shift();if(0===r.length||"keydown"!==i&&"keyup"!==i)return null;const s=n._normalizeKey(r.pop());let o="",a=r.indexOf("code");if(a>-1&&(r.splice(a,1),o="code."),ZT.forEach(_=>{const x=r.indexOf(_);x>-1&&(r.splice(x,1),o+=_+".")}),o+=s,0!=r.length||0===s.length)return null;const u={};return u.domEventName=i,u.fullKey=o,u}static matchEventFullKeyCode(t,r){let i=E8[t.key]||t.key,s="";return r.indexOf("code.")>-1&&(i=t.code,s="code."),!(null==i||!i)&&(i=i.toLowerCase()," "===i?i="space":"."===i&&(i="dot"),ZT.forEach(o=>{o!==i&&(0,_8[o])(t)&&(s+=o+".")}),s+=i,s===r)}static eventCallback(t,r,i){return s=>{n.matchEventFullKeyCode(s,t)&&i.runGuarded(()=>r(s))}}static _normalizeKey(t){return"esc"===t?"escape":t}}return n.\u0275fac=function(t){return new(t||n)(mn(so))},n.\u0275prov=$n({token:n,factory:n.\u0275fac}),n})();const JT=[{provide:qI,useValue:"browser"},{provide:WI,useValue:function w8(){Cy.makeCurrent()},multi:!0},{provide:so,useFactory:function I8(){return function YP(n){Rg=n}(document),document},deps:[]}],T8=nT(h4,"browser",JT),eC=new Yt(""),tC=[{provide:Cd,useClass:class u8{addToWindow(e){Ln.getAngularTestability=(r,i=!0)=>{const s=e.findTestabilityInTree(r,i);if(null==s)throw new Error("Could not find testability for element.");return s},Ln.getAllAngularTestabilities=()=>e.getAllTestabilities(),Ln.getAllAngularRootElements=()=>e.getAllRootElements(),Ln.frameworkStabilizers||(Ln.frameworkStabilizers=[]),Ln.frameworkStabilizers.push(r=>{const i=Ln.getAllAngularTestabilities();let s=i.length,o=!1;const a=function(u){o=o||u,s--,0==s&&r(o)};i.forEach(function(u){u.whenStable(a)})})}findTestabilityInTree(e,t,r){return null==t?null:e.getTestability(t)??(r?fl().isShadowRoot(t)?this.findTestabilityInTree(e,t.host,!0):this.findTestabilityInTree(e,t.parentElement,!0):null)}},deps:[]},{provide:JI,useClass:ty,deps:[Kr,ny,Cd]},{provide:ty,useClass:ty,deps:[Kr,ny,Cd]}],nC=[{provide:Fg,useValue:"root"},{provide:cc,useFactory:function S8(){return new cc},deps:[]},{provide:Kd,useClass:v8,multi:!0,deps:[so,Kr,qI]},{provide:Kd,useClass:b8,multi:!0,deps:[so]},{provide:Ay,useClass:Ay,deps:[Gd,yl,ul]},{provide:Rw,useExisting:Ay},{provide:GT,useExisting:yl},{provide:yl,useClass:yl,deps:[so]},{provide:Gd,useClass:Gd,deps:[Kd,Kr]},{provide:class VB{},useClass:l8,deps:[]},[]];let C8=(()=>{class n{constructor(t){}static withServerTransition(t){return{ngModule:n,providers:[{provide:ul,useValue:t.appId},{provide:$T,useExisting:ul},c8]}}}return n.\u0275fac=function(t){return new(t||n)(mn(eC,12))},n.\u0275mod=Iu({type:n}),n.\u0275inj=Va({providers:[...nC,...tC],imports:[kB,p4]}),n})();typeof window<"u"&&window;class L8 extends qr{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){const t=super._subscribe(e);return!t.closed&&e.next(this._value),t}getValue(){const{hasError:e,thrownError:t,_value:r}=this;if(e)throw t;return this._throwIfClosed(),r}next(e){super.next(this._value=e)}}function sC(n,e,t,r,i,s,o){try{var a=n[s](o),u=a.value}catch(_){return void t(_)}a.done?e(u):Promise.resolve(u).then(r,i)}function $(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var s=n.apply(e,t);function o(u){sC(s,r,i,o,a,"next",u)}function a(u){sC(s,r,i,o,a,"throw",u)}o(void 0)})}}function oC(n){this.wrapped=n}function ml(n){var e,t;function i(o,a){try{var u=n[o](a),_=u.value,x=_ instanceof oC;Promise.resolve(x?_.wrapped:_).then(function(P){x?i("return"===o?"return":"next",P):s(u.done?"return":"normal",P)},function(P){i("throw",P)})}catch(P){s("throw",P)}}function s(o,a){switch(o){case"return":e.resolve({value:a,done:!0});break;case"throw":e.reject(a);break;default:e.resolve({value:a,done:!1})}(e=e.next)?i(e.key,e.arg):t=null}this._invoke=function r(o,a){return new Promise(function(u,_){var x={key:o,arg:a,resolve:u,reject:_,next:null};t?t=t.next=x:(e=t=x,i(o,a))})},"function"!=typeof n.return&&(this.return=void 0)}function Vt(n){return function(){return new ml(n.apply(this,arguments))}}function qe(n){return new oC(n)}function ut(n){var e,t,r,i=2;for(typeof Symbol<"u"&&(t=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(t&&null!=(e=n[t]))return e.call(n);if(r&&null!=(e=n[r]))return new zd(e.call(n));t="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function zd(n){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var r=t.done;return Promise.resolve(t.value).then(function(i){return{value:i,done:r}})}return(zd=function(r){this.s=r,this.n=r.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(r){var i=this.s.return;return void 0===i?Promise.resolve({value:r,done:!0}):e(i.apply(this.s,arguments))},throw:function(r){var i=this.s.return;return void 0===i?Promise.reject(r):e(i.apply(this.s,arguments))}},new zd(n)}function Mr(n,e){var t={},r=!1;function i(s,o){return r=!0,o=new Promise(function(a){a(n[s](o))}),{done:!1,value:e(o)}}return t[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},t.next=function(s){return r?(r=!1,s):i("next",s)},"function"==typeof n.throw&&(t.throw=function(s){if(r)throw r=!1,s;return i("throw",s)}),"function"==typeof n.return&&(t.return=function(s){return r?(r=!1,s):i("return",s)}),t}function Wd(n){return null!=globalThis.Buffer?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function Mo(n=0){return null!=globalThis.Buffer?.alloc?Wd(globalThis.Buffer.alloc(n)):new Uint8Array(n)}function Ac(n=0){return null!=globalThis.Buffer?.allocUnsafe?Wd(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function gr(n,e){null==e&&(e=n.reduce((i,s)=>i+s.length,0));const t=Ac(e);let r=0;for(const i of n)t.set(i,r),r+=i.length;return Wd(t)}function Or(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.byteLength;t++)if(n[t]!==e[t])return!1;return!0}ml.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ml.prototype.next=function(n){return this._invoke("next",n)},ml.prototype.throw=function(n){return this._invoke("throw",n)},ml.prototype.return=function(n){return this._invoke("return",n)};const aC=Symbol.for("@achingbrain/uint8arraylist");function cC(n,e){if(null==e||e<0)throw new RangeError("index is out of bounds");let t=0;for(const r of n){const i=t+r.byteLength;if(e<i)return{buf:r,index:e-t};t=i}throw new RangeError("index is out of bounds")}function qd(n){return Boolean(n?.[aC])}class yr{constructor(...e){Object.defineProperty(this,aC,{value:!0}),this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(const r of e)if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.push(r);else{if(!qd(r))throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.push(...r.bufs)}this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(const r of e.reverse())if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.unshift(r);else{if(!qd(r))throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.unshift(...r.bufs)}this.length+=t}get(e){const t=cC(this.bufs,e);return t.buf[t.index]}set(e,t){const r=cC(this.bufs,e);r.buf[r.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let r=0;r<e.length;r++)this.set(t+r,e[r]);else{if(!qd(e))throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList");for(let r=0;r<e.length;r++)this.set(t+r,e.get(r))}}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength)return this.bufs=[],void(this.length=0);for(;this.bufs.length>0;){if(!(e>=this.bufs[0].byteLength)){this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift()}}}slice(e,t){const{bufs:r,length:i}=this._subList(e,t);return gr(r,i)}subarray(e,t){const{bufs:r,length:i}=this._subList(e,t);return 1===r.length?r[0]:gr(r,i)}sublist(e,t){const{bufs:r,length:i}=this._subList(e,t),s=new yr;return s.length=i,s.bufs=r,s}_subList(e,t){if((e=e??0)<0&&(e=this.length+e),(t=t??this.length)<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(0===e&&t===this.length)return{bufs:[...this.bufs],length:this.length};const r=[];let i=0;for(let s=0;s<this.bufs.length;s++){const o=this.bufs[s],a=i,u=a+o.byteLength;if(i=u,e>=u)continue;const _=e>=a&&e<u,x=t>a&&t<=u;if(_&&x){if(e===a&&t===u){r.push(o);break}const P=e-a;r.push(o.subarray(P,P+(t-e)));break}if(_){if(0===e){r.push(o);continue}r.push(o.subarray(e-a))}else{if(x){if(t===u){r.push(o);break}r.push(o.subarray(0,t-a));break}r.push(o)}}return{bufs:r,length:t-e}}indexOf(e,t=0){if(!(qd(e)||e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const r=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const i=r.byteLength;if(0===i)throw new TypeError("search must be at least 1 byte long");const o=new Int32Array(256);for(let P=0;P<256;P++)o[P]=-1;for(let P=0;P<i;P++)o[r[P]]=P;const a=o,u=this.byteLength-r.byteLength,_=r.byteLength-1;let x;for(let P=t;P<=u;P+=x){x=0;for(let B=_;B>=0;B--){const U=this.get(P+B);if(r[B]!==U){x=Math.max(1,B-a[U]);break}}if(0===x)return P}return-1}getInt8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){const r=Ac(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,t),this.write(r,e)}getInt16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,t)}setInt16(e,t,r){const i=Mo(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,t,r),this.write(i,e)}getInt32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,t)}setInt32(e,t,r){const i=Mo(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,t,r),this.write(i,e)}getBigInt64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,t)}setBigInt64(e,t,r){const i=Mo(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,t,r),this.write(i,e)}getUint8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){const r=Ac(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,t),this.write(r,e)}getUint16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,t)}setUint16(e,t,r){const i=Mo(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,t,r),this.write(i,e)}getUint32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,t)}setUint32(e,t,r){const i=Mo(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,t,r),this.write(i,e)}getBigUint64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,t)}setBigUint64(e,t,r){const i=Mo(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,t,r),this.write(i,e)}getFloat32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,t)}setFloat32(e,t,r){const i=Mo(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,t,r),this.write(i,e)}getFloat64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,t)}setFloat64(e,t,r){const i=Mo(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,t,r),this.write(i,e)}equals(e){if(null==e||!(e instanceof yr)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Or(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){const r=new yr;return r.bufs=e,null==t&&(t=e.reduce((i,s)=>i+s.byteLength,0)),r.length=t,r}}class uC{constructor(e){if(!(e>0)||0!=(e-1&e))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 void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}class My{constructor(e={}){this.hwm=e.splitLimit??16,this.head=new uC(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return null!=e?.byteLength?e.byteLength:1}push(e){null!=e?.value&&(this.size+=this.calculateSize(e.value)),this.head.push(e)||(this.head=this.head.next=new uC(2*this.head.buffer.length),this.head.push(e))}shift(){let e=this.tail.shift();if(void 0===e&&null!=this.tail.next){const t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return null!=e?.value&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}}function Ea(n={}){return lC(t=>{const r=t.shift();if(null==r)return{done:!0};if(null!=r.error)throw r.error;return{done:!0===r.done,value:r.value}},n)}function lC(n,e){let i,s,o,t=(e=e??{}).onEnd,r=new My;const a=function(){var X=$(function*(){return r.isEmpty()?o?{done:!0}:yield new Promise((re,fe)=>{s=Ie=>{s=null,r.push(Ie);try{re(n(r))}catch(ae){fe(ae)}return i}}):n(r)});return function(){return X.apply(this,arguments)}}(),u=X=>null!=s?s(X):(r.push(X),i),x=X=>{if(o)return i;if(!0!==e?.objectMode&&null==X?.byteLength)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return u({done:!1,value:X})},P=X=>o?i:(o=!0,null!=X?(X=>(r=new My,null!=s?s({error:X}):(r.push({error:X}),i)))(X):u({done:!0}));if(i={[Symbol.asyncIterator](){return this},next:a,return:()=>(r=new My,P(),{done:!0}),throw:X=>(P(X),{done:!0}),push:x,end:P,get readableLength(){return r.size}},null==t)return i;const W=i;return i={[Symbol.asyncIterator](){return this},next:()=>W.next(),throw:X=>(W.throw(X),null!=t&&(t(X),t=void 0),{done:!0}),return:()=>(W.return(),null!=t&&(t(),t=void 0),{done:!0}),push:x,end:X=>(W.end(X),null!=t&&(t(X),t=void 0),i),get readableLength(){return W.readableLength}},i}function vl(){const n={};return n.promise=new Promise((e,t)=>{n.resolve=e,n.reject=t}),n}function Qd(n){const e=Ea(),t=function B8(n){const e=Vt(function*(){let t=yield,r=new yr;var o,i=!1,s=!1;try{for(var u,a=ut(n);i=!(u=yield qe(a.next())).done;i=!1){const _=u.value;if(null!=t)for(r.append(_);r.length>=t;){const x=r.sublist(0,t);if(r.consume(t),t=yield x,null==t){r.length>0&&(t=yield r,r=new yr);break}}else r.append(_),t=yield r,r=new yr}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}if(null!=t)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:r})})();return e.next(),e}(n.source),r=vl();let i;const s=n.sink(Vt(function*(){yield*Mr(ut(e),qe);const a=yield qe(r.promise);yield*Mr(ut(a),qe)})());s.catch(a=>{i=a});const o={sink:(a=$(function*(u){return null!=i?yield Promise.reject(i):(r.resolve(u),yield s)}),function(_){return a.apply(this,arguments)}),source:t};var a;return{reader:t,writer:e,stream:o,rest:()=>e.end(),write:e.push,read:function(){var a=$(function*(){const u=yield t.next();if(null!=u.value)return u.value});return function(){return a.apply(this,arguments)}}()}}function fC(n){return n instanceof Uint8Array?{get:e=>n[e],set(e,t){n[e]=t}}:{get:e=>n.get(e),set(e,t){n.set(e,t)}}}const dC=4294967296;class Ki{constructor(e=0,t=0){this.hi=e,this.lo=t}toBigInt(e){if(!0===e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!=0){const t=1+~this.lo>>>0;let r=~this.hi>>>0;return 0===t&&(r=r+1>>>0),-(BigInt(t)+(BigInt(r)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(e){return Number(this.toBigInt(e))}zzDecode(){const e=-(1&this.lo);return new Ki((this.hi>>>1^e)>>>0,((this.lo>>>1|this.hi<<31)^e)>>>0)}zzEncode(){const e=this.hi>>31;return new Ki(((this.hi<<1|this.lo>>>31)^e)>>>0,(this.lo<<1^e)>>>0)}toBytes(e,t=0){const r=fC(e);for(;this.hi>0;)r.set(t++,127&this.lo|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)r.set(t++,127&this.lo|128),this.lo=this.lo>>>7;r.set(t++,this.lo)}static fromBigInt(e){if(0n===e)return new Ki;const t=e<0;t&&(e=-e);let r=0|Number(e>>32n),i=0|Number(e-(BigInt(r)<<32n));return t&&(r=~r>>>0,i=~i>>>0,++i>dC&&(i=0,++r>dC&&(r=0))),new Ki(r,i)}static fromNumber(e){if(0===e)return new Ki;const t=e<0;t&&(e=-e);let r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new Ki(i,r)}static fromBytes(e,t=0){const r=fC(e),i=new Ki;let s=0;if(e.length-t>4){for(;s<4;++s)if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i;if(i.lo=(i.lo|(127&r.get(t))<<28)>>>0,i.hi=(i.hi|(127&r.get(t))>>4)>>>0,r.get(t++)<128)return i;s=0}else for(;s<4;++s){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.lo=(i.lo|(127&r.get(t))<<7*s)>>>0,r.get(t++)<128)return i}if(e.length-t>4){for(;s<5;++s)if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}else if(t<e.byteLength)for(;s<5;++s){if(t>=e.length)throw RangeError(`index out of range: ${t} > ${e.length}`);if(i.hi=(i.hi|(127&r.get(t))<<7*s+3)>>>0,r.get(t++)<128)return i}throw RangeError("invalid varint encoding")}}const U8=Math.pow(2,7),V8=Math.pow(2,14),H8=Math.pow(2,21),$8=Math.pow(2,28),K8=Math.pow(2,35),G8=Math.pow(2,42),j8=Math.pow(2,49),z8=Math.pow(2,56),W8=Math.pow(2,63),Ai={encodingLength:n=>n<U8?1:n<V8?2:n<H8?3:n<$8?4:n<K8?5:n<G8?6:n<j8?7:n<z8?8:n<W8?9:10,encode(n,e,t=0){if(null!=Number.MAX_SAFE_INTEGER&&n>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return null==e&&(e=Ac(Ai.encodingLength(n))),Ki.fromNumber(n).toBytes(e,t),e},decode:(n,e=0)=>Ki.fromBytes(n,e).toNumber(!0)},Yd=n=>{const e=Ai.encodingLength(n),t=function Q8(n){return null!=globalThis?.Buffer?.allocUnsafe?globalThis.Buffer.allocUnsafe(n):new Uint8Array(n)}(e);return Ai.encode(n,t),Yd.bytes=e,t};function ao(n){const e=(n=n??{}).lengthEncoder??Yd;return function(){var r=Vt(function*(i){var a,s=!1,o=!1;try{for(var _,u=ut(i);s=!(_=yield qe(u.next())).done;s=!1){const x=_.value,P=e(x.byteLength);P instanceof Uint8Array?yield P:yield*Mr(ut(P),qe),x instanceof Uint8Array?yield x:yield*Mr(ut(x),qe)}}catch(x){o=!0,a=x}finally{try{s&&null!=u.return&&(yield qe(u.return()))}finally{if(o)throw a}}});return function(s){return r.apply(this,arguments)}}()}Yd.bytes=0,ao.single=(n,e)=>new yr(((e=e??{}).lengthEncoder??Yd)(n.byteLength),n);var se=R(2535),Oo=(()=>{return(n=Oo||(Oo={}))[n.LENGTH=0]="LENGTH",n[n.DATA=1]="DATA",Oo;var n})();const Oy=n=>{const e=Ai.decode(n);return Oy.bytes=Ai.encodingLength(e),e};function ys(n){return function(){var t=Vt(function*(r){const i=new yr;let s=Oo.LENGTH,o=-1;const a=n?.lengthDecoder??Oy,u=n?.maxLengthLength??8,_=n?.maxDataLength??4194304;var B,x=!1,P=!1;try{for(var W,U=ut(r);x=!(W=yield qe(U.next())).done;x=!1)for(i.append(W.value);i.byteLength>0;){if(s===Oo.LENGTH)try{if(o=a(i),o<0)throw se(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>_)throw se(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");i.consume(a.bytes),null!=n?.onLength&&n.onLength(o),s=Oo.DATA}catch(re){if(re instanceof RangeError){if(i.byteLength>u)throw se(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw re}if(s===Oo.DATA){if(i.byteLength<o)break;const re=i.sublist(0,o);i.consume(o),null!=n?.onData&&n.onData(re),yield re,s=Oo.LENGTH}}}catch(X){P=!0,B=X}finally{try{x&&null!=U.return&&(yield qe(U.return()))}finally{if(P)throw B}}if(i.byteLength>0)throw se(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")});return function(i){return t.apply(this,arguments)}}()}function hC(n,e={}){const t=Qd(n),r=ys.fromReader(t.reader,e),i={read:(s=$(function*(o){const{value:a}=yield t.reader.next(o);if(null==a)throw new Error("Value is null");return a}),function(a){return s.apply(this,arguments)}),readLP:function(){var s=$(function*(){const{value:o}=yield r.next();if(null==o)throw new Error("Value is null");return o});return function(){return s.apply(this,arguments)}}(),readPB:function(){var s=$(function*(o){const a=yield i.readLP();if(null==a)throw new Error("Value is null");const u=a instanceof Uint8Array?a:a.subarray();return o.decode(u)});return function(a){return s.apply(this,arguments)}}(),write:s=>{s instanceof Uint8Array?t.writer.push(s):t.writer.push(s.subarray())},writeLP:s=>{i.write(ao.single(s,e))},writePB:(s,o)=>{i.writeLP(o.encode(s))},pb:s=>{return{read:(o=$(function*(){return yield i.readPB(s)}),function(){return o.apply(this,arguments)}),write:o=>i.writePB(o,s)};var o},unwrap:()=>(t.rest(),t.stream)};var s;return i}function pC(){const n=vl();let e=!1;return{sink:(t=$(function*(r){if(e)throw new Error("already piped");e=!0,n.resolve(r)}),function(i){return t.apply(this,arguments)}),source:Vt(function*(){const t=yield qe(n.promise);yield*Mr(ut(t),qe)})()};var t}function Zd(){return ky.apply(this,arguments)}function ky(){return ky=Vt(function*(...n){const e=Ea({objectMode:!0});Promise.resolve().then($(function*(){try{yield Promise.all(n.map(function(){var t=$(function*(r){var o,i=!1,s=!1;try{for(var u,a=ut(r);i=!(u=yield a.next()).done;i=!1)e.push(u.value)}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}});return function(r){return t.apply(this,arguments)}}())),e.end()}catch(t){e.end(t)}})),yield*Mr(ut(e),qe)}),ky.apply(this,arguments)}Oy.bytes=0,ys.fromReader=(n,e)=>{let t=1;const r=Vt(function*(){for(;;)try{const{done:s,value:o}=yield qe(n.next(t));if(!0===s)return;null!=o&&(yield o)}catch(s){if("ERR_UNDER_READ"===s.code)return{done:!0,value:null};throw s}finally{t=1}})();return ys({...e??{},onLength:s=>{t=s}})(r)};const gC=n=>null!=n&&("function"==typeof n[Symbol.asyncIterator]||"function"==typeof n[Symbol.iterator]||"function"==typeof n.next),Ly=n=>null!=n&&"function"==typeof n.sink&&gC(n.source),e6=n=>e=>{const t=n.sink(e);if(null!=t.then){const r=Ea({objectMode:!0});return t.then(()=>{r.end()},s=>{r.end(s)}),Zd(r,function(){var s=Vt(function*(){yield*Mr(ut(n.source),qe),r.end()});return function(){return s.apply(this,arguments)}}()())}return n.source};function zn(n,...e){if(Ly(n)){const r=n;n=()=>r.source}else if(gC(n)){const r=n;n=()=>r}const t=[n,...e];if(t.length>1&&Ly(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let r=1;r<t.length-1;r++)Ly(t[r])&&(t[r]=e6(t[r]));return((...n)=>{let e;for(;n.length>0;)e=n.shift()(e);return e})(...t)}const El=65535,t6=Boolean(globalThis.process?.env?.DUMP_SESSION_KEYS);var n6=R(5705),By=R(5006),mC=R(893),Xd=R(1780);const r6={hashSHA256:n=>(0,mC.vp)(n),getHKDF(n,e){const i=new n6.t(mC.mE,e,n).expand(96);return[i.subarray(0,32),i.subarray(32,64),i.subarray(64,96)]},generateX25519KeyPair(){const n=By.Au();return{publicKey:n.publicKey,privateKey:n.secretKey}},generateX25519KeyPairFromSeed(n){const e=By._w(n);return{publicKey:e.publicKey,privateKey:e.secretKey}},generateX25519SharedKey:(n,e)=>By.gi(n,e),chaCha20Poly1305Encrypt:(n,e,t,r)=>new Xd.OK(r).seal(e,n,t),chaCha20Poly1305Decrypt:(n,e,t,r,i)=>new Xd.OK(r).open(e,n,t,i)},Jd=n=>{const e=globalThis.Buffer?globalThis.Buffer.allocUnsafe(2):new Uint8Array(2);return new DataView(e.buffer,e.byteOffset,e.byteLength).setUint16(0,n,!1),e};Jd.bytes=2;const eh=n=>{if(n.length<2)throw RangeError("Could not decode int16BE");return n instanceof Uint8Array?new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,!1):n.getUint16(0)};eh.bytes=2;class th extends Error{constructor(e="Unexpected Peer"){super(e),this.code=th.code}static get code(){return"ERR_UNEXPECTED_PEER"}}class Rc extends Error{constructor(e="Invalid crypto exchange"){super(e),this.code=Rc.code}static get code(){return"ERR_INVALID_CRYPTO_EXCHANGE"}}Error;var Gi=R(7270),Pc=R(4354),ji=R(1650),Nc=R(813),Mc=R(7211);!function h6(){Mc._configure(),Gi._configure(Pc),ji._configure(Nc)}();const EC=["uint64","int64","sint64","fixed64","sfixed64"];function _C(n,e){const t=function g6(n){return function p6(n){for(const e of EC){if(null==n[e])continue;const t=n[e];n[e]=function(){return BigInt(t.call(this).toString())}}return n}(new Gi(n))}(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}function bC(n,e){const t=function m6(){return function y6(n){for(const e of EC){if(null==n[e])continue;const t=n[e];n[e]=function(r){return t.call(this,r.toString())}}return n}(ji.create())}();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}var _l=(()=>{return(n=_l||(_l={}))[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32",_l;var n})();function wC(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}function SC(n,e){return wC("message",_l.LENGTH_DELIMITED,n,e)}var Oc,kc,or=(()=>{return(n=or||(or={})).RSA="RSA",n.Ed25519="Ed25519",n.Secp256k1="Secp256k1",or;var n})(),nh=(()=>{return(n=nh||(nh={}))[n.RSA=0]="RSA",n[n.Ed25519=1]="Ed25519",n[n.Secp256k1=2]="Secp256k1",nh;var n})();(or||(or={})).codec=()=>function v6(n){function e(i){if(null==n[i.toString()])throw new Error("Invalid enum value");return n[i]}return wC("enum",_l.VARINT,function(s,o){const a=e(s);o.int32(a)},function(s){return e(s.int32())})}(nh),function(n){let e;n.codec=()=>(null==e&&(e=SC((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.Type&&(r.uint32(8),or.codec().encode(t.Type,r)),null!=t.Data&&(r.uint32(18),r.bytes(t.Data)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.Type=or.codec().decode(t);break;case 2:i.Data=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>bC(t,n.codec()),n.decode=t=>_C(t,n.codec())}(Oc||(Oc={})),function(n){let e;n.codec=()=>(null==e&&(e=SC((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.Type&&(r.uint32(8),or.codec().encode(t.Type,r)),null!=t.Data&&(r.uint32(18),r.bytes(t.Data)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.Type=or.codec().decode(t);break;case 2:i.Data=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>bC(t,n.codec()),n.decode=t=>_C(t,n.codec())}(kc||(kc={})),R(7791),R(2158);var Nn=R(8659);const w6=function E6(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<n.length;i++){var s=n.charAt(i),o=s.charCodeAt(0);if(255!==t[o])throw new TypeError(s+" is ambiguous");t[o]=i}var a=n.length,u=n.charAt(0),_=Math.log(a)/Math.log(256),x=Math.log(256)/Math.log(a);function B(W){if("string"!=typeof W)throw new TypeError("Expected String");if(0===W.length)return new Uint8Array;var X=0;if(" "!==W[X]){for(var re=0,fe=0;W[X]===u;)re++,X++;for(var Ie=(W.length-X)*_+1>>>0,ae=new Uint8Array(Ie);W[X];){var Ce=t[W.charCodeAt(X)];if(255===Ce)return;for(var Ue=0,xe=Ie-1;(0!==Ce||Ue<fe)&&-1!==xe;xe--,Ue++)ae[xe]=(Ce+=a*ae[xe]>>>0)%256>>>0,Ce=Ce/256>>>0;if(0!==Ce)throw new Error("Non-zero carry");fe=Ue,X++}if(" "!==W[X]){for(var ht=Ie-fe;ht!==Ie&&0===ae[ht];)ht++;for(var lt=new Uint8Array(re+(Ie-ht)),nn=re;ht!==Ie;)lt[nn++]=ae[ht++];return lt}}}return{encode:function P(W){if(W instanceof Uint8Array||(ArrayBuffer.isView(W)?W=new Uint8Array(W.buffer,W.byteOffset,W.byteLength):Array.isArray(W)&&(W=Uint8Array.from(W))),!(W instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===W.length)return"";for(var X=0,re=0,fe=0,Ie=W.length;fe!==Ie&&0===W[fe];)fe++,X++;for(var ae=(Ie-fe)*x+1>>>0,Ce=new Uint8Array(ae);fe!==Ie;){for(var Ue=W[fe],xe=0,ht=ae-1;(0!==Ue||xe<re)&&-1!==ht;ht--,xe++)Ce[ht]=(Ue+=256*Ce[ht]>>>0)%a>>>0,Ue=Ue/a>>>0;if(0!==Ue)throw new Error("Non-zero carry");re=xe,fe++}for(var lt=ae-re;lt!==ae&&0===Ce[lt];)lt++;for(var nn=u.repeat(X);lt<ae;++lt)nn+=n.charAt(Ce[lt]);return nn},decodeUnsafe:B,decode:function U(W){var X=B(W);if(X)return X;throw new Error(`Non-${e} character`)}}},Lc=(new Uint8Array(0),n=>{if(n instanceof Uint8Array&&"Uint8Array"===n.constructor.name)return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")});class D6{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class x6{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return IC(this,e)}}class A6{constructor(e){this.decoders=e}or(e){return IC(this,e)}decode(e){const r=this.decoders[e[0]];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const IC=(n,e)=>new A6({...n.decoders||{[n.prefix]:n},...e.decoders||{[e.prefix]:e}});class R6{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new D6(e,t,r),this.decoder=new x6(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const rh=({name:n,prefix:e,encode:t,decode:r})=>new R6(n,e,t,r),bl=({prefix:n,name:e,alphabet:t})=>{const{encode:r,decode:i}=w6(t,e);return rh({prefix:n,name:e,encode:r,decode:s=>Lc(i(s))})},kr=({name:n,prefix:e,bitsPerChar:t,alphabet:r})=>rh({prefix:e,name:n,encode:i=>((n,e,t)=>{const r="="===e[e.length-1],i=(1<<t)-1;let s="",o=0,a=0;for(let u=0;u<n.length;++u)for(a=a<<8|n[u],o+=8;o>t;)o-=t,s+=e[i&a>>o];if(o&&(s+=e[i&a<<t-o]),r)for(;s.length*t&7;)s+="=";return s})(i,r,t),decode:i=>((n,e,t,r)=>{const i={};for(let x=0;x<e.length;++x)i[e[x]]=x;let s=n.length;for(;"="===n[s-1];)--s;const o=new Uint8Array(s*t/8|0);let a=0,u=0,_=0;for(let x=0;x<s;++x){const P=i[n[x]];if(void 0===P)throw new SyntaxError(`Non-${r} character`);u=u<<t|P,a+=t,a>=8&&(a-=8,o[_++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o})(i,r,t,n)}),M6=rh({prefix:"\0",name:"identity",encode:n=>(n=>(new TextDecoder).decode(n))(n),decode:n=>(n=>(new TextEncoder).encode(n))(n)}),O6=kr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),k6=kr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),L6=bl({prefix:"9",name:"base10",alphabet:"0123456789"}),B6=kr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),F6=kr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),co=kr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),U6=kr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),V6=kr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),H6=kr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$6=kr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),K6=kr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),G6=kr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),j6=kr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),z6=kr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),W6=bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),q6=bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),ii=bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Q6=bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),ih=kr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Y6=kr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Z6=kr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),X6=kr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),TC=Array.from("\u{1f680}\u{1fa90}\u2604\u{1f6f0}\u{1f30c}\u{1f311}\u{1f312}\u{1f313}\u{1f314}\u{1f315}\u{1f316}\u{1f317}\u{1f318}\u{1f30d}\u{1f30f}\u{1f30e}\u{1f409}\u2600\u{1f4bb}\u{1f5a5}\u{1f4be}\u{1f4bf}\u{1f602}\u2764\u{1f60d}\u{1f923}\u{1f60a}\u{1f64f}\u{1f495}\u{1f62d}\u{1f618}\u{1f44d}\u{1f605}\u{1f44f}\u{1f601}\u{1f525}\u{1f970}\u{1f494}\u{1f496}\u{1f499}\u{1f622}\u{1f914}\u{1f606}\u{1f644}\u{1f4aa}\u{1f609}\u263a\u{1f44c}\u{1f917}\u{1f49c}\u{1f614}\u{1f60e}\u{1f607}\u{1f339}\u{1f926}\u{1f389}\u{1f49e}\u270c\u2728\u{1f937}\u{1f631}\u{1f60c}\u{1f338}\u{1f64c}\u{1f60b}\u{1f497}\u{1f49a}\u{1f60f}\u{1f49b}\u{1f642}\u{1f493}\u{1f929}\u{1f604}\u{1f600}\u{1f5a4}\u{1f603}\u{1f4af}\u{1f648}\u{1f447}\u{1f3b6}\u{1f612}\u{1f92d}\u2763\u{1f61c}\u{1f48b}\u{1f440}\u{1f62a}\u{1f611}\u{1f4a5}\u{1f64b}\u{1f61e}\u{1f629}\u{1f621}\u{1f92a}\u{1f44a}\u{1f973}\u{1f625}\u{1f924}\u{1f449}\u{1f483}\u{1f633}\u270b\u{1f61a}\u{1f61d}\u{1f634}\u{1f31f}\u{1f62c}\u{1f643}\u{1f340}\u{1f337}\u{1f63b}\u{1f613}\u2b50\u2705\u{1f97a}\u{1f308}\u{1f608}\u{1f918}\u{1f4a6}\u2714\u{1f623}\u{1f3c3}\u{1f490}\u2639\u{1f38a}\u{1f498}\u{1f620}\u261d\u{1f615}\u{1f33a}\u{1f382}\u{1f33b}\u{1f610}\u{1f595}\u{1f49d}\u{1f64a}\u{1f639}\u{1f5e3}\u{1f4ab}\u{1f480}\u{1f451}\u{1f3b5}\u{1f91e}\u{1f61b}\u{1f534}\u{1f624}\u{1f33c}\u{1f62b}\u26bd\u{1f919}\u2615\u{1f3c6}\u{1f92b}\u{1f448}\u{1f62e}\u{1f646}\u{1f37b}\u{1f343}\u{1f436}\u{1f481}\u{1f632}\u{1f33f}\u{1f9e1}\u{1f381}\u26a1\u{1f31e}\u{1f388}\u274c\u270a\u{1f44b}\u{1f630}\u{1f928}\u{1f636}\u{1f91d}\u{1f6b6}\u{1f4b0}\u{1f353}\u{1f4a2}\u{1f91f}\u{1f641}\u{1f6a8}\u{1f4a8}\u{1f92c}\u2708\u{1f380}\u{1f37a}\u{1f913}\u{1f619}\u{1f49f}\u{1f331}\u{1f616}\u{1f476}\u{1f974}\u25b6\u27a1\u2753\u{1f48e}\u{1f4b8}\u2b07\u{1f628}\u{1f31a}\u{1f98b}\u{1f637}\u{1f57a}\u26a0\u{1f645}\u{1f61f}\u{1f635}\u{1f44e}\u{1f932}\u{1f920}\u{1f927}\u{1f4cc}\u{1f535}\u{1f485}\u{1f9d0}\u{1f43e}\u{1f352}\u{1f617}\u{1f911}\u{1f30a}\u{1f92f}\u{1f437}\u260e\u{1f4a7}\u{1f62f}\u{1f486}\u{1f446}\u{1f3a4}\u{1f647}\u{1f351}\u2744\u{1f334}\u{1f4a3}\u{1f438}\u{1f48c}\u{1f4cd}\u{1f940}\u{1f922}\u{1f445}\u{1f4a1}\u{1f4a9}\u{1f450}\u{1f4f8}\u{1f47b}\u{1f910}\u{1f92e}\u{1f3bc}\u{1f975}\u{1f6a9}\u{1f34e}\u{1f34a}\u{1f47c}\u{1f48d}\u{1f4e3}\u{1f942}"),J6=TC.reduce((n,e,t)=>(n[t]=e,n),[]),e5=TC.reduce((n,e,t)=>(n[e.codePointAt(0)]=t,n),[]),r5=rh({prefix:"\u{1f680}",name:"base256emoji",encode:function t5(n){return n.reduce((e,t)=>e+J6[t],"")},decode:function n5(n){const e=[];for(const t of n){const r=e5[t.codePointAt(0)];if(void 0===r)throw new Error(`Non-base256emoji character: ${t}`);e.push(r)}return new Uint8Array(e)}});var a5=Math.pow(2,31),l5=Math.pow(2,7),f5=Math.pow(2,14),d5=Math.pow(2,21),h5=Math.pow(2,28),p5=Math.pow(2,35),g5=Math.pow(2,42),y5=Math.pow(2,49),m5=Math.pow(2,56),v5=Math.pow(2,63),_5={encode:function DC(n,e,t){e=e||[];for(var r=t=t||0;n>=a5;)e[t++]=255&n|128,n/=128;for(;-128&n;)e[t++]=255&n|128,n>>>=7;return e[t]=0|n,DC.bytes=t-r+1,e},decode:function Fy(n,r){var o,t=0,i=0,s=r=r||0,a=n.length;do{if(s>=a)throw Fy.bytes=0,new RangeError("Could not decode varint");o=n[s++],t+=i<28?(127&o)<<i:(127&o)*Math.pow(2,i),i+=7}while(o>=128);return Fy.bytes=s-r,t},encodingLength:function(n){return n<l5?1:n<f5?2:n<d5?3:n<h5?4:n<p5?5:n<g5?6:n<y5?7:n<m5?8:n<v5?9:10}};const sh=_5,Uy=(n,e=0)=>[sh.decode(n,e),sh.decode.bytes],oh=(n,e,t=0)=>(sh.encode(n,e,t),e),ah=n=>sh.encodingLength(n),Bc=(n,e)=>{const t=e.byteLength,r=ah(n),i=r+ah(t),s=new Uint8Array(i+t);return oh(n,s,0),oh(t,s,r),s.set(e,i),new Vy(n,t,e,s)},ch=n=>{const e=Lc(n),[t,r]=Uy(e),[i,s]=Uy(e.subarray(r)),o=e.subarray(r+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Vy(t,i,o,e)};class Vy{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}const AC=({name:n,code:e,encode:t})=>new S5(n,e,t);class S5{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Bc(this.code,t):t.then(r=>Bc(this.code,r))}throw Error("Unknown type, must be binary type")}}const RC=n=>function(){var e=$(function*(t){return new Uint8Array(yield crypto.subtle.digest(n,t))});return function(t){return e.apply(this,arguments)}}(),di=AC({name:"sha2-256",code:18,encode:RC("SHA-256")}),I5=AC({name:"sha2-512",code:19,encode:RC("SHA-512")}),NC=Lc,Fc={code:0,name:"identity",encode:NC,digest:n=>Bc(0,NC(n))},C5="raw",D5=85,x5=n=>Lc(n),A5=n=>Lc(n),R5=new TextEncoder,P5=new TextDecoder,N5="json",M5=512,O5=n=>R5.encode(JSON.stringify(n)),k5=n=>JSON.parse(P5.decode(n)),MC=new WeakMap,Hy=n=>{const e=MC.get(n);if(null==e){const t=new Map;return MC.set(n,t),t}return e};class ar{constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:e,multihash:t}=this;if(e!==wl)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==V5)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ar.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=Bc(e,t);return ar.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return ar.equals(this,e)}static equals(e,t){return t&&e.code===t.code&&e.version===t.version&&((n,e)=>{if(n===e)return!0;{const t=e;return n.code===t.code&&n.size===t.size&&t.bytes instanceof Uint8Array&&((n,e)=>{if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.byteLength;t++)if(n[t]!==e[t])return!1;return!0})(n.bytes,t.bytes)}})(e.multihash,t.multihash)}toString(e){return((n,e)=>{const{bytes:t,version:r}=n;return 0===r?F5(t,Hy(n),e||ii.encoder):U5(t,Hy(n),e||co.encoder)})(this,e)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(null==e)return null;const t=e;if(t instanceof ar)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:r,code:i,multihash:s,bytes:o}=t;return new ar(r,i,s,o||OC(r,i,s.bytes))}if(!0===t[H5]){const{version:r,multihash:i,code:s}=t,o=ch(i);return ar.create(r,s,o)}return null}static create(e,t,r){if("number"!=typeof t)throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:if(t!==wl)throw new Error(`Version 0 CID must use dag-pb (code: ${wl}) block encoding`);return new ar(e,t,r,r.bytes);case 1:{const i=OC(e,t,r.bytes);return new ar(e,t,r,i)}default:throw new Error("Invalid version")}}static createV0(e){return ar.create(0,wl,e)}static createV1(e,t){return ar.create(1,e,t)}static decode(e){const[t,r]=ar.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=ar.inspectBytes(e),r=t.size-t.multihashSize,i=Lc(e.subarray(r,r+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");const s=i.subarray(t.multihashSize-t.digestSize),o=new Vy(t.multihashCode,t.digestSize,s,i);return[0===t.version?ar.createV0(o):ar.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[P,B]=Uy(e.subarray(t));return t+=B,P};let i=r(),s=wl;if(18===i?(i=0,t=0):s=r(),0!==i&&1!==i)throw new RangeError(`Invalid CID version ${i}`);const o=t,a=r(),u=r(),_=t+u;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:_-o,size:_}}static parse(e,t){const[r,i]=B5(e,t),s=ar.decode(i);return Hy(s).set(r,e),s}}const B5=(n,e)=>{switch(n[0]){case"Q":return[ii.prefix,(e||ii).decode(`${ii.prefix}${n}`)];case ii.prefix:return[ii.prefix,(e||ii).decode(n)];case co.prefix:return[co.prefix,(e||co).decode(n)];default:if(null==e)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}},F5=(n,e,t)=>{const{prefix:r}=t;if(r!==ii.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);const i=e.get(r);if(null==i){const s=t.encode(n).slice(1);return e.set(r,s),s}return i},U5=(n,e,t)=>{const{prefix:r}=t,i=e.get(r);if(null==i){const s=t.encode(n);return e.set(r,s),s}return i},wl=112,V5=18,OC=(n,e,t)=>{const r=ah(n),i=r+ah(e),s=new Uint8Array(i+t.byteLength);return oh(n,s,0),oh(e,s,r),s.set(t,i),s},H5=Symbol.for("@ipld/js-cid/CID"),Sl={...y,...l,...g,...b,...m,...d,...c,...f,...p,...w};function kC(n,e,t,r){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:t},decoder:{decode:r}}}const LC=kC("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>(new TextEncoder).encode(n.substring(1))),$y=kC("ascii","a",n=>{let e="a";for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e},n=>{const e=Ac((n=n.substring(1)).length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e}),BC={utf8:LC,"utf-8":LC,hex:Sl.base16,latin1:$y,ascii:$y,binary:$y,...Sl};function At(n,e="utf8"){const t=BC[e];if(null==t)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?t.decoder.decode(`${t.prefix}${n}`):Wd(globalThis.Buffer.from(n,"utf-8"))}const ks={get(n=globalThis){const e=n.crypto;if(null==e||null==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 G5=R(4747);function kt(n,e="utf8"){const t=BC[e];if(null==t)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?t.encoder.encode(n).substring(1):globalThis.Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("utf8")}function Ls(n,e){let t=Uint8Array.from(n.abs().toByteArray());if(t=0===t[0]?t.subarray(1):t,null!=e){if(t.length>e)throw new Error("byte array longer than desired length");t=gr([new Uint8Array(e-t.length),t])}return kt(t,"base64url")}function ms(n){const e=function j5(n,e){let t=At(n,"base64urlpad");if(null!=e){if(t.length>e)throw new Error("byte array longer than desired length");t=gr([new Uint8Array(e-t.length),t])}return t}(n);return new Nn.jsbn.BigInteger(kt(e,"base16"),16)}R(730);function $C(n){const e=n?.algorithm??"AES-GCM";let t=n?.keyLength??16;const r=n?.nonceLength??12,i=n?.digest??"SHA-256",s=n?.saltLength??16,o=n?.iterations??32767,a=ks.get();function _(){return(_=$(function*(U,W){const X=a.getRandomValues(new Uint8Array(s)),re=a.getRandomValues(new Uint8Array(r)),fe={name:e,iv:re};"string"==typeof W&&(W=At(W));const Ie={name:"PBKDF2",salt:X,iterations:o,hash:{name:i}},ae=yield a.subtle.importKey("raw",W,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),Ce=yield a.subtle.deriveKey(Ie,ae,{name:e,length:t},!0,["encrypt"]),Ue=yield a.subtle.encrypt(fe,Ce,U);return gr([X,fe.iv,new Uint8Array(Ue)])})).apply(this,arguments)}function P(){return(P=$(function*(U,W){const X=U.subarray(0,s),re=U.subarray(s,s+r),fe=U.subarray(s+r),Ie={name:e,iv:re};"string"==typeof W&&(W=At(W));const ae={name:"PBKDF2",salt:X,iterations:o,hash:{name:i}},Ce=yield a.subtle.importKey("raw",W,{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),Ue=yield a.subtle.deriveKey(ae,Ce,{name:e,length:t},!0,["decrypt"]),xe=yield a.subtle.decrypt(Ie,Ue,fe);return new Uint8Array(xe)})).apply(this,arguments)}return t*=8,{encrypt:function u(U,W){return _.apply(this,arguments)},decrypt:function x(U,W){return P.apply(this,arguments)}}}function q5(n,e){return Wy.apply(this,arguments)}function Wy(){return(Wy=$(function*(n,e){const t=ih.decode(n);return yield $C().decrypt(t,e)})).apply(this,arguments)}Object.keys({"P-256":256,"P-384":384,"P-521":521}).join(" / "),R(8985);var Q5=R(5856),Y5=R.t(Q5,2);const en=BigInt(0),Kn=BigInt(1),ko=BigInt(2),Il=BigInt(3),Z5=BigInt(8),wn=Object.freeze({a:en,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:Kn,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});function KC(n){const{a:e,b:t}=wn,r=Xe(n*n),i=Xe(r*n);return Xe(i+e*n+t)}const uh=wn.a===en;class qy extends Error{constructor(e){super(e)}}class Sn{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof pn))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new Sn(e.x,e.y,Kn)}static toAffineBatch(e){const t=function nF(n,e=wn.P){const t=new Array(n.length),i=$c(n.reduce((s,o,a)=>o===en?s:(t[a]=s,Xe(s*o,e)),Kn),e);return n.reduceRight((s,o,a)=>o===en?s:(t[a]=Xe(s*t[a],e),Xe(s*o,e)),i),t}(e.map(r=>r.z));return e.map((r,i)=>r.toAffine(t[i]))}static normalizeZ(e){return Sn.toAffineBatch(e).map(Sn.fromAffine)}equals(e){if(!(e instanceof Sn))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:i}=this,{x:s,y:o,z:a}=e,u=Xe(i*i),_=Xe(a*a),x=Xe(t*_),P=Xe(s*u),B=Xe(Xe(r*a)*_),U=Xe(Xe(o*i)*u);return x===P&&B===U}negate(){return new Sn(this.x,Xe(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,i=Xe(e*e),s=Xe(t*t),o=Xe(s*s),a=e+s,u=Xe(ko*(Xe(a*a)-i-o)),_=Xe(Il*i),x=Xe(_*_),P=Xe(x-ko*u),B=Xe(_*(u-P)-Z5*o),U=Xe(ko*t*r);return new Sn(P,B,U)}add(e){if(!(e instanceof Sn))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:i}=this,{x:s,y:o,z:a}=e;if(s===en||o===en)return this;if(t===en||r===en)return e;const u=Xe(i*i),_=Xe(a*a),x=Xe(t*_),P=Xe(s*u),B=Xe(Xe(r*a)*_),U=Xe(Xe(o*i)*u),W=Xe(P-x),X=Xe(U-B);if(W===en)return X===en?this.double():Sn.ZERO;const re=Xe(W*W),fe=Xe(W*re),Ie=Xe(x*re),ae=Xe(X*X-fe-ko*Ie),Ce=Xe(X*(Ie-ae)-B*fe),Ue=Xe(i*a*W);return new Sn(ae,Ce,Ue)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=Sn.ZERO;if("bigint"==typeof e&&e===en)return t;let r=zC(e);if(r===Kn)return this;if(!uh){let P=t,B=this;for(;r>en;)r&Kn&&(P=P.add(B)),B=B.double(),r>>=Kn;return P}let{k1neg:i,k1:s,k2neg:o,k2:a}=qC(r),u=t,_=t,x=this;for(;s>en||a>en;)s&Kn&&(u=u.add(x)),a&Kn&&(_=_.add(x)),x=x.double(),s>>=Kn,a>>=Kn;return i&&(u=u.negate()),o&&(_=_.negate()),_=new Sn(Xe(_.x*wn.beta),_.y,_.z),u.add(_)}precomputeWindow(e){const t=uh?128/e+1:256/e+1,r=[];let i=this,s=i;for(let o=0;o<t;o++){s=i,r.push(s);for(let a=1;a<2**(e-1);a++)s=s.add(i),r.push(s);i=s.double()}return r}wNAF(e,t){!t&&this.equals(Sn.BASE)&&(t=pn.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let i=t&&Qy.get(t);i||(i=this.precomputeWindow(r),t&&1!==r&&(i=Sn.normalizeZ(i),Qy.set(t,i)));let s=Sn.ZERO,o=Sn.ZERO;const a=1+(uh?128/r:256/r),u=2**(r-1),_=BigInt(2**r-1),x=2**r,P=BigInt(r);for(let B=0;B<a;B++){const U=B*u;let W=Number(e&_);if(e>>=P,W>u&&(W-=x,e+=Kn),0===W){let X=i[U];B%2&&(X=X.negate()),o=o.add(X)}else{let X=i[U+Math.abs(W)-1];W<0&&(X=X.negate()),s=s.add(X)}}return{p:s,f:o}}multiply(e,t){let i,s,r=zC(e);if(uh){const{k1neg:o,k1:a,k2neg:u,k2:_}=qC(r);let{p:x,f:P}=this.wNAF(a,t),{p:B,f:U}=this.wNAF(_,t);o&&(x=x.negate()),u&&(B=B.negate()),B=new Sn(Xe(B.x*wn.beta),B.y,B.z),i=x.add(B),s=P.add(U)}else{const{p:o,f:a}=this.wNAF(r,t);i=o,s=a}return Sn.normalizeZ([i,s])[0]}toAffine(e=$c(this.z)){const{x:t,y:r,z:i}=this,s=e,o=Xe(s*s),a=Xe(o*s),u=Xe(t*o),_=Xe(r*a);if(Xe(i*s)!==Kn)throw new Error("invZ was invalid");return new pn(u,_)}}Sn.BASE=new Sn(wn.Gx,wn.Gy,Kn),Sn.ZERO=new Sn(en,Kn,en);const Qy=new WeakMap;class pn{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,Qy.delete(this)}hasEvenY(){return this.y%ko===en}static fromCompressedHex(e){const t=32===e.length,r=hi(t?e:e.subarray(1));if(!fh(r))throw new Error("Point is not on curve");let s=function tF(n){const{P:e}=wn,t=BigInt(6),r=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),a=BigInt(88),u=n*n*n%e,_=u*u*n%e,x=zi(_,Il)*_%e,P=zi(x,Il)*_%e,B=zi(P,ko)*u%e,U=zi(B,r)*B%e,W=zi(U,i)*U%e,X=zi(W,o)*W%e,re=zi(X,a)*X%e,fe=zi(re,o)*W%e,Ie=zi(fe,Il)*_%e,ae=zi(Ie,s)*U%e,Ce=zi(ae,t)*u%e;return zi(Ce,ko)}(KC(r));const o=(s&Kn)===Kn;t?o&&(s=Xe(-s)):1==(1&e[0])!==o&&(s=Xe(-s));const a=new pn(r,s);return a.assertValidity(),a}static fromUncompressedHex(e){const t=hi(e.subarray(1,33)),r=hi(e.subarray(33,65)),i=new pn(t,r);return i.assertValidity(),i}static fromHex(e){const t=Bs(e),r=t.length,i=t[0];if(32===r||33===r&&(2===i||3===i))return this.fromCompressedHex(t);if(65===r&&4===i)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return pn.BASE.multiply(_a(e))}static fromSignature(e,t,r){const i=QC(e=Bs(e)),{r:s,s:o}=XC(t);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");const u=pn.fromHex((1&r?"03":"02")+Bo(s)),{n:_}=wn,x=$c(s,_),P=Xe(-i*x,_),B=Xe(o*x,_),U=pn.BASE.multiplyAndAddUnsafe(u,P,B);if(!U)throw new Error("Cannot recover signature: point at infinify");return U.assertValidity(),U}toRawBytes(e=!1){return Fo(this.toHex(e))}toHex(e=!1){const t=Bo(this.x);return e?`${this.hasEvenY()?"02":"03"}${t}`:`04${t}${Bo(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!fh(t)||!fh(r))throw new Error(e);const i=Xe(r*r);if(Xe(i-KC(t))!==en)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new pn(this.x,Xe(-this.y))}double(){return Sn.fromAffine(this).double().toAffine()}add(e){return Sn.fromAffine(this).add(Sn.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Sn.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const i=Sn.fromAffine(this),s=t===en||t===Kn||this!==pn.BASE?i.multiplyUnsafe(t):i.multiply(t),o=Sn.fromAffine(e).multiplyUnsafe(r),a=s.add(o);return a.equals(Sn.ZERO)?void 0:a.toAffine()}}function GC(n){return Number.parseInt(n[0],16)>=8?"00"+n:n}function jC(n){if(n.length<2||2!==n[0])throw new Error(`Invalid signature integer tag: ${Vc(n)}`);const e=n[1],t=n.subarray(2,e+2);if(!e||t.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===t[0]&&t[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:hi(t),left:n.subarray(e+2)}}pn.BASE=new pn(wn.Gx,wn.Gy),pn.ZERO=new pn(en,en);class Lo{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof e&&!t)throw new TypeError(`${r}: Expected string or Uint8Array`);const i=t?Vc(e):e;if(128!==i.length)throw new Error(`${r}: Expected 64-byte hex`);return new Lo(lh(i.slice(0,64)),lh(i.slice(64,128)))}static fromDER(e){const t=e instanceof Uint8Array;if("string"!=typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:i}=function X5(n){if(n.length<2||48!=n[0])throw new Error(`Invalid signature tag: ${Vc(n)}`);if(n[1]!==n.length-2)throw new Error("Invalid signature: incorrect length");const{data:e,left:t}=jC(n.subarray(2)),{data:r,left:i}=jC(t);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${Vc(i)}`);return{r:e,s:r}}(t?e:Fo(e));return new Lo(r,i)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!Gc(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Gc(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){return this.s>wn.n>>Kn}normalizeS(){return this.hasHighS()?new Lo(this.r,wn.n-this.s):this}toDERRawBytes(e=!1){return Fo(this.toDERHex(e))}toDERHex(e=!1){const t=GC(Tl(this.s));if(e)return t;const r=GC(Tl(this.r)),i=Tl(r.length/2),s=Tl(t.length/2);return`30${Tl(r.length/2+t.length/2+4)}02${i}${r}02${s}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Fo(this.toCompactHex())}toCompactHex(){return Bo(this.r)+Bo(this.s)}}function Uc(...n){if(!n.every(r=>r instanceof Uint8Array))throw new Error("Uint8Array list expected");if(1===n.length)return n[0];const e=n.reduce((r,i)=>r+i.length,0),t=new Uint8Array(e);for(let r=0,i=0;r<n.length;r++){const s=n[r];t.set(s,i),i+=s.length}return t}const J5=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function Vc(n){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");let e="";for(let t=0;t<n.length;t++)e+=J5[n[t]];return e}const eF=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function Bo(n){if("bigint"!=typeof n)throw new Error("Expected bigint");if(!(en<=n&&n<eF))throw new Error("Expected number < 2^256");return n.toString(16).padStart(64,"0")}function Hc(n){const e=Fo(Bo(n));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function Tl(n){const e=n.toString(16);return 1&e.length?`0${e}`:e}function lh(n){if("string"!=typeof n)throw new TypeError("hexToNumber: expected string, got "+typeof n);return BigInt(`0x${n}`)}function Fo(n){if("string"!=typeof n)throw new TypeError("hexToBytes: expected string, got "+typeof n);if(n.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+n.length);const e=new Uint8Array(n.length/2);for(let t=0;t<e.length;t++){const r=2*t,i=n.slice(r,r+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");e[t]=s}return e}function hi(n){return lh(Vc(n))}function Bs(n){return n instanceof Uint8Array?Uint8Array.from(n):Fo(n)}function zC(n){if("number"==typeof n&&Number.isSafeInteger(n)&&n>0)return BigInt(n);if("bigint"==typeof n&&Gc(n))return n;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Xe(n,e=wn.P){const t=n%e;return t>=en?t:e+t}function zi(n,e){const{P:t}=wn;let r=n;for(;e-- >en;)r*=r,r%=t;return r}function $c(n,e=wn.P){if(n===en||e<=en)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=Xe(n,e),r=e,i=en,s=Kn,o=Kn,a=en;for(;t!==en;){const _=r/t,x=r%t,P=i-o*_,B=s-a*_;r=t,t=x,i=o,s=a,o=P,a=B}if(r!==Kn)throw new Error("invert: does not exist");return Xe(i,e)}const WC=(n,e)=>(n+e/ko)/e,rF={a1:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),b1:-Kn*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a2:BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),b2:BigInt("0x3086d221a7d46bcde86c90e49284eb15"),POW_2_128:BigInt("0x100000000000000000000000000000000")};function qC(n){const{n:e}=wn,{a1:t,b1:r,a2:i,b2:s,POW_2_128:o}=rF,a=WC(s*n,e),u=WC(-r*n,e);let _=Xe(n-a*t-u*i,e),x=Xe(-a*r-u*s,e);const P=_>o,B=x>o;if(P&&(_=e-_),B&&(x=e-x),_>o||x>o)throw new Error("splitScalarEndo: Endomorphism failed, k="+n);return{k1neg:P,k1:_,k2neg:B,k2:x}}function QC(n){const{n:e}=wn,r=8*n.length-256;let i=hi(n);return r>0&&(i>>=BigInt(r)),i>=e&&(i-=e),i}let Kc,Cl;class YC{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...e){return pi.hmacSha256(this.k,...e)}hmacSync(...e){return Cl(this.k,...e)}checkSync(){if("function"!=typeof Cl)throw new qy("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}reseed(e=new Uint8Array){var t=this;return $(function*(){t.k=yield t.hmac(t.v,Uint8Array.from([0]),e),t.v=yield t.hmac(t.v),0!==e.length&&(t.k=yield t.hmac(t.v,Uint8Array.from([1]),e),t.v=yield t.hmac(t.v))})()}reseedSync(e=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}generate(){var e=this;return $(function*(){return e.incr(),e.v=yield e.hmac(e.v),e.v})()}generateSync(){return this.checkSync(),this.incr(),this.v=this.hmacSync(this.v),this.v}}function Gc(n){return en<n&&n<wn.n}function fh(n){return en<n&&n<wn.P}function ZC(n,e,t){const r=hi(n);if(!Gc(r))return;const{n:i}=wn,s=pn.BASE.multiply(r),o=Xe(s.x,i);if(o===en)return;const a=Xe($c(r,i)*Xe(e+t*o,i),i);if(a===en)return;const u=new Lo(o,a);return{sig:u,recovery:(s.x===u.r?0:2)|Number(s.y&Kn)}}function _a(n){let e;if("bigint"==typeof n)e=n;else if("number"==typeof n&&Number.isSafeInteger(n)&&n>0)e=BigInt(n);else if("string"==typeof n){if(64!==n.length)throw new Error("Expected 32 bytes of private key");e=lh(n)}else{if(!(n instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==n.length)throw new Error("Expected 32 bytes of private key");e=hi(n)}if(!Gc(e))throw new Error("Expected private key: 0 < key < n");return e}function XC(n){if(n instanceof Lo)return n.assertValidity(),n;try{return Lo.fromDER(n)}catch{return Lo.fromCompact(n)}}function JC(n,e=!1){return pn.fromPrivateKey(n).toRawBytes(e)}function tD(n){return hi(n.length>32?n.slice(0,32):n)}function iF(n){const e=tD(n),t=Xe(e,wn.n);return nD(t<en?e:t)}function nD(n){return Hc(n)}function rD(n,e,t){if(null==n)throw new Error(`sign: expected valid message hash, not "${n}"`);const r=Bs(n),i=_a(e),s=[nD(i),iF(r)];if(null!=t){!0===t&&(t=pi.randomBytes(32));const u=Bs(t);if(32!==u.length)throw new Error("sign: Expected 32 bytes of extra data");s.push(u)}return{seed:Uc(...s),m:tD(r),d:i}}function iD(n,e){let{sig:t,recovery:r}=n;const{canonical:i,der:s,recovered:o}=Object.assign({canonical:!0,der:!0},e);i&&t.hasHighS()&&(t=t.normalizeS(),r^=1);const a=s?t.toDERRawBytes():t.toCompactRawBytes();return o?[a,r]:a}function sF(n,e){return Zy.apply(this,arguments)}function Zy(){return(Zy=$(function*(n,e,t={}){const{seed:r,m:i,d:s}=rD(n,e,t.extraEntropy);let o;const a=new YC;for(yield a.reseed(r);!(o=ZC(yield a.generate(),i,s));)yield a.reseed();return iD(o,t)})).apply(this,arguments)}const oF={strict:!0};function aF(n,e,t,r=oF){let i;try{i=XC(n),e=Bs(e)}catch{return!1}const{r:s,s:o}=i;if(r.strict&&i.hasHighS())return!1;const a=QC(e);let u;try{u=function Yy(n){return n instanceof pn?(n.assertValidity(),n):pn.fromHex(n)}(t)}catch{return!1}const{n:_}=wn,x=$c(o,_),P=Xe(a*x,_),B=Xe(s*x,_),U=pn.BASE.multiplyAndAddUnsafe(u,P,B);return!!U&&Xe(U.x,_)===s}pn.BASE._setWindowSize(8);const Ri={node:Y5,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},hh={},pi={bytesToHex:Vc,hexToBytes:Fo,concatBytes:Uc,mod:Xe,invert:$c,isValidPrivateKey(n){try{return _a(n),!0}catch{return!1}},_bigintTo32Bytes:Hc,_normalizePrivateKey:_a,hashToPrivateKey:n=>{if((n=Bs(n)).length<40||n.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return Hc(Xe(hi(n),wn.n-Kn)+Kn)},randomBytes:(n=32)=>{if(Ri.web)return Ri.web.getRandomValues(new Uint8Array(n));if(Ri.node){const{randomBytes:e}=Ri.node;return Uint8Array.from(e(n))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>pi.hashToPrivateKey(pi.randomBytes(40)),sha256:(n=$(function*(...e){if(Ri.web){const t=yield Ri.web.subtle.digest("SHA-256",Uc(...e));return new Uint8Array(t)}if(Ri.node){const{createHash:t}=Ri.node,r=t("sha256");return e.forEach(i=>r.update(i)),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")}),function(){return n.apply(this,arguments)}),hmacSha256:function(){var n=$(function*(e,...t){if(Ri.web){const r=yield Ri.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),i=Uc(...t),s=yield Ri.web.subtle.sign("HMAC",r,i);return new Uint8Array(s)}if(Ri.node){const{createHmac:r}=Ri.node,i=r("sha256",e);return t.forEach(s=>i.update(s)),Uint8Array.from(i.digest())}throw new Error("The environment doesn't have hmac-sha256 function")});return function(t){return n.apply(this,arguments)}}(),sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:function(){var n=$(function*(e,...t){let r=hh[e];if(void 0===r){const i=yield pi.sha256(Uint8Array.from(e,s=>s.charCodeAt(0)));r=Uc(i,i),hh[e]=r}return pi.sha256(r,...t)});return function(t){return n.apply(this,arguments)}}(),taggedHashSync:(n,...e)=>{if("function"!=typeof Kc)throw new qy("sha256Sync is undefined, you need to set it");let t=hh[n];if(void 0===t){const r=Kc(Uint8Array.from(n,i=>i.charCodeAt(0)));t=Uc(r,r),hh[n]=t}return Kc(t,...e)},precompute(n=8,e=pn.BASE){const t=e===pn.BASE?e:new pn(e.x,e.y);return t._setWindowSize(n),t.multiply(Il),t}};var n;function ph(n){if(isNaN(n)||n<=0)throw se(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return pi.randomBytes(n)}function fF(n){const e=Nn.asn1.fromDer(kt(n,"ascii")),t=Nn.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:Ls(t.n),e:Ls(t.e),d:Ls(t.d),p:Ls(t.p),q:Ls(t.q),dp:Ls(t.dP),dq:Ls(t.dQ),qi:Ls(t.qInv),alg:"RS256"}}function lD(n,e){return e.map(t=>ms(n[t]))}function mF(n){return em.apply(this,arguments)}function em(){return em=$(function*(n){const e=yield ks.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:n,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),t=yield dD(e);return{privateKey:t[0],publicKey:t[1]}}),em.apply(this,arguments)}function fD(n){return tm.apply(this,arguments)}function tm(){return tm=$(function*(n){const t=[yield ks.get().subtle.importKey("jwk",n,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),yield _F(n)],r=yield dD({privateKey:t[0],publicKey:t[1]});return{privateKey:r[0],publicKey:r[1]}}),tm.apply(this,arguments)}function nm(){return nm=$(function*(n,e){const t=yield ks.get().subtle.importKey("jwk",n,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),r=yield ks.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},t,Uint8Array.from(e));return new Uint8Array(r,0,r.byteLength)}),nm.apply(this,arguments)}function rm(){return rm=$(function*(n,e,t){const r=yield ks.get().subtle.importKey("jwk",n,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return yield ks.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},r,e,t)}),rm.apply(this,arguments)}function dD(n){return im.apply(this,arguments)}function im(){return im=$(function*(n){if(null==n.privateKey||null==n.publicKey)throw se(new Error("Private and public key are required"),"ERR_INVALID_PARAMETERS");return yield Promise.all([ks.get().subtle.exportKey("jwk",n.privateKey),ks.get().subtle.exportKey("jwk",n.publicKey)])}),im.apply(this,arguments)}function _F(n){return sm.apply(this,arguments)}function sm(){return sm=$(function*(n){return yield ks.get().subtle.importKey("jwk",{kty:n.kty,n:n.n,e:n.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}),sm.apply(this,arguments)}function hD(n,e,t,r){const i=e?function yF(n){return Nn.pki.setRsaPublicKey(...lD(n,["n","e"]))}(n):function gF(n){return Nn.pki.setRsaPrivateKey(...lD(n,["n","e","d","p","q","dp","dq","qi"]))}(n);return At(r(kt(Uint8Array.from(t),"ascii"),i),"ascii")}function om(n,e){return am.apply(this,arguments)}function am(){return am=$(function*(n,e){const r=yield $C().encrypt(n,e);return ih.encode(r)}),am.apply(this,arguments)}Object.defineProperties(pi,{sha256Sync:{configurable:!1,get:()=>Kc,set(n){Kc||(Kc=n)}},hmacSha256Sync:{configurable:!1,get:()=>Cl,set(n){Cl||(Cl=n)}}}),R(5517);class cm{constructor(e){this._key=e}verify(e,t){var r=this;return $(function*(){return yield function EF(n,e,t){return rm.apply(this,arguments)}(r._key,t,e)})()}marshal(){return function pF(n){if(null==n.n||null==n.e)throw se(new Error("JWK was missing components"),"ERR_INVALID_PARAMETERS");const e=Nn.pki.publicKeyToAsn1({n:ms(n.n),e:ms(n.e)});return At(Nn.asn1.toDer(e).getBytes(),"ascii")}(this._key)}get bytes(){return Oc.encode({Type:or.RSA,Data:this.marshal()}).subarray()}encrypt(e){return function bF(n,e){return hD(n,!0,e,(t,r)=>r.encrypt(t))}(this._key,e)}equals(e){return Or(this.bytes,e.bytes)}hash(){var e=this;return $(function*(){const{bytes:t}=yield di.digest(e.bytes);return t})()}}class gh{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return ph(16)}sign(e){var t=this;return $(function*(){return yield function vF(n,e){return nm.apply(this,arguments)}(t._key,e)})()}get public(){if(null==this._publicKey)throw se(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new cm(this._publicKey)}decrypt(e){return function wF(n,e){return hD(n,!1,e,(t,r)=>r.decrypt(t))}(this._key,e)}marshal(){return function dF(n){if(null==n.n||null==n.e||null==n.d||null==n.p||null==n.q||null==n.dp||null==n.dq||null==n.qi)throw se(new Error("JWK was missing components"),"ERR_INVALID_PARAMETERS");const e=Nn.pki.privateKeyToAsn1({n:ms(n.n),e:ms(n.e),d:ms(n.d),p:ms(n.p),q:ms(n.q),dP:ms(n.dp),dQ:ms(n.dq),qInv:ms(n.qi)});return At(Nn.asn1.toDer(e).getBytes(),"ascii")}(this._key)}get bytes(){return kc.encode({Type:or.RSA,Data:this.marshal()}).subarray()}equals(e){return Or(this.bytes,e.bytes)}hash(){var e=this;return $(function*(){const{bytes:t}=yield di.digest(e.bytes);return t})()}id(){var e=this;return $(function*(){return kt(yield e.public.hash(),"base58btc")})()}export(e,t="pkcs-8"){var r=this;return $(function*(){if("pkcs-8"===t){const i=new Nn.util.ByteBuffer(r.marshal()),s=Nn.asn1.fromDer(i),o=Nn.pki.privateKeyFromAsn1(s);return Nn.pki.encryptRsaPrivateKey(o,e,{algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"})}if("libp2p-key"===t)return yield om(r.bytes,e);throw se(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")})()}}function SF(n){return um.apply(this,arguments)}function um(){return um=$(function*(n){const e=fF(n),t=yield fD(e);return new gh(t.privateKey,t.publicKey)}),um.apply(this,arguments)}function IF(n){const e=function hF(n){const e=Nn.asn1.fromDer(kt(n,"ascii")),t=Nn.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:Ls(t.n),e:Ls(t.e)}}(n);return new cm(e)}function TF(n){return lm.apply(this,arguments)}function lm(){return lm=$(function*(n){const e=yield fD(n);return new gh(e.privateKey,e.publicKey)}),lm.apply(this,arguments)}function CF(n){return fm.apply(this,arguments)}function fm(){return fm=$(function*(n){const e=yield mF(n);return new gh(e.privateKey,e.publicKey)}),fm.apply(this,arguments)}var DF=R(7420),xF=R.t(DF,2);const er=BigInt(0),Xt=BigInt(1),zc=BigInt(2),pD=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),Mn=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:pD,n:pD,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),gD=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),Dl=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),AF=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),RF=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),PF=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),NF=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class un{constructor(e,t,r,i){this.x=e,this.y=t,this.z=r,this.t=i}static fromAffine(e){if(!(e instanceof Yn))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(Yn.ZERO)?un.ZERO:new un(e.x,e.y,Xt,De(e.x*e.y))}static toAffineBatch(e){const t=function kF(n,e=Mn.P){const t=new Array(n.length),i=yh(n.reduce((s,o,a)=>o===er?s:(t[a]=s,De(s*o,e)),Xt),e);return n.reduceRight((s,o,a)=>o===er?s:(t[a]=De(s*t[a],e),De(s*o,e)),i),t}(e.map(r=>r.z));return e.map((r,i)=>r.toAffine(t[i]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){yD(e);const{x:t,y:r,z:i}=this,{x:s,y:o,z:a}=e,u=De(t*a),_=De(s*i),x=De(r*a),P=De(o*i);return u===_&&x===P}negate(){return new un(De(-this.x),this.y,this.z,De(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:i}=Mn,s=De(e*e),o=De(t*t),a=De(zc*De(r*r)),u=De(i*s),_=e+t,x=De(De(_*_)-s-o),P=u+o,B=P-a,U=u-o,W=De(x*B),X=De(P*U),re=De(x*U),fe=De(B*P);return new un(W,X,fe,re)}add(e){yD(e);const{x:t,y:r,z:i,t:s}=this,{x:o,y:a,z:u,t:_}=e,x=De((r-t)*(a+o)),P=De((r+t)*(a-o)),B=De(P-x);if(B===er)return this.double();const U=De(i*zc*_),W=De(s*zc*u),X=W+U,re=P+x,fe=W-U,Ie=De(X*B),ae=De(re*fe),Ce=De(X*fe),Ue=De(B*re);return new un(Ie,ae,Ue,Ce)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let i=this,s=i;for(let o=0;o<t;o++){s=i,r.push(s);for(let a=1;a<2**(e-1);a++)s=s.add(i),r.push(s);i=s.double()}return r}wNAF(e,t){!t&&this.equals(un.BASE)&&(t=Yn.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let i=t&&pm.get(t);i||(i=this.precomputeWindow(r),t&&1!==r&&(i=un.normalizeZ(i),pm.set(t,i)));let s=un.ZERO,o=un.ZERO;const a=1+256/r,u=2**(r-1),_=BigInt(2**r-1),x=2**r,P=BigInt(r);for(let B=0;B<a;B++){const U=B*u;let W=Number(e&_);if(e>>=P,W>u&&(W-=x,e+=Xt),0===W){let X=i[U];B%2&&(X=X.negate()),o=o.add(X)}else{let X=i[U+Math.abs(W)-1];W<0&&(X=X.negate()),s=s.add(X)}}return un.normalizeZ([s,o])[0]}multiply(e,t){return this.wNAF(Yc(e,Mn.l),t)}multiplyUnsafe(e){let t=Yc(e,Mn.l,!1);const r=un.BASE,i=un.ZERO;if(t===er)return i;if(this.equals(i)||t===Xt)return this;if(this.equals(r))return this.wNAF(t);let s=i,o=this;for(;t>er;)t&Xt&&(s=s.add(o)),o=o.double(),t>>=Xt;return s}isSmallOrder(){return this.multiplyUnsafe(Mn.h).equals(un.ZERO)}isTorsionFree(){return this.multiplyUnsafe(Mn.l).equals(un.ZERO)}toAffine(e=yh(this.z)){const{x:t,y:r,z:i}=this,s=De(t*e),o=De(r*e);if(De(i*e)!==Xt)throw new Error("invZ was invalid");return new Yn(s,o)}fromRistrettoBytes(){hm()}toRistrettoBytes(){hm()}fromRistrettoHash(){hm()}}function yD(n){if(!(n instanceof un))throw new TypeError("ExtendedPoint expected")}function dm(n){if(!(n instanceof Wi))throw new TypeError("RistrettoPoint expected")}function hm(){throw new Error("Legacy method: switch to RistrettoPoint")}un.BASE=new un(Mn.Gx,Mn.Gy,Xt,De(Mn.Gx*Mn.Gy)),un.ZERO=new un(er,Xt,Xt,er);class Wi{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=Mn,r=De(Dl*e*e),i=De((r+Xt)*PF);let s=BigInt(-1);const o=De((s-t*r)*De(r+t));let{isValid:a,value:u}=mm(i,o),_=De(u*e);Vo(_)||(_=De(-_)),a||(u=_),a||(s=r);const x=De(s*(r-Xt)*NF-o),P=u*u,B=De((u+u)*o),U=De(x*AF),W=De(Xt-P),X=De(Xt+P);return new un(De(B*X),De(W*U),De(U*X),De(B*W))}static hashToCurve(e){const t=ym((e=Es(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),i=ym(e.slice(32,64)),s=this.calcElligatorRistrettoMap(i);return new Wi(r.add(s))}static fromHex(e){e=Es(e,32);const{a:t,d:r}=Mn,i="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",s=ym(e);if(!function LF(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}(qc(s),e)||Vo(s))throw new Error(i);const o=De(s*s),a=De(Xt+t*o),u=De(Xt-t*o),_=De(a*a),x=De(u*u),P=De(t*r*_-x),{isValid:B,value:U}=_D(De(P*x)),W=De(U*u),X=De(U*W*P);let re=De((s+s)*W);Vo(re)&&(re=De(-re));const fe=De(a*X),Ie=De(re*fe);if(!B||Vo(Ie)||fe===er)throw new Error(i);return new Wi(new un(re,fe,Xt,Ie))}toRawBytes(){let{x:e,y:t,z:r,t:i}=this.ep;const s=De(De(r+t)*De(r-t)),o=De(e*t),a=De(o*o),{value:u}=_D(De(s*a)),_=De(u*s),x=De(u*o),P=De(_*x*i);let B;if(Vo(i*P)){let W=De(t*Dl),X=De(e*Dl);e=W,t=X,B=De(_*RF)}else B=x;Vo(e*P)&&(t=De(-t));let U=De((r-t)*B);return Vo(U)&&(U=De(-U)),qc(U)}toHex(){return xl(this.toRawBytes())}toString(){return this.toHex()}equals(e){dm(e);const t=this.ep,r=e.ep,i=De(t.x*r.y)===De(t.y*r.x),s=De(t.y*r.y)===De(t.x*r.x);return i||s}add(e){return dm(e),new Wi(this.ep.add(e.ep))}subtract(e){return dm(e),new Wi(this.ep.subtract(e.ep))}multiply(e){return new Wi(this.ep.multiply(e))}multiplyUnsafe(e){return new Wi(this.ep.multiplyUnsafe(e))}}Wi.BASE=new Wi(un.BASE),Wi.ZERO=new Wi(un.ZERO);const pm=new WeakMap;class Yn{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,pm.delete(this)}static fromHex(e,t=!0){const{d:r,P:i}=Mn,s=(e=Es(e,32)).slice();s[31]=-129&e[31];const o=ba(s);if(t&&o>=i)throw new Error("Expected 0 < hex < P");if(!t&&o>=gD)throw new Error("Expected 0 < hex < 2**256");const a=De(o*o),u=De(a-Xt),_=De(r*a+Xt);let{isValid:x,value:P}=mm(u,_);if(!x)throw new Error("Point.fromHex: invalid y coordinate");return 0!=(128&e[31])!=((P&Xt)===Xt)&&(P=De(-P)),new Yn(P,o)}static fromPrivateKey(e){return $(function*(){return(yield Rl(e)).point})()}toRawBytes(){const e=qc(this.y);return e[31]|=this.x&Xt?128:0,e}toHex(){return xl(this.toRawBytes())}toX25519(){const{y:e}=this;return qc(De((Xt+e)*yh(Xt-e)))}isTorsionFree(){return un.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new Yn(De(-this.x),this.y)}add(e){return un.fromAffine(this).add(un.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return un.fromAffine(this).multiply(e,this).toAffine()}}Yn.BASE=new Yn(Mn.Gx,Mn.Gy),Yn.ZERO=new Yn(er,Xt);class Wc{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=Es(e,64),r=Yn.fromHex(t.slice(0,32),!1),i=ba(t.slice(32,64));return new Wc(r,i)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof Yn))throw new Error("Expected Point instance");return Yc(t,Mn.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(qc(this.s),32),e}toHex(){return xl(this.toRawBytes())}}function mD(...n){if(!n.every(r=>r instanceof Uint8Array))throw new Error("Expected Uint8Array list");if(1===n.length)return n[0];const e=n.reduce((r,i)=>r+i.length,0),t=new Uint8Array(e);for(let r=0,i=0;r<n.length;r++){const s=n[r];t.set(s,i),i+=s.length}return t}const MF=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function xl(n){if(!(n instanceof Uint8Array))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=MF[n[t]];return e}function gm(n){if("string"!=typeof n)throw new TypeError("hexToBytes: expected string, got "+typeof n);if(n.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const e=new Uint8Array(n.length/2);for(let t=0;t<e.length;t++){const r=2*t,i=n.slice(r,r+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");e[t]=s}return e}function vD(n){return gm(n.toString(16).padStart(64,"0"))}function qc(n){return vD(n).reverse()}function Vo(n){return(De(n)&Xt)===Xt}function ba(n){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+xl(Uint8Array.from(n).reverse()))}const OF=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function ym(n){return De(ba(n)&OF)}function De(n,e=Mn.P){const t=n%e;return t>=er?t:e+t}function yh(n,e=Mn.P){if(n===er||e<=er)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=De(n,e),r=e,i=er,s=Xt,o=Xt,a=er;for(;t!==er;){const _=r/t,x=r%t,P=i-o*_,B=s-a*_;r=t,t=x,i=o,s=a,o=P,a=B}if(r!==Xt)throw new Error("invert: does not exist");return De(i,e)}function vs(n,e){const{P:t}=Mn;let r=n;for(;e-- >er;)r*=r,r%=t;return r}function mm(n,e){const t=De(e*e*e),r=De(t*t*e);let s=De(n*t*function ED(n){const{P:e}=Mn,t=BigInt(5),r=BigInt(10),i=BigInt(20),s=BigInt(40),o=BigInt(80),u=n*n%e*n%e,_=vs(u,zc)*u%e,x=vs(_,Xt)*n%e,P=vs(x,t)*x%e,B=vs(P,r)*P%e,U=vs(B,i)*B%e,W=vs(U,s)*U%e,X=vs(W,o)*W%e,re=vs(X,o)*W%e,fe=vs(re,r)*P%e;return{pow_p_5_8:vs(fe,zc)*n%e,b2:u}}(n*r).pow_p_5_8);const o=De(e*s*s),a=s,u=De(s*Dl),_=o===n,x=o===De(-n),P=o===De(-n*Dl);return _&&(s=a),(x||P)&&(s=u),Vo(s)&&(s=De(-s)),{isValid:_||x,value:s}}function _D(n){return mm(Xt,n)}function Qc(n){return De(ba(n),Mn.l)}function Es(n,e){const t=n instanceof Uint8Array?Uint8Array.from(n):gm(n);if("number"==typeof e&&t.length!==e)throw new Error(`Expected ${e} bytes`);return t}function Yc(n,e,t=!0){if(!e)throw new TypeError("Specify max value");if("number"==typeof n&&Number.isSafeInteger(n)&&(n=BigInt(n)),"bigint"==typeof n&&n<e)if(t){if(er<n)return n}else if(er<=n)return n;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function wD(n){if(32!==(n="bigint"==typeof n||"number"==typeof n?vD(Yc(n,gD)):Es(n)).length)throw new Error("Expected 32 bytes");return n}function SD(n){const e=function bD(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}(n.slice(0,32)),t=n.slice(32,64),r=Qc(e),i=Yn.BASE.multiply(r),s=i.toRawBytes();return{head:e,prefix:t,scalar:r,point:i,pointBytes:s}}let Al;function Rl(n){return vm.apply(this,arguments)}function vm(){return vm=$(function*(n){return SD(yield wa.sha512(wD(n)))}),vm.apply(this,arguments)}function ID(n){return _m.apply(this,arguments)}function _m(){return _m=$(function*(n){return(yield Rl(n)).pointBytes}),_m.apply(this,arguments)}function UF(n,e){return bm.apply(this,arguments)}function bm(){return bm=$(function*(n,e){n=Es(n);const{prefix:t,scalar:r,pointBytes:i}=yield Rl(e),s=Qc(yield wa.sha512(t,n)),o=Yn.BASE.multiply(s),u=De(s+Qc(yield wa.sha512(o.toRawBytes(),i,n))*r,Mn.l);return new Wc(o,u).toRawBytes()}),bm.apply(this,arguments)}function TD(n,e,t){e=Es(e),t instanceof Yn||(t=Yn.fromHex(t,!1));const{r,s:i}=n instanceof Wc?n.assertValidity():Wc.fromHex(n);return{r,s:i,SB:un.BASE.multiplyUnsafe(i),pub:t,msg:e}}function CD(n,e,t,r){const i=Qc(r),s=un.fromAffine(n).multiplyUnsafe(i);return un.fromAffine(e).add(s).subtract(t).multiplyUnsafe(Mn.h).equals(un.ZERO)}function HF(n,e,t){return wm.apply(this,arguments)}function wm(){return wm=$(function*(n,e,t){const{r,SB:i,msg:s,pub:o}=TD(n,e,t),a=yield wa.sha512(r.toRawBytes(),o.toRawBytes(),s);return CD(o,r,i,a)}),wm.apply(this,arguments)}Yn.BASE._setWindowSize(8);const Ho={node:xF,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},wa={bytesToHex:xl,hexToBytes:gm,concatBytes:mD,getExtendedPublicKey:Rl,mod:De,invert:yh,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:n=>{if((n=Es(n)).length<40||n.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return De(ba(n),Mn.l-Xt)+Xt},randomBytes:(n=32)=>{if(Ho.web)return Ho.web.getRandomValues(new Uint8Array(n));if(Ho.node){const{randomBytes:e}=Ho.node;return new Uint8Array(e(n).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>wa.randomBytes(32),sha512:function(){var n=$(function*(...e){const t=mD(...e);if(Ho.web){const r=yield Ho.web.subtle.digest("SHA-512",t.buffer);return new Uint8Array(r)}if(Ho.node)return Uint8Array.from(Ho.node.createHash("sha512").update(t).digest());throw new Error("The environment doesn't have sha512 function")});return function(){return n.apply(this,arguments)}}(),precompute(n=8,e=Yn.BASE){const t=e.equals(Yn.BASE)?e:new Yn(e.x,e.y);return t._setWindowSize(n),t.multiply(zc),t},sha512Sync:void 0};function zF(){return Tm.apply(this,arguments)}function Tm(){return Tm=$(function*(){const n=wa.randomPrivateKey(),e=yield ID(n);return{privateKey:DD(n,e),publicKey:e}}),Tm.apply(this,arguments)}function WF(n){return Cm.apply(this,arguments)}function Cm(){return Cm=$(function*(n){if(32!==n.length)throw new TypeError('"seed" must be 32 bytes in length.');if(!(n instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');const e=n,t=yield ID(e);return{privateKey:DD(e,t),publicKey:t}}),Cm.apply(this,arguments)}function Dm(){return Dm=$(function*(n,e){const t=n.subarray(0,32);return yield UF(e,t)}),Dm.apply(this,arguments)}function xm(){return xm=$(function*(n,e,t){return yield HF(e,t,n)}),xm.apply(this,arguments)}function DD(n,e){const t=new Uint8Array(64);for(let r=0;r<32;r++)t[r]=n[r],t[32+r]=e[r];return t}Object.defineProperties(wa,{sha512Sync:{configurable:!1,get:()=>Al,set(n){Al||(Al=n)}}});class Am{constructor(e){this._key=Zc(e,32)}verify(e,t){var r=this;return $(function*(){return yield function QF(n,e,t){return xm.apply(this,arguments)}(r._key,t,e)})()}marshal(){return this._key}get bytes(){return Oc.encode({Type:or.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Or(this.bytes,e.bytes)}hash(){var e=this;return $(function*(){const{bytes:t}=yield di.digest(e.bytes);return t})()}}class Nl{constructor(e,t){this._key=Zc(e,64),this._publicKey=Zc(t,32)}sign(e){var t=this;return $(function*(){return yield function qF(n,e){return Dm.apply(this,arguments)}(t._key,e)})()}get public(){return new Am(this._publicKey)}marshal(){return this._key}get bytes(){return kc.encode({Type:or.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Or(this.bytes,e.bytes)}hash(){var e=this;return $(function*(){const{bytes:t}=yield di.digest(e.bytes);return t})()}id(){var e=this;return $(function*(){const t=yield Fc.digest(e.public.bytes);return ii.encode(t.bytes).substring(1)})()}export(e,t="libp2p-key"){var r=this;return $(function*(){if("libp2p-key"===t)return yield om(r.bytes,e);throw se(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")})()}}function YF(n){if(n.length>64){const r=(n=Zc(n,96)).subarray(0,64),i=n.subarray(64,n.length);return new Nl(r,i)}const e=(n=Zc(n,64)).subarray(0,64),t=n.subarray(32);return new Nl(e,t)}function ZF(n){return n=Zc(n,32),new Am(n)}function XF(){return Rm.apply(this,arguments)}function Rm(){return Rm=$(function*(){const{privateKey:n,publicKey:e}=yield zF();return new Nl(n,e)}),Rm.apply(this,arguments)}function JF(n){return Pm.apply(this,arguments)}function Pm(){return Pm=$(function*(n){const{privateKey:e,publicKey:t}=yield WF(n);return new Nl(e,t)}),Pm.apply(this,arguments)}function Zc(n,e){if((n=Uint8Array.from(n??[])).length!==e)throw se(new Error(`Key must be a Uint8Array of length ${e}, got ${n.length}`),"ERR_INVALID_KEY_TYPE");return n}function eU(){return pi.randomPrivateKey()}function Nm(){return Nm=$(function*(n,e){const{digest:t}=yield di.digest(e);try{return yield sF(t,n)}catch(r){throw se(r,"ERR_INVALID_INPUT")}}),Nm.apply(this,arguments)}function Mm(){return Mm=$(function*(n,e,t){try{const{digest:r}=yield di.digest(t);return aF(e,r,n)}catch(r){throw se(r,"ERR_INVALID_INPUT")}}),Mm.apply(this,arguments)}function xD(n){try{pn.fromHex(n)}catch(e){throw se(e,"ERR_INVALID_PUBLIC_KEY")}}class Om{constructor(e){xD(e),this._key=e}verify(e,t){var r=this;return $(function*(){return yield function nU(n,e,t){return Mm.apply(this,arguments)}(r._key,t,e)})()}marshal(){return function rU(n){return pn.fromHex(n).toRawBytes(!0)}(this._key)}get bytes(){return Oc.encode({Type:or.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Or(this.bytes,e.bytes)}hash(){var e=this;return $(function*(){const{bytes:t}=yield di.digest(e.bytes);return t})()}}class km{constructor(e,t){this._key=e,this._publicKey=t??function sU(n){try{return JC(n,!0)}catch(e){throw se(e,"ERR_INVALID_PRIVATE_KEY")}}(e),function iU(n){try{JC(n,!0)}catch(e){throw se(e,"ERR_INVALID_PRIVATE_KEY")}}(this._key),xD(this._publicKey)}sign(e){var t=this;return $(function*(){return yield function tU(n,e){return Nm.apply(this,arguments)}(t._key,e)})()}get public(){return new Om(this._publicKey)}marshal(){return this._key}get bytes(){return kc.encode({Type:or.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Or(this.bytes,e.bytes)}hash(){var e=this;return $(function*(){const{bytes:t}=yield di.digest(e.bytes);return t})()}id(){var e=this;return $(function*(){return kt(yield e.public.hash(),"base58btc")})()}export(e,t="libp2p-key"){var r=this;return $(function*(){if("libp2p-key"===t)return yield om(r.bytes,e);throw se(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")})()}}function oU(n){return new km(n)}function aU(n){return new Om(n)}function cU(){return Lm.apply(this,arguments)}function Lm(){return Lm=$(function*(){const n=yield eU();return new km(n)}),Lm.apply(this,arguments)}const uo={rsa:C,ed25519:A,secp256k1:N};function Bm(n){const e=Object.keys(uo).join(" / ");return se(new Error(`invalid or unsupported key type ${n}. Must be ${e}`),"ERR_UNSUPPORTED_KEY_TYPE")}function Fm(n){if("rsa"===(n=n.toLowerCase())||"ed25519"===n||"secp256k1"===n)return uo[n];throw Bm(n)}function AD(n,e){return Um.apply(this,arguments)}function Um(){return Um=$(function*(n,e){return yield Fm(n).generateKeyPair(e??2048)}),Um.apply(this,arguments)}function Ml(n){const e=Oc.decode(n),t=e.Data??new Uint8Array;switch(e.Type){case or.RSA:return uo.rsa.unmarshalRsaPublicKey(t);case or.Ed25519:return uo.ed25519.unmarshalEd25519PublicKey(t);case or.Secp256k1:return uo.secp256k1.unmarshalSecp256k1PublicKey(t);default:throw Bm(e.Type??"RSA")}}function RD(n,e){return Fm(e=(e??"rsa").toLowerCase()),n.bytes}function Ol(n){return Hm.apply(this,arguments)}function Hm(){return Hm=$(function*(n){const e=kc.decode(n),t=e.Data??new Uint8Array;switch(e.Type){case or.RSA:return yield uo.rsa.unmarshalRsaPrivateKey(t);case or.Ed25519:return uo.ed25519.unmarshalEd25519PrivateKey(t);case or.Secp256k1:return uo.secp256k1.unmarshalSecp256k1PrivateKey(t);default:throw Bm(e.Type??"RSA")}}),Hm.apply(this,arguments)}function uU(n,e){return Fm(e=(e??"rsa").toLowerCase()),n.bytes}function $m(n,e){return Km.apply(this,arguments)}function Km(){return Km=$(function*(n,e){try{const i=yield q5(n,e);return yield Ol(i)}catch{}const t=Nn.pki.decryptRsaPrivateKey(n,e);if(null===t)throw se(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let r=Nn.asn1.toDer(Nn.pki.privateKeyToAsn1(t));return r=At(r.getBytes(),"ascii"),yield uo.rsa.unmarshalRsaPrivateKey(r)}),Km.apply(this,arguments)}const PD=Symbol.for("@libp2p/peer-id");function ND(n){return null!=n&&Boolean(n[PD])}const lU=Symbol.for("nodejs.util.inspect.custom"),MD=Object.values(Sl).map(n=>n.decoder).reduce((n,e)=>n.or(e),Sl.identity.decoder);class zm{constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}get[PD](){return!0}toString(){return null==this.string&&(this.string=ii.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return ar.createV1(114,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Or(this.multihash.bytes,e);if("string"==typeof e)return xr(e).equals(this);if(null!=e?.multihash?.bytes)return Or(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[lU](){return`PeerId(${this.toString()})`}}class Xc extends zm{constructor(e){super({...e,type:"RSA"}),this.type="RSA",this.publicKey=e.publicKey}}class Jc extends zm{constructor(e){super({...e,type:"Ed25519"}),this.type="Ed25519",this.publicKey=e.multihash.digest}}class eu extends zm{constructor(e){super({...e,type:"secp256k1"}),this.type="secp256k1",this.publicKey=e.multihash.digest}}function Lr(n){if("RSA"===n.type)return new Xc(n);if("Ed25519"===n.type)return new Jc(n);if("secp256k1"===n.type)return new eu(n);throw se(new Error("Not a PeerId"),"ERR_INVALID_PARAMETERS")}function xr(n,e){if(e=e??MD,"1"===n.charAt(0)||"Q"===n.charAt(0)){const t=ch(ii.decode(`z${n}`));return n.startsWith("12D")?new Jc({multihash:t}):n.startsWith("16U")?new eu({multihash:t}):new Xc({multihash:t})}return tu(MD.decode(n))}function tu(n){try{const e=ch(n);if(e.code===Fc.code){if(36===e.digest.length)return new Jc({multihash:e});if(37===e.digest.length)return new eu({multihash:e})}if(e.code===di.code)return new Xc({multihash:e})}catch{return function fU(n){if(null==n||null==n.multihash||null==n.version||1===n.version&&114!==n.code)throw new Error("Supplied PeerID CID is invalid");const e=n.multihash;if(e.code===di.code)return new Xc({multihash:n.multihash});if(e.code===Fc.code){if(36===e.digest.length)return new Jc({multihash:n.multihash});if(37===e.digest.length)return new eu({multihash:n.multihash})}throw new Error("Supplied PeerID CID is invalid")}(ar.decode(n))}throw new Error("Supplied PeerID CID is invalid")}function kl(n,e){return Wm.apply(this,arguments)}function Wm(){return Wm=$(function*(n,e){return 36===n.length?new Jc({multihash:Bc(Fc.code,n),privateKey:e}):37===n.length?new eu({multihash:Bc(Fc.code,n),privateKey:e}):new Xc({multihash:yield di.digest(n),publicKey:n,privateKey:e})}),Wm.apply(this,arguments)}!function dU(){Mc._configure(),Gi._configure(Pc),ji._configure(Nc)}();const kD=["uint64","int64","sint64","fixed64","sfixed64"];function LD(n,e){const t=function pU(n){return function hU(n){for(const e of kD){if(null==n[e])continue;const t=n[e];n[e]=function(){return BigInt(t.call(this).toString())}}return n}(new Gi(n))}(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}function BD(n,e){const t=function yU(){return function gU(n){for(const e of kD){if(null==n[e])continue;const t=n[e];n[e]=function(r){return t.call(this,r.toString())}}return n}(ji.create())}();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}var bh,wh,_h=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(_h||(_h={})),_h))();function FD(n,e){return function mU(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}("message",_h.LENGTH_DELIMITED,n,e)}function qm(){return qm=$(function*(n,e,t){const r=yield _U(n,HD(e));if(null==n.publicKey)throw new Error("PublicKey was missing from local PeerId");return EU(n.publicKey,r,t)}),qm.apply(this,arguments)}function EU(n,e,t){return wh.encode({identityKey:n,identitySig:e,extensions:t??{webtransportCerthashes:[]}}).subarray()}function _U(n,e){return Qm.apply(this,arguments)}function Qm(){return Qm=$(function*(n,e){if(null==n.privateKey)throw new Error("PrivateKey was missing from PeerId");return yield(yield Ol(n.privateKey)).sign(e)}),Qm.apply(this,arguments)}function UD(n){return Ym.apply(this,arguments)}function Ym(){return Ym=$(function*(n){return yield kl(n.identityKey)}),Ym.apply(this,arguments)}function VD(n){return wh.decode(n)}function HD(n){const e=At("noise-libp2p-static-key:");return gr([e,n],e.length+n.length)}function $D(n,e,t){return Zm.apply(this,arguments)}function Zm(){return Zm=$(function*(n,e,t){const r=yield kl(e.identityKey);if(!r.equals(t))throw new Error("Peer ID doesn't match libp2p public key.");const i=HD(n);if(null==r.publicKey)throw new Error("PublicKey was missing from PeerId");if(null==e.identitySig)throw new Error("Signature was missing from message");if(!(yield Ml(r.publicKey).verify(i,e.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return r}),Zm.apply(this,arguments)}function Sh(n){return!(!(n instanceof Uint8Array)||32!==n.length)}!function(n){let e;n.codec=()=>(null==e&&(e=FD((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null!=t.webtransportCerthashes)for(const s of t.webtransportCerthashes)r.uint32(10),r.bytes(s);!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={webtransportCerthashes:[]},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();o>>>3==1?i.webtransportCerthashes.push(t.bytes()):t.skipType(7&o)}return i})),e),n.encode=t=>BD(t,n.codec()),n.decode=t=>LD(t,n.codec())}(bh||(bh={})),function(n){let e;n.codec=()=>(null==e&&(e=FD((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),(!0===i.writeDefaults||null!=t.identityKey&&t.identityKey.byteLength>0)&&(r.uint32(10),r.bytes(t.identityKey)),(!0===i.writeDefaults||null!=t.identitySig&&t.identitySig.byteLength>0)&&(r.uint32(18),r.bytes(t.identitySig)),null!=t.extensions&&(r.uint32(34),bh.codec().encode(t.extensions,r,{writeDefaults:!1})),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={identityKey:new Uint8Array(0),identitySig:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.identityKey=t.bytes();break;case 2:i.identitySig=t.bytes();break;case 4:i.extensions=bh.codec().decode(t,t.uint32());break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>BD(t,n.codec()),n.decode=t=>LD(t,n.codec())}(wh||(wh={}));var mr=R(1455);function Mt(n){return Object.assign(mr(n),{error:mr(`${n}:error`),trace:mr(`${n}:trace`)})}mr.formatters.b=n=>null==n?"undefined":ii.baseEncode(n),mr.formatters.t=n=>null==n?"undefined":co.baseEncode(n),mr.formatters.m=n=>null==n?"undefined":ih.baseEncode(n),mr.formatters.p=n=>null==n?"undefined":n.toString(),mr.formatters.c=n=>null==n?"undefined":n.toString(),mr.formatters.k=n=>null==n?"undefined":n.toString();const jr=Mt("libp2p:noise");let qi;function KD(n){n?(qi(`LOCAL_PUBLIC_EPHEMERAL_KEY ${kt(n.publicKey,"hex")}`),qi(`LOCAL_PRIVATE_EPHEMERAL_KEY ${kt(n.privateKey,"hex")}`)):qi("Missing local ephemeral keys.")}function GD(n){qi(`REMOTE_EPHEMERAL_PUBLIC_KEY ${kt(n,"hex")}`)}qi=t6?jr:Object.assign(()=>{},{enabled:!1,trace:()=>{},error:()=>{}});class DU{constructor(e=0){this.n=e,this.bytes=new Uint8Array(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,e,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>4294967295)throw new Error("Cipherstate has reached maximum n, a new handshake must be performed")}}class AU extends class xU{constructor(e){this.crypto=e}encryptWithAd(e,t,r){const i=this.encrypt(e.k,e.n,t,r);return e.n.increment(),i}decryptWithAd(e,t,r,i){const{plaintext:s,valid:o}=this.decrypt(e.k,e.n,t,r,i);return o&&e.n.increment(),{plaintext:s,valid:o}}hasKey(e){return!this.isEmptyKey(e.k)}createEmptyKey(){return new Uint8Array(32)}isEmptyKey(e){return Or(this.createEmptyKey(),e)}encrypt(e,t,r,i){return t.assertValue(),this.crypto.chaCha20Poly1305Encrypt(i,t.getBytes(),r,e)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,i,s){t.assertValue();const o=this.crypto.chaCha20Poly1305Decrypt(i,t.getBytes(),r,e,s);return o?{plaintext:o,valid:!0}:{plaintext:new Uint8Array(0),valid:!1}}decryptAndHash(e,t){let r,i=!0;return this.hasKey(e.cs)?({plaintext:r,valid:i}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:i}}dh(e,t){try{const r=this.crypto.generateX25519SharedKey(e,t);return 32===r.length?r:r.subarray(0,32)}catch(r){return jr(r.message),new Uint8Array(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return this.crypto.hashSHA256(gr([e,t],e.length+t.length))}mixKey(e,t){const[r,i]=this.crypto.getHKDF(e.ck,t);e.cs=this.initializeKey(i),e.ck=r}initializeKey(e){return{k:e,n:new DU}}initializeSymmetric(e){const t=At(e,"utf-8"),r=this.hashProtocolName(t),i=r,s=this.createEmptyKey();return{cs:this.initializeKey(s),ck:i,h:r}}hashProtocolName(e){if(e.length<=32){const t=new Uint8Array(32);return t.set(e),t}return this.getHash(e,new Uint8Array(0))}split(e){const[t,r]=this.crypto.getHKDF(e.ck,new Uint8Array(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,new Uint8Array(0),t);return{ne:this.createEmptyKey(),ns:new Uint8Array(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,new Uint8Array(0),t.ciphertext)}}{initializeInitiator(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:new Uint8Array(32)}}initializeResponder(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:new Uint8Array(32)}}writeMessageA(e,t,r){const i=new Uint8Array(0);e.e=void 0!==r?r:this.crypto.generateX25519KeyPair();const s=e.e.publicKey;return this.mixHash(e.ss,s),{ne:s,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=this.crypto.generateX25519KeyPair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const s=this.encryptAndHash(e.ss,e.s.publicKey);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.re)),{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const i=this.encryptAndHash(e.ss,e.s.publicKey);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const s=this.encryptAndHash(e.ss,t),a={ne:this.createEmptyKey(),ns:i,ciphertext:s},{cs1:u,cs2:_}=this.split(e.ss);return{h:e.ss.h,messageBuffer:a,cs1:u,cs2:_}}readMessageA(e,t){return Sh(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(Sh(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);i&&Sh(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:i&&o}}readMessageC(e,t){const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);if(i&&Sh(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:u}=this.split(e.ss);return{h:e.ss.h,plaintext:s,valid:i&&o,cs1:a,cs2:u}}initSession(e,t,r){const i=this.createEmptyKey(),s=new Uint8Array(32);let o;return o=e?this.initializeInitiator(t,r,s,i):this.initializeResponder(t,r,s,i),{hs:o,i:e,mc:0}}sendMessage(e,t,r){let i;if(0===e.mc)i=this.writeMessageA(e.hs,t,r);else if(1===e.mc)i=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:s,messageBuffer:o,cs1:a,cs2:u}=this.writeMessageC(e.hs,t);i=o,e.h=s,e.cs1=a,e.cs2=u}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");i=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");i=this.writeMessageRegular(e.cs2,t)}}return e.mc++,i}recvMessage(e,t){let r=new Uint8Array(0),i=!1;if(0===e.mc)({plaintext:r,valid:i}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:i}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:s,plaintext:o,valid:a,cs1:u,cs2:_}=this.readMessageC(e.hs,t);r=o,i=a,e.h=s,e.cs1=u,e.cs2=_}return e.mc++,{plaintext:r,valid:i}}}class RU{constructor(e,t,r,i,s,o,a,u){this.remoteExtensions={webtransportCerthashes:[]},this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=s,this.connection=o,a&&(this.remotePeer=a),this.xx=u??new AU(i),this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair)}propose(){var e=this;return $(function*(){if(function bU(n){qi(`LOCAL_STATIC_PUBLIC_KEY ${kt(n.publicKey,"hex")}`),qi(`LOCAL_STATIC_PRIVATE_KEY ${kt(n.privateKey,"hex")}`)}(e.session.hs.s),e.isInitiator){jr("Stage 0 - Initiator starting to send first message.");const t=e.xx.sendMessage(e.session,new Uint8Array(0));e.connection.writeLP(function s6(n){return gr([n.ne,n.ciphertext],n.ne.length+n.ciphertext.length)}(t)),jr("Stage 0 - Initiator finished sending first message."),KD(e.session.hs.e)}else{jr("Stage 0 - Responder waiting to receive first message...");const t=function c6(n){if(n.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:n.subarray(0,32),ciphertext:n.subarray(32,n.length),ns:new Uint8Array(0)}}((yield e.connection.readLP()).subarray()),{valid:r}=e.xx.recvMessage(e.session,t);if(!r)throw new Rc("xx handshake stage 0 validation fail");jr("Stage 0 - Responder received first message."),GD(e.session.hs.re)}})()}exchange(){var e=this;return $(function*(){if(e.isInitiator){jr("Stage 1 - Initiator waiting to receive first message from responder...");const t=function u6(n){if(n.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:n.subarray(0,32),ns:n.subarray(32,80),ciphertext:n.subarray(80,n.length)}}((yield e.connection.readLP()).subarray()),{plaintext:r,valid:i}=e.xx.recvMessage(e.session,t);if(!i)throw new Rc("xx handshake stage 1 validation fail");jr("Stage 1 - Initiator received the message."),GD(e.session.hs.re),function wU(n){qi(`REMOTE_STATIC_PUBLIC_KEY ${kt(n,"hex")}`)}(e.session.hs.rs),jr("Initiator going to check remote's signature...");try{const s=VD(r);e.remotePeer=e.remotePeer||(yield UD(s)),yield $D(e.session.hs.rs,s,e.remotePeer),e.setRemoteNoiseExtension(s.extensions)}catch(s){throw new th(`Error occurred while verifying signed payload: ${s.message}`)}jr("All good with the signature!")}else{jr("Stage 1 - Responder sending out first message with signed payload and static key.");const t=e.xx.sendMessage(e.session,e.payload);e.connection.writeLP(function o6(n){return gr([n.ne,n.ns,n.ciphertext],n.ne.length+n.ns.length+n.ciphertext.length)}(t)),jr("Stage 1 - Responder sent the second handshake message with signed payload."),KD(e.session.hs.e)}})()}finish(){var e=this;return $(function*(){if(e.isInitiator){jr("Stage 2 - Initiator sending third handshake message.");const t=e.xx.sendMessage(e.session,e.payload);e.connection.writeLP(function a6(n){return gr([n.ns,n.ciphertext],n.ns.length+n.ciphertext.length)}(t)),jr("Stage 2 - Initiator sent message with signed payload.")}else{jr("Stage 2 - Responder waiting for third handshake message...");const t=function l6(n){if(n.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:new Uint8Array(0),ns:n.subarray(0,48),ciphertext:n.subarray(48,n.length)}}((yield e.connection.readLP()).subarray()),{plaintext:r,valid:i}=e.xx.recvMessage(e.session,t);if(!i)throw new Rc("xx handshake stage 2 validation fail");jr("Stage 2 - Responder received the message, finished handshake.");try{const s=VD(r);e.remotePeer=e.remotePeer||(yield UD(s)),yield $D(e.session.hs.rs,s,e.remotePeer),e.setRemoteNoiseExtension(s.extensions)}catch(s){throw new th(`Error occurred while verifying signed payload: ${s.message}`)}}!function SU(n){n.cs1&&n.cs2?(qi(`CIPHER_STATE_1 ${n.cs1.n.getUint64()} ${kt(n.cs1.k,"hex")}`),qi(`CIPHER_STATE_2 ${n.cs2.n.getUint64()} ${kt(n.cs2.k,"hex")}`)):qi("Missing cipher state.")}(e.session)})()}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,new Uint8Array(0),e)}decrypt(e,t,r){const i=this.getCS(t,!1);return this.xx.decryptWithAd(i,new Uint8Array(0),e,r)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Rc("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteNoiseExtension(e){e&&(this.remoteExtensions=e)}}class NU{constructor(e={}){this.protocol="/noise";const{staticNoiseKey:t,extensions:r,crypto:i,prologueBytes:s,metrics:o}=e;this.crypto=i??r6,this.extensions=r,this.metrics=o?function PU(n){return{xxHandshakeSuccesses:n.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:n.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:n.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:n.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:n.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}}(o):void 0,this.staticKeys=t?this.crypto.generateX25519KeyPairFromSeed(t):this.crypto.generateX25519KeyPair(),this.prologue=s??new Uint8Array(0)}secureOutbound(e,t,r){var i=this;return $(function*(){const s=hC(t,{lengthEncoder:Jd,lengthDecoder:eh,maxDataLength:El}),o=yield i.performHandshake({connection:s,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:yield i.createSecureConnection(s,o),remoteExtensions:o.remoteExtensions,remotePeer:o.remotePeer}})()}secureInbound(e,t,r){var i=this;return $(function*(){const s=hC(t,{lengthEncoder:Jd,lengthDecoder:eh,maxDataLength:El}),o=yield i.performHandshake({connection:s,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:yield i.createSecureConnection(s,o),remotePeer:o.remotePeer,remoteExtensions:o.remoteExtensions}})()}performHandshake(e){var t=this;return $(function*(){const r=yield function vU(n,e,t){return qm.apply(this,arguments)}(e.localPeer,t.staticKeys.publicKey,t.extensions);return yield t.performXXHandshake(e,r)})()}performXXHandshake(e,t){var r=this;return $(function*(){const{isInitiator:i,remotePeer:s,connection:o}=e,a=new RU(i,t,r.prologue,r.crypto,r.staticKeys,o,s);try{yield a.propose(),yield a.exchange(),yield a.finish(),r.metrics?.xxHandshakeSuccesses.increment()}catch(u){if(r.metrics?.xxHandshakeErrors.increment(),u instanceof Error)throw u.message=`Error occurred during XX handshake: ${u.message}`,u}return a})()}createSecureConnection(e,t){var r=this;return $(function*(){const[i,s]=function X8(){const n=pC(),e=pC();return[{source:n.source,sink:e.sink},{source:e.source,sink:n.sink}]}(),o=e.unwrap();return yield zn(i,function f6(n,e){return function(){var t=Vt(function*(r){var o,i=!1,s=!1;try{for(var u,a=ut(r);i=!(u=yield qe(a.next())).done;i=!1){const _=u.value;for(let x=0;x<_.length;x+=65519){let P=x+65519;P>_.length&&(P=_.length);const B=n.encrypt(_.subarray(x,P),n.session);e?.encryptedPackets.increment(),yield Jd(B.byteLength),yield B}}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}});return function(r){return t.apply(this,arguments)}}()}(t,r.metrics),o,ys({lengthDecoder:eh}),function d6(n,e){return function(){var t=Vt(function*(r){var o,i=!1,s=!1;try{for(var u,a=ut(r);i=!(u=yield qe(a.next())).done;i=!1){const _=u.value;for(let x=0;x<_.length;x+=El){let P=x+El;if(P>_.length&&(P=_.length),P-Xd.pg<x)throw new Error("Invalid chunk");const B=_.subarray(x,P),U=_.subarray(x,P-Xd.pg),{plaintext:W,valid:X}=n.decrypt(B,n.session,U);if(!X)throw e?.decryptErrors.increment(),new Error("Failed to validate decrypted chunk");e?.decryptedPackets.increment(),yield W}}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}});return function(r){return t.apply(this,arguments)}}()}(t,r.metrics),i),s})()}}function MU(n={}){return()=>new NU(n)}const nu=new class OU{constructor(){yf(this,"index",0),yf(this,"input","")}new(e){return this.index=0,this.input=e,this}readAtomically(e){const t=this.index,r=e();return void 0===r&&(this.index=t),r}parseWith(e){const t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{const t=this.readChar();if(t===e)return t})}readSeparator(e,t,r){return this.readAtomically(()=>{if(!(t>0&&void 0===this.readGivenChar(e)))return r()})}readNumber(e,t,r,i){return this.readAtomically(()=>{let s=0,o=0;const a=this.peekChar();if(void 0===a)return;const u="0"===a,_=2**(8*i)-1;for(;;){const x=this.readAtomically(()=>{const P=this.readChar();if(void 0===P)return;const B=Number.parseInt(P,e);return Number.isNaN(B)?void 0:B});if(void 0===x)break;if(s*=e,s+=x,s>_||(o+=1,void 0!==t&&o>t))return}return 0!==o?!r&&u&&o>1?void 0:s:void 0})}readIPv4Addr(){return this.readAtomically(()=>{const e=new Uint8Array(4);for(let t=0;t<e.length;t++){const r=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(void 0===r)return;e[t]=r}return e})}readIPv6Addr(){const e=t=>{for(let r=0;r<t.length/2;r++){const i=2*r;if(r<t.length-3){const o=this.readSeparator(":",r,()=>this.readIPv4Addr());if(void 0!==o)return t[i]=o[0],t[i+1]=o[1],t[i+2]=o[2],t[i+3]=o[3],[i+4,!0]}const s=this.readSeparator(":",r,()=>this.readNumber(16,4,!0,2));if(void 0===s)return[i,!1];t[i]=s>>8,t[i+1]=255&s}return[t.length,!1]};return this.readAtomically(()=>{const t=new Uint8Array(16),[r,i]=e(t);if(16===r)return t;if(i||void 0===this.readGivenChar(":")||void 0===this.readGivenChar(":"))return;const s=new Uint8Array(14),o=16-(r+2),[a]=e(s.subarray(0,o));return t.set(s.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};function Xm(n){return Boolean(function FU(n){if(!(n.length>45))return nu.new(n).parseWith(()=>nu.readIPAddr())}(n))}const qD=function zD(n){return Boolean(function LU(n){if(!(n.length>15))return nu.new(n).parseWith(()=>nu.readIPv4Addr())}(n))},UU=function WD(n){return Boolean(function BU(n){if(!(n.length>45))return nu.new(n).parseWith(()=>nu.readIPv6Addr())}(n))},QD=function(n){let e=0;if(n=n.toString().trim(),qD(n)){const t=new Uint8Array(e+4);return n.split(/\./g).forEach(r=>{t[e++]=255&parseInt(r,10)}),t}if(UU(n)){const t=n.split(":",8);let r;for(r=0;r<t.length;r++){let o;qD(t[r])&&(o=QD(t[r]),t[r]=kt(o.slice(0,2),"base16")),null!=o&&++r<8&&t.splice(r,0,kt(o.slice(2,4),"base16"))}if(""===t[0])for(;t.length<8;)t.unshift("0");else if(""===t[t.length-1])for(;t.length<8;)t.push("0");else if(t.length<8){for(r=0;r<t.length&&""!==t[r];r++);const s=[r,1];for(r=9-t.length;r>0;r--)s.push("0");t.splice.apply(t,s)}const i=new Uint8Array(e+16);for(r=0;r<t.length;r++){const s=parseInt(t[r],16);i[e++]=s>>8&255,i[e++]=255&s}return i}throw new Error("invalid ip address")},_s=-1,Ih={},Jm={};function vr(n){if("number"==typeof n){if(null!=Jm[n])return Jm[n];throw new Error(`no protocol with code: ${n}`)}if("string"==typeof n){if(null!=Ih[n])return Ih[n];throw new Error(`no protocol with name: ${n}`)}throw new Error("invalid protocol id type: "+typeof n)}[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,_s,"ip6zone"],[53,_s,"dns",!0],[54,_s,"dns4",!0],[55,_s,"dns6",!0],[56,_s,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,_s,"unix",!1,!0],[421,_s,"ipfs"],[421,_s,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,_s,"garlic64"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,_s,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,_s,"memory"]].forEach(n=>{const e=function HU(n,e,t,r,i){return{code:n,size:e,name:t,resolvable:Boolean(r),path:Boolean(i)}}(...n);Jm[e.code]=e,Ih[e.name]=e});var cr=R(1732);function ev(n,e){switch(vr(n).code){case 4:case 41:return function KU(n){const e=function(n,e=0,t){e=~~e,t=t??n.length-e;const r=new DataView(n.buffer);if(4===t){const i=[];for(let s=0;s<t;s++)i.push(n[e+s]);return i.join(".")}if(16===t){const i=[];for(let s=0;s<t;s+=2)i.push(r.getUint16(e+s).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""}(n,0,n.length);if(null==e)throw new Error("ipBuff is required");if(!Xm(e))throw new Error("invalid ip address");return e}(e);case 6:case 273:case 33:case 132:return XD(e).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function jU(n){const e=cr.decode(n);if((n=n.slice(cr.decode.bytes)).length!==e)throw new Error("inconsistent lengths");return kt(n)}(e);case 421:return function QU(n){const e=cr.decode(n),t=n.slice(cr.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return kt(t,"base58btc")}(e);case 444:case 445:return function JD(n){const e=n.slice(0,n.length-2),t=n.slice(n.length-2);return`${kt(e,"base32")}:${XD(t)}`}(e);case 466:return function qU(n){const e=cr.decode(n),t=n.slice(cr.decode.bytes);if(t.length!==e)throw new Error("inconsistent lengths");return"u"+kt(t,"base64url")}(e);default:return kt(e,"base16")}}function YD(n,e){switch(vr(n).code){case 4:case 41:return function ZD(n){if(!Xm(n))throw new Error("invalid ip address");return QD(n)}(e);case 6:case 273:case 33:case 132:return nv(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 777:return function GU(n){const e=At(n),t=Uint8Array.from(cr.encode(e.length));return gr([t,e],t.length+e.length)}(e);case 421:return function zU(n){let e;e="Q"===n[0]||"1"===n[0]?ch(ii.decode(`z${n}`)).bytes:ar.parse(n).multihash.bytes;const t=Uint8Array.from(cr.encode(e.length));return gr([t,e],t.length+e.length)}(e);case 444:return function YU(n){const e=n.split(":");if(2!==e.length)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(16!==e[0].length)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);const t=co.decode("b"+e[0]),r=parseInt(e[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=nv(r);return gr([t,i],t.length+i.length)}(e);case 445:return function ZU(n){const e=n.split(":");if(2!==e.length)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(56!==e[0].length)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);const t=co.decode(`b${e[0]}`),r=parseInt(e[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=nv(r);return gr([t,i],t.length+i.length)}(e);case 466:return function WU(n){const e=$U.decode(n),t=Uint8Array.from(cr.encode(e.length));return gr([t,e],t.length+e.length)}(e);default:return At(e,"base16")}}const tv=Object.values(Sl).map(n=>n.decoder),$U=function(){let n=tv[0].or(tv[1]);return tv.slice(2).forEach(e=>n=n.or(e)),n}();function nv(n){const e=new ArrayBuffer(2);return new DataView(e).setUint16(0,n),new Uint8Array(e)}function XD(n){return new DataView(n.buffer).getUint16(n.byteOffset)}function e2(n){return n.map(e=>{const t=Th(e);return null!=e[1]?[t.code,ev(t.code,e[1])]:[t.code]})}function t2(n){return iv(gr(n.map(e=>{const t=Th(e);let r=Uint8Array.from(cr.encode(t.code));return e.length>1&&null!=e[1]&&(r=gr([r,e[1]])),r})))}function n2(n,e){return n.size>0?n.size/8:0===n.size?0:cr.decode(e)+(cr.decode.bytes??0)}function rv(n){const e=[];let t=0;for(;t<n.length;){const r=cr.decode(n,t),i=cr.decode.bytes??0,o=n2(vr(r),n.slice(t+i));if(0===o){e.push([r]),t+=i;continue}const a=n.slice(t+i,t+i+o);if(t+=o+i,t>n.length)throw s2("Invalid address Uint8Array: "+kt(n,"base16"));e.push([r,a])}return e}function r2(n){return function JU(n){const e=[];return n.map(t=>{const r=Th(t);return e.push(r.name),t.length>1&&null!=t[1]&&e.push(t[1]),null}),sv(e.join("/"))}(e2(rv(n)))}function iv(n){const e=function i2(n){try{rv(n)}catch(e){return e}}(n);if(null!=e)throw e;return Uint8Array.from(n)}function sv(n){return"/"+n.trim().split("/").filter(e=>e).join("/")}function s2(n){return new Error("Error parsing address: "+n)}function Th(n){return vr(n[0])}var Ll,Bl,Fl,o2,ru=function(n,e,t,r){if("a"===t&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(n):r?r.value:e.get(n)},ov=function(n,e,t,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(n,t):i?i.value=t:e.set(n,t),t};const rV=Symbol.for("nodejs.util.inspect.custom"),a2=[vr("dns").code,vr("dns4").code,vr("dns6").code,vr("dnsaddr").code],iV=[vr("p2p").code,vr("ipfs").code],c2=new Map,u2=Symbol.for("@multiformats/js-multiaddr/multiaddr");function sV(n,e){if(null==n)throw new Error("requires node address object");if(null==e)throw new Error("requires transport protocol");let t;switch(n.family){case 4:t="ip4";break;case 6:t="ip6";break;default:throw Error("Invalid addr family, should be 4 or 6.")}return new Ko("/"+[t,n.address,e,n.port].join("/"))}function Ch(n){return Boolean(n?.[u2])}class Ko{constructor(e){if(Ll.set(this,void 0),Bl.set(this,void 0),Fl.set(this,void 0),this[o2]=!0,null==e&&(e=""),e instanceof Uint8Array)this.bytes=iv(e);else if("string"==typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=function nV(n){return function tV(n){const e=function XU(n){const e=[],t=n.split("/").slice(1);if(1===t.length&&""===t[0])return[];for(let r=0;r<t.length;r++){const i=t[r],s=vr(i);if(0!==s.size){if(r++,r>=t.length)throw s2("invalid address: "+n);if(!0===s.path){e.push([i,sv(t.slice(r).join("/"))]);break}e.push([i,t[r]])}else e.push([i])}return e}(n=sv(n)),t=function eV(n){return n.map(e=>{Array.isArray(e)||(e=[e]);const t=Th(e);return e.length>1?[t.code,YD(t.code,e[1])]:[t.code]})}(e);return t2(t)}(n)}(e)}else{if(!Ch(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=iv(e.bytes)}}toString(){return null==ru(this,Ll,"f")&&ov(this,Ll,r2(this.bytes),"f"),ru(this,Ll,"f")}toJSON(){return this.toString()}toOptions(){const e=this.protoCodes(),t=this.toString().split("/").slice(1);let r,i;if(t.length>2)a2.includes(e[0])&&iV.includes(e[1])?(r=vr("tcp").name,i=443):(r=vr(t[2]).name,i=parseInt(t[3]));else{if(!a2.includes(e[0]))throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');r=vr("tcp").name,i=443}return{family:41===e[0]||55===e[0]?6:4,host:t[1],transport:r,port:i}}protos(){return this.protoCodes().map(e=>Object.assign({},vr(e)))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){const i=cr.decode(t,r),s=cr.decode.bytes??0;r+=n2(vr(i),t.slice(r+s))+s,e.push(i)}return e}protoNames(){return this.protos().map(e=>e.name)}tuples(){return null==ru(this,Bl,"f")&&ov(this,Bl,rv(this.bytes),"f"),ru(this,Bl,"f")}stringTuples(){return null==ru(this,Fl,"f")&&ov(this,Fl,e2(this.tuples()),"f"),ru(this,Fl,"f")}encapsulate(e){return e=new Ko(e),new Ko(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),i=r.lastIndexOf(t);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new Ko(r.slice(0,i))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new Ko(t2(t.slice(0,r)));return this}getPeerId(){try{const t=this.stringTuples().filter(r=>r[0]===Ih.ipfs.code).pop();if(null!=t?.[1]){const r=t[1];return kt("Q"===r[0]||"1"===r[0]?ii.decode(`z${r}`):ar.parse(r).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){let e=null;try{e=this.stringTuples().filter(t=>!0===vr(t[0]).path)[0][1],null==e&&(e=null)}catch{e=null}return e}equals(e){return Or(this.bytes,e.bytes)}resolve(e){var t=this;return $(function*(){const r=t.protos().find(o=>o.resolvable);if(null==r)return[t];const i=c2.get(r.name);if(null==i)throw se(new Error(`no available resolver for ${r.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(yield i(t,e)).map(o=>new Ko(o))})()}nodeAddress(){const e=this.toOptions();if("tcp"!==e.transport&&"udp"!==e.transport)throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){const t=(e??this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&273!==t[1].code)}[(Ll=new WeakMap,Bl=new WeakMap,Fl=new WeakMap,o2=u2,rV)](){return`Multiaddr(${r2(this.bytes)})`}}function Cn(n){return new Ko(n)}const oV=vt("dns4"),aV=vt("dns6"),cV=vt("dnsaddr"),Sa=zr(vt("dns"),cV,oV,aV),Dh=zr(vt("ip4"),vt("ip6")),Ul=zr(Gt(Dh,vt("tcp")),Gt(Sa,vt("tcp"))),l2=Gt(Dh,vt("udp")),uV=Gt(l2,vt("utp")),lV=Gt(l2,vt("quic")),iu=zr(Gt(Ul,vt("ws")),Gt(Sa,vt("ws"))),Ia=zr(Gt(Ul,vt("wss")),Gt(Sa,vt("wss"))),av=zr(Gt(Ul,vt("http")),Gt(Dh,vt("http")),Gt(Sa,vt("http"))),cv=zr(Gt(Ul,vt("https")),Gt(Dh,vt("https")),Gt(Sa,vt("https"))),f2=zr(Gt(iu,vt("p2p-webrtc-star"),vt("p2p")),Gt(Ia,vt("p2p-webrtc-star"),vt("p2p")),Gt(iu,vt("p2p-webrtc-star")),Gt(Ia,vt("p2p-webrtc-star"))),d2=(zr(Gt(iu,vt("p2p-websocket-star"),vt("p2p")),Gt(Ia,vt("p2p-websocket-star"),vt("p2p")),Gt(iu,vt("p2p-websocket-star")),Gt(Ia,vt("p2p-websocket-star"))),zr(Gt(av,vt("p2p-webrtc-direct"),vt("p2p")),Gt(cv,vt("p2p-webrtc-direct"),vt("p2p")),Gt(av,vt("p2p-webrtc-direct")),Gt(cv,vt("p2p-webrtc-direct")))),Vl=zr(iu,Ia,av,cv,f2,d2,Ul,uV,lV,Sa),Go=(zr(Gt(Vl,vt("p2p-stardust"),vt("p2p")),Gt(Vl,vt("p2p-stardust"))),zr(Gt(Vl,vt("p2p")),f2,d2,vt("p2p"))),h2=zr(Gt(Go,vt("p2p-circuit"),Go),Gt(Go,vt("p2p-circuit")),Gt(vt("p2p-circuit"),Go),Gt(Vl,vt("p2p-circuit")),Gt(vt("p2p-circuit"),Vl),vt("p2p-circuit")),p2=()=>zr(Gt(h2,p2),h2),su=p2(),fV=zr(Gt(su,Go,su),Gt(Go,su),Gt(su,Go),su,Go);function g2(n){return function e(t){let r;try{r=Cn(t)}catch{return!1}const i=n(r.protoNames());return null!==i&&(!0===i||!1===i?i:0===i.length)}}function Gt(...n){function e(t){if(t.length<n.length)return null;let r=t;return n.some(i=>(r="function"==typeof i?i().partialMatch(t):i.partialMatch(t),Array.isArray(r)&&(t=r),null===r)),r}return{toString:function(){return"{ "+n.join(" ")+" }"},input:n,matches:g2(e),partialMatch:e}}function zr(...n){function e(r){let i=null;return n.some(s=>{const o="function"==typeof s?s().partialMatch(r):s.partialMatch(r);return null!=o&&(i=o,!0)}),i}return{toString:function(){return"{ "+n.join(" ")+" }"},input:n,matches:g2(e),partialMatch:e}}function vt(n){const e=n;return{toString:function(){return e},matches:function t(i){let s;try{s=Cn(i)}catch{return!1}const o=s.protoNames();return 1===o.length&&o[0]===e},partialMatch:function r(i){return 0===i.length?null:i[0]===e?i.slice(1):null}}}var lo,Ta=function(n,e,t,r){if("a"===t&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(n):r?r.value:e.get(n)};class gi extends EventTarget{constructor(){super(...arguments),lo.set(this,new Map)}listenerCount(e){const t=Ta(this,lo,"f").get(e);return null==t?0:t.length}addEventListener(e,t,r){super.addEventListener(e,t,r);let i=Ta(this,lo,"f").get(e);null==i&&(i=[],Ta(this,lo,"f").set(e,i)),i.push({callback:t,once:(!0!==r&&!1!==r&&r?.once)??!1})}removeEventListener(e,t,r){super.removeEventListener(e.toString(),t??null,r);let i=Ta(this,lo,"f").get(e);null!=i&&(i=i.filter(({callback:s})=>s!==t),Ta(this,lo,"f").set(e,i))}dispatchEvent(e){const t=super.dispatchEvent(e);let r=Ta(this,lo,"f").get(e.type);return null==r||(r=r.filter(({once:i})=>!i),Ta(this,lo,"f").set(e.type,r)),t}}lo=new WeakMap;class dV extends Event{constructor(e,t){super(e,t),this.detail=t?.detail}}const zt=globalThis.CustomEvent??dV,uv=Symbol.for("@libp2p/peer-discovery"),xh=Mt("libp2p:bootstrap");let mV=(()=>{class n extends gi{constructor(t,r={list:[]}){if(null==r.list||0===r.list.length)throw new Error("Bootstrap requires a list of peer addresses");super(),this.components=t,this.timeout=r.timeout??1e3,this.list=[];for(const i of r.list){if(!fV.matches(i)){xh.error("Invalid multiaddr");continue}const s=Cn(i),o=s.getPeerId();if(null==o){xh.error("Invalid bootstrap multiaddr without peer id");continue}const a={id:xr(o),multiaddrs:[s],protocols:[]};this.list.push(a)}this._init=r}get[uv](){return!0}get[Symbol.toStringTag](){return"@libp2p/bootstrap"}isStarted(){return Boolean(this.timer)}start(){this.isStarted()||(xh("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(t=>{xh.error(t)})},this.timeout))}_discoverBootstrapPeers(){var t=this;return $(function*(){if(null!=t.timer)for(const r of t.list){if(yield t.components.peerStore.tagPeer(r.id,t._init.tagName??"bootstrap",{value:t._init.tagValue??50,ttl:t._init.tagTTL??12e4}),null==t.timer)return;t.dispatchEvent(new zt("peer",{detail:r}))}})()}stop(){null!=this.timer&&clearTimeout(this.timer),this.timer=void 0}}return n.tag="bootstrap",n})();class y2 extends Error{constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}}function bs(n,e,t){const r=t??{},i=function EV(n){if(null!=n){if("function"==typeof n[Symbol.iterator])return n[Symbol.iterator]();if("function"==typeof n[Symbol.asyncIterator])return n[Symbol.asyncIterator]();if("function"==typeof n.next)return n}throw new Error("argument is not an iterator or iterable")}(n);function o(){return(o=Vt(function*(){let a;const u=()=>{a?.()};for(e.addEventListener("abort",u);;){let _;try{if(e.aborted){const{abortMessage:P,abortCode:B}=r;throw new y2(P,B)}const x=new Promise((P,B)=>{a=()=>{const{abortMessage:U,abortCode:W}=r;B(new y2(U,W))}});_=yield qe(Promise.race([x,i.next()])),a=null}catch(x){e.removeEventListener("abort",u);const P="aborted"===x.type&&e.aborted;if(P&&null!=r.onAbort&&(yield qe(r.onAbort(n))),"function"==typeof i.return)try{const B=i.return();B instanceof Promise&&B.catch(U=>{null!=r.onReturnError&&r.onReturnError(U)})}catch(B){null!=r.onReturnError&&r.onReturnError(B)}if(P&&!0===r.returnOnAbort)return;throw x}if(!0===_.done)break;yield _.value}e.removeEventListener("abort",u)})).apply(this,arguments)}return function s(){return o.apply(this,arguments)}()}function _V(n,e,t){return r=>n(bs(r,e,t))}function jo(n,e,t){return{sink:_V(n.sink,e,{...t,onAbort:void 0}),source:bs(n.source,e,t)}}function m2(n){return new Uint8Array(n)}var on=(()=>(function(n){n[n.NEW_STREAM=0]="NEW_STREAM",n[n.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",n[n.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",n[n.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",n[n.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",n[n.RESET_RECEIVER=5]="RESET_RECEIVER",n[n.RESET_INITIATOR=6]="RESET_INITIATOR"}(on||(on={})),on))();const lv=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),v2=Object.freeze({NEW_STREAM:on.NEW_STREAM,MESSAGE:on.MESSAGE_INITIATOR,CLOSE:on.CLOSE_INITIATOR,RESET:on.RESET_INITIATOR}),bV=Object.freeze({MESSAGE:on.MESSAGE_RECEIVER,CLOSE:on.CLOSE_RECEIVER,RESET:on.RESET_RECEIVER}),E2=1048576,wV=(n,e)=>e.append(n);function fv(){return fv=Vt(function*(n,e={}){let t=new yr,r=!1,i=vl(),s=Number(e.size??E2);(isNaN(s)||0===s||s<0)&&(s=E2);const o=e.yieldAfter??0,a=e.serialize??wV;for(Promise.resolve().then($(function*(){try{let U;var x,u=!1,_=!1;try{for(var B,P=ut(n);u=!(B=yield P.next()).done;u=!1)a(B.value,t),t.byteLength>=s?(clearTimeout(U),i.resolve()):U=setTimeout(()=>{i.resolve()},o)}catch(W){_=!0,x=W}finally{try{u&&null!=P.return&&(yield P.return())}finally{if(_)throw x}}clearTimeout(U),i.resolve()}catch(U){i.reject(U)}finally{r=!0}}));!r;)if(yield qe(i.promise),i=vl(),t.byteLength>0){const u=t;t=new yr,yield u.subarray()}}),fv.apply(this,arguments)}const IV=function SV(n){return fv.apply(this,arguments)},_2=new class TV{constructor(){this._pool=m2(10240),this._poolOffset=0}write(e,t){const r=this._pool;let i=this._poolOffset;cr.encode(e.id<<3|e.type,r,i),i+=cr.encode.bytes??0,cr.encode(e.type!==on.NEW_STREAM&&e.type!==on.MESSAGE_INITIATOR&&e.type!==on.MESSAGE_RECEIVER||null==e.data?0:e.data.length,r,i),i+=cr.encode.bytes??0;const s=r.subarray(this._poolOffset,i);10240-i<100?(this._pool=m2(10240),this._poolOffset=0):this._poolOffset=i,t.append(s),(e.type===on.NEW_STREAM||e.type===on.MESSAGE_INITIATOR||e.type===on.MESSAGE_RECEIVER)&&null!=e.data&&t.append(e.data)}};function hv(){return hv=Vt(function*(n,e=0){if(null!=e&&0!==e)yield*Mr(ut(IV(n,{size:e,serialize:(a,u)=>{for(const _ of a)_2.write(_,u)}})),qe);else{var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield qe(s.next())).done;t=!1){const a=o.value,u=new yr;for(const _ of a)_2.write(_,u);yield u.subarray()}}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield qe(s.return()))}finally{if(r)throw i}}}}),hv.apply(this,arguments)}const b2=1<<20;class xV{constructor(e=b2,t=4194304){this._buffer=new yr,this._headerInfo=null,this._maxMessageSize=e,this._maxUnprocessedMessageQueueSize=t}write(e){if(null==e||0===e.length)return[];if(this._buffer.append(e),this._buffer.byteLength>this._maxUnprocessedMessageQueueSize)throw Object.assign(new Error("unprocessed message queue size too large!"),{code:"ERR_MSG_QUEUE_TOO_BIG"});const t=[];for(;0!==this._buffer.length;){if(null==this._headerInfo)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(_){if("ERR_MSG_TOO_BIG"===_.code)throw _;break}const{id:r,type:i,length:s,offset:o}=this._headerInfo;if(this._buffer.length-o<s)break;const u={id:r,type:i};(i===on.NEW_STREAM||i===on.MESSAGE_INITIATOR||i===on.MESSAGE_RECEIVER)&&(u.data=this._buffer.sublist(o,o+s)),t.push(u),this._buffer.consume(o+s),this._headerInfo=null}return t}_decodeHeader(e){const{value:t,offset:r}=S2(e),{value:i,offset:s}=S2(e,r),o=7&t;if(null==lv[o])throw new Error(`Invalid type received: ${o}`);if(i>this._maxMessageSize)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"});return{id:t>>3,type:o,offset:r+s,length:i}}}function S2(n,e=0){let s,t=0,r=0,i=e;const o=n.length;do{if(i>=o||r>49)throw e=0,new RangeError("Could not decode varint");s=n.get(i++),t+=r<28?(127&s)<<r:(127&s)*Math.pow(2,r),r+=7}while(s>=128);return{value:t,offset:e=i-e}}var Ah=R(772);const ws=Mt("libp2p:mplex:stream"),pv="ERR_STREAM_RESET";var I2=R(7813);const Ss=Mt("libp2p:mplex");function T2(n){const e={...n,type:`${lv[n.type]} (${n.type})`};return n.type===on.NEW_STREAM&&(e.data=kt(n.data instanceof Uint8Array?n.data:n.data.subarray())),(n.type===on.MESSAGE_INITIATOR||n.type===on.MESSAGE_RECEIVER)&&(e.data=kt(n.data instanceof Uint8Array?n.data:n.data.subarray(),"base16")),e}class FV{constructor(e){this.protocol="/mplex/6.7.0",e=e??{},this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=e,this.sink=this._createSink();const t=this._createSource();this._source=t,this.source=t,this.closeController=new AbortController,this.rateLimiter=new I2.RateLimiterMemory({points:e.disconnectThreshold??5,duration:1})}get streams(){const e=[];for(const t of this._streams.initiators.values())e.push(t);for(const t of this._streams.receivers.values())e.push(t);return e}newStream(e){if(this.closeController.signal.aborted)throw new Error("Muxer already closed");const t=this._streamId++;return e=null==e?t.toString():e.toString(),this._newStream({id:t,name:e,type:"initiator",registry:this._streams.initiators})}close(e){this.closeController.signal.aborted||(this.streams.forEach(null!=e?t=>t.abort(e):t=>t.close()),this.closeController.abort())}_newReceiverStream(e){const{id:t,name:r}=e;return this._newStream({id:t,name:r,type:"receiver",registry:this._streams.receivers})}_newStream(e){const{id:t,name:r,type:i,registry:s}=e;if(Ss("new %s stream %s",i,t),"initiator"===i&&this._streams.initiators.size===(this._init.maxOutboundStreams??1024))throw se(new Error("Too many outbound streams open"),"ERR_TOO_MANY_OUTBOUND_STREAMS");if(s.has(t))throw new Error(`${i} stream ${t} already exists!`);const u=function MV(n){const{id:e,name:t,send:r,onEnd:i,type:s="initiator",maxMsgSize:o=b2}=n,a=new AbortController,u=new AbortController,_=new AbortController,x="initiator"===s?v2:bV,P="initiator"===s?`i${e}`:`r${e}`,B=`${t??e}`;let re,U=!1,W=!1,X=!1;const fe={open:Date.now()},ae=xe=>{W||(W=!0,ws.trace("%s stream %s sink end - err: %o",s,B,xe),null!=xe&&null==re&&(re=xe),U&&(fe.close=Date.now(),i?.(re)))},Ce=Ea({onEnd:xe=>{U||(U=!0,ws.trace("%s stream %s source end - err: %o",s,B,xe),null!=xe&&null==re&&(re=xe),W&&(Ue.stat.timeline.close=Date.now(),i?.(re)))}}),Ue={close:()=>{ws.trace("%s stream %s close",s,B),Ue.closeRead(),Ue.closeWrite()},closeRead:()=>{ws.trace("%s stream %s closeRead",s,B),!U&&Ce.end()},closeWrite:()=>{if(ws.trace("%s stream %s closeWrite",s,B),!W){_.abort();try{r({id:e,type:x.CLOSE})}catch(xe){ws.trace("%s stream %s error sending close",s,t,xe)}ae()}},abort:xe=>{ws.trace("%s stream %s abort",s,B,xe),Ce.end(xe),a.abort(),ae(xe)},reset:()=>{const xe=se(new Error("stream reset"),pv);u.abort(),Ce.end(xe),ae(xe)},sink:(xe=$(function*(ht){if(X)throw se(new Error("sink already called on stream"),"ERR_DOUBLE_SINK");if(X=!0,W)throw se(new Error("stream closed for writing"),"ERR_SINK_ENDED");ht=bs(ht,(0,Ah.anySignal)([a.signal,u.signal,_.signal]));try{"initiator"===s&&r({id:e,type:v2.NEW_STREAM,data:new yr(At(B))});var An,lt=!1,nn=!1;try{for(var vi,ir=ut(ht);lt=!(vi=yield ir.next()).done;lt=!1){let vn=vi.value;for(;vn.length>0;){if(vn.length<=o){r({id:e,type:x.MESSAGE,data:vn instanceof Uint8Array?new yr(vn):vn});break}vn=vn instanceof Uint8Array?new yr(vn):vn,r({id:e,type:x.MESSAGE,data:vn.sublist(0,o)}),vn.consume(o)}}}catch(vn){nn=!0,An=vn}finally{try{lt&&null!=ir.return&&(yield ir.return())}finally{if(nn)throw An}}}catch(vn){if("aborted"===vn.type&&"The operation was aborted"===vn.message){if(_.signal.aborted)return;u.signal.aborted&&(vn.message="stream reset",vn.code=pv),a.signal.aborted&&(vn.message="stream aborted",vn.code="ERR_STREAM_ABORT")}if(vn.code===pv)ws.trace("%s stream %s reset",s,t);else{ws.trace("%s stream %s error",s,t,vn);try{r({id:e,type:x.RESET})}catch(gf){ws.trace("%s stream %s error sending reset",s,t,gf)}}return Ce.end(vn),void ae(vn)}try{r({id:e,type:x.CLOSE})}catch(vn){ws.trace("%s stream %s error sending close",s,t,vn)}ae()}),function(lt){return xe.apply(this,arguments)}),source:Ce,sourcePush:xe=>{Ce.push(xe)},sourceReadableLength:()=>Ce.readableLength,stat:{direction:"initiator"===s?"outbound":"inbound",timeline:fe},metadata:{},id:P};var xe;return Ue}({id:t,name:r,send:_=>{Ss.enabled&&Ss.trace("%s stream %s send",i,t,T2(_)),this._source.push(_)},type:i,onEnd:()=>{Ss("%s stream with id %s and protocol %s ended",i,t,u.stat.protocol),s.delete(t),null!=this._init.onStreamEnd&&this._init.onStreamEnd(u)},maxMsgSize:this._init.maxMsgSize});return s.set(t,u),u}_createSink(){var e=this;return function(){var r=$(function*(i){const s=[e.closeController.signal];null!=e._init.signal&&s.push(e._init.signal),i=bs(i,Ah(s));try{const P=new xV(e._init.maxMsgSize,e._init.maxUnprocessedMessageQueueSize);var u,o=!1,a=!1;try{for(var x,_=ut(i);o=!(x=yield _.next()).done;o=!1){const B=x.value;for(const U of P.write(B))yield e._handleIncoming(U)}}catch(B){a=!0,u=B}finally{try{o&&null!=_.return&&(yield _.return())}finally{if(a)throw u}}e._source.end()}catch(P){Ss("error in sink",P),e._source.end(P)}});return function(s){return r.apply(this,arguments)}}()}_createSource(){const t=function F8(n={}){return lC(t=>{let r;const i=[];for(;!t.isEmpty()&&(r=t.shift(),null!=r);){if(null!=r.error)throw r.error;!1===r.done&&i.push(r.value)}return null==r?{done:!0}:{done:!0===r.done,value:i}},n)}({objectMode:!0,onEnd:r=>{this.close(r)}});return Object.assign(function CV(n){return hv.apply(this,arguments)}(t,this._init.minSendBytes),{push:t.push,end:t.end,return:t.return})}_handleIncoming(e){var t=this;return $(function*(){const{id:r,type:i}=e;if(Ss.enabled&&Ss.trace("incoming message",T2(e)),e.type===on.NEW_STREAM){if(t._streams.receivers.size===(t._init.maxInboundStreams??1024)){Ss("too many inbound streams open"),t._source.push({id:r,type:on.RESET_RECEIVER});try{yield t.rateLimiter.consume("new-stream",1)}catch{return Ss("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),void t._source.end(new Error("Too many open streams"))}return}const u=t._newReceiverStream({id:r,name:kt(e.data instanceof Uint8Array?e.data:e.data.subarray())});return void(null!=t._init.onIncomingStream&&t._init.onIncomingStream(u))}const o=(1==(1&i)?t._streams.initiators:t._streams.receivers).get(r);if(null==o)return void Ss("missing stream %s for message type %s",r,lv[i]);const a=t._init.maxStreamBufferSize??4194304;switch(i){case on.MESSAGE_INITIATOR:case on.MESSAGE_RECEIVER:if(o.sourceReadableLength()>a){t._source.push({id:e.id,type:i===on.MESSAGE_INITIATOR?on.RESET_RECEIVER:on.RESET_INITIATOR});const u=se(new Error("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers"),"ERR_STREAM_INPUT_BUFFER_FULL");return void o.abort(u)}o.sourcePush(e.data);break;case on.CLOSE_INITIATOR:case on.CLOSE_RECEIVER:o.closeRead();break;case on.RESET_INITIATOR:case on.RESET_RECEIVER:o.reset();break;default:Ss("unknown message type %s",i)}})()}}class UV{constructor(e={}){this.protocol="/mplex/6.7.0",this._init=e}createStreamMuxer(e={}){return new FV({...e,...this._init})}}function VV(n={}){return()=>new UV(n)}const HV=WebSocket;var $V=R(3676);function C2(n){return n instanceof ArrayBuffer||"ArrayBuffer"===n?.constructor?.name&&"number"==typeof n?.byteLength}const KV=n=>{n.binaryType="arraybuffer";const e=function(){var s=$(function*(){return yield new Promise((o,a)=>{if(r)return o();if(null!=i)return a(i);const u=P=>{n.removeEventListener("open",_),n.removeEventListener("error",x),P()},_=()=>u(o),x=P=>{u(()=>a(P.error??new Error(`connect ECONNREFUSED ${n.url}`)))};n.addEventListener("open",_),n.addEventListener("error",x)})});return function(){return s.apply(this,arguments)}}(),t=Vt(function*(){const s=new $V.zN(({push:P,stop:B,fail:U})=>{const W=re=>{let fe=null;"string"==typeof re.data&&(fe=At(re.data)),C2(re.data)&&(fe=new Uint8Array(re.data)),re.data instanceof Uint8Array&&(fe=re.data),null!=fe&&P(fe)},X=re=>U(re.error??new Error("Socket error"));return n.addEventListener("message",W),n.addEventListener("error",X),n.addEventListener("close",B),()=>{n.removeEventListener("message",W),n.removeEventListener("error",X),n.removeEventListener("close",B)}},{highWaterMark:1/0});yield qe(e());var u,o=!1,a=!1;try{for(var x,_=ut(s);o=!(x=yield qe(_.next())).done;o=!1){const P=x.value;yield C2(P)?new Uint8Array(P):P}}catch(P){a=!0,u=P}finally{try{o&&null!=_.return&&(yield qe(_.return()))}finally{if(a)throw u}}})();let i,r=1===n.readyState;return n.addEventListener("open",()=>{r=!0,i=null}),n.addEventListener("close",()=>{r=!1,i=null}),n.addEventListener("error",s=>{r||(i=s.error??new Error(`connect ECONNREFUSED ${n.url}`))}),Object.assign(t,{connected:e})},GV=n=>{if(n.readyState>=2)throw new Error("socket closed");if(1!==n.readyState)return new Promise((e,t)=>{function r(){n.removeEventListener("open",i),n.removeEventListener("error",s)}function i(){r(),e()}function s(o){r(),t(o.error??new Error(`connect ECONNREFUSED ${n.url}`))}n.addEventListener("open",i),n.addEventListener("error",s)})},jV=(n,e)=>((e=e??{}).closeOnEnd=!1!==e.closeOnEnd,function(){var r=$(function*(i){var a,s=!1,o=!1;try{for(var _,u=ut(i);s=!(_=yield u.next()).done;s=!1){const x=_.value;try{yield GV(n)}catch(P){if("socket closed"===P.message)break;throw P}n.send(x)}}catch(x){o=!0,a=x}finally{try{s&&null!=u.return&&(yield u.return())}finally{if(o)throw a}}if(null!=e.closeOnEnd&&n.readyState<=1)return yield new Promise((x,P)=>{n.addEventListener("close",B=>{if(B.wasClean||1006===B.code)x();else{const U=Object.assign(new Error("ws error"),{event:B});P(U)}}),setTimeout(()=>n.close())})});return function(s){return r.apply(this,arguments)}}()),zV=(n,e)=>{e=e??{};const t=KV(n);let r=e.remoteAddress,i=e.remotePort;if(null!=n.url)try{const o=new URL(n.url);r=o.hostname,i=parseInt(o.port,10)}catch{}if(null==r||null==i)throw new Error("Remote connection did not have address and/or port");return{sink:jV(n,e),source:t,connected:(o=$(function*(){return yield t.connected()}),function(){return o.apply(this,arguments)}),close:function(){var o=$(function*(){(n.readyState===n.CONNECTING||n.readyState===n.OPEN)&&(yield new Promise(a=>{n.addEventListener("close",()=>{a()}),n.close()}))});return function(){return o.apply(this,arguments)}}(),destroy:()=>{null!=n.terminate?n.terminate():n.close()},remoteAddress:r,remotePort:i,socket:n};var o};var WV=R(8596);const qV={http:"ws",https:"wss"};const Rh=(n,e)=>e,JV={ip4:Rh,ip6:(n,e,t,r)=>1===r.length&&"ip6"===r[0].protocol?e:`[${e}]`,tcp:(n,e,t,r,i)=>r.some(s=>["http","https","ws","wss"].includes(s.protocol))?`${n}:${e}`:((n,e,t,r)=>{if(null!=r&&!1===r.assumeHttp)return`tcp://${n}:${e}`;let i="tcp",s=`:${e}`;return"tcp"===t[t.length-1].protocol&&(i="443"===e?"https":"http",s="443"===e||"80"===e?"":s),`${i}://${n}${s}`})(n,e,r,i),udp:(n,e)=>`udp://${n}:${e}`,dnsaddr:Rh,dns4:Rh,dns6:Rh,ipfs:(n,e)=>`${n}/ipfs/${e}`,p2p:(n,e)=>`${n}/p2p/${e}`,http:n=>`http://${n}`,https:n=>`https://${n}`,ws:n=>`ws://${n}`,wss:n=>`wss://${n}`,"p2p-websocket-star":n=>`${n}/p2p-websocket-star`,"p2p-webrtc-star":n=>`${n}/p2p-webrtc-star`,"p2p-webrtc-direct":n=>`${n}/p2p-webrtc-direct`};class ou extends Error{constructor(e="The operation was aborted"){super(e),this.code=ou.code,this.type=ou.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}}var t9=R(9456);const gv="object"==typeof window&&"object"==typeof document&&9===document.nodeType,Ph=t9(),Nh=gv&&!Ph,n9=Ph&&!gv,r9=Ph&&gv,i9=typeof globalThis.process<"u"&&typeof globalThis.process.release<"u"&&"node"===globalThis.process.release.name&&!Ph,D2="function"==typeof importScripts&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,s9=(typeof globalThis.process<"u"&&typeof globalThis.process.env<"u"&&globalThis,typeof navigator<"u"&&"ReactNative"===navigator.product);class l9 extends Error{constructor(e){super(e),this.name="TimeoutError"}}class f9 extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const R2=n=>void 0===globalThis.DOMException?new f9(n):new DOMException(n),P2=n=>{const e=void 0===n.reason?R2("This operation was aborted."):n.reason;return e instanceof Error?e:R2(e)};function N2(n,e){const{milliseconds:t,fallback:r,message:i,customTimers:s={setTimeout,clearTimeout}}=e;let o;const a=new Promise((u,_)=>{if("number"!=typeof t||1!==Math.sign(t))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t!==Number.POSITIVE_INFINITY){if(e.signal){const{signal:x}=e;x.aborted&&_(P2(x)),x.addEventListener("abort",()=>{_(P2(x))})}o=s.setTimeout.call(void 0,()=>{if(r){try{u(r())}catch(B){_(B)}return}const P=i instanceof Error?i:new l9("string"==typeof i?i:`Promise timed out after ${t} milliseconds`);"function"==typeof n.cancel&&n.cancel(),_(P)},t),$(function*(){try{u(yield n)}catch(x){_(x)}finally{s.clearTimeout.call(void 0,o)}})()}else u(n)});return a.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},a}const M2=Mt("libp2p:websockets:socket");function O2(n){return n.filter(e=>{if(e.protoCodes().includes(290))return!1;const t=e.decapsulateCode(421);return iu.matches(t)||Ia.matches(t)})}const yv=Symbol.for("@libp2p/transport"),zo=Mt("libp2p:websockets");class p9{constructor(e){this.init=e}get[Symbol.toStringTag](){return"@libp2p/websockets"}get[yv](){return!0}dial(e,t){var r=this;return $(function*(){zo("dialing %s",e),t=t??{};const s=function d9(n,e,t){const r={sink:i=>$(function*(){null!=t?.signal&&(i=bs(i,t.signal));try{yield n.sink(i)}catch(s){"aborted"!==s.type&&M2.error(s)}})(),source:null!=(t=t??{}).signal?bs(n.source,t.signal):n.source,remoteAddr:e,timeline:{open:Date.now()},close:()=>$(function*(){const i=Date.now();try{yield N2(n.close(),{milliseconds:2e3})}catch{const{host:o,port:a}=r.remoteAddr.toOptions();M2("timeout closing stream to %s:%s after %dms, destroying it manually",o,a,Date.now()-i),n.destroy()}finally{r.timeline.close=Date.now()}})()};return n.socket.addEventListener("close",()=>{null==r.timeline.close&&(r.timeline.close=Date.now())},{once:!0}),r}(yield r._connect(e,t),e);zo("new outbound connection %s",s.remoteAddr);const o=yield t.upgrader.upgradeOutbound(s);return zo("outbound connection %s upgraded",s.remoteAddr),o})()}_connect(e,t){var r=this;return $(function*(){if(!0===t?.signal?.aborted)throw new ou;const i=e.toOptions();zo("dialing %s:%s",i.host,i.port);const s=vl(),o=x=>{zo.error("connection error:",x),s.reject(x)},a=function ZV(n,e){e=e??{};const r=((n,e)=>(0,WV.relative)(n,e,qV,"ws"))(n,(typeof window>"u"?"":window.location).toString()),i=new HV(r,e.websocket);return zV(i,e)}(function e9(n,e){const t=Cn(n),r=t.toString().split("/").slice(1);return t.tuples().map(i=>({protocol:r.shift()??"",content:null!=i[1]?r.shift()??"":""})).reduce((i,s,o,a)=>{const u=JV[s.protocol];if(null==u)throw new Error(`Unsupported protocol ${s.protocol}`);return u(i,s.content,o,a,e)},"")}(e),r.init);if(null!=a.socket.on?a.socket.on("error",o):a.socket.onerror=o,null==t.signal)return yield Promise.race([a.connected(),s.promise]),zo("connected %s",e),a;let u;const _=new Promise((x,P)=>{if(u=()=>{P(new ou),a.close().catch(B=>{zo.error("error closing raw socket",B)})},!0===t?.signal?.aborted)return u();t?.signal?.addEventListener("abort",u)});try{yield Promise.race([_,s.promise,a.connected()])}finally{null!=u&&t?.signal?.removeEventListener("abort",u)}return zo("connected %s",e),a})()}createListener(e){return function o9(){throw new Error("WebSocket Servers can not be created in the browser!")}()}filter(e){return e=Array.isArray(e)?e:[e],null!=this.init?.filter?this.init?.filter(e):Nh||D2?function h9(n){return n.filter(e=>{if(e.protoCodes().includes(290))return!1;const t=e.decapsulateCode(421);return Ia.matches(t)&&Sa.matches(t.decapsulateCode(6).decapsulateCode(478))})}(e):O2(e)}}function g9(n={}){return()=>new p9(n)}var Ar=(()=>(function(n){n.Relay="relay",n.Store="store",n.LightPush="lightpush",n.Filter="filter"}(Ar||(Ar={})),Ar))();R(5357),mr("waku:select-peer");var Ev=R(3863),_v=R.n(Ev);const bv=Ev.Reader;function tr(n,e){const t=bv.create(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}["uint64","int64","sint64","fixed64","sfixed64"].forEach(n=>{const e=bv.prototype[n];bv.prototype[n]=function(){return BigInt(e.call(this).toString())}});const wv=Ev.Writer;function nr(n,e){const t=wv.create();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}["uint64","int64","sint64","fixed64","sfixed64"].forEach(n=>{const e=wv.prototype[n];wv.prototype[n]=function(t){return e.call(this,t.toString())}});var Oh,kh,B2,Lh,Bh,Hl=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(Hl||(Hl={})),Hl))();function k2(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}function L2(n){function e(i){if(null==n[i.toString()])throw new Error("Invalid enum value");return n[i]}return k2("enum",Hl.VARINT,function(s,o){const a=e(s);o.int32(a)},function(s){return e(s.uint32())})}function rr(n,e){return k2("message",Hl.LENGTH_DELIMITED,n,e)}!function(n){let e,t;!function(r){let i;r.codec=()=>(null==i&&(i=rr((s,o,a={})=>{!1!==a.lengthDelimited&&o.fork(),null!=s.contentTopic&&(o.uint32(10),o.string(s.contentTopic)),!1!==a.lengthDelimited&&o.ldelim()},(s,o)=>{const a={},u=null==o?s.len:s.pos+o;for(;s.pos<u;){const _=s.uint32();_>>>3==1?a.contentTopic=s.string():s.skipType(7&_)}return a})),i),r.encode=s=>nr(s,r.codec()),r.decode=s=>tr(s,r.codec())}(e=n.ContentFilter||(n.ContentFilter={})),n.codec=()=>(null==t&&(t=rr((r,i,s={})=>{if(!1!==s.lengthDelimited&&i.fork(),null!=r.subscribe&&(i.uint32(8),i.bool(r.subscribe)),null!=r.topic&&(i.uint32(18),i.string(r.topic)),null==r.contentFilters)throw new Error('Protocol error: required field "contentFilters" was not found in object');for(const o of r.contentFilters)i.uint32(26),n.ContentFilter.codec().encode(o,i);!1!==s.lengthDelimited&&i.ldelim()},(r,i)=>{const s={contentFilters:[]},o=null==i?r.len:r.pos+i;for(;r.pos<o;){const a=r.uint32();switch(a>>>3){case 1:s.subscribe=r.bool();break;case 2:s.topic=r.string();break;case 3:s.contentFilters.push(n.ContentFilter.codec().decode(r,r.uint32()));break;default:r.skipType(7&a)}}return s})),t),n.encode=r=>nr(r,n.codec()),n.decode=r=>tr(r,n.codec())}(Oh||(Oh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.messages)throw new Error('Protocol error: required field "messages" was not found in object');for(const s of t.messages)r.uint32(10),Bh.codec().encode(s,r);!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={messages:[]},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();o>>>3==1?i.messages.push(Bh.codec().decode(t,t.uint32())):t.skipType(7&o)}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(kh||(kh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.requestId&&(r.uint32(10),r.string(t.requestId)),null!=t.request&&(r.uint32(18),Oh.codec().encode(t.request,r)),null!=t.push&&(r.uint32(26),kh.codec().encode(t.push,r)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.requestId=t.string();break;case 2:i.request=Oh.codec().decode(t,t.uint32());break;case 3:i.push=kh.codec().decode(t,t.uint32());break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(B2||(B2={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(r.uint32(10),r.bytes(t.proof),null==t.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(r.uint32(18),r.bytes(t.merkleRoot),null==t.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(r.uint32(26),r.bytes(t.epoch),null==t.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(r.uint32(34),r.bytes(t.shareX),null==t.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(r.uint32(42),r.bytes(t.shareY),null==t.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(r.uint32(50),r.bytes(t.nullifier),null==t.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');r.uint32(58),r.bytes(t.rlnIdentifier),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.proof=t.bytes();break;case 2:i.merkleRoot=t.bytes();break;case 3:i.epoch=t.bytes();break;case 4:i.shareX=t.bytes();break;case 5:i.shareY=t.bytes();break;case 6:i.nullifier=t.bytes();break;case 7:i.rlnIdentifier=t.bytes();break;default:t.skipType(7&o)}}if(null==i.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==i.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==i.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==i.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==i.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==i.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==i.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Lh||(Lh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.payload&&(r.uint32(10),r.bytes(t.payload)),null!=t.contentTopic&&(r.uint32(18),r.string(t.contentTopic)),null!=t.version&&(r.uint32(24),r.uint32(t.version)),null!=t.timestampDeprecated&&(r.uint32(33),r.double(t.timestampDeprecated)),null!=t.timestamp&&(r.uint32(80),r.sint64(t.timestamp)),null!=t.rateLimitProof&&(r.uint32(170),Lh.codec().encode(t.rateLimitProof,r)),null!=t.ephemeral&&(r.uint32(248),r.bool(t.ephemeral)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.payload=t.bytes();break;case 2:i.contentTopic=t.string();break;case 3:i.version=t.uint32();break;case 4:i.timestampDeprecated=t.double();break;case 10:i.timestamp=t.sint64();break;case 21:i.rateLimitProof=Lh.codec().decode(t,t.uint32());break;case 31:i.ephemeral=t.bool();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Bh||(Bh={}));const Ca="/vac/waku/filter/2.0.0-beta1";var Fh,Uh,F2,Vh,Hh;mr("waku:filter"),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.pubSubTopic&&(r.uint32(10),r.string(t.pubSubTopic)),null!=t.message&&(r.uint32(18),Hh.codec().encode(t.message,r)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.pubSubTopic=t.string();break;case 2:i.message=Hh.codec().decode(t,t.uint32());break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Fh||(Fh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.isSuccess&&(r.uint32(8),r.bool(t.isSuccess)),null!=t.info&&(r.uint32(18),r.string(t.info)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.isSuccess=t.bool();break;case 2:i.info=t.string();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Uh||(Uh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.requestId&&(r.uint32(10),r.string(t.requestId)),null!=t.request&&(r.uint32(18),Fh.codec().encode(t.request,r)),null!=t.response&&(r.uint32(26),Uh.codec().encode(t.response,r)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.requestId=t.string();break;case 2:i.request=Fh.codec().decode(t,t.uint32());break;case 3:i.response=Uh.codec().decode(t,t.uint32());break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(F2||(F2={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(r.uint32(10),r.bytes(t.proof),null==t.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(r.uint32(18),r.bytes(t.merkleRoot),null==t.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(r.uint32(26),r.bytes(t.epoch),null==t.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(r.uint32(34),r.bytes(t.shareX),null==t.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(r.uint32(42),r.bytes(t.shareY),null==t.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(r.uint32(50),r.bytes(t.nullifier),null==t.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');r.uint32(58),r.bytes(t.rlnIdentifier),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.proof=t.bytes();break;case 2:i.merkleRoot=t.bytes();break;case 3:i.epoch=t.bytes();break;case 4:i.shareX=t.bytes();break;case 5:i.shareY=t.bytes();break;case 6:i.nullifier=t.bytes();break;case 7:i.rlnIdentifier=t.bytes();break;default:t.skipType(7&o)}}if(null==i.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==i.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==i.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==i.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==i.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==i.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==i.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Vh||(Vh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.payload&&(r.uint32(10),r.bytes(t.payload)),null!=t.contentTopic&&(r.uint32(18),r.string(t.contentTopic)),null!=t.version&&(r.uint32(24),r.uint32(t.version)),null!=t.timestampDeprecated&&(r.uint32(33),r.double(t.timestampDeprecated)),null!=t.timestamp&&(r.uint32(80),r.sint64(t.timestamp)),null!=t.rateLimitProof&&(r.uint32(170),Vh.codec().encode(t.rateLimitProof,r)),null!=t.ephemeral&&(r.uint32(248),r.bool(t.ephemeral)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.payload=t.bytes();break;case 2:i.contentTopic=t.string();break;case 3:i.version=t.uint32();break;case 4:i.timestampDeprecated=t.double();break;case 10:i.timestamp=t.sint64();break;case 21:i.rateLimitProof=Vh.codec().decode(t,t.uint32());break;case 31:i.ephemeral=t.bool();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Hh||(Hh={})),mr("waku:light-push");const $l="/vac/waku/lightpush/2.0.0-beta1";var Kh,Gh;!function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(r.uint32(10),r.bytes(t.proof),null==t.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(r.uint32(18),r.bytes(t.merkleRoot),null==t.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(r.uint32(26),r.bytes(t.epoch),null==t.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(r.uint32(34),r.bytes(t.shareX),null==t.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(r.uint32(42),r.bytes(t.shareY),null==t.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(r.uint32(50),r.bytes(t.nullifier),null==t.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');r.uint32(58),r.bytes(t.rlnIdentifier),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.proof=t.bytes();break;case 2:i.merkleRoot=t.bytes();break;case 3:i.epoch=t.bytes();break;case 4:i.shareX=t.bytes();break;case 5:i.shareY=t.bytes();break;case 6:i.nullifier=t.bytes();break;case 7:i.rlnIdentifier=t.bytes();break;default:t.skipType(7&o)}}if(null==i.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==i.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==i.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==i.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==i.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==i.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==i.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Kh||(Kh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.payload&&(r.uint32(10),r.bytes(t.payload)),null!=t.contentTopic&&(r.uint32(18),r.string(t.contentTopic)),null!=t.version&&(r.uint32(24),r.uint32(t.version)),null!=t.timestampDeprecated&&(r.uint32(33),r.double(t.timestampDeprecated)),null!=t.timestamp&&(r.uint32(80),r.sint64(t.timestamp)),null!=t.rateLimitProof&&(r.uint32(170),Kh.codec().encode(t.rateLimitProof,r)),null!=t.ephemeral&&(r.uint32(248),r.bool(t.ephemeral)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.payload=t.bytes();break;case 2:i.contentTopic=t.string();break;case 3:i.version=t.uint32();break;case 4:i.timestampDeprecated=t.double();break;case 10:i.timestamp=t.sint64();break;case 21:i.rateLimitProof=Kh.codec().decode(t,t.uint32());break;case 31:i.ephemeral=t.bool();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Gh||(Gh={}));const U2=mr("waku:message:version-0"),V2=BigInt(1e6);class b9{constructor(e){this.proto=e}get _rawPayload(){if(this.proto.payload)return new Uint8Array(this.proto.payload)}get ephemeral(){return Boolean(this.proto.ephemeral)}get payload(){return this._rawPayload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp)return new Date(Number(this.proto.timestamp/V2));if(this.proto.timestampDeprecated)return new Date(1e3*this.proto.timestampDeprecated)}catch{return}}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}class H2{constructor(e,t=!1){this.contentTopic=e,this.ephemeral=t}toWire(e){var t=this;return $(function*(){return Gh.encode(yield t.toProtoObj(e))})()}toProtoObj(e){var t=this;return $(function*(){const r=e.timestamp??new Date;return{payload:e.payload,version:0,contentTopic:t.contentTopic,timestamp:BigInt(r.valueOf())*V2,rateLimitProof:e.rateLimitProof,ephemeral:t.ephemeral}})()}}class w9{constructor(e,t=!1){this.contentTopic=e,this.ephemeral=t}fromWireToProtoObj(e){const t=Gh.decode(e);return U2("Message decoded",t),Promise.resolve({payload:t.payload??void 0,contentTopic:t.contentTopic??void 0,version:t.version??void 0,timestamp:t.timestamp??void 0,rateLimitProof:t.rateLimitProof??void 0,ephemeral:t.ephemeral??!1})}fromProtoObj(e){return $(function*(){return void 0===e.version&&(e.version=0),0!==e.version?(U2("Failed to decode due to incorrect version, expected:",0,", actual:",e.version),Promise.resolve(void 0)):new b9(e)})()}}const Da=["/vac/waku/relay/2.0.0-beta2","/vac/waku/relay/2.0.0"];function $2(n,...e){if(!(n instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}const Dv_exists=function C9(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")},Dv_output=function D9(n,e){$2(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)},xv=("object"==typeof self&&"crypto"in self&&self,n=>new DataView(n.buffer,n.byteOffset,n.byteLength)),Fs=(n,e)=>n<<32-e|n>>>e;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function Rv(n){if("string"==typeof n&&(n=function R9(n){if("string"!=typeof n)throw new TypeError("utf8ToBytes expected string, got "+typeof n);return(new TextEncoder).encode(n)}(n)),!(n instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof n})`);return n}function K2(n){const e=r=>n().update(Rv(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));const k9=(n,e,t)=>n&e^~n&t,L9=(n,e,t)=>n&e^n&t^e&t,B9=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Wo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qo=new Uint32Array(64);class G2 extends class O9 extends class P9{clone(){return this._cloneInto()}}{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=xv(this.buffer)}update(e){Dv_exists(this);const{view:t,buffer:r,blockLen:i}=this,s=(e=Rv(e)).length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a!==i)r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0);else{const u=xv(e);for(;i<=s-o;o+=i)this.process(u,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Dv_exists(this),Dv_output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let P=o;P<i;P++)t[P]=0;(function M9(n,e,t,r){if("function"==typeof n.setBigUint64)return n.setBigUint64(e,t,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(t>>i&s),a=Number(t&s),_=r?0:4;n.setUint32(e+(r?4:0),o,r),n.setUint32(e+_,a,r)})(r,i-8,BigInt(8*this.length),s),this.process(r,0);const a=xv(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const _=u/4,x=this.get();if(_>x.length)throw new Error("_sha2: outputLen bigger than state");for(let P=0;P<_;P++)a.setUint32(4*P,x[P],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%t&&e.buffer.set(r),e}}{constructor(){super(64,32,8,!1),this.A=0|Wo[0],this.B=0|Wo[1],this.C=0|Wo[2],this.D=0|Wo[3],this.E=0|Wo[4],this.F=0|Wo[5],this.G=0|Wo[6],this.H=0|Wo[7]}get(){const{A:e,B:t,C:r,D:i,E:s,F:o,G:a,H:u}=this;return[e,t,r,i,s,o,a,u]}set(e,t,r,i,s,o,a,u){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|s,this.F=0|o,this.G=0|a,this.H=0|u}process(e,t){for(let P=0;P<16;P++,t+=4)qo[P]=e.getUint32(t,!1);for(let P=16;P<64;P++){const B=qo[P-15],U=qo[P-2],W=Fs(B,7)^Fs(B,18)^B>>>3,X=Fs(U,17)^Fs(U,19)^U>>>10;qo[P]=X+qo[P-7]+W+qo[P-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:u,G:_,H:x}=this;for(let P=0;P<64;P++){const U=x+(Fs(a,6)^Fs(a,11)^Fs(a,25))+k9(a,u,_)+B9[P]+qo[P]|0,X=(Fs(r,2)^Fs(r,13)^Fs(r,22))+L9(r,i,s)|0;x=_,_=u,u=a,a=o+U|0,o=s,s=i,i=r,r=U+X|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,u=u+this.F|0,_=_+this.G|0,x=x+this.H|0,this.set(r,i,s,o,a,u,_,x)}roundClean(){qo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class F9 extends G2{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}var jh,au,zh,Wh,Kl,j2,qh,Qh;K2(()=>new G2),K2(()=>new F9),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.digest&&(r.uint32(10),r.bytes(t.digest)),null!=t.receivedTime&&(r.uint32(16),r.sint64(t.receivedTime)),null!=t.senderTime&&(r.uint32(24),r.sint64(t.senderTime)),null!=t.pubsubTopic&&(r.uint32(34),r.string(t.pubsubTopic)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.digest=t.bytes();break;case 2:i.receivedTime=t.sint64();break;case 3:i.senderTime=t.sint64();break;case 4:i.pubsubTopic=t.string();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(jh||(jh={})),function(n){let e;var i;let t,r;(i=e=n.Direction||(n.Direction={})).DIRECTION_BACKWARD_UNSPECIFIED="DIRECTION_BACKWARD_UNSPECIFIED",i.DIRECTION_FORWARD="DIRECTION_FORWARD",function(i){i[i.DIRECTION_BACKWARD_UNSPECIFIED=0]="DIRECTION_BACKWARD_UNSPECIFIED",i[i.DIRECTION_FORWARD=1]="DIRECTION_FORWARD"}(t||(t={})),function(i){i.codec=()=>L2(t)}(e=n.Direction||(n.Direction={})),n.codec=()=>(null==r&&(r=rr((i,s,o={})=>{!1!==o.lengthDelimited&&s.fork(),null!=i.pageSize&&(s.uint32(8),s.uint64(i.pageSize)),null!=i.cursor&&(s.uint32(18),jh.codec().encode(i.cursor,s)),null!=i.direction&&(s.uint32(24),n.Direction.codec().encode(i.direction,s)),!1!==o.lengthDelimited&&s.ldelim()},(i,s)=>{const o={},a=null==s?i.len:i.pos+s;for(;i.pos<a;){const u=i.uint32();switch(u>>>3){case 1:o.pageSize=i.uint64();break;case 2:o.cursor=jh.codec().decode(i,i.uint32());break;case 3:o.direction=n.Direction.codec().decode(i);break;default:i.skipType(7&u)}}return o})),r),n.encode=i=>nr(i,n.codec()),n.decode=i=>tr(i,n.codec())}(au||(au={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.contentTopic&&(r.uint32(10),r.string(t.contentTopic)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();o>>>3==1?i.contentTopic=t.string():t.skipType(7&o)}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(zh||(zh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null!=t.pubSubTopic&&(r.uint32(18),r.string(t.pubSubTopic)),null==t.contentFilters)throw new Error('Protocol error: required field "contentFilters" was not found in object');for(const s of t.contentFilters)r.uint32(26),zh.codec().encode(s,r);null!=t.pagingInfo&&(r.uint32(34),au.codec().encode(t.pagingInfo,r)),null!=t.startTime&&(r.uint32(40),r.sint64(t.startTime)),null!=t.endTime&&(r.uint32(48),r.sint64(t.endTime)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={contentFilters:[]},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 2:i.pubSubTopic=t.string();break;case 3:i.contentFilters.push(zh.codec().decode(t,t.uint32()));break;case 4:i.pagingInfo=au.codec().decode(t,t.uint32());break;case 5:i.startTime=t.sint64();break;case 6:i.endTime=t.sint64();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Wh||(Wh={})),function(n){let e;var i;let t,r;(i=e=n.HistoryError||(n.HistoryError={})).ERROR_NONE_UNSPECIFIED="ERROR_NONE_UNSPECIFIED",i.ERROR_INVALID_CURSOR="ERROR_INVALID_CURSOR",function(i){i[i.ERROR_NONE_UNSPECIFIED=0]="ERROR_NONE_UNSPECIFIED",i[i.ERROR_INVALID_CURSOR=1]="ERROR_INVALID_CURSOR"}(t||(t={})),function(i){i.codec=()=>L2(t)}(e=n.HistoryError||(n.HistoryError={})),n.codec=()=>(null==r&&(r=rr((i,s,o={})=>{if(!1!==o.lengthDelimited&&s.fork(),null==i.messages)throw new Error('Protocol error: required field "messages" was not found in object');for(const a of i.messages)s.uint32(18),Qh.codec().encode(a,s);null!=i.pagingInfo&&(s.uint32(26),au.codec().encode(i.pagingInfo,s)),null!=i.error&&(s.uint32(32),n.HistoryError.codec().encode(i.error,s)),!1!==o.lengthDelimited&&s.ldelim()},(i,s)=>{const o={messages:[]},a=null==s?i.len:i.pos+s;for(;i.pos<a;){const u=i.uint32();switch(u>>>3){case 2:o.messages.push(Qh.codec().decode(i,i.uint32()));break;case 3:o.pagingInfo=au.codec().decode(i,i.uint32());break;case 4:o.error=n.HistoryError.codec().decode(i);break;default:i.skipType(7&u)}}return o})),r),n.encode=i=>nr(i,n.codec()),n.decode=i=>tr(i,n.codec())}(Kl||(Kl={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.requestId&&(r.uint32(10),r.string(t.requestId)),null!=t.query&&(r.uint32(18),Wh.codec().encode(t.query,r)),null!=t.response&&(r.uint32(26),Kl.codec().encode(t.response,r)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.requestId=t.string();break;case 2:i.query=Wh.codec().decode(t,t.uint32());break;case 3:i.response=Kl.codec().decode(t,t.uint32());break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(j2||(j2={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null==t.proof)throw new Error('Protocol error: required field "proof" was not found in object');if(r.uint32(10),r.bytes(t.proof),null==t.merkleRoot)throw new Error('Protocol error: required field "merkleRoot" was not found in object');if(r.uint32(18),r.bytes(t.merkleRoot),null==t.epoch)throw new Error('Protocol error: required field "epoch" was not found in object');if(r.uint32(26),r.bytes(t.epoch),null==t.shareX)throw new Error('Protocol error: required field "shareX" was not found in object');if(r.uint32(34),r.bytes(t.shareX),null==t.shareY)throw new Error('Protocol error: required field "shareY" was not found in object');if(r.uint32(42),r.bytes(t.shareY),null==t.nullifier)throw new Error('Protocol error: required field "nullifier" was not found in object');if(r.uint32(50),r.bytes(t.nullifier),null==t.rlnIdentifier)throw new Error('Protocol error: required field "rlnIdentifier" was not found in object');r.uint32(58),r.bytes(t.rlnIdentifier),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.proof=t.bytes();break;case 2:i.merkleRoot=t.bytes();break;case 3:i.epoch=t.bytes();break;case 4:i.shareX=t.bytes();break;case 5:i.shareY=t.bytes();break;case 6:i.nullifier=t.bytes();break;case 7:i.rlnIdentifier=t.bytes();break;default:t.skipType(7&o)}}if(null==i.proof)throw new Error('Protocol error: value for required field "proof" was not found in protobuf');if(null==i.merkleRoot)throw new Error('Protocol error: value for required field "merkleRoot" was not found in protobuf');if(null==i.epoch)throw new Error('Protocol error: value for required field "epoch" was not found in protobuf');if(null==i.shareX)throw new Error('Protocol error: value for required field "shareX" was not found in protobuf');if(null==i.shareY)throw new Error('Protocol error: value for required field "shareY" was not found in protobuf');if(null==i.nullifier)throw new Error('Protocol error: value for required field "nullifier" was not found in protobuf');if(null==i.rlnIdentifier)throw new Error('Protocol error: value for required field "rlnIdentifier" was not found in protobuf');return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(qh||(qh={})),function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.payload&&(r.uint32(10),r.bytes(t.payload)),null!=t.contentTopic&&(r.uint32(18),r.string(t.contentTopic)),null!=t.version&&(r.uint32(24),r.uint32(t.version)),null!=t.timestampDeprecated&&(r.uint32(33),r.double(t.timestampDeprecated)),null!=t.timestamp&&(r.uint32(80),r.sint64(t.timestamp)),null!=t.rateLimitProof&&(r.uint32(170),qh.codec().encode(t.rateLimitProof,r)),null!=t.ephemeral&&(r.uint32(248),r.bool(t.ephemeral)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.payload=t.bytes();break;case 2:i.contentTopic=t.string();break;case 3:i.version=t.uint32();break;case 4:i.timestampDeprecated=t.double();break;case 10:i.timestamp=t.sint64();break;case 21:i.rateLimitProof=qh.codec().decode(t,t.uint32());break;case 31:i.ephemeral=t.bool();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Qh||(Qh={})),BigInt(1e6),mr("waku:store");const Yh="/vac/waku/store/2.0.0-beta4",W9="js-waku",uu=mr("waku:waku");class q9{constructor(e,t,r,i,s){this.libp2p=t;const{peerStore:o,connectionManager:a,registrar:u}=t,_={peerStore:o,connectionManager:a,registrar:u};r&&(this.store=r(_)),s&&(this.filter=s(_)),i&&(this.lightPush=i(_)),function Q9(n){if(n)try{return n.multicodecs.includes(Da[Da.length-1])}catch{}return!1}(t.pubsub)&&(this.relay=t.pubsub),uu("Waku node created",this.libp2p.peerId.toString(),`relay: ${!!this.relay}, store: ${!!this.store}, light push: ${!!this.lightPush}, filter: ${!!this.filter}`),this.pingKeepAliveTimers={},this.relayKeepAliveTimers={};const x=e.pingKeepAlive||0,P=this.relay?e.relayKeepAlive||300:0;t.connectionManager.addEventListener("peer:connect",B=>{this.startKeepAlive(B.detail.remotePeer,x,P)}),t.connectionManager.addEventListener("peer:disconnect",B=>{this.stopKeepAlive(B.detail.remotePeer)}),t.addEventListener("peer:discovery",B=>{const U=B.detail.id;uu(`Found peer ${U.toString()}, dialing.`),t.dial(U).catch(W=>{uu(`Fail to dial ${U}`,W)})})}dial(e,t){var r=this;return $(function*(){const i=t??[];typeof t>"u"&&(r.relay&&i.push(Ar.Relay),r.store&&i.push(Ar.Store),r.filter&&i.push(Ar.Filter),r.lightPush&&i.push(Ar.LightPush));const s=[];return i.includes(Ar.Relay)&&Da.forEach(o=>s.push(o)),i.includes(Ar.Store)&&s.push(Yh),i.includes(Ar.LightPush)&&s.push($l),i.includes(Ar.Filter)&&s.push(Ca),r.libp2p.dialProtocol(e,s)})()}start(){var e=this;return $(function*(){yield e.libp2p.start()})()}stop(){var e=this;return $(function*(){e.stopAllKeepAlives(),yield e.libp2p.stop()})()}isStarted(){return this.libp2p.isStarted()}getLocalMultiaddrWithID(){const e=this.libp2p.getMultiaddrs().find(t=>t.toString().match(/127\.0\.0\.1/));if(!e||""===e.toString())throw"Not listening on localhost";return e+"/p2p/"+this.libp2p.peerId.toString()}startKeepAlive(e,t,r){this.stopKeepAlive(e);const i=e.toString();0!==t&&(this.pingKeepAliveTimers[i]=setInterval(()=>{this.libp2p.ping(e).catch(o=>{uu(`Ping failed (${i})`,o)})},1e3*t));const s=this.relay;if(s&&0!==r){const o=new H2("/relay-ping/1/ping/null");this.relayKeepAliveTimers[i]=setInterval(()=>{uu("Sending Waku Relay ping message"),s.send(o,{payload:new Uint8Array}).catch(a=>uu("Failed to send relay ping",a))},1e3*r)}}stopKeepAlive(e){const t=e.toString();this.pingKeepAliveTimers[t]&&(clearInterval(this.pingKeepAliveTimers[t]),delete this.pingKeepAliveTimers[t]),this.relayKeepAliveTimers[t]&&(clearInterval(this.relayKeepAliveTimers[t]),delete this.relayKeepAliveTimers[t])}stopAllKeepAlives(){for(const e of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(e);this.pingKeepAliveTimers={},this.relayKeepAliveTimers={}}}var Ov;!function(n){let e;n.codec=()=>(null==e&&(e=rr((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),null!=t.contentTopic&&(r.uint32(18),r.string(t.contentTopic)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();o>>>3==2?i.contentTopic=t.string():t.skipType(7&o)}return i})),e),n.encode=t=>nr(t,n.codec()),n.decode=t=>tr(t,n.codec())}(Ov||(Ov={}));!function Z9(){Mc._configure(),Gi._configure(Pc),ji._configure(Nc)}();const q2=["uint64","int64","sint64","fixed64","sfixed64"];function kv(n,e){const t=function J9(n){return function X9(n){for(const e of q2){if(null==n[e])continue;const t=n[e];n[e]=function(){return BigInt(t.call(this).toString())}}return n}(new Gi(n))}(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}function Lv(n,e){const t=function t7(){return function e7(n){for(const e of q2){if(null==n[e])continue;const t=n[e];n[e]=function(r){return t.call(this,r.toString())}}return n}(ji.create())}();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}var Xh,Zh=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(Zh||(Zh={})),Zh))();function Bv(n,e){return function n7(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}("message",Zh.LENGTH_DELIMITED,n,e)}!function(n){let e;n.codec=()=>(null==e&&(e=Bv((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),(!0===i.writeDefaults||null!=t.publicKey&&t.publicKey.byteLength>0)&&(r.uint32(10),r.bytes(t.publicKey)),(!0===i.writeDefaults||null!=t.payloadType&&t.payloadType.byteLength>0)&&(r.uint32(18),r.bytes(t.payloadType)),(!0===i.writeDefaults||null!=t.payload&&t.payload.byteLength>0)&&(r.uint32(26),r.bytes(t.payload)),(!0===i.writeDefaults||null!=t.signature&&t.signature.byteLength>0)&&(r.uint32(42),r.bytes(t.signature)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.publicKey=t.bytes();break;case 2:i.payloadType=t.bytes();break;case 3:i.payload=t.bytes();break;case 5:i.signature=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>Lv(t,n.codec()),n.decode=t=>kv(t,n.codec())}(Xh||(Xh={}));class yi{constructor(e){const{peerId:t,payloadType:r,payload:i,signature:s}=e;this.peerId=t,this.payloadType=r,this.payload=i,this.signature=s}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=Xh.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return Or(this.marshal(),e.marshal())}validate(e){var t=this;return $(function*(){const r=Q2(e,t.payloadType,t.payload);if(null==t.peerId.publicKey)throw new Error("Missing public key");return yield Ml(t.peerId.publicKey).verify(r.subarray(),t.signature)})()}}yi.createFromProtobuf=function(){var n=$(function*(e){const t=Xh.decode(e),r=yield kl(t.publicKey);return new yi({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})});return function(e){return n.apply(this,arguments)}}(),yi.seal=function(){var n=$(function*(e,t){if(null==t.privateKey)throw new Error("Missing private key");const r=e.domain,i=e.codec,s=e.marshal(),o=Q2(r,i,s),u=yield(yield Ol(t.privateKey)).sign(o.subarray());return new yi({peerId:t,payloadType:i,payload:s,signature:u})});return function(e,t){return n.apply(this,arguments)}}(),yi.openAndCertify=function(){var n=$(function*(e,t){const r=yield yi.createFromProtobuf(e);if(!(yield r.validate(t)))throw se(new Error("envelope signature is not valid for the given domain"),"ERR_SIGNATURE_NOT_VALID");return r});return function(e,t){return n.apply(this,arguments)}}();const Q2=(n,e,t)=>{const r=At(n),i=Ai.encode(r.byteLength),s=Ai.encode(e.length),o=Ai.encode(t.length);return new yr(i,r,s,e,o,t)};var Jh;!function(n){let e,t;!function(r){let i;r.codec=()=>(null==i&&(i=Bv((s,o,a={})=>{!1!==a.lengthDelimited&&o.fork(),(!0===a.writeDefaults||null!=s.multiaddr&&s.multiaddr.byteLength>0)&&(o.uint32(10),o.bytes(s.multiaddr)),!1!==a.lengthDelimited&&o.ldelim()},(s,o)=>{const a={multiaddr:new Uint8Array(0)},u=null==o?s.len:s.pos+o;for(;s.pos<u;){const _=s.uint32();_>>>3==1?a.multiaddr=s.bytes():s.skipType(7&_)}return a})),i),r.encode=s=>Lv(s,r.codec()),r.decode=s=>kv(s,r.codec())}(e=n.AddressInfo||(n.AddressInfo={})),n.codec=()=>(null==t&&(t=Bv((r,i,s={})=>{if(!1!==s.lengthDelimited&&i.fork(),(!0===s.writeDefaults||null!=r.peerId&&r.peerId.byteLength>0)&&(i.uint32(10),i.bytes(r.peerId)),(!0===s.writeDefaults||0n!==r.seq)&&(i.uint32(16),i.uint64(r.seq)),null!=r.addresses)for(const o of r.addresses)i.uint32(26),n.AddressInfo.codec().encode(o,i,{writeDefaults:!0});!1!==s.lengthDelimited&&i.ldelim()},(r,i)=>{const s={peerId:new Uint8Array(0),seq:0n,addresses:[]},o=null==i?r.len:r.pos+i;for(;r.pos<o;){const a=r.uint32();switch(a>>>3){case 1:s.peerId=r.bytes();break;case 2:s.seq=r.uint64();break;case 3:s.addresses.push(n.AddressInfo.codec().decode(r,r.uint32()));break;default:r.skipType(7&a)}}return s})),t),n.encode=r=>Lv(r,n.codec()),n.decode=r=>kv(r,n.codec())}(Jh||(Jh={}));const o7=Uint8Array.from([3,1]);let lu=(()=>{class n{constructor(t){this.domain=n.DOMAIN,this.codec=n.CODEC;const{peerId:r,multiaddrs:i,seqNumber:s}=t;this.peerId=r,this.multiaddrs=i??[],this.seqNumber=s??BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=Jh.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map(t=>({multiaddr:t.bytes}))})),this.marshaled}equals(t){return!!(t instanceof n&&this.peerId.equals(t.peerId)&&this.seqNumber===t.seqNumber&&function i7(n,e){const t=(r,i)=>r.toString().localeCompare(i.toString());return n.length===e.length&&(e.sort(t),n.sort(t).every((r,i)=>e[i].equals(r)))}(this.multiaddrs,t.multiaddrs))}}return n.createFromProtobuf=e=>{const t=Jh.decode(e),r=tu(t.peerId),i=(t.addresses??[]).map(o=>Cn(o.multiaddr));return new n({peerId:r,multiaddrs:i,seqNumber:t.seq})},n.DOMAIN="libp2p-peer-record",n.CODEC=o7,n})();const Fv=Symbol.for("@libp2p/topology"),Y2=()=>{};class c7{constructor(e){this.min=e.min??0,this.max=e.max??1/0,this.peers=new Set,this.onConnect=e.onConnect??Y2,this.onDisconnect=e.onDisconnect??Y2}get[Symbol.toStringTag](){return Fv.toString()}get[Fv](){return!0}setRegistrar(e){var t=this;return $(function*(){t.registrar=e})()}disconnect(e){this.onDisconnect(e)}}class l7{constructor(e,t,r){this.gossip=e,this.msgs=new Map,this.history=[],this.notValidatedCount=0,this.msgIdToStrFn=r;for(let i=0;i<t;i++)this.history[i]=[]}get size(){return this.msgs.size}put(e,t,r=!1){const{msgIdStr:i}=e;return!this.msgs.has(i)&&(this.msgs.set(i,{message:t,validated:r,originatingPeers:new Set,iwantCounts:new Map}),this.history[0].push({...e,topic:t.topic}),r||this.notValidatedCount++,!0)}observeDuplicate(e,t){const r=this.msgs.get(e);r&&!r.validated&&r.originatingPeers.add(t)}get(e){return this.msgs.get(this.msgIdToStrFn(e))?.message}getWithIWantCount(e,t){const r=this.msgs.get(e);if(!r)return null;const i=(r.iwantCounts.get(t)??0)+1;return r.iwantCounts.set(t,i),{msg:r.message,count:i}}getGossipIDs(e){const t=new Map;for(let r=0;r<this.gossip;r++)this.history[r].forEach(i=>{const s=this.msgs.get(i.msgIdStr);if(s&&s.validated&&e.has(i.topic)){let o=t.get(i.topic);o||(o=[],t.set(i.topic,o)),o.push(i.msgId)}});return t}validate(e){const t=this.msgs.get(e);if(!t)return null;t.validated||this.notValidatedCount--;const{message:r,originatingPeers:i}=t;return t.validated=!0,t.originatingPeers=new Set,{message:r,originatingPeers:i}}shift(){this.history[this.history.length-1].forEach(t=>{const r=this.msgs.get(t.msgIdStr);r&&(this.msgs.delete(t.msgIdStr),r.validated||this.notValidatedCount--)}),this.history.pop(),this.history.unshift([])}remove(e){const t=this.msgs.get(e);return t?(this.msgs.delete(e),t):null}}var f7=R(8479);const{RPC:Uv}=f7,Z2="/floodsub/1.0.0",X2="/meshsub/1.0.0",Hv="/meshsub/1.1.0",du=5e3;function fo(n){if(n.length<=1)return n;for(let t=0;t<n.length;t++){const r=Math.floor(Math.random()*Math.floor(n.length)),i=n[t];n[t]=n[r],n[r]=i}return n}function $7(n){return kt(n,"base64")}const ep="StrictSign",$v="StrictNoSign";var Us=(()=>(function(n){n.Accept="accept",n.Ignore="ignore",n.Reject="reject"}(Us||(Us={})),Us))(),tp=(()=>(function(n){n.StrictSign="StrictSign",n.StrictNoSign="StrictNoSign"}(tp||(tp={})),tp))(),xa=(()=>(function(n){n[n.Signing=0]="Signing",n[n.Anonymous=1]="Anonymous"}(xa||(xa={})),xa))(),Yi=(()=>(function(n){n.Error="error",n.Ignore="ignore",n.Reject="reject",n.Blacklisted="blacklisted"}(Yi||(Yi={})),Yi))(),si=(()=>(function(n){n.InvalidSignature="invalid_signature",n.InvalidSeqno="invalid_seqno",n.InvalidPeerId="invalid_peerid",n.SignaturePresent="signature_present",n.SeqnoPresent="seqno_present",n.FromPresent="from_present",n.TransformFailed="transform_failed"}(si||(si={})),si))(),Zi=(()=>(function(n){n.duplicate="duplicate",n.invalid="invalid",n.valid="valid"}(Zi||(Zi={})),Zi))();function ex(n){switch(n){case Us.Ignore:return Yi.Ignore;case Us.Reject:return Yi.Reject}}function Kv(){return Kv=$(function*(n,e){switch(n){case ep:{if(!e)throw Error("Must provide PeerId");if(null==e.privateKey)throw Error("Cannot sign message, no private key present");if(null==e.publicKey)throw Error("Cannot sign message, no public key present");const t=yield Ol(e.privateKey);return{type:xa.Signing,author:e,key:e.publicKey,privateKey:t}}case $v:return{type:xa.Anonymous};default:throw new Error(`Unknown signature policy "${n}"`)}}),Kv.apply(this,arguments)}const On="ERR_INVALID_PEER_SCORE_PARAMS",G7={topics:{},topicScoreCap:10,appSpecificScore:()=>0,appSpecificWeight:10,IPColocationFactorWeight:-5,IPColocationFactorThreshold:10,IPColocationFactorWhitelist:new Set,behaviourPenaltyWeight:-10,behaviourPenaltyThreshold:0,behaviourPenaltyDecay:.2,decayInterval:1e3,decayToZero:.1,retainScore:36e5},j7={topicWeight:.5,timeInMeshWeight:1,timeInMeshQuantum:1,timeInMeshCap:3600,firstMessageDeliveriesWeight:1,firstMessageDeliveriesDecay:.5,firstMessageDeliveriesCap:2e3,meshMessageDeliveriesWeight:-1,meshMessageDeliveriesDecay:.5,meshMessageDeliveriesCap:100,meshMessageDeliveriesThreshold:20,meshMessageDeliveriesWindow:10,meshMessageDeliveriesActivation:5e3,meshFailurePenaltyWeight:-1,meshFailurePenaltyDecay:.5,invalidMessageDeliveriesWeight:-1,invalidMessageDeliveriesDecay:.3};function z7(n={}){return{...G7,...n,topics:n.topics?Object.entries(n.topics).reduce((e,[t,r])=>(e[t]=function W7(n={}){return{...j7,...n}}(r),e),{}):{}}}function Q7(n){if(n.topicWeight<0)throw se(new Error("invalid topic weight; must be >= 0"),On);if(0===n.timeInMeshQuantum)throw se(new Error("invalid TimeInMeshQuantum; must be non zero"),On);if(n.timeInMeshWeight<0)throw se(new Error("invalid TimeInMeshWeight; must be positive (or 0 to disable)"),On);if(0!==n.timeInMeshWeight&&n.timeInMeshQuantum<=0)throw se(new Error("invalid TimeInMeshQuantum; must be positive"),On);if(0!==n.timeInMeshWeight&&n.timeInMeshCap<=0)throw se(new Error("invalid TimeInMeshCap; must be positive"),On);if(n.firstMessageDeliveriesWeight<0)throw se(new Error("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)"),On);if(0!==n.firstMessageDeliveriesWeight&&(n.firstMessageDeliveriesDecay<=0||n.firstMessageDeliveriesDecay>=1))throw se(new Error("invalid FirstMessageDeliveriesDecay; must be between 0 and 1"),On);if(0!==n.firstMessageDeliveriesWeight&&n.firstMessageDeliveriesCap<=0)throw se(new Error("invalid FirstMessageDeliveriesCap; must be positive"),On);if(n.meshMessageDeliveriesWeight>0)throw se(new Error("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)"),On);if(0!==n.meshMessageDeliveriesWeight&&(n.meshMessageDeliveriesDecay<=0||n.meshMessageDeliveriesDecay>=1))throw se(new Error("invalid MeshMessageDeliveriesDecay; must be between 0 and 1"),On);if(0!==n.meshMessageDeliveriesWeight&&n.meshMessageDeliveriesCap<=0)throw se(new Error("invalid MeshMessageDeliveriesCap; must be positive"),On);if(0!==n.meshMessageDeliveriesWeight&&n.meshMessageDeliveriesThreshold<=0)throw se(new Error("invalid MeshMessageDeliveriesThreshold; must be positive"),On);if(n.meshMessageDeliveriesWindow<0)throw se(new Error("invalid MeshMessageDeliveriesWindow; must be non-negative"),On);if(0!==n.meshMessageDeliveriesWeight&&n.meshMessageDeliveriesActivation<1e3)throw se(new Error("invalid MeshMessageDeliveriesActivation; must be at least 1s"),On);if(n.meshFailurePenaltyWeight>0)throw se(new Error("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)"),On);if(0!==n.meshFailurePenaltyWeight&&(n.meshFailurePenaltyDecay<=0||n.meshFailurePenaltyDecay>=1))throw se(new Error("invalid MeshFailurePenaltyDecay; must be between 0 and 1"),On);if(n.invalidMessageDeliveriesWeight>0)throw se(new Error("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)"),On);if(n.invalidMessageDeliveriesDecay<=0||n.invalidMessageDeliveriesDecay>=1)throw se(new Error("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1"),On)}const Y7={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function Z7(n={}){return{...Y7,...n}}function X7(n,e,t,r){let i=0;if(Object.entries(e.topics).forEach(([o,a])=>{const u=t.topics[o];if(void 0===u)return;let _=0;if(a.inMesh){let U=a.meshTime/u.timeInMeshQuantum;U>u.timeInMeshCap&&(U=u.timeInMeshCap),_+=U*u.timeInMeshWeight}let x=a.firstMessageDeliveries;if(x>u.firstMessageDeliveriesCap&&(x=u.firstMessageDeliveriesCap),_+=x*u.firstMessageDeliveriesWeight,a.meshMessageDeliveriesActive&&a.meshMessageDeliveries<u.meshMessageDeliveriesThreshold){const U=u.meshMessageDeliveriesThreshold-a.meshMessageDeliveries;_+=U*U*u.meshMessageDeliveriesWeight}_+=a.meshFailurePenalty*u.meshFailurePenaltyWeight,_+=a.invalidMessageDeliveries*a.invalidMessageDeliveries*u.invalidMessageDeliveriesWeight,i+=_*u.topicWeight}),t.topicScoreCap>0&&i>t.topicScoreCap&&(i=t.topicScoreCap),i+=t.appSpecificScore(n)*t.appSpecificWeight,e.knownIPs.forEach(o=>{if(t.IPColocationFactorWhitelist.has(o))return;const a=r.get(o),u=a?a.size:0;if(u>t.IPColocationFactorThreshold){const _=u-t.IPColocationFactorThreshold;i+=_*_*t.IPColocationFactorWeight}}),e.behaviourPenalty>t.behaviourPenaltyThreshold){const o=e.behaviourPenalty-t.behaviourPenaltyThreshold;i+=o*o*t.behaviourPenaltyWeight}return i}var J7=R(1807),oi=(()=>(function(n){n[n.unknown=0]="unknown",n[n.valid=1]="valid",n[n.invalid=2]="invalid",n[n.ignored=3]="ignored"}(oi||(oi={})),oi))();class eH{constructor(){this.records=new Map,this.queue=new J7}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:oi.unknown,firstSeen:Date.now(),validated:0,peers:new Set},this.records.set(e,t);const r={msgId:e,expire:Date.now()+12e4};return this.queue.push(r),t}gc(){const e=Date.now();let t=this.queue.peekFront();for(;t&&t.expire<e;)this.records.delete(t.msgId),this.queue.shift(),t=this.queue.peekFront()}clear(){this.records.clear(),this.queue.clear()}}function Gv(n,e,t=(()=>!0)){const r=new Set;if(e<=0)return r;for(const i of n){if(r.size>=e)break;t(i)&&(r.add(i),n.delete(i))}return r}class nH extends Map{constructor(e){super(),this.getDefault=e}getOrDefault(e){let t=super.get(e);return void 0===t&&(t=this.getDefault(),this.set(e,t)),t}}const hu=Mt("libp2p:gossipsub:score");class rH{constructor(e,t,r){this.params=e,this.metrics=t,this.peerStats=new Map,this.peerIPs=new nH(()=>new Set),this.scoreCache=new Map,this.deliveryRecords=new eH,function q7(n){for(const[e,t]of Object.entries(n.topics))try{Q7(t)}catch(r){throw se(new Error(`invalid score parameters for topic ${e}: ${r.message}`),On)}if(n.topicScoreCap<0)throw se(new Error("invalid topic score cap; must be positive (or 0 for no cap)"),On);if(null==n.appSpecificScore)throw se(new Error("missing application specific score function"),On);if(n.IPColocationFactorWeight>0)throw se(new Error("invalid IPColocationFactorWeight; must be negative (or 0 to disable)"),On);if(0!==n.IPColocationFactorWeight&&n.IPColocationFactorThreshold<1)throw se(new Error("invalid IPColocationFactorThreshold; must be at least 1"),On);if(n.behaviourPenaltyWeight>0)throw se(new Error("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)"),On);if(0!==n.behaviourPenaltyWeight&&(n.behaviourPenaltyDecay<=0||n.behaviourPenaltyDecay>=1))throw se(new Error("invalid BehaviourPenaltyDecay; must be between 0 and 1"),On);if(n.decayInterval<1e3)throw se(new Error("invalid DecayInterval; must be at least 1s"),On);if(n.decayToZero<=0||n.decayToZero>=1)throw se(new Error("invalid DecayToZero; must be between 0 and 1"),On)}(e),this.scoreCacheValidityMs=r.scoreCacheValidityMs,this.computeScore=r.computeScore??X7}get size(){return this.peerStats.size}start(){this._backgroundInterval?hu("Peer score already running"):(this._backgroundInterval=setInterval(()=>this.background(),this.params.decayInterval),hu("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),hu("stopped")):hu("Peer score already stopped")}background(){this.refreshScores(),this.deliveryRecords.gc()}dumpPeerScoreStats(){return Object.fromEntries(Array.from(this.peerStats.entries()).map(([e,t])=>[e,t]))}refreshScores(){const e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach((r,i)=>{r.connected?(Object.entries(r.topics).forEach(([s,o])=>{const a=this.params.topics[s];void 0!==a&&(o.firstMessageDeliveries*=a.firstMessageDeliveriesDecay,o.firstMessageDeliveries<t&&(o.firstMessageDeliveries=0),o.meshMessageDeliveries*=a.meshMessageDeliveriesDecay,o.meshMessageDeliveries<t&&(o.meshMessageDeliveries=0),o.meshFailurePenalty*=a.meshFailurePenaltyDecay,o.meshFailurePenalty<t&&(o.meshFailurePenalty=0),o.invalidMessageDeliveries*=a.invalidMessageDeliveriesDecay,o.invalidMessageDeliveries<t&&(o.invalidMessageDeliveries=0),o.inMesh&&(o.meshTime=e-o.graftTime,o.meshTime>a.meshMessageDeliveriesActivation&&(o.meshMessageDeliveriesActive=!0)))}),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenalty<t&&(r.behaviourPenalty=0)):e>r.expire&&(this.removeIPsForPeer(i,r.knownIPs),this.peerStats.delete(i),this.scoreCache.delete(i))})}score(e){this.metrics?.scoreFnCalls.inc();const t=this.peerStats.get(e);if(!t)return 0;const r=Date.now(),i=this.scoreCache.get(e);if(i&&i.cacheUntil>r)return i.score;this.metrics?.scoreFnRuns.inc();const s=this.computeScore(e,t,this.params,this.peerIPs),o=r+this.scoreCacheValidityMs;return i?(this.metrics?.scoreCachedDelta.observe(Math.abs(s-i.score)),i.score=s,i.cacheUntil=o):this.scoreCache.set(e,{score:s,cacheUntil:o}),s}addPenalty(e,t,r){const i=this.peerStats.get(e);i&&(i.behaviourPenalty+=t,this.metrics?.onScorePenalty(r))}addPeer(e){this.peerStats.set(e,{connected:!0,expire:0,topics:{},knownIPs:new Set,behaviourPenalty:0})}addIP(e,t){const r=this.peerStats.get(e);r&&r.knownIPs.add(t),this.peerIPs.getOrDefault(t).add(e)}removeIP(e,t){const r=this.peerStats.get(e);r&&r.knownIPs.delete(t);const i=this.peerIPs.get(t);i&&(i.delete(e),0===i.size&&this.peerIPs.delete(t))}removePeer(e){const t=this.peerStats.get(e);if(t){if(this.score(e)>0)return this.removeIPsForPeer(e,t.knownIPs),void this.peerStats.delete(e);Object.entries(t.topics).forEach(([r,i])=>{i.firstMessageDeliveries=0;const s=this.params.topics[r].meshMessageDeliveriesThreshold;if(i.inMesh&&i.meshMessageDeliveriesActive&&i.meshMessageDeliveries<s){const o=s-i.meshMessageDeliveries;i.meshFailurePenalty+=o*o}i.inMesh=!1,i.meshMessageDeliveriesActive=!1}),t.connected=!1,t.expire=Date.now()+this.params.retainScore}}graft(e,t){const r=this.peerStats.get(e);if(r){const i=this.getPtopicStats(r,t);i&&(i.inMesh=!0,i.graftTime=Date.now(),i.meshTime=0,i.meshMessageDeliveriesActive=!1)}}prune(e,t){const r=this.peerStats.get(e);if(r){const i=this.getPtopicStats(r,t);if(i){const s=this.params.topics[t].meshMessageDeliveriesThreshold;if(i.meshMessageDeliveriesActive&&i.meshMessageDeliveries<s){const o=s-i.meshMessageDeliveries;i.meshFailurePenalty+=o*o}i.meshMessageDeliveriesActive=!1,i.inMesh=!1}}}validateMessage(e){this.deliveryRecords.ensureRecord(e)}deliverMessage(e,t,r){this.markFirstMessageDelivery(e,r);const i=this.deliveryRecords.ensureRecord(t),s=Date.now();i.status===oi.unknown?(i.status=oi.valid,i.validated=s,i.peers.forEach(o=>{o!==e.toString()&&this.markDuplicateMessageDelivery(o,r)})):hu("unexpected delivery: message from %s was first seen %s ago and has delivery status %s",e,s-i.firstSeen,oi[i.status])}rejectInvalidMessage(e,t){this.markInvalidMessageDelivery(e,t)}rejectMessage(e,t,r,i){switch(i){case Yi.Error:return void this.markInvalidMessageDelivery(e,r);case Yi.Blacklisted:return}const s=this.deliveryRecords.ensureRecord(t);if(s.status===oi.unknown)return i===Yi.Ignore?(s.status=oi.ignored,void s.peers.clear()):(s.status=oi.invalid,this.markInvalidMessageDelivery(e,r),s.peers.forEach(o=>{this.markInvalidMessageDelivery(o,r)}),void s.peers.clear());hu("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",e,Date.now()-s.firstSeen,oi[s.status])}duplicateMessage(e,t,r){const i=this.deliveryRecords.ensureRecord(t);if(!i.peers.has(e))switch(i.status){case oi.unknown:i.peers.add(e);break;case oi.valid:i.peers.add(e),this.markDuplicateMessageDelivery(e,r,i.validated);break;case oi.invalid:this.markInvalidMessageDelivery(e,r)}}markInvalidMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const i=this.getPtopicStats(r,t);i&&(i.invalidMessageDeliveries+=1)}}markFirstMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const i=this.getPtopicStats(r,t);if(i){let s=this.params.topics[t].firstMessageDeliveriesCap;i.firstMessageDeliveries=Math.min(s,i.firstMessageDeliveries+1),i.inMesh&&(s=this.params.topics[t].meshMessageDeliveriesCap,i.meshMessageDeliveries=Math.min(s,i.meshMessageDeliveries+1))}}}markDuplicateMessageDelivery(e,t,r){const i=this.peerStats.get(e);if(i){const s=void 0!==r?Date.now():0,o=this.getPtopicStats(i,t);if(o&&o.inMesh){const a=this.params.topics[t];if(void 0!==r){const _=s-r,x=_>a.meshMessageDeliveriesWindow;if(this.metrics?.onDuplicateMsgDelivery(t,_,x),x)return}o.meshMessageDeliveries=Math.min(a.meshMessageDeliveriesCap,o.meshMessageDeliveries+1)}}}removeIPsForPeer(e,t){for(const r of t){const i=this.peerIPs.get(r);i&&(i.delete(e),0===i.size&&this.peerIPs.delete(r))}}getPtopicStats(e,t){let r=e.topics[t];return void 0!==r?r:void 0!==this.params.topics[t]?(r={inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e.topics[t]=r,r):null}}class iH{constructor(e,t,r){this.gossipsubIWantFollowupMs=e,this.msgIdToStrFn=t,this.metrics=r,this.promises=new Map,this.requestMsByMsg=new Map,this.requestMsByMsgExpire=10*e}get size(){return this.promises.size}get requestMsByMsgSize(){return this.requestMsByMsg.size}addPromise(e,t){const r=Math.floor(Math.random()*t.length),s=this.msgIdToStrFn(t[r]);let o=this.promises.get(s);o||(o=new Map,this.promises.set(s,o));const a=Date.now();o.has(e)||(o.set(e,a+this.gossipsubIWantFollowupMs),this.metrics&&(this.metrics.iwantPromiseStarted.inc(1),this.requestMsByMsg.has(s)||this.requestMsByMsg.set(s,a)))}getBrokenPromises(){const e=Date.now(),t=new Map;let r=0;return this.promises.forEach((i,s)=>{i.forEach((o,a)=>{o<e&&(t.set(a,(t.get(a)??0)+1),i.delete(a),r++)}),i.size||this.promises.delete(s)}),this.metrics?.iwantPromiseBroken.inc(r),t}deliverMessage(e,t=!1){this.trackMessage(e);const r=this.promises.get(e);r&&(this.promises.delete(e),this.metrics&&(this.metrics.iwantPromiseResolved.inc(1),t&&this.metrics.iwantPromiseResolvedFromDuplicate.inc(1),this.metrics.iwantPromiseResolvedPeers.inc(r.size)))}rejectMessage(e,t){this.trackMessage(e),t!==Yi.Error&&this.promises.delete(e)}clear(){this.promises.clear()}prune(){const e=Date.now()-this.requestMsByMsgExpire;let t=0;for(const[r,i]of this.requestMsByMsg.entries()){if(!(i<e))break;this.requestMsByMsg.delete(r),t++}this.metrics?.iwantMessagePruned.inc(t)}trackMessage(e){if(this.metrics){const t=this.requestMsByMsg.get(e);void 0!==t&&(this.metrics.iwantPromiseDeliveryTime.observe((Date.now()-t)/1e3),this.requestMsByMsg.delete(e))}}}class jv{constructor(e){this.entries=new Map,this.validityMs=e.validityMs}get size(){return this.entries.size}put(e,t){return!!this.entries.has(e)||(this.entries.set(e,{value:t,validUntilMs:Date.now()+this.validityMs}),!1)}prune(){const e=Date.now();for(const[t,r]of this.entries.entries()){if(!(r.validUntilMs<e))break;this.entries.delete(t)}}has(e){return this.entries.has(e)}get(e){const t=this.entries.get(e);return t&&t.validUntilMs>=Date.now()?t.value:void 0}clear(){this.entries.clear()}}var ho=(()=>(function(n){n.Fanout="fanout",n.Random="random",n.Subscribed="subscribed",n.Outbound="outbound",n.NotEnough="not_enough",n.Opportunistic="opportunistic"}(ho||(ho={})),ho))(),Aa=(()=>(function(n){n.Dc="disconnected",n.BadScore="bad_score",n.Prune="prune",n.Unsub="unsubscribed",n.Excess="excess"}(Aa||(Aa={})),Aa))(),pu=(()=>(function(n){n.GraftBackoff="graft_backoff",n.BrokenPromise="broken_promise",n.MessageDeficit="message_deficit",n.IPColocation="IP_colocation"}(pu||(pu={})),pu))(),gu=(()=>(function(n){n.LowScore="low_score",n.MaxIhave="max_ihave",n.MaxIasked="max_iasked"}(gu||(gu={})),gu))(),Ra=(()=>(function(n){n.graylist="graylist",n.publish="publish",n.gossip="gossip",n.mesh="mesh"}(Ra||(Ra={})),Ra))();R(1298);var oH=R(7949);const nx={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function rx(n,e,t,r,i){if("sha1"!==i&&"sha2-256"!==i&&"sha2-512"!==i){const a=Object.keys(nx).join(" / ");throw se(new Error(`Hash '${i}' is unknown or not supported. Must be ${a}`),"ERR_UNSUPPORTED_HASH_TYPE")}const o=oH(n,e,t,r,nx[i]);return G5.encode64(o,null)}const ix=At("libp2p-pubsub:");function Wv(){return Wv=$(function*(n,e,t,r){switch(n.type){case xa.Signing:{const i={from:n.author.toBytes(),data:r,seqno:ph(8),topic:e,signature:void 0,key:void 0},s=gr([ix,Uv.Message.encode(i).finish()]);return i.signature=yield n.privateKey.sign(s),i.key=n.key,{raw:i,msg:{type:"signed",from:n.author,data:t,sequenceNumber:BigInt(`0x${kt(i.seqno,"base16")}`),topic:e,signature:i.signature,key:i.key}}}case xa.Anonymous:return{raw:{from:void 0,data:r,seqno:void 0,topic:e,signature:void 0,key:void 0},msg:{type:"unsigned",data:t,topic:e}}}}),Wv.apply(this,arguments)}function qv(){return qv=$(function*(n,e){switch(n){case $v:return null!=e.signature?{valid:!1,error:si.SignaturePresent}:null!=e.seqno?{valid:!1,error:si.SeqnoPresent}:null!=e.key?{valid:!1,error:si.FromPresent}:{valid:!0,message:{type:"unsigned",topic:e.topic,data:e.data??new Uint8Array(0)}};case ep:{if(null==e.seqno)return{valid:!1,error:si.InvalidSeqno};if(8!==e.seqno.length)return{valid:!1,error:si.InvalidSeqno};if(null==e.signature)return{valid:!1,error:si.InvalidSignature};if(null==e.from)return{valid:!1,error:si.InvalidPeerId};let t,r;try{t=tu(e.from)}catch{return{valid:!1,error:si.InvalidPeerId}}if(e.key){if(r=Ml(e.key),void 0!==t.publicKey&&!Or(r.bytes,t.publicKey))return{valid:!1,error:si.InvalidPeerId}}else{if(null==t.publicKey)return{valid:!1,error:si.InvalidPeerId};r=Ml(t.publicKey)}const s=gr([ix,Uv.Message.encode({from:e.from,data:e.data,seqno:e.seqno,topic:e.topic,signature:void 0,key:void 0}).finish()]);return(yield r.verify(s,e.signature))?{valid:!0,message:{type:"signed",from:t,data:e.data??new Uint8Array(0),sequenceNumber:BigInt(`0x${kt(e.seqno,"base16")}`),topic:e.topic,signature:e.signature,key:e.key??RD(r)}}:{valid:!1,error:si.InvalidSignature}}}}),qv.apply(this,arguments)}function dH(n){if("signed"!==n.type)throw new Error("expected signed message type");if(null==n.sequenceNumber)throw Error("missing seqno field");return((n,e)=>{const t=At(e.toString(16).padStart(16,"0"),"base16"),r=new Uint8Array(n.length+t.length);return r.set(n,0),r.set(t,n.length),r})(n.from.toBytes(),n.sequenceNumber)}function hH(n){return Qv.apply(this,arguments)}function Qv(){return Qv=$(function*(n){return yield di.encode(n.data)}),Qv.apply(this,arguments)}function pH(n,e,t,r,i){let s=0;const o=new Map;if(Object.entries(e.topics).forEach(([B,U])=>{const W=i.get(B)??"unknown",X=t.topics[B];if(void 0===X)return;let re=o.get(W);re||(re={p1w:0,p2w:0,p3w:0,p3bw:0,p4w:0},o.set(W,re));let fe=0,Ie=0,ae=0,Ce=0,Ue=0;U.inMesh&&(fe+=Math.max(U.meshTime/X.timeInMeshQuantum,X.timeInMeshCap)*X.timeInMeshWeight);let xe=U.firstMessageDeliveries;if(xe>X.firstMessageDeliveriesCap&&(xe=X.firstMessageDeliveriesCap),Ie+=xe*X.firstMessageDeliveriesWeight,U.meshMessageDeliveriesActive&&U.meshMessageDeliveries<X.meshMessageDeliveriesThreshold){const nn=X.meshMessageDeliveriesThreshold-U.meshMessageDeliveries;ae+=nn*nn*X.meshMessageDeliveriesWeight}Ce+=U.meshFailurePenalty*X.meshFailurePenaltyWeight,Ue+=U.invalidMessageDeliveries*U.invalidMessageDeliveries*X.invalidMessageDeliveriesWeight,s+=(fe+Ie+ae+Ce+Ue)*X.topicWeight,re.p1w+=fe,re.p2w+=Ie,re.p3w+=ae,re.p3bw+=Ce,re.p4w+=Ue}),t.topicScoreCap>0&&s>t.topicScoreCap){s=t.topicScoreCap;const B=t.topicScoreCap/s;for(const U of o.values())U.p1w*=B,U.p2w*=B,U.p3w*=B,U.p3bw*=B,U.p4w*=B}let a=0,u=0,_=0;return a+=t.appSpecificScore(n)*t.appSpecificWeight,e.knownIPs.forEach(B=>{if(t.IPColocationFactorWhitelist.has(B))return;const U=r.get(B),W=U?U.size:0;if(W>t.IPColocationFactorThreshold){const X=W-t.IPColocationFactorThreshold;u+=X*X*t.IPColocationFactorWeight}}),_+=e.behaviourPenalty*e.behaviourPenalty*t.behaviourPenaltyWeight,s+=a+u+_,{byTopic:o,p5w:a,p6w:u,p7w:_,score:s}}class yH{constructor(e,t,r){this.rawStream=e,this.pushable=Ea({objectMode:!1}),this.closeController=new AbortController,this.maxBufferSize=r.maxBufferSize??1/0,zn(bs(this.pushable,this.closeController.signal,{returnOnAbort:!0}),ao(),this.rawStream).catch(t)}get protocol(){return this.rawStream.stat.protocol}push(e){if(this.pushable.readableLength>this.maxBufferSize)throw Error(`OutboundStream buffer full, size > ${this.maxBufferSize}`);this.pushable.push(e)}close(){this.closeController.abort(),this.pushable.return(),this.rawStream.close()}}class mH{constructor(e,t={}){this.rawStream=e,this.closeController=new AbortController,this.source=bs(zn(this.rawStream,ys(t)),this.closeController.signal,{returnOnAbort:!0})}close(){this.closeController.abort(),this.rawStream.close()}}var vH=R(1873);const EH={maxSubscriptions:1/0,maxMessages:1/0,maxIhaveMessageIDs:1/0,maxIwantMessageIDs:1/0,maxControlMessages:1/0,maxPeerInfos:1/0};function _H(n,e){e={...e};const t=vH.Reader.create(n),r=n.length,i=void 0===r?t.len:t.pos+r,s={};for(;t.pos<i;){const o=t.uint32();switch(o>>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.length<e.maxSubscriptions?s.subscriptions.push(bH(t,t.uint32())):t.skipType(7&o);break;case 2:s.messages&&s.messages.length||(s.messages=[]),s.messages.length<e.maxMessages?s.messages.push(wH(t,t.uint32())):t.skipType(7&o);break;case 3:s.control=SH(t,t.uint32(),e);break;default:t.skipType(7&o)}}return s}function bH(n,e){const t=void 0===e?n.len:n.pos+e,r={};for(;n.pos<t;){const i=n.uint32();switch(i>>>3){case 1:r.subscribe=n.bool();break;case 2:r.topic=n.string();break;default:n.skipType(7&i)}}return r}function wH(n,e){const t=void 0===e?n.len:n.pos+e,r={};for(;n.pos<t;){const i=n.uint32();switch(i>>>3){case 1:r.from=n.bytes();break;case 2:r.data=n.bytes();break;case 3:r.seqno=n.bytes();break;case 4:r.topic=n.string();break;case 5:r.signature=n.bytes();break;case 6:r.key=n.bytes();break;default:n.skipType(7&i)}}if(!r.topic)throw Error("missing required 'topic'");return r}function SH(n,e,t){const r=void 0===e?n.len:n.pos+e,i={};for(;n.pos<r;){const s=n.uint32();switch(s>>>3){case 1:i.ihave&&i.ihave.length||(i.ihave=[]),i.ihave.length<t.maxControlMessages?i.ihave.push(IH(n,n.uint32(),t)):n.skipType(7&s);break;case 2:i.iwant&&i.iwant.length||(i.iwant=[]),i.iwant.length<t.maxControlMessages?i.iwant.push(TH(n,n.uint32(),t)):n.skipType(7&s);break;case 3:i.graft&&i.graft.length||(i.graft=[]),i.graft.length<t.maxControlMessages?i.graft.push(CH(n,n.uint32())):n.skipType(7&s);break;case 4:i.prune&&i.prune.length||(i.prune=[]),i.prune.length<t.maxControlMessages?i.prune.push(DH(n,n.uint32(),t)):n.skipType(7&s);break;default:n.skipType(7&s)}}return i}function IH(n,e,t){const r=void 0===e?n.len:n.pos+e,i={};for(;n.pos<r;){const s=n.uint32();switch(s>>>3){case 1:i.topicID=n.string();break;case 2:i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),t.maxIhaveMessageIDs-- >0?i.messageIDs.push(n.bytes()):n.skipType(7&s);break;default:n.skipType(7&s)}}return i}function TH(n,e,t){const r=void 0===e?n.len:n.pos+e,i={};for(;n.pos<r;){const s=n.uint32();s>>>3==1?(i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),t.maxIwantMessageIDs-- >0?i.messageIDs.push(n.bytes()):n.skipType(7&s)):n.skipType(7&s)}return i}function CH(n,e){const t=void 0===e?n.len:n.pos+e,r={};for(;n.pos<t;){const i=n.uint32();i>>>3==1?r.topicID=n.string():n.skipType(7&i)}return r}function DH(n,e,t){const r=void 0===e?n.len:n.pos+e,i={};for(;n.pos<r;){const s=n.uint32();switch(s>>>3){case 1:i.topicID=n.string();break;case 2:i.peers&&i.peers.length||(i.peers=[]),t.maxPeerInfos-- >0?i.peers.push(xH(n,n.uint32())):n.skipType(7&s);break;case 3:i.backoff=n.uint64();break;default:n.skipType(7&s)}}return i}function xH(n,e){const t=void 0===e?n.len:n.pos+e,r={};for(;n.pos<t;){const i=n.uint32();switch(i>>>3){case 1:r.peerID=n.bytes();break;case 2:r.signedPeerRecord=n.bytes();break;default:n.skipType(7&i)}}return r}var Gl=(()=>(function(n){n[n.ip4=4]="ip4",n[n.ip6=41]="ip6"}(Gl||(Gl={})),Gl))(),mi=(()=>(function(n){n[n.started=0]="started",n[n.stopped=1]="stopped"}(mi||(mi={})),mi))();class Yv extends gi{constructor(e,t={}){super(),this.multicodecs=[Hv,X2],this.peers=new Set,this.streamsInbound=new Map,this.streamsOutbound=new Map,this.outboundInflightQueue=Ea({objectMode:!0}),this.direct=new Set,this.floodsubPeers=new Set,this.acceptFromWhitelist=new Map,this.topics=new Map,this.subscriptions=new Set,this.mesh=new Map,this.fanout=new Map,this.fanoutLastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.topicValidators=new Map,this.heartbeatTicks=0,this.directPeerInitial=null,this.status={code:mi.stopped},this.heartbeatTimer=null,this.runHeartbeat=()=>{const i=this.metrics?.heartbeatDuration.startTimer();this.heartbeat().catch(s=>{this.log("Error running heartbeat",s)}).finally(()=>{if(i?.(),this.status.code===mi.started){clearTimeout(this.status.heartbeatTimeout);let s=this.opts.heartbeatInterval-(Date.now()-this.status.hearbeatStartMs)%this.opts.heartbeatInterval;s<.25*this.opts.heartbeatInterval&&(s+=this.opts.heartbeatInterval,this.metrics?.heartbeatSkipped.inc()),this.status.heartbeatTimeout=setTimeout(this.runHeartbeat,s)}})};const r={fallbackToFloodsub:!0,floodPublish:!0,doPX:!1,directPeers:[],D:6,Dlo:4,Dhi:12,Dscore:4,Dout:2,Dlazy:6,heartbeatInterval:1e3,fanoutTTL:6e4,mcacheLength:5,mcacheGossip:3,seenTTL:12e4,gossipsubIWantFollowupMs:3e3,prunePeers:16,pruneBackoff:6e4,graftFloodThreshold:1e4,opportunisticGraftPeers:2,opportunisticGraftTicks:60,directConnectTicks:300,...t,scoreParams:z7(t.scoreParams),scoreThresholds:Z7(t.scoreThresholds)};if(this.components=e,this.decodeRpcLimits=r.decodeRpcLimits??EH,this.globalSignaturePolicy=r.globalSignaturePolicy??ep,r.fallbackToFloodsub&&this.multicodecs.push(Z2),this.log=Mt(r.debugName??"libp2p:gossipsub"),this.opts=r,this.direct=new Set(r.directPeers.map(i=>i.id.toString())),this.seenCache=new jv({validityMs:r.seenTTL}),this.publishedMessageIds=new jv({validityMs:r.seenTTL}),t.msgIdFn)this.msgIdFn=t.msgIdFn;else switch(this.globalSignaturePolicy){case ep:this.msgIdFn=dH;break;case $v:this.msgIdFn=hH}if(t.fastMsgIdFn&&(this.fastMsgIdFn=t.fastMsgIdFn,this.fastMsgIdCache=new jv({validityMs:r.seenTTL})),this.msgIdToStrFn=t.msgIdToStrFn??$7,this.mcache=t.messageCache||new l7(r.mcacheGossip,r.mcacheLength,this.msgIdToStrFn),t.dataTransform&&(this.dataTransform=t.dataTransform),t.metricsRegister){if(!t.metricsTopicStrToLabel)throw Error("Must set metricsTopicStrToLabel with metrics");const i=Math.max(...Object.values(r.scoreParams.topics).map(o=>o.meshMessageDeliveriesWindow),1e3),s=function sH(n,e,t){return{protocolsEnabled:n.gauge({name:"gossipsub_protocol",help:"Status of enabled protocols",labelNames:["protocol"]}),topicSubscriptionStatus:n.gauge({name:"gossipsub_topic_subscription_status",help:"Status of our subscription to this topic",labelNames:["topicStr"]}),topicPeersCount:n.gauge({name:"gossipsub_topic_peer_count",help:"Number of peers subscribed to each topic",labelNames:["topicStr"]}),meshPeerCounts:n.gauge({name:"gossipsub_mesh_peer_count",help:"Number of peers in our mesh",labelNames:["topicStr"]}),meshPeerInclusionEvents:n.gauge({name:"gossipsub_mesh_peer_inclusion_events_total",help:"Number of times we include peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),meshPeerChurnEvents:n.gauge({name:"gossipsub_peer_churn_events_total",help:"Number of times we remove peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),peersPerProtocol:n.gauge({name:"gossipsub_peers_per_protocol_count",help:"Peers connected for each topic",labelNames:["protocol"]}),heartbeatDuration:n.histogram({name:"gossipsub_heartbeat_duration_seconds",help:"The time it takes to complete one iteration of the heartbeat",buckets:[.01,.1,1]}),heartbeatSkipped:n.gauge({name:"gossipsub_heartbeat_skipped",help:"Heartbeat run took longer than heartbeat interval so next is skipped"}),asyncValidationResult:n.gauge({name:"gossipsub_async_validation_result_total",help:"Message validation result for each topic",labelNames:["topic","acceptance"]}),asyncValidationMcacheHit:n.gauge({name:"gossipsub_async_validation_mcache_hit_total",help:"Async validation result reported by the user layer",labelNames:["hit"]}),rpcRecvBytes:n.gauge({name:"gossipsub_rpc_recv_bytes_total",help:"RPC recv"}),rpcRecvCount:n.gauge({name:"gossipsub_rpc_recv_count_total",help:"RPC recv"}),rpcRecvSubscription:n.gauge({name:"gossipsub_rpc_recv_subscription_total",help:"RPC recv"}),rpcRecvMessage:n.gauge({name:"gossipsub_rpc_recv_message_total",help:"RPC recv"}),rpcRecvControl:n.gauge({name:"gossipsub_rpc_recv_control_total",help:"RPC recv"}),rpcRecvIHave:n.gauge({name:"gossipsub_rpc_recv_ihave_total",help:"RPC recv"}),rpcRecvIWant:n.gauge({name:"gossipsub_rpc_recv_iwant_total",help:"RPC recv"}),rpcRecvGraft:n.gauge({name:"gossipsub_rpc_recv_graft_total",help:"RPC recv"}),rpcRecvPrune:n.gauge({name:"gossipsub_rpc_recv_prune_total",help:"RPC recv"}),rpcRecvNotAccepted:n.gauge({name:"gossipsub_rpc_rcv_not_accepted_total",help:"Total count of RPC dropped because acceptFrom() == false"}),rpcSentBytes:n.gauge({name:"gossipsub_rpc_sent_bytes_total",help:"RPC sent"}),rpcSentCount:n.gauge({name:"gossipsub_rpc_sent_count_total",help:"RPC sent"}),rpcSentSubscription:n.gauge({name:"gossipsub_rpc_sent_subscription_total",help:"RPC sent"}),rpcSentMessage:n.gauge({name:"gossipsub_rpc_sent_message_total",help:"RPC sent"}),rpcSentControl:n.gauge({name:"gossipsub_rpc_sent_control_total",help:"RPC sent"}),rpcSentIHave:n.gauge({name:"gossipsub_rpc_sent_ihave_total",help:"RPC sent"}),rpcSentIWant:n.gauge({name:"gossipsub_rpc_sent_iwant_total",help:"RPC sent"}),rpcSentGraft:n.gauge({name:"gossipsub_rpc_sent_graft_total",help:"RPC sent"}),rpcSentPrune:n.gauge({name:"gossipsub_rpc_sent_prune_total",help:"RPC sent"}),msgPublishCount:n.gauge({name:"gossipsub_msg_publish_count_total",help:"Total count of msg published by topic",labelNames:["topic"]}),msgPublishPeers:n.gauge({name:"gossipsub_msg_publish_peers_total",help:"Total count of peers that we publish a msg to",labelNames:["topic"]}),msgPublishPeersByGroup:n.gauge({name:"gossipsub_msg_publish_peers_by_group",help:"Total count of peers (by group) that we publish a msg to",labelNames:["topic","peerGroup"]}),msgPublishBytes:n.gauge({name:"gossipsub_msg_publish_bytes_total",help:"Total count of msg publish data.length bytes",labelNames:["topic"]}),msgForwardCount:n.gauge({name:"gossipsub_msg_forward_count_total",help:"Total count of msg forwarded by topic",labelNames:["topic"]}),msgForwardPeers:n.gauge({name:"gossipsub_msg_forward_peers_total",help:"Total count of peers that we forward a msg to",labelNames:["topic"]}),msgReceivedPreValidation:n.gauge({name:"gossipsub_msg_received_prevalidation_total",help:"Total count of recv msgs before any validation",labelNames:["topic"]}),msgReceivedStatus:n.gauge({name:"gossipsub_msg_received_status_total",help:"Tracks distribution of recv msgs by duplicate, invalid, valid",labelNames:["topic","status"]}),msgReceivedInvalid:n.gauge({name:"gossipsub_msg_received_invalid_total",help:"Tracks specific reason of invalid",labelNames:["topic","error"]}),duplicateMsgDeliveryDelay:n.histogram({name:"gossisub_duplicate_msg_delivery_delay_seconds",help:"Time since the 1st duplicated message validated",labelNames:["topic"],buckets:[.25*t.maxMeshMessageDeliveriesWindowSec,.5*t.maxMeshMessageDeliveriesWindowSec,1*t.maxMeshMessageDeliveriesWindowSec,2*t.maxMeshMessageDeliveriesWindowSec,4*t.maxMeshMessageDeliveriesWindowSec]}),duplicateMsgLateDelivery:n.gauge({name:"gossisub_duplicate_msg_late_delivery_total",help:"Total count of late duplicate message delivery by topic, which triggers P3 penalty",labelNames:["topic"]}),scoreFnCalls:n.gauge({name:"gossipsub_score_fn_calls_total",help:"Total times score() is called"}),scoreFnRuns:n.gauge({name:"gossipsub_score_fn_runs_total",help:"Total times score() call actually computed computeScore(), no cache"}),scoreCachedDelta:n.histogram({name:"gossipsub_score_cache_delta",help:"Delta of score between cached values that expired",buckets:[10,100,1e3]}),peersByScoreThreshold:n.gauge({name:"gossipsub_peers_by_score_threshold_count",help:"Current count of peers by score threshold",labelNames:["threshold"]}),score:n.avgMinMax({name:"gossipsub_score",help:"Avg min max of gossip scores",labelNames:["topic","p"]}),scoreWeights:n.avgMinMax({name:"gossipsub_score_weights",help:"Separate score weights",labelNames:["topic","p"]}),scorePerMesh:n.avgMinMax({name:"gossipsub_score_per_mesh",help:"Histogram of the scores for each mesh topic",labelNames:["topic"]}),scoringPenalties:n.gauge({name:"gossipsub_scoring_penalties_total",help:"A counter of the kind of penalties being applied to peers",labelNames:["penalty"]}),behaviourPenalty:n.histogram({name:"gossipsub_peer_stat_behaviour_penalty",help:"Current peer stat behaviour_penalty at each scrape",buckets:[.25*t.behaviourPenaltyThreshold,.5*t.behaviourPenaltyThreshold,1*t.behaviourPenaltyThreshold,2*t.behaviourPenaltyThreshold,4*t.behaviourPenaltyThreshold]}),ihaveRcvIgnored:n.gauge({name:"gossipsub_ihave_rcv_ignored_total",help:"Total received IHAVE messages that we ignore for some reason",labelNames:["reason"]}),ihaveRcvMsgids:n.gauge({name:"gossipsub_ihave_rcv_msgids_total",help:"Total received IHAVE messages by topic",labelNames:["topic"]}),ihaveRcvNotSeenMsgids:n.gauge({name:"gossipsub_ihave_rcv_not_seen_msgids_total",help:"Total messages per topic we do not have, not actual requests",labelNames:["topic"]}),iwantRcvMsgids:n.gauge({name:"gossipsub_iwant_rcv_msgids_total",help:"Total received IWANT messages by topic",labelNames:["topic"]}),iwantRcvDonthaveMsgids:n.gauge({name:"gossipsub_iwant_rcv_dont_have_msgids_total",help:"Total requested messageIDs that we do not have"}),iwantPromiseStarted:n.gauge({name:"gossipsub_iwant_promise_sent_total",help:"Total count of started IWANT promises"}),iwantPromiseResolved:n.gauge({name:"gossipsub_iwant_promise_resolved_total",help:"Total count of resolved IWANT promises"}),iwantPromiseResolvedFromDuplicate:n.gauge({name:"gossipsub_iwant_promise_resolved_from_duplicate_total",help:"Total count of resolved IWANT promises from duplicate messages"}),iwantPromiseResolvedPeers:n.gauge({name:"gossipsub_iwant_promise_resolved_peers",help:"Total count of peers we have asked IWANT promises that are resolved"}),iwantPromiseBroken:n.gauge({name:"gossipsub_iwant_promise_broken",help:"Total count of broken IWANT promises"}),iwantMessagePruned:n.gauge({name:"gossipsub_iwant_message_pruned",help:"Total count of pruned IWANT messages"}),iwantPromiseDeliveryTime:n.histogram({name:"gossipsub_iwant_promise_delivery_seconds",help:"Histogram of delivery time of resolved IWANT promises",buckets:[.5*t.gossipPromiseExpireSec,1*t.gossipPromiseExpireSec,2*t.gossipPromiseExpireSec,4*t.gossipPromiseExpireSec]}),cacheSize:n.gauge({name:"gossipsub_cache_size",help:"Unbounded cache sizes",labelNames:["cache"]}),mcacheSize:n.gauge({name:"gossipsub_mcache_size",help:"Current mcache msg count"}),mcacheNotValidatedCount:n.gauge({name:"gossipsub_mcache_not_validated_count",help:"Current mcache msg count not validated"}),fastMsgIdCacheCollision:n.gauge({name:"gossipsub_fastmsgid_cache_collision_total",help:"Total count of key collisions on fastmsgid cache put"}),topicStrToLabel:e,toTopic(r){return this.topicStrToLabel.get(r)??r},onJoin(r){this.topicSubscriptionStatus.set({topicStr:r},1),this.meshPeerCounts.set({topicStr:r},0)},onLeave(r){this.topicSubscriptionStatus.set({topicStr:r},0),this.meshPeerCounts.set({topicStr:r},0)},onAddToMesh(r,i,s){const o=this.toTopic(r);this.meshPeerInclusionEvents.inc({topic:o,reason:i},s)},onRemoveFromMesh(r,i,s){const o=this.toTopic(r);this.meshPeerChurnEvents.inc({topic:o,reason:i},s)},onReportValidationMcacheHit(r){this.asyncValidationMcacheHit.inc({hit:r?"hit":"miss"})},onReportValidation(r,i){const s=this.toTopic(r);this.asyncValidationResult.inc({topic:s,acceptance:i})},onScorePenalty(r){this.scoringPenalties.inc({penalty:r},1)},onIhaveRcv(r,i,s){const o=this.toTopic(r);this.ihaveRcvMsgids.inc({topic:o},i),this.ihaveRcvNotSeenMsgids.inc({topic:o},s)},onIwantRcv(r,i){for(const[s,o]of r){const a=this.toTopic(s);this.iwantRcvMsgids.inc({topic:a},o)}this.iwantRcvDonthaveMsgids.inc(i)},onForwardMsg(r,i){const s=this.toTopic(r);this.msgForwardCount.inc({topic:s},1),this.msgForwardPeers.inc({topic:s},i)},onPublishMsg(r,i,s,o){const a=this.toTopic(r);this.msgPublishCount.inc({topic:a},1),this.msgPublishBytes.inc({topic:a},s*o),this.msgPublishPeers.inc({topic:a},s),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"direct"},i.direct),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"floodsub"},i.floodsub),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"mesh"},i.mesh),this.msgPublishPeersByGroup.inc({topic:a,peerGroup:"fanout"},i.fanout)},onMsgRecvPreValidation(r){const i=this.toTopic(r);this.msgReceivedPreValidation.inc({topic:i},1)},onMsgRecvResult(r,i){const s=this.toTopic(r);this.msgReceivedStatus.inc({topic:s,status:i})},onMsgRecvInvalid(r,i){const s=this.toTopic(r);this.msgReceivedInvalid.inc({topic:s,error:i.reason===Yi.Error?i.error:i.reason},1)},onDuplicateMsgDelivery(r,i,s){if(this.duplicateMsgDeliveryDelay.observe(i/1e3),s){const o=this.toTopic(r);this.duplicateMsgLateDelivery.inc({topic:o},1)}},onRpcRecv(r,i){this.rpcRecvBytes.inc(i),this.rpcRecvCount.inc(1),r.subscriptions&&this.rpcRecvSubscription.inc(r.subscriptions.length),r.messages&&this.rpcRecvMessage.inc(r.messages.length),r.control&&(this.rpcRecvControl.inc(1),r.control.ihave&&this.rpcRecvIHave.inc(r.control.ihave.length),r.control.iwant&&this.rpcRecvIWant.inc(r.control.iwant.length),r.control.graft&&this.rpcRecvGraft.inc(r.control.graft.length),r.control.prune&&this.rpcRecvPrune.inc(r.control.prune.length))},onRpcSent(r,i){if(this.rpcSentBytes.inc(i),this.rpcSentCount.inc(1),r.subscriptions&&this.rpcSentSubscription.inc(r.subscriptions.length),r.messages&&this.rpcSentMessage.inc(r.messages.length),r.control){const s=r.control.ihave?.length??0,o=r.control.iwant?.length??0,a=r.control.graft?.length??0,u=r.control.prune?.length??0;s>0&&this.rpcSentIHave.inc(s),o>0&&this.rpcSentIWant.inc(o),a>0&&this.rpcSentGraft.inc(a),u>0&&this.rpcSentPrune.inc(u),(s>0||o>0||a>0||u>0)&&this.rpcSentControl.inc(1)}},registerScores(r,i){let s=0,o=0,a=0,u=0;for(const _ of r)_>=i.graylistThreshold&&s++,_>=i.publishThreshold&&o++,_>=i.gossipThreshold&&a++,_>=0&&u++;this.peersByScoreThreshold.set({threshold:Ra.graylist},s),this.peersByScoreThreshold.set({threshold:Ra.publish},o),this.peersByScoreThreshold.set({threshold:Ra.gossip},a),this.peersByScoreThreshold.set({threshold:Ra.mesh},u),this.score.set(r)},registerScoreWeights(r){for(const[i,s]of r.byTopic)this.scoreWeights.set({topic:i,p:"p1"},s.p1w),this.scoreWeights.set({topic:i,p:"p2"},s.p2w),this.scoreWeights.set({topic:i,p:"p3"},s.p3w),this.scoreWeights.set({topic:i,p:"p3b"},s.p3bw),this.scoreWeights.set({topic:i,p:"p4"},s.p4w);this.scoreWeights.set({p:"p5"},r.p5w),this.scoreWeights.set({p:"p6"},r.p6w),this.scoreWeights.set({p:"p7"},r.p7w)},registerScorePerMesh(r,i){const s=new Map;r.forEach((o,a)=>{const u=this.topicStrToLabel.get(a)??"unknown";let _=s.get(u);_||(_=new Set,s.set(u,_)),o.forEach(x=>_?.add(x))});for(const[o,a]of s){const u=[];a.forEach(_=>{u.push(i.get(_)??0)}),this.scorePerMesh.set({topic:o},u)}}}}(t.metricsRegister,t.metricsTopicStrToLabel,{gossipPromiseExpireSec:this.opts.gossipsubIWantFollowupMs/1e3,behaviourPenaltyThreshold:r.scoreParams.behaviourPenaltyThreshold,maxMeshMessageDeliveriesWindowSec:i/1e3});s.mcacheSize.addCollect(()=>this.onScrapeMetrics(s));for(const o of this.multicodecs)s.protocolsEnabled.set({protocol:o},1);this.metrics=s}else this.metrics=null;this.gossipTracer=new iH(this.opts.gossipsubIWantFollowupMs,this.msgIdToStrFn,this.metrics),this.score=new rH(this.opts.scoreParams,this.metrics,{scoreCacheValidityMs:r.heartbeatInterval}),this.maxInboundStreams=t.maxInboundStreams,this.maxOutboundStreams=t.maxOutboundStreams,this.allowedTopics=r.allowedTopics?new Set(r.allowedTopics):null}getPeers(){return[...this.peers.keys()].map(e=>xr(e))}isStarted(){return this.status.code===mi.started}start(){var e=this;return $(function*(){if(e.isStarted())return;e.log("starting"),e.publishConfig=yield function K7(n,e){return Kv.apply(this,arguments)}(e.globalSignaturePolicy,e.components.peerId),e.outboundInflightQueue=Ea({objectMode:!0}),zn(e.outboundInflightQueue,function(){var o=$(function*(a){var x,u=!1,_=!1;try{for(var B,P=ut(a);u=!(B=yield P.next()).done;u=!1){const{peerId:U,connection:W}=B.value;yield e.createOutboundStream(U,W)}}catch(U){_=!0,x=U}finally{try{u&&null!=P.return&&(yield P.return())}finally{if(_)throw x}}});return function(a){return o.apply(this,arguments)}}()).catch(o=>e.log.error("outbound inflight queue error",o)),yield Promise.all(e.opts.directPeers.map(function(){var o=$(function*(a){yield e.components.peerStore.addressBook.add(a.id,a.addrs)});return function(a){return o.apply(this,arguments)}}()));const t=e.components.registrar;yield Promise.all(e.multicodecs.map(o=>t.handle(o,e.onIncomingStream.bind(e),{maxInboundStreams:e.maxInboundStreams,maxOutboundStreams:e.maxOutboundStreams})));const r=function u7(n){return new c7(n)}({onConnect:e.onPeerConnected.bind(e),onDisconnect:e.onPeerDisconnected.bind(e)}),i=yield Promise.all(e.multicodecs.map(o=>t.register(o,r))),s=setTimeout(e.runHeartbeat,100);e.status={code:mi.started,registrarTopologyIds:i,heartbeatTimeout:s,hearbeatStartMs:Date.now()+100},e.score.start(),e.directPeerInitial=setTimeout(()=>{Promise.resolve().then($(function*(){yield Promise.all(Array.from(e.direct).map(function(){var o=$(function*(a){return yield e.connect(a)});return function(a){return o.apply(this,arguments)}}()))})).catch(o=>{e.log(o)})},1e3),e.log("started")})()}stop(){var e=this;return $(function*(){if(e.log("stopping"),e.status.code!==mi.started)return;const{registrarTopologyIds:t}=e.status;e.status={code:mi.stopped};const r=e.components.registrar;t.forEach(i=>r.unregister(i)),e.outboundInflightQueue.end();for(const i of e.streamsOutbound.values())i.close();e.streamsOutbound.clear();for(const i of e.streamsInbound.values())i.close();e.streamsInbound.clear(),e.peers.clear(),e.subscriptions.clear(),e.heartbeatTimer&&(e.heartbeatTimer.cancel(),e.heartbeatTimer=null),e.score.stop(),e.mesh.clear(),e.fanout.clear(),e.fanoutLastpub.clear(),e.gossip.clear(),e.control.clear(),e.peerhave.clear(),e.iasked.clear(),e.backoff.clear(),e.outbound.clear(),e.gossipTracer.clear(),e.seenCache.clear(),e.fastMsgIdCache&&e.fastMsgIdCache.clear(),e.directPeerInitial&&clearTimeout(e.directPeerInitial),e.log("stopped")})()}dumpPeerScoreStats(){return this.score.dumpPeerScoreStats()}onIncomingStream({stream:e,connection:t}){if(!this.isStarted())return;const r=t.remotePeer;this.addPeer(r,t.stat.direction,t.remoteAddr),this.createInboundStream(r,e),this.outboundInflightQueue.push({peerId:r,connection:t})}onPeerConnected(e,t){!this.isStarted()||(this.addPeer(e,t.stat.direction,t.remoteAddr),this.outboundInflightQueue.push({peerId:e,connection:t}))}onPeerDisconnected(e){this.log("connection ended %p",e),this.removePeer(e)}createOutboundStream(e,t){var r=this;return $(function*(){if(!r.isStarted())return;const i=e.toString();if(r.peers.has(i)&&!r.streamsOutbound.has(i))try{const s=new yH(yield t.newStream(r.multicodecs),a=>r.log.error("outbound pipe error",a),{maxBufferSize:r.opts.maxOutboundBufferSize});r.log("create outbound stream %p",e),r.streamsOutbound.set(i,s);const o=s.protocol;o===Z2&&r.floodsubPeers.add(i),r.metrics?.peersPerProtocol.inc({protocol:o},1),r.subscriptions.size>0&&(r.log("send subscriptions to",i),r.sendSubscriptions(i,Array.from(r.subscriptions),!0))}catch(s){r.log.error("createOutboundStream error",s)}})()}createInboundStream(e,t){var r=this;return $(function*(){if(!r.isStarted())return;const i=e.toString();if(!r.peers.has(i))return;const s=r.streamsInbound.get(i);void 0!==s&&(r.log("replacing existing inbound steam %s",i),s.close()),r.log("create inbound stream %s",i);const o=new mH(t,{maxDataLength:r.opts.maxInboundDataLength});r.streamsInbound.set(i,o),r.pipePeerReadStream(e,o.source).catch(a=>r.log(a))})()}addPeer(e,t,r){const i=e.toString();if(!this.peers.has(i)){this.log("new peer %p",e),this.peers.add(i),this.score.addPeer(i);const s=function AH(n){for(const e of n.tuples())switch(e[0]){case Gl.ip4:case Gl.ip6:return ev(e[0],e[1])}return null}(r);null!==s?this.score.addIP(i,s):this.log("Added peer has no IP in current address %s %s",i,r.toString()),this.outbound.has(i)||this.outbound.set(i,"outbound"===t)}}removePeer(e){const t=e.toString();if(!this.peers.has(t))return;this.log("delete peer %p",e),this.peers.delete(t);const r=this.streamsOutbound.get(t),i=this.streamsInbound.get(t);r&&this.metrics?.peersPerProtocol.inc({protocol:r.protocol},-1),r?.close(),i?.close(),this.streamsOutbound.delete(t),this.streamsInbound.delete(t);for(const s of this.topics.values())s.delete(t);for(const[s,o]of this.mesh)!0===o.delete(t)&&this.metrics?.onRemoveFromMesh(s,Aa.Dc,1);for(const s of this.fanout.values())s.delete(t);this.floodsubPeers.delete(t),this.gossip.delete(t),this.control.delete(t),this.outbound.delete(t),this.score.removePeer(t),this.acceptFromWhitelist.delete(t)}get started(){return this.status.code===mi.started}getMeshPeers(e){const t=this.mesh.get(e);return t?Array.from(t):[]}getSubscribers(e){const t=this.topics.get(e);return(t?Array.from(t):[]).map(r=>xr(r))}getTopics(){return Array.from(this.subscriptions)}pipePeerReadStream(e,t){var r=this;return $(function*(){try{yield zn(t,function(){var i=$(function*(s){var u,o=!1,a=!1;try{for(var x,_=ut(s);o=!(x=yield _.next()).done;o=!1){const P=x.value;try{const B=P.subarray(),U=_H(B,r.decodeRpcLimits);r.metrics?.onRpcRecv(U,B.length),r.opts.awaitRpcHandler?yield r.handleReceivedRpc(e,U):r.handleReceivedRpc(e,U).catch(W=>r.log(W))}catch(B){r.log(B)}}}catch(P){a=!0,u=P}finally{try{o&&null!=_.return&&(yield _.return())}finally{if(a)throw u}}});return function(s){return i.apply(this,arguments)}}())}catch(i){r.handlePeerReadStreamError(i,e)}})()}handlePeerReadStreamError(e,t){this.log.error(e),this.onPeerDisconnected(t)}handleReceivedRpc(e,t){var r=this;return $(function*(){if(!r.acceptFrom(e.toString()))return r.log("received message from unacceptable peer %p",e),void r.metrics?.rpcRecvNotAccepted.inc();if(r.log("rpc from %p",e),t.subscriptions&&t.subscriptions.length>0){const i=[];t.subscriptions.forEach(s=>{const o=s.topic,a=!0===s.subscribe;if(null!=o){if(r.allowedTopics&&!r.allowedTopics.has(o))return;r.handleReceivedSubscription(e,o,a),i.push({topic:o,subscribe:a})}}),r.dispatchEvent(new zt("subscription-change",{detail:{peerId:e,subscriptions:i}}))}if(t.messages)for(const i of t.messages){if(r.allowedTopics&&!r.allowedTopics.has(i.topic))continue;const s=r.handleReceivedMessage(e,i).catch(o=>r.log(o));r.opts.awaitRpcMessageHandler&&(yield s)}t.control&&(yield r.handleControlMessage(e.toString(),t.control))})()}handleReceivedSubscription(e,t,r){this.log("subscription update from %p topic %s",e,t);let i=this.topics.get(t);null==i&&(i=new Set,this.topics.set(t,i)),r?i.add(e.toString()):i.delete(e.toString())}handleReceivedMessage(e,t){var r=()=>super.dispatchEvent,i=this;return $(function*(){i.metrics?.onMsgRecvPreValidation(t.topic);const s=yield i.validateReceivedMessage(e,t);switch(i.metrics?.onMsgRecvResult(t.topic,s.code),s.code){case Zi.duplicate:return i.score.duplicateMessage(e.toString(),s.msgIdStr,t.topic),i.gossipTracer.deliverMessage(s.msgIdStr,!0),void i.mcache.observeDuplicate(s.msgIdStr,e.toString());case Zi.invalid:if(s.msgIdStr){const o=s.msgIdStr;i.score.rejectMessage(e.toString(),o,t.topic,s.reason),i.gossipTracer.rejectMessage(o,s.reason)}else i.score.rejectInvalidMessage(e.toString(),t.topic);return void i.metrics?.onMsgRecvInvalid(t.topic,s);case Zi.valid:i.score.validateMessage(s.messageId.msgIdStr),i.gossipTracer.deliverMessage(s.messageId.msgIdStr),i.mcache.put(s.messageId,t,!i.opts.asyncValidation),i.subscriptions.has(t.topic)&&(!i.components.peerId.equals(e)||i.opts.emitSelf)&&(r().call(i,new zt("gossipsub:message",{detail:{propagationSource:e,msgId:s.messageId.msgIdStr,msg:s.msg}})),r().call(i,new zt("message",{detail:s.msg}))),i.opts.asyncValidation||i.forwardMessage(s.messageId.msgIdStr,t,e.toString())}})()}validateReceivedMessage(e,t){var r=this;return $(function*(){const i=r.fastMsgIdFn?.(t),s=void 0!==i?r.fastMsgIdCache?.get(i):void 0;if(s)return{code:Zi.duplicate,msgIdStr:s};const o=yield function cH(n,e){return qv.apply(this,arguments)}(r.globalSignaturePolicy,t);if(!o.valid)return{code:Zi.invalid,reason:Yi.Error,error:o.error};const a=o.message;try{r.dataTransform&&(a.data=r.dataTransform.inboundTransform(t.topic,a.data))}catch(B){return r.log("Invalid message, transform failed",B),{code:Zi.invalid,reason:Yi.Error,error:si.TransformFailed}}const u=yield r.msgIdFn(a),_=r.msgIdToStrFn(u),x={msgId:u,msgIdStr:_};if(void 0!==i&&r.fastMsgIdCache&&r.fastMsgIdCache.put(i,_)&&r.metrics?.fastMsgIdCacheCollision.inc(),r.seenCache.has(_))return{code:Zi.duplicate,msgIdStr:_};r.seenCache.put(_);const P=r.topicValidators.get(t.topic);if(null!=P){let B;try{B=yield P(e,a)}catch(U){const W=U.code;"ERR_TOPIC_VALIDATOR_IGNORE"===W&&(B=Us.Ignore),B="ERR_TOPIC_VALIDATOR_REJECT"===W?Us.Reject:Us.Ignore}if(B!==Us.Accept)return{code:Zi.invalid,reason:ex(B),msgIdStr:_}}return{code:Zi.valid,messageId:x,msg:a}})()}getScore(e){return this.score.score(e)}sendSubscriptions(e,t,r){this.sendRpc(e,{subscriptions:t.map(i=>({topic:i,subscribe:r}))})}handleControlMessage(e,t){var r=this;return $(function*(){if(void 0===t)return;const i=t.ihave?r.handleIHave(e,t.ihave):[],s=t.iwant?r.handleIWant(e,t.iwant):[],o=t.graft?yield r.handleGraft(e,t.graft):[];t.prune&&(yield r.handlePrune(e,t.prune)),(i.length||s.length||o.length)&&r.sendRpc(e,{messages:s,control:{iwant:i,prune:o}})})()}acceptFrom(e){if(this.direct.has(e))return!0;const t=Date.now(),r=this.acceptFromWhitelist.get(e);if(r&&r.messagesAccepted<128&&r.acceptUntil>=t)return r.messagesAccepted+=1,!0;const i=this.score.score(e);return i>=0?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+1e3}):this.acceptFromWhitelist.delete(e),i>=this.opts.scoreThresholds.graylistThreshold}handleIHave(e,t){if(!t.length)return[];const r=this.score.score(e);if(r<this.opts.scoreThresholds.gossipThreshold)return this.log("IHAVE: ignoring peer %s with score below threshold [ score = %d ]",e,r),this.metrics?.ihaveRcvIgnored.inc({reason:gu.LowScore}),[];const i=(this.peerhave.get(e)??0)+1;if(this.peerhave.set(e,i),i>10)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,i),this.metrics?.ihaveRcvIgnored.inc({reason:gu.MaxIhave}),[];const s=this.iasked.get(e)??0;if(s>=du)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,s),this.metrics?.ihaveRcvIgnored.inc({reason:gu.MaxIasked}),[];const o=new Map;if(t.forEach(({topicID:_,messageIDs:x})=>{if(!_||!x||!this.mesh.has(_))return;let P=0;x.forEach(B=>{const U=this.msgIdToStrFn(B);this.seenCache.has(U)||(o.set(U,B),P++)}),this.metrics?.onIhaveRcv(_,x.length,P)}),!o.size)return[];let a=o.size;a+s>du&&(a=du-s),this.log("IHAVE: Asking for %d out of %d messages from %s",a,o.size,e);let u=Array.from(o.values());return fo(u),u=u.slice(0,a),this.iasked.set(e,s+a),this.gossipTracer.addPromise(e,u),[{messageIDs:u}]}handleIWant(e,t){if(!t.length)return[];const r=this.score.score(e);if(r<this.opts.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,r),[];const i=new Map,s=new Map;let o=0;return t.forEach(({messageIDs:a})=>{a&&a.forEach(u=>{const _=this.msgIdToStrFn(u),x=this.mcache.getWithIWantCount(_,e);null!=x?(s.set(x.msg.topic,1+(s.get(x.msg.topic)??0)),x.count>3?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,u):i.set(_,x.msg)):o++})}),this.metrics?.onIwantRcv(s,o),i.size?(this.log("IWANT: Sending %d messages to %s",i.size,e),Array.from(i.values())):(this.log("IWANT: Could not provide any wanted messages to %s",e),[])}handleGraft(e,t){var r=this;return $(function*(){const i=[],s=r.score.score(e),o=Date.now();let a=r.opts.doPX;return t.forEach(({topicID:u})=>{if(!u)return;const _=r.mesh.get(u);if(!_)return void(a=!1);if(_.has(e))return;if(r.direct.has(e))return r.log("GRAFT: ignoring request from direct peer %s",e),i.push(u),void(a=!1);const x=r.backoff.get(u)?.get(e);return"number"==typeof x&&o<x?(r.log("GRAFT: ignoring backed off peer %s",e),r.score.addPenalty(e,1,pu.GraftBackoff),a=!1,o<x+r.opts.graftFloodThreshold-r.opts.pruneBackoff&&r.score.addPenalty(e,1,pu.GraftBackoff),r.addBackoff(e,u),void i.push(u)):s<0?(r.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,s,u),i.push(u),a=!1,void r.addBackoff(e,u)):_.size>=r.opts.Dhi&&!r.outbound.get(e)?(i.push(u),void r.addBackoff(e,u)):(r.log("GRAFT: Add mesh link from %s in %s",e,u),r.score.graft(e,u),_.add(e),void r.metrics?.onAddToMesh(u,ho.Subscribed,1))}),i.length?yield Promise.all(i.map(u=>r.makePrune(e,u,a))):[]})()}handlePrune(e,t){var r=this;return $(function*(){const i=r.score.score(e);for(const{topicID:s,backoff:o,peers:a}of t){if(null==s)continue;const u=r.mesh.get(s);if(!u)return;if(r.log("PRUNE: Remove mesh link to %s in %s",e,s),r.score.prune(e,s),u.has(e)&&(u.delete(e),r.metrics?.onRemoveFromMesh(s,Aa.Unsub,1)),"number"==typeof o&&o>0?r.doAddBackoff(e,s,1e3*o):r.addBackoff(e,s),a&&a.length){if(i<r.opts.scoreThresholds.acceptPXThreshold){r.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,i,s);continue}yield r.pxConnect(a)}}})()}addBackoff(e,t){this.doAddBackoff(e,t,this.opts.pruneBackoff)}doAddBackoff(e,t,r){let i=this.backoff.get(t);i||(i=new Map,this.backoff.set(t,i));const s=Date.now()+r;(i.get(e)??0)<s&&i.set(e,s)}applyIwantPenalties(){this.gossipTracer.getBrokenPromises().forEach((e,t)=>{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",t,e),this.score.addPenalty(t,e,pu.BrokenPromise)})}clearBackoff(){if(this.heartbeatTicks%15!=0)return;const e=Date.now();this.backoff.forEach((t,r)=>{t.forEach((i,s)=>{i<e&&t.delete(s)}),0===t.size&&this.backoff.delete(r)})}directConnect(){var e=this;return $(function*(){const t=[];e.direct.forEach(r=>{e.streamsOutbound.has(r)||t.push(r)}),yield Promise.all(t.map(function(){var r=$(function*(i){return yield e.connect(i)});return function(i){return r.apply(this,arguments)}}()))})()}pxConnect(e){var t=this;return $(function*(){e.length>t.opts.prunePeers&&(fo(e),e=e.slice(0,t.opts.prunePeers));const r=[];yield Promise.all(e.map(function(){var i=$(function*(s){if(!s.peerID)return;const o=tu(s.peerID).toString();if(!t.peers.has(o)){if(!s.signedPeerRecord)return void r.push(o);try{const a=yield yi.openAndCertify(s.signedPeerRecord,"libp2p-peer-record"),u=a.peerId;if(!a.peerId.equals(o))return void t.log("bogus peer record obtained through px: peer ID %p doesn't match expected peer %p",u,o);if(!(yield t.components.peerStore.addressBook.consumePeerRecord(a)))return void t.log("bogus peer record obtained through px: could not add peer record to address book");r.push(o)}catch{t.log("bogus peer record obtained through px: invalid signature or not a peer record")}}});return function(s){return i.apply(this,arguments)}}())),r.length&&(yield Promise.all(r.map(function(){var i=$(function*(s){return yield t.connect(s)});return function(s){return i.apply(this,arguments)}}())))})()}connect(e){var t=this;return $(function*(){t.log("Initiating connection with %s",e);const r=xr(e),i=yield t.components.connectionManager.openConnection(r);for(const s of t.multicodecs)for(const o of t.components.registrar.getTopologies(s))o.onConnect(r,i)})()}subscribe(e){if(this.status.code!==mi.started)throw new Error("Pubsub has not started");if(!this.subscriptions.has(e)){this.subscriptions.add(e);for(const t of this.peers.keys())this.sendSubscriptions(t,[e],!0)}this.join(e)}unsubscribe(e){if(this.status.code!==mi.started)throw new Error("Pubsub is not started");const t=this.subscriptions.delete(e);if(this.log("unsubscribe from %s - am subscribed %s",e,t),t)for(const r of this.peers.keys())this.sendSubscriptions(r,[e],!1);this.leave(e)}join(e){if(this.status.code!==mi.started)throw new Error("Gossipsub has not started");if(this.mesh.has(e))return;this.log("JOIN %s",e),this.metrics?.onJoin(e);const t=new Set,r=this.fanout.get(e);if(r&&(this.fanout.delete(e),this.fanoutLastpub.delete(e),r.forEach(i=>{!this.direct.has(i)&&this.score.score(i)>=0&&t.add(i)}),this.metrics?.onAddToMesh(e,ho.Fanout,t.size)),t.size<this.opts.D){const i=t.size;this.getRandomGossipPeers(e,this.opts.D,o=>!t.has(o)&&!this.direct.has(o)&&this.score.score(o)>=0).forEach(o=>{t.add(o)}),this.metrics?.onAddToMesh(e,ho.Random,t.size-i)}this.mesh.set(e,t),t.forEach(i=>{this.log("JOIN: Add mesh link to %s in %s",i,e),this.sendGraft(i,e)})}leave(e){var t=this;if(this.status.code!==mi.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e),this.metrics?.onLeave(e);const r=this.mesh.get(e);r&&(Promise.all(Array.from(r).map(function(){var i=$(function*(s){return t.log("LEAVE: Remove mesh link to %s in %s",s,e),yield t.sendPrune(s,e)});return function(s){return i.apply(this,arguments)}}())).catch(i=>{this.log("Error sending prunes to mesh peers",i)}),this.mesh.delete(e))}selectPeersToForward(e,t,r){const i=new Set,s=this.topics.get(e);s&&(this.direct.forEach(a=>{s.has(a)&&t!==a&&!r?.has(a)&&i.add(a)}),this.floodsubPeers.forEach(a=>{s.has(a)&&t!==a&&!r?.has(a)&&this.score.score(a)>=this.opts.scoreThresholds.publishThreshold&&i.add(a)}));const o=this.mesh.get(e);return o&&o.size>0&&o.forEach(a=>{t!==a&&!r?.has(a)&&i.add(a)}),i}selectPeersToPublish(e){const t=new Set,r={direct:0,floodsub:0,mesh:0,fanout:0},i=this.topics.get(e);if(i)if(this.opts.floodPublish)i.forEach(s=>{this.direct.has(s)?(t.add(s),r.direct++):this.score.score(s)>=this.opts.scoreThresholds.publishThreshold&&(t.add(s),r.floodsub++)});else{this.direct.forEach(o=>{i.has(o)&&(t.add(o),r.direct++)}),this.floodsubPeers.forEach(o=>{i.has(o)&&this.score.score(o)>=this.opts.scoreThresholds.publishThreshold&&(t.add(o),r.floodsub++)});const s=this.mesh.get(e);if(s&&s.size>0)s.forEach(o=>{t.add(o),r.mesh++});else{const o=this.fanout.get(e);if(o&&o.size>0)o.forEach(a=>{t.add(a),r.fanout++});else{const a=this.getRandomGossipPeers(e,this.opts.D,u=>this.score.score(u)>=this.opts.scoreThresholds.publishThreshold);a.size>0&&(this.fanout.set(e,a),a.forEach(u=>{t.add(u),r.fanout++}))}this.fanoutLastpub.set(e,Date.now())}}return{tosend:t,tosendCount:r}}forwardMessage(e,t,r,i){r&&this.score.deliverMessage(r,e,t.topic);const s=this.selectPeersToForward(t.topic,r,i);s.forEach(o=>{this.sendRpc(o,{messages:[t]})}),this.metrics?.onForwardMsg(t.topic,s.size)}publish(e,t){var r=()=>super.dispatchEvent,i=this;return $(function*(){const s=i.dataTransform?i.dataTransform.outboundTransform(e,t):t;if(null==i.publishConfig)throw Error("PublishError.Uninitialized");const{raw:o,msg:a}=yield function aH(n,e,t,r){return Wv.apply(this,arguments)}(i.publishConfig,e,t,s),u=yield i.msgIdFn(a),_=i.msgIdToStrFn(u);if(i.seenCache.has(_))throw Error("PublishError.Duplicate");const{tosend:x,tosendCount:P}=i.selectPeersToPublish(e),B=!0===i.opts.emitSelf&&i.subscriptions.has(e);if(0===x.size&&!i.opts.allowPublishToZeroPeers&&!B)throw Error("PublishError.InsufficientPeers");i.seenCache.put(_),i.mcache.put({msgId:u,msgIdStr:_},o,!0),i.publishedMessageIds.put(_);for(const U of x)i.sendRpc(U,{messages:[o]})||x.delete(U);return i.metrics?.onPublishMsg(e,P,x.size,null!=o.data?o.data.length:0),B&&(x.add(i.components.peerId.toString()),r().call(i,new zt("gossipsub:message",{detail:{propagationSource:i.components.peerId,msgId:_,msg:a}})),r().call(i,new zt("message",{detail:a}))),{recipients:Array.from(x.values()).map(U=>xr(U))}})()}reportMessageValidationResult(e,t,r){if(r===Us.Accept){const i=this.mcache.validate(e);if(this.metrics?.onReportValidationMcacheHit(null!==i),null!=i){const{message:s,originatingPeers:o}=i;this.score.deliverMessage(t.toString(),e,s.topic),this.forwardMessage(e,i.message,t.toString(),o),this.metrics?.onReportValidation(s.topic,r)}}else{const i=this.mcache.remove(e);if(this.metrics?.onReportValidationMcacheHit(null!==i),i){const s=ex(r),{message:o,originatingPeers:a}=i;this.score.rejectMessage(t.toString(),e,o.topic,s);for(const u of a)this.score.rejectMessage(u,e,o.topic,s);this.metrics?.onReportValidation(o.topic,r)}}}sendGraft(e,t){this.sendRpc(e,{control:{graft:[{topicID:t}]}})}sendPrune(e,t){var r=this;return $(function*(){const i=[yield r.makePrune(e,t,r.opts.doPX)];r.sendRpc(e,{control:{prune:i}})})()}sendRpc(e,t){const r=this.streamsOutbound.get(e);if(!r)return this.log(`Cannot send RPC to ${e} as there is no open stream to it available`),!1;const i=this.control.get(e);i&&(this.piggybackControl(e,t,i),this.control.delete(e));const s=this.gossip.get(e);s&&(this.piggybackGossip(e,t,s),this.gossip.delete(e));const o=Uv.encode(t).finish();try{r.push(o)}catch(a){return this.log.error(`Cannot send rpc to ${e}`,a),i&&this.control.set(e,i),s&&this.gossip.set(e,s),!1}return this.metrics?.onRpcSent(t,o.length),!0}piggybackControl(e,t,r){if(r.graft){t.control||(t.control={}),t.control.graft||(t.control.graft=[]);for(const i of r.graft)i.topicID&&this.mesh.get(i.topicID)?.has(e)&&t.control.graft.push(i)}if(r.prune){t.control||(t.control={}),t.control.prune||(t.control.prune=[]);for(const i of r.prune)i.topicID&&!this.mesh.get(i.topicID)?.has(e)&&t.control.prune.push(i)}}piggybackGossip(e,t,r){t.control||(t.control={}),t.control.ihave=r}sendGraftPrune(e,t,r){var i=this;return $(function*(){const s=i.opts.doPX;for(const[o,a]of e){const u=a.map(P=>({topicID:P}));let _=[];const x=t.get(o);x&&(_=yield Promise.all(x.map(function(){var P=$(function*(B){return yield i.makePrune(o,B,s&&!r.get(o))});return function(B){return P.apply(this,arguments)}}())),t.delete(o)),i.sendRpc(o,{control:{graft:u,prune:_}})}for(const[o,a]of t){const u=yield Promise.all(a.map(function(){var _=$(function*(x){return yield i.makePrune(o,x,s&&!r.get(o))});return function(x){return _.apply(this,arguments)}}()));i.sendRpc(o,{control:{prune:u}})}})()}emitGossip(e){const t=this.mcache.getGossipIDs(new Set(e.keys()));for(const[r,i]of e)this.doEmitGossip(r,i,t.get(r)??[])}doEmitGossip(e,t,r){if(!r.length||(fo(r),r.length>du&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length),!t.size))return;let i=this.opts.Dlazy;const s=.25*t.size;let o=t;s>i&&(i=s),i>o.size?i=o.size:o=fo(Array.from(o)).slice(0,i),o.forEach(a=>{let u=r;r.length>du&&(u=fo(u.slice()).slice(0,du)),this.pushGossip(a,{topicID:e,messageIDs:u})})}flush(){for(const[e,t]of this.gossip.entries())this.gossip.delete(e),this.sendRpc(e,{control:{ihave:t}});for(const[e,t]of this.control.entries())this.control.delete(e),this.sendRpc(e,{control:{graft:t.graft,prune:t.prune}})}pushGossip(e,t){this.log("Add gossip to %s",e);const r=this.gossip.get(e)||[];this.gossip.set(e,r.concat(t))}makePrune(e,t,r){var i=this;return $(function*(){if(i.score.prune(e,t),i.streamsOutbound.get(e).protocol===X2)return{topicID:t,peers:[]};const s=i.opts.pruneBackoff/1e3;if(!r)return{topicID:t,peers:[],backoff:s};const o=i.getRandomGossipPeers(t,i.opts.prunePeers,u=>u!==e&&i.score.score(u)>=0),a=yield Promise.all(Array.from(o).map(function(){var u=$(function*(_){const x=xr(_);return{peerID:x.toBytes(),signedPeerRecord:yield i.components.peerStore.addressBook.getRawEnvelope(x)}});return function(_){return u.apply(this,arguments)}}()));return{topicID:t,peers:a,backoff:s}})()}heartbeat(){var e=this;return $(function*(){const{D:t,Dlo:r,Dhi:i,Dscore:s,Dout:o,fanoutTTL:a}=e.opts;e.heartbeatTicks++;const u=new Map,_=X=>{let re=u.get(X);return void 0===re&&(re=e.score.score(X),u.set(X,re)),re},x=new Map,P=new Map,B=new Map;e.clearBackoff(),e.peerhave.clear(),e.metrics?.cacheSize.set({cache:"iasked"},e.iasked.size),e.iasked.clear(),e.applyIwantPenalties(),e.heartbeatTicks%e.opts.directConnectTicks==0&&(yield e.directConnect()),e.fastMsgIdCache?.prune(),e.seenCache.prune(),e.gossipTracer.prune(),e.publishedMessageIds.prune();const U=new Map;e.mesh.forEach((X,re)=>{const fe=e.topics.get(re),Ie=new Set,ae=new Set;if(U.set(re,ae),fe){const xe=fo(Array.from(fe)),ht=e.backoff.get(re);for(const lt of xe){const nn=e.streamsOutbound.get(lt);if(nn&&e.multicodecs.includes(nn.protocol)&&!X.has(lt)&&!e.direct.has(lt)){const An=_(lt);(!ht||!ht.has(lt))&&An>=0&&Ie.add(lt),An>=e.opts.scoreThresholds.gossipThreshold&&ae.add(lt)}}}const Ce=(xe,ht)=>{e.log("HEARTBEAT: Remove mesh link to %s in %s",xe,re),e.addBackoff(xe,re),X.delete(xe),_(xe)>=e.opts.scoreThresholds.gossipThreshold&&ae.add(xe),e.metrics?.onRemoveFromMesh(re,ht,1);const lt=P.get(xe);lt?lt.push(re):P.set(xe,[re])},Ue=(xe,ht)=>{e.log("HEARTBEAT: Add mesh link to %s in %s",xe,re),e.score.graft(xe,re),X.add(xe),ae.delete(xe),e.metrics?.onAddToMesh(re,ht,1);const lt=x.get(xe);lt?lt.push(re):x.set(xe,[re])};if(X.forEach(xe=>{const ht=_(xe);ht<0&&(e.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",xe,ht,re),Ce(xe,Aa.BadScore),B.set(xe,!0))}),X.size<r&&function tH(n,e){return Gv(n,e,()=>!0)}(Ie,t-X.size).forEach(lt=>{Ue(lt,ho.NotEnough)}),X.size>i){let xe=Array.from(X);xe.sort((lt,nn)=>_(nn)-_(lt)),xe=xe.slice(0,s).concat(fo(xe.slice(s)));let ht=0;if(xe.slice(0,t).forEach(lt=>{e.outbound.get(lt)&&ht++}),ht<o){const lt=An=>{const ir=xe[An];for(let vi=An;vi>0;vi--)xe[vi]=xe[vi-1];xe[0]=ir};if(ht>0){let An=ht;for(let ir=1;ir<t&&An>0;ir++)e.outbound.get(xe[ir])&&(lt(ir),An--)}let nn=t-ht;for(let An=t;An<xe.length&&nn>0;An++)e.outbound.get(xe[An])&&(lt(An),nn--)}xe.slice(t).forEach(lt=>{Ce(lt,Aa.Excess)})}if(X.size>=r){let xe=0;X.forEach(ht=>{e.outbound.get(ht)&&xe++}),xe<o&&Gv(Ie,o-xe,nn=>!0===e.outbound.get(nn)).forEach(nn=>{Ue(nn,ho.Outbound)})}if(e.heartbeatTicks%e.opts.opportunisticGraftTicks==0&&X.size>1){const xe=Array.from(X).sort((nn,An)=>_(nn)-_(An)),ht=Math.floor(X.size/2),lt=_(xe[ht]);if(lt<e.opts.scoreThresholds.opportunisticGraftThreshold){const An=Gv(Ie,e.opts.opportunisticGraftPeers,ir=>_(ir)>lt);for(const ir of An)e.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",ir,re),Ue(ir,ho.Opportunistic)}}});const W=Date.now();e.fanoutLastpub.forEach((X,re)=>{X+a<W&&(e.fanout.delete(re),e.fanoutLastpub.delete(re))}),e.fanout.forEach((X,re)=>{const fe=e.topics.get(re);X.forEach(Ue=>{(!fe.has(Ue)||_(Ue)<e.opts.scoreThresholds.publishThreshold)&&X.delete(Ue)});const Ie=e.topics.get(re),ae=[],Ce=new Set;if(U.set(re,Ce),Ie){const Ue=fo(Array.from(Ie));for(const xe of Ue){const ht=e.streamsOutbound.get(xe);if(ht&&e.multicodecs.includes(ht.protocol)&&!X.has(xe)&&!e.direct.has(xe)){const lt=_(xe);lt>=e.opts.scoreThresholds.publishThreshold&&ae.push(xe),lt>=e.opts.scoreThresholds.gossipThreshold&&Ce.add(xe)}}}X.size<t&&ae.slice(0,t-X.size).forEach(xe=>{X.add(xe),Ce?.delete(xe)})}),e.emitGossip(U),yield e.sendGraftPrune(x,P,B),e.flush(),e.mcache.shift(),e.dispatchEvent(new zt("gossipsub:heartbeat"))})()}getRandomGossipPeers(e,t,r=(()=>!0)){const i=this.topics.get(e);if(!i)return new Set;let s=[];return i.forEach(o=>{const a=this.streamsOutbound.get(o);!a||this.multicodecs.includes(a.protocol)&&r(o)&&s.push(o)}),s=fo(s),t>0&&s.length>t&&(s=s.slice(0,t)),new Set(s)}onScrapeMetrics(e){e.mcacheSize.set(this.mcache.size),e.mcacheNotValidatedCount.set(this.mcache.notValidatedCount),e.cacheSize.set({cache:"direct"},this.direct.size),e.cacheSize.set({cache:"seenCache"},this.seenCache.size),e.cacheSize.set({cache:"fastMsgIdCache"},this.fastMsgIdCache?.size??0),e.cacheSize.set({cache:"publishedMessageIds"},this.publishedMessageIds.size),e.cacheSize.set({cache:"mcache"},this.mcache.size),e.cacheSize.set({cache:"score"},this.score.size),e.cacheSize.set({cache:"gossipTracer.promises"},this.gossipTracer.size),e.cacheSize.set({cache:"gossipTracer.requests"},this.gossipTracer.requestMsByMsgSize),e.cacheSize.set({cache:"topics"},this.topics.size),e.cacheSize.set({cache:"subscriptions"},this.subscriptions.size),e.cacheSize.set({cache:"mesh"},this.mesh.size),e.cacheSize.set({cache:"fanout"},this.fanout.size),e.cacheSize.set({cache:"peers"},this.peers.size),e.cacheSize.set({cache:"streamsOutbound"},this.streamsOutbound.size),e.cacheSize.set({cache:"streamsInbound"},this.streamsInbound.size),e.cacheSize.set({cache:"acceptFromWhitelist"},this.acceptFromWhitelist.size),e.cacheSize.set({cache:"gossip"},this.gossip.size),e.cacheSize.set({cache:"control"},this.control.size),e.cacheSize.set({cache:"peerhave"},this.peerhave.size),e.cacheSize.set({cache:"outbound"},this.outbound.size);let t=0;for(const o of this.backoff.values())t+=o.size;e.cacheSize.set({cache:"backoff"},t);for(const[o,a]of this.topics)e.topicPeersCount.set({topicStr:o},a.size);for(const[o,a]of this.mesh)e.meshPeerCounts.set({topicStr:o},a.size);const r=[],i=new Map;e.behaviourPenalty.reset();for(const o of this.peers.keys()){const a=this.score.score(o);r.push(a),i.set(o,a),e.behaviourPenalty.observe(this.score.peerStats.get(o)?.behaviourPenalty??0)}e.registerScores(r,this.opts.scoreThresholds),e.registerScorePerMesh(this.mesh,i);const s=function gH(n,e,t,r,i){const s={byTopic:new Map,p5w:[],p6w:[],p7w:[],score:[]};for(const o of n){const a=e.get(o);if(a){const u=pH(o,a,t,r,i);for(const[_,x]of u.byTopic){let P=s.byTopic.get(_);P||(P={p1w:[],p2w:[],p3w:[],p3bw:[],p4w:[]},s.byTopic.set(_,P)),P.p1w.push(x.p1w),P.p2w.push(x.p2w),P.p3w.push(x.p3w),P.p3bw.push(x.p3bw),P.p4w.push(x.p4w)}s.p5w.push(u.p5w),s.p6w.push(u.p6w),s.p7w.push(u.p7w),s.score.push(u.score)}else s.p5w.push(0),s.p6w.push(0),s.p7w.push(0),s.score.push(0)}return s}(this.peers.keys(),this.score.peerStats,this.score.params,this.score.peerIPs,e.topicStrToLabel);e.registerScoreWeights(s)}}Yv.multicodec=Hv;const NH=mr("waku:message:topic-only");class MH{constructor(e){this.proto=e}get contentTopic(){return this.proto.contentTopic??""}}class OH{constructor(){this.contentTopic=""}fromWireToProtoObj(e){const t=Ov.decode(e);return NH("Message decoded",t),Promise.resolve({contentTopic:t.contentTopic,payload:void 0,rateLimitProof:void 0,timestamp:void 0,version:void 0,ephemeral:void 0})}fromProtoObj(e){return $(function*(){return new MH(e)})()}}const jl=mr("waku:relay");class Zv extends Yv{constructor(e,t){super(e,t=Object.assign(t??{},{globalSignaturePolicy:tp.StrictNoSign,fallbackToFloodsub:!1})),this.multicodecs=Da,this.observers=new Map,this.pubSubTopic=t?.pubSubTopic??"/waku/2/default-waku/proto",this.defaultDecoder=new OH}start(){var e=()=>super.start,t=this;return $(function*(){yield e().call(t),t.subscribe(t.pubSubTopic)})()}send(e,t){var r=this;return $(function*(){const i=yield e.toWire(t);return i?r.publish(r.pubSubTopic,i):(jl("Failed to encode message, aborting publish"),{recipients:[]})})()}addObserver(e,t){const r={decoder:e,callback:t};return function PH(n,e,t){let r=n.get(e);typeof r>"u"&&(n.set(e,new Set),r=n.get(e)),r.add(t)}(this.observers,e.contentTopic,r),()=>{const i=this.observers.get(e.contentTopic);i&&i.delete(r)}}subscribe(e){var t=this;this.addEventListener("gossipsub:message",function(){var r=$(function*(i){if(i.detail.msg.topic!==e)return;jl(`Message received on ${e}`);const s=yield t.defaultDecoder.fromWireToProtoObj(i.detail.msg.data);if(!s||!s.contentTopic)return void jl("Message does not have a content topic, skipping");const o=t.observers.get(s.contentTopic);!o||(yield Promise.all(Array.from(o).map(function(){var a=$(function*({decoder:u,callback:_}){const x=yield u.fromWireToProtoObj(i.detail.msg.data);if(!x)return void jl("Internal error: message previously decoded failed on 2nd pass.");const P=yield u.fromProtoObj(x);P?_(P):jl("Failed to decode messages on",s.contentTopic)});return function(u){return a.apply(this,arguments)}}())))});return function(i){return r.apply(this,arguments)}}()),super.subscribe(e)}getMeshPeers(e){return super.getMeshPeers(e??this.pubSubTopic)}}function kH(n={}){return e=>new Zv(e,n)}Zv.multicodec=Da[0],Zv.multicodec=Da[Da.length-1];var yu=(()=>(function(n){n.Prod="prod",n.Test="test"}(yu||(yu={})),yu))();function UH(n=yu.Prod,e=1){if(e<=0)return[];let t;switch(n){case yu.Prod:t=Xv.fleets["wakuv2.prod"]["waku-websocket"];break;case yu.Test:t=Xv.fleets["wakuv2.test"]["waku-websocket"];break;default:t=Xv.fleets["wakuv2.prod"]["waku-websocket"]}return t=Object.values(t),function LH(n,e){return n.length<=e||n.length<=1?n:function BH(n){if(n.length<=1)return n;for(let t=0;t<n.length;t++){const r=Math.floor(Math.random()*Math.floor(n.length)),i=n[t];n[t]=n[r],n[r]=i}return n}(n).slice(0,e)}(t,e)}const Xv={fleets:{"wakuv2.prod":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.prod":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD","node-01.do-ams3.wakuv2.prod":"/dns4/node-01.do-ams3.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmL5okWopX7NqZWBUKVqW8iUxCEmd5GMHLVPwCgzYzQv3e","node-01.gc-us-central1-a.wakuv2.prod":"/dns4/node-01.gc-us-central1-a.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmVkKntsECaYfefR1V2yCR79CegLATuTPE6B9TxgxBiiiA"}},"wakuv2.test":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.test":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAkvWiyFsgRhuJEb9JfjYxEkoHLgnUQmr1N5mKWnYjxYRVm","node-01.do-ams3.wakuv2.test":"/dns4/node-01.do-ams3.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ","node-01.gc-us-central1-a.wakuv2.test":"/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS"}}}};function po(n){return null!=n&&"function"==typeof n.start&&"function"==typeof n.stop}function tE(){return tE=$(function*(n){const e=[];var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield s.next()).done;t=!1)e.push(o.value)}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield s.return())}finally{if(r)throw i}}return e}),tE.apply(this,arguments)}const sx=(n,e)=>Vt(function*(){const t=yield qe(function VH(n){return tE.apply(this,arguments)}(n));yield*Mr(ut(t.sort(e)),qe)})();function mu(n){return nE.apply(this,arguments)}function nE(){return nE=$(function*(n){var r,e=!1,t=!1;try{for(var i=ut(n);e=!(yield i.next()).done;e=!1);}catch(o){t=!0,r=o}finally{try{e&&null!=i.return&&(yield i.return())}finally{if(t)throw r}}}),nE.apply(this,arguments)}function Xi(n,e){return rE.apply(this,arguments)}function rE(){return rE=Vt(function*(n,e){var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield qe(s.next())).done;t=!1){const a=o.value;(yield qe(e(a)))&&(yield a)}}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield qe(s.return()))}finally{if(r)throw i}}}),rE.apply(this,arguments)}function ox(n,e){return iE.apply(this,arguments)}function iE(){return iE=Vt(function*(n,e){let t=0;if(!(e<1)){var s,r=!1,i=!1;try{for(var a,o=ut(n);r=!(a=yield qe(o.next())).done;r=!1)if(yield a.value,t++,t===e)return}catch(u){i=!0,s=u}finally{try{r&&null!=o.return&&(yield qe(o.return()))}finally{if(i)throw s}}}}),iE.apply(this,arguments)}let ax=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"");const go="/",cx=(new TextEncoder).encode(go),np=cx[0];class Br{constructor(e,t){if("string"==typeof e)this._buf=At(e);else{if(!(e instanceof Uint8Array))throw new Error("Invalid key, should be String of Uint8Array");this._buf=e}if(null==t&&(t=!0),t&&this.clean(),0===this._buf.byteLength||this._buf[0]!==np)throw new Error("Invalid key")}toString(e="utf8"){return kt(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new Br(e.join(go))}static random(){return new Br(ax().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"==typeof e?new Br(e):"function"==typeof e.uint8Array?new Br(e.uint8Array()):null}clean(){if((null==this._buf||0===this._buf.byteLength)&&(this._buf=cx),this._buf[0]!==np){const e=new Uint8Array(this._buf.byteLength+1);e.fill(np,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===np;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let i=0;i<t.length;i++){if(r.length<i+1)return!1;const s=t[i],o=r[i];if(s<o)return!0;if(s>o)return!1}return t.length<r.length}reverse(){return Br.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(go).slice(1)}type(){return function GH(n){const e=n.split(":");return e.length<2?"":e.slice(0,-1).join(":")}(this.baseNamespace())}name(){return function jH(n){const e=n.split(":");return e[e.length-1]}(this.baseNamespace())}instance(e){return new Br(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(go)||(e+=go),e+=this.type(),new Br(e)}parent(){const e=this.list();return new Br(1===e.length?go:e.slice(0,-1).join(go))}child(e){return this.toString()===go?e:e.toString()===go?this:new Br(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()!==this.toString()&&e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()!==this.toString()&&this.toString().startsWith(e.toString())}isTopLevel(){return 1===this.list().length}concat(...e){return Br.withNamespaces([...this.namespaces(),...zH(e.map(t=>t.namespaces()))])}}function zH(n){return[].concat(...n)}class qH extends class HH{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}putMany(e,t={}){var r=this;return Vt(function*(){var o,i=!1,s=!1;try{for(var u,a=ut(e);i=!(u=yield qe(a.next())).done;i=!1){const{key:_,value:x}=u.value;yield qe(r.put(_,x,t)),yield{key:_,value:x}}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}})()}getMany(e,t={}){var r=this;return Vt(function*(){var o,i=!1,s=!1;try{for(var u,a=ut(e);i=!(u=yield qe(a.next())).done;i=!1){const _=u.value;yield r.get(_,t)}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}})()}deleteMany(e,t={}){var r=this;return Vt(function*(){var o,i=!1,s=!1;try{for(var u,a=ut(e);i=!(u=yield qe(a.next())).done;i=!1){const _=u.value;yield qe(r.delete(_,t)),yield _}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}})()}batch(){var e=this;let t=[],r=[];return{put(i,s){t.push({key:i,value:s})},delete(i){r.push(i)},commit:(i=$(function*(s){yield mu(e.putMany(t,s)),t=[],yield mu(e.deleteMany(r,s)),r=[]}),function(o){return i.apply(this,arguments)})};var i}_all(e,t){return Vt(function*(){throw new Error("._all is not implemented")})()}_allKeys(e,t){return Vt(function*(){throw new Error("._allKeys is not implemented")})()}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=Xi(r,i=>i.key.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(r=e.filters.reduce((i,s)=>Xi(i,s),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((i,s)=>sx(i,s),r)),null!=e.offset){let i=0;r=Xi(r,()=>i++>=e.offset)}return null!=e.limit&&(r=ox(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=Xi(r,i=>i.toString().startsWith(e.prefix))),Array.isArray(e.filters)&&(r=e.filters.reduce((i,s)=>Xi(i,s),r)),Array.isArray(e.orders)&&(r=e.orders.reduce((i,s)=>sx(i,s),r)),null!=e.offset){let i=0;r=Xi(r,()=>i++>=e.offset)}return null!=e.limit&&(r=ox(r,e.limit)),r}}{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}put(e,t){var r=this;return $(function*(){r.data[e.toString()]=t})()}get(e){var t=this;return $(function*(){if(!(yield t.has(e)))throw function WH(n){return n=n||new Error("Not Found"),se(n,"ERR_NOT_FOUND")}();return t.data[e.toString()]})()}has(e){var t=this;return $(function*(){return void 0!==t.data[e.toString()]})()}delete(e){var t=this;return $(function*(){delete t.data[e.toString()]})()}_all(){var e=this;return Vt(function*(){yield*Mr(ut(Object.entries(e.data).map(([t,r])=>({key:new Br(t),value:r}))),qe)})()}_allKeys(){var e=this;return Vt(function*(){yield*Mr(ut(Object.entries(e.data).map(([t])=>new Br(t))),qe)})()}}var ln=(()=>(function(n){n.NOT_STARTED_YET="The libp2p node is not started yet",n.DHT_DISABLED="DHT is not available",n.PUBSUB_DISABLED="PubSub is not available",n.CONN_ENCRYPTION_REQUIRED="At least one connection encryption module is required",n.ERR_TRANSPORTS_REQUIRED="At least one transport module is required",n.ERR_PROTECTOR_REQUIRED="Private network is enforced, but no protector was provided",n.NOT_FOUND="Not found"}(ln||(ln={})),ln))(),_e=(()=>(function(n){n.DHT_DISABLED="ERR_DHT_DISABLED",n.ERR_PUBSUB_DISABLED="ERR_PUBSUB_DISABLED",n.PUBSUB_NOT_STARTED="ERR_PUBSUB_NOT_STARTED",n.DHT_NOT_STARTED="ERR_DHT_NOT_STARTED",n.CONN_ENCRYPTION_REQUIRED="ERR_CONN_ENCRYPTION_REQUIRED",n.ERR_TRANSPORTS_REQUIRED="ERR_TRANSPORTS_REQUIRED",n.ERR_PROTECTOR_REQUIRED="ERR_PROTECTOR_REQUIRED",n.ERR_PEER_DIAL_INTERCEPTED="ERR_PEER_DIAL_INTERCEPTED",n.ERR_CONNECTION_INTERCEPTED="ERR_CONNECTION_INTERCEPTED",n.ERR_INVALID_PROTOCOLS_FOR_STREAM="ERR_INVALID_PROTOCOLS_FOR_STREAM",n.ERR_CONNECTION_ENDED="ERR_CONNECTION_ENDED",n.ERR_CONNECTION_FAILED="ERR_CONNECTION_FAILED",n.ERR_NODE_NOT_STARTED="ERR_NODE_NOT_STARTED",n.ERR_ALREADY_ABORTED="ERR_ALREADY_ABORTED",n.ERR_TOO_MANY_ADDRESSES="ERR_TOO_MANY_ADDRESSES",n.ERR_NO_VALID_ADDRESSES="ERR_NO_VALID_ADDRESSES",n.ERR_RELAYED_DIAL="ERR_RELAYED_DIAL",n.ERR_DIALED_SELF="ERR_DIALED_SELF",n.ERR_DISCOVERED_SELF="ERR_DISCOVERED_SELF",n.ERR_DUPLICATE_TRANSPORT="ERR_DUPLICATE_TRANSPORT",n.ERR_ENCRYPTION_FAILED="ERR_ENCRYPTION_FAILED",n.ERR_HOP_REQUEST_FAILED="ERR_HOP_REQUEST_FAILED",n.ERR_INVALID_KEY="ERR_INVALID_KEY",n.ERR_INVALID_MESSAGE="ERR_INVALID_MESSAGE",n.ERR_INVALID_PARAMETERS="ERR_INVALID_PARAMETERS",n.ERR_INVALID_PEER="ERR_INVALID_PEER",n.ERR_MUXER_UNAVAILABLE="ERR_MUXER_UNAVAILABLE",n.ERR_NOT_FOUND="ERR_NOT_FOUND",n.ERR_TIMEOUT="ERR_TIMEOUT",n.ERR_TRANSPORT_UNAVAILABLE="ERR_TRANSPORT_UNAVAILABLE",n.ERR_TRANSPORT_DIAL_FAILED="ERR_TRANSPORT_DIAL_FAILED",n.ERR_UNSUPPORTED_PROTOCOL="ERR_UNSUPPORTED_PROTOCOL",n.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED="ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED",n.ERR_INVALID_MULTIADDR="ERR_INVALID_MULTIADDR",n.ERR_SIGNATURE_NOT_VALID="ERR_SIGNATURE_NOT_VALID",n.ERR_FIND_SELF="ERR_FIND_SELF",n.ERR_NO_ROUTERS_AVAILABLE="ERR_NO_ROUTERS_AVAILABLE",n.ERR_CONNECTION_NOT_MULTIPLEXED="ERR_CONNECTION_NOT_MULTIPLEXED",n.ERR_NO_DIAL_TOKENS="ERR_NO_DIAL_TOKENS",n.ERR_KEYCHAIN_REQUIRED="ERR_KEYCHAIN_REQUIRED",n.ERR_INVALID_CMS="ERR_INVALID_CMS",n.ERR_MISSING_KEYS="ERR_MISSING_KEYS",n.ERR_NO_KEY="ERR_NO_KEY",n.ERR_INVALID_KEY_NAME="ERR_INVALID_KEY_NAME",n.ERR_INVALID_KEY_TYPE="ERR_INVALID_KEY_TYPE",n.ERR_KEY_ALREADY_EXISTS="ERR_KEY_ALREADY_EXISTS",n.ERR_INVALID_KEY_SIZE="ERR_INVALID_KEY_SIZE",n.ERR_KEY_NOT_FOUND="ERR_KEY_NOT_FOUND",n.ERR_OLD_KEY_NAME_INVALID="ERR_OLD_KEY_NAME_INVALID",n.ERR_NEW_KEY_NAME_INVALID="ERR_NEW_KEY_NAME_INVALID",n.ERR_PASSWORD_REQUIRED="ERR_PASSWORD_REQUIRED",n.ERR_PEM_REQUIRED="ERR_PEM_REQUIRED",n.ERR_CANNOT_READ_KEY="ERR_CANNOT_READ_KEY",n.ERR_MISSING_PRIVATE_KEY="ERR_MISSING_PRIVATE_KEY",n.ERR_MISSING_PUBLIC_KEY="ERR_MISSING_PUBLIC_KEY",n.ERR_INVALID_OLD_PASS_TYPE="ERR_INVALID_OLD_PASS_TYPE",n.ERR_INVALID_NEW_PASS_TYPE="ERR_INVALID_NEW_PASS_TYPE",n.ERR_INVALID_PASS_LENGTH="ERR_INVALID_PASS_LENGTH",n.ERR_NOT_IMPLEMENTED="ERR_NOT_IMPLEMENTED",n.ERR_WRONG_PING_ACK="ERR_WRONG_PING_ACK",n.ERR_INVALID_RECORD="ERR_INVALID_RECORD",n.ERR_ALREADY_SUCCEEDED="ERR_ALREADY_SUCCEEDED",n.ERR_NO_HANDLER_FOR_PROTOCOL="ERR_NO_HANDLER_FOR_PROTOCOL",n.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS",n.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS",n.ERR_CONNECTION_DENIED="ERR_CONNECTION_DENIED"}(_e||(_e={})),_e))();function sE(n,e){return oE.apply(this,arguments)}function oE(){return oE=Vt(function*(n,e){var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield qe(s.next())).done;t=!1){const a=o.value;yield e(a)}}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield qe(s.return()))}finally{if(r)throw i}}}),oE.apply(this,arguments)}function aE(n,e){return cE.apply(this,arguments)}function cE(){return cE=Vt(function*(n,e){yield*Mr(ut(sE(n,function(){var t=$(function*(r){return yield e.addressBook.add(r.id,r.multiaddrs),r});return function(r){return t.apply(this,arguments)}}())),qe)}),cE.apply(this,arguments)}function ux(n){const e=new Set;return Xi(n,t=>!e.has(t.id.toString())&&(e.add(t.id.toString()),!0))}function lx(n){return uE.apply(this,arguments)}function uE(){return uE=Vt(function*(n,e=1){let t=0;var s,r=!1,i=!1;try{for(var a,o=ut(n);r=!(a=yield qe(o.next())).done;r=!1){const u=a.value;t++,yield u}}catch(u){i=!0,s=u}finally{try{r&&null!=o.return&&(yield qe(o.return()))}finally{if(i)throw s}}if(t<e)throw se(new Error("not found"),"NOT_FOUND")}),uE.apply(this,arguments)}var Pi=R(1420);function Pa(n){return lE.apply(this,arguments)}function lE(){return lE=$(function*(n){var r,e=!1,t=!1;try{for(var s,i=ut(n);e=!(s=yield i.next()).done;e=!1)return s.value}catch(o){t=!0,r=o}finally{try{e&&null!=i.return&&(yield i.return())}finally{if(t)throw r}}}),lE.apply(this,arguments)}var rp=R(1466),Wr=R(9069);const fx=Mt("libp2p:peer-routing");class QH{constructor(e,t){this.components=e,this.routers=t.routers,this.refreshManagerInit=t.refreshManager??{},this.started=!1,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}isStarted(){return this.started}start(){var e=this;return $(function*(){e.started||0===e.routers.length||null!=e.timeoutId||!1===e.refreshManagerInit.enabled||(e.timeoutId=(0,rp.setDelayedInterval)(e._findClosestPeersTask,e.refreshManagerInit.interval,e.refreshManagerInit.bootDelay),e.started=!0)})()}_findClosestPeersTask(){var e=this;return $(function*(){if(null==e.abortController)try{e.abortController=new Pi.TimeoutController(e.refreshManagerInit.timeout??1e4);try{(0,Wr.setMaxListeners)?.(1/0,e.abortController.signal)}catch{}yield mu(e.getClosestPeers(e.components.peerId.toBytes(),{signal:e.abortController.signal}))}catch(t){fx.error(t)}finally{e.abortController?.clear(),e.abortController=void 0}})()}stop(){var e=this;return $(function*(){(0,rp.clearDelayedInterval)(e.timeoutId),e.abortController?.abort(),e.started=!1})()}findPeer(e,t){var r=this;return $(function*(){if(0===r.routers.length)throw se(new Error("No peer routers available"),_e.ERR_NO_ROUTERS_AVAILABLE);if(e.toString()===r.components.peerId.toString())throw se(new Error("Should not try to find self"),_e.ERR_FIND_SELF);const i=yield zn(Zd(...r.routers.map(s=>Vt(function*(){try{yield yield qe(s.findPeer(e,t))}catch(o){fx.error(o)}})())),s=>Xi(s,Boolean),s=>aE(s,r.components.peerStore),function(){var s=$(function*(o){return yield Pa(o)});return function(o){return s.apply(this,arguments)}}());if(null!=i)return i;throw se(new Error(ln.NOT_FOUND),_e.ERR_NOT_FOUND)})()}getClosestPeers(e,t){var r=this;return Vt(function*(){if(0===r.routers.length)throw se(new Error("No peer routers available"),_e.ERR_NO_ROUTERS_AVAILABLE);yield*Mr(ut(zn(Zd(...r.routers.map(i=>i.getClosestPeers(e,t))),i=>aE(i,r.components.peerStore),i=>ux(i),i=>lx(i))),qe)})()}}class YH{constructor(e,t){this.routers=t.routers??[],this.started=!1,this.components=e}isStarted(){return this.started}start(){var e=this;return $(function*(){e.started=!0})()}stop(){var e=this;return $(function*(){e.started=!1})()}findProviders(e,t={}){var r=this;return Vt(function*(){if(0===r.routers.length)throw se(new Error("No content this.routers available"),_e.ERR_NO_ROUTERS_AVAILABLE);yield*Mr(ut(zn(Zd(...r.routers.map(i=>i.findProviders(e,t))),i=>aE(i,r.components.peerStore),i=>ux(i),i=>lx(i))),qe)})()}provide(e,t={}){var r=this;return $(function*(){if(0===r.routers.length)throw se(new Error("No content routers available"),_e.ERR_NO_ROUTERS_AVAILABLE);yield Promise.all(r.routers.map(function(){var i=$(function*(s){return yield s.provide(e,t)});return function(s){return i.apply(this,arguments)}}()))})()}put(e,t,r){var i=this;return $(function*(){if(!i.isStarted())throw se(new Error(ln.NOT_STARTED_YET),_e.DHT_NOT_STARTED);const s=i.components.dht;null!=s&&(yield mu(s.put(e,t,r)))})()}get(e,t){var r=this;return $(function*(){if(!r.isStarted())throw se(new Error(ln.NOT_STARTED_YET),_e.DHT_NOT_STARTED);const i=r.components.dht;if(null!=i){var a,s=!1,o=!1;try{for(var _,u=ut(i.get(e,t));s=!(_=yield u.next()).done;s=!1){const x=_.value;if("VALUE"===x.name)return x.value}}catch(x){o=!0,a=x}finally{try{s&&null!=u.return&&(yield u.return())}finally{if(o)throw a}}}throw se(new Error(ln.NOT_FOUND),_e.ERR_NOT_FOUND)})()}getMany(e,t,r){var i=this;return Vt(function*(){if(!i.isStarted())throw se(new Error(ln.NOT_STARTED_YET),_e.DHT_NOT_STARTED);if(null==t||0===t)return;let s=0;const o=i.components.dht;if(null!=o){var _,a=!1,u=!1;try{for(var P,x=ut(o.get(e,r));a=!(P=yield qe(x.next())).done;a=!1){const B=P.value;if("VALUE"===B.name&&(yield{from:B.from,val:B.value},s++,s===t))break}}catch(B){u=!0,_=B}finally{try{a&&null!=x.return&&(yield qe(x.return()))}finally{if(u)throw _}}}if(0===s)throw se(new Error(ln.NOT_FOUND),_e.ERR_NOT_FOUND)})()}}function zl(n){if(ND(n))return{id:n,multiaddrs:[],protocols:[]};let e;return"string"==typeof n&&(n=Cn(n)),Ch(n)&&(e=n,n=function ZH(n){const e=n.getPeerId();if(null==e)throw se(new Error(`${n.toString()} does not have a valid peer type`),_e.ERR_INVALID_MULTIADDR);try{return xr(e)}catch{throw se(new Error(`${n.toString()} is not a valid peer type`),_e.ERR_INVALID_MULTIADDR)}}(n)),{id:n,multiaddrs:null!=e?[e]:[],protocols:[]}}const XH=n=>n;class JH extends gi{constructor(e,t){super();const{listen:r=[],announce:i=[]}=t;this.components=e,this.listen=new Set(r.map(s=>s.toString())),this.announce=new Set(i.map(s=>s.toString())),this.observed=new Set,this.announceFilter=t.announceFilter??XH}getListenAddrs(){return Array.from(this.listen).map(e=>Cn(e))}getAnnounceAddrs(){return Array.from(this.announce).map(e=>Cn(e))}getObservedAddrs(){return Array.from(this.observed).map(e=>Cn(e))}confirmObservedAddr(e){}removeObservedAddr(e){}addObservedAddr(e){let t=Cn(e);const r=t.getPeerId();null!=r&&xr(r).equals(this.components.peerId)&&(t=t.decapsulate(Cn(`/p2p/${this.components.peerId.toString()}`)));const i=t.toString();this.observed.has(i)||(this.observed.add(i),this.dispatchEvent(new zt("change:addresses")))}getAddresses(){let e=this.getAnnounceAddrs().map(r=>r.toString());0===e.length&&(e=this.components.transportManager.getAddrs().map(r=>r.toString())),e=e.concat(this.getObservedAddrs().map(r=>r.toString()));const t=new Set(e);return this.announceFilter(Array.from(t).map(r=>Cn(r))).map(r=>r.getPeerId()===this.components.peerId.toString()?r:r.encapsulate(`/p2p/${this.components.peerId.toString()}`))}}const Wl=R(7820),dx=Mt("libp2p:connection-manager:latency-monitor:visibility-change-emitter");class t$ extends gi{constructor(){super(),this.hidden="hidden",this.visibilityChange="visibilityChange",null!=globalThis.document&&(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener())}_initializeVisibilityVarNames(){let e="hidden",t="visibilitychange";typeof globalThis.document.hidden<"u"?(e="hidden",t="visibilitychange"):typeof globalThis.document.mozHidden<"u"?(e="mozHidden",t="mozvisibilitychange"):typeof globalThis.document.msHidden<"u"?(e="msHidden",t="msvisibilitychange"):typeof globalThis.document.webkitHidden<"u"&&(e="webkitHidden",t="webkitvisibilitychange"),this.hidden=e,this.visibilityChange=t}_addVisibilityChangeListener(){typeof globalThis.document.addEventListener>"u"||typeof document[this.hidden]>"u"?dx("Checking page visibility requires a browser that supports the Page Visibility API."):globalThis.document.addEventListener(this.visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this.hidden&&void 0!==document[this.hidden])return null==document[this.hidden]}_handleVisibilityChange(){const e=!1===globalThis.document[this.hidden];dx(e?"Page Visible":"Page Hidden"),this.dispatchEvent(new zt("visibilityChange",{detail:e}))}}const yo=Mt("libp2p:connection-manager:latency-monitor");class n$ extends gi{constructor(e={}){super();const{latencyCheckIntervalMs:t,dataEmitIntervalMs:r,asyncTestFn:i,latencyRandomPercentage:s}=e;this.latencyCheckIntervalMs=t??500,this.latencyRandomPercentage=s??10,this.latencyCheckMultiply=this.latencyRandomPercentage/100*2*this.latencyCheckIntervalMs,this.latencyCheckSubtract=this.latencyCheckMultiply/2,this.dataEmitIntervalMs=null===r||0===r?void 0:r??5e3,yo("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",this.latencyCheckIntervalMs,this.dataEmitIntervalMs),null!=this.dataEmitIntervalMs?yo("Expecting ~%s events per summary",this.latencyCheckIntervalMs/this.dataEmitIntervalMs):yo("Not emitting summaries"),this.asyncTestFn=i,null!=globalThis.process?.hrtime?(yo("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=o=>{const a=this.now(o);return 1e3*a[0]+a[1]/1e6}):typeof window<"u"&&null!=window.performance?.now?(yo("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=o=>Math.round(this.now()-o)):(yo("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=o=>this.now()-o),this.latencyData=this.initLatencyData()}start(){(function r$(){return typeof globalThis.window<"u"})()&&(this.visibilityChangeEmitter=new t$,this.visibilityChangeEmitter.addEventListener("visibilityChange",e=>{const{detail:t}=e;t?this._startTimers():(this._emitSummary(),this._stopTimers())})),!0===this.visibilityChangeEmitter?.isVisible()&&this._startTimers()}stop(){this._stopTimers()}_startTimers(){null==this.checkLatencyID&&(this.checkLatency(),null!=this.dataEmitIntervalMs&&(this.emitIntervalID=setInterval(()=>this._emitSummary(),this.dataEmitIntervalMs),"function"==typeof this.emitIntervalID.unref&&this.emitIntervalID.unref()))}_stopTimers(){null!=this.checkLatencyID&&(clearTimeout(this.checkLatencyID),this.checkLatencyID=void 0),null!=this.emitIntervalID&&(clearInterval(this.emitIntervalID),this.emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.dispatchEvent(new zt("data",{detail:e}))}getSummary(){const e={events:this.latencyData.events,minMs:this.latencyData.minMs,maxMs:this.latencyData.maxMs,avgMs:this.latencyData.events>0?this.latencyData.totalMs/this.latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this.latencyData.startTime)};return this.latencyData=this.initLatencyData(),yo.trace("Summary: %O",e),e}checkLatency(){const e=Math.random()*this.latencyCheckMultiply-this.latencyCheckSubtract,t={deltaOffset:Math.ceil(this.latencyCheckIntervalMs+e),startTime:this.now()},r=()=>{if(null==this.checkLatencyID)return;const i=this.getDeltaMS(t.startTime)-t.deltaOffset;this.checkLatency(),this.latencyData.events++,this.latencyData.minMs=Math.min(this.latencyData.minMs,i),this.latencyData.maxMs=Math.max(this.latencyData.maxMs,i),this.latencyData.totalMs+=i,yo.trace("MS: %s Data: %O",i,this.latencyData)};yo.trace("localData: %O",t),this.checkLatencyID=setTimeout(()=>{null!=this.asyncTestFn?(t.deltaOffset=0,t.startTime=this.now(),this.asyncTestFn(r)):(t.deltaOffset-=1,r())},t.deltaOffset),"function"==typeof this.checkLatencyID.unref&&this.checkLatencyID.unref()}initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}var ql=R(2502);const px="CLOSING",fE="CLOSED";function ip(n,e){const t={[Symbol.iterator]:()=>t,next:()=>{const r=n.next(),i=r.value;return!0===r.done||null==i?{done:!0,value:void 0}:{done:!1,value:e(i)}}};return t}class i${constructor(e){if(this.map=new Map,null!=e)for(const[t,r]of e.entries())this.map.set(t.toString(),r)}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(e){this.map.delete(e.toString())}entries(){return ip(this.map.entries(),e=>[xr(e[0]),e[1]])}forEach(e){this.map.forEach((t,r)=>{e(t,xr(r),this)})}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return ip(this.map.keys(),e=>xr(e))}values(){return this.map.values()}get size(){return this.map.size}}class Ql{constructor(e){if(this.set=new Set,null!=e)for(const t of e)this.set.add(t.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return ip(this.set.entries(),e=>{const t=xr(e[0]);return[t,t]})}forEach(e){this.set.forEach(t=>{const r=xr(t);e(r,r,this)})}has(e){return this.set.has(e.toString())}values(){return ip(this.set.values(),e=>xr(e))}intersection(e){const t=new Ql;for(const r of e)this.has(r)&&t.add(r);return t}difference(e){const t=new Ql;for(const r of this)e.has(r)||t.add(r);return t}union(e){const t=new Ql;for(const r of e)t.add(r);for(const r of this)t.add(r);return t}}Symbol;const Er=Mt("libp2p:connection-manager"),o$={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,inboundConnectionThreshold:5,maxIncomingPendingConnections:10},hE="libp2p",pE="connection-manager";class c$ extends gi{constructor(e,t){if(super(),this.opts=Wl.call({ignoreUndefined:!0},o$,t),this.opts.maxConnections<this.opts.minConnections)throw se(new Error("Connection Manager maxConnections must be greater than minConnections"),_e.ERR_INVALID_PARAMETERS);Er("options: %o",this.opts),this.components=e,this.connections=new Map,this.started=!1,this._checkMetrics=this._checkMetrics.bind(this),this.latencyMonitor=new n$({latencyCheckIntervalMs:t.pollInterval,dataEmitIntervalMs:t.pollInterval});try{(0,Wr.setMaxListeners)?.(1/0,this)}catch{}this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.startupReconnectTimeout=t.startupReconnectTimeout??6e4,this.dialTimeout=t.dialTimeout??3e4,this.allow=(t.allow??[]).map(r=>Cn(r)),this.deny=(t.deny??[]).map(r=>Cn(r)),this.inboundConnectionRateLimiter=new I2.RateLimiterMemory({points:this.opts.inboundConnectionThreshold,duration:1}),this.incomingPendingConnections=0}isStarted(){return this.started}start(){var e=this;return $(function*(){null!=e.components.metrics&&(e.timer=e.timer??ql(e._checkMetrics,e.opts.pollInterval)),e.components.metrics?.updateComponentMetric({system:hE,component:pE,metric:"connections",label:"direction",value:()=>{const t={inbound:0,outbound:0};for(const r of e.connections.values())for(const i of r)"inbound"===i.stat.direction?t.inbound++:t.outbound++;return t}}),e.components.metrics?.updateComponentMetric({system:hE,component:pE,metric:"protocol-streams-total",label:"protocol",value:()=>{const t={};for(const r of e.connections.values())for(const i of r)for(const s of i.streams){const o=`${s.stat.direction} ${s.stat.protocol??"unnegotiated"}`;t[o]=(t[o]??0)+1}return t}}),e.components.metrics?.updateComponentMetric({system:hE,component:pE,metric:"protocol-streams-per-connection-90th-percentile",label:"protocol",value:()=>{const t={};for(const i of e.connections.values())for(const s of i){const o={};for(const a of s.streams){const u=`${a.stat.direction} ${a.stat.protocol??"unnegotiated"}`;o[u]=(o[u]??0)+1}for(const[a,u]of Object.entries(o))t[a]=t[a]??[],t[a].push(u)}const r={};for(let[i,s]of Object.entries(t)){s=s.sort((a,u)=>a-u);const o=Math.floor(.9*s.length);r[i]=s[o]}return r}}),e.latencyMonitor.start(),e._onLatencyMeasure=e._onLatencyMeasure.bind(e),e.latencyMonitor.addEventListener("data",e._onLatencyMeasure),e.started=!0,Er("started")})()}afterStart(){var e=this;return $(function*(){e.components.upgrader.addEventListener("connection",e.onConnect),e.components.upgrader.addEventListener("connectionEnd",e.onDisconnect),Promise.resolve().then($(function*(){const t=[];for(const r of yield e.components.peerStore.all())(yield e.components.peerStore.getTags(r.id)).filter(o=>"keep-alive"===o.name).length>0&&t.push(r.id);e.connectOnStartupController?.clear(),e.connectOnStartupController=new Pi.TimeoutController(e.startupReconnectTimeout);try{(0,Wr.setMaxListeners)?.(1/0,e.connectOnStartupController.signal)}catch{}yield Promise.all(t.map(function(){var r=$(function*(i){yield e.openConnection(i,{signal:e.connectOnStartupController?.signal}).catch(s=>{Er.error(s)})});return function(i){return r.apply(this,arguments)}}()))})).catch(t=>{Er.error(t)}).finally(()=>{e.connectOnStartupController?.clear()})})()}beforeStop(){var e=this;return $(function*(){e.connectOnStartupController?.abort(),e.components.upgrader.removeEventListener("connection",e.onConnect),e.components.upgrader.removeEventListener("connectionEnd",e.onDisconnect)})()}stop(){var e=this;return $(function*(){e.timer?.clear(),e.latencyMonitor.removeEventListener("data",e._onLatencyMeasure),e.latencyMonitor.stop(),e.started=!1,yield e._close(),Er("stopped")})()}_close(){var e=this;return $(function*(){const t=[];for(const r of e.connections.values())for(const i of r)t.push($(function*(){try{yield i.close()}catch(s){Er.error(s)}})());Er("closing %d connections",t.length),yield Promise.all(t),e.connections.clear()})()}_checkMetrics(){var e=this;return $(function*(){const t=e.components.metrics;if(null!=t)try{const r=t.getGlobal().getMovingAverages(),i=r.dataReceived[e.opts.movingAverageInterval].movingAverage;yield e._checkMaxLimit("maxReceivedData",i);const s=r.dataSent[e.opts.movingAverageInterval].movingAverage;yield e._checkMaxLimit("maxSentData",s);const o=i+s;yield e._checkMaxLimit("maxData",o),Er.trace("metrics update",o)}finally{e.timer=ql(e._checkMetrics,e.opts.pollInterval)}})()}onConnect(e){this._onConnect(e).catch(t=>{Er.error(t)})}_onConnect(e){var t=this;return $(function*(){const{detail:r}=e;if(!t.started)return void(yield r.close());const i=r.remotePeer,s=i.toString(),o=t.connections.get(s);null!=o?o.push(r):t.connections.set(s,[r]),null!=i.publicKey&&(yield t.components.peerStore.keyBook.set(i,i.publicKey));const a=t.getConnections().length,u=a-t.opts.maxConnections;yield t._checkMaxLimit("maxConnections",a,u),t.dispatchEvent(new zt("peer:connect",{detail:r}))})()}onDisconnect(e){const{detail:t}=e;if(!this.started)return;const r=t.remotePeer.toString();let i=this.connections.get(r);null!=i&&i.length>1?(i=i.filter(s=>s.id!==t.id),this.connections.set(r,i)):null!=i&&(this.connections.delete(r),this.dispatchEvent(new zt("peer:disconnect",{detail:t})),this.components.metrics?.onPeerDisconnected(t.remotePeer))}getConnections(e){if(null!=e)return this.connections.get(e.toString())??[];let t=[];for(const r of this.connections.values())t=t.concat(r);return t}openConnection(e,t={}){var r=this;return $(function*(){Er("dial to %p",e);const i=r.getConnections(e);if(i.length>0)return Er("had an existing connection to %p",e),i[0];let s;if(null==t?.signal){s=new Pi.TimeoutController(r.dialTimeout),t.signal=s.signal;try{(0,Wr.setMaxListeners)?.(1/0,s.signal)}catch{}}try{const o=yield r.components.dialer.dial(e,t);let a=r.connections.get(e.toString());null==a&&(a=[],r.connections.set(e.toString(),a));let u=!1;for(const _ of a)_.id===o.id&&(u=!0);return u||a.push(o),o}finally{s?.clear()}})()}closeConnections(e){var t=this;return $(function*(){const r=t.connections.get(e.toString())??[];yield Promise.all(r.map(function(){var i=$(function*(s){return yield s.close()});return function(s){return i.apply(this,arguments)}}()))})()}getAll(e){if(!ND(e))throw se(new Error("peerId must be an instance of peer-id"),_e.ERR_INVALID_PARAMETERS);const t=e.toString(),r=this.connections.get(t);return null!=r?r.filter(i=>"OPEN"===i.stat.status):[]}_onLatencyMeasure(e){const{detail:t}=e;this._checkMaxLimit("maxEventLoopDelay",t.avgMs,1).catch(r=>{Er.error(r)})}_checkMaxLimit(e,t,r=1){var i=this;return $(function*(){const s=i.opts[e];Er.trace("checking limit of %s. current value: %d of %d",e,t,s),t>s&&(Er("%s: limit exceeded: %p, %d/%d, pruning %d connection(s)",i.components.peerId,e,t,s,r),yield i._pruneConnections(r))})()}_pruneConnections(e){var t=this;return $(function*(){const r=t.getConnections(),i=new i$;for(const a of r){const u=a.remotePeer;if(i.has(u))continue;const _=yield t.components.peerStore.getTags(u);i.set(u,_.reduce((x,P)=>x+P.value,0))}const s=r.sort((a,u)=>{const _=i.get(a.remotePeer)??0,x=i.get(u.remotePeer)??0;return _>x?1:_<x?-1:0}),o=[];for(const a of s)if(Er("too many connections open - closing a connection to %p",a.remotePeer),o.push(a),o.length===e)break;yield Promise.all(o.map(function(){var a=$(function*(u){try{yield u.close()}catch(_){Er.error(_)}t.onDisconnect(new zt("connectionEnd",{detail:u}))});return function(u){return a.apply(this,arguments)}}()))})()}acceptIncomingConnection(e){var t=this;return $(function*(){if(t.deny.some(s=>e.remoteAddr.toString().startsWith(s.toString())))return Er("connection from %s refused - connection remote address was in deny list",e.remoteAddr),!1;if(t.allow.some(s=>e.remoteAddr.toString().startsWith(s.toString())))return t.incomingPendingConnections++,!0;if(t.incomingPendingConnections===t.opts.maxIncomingPendingConnections)return Er("connection from %s refused - incomingPendingConnections exceeded by peer %s",e.remoteAddr),!1;if(e.remoteAddr.isThinWaistAddress()){const s=e.remoteAddr.nodeAddress().address;try{yield t.inboundConnectionRateLimiter.consume(s,1)}catch{return Er("connection from %s refused - inboundConnectionThreshold exceeded by host %s",s,e.remoteAddr),!1}}return t.getConnections().length<t.opts.maxConnections?(t.incomingPendingConnections++,!0):(Er("connection from %s refused - maxConnections exceeded",e.remoteAddr),!1)})()}afterUpgradeInbound(){this.incomingPendingConnections--}}function gE(n){return yE.apply(this,arguments)}function yE(){return yE=$(function*(n){const e=[];var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield s.next()).done;t=!1)e.push(o.value)}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield s.return())}finally{if(r)throw i}}return e}),yE.apply(this,arguments)}function u$(n){return mE.apply(this,arguments)}function mE(){return mE=$(function*(n){const e=[];var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield s.next()).done;t=!1)e.push(o.value)}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield s.return())}finally{if(r)throw i}}return e}),mE.apply(this,arguments)}function vE(n,e){return EE.apply(this,arguments)}function EE(){return EE=Vt(function*(n,e){const t=yield qe(u$(n));yield*Mr(ut(t.sort(e)),qe)}),EE.apply(this,arguments)}const Qo=Mt("libp2p:connection-manager:auto-dialler"),l$={enabled:!0,minConnections:0,autoDialInterval:1e4};class f${constructor(e,t){this.components=e,this.options=Wl.call({ignoreUndefined:!0},l$,t),this.running=!1,this._autoDial=this._autoDial.bind(this),Qo("options: %j",this.options)}isStarted(){return this.running}start(){var e=this;return $(function*(){e.options.enabled?(e.running=!0,e._autoDial().catch(t=>{Qo.error("could start autodial",t)}),Qo("started")):Qo("not enabled")})()}stop(){var e=this;return $(function*(){e.options.enabled?(e.running=!1,null!=e.autoDialTimeout&&e.autoDialTimeout.clear(),Qo("stopped")):Qo("not enabled")})()}_autoDial(){var e=this;return $(function*(){null!=e.autoDialTimeout&&e.autoDialTimeout.clear();const t=e.options.minConnections;if(e.components.connectionManager.getConnections().length>=t)return void(e.autoDialTimeout=ql(e._autoDial,e.options.autoDialInterval));const r=yield e.components.peerStore.all(),i=yield zn(r.sort(()=>Math.random()>.5?1:-1),s=>Xi(s,o=>!o.id.equals(e.components.peerId)),s=>vE(s,(o,a)=>a.protocols.length>o.protocols.length||null!=a.id.publicKey&&null==o.id.publicKey?1:-1),function(){var s=$(function*(o){return yield gE(o)});return function(o){return s.apply(this,arguments)}}());for(let s=0;e.running&&s<i.length&&e.components.connectionManager.getConnections().length<t;s++){if(!e.running)return;const o=i[s];if(0===e.components.connectionManager.getConnections(o.id).length){Qo("connecting to a peerStore stored peer %p",o.id);try{yield e.components.connectionManager.openConnection(o.id)}catch(a){Qo.error("could not connect to peerStore stored peer",a)}}}!e.running||(e.autoDialTimeout=ql(e._autoDial,e.options.autoDialInterval))})()}}!function d$(){Mc._configure(),Gi._configure(Pc),ji._configure(Nc)}();const gx=["uint64","int64","sint64","fixed64","sfixed64"];function Yl(n,e){const t=function p$(n){return function h$(n){for(const e of gx){if(null==n[e])continue;const t=n[e];n[e]=function(){return BigInt(t.call(this).toString())}}return n}(new Gi(n))}(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}function Zl(n,e){const t=function y$(){return function g$(n){for(const e of gx){if(null==n[e])continue;const t=n[e];n[e]=function(r){return t.call(this,r.toString())}}return n}(ji.create())}();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}var Wt,Xl=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(Xl||(Xl={})),Xl))();function yx(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}function _E(n){function e(i){if(null==n[i.toString()])throw new Error("Invalid enum value");return n[i]}return yx("enum",Xl.VARINT,function(s,o){const a=e(s);o.int32(a)},function(s){return e(s.int32())})}function Jl(n,e){return yx("message",Xl.LENGTH_DELIMITED,n,e)}!function(n){let e;var a;let t,r,i,s,o;(a=e=n.Status||(n.Status={})).SUCCESS="SUCCESS",a.HOP_SRC_ADDR_TOO_LONG="HOP_SRC_ADDR_TOO_LONG",a.HOP_DST_ADDR_TOO_LONG="HOP_DST_ADDR_TOO_LONG",a.HOP_SRC_MULTIADDR_INVALID="HOP_SRC_MULTIADDR_INVALID",a.HOP_DST_MULTIADDR_INVALID="HOP_DST_MULTIADDR_INVALID",a.HOP_NO_CONN_TO_DST="HOP_NO_CONN_TO_DST",a.HOP_CANT_DIAL_DST="HOP_CANT_DIAL_DST",a.HOP_CANT_OPEN_DST_STREAM="HOP_CANT_OPEN_DST_STREAM",a.HOP_CANT_SPEAK_RELAY="HOP_CANT_SPEAK_RELAY",a.HOP_CANT_RELAY_TO_SELF="HOP_CANT_RELAY_TO_SELF",a.STOP_SRC_ADDR_TOO_LONG="STOP_SRC_ADDR_TOO_LONG",a.STOP_DST_ADDR_TOO_LONG="STOP_DST_ADDR_TOO_LONG",a.STOP_SRC_MULTIADDR_INVALID="STOP_SRC_MULTIADDR_INVALID",a.STOP_DST_MULTIADDR_INVALID="STOP_DST_MULTIADDR_INVALID",a.STOP_RELAY_REFUSED="STOP_RELAY_REFUSED",a.MALFORMED_MESSAGE="MALFORMED_MESSAGE",function(a){a[a.SUCCESS=100]="SUCCESS",a[a.HOP_SRC_ADDR_TOO_LONG=220]="HOP_SRC_ADDR_TOO_LONG",a[a.HOP_DST_ADDR_TOO_LONG=221]="HOP_DST_ADDR_TOO_LONG",a[a.HOP_SRC_MULTIADDR_INVALID=250]="HOP_SRC_MULTIADDR_INVALID",a[a.HOP_DST_MULTIADDR_INVALID=251]="HOP_DST_MULTIADDR_INVALID",a[a.HOP_NO_CONN_TO_DST=260]="HOP_NO_CONN_TO_DST",a[a.HOP_CANT_DIAL_DST=261]="HOP_CANT_DIAL_DST",a[a.HOP_CANT_OPEN_DST_STREAM=262]="HOP_CANT_OPEN_DST_STREAM",a[a.HOP_CANT_SPEAK_RELAY=270]="HOP_CANT_SPEAK_RELAY",a[a.HOP_CANT_RELAY_TO_SELF=280]="HOP_CANT_RELAY_TO_SELF",a[a.STOP_SRC_ADDR_TOO_LONG=320]="STOP_SRC_ADDR_TOO_LONG",a[a.STOP_DST_ADDR_TOO_LONG=321]="STOP_DST_ADDR_TOO_LONG",a[a.STOP_SRC_MULTIADDR_INVALID=350]="STOP_SRC_MULTIADDR_INVALID",a[a.STOP_DST_MULTIADDR_INVALID=351]="STOP_DST_MULTIADDR_INVALID",a[a.STOP_RELAY_REFUSED=390]="STOP_RELAY_REFUSED",a[a.MALFORMED_MESSAGE=400]="MALFORMED_MESSAGE"}(t||(t={})),function(a){a.codec=()=>_E(t)}(e=n.Status||(n.Status={})),function(a){a.HOP="HOP",a.STOP="STOP",a.STATUS="STATUS",a.CAN_HOP="CAN_HOP"}(r=n.Type||(n.Type={})),function(a){a[a.HOP=1]="HOP",a[a.STOP=2]="STOP",a[a.STATUS=3]="STATUS",a[a.CAN_HOP=4]="CAN_HOP"}(i||(i={})),function(a){a.codec=()=>_E(i)}(r=n.Type||(n.Type={})),function(a){let u;a.codec=()=>(null==u&&(u=Jl((_,x,P={})=>{if(!1!==P.lengthDelimited&&x.fork(),(!0===P.writeDefaults||null!=_.id&&_.id.byteLength>0)&&(x.uint32(10),x.bytes(_.id)),null!=_.addrs)for(const B of _.addrs)x.uint32(18),x.bytes(B);!1!==P.lengthDelimited&&x.ldelim()},(_,x)=>{const P={id:new Uint8Array(0),addrs:[]},B=null==x?_.len:_.pos+x;for(;_.pos<B;){const U=_.uint32();switch(U>>>3){case 1:P.id=_.bytes();break;case 2:P.addrs.push(_.bytes());break;default:_.skipType(7&U)}}return P})),u),a.encode=_=>Zl(_,a.codec()),a.decode=_=>Yl(_,a.codec())}(s=n.Peer||(n.Peer={})),n.codec=()=>(null==o&&(o=Jl((a,u,_={})=>{!1!==_.lengthDelimited&&u.fork(),null!=a.type&&(u.uint32(8),n.Type.codec().encode(a.type,u)),null!=a.srcPeer&&(u.uint32(18),n.Peer.codec().encode(a.srcPeer,u,{writeDefaults:!1})),null!=a.dstPeer&&(u.uint32(26),n.Peer.codec().encode(a.dstPeer,u,{writeDefaults:!1})),null!=a.code&&(u.uint32(32),n.Status.codec().encode(a.code,u)),!1!==_.lengthDelimited&&u.ldelim()},(a,u)=>{const _={},x=null==u?a.len:a.pos+u;for(;a.pos<x;){const P=a.uint32();switch(P>>>3){case 1:_.type=n.Type.codec().decode(a);break;case 2:_.srcPeer=n.Peer.codec().decode(a,a.uint32());break;case 3:_.dstPeer=n.Peer.codec().decode(a,a.uint32());break;case 4:_.code=n.Status.codec().decode(a);break;default:a.skipType(7&P)}}return _})),o),n.encode=a=>Zl(a,n.codec()),n.decode=a=>Yl(a,n.codec())}(Wt||(Wt={}));const m$=Mt("libp2p:stream:converter");function mx(n,e={}){const{stream:t,remoteAddr:r}=n,{sink:i,source:s}=t,o=Vt(function*(){var B,x=!1,P=!1;try{for(var W,U=ut(s);x=!(W=yield qe(U.next())).done;x=!1){const X=W.value;yield*Mr(ut(X),qe)}}catch(X){P=!0,B=X}finally{try{x&&null!=U.return&&(yield qe(U.return()))}finally{if(P)throw B}}})(),a={sink:x=>$(function*(){null!=e.signal&&(x=bs(x,e.signal));try{yield i(x),yield u()}catch(P){"aborted"!==P.type&&m$(P)}})(),source:null!=e.signal?bs(o,e.signal):o,remoteAddr:r,timeline:{open:Date.now(),close:void 0},close:()=>$(function*(){yield i(Vt(function*(){yield new Uint8Array(0)})()),yield u()})()};function u(){return _.apply(this,arguments)}function _(){return(_=$(function*(){return null==a.timeline.close&&(a.timeline.close=Date.now()),yield Promise.resolve()})).apply(this,arguments)}return a}const vu="/libp2p/circuit/relay/0.1.0";function vx(n,e){n.write({type:Wt.Type.STATUS,code:e})}function Ex(n,e){try{null!=n.dstPeer?.addrs&&n.dstPeer.addrs.forEach(t=>Cn(t))}catch(t){throw vx(e,n.type===Wt.Type.HOP?Wt.Status.HOP_DST_MULTIADDR_INVALID:Wt.Status.STOP_DST_MULTIADDR_INVALID),t}try{null!=n.srcPeer?.addrs&&n.srcPeer.addrs.forEach(t=>Cn(t))}catch(t){throw vx(e,n.type===Wt.Type.HOP?Wt.Status.HOP_SRC_MULTIADDR_INVALID:Wt.Status.STOP_SRC_MULTIADDR_INVALID),t}}const ef=Mt("libp2p:circuit:stream-handler");class sp{constructor(e){const{stream:t,maxLength:r=4096}=e;this.stream=t,this.shake=Qd(this.stream),this.decoder=ys.fromReader(this.shake.reader,{maxDataLength:r})}read(){var e=this;return $(function*(){const t=yield e.decoder.next();if(null!=t.value){const r=Wt.decode(t.value);return ef("read message type",r.type),r}ef("read received no value, closing stream"),e.close()})()}write(e){ef("write message type %s",e.type),this.shake.write(ao.single(Wt.encode(e)))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){ef("closing the stream"),this.rest().sink([]).catch(e=>{ef.error(e)})}}const tf=Mt("libp2p:circuit:stop");function _$(n){return bE.apply(this,arguments)}function bE(){return bE=$(function*(n){const{connection:e,request:t,signal:r}=n,i=yield e.newStream(vu,{signal:r});tf("starting stop request to %p",e.remotePeer);const s=new sp({stream:i});s.write(t);const o=yield s.read();if(null!=o)return o.code===Wt.Status.SUCCESS?(tf("stop request to %p was successful",e.remotePeer),s.rest()):(tf("stop request failed with code %d",o.code),void s.close());s.close()}),bE.apply(this,arguments)}const Ji=Mt("libp2p:circuit:hop");function wE(){return wE=$(function*(n){const{connection:e,request:t,streamHandler:r,circuit:i,connectionManager:s}=n;if(!i.hopEnabled())return Ji("HOP request received but we are not acting as a relay"),r.end({type:Wt.Type.STATUS,code:Wt.Status.HOP_CANT_SPEAK_RELAY});try{Ex(t,r)}catch(P){return void Ji.error("invalid hop request via peer %p %o",e.remotePeer,P)}if(null==t.dstPeer)return void Ji("HOP request received but we do not receive a dstPeer");const o=tu(t.dstPeer.id),a=s.getConnections(o);if(0===a.length&&!i.hopActive())return Ji("HOP request received but we are not connected to the destination peer"),r.end({type:Wt.Type.STATUS,code:Wt.Status.HOP_NO_CONN_TO_DST});if(0===a.length)return Ji("did not have connection to remote peer"),r.end({type:Wt.Type.STATUS,code:Wt.Status.HOP_NO_CONN_TO_DST});const u={type:Wt.Type.STOP,dstPeer:t.dstPeer,srcPeer:t.srcPeer};let _;try{Ji("performing STOP request");const P=yield _$({connection:a[0],request:u});if(null==P)throw new Error("Could not stop");_=P}catch(P){return void Ji.error(P)}Ji("hop request from %p is valid",e.remotePeer),r.write({type:Wt.Type.STATUS,code:Wt.Status.SUCCESS});const x=r.rest();return Ji("creating related connections"),yield zn(x,_,x)}),wE.apply(this,arguments)}function SE(){return SE=$(function*(n){const{connection:e,request:t,signal:r}=n,i=yield e.newStream(vu,{signal:r}),s=new sp({stream:i});s.write(t);const o=yield s.read();if(null==o)throw se(new Error("HOP request had no response"),_e.ERR_HOP_REQUEST_FAILED);if(o.code===Wt.Status.SUCCESS)return Ji("hop request was successful"),s.rest();throw Ji("hop request failed with code %d, closing stream",o.code),s.close(),se(new Error(`HOP request failed with code "${o.code??"unknown"}"`),_e.ERR_HOP_REQUEST_FAILED)}),SE.apply(this,arguments)}function IE(){return IE=$(function*(n){const{connection:e,signal:t}=n,r=yield e.newStream(vu,{signal:t}),i=new sp({stream:r});i.write({type:Wt.Type.CAN_HOP});const s=yield i.read();return yield i.close(),!(null==s||s.code!==Wt.Status.SUCCESS)}),IE.apply(this,arguments)}const es=Mt("libp2p:circuit");class T${constructor(e,t){this._init=t,this.components=e,this._started=!1}isStarted(){return this._started}start(){var e=this;return $(function*(){e._started||(e._started=!0,yield e.components.registrar.handle(vu,t=>{e._onProtocol(t).catch(r=>{es.error(r)})}).catch(t=>{es.error(t)}))})()}stop(){var e=this;return $(function*(){yield e.components.registrar.unhandle(vu)})()}hopEnabled(){return!0}hopActive(){return!0}get[yv](){return!0}get[Symbol.toStringTag](){return"libp2p/circuit-relay-v1"}_onProtocol(e){var t=this;return $(function*(){const{connection:r,stream:i}=e,s=new Pi.TimeoutController(t._init.hop.timeout);try{(0,Wr.setMaxListeners)?.(1/0,s.signal)}catch{}try{const o=jo(i,s.signal),a=new sp({stream:{...i,...o}}),u=yield a.read();if(null==u)return es("request was invalid, could not read from stream"),a.write({type:Wt.Type.STATUS,code:Wt.Status.MALFORMED_MESSAGE}),void a.close();let _;switch(u.type){case Wt.Type.CAN_HOP:es("received CAN_HOP request from %p",r.remotePeer),yield function I$(n){const{connection:e,streamHandler:t,circuit:r}=n,i=r.hopEnabled();Ji("can hop (%s) request from %p",i,e.remotePeer),t.end({type:Wt.Type.STATUS,code:i?Wt.Status.SUCCESS:Wt.Status.HOP_CANT_SPEAK_RELAY})}({circuit:t,connection:r,streamHandler:a});break;case Wt.Type.HOP:es("received HOP request from %p",r.remotePeer),yield function b$(n){return wE.apply(this,arguments)}({connection:r,request:u,streamHandler:a,circuit:t,connectionManager:t.components.connectionManager});break;case Wt.Type.STOP:es("received STOP request from %p",r.remotePeer),_=yield function E$(n){const{connection:e,request:t,streamHandler:r}=n;try{Ex(t,r)}catch(i){return void tf.error("invalid stop request via peer %p %o",e.remotePeer,i)}return tf("stop request is valid"),r.write({type:Wt.Type.STATUS,code:Wt.Status.SUCCESS}),r.rest()}({connection:r,request:u,streamHandler:a});break;default:return es("Request of type %s not supported",u.type),a.write({type:Wt.Type.STATUS,code:Wt.Status.MALFORMED_MESSAGE}),void a.close()}if(null!=_){const B=mx({stream:_,remoteAddr:r.remoteAddr.encapsulate("/p2p-circuit").encapsulate(Cn(u.dstPeer?.addrs[0])),localAddr:Cn(u.srcPeer?.addrs[0])}),U=u.type===Wt.Type.HOP?"relay":"inbound";es("new %s connection %s",U,B.remoteAddr);const W=yield t.components.upgrader.upgradeInbound(B);es("%s connection %s upgraded",U,B.remoteAddr),null!=t.handler&&t.handler(W)}}finally{s.clear()}})()}dial(e,t={}){var r=this;return $(function*(){const i=e.toString().split("/p2p-circuit"),s=Cn(i[0]),o=Cn(i[i.length-1]),a=s.getPeerId(),u=o.getPeerId();if(null==a||null==u){const W="Circuit relay dial failed as addresses did not have peer id";throw es.error(W),se(new Error(W),_e.ERR_RELAYED_DIAL)}const _=xr(a),x=xr(u);let P=!1,U=r.components.connectionManager.getConnections(_)[0];null==U&&(yield r.components.peerStore.addressBook.add(_,[s]),U=yield r.components.connectionManager.openConnection(_,t),P=!0);try{const W=yield function w$(n){return SE.apply(this,arguments)}({...t,connection:U,request:{type:Wt.Type.HOP,srcPeer:{id:r.components.peerId.toBytes(),addrs:r.components.addressManager.getAddresses().map(fe=>fe.bytes)},dstPeer:{id:x.toBytes(),addrs:[Cn(o).bytes]}}}),X=s.encapsulate(`/p2p-circuit/p2p/${r.components.peerId.toString()}`),re=mx({stream:W,remoteAddr:e,localAddr:X});return es("new outbound connection %s",re.remoteAddr),yield r.components.upgrader.upgradeOutbound(re)}catch(W){throw es.error("Circuit relay dial failed",W),P&&(yield U.close()),W}})()}createListener(e){return this.handler=e.handler,function v$(n){const e=new Map;function r(){return(r=$(function*(o){const u=Cn(o.toString().split("/p2p-circuit").find(U=>""!==U)),_=u.getPeerId();if(null==_)throw new Error("Could not determine relay peer from multiaddr");const x=xr(_);yield n.peerStore.addressBook.add(x,[u]);const P=yield n.connectionManager.openConnection(x),B=P.remoteAddr.encapsulate("/p2p-circuit");e.set(P.remotePeer.toString(),B),s.dispatchEvent(new zt("listening"))})).apply(this,arguments)}const s=Object.assign(new gi,{close:(o=$(function*(){return yield Promise.resolve()}),function(){return o.apply(this,arguments)}),listen:function t(o){return r.apply(this,arguments)},getAddrs:function i(){const o=[];for(const a of e.values())o.push(a);return o}});var o;return n.connectionManager.addEventListener("peer:disconnect",o=>{const{detail:a}=o;e.delete(a.remotePeer.toString())&&s.dispatchEvent(new zt("close"))}),s}({connectionManager:this.components.connectionManager,peerStore:this.components.peerStore})}filter(e){return(e=Array.isArray(e)?e:[e]).filter(t=>su.matches(t))}}function _x(n){return TE.apply(this,arguments)}function TE(){return TE=$(function*(n){const e=(new TextEncoder).encode(n),t=yield di.digest(e);return ar.createV0(t)}),TE.apply(this,arguments)}const wx="hop_relay",Ix="/libp2p/relay";var A$=R(7910);const Tx="[a-fA-F\\d:]",Yo=n=>n&&n.includeBoundaries?`(?:(?<=\\s|^)(?=${Tx})|(?<=${Tx})(?=\\s|$))`:"",Is="(?: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}",_r="[a-fA-F\\d]{1,4}",op=`\n(?:\n(?:${_r}:){7}(?:${_r}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${_r}:){6}(?:${Is}|:${_r}|:)| // 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\n(?:${_r}:){5}(?::${Is}|(?::${_r}){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\n(?:${_r}:){4}(?:(?::${_r}){0,1}:${Is}|(?::${_r}){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\n(?:${_r}:){3}(?:(?::${_r}){0,2}:${Is}|(?::${_r}){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\n(?:${_r}:){2}(?:(?::${_r}){0,3}:${Is}|(?::${_r}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${_r}:){1}(?:(?::${_r}){0,4}:${Is}|(?::${_r}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${_r}){0,5}:${Is}|(?::${_r}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),R$=new RegExp(`(?:^${Is}$)|(?:^${op}$)`),P$=new RegExp(`^${Is}$`),N$=new RegExp(`^${op}$`),CE=n=>n&&n.exact?R$:new RegExp(`(?:${Yo(n)}${Is}${Yo(n)})|(?:${Yo(n)}${op}${Yo(n)})`,"g");CE.v4=n=>n&&n.exact?P$:new RegExp(`${Yo(n)}${Is}${Yo(n)}`,"g"),CE.v6=n=>n&&n.exact?N$:new RegExp(`${Yo(n)}${op}${Yo(n)}`,"g");const M$=CE;var O$=R(1396);const{isValid:k$,parse:L$}=O$,B$=["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"].map(n=>new A$.Netmask(n));function Cx(n){return/^::$/.test(n)||/^::1$/.test(n)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(n)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(n)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(n)||/^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(n)||/^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(n)||/^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(n)||/^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(n)||/^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(n)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(n)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(n)||/^ff([0-9a-fA-F]{2,2}):/i.test(n)}function Dx(n){const{address:e}=n.nodeAddress();return Boolean((n=>{if(k$(n)){const e=L$(n);if("ipv4"===e.kind())return function F$(n){for(let e of B$)if(e.contains(n))return!0;return!1}(e.toNormalizedString());if("ipv6"===e.kind())return Cx(n)}else if(Xm(n)&&M$.v6().test(n))return Cx(n)})(e))}function DE(n,e){const t=Dx(n.multiaddr),r=Dx(e.multiaddr);return t&&!r?1:!t&&r||n.isCertified&&!e.isCertified?-1:!n.isCertified&&e.isCertified?1:0}const nf=Mt("libp2p:auto-relay"),V$=()=>{};class H${constructor(e,t){this.components=e,this.addressSorter=t.addressSorter??DE,this.maxListeners=t.maxListeners??1,this.listenRelays=new Set,this.onError=t.onError??V$,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this.components.peerStore.addEventListener("change:protocols",r=>{this._onProtocolChange(r).catch(i=>{nf.error(i)})}),this.components.connectionManager.addEventListener("peer:disconnect",this._onPeerDisconnected)}_onProtocolChange(e){var t=this;return $(function*(){const{peerId:r,protocols:i}=e.detail,s=r.toString();if(null!=i.find(a=>a===vu)){if(!t.listenRelays.has(s))try{const a=t.components.connectionManager.getConnections(r);if(0===a.length)return;const u=a[0];if(u.remoteAddr.protoCodes().includes(290))return void nf(`relayed connection to ${s} will not be used to hop on`);(yield function S$(n){return IE.apply(this,arguments)}({connection:u}))&&(yield t.components.peerStore.metadataBook.setValue(r,wx,At("true")),yield t._addListenRelay(u,s))}catch(a){t.onError(a)}}else t.listenRelays.has(s)&&(yield t._removeListenRelay(s))})()}_onPeerDisconnected(e){const i=e.detail.remotePeer.toString();!this.listenRelays.has(i)||this._removeListenRelay(i).catch(s=>{nf.error(s)})}_addListenRelay(e,t){var r=this;return $(function*(){try{if(r.listenRelays.size>=r.maxListeners)return;const i=yield zn(yield r.components.peerStore.addressBook.get(e.remotePeer),o=>vE(o,r.addressSorter),function(){var o=$(function*(a){return yield gE(a)});return function(a){return o.apply(this,arguments)}}());(yield Promise.all(i.map(function(){var o=$(function*(a){try{let u=a.multiaddr;return null==u.getPeerId()&&(u=u.encapsulate(`/p2p/${e.remotePeer.toString()}`)),u=u.encapsulate("/p2p-circuit"),yield r.components.transportManager.listen([u]),!0}catch(u){nf.error("error listening on circuit address",u),r.onError(u)}return!1});return function(a){return o.apply(this,arguments)}}()))).includes(!0)&&r.listenRelays.add(t)}catch(i){r.onError(i),r.listenRelays.delete(t)}})()}_removeListenRelay(e){var t=this;return $(function*(){t.listenRelays.delete(e)&&(yield t._listenOnAvailableHopRelays([e]))})()}_listenOnAvailableHopRelays(e=[]){var t=this;return $(function*(){if(t.listenRelays.size>=t.maxListeners)return;const r=[],i=yield t.components.peerStore.all();for(const{id:x,metadata:P}of i){const B=x.toString();if(t.listenRelays.has(B)||e.includes(B))continue;const U=P.get(wx);if(null==U||"true"!==kt(U))continue;const W=t.components.connectionManager.getConnections(x);if(0!==W.length){if(yield t._addListenRelay(W[0],B),t.listenRelays.size>=t.maxListeners)return}else r.push(x)}for(const x of r)if(yield t._tryToListenOnRelay(x),t.listenRelays.size>=t.maxListeners)return;try{const x=yield _x(Ix);var a,s=!1,o=!1;try{for(var _,u=ut(t.components.contentRouting.findProviders(x));s=!(_=yield u.next()).done;s=!1){const P=_.value;if(0===P.multiaddrs.length)continue;const B=P.id;if(!B.equals(t.components.peerId)&&(yield t.components.peerStore.addressBook.add(B,P.multiaddrs),yield t._tryToListenOnRelay(B),t.listenRelays.size>=t.maxListeners))return}}catch(P){o=!0,a=P}finally{try{s&&null!=u.return&&(yield u.return())}finally{if(o)throw a}}}catch(x){t.onError(x)}})()}_tryToListenOnRelay(e){var t=this;return $(function*(){try{const r=yield t.components.connectionManager.openConnection(e);yield t._addListenRelay(r,e.toString())}catch(r){nf.error("Could not use %p as relay",e,r),t.onError(r,`could not connect and listen on known hop relay ${e.toString()}`)}})()}}const xx=Mt("libp2p:relay");class $${constructor(e,t){this.components=e,this.autoRelay=!1!==t.autoRelay?.enabled?new H$(e,{addressSorter:t.addressSorter,...t.autoRelay}):void 0,this.started=!1,this.init=t,this._advertiseService=this._advertiseService.bind(this)}isStarted(){return this.started}start(){var e=this;return $(function*(){!1!==e.init.hop.enabled&&!1!==e.init.advertise.enabled&&(e.timeout=(0,rp.setDelayedInterval)(e._advertiseService,e.init.advertise.ttl,e.init.advertise.bootDelay)),e.started=!0})()}stop(){var e=this;return $(function*(){null!=e.timeout&&(0,rp.clearDelayedInterval)(e.timeout),e.started=!1})()}_advertiseService(){var e=this;return $(function*(){try{const t=yield _x(Ix);yield e.components.contentRouting.provide(t)}catch(t){t.code===_e.ERR_NO_ROUTERS_AVAILABLE?(xx.error("a content router, such as a DHT, must be provided in order to advertise the relay service",t),yield e.stop()):xx.error(t)}})()}}var K$=R(9014);R(422),R(5911);const Ax=Nn.pki;function AE(){return AE=$(function*(n,e){const t=n.map(e);return n[(yield Promise.all(t)).findIndex(s=>s)]}),AE.apply(this,arguments)}const z$=Mt("libp2p:keychain:cms"),RE=new WeakMap;class W${constructor(e,t){if(null==e)throw se(new Error("keychain is required"),_e.ERR_KEYCHAIN_REQUIRED);this.keychain=e,RE.set(this,{dek:t})}encrypt(e,t){var r=this;return $(function*(){if(!(t instanceof Uint8Array))throw se(new Error("Plain data must be a Uint8Array"),_e.ERR_INVALID_PARAMETERS);const i=yield r.keychain.findKeyByName(e),s=yield r.keychain.getPrivateKey(e),o=RE.get(r);if(null==o)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);const u=Nn.pki.decryptRsaPrivateKey(s,o.dek),_=yield((n,e)=>{const t=Ax.rsa.setPublicKey(e.n,e.e),r=Ax.createCertificate();r.publicKey=t,r.serialNumber="01",r.validity.notBefore=new Date,r.validity.notAfter=new Date,r.validity.notAfter.setFullYear(r.validity.notBefore.getFullYear()+10);const i=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:n.id}];return r.setSubject(i),r.setIssuer(i),r.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}]),r.sign(e),r})(i,u),x=Nn.pkcs7.createEnvelopedData();return x.addRecipient(_),x.content=Nn.util.createBuffer(t),x.encrypt(),At(Nn.asn1.toDer(x.toAsn1()).getBytes(),"ascii")})()}decrypt(e){var t=this;return $(function*(){if(!(e instanceof Uint8Array))throw se(new Error("CMS data is required"),_e.ERR_INVALID_PARAMETERS);let r;try{const P=Nn.util.createBuffer(kt(e,"ascii")),B=Nn.asn1.fromDer(P);r=Nn.pkcs7.messageFromAsn1(B)}catch(P){throw z$.error(P),se(new Error("Invalid CMS"),_e.ERR_INVALID_CMS)}const i=r.recipients.filter(P=>P.issuer.find(B=>"O"===B.shortName&&"ipfs"===B.value)).filter(P=>P.issuer.find(B=>"CN"===B.shortName)).map(P=>({recipient:P,keyId:P.issuer.find(B=>"CN"===B.shortName).value})),s=yield function j$(n,e){return AE.apply(this,arguments)}(i,function(){var P=$(function*(B){try{if(null!=(yield t.keychain.findKeyById(B.keyId)))return!0}catch{return!1}return!1});return function(B){return P.apply(this,arguments)}}());if(null==s){const P=i.map(B=>B.keyId);throw se(new Error(`Decryption needs one of the key(s): ${P.join(", ")}`),_e.ERR_MISSING_KEYS,{missingKeys:P})}const o=yield t.keychain.findKeyById(s.keyId);if(null==o)throw se(new Error("No key available to decrypto"),_e.ERR_NO_KEY);const a=yield t.keychain.getPrivateKey(o.name),u=RE.get(t);if(null==u)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);const x=Nn.pki.decryptRsaPrivateKey(a,u.dek);return r.decrypt(s.recipient,x),At(r.content.getBytes(),"ascii")})()}}const ap=Mt("libp2p:keychain"),Zo=new WeakMap,PE={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function mo(n){return null!=n&&"string"==typeof n&&n===K$(n.trim())&&n.length>0}function Dn(){return NE.apply(this,arguments)}function NE(){return(NE=$(function*(){const t=800*Math.random()+200;yield new Promise(r=>setTimeout(r,t))})).apply(this,arguments)}function Vs(n){return new Br("/pkcs8/"+n)}function vo(n){return new Br("/info/"+n)}class Px{constructor(e,t){if(this.components=e,this.init=Wl(PE,t),null!=this.init.pass&&this.init.pass?.length<20)throw new Error("pass must be least 20 characters");if(null!=this.init.dek?.keyLength&&this.init.dek.keyLength<14)throw new Error("dek.keyLength must be least 14 bytes");if(null!=this.init.dek?.salt?.length&&this.init.dek.salt.length<16)throw new Error("dek.saltLength must be least 16 bytes");if(null!=this.init.dek?.iterationCount&&this.init.dek.iterationCount<1e3)throw new Error("dek.iterationCount must be least 1000");const r=null!=this.init.pass&&null!=this.init.dek?.salt?rx(this.init.pass,this.init.dek?.salt,this.init.dek?.iterationCount,this.init.dek?.keyLength,this.init.dek?.hash):"";Zo.set(this,{dek:r}),this.started=!1}isStarted(){return this.started}start(){var e=this;return $(function*(){const t=vo("self");(yield e.components.datastore.has(t))||(yield e.importPeer("self",e.components.peerId)),e.started=!0})()}stop(){this.started=!1}get cms(){const e=Zo.get(this);if(null==e)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);return new W$(this,e.dek)}static generateOptions(){const e=Object.assign({},PE),t=3*Math.ceil(16/3);return e.dek.salt=kt(ph(t),"base64"),e}static get options(){return PE}createKey(e,t,r=2048){var i=this;return $(function*(){if(!mo(e)||"self"===e)throw yield Dn(),se(new Error("Invalid key name"),_e.ERR_INVALID_KEY_NAME);if("string"!=typeof t)throw yield Dn(),se(new Error("Invalid key type"),_e.ERR_INVALID_KEY_TYPE);const s=Vs(e);if(yield i.components.datastore.has(s))throw yield Dn(),se(new Error("Key name already exists"),_e.ERR_KEY_ALREADY_EXISTS);if("rsa"===t.toLowerCase()&&(!Number.isSafeInteger(r)||r<2048))throw yield Dn(),se(new Error("Invalid RSA key size"),_e.ERR_INVALID_KEY_SIZE);let a;try{const u=yield AD(t,r),_=yield u.id(),x=Zo.get(i);if(null==x)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);const P=x.dek,B=yield u.export(P);a={name:e,id:_};const U=i.components.datastore.batch();U.put(s,At(B)),U.put(vo(e),At(JSON.stringify(a))),yield U.commit()}catch(u){throw yield Dn(),u}return a})()}listKeys(){var e=this;return $(function*(){const t={prefix:"/info/"},r=[];var o,i=!1,s=!1;try{for(var u,a=ut(e.components.datastore.query(t));i=!(u=yield a.next()).done;i=!1)r.push(JSON.parse(kt(u.value.value)))}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}return r})()}findKeyById(e){var t=this;return $(function*(){try{return(yield t.listKeys()).find(i=>i.id===e)}catch(r){throw yield Dn(),r}})()}findKeyByName(e){var t=this;return $(function*(){if(!mo(e))throw yield Dn(),se(new Error(`Invalid key name '${e}'`),_e.ERR_INVALID_KEY_NAME);const r=vo(e);try{const i=yield t.components.datastore.get(r);return JSON.parse(kt(i))}catch(i){throw yield Dn(),ap.error(i),se(new Error(`Key '${e}' does not exist.`),_e.ERR_KEY_NOT_FOUND)}})()}removeKey(e){var t=this;return $(function*(){if(!mo(e)||"self"===e)throw yield Dn(),se(new Error(`Invalid key name '${e}'`),_e.ERR_INVALID_KEY_NAME);const r=Vs(e),i=yield t.findKeyByName(e),s=t.components.datastore.batch();return s.delete(r),s.delete(vo(e)),yield s.commit(),i})()}renameKey(e,t){var r=this;return $(function*(){if(!mo(e)||"self"===e)throw yield Dn(),se(new Error(`Invalid old key name '${e}'`),_e.ERR_OLD_KEY_NAME_INVALID);if(!mo(t)||"self"===t)throw yield Dn(),se(new Error(`Invalid new key name '${t}'`),_e.ERR_NEW_KEY_NAME_INVALID);const i=Vs(e),s=Vs(t),o=vo(e),a=vo(t);if(yield r.components.datastore.has(s))throw yield Dn(),se(new Error(`Key '${t}' already exists`),_e.ERR_KEY_ALREADY_EXISTS);try{const _=yield r.components.datastore.get(i),x=yield r.components.datastore.get(o),P=JSON.parse(kt(x));P.name=t;const B=r.components.datastore.batch();return B.put(s,_),B.put(a,At(JSON.stringify(P))),B.delete(i),B.delete(o),yield B.commit(),P}catch(_){throw yield Dn(),_}})()}exportKey(e,t){var r=this;return $(function*(){if(!mo(e))throw yield Dn(),se(new Error(`Invalid key name '${e}'`),_e.ERR_INVALID_KEY_NAME);if(null==t)throw yield Dn(),se(new Error("Password is required"),_e.ERR_PASSWORD_REQUIRED);const i=Vs(e);try{const o=kt(yield r.components.datastore.get(i)),a=Zo.get(r);if(null==a)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);const u=a.dek;return yield(yield $m(o,u)).export(t)}catch(s){throw yield Dn(),s}})()}importKey(e,t,r){var i=this;return $(function*(){if(!mo(e)||"self"===e)throw yield Dn(),se(new Error(`Invalid key name '${e}'`),_e.ERR_INVALID_KEY_NAME);if(null==t)throw yield Dn(),se(new Error("PEM encoded key is required"),_e.ERR_PEM_REQUIRED);const s=Vs(e);if(yield i.components.datastore.has(s))throw yield Dn(),se(new Error(`Key '${e}' already exists`),_e.ERR_KEY_ALREADY_EXISTS);let a,u;try{a=yield $m(t,r)}catch{throw yield Dn(),se(new Error("Cannot read the key, most likely the password is wrong"),_e.ERR_CANNOT_READ_KEY)}try{u=yield a.id();const P=Zo.get(i);if(null==P)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);const B=P.dek;t=yield a.export(B)}catch(P){throw yield Dn(),P}const _={name:e,id:u},x=i.components.datastore.batch();return x.put(s,At(t)),x.put(vo(e),At(JSON.stringify(_))),yield x.commit(),_})()}importPeer(e,t){var r=this;return $(function*(){try{if(!mo(e))throw se(new Error(`Invalid key name '${e}'`),_e.ERR_INVALID_KEY_NAME);if(null==t)throw se(new Error("PeerId is required"),_e.ERR_MISSING_PRIVATE_KEY);if(null==t.privateKey)throw se(new Error("PeerId.privKey is required"),_e.ERR_MISSING_PRIVATE_KEY);const i=yield Ol(t.privateKey),s=Vs(e);if(yield r.components.datastore.has(s))throw yield Dn(),se(new Error(`Key '${e}' already exists`),_e.ERR_KEY_ALREADY_EXISTS);const a=Zo.get(r);if(null==a)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);const u=a.dek,_=yield i.export(u),x={name:e,id:t.toString()},P=r.components.datastore.batch();return P.put(s,At(_)),P.put(vo(e),At(JSON.stringify(x))),yield P.commit(),x}catch(i){throw yield Dn(),i}})()}getPrivateKey(e){var t=this;return $(function*(){if(!mo(e))throw yield Dn(),se(new Error(`Invalid key name '${e}'`),_e.ERR_INVALID_KEY_NAME);try{const r=Vs(e);return kt(yield t.components.datastore.get(r))}catch(r){throw yield Dn(),ap.error(r),se(new Error(`Key '${e}' does not exist.`),_e.ERR_KEY_NOT_FOUND)}})()}rotateKeychainPass(e,t){var r=this;return $(function*(){if("string"!=typeof e)throw yield Dn(),se(new Error(`Invalid old pass type '${typeof e}'`),_e.ERR_INVALID_OLD_PASS_TYPE);if("string"!=typeof t)throw yield Dn(),se(new Error(`Invalid new pass type '${typeof t}'`),_e.ERR_INVALID_NEW_PASS_TYPE);if(t.length<20)throw yield Dn(),se(new Error(`Invalid pass length ${t.length}`),_e.ERR_INVALID_PASS_LENGTH);ap("recreating keychain");const i=Zo.get(r);if(null==i)throw se(new Error("dek missing"),_e.ERR_INVALID_PARAMETERS);const s=i.dek;r.init.pass=t;const o=null!=t&&null!=r.init.dek?.salt?rx(t,r.init.dek.salt,r.init.dek?.iterationCount,r.init.dek?.keyLength,r.init.dek?.hash):"";Zo.set(r,{dek:o});const a=yield r.listKeys();for(const u of a){const x=kt(yield r.components.datastore.get(Vs(u.name))),P=yield $m(x,s),B=o.toString(),U=yield P.export(B),W=r.components.datastore.batch(),X={name:u.name,id:u.id};W.put(Vs(u.name),At(U)),W.put(vo(u.name),At(JSON.stringify(X))),yield W.commit()}ap("keychain reconstructed")})()}}function ME(n,e){return OE.apply(this,arguments)}function OE(){return OE=Vt(function*(n,e){var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield qe(s.next())).done;t=!1){const a=o.value;yield qe(e(a)),yield a}}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield qe(s.return()))}finally{if(r)throw i}}}),OE.apply(this,arguments)}var Q$=R(5550);class J${constructor(e){if("number"!=typeof e)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");this.timespan=e,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(e,t){return 1-Math.exp(-(e-t)/this.timespan)}push(e,t){if(null!=this.previousTime){const r=this.alpha(e,this.previousTime),i=t-this.movingAverage,s=r*i;this.movingAverage=r*t+(1-r)*this.movingAverage,this.variance=(1-r)*(this.variance+i*s),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+r*i}else this.movingAverage=t;this.previousTime=e}}function kx(n){return new J$(n)}class kE extends gi{constructor(e){super(),this.enabled=e.enabled,this.queue=[],this.stats={dataReceived:0n,dataSent:0n},this.frequencyLastTime=Date.now(),this.frequencyAccumulators={},this.movingAverages={dataReceived:[],dataSent:[]},this.computeThrottleMaxQueueSize=e.computeThrottleMaxQueueSize,this.computeThrottleTimeout=e.computeThrottleTimeout,this._update=this._update.bind(this),this.movingAverageIntervals=e.movingAverageIntervals;for(let t=0;t<e.initialCounters.length;t++){const r=e.initialCounters[t];this.stats[r]=0n,this.movingAverages[r]=[];for(let i=0;i<this.movingAverageIntervals.length;i++){const s=this.movingAverageIntervals[i];(this.movingAverages[r][s]=kx(s)).push(this.frequencyLastTime,0)}}}start(){!this.enabled||this.queue.length>0&&this._resetComputeTimeout()}stop(){null!=this.timeout&&(this.timeout.clear(),this.timeout=null)}getSnapshot(){return Object.assign({},this.stats)}getMovingAverages(){return Object.assign({},this.movingAverages)}push(e,t){this.queue.push([e,t,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this.timeout=ql(this._update,this._nextTimeout())}_nextTimeout(){return Math.max(this.computeThrottleTimeout*(1-this.queue.length/this.computeThrottleMaxQueueSize),0)}_update(){if(this.timeout=null,this.queue.length>0){let e=["",0,0];for(e of this.queue)this._applyOp(e);this.queue=[],e.length>2&&""!==e[0]&&this._updateFrequency(e[2]),this.dispatchEvent(new zt("update",{detail:this.stats}))}}_updateFrequency(e){const t=e-this.frequencyLastTime;this._updateFrequencyFor("dataReceived",t,e),this._updateFrequencyFor("dataSent",t,e),this.frequencyLastTime=e}_updateFrequencyFor(e,t,r){const i=this.frequencyAccumulators[e]??0;this.frequencyAccumulators[e]=0;const o=i/(t??1)*1e3;let a=this.movingAverages[e];null==a&&(a=this.movingAverages[e]=[]);const u=this.movingAverageIntervals;for(let _=0;_<u.length;_++){const x=u[_];let P=a[x];null==P&&(P=a[x]=kx(x)),P.push(r,o)}}_applyOp(e){const t=e[0],r=e[1];if("number"!=typeof r)throw new Error("invalid increment number");let i;i=Object.prototype.hasOwnProperty.call(this.stats,t)?this.stats[t]:this.stats[t]=0n,this.stats[t]=i+BigInt(r),null==this.frequencyAccumulators[t]&&(this.frequencyAccumulators[t]=0),this.frequencyAccumulators[t]+=r}}const eK=["dataReceived","dataSent"],tK={in:"dataReceived",out:"dataSent"};class nK{constructor(e){this.enabled=e.enabled,this.statsInit={...e,initialCounters:eK},this.globalStats=new kE(this.statsInit),this.peerStats=new Map,this.protocolStats=new Map,this.oldPeers=Q$(e.maxOldPeersRetention??50),this.running=!1,this._onMessage=this._onMessage.bind(this),this.systems=new Map}isStarted(){return this.running}start(){var e=this;return $(function*(){!e.enabled||(e.running=!0)})()}stop(){var e=this;return $(function*(){if(e.running){e.running=!1,e.globalStats.stop();for(const t of e.peerStats.values())t.stop();for(const t of e.protocolStats.values())t.stop()}})()}getGlobal(){return this.globalStats}getPeers(){return Array.from(this.peerStats.keys())}getComponentMetrics(){return this.systems}updateComponentMetric(e){const{system:t="libp2p",component:r,metric:i,value:s,label:o,help:a}=e;this.systems.has(t)||this.systems.set(t,new Map);const u=this.systems.get(t);if(null==u)throw new Error("Unknown metric system");u.has(r)||u.set(r,new Map);const _=u.get(r);if(null==_)throw new Error("Unknown metric component");_.set(i,{label:o,help:a,calculate:"function"!=typeof s?()=>s:s})}forPeer(e){const t=e.toString();return this.peerStats.get(t)??this.oldPeers.get(t)}getProtocols(){return Array.from(this.protocolStats.keys())}forProtocol(e){return this.protocolStats.get(e)}onPeerDisconnected(e){const t=e.toString(),r=this.peerStats.get(t);null!=r&&(r.stop(),this.peerStats.delete(t),this.oldPeers.set(t,r))}_onMessage(e){if(!this.running)return;const{remotePeer:t,protocol:r,direction:i,dataLength:s}=e,o=tK[i];let a=this.forPeer(t);if(null==a){const u=new kE(this.statsInit);this.peerStats.set(t.toString(),u),a=u}if(a.push(o,s),this.globalStats.push(o,s),null!=r){let u=this.forProtocol(r);if(null==u){const _=new kE(this.statsInit);this.protocolStats.set(r,_),u=_}u.push(o,s)}}updatePlaceholder(e,t){if(!this.running)return;const r=e.toString(),i=this.peerStats.get(r)??this.oldPeers.get(r),s=t.toString(),o=this.peerStats.get(s)??this.oldPeers.get(s);let a=i;null!=o&&(a=function rK(n,e){return n.stop(),e.stop(),n.queue=[...n.queue,...e.queue],n}(o,a),this.oldPeers.remove(s)),this.peerStats.delete(e.toString()),this.peerStats.set(s,a),a.start()}trackStream(e){var t=this;const{stream:r,remotePeer:i,protocol:s}=e;if(!this.running)return;r.source=ME(r.source,u=>this._onMessage({remotePeer:i,protocol:s,direction:"in",dataLength:u.byteLength}));const a=r.sink;r.sink=function(){var u=$(function*(_){return yield zn(_,x=>ME(x,P=>{t._onMessage({remotePeer:i,protocol:s,direction:"out",dataLength:P.byteLength})}),a)});return function(_){return u.apply(this,arguments)}}()}}function LE(n){return BE.apply(this,arguments)}function BE(){return BE=$(function*(n){try{return{status:"fulfilled",value:yield n,isFulfilled:!0,isRejected:!1}}catch(e){return{status:"rejected",reason:e,isFulfilled:!1,isRejected:!0}}}),BE.apply(this,arguments)}class iK{constructor(e){yf(this,"value"),yf(this,"next"),this.value=e}}class sK{constructor(){Dp(this,Ks,void 0),Dp(this,Fa,void 0),Dp(this,Ua,void 0),this.clear()}enqueue(e){const t=new iK(e);ra(this,Ks)?(ra(this,Fa).next=t,bo(this,Fa,t)):(bo(this,Ks,t),bo(this,Fa,t)),P_(this,Ua)._++}dequeue(){const e=ra(this,Ks);if(e)return bo(this,Ks,ra(this,Ks).next),P_(this,Ua)._--,e.value}clear(){bo(this,Ks,void 0),bo(this,Fa,void 0),bo(this,Ua,0)}get size(){return ra(this,Ua)}*[Symbol.iterator](){let e=ra(this,Ks);for(;e;)yield e.value,e=e.next}}function oK(n){if(!Number.isInteger(n)&&n!==Number.POSITIVE_INFINITY||!(n>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");const e=new sK;let t=0;const i=function(){var a=$(function*(u,_,x){t++;const P=$(function*(){return u(...x)})();_(P);try{yield P}catch{}t--,e.size>0&&e.dequeue()()});return function(_,x,P){return a.apply(this,arguments)}}(),o=(a,...u)=>new Promise(_=>{((a,u,_)=>{e.enqueue(i.bind(void 0,a,u,_)),$(function*(){yield Promise.resolve(),t<n&&e.size>0&&e.dequeue()()})()})(a,_,u)});return Object.defineProperties(o,{activeCount:{get:()=>t},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),o}function aK(n){return FE.apply(this,arguments)}function FE(){return FE=$(function*(n,e={}){const{concurrency:t=Number.POSITIVE_INFINITY}=e,r=oK(t);return Promise.all(n.map(i=>LE(i&&"function"==typeof i.then?i:"function"==typeof i?r(()=>i()):Promise.resolve(i))))}),FE.apply(this,arguments)}Ks=new WeakMap,Fa=new WeakMap,Ua=new WeakMap;class cK extends Map{constructor(e){super();const{system:t,component:r,metric:i,metrics:s}=e;this.system=t??"libp2p",this.component=r,this.metric=i,this.metrics=s,this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){const t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metrics.updateComponentMetric({system:this.system,component:this.component,metric:this.metric,value:this.size})}}function UE(n){const{system:e,component:t,metric:r,metrics:i}=n;let s;return s=null!=i?new cK({system:e,component:t,metric:r,metrics:i}):new Map,s}const Ma=Mt("libp2p:transports");class uK extends gi{constructor(e,t={}){super(),this.components=e,this.started=!1,this.transports=new Map,this.listeners=UE({component:"transport-manager",metric:"listeners",metrics:this.components.metrics}),this.faultTolerance=t.faultTolerance??Oa.FATAL_ALL}add(e){const t=e[Symbol.toStringTag];if(null==t)throw se(new Error("Transport must have a valid tag"),_e.ERR_INVALID_KEY);if(this.transports.has(t))throw se(new Error("There is already a transport with this tag"),_e.ERR_DUPLICATE_TRANSPORT);Ma("adding transport %s",t),this.transports.set(t,e),this.listeners.has(t)||this.listeners.set(t,[])}isStarted(){return this.started}start(){var e=this;return $(function*(){const t=e.components.addressManager.getListenAddrs();yield e.listen(t),e.started=!0})()}stop(){var e=this;return $(function*(){const t=[];for(const[r,i]of e.listeners)for(Ma("closing listeners for %s",r);i.length>0;){const s=i.pop();null!=s&&t.push(s.close())}yield Promise.all(t),Ma("all listeners closed");for(const r of e.listeners.keys())e.listeners.set(r,[]);e.started=!1})()}dial(e,t){var r=this;return $(function*(){const i=r.transportForMultiaddr(e);if(null==i)throw se(new Error(`No transport available for address ${String(e)}`),_e.ERR_TRANSPORT_UNAVAILABLE);try{return yield i.dial(e,{...t,upgrader:r.components.upgrader})}catch(s){throw null==s.code&&(s.code=_e.ERR_TRANSPORT_DIAL_FAILED),s}})()}getAddrs(){let e=[];for(const t of this.listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return Array.of(...this.transports.values())}transportForMultiaddr(e){for(const t of this.transports.values())if(t.filter([e]).length>0)return t}listen(e){var t=this;return $(function*(){if(null==e||0===e.length)return void Ma("no addresses were provided for listening, this node is dial only");const r=[];for(const[i,s]of t.transports.entries()){const o=s.filter(e),a=[];for(const x of o){Ma("creating listener for %s on %s",i,x);const P=s.createListener({upgrader:t.components.upgrader});let B=t.listeners.get(i);null==B&&(B=[],t.listeners.set(i,B)),B.push(P),P.addEventListener("listening",()=>{t.dispatchEvent(new zt("listener:listening",{detail:P}))}),P.addEventListener("close",()=>{t.dispatchEvent(new zt("listener:close",{detail:P}))}),a.push(P.listen(x))}if(0!==a.length){if(null==(yield aK(a)).find(x=>x.isFulfilled)&&t.faultTolerance!==Oa.NO_FATAL)throw se(new Error(`Transport (${i}) could not listen on any available address`),_e.ERR_NO_VALID_ADDRESSES)}else r.push(i)}if(r.length===t.transports.size){const i=`no valid addresses were provided for transports [${r.join(", ")}]`;if(t.faultTolerance===Oa.FATAL_ALL)throw se(new Error(i),_e.ERR_NO_VALID_ADDRESSES);Ma(`libp2p in dial mode only: ${i}`)}})()}remove(e){var t=this;return $(function*(){Ma("removing %s",e);for(const r of t.listeners.get(e)??[])yield r.close();t.transports.delete(e),t.listeners.delete(e)})()}removeAll(){var e=this;return $(function*(){const t=[];for(const r of e.transports.keys())t.push(e.remove(r));yield Promise.all(t)})()}}var Oa=(()=>(function(n){n[n.FATAL_ALL=0]="FATAL_ALL",n[n.NO_FATAL=1]="NO_FATAL"}(Oa||(Oa={})),Oa))();const Eu="/multistream/1.0.0",fK=Mt("libp2p:mss"),Lx=At("\n");function VE(n){const e=new yr(n,Lx);return ao.single(e)}function rf(n,e,t={}){const r=VE(e);n.push(!0===t.writeBytes?r.subarray():r)}function dK(n,e,t={}){const r=new yr;for(const i of e)r.append(VE(i));n.push(!0===t.writeBytes?r.subarray():r)}function hK(n,e){return HE.apply(this,arguments)}function HE(){return HE=$(function*(n,e){let t=1;const r={[Symbol.asyncIterator]:()=>r,next:(a=$(function*(){return yield n.next(t)}),function(){return a.apply(this,arguments)})};var a;let i=r;null!=e?.signal&&(i=bs(r,e.signal));const o=yield zn(i,ys({onLength:a=>{t=a},maxDataLength:1024}),function(){var a=$(function*(u){return yield Pa(u)});return function(u){return a.apply(this,arguments)}}());if(null==o||0===o.length)throw se(new Error("no buffer returned"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(o.get(o.byteLength-1)!==Lx[0])throw fK.error("Invalid mss message - missing newline - %s",o.subarray()),se(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return o.sublist(0,-1)}),HE.apply(this,arguments)}function cp(n,e){return $E.apply(this,arguments)}function $E(){return $E=$(function*(n,e){return kt((yield hK(n,e)).subarray())}),$E.apply(this,arguments)}const sf=Mt("libp2p:mss:select");function KE(n,e){return GE.apply(this,arguments)}function GE(){return GE=$(function*(n,e,t={}){e=Array.isArray(e)?[...e]:[e];const{reader:r,writer:i,rest:s,stream:o}=Qd(n),a=e.shift();if(null==a)throw new Error("At least one protocol must be specified");sf('select: write ["%s", "%s"]',Eu,a),dK(i,[At(Eu),At(a)],t);let x=yield cp(r,t);if(sf('select: read "%s"',x),x===Eu&&(x=yield cp(r,t),sf('select: read "%s"',x)),x===a)return s(),{stream:o,protocol:a};for(const P of e){sf('select: write "%s"',P),rf(i,At(P),t);const B=yield cp(r,t);if(sf('select: read "%s" for "%s"',B,P),B===P)return s(),{stream:o,protocol:P}}throw s(),se(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}),GE.apply(this,arguments)}const of=Mt("libp2p:mss:handle");function jE(n,e,t){return zE.apply(this,arguments)}function zE(){return zE=$(function*(n,e,t){e=Array.isArray(e)?e:[e];const{writer:r,reader:i,rest:s,stream:o}=Qd(n);for(;;){const a=yield cp(i,t);if(of('read "%s"',a),a!==Eu){if(e.includes(a))return rf(r,At(a),t),of('respond with "%s" for "%s"',a,a),s(),{stream:o,protocol:a};"ls"!==a?(rf(r,At("na"),t),of('respond with "na" for "%s"',a)):(rf(r,new yr(...e.map(u=>VE(At(u)))),t),of('respond with "%s" for %s',e,a))}else of('respond with "%s" for "%s"',Eu,a),rf(r,At(Eu),t)}}),zE.apply(this,arguments)}var Bx=R(344);const Fx=Symbol.for("@libp2p/connection"),pK=Mt("libp2p:connection");class gK{constructor(e){const{remoteAddr:t,remotePeer:r,newStream:i,close:s,getStreams:o,stat:a}=e;this.id=`${parseInt(String(1e9*Math.random())).toString(36)}${Date.now()}`,this.remoteAddr=t,this.remotePeer=r,this.stat={...a,status:"OPEN"},this._newStream=i,this._close=s,this._getStreams=o,this.tags=[],this._closing=!1}get[Symbol.toStringTag](){return"Connection"}get[Fx](){return!0}get streams(){return this._getStreams()}newStream(e,t){var r=this;return $(function*(){if(r.stat.status===px)throw se(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(r.stat.status===fE)throw se(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const i=yield r._newStream(e,t);return i.stat.direction="outbound",i})()}addStream(e){e.stat.direction="inbound"}removeStream(e){}close(){var e=this;return $(function*(){if(e.stat.status!==fE&&!e._closing){e.stat.status=px;try{e.streams.forEach(t=>t.close())}catch(t){pK.error(t)}e._closing=!0,yield e._close(),e._closing=!1,e.stat.timeline.close=Date.now(),e.stat.status=fE}})()}}const Ux=Mt("libp2p:registrar");class mK{constructor(e){this.topologies=new Map,this.handlers=new Map,this.components=e,this._onDisconnect=this._onDisconnect.bind(this),this._onProtocolChange=this._onProtocolChange.bind(this),this.components.connectionManager.addEventListener("peer:disconnect",this._onDisconnect),this.components.peerStore.addEventListener("change:protocols",this._onProtocolChange)}getProtocols(){return Array.from(new Set([...this.topologies.keys(),...this.handlers.keys()])).sort()}getHandler(e){const t=this.handlers.get(e);if(null==t)throw se(new Error(`No handler registered for protocol ${e}`),_e.ERR_NO_HANDLER_FOR_PROTOCOL);return t}getTopologies(e){const t=this.topologies.get(e);return null==t?[]:[...t.values()]}handle(e,t,r){var i=this;return $(function*(){if(i.handlers.has(e))throw se(new Error(`Handler already registered for protocol ${e}`),_e.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);const s=Wl.bind({ignoreUndefined:!0})({maxInboundStreams:32,maxOutboundStreams:64},r);i.handlers.set(e,{handler:t,options:s}),yield i.components.peerStore.protoBook.add(i.components.peerId,[e])})()}unhandle(e){var t=this;return $(function*(){const r=Array.isArray(e)?e:[e];r.forEach(i=>{t.handlers.delete(i)}),yield t.components.peerStore.protoBook.remove(t.components.peerId,r)})()}register(e,t){var r=this;return $(function*(){if(!function a7(n){return null!=n&&Boolean(n[Fv])}(t))throw Ux.error("topology must be an instance of interfaces/topology"),se(new Error("topology must be an instance of interfaces/topology"),_e.ERR_INVALID_PARAMETERS);const i=`${(1e9*Math.random()).toString(36)}${Date.now()}`;let s=r.topologies.get(e);return null==s&&(s=new Map,r.topologies.set(e,s)),s.set(i,t),yield t.setRegistrar(r),i})()}unregister(e){for(const[t,r]of this.topologies.entries())r.has(e)&&(r.delete(e),0===r.size&&this.topologies.delete(t))}_onDisconnect(e){const t=e.detail;this.components.peerStore.protoBook.get(t.remotePeer).then(r=>{for(const i of r){const s=this.topologies.get(i);if(null!=s)for(const o of s.values())o.onDisconnect(t.remotePeer)}}).catch(r=>{Ux.error(r)})}_onProtocolChange(e){const{peerId:t,protocols:r,oldProtocols:i}=e.detail,s=i.filter(a=>!r.includes(a)),o=r.filter(a=>!i.includes(a));for(const a of s){const u=this.topologies.get(a);if(null!=u)for(const _ of u.values())_.onDisconnect(t)}for(const a of o){const u=this.topologies.get(a);if(null!=u)for(const _ of u.values()){const x=this.components.connectionManager.getConnections(t)[0];null!=x&&_.onConnect(t,x)}}}}const Un=Mt("libp2p:upgrader");function $x(n,e,t){let r=0;return t.streams.forEach(i=>{i.stat.direction===e&&i.stat.protocol===n&&r++}),r}class _K extends gi{constructor(e,t){super(),this.components=e,this.connectionEncryption=new Map,t.connectionEncryption.forEach(r=>{this.connectionEncryption.set(r.protocol,r)}),this.muxers=new Map,t.muxers.forEach(r=>{this.muxers.set(r.protocol,r)}),this.inboundUpgradeTimeout=t.inboundUpgradeTimeout}upgradeInbound(e){var t=this;return $(function*(){if(!(yield t.components.connectionManager.acceptIncomingConnection(e)))throw se(new Error("connection denied"),_e.ERR_CONNECTION_DENIED);let i,s,o,a,u,_,x;const P=t.components.metrics,B=new Pi.TimeoutController(t.inboundUpgradeTimeout);try{(0,Wr.setMaxListeners)?.(1/0,B.signal)}catch{}try{const U=jo(e,B.signal);if(e.source=U.source,e.sink=U.sink,yield t.components.connectionGater.denyInboundConnection(e))throw se(new Error("The multiaddr connection is blocked by gater.acceptConnection"),_e.ERR_CONNECTION_INTERCEPTED);if(null!=P){({setTarget:_,proxy:x}=Bx());const re=`${(1e9*Math.random()).toString(36)}${Date.now()}`;_({toString:()=>re}),P.trackStream({stream:e,remotePeer:x})}Un("starting the inbound connection upgrade");let W=e;const X=t.components.connectionProtector;null!=X&&(Un("protecting the inbound connection"),W=yield X.protect(e));try{if(({conn:i,remotePeer:s,protocol:u}=yield t._encryptInbound(W)),yield t.components.connectionGater.denyInboundEncryptedConnection(s,{...W,...i}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),_e.ERR_CONNECTION_INTERCEPTED);if(t.muxers.size>0){const re=yield t._multiplexInbound({...W,...i},t.muxers);a=re.muxerFactory,o=re.stream}else o=i}catch(re){throw Un.error("Failed to upgrade inbound connection",re),re}if(yield t.components.connectionGater.denyInboundUpgradedConnection(s,{...W,...i}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),_e.ERR_CONNECTION_INTERCEPTED);return null!=P&&(P.updatePlaceholder(x,s),_(s)),Un("Successfully upgraded inbound connection"),t._createConnection({cryptoProtocol:u,direction:"inbound",maConn:e,upgradedConn:o,muxerFactory:a,remotePeer:s})}finally{t.components.connectionManager.afterUpgradeInbound(),B.clear()}})()}upgradeOutbound(e,t){var r=this;return $(function*(){const i=e.remoteAddr.getPeerId();if(null==i)throw se(new Error("outbound connection must have a peer id"),_e.ERR_INVALID_MULTIADDR);const s=xr(i);if(yield r.components.connectionGater.denyOutboundConnection(s,e))throw se(new Error("The multiaddr connection is blocked by connectionGater.denyOutboundConnection"),_e.ERR_CONNECTION_INTERCEPTED);let o,a,u,_,x,P,B;const U=r.components.metrics;if(null!=U){({setTarget:P,proxy:B}=Bx());const X=`${(1e9*Math.random()).toString(36)}${Date.now()}`;P({toB58String:()=>X}),U.trackStream({stream:e,remotePeer:B})}Un("Starting the outbound connection upgrade");let W=e;if(!0!==t?.skipProtection){const X=r.components.connectionProtector;null!=X&&(W=yield X.protect(e))}try{if(o=W,!0!==t?.skipEncryption){if(({conn:o,remotePeer:a,protocol:_}=yield r._encryptOutbound(W,s)),yield r.components.connectionGater.denyOutboundEncryptedConnection(a,{...W,...o}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),_e.ERR_CONNECTION_INTERCEPTED)}else _="native",a=s;if(u=o,null!=t?.muxerFactory)x=t.muxerFactory;else if(r.muxers.size>0){const X=yield r._multiplexOutbound({...W,...o},r.muxers);x=X.muxerFactory,u=X.stream}}catch(X){throw Un.error("Failed to upgrade outbound connection",X),yield e.close(X),X}if(yield r.components.connectionGater.denyOutboundUpgradedConnection(a,{...W,...o}))throw se(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),_e.ERR_CONNECTION_INTERCEPTED);return null!=U&&(U.updatePlaceholder(B,a),P(a)),Un("Successfully upgraded outbound connection"),r._createConnection({cryptoProtocol:_,direction:"outbound",maConn:e,upgradedConn:u,muxerFactory:x,remotePeer:a})})()}_createConnection(e){var t=this;const{cryptoProtocol:r,direction:i,maConn:s,upgradedConn:o,remotePeer:a,muxerFactory:u}=e;let _,x,P;null!=u&&(_=u.createStreamMuxer({direction:i,onIncomingStream:W=>{null!=P&&Promise.resolve().then($(function*(){const X=t.components.registrar.getProtocols(),{stream:re,protocol:fe}=yield jE(W,X);if(Un("%s: incoming stream opened on %s",i,fe),t.components.metrics?.trackStream({stream:re,remotePeer:a,protocol:fe}),null==P)return;const ae=function vK(n,e){try{const{options:t}=e.getHandler(n);return t.maxInboundStreams}catch(t){if(t.code!==_e.ERR_NO_HANDLER_FOR_PROTOCOL)throw t}return 32}(fe,t.components.registrar);$x(fe,"inbound",P)!==ae?(W.source=re.source,W.sink=re.sink,W.stat.protocol=fe,t.components.peerStore.protoBook.add(a,[fe]).catch(Ue=>Un.error(Ue)),P.addStream(W),t._onStream({connection:P,stream:W,protocol:fe})):W.abort(se(new Error(`Too many inbound protocol streams for protocol "${fe}" - limit ${ae}`),_e.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS))})).catch(X=>{Un.error(X),null==W.stat.timeline.close&&W.close()})},onStreamEnd:W=>{P?.removeStream(W.id)}}),x=function(){var W=$(function*(X,re={}){if(null==_)throw se(new Error("Stream is not multiplexed"),_e.ERR_MUXER_UNAVAILABLE);Un("%s: starting new stream on %s",i,X);const fe=yield _.newStream(),Ie=t.components.metrics;let ae;try{if(null==re.signal){Un("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",X),ae=new Pi.TimeoutController(3e4),re.signal=ae.signal;try{(0,Wr.setMaxListeners)?.(1/0,ae.signal)}catch{}}const{stream:Ce,protocol:Ue}=yield KE(fe,X,re);Ie?.trackStream({stream:Ce,remotePeer:a,protocol:Ue});const xe=function EK(n,e){try{const{options:t}=e.getHandler(n);return t.maxOutboundStreams}catch(t){if(t.code!==_e.ERR_NO_HANDLER_FOR_PROTOCOL)throw t}return 64}(Ue,t.components.registrar);if($x(Ue,"outbound",P)===xe){const lt=se(new Error(`Too many outbound protocol streams for protocol "${Ue}" - limit ${xe}`),_e.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw fe.abort(lt),lt}return t.components.peerStore.protoBook.add(a,[Ue]).catch(lt=>Un.error(lt)),fe.source=Ce.source,fe.sink=Ce.sink,fe.stat.protocol=Ue,fe}catch(Ce){throw Un.error("could not create new stream",Ce),null==fe.stat.timeline.close&&fe.close(),null!=Ce.code?Ce:se(Ce,_e.ERR_UNSUPPORTED_PROTOCOL)}finally{ae?.clear()}});return function(re){return W.apply(this,arguments)}}(),zn(o,_,o).catch(Un.error));const B=s.timeline;s.timeline=new Proxy(B,{set:(...W)=>(null!=P&&"close"===W[1]&&null!=W[2]&&null==B.close&&$(function*(){try{"OPEN"===P.stat.status&&(yield P.close())}catch(X){Un.error(X)}finally{t.dispatchEvent(new zt("connectionEnd",{detail:P}))}})().catch(X=>{Un.error(X)}),Reflect.set(...W))}),s.timeline.upgraded=Date.now();const U=()=>{throw se(new Error("connection is not multiplexed"),_e.ERR_CONNECTION_NOT_MULTIPLEXED)};return P=function yK(n){return new gK(n)}({remoteAddr:s.remoteAddr,remotePeer:a,stat:{status:"OPEN",direction:i,timeline:s.timeline,multiplexer:_?.protocol,encryption:r},newStream:x??U,getStreams:()=>null!=_?_.streams:U(),close:(W=$(function*(){yield s.close(),_?.close()}),function(){return W.apply(this,arguments)})}),this.dispatchEvent(new zt("connection",{detail:P})),P;var W}_onStream(e){const{connection:t,stream:r,protocol:i}=e,{handler:s}=this.components.registrar.getHandler(i);s({connection:t,stream:r})}_encryptInbound(e){var t=this;return $(function*(){const r=Array.from(t.connectionEncryption.keys());Un("handling inbound crypto protocol selection",r);try{const{stream:i,protocol:s}=yield jE(e,r,{writeBytes:!0}),o=t.connectionEncryption.get(s);if(null==o)throw new Error(`no crypto module found for ${s}`);return Un("encrypting inbound connection..."),{...yield o.secureInbound(t.components.peerId,i),protocol:s}}catch(i){throw se(i,_e.ERR_ENCRYPTION_FAILED)}})()}_encryptOutbound(e,t){var r=this;return $(function*(){const i=Array.from(r.connectionEncryption.keys());Un("selecting outbound crypto protocol",i);try{const{stream:s,protocol:o}=yield KE(e,i,{writeBytes:!0}),a=r.connectionEncryption.get(o);if(null==a)throw new Error(`no crypto module found for ${o}`);return Un("encrypting outbound connection to %p",t),{...yield a.secureOutbound(r.components.peerId,s,t),protocol:o}}catch(s){throw se(s,_e.ERR_ENCRYPTION_FAILED)}})()}_multiplexOutbound(e,t){return $(function*(){const r=Array.from(t.keys());Un("outbound selecting muxer %s",r);try{const{stream:i,protocol:s}=yield KE(e,r,{writeBytes:!0});return Un("%s selected as muxer protocol",s),{stream:i,muxerFactory:t.get(s)}}catch(i){throw Un.error("error multiplexing outbound stream",i),se(i,_e.ERR_MUXER_UNAVAILABLE)}})()}_multiplexInbound(e,t){return $(function*(){const r=Array.from(t.keys());Un("inbound handling muxers %s",r);try{const{stream:i,protocol:s}=yield jE(e,r,{writeBytes:!0});return{stream:i,muxerFactory:t.get(s)}}catch(i){throw Un.error("error multiplexing inbound stream",i),se(i,_e.ERR_MUXER_UNAVAILABLE)}})()}}var ka;!function(n){let e;n.codec=()=>(null==e&&(e=Jl((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null!=t.protocolVersion&&(r.uint32(42),r.string(t.protocolVersion)),null!=t.agentVersion&&(r.uint32(50),r.string(t.agentVersion)),null!=t.publicKey&&(r.uint32(10),r.bytes(t.publicKey)),null!=t.listenAddrs)for(const s of t.listenAddrs)r.uint32(18),r.bytes(s);if(null!=t.observedAddr&&(r.uint32(34),r.bytes(t.observedAddr)),null!=t.protocols)for(const s of t.protocols)r.uint32(26),r.string(s);null!=t.signedPeerRecord&&(r.uint32(66),r.bytes(t.signedPeerRecord)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={listenAddrs:[],protocols:[]},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 5:i.protocolVersion=t.string();break;case 6:i.agentVersion=t.string();break;case 1:i.publicKey=t.bytes();break;case 2:i.listenAddrs.push(t.bytes());break;case 4:i.observedAddr=t.bytes();break;case 3:i.protocols.push(t.string());break;case 8:i.signedPeerRecord=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>Zl(t,n.codec()),n.decode=t=>Yl(t,n.codec())}(ka||(ka={}));const Gx="js-libp2p/0.0.0",kn=Mt("libp2p:identify");class WE{constructor(e,t){this.components=e,this.started=!1,this.init=t,this.identifyProtocolStr=`/${t.protocolPrefix}/id/1.0.0`,this.identifyPushProtocolStr=`/${t.protocolPrefix}/id/push/1.0.0`,this.host={protocolVersion:`${t.protocolPrefix}/0.1.0`,...t.host},this.components.connectionManager.addEventListener("peer:connect",r=>{this.identify(r.detail).catch(kn.error)}),this.components.peerStore.addEventListener("change:multiaddrs",r=>{const{peerId:i}=r.detail;this.components.peerId.equals(i)&&this.pushToPeerStore().catch(s=>kn.error(s))}),this.components.peerStore.addEventListener("change:protocols",r=>{const{peerId:i}=r.detail;this.components.peerId.equals(i)&&this.pushToPeerStore().catch(s=>kn.error(s))})}isStarted(){return this.started}start(){var e=this;return $(function*(){e.started||(yield e.components.peerStore.metadataBook.setValue(e.components.peerId,"AgentVersion",At(e.host.agentVersion)),yield e.components.peerStore.metadataBook.setValue(e.components.peerId,"ProtocolVersion",At(e.host.protocolVersion)),yield e.components.registrar.handle(e.identifyProtocolStr,t=>{e._handleIdentify(t).catch(r=>{kn.error(r)})},{maxInboundStreams:e.init.maxInboundStreams,maxOutboundStreams:e.init.maxOutboundStreams}),yield e.components.registrar.handle(e.identifyPushProtocolStr,t=>{e._handlePush(t).catch(r=>{kn.error(r)})},{maxInboundStreams:e.init.maxPushIncomingStreams,maxOutboundStreams:e.init.maxPushOutgoingStreams}),e.started=!0)})()}stop(){var e=this;return $(function*(){yield e.components.registrar.unhandle(e.identifyProtocolStr),yield e.components.registrar.unhandle(e.identifyPushProtocolStr),e.started=!1})()}push(e){var t=this;return $(function*(){const r=yield t.components.peerStore.addressBook.getRawEnvelope(t.components.peerId),i=t.components.addressManager.getAddresses().map(a=>a.bytes),s=yield t.components.peerStore.protoBook.get(t.components.peerId),o=e.map(function(){var a=$(function*(u){let _;const x=new Pi.TimeoutController(t.init.timeout);try{(0,Wr.setMaxListeners)?.(1/0,x.signal)}catch{}try{_=yield u.newStream([t.identifyPushProtocolStr],{signal:x.signal}),yield jo(_,x.signal).sink(zn([ka.encode({listenAddrs:i,signedPeerRecord:r,protocols:s})],ao()))}catch(P){kn.error("could not push identify update to peer",P)}finally{_?.close(),x.clear()}});return function(u){return a.apply(this,arguments)}}());yield Promise.all(o)})()}pushToPeerStore(){var e=this;return $(function*(){if(!e.isStarted())return;const t=[];for(const r of e.components.connectionManager.getConnections()){const i=r.remotePeer;!(yield e.components.peerStore.get(i)).protocols.includes(e.identifyPushProtocolStr)||t.push(r)}yield e.push(t)})()}_identify(e,t={}){var r=this;return $(function*(){let i,o,s=t.signal;if(null==s){i=new Pi.TimeoutController(r.init.timeout),s=i.signal;try{(0,Wr.setMaxListeners)?.(1/0,i.signal)}catch{}}try{o=yield e.newStream([r.identifyProtocolStr],{signal:s});const a=jo(o,s),u=yield zn([],a,ys({maxDataLength:r.init.maxIdentifyMessageSize??8192}),function(){var _=$(function*(x){return yield Pa(x)});return function(x){return _.apply(this,arguments)}}());if(null==u)throw se(new Error("No data could be retrieved"),_e.ERR_CONNECTION_ENDED);try{return ka.decode(u)}catch(_){throw se(_,_e.ERR_INVALID_MESSAGE)}}finally{i?.clear(),o?.close()}})()}identify(e,t={}){var r=this;return $(function*(){const i=yield r._identify(e,t),{publicKey:s,listenAddrs:o,protocols:a,observedAddr:u,signedPeerRecord:_,agentVersion:x,protocolVersion:P}=i;if(null==s)throw se(new Error("public key was missing from identify message"),_e.ERR_MISSING_PUBLIC_KEY);const B=yield kl(s);if(!e.remotePeer.equals(B))throw se(new Error("identified peer does not match the expected peer"),_e.ERR_INVALID_PEER);if(r.components.peerId.equals(B))throw se(new Error("identified peer is our own peer id?"),_e.ERR_INVALID_PEER);const U=WE.getCleanMultiaddr(u);if(null!=_){kn("received signed peer record from %p",B);try{const W=yield yi.openAndCertify(_,lu.DOMAIN);if(!W.peerId.equals(B))throw se(new Error("identified peer does not match the expected peer"),_e.ERR_INVALID_PEER);if(yield r.components.peerStore.addressBook.consumePeerRecord(W))return yield r.components.peerStore.protoBook.set(B,a),null!=x&&(yield r.components.peerStore.metadataBook.setValue(B,"AgentVersion",At(x))),null!=P&&(yield r.components.peerStore.metadataBook.setValue(B,"ProtocolVersion",At(P))),void kn("identify completed for peer %p and protocols %o",B,a)}catch(W){kn("received invalid envelope, discard it and fallback to listenAddrs is available",W)}}else kn("no signed peer record received from %p",B);kn("falling back to legacy addresses from %p",B);try{yield r.components.peerStore.addressBook.set(B,o.map(W=>Cn(W)))}catch(W){kn.error("received invalid addrs",W)}yield r.components.peerStore.protoBook.set(B,a),null!=x&&(yield r.components.peerStore.metadataBook.setValue(B,"AgentVersion",At(x))),null!=P&&(yield r.components.peerStore.metadataBook.setValue(B,"ProtocolVersion",At(P))),kn("identify completed for peer %p and protocols %o",B,a),kn("received observed address of %s",U?.toString())})()}_handleIdentify(e){var t=this;return $(function*(){const{connection:r,stream:i}=e,s=new Pi.TimeoutController(t.init.timeout);try{(0,Wr.setMaxListeners)?.(1/0,s.signal)}catch{}try{const o=t.components.peerId.publicKey??new Uint8Array(0),a=yield t.components.peerStore.get(t.components.peerId),u=t.components.addressManager.getAddresses().map(U=>U.decapsulateCode(vr("p2p").code));let _=a.peerRecordEnvelope;if(u.length>0&&null==_){const U=new lu({peerId:t.components.peerId,multiaddrs:u}),W=yield yi.seal(U,t.components.peerId);yield t.components.peerStore.addressBook.consumePeerRecord(W),_=W.marshal().subarray()}const x=ka.encode({protocolVersion:t.host.protocolVersion,agentVersion:t.host.agentVersion,publicKey:o,listenAddrs:u.map(U=>U.bytes),signedPeerRecord:_,observedAddr:r.remoteAddr.bytes,protocols:a.protocols}),P=jo(i,s.signal),B=zn([x],ao());yield P.sink(B)}catch(o){kn.error("could not respond to identify request",o)}finally{i.close(),s.clear()}})()}_handlePush(e){var t=this;return $(function*(){const{connection:r,stream:i}=e,s=new Pi.TimeoutController(t.init.timeout);try{(0,Wr.setMaxListeners)?.(1/0,s.signal)}catch{}let o;try{const u=jo(i,s.signal),_=yield zn([],u,ys({maxDataLength:t.init.maxIdentifyMessageSize??8192}),function(){var x=$(function*(P){return yield Pa(P)});return function(P){return x.apply(this,arguments)}}());null!=_&&(o=ka.decode(_))}catch(u){return kn.error("received invalid message",u)}finally{i.close(),s.clear()}if(null==o)return kn.error("received invalid message");const a=r.remotePeer;if(t.components.peerId.equals(a))kn("received push from ourselves?");else{if(kn("received push from %p",a),null!=o.signedPeerRecord){kn("received signedPeerRecord in push");try{const u=yield yi.openAndCertify(o.signedPeerRecord,lu.DOMAIN);if(yield t.components.peerStore.addressBook.consumePeerRecord(u))return kn("consumed signedPeerRecord sent in push"),void(yield t.components.peerStore.protoBook.set(a,o.protocols));kn("failed to consume signedPeerRecord sent in push")}catch(u){kn("received invalid envelope, discard it and fallback to listenAddrs is available",u)}}else kn("did not receive signedPeerRecord in push");try{yield t.components.peerStore.addressBook.set(a,o.listenAddrs.map(u=>Cn(u)))}catch(u){kn.error("received invalid addrs",u)}try{yield t.components.peerStore.protoBook.set(a,o.protocols)}catch(u){kn.error("received invalid protocols",u)}kn("handled push from %p",a)}})()}static getCleanMultiaddr(e){if(null!=e&&e.length>0)try{return Cn(e)}catch{}}}var up,Hs;!function(n){let e;n.codec=()=>(null==e&&(e=Jl((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),(!0===i.writeDefaults||""!==t.identifier)&&(r.uint32(10),r.string(t.identifier)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={identifier:""},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();o>>>3==1?i.identifier=t.string():t.skipType(7&o)}return i})),e),n.encode=t=>Zl(t,n.codec()),n.decode=t=>Yl(t,n.codec())}(up||(up={})),function(n){let e;var i;let t,r;(i=e=n.StatusCode||(n.StatusCode={})).OK="OK",i.NOT_FOUND="NOT_FOUND",i.ERROR="ERROR",function(i){i[i.OK=0]="OK",i[i.NOT_FOUND=1]="NOT_FOUND",i[i.ERROR=2]="ERROR"}(t||(t={})),function(i){i.codec=()=>_E(t)}(e=n.StatusCode||(n.StatusCode={})),n.codec=()=>(null==r&&(r=Jl((i,s,o={})=>{!1!==o.lengthDelimited&&s.fork(),(!0===o.writeDefaults||null!=i.status&&0!==t[i.status])&&(s.uint32(8),n.StatusCode.codec().encode(i.status,s)),(!0===o.writeDefaults||null!=i.data&&i.data.byteLength>0)&&(s.uint32(18),s.bytes(i.data)),!1!==o.lengthDelimited&&s.ldelim()},(i,s)=>{const o={status:e.OK,data:new Uint8Array(0)},a=null==s?i.len:i.pos+s;for(;i.pos<a;){const u=i.uint32();switch(u>>>3){case 1:o.status=n.StatusCode.codec().decode(i);break;case 2:o.data=i.bytes();break;default:i.skipType(7&u)}}return o})),r),n.encode=i=>Zl(i,n.codec()),n.decode=i=>Yl(i,n.codec())}(Hs||(Hs={}));const zx=Mt("libp2p:fetch");class PK{constructor(e,t){this.started=!1,this.components=e,this.protocol=`/${t.protocolPrefix??"libp2p"}/fetch/0.0.1`,this.lookupFunctions=new Map,this.handleMessage=this.handleMessage.bind(this),this.init=t}start(){var e=this;return $(function*(){yield e.components.registrar.handle(e.protocol,t=>{e.handleMessage(t).catch(r=>{zx.error(r)}).finally(()=>{t.stream.close()})},{maxInboundStreams:e.init.maxInboundStreams,maxOutboundStreams:e.init.maxOutboundStreams}),e.started=!0})()}stop(){var e=this;return $(function*(){yield e.components.registrar.unhandle(e.protocol),e.started=!1})()}isStarted(){return this.started}fetch(e,t,r={}){var i=this;return $(function*(){zx("dialing %s to %p",i.protocol,e);const s=yield i.components.connectionManager.openConnection(e,r);let o,u,a=r.signal;if(null==a){o=new Pi.TimeoutController(i.init.timeout),a=o.signal;try{(0,Wr.setMaxListeners)?.(1/0,o.signal)}catch{}}try{u=yield s.newStream([i.protocol],{signal:a});const _=jo(u,a);return(yield zn([up.encode({identifier:t})],ao(),_,ys(),function(){var P=$(function*(B){const U=yield Pa(B);if(null==U)throw se(new Error("No data received"),_e.ERR_INVALID_MESSAGE);const W=Hs.decode(U);switch(W.status){case Hs.StatusCode.OK:return W.data;case Hs.StatusCode.NOT_FOUND:return null;case Hs.StatusCode.ERROR:{const X=(new TextDecoder).decode(W.data);throw se(new Error("Error in fetch protocol response: "+X),_e.ERR_INVALID_PARAMETERS)}default:throw se(new Error("Unknown response status"),_e.ERR_INVALID_MESSAGE)}});return function(B){return P.apply(this,arguments)}}()))??null}finally{o?.clear(),u?.close()}})()}handleMessage(e){var t=this;return $(function*(){const{stream:r}=e,i=t;yield zn(r,ys(),function(){var s=Vt(function*(o){const a=yield qe(Pa(o));if(null==a)throw se(new Error("No data received"),_e.ERR_INVALID_MESSAGE);const u=up.decode(a);let _;const x=i._getLookupFunction(u.identifier);if(null!=x){const P=yield qe(x(u.identifier));_=null!=P?{status:Hs.StatusCode.OK,data:P}:{status:Hs.StatusCode.NOT_FOUND,data:new Uint8Array(0)}}else{const P=(new TextEncoder).encode("No lookup function registered for key: "+u.identifier);_={status:Hs.StatusCode.ERROR,data:P}}yield Hs.encode(_)});return function(o){return s.apply(this,arguments)}}(),ao(),r)})()}_getLookupFunction(e){for(const t of this.lookupFunctions.keys())if(e.startsWith(t))return this.lookupFunctions.get(t)}registerLookupFunction(e,t){if(this.lookupFunctions.has(e))throw se(new Error("Fetch protocol handler for key prefix '"+e+"' already registered"),_e.ERR_KEY_ALREADY_EXISTS);this.lookupFunctions.set(e,t)}unregisterLookupFunction(e,t){null!=t&&this.lookupFunctions.get(e)!==t||this.lookupFunctions.delete(e)}}const Wx=Mt("libp2p:ping");class kK{constructor(e,t){this.components=e,this.started=!1,this.protocol=`/${t.protocolPrefix}/ping/1.0.0`,this.init=t}start(){var e=this;return $(function*(){yield e.components.registrar.handle(e.protocol,e.handleMessage,{maxInboundStreams:e.init.maxInboundStreams,maxOutboundStreams:e.init.maxOutboundStreams}),e.started=!0})()}stop(){var e=this;return $(function*(){yield e.components.registrar.unhandle(e.protocol),e.started=!1})()}isStarted(){return this.started}handleMessage(e){const{stream:t}=e;zn(t,t).catch(r=>{Wx.error(r)})}ping(e,t={}){var r=this;return $(function*(){Wx("dialing %s to %p",r.protocol,e);const i=Date.now(),s=ph(32),o=yield r.components.connectionManager.openConnection(e,t);let a,_,u=t.signal;if(null==u){a=new Pi.TimeoutController(r.init.timeout),u=a.signal;try{(0,Wr.setMaxListeners)?.(1/0,a.signal)}catch{}}try{_=yield o.newStream([r.protocol],{signal:u});const x=jo(_,u),P=yield zn([s],x,function(){var U=$(function*(W){return yield Pa(W)});return function(W){return U.apply(this,arguments)}}()),B=Date.now();if(null==P||!Or(s,P.subarray()))throw se(new Error("Received wrong ping ack"),_e.ERR_WRONG_PING_ACK);return B-i}finally{a?.clear(),_?.close()}})()}}function qE(){return(qE=$(function*(){throw new Error("Not supported in browsers")})).apply(this,arguments)}var BK=R(3915);function UK(n){const{address:e}=n.nodeAddress();return function FK(n){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(n)||/^::1$/.test(n)}(e)}const YE=Mt("libp2p:nat");function VK(n=1024,e=65535){return Math.floor(Math.random()*(e-n+1)+n)}class HK{constructor(e,t){if(this.components=e,this.started=!1,this.enabled=t.enabled,this.externalAddress=t.externalAddress,this.localAddress=t.localAddress,this.description=t.description??`libp2p@0.0.0 ${this.components.peerId.toString()}`,this.ttl=t.ttl??7200,this.keepAlive=t.keepAlive??!0,this.gateway=t.gateway,this.ttl<7200)throw se(new Error("NatManager ttl should be at least 7200 seconds"),_e.ERR_INVALID_PARAMETERS)}isStarted(){return this.started}start(){}afterStart(){Nh||!this.enabled||this.started||(this.started=!0,this._start().catch(e=>{YE.error(e)}))}_start(){var e=this;return $(function*(){const t=e.components.transportManager.getAddrs();for(const r of t){const{family:i,host:s,port:o,transport:a}=r.toOptions();if(!r.isThinWaistAddress()||"tcp"!==a||UK(r)||4!==i)continue;const u=yield e._getClient(),_=e.externalAddress??(yield u.externalIp());if(BK(_))throw new Error(`${_} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`);const x=VK();YE(`opening uPnP connection from ${_}:${x} to ${s}:${o}`),yield u.map({publicPort:x,localPort:o,localAddress:e.localAddress,protocol:"TCP"===a.toUpperCase()?"TCP":"UDP"}),e.components.addressManager.addObservedAddr(sV({family:4,address:_,port:x},a))}})()}_getClient(){var e=this;return $(function*(){return null!=e.client||(e.client=yield function LK(){return qE.apply(this,arguments)}({description:e.description,ttl:e.ttl,keepAlive:e.keepAlive,gateway:e.gateway})),e.client})()}stop(){var e=this;return $(function*(){if(!Nh&&null!=e.client)try{yield e.client.close(),e.client=void 0}catch(t){YE.error(t)}})()}}const $K=Mt("libp2p:peer-record-updater");class KK{constructor(e){this.components=e,this.started=!1,this.update=this.update.bind(this)}isStarted(){return this.started}start(){var e=this;return $(function*(){e.started=!0,e.components.transportManager.addEventListener("listener:listening",e.update),e.components.transportManager.addEventListener("listener:close",e.update),e.components.addressManager.addEventListener("change:addresses",e.update)})()}stop(){var e=this;return $(function*(){e.started=!1,e.components.transportManager.removeEventListener("listener:listening",e.update),e.components.transportManager.removeEventListener("listener:close",e.update),e.components.addressManager.removeEventListener("change:addresses",e.update)})()}update(){var e=this;Promise.resolve().then($(function*(){const t=new lu({peerId:e.components.peerId,multiaddrs:e.components.addressManager.getAddresses().map(i=>i.decapsulateCode(vr("p2p").code))}),r=yield yi.seal(t,e.components.peerId);yield e.components.peerStore.addressBook.consumePeerRecord(r)})).catch(t=>{$K.error("Could not update self peer record: %o",t)})}}class GK{constructor(e){this.dht=e}findPeer(e,t={}){var r=this;return $(function*(){var o,i=!1,s=!1;try{for(var u,a=ut(r.dht.findPeer(e,t));i=!(u=yield a.next()).done;i=!1){const _=u.value;if("FINAL_PEER"===_.name)return _.peer}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}throw se(new Error(ln.NOT_FOUND),_e.ERR_NOT_FOUND)})()}getClosestPeers(e,t={}){var r=this;return Vt(function*(){var o,i=!1,s=!1;try{for(var u,a=ut(r.dht.getClosestPeers(e,t));i=!(u=yield qe(a.next())).done;i=!1){const _=u.value;"FINAL_PEER"===_.name&&(yield _.peer)}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}})()}}function jK(n){return XE.apply(this,arguments)}function XE(){return XE=$(function*(n){const e=[];var i,t=!1,r=!1;try{for(var o,s=ut(n);t=!(o=yield s.next()).done;t=!1)e.push(o.value)}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield s.return())}finally{if(r)throw i}}return e}),XE.apply(this,arguments)}const xn=Mt("libp2p:peer-store:address-book"),fp="change:multiaddrs";function zK(){return JE.apply(this,arguments)}function JE(){return(JE=$(function*(){return!0})).apply(this,arguments)}class WK{constructor(e,t,r){this.dispatchEvent=e,this.store=t,this.addressFilter=r??zK}consumePeerRecord(e){var t=this;return $(function*(){xn.trace("consumePeerRecord await write lock");const r=yield t.store.lock.writeLock();let i,s,o;xn.trace("consumePeerRecord got write lock");try{let a;try{a=lu.createFromProtobuf(e.payload)}catch{return xn.error("invalid peer record received"),!1}i=a.peerId;const u=a.multiaddrs;if(!i.equals(e.peerId))return xn("signing key does not match PeerId in the PeerRecord"),!1;if(null==u||0===u.length)return!1;if((yield t.store.has(i))&&(s=yield t.store.load(i),null!=s.peerRecordEnvelope)){const x=yield yi.createFromProtobuf(s.peerRecordEnvelope),P=lu.createFromProtobuf(x.payload);if(P.seqNumber>=a.seqNumber)return xn("sequence number was lower or equal to existing sequence number - stored: %d received: %d",P.seqNumber,a.seqNumber),!1}const _=yield e_(i,u,t.addressFilter,!0);o=yield t.store.patchOrCreate(i,{addresses:_,peerRecordEnvelope:e.marshal().subarray()}),xn("stored provided peer record for %p",a.peerId)}finally{xn.trace("consumePeerRecord release write lock"),r()}return t.dispatchEvent(new zt(fp,{detail:{peerId:i,multiaddrs:o.addresses.map(({multiaddr:a})=>a),oldMultiaddrs:null==s?[]:s.addresses.map(({multiaddr:a})=>a)}})),!0})()}getRawEnvelope(e){var t=this;return $(function*(){xn.trace("getRawEnvelope await read lock");const r=yield t.store.lock.readLock();xn.trace("getRawEnvelope got read lock");try{return(yield t.store.load(e)).peerRecordEnvelope}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{xn.trace("getRawEnvelope release read lock"),r()}})()}getPeerRecord(e){var t=this;return $(function*(){const r=yield t.getRawEnvelope(e);if(null!=r)return yield yi.createFromProtobuf(r)})()}get(e){var t=this;return $(function*(){e=Lr(e),xn.trace("get wait for read lock");const r=yield t.store.lock.readLock();xn.trace("get got read lock");try{return(yield t.store.load(e)).addresses}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{xn.trace("get release read lock"),r()}return[]})()}set(e,t){var r=this;return $(function*(){if(e=Lr(e),!Array.isArray(t))throw xn.error("multiaddrs must be an array of Multiaddrs"),se(new Error("multiaddrs must be an array of Multiaddrs"),"ERR_INVALID_PARAMETERS");xn.trace("set await write lock");const i=yield r.store.lock.writeLock();xn.trace("set got write lock");let o,a,s=!1;try{const u=yield e_(e,t,r.addressFilter);if(0===u.length)return;try{if(o=yield r.store.load(e),s=!0,new Set([...u.map(({multiaddr:_})=>_.toString()),...o.addresses.map(({multiaddr:_})=>_.toString())]).size===o.addresses.length&&u.length===o.addresses.length)return}catch(_){if("ERR_NOT_FOUND"!==_.code)throw _}a=yield r.store.patchOrCreate(e,{addresses:u}),xn("set multiaddrs for %p",e)}finally{xn.trace("set multiaddrs for %p",e),xn("set release write lock"),i()}r.dispatchEvent(new zt(fp,{detail:{peerId:e,multiaddrs:a.addresses.map(u=>u.multiaddr),oldMultiaddrs:null==o?[]:o.addresses.map(({multiaddr:u})=>u)}})),s||r.dispatchEvent(new zt("peer",{detail:{id:e,multiaddrs:a.addresses.map(u=>u.multiaddr),protocols:a.protocols}}))})()}add(e,t){var r=this;return $(function*(){if(e=Lr(e),!Array.isArray(t))throw xn.error("multiaddrs must be an array of Multiaddrs"),se(new Error("multiaddrs must be an array of Multiaddrs"),"ERR_INVALID_PARAMETERS");xn.trace("add await write lock");const i=yield r.store.lock.writeLock();let s,o,a;xn.trace("add got write lock");try{const u=yield e_(e,t,r.addressFilter);if(0===u.length)return;try{if(o=yield r.store.load(e),s=!0,new Set([...u.map(({multiaddr:_})=>_.toString()),...o.addresses.map(({multiaddr:_})=>_.toString())]).size===o.addresses.length)return}catch(_){if("ERR_NOT_FOUND"!==_.code)throw _}a=yield r.store.mergeOrCreate(e,{addresses:u}),xn("added multiaddrs for %p",e)}finally{xn.trace("set release write lock"),i()}r.dispatchEvent(new zt(fp,{detail:{peerId:e,multiaddrs:a.addresses.map(u=>u.multiaddr),oldMultiaddrs:null==o?[]:o.addresses.map(({multiaddr:u})=>u)}})),!0===s&&r.dispatchEvent(new zt("peer",{detail:{id:e,multiaddrs:a.addresses.map(u=>u.multiaddr),protocols:a.protocols}}))})()}delete(e){var t=this;return $(function*(){e=Lr(e),xn.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;xn.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}yield t.store.patchOrCreate(e,{addresses:[]})}finally{xn.trace("delete release write lock"),r()}null!=i&&t.dispatchEvent(new zt(fp,{detail:{peerId:e,multiaddrs:[],oldMultiaddrs:null==i?[]:i.addresses.map(({multiaddr:s})=>s)}}))})()}}function e_(n,e,t){return t_.apply(this,arguments)}function t_(){return t_=$(function*(n,e,t,r=!1){return yield zn(e,i=>ME(i,s=>{if(!Ch(s))throw xn.error("multiaddr must be an instance of Multiaddr"),se(new Error("multiaddr must be an instance of Multiaddr"),"ERR_INVALID_PARAMETERS")}),i=>Xi(i,function(){var s=$(function*(o){return yield t(n,o)});return function(o){return s.apply(this,arguments)}}()),i=>sE(i,s=>({multiaddr:s,isCertified:r})),function(){var i=$(function*(s){return yield jK(s)});return function(s){return i.apply(this,arguments)}}())}),t_.apply(this,arguments)}const $s=Mt("libp2p:peer-store:key-book"),qx="change:pubkey";class qK{constructor(e,t){this.dispatchEvent=e,this.store=t}set(e,t){var r=this;return $(function*(){if(e=Lr(e),!(t instanceof Uint8Array))throw $s.error("publicKey must be an instance of Uint8Array to store data"),se(new Error("publicKey must be an instance of PublicKey"),"ERR_INVALID_PARAMETERS");$s.trace("set await write lock");const i=yield r.store.lock.writeLock();$s.trace("set got write lock");let o,s=!1;try{try{if(o=yield r.store.load(e),null!=o.pubKey&&Or(o.pubKey,t))return}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}yield r.store.patchOrCreate(e,{pubKey:t}),s=!0}finally{$s.trace("set release write lock"),i()}s&&r.dispatchEvent(new zt(qx,{detail:{peerId:e,publicKey:t,oldPublicKey:o?.pubKey}}))})()}get(e){var t=this;return $(function*(){e=Lr(e),$s.trace("get await write lock");const r=yield t.store.lock.readLock();$s.trace("get got write lock");try{return(yield t.store.load(e)).pubKey}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{$s("get release write lock"),r()}})()}delete(e){var t=this;return $(function*(){e=Lr(e),$s.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;$s.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}yield t.store.patchOrCreate(e,{pubKey:void 0})}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}finally{$s.trace("delete release write lock"),r()}t.dispatchEvent(new zt(qx,{detail:{peerId:e,publicKey:void 0,oldPublicKey:i?.pubKey}}))})()}}const br=Mt("libp2p:peer-store:metadata-book"),dp="change:metadata";class QK{constructor(e,t){this.dispatchEvent=e,this.store=t}get(e){var t=this;return $(function*(){e=Lr(e),br.trace("get await read lock");const r=yield t.store.lock.readLock();br.trace("get got read lock");try{return(yield t.store.load(e)).metadata}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{br.trace("get release read lock"),r()}return new Map})()}getValue(e,t){var r=this;return $(function*(){e=Lr(e),br.trace("getValue await read lock");const i=yield r.store.lock.readLock();br.trace("getValue got read lock");try{return(yield r.store.load(e)).metadata.get(t)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}finally{br.trace("getValue release write lock"),i()}})()}set(e,t){var r=this;return $(function*(){if(e=Lr(e),!(t instanceof Map))throw br.error("valid metadata must be provided to store data"),se(new Error("valid metadata must be provided"),"ERR_INVALID_PARAMETERS");br.trace("set await write lock");const i=yield r.store.lock.writeLock();let s;br.trace("set got write lock");try{try{s=yield r.store.load(e)}catch(o){if("ERR_NOT_FOUND"!==o.code)throw o}yield r.store.mergeOrCreate(e,{metadata:t})}finally{br.trace("set release write lock"),i()}r.dispatchEvent(new zt(dp,{detail:{peerId:e,metadata:t,oldMetadata:null==s?new Map:s.metadata}}))})()}setValue(e,t,r){var i=this;return $(function*(){if(e=Lr(e),"string"!=typeof t||!(r instanceof Uint8Array))throw br.error("valid key and value must be provided to store data"),se(new Error("valid key and value must be provided"),"ERR_INVALID_PARAMETERS");br.trace("setValue await write lock");const s=yield i.store.lock.writeLock();let o,a;br.trace("setValue got write lock");try{try{o=yield i.store.load(e);const u=o.metadata.get(t);if(null!=u&&Or(r,u))return}catch(u){if("ERR_NOT_FOUND"!==u.code)throw u}a=yield i.store.mergeOrCreate(e,{metadata:new Map([[t,r]])})}finally{br.trace("setValue release write lock"),s()}i.dispatchEvent(new zt(dp,{detail:{peerId:e,metadata:a.metadata,oldMetadata:null==o?new Map:o.metadata}}))})()}delete(e){var t=this;return $(function*(){e=Lr(e),br.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;br.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}null!=i&&(yield t.store.patch(e,{metadata:new Map}))}finally{br.trace("delete release write lock"),r()}null!=i&&t.dispatchEvent(new zt(dp,{detail:{peerId:e,metadata:new Map,oldMetadata:i.metadata}}))})()}deleteValue(e,t){var r=this;return $(function*(){e=Lr(e),br.trace("deleteValue await write lock");const i=yield r.store.lock.writeLock();let s,o;br.trace("deleteValue got write lock");try{o=yield r.store.load(e),s=o.metadata,s.delete(t),yield r.store.patch(e,{metadata:s})}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}finally{br.trace("deleteValue release write lock"),i()}null!=s&&r.dispatchEvent(new zt(dp,{detail:{peerId:e,metadata:s,oldMetadata:null==o?new Map:o.metadata}}))})()}}const wr=Mt("libp2p:peer-store:proto-book"),hp="change:protocols";class YK{constructor(e,t){this.dispatchEvent=e,this.store=t}get(e){var t=this;return $(function*(){wr.trace("get wait for read lock");const r=yield t.store.lock.readLock();wr.trace("get got read lock");try{return(yield t.store.load(e)).protocols}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}finally{wr.trace("get release read lock"),r()}return[]})()}set(e,t){var r=this;return $(function*(){if(e=Lr(e),!Array.isArray(t))throw wr.error("protocols must be provided to store data"),se(new Error("protocols must be provided"),"ERR_INVALID_PARAMETERS");wr.trace("set await write lock");const i=yield r.store.lock.writeLock();let s,o;wr.trace("set got write lock");try{try{if(s=yield r.store.load(e),new Set([...t]).size===s.protocols.length)return}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}o=yield r.store.patchOrCreate(e,{protocols:t}),wr("stored provided protocols for %p",e)}finally{wr.trace("set release write lock"),i()}r.dispatchEvent(new zt(hp,{detail:{peerId:e,protocols:o.protocols,oldProtocols:null==s?[]:s.protocols}}))})()}add(e,t){var r=this;return $(function*(){if(e=Lr(e),!Array.isArray(t))throw wr.error("protocols must be provided to store data"),se(new Error("protocols must be provided"),"ERR_INVALID_PARAMETERS");wr.trace("add await write lock");const i=yield r.store.lock.writeLock();let s,o;wr.trace("add got write lock");try{try{if(s=yield r.store.load(e),new Set([...s.protocols,...t]).size===s.protocols.length)return}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}o=yield r.store.mergeOrCreate(e,{protocols:t}),wr("added provided protocols for %p",e)}finally{wr.trace("add release write lock"),i()}r.dispatchEvent(new zt(hp,{detail:{peerId:e,protocols:o.protocols,oldProtocols:null==s?[]:s.protocols}}))})()}remove(e,t){var r=this;return $(function*(){if(e=Lr(e),!Array.isArray(t))throw wr.error("protocols must be provided to store data"),se(new Error("protocols must be provided"),"ERR_INVALID_PARAMETERS");wr.trace("remove await write lock");const i=yield r.store.lock.writeLock();let s,o;wr.trace("remove got write lock");try{try{s=yield r.store.load(e);const a=new Set(s.protocols);for(const u of t)a.delete(u);if(s.protocols.length===a.size)return;t=Array.from(a)}catch(a){if("ERR_NOT_FOUND"!==a.code)throw a}o=yield r.store.patchOrCreate(e,{protocols:t})}finally{wr.trace("remove release write lock"),i()}r.dispatchEvent(new zt(hp,{detail:{peerId:e,protocols:o.protocols,oldProtocols:null==s?[]:s.protocols}}))})()}delete(e){var t=this;return $(function*(){e=Lr(e),wr.trace("delete await write lock");const r=yield t.store.lock.writeLock();let i;wr.trace("delete got write lock");try{try{i=yield t.store.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}yield t.store.patchOrCreate(e,{protocols:[]})}finally{wr.trace("delete release write lock"),r()}null!=i&&t.dispatchEvent(new zt(hp,{detail:{peerId:e,protocols:[],oldProtocols:i.protocols}}))})()}}!function ZK(){Mc._configure(),Gi._configure(Pc),ji._configure(Nc)}();const Qx=["uint64","int64","sint64","fixed64","sfixed64"];function af(n,e){const t=function JK(n){return function XK(n){for(const e of Qx){if(null==n[e])continue;const t=n[e];n[e]=function(){return BigInt(t.call(this).toString())}}return n}(new Gi(n))}(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}function cf(n,e){const t=function tG(){return function eG(n){for(const e of Qx){if(null==n[e])continue;const t=n[e];n[e]=function(r){return t.call(this,r.toString())}}return n}(ji.create())}();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}var gp,yp,mp,pp=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(pp||(pp={})),pp))();function uf(n,e){return function nG(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}("message",pp.LENGTH_DELIMITED,n,e)}!function(n){let e;n.codec=()=>(null==e&&(e=uf((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null!=t.addresses)for(const s of t.addresses)r.uint32(10),yp.codec().encode(s,r,{writeDefaults:!0});if(null!=t.protocols)for(const s of t.protocols)r.uint32(18),r.string(s);if(null!=t.metadata)for(const s of t.metadata)r.uint32(26),mp.codec().encode(s,r,{writeDefaults:!0});null!=t.pubKey&&(r.uint32(34),r.bytes(t.pubKey)),null!=t.peerRecordEnvelope&&(r.uint32(42),r.bytes(t.peerRecordEnvelope)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={addresses:[],protocols:[],metadata:[]},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.addresses.push(yp.codec().decode(t,t.uint32()));break;case 2:i.protocols.push(t.string());break;case 3:i.metadata.push(mp.codec().decode(t,t.uint32()));break;case 4:i.pubKey=t.bytes();break;case 5:i.peerRecordEnvelope=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>cf(t,n.codec()),n.decode=t=>af(t,n.codec())}(gp||(gp={})),function(n){let e;n.codec=()=>(null==e&&(e=uf((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),(!0===i.writeDefaults||null!=t.multiaddr&&t.multiaddr.byteLength>0)&&(r.uint32(10),r.bytes(t.multiaddr)),null!=t.isCertified&&(r.uint32(16),r.bool(t.isCertified)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={multiaddr:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.multiaddr=t.bytes();break;case 2:i.isCertified=t.bool();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>cf(t,n.codec()),n.decode=t=>af(t,n.codec())}(yp||(yp={})),function(n){let e;n.codec=()=>(null==e&&(e=uf((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),(!0===i.writeDefaults||""!==t.key)&&(r.uint32(10),r.string(t.key)),(!0===i.writeDefaults||null!=t.value&&t.value.byteLength>0)&&(r.uint32(18),r.bytes(t.value)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={key:"",value:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.key=t.string();break;case 2:i.value=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>cf(t,n.codec()),n.decode=t=>af(t,n.codec())}(mp||(mp={}));var rG=R(2005);class Yx extends Error{constructor(e){super(e),this.name="TimeoutError"}}class iG extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const Zx=n=>void 0===globalThis.DOMException?new iG(n):new DOMException(n),Xx=n=>{const e=void 0===n.reason?Zx("This operation was aborted."):n.reason;return e instanceof Error?e:Zx(e)};var Eo,La=function(n,e,t,r){if("a"===t&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(n):r?r.value:e.get(n)};class aG{constructor(){Eo.set(this,[])}enqueue(e,t){const r={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&La(this,Eo,"f")[this.size-1].priority>=t.priority)return void La(this,Eo,"f").push(r);const i=function oG(n,e,t){let r=0,i=n.length;for(;i>0;){const s=Math.trunc(i/2);let o=r+s;t(n[o],e)<=0?(r=++o,i-=s+1):i=s}return r}(La(this,Eo,"f"),r,(s,o)=>o.priority-s.priority);La(this,Eo,"f").splice(i,0,r)}dequeue(){return La(this,Eo,"f").shift()?.run}filter(e){return La(this,Eo,"f").filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return La(this,Eo,"f").length}}Eo=new WeakMap;var ur,lf,ff,Xo,vp,df,Ep,Ts,hf,Ni,_p,Mi,pf,Jo,bp,Jx,eA,tA,nA,rA,iA,wp,n_,r_,Sp,Ip,Zn=function(n,e,t,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(n,t):i?i.value=t:e.set(n,t),t},st=function(n,e,t,r){if("a"===t&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?r:"a"===t?r.call(n):r?r.value:e.get(n)};const cG=new Yx;class uG extends Error{}class sA extends rG{constructor(e){var t,r,i,s;if(super(),ur.add(this),lf.set(this,void 0),ff.set(this,void 0),Xo.set(this,0),vp.set(this,void 0),df.set(this,void 0),Ep.set(this,0),Ts.set(this,void 0),hf.set(this,void 0),Ni.set(this,void 0),_p.set(this,void 0),Mi.set(this,0),pf.set(this,void 0),Jo.set(this,void 0),bp.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:aG,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(s=null===(i=e.interval)||void 0===i?void 0:i.toString())&&void 0!==s?s:""}\` (${typeof e.interval})`);Zn(this,lf,e.carryoverConcurrencyCount,"f"),Zn(this,ff,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,"f"),Zn(this,vp,e.intervalCap,"f"),Zn(this,df,e.interval,"f"),Zn(this,Ni,new e.queueClass,"f"),Zn(this,_p,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,Zn(this,bp,!0===e.throwOnTimeout,"f"),Zn(this,Jo,!1===e.autoStart,"f")}get concurrency(){return st(this,pf,"f")}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);Zn(this,pf,e,"f"),st(this,ur,"m",Sp).call(this)}add(e,t={}){var r=this;return $(function*(){return new Promise((i,s)=>{const o=function(){var a=$(function*(){var u,_,x;Zn(r,Mi,(_=st(r,Mi,"f"),++_),"f"),Zn(r,Xo,(x=st(r,Xo,"f"),++x),"f");try{if(null!==(u=t.signal)&&void 0!==u&&u.aborted)return void s(new uG("The task was aborted."));const B=yield void 0===r.timeout&&void 0===t.timeout?e({signal:t.signal}):function sG(n,e,t,r){let i;const s=new Promise((o,a)=>{if("number"!=typeof e||1!==Math.sign(e))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e!==Number.POSITIVE_INFINITY){if((r={customTimers:{setTimeout,clearTimeout},...r}).signal){const{signal:u}=r;u.aborted&&a(Xx(u)),u.addEventListener("abort",()=>{a(Xx(u))})}i=r.customTimers.setTimeout.call(void 0,()=>{if("function"==typeof t){try{o(t())}catch(x){a(x)}return}const _=t instanceof Error?t:new Yx("string"==typeof t?t:`Promise timed out after ${e} milliseconds`);"function"==typeof n.cancel&&n.cancel(),a(_)},e),$(function*(){try{o(yield n)}catch(u){a(u)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()}else o(n)});return s.clear=()=>{clearTimeout(i),i=void 0},s}(Promise.resolve(e({signal:t.signal})),void 0===t.timeout?r.timeout:t.timeout,()=>{(void 0===t.throwOnTimeout?st(r,bp,"f"):t.throwOnTimeout)&&s(cG)});i(B),r.emit("completed",B)}catch(P){s(P),r.emit("error",P)}st(r,ur,"m",tA).call(r)});return function(){return a.apply(this,arguments)}}();st(r,Ni,"f").enqueue(o,t),st(r,ur,"m",wp).call(r),r.emit("add")})})()}addAll(e,t){var r=this;return $(function*(){return Promise.all(e.map(function(){var i=$(function*(s){return r.add(s,t)});return function(s){return i.apply(this,arguments)}}()))})()}start(){return st(this,Jo,"f")?(Zn(this,Jo,!1,"f"),st(this,ur,"m",Sp).call(this),this):this}pause(){Zn(this,Jo,!0,"f")}clear(){Zn(this,Ni,new(st(this,_p,"f")),"f")}onEmpty(){var e=this;return $(function*(){0!==st(e,Ni,"f").size&&(yield st(e,ur,"m",Ip).call(e,"empty"))})()}onSizeLessThan(e){var t=this;return $(function*(){st(t,Ni,"f").size<e||(yield st(t,ur,"m",Ip).call(t,"next",()=>st(t,Ni,"f").size<e))})()}onIdle(){var e=this;return $(function*(){0===st(e,Mi,"f")&&0===st(e,Ni,"f").size||(yield st(e,ur,"m",Ip).call(e,"idle"))})()}get size(){return st(this,Ni,"f").size}sizeBy(e){return st(this,Ni,"f").filter(e).length}get pending(){return st(this,Mi,"f")}get isPaused(){return st(this,Jo,"f")}}lf=new WeakMap,ff=new WeakMap,Xo=new WeakMap,vp=new WeakMap,df=new WeakMap,Ep=new WeakMap,Ts=new WeakMap,hf=new WeakMap,Ni=new WeakMap,_p=new WeakMap,Mi=new WeakMap,pf=new WeakMap,Jo=new WeakMap,bp=new WeakMap,ur=new WeakSet,Jx=function(){return st(this,ff,"f")||st(this,Xo,"f")<st(this,vp,"f")},eA=function(){return st(this,Mi,"f")<st(this,pf,"f")},tA=function(){var e;Zn(this,Mi,(e=st(this,Mi,"f"),--e),"f"),st(this,ur,"m",wp).call(this),this.emit("next")},nA=function(){this.emit("empty"),0===st(this,Mi,"f")&&this.emit("idle")},rA=function(){st(this,ur,"m",r_).call(this),st(this,ur,"m",n_).call(this),Zn(this,hf,void 0,"f")},iA=function(){const e=Date.now();if(void 0===st(this,Ts,"f")){const t=st(this,Ep,"f")-e;if(!(t<0))return void 0===st(this,hf,"f")&&Zn(this,hf,setTimeout(()=>{st(this,ur,"m",rA).call(this)},t),"f"),!0;Zn(this,Xo,st(this,lf,"f")?st(this,Mi,"f"):0,"f")}return!1},wp=function(){if(0===st(this,Ni,"f").size)return st(this,Ts,"f")&&clearInterval(st(this,Ts,"f")),Zn(this,Ts,void 0,"f"),st(this,ur,"m",nA).call(this),!1;if(!st(this,Jo,"f")){const e=!st(this,ur,"a",iA);if(st(this,ur,"a",Jx)&&st(this,ur,"a",eA)){const t=st(this,Ni,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&st(this,ur,"m",n_).call(this),!0)}}return!1},n_=function(){st(this,ff,"f")||void 0!==st(this,Ts,"f")||(Zn(this,Ts,setInterval(()=>{st(this,ur,"m",r_).call(this)},st(this,df,"f")),"f"),Zn(this,Ep,Date.now()+st(this,df,"f"),"f"))},r_=function(){0===st(this,Xo,"f")&&0===st(this,Mi,"f")&&st(this,Ts,"f")&&(clearInterval(st(this,Ts,"f")),Zn(this,Ts,void 0,"f")),Zn(this,Xo,st(this,lf,"f")?st(this,Mi,"f"):0,"f"),st(this,ur,"m",Sp).call(this)},Sp=function(){for(;st(this,ur,"m",wp).call(this););},Ip=function(){var n=$(function*(t,r){return new Promise(i=>{const s=()=>{r&&!r()||(this.off(t,s),i())};this.on(t,s)})});return function e(t,r){return n.apply(this,arguments)}}();const oA="lock:worker:request-read",aA="lock:worker:release-read",cA="lock:master:grant-read",uA="lock:worker:request-write",lA="lock:worker:release-write",fA="lock:master:grant-write",ea={},_u=n=>{n.addEventListener("message",e=>{_u.dispatchEvent("message",n,e)}),null!=n.port&&n.port.addEventListener("message",e=>{_u.dispatchEvent("message",n,e)})};_u.addEventListener=(n,e)=>{null==ea[n]&&(ea[n]=[]),ea[n].push(e)},_u.removeEventListener=(n,e)=>{null!=ea[n]&&(ea[n]=ea[n].filter(t=>t===e))},_u.dispatchEvent=function(n,e,t){null!=ea[n]&&ea[n].forEach(r=>r(e,t))};const dA=_u,hA=(n,e,t,r,i)=>(s,o)=>{if(o.data.type!==t)return;const a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};var u;n.dispatchEvent(new MessageEvent(e,{data:{name:a.name,handler:(u=$(function*(){return s.postMessage({type:i,name:a.name,identifier:a.identifier}),yield new Promise(_=>{const x=P=>{null!=P&&null!=P.data&&P.data.type===r&&P.data.identifier===a.identifier&&(s.removeEventListener("message",x),_())};s.addEventListener("message",x)})}),function(){return u.apply(this,arguments)})}}))},pA=(n,e,t,r)=>$(function*(){const i=ax();return globalThis.postMessage({type:e,identifier:i,name:n}),yield new Promise(s=>{const o=a=>{null!=a&&null!=a.data&&a.data.type===t&&a.data.identifier===i&&(globalThis.removeEventListener("message",o),s(()=>{globalThis.postMessage({type:r,identifier:i,name:n})}))};globalThis.addEventListener("message",o)})}),lG={singleProcess:!1},Ba={};let ta;function i_(n,e){return s_.apply(this,arguments)}function s_(){return s_=$(function*(n,e){let t;const r=new Promise(i=>{t=i});return n.add($(function*(){return yield N2($(function*(){return yield new Promise(i=>{t(()=>{i()})})})(),{milliseconds:e.timeout})})),yield r}),s_.apply(this,arguments)}const hG={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};const gA=Mt("libp2p:peer-store:store"),yA="/peers/";class gG{constructor(e){this.components=e,this.lock=function pG(n){const e=Object.assign({},hG,n);return null==ta&&(ta=(n=>{if(n=Object.assign({},lG,n),Boolean(globalThis.document)||n.singleProcess){const t=new EventTarget;return dA.addEventListener("message",hA(t,"requestReadLock",oA,aA,cA)),dA.addEventListener("message",hA(t,"requestWriteLock",uA,lA,fA)),t}return{isWorker:!0,readLock:t=>pA(t,oA,cA,aA),writeLock:t=>pA(t,uA,fA,lA)}})(e),!0!==ta.isWorker&&(ta.addEventListener("requestReadLock",t=>{null!=Ba[t.data.name]&&Ba[t.data.name].readLock().then(function(){var r=$(function*(i){return yield t.data.handler().finally(()=>i())});return function(i){return r.apply(this,arguments)}}())}),ta.addEventListener("requestWriteLock",function(){var t=$(function*(r){null!=Ba[r.data.name]&&Ba[r.data.name].writeLock().then(function(){var i=$(function*(s){return yield r.data.handler().finally(()=>s())});return function(s){return i.apply(this,arguments)}}())});return function(r){return t.apply(this,arguments)}}()))),null==Ba[e.name]&&(Ba[e.name]=((n,e)=>{if(!0===ta.isWorker)return{readLock:ta.readLock(n,e),writeLock:ta.writeLock(n,e)};const t=new sA({concurrency:1});let r;return{readLock:()=>$(function*(){if(null!=r)return yield i_(r,e);r=new sA({concurrency:e.concurrency,autoStart:!1});const i=r,s=i_(r,e);return t.add($(function*(){return i.start(),yield i.onIdle().then(()=>{r===i&&(r=null)})})),yield s})(),writeLock:()=>$(function*(){return r=null,yield i_(t,e)})()}})(e.name,e)),Ba[e.name]}({name:"peer-store",singleProcess:!0})}_peerIdToDatastoreKey(e){if(null==e.type)throw gA.error("peerId must be an instance of peer-id to store data"),se(new Error("peerId must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");const t=e.toCID().toString();return new Br(`${yA}${t}`)}has(e){var t=this;return $(function*(){return yield t.components.datastore.has(t._peerIdToDatastoreKey(e))})()}delete(e){var t=this;return $(function*(){yield t.components.datastore.delete(t._peerIdToDatastoreKey(e))})()}load(e){var t=this;return $(function*(){const r=yield t.components.datastore.get(t._peerIdToDatastoreKey(e)),i=gp.decode(r),s=new Map;for(const o of i.metadata)s.set(o.key,o.value);return{...i,id:e,addresses:i.addresses.map(({multiaddr:o,isCertified:a})=>({multiaddr:Cn(o),isCertified:a??!1})),metadata:s,pubKey:i.pubKey??void 0,peerRecordEnvelope:i.peerRecordEnvelope??void 0}})()}save(e){var t=this;return $(function*(){if(null!=e.pubKey&&null!=e.id.publicKey&&!Or(e.pubKey,e.id.publicKey))throw gA.error("peer publicKey bytes do not match peer id publicKey bytes"),se(new Error("publicKey bytes do not match peer id publicKey bytes"),"ERR_INVALID_PARAMETERS");const r=new Set,i=e.addresses.filter(a=>!r.has(a.multiaddr.toString())&&(r.add(a.multiaddr.toString()),!0)).sort((a,u)=>a.multiaddr.toString().localeCompare(u.multiaddr.toString())).map(({multiaddr:a,isCertified:u})=>({multiaddr:a.bytes,isCertified:u})),s=[];[...e.metadata.keys()].sort().forEach(a=>{const u=e.metadata.get(a);null!=u&&s.push({key:a,value:u})});const o=gp.encode({addresses:i,protocols:e.protocols.sort(),pubKey:e.pubKey,metadata:s,peerRecordEnvelope:e.peerRecordEnvelope});return yield t.components.datastore.put(t._peerIdToDatastoreKey(e.id),o.subarray()),yield t.load(e.id)})()}patch(e,t){var r=this;return $(function*(){const i=yield r.load(e);return yield r._patch(e,t,i)})()}patchOrCreate(e,t){var r=this;return $(function*(){let i;try{i=yield r.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s;i={id:e,addresses:[],protocols:[],metadata:new Map}}return yield r._patch(e,t,i)})()}_patch(e,t,r){var i=this;return $(function*(){return yield i.save({...r,...t,id:e})})()}merge(e,t){var r=this;return $(function*(){const i=yield r.load(e);return yield r._merge(e,t,i)})()}mergeOrCreate(e,t){var r=this;return $(function*(){let i;try{i=yield r.load(e)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s;i={id:e,addresses:[],protocols:[],metadata:new Map}}return yield r._merge(e,t,i)})()}_merge(e,t,r){var i=this;return $(function*(){const s=new Map;return r.addresses.forEach(o=>{s.set(o.multiaddr.toString(),o.isCertified)}),(t.addresses??[]).forEach(o=>{const a=o.multiaddr.toString(),_=Boolean(s.get(a))||o.isCertified;s.set(a,_)}),yield i.save({id:e,addresses:Array.from(s.entries()).map(([o,a])=>({multiaddr:Cn(o),isCertified:a})),protocols:Array.from(new Set([...r.protocols??[],...t.protocols??[]])),metadata:new Map([...r.metadata?.entries()??[],...t.metadata?.entries()??[]]),pubKey:t.pubKey??r?.pubKey,peerRecordEnvelope:t.peerRecordEnvelope??r?.peerRecordEnvelope})})()}all(){var e=this;return Vt(function*(){var i,t=!1,r=!1;try{for(var o,s=ut(e.components.datastore.queryKeys({prefix:yA}));t=!(o=yield qe(s.next())).done;t=!1){const u=o.value.toString().split("/")[2],_=co.decode(u);yield e.load(tu(_))}}catch(a){r=!0,i=a}finally{try{t&&null!=s.return&&(yield qe(s.return()))}finally{if(r)throw i}}})()}}var na,Tp;!function(n){let e;n.codec=()=>(null==e&&(e=uf((t,r,i={})=>{if(!1!==i.lengthDelimited&&r.fork(),null!=t.tags)for(const s of t.tags)r.uint32(10),Tp.codec().encode(s,r,{writeDefaults:!0});!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={tags:[]},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();o>>>3==1?i.tags.push(Tp.codec().decode(t,t.uint32())):t.skipType(7&o)}return i})),e),n.encode=t=>cf(t,n.codec()),n.decode=t=>af(t,n.codec())}(na||(na={})),function(n){let e;n.codec=()=>(null==e&&(e=uf((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),(!0===i.writeDefaults||""!==t.name)&&(r.uint32(10),r.string(t.name)),null!=t.value&&(r.uint32(16),r.uint32(t.value)),null!=t.expiry&&(r.uint32(24),r.uint64(t.expiry)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={name:""},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.name=t.string();break;case 2:i.value=t.uint32();break;case 3:i.expiry=t.uint64();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>cf(t,n.codec()),n.decode=t=>af(t,n.codec())}(Tp||(Tp={}));const ts=Mt("libp2p:peer-store");class yG extends gi{constructor(e,t={}){super(),this.components=e,this.store=new gG(e),this.addressBook=new WK(this.dispatchEvent.bind(this),this.store,t.addressFilter),this.keyBook=new qK(this.dispatchEvent.bind(this),this.store),this.metadataBook=new QK(this.dispatchEvent.bind(this),this.store),this.protoBook=new YK(this.dispatchEvent.bind(this),this.store)}forEach(e){var t=this;return $(function*(){ts.trace("getPeers await read lock");const r=yield t.store.lock.readLock();ts.trace("getPeers got read lock");try{var o,i=!1,s=!1;try{for(var u,a=ut(t.store.all());i=!(u=yield a.next()).done;i=!1){const _=u.value;_.id.equals(t.components.peerId)||e(_)}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}}finally{ts.trace("getPeers release read lock"),r()}})()}all(){var e=this;return $(function*(){const t=[];return yield e.forEach(r=>{t.push(r)}),t})()}delete(e){var t=this;return $(function*(){ts.trace("delete await write lock");const r=yield t.store.lock.writeLock();ts.trace("delete got write lock");try{yield t.store.delete(e)}finally{ts.trace("delete release write lock"),r()}})()}get(e){var t=this;return $(function*(){ts.trace("get await read lock");const r=yield t.store.lock.readLock();ts.trace("get got read lock");try{return yield t.store.load(e)}finally{ts.trace("get release read lock"),r()}})()}has(e){var t=this;return $(function*(){ts.trace("has await read lock");const r=yield t.store.lock.readLock();ts.trace("has got read lock");try{return yield t.store.has(e)}finally{ts.trace("has release read lock"),r()}})()}tagPeer(e,t,r={}){var i=this;return $(function*(){const s=r.value??0,o=Math.round(s),a=r.ttl??void 0;if(o!==s||o<0||o>100)throw se(new Error("Tag value must be between 0-100"),"ERR_TAG_VALUE_OUT_OF_BOUNDS");const u=yield i.metadataBook.getValue(e,"tags");let _=[];null!=u&&(_=na.decode(u).tags);for(const x of _)if(x.name===t)throw se(new Error("Peer already tagged"),"ERR_DUPLICATE_TAG");_.push({name:t,value:o,expiry:null==a?void 0:BigInt(Date.now()+a)}),yield i.metadataBook.setValue(e,"tags",na.encode({tags:_}).subarray())})()}unTagPeer(e,t){var r=this;return $(function*(){const i=yield r.metadataBook.getValue(e,"tags");let s=[];null!=i&&(s=na.decode(i).tags),s=s.filter(o=>o.name!==t),yield r.metadataBook.setValue(e,"tags",na.encode({tags:s}).subarray())})()}getTags(e){var t=this;return $(function*(){const r=yield t.metadataBook.getValue(e,"tags");let i=[];null!=r&&(i=na.decode(r).tags);const s=BigInt(Date.now()),o=i.filter(a=>null==a.expiry||a.expiry>s);return o.length!==i.length&&(yield t.metadataBook.setValue(e,"tags",na.encode({tags:o}).subarray())),o.map(a=>({name:a.name,value:a.value??0}))})()}}class mG{constructor(e){this.dht=e}provide(e){var t=this;return $(function*(){yield mu(t.dht.provide(e))})()}findProviders(e,t={}){var r=this;return Vt(function*(){var o,i=!1,s=!1;try{for(var u,a=ut(r.dht.findProviders(e,t));i=!(u=yield qe(a.next())).done;i=!1){const _=u.value;"PROVIDER"===_.name&&(yield*Mr(ut(_.providers),qe))}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield qe(a.return()))}finally{if(s)throw o}}})()}put(e,t,r){var i=this;return $(function*(){yield mu(i.dht.put(e,t,r))})()}get(e,t){var r=this;return $(function*(){var o,i=!1,s=!1;try{for(var u,a=ut(r.dht.get(e,t));i=!(u=yield a.next()).done;i=!1){const _=u.value;if("VALUE"===_.name)return _.value}}catch(_){s=!0,o=_}finally{try{i&&null!=a.return&&(yield a.return())}finally{if(s)throw o}}throw se(new Error("Not found"),"ERR_NOT_FOUND")})()}}class vG{constructor(e={}){this._started=!1,this._peerId=e.peerId,this._addressManager=e.addressManager,this._peerStore=e.peerStore,this._upgrader=e.upgrader,this._metrics=e.metrics,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._connectionGater=e.connectionGater,this._contentRouting=e.contentRouting,this._peerRouting=e.peerRouting,this._datastore=e.datastore,this._connectionProtector=e.connectionProtector,this._dht=e.dht,this._pubsub=e.pubsub,this._dialer=e.dialer}isStarted(){return this._started}beforeStart(){var e=this;return $(function*(){yield Promise.all(Object.values(e).filter(t=>po(t)).map(function(){var t=$(function*(r){null!=r.beforeStart&&(yield r.beforeStart())});return function(r){return t.apply(this,arguments)}}()))})()}start(){var e=this;return $(function*(){yield Promise.all(Object.values(e).filter(t=>po(t)).map(function(){var t=$(function*(r){yield r.start()});return function(r){return t.apply(this,arguments)}}())),e._started=!0})()}afterStart(){var e=this;return $(function*(){yield Promise.all(Object.values(e).filter(t=>po(t)).map(function(){var t=$(function*(r){null!=r.afterStart&&(yield r.afterStart())});return function(r){return t.apply(this,arguments)}}()))})()}beforeStop(){var e=this;return $(function*(){yield Promise.all(Object.values(e).filter(t=>po(t)).map(function(){var t=$(function*(r){null!=r.beforeStop&&(yield r.beforeStop())});return function(r){return t.apply(this,arguments)}}()))})()}stop(){var e=this;return $(function*(){yield Promise.all(Object.values(e).filter(t=>po(t)).map(function(){var t=$(function*(r){yield r.stop()});return function(r){return t.apply(this,arguments)}}())),e._started=!1})()}afterStop(){var e=this;return $(function*(){yield Promise.all(Object.values(e).filter(t=>po(t)).map(function(){var t=$(function*(r){null!=r.afterStop&&(yield r.afterStop())});return function(r){return t.apply(this,arguments)}}()))})()}get peerId(){if(null==this._peerId)throw se(new Error("peerId not set"),"ERR_SERVICE_MISSING");return this._peerId}set peerId(e){this._peerId=e}get addressManager(){if(null==this._addressManager)throw se(new Error("addressManager not set"),"ERR_SERVICE_MISSING");return this._addressManager}set addressManager(e){this._addressManager=e}get peerStore(){if(null==this._peerStore)throw se(new Error("peerStore not set"),"ERR_SERVICE_MISSING");return this._peerStore}set peerStore(e){this._peerStore=e}get upgrader(){if(null==this._upgrader)throw se(new Error("upgrader not set"),"ERR_SERVICE_MISSING");return this._upgrader}set upgrader(e){this._upgrader=e}get registrar(){if(null==this._registrar)throw se(new Error("registrar not set"),"ERR_SERVICE_MISSING");return this._registrar}set registrar(e){this._registrar=e}get connectionManager(){if(null==this._connectionManager)throw se(new Error("connectionManager not set"),"ERR_SERVICE_MISSING");return this._connectionManager}set connectionManager(e){this._connectionManager=e}get transportManager(){if(null==this._transportManager)throw se(new Error("transportManager not set"),"ERR_SERVICE_MISSING");return this._transportManager}set transportManager(e){this._transportManager=e}get connectionGater(){if(null==this._connectionGater)throw se(new Error("connectionGater not set"),"ERR_SERVICE_MISSING");return this._connectionGater}set connectionGater(e){this._connectionGater=e}get contentRouting(){if(null==this._contentRouting)throw se(new Error("contentRouting not set"),"ERR_SERVICE_MISSING");return this._contentRouting}set contentRouting(e){this._contentRouting=e}get peerRouting(){if(null==this._peerRouting)throw se(new Error("peerRouting not set"),"ERR_SERVICE_MISSING");return this._peerRouting}set peerRouting(e){this._peerRouting=e}get datastore(){if(null==this._datastore)throw se(new Error("datastore not set"),"ERR_SERVICE_MISSING");return this._datastore}set datastore(e){this._datastore=e}get connectionProtector(){return this._connectionProtector}set connectionProtector(e){this._connectionProtector=e}get dialer(){if(null==this._dialer)throw se(new Error("dialer not set"),"ERR_SERVICE_MISSING");return this._dialer}set dialer(e){this._dialer=e}get metrics(){return this._metrics}set metrics(e){this._metrics=e}get dht(){return this._dht}set dht(e){this._dht=e}get pubsub(){return this._pubsub}set pubsub(e){this._pubsub=e}}var mA=R(4033);const EG=globalThis.fetch,_G=globalThis.Headers;function o_(n,e,t){return`${n}?name=${e}&type=${t}`}function bG(n,e){return a_.apply(this,arguments)}function a_(){return a_=$(function*(n,e){return yield(yield EG(n,{headers:new _G({accept:"application/dns-json"}),signal:e})).json()}),a_.apply(this,arguments)}function bu(n,e){return`${e}_${n}`}globalThis,globalThis;const c_=Object.assign(mr("dns-over-http-resolver"),{error:mr("dns-over-http-resolver:error")}),SG=class wG{constructor(e={}){this._cache=new mA({max:e?.maxCache??100}),this._TXTcache=new mA({max:e?.maxCache??100}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"],this._request=e.request??bG,this._abortControllers=[]}cancel(){this._abortControllers.forEach(e=>e.abort())}getServers(){return this._servers}_getShuffledServers(){const e=[...this._servers];for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),i=e[t];e[t]=e[r],e[r]=i}return e}setServers(e){this._servers=e}resolve(e,t="A"){var r=this;return $(function*(){switch(t){case"A":return yield r.resolve4(e);case"AAAA":return yield r.resolve6(e);case"TXT":return yield r.resolveTxt(e);default:throw new Error(`${t} is not supported`)}})()}resolve4(e){var t=this;return $(function*(){const i=t._cache.get(bu(e,"A"));if(null!=i)return i;let s=!1;for(const o of t._getShuffledServers()){const a=new AbortController;t._abortControllers.push(a);try{const u=yield t._request(o_(o,e,"A"),a.signal),_=u.Answer.map(P=>P.data),x=Math.min(...u.Answer.map(P=>P.TTL));return t._cache.set(bu(e,"A"),_,{ttl:x}),_}catch{a.signal.aborted&&(s=!0),c_.error(`${o} could not resolve ${e} record A`)}finally{t._abortControllers=t._abortControllers.filter(u=>u!==a)}}throw s?Object.assign(new Error("queryA ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record A`)})()}resolve6(e){var t=this;return $(function*(){const r="AAAA",i=t._cache.get(bu(e,r));if(null!=i)return i;let s=!1;for(const o of t._getShuffledServers()){const a=new AbortController;t._abortControllers.push(a);try{const u=yield t._request(o_(o,e,r),a.signal),_=u.Answer.map(P=>P.data),x=Math.min(...u.Answer.map(P=>P.TTL));return t._cache.set(bu(e,r),_,{ttl:x}),_}catch{a.signal.aborted&&(s=!0),c_.error(`${o} could not resolve ${e} record AAAA`)}finally{t._abortControllers=t._abortControllers.filter(u=>u!==a)}}throw s?Object.assign(new Error("queryAaaa ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record AAAA`)})()}resolveTxt(e){var t=this;return $(function*(){const r="TXT",i=t._TXTcache.get(bu(e,r));if(null!=i)return i;let s=!1;for(const o of t._getShuffledServers()){const a=new AbortController;t._abortControllers.push(a);try{const u=yield t._request(o_(o,e,r),a.signal),_=u.Answer.map(P=>[P.data.replace(/['"]+/g,"")]),x=Math.min(...u.Answer.map(P=>P.TTL));return t._TXTcache.set(bu(e,r),_,{ttl:x}),_}catch{a.signal.aborted&&(s=!0),c_.error(`${o} could not resolve ${e} record TXT`)}finally{t._abortControllers=t._abortControllers.filter(u=>u!==a)}}throw s?Object.assign(new Error("queryTxt ECANCELLED"),{code:"ECANCELLED"}):new Error(`Could not resolve ${e} record TXT`)})()}clearCache(){this._cache.clear(),this._TXTcache.clear()}},{code:IG}=vr("dnsaddr");function u_(){return u_=$(function*(n,e={}){const t=new SG;null!=e.signal&&e.signal.addEventListener("abort",()=>{t.cancel()});const r=n.getPeerId(),[,i]=n.stringTuples().find(([a])=>a===IG)??[];if(null==i)throw new Error("No hostname found in multiaddr");let o=(yield t.resolveTxt(`_dnsaddr.${i}`)).flat().map(a=>a.split("=")[1]);return null!=r&&(o=o.filter(a=>a.includes(r))),o}),u_.apply(this,arguments)}const CG={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:n=>n},connectionManager:{maxConnections:300,minConnections:50,autoDial:!0,autoDialInterval:1e4,maxParallelDials:100,maxDialsPerPeer:4,dialTimeout:3e4,inboundUpgradeTimeout:3e4,resolvers:{dnsaddr:function TG(n){return u_.apply(this,arguments)}},addressSorter:DE},connectionGater:{},transportManager:{faultTolerance:Oa.FATAL_ALL},metrics:{enabled:!1,computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0},relay:{enabled:!0,advertise:{bootDelay:9e5,enabled:!1,ttl:18e5},hop:{enabled:!1,active:!1,timeout:3e4},autoRelay:{enabled:!1,maxListeners:2}},identify:{protocolPrefix:"ipfs",host:{agentVersion:Gx},timeout:6e4,maxInboundStreams:1,maxOutboundStreams:1,maxPushIncomingStreams:1,maxPushOutgoingStreams:1},ping:{protocolPrefix:"ipfs",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4},fetch:{protocolPrefix:"libp2p",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4}};function DG(n){const e=Wl(CG,n);if(null==e.transports||e.transports.length<1)throw se(new Error(ln.ERR_TRANSPORTS_REQUIRED),_e.ERR_TRANSPORTS_REQUIRED);if(null==e.connectionEncryption||0===e.connectionEncryption.length)throw se(new Error(ln.CONN_ENCRYPTION_REQUIRED),_e.CONN_ENCRYPTION_REQUIRED);if(null===e.connectionProtector&&null!=globalThis.process?.env?.LIBP2P_FORCE_PNET)throw se(new Error(ln.ERR_PROTECTOR_REQUIRED),_e.ERR_PROTECTOR_REQUIRED);return e.identify.host.agentVersion===Gx&&(i9||n9?e.identify.host.agentVersion+=` UserAgent=${globalThis.process.version}`:(Nh||D2||r9||s9)&&(e.identify.host.agentVersion+=` UserAgent=${globalThis.navigator.userAgent}`)),e}!function xG(){Mc._configure(),Gi._configure(Pc),ji._configure(Nc)}();const vA=["uint64","int64","sint64","fixed64","sfixed64"];var EA,Cp=(()=>(function(n){n[n.VARINT=0]="VARINT",n[n.BIT64=1]="BIT64",n[n.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",n[n.START_GROUP=3]="START_GROUP",n[n.END_GROUP=4]="END_GROUP",n[n.BIT32=5]="BIT32"}(Cp||(Cp={})),Cp))();!function(n){let e;n.codec=()=>(null==e&&(e=function LG(n,e){return function kG(n,e,t,r){return{name:n,type:e,encode:t,decode:r}}("message",Cp.LENGTH_DELIMITED,n,e)}((t,r,i={})=>{!1!==i.lengthDelimited&&r.fork(),(!0===i.writeDefaults||null!=t.id&&t.id.byteLength>0)&&(r.uint32(10),r.bytes(t.id)),null!=t.pubKey&&(r.uint32(18),r.bytes(t.pubKey)),null!=t.privKey&&(r.uint32(26),r.bytes(t.privKey)),!1!==i.lengthDelimited&&r.ldelim()},(t,r)=>{const i={id:new Uint8Array(0)},s=null==r?t.len:t.pos+r;for(;t.pos<s;){const o=t.uint32();switch(o>>>3){case 1:i.id=t.bytes();break;case 2:i.pubKey=t.bytes();break;case 3:i.privKey=t.bytes();break;default:t.skipType(7&o)}}return i})),e),n.encode=t=>function OG(n,e){const t=function NG(){return function PG(n){for(const e of vA){if(null==n[e])continue;const t=n[e];n[e]=function(r){return t.call(this,r.toString())}}return n}(ji.create())}();return e.encode(n,t,{lengthDelimited:!1}),t.finish()}(t,n.codec()),n.decode=t=>function MG(n,e){const t=function RG(n){return function AG(n){for(const e of vA){if(null==n[e])continue;const t=n[e];n[e]=function(){return BigInt(t.call(this).toString())}}return n}(new Gi(n))}(n instanceof Uint8Array?n:n.subarray());return e.decode(t)}(t,n.codec())}(EA||(EA={}));const BG=function(){var n=$(function*(){const e=yield AD("Ed25519"),t=yield function _A(n){return f_.apply(this,arguments)}(e);if("Ed25519"===t.type)return t;throw new Error(`Generated unexpected PeerId type "${t.type}"`)});return function(){return n.apply(this,arguments)}}();function f_(){return f_=$(function*(n){return yield kl(RD(n.public),uU(n))}),f_.apply(this,arguments)}class UG extends gi{get[uv](){return!0}get[Symbol.toStringTag](){return"@libp2p/dummy-dht"}get wan(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}get lan(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}get(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}findProviders(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}findPeer(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}getClosestPeers(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}provide(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}put(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)}getMode(){return $(function*(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)})()}setMode(){return $(function*(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)})()}refreshRoutingTable(){return $(function*(){throw se(new Error(ln.DHT_DISABLED),_e.DHT_DISABLED)})()}}class VG extends gi{constructor(){super(...arguments),this.topicValidators=new Map}isStarted(){return!1}start(){}stop(){}get globalSignaturePolicy(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)}get multicodecs(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)}getPeers(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)}getTopics(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)}subscribe(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)}unsubscribe(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)}getSubscribers(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)}publish(){return $(function*(){throw se(new Error(ln.PUBSUB_DISABLED),_e.ERR_PUBSUB_DISABLED)})()}}var HG=R(8614);const wA=Mt("libp2p:dialer:dial-request");class $G{constructor(e){const{addrs:t,dialAction:r,dialer:i}=e;this.addrs=t,this.dialer=i,this.dialAction=r}run(e={}){var t=this;return $(function*(){const r=t.dialer.getTokens(t.addrs.length);if(r.length<1)throw se(new Error("No dial tokens available"),_e.ERR_NO_DIAL_TOKENS);const i=new HG;for(const u of r)i.push(u).catch(_=>{wA.error(_)});const s=t.addrs.map(()=>{const u=new AbortController;try{(0,Wr.setMaxListeners)?.(1/0,u.signal)}catch{}return u});if(null!=e.signal)try{(0,Wr.setMaxListeners)?.(1/0,e.signal)}catch{}let o=0,a=!1;try{return yield Promise.any(t.addrs.map(function(){var u=$(function*(_,x){const P=yield i.shift();if(a)throw t.dialer.releaseToken(r.splice(r.indexOf(P),1)[0]),se(new Error("dialAction already succeeded"),_e.ERR_ALREADY_SUCCEEDED);const B=s[x];if(null==B)throw se(new Error("dialAction did not come with an AbortController"),_e.ERR_INVALID_PARAMETERS);let U;try{const W=B.signal;U=yield t.dialAction(_,{...e,signal:null!=e.signal?(0,Ah.anySignal)([W,e.signal]):W}),s[x]=void 0}finally{o++,t.addrs.length-o>=r.length?i.push(P).catch(W=>{wA.error(W)}):t.dialer.releaseToken(r.splice(r.indexOf(P),1)[0])}if(null==U)throw se(new Error("dialAction led to empty object"),_e.ERR_TRANSPORT_DIAL_FAILED);return a=!0,U});return function(_,x){return u.apply(this,arguments)}}()))}finally{s.forEach(u=>{void 0!==u&&u.abort()}),r.forEach(u=>t.dialer.releaseToken(u))}})()}}const Cs=Mt("libp2p:dialer"),SA="dialler";class jG{constructor(e,t={}){this.started=!1,this.addressSorter=t.addressSorter??DE,this.maxAddrsToDial=t.maxAddrsToDial??25,this.timeout=t.dialTimeout??3e4,this.maxDialsPerPeer=t.maxDialsPerPeer??4,this.tokens=[...new Array(t.maxParallelDials??100)].map((r,i)=>i),this.components=e,this.pendingDials=UE({component:SA,metric:"pending-dials",metrics:t.metrics}),this.pendingDialTargets=UE({component:SA,metric:"pending-dial-targets",metrics:e.metrics});for(const[r,i]of Object.entries(t.resolvers??{}))c2.set(r,i)}isStarted(){return this.started}start(){var e=this;return $(function*(){e.started=!0})()}stop(){var e=this;return $(function*(){e.started=!1;for(const t of e.pendingDials.values())try{t.controller.abort()}catch(r){Cs.error(r)}e.pendingDials.clear();for(const t of e.pendingDialTargets.values())t.reject(new ou("Dialer was destroyed"));e.pendingDialTargets.clear()})()}dial(e,t={}){var r=this;return $(function*(){const{id:i,multiaddrs:s}=zl(e);if(r.components.peerId.equals(i))throw se(new Error("Tried to dial self"),_e.ERR_DIALED_SELF);if(Cs("check multiaddrs %p",i),null!=s&&s.length>0&&(Cs("storing multiaddrs %p",i,s),yield r.components.peerStore.addressBook.add(i,s)),yield r.components.connectionGater.denyDialPeer(i))throw se(new Error("The dial request is blocked by gater.allowDialPeer"),_e.ERR_PEER_DIAL_INTERCEPTED);Cs("creating dial target for %p",i);const o=yield r._createCancellableDialTarget(i,t);if(0===o.addrs.length)throw se(new Error("The dial request has no valid addresses"),_e.ERR_NO_VALID_ADDRESSES);const a=r.pendingDials.get(o.id)??r._createPendingDial(o,t);try{const u=yield a.promise;return Cs("dial succeeded to %s",o.id),u}catch(u){throw Cs("dial failed to %s",o.id,u),a.controller.signal.aborted&&(u.code=_e.ERR_TIMEOUT),Cs.error(u),u}finally{a.destroy()}})()}_createCancellableDialTarget(e,t){var r=this;return $(function*(){const i=`${parseInt(String(1e9*Math.random()),10).toString()}${Date.now()}`,s=new Promise((o,a)=>{r.pendingDialTargets.set(i,{resolve:o,reject:a})});try{return yield Promise.race([r._createDialTarget(e,t),s])}finally{r.pendingDialTargets.delete(i)}})()}_createDialTarget(e,t){var r=this;return $(function*(){const i=r._resolve.bind(r),s=yield zn(yield r.components.peerStore.addressBook.get(e),o=>Xi(o,function(){var a=$(function*(u){return!(yield r.components.connectionGater.denyDialMultiaddr(e,u.multiaddr))});return function(u){return a.apply(this,arguments)}}()),o=>vE(o,r.addressSorter),function(){var o=Vt(function*(u){var P,_=!1,x=!1;try{for(var U,B=ut(u);_=!(U=yield qe(B.next())).done;_=!1){const W=U.value;yield*Mr(ut(yield qe(i(W.multiaddr,t))),qe)}}catch(W){x=!0,P=W}finally{try{_&&null!=B.return&&(yield qe(B.return()))}finally{if(x)throw P}}});return function a(u){return o.apply(this,arguments)}}(),o=>Xi(o,a=>Boolean(r.components.transportManager.transportForMultiaddr(a))),o=>sE(o,a=>e.toString()===a.getPeerId()?a:a.encapsulate(`/p2p/${e.toString()}`)),function(){var o=$(function*(a){return yield gE(a)});return function(a){return o.apply(this,arguments)}}());if(s.length>r.maxAddrsToDial)throw yield r.components.peerStore.delete(e),se(new Error("dial with more addresses than allowed"),_e.ERR_TOO_MANY_ADDRESSES);return{id:e.toString(),addrs:s}})()}_createPendingDial(e,t={}){var r=this;const i=function(){var x=$(function*(P,B={}){if(!0===B.signal?.aborted)throw se(new Error("already aborted"),_e.ERR_ALREADY_ABORTED);return yield r.components.transportManager.dial(P,B).catch(U=>{throw Cs.error("dial to %s failed",P,U),U})});return function(B){return x.apply(this,arguments)}}(),s=new $G({addrs:e.addrs,dialAction:i,dialer:this}),o=new Pi.TimeoutController(this.timeout),a=[o.signal];null!=t.signal&&a.push(t.signal);const u=(0,Ah.anySignal)(a);try{(0,Wr.setMaxListeners)?.(1/0,u)}catch{}const _={dialRequest:s,controller:o,promise:s.run({...t,signal:u}),destroy:()=>{o.clear(),this.pendingDials.delete(e.id)}};return this.pendingDials.set(e.id,_),_}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return Cs("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.includes(e)||(Cs("token %d released",e),this.tokens.push(e))}_resolve(e,t){var r=this;return $(function*(){if(!e.protoNames().includes("dnsaddr"))return[e];const s=yield r._resolveRecord(e,t);return(yield Promise.all(s.map(function(){var u=$(function*(_){return yield r._resolve(_,t)});return function(_){return u.apply(this,arguments)}}()))).flat().reduce((u,_)=>(null==u.find(x=>x.equals(_))&&u.push(_),u),[])})()}_resolveRecord(e,t){return $(function*(){try{return e=Cn(e.toString()),yield e.resolve(t)}catch(r){return Cs.error(`multiaddr ${e.toString()} could not be resolved`,r),[]}})()}}const _o=Mt("libp2p");class zG extends gi{constructor(e){super(),this.started=!1,this.peerId=e.peerId;const t=this.components=new vG({peerId:e.peerId,datastore:e.datastore??new qH,connectionGater:{denyDialPeer:(o=$(function*(){return yield Promise.resolve(!1)}),function(){return o.apply(this,arguments)}),denyDialMultiaddr:function(){var o=$(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyInboundConnection:function(){var o=$(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyOutboundConnection:function(){var o=$(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyInboundEncryptedConnection:function(){var o=$(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyOutboundEncryptedConnection:function(){var o=$(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyInboundUpgradedConnection:function(){var o=$(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),denyOutboundUpgradedConnection:function(){var o=$(function*(){return yield Promise.resolve(!1)});return function(){return o.apply(this,arguments)}}(),filterMultiaddrForPeer:function(){var o=$(function*(){return yield Promise.resolve(!0)});return function(){return o.apply(this,arguments)}}(),...e.connectionGater}});var o;t.peerStore=new yG(t,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...e.peerStore}),this.services=[t],e.metrics.enabled&&(this.metrics=this.components.metrics=new nK(e.metrics)),this.peerStore=this.components.peerStore,this.peerStore.addEventListener("peer",o=>{const{detail:a}=o;this.dispatchEvent(new zt("peer:discovery",{detail:a}))}),null!=e.connectionProtector&&(this.components.connectionProtector=e.connectionProtector(t)),this.components.upgrader=new _K(this.components,{connectionEncryption:(e.connectionEncryption??[]).map(o=>this.configureComponent(o(this.components))),muxers:(e.streamMuxers??[]).map(o=>this.configureComponent(o(this.components))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.components.dialer=new jG(this.components,e.connectionManager),this.connectionManager=this.components.connectionManager=new c$(this.components,e.connectionManager),this.registrar=this.components.registrar=new mK(this.components),this.components.transportManager=new uK(this.components,e.transportManager),this.components.addressManager=new JH(this.components,e.addresses),this.configureComponent(new KK(this.components)),this.configureComponent(new f$(this.components,{enabled:e.connectionManager.autoDial,minConnections:e.connectionManager.minConnections,autoDialInterval:e.connectionManager.autoDialInterval}));const r=Px.generateOptions();this.keychain=this.configureComponent(new Px(this.components,{...r,...e.keychain})),this.services.push(new HK(this.components,e.nat)),e.transports.forEach(o=>{this.components.transportManager.add(this.configureComponent(o(this.components)))}),this.identifyService=new WE(this.components,{...e.identify}),this.configureComponent(this.identifyService),this.dht=null!=e.dht?this.components.dht=e.dht(this.components):new UG,this.pubsub=null!=e.pubsub?this.components.pubsub=e.pubsub(this.components):new VG;const i=(e.peerRouters??[]).map(o=>this.configureComponent(o(this.components)));null!=e.dht&&(i.push(this.configureComponent(new GK(this.dht))),this.dht.addEventListener("peer",o=>{this.onDiscoveryPeer(o)})),this.peerRouting=this.components.peerRouting=this.configureComponent(new QH(this.components,{...e.peerRouting,routers:i}));const s=(e.contentRouters??[]).map(o=>this.configureComponent(o(this.components)));null!=e.dht&&s.push(this.configureComponent(new mG(this.dht))),this.contentRouting=this.components.contentRouting=this.configureComponent(new YH(this.components,{routers:s})),e.relay.enabled&&(this.components.transportManager.add(this.configureComponent(new T$(this.components,e.relay))),this.configureComponent(new $$(this.components,{addressSorter:e.connectionManager.addressSorter,...e.relay}))),this.fetchService=this.configureComponent(new PK(this.components,{...e.fetch})),this.pingService=this.configureComponent(new kK(this.components,{...e.ping}));for(const o of e.peerDiscovery??[])this.configureComponent(o(this.components)).addEventListener("peer",u=>{this.onDiscoveryPeer(u)})}configureComponent(e){return po(e)&&this.services.push(e),e}start(){var e=this;return $(function*(){if(!e.started){e.started=!0,_o("libp2p is starting");try{yield Promise.all(e.services.map(function(){var t=$(function*(r){null!=r.beforeStart&&(yield r.beforeStart())});return function(r){return t.apply(this,arguments)}}())),yield Promise.all(e.services.map(t=>t.start())),yield Promise.all(e.services.map(function(){var t=$(function*(r){null!=r.afterStart&&(yield r.afterStart())});return function(r){return t.apply(this,arguments)}}())),_o("libp2p has started")}catch(t){throw _o.error("An error occurred starting libp2p",t),yield e.stop(),t}}})()}stop(){var e=this;return $(function*(){!e.started||(_o("libp2p is stopping"),e.started=!1,yield Promise.all(e.services.map(function(){var t=$(function*(r){null!=r.beforeStop&&(yield r.beforeStop())});return function(r){return t.apply(this,arguments)}}())),yield Promise.all(e.services.map(t=>t.stop())),yield Promise.all(e.services.map(function(){var t=$(function*(r){null!=r.afterStop&&(yield r.afterStop())});return function(r){return t.apply(this,arguments)}}())),_o("libp2p has stopped"))})()}isStarted(){return this.started}getConnections(e){return this.components.connectionManager.getConnections(e)}getPeers(){const e=new Ql;for(const t of this.components.connectionManager.getConnections())e.add(t.remotePeer);return Array.from(e)}dial(e,t={}){var r=this;return $(function*(){const{id:i,multiaddrs:s}=zl(e);return yield r.components.peerStore.addressBook.add(i,s),yield r.components.connectionManager.openConnection(i,t)})()}dialProtocol(e,t,r={}){var i=this;return $(function*(){if(null==t)throw se(new Error("no protocols were provided to open a stream"),_e.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(0===(t=Array.isArray(t)?t:[t]).length)throw se(new Error("no protocols were provided to open a stream"),_e.ERR_INVALID_PROTOCOLS_FOR_STREAM);return yield(yield i.dial(e,r)).newStream(t,r)})()}getMultiaddrs(){return this.components.addressManager.getAddresses()}hangUp(e){var t=this;return $(function*(){const{id:r}=zl(e);yield t.components.connectionManager.closeConnections(r)})()}getPublicKey(e,t={}){var r=this;return $(function*(){if(_o("getPublicKey %p",e),null!=e.publicKey)return e.publicKey;const i=yield r.peerStore.get(e);if(null!=i.pubKey)return i.pubKey;if(null==r.dht)throw se(new Error("Public key was not in the peer store and the DHT is not enabled"),_e.ERR_NO_ROUTERS_AVAILABLE);const s=gr([At("/pk/"),e.multihash.digest]);var u,o=!1,a=!1;try{for(var x,_=ut(r.dht.get(s,t));o=!(x=yield _.next()).done;o=!1){const P=x.value;if("VALUE"===P.name){const B=Ml(P.value);return yield r.peerStore.keyBook.set(e,P.value),B.bytes}}}catch(P){a=!0,u=P}finally{try{o&&null!=_.return&&(yield _.return())}finally{if(a)throw u}}throw se(new Error(`Node not responding with its public key: ${e.toString()}`),_e.ERR_INVALID_RECORD)})()}fetch(e,t,r={}){var i=this;return $(function*(){const{id:s,multiaddrs:o}=zl(e);return null!=o&&(yield i.components.peerStore.addressBook.add(s,o)),yield i.fetchService.fetch(s,t,r)})()}ping(e,t={}){var r=this;return $(function*(){const{id:i,multiaddrs:s}=zl(e);return s.length>0&&(yield r.components.peerStore.addressBook.add(i,s)),yield r.pingService.ping(i,t)})()}handle(e,t,r){var i=this;return $(function*(){Array.isArray(e)||(e=[e]),yield Promise.all(e.map(function(){var s=$(function*(o){yield i.components.registrar.handle(o,t,r)});return function(o){return s.apply(this,arguments)}}()))})()}unhandle(e){var t=this;return $(function*(){Array.isArray(e)||(e=[e]),yield Promise.all(e.map(function(){var r=$(function*(i){yield t.components.registrar.unhandle(i)});return function(i){return r.apply(this,arguments)}}()))})()}onDiscoveryPeer(e){const{detail:t}=e;t.id.toString()!==this.peerId.toString()?(t.multiaddrs.length>0&&this.components.peerStore.addressBook.add(t.id,t.multiaddrs).catch(r=>_o.error(r)),t.protocols.length>0&&this.components.peerStore.protoBook.set(t.id,t.protocols).catch(r=>_o.error(r)),this.dispatchEvent(new zt("peer:discovery",{detail:t}))):_o.error(new Error(_e.ERR_DISCOVERED_SELF))}}function WG(n){return g_.apply(this,arguments)}function g_(){return g_=$(function*(n){return null==n.peerId&&(n.peerId=yield BG()),new zG(DG(n))}),g_.apply(this,arguments)}function qG(n){return y_.apply(this,arguments)}function y_(){return y_=$(function*(n){return yield WG(n)}),y_.apply(this,arguments)}function v_(){return v_=$(function*(n){const e=n?.libp2p??{},t=e.peerDiscovery??[];n?.defaultBootstrap&&(t.push(__()),Object.assign(e,{peerDiscovery:t}));const r=yield b_(kH(n),e,n?.userAgent);return new q9(n??{},r)}),v_.apply(this,arguments)}function __(){return function vV(n){return e=>new mV(e,n)}({list:UH()})}function b_(n,e,t){return w_.apply(this,arguments)}function w_(){return w_=$(function*(n,e,t){return qG(Object.assign({transports:[g9({filter:O2})],streamMuxers:[VV()],connectionEncryption:[MU()],identify:{host:{agentVersion:t??W9}}},n?{pubsub:n}:{},e??{}))}),w_.apply(this,arguments)}class YG extends Error{constructor(e){super(e),this.name="TimeoutError"}}class ZG extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const IA=n=>void 0===globalThis.DOMException?new ZG(n):new DOMException(n),TA=n=>{const e=void 0===n.reason?IA("This operation was aborted."):n.reason;return e instanceof Error?e:IA(e)};function JG(n,e,t){let r;const i=new Promise((s,o)=>{if(!((t={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...t}).count>=0)||t.count!==Number.POSITIVE_INFINITY&&!Number.isInteger(t.count))throw new TypeError("The `count` option should be at least 0 or more");const a=[e].flat(),u=[],{addListener:_,removeListener:x}=(n=>{const e=n.on||n.addListener||n.addEventListener,t=n.off||n.removeListener||n.removeEventListener;if(!e||!t)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(n),removeListener:t.bind(n)}})(n),P=(...U)=>{const W=t.multiArgs?U:U[0];t.filter&&!t.filter(W)||(u.push(W),t.count===u.length&&(r(),s(u)))},B=U=>{r(),o(U)};r=()=>{for(const U of a)x(U,P);for(const U of t.rejectionEvents)x(U,B)};for(const U of a)_(U,P);for(const U of t.rejectionEvents)_(U,B);t.resolveImmediately&&s(u)});if(i.cancel=r,"number"==typeof t.timeout){const s=function XG(n,e,t,r){let i;const s=new Promise((o,a)=>{if("number"!=typeof e||1!==Math.sign(e))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e!==Number.POSITIVE_INFINITY){if((r={customTimers:{setTimeout,clearTimeout},...r}).signal){const{signal:u}=r;u.aborted&&a(TA(u)),u.addEventListener("abort",()=>{a(TA(u))})}i=r.customTimers.setTimeout.call(void 0,()=>{if("function"==typeof t){try{o(t())}catch(x){a(x)}return}const _=t instanceof Error?t:new YG("string"==typeof t?t:`Promise timed out after ${e} milliseconds`);"function"==typeof n.cancel&&n.cancel(),a(_)},e),$(function*(){try{o(yield n)}catch(u){a(u)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()}else o(n)});return s.clear=()=>{clearTimeout(i),i=void 0},s}(i,t.timeout);return s.cancel=r,s}return i}function ej(n,e,t){"function"==typeof t&&(t={filter:t});const r=JG(n,e,t={...t,count:1,resolveImmediately:!1}),i=r.then(s=>s[0]);return i.cancel=r.cancel,i}const DA=mr("waku:wait-for-remote-peer");function S_(){return S_=$(function*(n,e,t){if(e=e??sj(n),!n.isStarted())return Promise.reject("Waku node is not started");const r=[];if(e.includes(Ar.Relay)){if(!n.relay)throw new Error("Cannot wait for Relay peer: protocol not mounted");r.push(nj(n.relay))}if(e.includes(Ar.Store)){if(!n.store)throw new Error("Cannot wait for Store peer: protocol not mounted");r.push(I_(n.store,[Yh]))}if(e.includes(Ar.LightPush)){if(!n.lightPush)throw new Error("Cannot wait for LightPush peer: protocol not mounted");r.push(I_(n.lightPush,[$l]))}if(e.includes(Ar.Filter)){if(!n.filter)throw new Error("Cannot wait for Filter peer: protocol not mounted");r.push(I_(n.filter,[Ca]))}t?yield ij(Promise.all(r),t,"Timed out waiting for a remote peer."):yield Promise.all(r)}),S_.apply(this,arguments)}function I_(n,e){return T_.apply(this,arguments)}function T_(){return T_=$(function*(n,e){const t=yield n.peers();t.length?DA(`${e} peer found: `,t[0].id.toString()):yield new Promise(r=>{const i=s=>{for(const o of e)if(s.detail.protocols.includes(o)){DA("Resolving for",o,s.detail.protocols),n.peerStore.removeEventListener("change:protocols",i),r();break}};n.peerStore.addEventListener("change:protocols",i)})}),T_.apply(this,arguments)}function nj(n){return C_.apply(this,arguments)}function C_(){return C_=$(function*(n){let e=n.getMeshPeers();for(;0==e.length;)yield ej(n,"gossipsub:heartbeat"),e=n.getMeshPeers()}),C_.apply(this,arguments)}const rj=(n,e)=>new Promise((t,r)=>setTimeout(()=>r(e),n));function ij(n,e,t){return D_.apply(this,arguments)}function D_(){return D_=$(function*(n,e,t){yield Promise.race([n,rj(e,t)])}),D_.apply(this,arguments)}function sj(n){const e=[];return n.relay&&e.push(Ar.Relay),n.filter&&e.push(Ar.Filter),n.store&&e.push(Ar.Store),n.lightPush&&e.push(Ar.LightPush),e}let xA=(()=>{class n{constructor(){this.wakuSubject=new qr,this.waku=this.wakuSubject.asObservable(),this.wakuStatusSubject=new L8(""),this.wakuStatus=this.wakuStatusSubject.asObservable()}init(){(function QG(n){return v_.apply(this,arguments)})({defaultBootstrap:!0}).then(t=>{t.start().then(()=>{this.wakuSubject.next(t),this.wakuStatusSubject.next("Connecting..."),function tj(n,e,t){return S_.apply(this,arguments)}(t).then(()=>{this.wakuStatusSubject.next("Connected")})})})}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=$n({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();function oj(n,e){if(1&n&&(Js(0,"li")(1,"span"),Sc(2),eo()()),2&n){const t=e.$implicit;Qu(2),R0("",t.timestamp," ",t.text,"")}}const x_=new(_v().Type)("ChatMessage").add(new(_v().Field)("timestamp",1,"uint32")).add(new(_v().Field)("text",2,"string"));let aj=(()=>{class n{constructor(t){this.wakuService=t,this.contentTopic="/js-waku-examples/1/chat/proto",this.messages=[],this.messageCount=0,this.processIncomingMessages=r=>{if(!r.payload)return;const{text:i,timestamp:s}=x_.decode(r.payload),o=new Date;o.setTime(Number(s)),this.messages.push({text:i,timestamp:o})},this.decoder=new w9(this.contentTopic),this.encoder=new H2(this.contentTopic)}ngOnInit(){this.wakuService.wakuStatus.subscribe(t=>{this.wakuStatus=t}),this.wakuService.waku.subscribe(t=>{this.waku=t,this.deleteObserver=this.waku.relay.addObserver(this.decoder,this.processIncomingMessages)}),window.onbeforeunload=()=>this.ngOnDestroy()}ngOnDestroy(){this.deleteObserver&&this.deleteObserver()}sendMessage(){const t=(new Date).getTime(),r=x_.create({timestamp:t,text:`Here is a message #${this.messageCount}`}),i=x_.encode(r).finish();this.waku.relay.send(this.encoder,{payload:i}).then(()=>{console.log(`Message #${this.messageCount} sent`),this.messageCount+=1})}}return n.\u0275fac=function(t){return new(t||n)(Ut(xA))},n.\u0275cmp=Sf({type:n,selectors:[["app-messages"]],decls:6,vars:2,consts:[[3,"disabled","click"],[1,"messages"],[4,"ngFor","ngForOf"]],template:function(t,r){1&t&&(Js(0,"button",0),C0("click",function(){return r.sendMessage()}),Sc(1," Send Message\n"),eo(),Js(2,"h2"),Sc(3,"Messages"),eo(),Js(4,"ul",1),function B1(n,e,t,r,i,s,o,a){const u=Ne(),_=tn(),x=n+22,P=_.firstCreatePass?function wO(n,e,t,r,i,s,o,a,u){const _=e.consts,x=fc(e,n,4,o||null,To(_,a));d0(e,t,x,To(_,u)),Nf(e,x);const P=x.tViews=f0(2,x,r,i,s,e.directiveRegistry,e.pipeRegistry,null,e.schemas,_);return null!==e.queries&&(e.queries.template(e,x),P.queries=e.queries.embeddedTView(x)),x}(x,_,u,e,t,r,i,s,o):_.data[x];xs(P,!1);const B=u[11].createComment("");Qf(_,u,B,P),Hr(B,u),ud(u,u[x]=E1(B,u,B,P)),xf(P)&&u0(_,u,P),null!=o&&l0(u,P,a)}(5,oj,3,2,"li",2),eo()),2&t&&(gd("disabled","Connected"!==r.wakuStatus),Qu(5),gd("ngForOf",r.messages))},dependencies:[NT]}),n})(),cj=(()=>{class n{constructor(t){this.wakuService=t,this.title="relay-angular-chat"}ngOnInit(){this.wakuService.init(),this.wakuService.wakuStatus.subscribe(t=>{this.wakuStatus=t})}}return n.\u0275fac=function(t){return new(t||n)(Ut(xA))},n.\u0275cmp=Sf({type:n,selectors:[["app-root"]],decls:5,vars:2,template:function(t,r){1&t&&(Js(0,"h1"),Sc(1),eo(),Js(2,"p"),Sc(3),eo(),w0(4,"app-messages")),2&t&&(Qu(1),A0(r.title),Qu(2),md("Waku node's status: ",r.wakuStatus,""))},dependencies:[aj],styles:["h1[_ngcontent-%COMP%]{color:#369;font-family:Arial,Helvetica,sans-serif;font-size:250%}h2[_ngcontent-%COMP%], h3[_ngcontent-%COMP%]{color:#444;font-family:Arial,Helvetica,sans-serif;font-weight:lighter}body[_ngcontent-%COMP%]{margin:2em}body[_ngcontent-%COMP%], input[type=text][_ngcontent-%COMP%], button[_ngcontent-%COMP%]{color:#333;font-family:Cambria,Georgia,serif}*[_ngcontent-%COMP%]{font-family:Arial,Helvetica,sans-serif}"]}),n})(),uj=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=Iu({type:n,bootstrap:[cj]}),n.\u0275inj=Va({imports:[C8]}),n})();R(8583),function Z3(){lT=!1}(),T8().bootstrapModule(uj).catch(n=>console.error(n))},1280:Y=>{"use strict";Y.exports=function K(R,y){for(var l=new Array(arguments.length-1),g=0,b=2,m=!0;b<arguments.length;)l[g++]=arguments[b++];return new Promise(function(c,f){l[g]=function(w){if(m)if(m=!1,w)f(w);else{for(var I=new Array(arguments.length-1),E=0;E<I.length;)I[E++]=arguments[E];c.apply(null,I)}};try{R.apply(y||null,l)}catch(p){m&&(m=!1,f(p))}})}},9039:(Y,K)=>{"use strict";var R=K;R.length=function(d){var c=d.length;if(!c)return 0;for(var f=0;--c%4>1&&"="===d.charAt(c);)++f;return Math.ceil(3*d.length)/4-f};for(var y=new Array(64),l=new Array(123),g=0;g<64;)l[y[g]=g<26?g+65:g<52?g+71:g<62?g-4:g-59|43]=g++;R.encode=function(d,c,f){for(var v,p=null,w=[],I=0,E=0;c<f;){var h=d[c++];switch(E){case 0:w[I++]=y[h>>2],v=(3&h)<<4,E=1;break;case 1:w[I++]=y[v|h>>4],v=(15&h)<<2,E=2;break;case 2:w[I++]=y[v|h>>6],w[I++]=y[63&h],E=0}I>8191&&((p||(p=[])).push(String.fromCharCode.apply(String,w)),I=0)}return E&&(w[I++]=y[v],w[I++]=61,1===E&&(w[I++]=61)),p?(I&&p.push(String.fromCharCode.apply(String,w.slice(0,I))),p.join("")):String.fromCharCode.apply(String,w.slice(0,I))};var b="invalid encoding";R.decode=function(d,c,f){for(var I,p=f,w=0,E=0;E<d.length;){var v=d.charCodeAt(E++);if(61===v&&w>1)break;if(void 0===(v=l[v]))throw Error(b);switch(w){case 0:I=v,w=1;break;case 1:c[f++]=I<<2|(48&v)>>4,I=v,w=2;break;case 2:c[f++]=(15&I)<<4|(60&v)>>2,I=v,w=3;break;case 3:c[f++]=(3&I)<<6|v,w=0}}if(1===w)throw Error(b);return f-p},R.test=function(d){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(d)}},9749:Y=>{"use strict";function K(R,y){"string"==typeof R&&(y=R,R=void 0);var l=[];function g(m){if("string"!=typeof m){var d=b();if(K.verbose&&console.log("codegen: "+d),d="return "+d,m){for(var c=Object.keys(m),f=new Array(c.length+1),p=new Array(c.length),w=0;w<c.length;)f[w]=c[w],p[w]=m[c[w++]];return f[w]=d,Function.apply(null,f).apply(null,p)}return Function(d)()}for(var I=new Array(arguments.length-1),E=0;E<I.length;)I[E]=arguments[++E];if(E=0,m=m.replace(/%([%dfijs])/g,function(h,C){var A=I[E++];switch(C){case"d":case"f":return String(Number(A));case"i":return String(Math.floor(A));case"j":return JSON.stringify(A);case"s":return String(A)}return"%"}),E!==I.length)throw Error("parameter count mismatch");return l.push(m),g}function b(m){return"function "+(m||y||"")+"("+(R&&R.join(",")||"")+"){\n "+l.join("\n ")+"\n}"}return g.toString=b,g}Y.exports=K,K.verbose=!1},9889:Y=>{"use strict";function K(){this._listeners={}}Y.exports=K,K.prototype.on=function(y,l,g){return(this._listeners[y]||(this._listeners[y]=[])).push({fn:l,ctx:g||this}),this},K.prototype.off=function(y,l){if(void 0===y)this._listeners={};else if(void 0===l)this._listeners[y]=[];else for(var g=this._listeners[y],b=0;b<g.length;)g[b].fn===l?g.splice(b,1):++b;return this},K.prototype.emit=function(y){var l=this._listeners[y];if(l){for(var g=[],b=1;b<arguments.length;)g.push(arguments[b++]);for(b=0;b<l.length;)l[b].fn.apply(l[b++].ctx,g)}return this}},8832:(Y,K,R)=>{"use strict";Y.exports=b;var y=R(1280),g=R(716)("fs");function b(m,d,c){return"function"==typeof d?(c=d,d={}):d||(d={}),c?!d.xhr&&g&&g.readFile?g.readFile(m,function(p,w){return p&&typeof XMLHttpRequest<"u"?b.xhr(m,d,c):p?c(p):c(null,d.binary?w:w.toString("utf8"))}):b.xhr(m,d,c):y(b,this,m,d)}b.xhr=function(d,c,f){var p=new XMLHttpRequest;p.onreadystatechange=function(){if(4===p.readyState){if(0!==p.status&&200!==p.status)return f(Error("status "+p.status));if(c.binary){var I=p.response;if(!I){I=[];for(var E=0;E<p.responseText.length;++E)I.push(255&p.responseText.charCodeAt(E))}return f(null,typeof Uint8Array<"u"?new Uint8Array(I):I)}return f(null,p.responseText)}},c.binary&&("overrideMimeType"in p&&p.overrideMimeType("text/plain; charset=x-user-defined"),p.responseType="arraybuffer"),p.open("GET",d),p.send()}},530:Y=>{"use strict";function K(b){return typeof Float32Array<"u"?function(){var m=new Float32Array([-0]),d=new Uint8Array(m.buffer),c=128===d[3];function f(E,v,h){m[0]=E,v[h]=d[0],v[h+1]=d[1],v[h+2]=d[2],v[h+3]=d[3]}function p(E,v,h){m[0]=E,v[h]=d[3],v[h+1]=d[2],v[h+2]=d[1],v[h+3]=d[0]}function w(E,v){return d[0]=E[v],d[1]=E[v+1],d[2]=E[v+2],d[3]=E[v+3],m[0]}function I(E,v){return d[3]=E[v],d[2]=E[v+1],d[1]=E[v+2],d[0]=E[v+3],m[0]}b.writeFloatLE=c?f:p,b.writeFloatBE=c?p:f,b.readFloatLE=c?w:I,b.readFloatBE=c?I:w}():function(){function m(c,f,p,w){var I=f<0?1:0;if(I&&(f=-f),0===f)c(1/f>0?0:2147483648,p,w);else if(isNaN(f))c(2143289344,p,w);else if(f>34028234663852886e22)c((I<<31|2139095040)>>>0,p,w);else if(f<11754943508222875e-54)c((I<<31|Math.round(f/1401298464324817e-60))>>>0,p,w);else{var E=Math.floor(Math.log(f)/Math.LN2);c((I<<31|E+127<<23|8388607&Math.round(f*Math.pow(2,-E)*8388608))>>>0,p,w)}}function d(c,f,p){var w=c(f,p),I=2*(w>>31)+1,E=w>>>23&255,v=8388607&w;return 255===E?v?NaN:I*(1/0):0===E?1401298464324817e-60*I*v:I*Math.pow(2,E-150)*(v+8388608)}b.writeFloatLE=m.bind(null,R),b.writeFloatBE=m.bind(null,y),b.readFloatLE=d.bind(null,l),b.readFloatBE=d.bind(null,g)}(),typeof Float64Array<"u"?function(){var m=new Float64Array([-0]),d=new Uint8Array(m.buffer),c=128===d[7];function f(E,v,h){m[0]=E,v[h]=d[0],v[h+1]=d[1],v[h+2]=d[2],v[h+3]=d[3],v[h+4]=d[4],v[h+5]=d[5],v[h+6]=d[6],v[h+7]=d[7]}function p(E,v,h){m[0]=E,v[h]=d[7],v[h+1]=d[6],v[h+2]=d[5],v[h+3]=d[4],v[h+4]=d[3],v[h+5]=d[2],v[h+6]=d[1],v[h+7]=d[0]}function w(E,v){return d[0]=E[v],d[1]=E[v+1],d[2]=E[v+2],d[3]=E[v+3],d[4]=E[v+4],d[5]=E[v+5],d[6]=E[v+6],d[7]=E[v+7],m[0]}function I(E,v){return d[7]=E[v],d[6]=E[v+1],d[5]=E[v+2],d[4]=E[v+3],d[3]=E[v+4],d[2]=E[v+5],d[1]=E[v+6],d[0]=E[v+7],m[0]}b.writeDoubleLE=c?f:p,b.writeDoubleBE=c?p:f,b.readDoubleLE=c?w:I,b.readDoubleBE=c?I:w}():function(){function m(c,f,p,w,I,E){var v=w<0?1:0;if(v&&(w=-w),0===w)c(0,I,E+f),c(1/w>0?0:2147483648,I,E+p);else if(isNaN(w))c(0,I,E+f),c(2146959360,I,E+p);else if(w>17976931348623157e292)c(0,I,E+f),c((v<<31|2146435072)>>>0,I,E+p);else{var h;if(w<22250738585072014e-324)c((h=w/5e-324)>>>0,I,E+f),c((v<<31|h/4294967296)>>>0,I,E+p);else{var C=Math.floor(Math.log(w)/Math.LN2);1024===C&&(C=1023),c(4503599627370496*(h=w*Math.pow(2,-C))>>>0,I,E+f),c((v<<31|C+1023<<20|1048576*h&1048575)>>>0,I,E+p)}}}function d(c,f,p,w,I){var E=c(w,I+f),v=c(w,I+p),h=2*(v>>31)+1,C=v>>>20&2047,A=4294967296*(1048575&v)+E;return 2047===C?A?NaN:h*(1/0):0===C?5e-324*h*A:h*Math.pow(2,C-1075)*(A+4503599627370496)}b.writeDoubleLE=m.bind(null,R,0,4),b.writeDoubleBE=m.bind(null,y,4,0),b.readDoubleLE=d.bind(null,l,0,4),b.readDoubleBE=d.bind(null,g,4,0)}(),b}function R(b,m,d){m[d]=255&b,m[d+1]=b>>>8&255,m[d+2]=b>>>16&255,m[d+3]=b>>>24}function y(b,m,d){m[d]=b>>>24,m[d+1]=b>>>16&255,m[d+2]=b>>>8&255,m[d+3]=255&b}function l(b,m){return(b[m]|b[m+1]<<8|b[m+2]<<16|b[m+3]<<24)>>>0}function g(b,m){return(b[m]<<24|b[m+1]<<16|b[m+2]<<8|b[m+3])>>>0}Y.exports=K(K)},716:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(Y){}return null}module.exports=inquire},1311:(Y,K)=>{"use strict";var R=K,y=R.isAbsolute=function(b){return/^(?:\/|\w+:)/.test(b)},l=R.normalize=function(b){var m=(b=b.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),d=y(b),c="";d&&(c=m.shift()+"/");for(var f=0;f<m.length;)".."===m[f]?f>0&&".."!==m[f-1]?m.splice(--f,2):d?m.splice(f,1):++f:"."===m[f]?m.splice(f,1):++f;return c+m.join("/")};R.resolve=function(b,m,d){return d||(m=l(m)),y(m)?m:(d||(b=l(b)),(b=b.replace(/(?:\/|^)[^/]+$/,"")).length?l(b+"/"+m):m)}},4479:Y=>{"use strict";Y.exports=function K(R,y,l){var g=l||8192,b=g>>>1,m=null,d=g;return function(f){if(f<1||f>b)return R(f);d+f>g&&(m=R(g),d=0);var p=y.call(m,d,d+=f);return 7&d&&(d=1+(7|d)),p}}},7768:(Y,K)=>{"use strict";var R=K;R.length=function(l){for(var g=0,b=0,m=0;m<l.length;++m)(b=l.charCodeAt(m))<128?g+=1:b<2048?g+=2:55296==(64512&b)&&56320==(64512&l.charCodeAt(m+1))?(++m,g+=4):g+=3;return g},R.read=function(l,g,b){if(b-g<1)return"";for(var p,d=null,c=[],f=0;g<b;)(p=l[g++])<128?c[f++]=p:p>191&&p<224?c[f++]=(31&p)<<6|63&l[g++]:p>239&&p<365?(p=((7&p)<<18|(63&l[g++])<<12|(63&l[g++])<<6|63&l[g++])-65536,c[f++]=55296+(p>>10),c[f++]=56320+(1023&p)):c[f++]=(15&p)<<12|(63&l[g++])<<6|63&l[g++],f>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,c)),f=0);return d?(f&&d.push(String.fromCharCode.apply(String,c.slice(0,f))),d.join("")):String.fromCharCode.apply(String,c.slice(0,f))},R.write=function(l,g,b){for(var d,c,m=b,f=0;f<l.length;++f)(d=l.charCodeAt(f))<128?g[b++]=d:d<2048?(g[b++]=d>>6|192,g[b++]=63&d|128):55296==(64512&d)&&56320==(64512&(c=l.charCodeAt(f+1)))?(++f,g[b++]=(d=65536+((1023&d)<<10)+(1023&c))>>18|240,g[b++]=d>>12&63|128,g[b++]=d>>6&63|128,g[b++]=63&d|128):(g[b++]=d>>12|224,g[b++]=d>>6&63|128,g[b++]=63&d|128);return b-m}},4502:(Y,K,R)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});var y=R(8046);function d(Z,q,te){return void 0===q&&(q=new Uint8Array(2)),void 0===te&&(te=0),q[te+0]=Z>>>8,q[te+1]=Z>>>0,q}function c(Z,q,te){return void 0===q&&(q=new Uint8Array(2)),void 0===te&&(te=0),q[te+0]=Z>>>0,q[te+1]=Z>>>8,q}function f(Z,q){return void 0===q&&(q=0),Z[q]<<24|Z[q+1]<<16|Z[q+2]<<8|Z[q+3]}function p(Z,q){return void 0===q&&(q=0),(Z[q]<<24|Z[q+1]<<16|Z[q+2]<<8|Z[q+3])>>>0}function w(Z,q){return void 0===q&&(q=0),Z[q+3]<<24|Z[q+2]<<16|Z[q+1]<<8|Z[q]}function I(Z,q){return void 0===q&&(q=0),(Z[q+3]<<24|Z[q+2]<<16|Z[q+1]<<8|Z[q])>>>0}function E(Z,q,te){return void 0===q&&(q=new Uint8Array(4)),void 0===te&&(te=0),q[te+0]=Z>>>24,q[te+1]=Z>>>16,q[te+2]=Z>>>8,q[te+3]=Z>>>0,q}function v(Z,q,te){return void 0===q&&(q=new Uint8Array(4)),void 0===te&&(te=0),q[te+0]=Z>>>0,q[te+1]=Z>>>8,q[te+2]=Z>>>16,q[te+3]=Z>>>24,q}function S(Z,q,te){return void 0===q&&(q=new Uint8Array(8)),void 0===te&&(te=0),E(Z/4294967296>>>0,q,te),E(Z>>>0,q,te+4),q}function D(Z,q,te){return void 0===q&&(q=new Uint8Array(8)),void 0===te&&(te=0),v(Z>>>0,q,te),v(Z/4294967296>>>0,q,te+4),q}K.readInt16BE=function l(Z,q){return void 0===q&&(q=0),(Z[q+0]<<8|Z[q+1])<<16>>16},K.readUint16BE=function g(Z,q){return void 0===q&&(q=0),(Z[q+0]<<8|Z[q+1])>>>0},K.readInt16LE=function b(Z,q){return void 0===q&&(q=0),(Z[q+1]<<8|Z[q])<<16>>16},K.readUint16LE=function m(Z,q){return void 0===q&&(q=0),(Z[q+1]<<8|Z[q])>>>0},K.writeUint16BE=d,K.writeInt16BE=d,K.writeUint16LE=c,K.writeInt16LE=c,K.readInt32BE=f,K.readUint32BE=p,K.readInt32LE=w,K.readUint32LE=I,K.writeUint32BE=E,K.writeInt32BE=E,K.writeUint32LE=v,K.writeInt32LE=v,K.readInt64BE=function h(Z,q){void 0===q&&(q=0);var te=f(Z,q),oe=f(Z,q+4);return 4294967296*te+oe-4294967296*(oe>>31)},K.readUint64BE=function C(Z,q){return void 0===q&&(q=0),4294967296*p(Z,q)+p(Z,q+4)},K.readInt64LE=function A(Z,q){void 0===q&&(q=0);var te=w(Z,q);return 4294967296*w(Z,q+4)+te-4294967296*(te>>31)},K.readUint64LE=function N(Z,q){void 0===q&&(q=0);var te=I(Z,q);return 4294967296*I(Z,q+4)+te},K.writeUint64BE=S,K.writeInt64BE=S,K.writeUint64LE=D,K.writeInt64LE=D,K.readUintBE=function M(Z,q,te){if(void 0===te&&(te=0),Z%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(Z/8>q.length-te)throw new Error("readUintBE: array is too short for the given bitLength");for(var oe=0,de=1,he=Z/8+te-1;he>=te;he--)oe+=q[he]*de,de*=256;return oe},K.readUintLE=function k(Z,q,te){if(void 0===te&&(te=0),Z%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(Z/8>q.length-te)throw new Error("readUintLE: array is too short for the given bitLength");for(var oe=0,de=1,he=te;he<te+Z/8;he++)oe+=q[he]*de,de*=256;return oe},K.writeUintBE=function F(Z,q,te,oe){if(void 0===te&&(te=new Uint8Array(Z/8)),void 0===oe&&(oe=0),Z%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!y.isSafeInteger(q))throw new Error("writeUintBE value must be an integer");for(var de=1,he=Z/8+oe-1;he>=oe;he--)te[he]=q/de&255,de*=256;return te},K.writeUintLE=function G(Z,q,te,oe){if(void 0===te&&(te=new Uint8Array(Z/8)),void 0===oe&&(oe=0),Z%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!y.isSafeInteger(q))throw new Error("writeUintLE value must be an integer");for(var de=1,he=oe;he<oe+Z/8;he++)te[he]=q/de&255,de*=256;return te},K.readFloat32BE=function T(Z,q){return void 0===q&&(q=0),new DataView(Z.buffer,Z.byteOffset,Z.byteLength).getFloat32(q)},K.readFloat32LE=function O(Z,q){return void 0===q&&(q=0),new DataView(Z.buffer,Z.byteOffset,Z.byteLength).getFloat32(q,!0)},K.readFloat64BE=function V(Z,q){return void 0===q&&(q=0),new DataView(Z.buffer,Z.byteOffset,Z.byteLength).getFloat64(q)},K.readFloat64LE=function L(Z,q){return void 0===q&&(q=0),new DataView(Z.buffer,Z.byteOffset,Z.byteLength).getFloat64(q,!0)},K.writeFloat32BE=function H(Z,q,te){return void 0===q&&(q=new Uint8Array(4)),void 0===te&&(te=0),new DataView(q.buffer,q.byteOffset,q.byteLength).setFloat32(te,Z),q},K.writeFloat32LE=function ne(Z,q,te){return void 0===q&&(q=new Uint8Array(4)),void 0===te&&(te=0),new DataView(q.buffer,q.byteOffset,q.byteLength).setFloat32(te,Z,!0),q},K.writeFloat64BE=function j(Z,q,te){return void 0===q&&(q=new Uint8Array(8)),void 0===te&&(te=0),new DataView(q.buffer,q.byteOffset,q.byteLength).setFloat64(te,Z),q},K.writeFloat64LE=function ee(Z,q,te){return void 0===q&&(q=new Uint8Array(8)),void 0===te&&(te=0),new DataView(q.buffer,q.byteOffset,q.byteLength).setFloat64(te,Z,!0),q}},4484:(Y,K,R)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});var y=R(4502),l=R(9815);function b(f,p,w){for(var I=1634760805,E=857760878,v=2036477234,h=1797285236,C=w[3]<<24|w[2]<<16|w[1]<<8|w[0],A=w[7]<<24|w[6]<<16|w[5]<<8|w[4],N=w[11]<<24|w[10]<<16|w[9]<<8|w[8],S=w[15]<<24|w[14]<<16|w[13]<<8|w[12],D=w[19]<<24|w[18]<<16|w[17]<<8|w[16],M=w[23]<<24|w[22]<<16|w[21]<<8|w[20],k=w[27]<<24|w[26]<<16|w[25]<<8|w[24],F=w[31]<<24|w[30]<<16|w[29]<<8|w[28],G=p[3]<<24|p[2]<<16|p[1]<<8|p[0],T=p[7]<<24|p[6]<<16|p[5]<<8|p[4],O=p[11]<<24|p[10]<<16|p[9]<<8|p[8],V=p[15]<<24|p[14]<<16|p[13]<<8|p[12],L=I,H=E,ne=v,j=h,ee=C,Z=A,q=N,te=S,oe=D,de=M,he=k,Pe=F,Se=G,Be=T,ve=O,He=V,ke=0;ke<20;ke+=2)ee=(ee^=oe=oe+(Se=(Se^=L=L+ee|0)>>>16|Se<<16)|0)>>>20|ee<<12,Z=(Z^=de=de+(Be=(Be^=H=H+Z|0)>>>16|Be<<16)|0)>>>20|Z<<12,q=(q^=he=he+(ve=(ve^=ne=ne+q|0)>>>16|ve<<16)|0)>>>20|q<<12,te=(te^=Pe=Pe+(He=(He^=j=j+te|0)>>>16|He<<16)|0)>>>20|te<<12,q=(q^=he=he+(ve=(ve^=ne=ne+q|0)>>>24|ve<<8)|0)>>>25|q<<7,te=(te^=Pe=Pe+(He=(He^=j=j+te|0)>>>24|He<<8)|0)>>>25|te<<7,Z=(Z^=de=de+(Be=(Be^=H=H+Z|0)>>>24|Be<<8)|0)>>>25|Z<<7,ee=(ee^=oe=oe+(Se=(Se^=L=L+ee|0)>>>24|Se<<8)|0)>>>25|ee<<7,Z=(Z^=he=he+(He=(He^=L=L+Z|0)>>>16|He<<16)|0)>>>20|Z<<12,q=(q^=Pe=Pe+(Se=(Se^=H=H+q|0)>>>16|Se<<16)|0)>>>20|q<<12,te=(te^=oe=oe+(Be=(Be^=ne=ne+te|0)>>>16|Be<<16)|0)>>>20|te<<12,ee=(ee^=de=de+(ve=(ve^=j=j+ee|0)>>>16|ve<<16)|0)>>>20|ee<<12,te=(te^=oe=oe+(Be=(Be^=ne=ne+te|0)>>>24|Be<<8)|0)>>>25|te<<7,ee=(ee^=de=de+(ve=(ve^=j=j+ee|0)>>>24|ve<<8)|0)>>>25|ee<<7,q=(q^=Pe=Pe+(Se=(Se^=H=H+q|0)>>>24|Se<<8)|0)>>>25|q<<7,Z=(Z^=he=he+(He=(He^=L=L+Z|0)>>>24|He<<8)|0)>>>25|Z<<7;y.writeUint32LE(L+I|0,f,0),y.writeUint32LE(H+E|0,f,4),y.writeUint32LE(ne+v|0,f,8),y.writeUint32LE(j+h|0,f,12),y.writeUint32LE(ee+C|0,f,16),y.writeUint32LE(Z+A|0,f,20),y.writeUint32LE(q+N|0,f,24),y.writeUint32LE(te+S|0,f,28),y.writeUint32LE(oe+D|0,f,32),y.writeUint32LE(de+M|0,f,36),y.writeUint32LE(he+k|0,f,40),y.writeUint32LE(Pe+F|0,f,44),y.writeUint32LE(Se+G|0,f,48),y.writeUint32LE(Be+T|0,f,52),y.writeUint32LE(ve+O|0,f,56),y.writeUint32LE(He+V|0,f,60)}function m(f,p,w,I,E){if(void 0===E&&(E=0),32!==f.length)throw new Error("ChaCha: key size must be 32 bytes");if(I.length<w.length)throw new Error("ChaCha: destination is shorter than source");var v,h;if(0===E){if(8!==p.length&&12!==p.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");(v=new Uint8Array(16)).set(p,h=v.length-p.length)}else{if(16!==p.length)throw new Error("ChaCha nonce with counter must be 16 bytes");v=p,h=E}for(var C=new Uint8Array(64),A=0;A<w.length;A+=64){b(C,v,f);for(var N=A;N<A+64&&N<w.length;N++)I[N]=w[N]^C[N-A];c(v,0,h)}return l.wipe(C),0===E&&l.wipe(v),I}function c(f,p,w){for(var I=1;w--;)f[p]=255&(I=I+(255&f[p])|0),I>>>=8,p++;if(I>0)throw new Error("ChaCha: counter overflow")}K.streamXOR=m,K.stream=function d(f,p,w,I){return void 0===I&&(I=0),l.wipe(w),m(f,p,w,w,I)}},1780:(Y,K,R)=>{"use strict";var l=R(4484),g=R(314),b=R(9815),m=R(4502),d=R(9976);K.Cv=32,K.WH=12,K.pg=16;var c=new Uint8Array(16),f=function(){function p(w){if(this.nonceLength=K.WH,this.tagLength=K.pg,w.length!==K.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(w)}return p.prototype.seal=function(w,I,E,v){if(w.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var h=new Uint8Array(16);h.set(w,h.length-w.length);var C=new Uint8Array(32);l.stream(this._key,h,C,4);var N,A=I.length+this.tagLength;if(v){if(v.length!==A)throw new Error("ChaCha20Poly1305: incorrect destination length");N=v}else N=new Uint8Array(A);return l.streamXOR(this._key,h,I,N,4),this._authenticate(N.subarray(N.length-this.tagLength,N.length),C,N.subarray(0,N.length-this.tagLength),E),b.wipe(h),N},p.prototype.open=function(w,I,E,v){if(w.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(I.length<this.tagLength)return null;var h=new Uint8Array(16);h.set(w,h.length-w.length);var C=new Uint8Array(32);l.stream(this._key,h,C,4);var A=new Uint8Array(this.tagLength);if(this._authenticate(A,C,I.subarray(0,I.length-this.tagLength),E),!d.equal(A,I.subarray(I.length-this.tagLength,I.length)))return null;var S,N=I.length-this.tagLength;if(v){if(v.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");S=v}else S=new Uint8Array(N);return l.streamXOR(this._key,h,I.subarray(0,I.length-this.tagLength),S,4),b.wipe(h),S},p.prototype.clean=function(){return b.wipe(this._key),this},p.prototype._authenticate=function(w,I,E,v){var h=new g.Poly1305(I);v&&(h.update(v),v.length%16>0&&h.update(c.subarray(v.length%16))),h.update(E),E.length%16>0&&h.update(c.subarray(E.length%16));var C=new Uint8Array(8);v&&m.writeUint64LE(v.length,C),h.update(C),m.writeUint64LE(E.length,C),h.update(C);for(var A=h.digest(),N=0;N<A.length;N++)w[N]=A[N];h.clean(),b.wipe(A),b.wipe(C)},p}();K.OK=f},9976:(Y,K)=>{"use strict";function l(b,m){if(b.length!==m.length)return 0;for(var d=0,c=0;c<b.length;c++)d|=b[c]^m[c];return 1&d-1>>>8}Object.defineProperty(K,"__esModule",{value:!0}),K.select=function R(b,m,d){return~(b-1)&m|b-1&d},K.lessOrEqual=function y(b,m){return(0|b)-(0|m)-1>>>31&1},K.compare=l,K.equal=function g(b,m){return 0!==b.length&&0!==m.length&&0!==l(b,m)}},5571:(Y,K)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0}),K.isSerializableHash=function R(y){return typeof y.saveState<"u"&&typeof y.restoreState<"u"&&typeof y.cleanSavedState<"u"}},5705:(Y,K,R)=>{"use strict";var l=R(4193),g=R(9815),b=function(){function m(d,c,f,p){void 0===f&&(f=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=d,this._info=p;var w=l.hmac(this._hash,f,c);this._hmac=new l.HMAC(d,w),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return m.prototype._fillBuffer=function(){this._counter[0]++;var d=this._counter[0];if(0===d)throw new Error("hkdf: cannot expand more");this._hmac.reset(),d>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},m.prototype.expand=function(d){for(var c=new Uint8Array(d),f=0;f<c.length;f++)this._bufpos===this._buffer.length&&this._fillBuffer(),c[f]=this._buffer[this._bufpos++];return c},m.prototype.clean=function(){this._hmac.clean(),g.wipe(this._buffer),g.wipe(this._counter),this._bufpos=0},m}();K.t=b},4193:(Y,K,R)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});var y=R(5571),l=R(9976),g=R(9815),b=function(){function d(c,f){this._finished=!1,this._inner=new c,this._outer=new c,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var p=new Uint8Array(this.blockSize);f.length>this.blockSize?this._inner.update(f).finish(p).clean():p.set(f);for(var w=0;w<p.length;w++)p[w]^=54;for(this._inner.update(p),w=0;w<p.length;w++)p[w]^=106;this._outer.update(p),y.isSerializableHash(this._inner)&&y.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),g.wipe(p)}return d.prototype.reset=function(){if(!y.isSerializableHash(this._inner)||!y.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},d.prototype.clean=function(){y.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),y.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},d.prototype.update=function(c){return this._inner.update(c),this},d.prototype.finish=function(c){return this._finished?(this._outer.finish(c),this):(this._inner.finish(c),this._outer.update(c.subarray(0,this.digestLength)).finish(c),this._finished=!0,this)},d.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},d.prototype.saveState=function(){if(!y.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},d.prototype.restoreState=function(c){if(!y.isSerializableHash(this._inner)||!y.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(c),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},d.prototype.cleanSavedState=function(c){if(!y.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(c)},d}();K.HMAC=b,K.hmac=function m(d,c,f){var p=new b(d,c);p.update(f);var w=p.digest();return p.clean(),w},K.equal=l.equal},8046:(Y,K)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0}),K.mul=Math.imul||function R(d,c){var p=65535&d,I=65535&c;return p*I+((d>>>16&65535)*I+p*(c>>>16&65535)<<16>>>0)|0},K.add=function y(d,c){return d+c|0},K.sub=function l(d,c){return d-c|0},K.rotl=function g(d,c){return d<<c|d>>>32-c},K.rotr=function b(d,c){return d<<32-c|d>>>c},K.isInteger=Number.isInteger||function m(d){return"number"==typeof d&&isFinite(d)&&Math.floor(d)===d},K.MAX_SAFE_INTEGER=9007199254740991,K.isSafeInteger=function(d){return K.isInteger(d)&&d>=-K.MAX_SAFE_INTEGER&&d<=K.MAX_SAFE_INTEGER}},314:(Y,K,R)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});var y=R(9976),l=R(9815);K.DIGEST_LENGTH=16;var g=function(){function d(c){this.digestLength=K.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var f=c[0]|c[1]<<8;this._r[0]=8191&f;var p=c[2]|c[3]<<8;this._r[1]=8191&(f>>>13|p<<3);var w=c[4]|c[5]<<8;this._r[2]=7939&(p>>>10|w<<6);var I=c[6]|c[7]<<8;this._r[3]=8191&(w>>>7|I<<9);var E=c[8]|c[9]<<8;this._r[4]=255&(I>>>4|E<<12),this._r[5]=E>>>1&8190;var v=c[10]|c[11]<<8;this._r[6]=8191&(E>>>14|v<<2);var h=c[12]|c[13]<<8;this._r[7]=8065&(v>>>11|h<<5);var C=c[14]|c[15]<<8;this._r[8]=8191&(h>>>8|C<<8),this._r[9]=C>>>5&127,this._pad[0]=c[16]|c[17]<<8,this._pad[1]=c[18]|c[19]<<8,this._pad[2]=c[20]|c[21]<<8,this._pad[3]=c[22]|c[23]<<8,this._pad[4]=c[24]|c[25]<<8,this._pad[5]=c[26]|c[27]<<8,this._pad[6]=c[28]|c[29]<<8,this._pad[7]=c[30]|c[31]<<8}return d.prototype._blocks=function(c,f,p){for(var w=this._fin?0:2048,I=this._h[0],E=this._h[1],v=this._h[2],h=this._h[3],C=this._h[4],A=this._h[5],N=this._h[6],S=this._h[7],D=this._h[8],M=this._h[9],k=this._r[0],F=this._r[1],G=this._r[2],T=this._r[3],O=this._r[4],V=this._r[5],L=this._r[6],H=this._r[7],ne=this._r[8],j=this._r[9];p>=16;){var ee=c[f+0]|c[f+1]<<8,Z=c[f+2]|c[f+3]<<8,q=c[f+4]|c[f+5]<<8,te=c[f+6]|c[f+7]<<8,oe=c[f+8]|c[f+9]<<8,de=c[f+10]|c[f+11]<<8,he=c[f+12]|c[f+13]<<8,Pe=c[f+14]|c[f+15]<<8,Se=0,Be=Se;Be+=(I+=8191&ee)*k,Be+=(E+=8191&(ee>>>13|Z<<3))*(5*j),Be+=(v+=8191&(Z>>>10|q<<6))*(5*ne),Be+=(h+=8191&(q>>>7|te<<9))*(5*H),Se=(Be+=(C+=8191&(te>>>4|oe<<12))*(5*L))>>>13,Be&=8191,Be+=(A+=oe>>>1&8191)*(5*V),Be+=(N+=8191&(oe>>>14|de<<2))*(5*O),Be+=(S+=8191&(de>>>11|he<<5))*(5*T),Be+=(D+=8191&(he>>>8|Pe<<8))*(5*G);var ve=Se+=(Be+=(M+=Pe>>>5|w)*(5*F))>>>13;ve+=I*F,ve+=E*k,ve+=v*(5*j),ve+=h*(5*ne),Se=(ve+=C*(5*H))>>>13,ve&=8191,ve+=A*(5*L),ve+=N*(5*V),ve+=S*(5*O),ve+=D*(5*T),Se+=(ve+=M*(5*G))>>>13,ve&=8191;var He=Se;He+=I*G,He+=E*F,He+=v*k,He+=h*(5*j),Se=(He+=C*(5*ne))>>>13,He&=8191,He+=A*(5*H),He+=N*(5*L),He+=S*(5*V),He+=D*(5*O);var ke=Se+=(He+=M*(5*T))>>>13;ke+=I*T,ke+=E*G,ke+=v*F,ke+=h*k,Se=(ke+=C*(5*j))>>>13,ke&=8191,ke+=A*(5*ne),ke+=N*(5*H),ke+=S*(5*L),ke+=D*(5*V);var nt=Se+=(ke+=M*(5*O))>>>13;nt+=I*O,nt+=E*T,nt+=v*G,nt+=h*F,Se=(nt+=C*k)>>>13,nt&=8191,nt+=A*(5*j),nt+=N*(5*ne),nt+=S*(5*H),nt+=D*(5*L);var Rt=Se+=(nt+=M*(5*V))>>>13;Rt+=I*V,Rt+=E*O,Rt+=v*T,Rt+=h*G,Se=(Rt+=C*F)>>>13,Rt&=8191,Rt+=A*k,Rt+=N*(5*j),Rt+=S*(5*ne),Rt+=D*(5*H);var wt=Se+=(Rt+=M*(5*L))>>>13;wt+=I*L,wt+=E*V,wt+=v*O,wt+=h*T,Se=(wt+=C*G)>>>13,wt&=8191,wt+=A*F,wt+=N*k,wt+=S*(5*j),wt+=D*(5*ne);var Ft=Se+=(wt+=M*(5*H))>>>13;Ft+=I*H,Ft+=E*L,Ft+=v*V,Ft+=h*O,Se=(Ft+=C*T)>>>13,Ft&=8191,Ft+=A*G,Ft+=N*F,Ft+=S*k,Ft+=D*(5*j);var qt=Se+=(Ft+=M*(5*ne))>>>13;qt+=I*ne,qt+=E*H,qt+=v*L,qt+=h*V,Se=(qt+=C*O)>>>13,qt&=8191,qt+=A*T,qt+=N*G,qt+=S*F,qt+=D*k;var Jt=Se+=(qt+=M*(5*j))>>>13;Jt+=I*j,Jt+=E*ne,Jt+=v*H,Jt+=h*L,Se=(Jt+=C*V)>>>13,Jt&=8191,Jt+=A*O,Jt+=N*T,Jt+=S*G,Jt+=D*F,I=Be=8191&(Se=(Se=((Se+=(Jt+=M*k)>>>13)<<2)+Se|0)+(Be&=8191)|0),E=ve+=Se>>>=13,v=He&=8191,h=ke&=8191,C=nt&=8191,A=Rt&=8191,N=wt&=8191,S=Ft&=8191,D=qt&=8191,M=Jt&=8191,f+=16,p-=16}this._h[0]=I,this._h[1]=E,this._h[2]=v,this._h[3]=h,this._h[4]=C,this._h[5]=A,this._h[6]=N,this._h[7]=S,this._h[8]=D,this._h[9]=M},d.prototype.finish=function(c,f){void 0===f&&(f=0);var w,I,E,v,p=new Uint16Array(10);if(this._leftover){for(v=this._leftover,this._buffer[v++]=1;v<16;v++)this._buffer[v]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,v=2;v<10;v++)this._h[v]+=w,w=this._h[v]>>>13,this._h[v]&=8191;for(this._h[0]+=5*w,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,p[0]=this._h[0]+5,w=p[0]>>>13,p[0]&=8191,v=1;v<10;v++)p[v]=this._h[v]+w,w=p[v]>>>13,p[v]&=8191;for(p[9]-=8192,I=(1^w)-1,v=0;v<10;v++)p[v]&=I;for(I=~I,v=0;v<10;v++)this._h[v]=this._h[v]&I|p[v];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),this._h[0]=65535&(E=this._h[0]+this._pad[0]),v=1;v<8;v++)this._h[v]=65535&(E=(this._h[v]+this._pad[v]|0)+(E>>>16)|0);return c[f+0]=this._h[0]>>>0,c[f+1]=this._h[0]>>>8,c[f+2]=this._h[1]>>>0,c[f+3]=this._h[1]>>>8,c[f+4]=this._h[2]>>>0,c[f+5]=this._h[2]>>>8,c[f+6]=this._h[3]>>>0,c[f+7]=this._h[3]>>>8,c[f+8]=this._h[4]>>>0,c[f+9]=this._h[4]>>>8,c[f+10]=this._h[5]>>>0,c[f+11]=this._h[5]>>>8,c[f+12]=this._h[6]>>>0,c[f+13]=this._h[6]>>>8,c[f+14]=this._h[7]>>>0,c[f+15]=this._h[7]>>>8,this._finished=!0,this},d.prototype.update=function(c){var w,f=0,p=c.length;if(this._leftover){(w=16-this._leftover)>p&&(w=p);for(var I=0;I<w;I++)this._buffer[this._leftover+I]=c[f+I];if(p-=w,f+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(p>=16&&(this._blocks(c,f,w=p-p%16),f+=w,p-=w),p){for(I=0;I<p;I++)this._buffer[this._leftover+I]=c[f+I];this._leftover+=p}return this},d.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var c=new Uint8Array(16);return this.finish(c),c},d.prototype.clean=function(){return l.wipe(this._buffer),l.wipe(this._r),l.wipe(this._h),l.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},d}();K.Poly1305=g,K.oneTimeAuth=function b(d,c){var f=new g(d);f.update(c);var p=f.digest();return f.clean(),p},K.equal=function m(d,c){return d.length===K.DIGEST_LENGTH&&c.length===K.DIGEST_LENGTH&&y.equal(d,c)}},5784:(Y,K,R)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0}),K.randomStringForEntropy=K.randomString=K.randomUint32=K.randomBytes=K.defaultRandomSource=void 0;const y=R(9753),l=R(4502),g=R(9815);function b(p,w=K.defaultRandomSource){return w.randomBytes(p)}K.defaultRandomSource=new y.SystemRandomSource,K.randomBytes=b,K.randomUint32=function m(p=K.defaultRandomSource){const w=b(4,p),I=(0,l.readUint32LE)(w);return(0,g.wipe)(w),I};const d="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(p,w=d,I=K.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let E="";const v=w.length,h=256-256%v;for(;p>0;){const C=b(Math.ceil(256*p/h),I);for(let A=0;A<C.length&&p>0;A++){const N=C[A];N<h&&(E+=w.charAt(N%v),p--)}(0,g.wipe)(C)}return E}K.randomString=c,K.randomStringForEntropy=function f(p,w=d,I=K.defaultRandomSource){return c(Math.ceil(p/(Math.log(w.length)/Math.LN2)),w,I)}},7170:(Y,K)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0}),K.BrowserRandomSource=void 0,K.BrowserRandomSource=class y{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const g=typeof self<"u"?self.crypto||self.msCrypto:null;g&&void 0!==g.getRandomValues&&(this._crypto=g,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(g){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const b=new Uint8Array(g);for(let m=0;m<b.length;m+=65536)this._crypto.getRandomValues(b.subarray(m,m+Math.min(b.length-m,65536)));return b}}},1382:(Y,K,R)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0}),K.NodeRandomSource=void 0;const y=R(9815);K.NodeRandomSource=class l{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const b=R(5883);b&&b.randomBytes&&(this._crypto=b,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(b){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let m=this._crypto.randomBytes(b);if(m.length!==b)throw new Error("NodeRandomSource: got fewer bytes than requested");const d=new Uint8Array(b);for(let c=0;c<d.length;c++)d[c]=m[c];return(0,y.wipe)(m),d}}},9753:(Y,K,R)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0}),K.SystemRandomSource=void 0;const y=R(7170),l=R(1382);K.SystemRandomSource=class g{constructor(){return this.isAvailable=!1,this.name="",this._source=new y.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new l.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(m){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(m)}}},893:(Y,K,R)=>{"use strict";var l=R(4502),g=R(9815);K.k=32,K.cn=64;var b=function(){function f(){this.digestLength=K.k,this.blockSize=K.cn,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){g.wipe(this._buffer),g.wipe(this._temp),this.reset()},f.prototype.update=function(p,w){if(void 0===w&&(w=p.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var I=0;if(this._bytesHashed+=w,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&w>0;)this._buffer[this._bufferLength++]=p[I++],w--;this._bufferLength===this.blockSize&&(d(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(w>=this.blockSize&&(I=d(this._temp,this._state,p,I,w),w%=this.blockSize);w>0;)this._buffer[this._bufferLength++]=p[I++],w--;return this},f.prototype.finish=function(p){if(!this._finished){var w=this._bytesHashed,I=this._bufferLength,E=w/536870912|0,v=w<<3,h=w%64<56?64:128;this._buffer[I]=128;for(var C=I+1;C<h-8;C++)this._buffer[C]=0;l.writeUint32BE(E,this._buffer,h-8),l.writeUint32BE(v,this._buffer,h-4),d(this._temp,this._state,this._buffer,0,h),this._finished=!0}for(C=0;C<this.digestLength/4;C++)l.writeUint32BE(this._state[C],p,4*C);return this},f.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(p){return this._state.set(p.state),this._bufferLength=p.bufferLength,p.buffer&&this._buffer.set(p.buffer),this._bytesHashed=p.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(p){g.wipe(p.state),p.buffer&&g.wipe(p.buffer),p.bufferLength=0,p.bytesHashed=0},f}();K.mE=b;var m=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function d(f,p,w,I,E){for(;E>=64;){for(var v=p[0],h=p[1],C=p[2],A=p[3],N=p[4],S=p[5],D=p[6],M=p[7],k=0;k<16;k++)f[k]=l.readUint32BE(w,I+4*k);for(k=16;k<64;k++){var G=f[k-2];f[k]=((T=(G>>>17|G<<15)^(G>>>19|G<<13)^G>>>10)+f[k-7]|0)+((O=((G=f[k-15])>>>7|G<<25)^(G>>>18|G<<14)^G>>>3)+f[k-16]|0)}for(k=0;k<64;k++){var T=(((N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7))+(N&S^~N&D)|0)+(M+(m[k]+f[k]|0)|0)|0,O=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&h^v&C^h&C)|0;M=D,D=S,S=N,N=A+T|0,A=C,C=h,h=v,v=T+O|0}p[0]+=v,p[1]+=h,p[2]+=C,p[3]+=A,p[4]+=N,p[5]+=S,p[6]+=D,p[7]+=M,I+=64,E-=64}return I}K.vp=function c(f){var p=new b;p.update(f);var w=p.digest();return p.clean(),w}},9815:(Y,K)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0}),K.wipe=function R(y){for(var l=0;l<y.length;l++)y[l]=0;return y}},5006:(Y,K,R)=>{"use strict";K.gi=K.Au=K._w=K.KS=K.kz=void 0;const l=R(5784),g=R(9815);function b(k){const F=new Float64Array(16);if(k)for(let G=0;G<k.length;G++)F[G]=k[G];return F}K.kz=32,K.KS=32;const m=new Uint8Array(32);m[0]=9;const d=b([56129,1]);function c(k){let F=1;for(let G=0;G<16;G++){let T=k[G]+F+65535;F=Math.floor(T/65536),k[G]=T-65536*F}k[0]+=F-1+37*(F-1)}function f(k,F,G){const T=~(G-1);for(let O=0;O<16;O++){const V=T&(k[O]^F[O]);k[O]^=V,F[O]^=V}}function I(k,F,G){for(let T=0;T<16;T++)k[T]=F[T]+G[T]}function E(k,F,G){for(let T=0;T<16;T++)k[T]=F[T]-G[T]}function v(k,F,G){let T,O,V=0,L=0,H=0,ne=0,j=0,ee=0,Z=0,q=0,te=0,oe=0,de=0,he=0,Pe=0,Se=0,Be=0,ve=0,He=0,ke=0,nt=0,Rt=0,wt=0,Ft=0,qt=0,Jt=0,rn=0,Vn=0,Rr=0,En=0,Oi=0,qr=0,ns=0,ie=G[0],le=G[1],ge=G[2],ye=G[3],be=G[4],Ae=G[5],ze=G[6],Ge=G[7],et=G[8],Je=G[9],Fe=G[10],Ee=G[11],pe=G[12],we=G[13],Le=G[14],Me=G[15];T=F[0],V+=T*ie,L+=T*le,H+=T*ge,ne+=T*ye,j+=T*be,ee+=T*Ae,Z+=T*ze,q+=T*Ge,te+=T*et,oe+=T*Je,de+=T*Fe,he+=T*Ee,Pe+=T*pe,Se+=T*we,Be+=T*Le,ve+=T*Me,T=F[1],L+=T*ie,H+=T*le,ne+=T*ge,j+=T*ye,ee+=T*be,Z+=T*Ae,q+=T*ze,te+=T*Ge,oe+=T*et,de+=T*Je,he+=T*Fe,Pe+=T*Ee,Se+=T*pe,Be+=T*we,ve+=T*Le,He+=T*Me,T=F[2],H+=T*ie,ne+=T*le,j+=T*ge,ee+=T*ye,Z+=T*be,q+=T*Ae,te+=T*ze,oe+=T*Ge,de+=T*et,he+=T*Je,Pe+=T*Fe,Se+=T*Ee,Be+=T*pe,ve+=T*we,He+=T*Le,ke+=T*Me,T=F[3],ne+=T*ie,j+=T*le,ee+=T*ge,Z+=T*ye,q+=T*be,te+=T*Ae,oe+=T*ze,de+=T*Ge,he+=T*et,Pe+=T*Je,Se+=T*Fe,Be+=T*Ee,ve+=T*pe,He+=T*we,ke+=T*Le,nt+=T*Me,T=F[4],j+=T*ie,ee+=T*le,Z+=T*ge,q+=T*ye,te+=T*be,oe+=T*Ae,de+=T*ze,he+=T*Ge,Pe+=T*et,Se+=T*Je,Be+=T*Fe,ve+=T*Ee,He+=T*pe,ke+=T*we,nt+=T*Le,Rt+=T*Me,T=F[5],ee+=T*ie,Z+=T*le,q+=T*ge,te+=T*ye,oe+=T*be,de+=T*Ae,he+=T*ze,Pe+=T*Ge,Se+=T*et,Be+=T*Je,ve+=T*Fe,He+=T*Ee,ke+=T*pe,nt+=T*we,Rt+=T*Le,wt+=T*Me,T=F[6],Z+=T*ie,q+=T*le,te+=T*ge,oe+=T*ye,de+=T*be,he+=T*Ae,Pe+=T*ze,Se+=T*Ge,Be+=T*et,ve+=T*Je,He+=T*Fe,ke+=T*Ee,nt+=T*pe,Rt+=T*we,wt+=T*Le,Ft+=T*Me,T=F[7],q+=T*ie,te+=T*le,oe+=T*ge,de+=T*ye,he+=T*be,Pe+=T*Ae,Se+=T*ze,Be+=T*Ge,ve+=T*et,He+=T*Je,ke+=T*Fe,nt+=T*Ee,Rt+=T*pe,wt+=T*we,Ft+=T*Le,qt+=T*Me,T=F[8],te+=T*ie,oe+=T*le,de+=T*ge,he+=T*ye,Pe+=T*be,Se+=T*Ae,Be+=T*ze,ve+=T*Ge,He+=T*et,ke+=T*Je,nt+=T*Fe,Rt+=T*Ee,wt+=T*pe,Ft+=T*we,qt+=T*Le,Jt+=T*Me,T=F[9],oe+=T*ie,de+=T*le,he+=T*ge,Pe+=T*ye,Se+=T*be,Be+=T*Ae,ve+=T*ze,He+=T*Ge,ke+=T*et,nt+=T*Je,Rt+=T*Fe,wt+=T*Ee,Ft+=T*pe,qt+=T*we,Jt+=T*Le,rn+=T*Me,T=F[10],de+=T*ie,he+=T*le,Pe+=T*ge,Se+=T*ye,Be+=T*be,ve+=T*Ae,He+=T*ze,ke+=T*Ge,nt+=T*et,Rt+=T*Je,wt+=T*Fe,Ft+=T*Ee,qt+=T*pe,Jt+=T*we,rn+=T*Le,Vn+=T*Me,T=F[11],he+=T*ie,Pe+=T*le,Se+=T*ge,Be+=T*ye,ve+=T*be,He+=T*Ae,ke+=T*ze,nt+=T*Ge,Rt+=T*et,wt+=T*Je,Ft+=T*Fe,qt+=T*Ee,Jt+=T*pe,rn+=T*we,Vn+=T*Le,Rr+=T*Me,T=F[12],Pe+=T*ie,Se+=T*le,Be+=T*ge,ve+=T*ye,He+=T*be,ke+=T*Ae,nt+=T*ze,Rt+=T*Ge,wt+=T*et,Ft+=T*Je,qt+=T*Fe,Jt+=T*Ee,rn+=T*pe,Vn+=T*we,Rr+=T*Le,En+=T*Me,T=F[13],Se+=T*ie,Be+=T*le,ve+=T*ge,He+=T*ye,ke+=T*be,nt+=T*Ae,Rt+=T*ze,wt+=T*Ge,Ft+=T*et,qt+=T*Je,Jt+=T*Fe,rn+=T*Ee,Vn+=T*pe,Rr+=T*we,En+=T*Le,Oi+=T*Me,T=F[14],Be+=T*ie,ve+=T*le,He+=T*ge,ke+=T*ye,nt+=T*be,Rt+=T*Ae,wt+=T*ze,Ft+=T*Ge,qt+=T*et,Jt+=T*Je,rn+=T*Fe,Vn+=T*Ee,Rr+=T*pe,En+=T*we,Oi+=T*Le,qr+=T*Me,T=F[15],ve+=T*ie,He+=T*le,ke+=T*ge,nt+=T*ye,Rt+=T*be,wt+=T*Ae,Ft+=T*ze,qt+=T*Ge,Jt+=T*et,rn+=T*Je,Vn+=T*Fe,Rr+=T*Ee,En+=T*pe,Oi+=T*we,qr+=T*Le,ns+=T*Me,V+=38*He,L+=38*ke,H+=38*nt,ne+=38*Rt,j+=38*wt,ee+=38*Ft,Z+=38*qt,q+=38*Jt,te+=38*rn,oe+=38*Vn,de+=38*Rr,he+=38*En,Pe+=38*Oi,Se+=38*qr,Be+=38*ns,O=1,T=V+O+65535,O=Math.floor(T/65536),V=T-65536*O,T=L+O+65535,O=Math.floor(T/65536),L=T-65536*O,T=H+O+65535,O=Math.floor(T/65536),H=T-65536*O,T=ne+O+65535,O=Math.floor(T/65536),ne=T-65536*O,T=j+O+65535,O=Math.floor(T/65536),j=T-65536*O,T=ee+O+65535,O=Math.floor(T/65536),ee=T-65536*O,T=Z+O+65535,O=Math.floor(T/65536),Z=T-65536*O,T=q+O+65535,O=Math.floor(T/65536),q=T-65536*O,T=te+O+65535,O=Math.floor(T/65536),te=T-65536*O,T=oe+O+65535,O=Math.floor(T/65536),oe=T-65536*O,T=de+O+65535,O=Math.floor(T/65536),de=T-65536*O,T=he+O+65535,O=Math.floor(T/65536),he=T-65536*O,T=Pe+O+65535,O=Math.floor(T/65536),Pe=T-65536*O,T=Se+O+65535,O=Math.floor(T/65536),Se=T-65536*O,T=Be+O+65535,O=Math.floor(T/65536),Be=T-65536*O,T=ve+O+65535,O=Math.floor(T/65536),ve=T-65536*O,V+=O-1+37*(O-1),O=1,T=V+O+65535,O=Math.floor(T/65536),V=T-65536*O,T=L+O+65535,O=Math.floor(T/65536),L=T-65536*O,T=H+O+65535,O=Math.floor(T/65536),H=T-65536*O,T=ne+O+65535,O=Math.floor(T/65536),ne=T-65536*O,T=j+O+65535,O=Math.floor(T/65536),j=T-65536*O,T=ee+O+65535,O=Math.floor(T/65536),ee=T-65536*O,T=Z+O+65535,O=Math.floor(T/65536),Z=T-65536*O,T=q+O+65535,O=Math.floor(T/65536),q=T-65536*O,T=te+O+65535,O=Math.floor(T/65536),te=T-65536*O,T=oe+O+65535,O=Math.floor(T/65536),oe=T-65536*O,T=de+O+65535,O=Math.floor(T/65536),de=T-65536*O,T=he+O+65535,O=Math.floor(T/65536),he=T-65536*O,T=Pe+O+65535,O=Math.floor(T/65536),Pe=T-65536*O,T=Se+O+65535,O=Math.floor(T/65536),Se=T-65536*O,T=Be+O+65535,O=Math.floor(T/65536),Be=T-65536*O,T=ve+O+65535,O=Math.floor(T/65536),ve=T-65536*O,V+=O-1+37*(O-1),k[0]=V,k[1]=L,k[2]=H,k[3]=ne,k[4]=j,k[5]=ee,k[6]=Z,k[7]=q,k[8]=te,k[9]=oe,k[10]=de,k[11]=he,k[12]=Pe,k[13]=Se,k[14]=Be,k[15]=ve}function h(k,F){v(k,F,F)}function A(k,F){const G=new Uint8Array(32),T=new Float64Array(80),O=b(),V=b(),L=b(),H=b(),ne=b(),j=b();for(let te=0;te<31;te++)G[te]=k[te];G[31]=127&k[31]|64,G[0]&=248,function w(k,F){for(let G=0;G<16;G++)k[G]=F[2*G]+(F[2*G+1]<<8);k[15]&=32767}(T,F);for(let te=0;te<16;te++)V[te]=T[te];O[0]=H[0]=1;for(let te=254;te>=0;--te){const oe=G[te>>>3]>>>(7&te)&1;f(O,V,oe),f(L,H,oe),I(ne,O,L),E(O,O,L),I(L,V,H),E(V,V,H),h(H,ne),h(j,O),v(O,L,O),v(L,V,ne),I(ne,O,L),E(O,O,L),h(V,O),E(L,H,j),v(O,L,d),I(O,O,H),v(L,L,O),v(O,H,j),v(H,V,T),h(V,ne),f(O,V,oe),f(L,H,oe)}for(let te=0;te<16;te++)T[te+16]=O[te],T[te+32]=L[te],T[te+48]=V[te],T[te+64]=H[te];const ee=T.subarray(32),Z=T.subarray(16);(function C(k,F){const G=b();for(let T=0;T<16;T++)G[T]=F[T];for(let T=253;T>=0;T--)h(G,G),2!==T&&4!==T&&v(G,G,F);for(let T=0;T<16;T++)k[T]=G[T]})(ee,ee),v(Z,Z,ee);const q=new Uint8Array(32);return function p(k,F){const G=b(),T=b();for(let O=0;O<16;O++)T[O]=F[O];c(T),c(T),c(T);for(let O=0;O<2;O++){G[0]=T[0]-65517;for(let L=1;L<15;L++)G[L]=T[L]-65535-(G[L-1]>>16&1),G[L-1]&=65535;G[15]=T[15]-32767-(G[14]>>16&1);const V=G[15]>>16&1;G[14]&=65535,f(T,G,1-V)}for(let O=0;O<16;O++)k[2*O]=255&T[O],k[2*O+1]=T[O]>>8}(q,Z),q}function N(k){return A(k,m)}function S(k){if(k.length!==K.KS)throw new Error(`x25519: seed must be ${K.KS} bytes`);const F=new Uint8Array(k);return{publicKey:N(F),secretKey:F}}K._w=S,K.Au=function D(k){const F=(0,l.randomBytes)(32,k),G=S(F);return(0,g.wipe)(F),G},K.gi=function M(k,F,G=!1){if(k.length!==K.kz)throw new Error("X25519: incorrect secret key length");if(F.length!==K.kz)throw new Error("X25519: incorrect public key length");const T=A(k,F);if(G){let O=0;for(let V=0;V<T.length;V++)O|=T[V];if(0===O)throw new Error("X25519: invalid shared key")}return T}},772:Y=>{function K(R){const y=new globalThis.AbortController;function l(){y.abort();for(const g of R)!g||!g.removeEventListener||g.removeEventListener("abort",l)}for(const g of R)if(g&&g.addEventListener){if(g.aborted){l();break}g.addEventListener("abort",l)}return y.signal}Y.exports=K,Y.exports.anySignal=K},1455:(Y,K,R)=>{K.formatArgs=function l(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+Y.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;c.splice(1,0,f,"color: inherit");let p=0,w=0;c[0].replace(/%[a-zA-Z%]/g,I=>{"%%"!==I&&(p++,"%c"===I&&(w=p))}),c.splice(w,0,f)},K.save=function g(c){try{c?K.storage.setItem("debug",c):K.storage.removeItem("debug")}catch{}},K.load=function b(){let c;try{c=K.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c},K.useColors=function y(){return!(!(typeof window<"u"&&window.process)||"renderer"!==window.process.type&&!window.process.__nwjs)||!(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&(typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},K.storage=function m(){try{return localStorage}catch{}}(),K.destroy=(()=>{let c=!1;return()=>{c||(c=!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`."))}})(),K.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"],K.log=console.debug||console.log||(()=>{}),Y.exports=R(3283)(K);const{formatters:d}=Y.exports;d.j=function(c){try{return JSON.stringify(c)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}},3283:(Y,K,R)=>{Y.exports=function y(l){function b(E){let v,C,A,h=null;function N(...S){if(!N.enabled)return;const D=N,M=Number(new Date);D.diff=M-(v||M),D.prev=v,D.curr=M,v=M,S[0]=b.coerce(S[0]),"string"!=typeof S[0]&&S.unshift("%O");let F=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(T,O)=>{if("%%"===T)return"%";F++;const V=b.formatters[O];return"function"==typeof V&&(T=V.call(D,S[F]),S.splice(F,1),F--),T}),b.formatArgs.call(D,S),(D.log||b.log).apply(D,S)}return N.namespace=E,N.useColors=b.useColors(),N.color=b.selectColor(E),N.extend=m,N.destroy=b.destroy,Object.defineProperty(N,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==h?h:(C!==b.namespaces&&(C=b.namespaces,A=b.enabled(E)),A),set:S=>{h=S}}),"function"==typeof b.init&&b.init(N),N}function m(E,v){const h=b(this.namespace+(typeof v>"u"?":":v)+E);return h.log=this.log,h}function p(E){return E.toString().substring(2,E.toString().length-2).replace(/\.\*\?$/,"*")}return b.debug=b,b.default=b,b.coerce=function w(E){return E instanceof Error?E.stack||E.message:E},b.disable=function c(){const E=[...b.names.map(p),...b.skips.map(p).map(v=>"-"+v)].join(",");return b.enable(""),E},b.enable=function d(E){let v;b.save(E),b.namespaces=E,b.names=[],b.skips=[];const h=("string"==typeof E?E:"").split(/[\s,]+/),C=h.length;for(v=0;v<C;v++)!h[v]||("-"===(E=h[v].replace(/\*/g,".*?"))[0]?b.skips.push(new RegExp("^"+E.slice(1)+"$")):b.names.push(new RegExp("^"+E+"$")))},b.enabled=function f(E){if("*"===E[E.length-1])return!0;let v,h;for(v=0,h=b.skips.length;v<h;v++)if(b.skips[v].test(E))return!1;for(v=0,h=b.names.length;v<h;v++)if(b.names[v].test(E))return!0;return!1},b.humanize=R(4366),b.destroy=function I(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(l).forEach(E=>{b[E]=l[E]}),b.names=[],b.skips=[],b.formatters={},b.selectColor=function g(E){let v=0;for(let h=0;h<E.length;h++)v=(v<<5)-v+E.charCodeAt(h),v|=0;return b.colors[Math.abs(v)%b.colors.length]},b.enable(b.load()),b}},1807:Y=>{"use strict";function K(R,l){l=l||{},this._head=0,this._tail=0,this._capacity=l.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(R)&&this._fromArray(R)}K.prototype.peekAt=function(y){var l=y;if(l===(0|l)){var g=this.size();if(!(l>=g||l<-g))return l<0&&(l+=g),this._list[l=this._head+l&this._capacityMask]}},K.prototype.get=function(y){return this.peekAt(y)},K.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},K.prototype.peekFront=function(){return this.peek()},K.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(K.prototype,"length",{get:function(){return this.size()}}),K.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},K.prototype.unshift=function(y){return void 0===y?this.size():(this._head=this._head-1+this._list.length&this._capacityMask,this._list[this._head]=y,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail))},K.prototype.shift=function(){var y=this._head;if(y!==this._tail){var l=this._list[y];return this._list[y]=void 0,this._head=y+1&this._capacityMask,y<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),l}},K.prototype.push=function(y){if(void 0===y)return this.size();var l=this._tail;return this._list[l]=y,this._tail=l+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},K.prototype.pop=function(){var y=this._tail;if(y!==this._head){var l=this._list.length;this._tail=y-1+l&this._capacityMask;var g=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&y>1e4&&y<=l>>>2&&this._shrinkArray(),g}},K.prototype.removeOne=function(y){var l=y;if(l===(0|l)&&this._head!==this._tail){var g=this.size(),b=this._list.length;if(!(l>=g||l<-g)){l<0&&(l+=g);var d,m=this._list[l=this._head+l&this._capacityMask];if(y<g/2){for(d=y;d>0;d--)this._list[l]=this._list[l=l-1+b&this._capacityMask];this._list[l]=void 0,this._head=this._head+1+b&this._capacityMask}else{for(d=g-1-y;d>0;d--)this._list[l]=this._list[l=l+1+b&this._capacityMask];this._list[l]=void 0,this._tail=this._tail-1+b&this._capacityMask}return m}}},K.prototype.remove=function(y,l){var b,g=y,m=l;if(g===(0|g)&&this._head!==this._tail){var d=this.size(),c=this._list.length;if(!(g>=d||g<-d||l<1)){if(g<0&&(g+=d),1===l||!l)return(b=new Array(1))[0]=this.removeOne(g),b;if(0===g&&g+l>=d)return b=this.toArray(),this.clear(),b;var f;for(g+l>d&&(l=d-g),b=new Array(l),f=0;f<l;f++)b[f]=this._list[this._head+g+f&this._capacityMask];if(g=this._head+g&this._capacityMask,y+l===d){for(this._tail=this._tail-l+c&this._capacityMask,f=l;f>0;f--)this._list[g=g+1+c&this._capacityMask]=void 0;return b}if(0===y){for(this._head=this._head+l+c&this._capacityMask,f=l-1;f>0;f--)this._list[g=g+1+c&this._capacityMask]=void 0;return b}if(g<d/2){for(this._head=this._head+y+l+c&this._capacityMask,f=y;f>0;f--)this.unshift(this._list[g=g-1+c&this._capacityMask]);for(g=this._head-1+c&this._capacityMask;m>0;)this._list[g=g-1+c&this._capacityMask]=void 0,m--;y<0&&(this._tail=g)}else{for(this._tail=g,g=g+l+c&this._capacityMask,f=d-(l+y);f>0;f--)this.push(this._list[g++]);for(g=this._tail;m>0;)this._list[g=g+1+c&this._capacityMask]=void 0,m--}return this._head<2&&this._tail>1e4&&this._tail<=c>>>2&&this._shrinkArray(),b}}},K.prototype.splice=function(y,l){var g=y;if(g===(0|g)){var b=this.size();if(g<0&&(g+=b),!(g>b)){if(arguments.length>2){var m,d,c,f=arguments.length,p=this._list.length,w=2;if(!b||g<b/2){for(d=new Array(g),m=0;m<g;m++)d[m]=this._list[this._head+m&this._capacityMask];for(0===l?(c=[],g>0&&(this._head=this._head+g+p&this._capacityMask)):(c=this.remove(g,l),this._head=this._head+g+p&this._capacityMask);f>w;)this.unshift(arguments[--f]);for(m=g;m>0;m--)this.unshift(d[m-1])}else{var I=(d=new Array(b-(g+l))).length;for(m=0;m<I;m++)d[m]=this._list[this._head+g+l+m&this._capacityMask];for(0===l?(c=[],g!=b&&(this._tail=this._head+g+p&this._capacityMask)):(c=this.remove(g,l),this._tail=this._tail-I+p&this._capacityMask);w<f;)this.push(arguments[w++]);for(m=0;m<I;m++)this.push(d[m])}return c}return this.remove(g,l)}}},K.prototype.clear=function(){this._head=0,this._tail=0},K.prototype.isEmpty=function(){return this._head===this._tail},K.prototype.toArray=function(){return this._copyArray(!1)},K.prototype._fromArray=function(y){for(var l=0;l<y.length;l++)this.push(y[l])},K.prototype._copyArray=function(y){var m,l=[],g=this._list,b=g.length;if(y||this._head>this._tail){for(m=this._head;m<b;m++)l.push(g[m]);for(m=0;m<this._tail;m++)l.push(g[m])}else for(m=this._head;m<this._tail;m++)l.push(g[m]);return l},K.prototype._growArray=function(){this._head&&(this._list=this._copyArray(!0),this._head=0),this._tail=this._list.length,this._list.length<<=1,this._capacityMask=this._capacityMask<<1|1},K.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},Y.exports=K},2535:Y=>{"use strict";function K(y,l){for(const g in l)Object.defineProperty(y,g,{value:l[g],enumerable:!0,configurable:!0});return y}Y.exports=function R(y,l,g){if(!y||"string"==typeof y)throw new TypeError("Please pass an Error to err-code");g||(g={}),"object"==typeof l&&(g=l,l=""),l&&(g.code=l);try{return K(y,g)}catch{g.message=y.message,g.stack=y.stack;const m=function(){};return m.prototype=Object.create(Object.getPrototypeOf(y)),K(new m,g)}}},3676:(Y,K,R)=>{"use strict";const l=R(649);K.zN=l.EventIterator},649:(Y,K)=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});class R{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(g){if(this.isStopped)return;const b={value:g,done:!1};if(this.pullQueue.length){const m=this.pullQueue.shift();m&&m.resolve(b)}else this.pushQueue.push(Promise.resolve(b)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const g of this.pullQueue)g.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(g){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const b of this.pullQueue)b.reject(g);this.pullQueue.length=0}else{const b=Promise.reject(g);b.catch(()=>{}),this.pushQueue.push(b)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:g=>{const b=this.pushQueue.shift();return b?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),b):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((m,d)=>{this.pullQueue.push({resolve:m,reject:d})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class y{constructor(g,{highWaterMark:b=100,lowWaterMark:m=1}={}){const d=new R;d.highWaterMark=b,d.lowWaterMark=m,d.removeCallback=g({push:c=>d.push(c),stop:()=>d.stop(),fail:c=>d.fail(c),on:(c,f)=>{d.eventHandlers[c]=f}})||(()=>{}),this[Symbol.asyncIterator]=()=>d[Symbol.asyncIterator](),Object.freeze(this)}}K.EventIterator=y,K.default=y},2005:Y=>{"use strict";var K=Object.prototype.hasOwnProperty,R="~";function y(){}function l(d,c,f){this.fn=d,this.context=c,this.once=f||!1}function g(d,c,f,p,w){if("function"!=typeof f)throw new TypeError("The listener must be a function");var I=new l(f,p||d,w),E=R?R+c:c;return d._events[E]?d._events[E].fn?d._events[E]=[d._events[E],I]:d._events[E].push(I):(d._events[E]=I,d._eventsCount++),d}function b(d,c){0==--d._eventsCount?d._events=new y:delete d._events[c]}function m(){this._events=new y,this._eventsCount=0}Object.create&&(y.prototype=Object.create(null),(new y).__proto__||(R=!1)),m.prototype.eventNames=function(){var f,p,c=[];if(0===this._eventsCount)return c;for(p in f=this._events)K.call(f,p)&&c.push(R?p.slice(1):p);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(f)):c},m.prototype.listeners=function(c){var p=this._events[R?R+c:c];if(!p)return[];if(p.fn)return[p.fn];for(var w=0,I=p.length,E=new Array(I);w<I;w++)E[w]=p[w].fn;return E},m.prototype.listenerCount=function(c){var p=this._events[R?R+c:c];return p?p.fn?1:p.length:0},m.prototype.emit=function(c,f,p,w,I,E){var v=R?R+c:c;if(!this._events[v])return!1;var A,N,h=this._events[v],C=arguments.length;if(h.fn){switch(h.once&&this.removeListener(c,h.fn,void 0,!0),C){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,f),!0;case 3:return h.fn.call(h.context,f,p),!0;case 4:return h.fn.call(h.context,f,p,w),!0;case 5:return h.fn.call(h.context,f,p,w,I),!0;case 6:return h.fn.call(h.context,f,p,w,I,E),!0}for(N=1,A=new Array(C-1);N<C;N++)A[N-1]=arguments[N];h.fn.apply(h.context,A)}else{var D,S=h.length;for(N=0;N<S;N++)switch(h[N].once&&this.removeListener(c,h[N].fn,void 0,!0),C){case 1:h[N].fn.call(h[N].context);break;case 2:h[N].fn.call(h[N].context,f);break;case 3:h[N].fn.call(h[N].context,f,p);break;case 4:h[N].fn.call(h[N].context,f,p,w);break;default:if(!A)for(D=1,A=new Array(C-1);D<C;D++)A[D-1]=arguments[D];h[N].fn.apply(h[N].context,A)}}return!0},m.prototype.on=function(c,f,p){return g(this,c,f,p,!1)},m.prototype.once=function(c,f,p){return g(this,c,f,p,!0)},m.prototype.removeListener=function(c,f,p,w){var I=R?R+c:c;if(!this._events[I])return this;if(!f)return b(this,I),this;var E=this._events[I];if(E.fn)E.fn===f&&(!w||E.once)&&(!p||E.context===p)&&b(this,I);else{for(var v=0,h=[],C=E.length;v<C;v++)(E[v].fn!==f||w&&!E[v].once||p&&E[v].context!==p)&&h.push(E[v]);h.length?this._events[I]=1===h.length?h[0]:h:b(this,I)}return this},m.prototype.removeAllListeners=function(c){var f;return c?this._events[f=R?R+c:c]&&b(this,f):(this._events=new y,this._eventsCount=0),this},m.prototype.off=m.prototype.removeListener,m.prototype.addListener=m.prototype.on,m.prefixed=R,m.EventEmitter=m,Y.exports=m},9069:Y=>{"use strict";var y,K="object"==typeof Reflect?Reflect:null,R=K&&"function"==typeof K.apply?K.apply:function(M,k,F){return Function.prototype.apply.call(M,k,F)};y=K&&"function"==typeof K.ownKeys?K.ownKeys:Object.getOwnPropertySymbols?function(M){return Object.getOwnPropertyNames(M).concat(Object.getOwnPropertySymbols(M))}:function(M){return Object.getOwnPropertyNames(M)};var g=Number.isNaN||function(M){return M!=M};function b(){b.init.call(this)}Y.exports=b,Y.exports.once=function A(D,M){return new Promise(function(k,F){function G(O){D.removeListener(M,T),F(O)}function T(){"function"==typeof D.removeListener&&D.removeListener("error",G),k([].slice.call(arguments))}S(D,M,T,{once:!0}),"error"!==M&&function N(D,M,k){"function"==typeof D.on&&S(D,"error",M,k)}(D,G,{once:!0})})},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var m=10;function d(D){if("function"!=typeof D)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof D)}function c(D){return void 0===D._maxListeners?b.defaultMaxListeners:D._maxListeners}function f(D,M,k,F){var G,T,O;if(d(k),void 0===(T=D._events)?(T=D._events=Object.create(null),D._eventsCount=0):(void 0!==T.newListener&&(D.emit("newListener",M,k.listener?k.listener:k),T=D._events),O=T[M]),void 0===O)O=T[M]=k,++D._eventsCount;else if("function"==typeof O?O=T[M]=F?[k,O]:[O,k]:F?O.unshift(k):O.push(k),(G=c(D))>0&&O.length>G&&!O.warned){O.warned=!0;var V=new Error("Possible EventEmitter memory leak detected. "+O.length+" "+String(M)+" listeners added. Use emitter.setMaxListeners() to increase limit");V.name="MaxListenersExceededWarning",V.emitter=D,V.type=M,V.count=O.length,function l(D){console&&console.warn&&console.warn(D)}(V)}return D}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function w(D,M,k){var F={fired:!1,wrapFn:void 0,target:D,type:M,listener:k},G=p.bind(F);return G.listener=k,F.wrapFn=G,G}function I(D,M,k){var F=D._events;if(void 0===F)return[];var G=F[M];return void 0===G?[]:"function"==typeof G?k?[G.listener||G]:[G]:k?function C(D){for(var M=new Array(D.length),k=0;k<M.length;++k)M[k]=D[k].listener||D[k];return M}(G):v(G,G.length)}function E(D){var M=this._events;if(void 0!==M){var k=M[D];if("function"==typeof k)return 1;if(void 0!==k)return k.length}return 0}function v(D,M){for(var k=new Array(M),F=0;F<M;++F)k[F]=D[F];return k}function S(D,M,k,F){if("function"==typeof D.on)F.once?D.once(M,k):D.on(M,k);else{if("function"!=typeof D.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof D);D.addEventListener(M,function G(T){F.once&&D.removeEventListener(M,G),k(T)})}}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return m},set:function(D){if("number"!=typeof D||D<0||g(D))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+D+".");m=D}}),b.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(M){if("number"!=typeof M||M<0||g(M))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+M+".");return this._maxListeners=M,this},b.prototype.getMaxListeners=function(){return c(this)},b.prototype.emit=function(M){for(var k=[],F=1;F<arguments.length;F++)k.push(arguments[F]);var G="error"===M,T=this._events;if(void 0!==T)G=G&&void 0===T.error;else if(!G)return!1;if(G){var O;if(k.length>0&&(O=k[0]),O instanceof Error)throw O;var V=new Error("Unhandled error."+(O?" ("+O.message+")":""));throw V.context=O,V}var L=T[M];if(void 0===L)return!1;if("function"==typeof L)R(L,this,k);else{var H=L.length,ne=v(L,H);for(F=0;F<H;++F)R(ne[F],this,k)}return!0},b.prototype.on=b.prototype.addListener=function(M,k){return f(this,M,k,!1)},b.prototype.prependListener=function(M,k){return f(this,M,k,!0)},b.prototype.once=function(M,k){return d(k),this.on(M,w(this,M,k)),this},b.prototype.prependOnceListener=function(M,k){return d(k),this.prependListener(M,w(this,M,k)),this},b.prototype.off=b.prototype.removeListener=function(M,k){var F,G,T,O,V;if(d(k),void 0===(G=this._events))return this;if(void 0===(F=G[M]))return this;if(F===k||F.listener===k)0==--this._eventsCount?this._events=Object.create(null):(delete G[M],G.removeListener&&this.emit("removeListener",M,F.listener||k));else if("function"!=typeof F){for(T=-1,O=F.length-1;O>=0;O--)if(F[O]===k||F[O].listener===k){V=F[O].listener,T=O;break}if(T<0)return this;0===T?F.shift():function h(D,M){for(;M+1<D.length;M++)D[M]=D[M+1];D.pop()}(F,T),1===F.length&&(G[M]=F[0]),void 0!==G.removeListener&&this.emit("removeListener",M,V||k)}return this},b.prototype.removeAllListeners=function(M){var k,F,G;if(void 0===(F=this._events))return this;if(void 0===F.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==F[M]&&(0==--this._eventsCount?this._events=Object.create(null):delete F[M]),this;if(0===arguments.length){var O,T=Object.keys(F);for(G=0;G<T.length;++G)"removeListener"!==(O=T[G])&&this.removeAllListeners(O);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(k=F[M]))this.removeListener(M,k);else if(void 0!==k)for(G=k.length-1;G>=0;G--)this.removeListener(M,k[G]);return this},b.prototype.listeners=function(M){return I(this,M,!0)},b.prototype.rawListeners=function(M){return I(this,M,!1)},b.listenerCount=function(D,M){return"function"==typeof D.listenerCount?D.listenerCount(M):E.call(D,M)},b.prototype.listenerCount=E,b.prototype.eventNames=function(){return this._eventsCount>0?y(this._events):[]}},3111:Y=>{Y.exports=class{constructor(R){if(!(R>0)||0!=(R-1&R))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(R),this.mask=R-1,this.top=0,this.btm=0,this.next=null}push(R){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=R,this.top=this.top+1&this.mask,!0)}shift(){const R=this.buffer[this.btm];if(void 0!==R)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,R}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},1159:(Y,K,R)=>{const y=R(3111);Y.exports=class{constructor(g){this.hwm=g||16,this.head=new y(this.hwm),this.tail=this.head}push(g){this.head.push(g)||(this.head=this.head.next=new y(2*this.head.buffer.length),this.head.push(g))}shift(){const g=this.tail.shift();if(void 0===g&&this.tail.next){const b=this.tail.next;return this.tail.next=null,this.tail=b,this.tail.shift()}return g}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},5550:Y=>{Y.exports=function(K){if(!K)throw Error("hashlru must have a max value, of type number, greater than 0");var R=0,y=Object.create(null),l=Object.create(null);function g(b,m){y[b]=m,++R>=K&&(R=0,l=y,y=Object.create(null))}return{has:function(b){return void 0!==y[b]||void 0!==l[b]},remove:function(b){void 0!==y[b]&&(y[b]=void 0),void 0!==l[b]&&(l[b]=void 0)},get:function(b){var m=y[b];return void 0!==m?m:void 0!==(m=l[b])?(g(b,m),m):void 0},set:function(b,m){void 0!==y[b]?y[b]=m:g(b,m)},clear:function(){y=Object.create(null),l=Object.create(null)}}}},1396:function(Y){!function(K){"use strict";const R="(0?\\d+|0x[a-f0-9]+)",y={fourOctet:new RegExp(`^${R}\\.${R}\\.${R}\\.${R}$`,"i"),threeOctet:new RegExp(`^${R}\\.${R}\\.${R}$`,"i"),twoOctet:new RegExp(`^${R}\\.${R}$`,"i"),longValue:new RegExp(`^${R}$`,"i")},l=new RegExp("^0[0-7]+$","i"),g=new RegExp("^0x[a-f0-9]+$","i"),b="%[0-9a-z]{1,}",m="(?:[0-9a-f]+::?)+",d={zoneIndex:new RegExp(b,"i"),native:new RegExp(`^(::)?(${m})?([0-9a-f]+)?(::)?(${b})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${R}\\.${R}\\.${R}\\.${R}(${b})?)$`,"i"),transitional:new RegExp(`^((?:${m})|(?:::)(?:${m})?)${R}\\.${R}\\.${R}\\.${R}(${b})?$`,"i")};function c(E,v){if(E.indexOf("::")!==E.lastIndexOf("::"))return null;let N,S,h=0,C=-1,A=(E.match(d.zoneIndex)||[])[0];for(A&&(A=A.substring(1),E=E.replace(/%.+$/,""));(C=E.indexOf(":",C+1))>=0;)h++;if("::"===E.substr(0,2)&&h--,"::"===E.substr(-2,2)&&h--,h>v)return null;for(S=v-h,N=":";S--;)N+="0:";return":"===(E=E.replace("::",N))[0]&&(E=E.slice(1)),":"===E[E.length-1]&&(E=E.slice(0,-1)),{parts:v=function(){const D=E.split(":"),M=[];for(let k=0;k<D.length;k++)M.push(parseInt(D[k],16));return M}(),zoneId:A}}function f(E,v,h,C){if(E.length!==v.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let N,A=0;for(;C>0;){if(N=h-C,N<0&&(N=0),E[A]>>N!=v[A]>>N)return!1;C-=h,A+=1}return!0}function p(E){if(g.test(E))return parseInt(E,16);if("0"===E[0]&&!isNaN(parseInt(E[1],10))){if(l.test(E))return parseInt(E,8);throw new Error(`ipaddr: cannot parse ${E} as octal`)}return parseInt(E,10)}function w(E,v){for(;E.length<v;)E=`0${E}`;return E}const I={};I.IPv4=function(){function E(v){if(4!==v.length)throw new Error("ipaddr: ipv4 octet count should be 4");let h,C;for(h=0;h<v.length;h++)if(C=v[h],!(0<=C&&C<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=v}return E.prototype.SpecialRanges={unspecified:[[new E([0,0,0,0]),8]],broadcast:[[new E([255,255,255,255]),32]],multicast:[[new E([224,0,0,0]),4]],linkLocal:[[new E([169,254,0,0]),16]],loopback:[[new E([127,0,0,0]),8]],carrierGradeNat:[[new E([100,64,0,0]),10]],private:[[new E([10,0,0,0]),8],[new E([172,16,0,0]),12],[new E([192,168,0,0]),16]],reserved:[[new E([192,0,0,0]),24],[new E([192,0,2,0]),24],[new E([192,88,99,0]),24],[new E([198,51,100,0]),24],[new E([203,0,113,0]),24],[new E([240,0,0,0]),4]]},E.prototype.kind=function(){return"ipv4"},E.prototype.match=function(v,h){let C;if(void 0===h&&(C=v,v=C[0],h=C[1]),"ipv4"!==v.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,v.octets,8,h)},E.prototype.prefixLengthFromSubnetMask=function(){let v=0,h=!1;const C={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let A,N,S;for(A=3;A>=0;A-=1){if(N=this.octets[A],!(N in C))return null;if(S=C[N],h&&0!==S)return null;8!==S&&(h=!0),v+=S}return 32-v},E.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},E.prototype.toByteArray=function(){return this.octets.slice(0)},E.prototype.toIPv4MappedAddress=function(){return I.IPv6.parse(`::ffff:${this.toString()}`)},E.prototype.toNormalizedString=function(){return this.toString()},E.prototype.toString=function(){return this.octets.join(".")},E}(),I.IPv4.broadcastAddressFromCIDR=function(E){try{const v=this.parseCIDR(E),h=v[0].toByteArray(),C=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),A=[];let N=0;for(;N<4;)A.push(parseInt(h[N],10)|255^parseInt(C[N],10)),N++;return new this(A)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},I.IPv4.isIPv4=function(E){return null!==this.parser(E)},I.IPv4.isValid=function(E){try{return new this(this.parser(E)),!0}catch{return!1}},I.IPv4.isValidFourPartDecimal=function(E){return!(!I.IPv4.isValid(E)||!E.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},I.IPv4.networkAddressFromCIDR=function(E){let v,h,C,A,N;try{for(v=this.parseCIDR(E),C=v[0].toByteArray(),N=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),A=[],h=0;h<4;)A.push(parseInt(C[h],10)&parseInt(N[h],10)),h++;return new this(A)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},I.IPv4.parse=function(E){const v=this.parser(E);if(null===v)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(v)},I.IPv4.parseCIDR=function(E){let v;if(v=E.match(/^(.+)\/(\d+)$/)){const h=parseInt(v[2]);if(h>=0&&h<=32){const C=[this.parse(v[1]),h];return Object.defineProperty(C,"toString",{value:function(){return this.join("/")}}),C}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(E){let v,h,C;if(v=E.match(y.fourOctet))return function(){const A=v.slice(1,6),N=[];for(let S=0;S<A.length;S++)h=A[S],N.push(p(h));return N}();if(v=E.match(y.longValue)){if(C=p(v[1]),C>4294967295||C<0)throw new Error("ipaddr: address outside defined range");return function(){const A=[];let N;for(N=0;N<=24;N+=8)A.push(C>>N&255);return A}().reverse()}return(v=E.match(y.twoOctet))?function(){const A=v.slice(1,4),N=[];if(C=p(A[1]),C>16777215||C<0)throw new Error("ipaddr: address outside defined range");return N.push(p(A[0])),N.push(C>>16&255),N.push(C>>8&255),N.push(255&C),N}():(v=E.match(y.threeOctet))?function(){const A=v.slice(1,5),N=[];if(C=p(A[2]),C>65535||C<0)throw new Error("ipaddr: address outside defined range");return N.push(p(A[0])),N.push(p(A[1])),N.push(C>>8&255),N.push(255&C),N}():null},I.IPv4.subnetMaskFromPrefixLength=function(E){if((E=parseInt(E))<0||E>32)throw new Error("ipaddr: invalid IPv4 prefix length");const v=[0,0,0,0];let h=0;const C=Math.floor(E/8);for(;h<C;)v[h]=255,h++;return C<4&&(v[C]=Math.pow(2,E%8)-1<<8-E%8),new this(v)},I.IPv6=function(){function E(v,h){let C,A;if(16===v.length)for(this.parts=[],C=0;C<=14;C+=2)this.parts.push(v[C]<<8|v[C+1]);else{if(8!==v.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=v}for(C=0;C<this.parts.length;C++)if(A=this.parts[C],!(0<=A&&A<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");h&&(this.zoneId=h)}return E.prototype.SpecialRanges={unspecified:[new E([0,0,0,0,0,0,0,0]),128],linkLocal:[new E([65152,0,0,0,0,0,0,0]),10],multicast:[new E([65280,0,0,0,0,0,0,0]),8],loopback:[new E([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new E([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new E([0,0,0,0,0,65535,0,0]),96],rfc6145:[new E([0,0,0,0,65535,0,0,0]),96],rfc6052:[new E([100,65435,0,0,0,0,0,0]),96],"6to4":[new E([8194,0,0,0,0,0,0,0]),16],teredo:[new E([8193,0,0,0,0,0,0,0]),32],reserved:[[new E([8193,3512,0,0,0,0,0,0]),32]]},E.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},E.prototype.kind=function(){return"ipv6"},E.prototype.match=function(v,h){let C;if(void 0===h&&(C=v,v=C[0],h=C[1]),"ipv6"!==v.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,v.parts,16,h)},E.prototype.prefixLengthFromSubnetMask=function(){let v=0,h=!1;const C={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let A,N;for(let S=7;S>=0;S-=1){if(A=this.parts[S],!(A in C))return null;if(N=C[A],h&&0!==N)return null;16!==N&&(h=!0),v+=N}return 128-v},E.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},E.prototype.toByteArray=function(){let v;const h=[],C=this.parts;for(let A=0;A<C.length;A++)v=C[A],h.push(v>>8),h.push(255&v);return h},E.prototype.toFixedLengthString=function(){const v=function(){const C=[];for(let A=0;A<this.parts.length;A++)C.push(w(this.parts[A].toString(16),4));return C}.call(this).join(":");let h="";return this.zoneId&&(h=`%${this.zoneId}`),v+h},E.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const v=this.parts.slice(-2),h=v[0],C=v[1];return new I.IPv4([h>>8,255&h,C>>8,255&C])},E.prototype.toNormalizedString=function(){const v=function(){const C=[];for(let A=0;A<this.parts.length;A++)C.push(this.parts[A].toString(16));return C}.call(this).join(":");let h="";return this.zoneId&&(h=`%${this.zoneId}`),v+h},E.prototype.toRFC5952String=function(){const v=/((^|:)(0(:|$)){2,})/g,h=this.toNormalizedString();let N,C=0,A=-1;for(;N=v.exec(h);)N[0].length>A&&(C=N.index,A=N[0].length);return A<0?h:`${h.substring(0,C)}::${h.substring(C+A)}`},E.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},E}(),I.IPv6.broadcastAddressFromCIDR=function(E){try{const v=this.parseCIDR(E),h=v[0].toByteArray(),C=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),A=[];let N=0;for(;N<16;)A.push(parseInt(h[N],10)|255^parseInt(C[N],10)),N++;return new this(A)}catch(v){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${v})`)}},I.IPv6.isIPv6=function(E){return null!==this.parser(E)},I.IPv6.isValid=function(E){if("string"==typeof E&&-1===E.indexOf(":"))return!1;try{const v=this.parser(E);return new this(v.parts,v.zoneId),!0}catch{return!1}},I.IPv6.networkAddressFromCIDR=function(E){let v,h,C,A,N;try{for(v=this.parseCIDR(E),C=v[0].toByteArray(),N=this.subnetMaskFromPrefixLength(v[1]).toByteArray(),A=[],h=0;h<16;)A.push(parseInt(C[h],10)&parseInt(N[h],10)),h++;return new this(A)}catch(S){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${S})`)}},I.IPv6.parse=function(E){const v=this.parser(E);if(null===v.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(v.parts,v.zoneId)},I.IPv6.parseCIDR=function(E){let v,h,C;if((h=E.match(/^(.+)\/(\d+)$/))&&(v=parseInt(h[2]),v>=0&&v<=128))return C=[this.parse(h[1]),v],Object.defineProperty(C,"toString",{value:function(){return this.join("/")}}),C;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(E){let v,h,C,A,N,S;if(C=E.match(d.deprecatedTransitional))return this.parser(`::ffff:${C[1]}`);if(d.native.test(E))return c(E,8);if((C=E.match(d.transitional))&&(S=C[6]||"",v=c(C[1].slice(0,-1)+S,6),v.parts)){for(N=[parseInt(C[2]),parseInt(C[3]),parseInt(C[4]),parseInt(C[5])],h=0;h<N.length;h++)if(A=N[h],!(0<=A&&A<=255))return null;return v.parts.push(N[0]<<8|N[1]),v.parts.push(N[2]<<8|N[3]),{parts:v.parts,zoneId:v.zoneId}}return null},I.IPv6.subnetMaskFromPrefixLength=function(E){if((E=parseInt(E))<0||E>128)throw new Error("ipaddr: invalid IPv6 prefix length");const v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let h=0;const C=Math.floor(E/8);for(;h<C;)v[h]=255,h++;return C<16&&(v[C]=Math.pow(2,E%8)-1<<8-E%8),new this(v)},I.fromByteArray=function(E){const v=E.length;if(4===v)return new I.IPv4(E);if(16===v)return new I.IPv6(E);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},I.isValid=function(E){return I.IPv6.isValid(E)||I.IPv4.isValid(E)},I.parse=function(E){if(I.IPv6.isValid(E))return I.IPv6.parse(E);if(I.IPv4.isValid(E))return I.IPv4.parse(E);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},I.parseCIDR=function(E){try{return I.IPv6.parseCIDR(E)}catch{try{return I.IPv4.parseCIDR(E)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},I.process=function(E){const v=this.parse(E);return"ipv6"===v.kind()&&v.isIPv4MappedAddress()?v.toIPv4Address():v},I.subnetMatch=function(E,v,h){let C,A,N,S;for(A in null==h&&(h="unicast"),v)if(Object.prototype.hasOwnProperty.call(v,A))for(N=v[A],N[0]&&!(N[0]instanceof Array)&&(N=[N]),C=0;C<N.length;C++)if(S=N[C],E.kind()===S[0].kind()&&E.match.apply(E,S))return A;return h},Y.exports?Y.exports=I:K.ipaddr=I}(this)},9456:Y=>{Y.exports=function K(){return typeof window<"u"&&"object"==typeof window.process&&"renderer"===window.process.type||typeof process<"u"&&"object"==typeof process.versions&&!!process.versions.electron||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}},6599:(Y,K,R)=>{"use strict";const y=R(2888),l=g=>y({exact:!0}).test(g);l.v4=g=>y.v4({exact:!0}).test(g),l.v6=g=>y.v6({exact:!0}).test(g),l.version=g=>l(g)?l.v4(g)?4:6:void 0,Y.exports=l},2888:Y=>{"use strict";const K="[a-fA-F\\d:]",R=f=>f&&f.includeBoundaries?`(?:(?<=\\s|^)(?=${K})|(?<=${K})(?=\\s|$))`:"",y="(?: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}",l="[a-fA-F\\d]{1,4}",g=`\n(?:\n(?:${l}:){7}(?:${l}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${l}:){6}(?:${y}|:${l}|:)| // 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\n(?:${l}:){5}(?::${y}|(?::${l}){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\n(?:${l}:){4}(?:(?::${l}){0,1}:${y}|(?::${l}){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\n(?:${l}:){3}(?:(?::${l}){0,2}:${y}|(?::${l}){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\n(?:${l}:){2}(?:(?::${l}){0,3}:${y}|(?::${l}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${l}:){1}(?:(?::${l}){0,4}:${y}|(?::${l}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${l}){0,5}:${y}|(?::${l}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),b=new RegExp(`(?:^${y}$)|(?:^${g}$)`),m=new RegExp(`^${y}$`),d=new RegExp(`^${g}$`),c=f=>f&&f.exact?b:new RegExp(`(?:${R(f)}${y}${R(f)})|(?:${R(f)}${g}${R(f)})`,"g");c.v4=f=>f&&f.exact?m:new RegExp(`${R(f)}${y}${R(f)}`,"g"),c.v6=f=>f&&f.exact?d:new RegExp(`${R(f)}${g}${R(f)}`,"g"),Y.exports=c},7494:Y=>{"use strict";Y.exports=K=>{if("[object Object]"!==Object.prototype.toString.call(K))return!1;const R=Object.getPrototypeOf(K);return null===R||R===Object.prototype}},8596:(Y,K,R)=>{"use strict";const{URLWithLegacySupport:y,format:l,URLSearchParams:g,defaultBase:b}=R(5695),m=R(340);Y.exports={URL:y,URLSearchParams:g,format:l,relative:m,defaultBase:b}},340:(Y,K,R)=>{"use strict";const{URLWithLegacySupport:y,format:l}=R(5695);Y.exports=(g,b={},m={},d)=>{let f,c=b.protocol?b.protocol.replace(":",""):"http";c=(m[c]||d||c)+":";try{f=new y(g)}catch{f={}}const p=Object.assign({},b,{protocol:c||f.protocol,host:b.host||f.host});return new y(g,l(p)).toString()}},5695:Y=>{"use strict";const K=typeof navigator<"u"&&"ReactNative"===navigator.product,y=self.URL,l=function R(){return K?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}();Y.exports={URLWithLegacySupport:class g{constructor(d="",c=l){this.super=new y(d,c),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(d){this.super.hash=d}set host(d){this.super.host=d}set hostname(d){this.super.hostname=d}set href(d){this.super.href=d}set password(d){this.super.password=d}set pathname(d){this.super.pathname=d}set port(d){this.super.port=d}set protocol(d){this.super.protocol=d}set search(d){this.super.search=d}set username(d){this.super.username=d}static createObjectURL(d){return y.createObjectURL(d)}static revokeObjectURL(d){y.revokeObjectURL(d)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:l,format:function b(m){if("string"==typeof m)return new y(m).toString();if(!(m instanceof y)){const c=m.auth?m.auth+"@":"",f=m.port?":"+m.port:"",I=m.hostname||"",E=m.search||(m.query?"?"+m.query:""),h=m.pathname||"";return`${m.protocol?m.protocol+"//":""}${(m.username&&m.password?`${m.username}:${m.password}@`:"")||c}${m.host||I+f}${m.path||h+E}${m.hash||""}`}}}},5357:(Y,K,R)=>{"use strict";var y=R(7156).default,l=R(8237).default;Y.exports=function(){var b=y(function*(m){const d=[];var p,c=!1,f=!1;try{for(var I,w=l(m);c=!(I=yield w.next()).done;c=!1)d.push(I.value)}catch(E){f=!0,p=E}finally{try{c&&null!=w.return&&(yield w.return())}finally{if(f)throw p}}return d});return function(d){return b.apply(this,arguments)}}()},5019:Y=>{"use strict";const K="[a-fA-F\\d:]",R=f=>f&&f.includeBoundaries?`(?:(?<=\\s|^)(?=${K})|(?<=${K})(?=\\s|$))`:"",y="(?: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}",l="[a-fA-F\\d]{1,4}",g=`\n(?:\n(?:${l}:){7}(?:${l}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${l}:){6}(?:${y}|:${l}|:)| // 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\n(?:${l}:){5}(?::${y}|(?::${l}){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\n(?:${l}:){4}(?:(?::${l}){0,1}:${y}|(?::${l}){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\n(?:${l}:){3}(?:(?::${l}){0,2}:${y}|(?::${l}){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\n(?:${l}:){2}(?:(?::${l}){0,3}:${y}|(?::${l}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${l}:){1}(?:(?::${l}){0,4}:${y}|(?::${l}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${l}){0,5}:${y}|(?::${l}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),b=new RegExp(`(?:^${y}$)|(?:^${g}$)`),m=new RegExp(`^${y}$`),d=new RegExp(`^${g}$`),c=f=>f&&f.exact?b:new RegExp(`(?:${R(f)}${y}${R(f)})|(?:${R(f)}${g}${R(f)})`,"g");c.v4=f=>f&&f.exact?m:new RegExp(`${R(f)}${y}${R(f)}`,"g"),c.v6=f=>f&&f.exact?d:new RegExp(`${R(f)}${g}${R(f)}`,"g"),Y.exports=c},3915:(Y,K,R)=>{"use strict";Y.exports=R(7422).default},7422:function(Y,K,R){"use strict";var y=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(K,"__esModule",{value:!0});const l=R(7910),g=y(R(5019)),b=y(R(6599)),m=R(1396),c=["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"].map(w=>new l.Netmask(w));function p(w){return/^::$/.test(w)||/^::1$/.test(w)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(w)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(w)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(w)||/^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(w)||/^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(w)||/^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(w)||/^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(w)||/^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(w)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(w)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(w)||/^ff([0-9a-fA-F]{2,2}):/i.test(w)}K.default=w=>{if((0,m.isValid)(w)){const I=(0,m.parse)(w);if("ipv4"===I.kind())return function f(w){for(let I of c)if(I.contains(w))return!0;return!1}(I.toNormalizedString());if("ipv6"===I.kind())return p(w)}else if((0,b.default)(w)&&g.default.v6().test(w))return p(w)}},7820:function(Y,K,R){"use strict";const y=R(7494),{hasOwnProperty:l}=Object.prototype,{propertyIsEnumerable:g}=Object,b=(h,C,A)=>Object.defineProperty(h,C,{value:A,writable:!0,enumerable:!0,configurable:!0}),m=this,d={concatArrays:!1,ignoreUndefined:!1},c=h=>{const C=[];for(const A in h)l.call(h,A)&&C.push(A);if(Object.getOwnPropertySymbols){const A=Object.getOwnPropertySymbols(h);for(const N of A)g.call(h,N)&&C.push(N)}return C};function f(h){return Array.isArray(h)?function p(h){const C=h.slice(0,0);return c(h).forEach(A=>{b(C,A,f(h[A]))}),C}(h):y(h)?function w(h){const C=null===Object.getPrototypeOf(h)?Object.create(null):{};return c(h).forEach(A=>{b(C,A,f(h[A]))}),C}(h):h}const I=(h,C,A,N)=>(A.forEach(S=>{typeof C[S]>"u"&&N.ignoreUndefined||(S in h&&h[S]!==Object.getPrototypeOf(h)?b(h,S,v(h[S],C[S],N)):b(h,S,f(C[S])))}),h);function v(h,C,A){return A.concatArrays&&Array.isArray(h)&&Array.isArray(C)?((h,C,A)=>{let N=h.slice(0,0),S=0;return[h,C].forEach(D=>{const M=[];for(let k=0;k<D.length;k++)!l.call(D,k)||(M.push(String(k)),b(N,S++,D===h?D[k]:f(D[k])));N=I(N,D,c(D).filter(k=>!M.includes(k)),A)}),N})(h,C,A):y(C)&&y(h)?I(h,C,c(C),A):f(C)}Y.exports=function(...h){const C=v(f(d),this!==m&&this||{},d);let A={_:{}};for(const N of h)if(void 0!==N){if(!y(N))throw new TypeError("`"+N+"` is not an Option Object");A=v(A,{_:N},C)}return A._}},4366:Y=>{var K=1e3,R=60*K,y=60*R,l=24*y;function f(p,w,I,E){var v=w>=1.5*I;return Math.round(p/I)+" "+E+(v?"s":"")}Y.exports=function(p,w){w=w||{};var I=typeof p;if("string"===I&&p.length>0)return function m(p){if(!((p=String(p)).length>100)){var w=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(p);if(w){var I=parseFloat(w[1]);switch((w[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*I;case"weeks":case"week":case"w":return 6048e5*I;case"days":case"day":case"d":return I*l;case"hours":case"hour":case"hrs":case"hr":case"h":return I*y;case"minutes":case"minute":case"mins":case"min":case"m":return I*R;case"seconds":case"second":case"secs":case"sec":case"s":return I*K;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return I;default:return}}}}(p);if("number"===I&&isFinite(p))return w.long?function c(p){var w=Math.abs(p);return w>=l?f(p,w,l,"day"):w>=y?f(p,w,y,"hour"):w>=R?f(p,w,R,"minute"):w>=K?f(p,w,K,"second"):p+" ms"}(p):function d(p){var w=Math.abs(p);return w>=l?Math.round(p/l)+"d":w>=y?Math.round(p/y)+"h":w>=R?Math.round(p/R)+"m":w>=K?Math.round(p/K)+"s":p+"ms"}(p);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(p))}},344:Y=>{"use strict";function K(R){if(Array.isArray(R)){for(var y=0,l=Array(R.length);y<R.length;y++)l[y]=R[y];return l}return Array.from(R)}Y.exports=function(y){var l=void 0,g=void 0;function b(c){if(!(c instanceof Object))throw new Error('Target "'+c+'" is not an object');g=c}function m(c){Object.keys(c).forEach(function(f){var p=c[f];if("function"!=typeof p)throw new Error('Trap "'+f+": "+p+'" is not a function');if(!Reflect[f])throw new Error('Trap "'+f+": "+p+'" is not a valid trap')}),l=c}b(function(){}),y&&b(y),m(Reflect);var d=new Proxy({},{get:function(f,p){return function(){for(var w=arguments.length,I=Array(w),E=0;E<w;E++)I[E]=arguments[E];return l[p].apply(null,[g].concat(K(I.slice(1))))}}});return{setTarget:b,setHandler:m,getTarget:function(){return g},getHandler:function(){return l},proxy:new Proxy(g,d)}}},7910:function(Y,K){(function(){var R,y,l,g,b,m,d,c;c=function(f){return[(f&255<<24)>>>24,(f&255<<16)>>>16,(65280&f)>>>8,255&f].join(".")},d=function(f){var p,I,E,v,h;for(p=[],I=E=0;E<=3&&0!==f.length;I=++E){if(I>0){if("."!==f[0])throw new Error("Invalid IP");f=f.substring(1)}v=(h=y(f))[0],f=f.substring(h[1]),p.push(v)}if(0!==f.length)throw new Error("Invalid IP");switch(p.length){case 1:if(p[0]>4294967295)throw new Error("Invalid IP");return p[0]>>>0;case 2:if(p[0]>255||p[1]>16777215)throw new Error("Invalid IP");return(p[0]<<24|p[1])>>>0;case 3:if(p[0]>255||p[1]>255||p[2]>65535)throw new Error("Invalid IP");return(p[0]<<24|p[1]<<16|p[2])>>>0;case 4:if(p[0]>255||p[1]>255||p[2]>255||p[3]>255)throw new Error("Invalid IP");return(p[0]<<24|p[1]<<16|p[2]<<8|p[3])>>>0;default:throw new Error("Invalid IP")}},g=(l=function(f){return f.charCodeAt(0)})("0"),m=l("a"),b=l("A"),y=function(f){var p,w,I,E,v;for(E=0,p=10,w="9",I=0,f.length>1&&"0"===f[I]&&("x"===f[I+1]||"X"===f[I+1]?(I+=2,p=16):"0"<=f[I+1]&&f[I+1]<="9"&&(I++,p=8,w="7")),v=I;I<f.length;){if("0"<=f[I]&&f[I]<=w)E=E*p+(l(f[I])-g)>>>0;else{if(16!==p)break;if("a"<=f[I]&&f[I]<="f")E=E*p+(10+l(f[I])-m)>>>0;else{if(!("A"<=f[I]&&f[I]<="F"))break;E=E*p+(10+l(f[I])-b)>>>0}}if(E>4294967295)throw new Error("too large");I++}if(I===v)throw new Error("empty octet");return[E,I]},R=function(){function f(p,w){var E,v,h;if("string"!=typeof p)throw new Error("Missing `net' parameter");if(w||(h=p.split("/",2),p=h[0],w=h[1]),w||(w=32),"string"==typeof w&&w.indexOf(".")>-1){try{this.maskLong=d(w)}catch(C){throw new Error("Invalid mask: "+w)}for(E=v=32;v>=0;E=--v)if(this.maskLong===4294967295<<32-E>>>0){this.bitmask=E;break}}else{if(!w&&0!==w)throw new Error("Invalid mask: empty");this.bitmask=parseInt(w,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(d(p)&this.maskLong)>>>0}catch(C){throw new Error("Invalid net address: "+p)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+w);this.size=Math.pow(2,32-this.bitmask),this.base=c(this.netLong),this.mask=c(this.maskLong),this.hostmask=c(~this.maskLong),this.first=this.bitmask<=30?c(this.netLong+1):this.base,this.last=c(this.bitmask<=30?this.netLong+this.size-2:this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return f.prototype.contains=function(p){return"string"==typeof p&&(p.indexOf("/")>0||4!==p.split(".").length)&&(p=new f(p)),p instanceof f?this.contains(p.base)&&this.contains(p.broadcast||p.last):(d(p)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},f.prototype.next=function(p){return null==p&&(p=1),new f(c(this.netLong+this.size*p),this.mask)},f.prototype.forEach=function(p){var w,I,E;for(E=d(this.first),I=d(this.last),w=0;E<=I;)p(c(E),E,w),w++,E++},f.prototype.toString=function(){return this.base+"/"+this.bitmask},f}(),K.ip2long=d,K.long2ip=c,K.Netmask=R}).call(this)},1298:(Y,K,R)=>{var y=R(8659);function l(h,C){y.cipher.registerAlgorithm(h,function(){return new y.aes.Algorithm(h,C)})}R(3311),R(3481),R(4747),Y.exports=y.aes=y.aes||{},y.aes.startEncrypting=function(h,C,A,N){var S=v({key:h,output:A,decrypt:!1,mode:N});return S.start(C),S},y.aes.createEncryptionCipher=function(h,C){return v({key:h,output:null,decrypt:!1,mode:C})},y.aes.startDecrypting=function(h,C,A,N){var S=v({key:h,output:A,decrypt:!0,mode:N});return S.start(C),S},y.aes.createDecryptionCipher=function(h,C){return v({key:h,output:null,decrypt:!0,mode:C})},y.aes.Algorithm=function(h,C){g||w();var A=this;A.name=h,A.mode=new C({blockSize:16,cipher:{encrypt:function(N,S){return E(A._w,N,S,!1)},decrypt:function(N,S){return E(A._w,N,S,!0)}}}),A._init=!1},y.aes.Algorithm.prototype.initialize=function(h){if(!this._init){var A,C=h.key;if("string"!=typeof C||16!==C.length&&24!==C.length&&32!==C.length){if(y.util.isArray(C)&&(16===C.length||24===C.length||32===C.length)){A=C,C=y.util.createBuffer();for(var N=0;N<A.length;++N)C.putByte(A[N])}}else C=y.util.createBuffer(C);if(!y.util.isArray(C)){A=C,C=[];var S=A.length();if(16===S||24===S||32===S)for(S>>>=2,N=0;N<S;++N)C.push(A.getInt32())}if(!y.util.isArray(C)||4!==C.length&&6!==C.length&&8!==C.length)throw new Error("Invalid key parameter.");var M=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=I(C,h.decrypt&&!M),this._init=!0}},y.aes._expandKey=function(h,C){return g||w(),I(h,C)},y.aes._updateBlock=E,l("AES-ECB",y.cipher.modes.ecb),l("AES-CBC",y.cipher.modes.cbc),l("AES-CFB",y.cipher.modes.cfb),l("AES-OFB",y.cipher.modes.ofb),l("AES-CTR",y.cipher.modes.ctr),l("AES-GCM",y.cipher.modes.gcm);var m,d,c,f,p,g=!1;function w(){g=!0,c=[0,1,2,4,8,16,32,64,128,27,54];for(var h=new Array(256),C=0;C<128;++C)h[C]=C<<1,h[C+128]=C+128<<1^283;for(m=new Array(256),d=new Array(256),f=new Array(4),p=new Array(4),C=0;C<4;++C)f[C]=new Array(256),p[C]=new Array(256);var S,D,M,k,F,G,T,A=0,N=0;for(C=0;C<256;++C){m[A]=k=(k=N^N<<1^N<<2^N<<3^N<<4)>>8^255&k^99,d[k]=A,G=(F=h[k])<<24^k<<16^k<<8^k^F,T=((S=h[A])^(D=h[S])^(M=h[D]))<<24^(A^M)<<16^(A^D^M)<<8^A^S^M;for(var O=0;O<4;++O)f[O][A]=G,p[O][k]=T,G=G<<24|G>>>8,T=T<<24|T>>>8;0===A?A=N=1:(A=S^h[h[h[S^M]]],N^=h[h[N]])}}function I(h,C){for(var N,A=h.slice(0),S=1,D=A.length,k=4*(D+6+1),F=D;F<k;++F)N=A[F-1],F%D==0?(N=m[N>>>16&255]<<24^m[N>>>8&255]<<16^m[255&N]<<8^m[N>>>24]^c[S]<<24,S++):D>6&&F%D==4&&(N=m[N>>>24]<<24^m[N>>>16&255]<<16^m[N>>>8&255]<<8^m[255&N]),A[F]=A[F-D]^N;if(C){for(var G,T=p[0],O=p[1],V=p[2],L=p[3],H=A.slice(0),ne=(F=0,(k=A.length)-4);F<k;F+=4,ne-=4)if(0===F||F===k-4)H[F]=A[ne],H[F+1]=A[ne+3],H[F+2]=A[ne+2],H[F+3]=A[ne+1];else for(var j=0;j<4;++j)H[F+(3&-j)]=T[m[(G=A[ne+j])>>>24]]^O[m[G>>>16&255]]^V[m[G>>>8&255]]^L[m[255&G]];A=H}return A}function E(h,C,A,N){var D,M,k,F,G,T,O,V,L,H,ne,j,S=h.length/4-1;N?(D=p[0],M=p[1],k=p[2],F=p[3],G=d):(D=f[0],M=f[1],k=f[2],F=f[3],G=m),T=C[0]^h[0],O=C[N?3:1]^h[1],V=C[2]^h[2],L=C[N?1:3]^h[3];for(var ee=3,Z=1;Z<S;++Z)H=D[T>>>24]^M[O>>>16&255]^k[V>>>8&255]^F[255&L]^h[++ee],ne=D[O>>>24]^M[V>>>16&255]^k[L>>>8&255]^F[255&T]^h[++ee],j=D[V>>>24]^M[L>>>16&255]^k[T>>>8&255]^F[255&O]^h[++ee],L=D[L>>>24]^M[T>>>16&255]^k[O>>>8&255]^F[255&V]^h[++ee],T=H,O=ne,V=j;A[0]=G[T>>>24]<<24^G[O>>>16&255]<<16^G[V>>>8&255]<<8^G[255&L]^h[++ee],A[N?3:1]=G[O>>>24]<<24^G[V>>>16&255]<<16^G[L>>>8&255]<<8^G[255&T]^h[++ee],A[2]=G[V>>>24]<<24^G[L>>>16&255]<<16^G[T>>>8&255]<<8^G[255&O]^h[++ee],A[N?1:3]=G[L>>>24]<<24^G[T>>>16&255]<<16^G[O>>>8&255]<<8^G[255&V]^h[++ee]}function v(h){var N,A="AES-"+((h=h||{}).mode||"CBC").toUpperCase(),S=(N=h.decrypt?y.cipher.createDecipher(A,h.key):y.cipher.createCipher(A,h.key)).start;return N.start=function(D,M){var k=null;M instanceof y.util.ByteBuffer&&(k=M,M={}),(M=M||{}).output=k,M.iv=D,S.call(N,M)},N}},7791:(Y,K,R)=>{var y=R(8659);R(4747),R(6078);var l=Y.exports=y.asn1=y.asn1||{};function g(c,f,p){if(p>f){var w=new Error("Too few bytes to parse DER.");throw w.available=c.length(),w.remaining=f,w.requested=p,w}}function m(c,f,p,w){var I;g(c,f,2);var E=c.getByte();f--;var v=192&E,h=31&E;I=c.length();var C=function(c,f){var p=c.getByte();if(f--,128!==p){var w;if(128&p){var E=127&p;g(c,f,E),w=c.getInt(E<<3)}else w=p;if(w<0)throw new Error("Negative length: "+w);return w}}(c,f);if(f-=I-c.length(),void 0!==C&&C>f){if(w.strict){var A=new Error("Too few bytes to read ASN.1 value.");throw A.available=c.length(),A.remaining=f,A.requested=C,A}C=f}var N,S,D=32==(32&E);if(D)if(N=[],void 0===C)for(;;){if(g(c,f,2),c.bytes(2)===String.fromCharCode(0,0)){c.getBytes(2),f-=2;break}I=c.length(),N.push(m(c,f,p+1,w)),f-=I-c.length()}else for(;C>0;)I=c.length(),N.push(m(c,C,p+1,w)),f-=I-c.length(),C-=I-c.length();if(void 0===N&&v===l.Class.UNIVERSAL&&h===l.Type.BITSTRING&&(S=c.bytes(C)),void 0===N&&w.decodeBitStrings&&v===l.Class.UNIVERSAL&&h===l.Type.BITSTRING&&C>1){var M=c.read,k=f,F=0;if(h===l.Type.BITSTRING&&(g(c,f,1),F=c.getByte(),f--),0===F)try{I=c.length();var T=m(c,f,p+1,{strict:!0,decodeBitStrings:!0}),O=I-c.length();f-=O,h==l.Type.BITSTRING&&O++;var V=T.tagClass;O===C&&(V===l.Class.UNIVERSAL||V===l.Class.CONTEXT_SPECIFIC)&&(N=[T])}catch{}void 0===N&&(c.read=M,f=k)}if(void 0===N){if(void 0===C){if(w.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");C=f}if(h===l.Type.BMPSTRING)for(N="";C>0;C-=2)g(c,f,2),N+=String.fromCharCode(c.getInt16()),f-=2;else N=c.getBytes(C),f-=C}return l.create(v,h,D,N,void 0===S?null:{bitStringContents:S})}l.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},l.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},l.create=function(c,f,p,w,I){if(y.util.isArray(w)){for(var E=[],v=0;v<w.length;++v)void 0!==w[v]&&E.push(w[v]);w=E}var h={tagClass:c,type:f,constructed:p,composed:p||y.util.isArray(w),value:w};return I&&"bitStringContents"in I&&(h.bitStringContents=I.bitStringContents,h.original=l.copy(h)),h},l.copy=function(c,f){var p;if(y.util.isArray(c)){p=[];for(var w=0;w<c.length;++w)p.push(l.copy(c[w],f));return p}return"string"==typeof c?c:(p={tagClass:c.tagClass,type:c.type,constructed:c.constructed,composed:c.composed,value:l.copy(c.value,f)},f&&!f.excludeBitStringContents&&(p.bitStringContents=c.bitStringContents),p)},l.equals=function(c,f,p){if(y.util.isArray(c)){if(!y.util.isArray(f)||c.length!==f.length)return!1;for(var w=0;w<c.length;++w)if(!l.equals(c[w],f[w]))return!1;return!0}if(typeof c!=typeof f)return!1;if("string"==typeof c)return c===f;var I=c.tagClass===f.tagClass&&c.type===f.type&&c.constructed===f.constructed&&c.composed===f.composed&&l.equals(c.value,f.value);return p&&p.includeBitStringContents&&(I=I&&c.bitStringContents===f.bitStringContents),I},l.getBerValueLength=function(c){var f=c.getByte();if(128!==f)return 128&f?c.getInt((127&f)<<3):f},l.fromDer=function(c,f){void 0===f&&(f={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof f&&(f={strict:f,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in f||(f.strict=!0),"parseAllBytes"in f||(f.parseAllBytes=!0),"decodeBitStrings"in f||(f.decodeBitStrings=!0),"string"==typeof c&&(c=y.util.createBuffer(c));var p=c.length(),w=m(c,c.length(),0,f);if(f.parseAllBytes&&0!==c.length()){var I=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw I.byteCount=p,I.remaining=c.length(),I}return w},l.toDer=function(c){var f=y.util.createBuffer(),p=c.tagClass|c.type,w=y.util.createBuffer(),I=!1;if("bitStringContents"in c&&(I=!0,c.original&&(I=l.equals(c,c.original))),I)w.putBytes(c.bitStringContents);else if(c.composed){c.constructed?p|=32:w.putByte(0);for(var E=0;E<c.value.length;++E)void 0!==c.value[E]&&w.putBuffer(l.toDer(c.value[E]))}else if(c.type===l.Type.BMPSTRING)for(E=0;E<c.value.length;++E)w.putInt16(c.value.charCodeAt(E));else c.type===l.Type.INTEGER&&c.value.length>1&&(0===c.value.charCodeAt(0)&&0==(128&c.value.charCodeAt(1))||255===c.value.charCodeAt(0)&&128==(128&c.value.charCodeAt(1)))?w.putBytes(c.value.substr(1)):w.putBytes(c.value);if(f.putByte(p),w.length()<=127)f.putByte(127&w.length());else{var v=w.length(),h="";do{h+=String.fromCharCode(255&v),v>>>=8}while(v>0);for(f.putByte(128|h.length),E=h.length-1;E>=0;--E)f.putByte(h.charCodeAt(E))}return f.putBuffer(w),f},l.oidToDer=function(c){var f=c.split("."),p=y.util.createBuffer();p.putByte(40*parseInt(f[0],10)+parseInt(f[1],10));for(var w,I,E,v,h=2;h<f.length;++h){w=!0,I=[],E=parseInt(f[h],10);do{v=127&E,E>>>=7,w||(v|=128),I.push(v),w=!1}while(E>0);for(var C=I.length-1;C>=0;--C)p.putByte(I[C])}return p},l.derToOid=function(c){var f;"string"==typeof c&&(c=y.util.createBuffer(c));var p=c.getByte();f=Math.floor(p/40)+"."+p%40;for(var w=0;c.length()>0;)w<<=7,128&(p=c.getByte())?w+=127&p:(f+="."+(w+p),w=0);return f},l.utcTimeToDate=function(c){var f=new Date,p=parseInt(c.substr(0,2),10);p=p>=50?1900+p:2e3+p;var w=parseInt(c.substr(2,2),10)-1,I=parseInt(c.substr(4,2),10),E=parseInt(c.substr(6,2),10),v=parseInt(c.substr(8,2),10),h=0;if(c.length>11){var C=c.charAt(10),A=10;"+"!==C&&"-"!==C&&(h=parseInt(c.substr(10,2),10),A+=2)}if(f.setUTCFullYear(p,w,I),f.setUTCHours(E,v,h,0),A&&("+"===(C=c.charAt(A))||"-"===C)){var D=60*parseInt(c.substr(A+1,2),10)+parseInt(c.substr(A+4,2),10);D*=6e4,f.setTime("+"===C?+f-D:+f+D)}return f},l.generalizedTimeToDate=function(c){var f=new Date,p=parseInt(c.substr(0,4),10),w=parseInt(c.substr(4,2),10)-1,I=parseInt(c.substr(6,2),10),E=parseInt(c.substr(8,2),10),v=parseInt(c.substr(10,2),10),h=parseInt(c.substr(12,2),10),C=0,A=0,N=!1;"Z"===c.charAt(c.length-1)&&(N=!0);var S=c.length-5,D=c.charAt(S);return"+"!==D&&"-"!==D||(A=60*parseInt(c.substr(S+1,2),10)+parseInt(c.substr(S+4,2),10),A*=6e4,"+"===D&&(A*=-1),N=!0),"."===c.charAt(14)&&(C=1e3*parseFloat(c.substr(14),10)),N?(f.setUTCFullYear(p,w,I),f.setUTCHours(E,v,h,C),f.setTime(+f+A)):(f.setFullYear(p,w,I),f.setHours(E,v,h,C)),f},l.dateToUtcTime=function(c){if("string"==typeof c)return c;var f="",p=[];p.push((""+c.getUTCFullYear()).substr(2)),p.push(""+(c.getUTCMonth()+1)),p.push(""+c.getUTCDate()),p.push(""+c.getUTCHours()),p.push(""+c.getUTCMinutes()),p.push(""+c.getUTCSeconds());for(var w=0;w<p.length;++w)p[w].length<2&&(f+="0"),f+=p[w];return f+"Z"},l.dateToGeneralizedTime=function(c){if("string"==typeof c)return c;var f="",p=[];p.push(""+c.getUTCFullYear()),p.push(""+(c.getUTCMonth()+1)),p.push(""+c.getUTCDate()),p.push(""+c.getUTCHours()),p.push(""+c.getUTCMinutes()),p.push(""+c.getUTCSeconds());for(var w=0;w<p.length;++w)p[w].length<2&&(f+="0"),f+=p[w];return f+"Z"},l.integerToDer=function(c){var f=y.util.createBuffer();if(c>=-128&&c<128)return f.putSignedInt(c,8);if(c>=-32768&&c<32768)return f.putSignedInt(c,16);if(c>=-8388608&&c<8388608)return f.putSignedInt(c,24);if(c>=-2147483648&&c<2147483648)return f.putSignedInt(c,32);var p=new Error("Integer too large; max is 32-bits.");throw p.integer=c,p},l.derToInteger=function(c){"string"==typeof c&&(c=y.util.createBuffer(c));var f=8*c.length();if(f>32)throw new Error("Integer too large; max is 32-bits.");return c.getSignedInt(f)},l.validate=function(c,f,p,w){var I=!1;if((c.tagClass===f.tagClass||typeof f.tagClass>"u")&&(c.type===f.type||typeof f.type>"u"))if(c.constructed===f.constructed||typeof f.constructed>"u"){if(I=!0,f.value&&y.util.isArray(f.value))for(var E=0,v=0;I&&v<f.value.length;++v)I=f.value[v].optional||!1,c.value[E]&&((I=l.validate(c.value[E],f.value[v],p,w))?++E:f.value[v].optional&&(I=!0)),!I&&w&&w.push("["+f.name+'] Tag class "'+f.tagClass+'", type "'+f.type+'" expected value length "'+f.value.length+'", got "'+c.value.length+'"');if(I&&p&&(f.capture&&(p[f.capture]=c.value),f.captureAsn1&&(p[f.captureAsn1]=c),f.captureBitStringContents&&"bitStringContents"in c&&(p[f.captureBitStringContents]=c.bitStringContents),f.captureBitStringValue&&"bitStringContents"in c))if(c.bitStringContents.length<2)p[f.captureBitStringValue]="";else{if(0!==c.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");p[f.captureBitStringValue]=c.bitStringContents.slice(1)}}else w&&w.push("["+f.name+'] Expected constructed "'+f.constructed+'", got "'+c.constructed+'"');else w&&(c.tagClass!==f.tagClass&&w.push("["+f.name+'] Expected tag class "'+f.tagClass+'", got "'+c.tagClass+'"'),c.type!==f.type&&w.push("["+f.name+'] Expected type "'+f.type+'", got "'+c.type+'"'));return I};var d=/[^\\u0000-\\u00ff]/;l.prettyPrint=function(c,f,p){var w="";p=p||2,(f=f||0)>0&&(w+="\n");for(var I="",E=0;E<f*p;++E)I+=" ";switch(w+=I+"Tag: ",c.tagClass){case l.Class.UNIVERSAL:w+="Universal:";break;case l.Class.APPLICATION:w+="Application:";break;case l.Class.CONTEXT_SPECIFIC:w+="Context-Specific:";break;case l.Class.PRIVATE:w+="Private:"}if(c.tagClass===l.Class.UNIVERSAL)switch(w+=c.type,c.type){case l.Type.NONE:w+=" (None)";break;case l.Type.BOOLEAN:w+=" (Boolean)";break;case l.Type.INTEGER:w+=" (Integer)";break;case l.Type.BITSTRING:w+=" (Bit string)";break;case l.Type.OCTETSTRING:w+=" (Octet string)";break;case l.Type.NULL:w+=" (Null)";break;case l.Type.OID:w+=" (Object Identifier)";break;case l.Type.ODESC:w+=" (Object Descriptor)";break;case l.Type.EXTERNAL:w+=" (External or Instance of)";break;case l.Type.REAL:w+=" (Real)";break;case l.Type.ENUMERATED:w+=" (Enumerated)";break;case l.Type.EMBEDDED:w+=" (Embedded PDV)";break;case l.Type.UTF8:w+=" (UTF8)";break;case l.Type.ROID:w+=" (Relative Object Identifier)";break;case l.Type.SEQUENCE:w+=" (Sequence)";break;case l.Type.SET:w+=" (Set)";break;case l.Type.PRINTABLESTRING:w+=" (Printable String)";break;case l.Type.IA5String:w+=" (IA5String (ASCII))";break;case l.Type.UTCTIME:w+=" (UTC time)";break;case l.Type.GENERALIZEDTIME:w+=" (Generalized time)";break;case l.Type.BMPSTRING:w+=" (BMP String)"}else w+=c.type;if(w+="\n",w+=I+"Constructed: "+c.constructed+"\n",c.composed){var v=0,h="";for(E=0;E<c.value.length;++E)void 0!==c.value[E]&&(v+=1,h+=l.prettyPrint(c.value[E],f+1,p),E+1<c.value.length&&(h+=","));w+=I+"Sub values: "+v+h}else{if(w+=I+"Value: ",c.type===l.Type.OID){var C=l.derToOid(c.value);w+=C,y.pki&&y.pki.oids&&C in y.pki.oids&&(w+=" ("+y.pki.oids[C]+") ")}if(c.type===l.Type.INTEGER)try{w+=l.derToInteger(c.value)}catch{w+="0x"+y.util.bytesToHex(c.value)}else if(c.type===l.Type.BITSTRING){if(w+=c.value.length>1?"0x"+y.util.bytesToHex(c.value.slice(1)):"(none)",c.value.length>0){var A=c.value.charCodeAt(0);1==A?w+=" (1 unused bit shown)":A>1&&(w+=" ("+A+" unused bits shown)")}}else if(c.type===l.Type.OCTETSTRING)d.test(c.value)||(w+="("+c.value+") "),w+="0x"+y.util.bytesToHex(c.value);else if(c.type===l.Type.UTF8)try{w+=y.util.decodeUtf8(c.value)}catch(N){if("URI malformed"!==N.message)throw N;w+="0x"+y.util.bytesToHex(c.value)+" (malformed UTF8)"}else c.type===l.Type.PRINTABLESTRING||c.type===l.Type.IA5String?w+=c.value:d.test(c.value)?w+="0x"+y.util.bytesToHex(c.value):w+=0===c.value.length?"[null]":c.value}return w}},2020:Y=>{var K={};Y.exports=K;var R={};K.encode=function(l,g,b){if("string"!=typeof g)throw new TypeError('"alphabet" must be a string.');if(void 0!==b&&"number"!=typeof b)throw new TypeError('"maxline" must be a number.');var m="";if(l instanceof Uint8Array){var d=0,c=g.length,f=g.charAt(0),p=[0];for(d=0;d<l.length;++d){for(var w=0,I=l[d];w<p.length;++w)p[w]=(I+=p[w]<<8)%c,I=I/c|0;for(;I>0;)p.push(I%c),I=I/c|0}for(d=0;0===l[d]&&d<l.length-1;++d)m+=f;for(d=p.length-1;d>=0;--d)m+=g[p[d]]}else m=function y(l,g){var b=0,m=g.length,d=g.charAt(0),c=[0];for(b=0;b<l.length();++b){for(var f=0,p=l.at(b);f<c.length;++f)c[f]=(p+=c[f]<<8)%m,p=p/m|0;for(;p>0;)c.push(p%m),p=p/m|0}var w="";for(b=0;0===l.at(b)&&b<l.length()-1;++b)w+=d;for(b=c.length-1;b>=0;--b)w+=g[c[b]];return w}(l,g);if(b){var E=new RegExp(".{1,"+b+"}","g");m=m.match(E).join("\r\n")}return m},K.decode=function(l,g){if("string"!=typeof l)throw new TypeError('"input" must be a string.');if("string"!=typeof g)throw new TypeError('"alphabet" must be a string.');var b=R[g];if(!b){b=R[g]=[];for(var m=0;m<g.length;++m)b[g.charCodeAt(m)]=m}l=l.replace(/\s/g,"");var d=g.length,c=g.charAt(0),f=[0];for(m=0;m<l.length;m++){var p=b[l.charCodeAt(m)];if(void 0===p)return;for(var w=0,I=p;w<f.length;++w)f[w]=255&(I+=f[w]*d),I>>=8;for(;I>0;)f.push(255&I),I>>=8}for(var E=0;l[E]===c&&E<l.length-1;++E)f.push(0);return typeof Buffer<"u"?Buffer.from(f.reverse()):new Uint8Array(f.reverse())}},3311:(Y,K,R)=>{var y=R(8659);R(4747),Y.exports=y.cipher=y.cipher||{},y.cipher.algorithms=y.cipher.algorithms||{},y.cipher.createCipher=function(g,b){var m=g;if("string"==typeof m&&(m=y.cipher.getAlgorithm(m))&&(m=m()),!m)throw new Error("Unsupported algorithm: "+g);return new y.cipher.BlockCipher({algorithm:m,key:b,decrypt:!1})},y.cipher.createDecipher=function(g,b){var m=g;if("string"==typeof m&&(m=y.cipher.getAlgorithm(m))&&(m=m()),!m)throw new Error("Unsupported algorithm: "+g);return new y.cipher.BlockCipher({algorithm:m,key:b,decrypt:!0})},y.cipher.registerAlgorithm=function(g,b){g=g.toUpperCase(),y.cipher.algorithms[g]=b},y.cipher.getAlgorithm=function(g){return(g=g.toUpperCase())in y.cipher.algorithms?y.cipher.algorithms[g]:null};var l=y.cipher.BlockCipher=function(g){this.algorithm=g.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=g.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=g.decrypt,this.algorithm.initialize(g)};l.prototype.start=function(g){g=g||{};var b={};for(var m in g)b[m]=g[m];b.decrypt=this._decrypt,this._finish=!1,this._input=y.util.createBuffer(),this.output=g.output||y.util.createBuffer(),this.mode.start(b)},l.prototype.update=function(g){for(g&&this._input.putBuffer(g);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},l.prototype.finish=function(g){g&&("ECB"===this.mode.name||"CBC"===this.mode.name)&&(this.mode.pad=function(m){return g(this.blockSize,m,!1)},this.mode.unpad=function(m){return g(this.blockSize,m,!0)});var b={};return b.decrypt=this._decrypt,b.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,b)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b))}},3481:(Y,K,R)=>{var y=R(8659);R(4747),y.cipher=y.cipher||{};var l=Y.exports=y.cipher.modes=y.cipher.modes||{};function g(d,c){if("string"==typeof d&&(d=y.util.createBuffer(d)),y.util.isArray(d)&&d.length>4){var f=d;d=y.util.createBuffer();for(var p=0;p<f.length;++p)d.putByte(f[p])}if(d.length()<c)throw new Error("Invalid IV length; got "+d.length()+" bytes and expected "+c+" bytes.");if(!y.util.isArray(d)){var w=[],I=c/4;for(p=0;p<I;++p)w.push(d.getInt32());d=w}return d}function b(d){d[d.length-1]=d[d.length-1]+1&4294967295}function m(d){return[d/4294967296|0,4294967295&d]}l.ecb=function(d){d=d||{},this.name="ECB",this.cipher=d.cipher,this.blockSize=d.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},l.ecb.prototype.start=function(d){},l.ecb.prototype.encrypt=function(d,c,f){if(d.length()<this.blockSize&&!(f&&d.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=d.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),p=0;p<this._ints;++p)c.putInt32(this._outBlock[p])},l.ecb.prototype.decrypt=function(d,c,f){if(d.length()<this.blockSize&&!(f&&d.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=d.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),p=0;p<this._ints;++p)c.putInt32(this._outBlock[p])},l.ecb.prototype.pad=function(d,c){var f=d.length()===this.blockSize?this.blockSize:this.blockSize-d.length();return d.fillWithByte(f,f),!0},l.ecb.prototype.unpad=function(d,c){if(c.overflow>0)return!1;var f=d.length(),p=d.at(f-1);return!(p>this.blockSize<<2||(d.truncate(p),0))},l.cbc=function(d){d=d||{},this.name="CBC",this.cipher=d.cipher,this.blockSize=d.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},l.cbc.prototype.start=function(d){if(null===d.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in d))throw new Error("Invalid IV parameter.");this._iv=g(d.iv,this.blockSize),this._prev=this._iv.slice(0)}},l.cbc.prototype.encrypt=function(d,c,f){if(d.length()<this.blockSize&&!(f&&d.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=this._prev[p]^d.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),p=0;p<this._ints;++p)c.putInt32(this._outBlock[p]);this._prev=this._outBlock},l.cbc.prototype.decrypt=function(d,c,f){if(d.length()<this.blockSize&&!(f&&d.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=d.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),p=0;p<this._ints;++p)c.putInt32(this._prev[p]^this._outBlock[p]);this._prev=this._inBlock.slice(0)},l.cbc.prototype.pad=function(d,c){var f=d.length()===this.blockSize?this.blockSize:this.blockSize-d.length();return d.fillWithByte(f,f),!0},l.cbc.prototype.unpad=function(d,c){if(c.overflow>0)return!1;var f=d.length(),p=d.at(f-1);return!(p>this.blockSize<<2||(d.truncate(p),0))},l.cfb=function(d){d=d||{},this.name="CFB",this.cipher=d.cipher,this.blockSize=d.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=y.util.createBuffer(),this._partialBytes=0},l.cfb.prototype.start=function(d){if(!("iv"in d))throw new Error("Invalid IV parameter.");this._iv=g(d.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},l.cfb.prototype.encrypt=function(d,c,f){var p=d.length();if(0===p)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&p>=this.blockSize)for(var w=0;w<this._ints;++w)this._inBlock[w]=d.getInt32()^this._outBlock[w],c.putInt32(this._inBlock[w]);else{var I=(this.blockSize-p)%this.blockSize;for(I>0&&(I=this.blockSize-I),this._partialOutput.clear(),w=0;w<this._ints;++w)this._partialBlock[w]=d.getInt32()^this._outBlock[w],this._partialOutput.putInt32(this._partialBlock[w]);if(I>0)d.read-=this.blockSize;else for(w=0;w<this._ints;++w)this._inBlock[w]=this._partialBlock[w];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!f)return c.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;c.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}},l.cfb.prototype.decrypt=function(d,c,f){var p=d.length();if(0===p)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&p>=this.blockSize)for(var w=0;w<this._ints;++w)this._inBlock[w]=d.getInt32(),c.putInt32(this._inBlock[w]^this._outBlock[w]);else{var I=(this.blockSize-p)%this.blockSize;for(I>0&&(I=this.blockSize-I),this._partialOutput.clear(),w=0;w<this._ints;++w)this._partialBlock[w]=d.getInt32(),this._partialOutput.putInt32(this._partialBlock[w]^this._outBlock[w]);if(I>0)d.read-=this.blockSize;else for(w=0;w<this._ints;++w)this._inBlock[w]=this._partialBlock[w];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!f)return c.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;c.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}},l.ofb=function(d){d=d||{},this.name="OFB",this.cipher=d.cipher,this.blockSize=d.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=y.util.createBuffer(),this._partialBytes=0},l.ofb.prototype.start=function(d){if(!("iv"in d))throw new Error("Invalid IV parameter.");this._iv=g(d.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},l.ofb.prototype.encrypt=function(d,c,f){var p=d.length();if(0===d.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&p>=this.blockSize)for(var w=0;w<this._ints;++w)c.putInt32(d.getInt32()^this._outBlock[w]),this._inBlock[w]=this._outBlock[w];else{var I=(this.blockSize-p)%this.blockSize;for(I>0&&(I=this.blockSize-I),this._partialOutput.clear(),w=0;w<this._ints;++w)this._partialOutput.putInt32(d.getInt32()^this._outBlock[w]);if(I>0)d.read-=this.blockSize;else for(w=0;w<this._ints;++w)this._inBlock[w]=this._outBlock[w];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!f)return c.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;c.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}},l.ofb.prototype.decrypt=l.ofb.prototype.encrypt,l.ctr=function(d){d=d||{},this.name="CTR",this.cipher=d.cipher,this.blockSize=d.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=y.util.createBuffer(),this._partialBytes=0},l.ctr.prototype.start=function(d){if(!("iv"in d))throw new Error("Invalid IV parameter.");this._iv=g(d.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},l.ctr.prototype.encrypt=function(d,c,f){var p=d.length();if(0===p)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&p>=this.blockSize)for(var w=0;w<this._ints;++w)c.putInt32(d.getInt32()^this._outBlock[w]);else{var I=(this.blockSize-p)%this.blockSize;for(I>0&&(I=this.blockSize-I),this._partialOutput.clear(),w=0;w<this._ints;++w)this._partialOutput.putInt32(d.getInt32()^this._outBlock[w]);if(I>0&&(d.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!f)return c.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;c.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}b(this._inBlock)},l.ctr.prototype.decrypt=l.ctr.prototype.encrypt,l.gcm=function(d){d=d||{},this.name="GCM",this.cipher=d.cipher,this.blockSize=d.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=y.util.createBuffer(),this._partialBytes=0,this._R=3774873600},l.gcm.prototype.start=function(d){if(!("iv"in d))throw new Error("Invalid IV parameter.");var f,c=y.util.createBuffer(d.iv);if(this._cipherLength=0,f="additionalData"in d?y.util.createBuffer(d.additionalData):y.util.createBuffer(),this._tagLength="tagLength"in d?d.tagLength:128,this._tag=null,d.decrypt&&(this._tag=y.util.createBuffer(d.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 p=c.length();if(12===p)this._j0=[c.getInt32(),c.getInt32(),c.getInt32(),1];else{for(this._j0=[0,0,0,0];c.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[c.getInt32(),c.getInt32(),c.getInt32(),c.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(m(8*p)))}this._inBlock=this._j0.slice(0),b(this._inBlock),this._partialBytes=0,f=y.util.createBuffer(f),this._aDataLength=m(8*f.length());var w=f.length()%this.blockSize;for(w&&f.fillWithByte(0,this.blockSize-w),this._s=[0,0,0,0];f.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[f.getInt32(),f.getInt32(),f.getInt32(),f.getInt32()])},l.gcm.prototype.encrypt=function(d,c,f){var p=d.length();if(0===p)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&p>=this.blockSize){for(var w=0;w<this._ints;++w)c.putInt32(this._outBlock[w]^=d.getInt32());this._cipherLength+=this.blockSize}else{var I=(this.blockSize-p)%this.blockSize;for(I>0&&(I=this.blockSize-I),this._partialOutput.clear(),w=0;w<this._ints;++w)this._partialOutput.putInt32(d.getInt32()^this._outBlock[w]);if(I<=0||f){if(f){var E=p%this.blockSize;this._cipherLength+=E,this._partialOutput.truncate(this.blockSize-E)}else this._cipherLength+=this.blockSize;for(w=0;w<this._ints;++w)this._outBlock[w]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),I>0&&!f)return d.read-=this.blockSize,c.putBytes(this._partialOutput.getBytes(I-this._partialBytes)),this._partialBytes=I,!0;c.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),b(this._inBlock)},l.gcm.prototype.decrypt=function(d,c,f){var p=d.length();if(p<this.blockSize&&!(f&&p>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),b(this._inBlock),this._hashBlock[0]=d.getInt32(),this._hashBlock[1]=d.getInt32(),this._hashBlock[2]=d.getInt32(),this._hashBlock[3]=d.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var w=0;w<this._ints;++w)c.putInt32(this._outBlock[w]^this._hashBlock[w]);this._cipherLength+=p<this.blockSize?p%this.blockSize:this.blockSize},l.gcm.prototype.afterFinish=function(d,c){var f=!0;c.decrypt&&c.overflow&&d.truncate(this.blockSize-c.overflow),this.tag=y.util.createBuffer();var p=this._aDataLength.concat(m(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,p);var w=[];this.cipher.encrypt(this._j0,w);for(var I=0;I<this._ints;++I)this.tag.putInt32(this._s[I]^w[I]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),c.decrypt&&this.tag.bytes()!==this._tag&&(f=!1),f},l.gcm.prototype.multiply=function(d,c){for(var f=[0,0,0,0],p=c.slice(0),w=0;w<128;++w)d[w/32|0]&1<<31-w%32&&(f[0]^=p[0],f[1]^=p[1],f[2]^=p[2],f[3]^=p[3]),this.pow(p,p);return f},l.gcm.prototype.pow=function(d,c){for(var f=1&d[3],p=3;p>0;--p)c[p]=d[p]>>>1|(1&d[p-1])<<31;c[0]=d[0]>>>1,f&&(c[0]^=this._R)},l.gcm.prototype.tableMultiply=function(d){for(var c=[0,0,0,0],f=0;f<32;++f){var I=this._m[f][d[f/8|0]>>>4*(7-f%8)&15];c[0]^=I[0],c[1]^=I[1],c[2]^=I[2],c[3]^=I[3]}return c},l.gcm.prototype.ghash=function(d,c,f){return c[0]^=f[0],c[1]^=f[1],c[2]^=f[2],c[3]^=f[3],this.tableMultiply(c)},l.gcm.prototype.generateHashTable=function(d,c){for(var f=8/c,p=4*f,w=16*f,I=new Array(w),E=0;E<w;++E){var v=[0,0,0,0];v[E/p|0]=1<<c-1<<(p-1-E%p)*c,I[E]=this.generateSubHashTable(this.multiply(v,d),c)}return I},l.gcm.prototype.generateSubHashTable=function(d,c){var f=1<<c,p=f>>>1,w=new Array(f);w[p]=d.slice(0);for(var I=p>>>1;I>0;)this.pow(w[2*I],w[I]=[]),I>>=1;for(I=2;I<p;){for(var E=1;E<I;++E){var v=w[I],h=w[E];w[I+E]=[v[0]^h[0],v[1]^h[1],v[2]^h[2],v[3]^h[3]]}I*=2}for(w[0]=[0,0,0,0],I=p+1;I<f;++I){var C=w[I^p];w[I]=[d[0]^C[0],d[1]^C[1],d[2]^C[2],d[3]^C[3]]}return w}},279:(Y,K,R)=>{var y=R(8659);function l(h,C){y.cipher.registerAlgorithm(h,function(){return new y.des.Algorithm(h,C)})}R(3311),R(3481),R(4747),Y.exports=y.des=y.des||{},y.des.startEncrypting=function(h,C,A,N){var S=v({key:h,output:A,decrypt:!1,mode:N||(null===C?"ECB":"CBC")});return S.start(C),S},y.des.createEncryptionCipher=function(h,C){return v({key:h,output:null,decrypt:!1,mode:C})},y.des.startDecrypting=function(h,C,A,N){var S=v({key:h,output:A,decrypt:!0,mode:N||(null===C?"ECB":"CBC")});return S.start(C),S},y.des.createDecryptionCipher=function(h,C){return v({key:h,output:null,decrypt:!0,mode:C})},y.des.Algorithm=function(h,C){var A=this;A.name=h,A.mode=new C({blockSize:8,cipher:{encrypt:function(N,S){return E(A._keys,N,S,!1)},decrypt:function(N,S){return E(A._keys,N,S,!0)}}}),A._init=!1},y.des.Algorithm.prototype.initialize=function(h){if(!this._init){var C=y.util.createBuffer(h.key);if(0===this.name.indexOf("3DES")&&24!==C.length())throw new Error("Invalid Triple-DES key size: "+8*C.length());this._keys=function I(h){for(var q,C=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],A=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],N=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],S=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],D=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],M=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],k=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],F=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],G=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],T=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],O=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],V=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],L=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],H=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],ne=h.length()>8?3:1,j=[],ee=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],Z=0,te=0;te<ne;te++){var oe=h.getInt32(),de=h.getInt32();oe^=(q=252645135&(oe>>>4^de))<<4,oe^=q=65535&((de^=q)>>>-16^oe),oe^=(q=858993459&(oe>>>2^(de^=q<<-16)))<<2,oe^=q=65535&((de^=q)>>>-16^oe),oe^=(q=1431655765&(oe>>>1^(de^=q<<-16)))<<1,oe^=q=16711935&((de^=q)>>>8^oe),q=(oe^=(q=1431655765&(oe>>>1^(de^=q<<8)))<<1)<<8|(de^=q)>>>20&240,oe=de<<24|de<<8&16711680|de>>>8&65280|de>>>24&240,de=q;for(var he=0;he<ee.length;++he){ee[he]?(oe=oe<<2|oe>>>26,de=de<<2|de>>>26):(oe=oe<<1|oe>>>27,de=de<<1|de>>>27);var Pe=C[(oe&=-15)>>>28]|A[oe>>>24&15]|N[oe>>>20&15]|S[oe>>>16&15]|D[oe>>>12&15]|M[oe>>>8&15]|k[oe>>>4&15],Se=F[(de&=-15)>>>28]|G[de>>>24&15]|T[de>>>20&15]|O[de>>>16&15]|V[de>>>12&15]|L[de>>>8&15]|H[de>>>4&15];j[Z++]=Pe^(q=65535&(Se>>>16^Pe)),j[Z++]=Se^q<<16}}return j}(C),this._init=!0}},l("DES-ECB",y.cipher.modes.ecb),l("DES-CBC",y.cipher.modes.cbc),l("DES-CFB",y.cipher.modes.cfb),l("DES-OFB",y.cipher.modes.ofb),l("DES-CTR",y.cipher.modes.ctr),l("3DES-ECB",y.cipher.modes.ecb),l("3DES-CBC",y.cipher.modes.cbc),l("3DES-CFB",y.cipher.modes.cfb),l("3DES-OFB",y.cipher.modes.ofb),l("3DES-CTR",y.cipher.modes.ctr);var g=[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],b=[-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],m=[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],d=[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],c=[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],f=[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],p=[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],w=[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 E(h,C,A,N){var D,S=32===h.length?3:9;D=3===S?N?[30,-2,-2]:[0,32,2]:N?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var M,k=C[0],F=C[1];k^=(M=252645135&(k>>>4^F))<<4,k^=(M=65535&(k>>>16^(F^=M)))<<16,k^=M=858993459&((F^=M)>>>2^k),k^=M=16711935&((F^=M<<2)>>>8^k),k=(k^=(M=1431655765&(k>>>1^(F^=M<<8)))<<1)<<1|k>>>31,F=(F^=M)<<1|F>>>31;for(var G=0;G<S;G+=3){for(var T=D[G+1],O=D[G+2],V=D[G];V!=T;V+=O){var L=F^h[V],H=(F>>>4|F<<28)^h[V+1];M=k,k=F,F=M^(b[L>>>24&63]|d[L>>>16&63]|f[L>>>8&63]|w[63&L]|g[H>>>24&63]|m[H>>>16&63]|c[H>>>8&63]|p[63&H])}M=k,k=F,F=M}F=F>>>1|F<<31,F^=M=1431655765&((k=k>>>1|k<<31)>>>1^F),F^=(M=16711935&(F>>>8^(k^=M<<1)))<<8,F^=(M=858993459&(F>>>2^(k^=M)))<<2,F^=M=65535&((k^=M)>>>16^F),F^=M=252645135&((k^=M<<16)>>>4^F),A[0]=k^=M<<4,A[1]=F}function v(h){var N,A="DES-"+((h=h||{}).mode||"CBC").toUpperCase(),S=(N=h.decrypt?y.cipher.createDecipher(A,h.key):y.cipher.createCipher(A,h.key)).start;return N.start=function(D,M){var k=null;M instanceof y.util.ByteBuffer&&(k=M,M={}),(M=M||{}).output=k,M.iv=D,S.call(N,M)},N}},8659:Y=>{Y.exports={options:{usePureJavaScript:!1}}},9032:(Y,K,R)=>{var y=R(8659);R(979),R(4747),(Y.exports=y.hmac=y.hmac||{}).create=function(){var g=null,b=null,m=null,d=null,c={start:function(f,p){if(null!==f)if("string"==typeof f){if(!((f=f.toLowerCase())in y.md.algorithms))throw new Error('Unknown hash algorithm "'+f+'"');b=y.md.algorithms[f].create()}else b=f;if(null===p)p=g;else{if("string"==typeof p)p=y.util.createBuffer(p);else if(y.util.isArray(p)){var w=p;p=y.util.createBuffer();for(var I=0;I<w.length;++I)p.putByte(w[I])}var E=p.length();for(E>b.blockLength&&(b.start(),b.update(p.bytes()),p=b.digest()),m=y.util.createBuffer(),d=y.util.createBuffer(),E=p.length(),I=0;I<E;++I)w=p.at(I),m.putByte(54^w),d.putByte(92^w);if(E<b.blockLength)for(w=b.blockLength-E,I=0;I<w;++I)m.putByte(54),d.putByte(92);g=p,m=m.bytes(),d=d.bytes()}b.start(),b.update(m)},update:function(f){b.update(f)},getMac:function(){var f=b.digest().bytes();return b.start(),b.update(d),b.update(f),b.digest()}};return c.digest=c.getMac,c}},730:(Y,K,R)=>{var l,y=R(8659);function m(z,Q,J){this.data=[],null!=z&&("number"==typeof z?this.fromNumber(z,Q,J):this.fromString(z,null==Q&&"string"!=typeof z?256:Q))}function d(){return new m(null)}function p(z,Q,J,ue,Re,Oe){for(var We=16383&Q,Ke=Q>>14;--Oe>=0;){var Qt=16383&this.data[z],lr=this.data[z++]>>14,ai=Ke*Qt+lr*We;Re=((Qt=We*Qt+((16383&ai)<<14)+J.data[ue]+Re)>>28)+(ai>>14)+Ke*lr,J.data[ue++]=268435455&Qt}return Re}Y.exports=y.jsbn=y.jsbn||{},y.jsbn.BigInteger=m,typeof navigator>"u"?(m.prototype.am=p,l=28):"Microsoft Internet Explorer"==navigator.appName?(m.prototype.am=function f(z,Q,J,ue,Re,Oe){for(var We=32767&Q,Ke=Q>>15;--Oe>=0;){var Qt=32767&this.data[z],lr=this.data[z++]>>15,ai=Ke*Qt+lr*We;Re=((Qt=We*Qt+((32767&ai)<<15)+J.data[ue]+(1073741823&Re))>>>30)+(ai>>>15)+Ke*lr+(Re>>>30),J.data[ue++]=1073741823&Qt}return Re},l=30):"Netscape"!=navigator.appName?(m.prototype.am=function c(z,Q,J,ue,Re,Oe){for(;--Oe>=0;){var We=Q*this.data[z++]+J.data[ue]+Re;Re=Math.floor(We/67108864),J.data[ue++]=67108863&We}return Re},l=26):(m.prototype.am=p,l=28),m.prototype.DB=l,m.prototype.DM=(1<<l)-1,m.prototype.DV=1<<l,m.prototype.FV=Math.pow(2,52),m.prototype.F1=52-l,m.prototype.F2=2*l-52;var v,h,E=new Array;for(v="0".charCodeAt(0),h=0;h<=9;++h)E[v++]=h;for(v="a".charCodeAt(0),h=10;h<36;++h)E[v++]=h;for(v="A".charCodeAt(0),h=10;h<36;++h)E[v++]=h;function C(z){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(z)}function A(z,Q){return E[z.charCodeAt(Q)]??-1}function D(z){var Q=d();return Q.fromInt(z),Q}function V(z){var J,Q=1;return 0!=(J=z>>>16)&&(z=J,Q+=16),0!=(J=z>>8)&&(z=J,Q+=8),0!=(J=z>>4)&&(z=J,Q+=4),0!=(J=z>>2)&&(z=J,Q+=2),0!=(J=z>>1)&&(z=J,Q+=1),Q}function he(z){this.m=z}function nt(z){this.m=z,this.mp=z.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<z.DB-15)-1,this.mt2=2*z.t}function Fe(z,Q){return z&Q}function pe(z,Q){return z|Q}function Le(z,Q){return z^Q}function at(z,Q){return z&~Q}function Ht(z){if(0==z)return-1;var Q=0;return 0==(65535&z)&&(z>>=16,Q+=16),0==(255&z)&&(z>>=8,Q+=8),0==(15&z)&&(z>>=4,Q+=4),0==(3&z)&&(z>>=2,Q+=2),0==(1&z)&&++Q,Q}function sn(z){for(var Q=0;0!=z;)z&=z-1,++Q;return Q}function me(){}function ft(z){return z}function $e(z){this.r2=d(),this.q3=d(),m.ONE.dlShiftTo(2*z.t,this.r2),this.mu=this.r2.divide(z),this.m=z}he.prototype.convert=function Pe(z){return z.s<0||z.compareTo(this.m)>=0?z.mod(this.m):z},he.prototype.revert=function Se(z){return z},he.prototype.reduce=function Be(z){z.divRemTo(this.m,null,z)},he.prototype.mulTo=function ve(z,Q,J){z.multiplyTo(Q,J),this.reduce(J)},he.prototype.sqrTo=function He(z,Q){z.squareTo(Q),this.reduce(Q)},nt.prototype.convert=function Rt(z){var Q=d();return z.abs().dlShiftTo(this.m.t,Q),Q.divRemTo(this.m,null,Q),z.s<0&&Q.compareTo(m.ZERO)>0&&this.m.subTo(Q,Q),Q},nt.prototype.revert=function wt(z){var Q=d();return z.copyTo(Q),this.reduce(Q),Q},nt.prototype.reduce=function Ft(z){for(;z.t<=this.mt2;)z.data[z.t++]=0;for(var Q=0;Q<this.m.t;++Q){var J=32767&z.data[Q],ue=J*this.mpl+((J*this.mph+(z.data[Q]>>15)*this.mpl&this.um)<<15)&z.DM;for(z.data[J=Q+this.m.t]+=this.m.am(0,ue,z,Q,0,this.m.t);z.data[J]>=z.DV;)z.data[J]-=z.DV,z.data[++J]++}z.clamp(),z.drShiftTo(this.m.t,z),z.compareTo(this.m)>=0&&z.subTo(this.m,z)},nt.prototype.mulTo=function Jt(z,Q,J){z.multiplyTo(Q,J),this.reduce(J)},nt.prototype.sqrTo=function qt(z,Q){z.squareTo(Q),this.reduce(Q)},m.prototype.copyTo=function N(z){for(var Q=this.t-1;Q>=0;--Q)z.data[Q]=this.data[Q];z.t=this.t,z.s=this.s},m.prototype.fromInt=function S(z){this.t=1,this.s=z<0?-1:0,z>0?this.data[0]=z:z<-1?this.data[0]=z+this.DV:this.t=0},m.prototype.fromString=function M(z,Q){var J;if(16==Q)J=4;else if(8==Q)J=3;else if(256==Q)J=8;else if(2==Q)J=1;else if(32==Q)J=5;else{if(4!=Q)return void this.fromRadix(z,Q);J=2}this.t=0,this.s=0;for(var ue=z.length,Re=!1,Oe=0;--ue>=0;){var We=8==J?255&z[ue]:A(z,ue);We<0?"-"==z.charAt(ue)&&(Re=!0):(Re=!1,0==Oe?this.data[this.t++]=We:Oe+J>this.DB?(this.data[this.t-1]|=(We&(1<<this.DB-Oe)-1)<<Oe,this.data[this.t++]=We>>this.DB-Oe):this.data[this.t-1]|=We<<Oe,(Oe+=J)>=this.DB&&(Oe-=this.DB))}8==J&&0!=(128&z[0])&&(this.s=-1,Oe>0&&(this.data[this.t-1]|=(1<<this.DB-Oe)-1<<Oe)),this.clamp(),Re&&m.ZERO.subTo(this,this)},m.prototype.clamp=function k(){for(var z=this.s&this.DM;this.t>0&&this.data[this.t-1]==z;)--this.t},m.prototype.dlShiftTo=function H(z,Q){var J;for(J=this.t-1;J>=0;--J)Q.data[J+z]=this.data[J];for(J=z-1;J>=0;--J)Q.data[J]=0;Q.t=this.t+z,Q.s=this.s},m.prototype.drShiftTo=function ne(z,Q){for(var J=z;J<this.t;++J)Q.data[J-z]=this.data[J];Q.t=Math.max(this.t-z,0),Q.s=this.s},m.prototype.lShiftTo=function j(z,Q){var Ke,J=z%this.DB,ue=this.DB-J,Re=(1<<ue)-1,Oe=Math.floor(z/this.DB),We=this.s<<J&this.DM;for(Ke=this.t-1;Ke>=0;--Ke)Q.data[Ke+Oe+1]=this.data[Ke]>>ue|We,We=(this.data[Ke]&Re)<<J;for(Ke=Oe-1;Ke>=0;--Ke)Q.data[Ke]=0;Q.data[Oe]=We,Q.t=this.t+Oe+1,Q.s=this.s,Q.clamp()},m.prototype.rShiftTo=function ee(z,Q){Q.s=this.s;var J=Math.floor(z/this.DB);if(J>=this.t)Q.t=0;else{var ue=z%this.DB,Re=this.DB-ue,Oe=(1<<ue)-1;Q.data[0]=this.data[J]>>ue;for(var We=J+1;We<this.t;++We)Q.data[We-J-1]|=(this.data[We]&Oe)<<Re,Q.data[We-J]=this.data[We]>>ue;ue>0&&(Q.data[this.t-J-1]|=(this.s&Oe)<<Re),Q.t=this.t-J,Q.clamp()}},m.prototype.subTo=function Z(z,Q){for(var J=0,ue=0,Re=Math.min(z.t,this.t);J<Re;)ue+=this.data[J]-z.data[J],Q.data[J++]=ue&this.DM,ue>>=this.DB;if(z.t<this.t){for(ue-=z.s;J<this.t;)ue+=this.data[J],Q.data[J++]=ue&this.DM,ue>>=this.DB;ue+=this.s}else{for(ue+=this.s;J<z.t;)ue-=z.data[J],Q.data[J++]=ue&this.DM,ue>>=this.DB;ue-=z.s}Q.s=ue<0?-1:0,ue<-1?Q.data[J++]=this.DV+ue:ue>0&&(Q.data[J++]=ue),Q.t=J,Q.clamp()},m.prototype.multiplyTo=function q(z,Q){var J=this.abs(),ue=z.abs(),Re=J.t;for(Q.t=Re+ue.t;--Re>=0;)Q.data[Re]=0;for(Re=0;Re<ue.t;++Re)Q.data[Re+J.t]=J.am(0,ue.data[Re],Q,Re,0,J.t);Q.s=0,Q.clamp(),this.s!=z.s&&m.ZERO.subTo(Q,Q)},m.prototype.squareTo=function te(z){for(var Q=this.abs(),J=z.t=2*Q.t;--J>=0;)z.data[J]=0;for(J=0;J<Q.t-1;++J){var ue=Q.am(J,Q.data[J],z,2*J,0,1);(z.data[J+Q.t]+=Q.am(J+1,2*Q.data[J],z,2*J+1,ue,Q.t-J-1))>=Q.DV&&(z.data[J+Q.t]-=Q.DV,z.data[J+Q.t+1]=1)}z.t>0&&(z.data[z.t-1]+=Q.am(J,Q.data[J],z,2*J,0,1)),z.s=0,z.clamp()},m.prototype.divRemTo=function oe(z,Q,J){var ue=z.abs();if(!(ue.t<=0)){var Re=this.abs();if(Re.t<ue.t)return Q?.fromInt(0),void(null!=J&&this.copyTo(J));null==J&&(J=d());var Oe=d(),We=this.s,Ke=z.s,Qt=this.DB-V(ue.data[ue.t-1]);Qt>0?(ue.lShiftTo(Qt,Oe),Re.lShiftTo(Qt,J)):(ue.copyTo(Oe),Re.copyTo(J));var lr=Oe.t,ai=Oe.data[lr-1];if(0!=ai){var Qr=ai*(1<<this.F1)+(lr>1?Oe.data[lr-2]>>this.F2:0),is=this.FV/Qr,So=(1<<this.F1)/Qr,Kt=1<<this.F2,Yr=J.t,cn=Yr-lr,ki=Q??d();for(Oe.dlShiftTo(cn,ki),J.compareTo(ki)>=0&&(J.data[J.t++]=1,J.subTo(ki,J)),m.ONE.dlShiftTo(lr,ki),ki.subTo(Oe,Oe);Oe.t<lr;)Oe.data[Oe.t++]=0;for(;--cn>=0;){var wu=J.data[--Yr]==ai?this.DM:Math.floor(J.data[Yr]*is+(J.data[Yr-1]+Kt)*So);if((J.data[Yr]+=Oe.am(0,wu,J,cn,0,lr))<wu)for(Oe.dlShiftTo(cn,ki),J.subTo(ki,J);J.data[Yr]<--wu;)J.subTo(ki,J)}null!=Q&&(J.drShiftTo(lr,Q),We!=Ke&&m.ZERO.subTo(Q,Q)),J.t=lr,J.clamp(),Qt>0&&J.rShiftTo(Qt,J),We<0&&m.ZERO.subTo(J,J)}}},m.prototype.invDigit=function ke(){if(this.t<1)return 0;var z=this.data[0];if(0==(1&z))return 0;var Q=3&z;return(Q=(Q=(Q=(Q=Q*(2-(15&z)*Q)&15)*(2-(255&z)*Q)&255)*(2-((65535&z)*Q&65535))&65535)*(2-z*Q%this.DV)%this.DV)>0?this.DV-Q:-Q},m.prototype.isEven=function rn(){return 0==(this.t>0?1&this.data[0]:this.s)},m.prototype.exp=function Vn(z,Q){if(z>4294967295||z<1)return m.ONE;var J=d(),ue=d(),Re=Q.convert(this),Oe=V(z)-1;for(Re.copyTo(J);--Oe>=0;)if(Q.sqrTo(J,ue),(z&1<<Oe)>0)Q.mulTo(ue,Re,J);else{var We=J;J=ue,ue=We}return Q.revert(J)},m.prototype.toString=function F(z){if(this.s<0)return"-"+this.negate().toString(z);var Q;if(16==z)Q=4;else if(8==z)Q=3;else if(2==z)Q=1;else if(32==z)Q=5;else{if(4!=z)return this.toRadix(z);Q=2}var ue,J=(1<<Q)-1,Re=!1,Oe="",We=this.t,Ke=this.DB-We*this.DB%Q;if(We-- >0)for(Ke<this.DB&&(ue=this.data[We]>>Ke)>0&&(Re=!0,Oe=C(ue));We>=0;)Ke<Q?(ue=(this.data[We]&(1<<Ke)-1)<<Q-Ke,ue|=this.data[--We]>>(Ke+=this.DB-Q)):(ue=this.data[We]>>(Ke-=Q)&J,Ke<=0&&(Ke+=this.DB,--We)),ue>0&&(Re=!0),Re&&(Oe+=C(ue));return Re?Oe:"0"},m.prototype.negate=function G(){var z=d();return m.ZERO.subTo(this,z),z},m.prototype.abs=function T(){return this.s<0?this.negate():this},m.prototype.compareTo=function O(z){var Q=this.s-z.s;if(0!=Q)return Q;var J=this.t;if(0!=(Q=J-z.t))return this.s<0?-Q:Q;for(;--J>=0;)if(0!=(Q=this.data[J]-z.data[J]))return Q;return 0},m.prototype.bitLength=function L(){return this.t<=0?0:this.DB*(this.t-1)+V(this.data[this.t-1]^this.s&this.DM)},m.prototype.mod=function de(z){var Q=d();return this.abs().divRemTo(z,null,Q),this.s<0&&Q.compareTo(m.ZERO)>0&&z.subTo(Q,Q),Q},m.prototype.modPowInt=function Rr(z,Q){var J;return J=z<256||Q.isEven()?new he(Q):new nt(Q),this.exp(z,J)},m.ZERO=D(0),m.ONE=D(1),me.prototype.convert=ft,me.prototype.revert=ft,me.prototype.mulTo=function St(z,Q,J){z.multiplyTo(Q,J)},me.prototype.sqrTo=function Tn(z,Q){z.squareTo(Q)},$e.prototype.convert=function ct(z){if(z.s<0||z.t>2*this.m.t)return z.mod(this.m);if(z.compareTo(this.m)<0)return z;var Q=d();return z.copyTo(Q),this.reduce(Q),Q},$e.prototype.revert=function pt(z){return z},$e.prototype.reduce=function it(z){for(z.drShiftTo(this.m.t-1,this.r2),z.t>this.m.t+1&&(z.t=this.m.t+1,z.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);z.compareTo(this.r2)<0;)z.dAddOffset(1,this.m.t+1);for(z.subTo(this.r2,z);z.compareTo(this.m)>=0;)z.subTo(this.m,z)},$e.prototype.mulTo=function Nt(z,Q,J){z.multiplyTo(Q,J),this.reduce(J)},$e.prototype.sqrTo=function gt(z,Q){z.squareTo(Q),this.reduce(Q)};var Gn=[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],ia=(1<<26)/Gn[Gn.length-1];m.prototype.chunkSize=function ie(z){return Math.floor(Math.LN2*this.DB/Math.log(z))},m.prototype.toRadix=function ge(z){if(null==z&&(z=10),0==this.signum()||z<2||z>36)return"0";var Q=this.chunkSize(z),J=Math.pow(z,Q),ue=D(J),Re=d(),Oe=d(),We="";for(this.divRemTo(ue,Re,Oe);Re.signum()>0;)We=(J+Oe.intValue()).toString(z).substr(1)+We,Re.divRemTo(ue,Re,Oe);return Oe.intValue().toString(z)+We},m.prototype.fromRadix=function ye(z,Q){this.fromInt(0),null==Q&&(Q=10);for(var J=this.chunkSize(Q),ue=Math.pow(Q,J),Re=!1,Oe=0,We=0,Ke=0;Ke<z.length;++Ke){var Qt=A(z,Ke);Qt<0?"-"==z.charAt(Ke)&&0==this.signum()&&(Re=!0):(We=Q*We+Qt,++Oe>=J&&(this.dMultiply(ue),this.dAddOffset(We,0),Oe=0,We=0))}Oe>0&&(this.dMultiply(Math.pow(Q,Oe)),this.dAddOffset(We,0)),Re&&m.ZERO.subTo(this,this)},m.prototype.fromNumber=function be(z,Q,J){if("number"==typeof Q)if(z<2)this.fromInt(1);else for(this.fromNumber(z,J),this.testBit(z-1)||this.bitwiseTo(m.ONE.shiftLeft(z-1),pe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(Q);)this.dAddOffset(2,0),this.bitLength()>z&&this.subTo(m.ONE.shiftLeft(z-1),this);else{var ue=new Array,Re=7&z;ue.length=1+(z>>3),Q.nextBytes(ue),Re>0?ue[0]&=(1<<Re)-1:ue[0]=0,this.fromString(ue,256)}},m.prototype.bitwiseTo=function Je(z,Q,J){var ue,Re,Oe=Math.min(z.t,this.t);for(ue=0;ue<Oe;++ue)J.data[ue]=Q(this.data[ue],z.data[ue]);if(z.t<this.t){for(Re=z.s&this.DM,ue=Oe;ue<this.t;++ue)J.data[ue]=Q(this.data[ue],Re);J.t=this.t}else{for(Re=this.s&this.DM,ue=Oe;ue<z.t;++ue)J.data[ue]=Q(Re,z.data[ue]);J.t=z.t}J.s=Q(this.s,z.s),J.clamp()},m.prototype.changeBit=function tt(z,Q){var J=m.ONE.shiftLeft(z);return this.bitwiseTo(J,Q,J),J},m.prototype.addTo=function Ei(z,Q){for(var J=0,ue=0,Re=Math.min(z.t,this.t);J<Re;)ue+=this.data[J]+z.data[J],Q.data[J++]=ue&this.DM,ue>>=this.DB;if(z.t<this.t){for(ue+=z.s;J<this.t;)ue+=this.data[J],Q.data[J++]=ue&this.DM,ue>>=this.DB;ue+=this.s}else{for(ue+=this.s;J<z.t;)ue+=z.data[J],Q.data[J++]=ue&this.DM,ue>>=this.DB;ue+=z.s}Q.s=ue<0?-1:0,ue>0?Q.data[J++]=ue:ue<-1&&(Q.data[J++]=this.DV+ue),Q.t=J,Q.clamp()},m.prototype.dMultiply=function rt(z){this.data[this.t]=this.am(0,z-1,this,0,0,this.t),++this.t,this.clamp()},m.prototype.dAddOffset=function ce(z,Q){if(0!=z){for(;this.t<=Q;)this.data[this.t++]=0;for(this.data[Q]+=z;this.data[Q]>=this.DV;)this.data[Q]-=this.DV,++Q>=this.t&&(this.data[this.t++]=0),++this.data[Q]}},m.prototype.multiplyLowerTo=function je(z,Q,J){var Re,ue=Math.min(this.t+z.t,Q);for(J.s=0,J.t=ue;ue>0;)J.data[--ue]=0;for(Re=J.t-this.t;ue<Re;++ue)J.data[ue+this.t]=this.am(0,z.data[ue],J,ue,0,this.t);for(Re=Math.min(z.t,Q);ue<Re;++ue)this.am(0,z.data[ue],J,ue,0,Q-ue);J.clamp()},m.prototype.multiplyUpperTo=function Te(z,Q,J){--Q;var ue=J.t=this.t+z.t-Q;for(J.s=0;--ue>=0;)J.data[ue]=0;for(ue=Math.max(Q-this.t,0);ue<z.t;++ue)J.data[this.t+ue-Q]=this.am(Q-ue,z.data[ue],J,0,0,this.t+ue-Q);J.clamp(),J.drShiftTo(1,J)},m.prototype.modInt=function fn(z){if(z<=0)return 0;var Q=this.DV%z,J=this.s<0?z-1:0;if(this.t>0)if(0==Q)J=this.data[0]%z;else for(var ue=this.t-1;ue>=0;--ue)J=(Q*J+this.data[ue])%z;return J},m.prototype.millerRabin=function mf(z){var Q=this.subtract(m.ONE),J=Q.getLowestSetBit();if(J<=0)return!1;for(var Oe,ue=Q.shiftRight(J),Re=function sa(){return{nextBytes:function(z){for(var Q=0;Q<z.length;++Q)z[Q]=Math.floor(256*Math.random())}}}(),We=0;We<z;++We){do{Oe=new m(this.bitLength(),Re)}while(Oe.compareTo(m.ONE)<=0||Oe.compareTo(Q)>=0);var Ke=Oe.modPow(ue,this);if(0!=Ke.compareTo(m.ONE)&&0!=Ke.compareTo(Q)){for(var Qt=1;Qt++<J&&0!=Ke.compareTo(Q);)if(0==(Ke=Ke.modPowInt(2,this)).compareTo(m.ONE))return!1;if(0!=Ke.compareTo(Q))return!1}}return!0},m.prototype.clone=function En(){var z=d();return this.copyTo(z),z},m.prototype.intValue=function Oi(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},m.prototype.byteValue=function qr(){return 0==this.t?this.s:this.data[0]<<24>>24},m.prototype.shortValue=function ns(){return 0==this.t?this.s:this.data[0]<<16>>16},m.prototype.signum=function le(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},m.prototype.toByteArray=function Ae(){var z=this.t,Q=new Array;Q[0]=this.s;var ue,J=this.DB-z*this.DB%8,Re=0;if(z-- >0)for(J<this.DB&&(ue=this.data[z]>>J)!=(this.s&this.DM)>>J&&(Q[Re++]=ue|this.s<<this.DB-J);z>=0;)J<8?(ue=(this.data[z]&(1<<J)-1)<<8-J,ue|=this.data[--z]>>(J+=this.DB-8)):(ue=this.data[z]>>(J-=8)&255,J<=0&&(J+=this.DB,--z)),0!=(128&ue)&&(ue|=-256),0==Re&&(128&this.s)!=(128&ue)&&++Re,(Re>0||ue!=this.s)&&(Q[Re++]=ue);return Q},m.prototype.equals=function ze(z){return 0==this.compareTo(z)},m.prototype.min=function Ge(z){return this.compareTo(z)<0?this:z},m.prototype.max=function et(z){return this.compareTo(z)>0?this:z},m.prototype.and=function Ee(z){var Q=d();return this.bitwiseTo(z,Fe,Q),Q},m.prototype.or=function we(z){var Q=d();return this.bitwiseTo(z,pe,Q),Q},m.prototype.xor=function Me(z){var Q=d();return this.bitwiseTo(z,Le,Q),Q},m.prototype.andNot=function Pt(z){var Q=d();return this.bitwiseTo(z,at,Q),Q},m.prototype.not=function dt(){for(var z=d(),Q=0;Q<this.t;++Q)z.data[Q]=this.DM&~this.data[Q];return z.t=this.t,z.s=~this.s,z},m.prototype.shiftLeft=function Qe(z){var Q=d();return z<0?this.rShiftTo(-z,Q):this.lShiftTo(z,Q),Q},m.prototype.shiftRight=function Hn(z){var Q=d();return z<0?this.lShiftTo(-z,Q):this.rShiftTo(z,Q),Q},m.prototype.getLowestSetBit=function In(){for(var z=0;z<this.t;++z)if(0!=this.data[z])return z*this.DB+Ht(this.data[z]);return this.s<0?this.t*this.DB:-1},m.prototype.bitCount=function ot(){for(var z=0,Q=this.s&this.DM,J=0;J<this.t;++J)z+=sn(this.data[J]^Q);return z},m.prototype.testBit=function _n(z){var Q=Math.floor(z/this.DB);return Q>=this.t?0!=this.s:0!=(this.data[Q]&1<<z%this.DB)},m.prototype.setBit=function jt(z){return this.changeBit(z,pe)},m.prototype.clearBit=function _t(z){return this.changeBit(z,at)},m.prototype.flipBit=function Pr(z){return this.changeBit(z,Le)},m.prototype.add=function Wn(z){var Q=d();return this.addTo(z,Q),Q},m.prototype.subtract=function Rn(z){var Q=d();return this.subTo(z,Q),Q},m.prototype.multiply=function Fr(z){var Q=d();return this.multiplyTo(z,Q),Q},m.prototype.divide=function Sr(z){var Q=d();return this.divRemTo(z,Q,null),Q},m.prototype.remainder=function Pn(z){var Q=d();return this.divRemTo(z,null,Q),Q},m.prototype.divideAndRemainder=function $t(z){var Q=d(),J=d();return this.divRemTo(z,Q,J),new Array(Q,J)},m.prototype.modPow=function Ct(z,Q){var ue,Oe,J=z.bitLength(),Re=D(1);if(J<=0)return Re;ue=J<18?1:J<48?3:J<144?4:J<768?5:6,Oe=J<8?new he(Q):Q.isEven()?new $e(Q):new nt(Q);var We=new Array,Ke=3,Qt=ue-1,lr=(1<<ue)-1;if(We[1]=Oe.convert(this),ue>1){var ai=d();for(Oe.sqrTo(We[1],ai);Ke<=lr;)We[Ke]=d(),Oe.mulTo(ai,We[Ke-2],We[Ke]),Ke+=2}var is,Yr,Qr=z.t-1,So=!0,Kt=d();for(J=V(z.data[Qr])-1;Qr>=0;){for(J>=Qt?is=z.data[Qr]>>J-Qt&lr:(is=(z.data[Qr]&(1<<J+1)-1)<<Qt-J,Qr>0&&(is|=z.data[Qr-1]>>this.DB+J-Qt)),Ke=ue;0==(1&is);)is>>=1,--Ke;if((J-=Ke)<0&&(J+=this.DB,--Qr),So)We[is].copyTo(Re),So=!1;else{for(;Ke>1;)Oe.sqrTo(Re,Kt),Oe.sqrTo(Kt,Re),Ke-=2;Ke>0?Oe.sqrTo(Re,Kt):(Yr=Re,Re=Kt,Kt=Yr),Oe.mulTo(Kt,We[is],Re)}for(;Qr>=0&&0==(z.data[Qr]&1<<J);)Oe.sqrTo(Re,Kt),Yr=Re,Re=Kt,Kt=Yr,--J<0&&(J=this.DB-1,--Qr)}return Oe.revert(Re)},m.prototype.modInverse=function rs(z){var Q=z.isEven();if(this.isEven()&&Q||0==z.signum())return m.ZERO;for(var J=z.clone(),ue=this.clone(),Re=D(1),Oe=D(0),We=D(0),Ke=D(1);0!=J.signum();){for(;J.isEven();)J.rShiftTo(1,J),Q?((!Re.isEven()||!Oe.isEven())&&(Re.addTo(this,Re),Oe.subTo(z,Oe)),Re.rShiftTo(1,Re)):Oe.isEven()||Oe.subTo(z,Oe),Oe.rShiftTo(1,Oe);for(;ue.isEven();)ue.rShiftTo(1,ue),Q?((!We.isEven()||!Ke.isEven())&&(We.addTo(this,We),Ke.subTo(z,Ke)),We.rShiftTo(1,We)):Ke.isEven()||Ke.subTo(z,Ke),Ke.rShiftTo(1,Ke);J.compareTo(ue)>=0?(J.subTo(ue,J),Q&&Re.subTo(We,Re),Oe.subTo(Ke,Oe)):(ue.subTo(J,ue),Q&&We.subTo(Re,We),Ke.subTo(Oe,Ke))}return 0!=ue.compareTo(m.ONE)?m.ZERO:Ke.compareTo(z)>=0?Ke.subtract(z):Ke.signum()<0?(Ke.addTo(z,Ke),Ke.signum()<0?Ke.add(z):Ke):Ke},m.prototype.pow=function Ve(z){return this.exp(z,new me)},m.prototype.gcd=function gn(z){var Q=this.s<0?this.negate():this.clone(),J=z.s<0?z.negate():z.clone();if(Q.compareTo(J)<0){var ue=Q;Q=J,J=ue}var Re=Q.getLowestSetBit(),Oe=J.getLowestSetBit();if(Oe<0)return Q;for(Re<Oe&&(Oe=Re),Oe>0&&(Q.rShiftTo(Oe,Q),J.rShiftTo(Oe,J));Q.signum()>0;)(Re=Q.getLowestSetBit())>0&&Q.rShiftTo(Re,Q),(Re=J.getLowestSetBit())>0&&J.rShiftTo(Re,J),Q.compareTo(J)>=0?(Q.subTo(J,Q),Q.rShiftTo(1,Q)):(J.subTo(Q,J),J.rShiftTo(1,J));return Oe>0&&J.lShiftTo(Oe,J),J},m.prototype.isProbablePrime=function wo(z){var Q,J=this.abs();if(1==J.t&&J.data[0]<=Gn[Gn.length-1]){for(Q=0;Q<Gn.length;++Q)if(J.data[0]==Gn[Q])return!0;return!1}if(J.isEven())return!1;for(Q=1;Q<Gn.length;){for(var ue=Gn[Q],Re=Q+1;Re<Gn.length&&ue<ia;)ue*=Gn[Re++];for(ue=J.modInt(ue);Q<Re;)if(ue%Gn[Q++]==0)return!1}return J.millerRabin(z)}},979:(Y,K,R)=>{var y=R(8659);Y.exports=y.md=y.md||{},y.md.algorithms=y.md.algorithms||{}},9386:(Y,K,R)=>{var y=R(8659);R(8449),Y.exports=y.mgf=y.mgf||{},y.mgf.mgf1=y.mgf1},8449:(Y,K,R)=>{var y=R(8659);R(4747),y.mgf=y.mgf||{},(Y.exports=y.mgf.mgf1=y.mgf1=y.mgf1||{}).create=function(g){return{generate:function(m,d){for(var c=new y.util.ByteBuffer,f=Math.ceil(d/g.digestLength),p=0;p<f;p++){var w=new y.util.ByteBuffer;w.putInt32(p),g.start(),g.update(m+w.getBytes()),c.putBuffer(g.digest())}return c.truncate(c.length()-d),c.getBytes()}}}},6078:(Y,K,R)=>{var y=R(8659);y.pki=y.pki||{};var l=Y.exports=y.pki.oids=y.oids=y.oids||{};function g(m,d){l[m]=d,l[d]=m}function b(m,d){l[m]=d}g("1.2.840.113549.1.1.1","rsaEncryption"),g("1.2.840.113549.1.1.4","md5WithRSAEncryption"),g("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),g("1.2.840.113549.1.1.7","RSAES-OAEP"),g("1.2.840.113549.1.1.8","mgf1"),g("1.2.840.113549.1.1.9","pSpecified"),g("1.2.840.113549.1.1.10","RSASSA-PSS"),g("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),g("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),g("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),g("1.3.101.112","EdDSA25519"),g("1.2.840.10040.4.3","dsa-with-sha1"),g("1.3.14.3.2.7","desCBC"),g("1.3.14.3.2.26","sha1"),g("1.3.14.3.2.29","sha1WithRSASignature"),g("2.16.840.1.101.3.4.2.1","sha256"),g("2.16.840.1.101.3.4.2.2","sha384"),g("2.16.840.1.101.3.4.2.3","sha512"),g("2.16.840.1.101.3.4.2.4","sha224"),g("2.16.840.1.101.3.4.2.5","sha512-224"),g("2.16.840.1.101.3.4.2.6","sha512-256"),g("1.2.840.113549.2.2","md2"),g("1.2.840.113549.2.5","md5"),g("1.2.840.113549.1.7.1","data"),g("1.2.840.113549.1.7.2","signedData"),g("1.2.840.113549.1.7.3","envelopedData"),g("1.2.840.113549.1.7.4","signedAndEnvelopedData"),g("1.2.840.113549.1.7.5","digestedData"),g("1.2.840.113549.1.7.6","encryptedData"),g("1.2.840.113549.1.9.1","emailAddress"),g("1.2.840.113549.1.9.2","unstructuredName"),g("1.2.840.113549.1.9.3","contentType"),g("1.2.840.113549.1.9.4","messageDigest"),g("1.2.840.113549.1.9.5","signingTime"),g("1.2.840.113549.1.9.6","counterSignature"),g("1.2.840.113549.1.9.7","challengePassword"),g("1.2.840.113549.1.9.8","unstructuredAddress"),g("1.2.840.113549.1.9.14","extensionRequest"),g("1.2.840.113549.1.9.20","friendlyName"),g("1.2.840.113549.1.9.21","localKeyId"),g("1.2.840.113549.1.9.22.1","x509Certificate"),g("1.2.840.113549.1.12.10.1.1","keyBag"),g("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),g("1.2.840.113549.1.12.10.1.3","certBag"),g("1.2.840.113549.1.12.10.1.4","crlBag"),g("1.2.840.113549.1.12.10.1.5","secretBag"),g("1.2.840.113549.1.12.10.1.6","safeContentsBag"),g("1.2.840.113549.1.5.13","pkcs5PBES2"),g("1.2.840.113549.1.5.12","pkcs5PBKDF2"),g("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),g("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),g("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),g("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),g("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),g("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),g("1.2.840.113549.2.7","hmacWithSHA1"),g("1.2.840.113549.2.8","hmacWithSHA224"),g("1.2.840.113549.2.9","hmacWithSHA256"),g("1.2.840.113549.2.10","hmacWithSHA384"),g("1.2.840.113549.2.11","hmacWithSHA512"),g("1.2.840.113549.3.7","des-EDE3-CBC"),g("2.16.840.1.101.3.4.1.2","aes128-CBC"),g("2.16.840.1.101.3.4.1.22","aes192-CBC"),g("2.16.840.1.101.3.4.1.42","aes256-CBC"),g("2.5.4.3","commonName"),g("2.5.4.4","surname"),g("2.5.4.5","serialNumber"),g("2.5.4.6","countryName"),g("2.5.4.7","localityName"),g("2.5.4.8","stateOrProvinceName"),g("2.5.4.9","streetAddress"),g("2.5.4.10","organizationName"),g("2.5.4.11","organizationalUnitName"),g("2.5.4.12","title"),g("2.5.4.13","description"),g("2.5.4.15","businessCategory"),g("2.5.4.17","postalCode"),g("2.5.4.42","givenName"),g("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),g("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),g("2.16.840.1.113730.1.1","nsCertType"),g("2.16.840.1.113730.1.13","nsComment"),b("2.5.29.1","authorityKeyIdentifier"),b("2.5.29.2","keyAttributes"),b("2.5.29.3","certificatePolicies"),b("2.5.29.4","keyUsageRestriction"),b("2.5.29.5","policyMapping"),b("2.5.29.6","subtreesConstraint"),b("2.5.29.7","subjectAltName"),b("2.5.29.8","issuerAltName"),b("2.5.29.9","subjectDirectoryAttributes"),b("2.5.29.10","basicConstraints"),b("2.5.29.11","nameConstraints"),b("2.5.29.12","policyConstraints"),b("2.5.29.13","basicConstraints"),g("2.5.29.14","subjectKeyIdentifier"),g("2.5.29.15","keyUsage"),b("2.5.29.16","privateKeyUsagePeriod"),g("2.5.29.17","subjectAltName"),g("2.5.29.18","issuerAltName"),g("2.5.29.19","basicConstraints"),b("2.5.29.20","cRLNumber"),b("2.5.29.21","cRLReason"),b("2.5.29.22","expirationDate"),b("2.5.29.23","instructionCode"),b("2.5.29.24","invalidityDate"),b("2.5.29.25","cRLDistributionPoints"),b("2.5.29.26","issuingDistributionPoint"),b("2.5.29.27","deltaCRLIndicator"),b("2.5.29.28","issuingDistributionPoint"),b("2.5.29.29","certificateIssuer"),b("2.5.29.30","nameConstraints"),g("2.5.29.31","cRLDistributionPoints"),g("2.5.29.32","certificatePolicies"),b("2.5.29.33","policyMappings"),b("2.5.29.34","policyConstraints"),g("2.5.29.35","authorityKeyIdentifier"),b("2.5.29.36","policyConstraints"),g("2.5.29.37","extKeyUsage"),b("2.5.29.46","freshestCRL"),b("2.5.29.54","inhibitAnyPolicy"),g("1.3.6.1.4.1.11129.2.4.2","timestampList"),g("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),g("1.3.6.1.5.5.7.3.1","serverAuth"),g("1.3.6.1.5.5.7.3.2","clientAuth"),g("1.3.6.1.5.5.7.3.3","codeSigning"),g("1.3.6.1.5.5.7.3.4","emailProtection"),g("1.3.6.1.5.5.7.3.8","timeStamping")},2158:(Y,K,R)=>{var y=R(8659);if(R(1298),R(7791),R(279),R(979),R(6078),R(7949),R(8604),R(8365),R(209),R(5517),R(4747),typeof l>"u")var l=y.jsbn.BigInteger;var g=y.asn1,b=y.pki=y.pki||{};Y.exports=b.pbe=y.pbe=y.pbe||{};var m=b.oids,d={name:"EncryptedPrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},f={name:"pkcs-12PbeParams",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"iterations"}]};function p(v,h){return v.start().update(h).digest().getBytes()}function w(v){var h;if(v){if(!(h=b.oids[g.derToOid(v)])){var C=new Error("Unsupported PRF OID.");throw C.oid=v,C.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],C}}else h="hmacWithSHA1";return I(h)}function I(v){var h=y.md;switch(v){case"hmacWithSHA224":h=y.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":v=v.substr(8).toLowerCase();break;default:var C=new Error("Unsupported PRF algorithm.");throw C.algorithm=v,C.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],C}if(!h||!(v in h))throw new Error("Unknown hash algorithm: "+v);return h[v].create()}b.encryptPrivateKeyInfo=function(v,h,C){(C=C||{}).saltSize=C.saltSize||8,C.count=C.count||2048,C.algorithm=C.algorithm||"aes128",C.prfAlgorithm=C.prfAlgorithm||"sha1";var D,M,k,A=y.random.getBytesSync(C.saltSize),N=C.count,S=g.integerToDer(N);if(0===C.algorithm.indexOf("aes")||"des"===C.algorithm){var F,G,T;switch(C.algorithm){case"aes128":D=16,F=16,G=m["aes128-CBC"],T=y.aes.createEncryptionCipher;break;case"aes192":D=24,F=16,G=m["aes192-CBC"],T=y.aes.createEncryptionCipher;break;case"aes256":D=32,F=16,G=m["aes256-CBC"],T=y.aes.createEncryptionCipher;break;case"des":D=8,F=8,G=m.desCBC,T=y.des.createEncryptionCipher;break;default:throw(O=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=C.algorithm,O}var V="hmacWith"+C.prfAlgorithm.toUpperCase(),L=I(V),H=y.pkcs5.pbkdf2(h,A,N,D,L),ne=y.random.getBytesSync(F);(j=T(H)).start(ne),j.update(g.toDer(v)),j.finish(),k=j.output.getBytes();var ee=function E(v,h,C,A){var N=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,v),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,h.getBytes())]);return"hmacWithSHA1"!==A&&N.value.push(g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,y.util.hexToBytes(C.toString(16))),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.oids[A]).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])),N}(A,S,D,V);M=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(m.pkcs5PBES2).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(m.pkcs5PBKDF2).getBytes()),ee]),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(G).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,ne)])])])}else{var O;if("3des"!==C.algorithm)throw(O=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=C.algorithm,O;D=24;var j,Z=new y.util.ByteBuffer(A);H=b.pbe.generatePkcs12Key(h,Z,1,N,D),ne=b.pbe.generatePkcs12Key(h,Z,2,N,D),(j=y.des.createEncryptionCipher(H)).start(ne),j.update(g.toDer(v)),j.finish(),k=j.output.getBytes(),M=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(m["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,A),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,S.getBytes())])])}return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[M,g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,k)])},b.decryptPrivateKeyInfo=function(v,h){var C=null,A={},N=[];if(!g.validate(v,d,A,N)){var S=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw S.errors=N,S}var D=g.derToOid(A.encryptionOid),M=b.pbe.getCipher(D,A.encryptionParams,h),k=y.util.createBuffer(A.encryptedData);return M.update(k),M.finish()&&(C=g.fromDer(M.output)),C},b.encryptedPrivateKeyToPem=function(v,h){var C={type:"ENCRYPTED PRIVATE KEY",body:g.toDer(v).getBytes()};return y.pem.encode(C,{maxline:h})},b.encryptedPrivateKeyFromPem=function(v){var h=y.pem.decode(v)[0];if("ENCRYPTED PRIVATE KEY"!==h.type){var C=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw C.headerType=h.type,C}if(h.procType&&"ENCRYPTED"===h.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return g.fromDer(h.body)},b.encryptRsaPrivateKey=function(v,h,C){if(!(C=C||{}).legacy){var A=b.wrapRsaPrivateKey(b.privateKeyToAsn1(v));return A=b.encryptPrivateKeyInfo(A,h,C),b.encryptedPrivateKeyToPem(A)}var N,S,D,M;switch(C.algorithm){case"aes128":N="AES-128-CBC",D=16,S=y.random.getBytesSync(16),M=y.aes.createEncryptionCipher;break;case"aes192":N="AES-192-CBC",D=24,S=y.random.getBytesSync(16),M=y.aes.createEncryptionCipher;break;case"aes256":N="AES-256-CBC",D=32,S=y.random.getBytesSync(16),M=y.aes.createEncryptionCipher;break;case"3des":N="DES-EDE3-CBC",D=24,S=y.random.getBytesSync(8),M=y.des.createEncryptionCipher;break;case"des":N="DES-CBC",D=8,S=y.random.getBytesSync(8),M=y.des.createEncryptionCipher;break;default:var k=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+C.algorithm+'".');throw k.algorithm=C.algorithm,k}var G=M(y.pbe.opensslDeriveBytes(h,S.substr(0,8),D));G.start(S),G.update(g.toDer(b.privateKeyToAsn1(v))),G.finish();var T={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:N,parameters:y.util.bytesToHex(S).toUpperCase()},body:G.output.getBytes()};return y.pem.encode(T)},b.decryptRsaPrivateKey=function(v,h){var C=null,A=y.pem.decode(v)[0];if("ENCRYPTED PRIVATE KEY"!==A.type&&"PRIVATE KEY"!==A.type&&"RSA PRIVATE KEY"!==A.type)throw(N=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=N,N;if(A.procType&&"ENCRYPTED"===A.procType.type){var S,D;switch(A.dekInfo.algorithm){case"DES-CBC":S=8,D=y.des.createDecryptionCipher;break;case"DES-EDE3-CBC":S=24,D=y.des.createDecryptionCipher;break;case"AES-128-CBC":S=16,D=y.aes.createDecryptionCipher;break;case"AES-192-CBC":S=24,D=y.aes.createDecryptionCipher;break;case"AES-256-CBC":S=32,D=y.aes.createDecryptionCipher;break;case"RC2-40-CBC":S=5,D=function(T){return y.rc2.createDecryptionCipher(T,40)};break;case"RC2-64-CBC":S=8,D=function(T){return y.rc2.createDecryptionCipher(T,64)};break;case"RC2-128-CBC":S=16,D=function(T){return y.rc2.createDecryptionCipher(T,128)};break;default:var N;throw(N=new Error('Could not decrypt private key; unsupported encryption algorithm "'+A.dekInfo.algorithm+'".')).algorithm=A.dekInfo.algorithm,N}var M=y.util.hexToBytes(A.dekInfo.parameters),F=D(y.pbe.opensslDeriveBytes(h,M.substr(0,8),S));if(F.start(M),F.update(y.util.createBuffer(A.body)),!F.finish())return C;C=F.output.getBytes()}else C=A.body;return null!==(C="ENCRYPTED PRIVATE KEY"===A.type?b.decryptPrivateKeyInfo(g.fromDer(C),h):g.fromDer(C))&&(C=b.privateKeyFromAsn1(C)),C},b.pbe.generatePkcs12Key=function(v,h,C,A,N,S){var D,M;if(typeof S>"u"||null===S){if(!("sha1"in y.md))throw new Error('"sha1" hash algorithm unavailable.');S=y.md.sha1.create()}var k=S.digestLength,F=S.blockLength,G=new y.util.ByteBuffer,T=new y.util.ByteBuffer;if(null!=v){for(M=0;M<v.length;M++)T.putInt16(v.charCodeAt(M));T.putInt16(0)}var O=T.length(),V=h.length(),L=new y.util.ByteBuffer;L.fillWithByte(C,F);var H=F*Math.ceil(V/F),ne=new y.util.ByteBuffer;for(M=0;M<H;M++)ne.putByte(h.at(M%V));var j=F*Math.ceil(O/F),ee=new y.util.ByteBuffer;for(M=0;M<j;M++)ee.putByte(T.at(M%O));var Z=ne;Z.putBuffer(ee);for(var q=Math.ceil(N/k),te=1;te<=q;te++){var oe=new y.util.ByteBuffer;oe.putBytes(L.bytes()),oe.putBytes(Z.bytes());for(var de=0;de<A;de++)S.start(),S.update(oe.getBytes()),oe=S.digest();var he=new y.util.ByteBuffer;for(M=0;M<F;M++)he.putByte(oe.at(M%k));var Pe=Math.ceil(V/F)+Math.ceil(O/F),Se=new y.util.ByteBuffer;for(D=0;D<Pe;D++){var Be=new y.util.ByteBuffer(Z.getBytes(F)),ve=511;for(M=he.length()-1;M>=0;M--)ve>>=8,ve+=he.at(M)+Be.at(M),Be.setAt(M,255&ve);Se.putBuffer(Be)}Z=Se,G.putBuffer(oe)}return G.truncate(G.length()-N),G},b.pbe.getCipher=function(v,h,C){switch(v){case b.oids.pkcs5PBES2:return b.pbe.getCipherForPBES2(v,h,C);case b.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case b.oids["pbewithSHAAnd40BitRC2-CBC"]:return b.pbe.getCipherForPKCS12PBE(v,h,C);default:var A=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw A.oid=v,A.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],A}},b.pbe.getCipherForPBES2=function(v,h,C){var S,A={},N=[];if(!g.validate(h,c,A,N))throw(S=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=N,S;if((v=g.derToOid(A.kdfOid))!==b.oids.pkcs5PBKDF2)throw(S=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=v,S.supportedOids=["pkcs5PBKDF2"],S;if((v=g.derToOid(A.encOid))!==b.oids["aes128-CBC"]&&v!==b.oids["aes192-CBC"]&&v!==b.oids["aes256-CBC"]&&v!==b.oids["des-EDE3-CBC"]&&v!==b.oids.desCBC)throw(S=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=v,S.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],S;var k,F,D=A.kdfSalt,M=y.util.createBuffer(A.kdfIterationCount);switch(M=M.getInt(M.length()<<3),b.oids[v]){case"aes128-CBC":k=16,F=y.aes.createDecryptionCipher;break;case"aes192-CBC":k=24,F=y.aes.createDecryptionCipher;break;case"aes256-CBC":k=32,F=y.aes.createDecryptionCipher;break;case"des-EDE3-CBC":k=24,F=y.des.createDecryptionCipher;break;case"desCBC":k=8,F=y.des.createDecryptionCipher}var G=w(A.prfOid),T=y.pkcs5.pbkdf2(C,D,M,k,G),O=A.encIv,V=F(T);return V.start(O),V},b.pbe.getCipherForPKCS12PBE=function(v,h,C){var A={},N=[];if(!g.validate(h,f,A,N))throw(S=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=N,S;var k,F,G,D=y.util.createBuffer(A.salt),M=y.util.createBuffer(A.iterations);switch(M=M.getInt(M.length()<<3),v){case b.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:k=24,F=8,G=y.des.startDecrypting;break;case b.oids["pbewithSHAAnd40BitRC2-CBC"]:k=5,F=8,G=function(H,ne){var j=y.rc2.createDecryptionCipher(H,40);return j.start(ne,null),j};break;default:var S;throw(S=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=v,S}var T=w(A.prfOid),O=b.pbe.generatePkcs12Key(C,D,1,M,k,T);return T.start(),G(O,b.pbe.generatePkcs12Key(C,D,2,M,F,T))},b.pbe.opensslDeriveBytes=function(v,h,C,A){if(typeof A>"u"||null===A){if(!("md5"in y.md))throw new Error('"md5" hash algorithm unavailable.');A=y.md.md5.create()}null===h&&(h="");for(var N=[p(A,v+h)],S=16,D=1;S<C;++D,S+=16)N.push(p(A,N[D-1]+v+h));return N.join("").substr(0,C)}},7949:(Y,K,R)=>{var y=R(8659);R(9032),R(979),R(4747);var g,l=y.pkcs5=y.pkcs5||{};y.util.isNodejs&&!y.options.usePureJavaScript&&(g=R(5819)),Y.exports=y.pbkdf2=l.pbkdf2=function(b,m,d,c,f,p){if("function"==typeof f&&(p=f,f=null),y.util.isNodejs&&!y.options.usePureJavaScript&&g.pbkdf2&&(null===f||"object"!=typeof f)&&(g.pbkdf2Sync.length>4||!f||"sha1"===f))return"string"!=typeof f&&(f="sha1"),b=Buffer.from(b,"binary"),m=Buffer.from(m,"binary"),p?4===g.pbkdf2Sync.length?g.pbkdf2(b,m,d,c,function(G,T){if(G)return p(G);p(null,T.toString("binary"))}):g.pbkdf2(b,m,d,c,f,function(G,T){if(G)return p(G);p(null,T.toString("binary"))}):4===g.pbkdf2Sync.length?g.pbkdf2Sync(b,m,d,c).toString("binary"):g.pbkdf2Sync(b,m,d,c,f).toString("binary");if((typeof f>"u"||null===f)&&(f="sha1"),"string"==typeof f){if(!(f in y.md.algorithms))throw new Error("Unknown hash algorithm: "+f);f=y.md[f].create()}var w=f.digestLength;if(c>4294967295*w){var I=new Error("Derived key is too long.");if(p)return p(I);throw I}var E=Math.ceil(c/w),v=c-(E-1)*w,h=y.hmac.create();h.start(f,b);var A,N,S,C="";if(!p){for(var D=1;D<=E;++D){h.start(null,null),h.update(m),h.update(y.util.int32ToBytes(D)),A=S=h.digest().getBytes();for(var M=2;M<=d;++M)h.start(null,null),h.update(S),N=h.digest().getBytes(),A=y.util.xorBytes(A,N,w),S=N;C+=D<E?A:A.substr(0,v)}return C}function k(){if(D>E)return p(null,C);h.start(null,null),h.update(m),h.update(y.util.int32ToBytes(D)),A=S=h.digest().getBytes(),M=2,F()}function F(){if(M<=d)return h.start(null,null),h.update(S),N=h.digest().getBytes(),A=y.util.xorBytes(A,N,w),S=N,++M,y.util.setImmediate(F);C+=D<E?A:A.substr(0,v),++D,k()}D=1,k()}},8604:(Y,K,R)=>{var y=R(8659);R(4747);var l=Y.exports=y.pem=y.pem||{};function g(m){for(var d=m.name+": ",c=[],f=function(v,h){return" "+h},p=0;p<m.values.length;++p)c.push(m.values[p].replace(/^(\S+\r\n)/,f));d+=c.join(",")+"\r\n";var w=0,I=-1;for(p=0;p<d.length;++p,++w)if(w>65&&-1!==I){var E=d[I];","===E?(++I,d=d.substr(0,I)+"\r\n "+d.substr(I)):d=d.substr(0,I)+"\r\n"+E+d.substr(I+1),w=p-I-1,I=-1,++p}else(" "===d[p]||"\t"===d[p]||","===d[p])&&(I=p);return d}function b(m){return m.replace(/^\s+/,"")}l.encode=function(m,d){d=d||{};var f,c="-----BEGIN "+m.type+"-----\r\n";if(m.procType&&(c+=g(f={name:"Proc-Type",values:[String(m.procType.version),m.procType.type]})),m.contentDomain&&(c+=g(f={name:"Content-Domain",values:[m.contentDomain]})),m.dekInfo&&(f={name:"DEK-Info",values:[m.dekInfo.algorithm]},m.dekInfo.parameters&&f.values.push(m.dekInfo.parameters),c+=g(f)),m.headers)for(var p=0;p<m.headers.length;++p)c+=g(m.headers[p]);return m.procType&&(c+="\r\n"),(c+=y.util.encode64(m.body,d.maxline||64)+"\r\n")+"-----END "+m.type+"-----\r\n"},l.decode=function(m){for(var w,d=[],c=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,f=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,p=/\r?\n/;w=c.exec(m);){var I=w[1];"NEW CERTIFICATE REQUEST"===I&&(I="CERTIFICATE REQUEST");var E={type:I,procType:null,contentDomain:null,dekInfo:null,headers:[],body:y.util.decode64(w[3])};if(d.push(E),w[2]){for(var v=w[2].split(p),h=0;w&&h<v.length;){for(var C=v[h].replace(/\s+$/,""),A=h+1;A<v.length;++A){var N=v[A];if(!/\s/.test(N[0]))break;C+=N,h=A}if(w=C.match(f)){for(var S={name:w[1],values:[]},D=w[2].split(","),M=0;M<D.length;++M)S.values.push(b(D[M]));if(E.procType)if(E.contentDomain||"Content-Domain"!==S.name)if(E.dekInfo||"DEK-Info"!==S.name)E.headers.push(S);else{if(0===S.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');E.dekInfo={algorithm:D[0],parameters:D[1]||null}}else E.contentDomain=D[0]||"";else{if("Proc-Type"!==S.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==S.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');E.procType={version:D[0],type:D[1]}}}++h}if("ENCRYPTED"===E.procType&&!E.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===d.length)throw new Error("Invalid PEM formatted message.");return d}},7246:(Y,K,R)=>{var y=R(8659);R(4747),R(8365),R(7690);var l=Y.exports=y.pkcs1=y.pkcs1||{};function g(b,m,d){d||(d=y.md.sha1.create());for(var c="",f=Math.ceil(m/d.digestLength),p=0;p<f;++p){var w=String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,255&p);d.start(),d.update(b+w),c+=d.digest().getBytes()}return c.substring(0,m)}l.encode_rsa_oaep=function(b,m,d){var c,f,p,w;"string"==typeof d?(c=d,f=arguments[3]||void 0,p=arguments[4]||void 0):d&&(c=d.label||void 0,f=d.seed||void 0,p=d.md||void 0,d.mgf1&&d.mgf1.md&&(w=d.mgf1.md)),p?p.start():p=y.md.sha1.create(),w||(w=p);var I=Math.ceil(b.n.bitLength()/8),E=I-2*p.digestLength-2;if(m.length>E)throw(v=new Error("RSAES-OAEP input message length is too long.")).length=m.length,v.maxLength=E,v;c||(c=""),p.update(c,"raw");for(var h=p.digest(),C="",A=E-m.length,N=0;N<A;N++)C+="\0";var S=h.getBytes()+C+"\x01"+m;if(f){if(f.length!==p.digestLength){var v;throw(v=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=f.length,v.digestLength=p.digestLength,v}}else f=y.random.getBytes(p.digestLength);var D=g(f,I-p.digestLength-1,w),M=y.util.xorBytes(S,D,S.length),k=g(M,p.digestLength,w),F=y.util.xorBytes(f,k,f.length);return"\0"+F+M},l.decode_rsa_oaep=function(b,m,d){var c,f,p;"string"==typeof d?(c=d,f=arguments[3]||void 0):d&&(c=d.label||void 0,f=d.md||void 0,d.mgf1&&d.mgf1.md&&(p=d.mgf1.md));var w=Math.ceil(b.n.bitLength()/8);if(m.length!==w)throw(M=new Error("RSAES-OAEP encoded message length is invalid.")).length=m.length,M.expectedLength=w,M;if(void 0===f?f=y.md.sha1.create():f.start(),p||(p=f),w<2*f.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");c||(c=""),f.update(c,"raw");for(var I=f.digest().getBytes(),E=m.charAt(0),v=m.substring(1,f.digestLength+1),h=m.substring(1+f.digestLength),C=g(h,f.digestLength,p),A=y.util.xorBytes(v,C,v.length),N=g(A,w-f.digestLength-1,p),S=y.util.xorBytes(h,N,h.length),D=S.substring(0,f.digestLength),M="\0"!==E,k=0;k<f.digestLength;++k)M|=I.charAt(k)!==D.charAt(k);for(var F=1,G=f.digestLength,T=f.digestLength;T<S.length;T++){var O=S.charCodeAt(T),V=1&O^1,L=F?65534:0;M|=O&L,G+=F&=V}if(M||1!==S.charCodeAt(G))throw new Error("Invalid RSAES-OAEP padding.");return S.substring(G+1)}},422:(Y,K,R)=>{var y=R(8659);R(1298),R(7791),R(279),R(6078),R(8604),R(4957),R(8365),R(4747),R(5911);var l=y.asn1,g=Y.exports=y.pkcs7=y.pkcs7||{};function b(A){var N={},S=[];if(!l.validate(A,g.asn1.recipientInfoValidator,N,S)){var D=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw D.errors=S,D}return{version:N.version.charCodeAt(0),issuer:y.pki.RDNAttributesAsArray(N.issuer),serialNumber:y.util.createBuffer(N.serial).toHex(),encryptedContent:{algorithm:l.derToOid(N.encAlgorithm),parameter:N.encParameter?N.encParameter.value:void 0,content:N.encKey}}}function m(A){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(A.version).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[y.pki.distinguishedNameToAsn1({attributes:A.issuer}),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,y.util.hexToBytes(A.serialNumber))]),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.encryptedContent.algorithm).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")]),l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,A.encryptedContent.content)])}function c(A){for(var N=[],S=0;S<A.length;++S)N.push(m(A[S]));return N}function p(A){var N=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(A.version).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[y.pki.distinguishedNameToAsn1({attributes:A.issuer}),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,y.util.hexToBytes(A.serialNumber))]),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.digestAlgorithm).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])]);if(A.authenticatedAttributesAsn1&&N.value.push(A.authenticatedAttributesAsn1),N.value.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.signatureAlgorithm).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])),N.value.push(l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,A.signature)),A.unauthenticatedAttributes.length>0){for(var S=l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[]),D=0;D<A.unauthenticatedAttributes.length;++D)S.values.push(E(A.unauthenticatedAttributes[D]));N.value.push(S)}return N}function E(A){var N;if(A.type===y.pki.oids.contentType)N=l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.value).getBytes());else if(A.type===y.pki.oids.messageDigest)N=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,A.value.bytes());else if(A.type===y.pki.oids.signingTime){var S=new Date("1950-01-01T00:00:00Z"),D=new Date("2050-01-01T00:00:00Z"),M=A.value;if("string"==typeof M){var k=Date.parse(M);M=isNaN(k)?13===M.length?l.utcTimeToDate(M):l.generalizedTimeToDate(M):new Date(k)}N=M>=S&&M<D?l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(M)):l.create(l.Class.UNIVERSAL,l.Type.GENERALIZEDTIME,!1,l.dateToGeneralizedTime(M))}return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.type).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[N])])}function v(A){return[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(y.pki.oids.data).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.algorithm).getBytes()),A.parameter?l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,A.parameter.getBytes()):void 0]),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,A.content.getBytes())])]}function h(A,N,S){var D={};if(!l.validate(N,S,D,[])){var k=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw k.errors=k,k}if(l.derToOid(D.contentType)!==y.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(D.encryptedContent){var G="";if(y.util.isArray(D.encryptedContent))for(var T=0;T<D.encryptedContent.length;++T){if(D.encryptedContent[T].type!==l.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");G+=D.encryptedContent[T].value}else G=D.encryptedContent;A.encryptedContent={algorithm:l.derToOid(D.encAlgorithm),parameter:y.util.createBuffer(D.encParameter.value),content:y.util.createBuffer(G)}}if(D.content){if(G="",y.util.isArray(D.content))for(T=0;T<D.content.length;++T){if(D.content[T].type!==l.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");G+=D.content[T].value}else G=D.content;A.content=y.util.createBuffer(G)}return A.version=D.version.charCodeAt(0),A.rawCapture=D,D}function C(A){if(void 0===A.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===A.content){var N;switch(A.encryptedContent.algorithm){case y.pki.oids["aes128-CBC"]:case y.pki.oids["aes192-CBC"]:case y.pki.oids["aes256-CBC"]:N=y.aes.createDecryptionCipher(A.encryptedContent.key);break;case y.pki.oids.desCBC:case y.pki.oids["des-EDE3-CBC"]:N=y.des.createDecryptionCipher(A.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+A.encryptedContent.algorithm)}if(N.start(A.encryptedContent.parameter),N.update(A.encryptedContent.content),!N.finish())throw new Error("Symmetric decryption failed.");A.content=N.output}}g.messageFromPem=function(A){var N=y.pem.decode(A)[0];if("PKCS7"!==N.type){var S=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw S.headerType=N.type,S}if(N.procType&&"ENCRYPTED"===N.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var D=l.fromDer(N.body);return g.messageFromAsn1(D)},g.messageToPem=function(A,N){var S={type:"PKCS7",body:l.toDer(A.toAsn1()).getBytes()};return y.pem.encode(S,{maxline:N})},g.messageFromAsn1=function(A){var N={},S=[];if(!l.validate(A,g.asn1.contentInfoValidator,N,S)){var D=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw D.errors=S,D}var k,M=l.derToOid(N.contentType);switch(M){case y.pki.oids.envelopedData:k=g.createEnvelopedData();break;case y.pki.oids.encryptedData:k=g.createEncryptedData();break;case y.pki.oids.signedData:k=g.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+M+" is not (yet) supported.")}return k.fromAsn1(N.content.value[0]),k},g.createSignedData=function(){var A=null;return A={type:y.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(D){if(h(A,D,g.asn1.signedDataValidator),A.certificates=[],A.crls=[],A.digestAlgorithmIdentifiers=[],A.contentInfo=null,A.signerInfos=[],A.rawCapture.certificates)for(var M=A.rawCapture.certificates.value,k=0;k<M.length;++k)A.certificates.push(y.pki.certificateFromAsn1(M[k]))},toAsn1:function(){A.contentInfo||A.sign();for(var D=[],M=0;M<A.certificates.length;++M)D.push(y.pki.certificateToAsn1(A.certificates[M]));var k=[],F=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(A.version).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,A.digestAlgorithmIdentifiers),A.contentInfo])]);return D.length>0&&F.value[0].value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,D)),k.length>0&&F.value[0].value.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,k)),F.value[0].value.push(l.create(l.Class.UNIVERSAL,l.Type.SET,!0,A.signerInfos)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.type).getBytes()),F])},addSigner:function(D){var M=D.issuer,k=D.serialNumber;if(D.certificate){var F=D.certificate;"string"==typeof F&&(F=y.pki.certificateFromPem(F)),M=F.issuer.attributes,k=F.serialNumber}var G=D.key;if(!G)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof G&&(G=y.pki.privateKeyFromPem(G));var T=D.digestAlgorithm||y.pki.oids.sha1;switch(T){case y.pki.oids.sha1:case y.pki.oids.sha256:case y.pki.oids.sha384:case y.pki.oids.sha512:case y.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+T)}var O=D.authenticatedAttributes||[];if(O.length>0){for(var V=!1,L=!1,H=0;H<O.length;++H){var ne=O[H];if(V||ne.type!==y.pki.oids.contentType){if(L||ne.type!==y.pki.oids.messageDigest);else if(L=!0,V)break}else if(V=!0,L)break}if(!V||!L)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}A.signers.push({key:G,version:1,issuer:M,serialNumber:k,digestAlgorithm:T,signatureAlgorithm:y.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:O,unauthenticatedAttributes:[]})},sign:function(D){var M;if(D=D||{},"object"==typeof A.content&&null!==A.contentInfo||(A.contentInfo=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(y.pki.oids.data).getBytes())]),!("content"in A))||(A.content instanceof y.util.ByteBuffer?M=A.content.bytes():"string"==typeof A.content&&(M=y.util.encodeUtf8(A.content)),D.detached?A.detachedContent=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,M):A.contentInfo.value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,M)]))),0!==A.signers.length){var k=function N(){for(var D={},M=0;M<A.signers.length;++M){var k=A.signers[M];(F=k.digestAlgorithm)in D||(D[F]=y.md[y.pki.oids[F]].create()),k.md=0===k.authenticatedAttributes.length?D[F]:y.md[y.pki.oids[F]].create()}for(var F in A.digestAlgorithmIdentifiers=[],D)A.digestAlgorithmIdentifiers.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(F).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")]));return D}();!function S(D){var M;if(!(M=A.detachedContent?A.detachedContent:(M=A.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var k=l.derToOid(A.contentInfo.value[0].value),F=l.toDer(M);for(var G in F.getByte(),l.getBerValueLength(F),F=F.getBytes(),D)D[G].start().update(F);for(var T=new Date,O=0;O<A.signers.length;++O){var V=A.signers[O];if(0===V.authenticatedAttributes.length){if(k!==y.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{V.authenticatedAttributesAsn1=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var L=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[]),H=0;H<V.authenticatedAttributes.length;++H){var ne=V.authenticatedAttributes[H];ne.type===y.pki.oids.messageDigest?ne.value=D[V.digestAlgorithm].digest():ne.type===y.pki.oids.signingTime&&(ne.value||(ne.value=T)),L.value.push(E(ne)),V.authenticatedAttributesAsn1.value.push(E(ne))}F=l.toDer(L).getBytes(),V.md.start().update(F)}V.signature=V.key.sign(V.md,"RSASSA-PKCS1-V1_5")}A.signerInfos=function I(A){for(var N=[],S=0;S<A.length;++S)N.push(p(A[S]));return N}(A.signers)}(k)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(D){"string"==typeof D&&(D=y.pki.certificateFromPem(D)),A.certificates.push(D)},addCertificateRevokationList:function(D){throw new Error("PKCS#7 CRL support not yet implemented.")}}},g.createEncryptedData=function(){var A=null;return A={type:y.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:y.pki.oids["aes256-CBC"]},fromAsn1:function(N){h(A,N,g.asn1.encryptedDataValidator)},decrypt:function(N){void 0!==N&&(A.encryptedContent.key=N),C(A)}}},g.createEnvelopedData=function(){var A=null;return A={type:y.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:y.pki.oids["aes256-CBC"]},fromAsn1:function(N){var S=h(A,N,g.asn1.envelopedDataValidator);A.recipients=function d(A){for(var N=[],S=0;S<A.length;++S)N.push(b(A[S]));return N}(S.recipientInfos.value)},toAsn1:function(){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(A.type).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(A.version).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,c(A.recipients)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,v(A.encryptedContent))])])])},findRecipient:function(N){for(var S=N.issuer.attributes,D=0;D<A.recipients.length;++D){var M=A.recipients[D],k=M.issuer;if(M.serialNumber===N.serialNumber&&k.length===S.length){for(var F=!0,G=0;G<S.length;++G)if(k[G].type!==S[G].type||k[G].value!==S[G].value){F=!1;break}if(F)return M}}return null},decrypt:function(N,S){if(void 0===A.encryptedContent.key&&void 0!==N&&void 0!==S)switch(N.encryptedContent.algorithm){case y.pki.oids.rsaEncryption:case y.pki.oids.desCBC:var D=S.decrypt(N.encryptedContent.content);A.encryptedContent.key=y.util.createBuffer(D);break;default:throw new Error("Unsupported asymmetric cipher, OID "+N.encryptedContent.algorithm)}C(A)},addRecipient:function(N){A.recipients.push({version:0,issuer:N.issuer.attributes,serialNumber:N.serialNumber,encryptedContent:{algorithm:y.pki.oids.rsaEncryption,key:N.publicKey}})},encrypt:function(N,S){if(void 0===A.encryptedContent.content){var D,M,k;switch(N=N||A.encryptedContent.key,S=S||A.encryptedContent.algorithm){case y.pki.oids["aes128-CBC"]:D=16,M=16,k=y.aes.createEncryptionCipher;break;case y.pki.oids["aes192-CBC"]:D=24,M=16,k=y.aes.createEncryptionCipher;break;case y.pki.oids["aes256-CBC"]:D=32,M=16,k=y.aes.createEncryptionCipher;break;case y.pki.oids["des-EDE3-CBC"]:D=24,M=8,k=y.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+S)}if(void 0===N)N=y.util.createBuffer(y.random.getBytes(D));else if(N.length()!=D)throw new Error("Symmetric key has wrong length; got "+N.length()+" bytes, expected "+D+".");A.encryptedContent.algorithm=S,A.encryptedContent.key=N,A.encryptedContent.parameter=y.util.createBuffer(y.random.getBytes(M));var F=k(N);if(F.start(A.encryptedContent.parameter.copy()),F.update(A.content),!F.finish())throw new Error("Symmetric encryption failed.");A.encryptedContent.content=F.output}for(var G=0;G<A.recipients.length;++G){var T=A.recipients[G];if(void 0===T.encryptedContent.content){if(T.encryptedContent.algorithm!==y.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+T.encryptedContent.algorithm);T.encryptedContent.content=T.encryptedContent.key.encrypt(A.encryptedContent.key.data)}}}}}},4957:(Y,K,R)=>{var y=R(8659);R(7791),R(4747);var l=y.asn1,g=Y.exports=y.pkcs7asn1=y.pkcs7asn1||{};y.pkcs7=y.pkcs7||{},y.pkcs7.asn1=g;var b={name:"ContentInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};g.contentInfoValidator=b;var m={name:"EncryptedContentInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:l.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};g.envelopedDataValidator={name:"EnvelopedData",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(m)},g.encryptedDataValidator={name:"EncryptedData",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"}].concat(m)},g.signedDataValidator={name:"SignedData",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},b,{name:"SignedData.Certificates",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,capture:"signerInfos",optional:!0,value:[{name:"SignerInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:l.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]},g.recipientInfoValidator={name:"RecipientInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:l.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},9709:(Y,K,R)=>{var y=R(8659);R(4747),R(730),R(8365),function(){if(y.prime)Y.exports=y.prime;else{var l=Y.exports=y.prime=y.prime||{},g=y.jsbn.BigInteger,b=[6,4,2,4,2,4,6,2],m=new g(null);m.fromInt(30);var d=function(v,h){return v|h};l.generateProbablePrime=function(v,h,C){"function"==typeof h&&(C=h,h={});var A=(h=h||{}).algorithm||"PRIMEINC";"string"==typeof A&&(A={name:A}),A.options=A.options||{};var N=h.prng||y.random;if("PRIMEINC"===A.name)return function c(v,h,C,A){return"workers"in C?function w(v,h,C,A){if(typeof Worker>"u")return f(v,h,C,A);var N=I(v,h),S=C.workers,D=C.workLoad||100,M=30*D/8,k=C.workerScript||"forge/prime.worker.js";if(-1===S)return y.util.estimateCores(function(G,T){G&&(T=2),S=T-1,F()});function F(){S=Math.max(1,S);for(var G=[],T=0;T<S;++T)G[T]=new Worker(k);for(T=0;T<S;++T)G[T].addEventListener("message",L);var V=!1;function L(H){if(!V){var ne=H.data;if(ne.found){for(var j=0;j<G.length;++j)G[j].terminate();return V=!0,A(null,new g(ne.prime,16))}N.bitLength()>v&&(N=I(v,h));var ee=N.toString(16);H.target.postMessage({hex:ee,workLoad:D}),N.dAddOffset(M,0)}}}F()}(v,h,C,A):f(v,h,C,A)}(v,{nextBytes:function(D){for(var M=N.getBytesSync(D.length),k=0;k<D.length;++k)D[k]=M.charCodeAt(k)}},A.options,C);throw new Error("Invalid prime generation algorithm: "+A.name)}}function f(v,h,C,A){var N=I(v,h),D=function E(v){return v<=100?27:v<=150?18:v<=200?15:v<=250?12:v<=300?9:v<=350?8:v<=400?7:v<=500?6:v<=600?5:v<=800?4:v<=1250?3:2}(N.bitLength());"millerRabinTests"in C&&(D=C.millerRabinTests);var M=10;"maxBlockTime"in C&&(M=C.maxBlockTime),p(N,v,h,0,D,M,A)}function p(v,h,C,A,N,S,D){var M=+new Date;do{if(v.bitLength()>h&&(v=I(h,C)),v.isProbablePrime(N))return D(null,v);v.dAddOffset(b[A++%8],0)}while(S<0||+new Date-M<S);y.util.setImmediate(function(){p(v,h,C,A,N,S,D)})}function I(v,h){var C=new g(v,h),A=v-1;return C.testBit(A)||C.bitwiseTo(g.ONE.shiftLeft(A),d,C),C.dAddOffset(31-C.mod(m).byteValue(),0),C}}()},4473:(Y,K,R)=>{var y=R(8659);R(4747);var l=null;y.util.isNodejs&&!y.options.usePureJavaScript&&!process.versions["node-webkit"]&&(l=R(5819)),(Y.exports=y.prng=y.prng||{}).create=function(b){for(var m={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},d=b.md,c=new Array(32),f=0;f<32;++f)c[f]=d.create();function w(){if(m.pools[0].messageLength>=32)return I();m.collect(m.seedFileSync(32-m.pools[0].messageLength<<5)),I()}function I(){m.reseeds=4294967295===m.reseeds?0:m.reseeds+1;var v=m.plugin.md.create();v.update(m.keyBytes);for(var h=1,C=0;C<32;++C)m.reseeds%h==0&&(v.update(m.pools[C].digest().getBytes()),m.pools[C].start()),h<<=1;m.keyBytes=v.digest().getBytes(),v.start(),v.update(m.keyBytes);var A=v.digest().getBytes();m.key=m.plugin.formatKey(m.keyBytes),m.seed=m.plugin.formatSeed(A),m.generated=0}function E(v){var h=null,C=y.util.globalScope,A=C.crypto||C.msCrypto;A&&A.getRandomValues&&(h=function(O){return A.getRandomValues(O)});var N=y.util.createBuffer();if(h)for(;N.length()<v;){var S=Math.max(1,Math.min(v-N.length(),65536)/4),D=new Uint32Array(Math.floor(S));try{h(D);for(var M=0;M<D.length;++M)N.putInt32(D[M])}catch(O){if(!(typeof QuotaExceededError<"u"&&O instanceof QuotaExceededError))throw O}}if(N.length()<v)for(var k,F,G,T=Math.floor(65536*Math.random());N.length()<v;)for(F=16807*(65535&T),F+=(32767&(k=16807*(T>>16)))<<16,T=4294967295&(F=(2147483647&(F+=k>>15))+(F>>31)),M=0;M<3;++M)G=T>>>(M<<3),G^=Math.floor(256*Math.random()),N.putByte(255&G);return N.getBytes(v)}return m.pools=c,m.pool=0,m.generate=function(v,h){if(!h)return m.generateSync(v);var C=m.plugin.cipher,A=m.plugin.increment,N=m.plugin.formatKey,S=m.plugin.formatSeed,D=y.util.createBuffer();m.key=null,function M(k){if(k)return h(k);if(D.length()>=v)return h(null,D.getBytes(v));if(m.generated>1048575&&(m.key=null),null===m.key)return y.util.nextTick(function(){!function p(v){if(m.pools[0].messageLength>=32)return I(),v();m.seedFile(32-m.pools[0].messageLength<<5,function(C,A){if(C)return v(C);m.collect(A),I(),v()})}(M)});var F=C(m.key,m.seed);m.generated+=F.length,D.putBytes(F),m.key=N(C(m.key,A(m.seed))),m.seed=S(C(m.key,m.seed)),y.util.setImmediate(M)}()},m.generateSync=function(v){var h=m.plugin.cipher,C=m.plugin.increment,A=m.plugin.formatKey,N=m.plugin.formatSeed;m.key=null;for(var S=y.util.createBuffer();S.length()<v;){m.generated>1048575&&(m.key=null),null===m.key&&w();var D=h(m.key,m.seed);m.generated+=D.length,S.putBytes(D),m.key=A(h(m.key,C(m.seed))),m.seed=N(h(m.key,m.seed))}return S.getBytes(v)},l?(m.seedFile=function(v,h){l.randomBytes(v,function(C,A){if(C)return h(C);h(null,A.toString())})},m.seedFileSync=function(v){return l.randomBytes(v).toString()}):(m.seedFile=function(v,h){try{h(null,E(v))}catch(C){h(C)}},m.seedFileSync=E),m.collect=function(v){for(var h=v.length,C=0;C<h;++C)m.pools[m.pool].update(v.substr(C,1)),m.pool=31===m.pool?0:m.pool+1},m.collectInt=function(v,h){for(var C="",A=0;A<h;A+=8)C+=String.fromCharCode(v>>A&255);m.collect(C)},m.registerWorker=function(v){v===self?m.seedFile=function(C,A){self.addEventListener("message",function N(S){var D=S.data;D.forge&&D.forge.prng&&(self.removeEventListener("message",N),A(D.forge.prng.err,D.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:C}}})}:v.addEventListener("message",function(C){var A=C.data;A.forge&&A.forge.prng&&m.seedFile(A.forge.prng.needed,function(N,S){v.postMessage({forge:{prng:{err:N,bytes:S}}})})})},m}},7256:(Y,K,R)=>{var y=R(8659);R(8365),R(4747),(Y.exports=y.pss=y.pss||{}).create=function(g){3===arguments.length&&(g={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var f,b=g.md,m=g.mgf,d=b.digestLength,c=g.salt||null;if("string"==typeof c&&(c=y.util.createBuffer(c)),"saltLength"in g)f=g.saltLength;else{if(null===c)throw new Error("Salt length not specified or specific salt not given.");f=c.length()}if(null!==c&&c.length()!==f)throw new Error("Given salt length does not match length of given salt.");var p=g.prng||y.random,w={encode:function(I,E){var v,N,h=E-1,C=Math.ceil(h/8),A=I.digest().getBytes();if(C<d+f+2)throw new Error("Message is too long to encrypt.");N=null===c?p.getBytesSync(f):c.bytes();var S=new y.util.ByteBuffer;S.fillWithByte(0,8),S.putBytes(A),S.putBytes(N),b.start(),b.update(S.getBytes());var D=b.digest().getBytes(),M=new y.util.ByteBuffer;M.fillWithByte(0,C-f-d-2),M.putByte(1),M.putBytes(N);var k=M.getBytes(),F=C-d-1,G=m.generate(D,F),T="";for(v=0;v<F;v++)T+=String.fromCharCode(k.charCodeAt(v)^G.charCodeAt(v));var O=65280>>8*C-h&255;return(T=String.fromCharCode(T.charCodeAt(0)&~O)+T.substr(1))+D+String.fromCharCode(188)},verify:function(I,E,v){var h,C=v-1,A=Math.ceil(C/8);if(E=E.substr(-A),A<d+f+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==E.charCodeAt(A-1))throw new Error("Encoded message does not end in 0xBC.");var N=A-d-1,S=E.substr(0,N),D=E.substr(N,d),M=65280>>8*A-C&255;if(0!=(S.charCodeAt(0)&M))throw new Error("Bits beyond keysize not zero as expected.");var k=m.generate(D,N),F="";for(h=0;h<N;h++)F+=String.fromCharCode(S.charCodeAt(h)^k.charCodeAt(h));F=String.fromCharCode(F.charCodeAt(0)&~M)+F.substr(1);var G=A-d-f-2;for(h=0;h<G;h++)if(0!==F.charCodeAt(h))throw new Error("Leftmost octets not zero as expected");if(1!==F.charCodeAt(G))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var T=F.substr(-f),O=new y.util.ByteBuffer;return O.fillWithByte(0,8),O.putBytes(I),O.putBytes(T),b.start(),b.update(O.getBytes()),D===b.digest().getBytes()}};return w}},8365:(Y,K,R)=>{var y=R(8659);R(1298),R(1594),R(4473),R(4747),y.random&&y.random.getBytes?Y.exports=y.random:function(l){var g={},b=new Array(4),m=y.util.createBuffer();function d(){var v=y.prng.create(g);return v.getBytes=function(h,C){return v.generate(h,C)},v.getBytesSync=function(h){return v.generate(h)},v}g.formatKey=function(v){var h=y.util.createBuffer(v);return(v=new Array(4))[0]=h.getInt32(),v[1]=h.getInt32(),v[2]=h.getInt32(),v[3]=h.getInt32(),y.aes._expandKey(v,!1)},g.formatSeed=function(v){var h=y.util.createBuffer(v);return(v=new Array(4))[0]=h.getInt32(),v[1]=h.getInt32(),v[2]=h.getInt32(),v[3]=h.getInt32(),v},g.cipher=function(v,h){return y.aes._updateBlock(v,h,b,!1),m.putInt32(b[0]),m.putInt32(b[1]),m.putInt32(b[2]),m.putInt32(b[3]),m.getBytes()},g.increment=function(v){return++v[3],v},g.md=y.md.sha256;var c=d(),f=null,p=y.util.globalScope,w=p.crypto||p.msCrypto;if(w&&w.getRandomValues&&(f=function(v){return w.getRandomValues(v)}),y.options.usePureJavaScript||!y.util.isNodejs&&!f){if(typeof window>"u"||window,c.collectInt(+new Date,32),typeof navigator<"u"){var I="";for(var E in navigator)try{"string"==typeof navigator[E]&&(I+=navigator[E])}catch{}c.collect(I),I=null}l&&(l().mousemove(function(v){c.collectInt(v.clientX,16),c.collectInt(v.clientY,16)}),l().keypress(function(v){c.collectInt(v.charCode,8)}))}if(y.random)for(var E in c)y.random[E]=c[E];else y.random=c;y.random.createInstance=d,Y.exports=y.random}(typeof jQuery<"u"?jQuery:null)},209:(Y,K,R)=>{var y=R(8659);R(4747);var l=[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],g=[1,2,3,5],b=function(c,f){return c<<f&65535|(65535&c)>>16-f},m=function(c,f){return(65535&c)>>f|c<<16-f&65535};Y.exports=y.rc2=y.rc2||{},y.rc2.expandKey=function(c,f){"string"==typeof c&&(c=y.util.createBuffer(c)),f=f||128;var h,p=c,w=c.length(),I=f,E=Math.ceil(I/8),v=255>>(7&I);for(h=w;h<128;h++)p.putByte(l[p.at(h-1)+p.at(h-w)&255]);for(p.setAt(128-E,l[p.at(128-E)&v]),h=127-E;h>=0;h--)p.setAt(h,l[p.at(h+1)^p.at(h+E)]);return p};var d=function(c,f,p){var h,C,A,N,w=!1,I=null,E=null,v=null,S=[];for(c=y.rc2.expandKey(c,f),A=0;A<64;A++)S.push(c.getInt16Le());p?(h=function(k){for(A=0;A<4;A++)k[A]+=S[N]+(k[(A+3)%4]&k[(A+2)%4])+(~k[(A+3)%4]&k[(A+1)%4]),k[A]=b(k[A],g[A]),N++},C=function(k){for(A=0;A<4;A++)k[A]+=S[63&k[(A+3)%4]]}):(h=function(k){for(A=3;A>=0;A--)k[A]=m(k[A],g[A]),k[A]-=S[N]+(k[(A+3)%4]&k[(A+2)%4])+(~k[(A+3)%4]&k[(A+1)%4]),N--},C=function(k){for(A=3;A>=0;A--)k[A]-=S[63&k[(A+3)%4]]});var D=function(k){var F=[];for(A=0;A<4;A++){var G=I.getInt16Le();null!==v&&(p?G^=v.getInt16Le():v.putInt16Le(G)),F.push(65535&G)}N=p?0:63;for(var T=0;T<k.length;T++)for(var O=0;O<k[T][0];O++)k[T][1](F);for(A=0;A<4;A++)null!==v&&(p?v.putInt16Le(F[A]):F[A]^=v.getInt16Le()),E.putInt16Le(F[A])},M=null;return M={start:function(k,F){k&&"string"==typeof k&&(k=y.util.createBuffer(k)),w=!1,I=y.util.createBuffer(),E=F||new y.util.createBuffer,v=k,M.output=E},update:function(k){for(w||I.putBuffer(k);I.length()>=8;)D([[5,h],[1,C],[6,h],[1,C],[5,h]])},finish:function(k){var F=!0;if(p)if(k)F=k(8,I,!p);else{var G=8===I.length()?8:8-I.length();I.fillWithByte(G,G)}if(F&&(w=!0,M.update()),!p&&(F=0===I.length()))if(k)F=k(8,E,!p);else{var T=E.length(),O=E.at(T-1);O>T?F=!1:E.truncate(O)}return F}}};y.rc2.startEncrypting=function(c,f,p){var w=y.rc2.createEncryptionCipher(c,128);return w.start(f,p),w},y.rc2.createEncryptionCipher=function(c,f){return d(c,f,!0)},y.rc2.startDecrypting=function(c,f,p){var w=y.rc2.createDecryptionCipher(c,128);return w.start(f,p),w},y.rc2.createDecryptionCipher=function(c,f){return d(c,f,!1)}},5517:(Y,K,R)=>{var y=R(8659);if(R(7791),R(730),R(6078),R(7246),R(9709),R(8365),R(4747),typeof l>"u")var l=y.jsbn.BigInteger;var g=y.util.isNodejs?R(5819):null,b=y.asn1,m=y.util;y.pki=y.pki||{},Y.exports=y.pki.rsa=y.rsa=y.rsa||{};var d=y.pki,c=[6,4,2,4,2,4,6,2],f={name:"PrivateKeyInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},w={name:"RSAPublicKey",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},I=y.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:b.Class.UNIVERSAL,type:b.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},E={name:"DigestInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:b.Class.UNIVERSAL,type:b.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},v=function(L){if(!(L.algorithm in d.oids)){var ne=new Error("Unknown message digest algorithm.");throw ne.algorithm=L.algorithm,ne}var j=b.oidToDer(d.oids[L.algorithm]).getBytes(),ee=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]),Z=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]);Z.value.push(b.create(b.Class.UNIVERSAL,b.Type.OID,!1,j)),Z.value.push(b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,""));var q=b.create(b.Class.UNIVERSAL,b.Type.OCTETSTRING,!1,L.digest().getBytes());return ee.value.push(Z),ee.value.push(q),b.toDer(ee).getBytes()},h=function(L,H,ne){if(ne)return L.modPow(H.e,H.n);if(!H.p||!H.q)return L.modPow(H.d,H.n);var j;H.dP||(H.dP=H.d.mod(H.p.subtract(l.ONE))),H.dQ||(H.dQ=H.d.mod(H.q.subtract(l.ONE))),H.qInv||(H.qInv=H.q.modInverse(H.p));do{j=new l(y.util.bytesToHex(y.random.getBytes(H.n.bitLength()/8)),16)}while(j.compareTo(H.n)>=0||!j.gcd(H.n).equals(l.ONE));for(var ee=(L=L.multiply(j.modPow(H.e,H.n)).mod(H.n)).mod(H.p).modPow(H.dP,H.p),Z=L.mod(H.q).modPow(H.dQ,H.q);ee.compareTo(Z)<0;)ee=ee.add(H.p);var q=ee.subtract(Z).multiply(H.qInv).mod(H.p).multiply(H.q).add(Z);return q.multiply(j.modInverse(H.n)).mod(H.n)};function C(L,H,ne){var j=y.util.createBuffer(),ee=Math.ceil(H.n.bitLength()/8);if(L.length>ee-11){var Z=new Error("Message is too long for PKCS#1 v1.5 padding.");throw Z.length=L.length,Z.max=ee-11,Z}j.putByte(0),j.putByte(ne);var te,q=ee-3-L.length;if(0===ne||1===ne){te=0===ne?0:255;for(var oe=0;oe<q;++oe)j.putByte(te)}else for(;q>0;){var de=0,he=y.random.getBytes(q);for(oe=0;oe<q;++oe)0===(te=he.charCodeAt(oe))?++de:j.putByte(te);q=de}return j.putByte(0),j.putBytes(L),j}function A(L,H,ne,j){var ee=Math.ceil(H.n.bitLength()/8),Z=y.util.createBuffer(L),q=Z.getByte(),te=Z.getByte();if(0!==q||ne&&0!==te&&1!==te||!ne&&2!=te||ne&&0===te&&typeof j>"u")throw new Error("Encryption block is invalid.");var oe=0;if(0===te){oe=ee-3-j;for(var de=0;de<oe;++de)if(0!==Z.getByte())throw new Error("Encryption block is invalid.")}else if(1===te)for(oe=0;Z.length()>1;){if(255!==Z.getByte()){--Z.read;break}++oe}else if(2===te)for(oe=0;Z.length()>1;){if(0===Z.getByte()){--Z.read;break}++oe}if(0!==Z.getByte()||oe!==ee-3-Z.length())throw new Error("Encryption block is invalid.");return Z.getBytes()}function N(L,H,ne){"function"==typeof H&&(ne=H,H={});var j={algorithm:{name:(H=H||{}).algorithm||"PRIMEINC",options:{workers:H.workers||2,workLoad:H.workLoad||100,workerScript:H.workerScript}}};function ee(){Z(L.pBits,function(te,oe){return te?ne(te):(L.p=oe,null!==L.q?q(te,L.q):void Z(L.qBits,q))})}function Z(te,oe){y.prime.generateProbablePrime(te,j,oe)}function q(te,oe){if(te)return ne(te);if(L.q=oe,L.p.compareTo(L.q)<0){var de=L.p;L.p=L.q,L.q=de}if(0!==L.p.subtract(l.ONE).gcd(L.e).compareTo(l.ONE))return L.p=null,void ee();if(0!==L.q.subtract(l.ONE).gcd(L.e).compareTo(l.ONE))return L.q=null,void Z(L.qBits,q);if(L.p1=L.p.subtract(l.ONE),L.q1=L.q.subtract(l.ONE),L.phi=L.p1.multiply(L.q1),0!==L.phi.gcd(L.e).compareTo(l.ONE))return L.p=L.q=null,void ee();if(L.n=L.p.multiply(L.q),L.n.bitLength()!==L.bits)return L.q=null,void Z(L.qBits,q);var he=L.e.modInverse(L.phi);L.keys={privateKey:d.rsa.setPrivateKey(L.n,L.e,he,L.p,L.q,he.mod(L.p1),he.mod(L.q1),L.q.modInverse(L.p)),publicKey:d.rsa.setPublicKey(L.n,L.e)},ne(null,L.keys)}"prng"in H&&(j.prng=H.prng),ee()}function S(L){var H=L.toString(16);H[0]>="8"&&(H="00"+H);var ne=y.util.hexToBytes(H);return ne.length>1&&(0===ne.charCodeAt(0)&&0==(128&ne.charCodeAt(1))||255===ne.charCodeAt(0)&&128==(128&ne.charCodeAt(1)))?ne.substr(1):ne}function D(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}function M(L){return y.util.isNodejs&&"function"==typeof g[L]}function k(L){return typeof m.globalScope<"u"&&"object"==typeof m.globalScope.crypto&&"object"==typeof m.globalScope.crypto.subtle&&"function"==typeof m.globalScope.crypto.subtle[L]}function F(L){return typeof m.globalScope<"u"&&"object"==typeof m.globalScope.msCrypto&&"object"==typeof m.globalScope.msCrypto.subtle&&"function"==typeof m.globalScope.msCrypto.subtle[L]}function G(L){for(var H=y.util.hexToBytes(L.toString(16)),ne=new Uint8Array(H.length),j=0;j<H.length;++j)ne[j]=H.charCodeAt(j);return ne}d.rsa.encrypt=function(L,H,ne){var ee,j=ne,Z=Math.ceil(H.n.bitLength()/8);!1!==ne&&!0!==ne?(j=2===ne,ee=C(L,H,ne)):(ee=y.util.createBuffer()).putBytes(L);for(var q=new l(ee.toHex(),16),oe=h(q,H,j).toString(16),de=y.util.createBuffer(),he=Z-Math.ceil(oe.length/2);he>0;)de.putByte(0),--he;return de.putBytes(y.util.hexToBytes(oe)),de.getBytes()},d.rsa.decrypt=function(L,H,ne,j){var ee=Math.ceil(H.n.bitLength()/8);if(L.length!==ee){var Z=new Error("Encrypted message length is invalid.");throw Z.length=L.length,Z.expected=ee,Z}var q=new l(y.util.createBuffer(L).toHex(),16);if(q.compareTo(H.n)>=0)throw new Error("Encrypted message is invalid.");for(var oe=h(q,H,ne).toString(16),de=y.util.createBuffer(),he=ee-Math.ceil(oe.length/2);he>0;)de.putByte(0),--he;return de.putBytes(y.util.hexToBytes(oe)),!1!==j?A(de.getBytes(),H,ne):de.getBytes()},d.rsa.createKeyPairGenerationState=function(L,H,ne){"string"==typeof L&&(L=parseInt(L,10)),L=L||2048;var q,j=(ne=ne||{}).prng||y.random,ee={nextBytes:function(te){for(var oe=j.getBytesSync(te.length),de=0;de<te.length;++de)te[de]=oe.charCodeAt(de)}},Z=ne.algorithm||"PRIMEINC";if("PRIMEINC"!==Z)throw new Error("Invalid key generation algorithm: "+Z);return(q={algorithm:Z,state:0,bits:L,rng:ee,eInt:H||65537,e:new l(null),p:null,q:null,qBits:L>>1,pBits:L-(L>>1),pqState:0,num:null,keys:null}).e.fromInt(q.eInt),q},d.rsa.stepKeyPairGenerationState=function(L,H){"algorithm"in L||(L.algorithm="PRIMEINC");var ne=new l(null);ne.fromInt(30);for(var q,j=0,ee=function(Pe,Se){return Pe|Se},Z=+new Date,te=0;null===L.keys&&(H<=0||te<H);){if(0===L.state){var oe=null===L.p?L.pBits:L.qBits,de=oe-1;0===L.pqState?(L.num=new l(oe,L.rng),L.num.testBit(de)||L.num.bitwiseTo(l.ONE.shiftLeft(de),ee,L.num),L.num.dAddOffset(31-L.num.mod(ne).byteValue(),0),j=0,++L.pqState):1===L.pqState?L.num.bitLength()>oe?L.pqState=0:L.num.isProbablePrime(D(L.num.bitLength()))?++L.pqState:L.num.dAddOffset(c[j++%8],0):2===L.pqState?L.pqState=0===L.num.subtract(l.ONE).gcd(L.e).compareTo(l.ONE)?3:0:3===L.pqState&&(L.pqState=0,null===L.p?L.p=L.num:L.q=L.num,null!==L.p&&null!==L.q&&++L.state,L.num=null)}else if(1===L.state)L.p.compareTo(L.q)<0&&(L.num=L.p,L.p=L.q,L.q=L.num),++L.state;else if(2===L.state)L.p1=L.p.subtract(l.ONE),L.q1=L.q.subtract(l.ONE),L.phi=L.p1.multiply(L.q1),++L.state;else if(3===L.state)0===L.phi.gcd(L.e).compareTo(l.ONE)?++L.state:(L.p=null,L.q=null,L.state=0);else if(4===L.state)L.n=L.p.multiply(L.q),L.n.bitLength()===L.bits?++L.state:(L.q=null,L.state=0);else if(5===L.state){var he=L.e.modInverse(L.phi);L.keys={privateKey:d.rsa.setPrivateKey(L.n,L.e,he,L.p,L.q,he.mod(L.p1),he.mod(L.q1),L.q.modInverse(L.p)),publicKey:d.rsa.setPublicKey(L.n,L.e)}}te+=(q=+new Date)-Z,Z=q}return null!==L.keys},d.rsa.generateKeyPair=function(L,H,ne,j){if(1===arguments.length?"object"==typeof L?(ne=L,L=void 0):"function"==typeof L&&(j=L,L=void 0):2===arguments.length?"number"==typeof L?"function"==typeof H?(j=H,H=void 0):"number"!=typeof H&&(ne=H,H=void 0):(ne=L,j=H,L=void 0,H=void 0):3===arguments.length&&("number"==typeof H?"function"==typeof ne&&(j=ne,ne=void 0):(j=ne,ne=H,H=void 0)),ne=ne||{},void 0===L&&(L=ne.bits||2048),void 0===H&&(H=ne.e||65537),!y.options.usePureJavaScript&&!ne.prng&&L>=256&&L<=16384&&(65537===H||3===H))if(j){if(M("generateKeyPair"))return g.generateKeyPair("rsa",{modulusLength:L,publicExponent:H,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(te,oe,de){if(te)return j(te);j(null,{privateKey:d.privateKeyFromPem(de),publicKey:d.publicKeyFromPem(oe)})});if(k("generateKey")&&k("exportKey"))return m.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:L,publicExponent:G(H),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(te){return m.globalScope.crypto.subtle.exportKey("pkcs8",te.privateKey)}).then(void 0,function(te){j(te)}).then(function(te){if(te){var oe=d.privateKeyFromAsn1(b.fromDer(y.util.createBuffer(te)));j(null,{privateKey:oe,publicKey:d.setRsaPublicKey(oe.n,oe.e)})}});if(F("generateKey")&&F("exportKey")){var ee=m.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:L,publicExponent:G(H),hash:{name:"SHA-256"}},!0,["sign","verify"]);return ee.oncomplete=function(te){var de=m.globalScope.msCrypto.subtle.exportKey("pkcs8",te.target.result.privateKey);de.oncomplete=function(he){var Se=d.privateKeyFromAsn1(b.fromDer(y.util.createBuffer(he.target.result)));j(null,{privateKey:Se,publicKey:d.setRsaPublicKey(Se.n,Se.e)})},de.onerror=function(he){j(he)}},void(ee.onerror=function(te){j(te)})}}else if(M("generateKeyPairSync")){var Z=g.generateKeyPairSync("rsa",{modulusLength:L,publicExponent:H,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:d.privateKeyFromPem(Z.privateKey),publicKey:d.publicKeyFromPem(Z.publicKey)}}var q=d.rsa.createKeyPairGenerationState(L,H,ne);if(!j)return d.rsa.stepKeyPairGenerationState(q,0),q.keys;N(q,ne,j)},d.setRsaPublicKey=d.rsa.setPublicKey=function(L,H){var ne={n:L,e:H,encrypt:function(j,ee,Z){if("string"==typeof ee?ee=ee.toUpperCase():void 0===ee&&(ee="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===ee)ee={encode:function(te,oe,de){return C(te,oe,2).getBytes()}};else if("RSA-OAEP"===ee||"RSAES-OAEP"===ee)ee={encode:function(te,oe){return y.pkcs1.encode_rsa_oaep(oe,te,Z)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(ee))ee={encode:function(te){return te}};else if("string"==typeof ee)throw new Error('Unsupported encryption scheme: "'+ee+'".');var q=ee.encode(j,ne,!0);return d.rsa.encrypt(q,ne,!0)},verify:function(j,ee,Z,q){"string"==typeof Z?Z=Z.toUpperCase():void 0===Z&&(Z="RSASSA-PKCS1-V1_5"),void 0===q&&(q={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in q||(q._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===Z?Z={verify:function(oe,de){de=A(de,ne,!0);var he=b.fromDer(de,{parseAllBytes:q._parseAllDigestBytes}),Pe={},Se=[];if(!b.validate(he,E,Pe,Se))throw(Be=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=Se,Be;var Be,ve=b.derToOid(Pe.algorithmIdentifier);if(ve!==y.oids.md2&&ve!==y.oids.md5&&ve!==y.oids.sha1&&ve!==y.oids.sha224&&ve!==y.oids.sha256&&ve!==y.oids.sha384&&ve!==y.oids.sha512&&ve!==y.oids["sha512-224"]&&ve!==y.oids["sha512-256"])throw(Be=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=ve,Be;if((ve===y.oids.md2||ve===y.oids.md5)&&!("parameters"in Pe))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return oe===Pe.digest}}:("NONE"===Z||"NULL"===Z||null===Z)&&(Z={verify:function(oe,de){return oe===A(de,ne,!0)}});var te=d.rsa.decrypt(ee,ne,!0,!1);return Z.verify(j,te,ne.n.bitLength())}};return ne},d.setRsaPrivateKey=d.rsa.setPrivateKey=function(L,H,ne,j,ee,Z,q,te){var oe={n:L,e:H,d:ne,p:j,q:ee,dP:Z,dQ:q,qInv:te,decrypt:function(de,he,Pe){"string"==typeof he?he=he.toUpperCase():void 0===he&&(he="RSAES-PKCS1-V1_5");var Se=d.rsa.decrypt(de,oe,!1,!1);if("RSAES-PKCS1-V1_5"===he)he={decode:A};else if("RSA-OAEP"===he||"RSAES-OAEP"===he)he={decode:function(Be,ve){return y.pkcs1.decode_rsa_oaep(ve,Be,Pe)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(he))throw new Error('Unsupported encryption scheme: "'+he+'".');he={decode:function(Be){return Be}}}return he.decode(Se,oe,!1)},sign:function(de,he){var Pe=!1;"string"==typeof he&&(he=he.toUpperCase()),void 0===he||"RSASSA-PKCS1-V1_5"===he?(he={encode:v},Pe=1):("NONE"===he||"NULL"===he||null===he)&&(he={encode:function(){return de}},Pe=1);var Se=he.encode(de,oe.n.bitLength());return d.rsa.encrypt(Se,oe,Pe)}};return oe},d.wrapRsaPrivateKey=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,b.integerToDer(0).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(d.oids.rsaEncryption).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,"")]),b.create(b.Class.UNIVERSAL,b.Type.OCTETSTRING,!1,b.toDer(L).getBytes())])},d.privateKeyFromAsn1=function(L){var ee,Z,q,te,oe,de,he,Pe,H={},ne=[];if(b.validate(L,f,H,ne)&&(L=b.fromDer(y.util.createBuffer(H.privateKey))),!b.validate(L,p,H={},ne=[])){var j=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw j.errors=ne,j}return ee=y.util.createBuffer(H.privateKeyModulus).toHex(),Z=y.util.createBuffer(H.privateKeyPublicExponent).toHex(),q=y.util.createBuffer(H.privateKeyPrivateExponent).toHex(),te=y.util.createBuffer(H.privateKeyPrime1).toHex(),oe=y.util.createBuffer(H.privateKeyPrime2).toHex(),de=y.util.createBuffer(H.privateKeyExponent1).toHex(),he=y.util.createBuffer(H.privateKeyExponent2).toHex(),Pe=y.util.createBuffer(H.privateKeyCoefficient).toHex(),d.setRsaPrivateKey(new l(ee,16),new l(Z,16),new l(q,16),new l(te,16),new l(oe,16),new l(de,16),new l(he,16),new l(Pe,16))},d.privateKeyToAsn1=d.privateKeyToRSAPrivateKey=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,b.integerToDer(0).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.n)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.e)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.d)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.p)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.q)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.dP)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.dQ)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.qInv))])},d.publicKeyFromAsn1=function(L){var H={},ne=[];if(b.validate(L,I,H,ne)){var ee,j=b.derToOid(H.publicKeyOid);if(j!==d.oids.rsaEncryption)throw(ee=new Error("Cannot read public key. Unknown OID.")).oid=j,ee;L=H.rsaPublicKey}if(!b.validate(L,w,H,ne=[]))throw(ee=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=ne,ee;var Z=y.util.createBuffer(H.publicKeyModulus).toHex(),q=y.util.createBuffer(H.publicKeyExponent).toHex();return d.setRsaPublicKey(new l(Z,16),new l(q,16))},d.publicKeyToAsn1=d.publicKeyToSubjectPublicKeyInfo=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(d.oids.rsaEncryption).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,"")]),b.create(b.Class.UNIVERSAL,b.Type.BITSTRING,!1,[d.publicKeyToRSAPublicKey(L)])])},d.publicKeyToRSAPublicKey=function(L){return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.n)),b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,S(L.e))])}},7690:(Y,K,R)=>{var y=R(8659);R(979),R(4747);var l=Y.exports=y.sha1=y.sha1||{};y.md.sha1=y.md.algorithms.sha1=l,l.create=function(){b||function m(){g=String.fromCharCode(128),g+=y.util.fillString(String.fromCharCode(0),64),b=!0}();var c=null,f=y.util.createBuffer(),p=new Array(80),w={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){w.messageLength=0,w.fullMessageLength=w.messageLength64=[];for(var I=w.messageLengthSize/4,E=0;E<I;++E)w.fullMessageLength.push(0);return f=y.util.createBuffer(),c={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},w}};return w.start(),w.update=function(I,E){"utf8"===E&&(I=y.util.encodeUtf8(I));var v=I.length;w.messageLength+=v,v=[v/4294967296>>>0,v>>>0];for(var h=w.fullMessageLength.length-1;h>=0;--h)w.fullMessageLength[h]+=v[1],v[1]=v[0]+(w.fullMessageLength[h]/4294967296>>>0),w.fullMessageLength[h]=w.fullMessageLength[h]>>>0,v[0]=v[1]/4294967296>>>0;return f.putBytes(I),d(c,p,f),(f.read>2048||0===f.length())&&f.compact(),w},w.digest=function(){var I=y.util.createBuffer();I.putBytes(f.bytes()),I.putBytes(g.substr(0,w.blockLength-(w.fullMessageLength[w.fullMessageLength.length-1]+w.messageLengthSize&w.blockLength-1)));for(var h,A=8*w.fullMessageLength[0],N=0;N<w.fullMessageLength.length-1;++N)I.putInt32((A+=(h=8*w.fullMessageLength[N+1])/4294967296>>>0)>>>0),A=h>>>0;I.putInt32(A);var S={h0:c.h0,h1:c.h1,h2:c.h2,h3:c.h3,h4:c.h4};d(S,p,I);var D=y.util.createBuffer();return D.putInt32(S.h0),D.putInt32(S.h1),D.putInt32(S.h2),D.putInt32(S.h3),D.putInt32(S.h4),D},w};var g=null,b=!1;function d(c,f,p){for(var w,I,E,v,h,C,N,S=p.length();S>=64;){for(I=c.h0,E=c.h1,v=c.h2,h=c.h3,C=c.h4,N=0;N<16;++N)w=p.getInt32(),f[N]=w,w=(I<<5|I>>>27)+(h^E&(v^h))+C+1518500249+w,C=h,h=v,v=(E<<30|E>>>2)>>>0,E=I,I=w;for(;N<20;++N)f[N]=w=(w=f[N-3]^f[N-8]^f[N-14]^f[N-16])<<1|w>>>31,w=(I<<5|I>>>27)+(h^E&(v^h))+C+1518500249+w,C=h,h=v,v=(E<<30|E>>>2)>>>0,E=I,I=w;for(;N<32;++N)f[N]=w=(w=f[N-3]^f[N-8]^f[N-14]^f[N-16])<<1|w>>>31,w=(I<<5|I>>>27)+(E^v^h)+C+1859775393+w,C=h,h=v,v=(E<<30|E>>>2)>>>0,E=I,I=w;for(;N<40;++N)f[N]=w=(w=f[N-6]^f[N-16]^f[N-28]^f[N-32])<<2|w>>>30,w=(I<<5|I>>>27)+(E^v^h)+C+1859775393+w,C=h,h=v,v=(E<<30|E>>>2)>>>0,E=I,I=w;for(;N<60;++N)f[N]=w=(w=f[N-6]^f[N-16]^f[N-28]^f[N-32])<<2|w>>>30,w=(I<<5|I>>>27)+(E&v|h&(E^v))+C+2400959708+w,C=h,h=v,v=(E<<30|E>>>2)>>>0,E=I,I=w;for(;N<80;++N)f[N]=w=(w=f[N-6]^f[N-16]^f[N-28]^f[N-32])<<2|w>>>30,w=(I<<5|I>>>27)+(E^v^h)+C+3395469782+w,C=h,h=v,v=(E<<30|E>>>2)>>>0,E=I,I=w;c.h0=c.h0+I|0,c.h1=c.h1+E|0,c.h2=c.h2+v|0,c.h3=c.h3+h|0,c.h4=c.h4+C|0,S-=64}}},1594:(Y,K,R)=>{var y=R(8659);R(979),R(4747);var l=Y.exports=y.sha256=y.sha256||{};y.md.sha256=y.md.algorithms.sha256=l,l.create=function(){b||function d(){g=String.fromCharCode(128),g+=y.util.fillString(String.fromCharCode(0),64),m=[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],b=!0}();var f=null,p=y.util.createBuffer(),w=new Array(64),I={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){I.messageLength=0,I.fullMessageLength=I.messageLength64=[];for(var E=I.messageLengthSize/4,v=0;v<E;++v)I.fullMessageLength.push(0);return p=y.util.createBuffer(),f={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},I}};return I.start(),I.update=function(E,v){"utf8"===v&&(E=y.util.encodeUtf8(E));var h=E.length;I.messageLength+=h,h=[h/4294967296>>>0,h>>>0];for(var C=I.fullMessageLength.length-1;C>=0;--C)I.fullMessageLength[C]+=h[1],h[1]=h[0]+(I.fullMessageLength[C]/4294967296>>>0),I.fullMessageLength[C]=I.fullMessageLength[C]>>>0,h[0]=h[1]/4294967296>>>0;return p.putBytes(E),c(f,w,p),(p.read>2048||0===p.length())&&p.compact(),I},I.digest=function(){var E=y.util.createBuffer();E.putBytes(p.bytes()),E.putBytes(g.substr(0,I.blockLength-(I.fullMessageLength[I.fullMessageLength.length-1]+I.messageLengthSize&I.blockLength-1)));for(var C,N=8*I.fullMessageLength[0],S=0;S<I.fullMessageLength.length-1;++S)E.putInt32((N+=(C=8*I.fullMessageLength[S+1])/4294967296>>>0)>>>0),N=C>>>0;E.putInt32(N);var D={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3,h4:f.h4,h5:f.h5,h6:f.h6,h7:f.h7};c(D,w,E);var M=y.util.createBuffer();return M.putInt32(D.h0),M.putInt32(D.h1),M.putInt32(D.h2),M.putInt32(D.h3),M.putInt32(D.h4),M.putInt32(D.h5),M.putInt32(D.h6),M.putInt32(D.h7),M},I};var g=null,b=!1,m=null;function c(f,p,w){for(var I,E,A,N,S,D,M,k,F,G,T,O,V=w.length();V>=64;){for(N=0;N<16;++N)p[N]=w.getInt32();for(;N<64;++N)p[N]=(I=((I=p[N-2])>>>17|I<<15)^(I>>>19|I<<13)^I>>>10)+p[N-7]+(E=((E=p[N-15])>>>7|E<<25)^(E>>>18|E<<14)^E>>>3)+p[N-16]|0;for(S=f.h0,D=f.h1,M=f.h2,k=f.h3,F=f.h4,G=f.h5,T=f.h6,O=f.h7,N=0;N<64;++N)A=S&D|M&(S^D),I=O+((F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7))+(T^F&(G^T))+m[N]+p[N],O=T,T=G,G=F,F=k+I>>>0,k=M,M=D,D=S,S=I+(E=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+A)>>>0;f.h0=f.h0+S|0,f.h1=f.h1+D|0,f.h2=f.h2+M|0,f.h3=f.h3+k|0,f.h4=f.h4+F|0,f.h5=f.h5+G|0,f.h6=f.h6+T|0,f.h7=f.h7+O|0,V-=64}}},8985:(Y,K,R)=>{var y=R(8659);R(979),R(4747);var l=Y.exports=y.sha512=y.sha512||{};y.md.sha512=y.md.algorithms.sha512=l;var g=y.sha384=y.sha512.sha384=y.sha512.sha384||{};g.create=function(){return l.create("SHA-384")},y.md.sha384=y.md.algorithms.sha384=g,y.sha512.sha256=y.sha512.sha256||{create:function(){return l.create("SHA-512/256")}},y.md["sha512/256"]=y.md.algorithms["sha512/256"]=y.sha512.sha256,y.sha512.sha224=y.sha512.sha224||{create:function(){return l.create("SHA-512/224")}},y.md["sha512/224"]=y.md.algorithms["sha512/224"]=y.sha512.sha224,l.create=function(w){if(m||function f(){b=String.fromCharCode(128),b+=y.util.fillString(String.fromCharCode(0),128),d=[[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]],(c={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],m=!0}(),typeof w>"u"&&(w="SHA-512"),!(w in c))throw new Error("Invalid SHA-512 algorithm: "+w);for(var I=c[w],E=null,v=y.util.createBuffer(),h=new Array(80),C=0;C<80;++C)h[C]=new Array(2);var A=64;switch(w){case"SHA-384":A=48;break;case"SHA-512/256":A=32;break;case"SHA-512/224":A=28}var N={algorithm:w.replace("-","").toLowerCase(),blockLength:128,digestLength:A,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){N.messageLength=0,N.fullMessageLength=N.messageLength128=[];for(var S=N.messageLengthSize/4,D=0;D<S;++D)N.fullMessageLength.push(0);for(v=y.util.createBuffer(),E=new Array(I.length),D=0;D<I.length;++D)E[D]=I[D].slice(0);return N}};return N.start(),N.update=function(S,D){"utf8"===D&&(S=y.util.encodeUtf8(S));var M=S.length;N.messageLength+=M,M=[M/4294967296>>>0,M>>>0];for(var k=N.fullMessageLength.length-1;k>=0;--k)N.fullMessageLength[k]+=M[1],M[1]=M[0]+(N.fullMessageLength[k]/4294967296>>>0),N.fullMessageLength[k]=N.fullMessageLength[k]>>>0,M[0]=M[1]/4294967296>>>0;return v.putBytes(S),p(E,h,v),(v.read>2048||0===v.length())&&v.compact(),N},N.digest=function(){var S=y.util.createBuffer();S.putBytes(v.bytes()),S.putBytes(b.substr(0,N.blockLength-(N.fullMessageLength[N.fullMessageLength.length-1]+N.messageLengthSize&N.blockLength-1)));for(var k,G=8*N.fullMessageLength[0],T=0;T<N.fullMessageLength.length-1;++T)S.putInt32((G+=(k=8*N.fullMessageLength[T+1])/4294967296>>>0)>>>0),G=k>>>0;S.putInt32(G);var O=new Array(E.length);for(T=0;T<E.length;++T)O[T]=E[T].slice(0);p(O,h,S);var L,V=y.util.createBuffer();for(L="SHA-512"===w?O.length:"SHA-384"===w?O.length-2:O.length-4,T=0;T<L;++T)V.putInt32(O[T][0]),(T!==L-1||"SHA-512/224"!==w)&&V.putInt32(O[T][1]);return V},N};var b=null,m=!1,d=null,c=null;function p(w,I,E){for(var v,h,C,A,O,V,L,H,ne,j,ee,Z,q,te,oe,de,he,Pe,Se,Be,ve,He,ke,nt,Rt,wt,Ft,qt=E.length();qt>=128;){for(ve=0;ve<16;++ve)I[ve][0]=E.getInt32()>>>0,I[ve][1]=E.getInt32()>>>0;for(;ve<80;++ve)h=(((He=(nt=I[ve-2])[0])<<13|(ke=nt[1])>>>19)^(ke<<3|He>>>29)^(He<<26|ke>>>6))>>>0,I[ve][0]=(v=((He>>>19|ke<<13)^(ke>>>29|He<<3)^He>>>6)>>>0)+(Rt=I[ve-7])[0]+(C=(((He=(wt=I[ve-15])[0])>>>1|(ke=wt[1])<<31)^(He>>>8|ke<<24)^He>>>7)>>>0)+(Ft=I[ve-16])[0]+((ke=h+Rt[1]+(A=((He<<31|ke>>>1)^(He<<24|ke>>>8)^(He<<25|ke>>>7))>>>0)+Ft[1])/4294967296>>>0)>>>0,I[ve][1]=ke>>>0;for(O=w[0][0],V=w[0][1],L=w[1][0],H=w[1][1],ne=w[2][0],j=w[2][1],ee=w[3][0],Z=w[3][1],q=w[4][0],te=w[4][1],oe=w[5][0],de=w[5][1],he=w[6][0],Pe=w[6][1],Se=w[7][0],Be=w[7][1],ve=0;ve<80;++ve)v=Se+(((q>>>14|te<<18)^(q>>>18|te<<14)^(te>>>9|q<<23))>>>0)+((he^q&(oe^he))>>>0)+d[ve][0]+I[ve][0]+((ke=Be+(((q<<18|te>>>14)^(q<<14|te>>>18)^(te<<23|q>>>9))>>>0)+((Pe^te&(de^Pe))>>>0)+d[ve][1]+I[ve][1])/4294967296>>>0)>>>0,h=ke>>>0,C=(((O>>>28|V<<4)^(V>>>2|O<<30)^(V>>>7|O<<25))>>>0)+((O&L|ne&(O^L))>>>0)+((ke=(((O<<4|V>>>28)^(V<<30|O>>>2)^(V<<25|O>>>7))>>>0)+((V&H|j&(V^H))>>>0))/4294967296>>>0)>>>0,A=ke>>>0,Se=he,Be=Pe,he=oe,Pe=de,oe=q,de=te,q=ee+v+((ke=Z+h)/4294967296>>>0)>>>0,te=ke>>>0,ee=ne,Z=j,ne=L,j=H,L=O,H=V,O=v+C+((ke=h+A)/4294967296>>>0)>>>0,V=ke>>>0;w[0][0]=w[0][0]+O+((ke=w[0][1]+V)/4294967296>>>0)>>>0,w[0][1]=ke>>>0,w[1][0]=w[1][0]+L+((ke=w[1][1]+H)/4294967296>>>0)>>>0,w[1][1]=ke>>>0,w[2][0]=w[2][0]+ne+((ke=w[2][1]+j)/4294967296>>>0)>>>0,w[2][1]=ke>>>0,w[3][0]=w[3][0]+ee+((ke=w[3][1]+Z)/4294967296>>>0)>>>0,w[3][1]=ke>>>0,w[4][0]=w[4][0]+q+((ke=w[4][1]+te)/4294967296>>>0)>>>0,w[4][1]=ke>>>0,w[5][0]=w[5][0]+oe+((ke=w[5][1]+de)/4294967296>>>0)>>>0,w[5][1]=ke>>>0,w[6][0]=w[6][0]+he+((ke=w[6][1]+Pe)/4294967296>>>0)>>>0,w[6][1]=ke>>>0,w[7][0]=w[7][0]+Se+((ke=w[7][1]+Be)/4294967296>>>0)>>>0,w[7][1]=ke>>>0,qt-=128}}},4747:(Y,K,R)=>{var y=R(8659),l=R(2020),g=Y.exports=y.util=y.util||{};function b(S){if(8!==S&&16!==S&&24!==S&&32!==S)throw new Error("Only 8, 16, 24, or 32 bits supported: "+S)}function m(S){if(this.data="",this.read=0,"string"==typeof S)this.data=S;else if(g.isArrayBuffer(S)||g.isArrayBufferView(S))if(typeof Buffer<"u"&&S instanceof Buffer)this.data=S.toString("binary");else{var D=new Uint8Array(S);try{this.data=String.fromCharCode.apply(null,D)}catch{for(var M=0;M<D.length;++M)this.putByte(D[M])}}else(S instanceof m||"object"==typeof S&&"string"==typeof S.data&&"number"==typeof S.read)&&(this.data=S.data,this.read=S.read);this._constructedStringLength=0}(function(){if(typeof process<"u"&&process.nextTick&&!process.browser)return g.nextTick=process.nextTick,void(g.setImmediate="function"==typeof setImmediate?setImmediate:g.nextTick);if("function"==typeof setImmediate)return g.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(g.nextTick=function(O){return setImmediate(O)});if(g.setImmediate=function(O){setTimeout(O,0)},typeof window<"u"&&"function"==typeof window.postMessage){let O=function(V){if(V.source===window&&V.data===S){V.stopPropagation();var L=D.slice();D.length=0,L.forEach(function(H){H()})}};var S="forge.setImmediate",D=[];g.setImmediate=function(V){D.push(V),1===D.length&&window.postMessage(S,"*")},window.addEventListener("message",O,!0)}if(typeof MutationObserver<"u"){var M=Date.now(),k=!0,F=document.createElement("div");D=[],new MutationObserver(function(){var V=D.slice();D.length=0,V.forEach(function(L){L()})}).observe(F,{attributes:!0});var G=g.setImmediate;g.setImmediate=function(V){Date.now()-M>15?(M=Date.now(),G(V)):(D.push(V),1===D.length&&F.setAttribute("a",k=!k))}}g.nextTick=g.setImmediate})(),g.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,g.globalScope=g.isNodejs?global:typeof self>"u"?window:self,g.isArray=Array.isArray||function(S){return"[object Array]"===Object.prototype.toString.call(S)},g.isArrayBuffer=function(S){return typeof ArrayBuffer<"u"&&S instanceof ArrayBuffer},g.isArrayBufferView=function(S){return S&&g.isArrayBuffer(S.buffer)&&void 0!==S.byteLength},g.ByteBuffer=m,g.ByteStringBuffer=m,g.ByteStringBuffer.prototype._optimizeConstructedString=function(S){this._constructedStringLength+=S,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},g.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},g.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},g.ByteStringBuffer.prototype.putByte=function(S){return this.putBytes(String.fromCharCode(S))},g.ByteStringBuffer.prototype.fillWithByte=function(S,D){S=String.fromCharCode(S);for(var M=this.data;D>0;)1&D&&(M+=S),(D>>>=1)>0&&(S+=S);return this.data=M,this._optimizeConstructedString(D),this},g.ByteStringBuffer.prototype.putBytes=function(S){return this.data+=S,this._optimizeConstructedString(S.length),this},g.ByteStringBuffer.prototype.putString=function(S){return this.putBytes(g.encodeUtf8(S))},g.ByteStringBuffer.prototype.putInt16=function(S){return this.putBytes(String.fromCharCode(S>>8&255)+String.fromCharCode(255&S))},g.ByteStringBuffer.prototype.putInt24=function(S){return this.putBytes(String.fromCharCode(S>>16&255)+String.fromCharCode(S>>8&255)+String.fromCharCode(255&S))},g.ByteStringBuffer.prototype.putInt32=function(S){return this.putBytes(String.fromCharCode(S>>24&255)+String.fromCharCode(S>>16&255)+String.fromCharCode(S>>8&255)+String.fromCharCode(255&S))},g.ByteStringBuffer.prototype.putInt16Le=function(S){return this.putBytes(String.fromCharCode(255&S)+String.fromCharCode(S>>8&255))},g.ByteStringBuffer.prototype.putInt24Le=function(S){return this.putBytes(String.fromCharCode(255&S)+String.fromCharCode(S>>8&255)+String.fromCharCode(S>>16&255))},g.ByteStringBuffer.prototype.putInt32Le=function(S){return this.putBytes(String.fromCharCode(255&S)+String.fromCharCode(S>>8&255)+String.fromCharCode(S>>16&255)+String.fromCharCode(S>>24&255))},g.ByteStringBuffer.prototype.putInt=function(S,D){b(D);var M="";do{D-=8,M+=String.fromCharCode(S>>D&255)}while(D>0);return this.putBytes(M)},g.ByteStringBuffer.prototype.putSignedInt=function(S,D){return S<0&&(S+=2<<D-1),this.putInt(S,D)},g.ByteStringBuffer.prototype.putBuffer=function(S){return this.putBytes(S.getBytes())},g.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},g.ByteStringBuffer.prototype.getInt16=function(){var S=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,S},g.ByteStringBuffer.prototype.getInt24=function(){var S=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,S},g.ByteStringBuffer.prototype.getInt32=function(){var S=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,S},g.ByteStringBuffer.prototype.getInt16Le=function(){var S=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,S},g.ByteStringBuffer.prototype.getInt24Le=function(){var S=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,S},g.ByteStringBuffer.prototype.getInt32Le=function(){var S=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,S},g.ByteStringBuffer.prototype.getInt=function(S){b(S);var D=0;do{D=(D<<8)+this.data.charCodeAt(this.read++),S-=8}while(S>0);return D},g.ByteStringBuffer.prototype.getSignedInt=function(S){var D=this.getInt(S),M=2<<S-2;return D>=M&&(D-=M<<1),D},g.ByteStringBuffer.prototype.getBytes=function(S){var D;return S?(S=Math.min(this.length(),S),D=this.data.slice(this.read,this.read+S),this.read+=S):0===S?D="":(D=0===this.read?this.data:this.data.slice(this.read),this.clear()),D},g.ByteStringBuffer.prototype.bytes=function(S){return typeof S>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+S)},g.ByteStringBuffer.prototype.at=function(S){return this.data.charCodeAt(this.read+S)},g.ByteStringBuffer.prototype.setAt=function(S,D){return this.data=this.data.substr(0,this.read+S)+String.fromCharCode(D)+this.data.substr(this.read+S+1),this},g.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},g.ByteStringBuffer.prototype.copy=function(){var S=g.createBuffer(this.data);return S.read=this.read,S},g.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},g.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},g.ByteStringBuffer.prototype.truncate=function(S){var D=Math.max(0,this.length()-S);return this.data=this.data.substr(this.read,D),this.read=0,this},g.ByteStringBuffer.prototype.toHex=function(){for(var S="",D=this.read;D<this.data.length;++D){var M=this.data.charCodeAt(D);M<16&&(S+="0"),S+=M.toString(16)}return S},g.ByteStringBuffer.prototype.toString=function(){return g.decodeUtf8(this.bytes())},g.DataBuffer=function c(S,D){this.read=(D=D||{}).readOffset||0,this.growSize=D.growSize||1024;var M=g.isArrayBuffer(S),k=g.isArrayBufferView(S);if(M||k)return this.data=M?new DataView(S):new DataView(S.buffer,S.byteOffset,S.byteLength),void(this.write="writeOffset"in D?D.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=S&&this.putBytes(S),"writeOffset"in D&&(this.write=D.writeOffset)},g.DataBuffer.prototype.length=function(){return this.write-this.read},g.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},g.DataBuffer.prototype.accommodate=function(S,D){if(this.length()>=S)return this;D=Math.max(D||this.growSize,S);var M=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),k=new Uint8Array(this.length()+D);return k.set(M),this.data=new DataView(k.buffer),this},g.DataBuffer.prototype.putByte=function(S){return this.accommodate(1),this.data.setUint8(this.write++,S),this},g.DataBuffer.prototype.fillWithByte=function(S,D){this.accommodate(D);for(var M=0;M<D;++M)this.data.setUint8(S);return this},g.DataBuffer.prototype.putBytes=function(S,D){if(g.isArrayBufferView(S)){var k=(M=new Uint8Array(S.buffer,S.byteOffset,S.byteLength)).byteLength-M.byteOffset;return this.accommodate(k),new Uint8Array(this.data.buffer,this.write).set(M),this.write+=k,this}if(g.isArrayBuffer(S)){var M=new Uint8Array(S);return this.accommodate(M.byteLength),new Uint8Array(this.data.buffer).set(M,this.write),this.write+=M.byteLength,this}if(S instanceof g.DataBuffer||"object"==typeof S&&"number"==typeof S.read&&"number"==typeof S.write&&g.isArrayBufferView(S.data))return M=new Uint8Array(S.data.byteLength,S.read,S.length()),this.accommodate(M.byteLength),new Uint8Array(S.data.byteLength,this.write).set(M),this.write+=M.byteLength,this;if(S instanceof g.ByteStringBuffer&&(S=S.data,D="binary"),D=D||"binary","string"==typeof S){var G;if("hex"===D)return this.accommodate(Math.ceil(S.length/2)),G=new Uint8Array(this.data.buffer,this.write),this.write+=g.binary.hex.decode(S,G,this.write),this;if("base64"===D)return this.accommodate(3*Math.ceil(S.length/4)),G=new Uint8Array(this.data.buffer,this.write),this.write+=g.binary.base64.decode(S,G,this.write),this;if("utf8"===D&&(S=g.encodeUtf8(S),D="binary"),"binary"===D||"raw"===D)return this.accommodate(S.length),G=new Uint8Array(this.data.buffer,this.write),this.write+=g.binary.raw.decode(G),this;if("utf16"===D)return this.accommodate(2*S.length),G=new Uint16Array(this.data.buffer,this.write),this.write+=g.text.utf16.encode(G),this;throw new Error("Invalid encoding: "+D)}throw Error("Invalid parameter: "+S)},g.DataBuffer.prototype.putBuffer=function(S){return this.putBytes(S),S.clear(),this},g.DataBuffer.prototype.putString=function(S){return this.putBytes(S,"utf16")},g.DataBuffer.prototype.putInt16=function(S){return this.accommodate(2),this.data.setInt16(this.write,S),this.write+=2,this},g.DataBuffer.prototype.putInt24=function(S){return this.accommodate(3),this.data.setInt16(this.write,S>>8&65535),this.data.setInt8(this.write,S>>16&255),this.write+=3,this},g.DataBuffer.prototype.putInt32=function(S){return this.accommodate(4),this.data.setInt32(this.write,S),this.write+=4,this},g.DataBuffer.prototype.putInt16Le=function(S){return this.accommodate(2),this.data.setInt16(this.write,S,!0),this.write+=2,this},g.DataBuffer.prototype.putInt24Le=function(S){return this.accommodate(3),this.data.setInt8(this.write,S>>16&255),this.data.setInt16(this.write,S>>8&65535,!0),this.write+=3,this},g.DataBuffer.prototype.putInt32Le=function(S){return this.accommodate(4),this.data.setInt32(this.write,S,!0),this.write+=4,this},g.DataBuffer.prototype.putInt=function(S,D){b(D),this.accommodate(D/8);do{D-=8,this.data.setInt8(this.write++,S>>D&255)}while(D>0);return this},g.DataBuffer.prototype.putSignedInt=function(S,D){return b(D),this.accommodate(D/8),S<0&&(S+=2<<D-1),this.putInt(S,D)},g.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},g.DataBuffer.prototype.getInt16=function(){var S=this.data.getInt16(this.read);return this.read+=2,S},g.DataBuffer.prototype.getInt24=function(){var S=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,S},g.DataBuffer.prototype.getInt32=function(){var S=this.data.getInt32(this.read);return this.read+=4,S},g.DataBuffer.prototype.getInt16Le=function(){var S=this.data.getInt16(this.read,!0);return this.read+=2,S},g.DataBuffer.prototype.getInt24Le=function(){var S=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,S},g.DataBuffer.prototype.getInt32Le=function(){var S=this.data.getInt32(this.read,!0);return this.read+=4,S},g.DataBuffer.prototype.getInt=function(S){b(S);var D=0;do{D=(D<<8)+this.data.getInt8(this.read++),S-=8}while(S>0);return D},g.DataBuffer.prototype.getSignedInt=function(S){var D=this.getInt(S),M=2<<S-2;return D>=M&&(D-=M<<1),D},g.DataBuffer.prototype.getBytes=function(S){var D;return S?(S=Math.min(this.length(),S),D=this.data.slice(this.read,this.read+S),this.read+=S):0===S?D="":(D=0===this.read?this.data:this.data.slice(this.read),this.clear()),D},g.DataBuffer.prototype.bytes=function(S){return typeof S>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+S)},g.DataBuffer.prototype.at=function(S){return this.data.getUint8(this.read+S)},g.DataBuffer.prototype.setAt=function(S,D){return this.data.setUint8(S,D),this},g.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},g.DataBuffer.prototype.copy=function(){return new g.DataBuffer(this)},g.DataBuffer.prototype.compact=function(){if(this.read>0){var S=new Uint8Array(this.data.buffer,this.read),D=new Uint8Array(S.byteLength);D.set(S),this.data=new DataView(D),this.write-=this.read,this.read=0}return this},g.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},g.DataBuffer.prototype.truncate=function(S){return this.write=Math.max(0,this.length()-S),this.read=Math.min(this.read,this.write),this},g.DataBuffer.prototype.toHex=function(){for(var S="",D=this.read;D<this.data.byteLength;++D){var M=this.data.getUint8(D);M<16&&(S+="0"),S+=M.toString(16)}return S},g.DataBuffer.prototype.toString=function(S){var D=new Uint8Array(this.data,this.read,this.length());if("binary"===(S=S||"utf8")||"raw"===S)return g.binary.raw.encode(D);if("hex"===S)return g.binary.hex.encode(D);if("base64"===S)return g.binary.base64.encode(D);if("utf8"===S)return g.text.utf8.decode(D);if("utf16"===S)return g.text.utf16.decode(D);throw new Error("Invalid encoding: "+S)},g.createBuffer=function(S,D){return D=D||"raw",void 0!==S&&"utf8"===D&&(S=g.encodeUtf8(S)),new g.ByteBuffer(S)},g.fillString=function(S,D){for(var M="";D>0;)1&D&&(M+=S),(D>>>=1)>0&&(S+=S);return M},g.xorBytes=function(S,D,M){for(var k="",F="",G="",T=0,O=0;M>0;--M,++T)F=S.charCodeAt(T)^D.charCodeAt(T),O>=10&&(k+=G,G="",O=0),G+=String.fromCharCode(F),++O;return k+G},g.hexToBytes=function(S){var D="",M=0;for(!0&S.length&&(M=1,D+=String.fromCharCode(parseInt(S[0],16)));M<S.length;M+=2)D+=String.fromCharCode(parseInt(S.substr(M,2),16));return D},g.bytesToHex=function(S){return g.createBuffer(S).toHex()},g.int32ToBytes=function(S){return String.fromCharCode(S>>24&255)+String.fromCharCode(S>>16&255)+String.fromCharCode(S>>8&255)+String.fromCharCode(255&S)};var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=[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],w="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";g.encode64=function(S,D){for(var F,G,T,M="",k="",O=0;O<S.length;)F=S.charCodeAt(O++),G=S.charCodeAt(O++),T=S.charCodeAt(O++),M+=f.charAt(F>>2),M+=f.charAt((3&F)<<4|G>>4),isNaN(G)?M+="==":(M+=f.charAt((15&G)<<2|T>>6),M+=isNaN(T)?"=":f.charAt(63&T)),D&&M.length>D&&(k+=M.substr(0,D)+"\r\n",M=M.substr(D));return k+M},g.decode64=function(S){S=S.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var M,k,F,G,D="",T=0;T<S.length;)M=p[S.charCodeAt(T++)-43],k=p[S.charCodeAt(T++)-43],F=p[S.charCodeAt(T++)-43],G=p[S.charCodeAt(T++)-43],D+=String.fromCharCode(M<<2|k>>4),64!==F&&(D+=String.fromCharCode((15&k)<<4|F>>2),64!==G&&(D+=String.fromCharCode((3&F)<<6|G)));return D},g.encodeUtf8=function(S){return unescape(encodeURIComponent(S))},g.decodeUtf8=function(S){return decodeURIComponent(escape(S))},g.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:l.encode,decode:l.decode}},g.binary.raw.encode=function(S){return String.fromCharCode.apply(null,S)},g.binary.raw.decode=function(S,D,M){var k=D;k||(k=new Uint8Array(S.length));for(var F=M=M||0,G=0;G<S.length;++G)k[F++]=S.charCodeAt(G);return D?F-M:k},g.binary.hex.encode=g.bytesToHex,g.binary.hex.decode=function(S,D,M){var k=D;k||(k=new Uint8Array(Math.ceil(S.length/2)));var F=0,G=M=M||0;for(1&S.length&&(F=1,k[G++]=parseInt(S[0],16));F<S.length;F+=2)k[G++]=parseInt(S.substr(F,2),16);return D?G-M:k},g.binary.base64.encode=function(S,D){for(var F,G,T,M="",k="",O=0;O<S.byteLength;)F=S[O++],G=S[O++],T=S[O++],M+=f.charAt(F>>2),M+=f.charAt((3&F)<<4|G>>4),isNaN(G)?M+="==":(M+=f.charAt((15&G)<<2|T>>6),M+=isNaN(T)?"=":f.charAt(63&T)),D&&M.length>D&&(k+=M.substr(0,D)+"\r\n",M=M.substr(D));return k+M},g.binary.base64.decode=function(S,D,M){var k=D;k||(k=new Uint8Array(3*Math.ceil(S.length/4))),S=S.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var F,G,T,O,V=0,L=M=M||0;V<S.length;)F=p[S.charCodeAt(V++)-43],G=p[S.charCodeAt(V++)-43],T=p[S.charCodeAt(V++)-43],O=p[S.charCodeAt(V++)-43],k[L++]=F<<2|G>>4,64!==T&&(k[L++]=(15&G)<<4|T>>2,64!==O&&(k[L++]=(3&T)<<6|O));return D?L-M:k.subarray(0,L)},g.binary.base58.encode=function(S,D){return g.binary.baseN.encode(S,w,D)},g.binary.base58.decode=function(S,D){return g.binary.baseN.decode(S,w,D)},g.text={utf8:{},utf16:{}},g.text.utf8.encode=function(S,D,M){S=g.encodeUtf8(S);var k=D;k||(k=new Uint8Array(S.length));for(var F=M=M||0,G=0;G<S.length;++G)k[F++]=S.charCodeAt(G);return D?F-M:k},g.text.utf8.decode=function(S){return g.decodeUtf8(String.fromCharCode.apply(null,S))},g.text.utf16.encode=function(S,D,M){var k=D;k||(k=new Uint8Array(2*S.length));for(var F=new Uint16Array(k.buffer),G=M=M||0,T=M,O=0;O<S.length;++O)F[T++]=S.charCodeAt(O),G+=2;return D?G-M:k},g.text.utf16.decode=function(S){return String.fromCharCode.apply(null,new Uint16Array(S.buffer))},g.deflate=function(S,D,M){if(D=g.decode64(S.deflate(g.encode64(D)).rval),M){var k=2;32&D.charCodeAt(1)&&(k=6),D=D.substring(k,D.length-4)}return D},g.inflate=function(S,D,M){var k=S.inflate(g.encode64(D)).rval;return null===k?null:g.decode64(k)};var I=function(S,D,M){if(!S)throw new Error("WebStorage not available.");var k;if(null===M?k=S.removeItem(D):(M=g.encode64(JSON.stringify(M)),k=S.setItem(D,M)),typeof k<"u"&&!0!==k.rval){var F=new Error(k.error.message);throw F.id=k.error.id,F.name=k.error.name,F}},E=function(S,D){if(!S)throw new Error("WebStorage not available.");var M=S.getItem(D);if(S.init)if(null===M.rval){if(M.error){var k=new Error(M.error.message);throw k.id=M.error.id,k.name=M.error.name,k}M=null}else M=M.rval;return null!==M&&(M=JSON.parse(g.decode64(M))),M},v=function(S,D,M,k){var F=E(S,D);null===F&&(F={}),F[M]=k,I(S,D,F)},h=function(S,D,M){var k=E(S,D);return null!==k&&(k=M in k?k[M]:null),k},C=function(S,D,M){var k=E(S,D);if(null!==k&&M in k){delete k[M];var F=!0;for(var G in k){F=!1;break}F&&(k=null),I(S,D,k)}},A=function(S,D){I(S,D,null)},N=function(S,D,M){var k=null;typeof M>"u"&&(M=["web","flash"]);var F,G=!1,T=null;for(var O in M){F=M[O];try{if("flash"===F||"both"===F){if(null===D[0])throw new Error("Flash local storage not available.");k=S.apply(this,D),G="flash"===F}("web"===F||"both"===F)&&(D[0]=localStorage,k=S.apply(this,D),G=!0)}catch(V){T=V}if(G)break}if(!G)throw T;return k};g.setItem=function(S,D,M,k,F){N(v,arguments,F)},g.getItem=function(S,D,M,k){return N(h,arguments,k)},g.removeItem=function(S,D,M,k){N(C,arguments,k)},g.clearItems=function(S,D,M){N(A,arguments,M)},g.isEmpty=function(S){for(var D in S)if(S.hasOwnProperty(D))return!1;return!0},g.format=function(S){for(var M,k,D=/%./g,F=0,G=[],T=0;M=D.exec(S);){(k=S.substring(T,D.lastIndex-2)).length>0&&G.push(k),T=D.lastIndex;var O=M[0][1];switch(O){case"s":case"o":G.push(F<arguments.length?arguments[1+F++]:"<?>");break;case"%":G.push("%");break;default:G.push("<%"+O+"?>")}}return G.push(S.substring(T)),G.join("")},g.formatNumber=function(S,D,M,k){var F=S,G=isNaN(D=Math.abs(D))?2:D,T=void 0===M?",":M,O=void 0===k?".":k,V=F<0?"-":"",L=parseInt(F=Math.abs(+F||0).toFixed(G),10)+"",H=L.length>3?L.length%3:0;return V+(H?L.substr(0,H)+O:"")+L.substr(H).replace(/(\d{3})(?=\d)/g,"$1"+O)+(G?T+Math.abs(F-L).toFixed(G).slice(2):"")},g.formatSize=function(S){return S>=1073741824?g.formatNumber(S/1073741824,2,".","")+" GiB":S>=1048576?g.formatNumber(S/1048576,2,".","")+" MiB":S>=1024?g.formatNumber(S/1024,0)+" KiB":g.formatNumber(S,0)+" bytes"},g.bytesFromIP=function(S){return-1!==S.indexOf(".")?g.bytesFromIPv4(S):-1!==S.indexOf(":")?g.bytesFromIPv6(S):null},g.bytesFromIPv4=function(S){if(4!==(S=S.split(".")).length)return null;for(var D=g.createBuffer(),M=0;M<S.length;++M){var k=parseInt(S[M],10);if(isNaN(k))return null;D.putByte(k)}return D.getBytes()},g.bytesFromIPv6=function(S){for(var D=0,M=2*(8-(S=S.split(":").filter(function(T){return 0===T.length&&++D,!0})).length+D),k=g.createBuffer(),F=0;F<8;++F)if(S[F]&&0!==S[F].length){var G=g.hexToBytes(S[F]);G.length<2&&k.putByte(0),k.putBytes(G)}else k.fillWithByte(0,M),M=0;return k.getBytes()},g.bytesToIP=function(S){return 4===S.length?g.bytesToIPv4(S):16===S.length?g.bytesToIPv6(S):null},g.bytesToIPv4=function(S){if(4!==S.length)return null;for(var D=[],M=0;M<S.length;++M)D.push(S.charCodeAt(M));return D.join(".")},g.bytesToIPv6=function(S){if(16!==S.length)return null;for(var D=[],M=[],k=0,F=0;F<S.length;F+=2){for(var G=g.bytesToHex(S[F]+S[F+1]);"0"===G[0]&&"0"!==G;)G=G.substr(1);if("0"===G){var T=M[M.length-1],O=D.length;T&&O===T.end+1?(T.end=O,T.end-T.start>M[k].end-M[k].start&&(k=M.length-1)):M.push({start:O,end:O})}D.push(G)}if(M.length>0){var V=M[k];V.end-V.start>0&&(D.splice(V.start,V.end-V.start+1,""),0===V.start&&D.unshift(""),7===V.end&&D.push(""))}return D.join(":")},g.estimateCores=function(S,D){if("function"==typeof S&&(D=S,S={}),S=S||{},"cores"in g&&!S.update)return D(null,g.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return g.cores=navigator.hardwareConcurrency,D(null,g.cores);if(typeof Worker>"u")return g.cores=1,D(null,g.cores);if(typeof Blob>"u")return g.cores=2,D(null,g.cores);var M=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(T){for(var O=Date.now(),V=O+4;Date.now()<V;);self.postMessage({st:O,et:V})})}.toString(),")()"],{type:"application/javascript"}));!function k(T,O,V){if(0===O){var L=Math.floor(T.reduce(function(H,ne){return H+ne},0)/T.length);return g.cores=Math.max(1,L),URL.revokeObjectURL(M),D(null,g.cores)}!function F(T,O){for(var V=[],L=[],H=0;H<T;++H){var ne=new Worker(M);ne.addEventListener("message",function(j){if(L.push(j.data),L.length===T){for(var ee=0;ee<T;++ee)V[ee].terminate();O(null,L)}}),V.push(ne)}for(H=0;H<T;++H)V[H].postMessage(H)}(V,function(H,ne){T.push(function G(T,O){for(var V=[],L=0;L<T;++L)for(var H=O[L],ne=V[L]=[],j=0;j<T;++j)if(L!==j){var ee=O[j];(H.st>ee.st&&H.st<ee.et||ee.st>H.st&&ee.st<H.et)&&ne.push(j)}return V.reduce(function(Z,q){return Math.max(Z,q.length)},0)}(V,ne)),k(T,O-1,V)})}([],5,16)}},5911:(Y,K,R)=>{var y=R(8659);R(1298),R(7791),R(279),R(979),R(9386),R(6078),R(8604),R(7256),R(5517),R(4747);var l=y.asn1,g=Y.exports=y.pki=y.pki||{},b=g.oids,m={};m.CN=b.commonName,m.commonName="CN",m.C=b.countryName,m.countryName="C",m.L=b.localityName,m.localityName="L",m.ST=b.stateOrProvinceName,m.stateOrProvinceName="ST",m.O=b.organizationName,m.organizationName="O",m.OU=b.organizationalUnitName,m.organizationalUnitName="OU",m.E=b.emailAddress,m.emailAddress="E";var d=y.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},d,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},f={name:"rsapss",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},w={name:"CertificationRequest",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},d,{name:"CertificationRequestInfo.attributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function I(T,O){"string"==typeof O&&(O={shortName:O});for(var L,V=null,H=0;null===V&&H<T.attributes.length;++H)L=T.attributes[H],(O.type&&O.type===L.type||O.name&&O.name===L.name||O.shortName&&O.shortName===L.shortName)&&(V=L);return V}g.RDNAttributesAsArray=function(T,O){for(var L,H,ne,V=[],j=0;j<T.value.length;++j){L=T.value[j];for(var ee=0;ee<L.value.length;++ee)(ne={}).type=l.derToOid((H=L.value[ee]).value[0].value),ne.value=H.value[1].value,ne.valueTagClass=H.value[1].type,ne.type in b&&(ne.name=b[ne.type],ne.name in m&&(ne.shortName=m[ne.name])),O&&(O.update(ne.type),O.update(ne.value)),V.push(ne)}return V},g.CRIAttributesAsArray=function(T){for(var O=[],V=0;V<T.length;++V)for(var L=T[V],H=l.derToOid(L.value[0].value),ne=L.value[1].value,j=0;j<ne.length;++j){var ee={};if(ee.type=H,ee.value=ne[j].value,ee.valueTagClass=ne[j].type,ee.type in b&&(ee.name=b[ee.type],ee.name in m&&(ee.shortName=m[ee.name])),ee.type===b.extensionRequest){ee.extensions=[];for(var Z=0;Z<ee.value.length;++Z)ee.extensions.push(g.certificateExtensionFromAsn1(ee.value[Z]))}O.push(ee)}return O};var E=function(T,O,V){var L={};if(T!==b["RSASSA-PSS"])return L;V&&(L={hash:{algorithmOid:b.sha1},mgf:{algorithmOid:b.mgf1,hash:{algorithmOid:b.sha1}},saltLength:20});var H={},ne=[];if(!l.validate(O,f,H,ne)){var j=new Error("Cannot read RSASSA-PSS parameter block.");throw j.errors=ne,j}return void 0!==H.hashOid&&(L.hash=L.hash||{},L.hash.algorithmOid=l.derToOid(H.hashOid)),void 0!==H.maskGenOid&&(L.mgf=L.mgf||{},L.mgf.algorithmOid=l.derToOid(H.maskGenOid),L.mgf.hash=L.mgf.hash||{},L.mgf.hash.algorithmOid=l.derToOid(H.maskGenHashOid)),void 0!==H.saltLength&&(L.saltLength=H.saltLength.charCodeAt(0)),L},v=function(T){switch(b[T.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return y.md.sha1.create();case"md5WithRSAEncryption":return y.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return y.md.sha256.create();case"sha384WithRSAEncryption":return y.md.sha384.create();case"sha512WithRSAEncryption":return y.md.sha512.create();default:var O=new Error("Could not compute "+T.type+" digest. Unknown signature OID.");throw O.signatureOid=T.signatureOid,O}},h=function(T){var V,O=T.certificate;switch(O.signatureOid){case b.sha1WithRSAEncryption:case b.sha1WithRSASignature:break;case b["RSASSA-PSS"]:var L,H,ne;if(void 0===(L=b[O.signatureParameters.mgf.hash.algorithmOid])||void 0===y.md[L])throw(ne=new Error("Unsupported MGF hash function.")).oid=O.signatureParameters.mgf.hash.algorithmOid,ne.name=L,ne;if(void 0===(H=b[O.signatureParameters.mgf.algorithmOid])||void 0===y.mgf[H])throw(ne=new Error("Unsupported MGF function.")).oid=O.signatureParameters.mgf.algorithmOid,ne.name=H,ne;if(H=y.mgf[H].create(y.md[L].create()),void 0===(L=b[O.signatureParameters.hash.algorithmOid])||void 0===y.md[L])throw(ne=new Error("Unsupported RSASSA-PSS hash function.")).oid=O.signatureParameters.hash.algorithmOid,ne.name=L,ne;V=y.pss.create(y.md[L].create(),H,O.signatureParameters.saltLength)}return O.publicKey.verify(T.md.digest().getBytes(),T.signature,V)};function C(T){for(var V,L,O=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),H=T.attributes,ne=0;ne<H.length;++ne){var j=(V=H[ne]).value,ee=l.Type.PRINTABLESTRING;"valueTagClass"in V&&(ee=V.valueTagClass)===l.Type.UTF8&&(j=y.util.encodeUtf8(j)),L=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(V.type).getBytes()),l.create(l.Class.UNIVERSAL,ee,!1,j)])]),O.value.push(L)}return O}function N(T){for(var O,V=0;V<T.length;++V){if(typeof(O=T[V]).name>"u"&&(O.type&&O.type in g.oids?O.name=g.oids[O.type]:O.shortName&&O.shortName in m&&(O.name=g.oids[m[O.shortName]])),typeof O.type>"u"){if(!O.name||!(O.name in g.oids))throw(L=new Error("Attribute type not specified.")).attribute=O,L;O.type=g.oids[O.name]}if(typeof O.shortName>"u"&&O.name&&O.name in m&&(O.shortName=m[O.name]),O.type===b.extensionRequest&&(O.valueConstructed=!0,O.valueTagClass=l.Type.SEQUENCE,!O.value&&O.extensions)){O.value=[];for(var H=0;H<O.extensions.length;++H)O.value.push(g.certificateExtensionToAsn1(S(O.extensions[H])))}var L;if(typeof O.value>"u")throw(L=new Error("Attribute value not specified.")).attribute=O,L}}function S(T,O){if(O=O||{},typeof T.name>"u"&&T.id&&T.id in g.oids&&(T.name=g.oids[T.id]),typeof T.id>"u"){if(!T.name||!(T.name in g.oids))throw(V=new Error("Extension ID not specified.")).extension=T,V;T.id=g.oids[T.name]}if(typeof T.value<"u")return T;if("keyUsage"===T.name){var L=0,H=0,ne=0;T.digitalSignature&&(H|=128,L=7),T.nonRepudiation&&(H|=64,L=6),T.keyEncipherment&&(H|=32,L=5),T.dataEncipherment&&(H|=16,L=4),T.keyAgreement&&(H|=8,L=3),T.keyCertSign&&(H|=4,L=2),T.cRLSign&&(H|=2,L=1),T.encipherOnly&&(H|=1,L=0),T.decipherOnly&&(ne|=128,L=7);var j=String.fromCharCode(L);0!==ne?j+=String.fromCharCode(H)+String.fromCharCode(ne):0!==H&&(j+=String.fromCharCode(H)),T.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,j)}else if("basicConstraints"===T.name)T.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),T.cA&&T.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in T&&T.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(T.pathLenConstraint).getBytes()));else if("extKeyUsage"===T.name){T.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var ee=T.value.value;for(var Z in T)!0===T[Z]&&(Z in b?ee.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(b[Z]).getBytes())):-1!==Z.indexOf(".")&&ee.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(Z).getBytes())))}else if("nsCertType"===T.name)L=0,H=0,T.client&&(H|=128,L=7),T.server&&(H|=64,L=6),T.email&&(H|=32,L=5),T.objsign&&(H|=16,L=4),T.reserved&&(H|=8,L=3),T.sslCA&&(H|=4,L=2),T.emailCA&&(H|=2,L=1),T.objCA&&(H|=1,L=0),j=String.fromCharCode(L),0!==H&&(j+=String.fromCharCode(H)),T.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,j);else if("subjectAltName"===T.name||"issuerAltName"===T.name){T.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var te=0;te<T.altNames.length;++te){if(j=(q=T.altNames[te]).value,7===q.type&&q.ip){if(null===(j=y.util.bytesFromIP(q.ip)))throw(V=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=T,V}else 8===q.type&&(j=l.oidToDer(q.oid?l.oidToDer(q.oid):j));T.value.value.push(l.create(l.Class.CONTEXT_SPECIFIC,q.type,!1,j))}}else if("nsComment"===T.name&&O.cert){if(!/^[\x00-\x7F]*$/.test(T.comment)||T.comment.length<1||T.comment.length>128)throw new Error('Invalid "nsComment" content.');T.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,T.comment)}else if("subjectKeyIdentifier"===T.name&&O.cert){var oe=O.cert.generateSubjectKeyIdentifier();T.subjectKeyIdentifier=oe.toHex(),T.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,oe.getBytes())}else if("authorityKeyIdentifier"===T.name&&O.cert){if(T.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),ee=T.value.value,T.keyIdentifier){var de=!0===T.keyIdentifier?O.cert.generateSubjectKeyIdentifier().getBytes():T.keyIdentifier;ee.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,de))}if(T.authorityCertIssuer){var he=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[C(!0===T.authorityCertIssuer?O.cert.issuer:T.authorityCertIssuer)])];ee.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,he))}if(T.serialNumber){var Pe=y.util.hexToBytes(!0===T.serialNumber?O.cert.serialNumber:T.serialNumber);ee.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,Pe))}}else if("cRLDistributionPoints"===T.name){T.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),ee=T.value.value;var q,Se=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),Be=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);for(te=0;te<T.altNames.length;++te){if(j=(q=T.altNames[te]).value,7===q.type&&q.ip){if(null===(j=y.util.bytesFromIP(q.ip)))throw(V=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=T,V}else 8===q.type&&(j=l.oidToDer(q.oid?l.oidToDer(q.oid):j));Be.value.push(l.create(l.Class.CONTEXT_SPECIFIC,q.type,!1,j))}Se.value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[Be])),ee.push(Se)}var V;if(typeof T.value>"u")throw(V=new Error("Extension value not specified.")).extension=T,V;return T}function D(T,O){if(T===b["RSASSA-PSS"]){var V=[];return void 0!==O.hash.algorithmOid&&V.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(O.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])),void 0!==O.mgf.algorithmOid&&V.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(O.mgf.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(O.mgf.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])])),void 0!==O.saltLength&&V.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(O.saltLength).getBytes())])),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,V)}return l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")}function M(T){var O=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===T.attributes.length)return O;for(var V=T.attributes,L=0;L<V.length;++L){var H=V[L],ne=H.value,j=l.Type.UTF8;"valueTagClass"in H&&(j=H.valueTagClass),j===l.Type.UTF8&&(ne=y.util.encodeUtf8(ne));var ee=!1;"valueConstructed"in H&&(ee=H.valueConstructed);var Z=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(H.type).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,j,ee,ne)])]);O.value.push(Z)}return O}g.certificateFromPem=function(T,O,V){var L=y.pem.decode(T)[0];if("CERTIFICATE"!==L.type&&"X509 CERTIFICATE"!==L.type&&"TRUSTED CERTIFICATE"!==L.type){var H=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw H.headerType=L.type,H}if(L.procType&&"ENCRYPTED"===L.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var ne=l.fromDer(L.body,V);return g.certificateFromAsn1(ne,O)},g.certificateToPem=function(T,O){var V={type:"CERTIFICATE",body:l.toDer(g.certificateToAsn1(T)).getBytes()};return y.pem.encode(V,{maxline:O})},g.publicKeyFromPem=function(T){var O=y.pem.decode(T)[0];if("PUBLIC KEY"!==O.type&&"RSA PUBLIC KEY"!==O.type){var V=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw V.headerType=O.type,V}if(O.procType&&"ENCRYPTED"===O.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var L=l.fromDer(O.body);return g.publicKeyFromAsn1(L)},g.publicKeyToPem=function(T,O){var V={type:"PUBLIC KEY",body:l.toDer(g.publicKeyToAsn1(T)).getBytes()};return y.pem.encode(V,{maxline:O})},g.publicKeyToRSAPublicKeyPem=function(T,O){var V={type:"RSA PUBLIC KEY",body:l.toDer(g.publicKeyToRSAPublicKey(T)).getBytes()};return y.pem.encode(V,{maxline:O})},g.getPublicKeyFingerprint=function(T,O){var H,V=(O=O||{}).md||y.md.sha1.create();switch(O.type||"RSAPublicKey"){case"RSAPublicKey":H=l.toDer(g.publicKeyToRSAPublicKey(T)).getBytes();break;case"SubjectPublicKeyInfo":H=l.toDer(g.publicKeyToAsn1(T)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+O.type+'".')}V.start(),V.update(H);var ne=V.digest();if("hex"===O.encoding){var j=ne.toHex();return O.delimiter?j.match(/.{2}/g).join(O.delimiter):j}if("binary"===O.encoding)return ne.getBytes();if(O.encoding)throw new Error('Unknown encoding "'+O.encoding+'".');return ne},g.certificationRequestFromPem=function(T,O,V){var L=y.pem.decode(T)[0];if("CERTIFICATE REQUEST"!==L.type){var H=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw H.headerType=L.type,H}if(L.procType&&"ENCRYPTED"===L.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var ne=l.fromDer(L.body,V);return g.certificationRequestFromAsn1(ne,O)},g.certificationRequestToPem=function(T,O){var V={type:"CERTIFICATE REQUEST",body:l.toDer(g.certificationRequestToAsn1(T)).getBytes()};return y.pem.encode(V,{maxline:O})},g.createCertificate=function(){var T={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return T.siginfo.algorithmOid=null,T.validity={},T.validity.notBefore=new Date,T.validity.notAfter=new Date,T.issuer={},T.issuer.getField=function(O){return I(T.issuer,O)},T.issuer.addField=function(O){N([O]),T.issuer.attributes.push(O)},T.issuer.attributes=[],T.issuer.hash=null,T.subject={},T.subject.getField=function(O){return I(T.subject,O)},T.subject.addField=function(O){N([O]),T.subject.attributes.push(O)},T.subject.attributes=[],T.subject.hash=null,T.extensions=[],T.publicKey=null,T.md=null,T.setSubject=function(O,V){N(O),T.subject.attributes=O,delete T.subject.uniqueId,V&&(T.subject.uniqueId=V),T.subject.hash=null},T.setIssuer=function(O,V){N(O),T.issuer.attributes=O,delete T.issuer.uniqueId,V&&(T.issuer.uniqueId=V),T.issuer.hash=null},T.setExtensions=function(O){for(var V=0;V<O.length;++V)S(O[V],{cert:T});T.extensions=O},T.getExtension=function(O){"string"==typeof O&&(O={name:O});for(var L,V=null,H=0;null===V&&H<T.extensions.length;++H)L=T.extensions[H],(O.id&&L.id===O.id||O.name&&L.name===O.name)&&(V=L);return V},T.sign=function(O,V){T.md=V||y.md.sha1.create();var L=b[T.md.algorithm+"WithRSAEncryption"];if(!L){var H=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw H.algorithm=T.md.algorithm,H}T.signatureOid=T.siginfo.algorithmOid=L,T.tbsCertificate=g.getTBSCertificate(T);var ne=l.toDer(T.tbsCertificate);T.md.update(ne.getBytes()),T.signature=O.sign(T.md)},T.verify=function(O){var V=!1;if(!T.issued(O)){var L=O.issuer,H=T.subject,ne=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw ne.expectedIssuer=H.attributes,ne.actualIssuer=L.attributes,ne}var j=O.md;if(null===j){j=v({signatureOid:O.signatureOid,type:"certificate"});var ee=O.tbsCertificate||g.getTBSCertificate(O),Z=l.toDer(ee);j.update(Z.getBytes())}return null!==j&&(V=h({certificate:T,md:j,signature:O.signature})),V},T.isIssuer=function(O){var V=!1,L=T.issuer,H=O.subject;if(L.hash&&H.hash)V=L.hash===H.hash;else if(L.attributes.length===H.attributes.length){V=!0;for(var ne,j,ee=0;V&&ee<L.attributes.length;++ee)((ne=L.attributes[ee]).type!==(j=H.attributes[ee]).type||ne.value!==j.value)&&(V=!1)}return V},T.issued=function(O){return O.isIssuer(T)},T.generateSubjectKeyIdentifier=function(){return g.getPublicKeyFingerprint(T.publicKey,{type:"RSAPublicKey"})},T.verifySubjectKeyIdentifier=function(){for(var O=b.subjectKeyIdentifier,V=0;V<T.extensions.length;++V){var L=T.extensions[V];if(L.id===O){var H=T.generateSubjectKeyIdentifier().getBytes();return y.util.hexToBytes(L.subjectKeyIdentifier)===H}}return!1},T},g.certificateFromAsn1=function(T,O){var V={},L=[];if(!l.validate(T,c,V,L)){var H=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw H.errors=L,H}if(l.derToOid(V.publicKeyOid)!==g.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var j=g.createCertificate();j.version=V.certVersion?V.certVersion.charCodeAt(0):0;var ee=y.util.createBuffer(V.certSerialNumber);j.serialNumber=ee.toHex(),j.signatureOid=y.asn1.derToOid(V.certSignatureOid),j.signatureParameters=E(j.signatureOid,V.certSignatureParams,!0),j.siginfo.algorithmOid=y.asn1.derToOid(V.certinfoSignatureOid),j.siginfo.parameters=E(j.siginfo.algorithmOid,V.certinfoSignatureParams,!1),j.signature=V.certSignature;var Z=[];if(void 0!==V.certValidity1UTCTime&&Z.push(l.utcTimeToDate(V.certValidity1UTCTime)),void 0!==V.certValidity2GeneralizedTime&&Z.push(l.generalizedTimeToDate(V.certValidity2GeneralizedTime)),void 0!==V.certValidity3UTCTime&&Z.push(l.utcTimeToDate(V.certValidity3UTCTime)),void 0!==V.certValidity4GeneralizedTime&&Z.push(l.generalizedTimeToDate(V.certValidity4GeneralizedTime)),Z.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(Z.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(j.validity.notBefore=Z[0],j.validity.notAfter=Z[1],j.tbsCertificate=V.tbsCertificate,O){j.md=v({signatureOid:j.signatureOid,type:"certificate"});var q=l.toDer(j.tbsCertificate);j.md.update(q.getBytes())}var te=y.md.sha1.create(),oe=l.toDer(V.certIssuer);te.update(oe.getBytes()),j.issuer.getField=function(Pe){return I(j.issuer,Pe)},j.issuer.addField=function(Pe){N([Pe]),j.issuer.attributes.push(Pe)},j.issuer.attributes=g.RDNAttributesAsArray(V.certIssuer),V.certIssuerUniqueId&&(j.issuer.uniqueId=V.certIssuerUniqueId),j.issuer.hash=te.digest().toHex();var de=y.md.sha1.create(),he=l.toDer(V.certSubject);return de.update(he.getBytes()),j.subject.getField=function(Pe){return I(j.subject,Pe)},j.subject.addField=function(Pe){N([Pe]),j.subject.attributes.push(Pe)},j.subject.attributes=g.RDNAttributesAsArray(V.certSubject),V.certSubjectUniqueId&&(j.subject.uniqueId=V.certSubjectUniqueId),j.subject.hash=de.digest().toHex(),j.extensions=V.certExtensions?g.certificateExtensionsFromAsn1(V.certExtensions):[],j.publicKey=g.publicKeyFromAsn1(V.subjectPublicKeyInfo),j},g.certificateExtensionsFromAsn1=function(T){for(var O=[],V=0;V<T.value.length;++V)for(var L=T.value[V],H=0;H<L.value.length;++H)O.push(g.certificateExtensionFromAsn1(L.value[H]));return O},g.certificateExtensionFromAsn1=function(T){var O={};if(O.id=l.derToOid(T.value[0].value),O.critical=!1,T.value[1].type===l.Type.BOOLEAN?(O.critical=0!==T.value[1].value.charCodeAt(0),O.value=T.value[2].value):O.value=T.value[1].value,O.id in b)if(O.name=b[O.id],"keyUsage"===O.name){var L=0,H=0;(V=l.fromDer(O.value)).value.length>1&&(L=V.value.charCodeAt(1),H=V.value.length>2?V.value.charCodeAt(2):0),O.digitalSignature=128==(128&L),O.nonRepudiation=64==(64&L),O.keyEncipherment=32==(32&L),O.dataEncipherment=16==(16&L),O.keyAgreement=8==(8&L),O.keyCertSign=4==(4&L),O.cRLSign=2==(2&L),O.encipherOnly=1==(1&L),O.decipherOnly=128==(128&H)}else if("basicConstraints"===O.name){var V=l.fromDer(O.value);O.cA=V.value.length>0&&V.value[0].type===l.Type.BOOLEAN&&0!==V.value[0].value.charCodeAt(0);var ne=null;V.value.length>0&&V.value[0].type===l.Type.INTEGER?ne=V.value[0].value:V.value.length>1&&(ne=V.value[1].value),null!==ne&&(O.pathLenConstraint=l.derToInteger(ne))}else if("extKeyUsage"===O.name){V=l.fromDer(O.value);for(var j=0;j<V.value.length;++j){var ee=l.derToOid(V.value[j].value);ee in b?O[b[ee]]=!0:O[ee]=!0}}else if("nsCertType"===O.name)L=0,(V=l.fromDer(O.value)).value.length>1&&(L=V.value.charCodeAt(1)),O.client=128==(128&L),O.server=64==(64&L),O.email=32==(32&L),O.objsign=16==(16&L),O.reserved=8==(8&L),O.sslCA=4==(4&L),O.emailCA=2==(2&L),O.objCA=1==(1&L);else if("subjectAltName"===O.name||"issuerAltName"===O.name){O.altNames=[],V=l.fromDer(O.value);for(var Z,q=0;q<V.value.length;++q){var te={type:(Z=V.value[q]).type,value:Z.value};switch(O.altNames.push(te),Z.type){case 1:case 2:case 6:break;case 7:te.ip=y.util.bytesToIP(Z.value);break;case 8:te.oid=l.derToOid(Z.value)}}}else"subjectKeyIdentifier"===O.name&&(V=l.fromDer(O.value),O.subjectKeyIdentifier=y.util.bytesToHex(V.value));return O},g.certificationRequestFromAsn1=function(T,O){var V={},L=[];if(!l.validate(T,w,V,L)){var H=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw H.errors=L,H}if(l.derToOid(V.publicKeyOid)!==g.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var j=g.createCertificationRequest();if(j.version=V.csrVersion?V.csrVersion.charCodeAt(0):0,j.signatureOid=y.asn1.derToOid(V.csrSignatureOid),j.signatureParameters=E(j.signatureOid,V.csrSignatureParams,!0),j.siginfo.algorithmOid=y.asn1.derToOid(V.csrSignatureOid),j.siginfo.parameters=E(j.siginfo.algorithmOid,V.csrSignatureParams,!1),j.signature=V.csrSignature,j.certificationRequestInfo=V.certificationRequestInfo,O){j.md=v({signatureOid:j.signatureOid,type:"certification request"});var ee=l.toDer(j.certificationRequestInfo);j.md.update(ee.getBytes())}var Z=y.md.sha1.create();return j.subject.getField=function(q){return I(j.subject,q)},j.subject.addField=function(q){N([q]),j.subject.attributes.push(q)},j.subject.attributes=g.RDNAttributesAsArray(V.certificationRequestInfoSubject,Z),j.subject.hash=Z.digest().toHex(),j.publicKey=g.publicKeyFromAsn1(V.subjectPublicKeyInfo),j.getAttribute=function(q){return I(j,q)},j.addAttribute=function(q){N([q]),j.attributes.push(q)},j.attributes=g.CRIAttributesAsArray(V.certificationRequestInfoAttributes||[]),j},g.createCertificationRequest=function(){var T={version:0,signatureOid:null,signature:null,siginfo:{}};return T.siginfo.algorithmOid=null,T.subject={},T.subject.getField=function(O){return I(T.subject,O)},T.subject.addField=function(O){N([O]),T.subject.attributes.push(O)},T.subject.attributes=[],T.subject.hash=null,T.publicKey=null,T.attributes=[],T.getAttribute=function(O){return I(T,O)},T.addAttribute=function(O){N([O]),T.attributes.push(O)},T.md=null,T.setSubject=function(O){N(O),T.subject.attributes=O,T.subject.hash=null},T.setAttributes=function(O){N(O),T.attributes=O},T.sign=function(O,V){T.md=V||y.md.sha1.create();var L=b[T.md.algorithm+"WithRSAEncryption"];if(!L){var H=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw H.algorithm=T.md.algorithm,H}T.signatureOid=T.siginfo.algorithmOid=L,T.certificationRequestInfo=g.getCertificationRequestInfo(T);var ne=l.toDer(T.certificationRequestInfo);T.md.update(ne.getBytes()),T.signature=O.sign(T.md)},T.verify=function(){var O=!1,V=T.md;if(null===V){V=v({signatureOid:T.signatureOid,type:"certification request"});var L=T.certificationRequestInfo||g.getCertificationRequestInfo(T),H=l.toDer(L);V.update(H.getBytes())}return null!==V&&(O=h({certificate:T,md:V,signature:T.signature})),O},T};var k=new Date("1950-01-01T00:00:00Z"),F=new Date("2050-01-01T00:00:00Z");function G(T){return T>=k&&T<F?l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(T)):l.create(l.Class.UNIVERSAL,l.Type.GENERALIZEDTIME,!1,l.dateToGeneralizedTime(T))}g.getTBSCertificate=function(T){var O=G(T.validity.notBefore),V=G(T.validity.notAfter),L=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(T.version).getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,y.util.hexToBytes(T.serialNumber)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(T.siginfo.algorithmOid).getBytes()),D(T.siginfo.algorithmOid,T.siginfo.parameters)]),C(T.issuer),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[O,V]),C(T.subject),g.publicKeyToAsn1(T.publicKey)]);return T.issuer.uniqueId&&L.value.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+T.issuer.uniqueId)])),T.subject.uniqueId&&L.value.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+T.subject.uniqueId)])),T.extensions.length>0&&L.value.push(g.certificateExtensionsToAsn1(T.extensions)),L},g.getCertificationRequestInfo=function(T){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(T.version).getBytes()),C(T.subject),g.publicKeyToAsn1(T.publicKey),M(T)])},g.distinguishedNameToAsn1=function(T){return C(T)},g.certificateToAsn1=function(T){var O=T.tbsCertificate||g.getTBSCertificate(T);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[O,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(T.signatureOid).getBytes()),D(T.signatureOid,T.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+T.signature)])},g.certificateExtensionsToAsn1=function(T){var O=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),V=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);O.value.push(V);for(var L=0;L<T.length;++L)V.value.push(g.certificateExtensionToAsn1(T[L]));return O},g.certificateExtensionToAsn1=function(T){var O=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);O.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(T.id).getBytes())),T.critical&&O.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255)));var V=T.value;return"string"!=typeof T.value&&(V=l.toDer(V).getBytes()),O.value.push(l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,V)),O},g.certificationRequestToAsn1=function(T){var O=T.certificationRequestInfo||g.getCertificationRequestInfo(T);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[O,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(T.signatureOid).getBytes()),D(T.signatureOid,T.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+T.signature)])},g.createCaStore=function(T){var O={certs:{}};function V(j){return L(j),O.certs[j.hash]||null}function L(j){if(!j.hash){var ee=y.md.sha1.create();j.attributes=g.RDNAttributesAsArray(C(j),ee),j.hash=ee.digest().toHex()}}if(O.getIssuer=function(j){return V(j.issuer)},O.addCertificate=function(j){if("string"==typeof j&&(j=y.pki.certificateFromPem(j)),L(j.subject),!O.hasCertificate(j))if(j.subject.hash in O.certs){var ee=O.certs[j.subject.hash];y.util.isArray(ee)||(ee=[ee]),ee.push(j),O.certs[j.subject.hash]=ee}else O.certs[j.subject.hash]=j},O.hasCertificate=function(j){"string"==typeof j&&(j=y.pki.certificateFromPem(j));var ee=V(j.subject);if(!ee)return!1;y.util.isArray(ee)||(ee=[ee]);for(var Z=l.toDer(g.certificateToAsn1(j)).getBytes(),q=0;q<ee.length;++q)if(Z===l.toDer(g.certificateToAsn1(ee[q])).getBytes())return!0;return!1},O.listAllCertificates=function(){var j=[];for(var ee in O.certs)if(O.certs.hasOwnProperty(ee)){var Z=O.certs[ee];if(y.util.isArray(Z))for(var q=0;q<Z.length;++q)j.push(Z[q]);else j.push(Z)}return j},O.removeCertificate=function(j){var ee;if("string"==typeof j&&(j=y.pki.certificateFromPem(j)),L(j.subject),!O.hasCertificate(j))return null;var Z=V(j.subject);if(!y.util.isArray(Z))return ee=O.certs[j.subject.hash],delete O.certs[j.subject.hash],ee;for(var q=l.toDer(g.certificateToAsn1(j)).getBytes(),te=0;te<Z.length;++te)q===l.toDer(g.certificateToAsn1(Z[te])).getBytes()&&(ee=Z[te],Z.splice(te,1));return 0===Z.length&&delete O.certs[j.subject.hash],ee},T)for(var H=0;H<T.length;++H)O.addCertificate(T[H]);return O},g.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},g.verifyCertificateChain=function(T,O,V){"function"==typeof V&&(V={verify:V}),V=V||{};var L=(O=O.slice(0)).slice(0),H=V.validityCheckDate;typeof H>"u"&&(H=new Date);var ne=!0,j=null,ee=0;do{var Z=O.shift(),q=null,te=!1;if(H&&(H<Z.validity.notBefore||H>Z.validity.notAfter)&&(j={message:"Certificate is not valid yet or has expired.",error:g.certificateError.certificate_expired,notBefore:Z.validity.notBefore,notAfter:Z.validity.notAfter,now:H}),null===j){if(null===(q=O[0]||T.getIssuer(Z))&&Z.isIssuer(Z)&&(te=!0,q=Z),q){var oe=q;y.util.isArray(oe)||(oe=[oe]);for(var de=!1;!de&&oe.length>0;){q=oe.shift();try{de=q.verify(Z)}catch{}}de||(j={message:"Certificate signature is invalid.",error:g.certificateError.bad_certificate})}null===j&&(!q||te)&&!T.hasCertificate(Z)&&(j={message:"Certificate is not trusted.",error:g.certificateError.unknown_ca})}if(null===j&&q&&!Z.isIssuer(q)&&(j={message:"Certificate issuer is invalid.",error:g.certificateError.bad_certificate}),null===j)for(var he={keyUsage:!0,basicConstraints:!0},Pe=0;null===j&&Pe<Z.extensions.length;++Pe){var Se=Z.extensions[Pe];Se.critical&&!(Se.name in he)&&(j={message:"Certificate has an unsupported critical extension.",error:g.certificateError.unsupported_certificate})}if(null===j&&(!ne||0===O.length&&(!q||te))){var Be=Z.getExtension("basicConstraints"),ve=Z.getExtension("keyUsage");null!==ve&&(!ve.keyCertSign||null===Be)&&(j={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:g.certificateError.bad_certificate}),null===j&&null!==Be&&!Be.cA&&(j={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:g.certificateError.bad_certificate}),null===j&&null!==ve&&"pathLenConstraint"in Be&&ee-1>Be.pathLenConstraint&&(j={message:"Certificate basicConstraints pathLenConstraint violated.",error:g.certificateError.bad_certificate})}var ke=null===j||j.error,nt=V.verify?V.verify(ke,ee,L):ke;if(!0!==nt)throw!0===ke&&(j={message:"The application rejected the certificate.",error:g.certificateError.bad_certificate}),(nt||0===nt)&&("object"!=typeof nt||y.util.isArray(nt)?"string"==typeof nt&&(j.error=nt):(nt.message&&(j.message=nt.message),nt.error&&(j.error=nt.error))),j;j=null,ne=!1,++ee}while(O.length>0);return!0}},8614:(Y,K,R)=>{const y=R(1159),l=R(281);Y.exports=class{constructor(){this._buffer=new y,this._waitingConsumers=new y}push(b){const{promise:m,resolve:d}=l();return this._buffer.push({chunk:b,resolve:d}),this._consume(),m}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const b=this._waitingConsumers.shift(),m=this._buffer.shift();b.resolve(m.chunk),m.resolve()}}shift(){const{promise:b,resolve:m}=l();return this._waitingConsumers.push({resolve:m}),this._consume(),b}isEmpty(){return this._buffer.isEmpty()}}},281:Y=>{"use strict";Y.exports=()=>{const R={};return R.promise=new Promise((y,l)=>{R.resolve=y,R.reject=l}),R}},3863:(Y,K,R)=>{"use strict";Y.exports=R(2540)},4599:Y=>{"use strict";Y.exports=R;var y,K=/\/|\./;function R(l,g){K.test(l)||(l="google/protobuf/"+l+".proto",g={nested:{google:{nested:{protobuf:{nested:g}}}}}),R[l]=g}R("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),R("duration",{Duration:y={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),R("timestamp",{Timestamp:y}),R("empty",{Empty:{fields:{}}}),R("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),R("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),R("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),R.get=function(g){return R[g]||null}},6533:(Y,K,R)=>{"use strict";var y=K,l=R(4269),g=R(8572);function b(d,c,f,p){var w=!1;if(c.resolvedType)if(c.resolvedType instanceof l){d("switch(d%s){",p);for(var I=c.resolvedType.values,E=Object.keys(I),v=0;v<E.length;++v)I[E[v]]===c.typeDefault&&!w&&(d("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',p,p,p),c.repeated||d("break"),w=!0),d("case%j:",E[v])("case %i:",I[E[v]])("m%s=%j",p,I[E[v]])("break");d("}")}else d('if(typeof d%s!=="object")',p)("throw TypeError(%j)",c.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",p,f,p);else{var h=!1;switch(c.type){case"double":case"float":d("m%s=Number(d%s)",p,p);break;case"uint32":case"fixed32":d("m%s=d%s>>>0",p,p);break;case"int32":case"sint32":case"sfixed32":d("m%s=d%s|0",p,p);break;case"uint64":h=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":d("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",p,p,h)('else if(typeof d%s==="string")',p)("m%s=parseInt(d%s,10)",p,p)('else if(typeof d%s==="number")',p)("m%s=d%s",p,p)('else if(typeof d%s==="object")',p)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",p,p,p,h?"true":"");break;case"bytes":d('if(typeof d%s==="string")',p)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",p,p,p)("else if(d%s.length >= 0)",p)("m%s=d%s",p,p);break;case"string":d("m%s=String(d%s)",p,p);break;case"bool":d("m%s=Boolean(d%s)",p,p)}}return d}function m(d,c,f,p){if(c.resolvedType)c.resolvedType instanceof l?d("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",p,f,p,p,f,p,p):d("d%s=types[%i].toObject(m%s,o)",p,f,p);else{var w=!1;switch(c.type){case"double":case"float":d("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",p,p,p,p);break;case"uint64":w=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":d('if(typeof m%s==="number")',p)("d%s=o.longs===String?String(m%s):m%s",p,p,p)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",p,p,p,p,w?"true":"",p);break;case"bytes":d("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",p,p,p,p,p);break;default:d("d%s=m%s",p,p)}}return d}y.fromObject=function(c){var f=c.fieldsArray,p=g.codegen(["d"],c.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!f.length)return p("return new this.ctor");p("var m=new this.ctor");for(var w=0;w<f.length;++w){var I=f[w].resolve(),E=g.safeProp(I.name);I.map?(p("if(d%s){",E)('if(typeof d%s!=="object")',E)("throw TypeError(%j)",I.fullName+": object expected")("m%s={}",E)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",E),b(p,I,w,E+"[ks[i]]")("}")("}")):I.repeated?(p("if(d%s){",E)("if(!Array.isArray(d%s))",E)("throw TypeError(%j)",I.fullName+": array expected")("m%s=[]",E)("for(var i=0;i<d%s.length;++i){",E),b(p,I,w,E+"[i]")("}")("}")):(I.resolvedType instanceof l||p("if(d%s!=null){",E),b(p,I,w,E),I.resolvedType instanceof l||p("}"))}return p("return m")},y.toObject=function(c){var f=c.fieldsArray.slice().sort(g.compareFieldsById);if(!f.length)return g.codegen()("return {}");for(var p=g.codegen(["m","o"],c.name+"$toObject")("if(!o)")("o={}")("var d={}"),w=[],I=[],E=[],v=0;v<f.length;++v)f[v].partOf||(f[v].resolve().repeated?w:f[v].map?I:E).push(f[v]);if(w.length){for(p("if(o.arrays||o.defaults){"),v=0;v<w.length;++v)p("d%s=[]",g.safeProp(w[v].name));p("}")}if(I.length){for(p("if(o.objects||o.defaults){"),v=0;v<I.length;++v)p("d%s={}",g.safeProp(I[v].name));p("}")}if(E.length){for(p("if(o.defaults){"),v=0;v<E.length;++v){var C=g.safeProp((h=E[v]).name);if(h.resolvedType instanceof l)p("d%s=o.enums===String?%j:%j",C,h.resolvedType.valuesById[h.typeDefault],h.typeDefault);else if(h.long)p("if(util.Long){")("var n=new util.Long(%i,%i,%j)",h.typeDefault.low,h.typeDefault.high,h.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",C)("}else")("d%s=o.longs===String?%j:%i",C,h.typeDefault.toString(),h.typeDefault.toNumber());else if(h.bytes){var A="["+Array.prototype.slice.call(h.typeDefault).join(",")+"]";p("if(o.bytes===String)d%s=%j",C,String.fromCharCode.apply(String,h.typeDefault))("else{")("d%s=%s",C,A)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",C,C)("}")}else p("d%s=%j",C,h.typeDefault)}p("}")}var N=!1;for(v=0;v<f.length;++v){var h,S=c._fieldsArray.indexOf(h=f[v]);C=g.safeProp(h.name),h.map?(N||(N=!0,p("var ks2")),p("if(m%s&&(ks2=Object.keys(m%s)).length){",C,C)("d%s={}",C)("for(var j=0;j<ks2.length;++j){"),m(p,h,S,C+"[ks2[j]]")("}")):h.repeated?(p("if(m%s&&m%s.length){",C,C)("d%s=[]",C)("for(var j=0;j<m%s.length;++j){",C),m(p,h,S,C+"[j]")("}")):(p("if(m%s!=null&&m.hasOwnProperty(%j)){",C,h.name),m(p,h,S,C),h.partOf&&p("if(o.oneofs)")("d%s=%j",g.safeProp(h.partOf.name),h.name)),p("}")}return p("return d")}},225:(Y,K,R)=>{"use strict";Y.exports=function m(d){var c=g.codegen(["r","l"],d.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(d.fieldsArray.filter(function(v){return v.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");d.group&&c("if((t&7)===4)")("break"),c("switch(t>>>3){");for(var f=0;f<d.fieldsArray.length;++f){var p=d._fieldsArray[f].resolve(),w=p.resolvedType instanceof y?"int32":p.type,I="m"+g.safeProp(p.name);c("case %i: {",p.id),p.map?(c("if(%s===util.emptyObject)",I)("%s={}",I)("var c2 = r.uint32()+r.pos"),void 0!==l.defaults[p.keyType]?c("k=%j",l.defaults[p.keyType]):c("k=null"),void 0!==l.defaults[w]?c("value=%j",l.defaults[w]):c("value=null"),c("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",p.keyType)("case 2:"),void 0===l.basic[w]?c("value=types[%i].decode(r,r.uint32())",f):c("value=r.%s()",w),c("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),c(void 0!==l.long[p.keyType]?'%s[typeof k==="object"?util.longToHash(k):k]=value':"%s[k]=value",I)):p.repeated?(c("if(!(%s&&%s.length))",I,I)("%s=[]",I),void 0!==l.packed[w]&&c("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",I,w)("}else"),void 0===l.basic[w]?c(p.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",I,f):c("%s.push(r.%s())",I,w)):void 0===l.basic[w]?c(p.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",I,f):c("%s=r.%s()",I,w),c("break")("}")}for(c("default:")("r.skipType(t&7)")("break")("}")("}"),f=0;f<d._fieldsArray.length;++f){var E=d._fieldsArray[f];E.required&&c("if(!m.hasOwnProperty(%j))",E.name)("throw util.ProtocolError(%j,{instance:m})",b(E))}return c("return m")};var y=R(4269),l=R(688),g=R(8572);function b(d){return"missing required '"+d.name+"'"}},133:(Y,K,R)=>{"use strict";Y.exports=function m(d){for(var p,c=g.codegen(["m","w"],d.name+"$encode")("if(!w)")("w=Writer.create()"),w=d.fieldsArray.slice().sort(g.compareFieldsById),f=0;f<w.length;++f){var I=w[f].resolve(),E=d._fieldsArray.indexOf(I),v=I.resolvedType instanceof y?"int32":I.type,h=l.basic[v];p="m"+g.safeProp(I.name),I.map?(c("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",p,I.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",p)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(I.id<<3|2)>>>0,8|l.mapKey[I.keyType],I.keyType),void 0===h?c("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",E,p):c(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|h,v,p),c("}")("}")):I.repeated?(c("if(%s!=null&&%s.length){",p,p),I.packed&&void 0!==l.packed[v]?c("w.uint32(%i).fork()",(I.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",p)("w.%s(%s[i])",v,p)("w.ldelim()"):(c("for(var i=0;i<%s.length;++i)",p),void 0===h?b(c,I,E,p+"[i]"):c("w.uint32(%i).%s(%s[i])",(I.id<<3|h)>>>0,v,p)),c("}")):(I.optional&&c("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",p,I.name),void 0===h?b(c,I,E,p):c("w.uint32(%i).%s(%s)",(I.id<<3|h)>>>0,v,p))}return c("return w")};var y=R(4269),l=R(688),g=R(8572);function b(d,c,f,p){return c.resolvedType.group?d("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",f,p,(c.id<<3|3)>>>0,(c.id<<3|4)>>>0):d("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",f,p,(c.id<<3|2)>>>0)}},4269:(Y,K,R)=>{"use strict";Y.exports=b;var y=R(9487);((b.prototype=Object.create(y.prototype)).constructor=b).className="Enum";var l=R(326),g=R(8572);function b(m,d,c,f,p,w){if(y.call(this,m,c),d&&"object"!=typeof d)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=f,this.comments=p||{},this.valuesOptions=w,this.reserved=void 0,d)for(var I=Object.keys(d),E=0;E<I.length;++E)"number"==typeof d[I[E]]&&(this.valuesById[this.values[I[E]]=d[I[E]]]=I[E])}b.fromJSON=function(d,c){var f=new b(d,c.values,c.options,c.comment,c.comments);return f.reserved=c.reserved,f},b.prototype.toJSON=function(d){var c=!!d&&Boolean(d.keepComments);return g.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",c?this.comment:void 0,"comments",c?this.comments:void 0])},b.prototype.add=function(d,c,f,p){if(!g.isString(d))throw TypeError("name must be a string");if(!g.isInteger(c))throw TypeError("id must be an integer");if(void 0!==this.values[d])throw Error("duplicate name '"+d+"' in "+this);if(this.isReservedId(c))throw Error("id "+c+" is reserved in "+this);if(this.isReservedName(d))throw Error("name '"+d+"' is reserved in "+this);if(void 0!==this.valuesById[c]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+c+" in "+this);this.values[d]=c}else this.valuesById[this.values[d]=c]=d;return p&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[d]=p||null),this.comments[d]=f||null,this},b.prototype.remove=function(d){if(!g.isString(d))throw TypeError("name must be a string");var c=this.values[d];if(null==c)throw Error("name '"+d+"' does not exist in "+this);return delete this.valuesById[c],delete this.values[d],delete this.comments[d],this.valuesOptions&&delete this.valuesOptions[d],this},b.prototype.isReservedId=function(d){return l.isReservedId(this.reserved,d)},b.prototype.isReservedName=function(d){return l.isReservedName(this.reserved,d)}},2986:(Y,K,R)=>{"use strict";Y.exports=c;var y=R(9487);((c.prototype=Object.create(y.prototype)).constructor=c).className="Field";var m,l=R(4269),g=R(688),b=R(8572),d=/^required|optional|repeated$/;function c(f,p,w,I,E,v,h){if(b.isObject(I)?(h=E,v=I,I=E=void 0):b.isObject(E)&&(h=v,v=E,E=void 0),y.call(this,f,v),!b.isInteger(p)||p<0)throw TypeError("id must be a non-negative integer");if(!b.isString(w))throw TypeError("type must be a string");if(void 0!==I&&!d.test(I=I.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==E&&!b.isString(E))throw TypeError("extend must be a string");"proto3_optional"===I&&(I="optional"),this.rule=I&&"optional"!==I?I:void 0,this.type=w,this.id=p,this.extend=E||void 0,this.required="required"===I,this.optional=!this.required,this.repeated="repeated"===I,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!b.Long&&void 0!==g.long[w],this.bytes="bytes"===w,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=h}c.fromJSON=function(p,w){return new c(p,w.id,w.type,w.rule,w.extend,w.options,w.comment)},Object.defineProperty(c.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),c.prototype.setOption=function(p,w,I){return"packed"===p&&(this._packed=null),y.prototype.setOption.call(this,p,w,I)},c.prototype.toJSON=function(p){var w=!!p&&Boolean(p.keepComments);return b.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",w?this.comment:void 0])},c.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=g.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.typeDefault=this.resolvedType instanceof m?null:this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof l&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((!0===this.options.packed||void 0!==this.options.packed&&this.resolvedType&&!(this.resolvedType instanceof l))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=b.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var p;b.base64.test(this.typeDefault)?b.base64.decode(this.typeDefault,p=b.newBuffer(b.base64.length(this.typeDefault)),0):b.utf8.write(this.typeDefault,p=b.newBuffer(b.utf8.length(this.typeDefault)),0),this.typeDefault=p}return this.defaultValue=this.map?b.emptyObject:this.repeated?b.emptyArray:this.typeDefault,this.parent instanceof m&&(this.parent.ctor.prototype[this.name]=this.defaultValue),y.prototype.resolve.call(this)},c.d=function(p,w,I,E){return"function"==typeof w?w=b.decorateType(w).name:w&&"object"==typeof w&&(w=b.decorateEnum(w).name),function(h,C){b.decorateType(h.constructor).add(new c(C,p,w,I,{default:E}))}},c._configure=function(p){m=p}},5803:(Y,K,R)=>{"use strict";var y=Y.exports=R(95);y.build="light",y.load=function l(b,m,d){return"function"==typeof m?(d=m,m=new y.Root):m||(m=new y.Root),m.load(b,d)},y.loadSync=function g(b,m){return m||(m=new y.Root),m.loadSync(b)},y.encoder=R(133),y.decoder=R(225),y.verifier=R(8617),y.converter=R(6533),y.ReflectionObject=R(9487),y.Namespace=R(326),y.Root=R(5257),y.Enum=R(4269),y.Type=R(7845),y.Field=R(2986),y.OneOf=R(7397),y.MapField=R(9455),y.Service=R(9630),y.Method=R(1618),y.Message=R(1413),y.wrappers=R(761),y.types=R(688),y.util=R(8572),y.ReflectionObject._configure(y.Root),y.Namespace._configure(y.Type,y.Service,y.Enum),y.Root._configure(y.Type),y.Field._configure(y.Type)},95:(Y,K,R)=>{"use strict";var y=K;function l(){y.util._configure(),y.Writer._configure(y.BufferWriter),y.Reader._configure(y.BufferReader)}y.build="minimal",y.Writer=R(1650),y.BufferWriter=R(813),y.Reader=R(7270),y.BufferReader=R(4354),y.util=R(7211),y.rpc=R(7830),y.roots=R(6671),y.configure=l,l()},2540:(Y,K,R)=>{"use strict";var y=Y.exports=R(5803);y.build="full",y.tokenize=R(691),y.parse=R(8992),y.common=R(4599),y.Root._configure(y.Type,y.parse,y.common)},9455:(Y,K,R)=>{"use strict";Y.exports=b;var y=R(2986);((b.prototype=Object.create(y.prototype)).constructor=b).className="MapField";var l=R(688),g=R(8572);function b(m,d,c,f,p,w){if(y.call(this,m,d,f,void 0,void 0,p,w),!g.isString(c))throw TypeError("keyType must be a string");this.keyType=c,this.resolvedKeyType=null,this.map=!0}b.fromJSON=function(d,c){return new b(d,c.id,c.keyType,c.type,c.options,c.comment)},b.prototype.toJSON=function(d){var c=!!d&&Boolean(d.keepComments);return g.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",c?this.comment:void 0])},b.prototype.resolve=function(){if(this.resolved)return this;if(void 0===l.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return y.prototype.resolve.call(this)},b.d=function(d,c,f){return"function"==typeof f?f=g.decorateType(f).name:f&&"object"==typeof f&&(f=g.decorateEnum(f).name),function(w,I){g.decorateType(w.constructor).add(new b(I,d,c,f))}}},1413:(Y,K,R)=>{"use strict";Y.exports=l;var y=R(7211);function l(g){if(g)for(var b=Object.keys(g),m=0;m<b.length;++m)this[b[m]]=g[b[m]]}l.create=function(b){return this.$type.create(b)},l.encode=function(b,m){return this.$type.encode(b,m)},l.encodeDelimited=function(b,m){return this.$type.encodeDelimited(b,m)},l.decode=function(b){return this.$type.decode(b)},l.decodeDelimited=function(b){return this.$type.decodeDelimited(b)},l.verify=function(b){return this.$type.verify(b)},l.fromObject=function(b){return this.$type.fromObject(b)},l.toObject=function(b,m){return this.$type.toObject(b,m)},l.prototype.toJSON=function(){return this.$type.toObject(this,y.toJSONOptions)}},1618:(Y,K,R)=>{"use strict";Y.exports=g;var y=R(9487);((g.prototype=Object.create(y.prototype)).constructor=g).className="Method";var l=R(8572);function g(b,m,d,c,f,p,w,I,E){if(l.isObject(f)?(w=f,f=p=void 0):l.isObject(p)&&(w=p,p=void 0),void 0!==m&&!l.isString(m))throw TypeError("type must be a string");if(!l.isString(d))throw TypeError("requestType must be a string");if(!l.isString(c))throw TypeError("responseType must be a string");y.call(this,b,w),this.type=m||"rpc",this.requestType=d,this.requestStream=!!f||void 0,this.responseType=c,this.responseStream=!!p||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=I,this.parsedOptions=E}g.fromJSON=function(m,d){return new g(m,d.type,d.requestType,d.responseType,d.requestStream,d.responseStream,d.options,d.comment,d.parsedOptions)},g.prototype.toJSON=function(m){var d=!!m&&Boolean(m.keepComments);return l.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",d?this.comment:void 0,"parsedOptions",this.parsedOptions])},g.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),y.prototype.resolve.call(this))}},326:(Y,K,R)=>{"use strict";Y.exports=p;var y=R(9487);((p.prototype=Object.create(y.prototype)).constructor=p).className="Namespace";var m,d,c,l=R(2986),g=R(8572),b=R(7397);function f(I,E){if(I&&I.length){for(var v={},h=0;h<I.length;++h)v[I[h].name]=I[h].toJSON(E);return v}}function p(I,E){y.call(this,I,E),this.nested=void 0,this._nestedArray=null}function w(I){return I._nestedArray=null,I}p.fromJSON=function(E,v){return new p(E,v.options).addJSON(v.nested)},p.arrayToJSON=f,p.isReservedId=function(E,v){if(E)for(var h=0;h<E.length;++h)if("string"!=typeof E[h]&&E[h][0]<=v&&E[h][1]>v)return!0;return!1},p.isReservedName=function(E,v){if(E)for(var h=0;h<E.length;++h)if(E[h]===v)return!0;return!1},Object.defineProperty(p.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=g.toArray(this.nested))}}),p.prototype.toJSON=function(E){return g.toObject(["options",this.options,"nested",f(this.nestedArray,E)])},p.prototype.addJSON=function(E){if(E)for(var A,h=Object.keys(E),C=0;C<h.length;++C)this.add((void 0!==(A=E[h[C]]).fields?m.fromJSON:void 0!==A.values?c.fromJSON:void 0!==A.methods?d.fromJSON:void 0!==A.id?l.fromJSON:p.fromJSON)(h[C],A));return this},p.prototype.get=function(E){return this.nested&&this.nested[E]||null},p.prototype.getEnum=function(E){if(this.nested&&this.nested[E]instanceof c)return this.nested[E].values;throw Error("no such enum: "+E)},p.prototype.add=function(E){if(!(E instanceof l&&void 0!==E.extend||E instanceof m||E instanceof b||E instanceof c||E instanceof d||E instanceof p))throw TypeError("object must be a valid nested object");if(this.nested){var v=this.get(E.name);if(v){if(!(v instanceof p&&E instanceof p)||v instanceof m||v instanceof d)throw Error("duplicate name '"+E.name+"' in "+this);for(var h=v.nestedArray,C=0;C<h.length;++C)E.add(h[C]);this.remove(v),this.nested||(this.nested={}),E.setOptions(v.options,!0)}}else this.nested={};return this.nested[E.name]=E,E.onAdd(this),w(this)},p.prototype.remove=function(E){if(!(E instanceof y))throw TypeError("object must be a ReflectionObject");if(E.parent!==this)throw Error(E+" is not a member of "+this);return delete this.nested[E.name],Object.keys(this.nested).length||(this.nested=void 0),E.onRemove(this),w(this)},p.prototype.define=function(E,v){if(g.isString(E))E=E.split(".");else if(!Array.isArray(E))throw TypeError("illegal path");if(E&&E.length&&""===E[0])throw Error("path must be relative");for(var h=this;E.length>0;){var C=E.shift();if(h.nested&&h.nested[C]){if(!((h=h.nested[C])instanceof p))throw Error("path conflicts with non-namespace objects")}else h.add(h=new p(C))}return v&&h.addJSON(v),h},p.prototype.resolveAll=function(){for(var E=this.nestedArray,v=0;v<E.length;)E[v]instanceof p?E[v++].resolveAll():E[v++].resolve();return this.resolve()},p.prototype.lookup=function(E,v,h){if("boolean"==typeof v?(h=v,v=void 0):v&&!Array.isArray(v)&&(v=[v]),g.isString(E)&&E.length){if("."===E)return this.root;E=E.split(".")}else if(!E.length)return this;if(""===E[0])return this.root.lookup(E.slice(1),v);var C=this.get(E[0]);if(C){if(1===E.length){if(!v||v.indexOf(C.constructor)>-1)return C}else if(C instanceof p&&(C=C.lookup(E.slice(1),v,!0)))return C}else for(var A=0;A<this.nestedArray.length;++A)if(this._nestedArray[A]instanceof p&&(C=this._nestedArray[A].lookup(E,v,!0)))return C;return null===this.parent||h?null:this.parent.lookup(E,v)},p.prototype.lookupType=function(E){var v=this.lookup(E,[m]);if(!v)throw Error("no such type: "+E);return v},p.prototype.lookupEnum=function(E){var v=this.lookup(E,[c]);if(!v)throw Error("no such Enum '"+E+"' in "+this);return v},p.prototype.lookupTypeOrEnum=function(E){var v=this.lookup(E,[m,c]);if(!v)throw Error("no such Type or Enum '"+E+"' in "+this);return v},p.prototype.lookupService=function(E){var v=this.lookup(E,[d]);if(!v)throw Error("no such Service '"+E+"' in "+this);return v},p._configure=function(I,E,v){m=I,d=E,c=v}},9487:(Y,K,R)=>{"use strict";Y.exports=g,g.className="ReflectionObject";var l,y=R(8572);function g(b,m){if(!y.isString(b))throw TypeError("name must be a string");if(m&&!y.isObject(m))throw TypeError("options must be an object");this.options=m,this.parsedOptions=null,this.name=b,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(g.prototype,{root:{get:function(){for(var b=this;null!==b.parent;)b=b.parent;return b}},fullName:{get:function(){for(var b=[this.name],m=this.parent;m;)b.unshift(m.name),m=m.parent;return b.join(".")}}}),g.prototype.toJSON=function(){throw Error()},g.prototype.onAdd=function(m){this.parent&&this.parent!==m&&this.parent.remove(this),this.parent=m,this.resolved=!1;var d=m.root;d instanceof l&&d._handleAdd(this)},g.prototype.onRemove=function(m){var d=m.root;d instanceof l&&d._handleRemove(this),this.parent=null,this.resolved=!1},g.prototype.resolve=function(){return this.resolved||this.root instanceof l&&(this.resolved=!0),this},g.prototype.getOption=function(m){if(this.options)return this.options[m]},g.prototype.setOption=function(m,d,c){return(!c||!this.options||void 0===this.options[m])&&((this.options||(this.options={}))[m]=d),this},g.prototype.setParsedOption=function(m,d,c){this.parsedOptions||(this.parsedOptions=[]);var f=this.parsedOptions;if(c){var p=f.find(function(E){return Object.prototype.hasOwnProperty.call(E,m)});p?y.setProperty(p[m],c,d):((p={})[m]=y.setProperty({},c,d),f.push(p))}else{var I={};I[m]=d,f.push(I)}return this},g.prototype.setOptions=function(m,d){if(m)for(var c=Object.keys(m),f=0;f<c.length;++f)this.setOption(c[f],m[c[f]],d);return this},g.prototype.toString=function(){var m=this.constructor.className,d=this.fullName;return d.length?m+" "+d:m},g._configure=function(b){l=b}},7397:(Y,K,R)=>{"use strict";Y.exports=b;var y=R(9487);((b.prototype=Object.create(y.prototype)).constructor=b).className="OneOf";var l=R(2986),g=R(8572);function b(d,c,f,p){if(Array.isArray(c)||(f=c,c=void 0),y.call(this,d,f),void 0!==c&&!Array.isArray(c))throw TypeError("fieldNames must be an Array");this.oneof=c||[],this.fieldsArray=[],this.comment=p}function m(d){if(d.parent)for(var c=0;c<d.fieldsArray.length;++c)d.fieldsArray[c].parent||d.parent.add(d.fieldsArray[c])}b.fromJSON=function(c,f){return new b(c,f.oneof,f.options,f.comment)},b.prototype.toJSON=function(c){var f=!!c&&Boolean(c.keepComments);return g.toObject(["options",this.options,"oneof",this.oneof,"comment",f?this.comment:void 0])},b.prototype.add=function(c){if(!(c instanceof l))throw TypeError("field must be a Field");return c.parent&&c.parent!==this.parent&&c.parent.remove(c),this.oneof.push(c.name),this.fieldsArray.push(c),c.partOf=this,m(this),this},b.prototype.remove=function(c){if(!(c instanceof l))throw TypeError("field must be a Field");var f=this.fieldsArray.indexOf(c);if(f<0)throw Error(c+" is not a member of "+this);return this.fieldsArray.splice(f,1),(f=this.oneof.indexOf(c.name))>-1&&this.oneof.splice(f,1),c.partOf=null,this},b.prototype.onAdd=function(c){y.prototype.onAdd.call(this,c);for(var p=0;p<this.oneof.length;++p){var w=c.get(this.oneof[p]);w&&!w.partOf&&(w.partOf=this,this.fieldsArray.push(w))}m(this)},b.prototype.onRemove=function(c){for(var p,f=0;f<this.fieldsArray.length;++f)(p=this.fieldsArray[f]).parent&&p.parent.remove(p);y.prototype.onRemove.call(this,c)},b.d=function(){for(var c=new Array(arguments.length),f=0;f<arguments.length;)c[f]=arguments[f++];return function(w,I){g.decorateType(w.constructor).add(new b(I,c)),Object.defineProperty(w,I,{get:g.oneOfGetter(c),set:g.oneOfSetter(c)})}}},8992:(Y,K,R)=>{"use strict";Y.exports=F,F.filename=null,F.defaults={keepCase:!1};var y=R(691),l=R(5257),g=R(7845),b=R(2986),m=R(9455),d=R(7397),c=R(4269),f=R(9630),p=R(1618),w=R(688),I=R(8572),E=/^[1-9][0-9]*$/,v=/^-?[1-9][0-9]*$/,h=/^0[x][0-9a-fA-F]+$/,C=/^-?0[x][0-9a-fA-F]+$/,A=/^0[0-7]+$/,N=/^-?0[0-7]+$/,S=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,D=/^[a-zA-Z_][a-zA-Z_0-9]*$/,M=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,k=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function F(G,T,O){T instanceof l||(O=T,T=new l),O||(O=F.defaults);var te,oe,de,he,Fe,V=O.preferTrailingComment||!1,L=y(G,O.alternateCommentMode||!1),H=L.next,ne=L.push,j=L.peek,ee=L.skip,Z=L.cmnt,q=!0,Pe=!1,Se=T,Be=O.keepCase?function(Ee){return Ee}:I.camelCase;function ve(Ee,pe,we){var Le=F.filename;return we||(F.filename=null),Error("illegal "+(pe||"token")+" '"+Ee+"' ("+(Le?Le+", ":"")+"line "+L.line+")")}function He(){var pe,Ee=[];do{if('"'!==(pe=H())&&"'"!==pe)throw ve(pe);Ee.push(H()),ee(pe),pe=j()}while('"'===pe||"'"===pe);return Ee.join("")}function ke(Ee){var pe=H();switch(pe){case"'":case'"':return ne(pe),He();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function Rt(Ee,pe){var we=1;switch("-"===Ee.charAt(0)&&(we=-1,Ee=Ee.substring(1)),Ee){case"inf":case"INF":case"Inf":return we*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(E.test(Ee))return we*parseInt(Ee,10);if(h.test(Ee))return we*parseInt(Ee,16);if(A.test(Ee))return we*parseInt(Ee,8);if(S.test(Ee))return we*parseFloat(Ee);throw ve(Ee,"number",pe)}(pe,!0)}catch{if(Ee&&M.test(pe))return pe;throw ve(pe,"value")}}function nt(Ee,pe){var we,Le;do{!pe||'"'!==(we=j())&&"'"!==we?Ee.push([Le=wt(H()),ee("to",!0)?wt(H()):Le]):Ee.push(He())}while(ee(",",!0));ee(";")}function wt(Ee,pe){switch(Ee){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!pe&&"-"===Ee.charAt(0))throw ve(Ee,"id");if(v.test(Ee))return parseInt(Ee,10);if(C.test(Ee))return parseInt(Ee,16);if(N.test(Ee))return parseInt(Ee,8);throw ve(Ee,"id")}function Ft(){if(void 0!==te)throw ve("package");if(te=H(),!M.test(te))throw ve(te,"name");Se=Se.define(te),ee(";")}function qt(){var pe,Ee=j();switch(Ee){case"weak":pe=de||(de=[]),H();break;case"public":H();default:pe=oe||(oe=[])}Ee=He(),ee(";"),pe.push(Ee)}function Jt(){if(ee("="),he=He(),!(Pe="proto3"===he)&&"proto2"!==he)throw ve(he,"syntax");ee(";")}function rn(Ee,pe){switch(pe){case"option":return ge(Ee,pe),ee(";"),!0;case"message":return Rr(Ee,pe),!0;case"enum":return ie(Ee,pe),!0;case"service":return function Ge(Ee,pe){if(!D.test(pe=H()))throw ve(pe,"service name");var we=new f(pe);Vn(we,function(Me){if(!rn(we,Me)){if("rpc"!==Me)throw ve(Me);!function et(Ee,pe){var we=Z(),Le=pe;if(!D.test(pe=H()))throw ve(pe,"name");var at,Pt,dt,Qe,Me=pe;if(ee("("),ee("stream",!0)&&(Pt=!0),!M.test(pe=H())||(at=pe,ee(")"),ee("returns"),ee("("),ee("stream",!0)&&(Qe=!0),!M.test(pe=H())))throw ve(pe);dt=pe,ee(")");var Hn=new p(Me,Le,at,dt,Pt,Qe);Hn.comment=we,Vn(Hn,function(In){if("option"!==In)throw ve(In);ge(Hn,In),ee(";")}),Ee.add(Hn)}(we,Me)}}),Ee.add(we)}(Ee,pe),!0;case"extend":return function Je(Ee,pe){if(!M.test(pe=H()))throw ve(pe,"reference");var we=pe;Vn(null,function(Me){switch(Me){case"required":case"repeated":En(Ee,Me,we);break;case"optional":En(Ee,Pe?"proto3_optional":"optional",we);break;default:if(!Pe||!M.test(Me))throw ve(Me);ne(Me),En(Ee,"optional",we)}})}(Ee,pe),!0}return!1}function Vn(Ee,pe,we){var Le=L.line;if(Ee&&("string"!=typeof Ee.comment&&(Ee.comment=Z()),Ee.filename=F.filename),ee("{",!0)){for(var Me;"}"!==(Me=H());)pe(Me);ee(";",!0)}else we&&we(),ee(";"),Ee&&("string"!=typeof Ee.comment||V)&&(Ee.comment=Z(Le)||Ee.comment)}function Rr(Ee,pe){if(!D.test(pe=H()))throw ve(pe,"type name");var we=new g(pe);Vn(we,function(Me){if(!rn(we,Me))switch(Me){case"map":!function qr(Ee){ee("<");var pe=H();if(void 0===w.mapKey[pe])throw ve(pe,"type");ee(",");var we=H();if(!M.test(we))throw ve(we,"type");ee(">");var Le=H();if(!D.test(Le))throw ve(Le,"name");ee("=");var Me=new m(Be(Le),wt(H()),pe,we);Vn(Me,function(Pt){if("option"!==Pt)throw ve(Pt);ge(Me,Pt),ee(";")},function(){ze(Me)}),Ee.add(Me)}(we);break;case"required":case"repeated":En(we,Me);break;case"optional":En(we,Pe?"proto3_optional":"optional");break;case"oneof":!function ns(Ee,pe){if(!D.test(pe=H()))throw ve(pe,"name");var we=new d(Be(pe));Vn(we,function(Me){"option"===Me?(ge(we,Me),ee(";")):(ne(Me),En(we,"optional"))}),Ee.add(we)}(we,Me);break;case"extensions":nt(we.extensions||(we.extensions=[]));break;case"reserved":nt(we.reserved||(we.reserved=[]),!0);break;default:if(!Pe||!M.test(Me))throw ve(Me);ne(Me),En(we,"optional")}}),Ee.add(we)}function En(Ee,pe,we){var Le=H();if("group"!==Le){if(!M.test(Le))throw ve(Le,"type");var Me=H();if(!D.test(Me))throw ve(Me,"name");Me=Be(Me),ee("=");var at=new b(Me,wt(H()),Le,pe,we);if(Vn(at,function(Qe){if("option"!==Qe)throw ve(Qe);ge(at,Qe),ee(";")},function(){ze(at)}),"proto3_optional"===pe){var Pt=new d("_"+Me);at.setOption("proto3_optional",!0),Pt.add(at),Ee.add(Pt)}else Ee.add(at);!Pe&&at.repeated&&(void 0!==w.packed[Le]||void 0===w.basic[Le])&&at.setOption("packed",!1,!0)}else!function Oi(Ee,pe){var we=H();if(!D.test(we))throw ve(we,"name");var Le=I.lcFirst(we);we===Le&&(we=I.ucFirst(we)),ee("=");var Me=wt(H()),at=new g(we);at.group=!0;var Pt=new b(Le,Me,we,pe);Pt.filename=F.filename,Vn(at,function(Qe){switch(Qe){case"option":ge(at,Qe),ee(";");break;case"required":case"repeated":En(at,Qe);break;case"optional":En(at,Pe?"proto3_optional":"optional");break;case"message":Rr(at,Qe);break;case"enum":ie(at,Qe);break;default:throw ve(Qe)}}),Ee.add(at).add(Pt)}(Ee,pe)}function ie(Ee,pe){if(!D.test(pe=H()))throw ve(pe,"name");var we=new c(pe);Vn(we,function(Me){switch(Me){case"option":ge(we,Me),ee(";");break;case"reserved":nt(we.reserved||(we.reserved=[]),!0);break;default:!function le(Ee,pe){if(!D.test(pe))throw ve(pe,"name");ee("=");var we=wt(H(),!0),Le={options:void 0,setOption:function(Me,at){void 0===this.options&&(this.options={}),this.options[Me]=at}};Vn(Le,function(at){if("option"!==at)throw ve(at);ge(Le,at),ee(";")},function(){ze(Le)}),Ee.add(pe,we,Le.comment,Le.options)}(we,Me)}}),Ee.add(we)}function ge(Ee,pe){var we=ee("(",!0);if(!M.test(pe=H()))throw ve(pe,"name");var at,Le=pe,Me=Le;we&&(ee(")"),Me=Le="("+Le+")",pe=j(),k.test(pe)&&(at=pe.slice(1),Le+=pe,H())),ee("="),function Ae(Ee,pe,we,Le){Ee.setParsedOption&&Ee.setParsedOption(pe,we,Le)}(Ee,Me,ye(Ee,Le),at)}function ye(Ee,pe){if(ee("{",!0)){for(var we={};!ee("}",!0);){if(!D.test(Fe=H()))throw ve(Fe,"name");var Le,Me=Fe;if(ee(":",!0),"{"===j())Le=ye(Ee,pe+"."+Fe);else if("["===j()){var at;if(Le=[],ee("[",!0)){do{at=ke(!0),Le.push(at)}while(ee(",",!0));ee("]"),typeof at<"u"&&be(Ee,pe+"."+Fe,at)}}else Le=ke(!0),be(Ee,pe+"."+Fe,Le);var Pt=we[Me];Pt&&(Le=[].concat(Pt).concat(Le)),we[Me]=Le,ee(",",!0),ee(";",!0)}return we}var dt=ke(!0);return be(Ee,pe,dt),dt}function be(Ee,pe,we){Ee.setOption&&Ee.setOption(pe,we)}function ze(Ee){if(ee("[",!0)){do{ge(Ee,"option")}while(ee(",",!0));ee("]")}return Ee}for(;null!==(Fe=H());)switch(Fe){case"package":if(!q)throw ve(Fe);Ft();break;case"import":if(!q)throw ve(Fe);qt();break;case"syntax":if(!q)throw ve(Fe);Jt();break;case"option":ge(Se,Fe),ee(";");break;default:if(rn(Se,Fe)){q=!1;continue}throw ve(Fe)}return F.filename=null,{package:te,imports:oe,weakImports:de,syntax:he,root:T}}},7270:(Y,K,R)=>{"use strict";Y.exports=d;var l,y=R(7211),g=y.LongBits,b=y.utf8;function m(E,v){return RangeError("index out of range: "+E.pos+" + "+(v||1)+" > "+E.len)}function d(E){this.buf=E,this.pos=0,this.len=E.length}var v,c=typeof Uint8Array<"u"?function(v){if(v instanceof Uint8Array||Array.isArray(v))return new d(v);throw Error("illegal buffer")}:function(v){if(Array.isArray(v))return new d(v);throw Error("illegal buffer")},f=function(){return y.Buffer?function(h){return(d.create=function(A){return y.Buffer.isBuffer(A)?new l(A):c(A)})(h)}:c};function p(){var E=new g(0,0),v=0;if(!(this.len-this.pos>4)){for(;v<3;++v){if(this.pos>=this.len)throw m(this);if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*v)>>>0,this.buf[this.pos++]<128)return E}return E.lo=(E.lo|(127&this.buf[this.pos++])<<7*v)>>>0,E}for(;v<4;++v)if(E.lo=(E.lo|(127&this.buf[this.pos])<<7*v)>>>0,this.buf[this.pos++]<128)return E;if(E.lo=(E.lo|(127&this.buf[this.pos])<<28)>>>0,E.hi=(E.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return E;if(v=0,this.len-this.pos>4){for(;v<5;++v)if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*v+3)>>>0,this.buf[this.pos++]<128)return E}else for(;v<5;++v){if(this.pos>=this.len)throw m(this);if(E.hi=(E.hi|(127&this.buf[this.pos])<<7*v+3)>>>0,this.buf[this.pos++]<128)return E}throw Error("invalid varint encoding")}function w(E,v){return(E[v-4]|E[v-3]<<8|E[v-2]<<16|E[v-1]<<24)>>>0}function I(){if(this.pos+8>this.len)throw m(this,8);return new g(w(this.buf,this.pos+=4),w(this.buf,this.pos+=4))}d.create=f(),d.prototype._slice=y.Array.prototype.subarray||y.Array.prototype.slice,d.prototype.uint32=(v=4294967295,function(){if(v=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(v=(v|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(v=(v|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(v=(v|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(v=(v|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128))return v;if((this.pos+=5)>this.len)throw this.pos=this.len,m(this,10);return v}),d.prototype.int32=function(){return 0|this.uint32()},d.prototype.sint32=function(){var v=this.uint32();return v>>>1^-(1&v)|0},d.prototype.bool=function(){return 0!==this.uint32()},d.prototype.fixed32=function(){if(this.pos+4>this.len)throw m(this,4);return w(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw m(this,4);return 0|w(this.buf,this.pos+=4)},d.prototype.float=function(){if(this.pos+4>this.len)throw m(this,4);var v=y.float.readFloatLE(this.buf,this.pos);return this.pos+=4,v},d.prototype.double=function(){if(this.pos+8>this.len)throw m(this,4);var v=y.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,v},d.prototype.bytes=function(){var v=this.uint32(),h=this.pos,C=this.pos+v;if(C>this.len)throw m(this,v);return this.pos+=v,Array.isArray(this.buf)?this.buf.slice(h,C):h===C?new this.buf.constructor(0):this._slice.call(this.buf,h,C)},d.prototype.string=function(){var v=this.bytes();return b.read(v,0,v.length)},d.prototype.skip=function(v){if("number"==typeof v){if(this.pos+v>this.len)throw m(this,v);this.pos+=v}else do{if(this.pos>=this.len)throw m(this)}while(128&this.buf[this.pos++]);return this},d.prototype.skipType=function(E){switch(E){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(E=7&this.uint32());)this.skipType(E);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+E+" at offset "+this.pos)}return this},d._configure=function(E){l=E,d.create=f(),l._configure();var v=y.Long?"toLong":"toNumber";y.merge(d.prototype,{int64:function(){return p.call(this)[v](!1)},uint64:function(){return p.call(this)[v](!0)},sint64:function(){return p.call(this).zzDecode()[v](!1)},fixed64:function(){return I.call(this)[v](!0)},sfixed64:function(){return I.call(this)[v](!1)}})}},4354:(Y,K,R)=>{"use strict";Y.exports=g;var y=R(7270);(g.prototype=Object.create(y.prototype)).constructor=g;var l=R(7211);function g(b){y.call(this,b)}g._configure=function(){l.Buffer&&(g.prototype._slice=l.Buffer.prototype.slice)},g.prototype.string=function(){var m=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+m,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+m,this.len))},g._configure()},5257:(Y,K,R)=>{"use strict";Y.exports=p;var y=R(326);((p.prototype=Object.create(y.prototype)).constructor=p).className="Root";var d,c,f,l=R(2986),g=R(4269),b=R(7397),m=R(8572);function p(v){y.call(this,"",v),this.deferred=[],this.files=[]}function w(){}p.fromJSON=function(h,C){return C||(C=new p),h.options&&C.setOptions(h.options),C.addJSON(h.nested)},p.prototype.resolvePath=m.path.resolve,p.prototype.fetch=m.fetch,p.prototype.load=function v(h,C,A){"function"==typeof C&&(A=C,C=void 0);var N=this;if(!A)return m.asPromise(v,N,h,C);var S=A===w;function D(V,L){if(A){var H=A;if(A=null,S)throw V;H(V,L)}}function M(V){var L=V.lastIndexOf("google/protobuf/");if(L>-1){var H=V.substring(L);if(H in f)return H}return null}function k(V,L){try{if(m.isString(L)&&"{"===L.charAt(0)&&(L=JSON.parse(L)),m.isString(L)){c.filename=V;var ne,H=c(L,N,C),j=0;if(H.imports)for(;j<H.imports.length;++j)(ne=M(H.imports[j])||N.resolvePath(V,H.imports[j]))&&F(ne);if(H.weakImports)for(j=0;j<H.weakImports.length;++j)(ne=M(H.weakImports[j])||N.resolvePath(V,H.weakImports[j]))&&F(ne,!0)}else N.setOptions(L.options).addJSON(L.nested)}catch(ee){D(ee)}!S&&!G&&D(null,N)}function F(V,L){if(!(N.files.indexOf(V)>-1)){if(N.files.push(V),V in f)return void(S?k(V,f[V]):(++G,setTimeout(function(){--G,k(V,f[V])})));if(S){var H;try{H=m.fs.readFileSync(V).toString("utf8")}catch(ne){return void(L||D(ne))}k(V,H)}else++G,N.fetch(V,function(ne,j){if(--G,A){if(ne)return void(L?G||D(null,N):D(ne));k(V,j)}})}}var G=0;m.isString(h)&&(h=[h]);for(var O,T=0;T<h.length;++T)(O=N.resolvePath("",h[T]))&&F(O);if(S)return N;G||D(null,N)},p.prototype.loadSync=function(h,C){if(!m.isNode)throw Error("not supported");return this.load(h,C,w)},p.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(h){return"'extend "+h.extend+"' in "+h.parent.fullName}).join(", "));return y.prototype.resolveAll.call(this)};var I=/^[A-Z]/;function E(v,h){var C=h.parent.lookup(h.extend);if(C){var A=new l(h.fullName,h.id,h.type,h.rule,void 0,h.options);return A.declaringField=h,h.extensionField=A,C.add(A),!0}return!1}p.prototype._handleAdd=function(h){if(h instanceof l)void 0!==h.extend&&!h.extensionField&&(E(0,h)||this.deferred.push(h));else if(h instanceof g)I.test(h.name)&&(h.parent[h.name]=h.values);else if(!(h instanceof b)){if(h instanceof d)for(var C=0;C<this.deferred.length;)E(0,this.deferred[C])?this.deferred.splice(C,1):++C;for(var A=0;A<h.nestedArray.length;++A)this._handleAdd(h._nestedArray[A]);I.test(h.name)&&(h.parent[h.name]=h)}},p.prototype._handleRemove=function(h){if(h instanceof l){if(void 0!==h.extend)if(h.extensionField)h.extensionField.parent.remove(h.extensionField),h.extensionField=null;else{var C=this.deferred.indexOf(h);C>-1&&this.deferred.splice(C,1)}}else if(h instanceof g)I.test(h.name)&&delete h.parent[h.name];else if(h instanceof y){for(var A=0;A<h.nestedArray.length;++A)this._handleRemove(h._nestedArray[A]);I.test(h.name)&&delete h.parent[h.name]}},p._configure=function(v,h,C){d=v,c=h,f=C}},6671:Y=>{"use strict";Y.exports={}},7830:(Y,K,R)=>{"use strict";K.Service=R(6346)},6346:(Y,K,R)=>{"use strict";Y.exports=l;var y=R(7211);function l(g,b,m){if("function"!=typeof g)throw TypeError("rpcImpl must be a function");y.EventEmitter.call(this),this.rpcImpl=g,this.requestDelimited=Boolean(b),this.responseDelimited=Boolean(m)}(l.prototype=Object.create(y.EventEmitter.prototype)).constructor=l,l.prototype.rpcCall=function g(b,m,d,c,f){if(!c)throw TypeError("request must be specified");var p=this;if(!f)return y.asPromise(g,p,b,m,d,c);if(p.rpcImpl)try{return p.rpcImpl(b,m[p.requestDelimited?"encodeDelimited":"encode"](c).finish(),function(I,E){if(I)return p.emit("error",I,b),f(I);if(null!==E){if(!(E instanceof d))try{E=d[p.responseDelimited?"decodeDelimited":"decode"](E)}catch(v){return p.emit("error",v,b),f(v)}return p.emit("data",E,b),f(null,E)}p.end(!0)})}catch(w){return p.emit("error",w,b),void setTimeout(function(){f(w)},0)}else setTimeout(function(){f(Error("already ended"))},0)},l.prototype.end=function(b){return this.rpcImpl&&(b||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9630:(Y,K,R)=>{"use strict";Y.exports=m;var y=R(326);((m.prototype=Object.create(y.prototype)).constructor=m).className="Service";var l=R(1618),g=R(8572),b=R(7830);function m(c,f){y.call(this,c,f),this.methods={},this._methodsArray=null}function d(c){return c._methodsArray=null,c}m.fromJSON=function(f,p){var w=new m(f,p.options);if(p.methods)for(var I=Object.keys(p.methods),E=0;E<I.length;++E)w.add(l.fromJSON(I[E],p.methods[I[E]]));return p.nested&&w.addJSON(p.nested),w.comment=p.comment,w},m.prototype.toJSON=function(f){var p=y.prototype.toJSON.call(this,f),w=!!f&&Boolean(f.keepComments);return g.toObject(["options",p&&p.options||void 0,"methods",y.arrayToJSON(this.methodsArray,f)||{},"nested",p&&p.nested||void 0,"comment",w?this.comment:void 0])},Object.defineProperty(m.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=g.toArray(this.methods))}}),m.prototype.get=function(f){return this.methods[f]||y.prototype.get.call(this,f)},m.prototype.resolveAll=function(){for(var f=this.methodsArray,p=0;p<f.length;++p)f[p].resolve();return y.prototype.resolve.call(this)},m.prototype.add=function(f){if(this.get(f.name))throw Error("duplicate name '"+f.name+"' in "+this);return f instanceof l?(this.methods[f.name]=f,f.parent=this,d(this)):y.prototype.add.call(this,f)},m.prototype.remove=function(f){if(f instanceof l){if(this.methods[f.name]!==f)throw Error(f+" is not a member of "+this);return delete this.methods[f.name],f.parent=null,d(this)}return y.prototype.remove.call(this,f)},m.prototype.create=function(f,p,w){for(var v,I=new b.Service(f,p,w),E=0;E<this.methodsArray.length;++E){var h=g.lcFirst((v=this._methodsArray[E]).resolve().name).replace(/[^$\w_]/g,"");I[h]=g.codegen(["r","c"],g.isReserved(h)?h+"_":h)("return this.rpcCall(m,q,s,r,c)")({m:v,q:v.resolvedRequestType.ctor,s:v.resolvedResponseType.ctor})}return I}},691:Y=>{"use strict";Y.exports=p;var K=/[\s{}=;:[\],'"()<>]/g,R=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,y=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,l=/^ *[*/]+ */,g=/^\s*\*?\/*/,b=/\n/g,m=/\s/,d=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function f(w){return w.replace(d,function(I,E){switch(E){case"\\":case"":return E;default:return c[E]||""}})}function p(w,I){w=w.toString();var E=0,v=w.length,h=1,C=0,A={},N=[],S=null;function D(j){return Error("illegal "+j+" (line "+h+")")}function k(j){return w.charAt(j)}function F(j,ee,Z){var de,q={type:w.charAt(j++),lineEmpty:!1,leading:Z},oe=j-(I?2:3);do{if(--oe<0||"\n"===(de=w.charAt(oe))){q.lineEmpty=!0;break}}while(" "===de||"\t"===de);for(var he=w.substring(j,ee).split(b),Pe=0;Pe<he.length;++Pe)he[Pe]=he[Pe].replace(I?g:l,"").trim();q.text=he.join("\n").trim(),A[h]=q,C=h}function G(j){var ee=T(j),Z=w.substring(j,ee);return/^\s*\/{1,2}/.test(Z)}function T(j){for(var ee=j;ee<v&&"\n"!==k(ee);)ee++;return ee}function O(){if(N.length>0)return N.shift();if(S)return function M(){var j="'"===S?y:R;j.lastIndex=E-1;var ee=j.exec(w);if(!ee)throw D("string");return E=j.lastIndex,V(S),S=null,f(ee[1])}();var j,ee,Z,q,te,oe=0===E;do{if(E===v)return null;for(j=!1;m.test(Z=k(E));)if("\n"===Z&&(oe=!0,++h),++E===v)return null;if("/"===k(E)){if(++E===v)throw D("comment");if("/"===k(E))if(I){if(q=E,te=!1,G(E)){te=!0;do{if((E=T(E))===v||(E++,!oe))break}while(G(E))}else E=Math.min(v,T(E)+1);te&&(F(q,E,oe),oe=!0),h++,j=!0}else{for(te="/"===k(q=E+1);"\n"!==k(++E);)if(E===v)return null;++E,te&&(F(q,E-1,oe),oe=!0),++h,j=!0}else{if("*"!==(Z=k(E)))return"/";q=E+1,te=I||"*"===k(q);do{if("\n"===Z&&++h,++E===v)throw D("comment");ee=Z,Z=k(E)}while("*"!==ee||"/"!==Z);++E,te&&(F(q,E-2,oe),oe=!0),j=!0}}}while(j);var de=E;if(K.lastIndex=0,!K.test(k(de++)))for(;de<v&&!K.test(k(de));)++de;var Pe=w.substring(E,E=de);return('"'===Pe||"'"===Pe)&&(S=Pe),Pe}function V(j){N.push(j)}function L(){if(!N.length){var j=O();if(null===j)return null;V(j)}return N[0]}return Object.defineProperty({next:O,peek:L,push:V,skip:function H(j,ee){var Z=L();if(Z===j)return O(),!0;if(!ee)throw D("token '"+Z+"', '"+j+"' expected");return!1},cmnt:function ne(j){var Z,ee=null;return void 0===j?(Z=A[h-1],delete A[h-1],Z&&(I||"*"===Z.type||Z.lineEmpty)&&(ee=Z.leading?Z.text:null)):(C<j&&L(),Z=A[j],delete A[j],Z&&!Z.lineEmpty&&(I||"/"===Z.type)&&(ee=Z.leading?null:Z.text)),ee}},"line",{get:function(){return h}})}p.unescape=f},7845:(Y,K,R)=>{"use strict";Y.exports=A;var y=R(326);((A.prototype=Object.create(y.prototype)).constructor=A).className="Type";var l=R(4269),g=R(7397),b=R(2986),m=R(9455),d=R(9630),c=R(1413),f=R(7270),p=R(1650),w=R(8572),I=R(133),E=R(225),v=R(8617),h=R(6533),C=R(761);function A(S,D){y.call(this,S,D),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function N(S){return S._fieldsById=S._fieldsArray=S._oneofsArray=null,delete S.encode,delete S.decode,delete S.verify,S}Object.defineProperties(A.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var S=Object.keys(this.fields),D=0;D<S.length;++D){var M=this.fields[S[D]],k=M.id;if(this._fieldsById[k])throw Error("duplicate id "+k+" in "+this);this._fieldsById[k]=M}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=w.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=w.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=A.generateConstructor(this)())},set:function(S){var D=S.prototype;D instanceof c||((S.prototype=new c).constructor=S,w.merge(S.prototype,D)),S.$type=S.prototype.$type=this,w.merge(S,c,!0),this._ctor=S;for(var M=0;M<this.fieldsArray.length;++M)this._fieldsArray[M].resolve();var k={};for(M=0;M<this.oneofsArray.length;++M)k[this._oneofsArray[M].resolve().name]={get:w.oneOfGetter(this._oneofsArray[M].oneof),set:w.oneOfSetter(this._oneofsArray[M].oneof)};M&&Object.defineProperties(S.prototype,k)}}}),A.generateConstructor=function(D){for(var F,M=w.codegen(["p"],D.name),k=0;k<D.fieldsArray.length;++k)(F=D._fieldsArray[k]).map?M("this%s={}",w.safeProp(F.name)):F.repeated&&M("this%s=[]",w.safeProp(F.name));return M("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},A.fromJSON=function(D,M){var k=new A(D,M.options);k.extensions=M.extensions,k.reserved=M.reserved;for(var F=Object.keys(M.fields),G=0;G<F.length;++G)k.add((typeof M.fields[F[G]].keyType<"u"?m.fromJSON:b.fromJSON)(F[G],M.fields[F[G]]));if(M.oneofs)for(F=Object.keys(M.oneofs),G=0;G<F.length;++G)k.add(g.fromJSON(F[G],M.oneofs[F[G]]));if(M.nested)for(F=Object.keys(M.nested),G=0;G<F.length;++G){var T=M.nested[F[G]];k.add((void 0!==T.id?b.fromJSON:void 0!==T.fields?A.fromJSON:void 0!==T.values?l.fromJSON:void 0!==T.methods?d.fromJSON:y.fromJSON)(F[G],T))}return M.extensions&&M.extensions.length&&(k.extensions=M.extensions),M.reserved&&M.reserved.length&&(k.reserved=M.reserved),M.group&&(k.group=!0),M.comment&&(k.comment=M.comment),k},A.prototype.toJSON=function(D){var M=y.prototype.toJSON.call(this,D),k=!!D&&Boolean(D.keepComments);return w.toObject(["options",M&&M.options||void 0,"oneofs",y.arrayToJSON(this.oneofsArray,D),"fields",y.arrayToJSON(this.fieldsArray.filter(function(F){return!F.declaringField}),D)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",M&&M.nested||void 0,"comment",k?this.comment:void 0])},A.prototype.resolveAll=function(){for(var D=this.fieldsArray,M=0;M<D.length;)D[M++].resolve();var k=this.oneofsArray;for(M=0;M<k.length;)k[M++].resolve();return y.prototype.resolveAll.call(this)},A.prototype.get=function(D){return this.fields[D]||this.oneofs&&this.oneofs[D]||this.nested&&this.nested[D]||null},A.prototype.add=function(D){if(this.get(D.name))throw Error("duplicate name '"+D.name+"' in "+this);if(D instanceof b&&void 0===D.extend){if(this._fieldsById?this._fieldsById[D.id]:this.fieldsById[D.id])throw Error("duplicate id "+D.id+" in "+this);if(this.isReservedId(D.id))throw Error("id "+D.id+" is reserved in "+this);if(this.isReservedName(D.name))throw Error("name '"+D.name+"' is reserved in "+this);return D.parent&&D.parent.remove(D),this.fields[D.name]=D,D.message=this,D.onAdd(this),N(this)}return D instanceof g?(this.oneofs||(this.oneofs={}),this.oneofs[D.name]=D,D.onAdd(this),N(this)):y.prototype.add.call(this,D)},A.prototype.remove=function(D){if(D instanceof b&&void 0===D.extend){if(!this.fields||this.fields[D.name]!==D)throw Error(D+" is not a member of "+this);return delete this.fields[D.name],D.parent=null,D.onRemove(this),N(this)}if(D instanceof g){if(!this.oneofs||this.oneofs[D.name]!==D)throw Error(D+" is not a member of "+this);return delete this.oneofs[D.name],D.parent=null,D.onRemove(this),N(this)}return y.prototype.remove.call(this,D)},A.prototype.isReservedId=function(D){return y.isReservedId(this.reserved,D)},A.prototype.isReservedName=function(D){return y.isReservedName(this.reserved,D)},A.prototype.create=function(D){return new this.ctor(D)},A.prototype.setup=function(){for(var D=this.fullName,M=[],k=0;k<this.fieldsArray.length;++k)M.push(this._fieldsArray[k].resolve().resolvedType);this.encode=I(this)({Writer:p,types:M,util:w}),this.decode=E(this)({Reader:f,types:M,util:w}),this.verify=v(this)({types:M,util:w}),this.fromObject=h.fromObject(this)({types:M,util:w}),this.toObject=h.toObject(this)({types:M,util:w});var F=C[D];if(F){var G=Object.create(this);G.fromObject=this.fromObject,this.fromObject=F.fromObject.bind(G),G.toObject=this.toObject,this.toObject=F.toObject.bind(G)}return this},A.prototype.encode=function(D,M){return this.setup().encode(D,M)},A.prototype.encodeDelimited=function(D,M){return this.encode(D,M&&M.len?M.fork():M).ldelim()},A.prototype.decode=function(D,M){return this.setup().decode(D,M)},A.prototype.decodeDelimited=function(D){return D instanceof f||(D=f.create(D)),this.decode(D,D.uint32())},A.prototype.verify=function(D){return this.setup().verify(D)},A.prototype.fromObject=function(D){return this.setup().fromObject(D)},A.prototype.toObject=function(D,M){return this.setup().toObject(D,M)},A.d=function(D){return function(k){w.decorateType(k,D)}}},688:(Y,K,R)=>{"use strict";var y=K,l=R(8572),g=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function b(m,d){var c=0,f={};for(d|=0;c<m.length;)f[g[c+d]]=m[c++];return f}y.basic=b([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),y.defaults=b([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",l.emptyArray,null]),y.long=b([0,0,0,1,1],7),y.mapKey=b([0,0,0,5,5,0,0,0,1,1,0,2],2),y.packed=b([1,5,0,0,0,5,5,0,0,0,1,1,0])},8572:(Y,K,R)=>{"use strict";var g,b,y=Y.exports=R(7211),l=R(6671);y.codegen=R(9749),y.fetch=R(8832),y.path=R(1311),y.fs=y.inquire("fs"),y.toArray=function(w){if(w){for(var I=Object.keys(w),E=new Array(I.length),v=0;v<I.length;)E[v]=w[I[v++]];return E}return[]},y.toObject=function(w){for(var I={},E=0;E<w.length;){var v=w[E++],h=w[E++];void 0!==h&&(I[v]=h)}return I};var m=/\\/g,d=/"/g;y.isReserved=function(w){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(w)},y.safeProp=function(w){return!/^[$\w_]+$/.test(w)||y.isReserved(w)?'["'+w.replace(m,"\\\\").replace(d,'\\"')+'"]':"."+w},y.ucFirst=function(w){return w.charAt(0).toUpperCase()+w.substring(1)};var c=/_([a-z])/g;y.camelCase=function(w){return w.substring(0,1)+w.substring(1).replace(c,function(I,E){return E.toUpperCase()})},y.compareFieldsById=function(w,I){return w.id-I.id},y.decorateType=function(w,I){if(w.$type)return I&&w.$type.name!==I&&(y.decorateRoot.remove(w.$type),w.$type.name=I,y.decorateRoot.add(w.$type)),w.$type;g||(g=R(7845));var E=new g(I||w.name);return y.decorateRoot.add(E),E.ctor=w,Object.defineProperty(w,"$type",{value:E,enumerable:!1}),Object.defineProperty(w.prototype,"$type",{value:E,enumerable:!1}),E};var f=0;y.decorateEnum=function(w){if(w.$type)return w.$type;b||(b=R(4269));var I=new b("Enum"+f++,w);return y.decorateRoot.add(I),Object.defineProperty(w,"$type",{value:I,enumerable:!1}),I},y.setProperty=function(w,I,E){if("object"!=typeof w)throw TypeError("dst must be an object");if(!I)throw TypeError("path must be specified");return function v(h,C,A){var N=C.shift();if("__proto__"===N)return h;if(C.length>0)h[N]=v(h[N]||{},C,A);else{var S=h[N];S&&(A=[].concat(S).concat(A)),h[N]=A}return h}(w,I=I.split("."),E)},Object.defineProperty(y,"decorateRoot",{get:function(){return l.decorated||(l.decorated=new(R(5257)))}})},942:(Y,K,R)=>{"use strict";Y.exports=l;var y=R(7211);function l(d,c){this.lo=d>>>0,this.hi=c>>>0}var g=l.zero=new l(0,0);g.toNumber=function(){return 0},g.zzEncode=g.zzDecode=function(){return this},g.length=function(){return 1};var b=l.zeroHash="\0\0\0\0\0\0\0\0";l.fromNumber=function(c){if(0===c)return g;var f=c<0;f&&(c=-c);var p=c>>>0,w=(c-p)/4294967296>>>0;return f&&(w=~w>>>0,p=~p>>>0,++p>4294967295&&(p=0,++w>4294967295&&(w=0))),new l(p,w)},l.from=function(c){if("number"==typeof c)return l.fromNumber(c);if(y.isString(c)){if(!y.Long)return l.fromNumber(parseInt(c,10));c=y.Long.fromString(c)}return c.low||c.high?new l(c.low>>>0,c.high>>>0):g},l.prototype.toNumber=function(c){if(!c&&this.hi>>>31){var f=1+~this.lo>>>0,p=~this.hi>>>0;return f||(p=p+1>>>0),-(f+4294967296*p)}return this.lo+4294967296*this.hi},l.prototype.toLong=function(c){return y.Long?new y.Long(0|this.lo,0|this.hi,Boolean(c)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(c)}};var m=String.prototype.charCodeAt;l.fromHash=function(c){return c===b?g:new l((m.call(c,0)|m.call(c,1)<<8|m.call(c,2)<<16|m.call(c,3)<<24)>>>0,(m.call(c,4)|m.call(c,5)<<8|m.call(c,6)<<16|m.call(c,7)<<24)>>>0)},l.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},l.prototype.zzEncode=function(){var c=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^c)>>>0,this.lo=(this.lo<<1^c)>>>0,this},l.prototype.zzDecode=function(){var c=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^c)>>>0,this.hi=(this.hi>>>1^c)>>>0,this},l.prototype.length=function(){var c=this.lo,f=(this.lo>>>28|this.hi<<4)>>>0,p=this.hi>>>24;return 0===p?0===f?c<16384?c<128?1:2:c<2097152?3:4:f<16384?f<128?5:6:f<2097152?7:8:p<128?9:10}},7211:function(Y,K,R){"use strict";var y=K;function l(b,m,d){for(var c=Object.keys(m),f=0;f<c.length;++f)(void 0===b[c[f]]||!d)&&(b[c[f]]=m[c[f]]);return b}function g(b){function m(d,c){if(!(this instanceof m))return new m(d,c);Object.defineProperty(this,"message",{get:function(){return d}}),Error.captureStackTrace?Error.captureStackTrace(this,m):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),c&&l(this,c)}return m.prototype=Object.create(Error.prototype,{constructor:{value:m,writable:!0,enumerable:!1,configurable:!0},name:{get:()=>b,set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),m}y.asPromise=R(1280),y.base64=R(9039),y.EventEmitter=R(9889),y.float=R(530),y.inquire=R(716),y.utf8=R(7768),y.pool=R(4479),y.LongBits=R(942),y.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node),y.global=y.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||this,y.emptyArray=Object.freeze?Object.freeze([]):[],y.emptyObject=Object.freeze?Object.freeze({}):{},y.isInteger=Number.isInteger||function(m){return"number"==typeof m&&isFinite(m)&&Math.floor(m)===m},y.isString=function(m){return"string"==typeof m||m instanceof String},y.isObject=function(m){return m&&"object"==typeof m},y.isset=y.isSet=function(m,d){var c=m[d];return!(null==c||!m.hasOwnProperty(d))&&("object"!=typeof c||(Array.isArray(c)?c.length:Object.keys(c).length)>0)},y.Buffer=function(){try{var b=y.inquire("buffer").Buffer;return b.prototype.utf8Write?b:null}catch{return null}}(),y._Buffer_from=null,y._Buffer_allocUnsafe=null,y.newBuffer=function(m){return"number"==typeof m?y.Buffer?y._Buffer_allocUnsafe(m):new y.Array(m):y.Buffer?y._Buffer_from(m):typeof Uint8Array>"u"?m:new Uint8Array(m)},y.Array=typeof Uint8Array<"u"?Uint8Array:Array,y.Long=y.global.dcodeIO&&y.global.dcodeIO.Long||y.global.Long||y.inquire("long"),y.key2Re=/^true|false|0|1$/,y.key32Re=/^-?(?:0|[1-9][0-9]*)$/,y.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,y.longToHash=function(m){return m?y.LongBits.from(m).toHash():y.LongBits.zeroHash},y.longFromHash=function(m,d){var c=y.LongBits.fromHash(m);return y.Long?y.Long.fromBits(c.lo,c.hi,d):c.toNumber(Boolean(d))},y.merge=l,y.lcFirst=function(m){return m.charAt(0).toLowerCase()+m.substring(1)},y.newError=g,y.ProtocolError=g("ProtocolError"),y.oneOfGetter=function(m){for(var d={},c=0;c<m.length;++c)d[m[c]]=1;return function(){for(var f=Object.keys(this),p=f.length-1;p>-1;--p)if(1===d[f[p]]&&null!=this[f[p]])return f[p]}},y.oneOfSetter=function(m){return function(d){for(var c=0;c<m.length;++c)m[c]!==d&&delete this[m[c]]}},y.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},y._configure=function(){var b=y.Buffer;b?(y._Buffer_from=b.from!==Uint8Array.from&&b.from||function(d,c){return new b(d,c)},y._Buffer_allocUnsafe=b.allocUnsafe||function(d){return new b(d)}):y._Buffer_from=y._Buffer_allocUnsafe=null}},8617:(Y,K,R)=>{"use strict";Y.exports=function d(c){var f=l.codegen(["m"],c.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),w={};c.oneofsArray.length&&f("var p={}");for(var I=0;I<c.fieldsArray.length;++I){var E=c._fieldsArray[I].resolve(),v="m"+l.safeProp(E.name);if(E.optional&&f("if(%s!=null&&m.hasOwnProperty(%j)){",v,E.name),E.map)f("if(!util.isObject(%s))",v)("return%j",g(E,"object"))("var k=Object.keys(%s)",v)("for(var i=0;i<k.length;++i){"),m(f,E,"k[i]"),b(f,E,I,v+"[k[i]]")("}");else if(E.repeated)f("if(!Array.isArray(%s))",v)("return%j",g(E,"array"))("for(var i=0;i<%s.length;++i){",v),b(f,E,I,v+"[i]")("}");else{if(E.partOf){var h=l.safeProp(E.partOf.name);1===w[E.partOf.name]&&f("if(p%s===1)",h)("return%j",E.partOf.name+": multiple values"),w[E.partOf.name]=1,f("p%s=1",h)}b(f,E,I,v)}E.optional&&f("}")}return f("return null")};var y=R(4269),l=R(8572);function g(c,f){return c.name+": "+f+(c.repeated&&"array"!==f?"[]":c.map&&"object"!==f?"{k:"+c.keyType+"}":"")+" expected"}function b(c,f,p,w){if(f.resolvedType)if(f.resolvedType instanceof y){c("switch(%s){",w)("default:")("return%j",g(f,"enum value"));for(var I=Object.keys(f.resolvedType.values),E=0;E<I.length;++E)c("case %i:",f.resolvedType.values[I[E]]);c("break")("}")}else c("{")("var e=types[%i].verify(%s);",p,w)("if(e)")("return%j+e",f.name+".")("}");else switch(f.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":c("if(!util.isInteger(%s))",w)("return%j",g(f,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":c("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",w,w,w,w)("return%j",g(f,"integer|Long"));break;case"float":case"double":c('if(typeof %s!=="number")',w)("return%j",g(f,"number"));break;case"bool":c('if(typeof %s!=="boolean")',w)("return%j",g(f,"boolean"));break;case"string":c("if(!util.isString(%s))",w)("return%j",g(f,"string"));break;case"bytes":c('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',w,w,w)("return%j",g(f,"buffer"))}return c}function m(c,f,p){switch(f.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":c("if(!util.key32Re.test(%s))",p)("return%j",g(f,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":c("if(!util.key64Re.test(%s))",p)("return%j",g(f,"integer|Long key"));break;case"bool":c("if(!util.key2Re.test(%s))",p)("return%j",g(f,"boolean key"))}return c}},761:(Y,K,R)=>{"use strict";var y=K,l=R(1413);y[".google.protobuf.Any"]={fromObject:function(g){if(g&&g["@type"]){var b=g["@type"].substring(g["@type"].lastIndexOf("/")+1),m=this.lookup(b);if(m){var d="."===g["@type"].charAt(0)?g["@type"].slice(1):g["@type"];return-1===d.indexOf("/")&&(d="/"+d),this.create({type_url:d,value:m.encode(m.fromObject(g)).finish()})}}return this.fromObject(g)},toObject:function(g,b){var d="",c="";if(b&&b.json&&g.type_url&&g.value){c=g.type_url.substring(g.type_url.lastIndexOf("/")+1),d=g.type_url.substring(0,g.type_url.lastIndexOf("/")+1);var f=this.lookup(c);f&&(g=f.decode(g.value))}if(!(g instanceof this.ctor)&&g instanceof l){var p=g.$type.toObject(g,b),w="."===g.$type.fullName[0]?g.$type.fullName.slice(1):g.$type.fullName;return""===d&&(d="type.googleapis.com/"),p["@type"]=c=d+w,p}return this.toObject(g,b)}}},1650:(Y,K,R)=>{"use strict";Y.exports=p;var l,y=R(7211),g=y.LongBits,b=y.base64,m=y.utf8;function d(N,S,D){this.fn=N,this.len=S,this.next=void 0,this.val=D}function c(){}function f(N){this.head=N.head,this.tail=N.tail,this.len=N.len,this.next=N.states}function p(){this.len=0,this.head=new d(c,0,0),this.tail=this.head,this.states=null}var w=function(){return y.Buffer?function(){return(p.create=function(){return new l})()}:function(){return new p}};function I(N,S,D){S[D]=255&N}function v(N,S){this.len=N,this.next=void 0,this.val=S}function h(N,S,D){for(;N.hi;)S[D++]=127&N.lo|128,N.lo=(N.lo>>>7|N.hi<<25)>>>0,N.hi>>>=7;for(;N.lo>127;)S[D++]=127&N.lo|128,N.lo=N.lo>>>7;S[D++]=N.lo}function C(N,S,D){S[D]=255&N,S[D+1]=N>>>8&255,S[D+2]=N>>>16&255,S[D+3]=N>>>24}p.create=w(),p.alloc=function(S){return new y.Array(S)},y.Array!==Array&&(p.alloc=y.pool(p.alloc,y.Array.prototype.subarray)),p.prototype._push=function(S,D,M){return this.tail=this.tail.next=new d(S,D,M),this.len+=D,this},(v.prototype=Object.create(d.prototype)).fn=function E(N,S,D){for(;N>127;)S[D++]=127&N|128,N>>>=7;S[D]=N},p.prototype.uint32=function(S){return this.len+=(this.tail=this.tail.next=new v((S>>>=0)<128?1:S<16384?2:S<2097152?3:S<268435456?4:5,S)).len,this},p.prototype.int32=function(S){return S<0?this._push(h,10,g.fromNumber(S)):this.uint32(S)},p.prototype.sint32=function(S){return this.uint32((S<<1^S>>31)>>>0)},p.prototype.int64=p.prototype.uint64=function(S){var D=g.from(S);return this._push(h,D.length(),D)},p.prototype.sint64=function(S){var D=g.from(S).zzEncode();return this._push(h,D.length(),D)},p.prototype.bool=function(S){return this._push(I,1,S?1:0)},p.prototype.sfixed32=p.prototype.fixed32=function(S){return this._push(C,4,S>>>0)},p.prototype.sfixed64=p.prototype.fixed64=function(S){var D=g.from(S);return this._push(C,4,D.lo)._push(C,4,D.hi)},p.prototype.float=function(S){return this._push(y.float.writeFloatLE,4,S)},p.prototype.double=function(S){return this._push(y.float.writeDoubleLE,8,S)};var A=y.Array.prototype.set?function(S,D,M){D.set(S,M)}:function(S,D,M){for(var k=0;k<S.length;++k)D[M+k]=S[k]};p.prototype.bytes=function(S){var D=S.length>>>0;if(!D)return this._push(I,1,0);if(y.isString(S)){var M=p.alloc(D=b.length(S));b.decode(S,M,0),S=M}return this.uint32(D)._push(A,D,S)},p.prototype.string=function(S){var D=m.length(S);return D?this.uint32(D)._push(m.write,D,S):this._push(I,1,0)},p.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new d(c,0,0),this.len=0,this},p.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 d(c,0,0),this.len=0),this},p.prototype.ldelim=function(){var S=this.head,D=this.tail,M=this.len;return this.reset().uint32(M),M&&(this.tail.next=S.next,this.tail=D,this.len+=M),this},p.prototype.finish=function(){for(var S=this.head.next,D=this.constructor.alloc(this.len),M=0;S;)S.fn(S.val,D,M),M+=S.len,S=S.next;return D},p._configure=function(N){l=N,p.create=w(),l._configure()}},813:(Y,K,R)=>{"use strict";Y.exports=g;var y=R(1650);(g.prototype=Object.create(y.prototype)).constructor=g;var l=R(7211);function g(){y.call(this)}function b(m,d,c){m.length<40?l.utf8.write(m,d,c):d.utf8Write?d.utf8Write(m,c):d.write(m,c)}g._configure=function(){g.alloc=l._Buffer_allocUnsafe,g.writeBytesBuffer=l.Buffer&&l.Buffer.prototype instanceof Uint8Array&&"set"===l.Buffer.prototype.set.name?function(d,c,f){c.set(d,f)}:function(d,c,f){if(d.copy)d.copy(c,f,0,d.length);else for(var p=0;p<d.length;)c[f++]=d[p++]}},g.prototype.bytes=function(d){l.isString(d)&&(d=l._Buffer_from(d,"base64"));var c=d.length>>>0;return this.uint32(c),c&&this._push(g.writeBytesBuffer,c,d),this},g.prototype.string=function(d){var c=l.Buffer.byteLength(d);return this.uint32(c),c&&this._push(b,c,d),this},g._configure()},7813:(Y,K,R)=>{const y=R(9301),l=R(6217),g=R(7840),b=R(939),{RateLimiterClusterMaster:m,RateLimiterClusterMasterPM2:d,RateLimiterCluster:c}=R(9644),f=R(4849),p=R(6492),w=R(5936),I=R(8592),E=R(2816),v=R(9062),h=R(9658);Y.exports={RateLimiterRedis:y,RateLimiterMongo:l,RateLimiterMySQL:g,RateLimiterPostgres:b,RateLimiterMemory:f,RateLimiterMemcache:p,RateLimiterClusterMaster:m,RateLimiterClusterMasterPM2:d,RateLimiterCluster:c,RLWrapperBlackAndWhite:w,RateLimiterUnion:I,RateLimiterQueue:E,BurstyRateLimiter:v,RateLimiterRes:h}},9062:(Y,K,R)=>{const y=R(9658);Y.exports=class{constructor(g,b){this._rateLimiter=g,this._burstLimiter=b}_combineRes(g,b){return new y(g.remainingPoints,Math.min(g.msBeforeNext,b.msBeforeNext),g.consumedPoints,g.isFirstInDuration)}consume(g,b=1,m={}){return this._rateLimiter.consume(g,b,m).catch(d=>d instanceof y?this._burstLimiter.consume(g,b,m).then(c=>Promise.resolve(this._combineRes(d,c))).catch(c=>Promise.reject(c instanceof y?this._combineRes(d,c):c)):Promise.reject(d))}get(g){return Promise.all([this._rateLimiter.get(g),this._burstLimiter.get(g)]).then(([b,m])=>this._combineRes(b,m))}get points(){return this._rateLimiter.points}}},5936:(Y,K,R)=>{const y=R(9658);Y.exports=class{constructor(g={}){this.limiter=g.limiter,this.blackList=g.blackList,this.whiteList=g.whiteList,this.isBlackListed=g.isBlackListed,this.isWhiteListed=g.isWhiteListed,this.runActionAnyway=g.runActionAnyway}get limiter(){return this._limiter}set limiter(g){if(typeof g>"u")throw new Error("limiter is not set");this._limiter=g}get runActionAnyway(){return this._runActionAnyway}set runActionAnyway(g){this._runActionAnyway=!(typeof g>"u")&&g}get blackList(){return this._blackList}set blackList(g){this._blackList=Array.isArray(g)?g:[]}get isBlackListed(){return this._isBlackListed}set isBlackListed(g){if(typeof g>"u"&&(g=()=>!1),"function"!=typeof g)throw new Error("isBlackListed must be function");this._isBlackListed=g}get whiteList(){return this._whiteList}set whiteList(g){this._whiteList=Array.isArray(g)?g:[]}get isWhiteListed(){return this._isWhiteListed}set isWhiteListed(g){if(typeof g>"u"&&(g=()=>!1),"function"!=typeof g)throw new Error("isWhiteListed must be function");this._isWhiteListed=g}isBlackListedSomewhere(g){return this.blackList.indexOf(g)>=0||this.isBlackListed(g)}isWhiteListedSomewhere(g){return this.whiteList.indexOf(g)>=0||this.isWhiteListed(g)}getBlackRes(){return new y(0,Number.MAX_SAFE_INTEGER,0,!1)}getWhiteRes(){return new y(Number.MAX_SAFE_INTEGER,0,0,!1)}rejectBlack(){return Promise.reject(this.getBlackRes())}resolveBlack(){return Promise.resolve(this.getBlackRes())}resolveWhite(){return Promise.resolve(this.getWhiteRes())}consume(g,b=1){let m;return this.isWhiteListedSomewhere(g)?m=this.resolveWhite():this.isBlackListedSomewhere(g)&&(m=this.rejectBlack()),typeof m>"u"?this.limiter.consume(g,b):(this.runActionAnyway&&this.limiter.consume(g,b).catch(()=>{}),m)}block(g,b){let m;return this.isWhiteListedSomewhere(g)?m=this.resolveWhite():this.isBlackListedSomewhere(g)&&(m=this.resolveBlack()),typeof m>"u"?this.limiter.block(g,b):(this.runActionAnyway&&this.limiter.block(g,b).catch(()=>{}),m)}penalty(g,b){let m;return this.isWhiteListedSomewhere(g)?m=this.resolveWhite():this.isBlackListedSomewhere(g)&&(m=this.resolveBlack()),typeof m>"u"?this.limiter.penalty(g,b):(this.runActionAnyway&&this.limiter.penalty(g,b).catch(()=>{}),m)}reward(g,b){let m;return this.isWhiteListedSomewhere(g)?m=this.resolveWhite():this.isBlackListedSomewhere(g)&&(m=this.resolveBlack()),typeof m>"u"?this.limiter.reward(g,b):(this.runActionAnyway&&this.limiter.reward(g,b).catch(()=>{}),m)}get(g){let b;return this.isWhiteListedSomewhere(g)?b=this.resolveWhite():this.isBlackListedSomewhere(g)&&(b=this.resolveBlack()),typeof b>"u"||this.runActionAnyway?this.limiter.get(g):b}delete(g){return this.limiter.delete(g)}}},6953:Y=>{Y.exports=class{constructor(R={}){this.points=R.points,this.duration=R.duration,this.blockDuration=R.blockDuration,this.execEvenly=R.execEvenly,this.execEvenlyMinDelayMs=R.execEvenlyMinDelayMs,this.keyPrefix=R.keyPrefix}get points(){return this._points}set points(R){this._points=R>=0?R:4}get duration(){return this._duration}set duration(R){this._duration=typeof R>"u"?1:R}get msDuration(){return 1e3*this.duration}get blockDuration(){return this._blockDuration}set blockDuration(R){this._blockDuration=typeof R>"u"?0:R}get msBlockDuration(){return 1e3*this.blockDuration}get execEvenly(){return this._execEvenly}set execEvenly(R){this._execEvenly=!(typeof R>"u")&&Boolean(R)}get execEvenlyMinDelayMs(){return this._execEvenlyMinDelayMs}set execEvenlyMinDelayMs(R){this._execEvenlyMinDelayMs=typeof R>"u"?Math.ceil(this.msDuration/this.points):R}get keyPrefix(){return this._keyPrefix}set keyPrefix(R){if(typeof R>"u"&&(R="rlflx"),"string"!=typeof R)throw new Error("keyPrefix must be string");this._keyPrefix=R}_getKeySecDuration(R={}){return R&&R.customDuration>=0?R.customDuration:this.duration}getKey(R){return this.keyPrefix.length>0?`${this.keyPrefix}:${R}`:R}parseKey(R){return R.substring(this.keyPrefix.length)}consume(){throw new Error("You have to implement the method 'consume'!")}penalty(){throw new Error("You have to implement the method 'penalty'!")}reward(){throw new Error("You have to implement the method 'reward'!")}get(){throw new Error("You have to implement the method 'get'!")}set(){throw new Error("You have to implement the method 'set'!")}block(){throw new Error("You have to implement the method 'block'!")}delete(){throw new Error("You have to implement the method 'delete'!")}}},9644:(Y,K,R)=>{const y=R(1265),l=R(5539),g=R(6953),b=R(4849),m=R(9658),d="rate_limiter_flexible";let c=null;const f=function(S,D,M,k){let F;F=null===k||!0===k||!1===k?k:{remainingPoints:k.remainingPoints,msBeforeNext:k.msBeforeNext,consumedPoints:k.consumedPoints,isFirstInDuration:k.isFirstInDuration},S.send({channel:d,keyPrefix:D.keyPrefix,promiseId:D.promiseId,type:M,data:F})},p=function(S){setTimeout(()=>{this._initiated?process.send(S):typeof this._promises[S.promiseId]<"u"&&p.call(this,S)},30)},w=function(S,D,M,k,F){const G={channel:d,keyPrefix:this.keyPrefix,func:S,promiseId:D,data:{key:M,arg:k,opts:F}};this._initiated?process.send(G):p.call(this,G)},I=function(S,D){if(!D||D.channel!==d||typeof this._rateLimiters[D.keyPrefix]>"u")return!1;let M;switch(D.func){case"consume":M=this._rateLimiters[D.keyPrefix].consume(D.data.key,D.data.arg,D.data.opts);break;case"penalty":M=this._rateLimiters[D.keyPrefix].penalty(D.data.key,D.data.arg,D.data.opts);break;case"reward":M=this._rateLimiters[D.keyPrefix].reward(D.data.key,D.data.arg,D.data.opts);break;case"block":M=this._rateLimiters[D.keyPrefix].block(D.data.key,D.data.arg,D.data.opts);break;case"get":M=this._rateLimiters[D.keyPrefix].get(D.data.key,D.data.opts);break;case"delete":M=this._rateLimiters[D.keyPrefix].delete(D.data.key,D.data.opts);break;default:return!1}M&&M.then(k=>{f(S,D,"resolve",k)}).catch(k=>{f(S,D,"reject",k)})},E=function(S){if(!S||S.channel!==d||S.keyPrefix!==this.keyPrefix)return!1;if(this._promises[S.promiseId]){let D;switch(clearTimeout(this._promises[S.promiseId].timeoutId),D=null===S.data||!0===S.data||!1===S.data?S.data:new m(S.data.remainingPoints,S.data.msBeforeNext,S.data.consumedPoints,S.data.isFirstInDuration),S.type){case"resolve":this._promises[S.promiseId].resolve(D);break;case"reject":this._promises[S.promiseId].reject(D);break;default:throw new Error(`RateLimiterCluster: no such message type '${S.type}'`)}delete this._promises[S.promiseId]}},v=function(){return{points:this.points,duration:this.duration,blockDuration:this.blockDuration,execEvenly:this.execEvenly,execEvenlyMinDelayMs:this.execEvenlyMinDelayMs,keyPrefix:this.keyPrefix}},h=function(S,D){const M=process.hrtime();let k=M[0].toString()+M[1].toString();return typeof this._promises[k]<"u"&&(k+=l.randomBytes(12).toString("base64")),this._promises[k]={resolve:S,reject:D,timeoutId:setTimeout(()=>{delete this._promises[k],D(new Error("RateLimiterCluster timeout: no answer from master in time"))},this.timeoutMs)},k};Y.exports={RateLimiterClusterMaster:class C{constructor(){if(c)return c;this._rateLimiters={},y.setMaxListeners(0),y.on("message",(D,M)=>{M&&M.channel===d&&"init"===M.type?(typeof this._rateLimiters[M.opts.keyPrefix]>"u"&&(this._rateLimiters[M.opts.keyPrefix]=new b(M.opts)),D.send({channel:d,type:"init",keyPrefix:M.opts.keyPrefix})):I.call(this,D,M)}),c=this}},RateLimiterClusterMasterPM2:class A{constructor(D){if(c)return c;this._rateLimiters={},D.launchBus((M,k)=>{k.on("process:msg",F=>{const G=F.raw;G&&G.channel===d&&"init"===G.type?(typeof this._rateLimiters[G.opts.keyPrefix]>"u"&&(this._rateLimiters[G.opts.keyPrefix]=new b(G.opts)),D.sendDataToProcessId(F.process.pm_id,{data:{},topic:d,channel:d,type:"init",keyPrefix:G.opts.keyPrefix},(T,O)=>{T&&console.log(T,O)})):I.call(this,{send:O=>{const V=O;V.topic=d,typeof V.data>"u"&&(V.data={}),D.sendDataToProcessId(F.process.pm_id,V,(L,H)=>{L&&console.log(L,H)})}},G)})}),c=this}},RateLimiterCluster:class N extends g{get timeoutMs(){return this._timeoutMs}set timeoutMs(D){this._timeoutMs=typeof D>"u"?5e3:Math.abs(parseInt(D))}constructor(D={}){super(D),process.setMaxListeners(0),this.timeoutMs=D.timeoutMs,this._initiated=!1,process.on("message",M=>{M&&M.channel===d&&"init"===M.type&&M.keyPrefix===this.keyPrefix?this._initiated=!0:E.call(this,M)}),process.send({channel:d,type:"init",opts:v.call(this)}),this._promises={}}consume(D,M=1,k={}){return new Promise((F,G)=>{const T=h.call(this,F,G);w.call(this,"consume",T,D,M,k)})}penalty(D,M=1,k={}){return new Promise((F,G)=>{const T=h.call(this,F,G);w.call(this,"penalty",T,D,M,k)})}reward(D,M=1,k={}){return new Promise((F,G)=>{const T=h.call(this,F,G);w.call(this,"reward",T,D,M,k)})}block(D,M,k={}){return new Promise((F,G)=>{const T=h.call(this,F,G);w.call(this,"block",T,D,M,k)})}get(D,M={}){return new Promise((k,F)=>{const G=h.call(this,k,F);w.call(this,"get",G,D,M)})}delete(D,M={}){return new Promise((k,F)=>{const G=h.call(this,k,F);w.call(this,"delete",G,D,M)})}}}},6492:(Y,K,R)=>{const y=R(3129),l=R(9658);Y.exports=class g extends y{constructor(m){super(m),this.client=m.storeClient}_getRateLimiterRes(m,d,c){const f=new l;return f.consumedPoints=parseInt(c.consumedPoints),f.isFirstInDuration=c.consumedPoints===d,f.remainingPoints=Math.max(this.points-f.consumedPoints,0),f.msBeforeNext=c.msBeforeNext,f}_upsert(m,d,c,f=!1,p={}){return new Promise((w,I)=>{const E=Date.now(),v=Math.floor(c/1e3);f?this.client.set(m,d,v,h=>{h?I(h):this.client.set(`${m}_expire`,v>0?E+1e3*v:-1,v,()=>{w({consumedPoints:d,msBeforeNext:v>0?1e3*v:-1})})}):this.client.incr(m,d,(h,C)=>{h||!1===C?this.client.add(m,d,v,(A,N)=>{if(A||!N)if(typeof p.attemptNumber>"u"||p.attemptNumber<3){const S=Object.assign({},p);S.attemptNumber=S.attemptNumber?S.attemptNumber+1:1,this._upsert(m,d,c,f,S).then(D=>w(D)).catch(D=>I(D))}else I(new Error("Can not add key"));else this.client.add(`${m}_expire`,v>0?E+1e3*v:-1,v,()=>{w({consumedPoints:d,msBeforeNext:v>0?1e3*v:-1})})}):this.client.get(`${m}_expire`,(A,N)=>{if(A)I(A);else{const S=!1===N?0:N,D={consumedPoints:C,msBeforeNext:S>=0?Math.max(S-E,0):-1};w(D)}})})})}_get(m){return new Promise((d,c)=>{const f=Date.now();this.client.get(m,(p,w)=>{w?this.client.get(`${m}_expire`,(I,E)=>{if(I)c(I);else{const v=!1===E?0:E,h={consumedPoints:w,msBeforeNext:v>=0?Math.max(v-f,0):-1};d(h)}}):d(null)})})}_delete(m){return new Promise((d,c)=>{this.client.del(m,(f,p)=>{f?c(f):!1===p?d(p):this.client.del(`${m}_expire`,w=>{w?c(w):d(p)})})})}}},4849:(Y,K,R)=>{const y=R(6953),l=R(6216),g=R(9658);Y.exports=class b extends y{constructor(d={}){super(d),this._memoryStorage=new l}consume(d,c=1,f={}){return new Promise((p,w)=>{const I=this.getKey(d),E=this._getKeySecDuration(f);let v=this._memoryStorage.incrby(I,c,E);if(v.remainingPoints=Math.max(this.points-v.consumedPoints,0),v.consumedPoints>this.points)this.blockDuration>0&&v.consumedPoints<=this.points+c&&(v=this._memoryStorage.set(I,v.consumedPoints,this.blockDuration)),w(v);else if(this.execEvenly&&v.msBeforeNext>0&&!v.isFirstInDuration){let h=Math.ceil(v.msBeforeNext/(v.remainingPoints+2));h<this.execEvenlyMinDelayMs&&(h=v.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(p,h,v)}else p(v)})}penalty(d,c=1,f={}){const p=this.getKey(d);return new Promise(w=>{const I=this._getKeySecDuration(f),E=this._memoryStorage.incrby(p,c,I);E.remainingPoints=Math.max(this.points-E.consumedPoints,0),w(E)})}reward(d,c=1,f={}){const p=this.getKey(d);return new Promise(w=>{const I=this._getKeySecDuration(f),E=this._memoryStorage.incrby(p,-c,I);E.remainingPoints=Math.max(this.points-E.consumedPoints,0),w(E)})}block(d,c){const f=1e3*c,p=this.points+1;return this._memoryStorage.set(this.getKey(d),p,c),Promise.resolve(new g(0,0===f?-1:f,p))}set(d,c,f){const p=1e3*(f>=0?f:this.duration);return this._memoryStorage.set(this.getKey(d),c,f),Promise.resolve(new g(0,0===p?-1:p,c))}get(d){const c=this._memoryStorage.get(this.getKey(d));return null!==c&&(c.remainingPoints=Math.max(this.points-c.consumedPoints,0)),Promise.resolve(c)}delete(d){return Promise.resolve(this._memoryStorage.delete(this.getKey(d)))}}},6217:(Y,K,R)=>{const y=R(3129),l=R(9658);function g(m){try{const d=m.client?m.client:m,{version:c}=d.topology.s.options.metadata.driver,f=c.split(".").map(p=>parseInt(p));return{major:f[0],feature:f[1],patch:f[2]}}catch{return{major:0,feature:0,patch:0}}}class b extends y{constructor(d){super(d),this.dbName=d.dbName,this.tableName=d.tableName,this.indexKeyPrefix=d.indexKeyPrefix,this.client=d.mongo?d.mongo:d.storeClient,"function"==typeof this.client.then?this.client.then(c=>{this.client=c,this._initCollection(),this._driverVersion=g(this.client)}):(this._initCollection(),this._driverVersion=g(this.client))}get dbName(){return this._dbName}set dbName(d){this._dbName=typeof d>"u"?b.getDbName():d}static getDbName(){return"node-rate-limiter-flexible"}get tableName(){return this._tableName}set tableName(d){this._tableName=typeof d>"u"?this.keyPrefix:d}get client(){return this._client}set client(d){if(typeof d>"u")throw new Error("mongo is not set");this._client=d}get indexKeyPrefix(){return this._indexKeyPrefix}set indexKeyPrefix(d){this._indexKeyPrefix=d||{}}_initCollection(){const c=("function"==typeof this.client.db?this.client.db(this.dbName):this.client).collection(this.tableName);c.createIndex({expire:-1},{expireAfterSeconds:0}),c.createIndex(Object.assign({},this.indexKeyPrefix,{key:1}),{unique:!0}),this._collection=c}_getRateLimiterRes(d,c,f){const p=new l;let w;return w=typeof f.value>"u"?f:f.value,p.isFirstInDuration=w.points===c,p.consumedPoints=w.points,p.remainingPoints=Math.max(this.points-p.consumedPoints,0),p.msBeforeNext=null!==w.expire?Math.max(new Date(w.expire).getTime()-Date.now(),0):-1,p}_upsert(d,c,f,p=!1,w={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const I=w.attrs||{};let E,v;p?(E={key:d},E=Object.assign(E,I),v={$set:{key:d,points:c,expire:f>0?new Date(Date.now()+f):null}},v.$set=Object.assign(v.$set,I)):(E={$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}],key:d},E=Object.assign(E,I),v={$setOnInsert:{key:d,expire:f>0?new Date(Date.now()+f):null},$inc:{points:c}},v.$setOnInsert=Object.assign(v.$setOnInsert,I));const h={upsert:!0};return this._driverVersion.major>=4||3===this._driverVersion.major&&this._driverVersion.feature>=7||this._driverVersion.feature>=6&&this._driverVersion.patch>=7?h.returnDocument="after":h.returnOriginal=!1,new Promise((C,A)=>{this._collection.findOneAndUpdate(E,v,h).then(N=>{C(N)}).catch(N=>{if(N&&11e3===N.code){const S=Object.assign({$or:[{expire:{$lte:new Date}},{expire:{$eq:null}}],key:d},I),D={$set:Object.assign({key:d,points:c,expire:f>0?new Date(Date.now()+f):null},I)};this._collection.findOneAndUpdate(S,D,h).then(M=>{C(M)}).catch(M=>{M&&11e3===M.code?this._upsert(d,c,f,p).then(k=>C(k)).catch(k=>A(k)):A(M)})}else A(N)})})}_get(d,c={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const f=c.attrs||{},p=Object.assign({key:d,$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}]},f);return this._collection.findOne(p)}_delete(d,c={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const p=Object.assign({key:d},c.attrs||{});return this._collection.deleteOne(p).then(w=>w.deletedCount>0)}}Y.exports=b},7840:(Y,K,R)=>{const y=R(3129),l=R(9658);Y.exports=class g extends y{constructor(m,d=null){super(m),this.client=m.storeClient,this.clientType=m.storeType,this.dbName=m.dbName,this.tableName=m.tableName,this.clearExpiredByTimeout=m.clearExpiredByTimeout,this.tableCreated=m.tableCreated,this.tableCreated?(this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"==typeof d&&d()):this._createDbAndTable().then(()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"==typeof d&&d()}).catch(c=>{if("function"!=typeof d)throw c;d(c)})}clearExpired(m){return new Promise(d=>{this._getConnection().then(c=>{c.query("DELETE FROM ??.?? WHERE expire < ?",[this.dbName,this.tableName,m],()=>{this._releaseConnection(c),d()})}).catch(()=>{d()})})}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout(()=>{this.clearExpired(Date.now()-36e5).then(()=>{this._clearExpiredHourAgo()})},3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":return new Promise((m,d)=>{this.client.getConnection((c,f)=>{if(c)return d(c);m(f)})});case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();default:return Promise.resolve(this.client)}}_releaseConnection(m){switch(this.clientType){case"pool":return m.release();case"sequelize":return this.client.connectionManager.releaseConnection(m);case"knex":return this.client.client.releaseConnection(m);default:return!0}}_createDbAndTable(){return new Promise((m,d)=>{this._getConnection().then(c=>{c.query(`CREATE DATABASE IF NOT EXISTS \`${this.dbName}\`;`,f=>{if(f)return this._releaseConnection(c),d(f);c.query(this._getCreateTableStmt(),p=>{if(p)return this._releaseConnection(c),d(p);this._releaseConnection(c),m()})})}).catch(c=>{d(c)})})}_getCreateTableStmt(){return`CREATE TABLE IF NOT EXISTS \`${this.dbName}\`.\`${this.tableName}\` (\`key\` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\`points\` INT(9) NOT NULL default 0,\`expire\` BIGINT UNSIGNED,PRIMARY KEY (\`key\`)) ENGINE = INNODB;`}get clientType(){return this._clientType}set clientType(m){if(typeof m>"u")if("Connection"===this.client.constructor.name)m="connection";else if("Pool"===this.client.constructor.name)m="pool";else{if("Sequelize"!==this.client.constructor.name)throw new Error("storeType is not defined");m="sequelize"}this._clientType=m.toLowerCase()}get dbName(){return this._dbName}set dbName(m){this._dbName=typeof m>"u"?"rtlmtrflx":m}get tableName(){return this._tableName}set tableName(m){this._tableName=typeof m>"u"?this.keyPrefix:m}get tableCreated(){return this._tableCreated}set tableCreated(m){this._tableCreated=!(typeof m>"u"||!m)}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(m){this._clearExpiredByTimeout=typeof m>"u"||Boolean(m)}_getRateLimiterRes(m,d,c){const f=new l,[p]=c;return f.isFirstInDuration=d===p.points,f.consumedPoints=f.isFirstInDuration?d:p.points,f.remainingPoints=Math.max(this.points-f.consumedPoints,0),f.msBeforeNext=p.expire?Math.max(p.expire-Date.now(),0):-1,f}_upsertTransaction(m,d,c,f,p){return new Promise((w,I)=>{m.query("BEGIN",E=>{if(E)return m.rollback(),I(E);const v=Date.now(),h=f>0?v+f:null;let C,A;p?(C="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = ?, \n expire = ?;",A=[this.dbName,this.tableName,d,c,h,c,h]):(C="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = IF(expire <= ?, ?, points + (?)), \n expire = IF(expire <= ?, ?, expire);",A=[this.dbName,this.tableName,d,c,h,v,c,c,v,h]),m.query(C,A,N=>{if(N)return m.rollback(),I(N);m.query("SELECT points, expire FROM ??.?? WHERE `key` = ?;",[this.dbName,this.tableName,d],(S,D)=>{if(S)return m.rollback(),I(S);m.query("COMMIT",M=>{if(M)return m.rollback(),I(M);w(D)})})})})})}_upsert(m,d,c,f=!1){return this.tableCreated?new Promise((p,w)=>{this._getConnection().then(I=>{this._upsertTransaction(I,m,d,c,f).then(E=>{p(E),this._releaseConnection(I)}).catch(E=>{w(E),this._releaseConnection(I)})}).catch(I=>{w(I)})}):Promise.reject(Error("Table is not created yet"))}_get(m){return this.tableCreated?new Promise((d,c)=>{this._getConnection().then(f=>{f.query("SELECT points, expire FROM ??.?? WHERE `key` = ? AND (`expire` > ? OR `expire` IS NULL)",[this.dbName,this.tableName,m,Date.now()],(p,w)=>{p?c(p):d(0===w.length?null:w),this._releaseConnection(f)})}).catch(f=>{c(f)})}):Promise.reject(Error("Table is not created yet"))}_delete(m){return this.tableCreated?new Promise((d,c)=>{this._getConnection().then(f=>{f.query("DELETE FROM ??.?? WHERE `key` = ?",[this.dbName,this.tableName,m],(p,w)=>{p?c(p):d(w.affectedRows>0),this._releaseConnection(f)})}).catch(f=>{c(f)})}):Promise.reject(Error("Table is not created yet"))}}},939:(Y,K,R)=>{const y=R(3129),l=R(9658);Y.exports=class g extends y{constructor(m,d=null){super(m),this.client=m.storeClient,this.clientType=m.storeType,this.tableName=m.tableName,this.clearExpiredByTimeout=m.clearExpiredByTimeout,this.tableCreated=m.tableCreated,this.tableCreated?"function"==typeof d&&d():this._createTable().then(()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"==typeof d&&d()}).catch(c=>{if("function"!=typeof d)throw c;d(c)})}clearExpired(m){return new Promise(d=>{this._query({name:"rlflx-clear-expired",text:`DELETE FROM ${this.tableName} WHERE expire < $1`,values:[m]}).then(()=>{d()}).catch(()=>{d()})})}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout(()=>{this.clearExpired(Date.now()-36e5).then(()=>{this._clearExpiredHourAgo()})},3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":default:return Promise.resolve(this.client);case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();case"typeorm":return Promise.resolve(this.client.driver.master)}}_releaseConnection(m){switch(this.clientType){case"pool":case"typeorm":default:return!0;case"sequelize":return this.client.connectionManager.releaseConnection(m);case"knex":return this.client.client.releaseConnection(m)}}_createTable(){return new Promise((m,d)=>{this._query({text:this._getCreateTableStmt()}).then(()=>{m()}).catch(c=>{"23505"===c.code?m():d(c)})})}_getCreateTableStmt(){return`CREATE TABLE IF NOT EXISTS ${this.tableName} ( \n key varchar(255) PRIMARY KEY,\n points integer NOT NULL DEFAULT 0,\n expire bigint\n );`}get clientType(){return this._clientType}set clientType(m){const d=this.client.constructor.name;if(typeof m>"u")if("Client"===d)m="client";else if("Pool"===d||"BoundPool"===d)m="pool";else{if("Sequelize"!==d)throw new Error("storeType is not defined");m="sequelize"}this._clientType=m.toLowerCase()}get tableName(){return this._tableName}set tableName(m){this._tableName=typeof m>"u"?this.keyPrefix:m}get tableCreated(){return this._tableCreated}set tableCreated(m){this._tableCreated=!(typeof m>"u"||!m)}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(m){this._clearExpiredByTimeout=typeof m>"u"||Boolean(m)}_getRateLimiterRes(m,d,c){const f=new l,p=c.rows[0];return f.isFirstInDuration=d===p.points,f.consumedPoints=f.isFirstInDuration?d:p.points,f.remainingPoints=Math.max(this.points-f.consumedPoints,0),f.msBeforeNext=p.expire?Math.max(p.expire-Date.now(),0):-1,f}_query(m){const c={name:`${this.tableName.toLowerCase()}:${m.name}`,text:m.text,values:m.values};return new Promise((f,p)=>{this._getConnection().then(w=>{w.query(c).then(I=>{f(I),this._releaseConnection(w)}).catch(I=>{p(I),this._releaseConnection(w)})}).catch(w=>{p(w)})})}_upsert(m,d,c,f=!1){if(!this.tableCreated)return Promise.reject(Error("Table is not created yet"));const p=c>0?Date.now()+c:null;return this._query({name:f?"rlflx-upsert-force":"rlflx-upsert",text:`\n INSERT INTO ${this.tableName} VALUES ($1, $2, $3)\n ON CONFLICT(key) DO UPDATE SET\n points = CASE\n WHEN (${this.tableName}.expire <= $4 OR 1=${f?1:0}) THEN $2\n ELSE ${this.tableName}.points + ($2)\n END,\n expire = ${f?" $3 ":` CASE\n WHEN ${this.tableName}.expire <= $4 THEN $3\n ELSE ${this.tableName}.expire\n END `}\n RETURNING points, expire;`,values:[m,d,p,Date.now()]})}_get(m){return this.tableCreated?new Promise((d,c)=>{this._query({name:"rlflx-get",text:`\n SELECT points, expire FROM ${this.tableName} WHERE key = $1 AND (expire > $2 OR expire IS NULL);`,values:[m,Date.now()]}).then(f=>{0===f.rowCount&&(f=null),d(f)}).catch(f=>{c(f)})}):Promise.reject(Error("Table is not created yet"))}_delete(m){return this.tableCreated?this._query({name:"rlflx-delete",text:`DELETE FROM ${this.tableName} WHERE key = $1`,values:[m]}).then(d=>d.rowCount>0):Promise.reject(Error("Table is not created yet"))}}},2816:(Y,K,R)=>{const y=R(2047),l=4294967295,g="limiter";Y.exports=class{constructor(d,c={maxQueueSize:l}){this._queueLimiters={KEY_DEFAULT:new b(d,c)},this._limiterFlexible=d,this._maxQueueSize=c.maxQueueSize}getTokensRemaining(d=g){return this._queueLimiters[d]?this._queueLimiters[d].getTokensRemaining():Promise.resolve(this._limiterFlexible.points)}removeTokens(d,c=g){return this._queueLimiters[c]||(this._queueLimiters[c]=new b(this._limiterFlexible,{key:c,maxQueueSize:this._maxQueueSize})),this._queueLimiters[c].removeTokens(d)}};class b{constructor(d,c={maxQueueSize:l,key:g}){this._key=c.key,this._waitTimeout=null,this._queue=[],this._limiterFlexible=d,this._maxQueueSize=c.maxQueueSize}getTokensRemaining(){return this._limiterFlexible.get(this._key).then(d=>null!==d?d.remainingPoints:this._limiterFlexible.points)}removeTokens(d){const c=this;return new Promise((f,p)=>{d>c._limiterFlexible.points?p(new y(`Requested tokens ${d} exceeds maximum ${c._limiterFlexible.points} tokens per interval`)):c._queue.length>0?c._queueRequest.call(c,f,p,d):c._limiterFlexible.consume(c._key,d).then(w=>{f(w.remainingPoints)}).catch(w=>{w instanceof Error?p(w):(c._queueRequest.call(c,f,p,d),null===c._waitTimeout&&(c._waitTimeout=setTimeout(c._processFIFO.bind(c),w.msBeforeNext)))})})}_queueRequest(d,c,f){const p=this;p._queue.length<p._maxQueueSize?p._queue.push({resolve:d,reject:c,tokens:f}):c(new y(`Number of requests reached it's maximum ${p._maxQueueSize}`))}_processFIFO(){const d=this;if(null!==d._waitTimeout&&(clearTimeout(d._waitTimeout),d._waitTimeout=null),0===d._queue.length)return;const c=d._queue.shift();d._limiterFlexible.consume(d._key,c.tokens).then(f=>{c.resolve(f.remainingPoints),d._processFIFO.call(d)}).catch(f=>{f instanceof Error?(c.reject(f),d._processFIFO.call(d)):(d._queue.unshift(c),null===d._waitTimeout&&(d._waitTimeout=setTimeout(d._processFIFO.bind(d),f.msBeforeNext)))})}}},9301:(Y,K,R)=>{const y=R(3129),l=R(9658),g="redis.call('set', KEYS[1], 0, 'EX', ARGV[2], 'NX') local consumed = redis.call('incrby', KEYS[1], ARGV[1]) local ttl = redis.call('pttl', KEYS[1]) if ttl == -1 then redis.call('expire', KEYS[1], ARGV[2]) ttl = 1000 * ARGV[2] end return {consumed, ttl} ";Y.exports=class b extends y{constructor(d){super(d),this.client=d.redis?d.redis:d.storeClient,this._rejectIfRedisNotReady=!!d.rejectIfRedisNotReady,"function"==typeof this.client.defineCommand&&this.client.defineCommand("rlflxIncr",{numberOfKeys:1,lua:g})}_isRedisReady(){return!this._rejectIfRedisNotReady||!(this.client.status&&"ready"!==this.client.status||"function"==typeof this.client.isReady&&!this.client.isReady())}_getRateLimiterRes(d,c,f){let[p,w]=f;Array.isArray(p)&&([,p]=p,[,w]=w);const I=new l;return I.consumedPoints=parseInt(p),I.isFirstInDuration=I.consumedPoints===c,I.remainingPoints=Math.max(this.points-I.consumedPoints,0),I.msBeforeNext=w,I}_upsert(d,c,f,p=!1){return new Promise((w,I)=>{if(!this._isRedisReady())return I(new Error("Redis connection is not ready"));const E=Math.floor(f/1e3),v=this.client.multi();if(p)E>0?v.set(d,c,"EX",E):v.set(d,c),v.pttl(d).exec((h,C)=>h?I(h):w(C));else if(E>0){const h=function(C,A){return C?I(C):w(A)};"function"==typeof this.client.rlflxIncr?this.client.rlflxIncr(d,c,E,h):this.client.eval(g,1,d,c,E,h)}else v.incrby(d,c).pttl(d).exec((h,C)=>h?I(h):w(C))})}_get(d){return new Promise((c,f)=>{if(!this._isRedisReady())return f(new Error("Redis connection is not ready"));this.client.multi().get(d).pttl(d).exec((p,w)=>{if(p)f(p);else{const[I]=w;if(null===I)return c(null);c(w)}})})}_delete(d){return new Promise((c,f)=>{this.client.del(d,(p,w)=>{p?f(p):c(w>0)})})}}},9658:Y=>{Y.exports=class{constructor(R,y,l,g){this.remainingPoints=typeof R>"u"?0:R,this.msBeforeNext=typeof y>"u"?0:y,this.consumedPoints=typeof l>"u"?0:l,this.isFirstInDuration=!(typeof g>"u")&&g}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(R){return this._msBeforeNext=R,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(R){return this._remainingPoints=R,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(R){return this._consumedPoints=R,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(R){this._isFirstInDuration=Boolean(R)}_getDecoratedProperties(){return{remainingPoints:this.remainingPoints,msBeforeNext:this.msBeforeNext,consumedPoints:this.consumedPoints,isFirstInDuration:this.isFirstInDuration}}[Symbol.for("nodejs.util.inspect.custom")](){return this._getDecoratedProperties()}toString(){return JSON.stringify(this._getDecoratedProperties())}toJSON(){return this._getDecoratedProperties()}}},3129:(Y,K,R)=>{const y=R(6953),l=R(8442),g=R(9658);Y.exports=class extends y{constructor(m={}){super(m),this.inMemoryBlockOnConsumed=m.inMemoryBlockOnConsumed||m.inmemoryBlockOnConsumed,this.inMemoryBlockDuration=m.inMemoryBlockDuration||m.inmemoryBlockDuration,this.insuranceLimiter=m.insuranceLimiter,this._inMemoryBlockedKeys=new l}get client(){return this._client}set client(m){if(typeof m>"u")throw new Error("storeClient is not set");this._client=m}_afterConsume(m,d,c,f,p,w={}){const I=this._getRateLimiterRes(c,f,p);if(this.inMemoryBlockOnConsumed>0&&!(this.inMemoryBlockDuration>0)&&I.consumedPoints>=this.inMemoryBlockOnConsumed)return this._inMemoryBlockedKeys.addMs(c,I.msBeforeNext),I.consumedPoints>this.points?d(I):m(I);if(I.consumedPoints>this.points){let E=Promise.resolve();this.blockDuration>0&&I.consumedPoints<=this.points+f&&(I.msBeforeNext=this.msBlockDuration,E=this._block(c,I.consumedPoints,this.msBlockDuration,w)),this.inMemoryBlockOnConsumed>0&&I.consumedPoints>=this.inMemoryBlockOnConsumed&&(this._inMemoryBlockedKeys.add(c,this.inMemoryBlockDuration),I.msBeforeNext=this.msInMemoryBlockDuration),E.then(()=>{d(I)}).catch(v=>{d(v)})}else if(this.execEvenly&&I.msBeforeNext>0&&!I.isFirstInDuration){let E=Math.ceil(I.msBeforeNext/(I.remainingPoints+2));E<this.execEvenlyMinDelayMs&&(E=I.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(m,E,I)}else m(I)}_handleError(m,d,c,f,p,w=!1,I={}){this.insuranceLimiter instanceof y?this.insuranceLimiter[d](p,w,I).then(E=>{c(E)}).catch(E=>{f(E)}):f(m)}get _inmemoryBlockedKeys(){return this._inMemoryBlockedKeys}getInmemoryBlockMsBeforeExpire(m){return this.getInMemoryBlockMsBeforeExpire(m)}get inmemoryBlockOnConsumed(){return this.inMemoryBlockOnConsumed}set inmemoryBlockOnConsumed(m){this.inMemoryBlockOnConsumed=m}get inmemoryBlockDuration(){return this.inMemoryBlockDuration}set inmemoryBlockDuration(m){this.inMemoryBlockDuration=m}get msInmemoryBlockDuration(){return 1e3*this.inMemoryBlockDuration}getInMemoryBlockMsBeforeExpire(m){return this.inMemoryBlockOnConsumed>0?this._inMemoryBlockedKeys.msBeforeExpire(m):0}get inMemoryBlockOnConsumed(){return this._inMemoryBlockOnConsumed}set inMemoryBlockOnConsumed(m){if(this._inMemoryBlockOnConsumed=m?parseInt(m):0,this.inMemoryBlockOnConsumed>0&&this.points>this.inMemoryBlockOnConsumed)throw new Error('inMemoryBlockOnConsumed option must be greater or equal "points" option')}get inMemoryBlockDuration(){return this._inMemoryBlockDuration}set inMemoryBlockDuration(m){if(this._inMemoryBlockDuration=m?parseInt(m):0,this.inMemoryBlockDuration>0&&0===this.inMemoryBlockOnConsumed)throw new Error("inMemoryBlockOnConsumed option must be set up")}get msInMemoryBlockDuration(){return 1e3*this._inMemoryBlockDuration}get insuranceLimiter(){return this._insuranceLimiter}set insuranceLimiter(m){if(typeof m<"u"&&!(m instanceof y))throw new Error("insuranceLimiter must be instance of RateLimiterAbstract");this._insuranceLimiter=m,this._insuranceLimiter&&(this._insuranceLimiter.blockDuration=this.blockDuration,this._insuranceLimiter.execEvenly=this.execEvenly)}block(m,d,c={}){const f=1e3*d;return this._block(this.getKey(m),this.points+1,f,c)}set(m,d,c,f={}){const p=1e3*(c>=0?c:this.duration);return this._block(this.getKey(m),d,p,f)}consume(m,d=1,c={}){return new Promise((f,p)=>{const w=this.getKey(m),I=this.getInMemoryBlockMsBeforeExpire(w);if(I>0)return p(new g(0,I));this._upsert(w,d,1e3*this._getKeySecDuration(c),!1,c).then(E=>{this._afterConsume(f,p,w,d,E)}).catch(E=>{this._handleError(E,"consume",f,p,m,d,c)})})}penalty(m,d=1,c={}){const f=this.getKey(m);return new Promise((p,w)=>{this._upsert(f,d,1e3*this._getKeySecDuration(c),!1,c).then(I=>{p(this._getRateLimiterRes(f,d,I))}).catch(I=>{this._handleError(I,"penalty",p,w,m,d,c)})})}reward(m,d=1,c={}){const f=this.getKey(m);return new Promise((p,w)=>{this._upsert(f,-d,1e3*this._getKeySecDuration(c),!1,c).then(I=>{p(this._getRateLimiterRes(f,-d,I))}).catch(I=>{this._handleError(I,"reward",p,w,m,d,c)})})}get(m,d={}){const c=this.getKey(m);return new Promise((f,p)=>{this._get(c,d).then(w=>{f(null===w||typeof w>"u"?null:this._getRateLimiterRes(c,0,w))}).catch(w=>{this._handleError(w,"get",f,p,m,d)})})}delete(m,d={}){const c=this.getKey(m);return new Promise((f,p)=>{this._delete(c,d).then(w=>{this._inMemoryBlockedKeys.delete(c),f(w)}).catch(w=>{this._handleError(w,"delete",f,p,m,d)})})}deleteInMemoryBlockedAll(){this._inMemoryBlockedKeys.delete()}_getRateLimiterRes(m,d,c){throw new Error("You have to implement the method '_getRateLimiterRes'!")}_block(m,d,c,f={}){return new Promise((p,w)=>{this._upsert(m,d,c,!0,f).then(()=>{p(new g(0,c>0?c:-1,d))}).catch(I=>{this._handleError(I,"block",p,w,this.parseKey(m),c/1e3,f)})})}_get(m,d={}){throw new Error("You have to implement the method '_get'!")}_delete(m,d={}){throw new Error("You have to implement the method '_delete'!")}_upsert(m,d,c,f=!1,p={}){throw new Error("You have to implement the method '_upsert'!")}}},8592:(Y,K,R)=>{const y=R(6953);Y.exports=class{constructor(...g){if(g.length<1)throw new Error("RateLimiterUnion: at least one limiter have to be passed");g.forEach(b=>{if(!(b instanceof y))throw new Error("RateLimiterUnion: all limiters have to be instance of RateLimiterAbstract")}),this._limiters=g}consume(g,b=1){return new Promise((m,d)=>{const c=[];this._limiters.forEach(f=>{c.push(f.consume(g,b).catch(p=>({rejected:!0,rej:p})))}),Promise.all(c).then(f=>{const p={};let w=!1;f.forEach(I=>{!0===I.rejected&&(w=!0)});for(let I=0;I<f.length;I++)w&&!0===f[I].rejected?p[this._limiters[I].keyPrefix]=f[I].rej:w||(p[this._limiters[I].keyPrefix]=f[I]);w?d(p):m(p)})})}}},2585:Y=>{Y.exports=class{constructor(){this._keys={},this._addedKeysAmount=0}collectExpired(){const R=Date.now();Object.keys(this._keys).forEach(y=>{this._keys[y]<=R&&delete this._keys[y]}),this._addedKeysAmount=Object.keys(this._keys).length}add(R,y){this.addMs(R,1e3*y)}addMs(R,y){this._keys[R]=Date.now()+y,this._addedKeysAmount++,this._addedKeysAmount>999&&this.collectExpired()}msBeforeExpire(R){const y=this._keys[R];if(y&&y>=Date.now()){this.collectExpired();const l=Date.now();return y>=l?y-l:0}return 0}delete(R){R?delete this._keys[R]:Object.keys(this._keys).forEach(y=>{delete this._keys[y]})}}},8442:(Y,K,R)=>{const y=R(2585);Y.exports=y},6216:(Y,K,R)=>{const y=R(7105),l=R(9658);Y.exports=class{constructor(){this._storage={}}incrby(b,m,d){if(this._storage[b]){const c=this._storage[b].expiresAt?this._storage[b].expiresAt.getTime()-(new Date).getTime():-1;return 0!==c?(this._storage[b].value=this._storage[b].value+m,new l(0,c,this._storage[b].value,!1)):this.set(b,m,d)}return this.set(b,m,d)}set(b,m,d){const c=1e3*d;return this._storage[b]&&this._storage[b].timeoutId&&clearTimeout(this._storage[b].timeoutId),this._storage[b]=new y(m,c>0?new Date(Date.now()+c):null),c>0&&(this._storage[b].timeoutId=setTimeout(()=>{delete this._storage[b]},c),this._storage[b].timeoutId.unref&&this._storage[b].timeoutId.unref()),new l(0,0===c?-1:c,this._storage[b].value,!0)}get(b){if(this._storage[b]){const m=this._storage[b].expiresAt?this._storage[b].expiresAt.getTime()-(new Date).getTime():-1;return new l(0,m,this._storage[b].value,!1)}return null}delete(b){return!!this._storage[b]&&(this._storage[b].timeoutId&&clearTimeout(this._storage[b].timeoutId),delete this._storage[b],!0)}}},7105:Y=>{Y.exports=class{constructor(R,y,l=null){this.value=R,this.expiresAt=y,this.timeoutId=l}get value(){return this._value}set value(R){this._value=parseInt(R)}get expiresAt(){return this._expiresAt}set expiresAt(R){!(R instanceof Date)&&Number.isInteger(R)&&(R=new Date(R)),this._expiresAt=R}get timeoutId(){return this._timeoutId}set timeoutId(R){this._timeoutId=R}}},2047:Y=>{Y.exports=class extends Error{constructor(R,y){super(),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="CustomError",this.message=R,y&&(this.extra=y)}}},4033:(Y,K,R)=>{"use strict";Y.exports=m;var y=R(4366),l=m.prototype,g=new Date%1e9;function m(d){this.id=(d=d||{}).id||function b(){return(1e9*Math.random()>>>0)+g++}(),this.max=d.max||1/0,this.items=d.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(d.lastModified||new Date);for(var c,f,p=this.items.length;p--;)c=this.items[p],f=new Date(c.expires)-new Date,this._lookup[c.key]=c,f>0?this.expire(c.key,f):f<=0&&this.delete(c.key)}l.has=function(d){return d in this._lookup},l.get=function(d){if(!this.has(d))return null;var c=this._lookup[d];return c.refresh&&this.expire(d,c.refresh),this.items.splice(this.items.indexOf(c),1),this.items.push(c),c.value},l.meta=function(d){if(!this.has(d))return null;var c=this._lookup[d];return"meta"in c?c.meta:null},l.set=function(d,c,f){var p=this._lookup[d],w=this._lookup[d]={key:d,value:c};return this.lastModified=new Date,p?(clearTimeout(p.timeout),this.items.splice(this.items.indexOf(p),1,w)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(w),this.size++),f&&("ttl"in f&&this.expire(d,f.ttl),"meta"in f&&(w.meta=f.meta),f.refresh&&(w.refresh=f.ttl)),this},l.delete=function(d){var c=this._lookup[d];return!!c&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(c),1),clearTimeout(c.timeout),delete this._lookup[d],this.size--,this)},l.expire=function(d,c){var f=c||0,p=this._lookup[d];if(!p)return this;if("string"==typeof f&&(f=y(c)),"number"!=typeof f)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(p.timeout),p.timeout=setTimeout(this.delete.bind(this,p.key),f),p.expires=Number(new Date)+f,this},l.clear=function(){for(var d=this.items.length;d--;)this.delete(this.items[d].key);return this},l.toJSON=function(){for(var c,d=new Array(this.items.length),f=d.length;f--;)d[f]={key:(c=this.items[f]).key,meta:c.meta,value:c.value,expires:c.expires,refresh:c.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:d}}},2502:(Y,K,R)=>{"use strict";const y=R(7806);class l{constructor(m,d,c){const f=this;this._started=y(),this._rescheduled=0,this._scheduled=d,this._args=c,this._triggered=!1,this._timerWrapper=()=>{f._rescheduled>0?(f._scheduled=f._rescheduled-(y()-f._started),f._schedule(f._scheduled)):(f._triggered=!0,m.apply(null,f._args))},this._timer=setTimeout(this._timerWrapper,d)}reschedule(m){m||(m=this._scheduled);const d=y();d+m-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(m)):this._triggered?this._schedule(m):(this._started=d,this._rescheduled=m)}_schedule(m){this._triggered=!1,this._started=y(),this._rescheduled=0,this._scheduled=m,this._timer=setTimeout(this._timerWrapper,m)}clear(){clearTimeout(this._timer)}}Y.exports=function g(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");let b;if(arguments.length>0){b=new Array(arguments.length-2);for(var m=0;m<b.length;m++)b[m]=arguments[m+2]}return new l(arguments[0],arguments[1],b)}},7806:Y=>{"use strict";Y.exports=function(){return Date.now()}},9014:(Y,K,R)=>{"use strict";var y=R(9942),l=/[\/\?<>\\:\*\|"]/g,g=/[\x00-\x1f\x80-\x9f]/g,b=/^\.+$/,m=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,d=/[\. ]+$/;function c(f,p){if("string"!=typeof f)throw new Error("Input must be string");var w=f.replace(l,p).replace(g,p).replace(b,p).replace(m,p).replace(d,p);return y(w,255)}Y.exports=function(f,p){var w=p&&p.replacement||"",I=c(f,w);return""===w?I:c(I,"")}},1466:(Y,K,R)=>{"use strict";var y=R(7156).default;const l=new Map;function m(){return(m=y(function*(f,p,w){for(;l.get(w);){try{yield f()}catch(I){setTimeout(()=>{throw I},1);break}if(!l.get(w))break;yield new Promise(I=>{const E=setTimeout(I,p);l.set(w,E)})}})).apply(this,arguments)}Y.exports={setDelayedInterval:function d(f,p,w){w=w||p;const I=`${Date.now()}:${Math.floor(1e6*Math.random())}`,E=setTimeout(()=>{!function b(f,p,w){m.apply(this,arguments)}(f,p,I)},w);return l.set(I,E),I},clearDelayedInterval:function c(f){const p=l.get(f);p&&(clearTimeout(p),l.delete(f))}}},1420:(Y,K,R)=>{"use strict";const{AbortController:y}=globalThis,l=R(2502);class g extends y{constructor(m){super(),this._ms=m,this._timer=l(()=>this.abort(),m),Object.setPrototypeOf(this,g.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=l(()=>this.abort(),this._ms)}}Y.exports={TimeoutController:g}},9942:(Y,K,R)=>{"use strict";var y=R(8831),l=R(8871);Y.exports=y.bind(null,l)},8831:Y=>{"use strict";function R(y){return y>=56320&&y<=57343}Y.exports=function(l,g,b){if("string"!=typeof g)throw new Error("Input must be string");for(var c,f,m=g.length,d=0,p=0;p<m;p+=1){if(c=g.charCodeAt(p),f=g[p],(y=c)>=55296&&y<=56319&&R(g.charCodeAt(p+1))&&(f+=g[p+=1]),(d+=l(f))===b)return g.slice(0,p+1);if(d>b)return g.slice(0,p-f.length+1)}var y;return g}},8871:Y=>{"use strict";function K(y){return y>=55296&&y<=56319}Y.exports=function(l){if("string"!=typeof l)throw new Error("Input must be string");for(var g=l.length,b=0,m=null,d=null,c=0;c<g;c++)(y=m=l.charCodeAt(c))>=56320&&y<=57343?null!=d&&K(d)?b+=1:b+=3:m<=127?b+=1:m>=128&&m<=2047?b+=2:m>=2048&&m<=65535&&(b+=3),d=m;var y;return b}},3004:Y=>{Y.exports=function y(l,m){var f,b=0,d=0,c=m=m||0,p=l.length;do{if(c>=p||d>49)throw y.bytes=0,new RangeError("Could not decode varint");f=l[c++],b+=d<28?(127&f)<<d:(127&f)*Math.pow(2,d),d+=7}while(f>=128);return y.bytes=c-m,b}},5723:Y=>{Y.exports=function g(b,m,d){if(Number.MAX_SAFE_INTEGER&&b>Number.MAX_SAFE_INTEGER)throw g.bytes=0,new RangeError("Could not encode varint");m=m||[];for(var c=d=d||0;b>=l;)m[d++]=255&b|128,b/=128;for(;-128&b;)m[d++]=255&b|128,b>>>=7;return m[d]=0|b,g.bytes=d-c+1,m};var l=Math.pow(2,31)},1732:(Y,K,R)=>{Y.exports={encode:R(5723),decode:R(3004),encodingLength:R(4036)}},4036:Y=>{var K=Math.pow(2,7),R=Math.pow(2,14),y=Math.pow(2,21),l=Math.pow(2,28),g=Math.pow(2,35),b=Math.pow(2,42),m=Math.pow(2,49),d=Math.pow(2,56),c=Math.pow(2,63);Y.exports=function(f){return f<K?1:f<R?2:f<y?3:f<l?4:f<g?5:f<b?6:f<m?7:f<d?8:f<c?9:10}},8583:()=>{"use strict";!function(ie){const le=ie.performance;function ge($t){le&&le.mark&&le.mark($t)}function ye($t,rt){le&&le.measure&&le.measure($t,rt)}ge("Zone");const be=ie.__Zone_symbol_prefix||"__zone_symbol__";function Ae($t){return be+$t}const ze=!0===ie[Ae("forceDuplicateZoneCheck")];if(ie.Zone){if(ze||"function"!=typeof ie.Zone.__symbol__)throw new Error("Zone already loaded.");return ie.Zone}let Ge=(()=>{class $t{constructor(ce,me){this._parent=ce,this._name=me?me.name||"unnamed":"<root>",this._properties=me&&me.properties||{},this._zoneDelegate=new Je(this,this._parent&&this._parent._zoneDelegate,me)}static assertZonePatched(){if(ie.Promise!==Ei.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let ce=$t.current;for(;ce.parent;)ce=ce.parent;return ce}static get current(){return Rn.zone}static get currentTask(){return Fr}static __load_patch(ce,me,ft=!1){if(Ei.hasOwnProperty(ce)){if(!ft&&ze)throw Error("Already loaded patch: "+ce)}else if(!ie["__Zone_disable_"+ce]){const St="Zone:"+ce;ge(St),Ei[ce]=me(ie,$t,Wn),ye(St,St)}}get parent(){return this._parent}get name(){return this._name}get(ce){const me=this.getZoneWith(ce);if(me)return me._properties[ce]}getZoneWith(ce){let me=this;for(;me;){if(me._properties.hasOwnProperty(ce))return me;me=me._parent}return null}fork(ce){if(!ce)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,ce)}wrap(ce,me){if("function"!=typeof ce)throw new Error("Expecting function got: "+ce);const ft=this._zoneDelegate.intercept(this,ce,me),St=this;return function(){return St.runGuarded(ft,this,arguments,me)}}run(ce,me,ft,St){Rn={parent:Rn,zone:this};try{return this._zoneDelegate.invoke(this,ce,me,ft,St)}finally{Rn=Rn.parent}}runGuarded(ce,me=null,ft,St){Rn={parent:Rn,zone:this};try{try{return this._zoneDelegate.invoke(this,ce,me,ft,St)}catch(Tn){if(this._zoneDelegate.handleError(this,Tn))throw Tn}}finally{Rn=Rn.parent}}runTask(ce,me,ft){if(ce.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(ce.zone||Hn).name+"; Execution: "+this.name+")");if(ce.state===Ht&&(ce.type===Pr||ce.type===_t))return;const St=ce.state!=ot;St&&ce._transitionTo(ot,sn),ce.runCount++;const Tn=Fr;Fr=ce,Rn={parent:Rn,zone:this};try{ce.type==_t&&ce.data&&!ce.data.isPeriodic&&(ce.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,ce,me,ft)}catch(Ve){if(this._zoneDelegate.handleError(this,Ve))throw Ve}}finally{ce.state!==Ht&&ce.state!==tt&&(ce.type==Pr||ce.data&&ce.data.isPeriodic?St&&ce._transitionTo(sn,ot):(ce.runCount=0,this._updateTaskCount(ce,-1),St&&ce._transitionTo(Ht,ot,Ht))),Rn=Rn.parent,Fr=Tn}}scheduleTask(ce){if(ce.zone&&ce.zone!==this){let ft=this;for(;ft;){if(ft===ce.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${ce.zone.name}`);ft=ft.parent}}ce._transitionTo(In,Ht);const me=[];ce._zoneDelegates=me,ce._zone=this;try{ce=this._zoneDelegate.scheduleTask(this,ce)}catch(ft){throw ce._transitionTo(tt,In,Ht),this._zoneDelegate.handleError(this,ft),ft}return ce._zoneDelegates===me&&this._updateTaskCount(ce,1),ce.state==In&&ce._transitionTo(sn,In),ce}scheduleMicroTask(ce,me,ft,St){return this.scheduleTask(new Fe(jt,ce,me,ft,St,void 0))}scheduleMacroTask(ce,me,ft,St,Tn){return this.scheduleTask(new Fe(_t,ce,me,ft,St,Tn))}scheduleEventTask(ce,me,ft,St,Tn){return this.scheduleTask(new Fe(Pr,ce,me,ft,St,Tn))}cancelTask(ce){if(ce.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(ce.zone||Hn).name+"; Execution: "+this.name+")");ce._transitionTo(_n,sn,ot);try{this._zoneDelegate.cancelTask(this,ce)}catch(me){throw ce._transitionTo(tt,_n),this._zoneDelegate.handleError(this,me),me}return this._updateTaskCount(ce,-1),ce._transitionTo(Ht,_n),ce.runCount=0,ce}_updateTaskCount(ce,me){const ft=ce._zoneDelegates;-1==me&&(ce._zoneDelegates=null);for(let St=0;St<ft.length;St++)ft[St]._updateTaskCount(ce.type,me)}}return $t.__symbol__=Ae,$t})();const et={name:"",onHasTask:($t,rt,ce,me)=>$t.hasTask(ce,me),onScheduleTask:($t,rt,ce,me)=>$t.scheduleTask(ce,me),onInvokeTask:($t,rt,ce,me,ft,St)=>$t.invokeTask(ce,me,ft,St),onCancelTask:($t,rt,ce,me)=>$t.cancelTask(ce,me)};class Je{constructor(rt,ce,me){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=rt,this._parentDelegate=ce,this._forkZS=me&&(me&&me.onFork?me:ce._forkZS),this._forkDlgt=me&&(me.onFork?ce:ce._forkDlgt),this._forkCurrZone=me&&(me.onFork?this.zone:ce._forkCurrZone),this._interceptZS=me&&(me.onIntercept?me:ce._interceptZS),this._interceptDlgt=me&&(me.onIntercept?ce:ce._interceptDlgt),this._interceptCurrZone=me&&(me.onIntercept?this.zone:ce._interceptCurrZone),this._invokeZS=me&&(me.onInvoke?me:ce._invokeZS),this._invokeDlgt=me&&(me.onInvoke?ce:ce._invokeDlgt),this._invokeCurrZone=me&&(me.onInvoke?this.zone:ce._invokeCurrZone),this._handleErrorZS=me&&(me.onHandleError?me:ce._handleErrorZS),this._handleErrorDlgt=me&&(me.onHandleError?ce:ce._handleErrorDlgt),this._handleErrorCurrZone=me&&(me.onHandleError?this.zone:ce._handleErrorCurrZone),this._scheduleTaskZS=me&&(me.onScheduleTask?me:ce._scheduleTaskZS),this._scheduleTaskDlgt=me&&(me.onScheduleTask?ce:ce._scheduleTaskDlgt),this._scheduleTaskCurrZone=me&&(me.onScheduleTask?this.zone:ce._scheduleTaskCurrZone),this._invokeTaskZS=me&&(me.onInvokeTask?me:ce._invokeTaskZS),this._invokeTaskDlgt=me&&(me.onInvokeTask?ce:ce._invokeTaskDlgt),this._invokeTaskCurrZone=me&&(me.onInvokeTask?this.zone:ce._invokeTaskCurrZone),this._cancelTaskZS=me&&(me.onCancelTask?me:ce._cancelTaskZS),this._cancelTaskDlgt=me&&(me.onCancelTask?ce:ce._cancelTaskDlgt),this._cancelTaskCurrZone=me&&(me.onCancelTask?this.zone:ce._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const ft=me&&me.onHasTask;(ft||ce&&ce._hasTaskZS)&&(this._hasTaskZS=ft?me:et,this._hasTaskDlgt=ce,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=rt,me.onScheduleTask||(this._scheduleTaskZS=et,this._scheduleTaskDlgt=ce,this._scheduleTaskCurrZone=this.zone),me.onInvokeTask||(this._invokeTaskZS=et,this._invokeTaskDlgt=ce,this._invokeTaskCurrZone=this.zone),me.onCancelTask||(this._cancelTaskZS=et,this._cancelTaskDlgt=ce,this._cancelTaskCurrZone=this.zone))}fork(rt,ce){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,rt,ce):new Ge(rt,ce)}intercept(rt,ce,me){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,rt,ce,me):ce}invoke(rt,ce,me,ft,St){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,rt,ce,me,ft,St):ce.apply(me,ft)}handleError(rt,ce){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,rt,ce)}scheduleTask(rt,ce){let me=ce;if(this._scheduleTaskZS)this._hasTaskZS&&me._zoneDelegates.push(this._hasTaskDlgtOwner),me=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,rt,ce),me||(me=ce);else if(ce.scheduleFn)ce.scheduleFn(ce);else{if(ce.type!=jt)throw new Error("Task is missing scheduleFn.");dt(ce)}return me}invokeTask(rt,ce,me,ft){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,rt,ce,me,ft):ce.callback.apply(me,ft)}cancelTask(rt,ce){let me;if(this._cancelTaskZS)me=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,rt,ce);else{if(!ce.cancelFn)throw Error("Task is not cancelable");me=ce.cancelFn(ce)}return me}hasTask(rt,ce){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,rt,ce)}catch(me){this.handleError(rt,me)}}_updateTaskCount(rt,ce){const me=this._taskCounts,ft=me[rt],St=me[rt]=ft+ce;if(St<0)throw new Error("More tasks executed then were scheduled.");0!=ft&&0!=St||this.hasTask(this.zone,{microTask:me.microTask>0,macroTask:me.macroTask>0,eventTask:me.eventTask>0,change:rt})}}class Fe{constructor(rt,ce,me,ft,St,Tn){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=rt,this.source=ce,this.data=ft,this.scheduleFn=St,this.cancelFn=Tn,!me)throw new Error("callback is not defined");this.callback=me;const Ve=this;this.invoke=rt===Pr&&ft&&ft.useG?Fe.invokeTask:function(){return Fe.invokeTask.call(ie,Ve,this,arguments)}}static invokeTask(rt,ce,me){rt||(rt=this),Sr++;try{return rt.runCount++,rt.zone.runTask(rt,ce,me)}finally{1==Sr&&Qe(),Sr--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(Ht,In)}_transitionTo(rt,ce,me){if(this._state!==ce&&this._state!==me)throw new Error(`${this.type} '${this.source}': can not transition to '${rt}', expecting state '${ce}'${me?" or '"+me+"'":""}, was '${this._state}'.`);this._state=rt,rt==Ht&&(this._zoneDelegates=null)}toString(){return this.data&&typeof this.data.handleId<"u"?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const Ee=Ae("setTimeout"),pe=Ae("Promise"),we=Ae("then");let at,Le=[],Me=!1;function Pt($t){if(at||ie[pe]&&(at=ie[pe].resolve(0)),at){let rt=at[we];rt||(rt=at.then),rt.call(at,$t)}else ie[Ee]($t,0)}function dt($t){0===Sr&&0===Le.length&&Pt(Qe),$t&&Le.push($t)}function Qe(){if(!Me){for(Me=!0;Le.length;){const $t=Le;Le=[];for(let rt=0;rt<$t.length;rt++){const ce=$t[rt];try{ce.zone.runTask(ce,null,null)}catch(me){Wn.onUnhandledError(me)}}}Wn.microtaskDrainDone(),Me=!1}}const Hn={name:"NO ZONE"},Ht="notScheduled",In="scheduling",sn="scheduled",ot="running",_n="canceling",tt="unknown",jt="microTask",_t="macroTask",Pr="eventTask",Ei={},Wn={symbol:Ae,currentZoneFrame:()=>Rn,onUnhandledError:Pn,microtaskDrainDone:Pn,scheduleMicroTask:dt,showUncaughtError:()=>!Ge[Ae("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:Pn,patchMethod:()=>Pn,bindArguments:()=>[],patchThen:()=>Pn,patchMacroTask:()=>Pn,patchEventPrototype:()=>Pn,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>Pn,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>Pn,wrapWithCurrentZone:()=>Pn,filterProperties:()=>[],attachOriginToPatched:()=>Pn,_redefineProperty:()=>Pn,patchCallbacks:()=>Pn,nativeScheduleMicroTask:Pt};let Rn={parent:null,zone:new Ge(null,null)},Fr=null,Sr=0;function Pn(){}ye("Zone","Zone"),ie.Zone=Ge}(typeof window<"u"&&window||typeof self<"u"&&self||global);const Y=Object.getOwnPropertyDescriptor,K=Object.defineProperty,R=Object.getPrototypeOf,y=Object.create,l=Array.prototype.slice,g="addEventListener",b="removeEventListener",m=Zone.__symbol__(g),d=Zone.__symbol__(b),c="true",f="false",p=Zone.__symbol__("");function w(ie,le){return Zone.current.wrap(ie,le)}function I(ie,le,ge,ye,be){return Zone.current.scheduleMacroTask(ie,le,ge,ye,be)}const E=Zone.__symbol__,v=typeof window<"u",h=v?window:void 0,C=v&&h||"object"==typeof self&&self||global;function N(ie,le){for(let ge=ie.length-1;ge>=0;ge--)"function"==typeof ie[ge]&&(ie[ge]=w(ie[ge],le+"_"+ge));return ie}function D(ie){return!ie||!1!==ie.writable&&!("function"==typeof ie.get&&typeof ie.set>"u")}const M=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,k=!("nw"in C)&&typeof C.process<"u"&&"[object process]"==={}.toString.call(C.process),F=!k&&!M&&!(!v||!h.HTMLElement),G=typeof C.process<"u"&&"[object process]"==={}.toString.call(C.process)&&!M&&!(!v||!h.HTMLElement),T={},O=function(ie){if(!(ie=ie||C.event))return;let le=T[ie.type];le||(le=T[ie.type]=E("ON_PROPERTY"+ie.type));const ge=this||ie.target||C,ye=ge[le];let be;if(F&&ge===h&&"error"===ie.type){const Ae=ie;be=ye&&ye.call(this,Ae.message,Ae.filename,Ae.lineno,Ae.colno,Ae.error),!0===be&&ie.preventDefault()}else be=ye&&ye.apply(this,arguments),null!=be&&!be&&ie.preventDefault();return be};function V(ie,le,ge){let ye=Y(ie,le);if(!ye&&ge&&Y(ge,le)&&(ye={enumerable:!0,configurable:!0}),!ye||!ye.configurable)return;const be=E("on"+le+"patched");if(ie.hasOwnProperty(be)&&ie[be])return;delete ye.writable,delete ye.value;const Ae=ye.get,ze=ye.set,Ge=le.slice(2);let et=T[Ge];et||(et=T[Ge]=E("ON_PROPERTY"+Ge)),ye.set=function(Je){let Fe=this;!Fe&&ie===C&&(Fe=C),Fe&&("function"==typeof Fe[et]&&Fe.removeEventListener(Ge,O),ze&&ze.call(Fe,null),Fe[et]=Je,"function"==typeof Je&&Fe.addEventListener(Ge,O,!1))},ye.get=function(){let Je=this;if(!Je&&ie===C&&(Je=C),!Je)return null;const Fe=Je[et];if(Fe)return Fe;if(Ae){let Ee=Ae.call(this);if(Ee)return ye.set.call(this,Ee),"function"==typeof Je.removeAttribute&&Je.removeAttribute(le),Ee}return null},K(ie,le,ye),ie[be]=!0}function L(ie,le,ge){if(le)for(let ye=0;ye<le.length;ye++)V(ie,"on"+le[ye],ge);else{const ye=[];for(const be in ie)"on"==be.slice(0,2)&&ye.push(be);for(let be=0;be<ye.length;be++)V(ie,ye[be],ge)}}const H=E("originalInstance");function ne(ie){const le=C[ie];if(!le)return;C[E(ie)]=le,C[ie]=function(){const be=N(arguments,ie);switch(be.length){case 0:this[H]=new le;break;case 1:this[H]=new le(be[0]);break;case 2:this[H]=new le(be[0],be[1]);break;case 3:this[H]=new le(be[0],be[1],be[2]);break;case 4:this[H]=new le(be[0],be[1],be[2],be[3]);break;default:throw new Error("Arg list too long.")}},Z(C[ie],le);const ge=new le(function(){});let ye;for(ye in ge)"XMLHttpRequest"===ie&&"responseBlob"===ye||function(be){"function"==typeof ge[be]?C[ie].prototype[be]=function(){return this[H][be].apply(this[H],arguments)}:K(C[ie].prototype,be,{set:function(Ae){"function"==typeof Ae?(this[H][be]=w(Ae,ie+"."+be),Z(this[H][be],Ae)):this[H][be]=Ae},get:function(){return this[H][be]}})}(ye);for(ye in le)"prototype"!==ye&&le.hasOwnProperty(ye)&&(C[ie][ye]=le[ye])}function j(ie,le,ge){let ye=ie;for(;ye&&!ye.hasOwnProperty(le);)ye=R(ye);!ye&&ie[le]&&(ye=ie);const be=E(le);let Ae=null;if(ye&&(!(Ae=ye[be])||!ye.hasOwnProperty(be))&&(Ae=ye[be]=ye[le],D(ye&&Y(ye,le)))){const Ge=ge(Ae,be,le);ye[le]=function(){return Ge(this,arguments)},Z(ye[le],Ae)}return Ae}function ee(ie,le,ge){let ye=null;function be(Ae){const ze=Ae.data;return ze.args[ze.cbIdx]=function(){Ae.invoke.apply(this,arguments)},ye.apply(ze.target,ze.args),Ae}ye=j(ie,le,Ae=>function(ze,Ge){const et=ge(ze,Ge);return et.cbIdx>=0&&"function"==typeof Ge[et.cbIdx]?I(et.name,Ge[et.cbIdx],et,be):Ae.apply(ze,Ge)})}function Z(ie,le){ie[E("OriginalDelegate")]=le}let q=!1,te=!1;function de(){if(q)return te;q=!0;try{const ie=h.navigator.userAgent;(-1!==ie.indexOf("MSIE ")||-1!==ie.indexOf("Trident/")||-1!==ie.indexOf("Edge/"))&&(te=!0)}catch{}return te}Zone.__load_patch("ZoneAwarePromise",(ie,le,ge)=>{const ye=Object.getOwnPropertyDescriptor,be=Object.defineProperty,ze=ge.symbol,Ge=[],et=!0===ie[ze("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],Je=ze("Promise"),Fe=ze("then");ge.onUnhandledError=Ve=>{if(ge.showUncaughtError()){const je=Ve&&Ve.rejection;je?console.error("Unhandled Promise rejection:",je instanceof Error?je.message:je,"; Zone:",Ve.zone.name,"; Task:",Ve.task&&Ve.task.source,"; Value:",je,je instanceof Error?je.stack:void 0):console.error(Ve)}},ge.microtaskDrainDone=()=>{for(;Ge.length;){const Ve=Ge.shift();try{Ve.zone.runGuarded(()=>{throw Ve.throwOriginal?Ve.rejection:Ve})}catch(je){we(je)}}};const pe=ze("unhandledPromiseRejectionHandler");function we(Ve){ge.onUnhandledError(Ve);try{const je=le[pe];"function"==typeof je&&je.call(this,Ve)}catch{}}function Le(Ve){return Ve&&Ve.then}function Me(Ve){return Ve}function at(Ve){return ce.reject(Ve)}const Pt=ze("state"),dt=ze("value"),Qe=ze("finally"),Hn=ze("parentPromiseValue"),Ht=ze("parentPromiseState"),sn=null,_n=!1;function jt(Ve,je){return Te=>{try{Wn(Ve,je,Te)}catch($e){Wn(Ve,!1,$e)}}}const _t=function(){let Ve=!1;return function(Te){return function(){Ve||(Ve=!0,Te.apply(null,arguments))}}},Ei=ze("currentTaskTrace");function Wn(Ve,je,Te){const $e=_t();if(Ve===Te)throw new TypeError("Promise resolved with itself");if(Ve[Pt]===sn){let ct=null;try{("object"==typeof Te||"function"==typeof Te)&&(ct=Te&&Te.then)}catch(pt){return $e(()=>{Wn(Ve,!1,pt)})(),Ve}if(je!==_n&&Te instanceof ce&&Te.hasOwnProperty(Pt)&&Te.hasOwnProperty(dt)&&Te[Pt]!==sn)Fr(Te),Wn(Ve,Te[Pt],Te[dt]);else if(je!==_n&&"function"==typeof ct)try{ct.call(Te,$e(jt(Ve,je)),$e(jt(Ve,!1)))}catch(pt){$e(()=>{Wn(Ve,!1,pt)})()}else{Ve[Pt]=je;const pt=Ve[dt];if(Ve[dt]=Te,Ve[Qe]===Qe&&!0===je&&(Ve[Pt]=Ve[Ht],Ve[dt]=Ve[Hn]),je===_n&&Te instanceof Error){const it=le.currentTask&&le.currentTask.data&&le.currentTask.data.__creationTrace__;it&&be(Te,Ei,{configurable:!0,enumerable:!1,writable:!0,value:it})}for(let it=0;it<pt.length;)Sr(Ve,pt[it++],pt[it++],pt[it++],pt[it++]);if(0==pt.length&&je==_n){Ve[Pt]=0;let it=Te;try{throw new Error("Uncaught (in promise): "+function Ae(Ve){return Ve&&Ve.toString===Object.prototype.toString?(Ve.constructor&&Ve.constructor.name||"")+": "+JSON.stringify(Ve):Ve?Ve.toString():Object.prototype.toString.call(Ve)}(Te)+(Te&&Te.stack?"\n"+Te.stack:""))}catch(gt){it=gt}et&&(it.throwOriginal=!0),it.rejection=Te,it.promise=Ve,it.zone=le.current,it.task=le.currentTask,Ge.push(it),ge.scheduleMicroTask()}}}return Ve}const Rn=ze("rejectionHandledHandler");function Fr(Ve){if(0===Ve[Pt]){try{const je=le[Rn];je&&"function"==typeof je&&je.call(this,{rejection:Ve[dt],promise:Ve})}catch{}Ve[Pt]=_n;for(let je=0;je<Ge.length;je++)Ve===Ge[je].promise&&Ge.splice(je,1)}}function Sr(Ve,je,Te,$e,ct){Fr(Ve);const pt=Ve[Pt],it=pt?"function"==typeof $e?$e:Me:"function"==typeof ct?ct:at;je.scheduleMicroTask("Promise.then",()=>{try{const gt=Ve[dt],Nt=!!Te&&Qe===Te[Qe];Nt&&(Te[Hn]=gt,Te[Ht]=pt);const Ct=je.run(it,void 0,Nt&&it!==at&&it!==Me?[]:[gt]);Wn(Te,!0,Ct)}catch(gt){Wn(Te,!1,gt)}},Te)}const $t=function(){},rt=ie.AggregateError;class ce{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(je){return Wn(new this(null),!0,je)}static reject(je){return Wn(new this(null),_n,je)}static any(je){if(!je||"function"!=typeof je[Symbol.iterator])return Promise.reject(new rt([],"All promises were rejected"));const Te=[];let $e=0;try{for(let it of je)$e++,Te.push(ce.resolve(it))}catch{return Promise.reject(new rt([],"All promises were rejected"))}if(0===$e)return Promise.reject(new rt([],"All promises were rejected"));let ct=!1;const pt=[];return new ce((it,gt)=>{for(let Nt=0;Nt<Te.length;Nt++)Te[Nt].then(Ct=>{ct||(ct=!0,it(Ct))},Ct=>{pt.push(Ct),$e--,0===$e&&(ct=!0,gt(new rt(pt,"All promises were rejected")))})})}static race(je){let Te,$e,ct=new this((gt,Nt)=>{Te=gt,$e=Nt});function pt(gt){Te(gt)}function it(gt){$e(gt)}for(let gt of je)Le(gt)||(gt=this.resolve(gt)),gt.then(pt,it);return ct}static all(je){return ce.allWithCallback(je)}static allSettled(je){return(this&&this.prototype instanceof ce?this:ce).allWithCallback(je,{thenCallback:$e=>({status:"fulfilled",value:$e}),errorCallback:$e=>({status:"rejected",reason:$e})})}static allWithCallback(je,Te){let $e,ct,pt=new this((Ct,gn)=>{$e=Ct,ct=gn}),it=2,gt=0;const Nt=[];for(let Ct of je){Le(Ct)||(Ct=this.resolve(Ct));const gn=gt;try{Ct.then(fn=>{Nt[gn]=Te?Te.thenCallback(fn):fn,it--,0===it&&$e(Nt)},fn=>{Te?(Nt[gn]=Te.errorCallback(fn),it--,0===it&&$e(Nt)):ct(fn)})}catch(fn){ct(fn)}it++,gt++}return it-=2,0===it&&$e(Nt),pt}constructor(je){const Te=this;if(!(Te instanceof ce))throw new Error("Must be an instanceof Promise.");Te[Pt]=sn,Te[dt]=[];try{const $e=_t();je&&je($e(jt(Te,!0)),$e(jt(Te,_n)))}catch($e){Wn(Te,!1,$e)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return ce}then(je,Te){var $e;let ct=null===($e=this.constructor)||void 0===$e?void 0:$e[Symbol.species];(!ct||"function"!=typeof ct)&&(ct=this.constructor||ce);const pt=new ct($t),it=le.current;return this[Pt]==sn?this[dt].push(it,pt,je,Te):Sr(this,it,pt,je,Te),pt}catch(je){return this.then(null,je)}finally(je){var Te;let $e=null===(Te=this.constructor)||void 0===Te?void 0:Te[Symbol.species];(!$e||"function"!=typeof $e)&&($e=ce);const ct=new $e($t);ct[Qe]=Qe;const pt=le.current;return this[Pt]==sn?this[dt].push(pt,ct,je,je):Sr(this,pt,ct,je,je),ct}}ce.resolve=ce.resolve,ce.reject=ce.reject,ce.race=ce.race,ce.all=ce.all;const me=ie[Je]=ie.Promise;ie.Promise=ce;const ft=ze("thenPatched");function St(Ve){const je=Ve.prototype,Te=ye(je,"then");if(Te&&(!1===Te.writable||!Te.configurable))return;const $e=je.then;je[Fe]=$e,Ve.prototype.then=function(ct,pt){return new ce((gt,Nt)=>{$e.call(this,gt,Nt)}).then(ct,pt)},Ve[ft]=!0}return ge.patchThen=St,me&&(St(me),j(ie,"fetch",Ve=>function Tn(Ve){return function(je,Te){let $e=Ve.apply(je,Te);if($e instanceof ce)return $e;let ct=$e.constructor;return ct[ft]||St(ct),$e}}(Ve))),Promise[le.__symbol__("uncaughtPromiseErrors")]=Ge,ce}),Zone.__load_patch("toString",ie=>{const le=Function.prototype.toString,ge=E("OriginalDelegate"),ye=E("Promise"),be=E("Error"),Ae=function(){if("function"==typeof this){const Je=this[ge];if(Je)return"function"==typeof Je?le.call(Je):Object.prototype.toString.call(Je);if(this===Promise){const Fe=ie[ye];if(Fe)return le.call(Fe)}if(this===Error){const Fe=ie[be];if(Fe)return le.call(Fe)}}return le.call(this)};Ae[ge]=le,Function.prototype.toString=Ae;const ze=Object.prototype.toString;Object.prototype.toString=function(){return"function"==typeof Promise&&this instanceof Promise?"[object Promise]":ze.call(this)}});let he=!1;if(typeof window<"u")try{const ie=Object.defineProperty({},"passive",{get:function(){he=!0}});window.addEventListener("test",ie,ie),window.removeEventListener("test",ie,ie)}catch{he=!1}const Pe={useG:!0},Se={},Be={},ve=new RegExp("^"+p+"(\\w+)(true|false)$"),He=E("propagationStopped");function ke(ie,le){const ge=(le?le(ie):ie)+f,ye=(le?le(ie):ie)+c,be=p+ge,Ae=p+ye;Se[ie]={},Se[ie][f]=be,Se[ie][c]=Ae}function nt(ie,le,ge,ye){const be=ye&&ye.add||g,Ae=ye&&ye.rm||b,ze=ye&&ye.listeners||"eventListeners",Ge=ye&&ye.rmAll||"removeAllListeners",et=E(be),Je="."+be+":",pe=function(dt,Qe,Hn){if(dt.isRemoved)return;const Ht=dt.callback;let In;"object"==typeof Ht&&Ht.handleEvent&&(dt.callback=ot=>Ht.handleEvent(ot),dt.originalDelegate=Ht);try{dt.invoke(dt,Qe,[Hn])}catch(ot){In=ot}const sn=dt.options;return sn&&"object"==typeof sn&&sn.once&&Qe[Ae].call(Qe,Hn.type,dt.originalDelegate?dt.originalDelegate:dt.callback,sn),In};function we(dt,Qe,Hn){if(!(Qe=Qe||ie.event))return;const Ht=dt||Qe.target||ie,In=Ht[Se[Qe.type][Hn?c:f]];if(In){const sn=[];if(1===In.length){const ot=pe(In[0],Ht,Qe);ot&&sn.push(ot)}else{const ot=In.slice();for(let _n=0;_n<ot.length&&(!Qe||!0!==Qe[He]);_n++){const tt=pe(ot[_n],Ht,Qe);tt&&sn.push(tt)}}if(1===sn.length)throw sn[0];for(let ot=0;ot<sn.length;ot++){const _n=sn[ot];le.nativeScheduleMicroTask(()=>{throw _n})}}}const Le=function(dt){return we(this,dt,!1)},Me=function(dt){return we(this,dt,!0)};function at(dt,Qe){if(!dt)return!1;let Hn=!0;Qe&&void 0!==Qe.useG&&(Hn=Qe.useG);const Ht=Qe&&Qe.vh;let In=!0;Qe&&void 0!==Qe.chkDup&&(In=Qe.chkDup);let sn=!1;Qe&&void 0!==Qe.rt&&(sn=Qe.rt);let ot=dt;for(;ot&&!ot.hasOwnProperty(be);)ot=R(ot);if(!ot&&dt[be]&&(ot=dt),!ot||ot[et])return!1;const _n=Qe&&Qe.eventNameToString,tt={},jt=ot[et]=ot[be],_t=ot[E(Ae)]=ot[Ae],Pr=ot[E(ze)]=ot[ze],Ei=ot[E(Ge)]=ot[Ge];let Wn;function Rn(Te,$e){return!he&&"object"==typeof Te&&Te?!!Te.capture:he&&$e?"boolean"==typeof Te?{capture:Te,passive:!0}:Te?"object"==typeof Te&&!1!==Te.passive?Object.assign(Object.assign({},Te),{passive:!0}):Te:{passive:!0}:Te}Qe&&Qe.prepend&&(Wn=ot[E(Qe.prepend)]=ot[Qe.prepend]);const ce=Hn?function(Te){if(!tt.isExisting)return jt.call(tt.target,tt.eventName,tt.capture?Me:Le,tt.options)}:function(Te){return jt.call(tt.target,tt.eventName,Te.invoke,tt.options)},me=Hn?function(Te){if(!Te.isRemoved){const $e=Se[Te.eventName];let ct;$e&&(ct=$e[Te.capture?c:f]);const pt=ct&&Te.target[ct];if(pt)for(let it=0;it<pt.length;it++)if(pt[it]===Te){pt.splice(it,1),Te.isRemoved=!0,0===pt.length&&(Te.allRemoved=!0,Te.target[ct]=null);break}}if(Te.allRemoved)return _t.call(Te.target,Te.eventName,Te.capture?Me:Le,Te.options)}:function(Te){return _t.call(Te.target,Te.eventName,Te.invoke,Te.options)},St=Qe&&Qe.diff?Qe.diff:function(Te,$e){const ct=typeof $e;return"function"===ct&&Te.callback===$e||"object"===ct&&Te.originalDelegate===$e},Tn=Zone[E("UNPATCHED_EVENTS")],Ve=ie[E("PASSIVE_EVENTS")],je=function(Te,$e,ct,pt,it=!1,gt=!1){return function(){const Nt=this||ie;let Ct=arguments[0];Qe&&Qe.transferEventName&&(Ct=Qe.transferEventName(Ct));let gn=arguments[1];if(!gn)return Te.apply(this,arguments);if(k&&"uncaughtException"===Ct)return Te.apply(this,arguments);let fn=!1;if("function"!=typeof gn){if(!gn.handleEvent)return Te.apply(this,arguments);fn=!0}if(Ht&&!Ht(Te,gn,Nt,arguments))return;const rs=he&&!!Ve&&-1!==Ve.indexOf(Ct),Gn=Rn(arguments[2],rs);if(Tn)for(let Qt=0;Qt<Tn.length;Qt++)if(Ct===Tn[Qt])return rs?Te.call(Nt,Ct,gn,Gn):Te.apply(this,arguments);const ia=!!Gn&&("boolean"==typeof Gn||Gn.capture),wo=!(!Gn||"object"!=typeof Gn)&&Gn.once,mf=Zone.current;let sa=Se[Ct];sa||(ke(Ct,_n),sa=Se[Ct]);const z=sa[ia?c:f];let ue,Q=Nt[z],J=!1;if(Q){if(J=!0,In)for(let Qt=0;Qt<Q.length;Qt++)if(St(Q[Qt],gn))return}else Q=Nt[z]=[];const Re=Nt.constructor.name,Oe=Be[Re];Oe&&(ue=Oe[Ct]),ue||(ue=Re+$e+(_n?_n(Ct):Ct)),tt.options=Gn,wo&&(tt.options.once=!1),tt.target=Nt,tt.capture=ia,tt.eventName=Ct,tt.isExisting=J;const We=Hn?Pe:void 0;We&&(We.taskData=tt);const Ke=mf.scheduleEventTask(ue,gn,We,ct,pt);return tt.target=null,We&&(We.taskData=null),wo&&(Gn.once=!0),!he&&"boolean"==typeof Ke.options||(Ke.options=Gn),Ke.target=Nt,Ke.capture=ia,Ke.eventName=Ct,fn&&(Ke.originalDelegate=gn),gt?Q.unshift(Ke):Q.push(Ke),it?Nt:void 0}};return ot[be]=je(jt,Je,ce,me,sn),Wn&&(ot.prependListener=je(Wn,".prependListener:",function(Te){return Wn.call(tt.target,tt.eventName,Te.invoke,tt.options)},me,sn,!0)),ot[Ae]=function(){const Te=this||ie;let $e=arguments[0];Qe&&Qe.transferEventName&&($e=Qe.transferEventName($e));const ct=arguments[2],pt=!!ct&&("boolean"==typeof ct||ct.capture),it=arguments[1];if(!it)return _t.apply(this,arguments);if(Ht&&!Ht(_t,it,Te,arguments))return;const gt=Se[$e];let Nt;gt&&(Nt=gt[pt?c:f]);const Ct=Nt&&Te[Nt];if(Ct)for(let gn=0;gn<Ct.length;gn++){const fn=Ct[gn];if(St(fn,it))return Ct.splice(gn,1),fn.isRemoved=!0,0===Ct.length&&(fn.allRemoved=!0,Te[Nt]=null,"string"==typeof $e)&&(Te[p+"ON_PROPERTY"+$e]=null),fn.zone.cancelTask(fn),sn?Te:void 0}return _t.apply(this,arguments)},ot[ze]=function(){const Te=this||ie;let $e=arguments[0];Qe&&Qe.transferEventName&&($e=Qe.transferEventName($e));const ct=[],pt=Rt(Te,_n?_n($e):$e);for(let it=0;it<pt.length;it++){const gt=pt[it];ct.push(gt.originalDelegate?gt.originalDelegate:gt.callback)}return ct},ot[Ge]=function(){const Te=this||ie;let $e=arguments[0];if($e){Qe&&Qe.transferEventName&&($e=Qe.transferEventName($e));const ct=Se[$e];if(ct){const gt=Te[ct[f]],Nt=Te[ct[c]];if(gt){const Ct=gt.slice();for(let gn=0;gn<Ct.length;gn++){const fn=Ct[gn];this[Ae].call(this,$e,fn.originalDelegate?fn.originalDelegate:fn.callback,fn.options)}}if(Nt){const Ct=Nt.slice();for(let gn=0;gn<Ct.length;gn++){const fn=Ct[gn];this[Ae].call(this,$e,fn.originalDelegate?fn.originalDelegate:fn.callback,fn.options)}}}}else{const ct=Object.keys(Te);for(let pt=0;pt<ct.length;pt++){const gt=ve.exec(ct[pt]);let Nt=gt&>[1];Nt&&"removeListener"!==Nt&&this[Ge].call(this,Nt)}this[Ge].call(this,"removeListener")}if(sn)return this},Z(ot[be],jt),Z(ot[Ae],_t),Ei&&Z(ot[Ge],Ei),Pr&&Z(ot[ze],Pr),!0}let Pt=[];for(let dt=0;dt<ge.length;dt++)Pt[dt]=at(ge[dt],ye);return Pt}function Rt(ie,le){if(!le){const Ae=[];for(let ze in ie){const Ge=ve.exec(ze);let et=Ge&&Ge[1];if(et&&(!le||et===le)){const Je=ie[ze];if(Je)for(let Fe=0;Fe<Je.length;Fe++)Ae.push(Je[Fe])}}return Ae}let ge=Se[le];ge||(ke(le),ge=Se[le]);const ye=ie[ge[f]],be=ie[ge[c]];return ye?be?ye.concat(be):ye.slice():be?be.slice():[]}function wt(ie,le){const ge=ie.Event;ge&&ge.prototype&&le.patchMethod(ge.prototype,"stopImmediatePropagation",ye=>function(be,Ae){be[He]=!0,ye&&ye.apply(be,Ae)})}function Ft(ie,le,ge,ye,be){const Ae=Zone.__symbol__(ye);if(le[Ae])return;const ze=le[Ae]=le[ye];le[ye]=function(Ge,et,Je){return et&&et.prototype&&be.forEach(function(Fe){const Ee=`${ge}.${ye}::`+Fe,pe=et.prototype;try{if(pe.hasOwnProperty(Fe)){const we=ie.ObjectGetOwnPropertyDescriptor(pe,Fe);we&&we.value?(we.value=ie.wrapWithCurrentZone(we.value,Ee),ie._redefineProperty(et.prototype,Fe,we)):pe[Fe]&&(pe[Fe]=ie.wrapWithCurrentZone(pe[Fe],Ee))}else pe[Fe]&&(pe[Fe]=ie.wrapWithCurrentZone(pe[Fe],Ee))}catch{}}),ze.call(le,Ge,et,Je)},ie.attachOriginToPatched(le[ye],ze)}function qt(ie,le,ge){if(!ge||0===ge.length)return le;const ye=ge.filter(Ae=>Ae.target===ie);if(!ye||0===ye.length)return le;const be=ye[0].ignoreProperties;return le.filter(Ae=>-1===be.indexOf(Ae))}function Jt(ie,le,ge,ye){ie&&L(ie,qt(ie,le,ge),ye)}function rn(ie){return Object.getOwnPropertyNames(ie).filter(le=>le.startsWith("on")&&le.length>2).map(le=>le.substring(2))}Zone.__load_patch("util",(ie,le,ge)=>{const ye=rn(ie);ge.patchOnProperties=L,ge.patchMethod=j,ge.bindArguments=N,ge.patchMacroTask=ee;const be=le.__symbol__("BLACK_LISTED_EVENTS"),Ae=le.__symbol__("UNPATCHED_EVENTS");ie[Ae]&&(ie[be]=ie[Ae]),ie[be]&&(le[be]=le[Ae]=ie[be]),ge.patchEventPrototype=wt,ge.patchEventTarget=nt,ge.isIEOrEdge=de,ge.ObjectDefineProperty=K,ge.ObjectGetOwnPropertyDescriptor=Y,ge.ObjectCreate=y,ge.ArraySlice=l,ge.patchClass=ne,ge.wrapWithCurrentZone=w,ge.filterProperties=qt,ge.attachOriginToPatched=Z,ge._redefineProperty=Object.defineProperty,ge.patchCallbacks=Ft,ge.getGlobalObjects=()=>({globalSources:Be,zoneSymbolEventNames:Se,eventNames:ye,isBrowser:F,isMix:G,isNode:k,TRUE_STR:c,FALSE_STR:f,ZONE_SYMBOL_PREFIX:p,ADD_EVENT_LISTENER_STR:g,REMOVE_EVENT_LISTENER_STR:b})});const Rr=E("zoneTask");function En(ie,le,ge,ye){let be=null,Ae=null;ge+=ye;const ze={};function Ge(Je){const Fe=Je.data;return Fe.args[0]=function(){return Je.invoke.apply(this,arguments)},Fe.handleId=be.apply(ie,Fe.args),Je}function et(Je){return Ae.call(ie,Je.data.handleId)}be=j(ie,le+=ye,Je=>function(Fe,Ee){if("function"==typeof Ee[0]){const pe={isPeriodic:"Interval"===ye,delay:"Timeout"===ye||"Interval"===ye?Ee[1]||0:void 0,args:Ee},we=Ee[0];Ee[0]=function(){try{return we.apply(this,arguments)}finally{pe.isPeriodic||("number"==typeof pe.handleId?delete ze[pe.handleId]:pe.handleId&&(pe.handleId[Rr]=null))}};const Le=I(le,Ee[0],pe,Ge,et);if(!Le)return Le;const Me=Le.data.handleId;return"number"==typeof Me?ze[Me]=Le:Me&&(Me[Rr]=Le),Me&&Me.ref&&Me.unref&&"function"==typeof Me.ref&&"function"==typeof Me.unref&&(Le.ref=Me.ref.bind(Me),Le.unref=Me.unref.bind(Me)),"number"==typeof Me||Me?Me:Le}return Je.apply(ie,Ee)}),Ae=j(ie,ge,Je=>function(Fe,Ee){const pe=Ee[0];let we;"number"==typeof pe?we=ze[pe]:(we=pe&&pe[Rr],we||(we=pe)),we&&"string"==typeof we.type?"notScheduled"!==we.state&&(we.cancelFn&&we.data.isPeriodic||0===we.runCount)&&("number"==typeof pe?delete ze[pe]:pe&&(pe[Rr]=null),we.zone.cancelTask(we)):Je.apply(ie,Ee)})}Zone.__load_patch("legacy",ie=>{const le=ie[Zone.__symbol__("legacyPatch")];le&&le()}),Zone.__load_patch("queueMicrotask",(ie,le,ge)=>{ge.patchMethod(ie,"queueMicrotask",ye=>function(be,Ae){le.current.scheduleMicroTask("queueMicrotask",Ae[0])})}),Zone.__load_patch("timers",ie=>{const ge="clear";En(ie,"set",ge,"Timeout"),En(ie,"set",ge,"Interval"),En(ie,"set",ge,"Immediate")}),Zone.__load_patch("requestAnimationFrame",ie=>{En(ie,"request","cancel","AnimationFrame"),En(ie,"mozRequest","mozCancel","AnimationFrame"),En(ie,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",(ie,le)=>{const ge=["alert","prompt","confirm"];for(let ye=0;ye<ge.length;ye++)j(ie,ge[ye],(Ae,ze,Ge)=>function(et,Je){return le.current.run(Ae,ie,Je,Ge)})}),Zone.__load_patch("EventTarget",(ie,le,ge)=>{(function ns(ie,le){le.patchEventPrototype(ie,le)})(ie,ge),function qr(ie,le){if(Zone[le.symbol("patchEventTarget")])return;const{eventNames:ge,zoneSymbolEventNames:ye,TRUE_STR:be,FALSE_STR:Ae,ZONE_SYMBOL_PREFIX:ze}=le.getGlobalObjects();for(let et=0;et<ge.length;et++){const Je=ge[et],pe=ze+(Je+Ae),we=ze+(Je+be);ye[Je]={},ye[Je][Ae]=pe,ye[Je][be]=we}const Ge=ie.EventTarget;Ge&&Ge.prototype&&le.patchEventTarget(ie,le,[Ge&&Ge.prototype])}(ie,ge);const ye=ie.XMLHttpRequestEventTarget;ye&&ye.prototype&&ge.patchEventTarget(ie,ge,[ye.prototype])}),Zone.__load_patch("MutationObserver",(ie,le,ge)=>{ne("MutationObserver"),ne("WebKitMutationObserver")}),Zone.__load_patch("IntersectionObserver",(ie,le,ge)=>{ne("IntersectionObserver")}),Zone.__load_patch("FileReader",(ie,le,ge)=>{ne("FileReader")}),Zone.__load_patch("on_property",(ie,le,ge)=>{!function Vn(ie,le){if(k&&!G||Zone[ie.symbol("patchEvents")])return;const ge=le.__Zone_ignore_on_properties;let ye=[];if(F){const be=window;ye=ye.concat(["Document","SVGElement","Element","HTMLElement","HTMLBodyElement","HTMLMediaElement","HTMLFrameSetElement","HTMLFrameElement","HTMLIFrameElement","HTMLMarqueeElement","Worker"]);const Ae=function oe(){try{const ie=h.navigator.userAgent;if(-1!==ie.indexOf("MSIE ")||-1!==ie.indexOf("Trident/"))return!0}catch{}return!1}()?[{target:be,ignoreProperties:["error"]}]:[];Jt(be,rn(be),ge&&ge.concat(Ae),R(be))}ye=ye.concat(["XMLHttpRequest","XMLHttpRequestEventTarget","IDBIndex","IDBRequest","IDBOpenDBRequest","IDBDatabase","IDBTransaction","IDBCursor","WebSocket"]);for(let be=0;be<ye.length;be++){const Ae=le[ye[be]];Ae&&Ae.prototype&&Jt(Ae.prototype,rn(Ae.prototype),ge)}}(ge,ie)}),Zone.__load_patch("customElements",(ie,le,ge)=>{!function Oi(ie,le){const{isBrowser:ge,isMix:ye}=le.getGlobalObjects();(ge||ye)&&ie.customElements&&"customElements"in ie&&le.patchCallbacks(le,ie.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])}(ie,ge)}),Zone.__load_patch("XHR",(ie,le)=>{!function et(Je){const Fe=Je.XMLHttpRequest;if(!Fe)return;const Ee=Fe.prototype;let we=Ee[m],Le=Ee[d];if(!we){const tt=Je.XMLHttpRequestEventTarget;if(tt){const jt=tt.prototype;we=jt[m],Le=jt[d]}}const Me="readystatechange",at="scheduled";function Pt(tt){const jt=tt.data,_t=jt.target;_t[Ae]=!1,_t[Ge]=!1;const Pr=_t[be];we||(we=_t[m],Le=_t[d]),Pr&&Le.call(_t,Me,Pr);const Ei=_t[be]=()=>{if(_t.readyState===_t.DONE)if(!jt.aborted&&_t[Ae]&&tt.state===at){const Rn=_t[le.__symbol__("loadfalse")];if(0!==_t.status&&Rn&&Rn.length>0){const Fr=tt.invoke;tt.invoke=function(){const Sr=_t[le.__symbol__("loadfalse")];for(let Pn=0;Pn<Sr.length;Pn++)Sr[Pn]===tt&&Sr.splice(Pn,1);!jt.aborted&&tt.state===at&&Fr.call(tt)},Rn.push(tt)}else tt.invoke()}else!jt.aborted&&!1===_t[Ae]&&(_t[Ge]=!0)};return we.call(_t,Me,Ei),_t[ge]||(_t[ge]=tt),ot.apply(_t,jt.args),_t[Ae]=!0,tt}function dt(){}function Qe(tt){const jt=tt.data;return jt.aborted=!0,_n.apply(jt.target,jt.args)}const Hn=j(Ee,"open",()=>function(tt,jt){return tt[ye]=0==jt[2],tt[ze]=jt[1],Hn.apply(tt,jt)}),In=E("fetchTaskAborting"),sn=E("fetchTaskScheduling"),ot=j(Ee,"send",()=>function(tt,jt){if(!0===le.current[sn]||tt[ye])return ot.apply(tt,jt);{const _t={target:tt,url:tt[ze],isPeriodic:!1,args:jt,aborted:!1},Pr=I("XMLHttpRequest.send",dt,_t,Pt,Qe);tt&&!0===tt[Ge]&&!_t.aborted&&Pr.state===at&&Pr.invoke()}}),_n=j(Ee,"abort",()=>function(tt,jt){const _t=function pe(tt){return tt[ge]}(tt);if(_t&&"string"==typeof _t.type){if(null==_t.cancelFn||_t.data&&_t.data.aborted)return;_t.zone.cancelTask(_t)}else if(!0===le.current[In])return _n.apply(tt,jt)})}(ie);const ge=E("xhrTask"),ye=E("xhrSync"),be=E("xhrListener"),Ae=E("xhrScheduled"),ze=E("xhrURL"),Ge=E("xhrErrorBeforeScheduled")}),Zone.__load_patch("geolocation",ie=>{ie.navigator&&ie.navigator.geolocation&&function S(ie,le){const ge=ie.constructor.name;for(let ye=0;ye<le.length;ye++){const be=le[ye],Ae=ie[be];if(Ae){if(!D(Y(ie,be)))continue;ie[be]=(Ge=>{const et=function(){return Ge.apply(this,N(arguments,ge+"."+be))};return Z(et,Ge),et})(Ae)}}}(ie.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",(ie,le)=>{function ge(ye){return function(be){Rt(ie,ye).forEach(ze=>{const Ge=ie.PromiseRejectionEvent;if(Ge){const et=new Ge(ye,{promise:be.promise,reason:be.rejection});ze.invoke(et)}})}}ie.PromiseRejectionEvent&&(le[E("unhandledPromiseRejectionHandler")]=ge("unhandledrejection"),le[E("rejectionHandledHandler")]=ge("rejectionhandled"))})},7420:()=>{},5856:()=>{},5883:()=>{},5819:()=>{},1265:()=>{},5539:()=>{},8479:function(Y,K,R){var l,g;l=[R(1873)],void 0!==(g=function(b){"use strict";var m=b.Reader,d=b.Writer,c=b.util,f=b.roots.default||(b.roots.default={});return f.RPC=function(){function p(I){if(this.subscriptions=[],this.messages=[],I)for(var E=Object.keys(I),v=0;v<E.length;++v)null!=I[E[v]]&&(this[E[v]]=I[E[v]])}var w;return p.prototype.subscriptions=c.emptyArray,p.prototype.messages=c.emptyArray,p.prototype.control=null,Object.defineProperty(p.prototype,"_control",{get:c.oneOfGetter(w=["control"]),set:c.oneOfSetter(w)}),p.encode=function(E,v){if(v||(v=d.create()),null!=E.subscriptions&&E.subscriptions.length)for(var h=0;h<E.subscriptions.length;++h)f.RPC.SubOpts.encode(E.subscriptions[h],v.uint32(10).fork()).ldelim();if(null!=E.messages&&E.messages.length)for(h=0;h<E.messages.length;++h)f.RPC.Message.encode(E.messages[h],v.uint32(18).fork()).ldelim();return null!=E.control&&Object.hasOwnProperty.call(E,"control")&&f.RPC.ControlMessage.encode(E.control,v.uint32(26).fork()).ldelim(),v},p.decode=function(E,v){E instanceof m||(E=m.create(E));for(var h=void 0===v?E.len:E.pos+v,C=new f.RPC;E.pos<h;){var A=E.uint32();switch(A>>>3){case 1:C.subscriptions&&C.subscriptions.length||(C.subscriptions=[]),C.subscriptions.push(f.RPC.SubOpts.decode(E,E.uint32()));break;case 2:C.messages&&C.messages.length||(C.messages=[]),C.messages.push(f.RPC.Message.decode(E,E.uint32()));break;case 3:C.control=f.RPC.ControlMessage.decode(E,E.uint32());break;default:E.skipType(7&A)}}return C},p.fromObject=function(E){if(E instanceof f.RPC)return E;var v=new f.RPC;if(E.subscriptions){if(!Array.isArray(E.subscriptions))throw TypeError(".RPC.subscriptions: array expected");v.subscriptions=[];for(var h=0;h<E.subscriptions.length;++h){if("object"!=typeof E.subscriptions[h])throw TypeError(".RPC.subscriptions: object expected");v.subscriptions[h]=f.RPC.SubOpts.fromObject(E.subscriptions[h])}}if(E.messages){if(!Array.isArray(E.messages))throw TypeError(".RPC.messages: array expected");for(v.messages=[],h=0;h<E.messages.length;++h){if("object"!=typeof E.messages[h])throw TypeError(".RPC.messages: object expected");v.messages[h]=f.RPC.Message.fromObject(E.messages[h])}}if(null!=E.control){if("object"!=typeof E.control)throw TypeError(".RPC.control: object expected");v.control=f.RPC.ControlMessage.fromObject(E.control)}return v},p.toObject=function(E,v){v||(v={});var h={};if((v.arrays||v.defaults)&&(h.subscriptions=[],h.messages=[]),E.subscriptions&&E.subscriptions.length){h.subscriptions=[];for(var C=0;C<E.subscriptions.length;++C)h.subscriptions[C]=f.RPC.SubOpts.toObject(E.subscriptions[C],v)}if(E.messages&&E.messages.length)for(h.messages=[],C=0;C<E.messages.length;++C)h.messages[C]=f.RPC.Message.toObject(E.messages[C],v);return null!=E.control&&E.hasOwnProperty("control")&&(h.control=f.RPC.ControlMessage.toObject(E.control,v),v.oneofs&&(h._control="control")),h},p.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},p.SubOpts=function(){function I(v){if(v)for(var h=Object.keys(v),C=0;C<h.length;++C)null!=v[h[C]]&&(this[h[C]]=v[h[C]])}var E;return I.prototype.subscribe=null,I.prototype.topic=null,Object.defineProperty(I.prototype,"_subscribe",{get:c.oneOfGetter(E=["subscribe"]),set:c.oneOfSetter(E)}),Object.defineProperty(I.prototype,"_topic",{get:c.oneOfGetter(E=["topic"]),set:c.oneOfSetter(E)}),I.encode=function(h,C){return C||(C=d.create()),null!=h.subscribe&&Object.hasOwnProperty.call(h,"subscribe")&&C.uint32(8).bool(h.subscribe),null!=h.topic&&Object.hasOwnProperty.call(h,"topic")&&C.uint32(18).string(h.topic),C},I.decode=function(h,C){h instanceof m||(h=m.create(h));for(var A=void 0===C?h.len:h.pos+C,N=new f.RPC.SubOpts;h.pos<A;){var S=h.uint32();switch(S>>>3){case 1:N.subscribe=h.bool();break;case 2:N.topic=h.string();break;default:h.skipType(7&S)}}return N},I.fromObject=function(h){if(h instanceof f.RPC.SubOpts)return h;var C=new f.RPC.SubOpts;return null!=h.subscribe&&(C.subscribe=Boolean(h.subscribe)),null!=h.topic&&(C.topic=String(h.topic)),C},I.toObject=function(h,C){C||(C={});var A={};return null!=h.subscribe&&h.hasOwnProperty("subscribe")&&(A.subscribe=h.subscribe,C.oneofs&&(A._subscribe="subscribe")),null!=h.topic&&h.hasOwnProperty("topic")&&(A.topic=h.topic,C.oneofs&&(A._topic="topic")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p.Message=function(){function I(v){if(v)for(var h=Object.keys(v),C=0;C<h.length;++C)null!=v[h[C]]&&(this[h[C]]=v[h[C]])}var E;return I.prototype.from=null,I.prototype.data=null,I.prototype.seqno=null,I.prototype.topic="",I.prototype.signature=null,I.prototype.key=null,Object.defineProperty(I.prototype,"_from",{get:c.oneOfGetter(E=["from"]),set:c.oneOfSetter(E)}),Object.defineProperty(I.prototype,"_data",{get:c.oneOfGetter(E=["data"]),set:c.oneOfSetter(E)}),Object.defineProperty(I.prototype,"_seqno",{get:c.oneOfGetter(E=["seqno"]),set:c.oneOfSetter(E)}),Object.defineProperty(I.prototype,"_signature",{get:c.oneOfGetter(E=["signature"]),set:c.oneOfSetter(E)}),Object.defineProperty(I.prototype,"_key",{get:c.oneOfGetter(E=["key"]),set:c.oneOfSetter(E)}),I.encode=function(h,C){return C||(C=d.create()),null!=h.from&&Object.hasOwnProperty.call(h,"from")&&C.uint32(10).bytes(h.from),null!=h.data&&Object.hasOwnProperty.call(h,"data")&&C.uint32(18).bytes(h.data),null!=h.seqno&&Object.hasOwnProperty.call(h,"seqno")&&C.uint32(26).bytes(h.seqno),C.uint32(34).string(h.topic),null!=h.signature&&Object.hasOwnProperty.call(h,"signature")&&C.uint32(42).bytes(h.signature),null!=h.key&&Object.hasOwnProperty.call(h,"key")&&C.uint32(50).bytes(h.key),C},I.decode=function(h,C){h instanceof m||(h=m.create(h));for(var A=void 0===C?h.len:h.pos+C,N=new f.RPC.Message;h.pos<A;){var S=h.uint32();switch(S>>>3){case 1:N.from=h.bytes();break;case 2:N.data=h.bytes();break;case 3:N.seqno=h.bytes();break;case 4:N.topic=h.string();break;case 5:N.signature=h.bytes();break;case 6:N.key=h.bytes();break;default:h.skipType(7&S)}}if(!N.hasOwnProperty("topic"))throw c.ProtocolError("missing required 'topic'",{instance:N});return N},I.fromObject=function(h){if(h instanceof f.RPC.Message)return h;var C=new f.RPC.Message;return null!=h.from&&("string"==typeof h.from?c.base64.decode(h.from,C.from=c.newBuffer(c.base64.length(h.from)),0):h.from.length&&(C.from=h.from)),null!=h.data&&("string"==typeof h.data?c.base64.decode(h.data,C.data=c.newBuffer(c.base64.length(h.data)),0):h.data.length&&(C.data=h.data)),null!=h.seqno&&("string"==typeof h.seqno?c.base64.decode(h.seqno,C.seqno=c.newBuffer(c.base64.length(h.seqno)),0):h.seqno.length&&(C.seqno=h.seqno)),null!=h.topic&&(C.topic=String(h.topic)),null!=h.signature&&("string"==typeof h.signature?c.base64.decode(h.signature,C.signature=c.newBuffer(c.base64.length(h.signature)),0):h.signature.length&&(C.signature=h.signature)),null!=h.key&&("string"==typeof h.key?c.base64.decode(h.key,C.key=c.newBuffer(c.base64.length(h.key)),0):h.key.length&&(C.key=h.key)),C},I.toObject=function(h,C){C||(C={});var A={};return C.defaults&&(A.topic=""),null!=h.from&&h.hasOwnProperty("from")&&(A.from=C.bytes===String?c.base64.encode(h.from,0,h.from.length):C.bytes===Array?Array.prototype.slice.call(h.from):h.from,C.oneofs&&(A._from="from")),null!=h.data&&h.hasOwnProperty("data")&&(A.data=C.bytes===String?c.base64.encode(h.data,0,h.data.length):C.bytes===Array?Array.prototype.slice.call(h.data):h.data,C.oneofs&&(A._data="data")),null!=h.seqno&&h.hasOwnProperty("seqno")&&(A.seqno=C.bytes===String?c.base64.encode(h.seqno,0,h.seqno.length):C.bytes===Array?Array.prototype.slice.call(h.seqno):h.seqno,C.oneofs&&(A._seqno="seqno")),null!=h.topic&&h.hasOwnProperty("topic")&&(A.topic=h.topic),null!=h.signature&&h.hasOwnProperty("signature")&&(A.signature=C.bytes===String?c.base64.encode(h.signature,0,h.signature.length):C.bytes===Array?Array.prototype.slice.call(h.signature):h.signature,C.oneofs&&(A._signature="signature")),null!=h.key&&h.hasOwnProperty("key")&&(A.key=C.bytes===String?c.base64.encode(h.key,0,h.key.length):C.bytes===Array?Array.prototype.slice.call(h.key):h.key,C.oneofs&&(A._key="key")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p.ControlMessage=function(){function I(E){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],E)for(var v=Object.keys(E),h=0;h<v.length;++h)null!=E[v[h]]&&(this[v[h]]=E[v[h]])}return I.prototype.ihave=c.emptyArray,I.prototype.iwant=c.emptyArray,I.prototype.graft=c.emptyArray,I.prototype.prune=c.emptyArray,I.encode=function(v,h){if(h||(h=d.create()),null!=v.ihave&&v.ihave.length)for(var C=0;C<v.ihave.length;++C)f.RPC.ControlIHave.encode(v.ihave[C],h.uint32(10).fork()).ldelim();if(null!=v.iwant&&v.iwant.length)for(C=0;C<v.iwant.length;++C)f.RPC.ControlIWant.encode(v.iwant[C],h.uint32(18).fork()).ldelim();if(null!=v.graft&&v.graft.length)for(C=0;C<v.graft.length;++C)f.RPC.ControlGraft.encode(v.graft[C],h.uint32(26).fork()).ldelim();if(null!=v.prune&&v.prune.length)for(C=0;C<v.prune.length;++C)f.RPC.ControlPrune.encode(v.prune[C],h.uint32(34).fork()).ldelim();return h},I.decode=function(v,h){v instanceof m||(v=m.create(v));for(var C=void 0===h?v.len:v.pos+h,A=new f.RPC.ControlMessage;v.pos<C;){var N=v.uint32();switch(N>>>3){case 1:A.ihave&&A.ihave.length||(A.ihave=[]),A.ihave.push(f.RPC.ControlIHave.decode(v,v.uint32()));break;case 2:A.iwant&&A.iwant.length||(A.iwant=[]),A.iwant.push(f.RPC.ControlIWant.decode(v,v.uint32()));break;case 3:A.graft&&A.graft.length||(A.graft=[]),A.graft.push(f.RPC.ControlGraft.decode(v,v.uint32()));break;case 4:A.prune&&A.prune.length||(A.prune=[]),A.prune.push(f.RPC.ControlPrune.decode(v,v.uint32()));break;default:v.skipType(7&N)}}return A},I.fromObject=function(v){if(v instanceof f.RPC.ControlMessage)return v;var h=new f.RPC.ControlMessage;if(v.ihave){if(!Array.isArray(v.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");h.ihave=[];for(var C=0;C<v.ihave.length;++C){if("object"!=typeof v.ihave[C])throw TypeError(".RPC.ControlMessage.ihave: object expected");h.ihave[C]=f.RPC.ControlIHave.fromObject(v.ihave[C])}}if(v.iwant){if(!Array.isArray(v.iwant))throw TypeError(".RPC.ControlMessage.iwant: array expected");for(h.iwant=[],C=0;C<v.iwant.length;++C){if("object"!=typeof v.iwant[C])throw TypeError(".RPC.ControlMessage.iwant: object expected");h.iwant[C]=f.RPC.ControlIWant.fromObject(v.iwant[C])}}if(v.graft){if(!Array.isArray(v.graft))throw TypeError(".RPC.ControlMessage.graft: array expected");for(h.graft=[],C=0;C<v.graft.length;++C){if("object"!=typeof v.graft[C])throw TypeError(".RPC.ControlMessage.graft: object expected");h.graft[C]=f.RPC.ControlGraft.fromObject(v.graft[C])}}if(v.prune){if(!Array.isArray(v.prune))throw TypeError(".RPC.ControlMessage.prune: array expected");for(h.prune=[],C=0;C<v.prune.length;++C){if("object"!=typeof v.prune[C])throw TypeError(".RPC.ControlMessage.prune: object expected");h.prune[C]=f.RPC.ControlPrune.fromObject(v.prune[C])}}return h},I.toObject=function(v,h){h||(h={});var C={};if((h.arrays||h.defaults)&&(C.ihave=[],C.iwant=[],C.graft=[],C.prune=[]),v.ihave&&v.ihave.length){C.ihave=[];for(var A=0;A<v.ihave.length;++A)C.ihave[A]=f.RPC.ControlIHave.toObject(v.ihave[A],h)}if(v.iwant&&v.iwant.length)for(C.iwant=[],A=0;A<v.iwant.length;++A)C.iwant[A]=f.RPC.ControlIWant.toObject(v.iwant[A],h);if(v.graft&&v.graft.length)for(C.graft=[],A=0;A<v.graft.length;++A)C.graft[A]=f.RPC.ControlGraft.toObject(v.graft[A],h);if(v.prune&&v.prune.length)for(C.prune=[],A=0;A<v.prune.length;++A)C.prune[A]=f.RPC.ControlPrune.toObject(v.prune[A],h);return C},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p.ControlIHave=function(){function I(v){if(this.messageIDs=[],v)for(var h=Object.keys(v),C=0;C<h.length;++C)null!=v[h[C]]&&(this[h[C]]=v[h[C]])}var E;return I.prototype.topicID=null,I.prototype.messageIDs=c.emptyArray,Object.defineProperty(I.prototype,"_topicID",{get:c.oneOfGetter(E=["topicID"]),set:c.oneOfSetter(E)}),I.encode=function(h,C){if(C||(C=d.create()),null!=h.topicID&&Object.hasOwnProperty.call(h,"topicID")&&C.uint32(10).string(h.topicID),null!=h.messageIDs&&h.messageIDs.length)for(var A=0;A<h.messageIDs.length;++A)C.uint32(18).bytes(h.messageIDs[A]);return C},I.decode=function(h,C){h instanceof m||(h=m.create(h));for(var A=void 0===C?h.len:h.pos+C,N=new f.RPC.ControlIHave;h.pos<A;){var S=h.uint32();switch(S>>>3){case 1:N.topicID=h.string();break;case 2:N.messageIDs&&N.messageIDs.length||(N.messageIDs=[]),N.messageIDs.push(h.bytes());break;default:h.skipType(7&S)}}return N},I.fromObject=function(h){if(h instanceof f.RPC.ControlIHave)return h;var C=new f.RPC.ControlIHave;if(null!=h.topicID&&(C.topicID=String(h.topicID)),h.messageIDs){if(!Array.isArray(h.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");C.messageIDs=[];for(var A=0;A<h.messageIDs.length;++A)"string"==typeof h.messageIDs[A]?c.base64.decode(h.messageIDs[A],C.messageIDs[A]=c.newBuffer(c.base64.length(h.messageIDs[A])),0):h.messageIDs[A].length&&(C.messageIDs[A]=h.messageIDs[A])}return C},I.toObject=function(h,C){C||(C={});var A={};if((C.arrays||C.defaults)&&(A.messageIDs=[]),null!=h.topicID&&h.hasOwnProperty("topicID")&&(A.topicID=h.topicID,C.oneofs&&(A._topicID="topicID")),h.messageIDs&&h.messageIDs.length){A.messageIDs=[];for(var N=0;N<h.messageIDs.length;++N)A.messageIDs[N]=C.bytes===String?c.base64.encode(h.messageIDs[N],0,h.messageIDs[N].length):C.bytes===Array?Array.prototype.slice.call(h.messageIDs[N]):h.messageIDs[N]}return A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p.ControlIWant=function(){function I(E){if(this.messageIDs=[],E)for(var v=Object.keys(E),h=0;h<v.length;++h)null!=E[v[h]]&&(this[v[h]]=E[v[h]])}return I.prototype.messageIDs=c.emptyArray,I.encode=function(v,h){if(h||(h=d.create()),null!=v.messageIDs&&v.messageIDs.length)for(var C=0;C<v.messageIDs.length;++C)h.uint32(10).bytes(v.messageIDs[C]);return h},I.decode=function(v,h){v instanceof m||(v=m.create(v));for(var C=void 0===h?v.len:v.pos+h,A=new f.RPC.ControlIWant;v.pos<C;){var N=v.uint32();N>>>3==1?(A.messageIDs&&A.messageIDs.length||(A.messageIDs=[]),A.messageIDs.push(v.bytes())):v.skipType(7&N)}return A},I.fromObject=function(v){if(v instanceof f.RPC.ControlIWant)return v;var h=new f.RPC.ControlIWant;if(v.messageIDs){if(!Array.isArray(v.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");h.messageIDs=[];for(var C=0;C<v.messageIDs.length;++C)"string"==typeof v.messageIDs[C]?c.base64.decode(v.messageIDs[C],h.messageIDs[C]=c.newBuffer(c.base64.length(v.messageIDs[C])),0):v.messageIDs[C].length&&(h.messageIDs[C]=v.messageIDs[C])}return h},I.toObject=function(v,h){h||(h={});var C={};if((h.arrays||h.defaults)&&(C.messageIDs=[]),v.messageIDs&&v.messageIDs.length){C.messageIDs=[];for(var A=0;A<v.messageIDs.length;++A)C.messageIDs[A]=h.bytes===String?c.base64.encode(v.messageIDs[A],0,v.messageIDs[A].length):h.bytes===Array?Array.prototype.slice.call(v.messageIDs[A]):v.messageIDs[A]}return C},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p.ControlGraft=function(){function I(v){if(v)for(var h=Object.keys(v),C=0;C<h.length;++C)null!=v[h[C]]&&(this[h[C]]=v[h[C]])}var E;return I.prototype.topicID=null,Object.defineProperty(I.prototype,"_topicID",{get:c.oneOfGetter(E=["topicID"]),set:c.oneOfSetter(E)}),I.encode=function(h,C){return C||(C=d.create()),null!=h.topicID&&Object.hasOwnProperty.call(h,"topicID")&&C.uint32(10).string(h.topicID),C},I.decode=function(h,C){h instanceof m||(h=m.create(h));for(var A=void 0===C?h.len:h.pos+C,N=new f.RPC.ControlGraft;h.pos<A;){var S=h.uint32();S>>>3==1?N.topicID=h.string():h.skipType(7&S)}return N},I.fromObject=function(h){if(h instanceof f.RPC.ControlGraft)return h;var C=new f.RPC.ControlGraft;return null!=h.topicID&&(C.topicID=String(h.topicID)),C},I.toObject=function(h,C){C||(C={});var A={};return null!=h.topicID&&h.hasOwnProperty("topicID")&&(A.topicID=h.topicID,C.oneofs&&(A._topicID="topicID")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p.ControlPrune=function(){function I(v){if(this.peers=[],v)for(var h=Object.keys(v),C=0;C<h.length;++C)null!=v[h[C]]&&(this[h[C]]=v[h[C]])}var E;return I.prototype.topicID=null,I.prototype.peers=c.emptyArray,I.prototype.backoff=null,Object.defineProperty(I.prototype,"_topicID",{get:c.oneOfGetter(E=["topicID"]),set:c.oneOfSetter(E)}),Object.defineProperty(I.prototype,"_backoff",{get:c.oneOfGetter(E=["backoff"]),set:c.oneOfSetter(E)}),I.encode=function(h,C){if(C||(C=d.create()),null!=h.topicID&&Object.hasOwnProperty.call(h,"topicID")&&C.uint32(10).string(h.topicID),null!=h.peers&&h.peers.length)for(var A=0;A<h.peers.length;++A)f.RPC.PeerInfo.encode(h.peers[A],C.uint32(18).fork()).ldelim();return null!=h.backoff&&Object.hasOwnProperty.call(h,"backoff")&&C.uint32(24).uint64(h.backoff),C},I.decode=function(h,C){h instanceof m||(h=m.create(h));for(var A=void 0===C?h.len:h.pos+C,N=new f.RPC.ControlPrune;h.pos<A;){var S=h.uint32();switch(S>>>3){case 1:N.topicID=h.string();break;case 2:N.peers&&N.peers.length||(N.peers=[]),N.peers.push(f.RPC.PeerInfo.decode(h,h.uint32()));break;case 3:N.backoff=h.uint64();break;default:h.skipType(7&S)}}return N},I.fromObject=function(h){if(h instanceof f.RPC.ControlPrune)return h;var C=new f.RPC.ControlPrune;if(null!=h.topicID&&(C.topicID=String(h.topicID)),h.peers){if(!Array.isArray(h.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");C.peers=[];for(var A=0;A<h.peers.length;++A){if("object"!=typeof h.peers[A])throw TypeError(".RPC.ControlPrune.peers: object expected");C.peers[A]=f.RPC.PeerInfo.fromObject(h.peers[A])}}return null!=h.backoff&&(c.Long?(C.backoff=c.Long.fromValue(h.backoff)).unsigned=!0:"string"==typeof h.backoff?C.backoff=parseInt(h.backoff,10):"number"==typeof h.backoff?C.backoff=h.backoff:"object"==typeof h.backoff&&(C.backoff=new c.LongBits(h.backoff.low>>>0,h.backoff.high>>>0).toNumber(!0))),C},I.toObject=function(h,C){C||(C={});var A={};if((C.arrays||C.defaults)&&(A.peers=[]),null!=h.topicID&&h.hasOwnProperty("topicID")&&(A.topicID=h.topicID,C.oneofs&&(A._topicID="topicID")),h.peers&&h.peers.length){A.peers=[];for(var N=0;N<h.peers.length;++N)A.peers[N]=f.RPC.PeerInfo.toObject(h.peers[N],C)}return null!=h.backoff&&h.hasOwnProperty("backoff")&&(A.backoff="number"==typeof h.backoff?C.longs===String?String(h.backoff):h.backoff:C.longs===String?c.Long.prototype.toString.call(h.backoff):C.longs===Number?new c.LongBits(h.backoff.low>>>0,h.backoff.high>>>0).toNumber(!0):h.backoff,C.oneofs&&(A._backoff="backoff")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p.PeerInfo=function(){function I(v){if(v)for(var h=Object.keys(v),C=0;C<h.length;++C)null!=v[h[C]]&&(this[h[C]]=v[h[C]])}var E;return I.prototype.peerID=null,I.prototype.signedPeerRecord=null,Object.defineProperty(I.prototype,"_peerID",{get:c.oneOfGetter(E=["peerID"]),set:c.oneOfSetter(E)}),Object.defineProperty(I.prototype,"_signedPeerRecord",{get:c.oneOfGetter(E=["signedPeerRecord"]),set:c.oneOfSetter(E)}),I.encode=function(h,C){return C||(C=d.create()),null!=h.peerID&&Object.hasOwnProperty.call(h,"peerID")&&C.uint32(10).bytes(h.peerID),null!=h.signedPeerRecord&&Object.hasOwnProperty.call(h,"signedPeerRecord")&&C.uint32(18).bytes(h.signedPeerRecord),C},I.decode=function(h,C){h instanceof m||(h=m.create(h));for(var A=void 0===C?h.len:h.pos+C,N=new f.RPC.PeerInfo;h.pos<A;){var S=h.uint32();switch(S>>>3){case 1:N.peerID=h.bytes();break;case 2:N.signedPeerRecord=h.bytes();break;default:h.skipType(7&S)}}return N},I.fromObject=function(h){if(h instanceof f.RPC.PeerInfo)return h;var C=new f.RPC.PeerInfo;return null!=h.peerID&&("string"==typeof h.peerID?c.base64.decode(h.peerID,C.peerID=c.newBuffer(c.base64.length(h.peerID)),0):h.peerID.length&&(C.peerID=h.peerID)),null!=h.signedPeerRecord&&("string"==typeof h.signedPeerRecord?c.base64.decode(h.signedPeerRecord,C.signedPeerRecord=c.newBuffer(c.base64.length(h.signedPeerRecord)),0):h.signedPeerRecord.length&&(C.signedPeerRecord=h.signedPeerRecord)),C},I.toObject=function(h,C){C||(C={});var A={};return null!=h.peerID&&h.hasOwnProperty("peerID")&&(A.peerID=C.bytes===String?c.base64.encode(h.peerID,0,h.peerID.length):C.bytes===Array?Array.prototype.slice.call(h.peerID):h.peerID,C.oneofs&&(A._peerID="peerID")),null!=h.signedPeerRecord&&h.hasOwnProperty("signedPeerRecord")&&(A.signedPeerRecord=C.bytes===String?c.base64.encode(h.signedPeerRecord,0,h.signedPeerRecord.length):C.bytes===Array?Array.prototype.slice.call(h.signedPeerRecord):h.signedPeerRecord,C.oneofs&&(A._signedPeerRecord="signedPeerRecord")),A},I.prototype.toJSON=function(){return this.constructor.toObject(this,b.util.toJSONOptions)},I}(),p}(),f}.apply(K,l))&&(Y.exports=g)},8237:Y=>{function R(y){function l(g){if(Object(g)!==g)return Promise.reject(new TypeError(g+" is not an object."));var b=g.done;return Promise.resolve(g.value).then(function(m){return{value:m,done:b}})}return(R=function(b){this.s=b,this.n=b.next}).prototype={s:null,n:null,next:function(){return l(this.n.apply(this.s,arguments))},return:function(b){var m=this.s.return;return void 0===m?Promise.resolve({value:b,done:!0}):l(m.apply(this.s,arguments))},throw:function(b){var m=this.s.return;return void 0===m?Promise.reject(b):l(m.apply(this.s,arguments))}},new R(y)}Y.exports=function K(y){var l,g,b,m=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,b=Symbol.iterator);m--;){if(g&&null!=(l=y[g]))return l.call(y);if(b&&null!=(l=y[b]))return new R(l.call(y));g="@@asyncIterator",b="@@iterator"}throw new TypeError("Object is not async iterable")},Y.exports.__esModule=!0,Y.exports.default=Y.exports},7156:Y=>{function K(y,l,g,b,m,d,c){try{var f=y[d](c),p=f.value}catch(w){return void g(w)}f.done?l(p):Promise.resolve(p).then(b,m)}Y.exports=function R(y){return function(){var l=this,g=arguments;return new Promise(function(b,m){var d=y.apply(l,g);function c(p){K(d,b,m,c,f,"next",p)}function f(p){K(d,b,m,c,f,"throw",p)}c(void 0)})}},Y.exports.__esModule=!0,Y.exports.default=Y.exports}},Y=>{Y(Y.s=5876)}]); |