status-im-auto 3f372cd065 Updates
2024-04-02 14:30:09 +00:00

2 lines
1.1 MiB

/*! For license information please see main.e636259c.js.LICENSE.txt */
(()=>{var __webpack_modules__={6516:(e,t,r)=>{"use strict";e.exports=r(6840)},6840:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(4239),n.BufferWriter=r(2584),n.Reader=r(8175),n.BufferReader=r(664),n.util=r(5924),n.rpc=r(2197),n.roots=r(6071),n.configure=i,i()},8175:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(5924),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>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(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.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},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},664:(e,t,r)=>{"use strict";e.exports=o;var n=r(8175);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(5924);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},6071:e=>{"use strict";e.exports={}},2197:(e,t,r)=>{"use strict";t.Service=r(7949)},7949:(e,t,r)=>{"use strict";e.exports=i;var n=r(5924);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){s(c)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},3533:(e,t,r)=>{"use strict";e.exports=i;var n=r(5924);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.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)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},5924:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=r(3159),n.base64=r(1313),n.EventEmitter=r(3456),n.float=r(4348),n.inquire=r(2867),n.utf8=r(7817),n.pool=r(2940),n.LongBits=r(3533),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},4239:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(5924),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.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 c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},2584:(e,t,r)=>{"use strict";e.exports=o;var n=r(4239);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(5924);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},3159:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,o=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,s){r[n]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(a){o&&(o=!1,s(a))}}))}},1313:(e,t)=>{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var i,o=null,s=[],a=0,c=0;t<r;){var l=e[t++];switch(c){case 0:s[a++]=n[l>>2],i=(3&l)<<4,c=1;break;case 1:s[a++]=n[i|l>>4],i=(15&l)<<2,c=2;break;case 2:s[a++]=n[i|l>>6],s[a++]=n[63&l],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,o=r,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=i[l]))throw Error(s);switch(a){case 0:n=l,a=1;break;case 1:t[r++]=n<<2|(48&l)>>4,n=l,a=2;break;case 2:t[r++]=(15&n)<<4|(60&l)>>2,n=l,a=3;break;case 3:t[r++]=(3&n)<<6|l,a=0}}if(1===a)throw Error(s);return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},4011:e=>{"use strict";function t(e,r){"string"===typeof e&&(r=e,e=void 0);var n=[];function i(e){if("string"!==typeof e){var r=o();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var s=Object.keys(e),a=new Array(s.length+1),c=new Array(s.length),l=0;l<s.length;)a[l]=s[l],c[l]=e[s[l++]];return a[l]=r,Function.apply(null,a).apply(null,c)}return Function(r)()}for(var u=new Array(arguments.length-1),h=0;h<u.length;)u[h]=arguments[++h];if(h=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=u[h++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),h!==u.length)throw Error("parameter count mismatch");return n.push(e),i}function o(t){return"function "+(t||r||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return i.toString=o,i}e.exports=t,t.verbose=!1},3456:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},6046:(e,t,r)=>{"use strict";e.exports=o;var n=r(3159),i=r(2867)("fs");function o(e,t,r){return"function"===typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&i&&i.readFile?i.readFile(e,(function(n,i){return n&&"undefined"!==typeof XMLHttpRequest?o.xhr(e,t,r):n?r(n):r(null,t.binary?i:i.toString("utf8"))})):o.xhr(e,t,r):n(o,this,e,t)}o.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var i=0;i<n.responseText.length;++i)e.push(255&n.responseText.charCodeAt(i))}return r(null,"undefined"!==typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},4348:e=>{"use strict";function t(e){return"undefined"!==typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,s=8388607&n;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,i,o){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}}function s(e,t,r,n,i){var o=e(n,i+t),s=e(n,i+r),a=2*(s>>31)+1,c=s>>>20&2047,l=4294967296*(1048575&s)+o;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},2867: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(e){}return null}module.exports=inquire},8845:(e,t)=>{"use strict";var r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),i="";r&&(i=t.shift()+"/");for(var o=0;o<t.length;)".."===t[o]?o>0&&".."!==t[o-1]?t.splice(--o,2):r?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return i+t.join("/")};r.resolve=function(e,t,r){return r||(t=i(t)),n(t)?t:(r||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},2940:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(r){if(r<1||r>i)return e(r);s+r>n&&(o=e(n),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},7817:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296===(64512&r)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,o=[],s=0;t<r;)(n=e[t++])<128?o[s++]=n:n>191&&n<224?o[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(n>>10),o[s++]=56320+(1023&n)):o[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,r){for(var n,i,o=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}},255:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(r){}!e&&"undefined"!==typeof process&&"env"in process&&(e={NODE_ENV:"production",PUBLIC_URL:"/relay-reactjs-chat",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.DEBUG);return e},t.useColors=function(){if("undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(7394)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},7394:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(!a.enabled)return;const o=a,s=Number(new Date),c=s-(r||s);o.diff=c,o.prev=r,o.curr=s,r=s,n[0]=t.coerce(n[0]),"string"!==typeof n[0]&&n.unshift("%O");let l=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,((e,r)=>{if("%%"===e)return"%";l++;const i=t.formatters[r];if("function"===typeof i){const t=n[l];e=i.call(o,t),n.splice(l,1),l--}return e})),t.formatArgs.call(o,n);(o.log||t.log).apply(o,n)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"===typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+("undefined"===typeof r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"===typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(8179),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},8467:e=>{"use strict";function t(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}t.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},t.prototype.get=function(e){return this.peekAt(e)},t.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},t.prototype.peekFront=function(){return this.peek()},t.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(t.prototype,"length",{get:function(){return this.size()}}),t.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.unshift=function(e){if(void 0===e)return this.size();var t=this._list.length;return this._head=this._head-1+t&this._capacityMask,this._list[this._head]=e,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)},t.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},t.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+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)},t.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var r=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),r}},t.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),n=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var i,o=this._list[t];if(e<r/2){for(i=e;i>0;i--)this._list[t]=this._list[t=t-1+n&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--)this._list[t]=this._list[t=t+1+n&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+n&this._capacityMask}return o}}},t.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var o=this.size(),s=this._list.length;if(!(n>=o||n<-o||t<1)){if(n<0&&(n+=o),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=o)return r=this.toArray(),this.clear(),r;var a;for(n+t>o&&(t=o-n),r=new Array(t),a=0;a<t;a++)r[a]=this._list[this._head+n+a&this._capacityMask];if(n=this._head+n&this._capacityMask,e+t===o){for(this._tail=this._tail-t+s&this._capacityMask,a=t;a>0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+s&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(n<o/2){for(this._head=this._head+e+t+s&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[n=n-1+s&this._capacityMask]);for(n=this._head-1+s&this._capacityMask;i>0;)this._list[n=n-1+s&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+s&this._capacityMask,a=o-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+s&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=s>>>2&&this._shrinkArray(),r}}},t.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(arguments.length>2){var i,o,s,a=arguments.length,c=this._list.length,l=2;if(!n||r<n/2){for(o=new Array(r),i=0;i<r;i++)o[i]=this._list[this._head+i&this._capacityMask];for(0===t?(s=[],r>0&&(this._head=this._head+r+c&this._capacityMask)):(s=this.remove(r,t),this._head=this._head+r+c&this._capacityMask);a>l;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(o[i-1])}else{var u=(o=new Array(n-(r+t))).length;for(i=0;i<u;i++)o[i]=this._list[this._head+r+t+i&this._capacityMask];for(0===t?(s=[],r!=n&&(this._tail=this._head+r+c&this._capacityMask)):(s=this.remove(r,t),this._tail=this._tail-u+c&this._capacityMask);l<a;)this.push(arguments[l++]);for(i=0;i<u;i++)this.push(o[i])}return s}return this.remove(r,t)}}},t.prototype.clear=function(){this._head=0,this._tail=0},t.prototype.isEmpty=function(){return this._head===this._tail},t.prototype.toArray=function(){return this._copyArray(!1)},t.prototype._fromArray=function(e){for(var t=0;t<e.length;t++)this.push(e[t])},t.prototype._copyArray=function(e){var t,r=[],n=this._list,i=n.length;if(e||this._head>this._tail){for(t=this._head;t<i;t++)r.push(n[t]);for(t=0;t<this._tail;t++)r.push(n[t])}else for(t=this._head;t<this._tail;t++)r.push(n[t]);return r},t.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},t.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},e.exports=t},2956:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"===typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"===typeof r&&(n=r,r=""),r&&(n.code=r);try{return t(e,n)}catch(i){n.message=e.message,n.stack=e.stack;const r=function(){};r.prototype=Object.create(Object.getPrototypeOf(e));return t(new r,n)}}},3394:(e,t,r)=>{"use strict";const n=r(6233);t.PP=n.EventIterator,n.EventIterator},6233:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),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 ".concat(this.pushQueue.length," items")))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e){let{highWaterMark:t=100,lowWaterMark:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},5438:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!==typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var c,l,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,o),!0;case 6:return u.fn.call(u.context,t,n,i,o,s),!0}for(l=1,c=new Array(h-1);l<h;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var d,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),h){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,n);break;case 4:u[l].fn.call(u[l].context,t,n,i);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];u[l].fn.apply(u[l].context,c)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var c=0,l=[],u=a.length;c<u;c++)(a[c].fn!==t||i&&!a[c].once||n&&a[c].context!==n)&&l.push(a[c]);l.length?this._events[o]=1===l.length?l[0]:l:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},8981:e=>{"use strict";var t,r="object"===typeof Reflect?Reflect:null,n=r&&"function"===typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"===typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!==e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,o,s,l;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"===typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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 h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"===typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"===typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!==typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!==typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.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},o.prototype.setMaxListeners=function(e){if("number"!==typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"===typeof c)n(c,this,t);else{var l=c.length,u=p(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return l(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!==typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"===typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},1196:e=>{e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,o){r[i]=o,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},3628:(e,t,r)=>{var n;!function(){"use strict";var t="object"===typeof window?window:{};!t.HI_BASE32_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node&&(t=r.g);var i=!t.HI_BASE32_NO_COMMON_JS&&e.exports,o=r.amdO,s="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),a={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},c=[0,0,0,0,0,0,0,0],l=function(e,t){t.length>10&&(t="..."+t.substr(-10));var r=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw r.position=e,r},u=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,r,n,i,o,s,c,l,u=[],h=0,d=(e=e.replace(/=/g,"")).length,f=0,p=d>>3<<3;f<p;)t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],o=a[e.charAt(f++)],s=a[e.charAt(f++)],c=a[e.charAt(f++)],l=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|c>>>3),u[h++]=255&(c<<5|l);var g=d-p;return 2===g?(t=a[e.charAt(f++)],r=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2)):4===g?(t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4)):5===g?(t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],o=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|o>>>1)):7===g&&(t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],o=a[e.charAt(f++)],s=a[e.charAt(f++)],c=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|c>>>3)),u},h=function(e,t){if(!t)return function(e){for(var t,r,n="",i=e.length,o=0,s=0;o<i;)if((t=e[o++])<=127)n+=String.fromCharCode(t);else{t>191&&t<=223?(r=31&t,s=1):t<=239?(r=15&t,s=2):t<=247?(r=7&t,s=3):l(o,n);for(var a=0;a<s;++a)((t=e[o++])<128||t>191)&&l(o,n),r<<=6,r+=63&t;r>=55296&&r<=57343&&l(o,n),r>1114111&&l(o,n),r<=65535?n+=String.fromCharCode(r):(r-=65536,n+=String.fromCharCode(55296+(r>>10)),n+=String.fromCharCode(56320+(1023&r)))}return n}(u(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var r,n,i,o,s,c,h,d,f="",p=e.indexOf("=");-1===p&&(p=e.length);for(var g=0,y=p>>3<<3;g<y;)r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],s=a[e.charAt(g++)],c=a[e.charAt(g++)],h=a[e.charAt(g++)],d=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|c<<2|h>>>3))+String.fromCharCode(255&(h<<5|d));var m=p-y;return 2===m?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))):4===m?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))):5===m?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],s=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===m&&(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],s=a[e.charAt(g++)],c=a[e.charAt(g++)],h=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|c<<2|h>>>3))),f},d={encode:function(e,t){var r="string"!==typeof e;return r&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),r?function(e){for(var t,r,n,i,o,a="",c=e.length,l=0,u=5*parseInt(c/5);l<u;)t=e[l++],r=e[l++],n=e[l++],i=e[l++],o=e[l++],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[31&(i<<3|o>>>5)]+s[31&o];var h=c-u;return 1===h?(t=e[l],a+=s[t>>>3]+s[t<<2&31]+"======"):2===h?(t=e[l++],r=e[l],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[r<<4&31]+"===="):3===h?(t=e[l++],r=e[l++],n=e[l],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[n<<1&31]+"==="):4===h&&(t=e[l++],r=e[l++],n=e[l++],i=e[l],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"="),a}(e):t?function(e){for(var t,r,n,i,o,a="",c=e.length,l=0,u=5*parseInt(c/5);l<u;)t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),i=e.charCodeAt(l++),o=e.charCodeAt(l++),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[31&(i<<3|o>>>5)]+s[31&o];var h=c-u;return 1===h?(t=e.charCodeAt(l),a+=s[t>>>3]+s[t<<2&31]+"======"):2===h?(t=e.charCodeAt(l++),r=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[r<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[n<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),i=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"="),a}(e):function(e){var t,r,n,i,o,a,l,u=!1,h="",d=0,f=0,p=e.length;if(""===e)return h;do{for(c[0]=c[5],c[1]=c[6],c[2]=c[7],l=f;d<p&&l<5;++d)(a=e.charCodeAt(d))<128?c[l++]=a:a<2048?(c[l++]=192|a>>6,c[l++]=128|63&a):a<55296||a>=57344?(c[l++]=224|a>>12,c[l++]=128|a>>6&63,c[l++]=128|63&a):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++d)),c[l++]=240|a>>18,c[l++]=128|a>>12&63,c[l++]=128|a>>6&63,c[l++]=128|63&a);f=l-5,d===p&&++d,d>p&&l<6&&(u=!0),t=c[0],l>4?(r=c[1],n=c[2],i=c[3],o=c[4],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[31&(i<<3|o>>>5)]+s[31&o]):1===l?h+=s[t>>>3]+s[t<<2&31]+"======":2===l?(r=c[1],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[r<<4&31]+"===="):3===l?(r=c[1],n=c[2],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[n<<1&31]+"==="):(r=c[1],n=c[2],i=c[3],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"=")}while(!u);return h}(e)},decode:h};h.asBytes=u,i?e.exports=d:(t.base32=d,o&&(void 0===(n=function(){return d}.call(d,r,d,e))||(e.exports=n)))}()},5958:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),threeOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),twoOctet:new RegExp("^".concat(r,"\\.").concat(r,"$"),"i"),longValue:new RegExp("^".concat(r,"$"),"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(s,"i"),native:new RegExp("^(::)?(".concat(a,")?([0-9a-f]+)?(::)?(").concat(s,")?$"),"i"),deprecatedTransitional:new RegExp("^(?:::)(".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?$"),"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(e.match(c.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(o=e.indexOf(":",o+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),zoneId:s}}function u(e,t,r,n){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,o=0;for(;n>0;){if(i=r-n,i<0&&(i=0),e[o]>>i!==t[o]>>i)return!1;n-=r,o+=1}return!0}function h(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error("ipaddr: cannot parse ".concat(e," as octal"))}return parseInt(e,10)}function d(e,t){for(;e.length<t;)e="0".concat(e);return e}const f={};f.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,r;for(t=0;t<e.length;t++)if(r=e[t],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}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,18,0,0]),15],[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(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,i,o;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],t&&0!==o)return null;8!==o&&(t=!0),e+=o}return 32-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse("::ffff:".concat(this.toString()))},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),f.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(e){return null!==this.parser(e)},f.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(t){return!1}},f.IPv4.isValidFourPartDecimal=function(e){return!(!f.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},f.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(e){let t,r,i;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t<e.length;t++)r=e[t],n.push(h(r));return n}();if(t=e.match(n.longValue)){if(i=h(t[1]),i>4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),r=[];if(i=h(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),r=[];if(i=h(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(h(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},f.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.IPv6=function(){function e(e,t){let r,n;if(16===e.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(e[r]<<8|e[r+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(r=0;r<this.parts.length;r++)if(n=this.parts[r],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}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]],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[new e([8193,4,274,0,0,0,0,0]),48],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={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 n,i;for(let o=7;o>=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n<r.length;n++)e=r[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(d(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],r=e[1];return new f.IPv4([t>>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let r,n=0,i=-1;for(;r=e.exec(t);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?t:"".concat(t.substring(0,n),"::").concat(t.substring(n+i))},e.prototype.toString=function(){return this.toRFC5952String()},e}(),f.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(t,")"))}},f.IPv6.isIPv6=function(e){return null!==this.parser(e)},f.IPv6.isValid=function(e){if("string"===typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(t){return!1}},f.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(s,")"))}},f.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},f.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(e){let t,r,n,i,o,s;if(n=e.match(c.deprecatedTransitional))return this.parser("::ffff:".concat(n[1]));if(c.native.test(e))return l(e,8);if((n=e.match(c.transitional))&&(s=n[6]||"",t=l(n[1].slice(0,-1)+s,6),t.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<o.length;r++)if(i=o[r],!(0<=i&&i<=255))return null;return t.parts.push(o[0]<<8|o[1]),t.parts.push(o[2]<<8|o[3]),{parts:t.parts,zoneId:t.zoneId}}return null},f.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.fromByteArray=function(e){const t=e.length;if(4===t)return new f.IPv4(e);if(16===t)return new f.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},f.isValid=function(e){return f.IPv6.isValid(e)||f.IPv4.isValid(e)},f.parse=function(e){if(f.IPv6.isValid(e))return f.IPv6.parse(e);if(f.IPv4.isValid(e))return f.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},f.parseCIDR=function(e){try{return f.IPv6.parseCIDR(e)}catch(t){try{return f.IPv4.parseCIDR(e)}catch(r){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},f.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},f.subnetMatch=function(e,t,r){let n,i,o,s;for(i in void 0!==r&&null!==r||(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,i))for(o=t[i],!o[0]||o[0]instanceof Array||(o=[o]),n=0;n<o.length;n++)if(s=o[n],e.kind()===s[0].kind()&&e.match.apply(e,s))return i;return r},e.exports?e.exports=f:t.ipaddr=f}(this)},9152:e=>{e.exports=function(){return"undefined"!==typeof window&&"object"===typeof window.process&&"renderer"===window.process.type||(!("undefined"===typeof process||"object"!==typeof process.versions||!process.versions.electron)||"object"===typeof navigator&&"string"===typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}},9666:e=>{"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},7674:(e,t,r)=>{var n;!function(){"use strict";var i="input is invalid type",o="object"===typeof window,s=o?window:{};s.JS_SHA3_NO_WINDOW&&(o=!1);var a=!o&&"object"===typeof self;!s.JS_SHA3_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node?s=r.g:a&&(s=self);var c=!s.JS_SHA3_NO_COMMON_JS&&e.exports,l=r.amdO,u=!s.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,h="0123456789abcdef".split(""),d=[4,1024,262144,67108864],f=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],y=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!s.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!u||!s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var b=function(e,t,r){return function(n){return new O(e,t,e).update(n)[r]()}},w=function(e,t,r){return function(n,i){return new O(e,t,i).update(n)[r]()}},E=function(e,t,r){return function(t,n,i,o){return I["cshake"+e].update(t,n,i,o)[r]()}},_=function(e,t,r){return function(t,n,i,o){return I["kmac"+e].update(t,n,i,o)[r]()}},S=function(e,t,r,n){for(var i=0;i<m.length;++i){var o=m[i];e[o]=t(r,n,o)}return e},A=function(e,t){var r=b(e,t,"hex");return r.create=function(){return new O(e,t,e)},r.update=function(e){return r.create().update(e)},S(r,b,e,t)},k=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:A},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:A},{name:"shake",padding:[31,7936,2031616,520093696],bits:y,createMethod:function(e,t){var r=w(e,t,"hex");return r.create=function(r){return new O(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},S(r,w,e,t)}},{name:"cshake",padding:d,bits:y,createMethod:function(e,t){var r=v[e],n=E(e,0,"hex");return n.create=function(n,i,o){return i||o?new O(e,t,n).bytepad([i,o],r):I["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},S(n,E,e,t)}},{name:"kmac",padding:d,bits:y,createMethod:function(e,t){var r=v[e],n=_(e,0,"hex");return n.create=function(n,i,o){return new L(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},S(n,_,e,t)}}],I={},C=[],R=0;R<k.length;++R)for(var T=k[R],x=T.bits,P=0;P<x.length;++P){var D=T.name+"_"+x[P];if(C.push(D),I[D]=T.createMethod(x[P],T.padding),"sha3"!==T.name){var N=T.name+x[P];C.push(N),I[N]=I[D]}}function O(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function L(e,t,r){O.call(this,e,t,r)}O.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}for(var n,o,s=this.blocks,a=this.byteCount,c=e.length,l=this.blockCount,h=0,d=this.s;h<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<l+1;++n)s[n]=0;if(t)for(n=this.start;h<c&&n<a;++h)s[n>>2]|=e[h]<<f[3&n++];else for(n=this.start;h<c&&n<a;++h)(o=e.charCodeAt(h))<128?s[n>>2]|=o<<f[3&n++]:o<2048?(s[n>>2]|=(192|o>>6)<<f[3&n++],s[n>>2]|=(128|63&o)<<f[3&n++]):o<55296||o>=57344?(s[n>>2]|=(224|o>>12)<<f[3&n++],s[n>>2]|=(128|o>>6&63)<<f[3&n++],s[n>>2]|=(128|63&o)<<f[3&n++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[n>>2]|=(240|o>>18)<<f[3&n++],s[n>>2]|=(128|o>>12&63)<<f[3&n++],s[n>>2]|=(128|o>>6&63)<<f[3&n++],s[n>>2]|=(128|63&o)<<f[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=s[l],n=0;n<l;++n)d[n]^=s[n];B(d),this.reset=!0}else this.start=n}return this},O.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},O.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}var n=0,o=e.length;if(t)n=o;else for(var s=0;s<e.length;++s){var a=e.charCodeAt(s);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(e),n},O.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,o=[];return o.length=i,this.update(o),this},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];B(n)}},O.prototype.toString=O.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<t&&s<n;++o,++s)e=r[o],a+=h[e>>4&15]+h[15&e]+h[e>>12&15]+h[e>>8&15]+h[e>>20&15]+h[e>>16&15]+h[e>>28&15]+h[e>>24&15];s%t===0&&(B(r),o=0)}return i&&(e=r[o],a+=h[e>>4&15]+h[15&e],i>1&&(a+=h[e>>12&15]+h[e>>8&15]),i>2&&(a+=h[e>>20&15]+h[e>>16&15])),a},O.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)c[s]=r[o];s%t===0&&B(r)}return i&&(c[o]=r[o],e=e.slice(0,a)),e},O.prototype.buffer=O.prototype.arrayBuffer,O.prototype.digest=O.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r===0&&B(n)}return o&&(e=a<<2,t=n[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},L.prototype=new O,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var B=function(e){var t,r,n,i,o,s,a,c,l,u,h,d,f,g,y,m,v,b,w,E,_,S,A,k,I,C,R,T,x,P,D,N,O,L,B,M,U,F,j,z,q,K,V,H,W,G,Y,Q,X,J,$,Z,ee,te,re,ne,ie,oe,se,ae,ce,le,ue;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|l>>>31),r=o^(l<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(u<<1|h>>>31),r=a^(h<<1|u>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|f>>>31),r=l^(f<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=u^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,g=e[0],y=e[1],G=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,x=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,L=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Q=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,le=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,M=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,N=e[45]<<29|e[44]>>>3,O=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,A=e[49]<<14|e[48]>>>18,e[0]=g^~m&b,e[1]=y^~v&w,e[10]=k^~C&T,e[11]=I^~R&x,e[20]=L^~M&F,e[21]=B^~U&j,e[30]=H^~G&Q,e[31]=W^~Y&X,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=m^~b&E,e[3]=v^~w&_,e[12]=C^~T&P,e[13]=R^~x&D,e[22]=M^~F&z,e[23]=U^~j&q,e[32]=G^~Q&J,e[33]=Y^~X&$,e[42]=ne^~oe&ae,e[43]=ie^~se&ce,e[4]=b^~E&S,e[5]=w^~_&A,e[14]=T^~P&N,e[15]=x^~D&O,e[24]=F^~z&K,e[25]=j^~q&V,e[34]=Q^~J&Z,e[35]=X^~$&ee,e[44]=oe^~ae&le,e[45]=se^~ce&ue,e[6]=E^~S&g,e[7]=_^~A&y,e[16]=P^~N&k,e[17]=D^~O&I,e[26]=z^~K&L,e[27]=q^~V&B,e[36]=J^~Z&H,e[37]=$^~ee&W,e[46]=ae^~le&te,e[47]=ce^~ue&re,e[8]=S^~g&m,e[9]=A^~y&v,e[18]=N^~k&C,e[19]=O^~I&R,e[28]=K^~L&M,e[29]=V^~B&U,e[38]=Z^~H&G,e[39]=ee^~W&Y,e[48]=le^~te&ne,e[49]=ue^~re&ie,e[0]^=p[n],e[1]^=p[n+1]};if(c)e.exports=I;else{for(R=0;R<C.length;++R)s[C[R]]=I[C[R]];l&&(void 0===(n=function(){return I}.call(t,r,t,e))||(e.exports=n))}}()},6754:function(e,t,r){"use strict";const n=r(9666),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:o}=Object,s=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},l=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)o.call(e,n)&&t.push(n)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return l(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):e}const h=(e,t,r,n)=>(r.forEach((r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,f(e[r],t[r],n)):s(e,r,u(t[r])))})),e),d=(e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r<t.length;r++)i.call(t,r)&&(a.push(String(r)),s(n,o++,t===e?t[r]:u(t[r])));n=h(n,t,l(t).filter((e=>!a.includes(e))),r)})),n};function f(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,r):n(t)&&n(e)?h(e,t,l(t),r):u(t)}e.exports=function(){const e=f(u(c),this!==a&&this||{},c);let t={_:{}};for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];for(const s of i)if(void 0!==s){if(!n(s))throw new TypeError("`"+s+"` is not an Option Object");t=f(t,{_:s},e)}return t._}},8179:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,s=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},3297:function(e,t){(function(){var e,r,n,i,o,s,a,c;c=function(e){return[(e&255<<24)>>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,o,s,a;for(t=[],i=o=0;o<=3&&0!==e.length;i=++o){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}s=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(s)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),s=n("a"),o=n("A"),r=function(e){var t,r,a,c,l;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),l=a;a<e.length;){if("0"<=e[a]&&e[a]<=r)c=c*t+(n(e[a])-i)>>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+n(e[a])-s)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-o)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===l)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,n,i;if("string"!==typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"===typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(o){throw o,new Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(o){throw o,new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);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=this.bitmask<=30?c(this.netLong+this.size-2):c(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"===typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(c(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(c(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=c,t.Netmask=e}).call(this)},7510:(e,t,r)=>{var n=r(1102);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(9362),r(6676),r(5593),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=g({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=g({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){u||d();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(r._w,e,t,!1)},decrypt:function(e,t){return p(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!==typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var s=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=f(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return u||d(),f(e,t)},n.aes._updateBlock=p,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var o,s,a,c,l,u=!1,h=4;function d(){u=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;o=new Array(256),s=new Array(256),c=new Array(4),l=new Array(4);for(t=0;t<4;++t)c[t]=new Array(256),l[t]=new Array(256);var r,n,i,h,d,f,p,g=0,y=0;for(t=0;t<256;++t){h=(h=y^y<<1^y<<2^y<<3^y<<4)>>8^255&h^99,o[g]=h,s[h]=g,f=(d=e[h])<<24^h<<16^h<<8^h^d,p=((r=e[g])^(n=e[r])^(i=e[n]))<<24^(g^i)<<16^(g^n^i)<<8^g^r^i;for(var m=0;m<4;++m)c[m][g]=f,l[m][h]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===g?g=y=1:(g=r^e[e[e[r^i]]],y^=e[e[y]])}}function f(e,t){for(var r,n=e.slice(0),i=1,s=n.length,c=h*(s+6+1),u=s;u<c;++u)r=n[u-1],u%s===0?(r=o[r>>>16&255]<<24^o[r>>>8&255]<<16^o[255&r]<<8^o[r>>>24]^a[i]<<24,i++):s>6&&u%s===4&&(r=o[r>>>24]<<24^o[r>>>16&255]<<16^o[r>>>8&255]<<8^o[255&r]),n[u]=n[u-s]^r;if(t){for(var d,f=l[0],p=l[1],g=l[2],y=l[3],m=n.slice(0),v=(u=0,(c=n.length)-h);u<c;u+=h,v-=h)if(0===u||u===c-h)m[u]=n[v],m[u+1]=n[v+3],m[u+2]=n[v+2],m[u+3]=n[v+1];else for(var b=0;b<h;++b)d=n[v+b],m[u+(3&-b)]=f[o[d>>>24]]^p[o[d>>>16&255]]^g[o[d>>>8&255]]^y[o[255&d]];n=m}return n}function p(e,t,r,n){var i,a,u,h,d,f,p,g,y,m,v,b,w=e.length/4-1;n?(i=l[0],a=l[1],u=l[2],h=l[3],d=s):(i=c[0],a=c[1],u=c[2],h=c[3],d=o),f=t[0]^e[0],p=t[n?3:1]^e[1],g=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,_=1;_<w;++_)m=i[f>>>24]^a[p>>>16&255]^u[g>>>8&255]^h[255&y]^e[++E],v=i[p>>>24]^a[g>>>16&255]^u[y>>>8&255]^h[255&f]^e[++E],b=i[g>>>24]^a[y>>>16&255]^u[f>>>8&255]^h[255&p]^e[++E],y=i[y>>>24]^a[f>>>16&255]^u[p>>>8&255]^h[255&g]^e[++E],f=m,p=v,g=b;r[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[g>>>8&255]<<8^d[255&y]^e[++E],r[n?3:1]=d[p>>>24]<<24^d[g>>>16&255]<<16^d[y>>>8&255]<<8^d[255&f]^e[++E],r[2]=d[g>>>24]<<24^d[y>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],r[n?1:3]=d[y>>>24]<<24^d[f>>>16&255]<<16^d[p>>>8&255]<<8^d[255&g]^e[++E]}function g(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},5120:(e,t,r)=>{var n=r(1102);r(5593),r(1920);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.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},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],c=0;c<o.length;++c)void 0!==o[c]&&a.push(o[c]);o=a}var l={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(o),value:o};return s&&"bitStringContents"in s&&(l.bitStringContents=s.bitStringContents,l.original=i.copy(l)),l},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var o=0;o<e.length;++o)r.push(i.copy(e[o],t));return r}return"string"===typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var o=0;o<e.length;++o)if(!i.equals(e[o],t[o]))return!1;return!0}if(typeof e!==typeof t)return!1;if("string"===typeof e)return e===t;var s=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(s=s&&e.bitStringContents===t.bitStringContents),s},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function s(e,t,r,n){var a;o(e,t,2);var c=e.getByte();t--;var l=192&c,u=31&c;a=e.length();var h,d,f=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;o(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}}(e,t);if(t-=a-e.length(),void 0!==f&&f>t){if(n.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=f,p}f=t}var g=32===(32&c);if(g)if(h=[],void 0===f)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),h.push(s(e,t,r+1,n)),t-=a-e.length()}else for(;f>0;)a=e.length(),h.push(s(e,f,r+1,n)),t-=a-e.length(),f-=a-e.length();if(void 0===h&&l===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===h&&n.decodeBitStrings&&l===i.Class.UNIVERSAL&&u===i.Type.BITSTRING&&f>1){var y=e.read,m=t,v=0;if(u===i.Type.BITSTRING&&(o(e,t,1),v=e.getByte(),t--),0===v)try{a=e.length();var b=s(e,t,r+1,{strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,u==i.Type.BITSTRING&&w++;var E=b.tagClass;w!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(h=[b])}catch(S){}void 0===h&&(e.read=y,t=m)}if(void 0===h){if(void 0===f){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(u===i.Type.BMPSTRING)for(h="";f>0;f-=2)o(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(f),t-=f}var _=void 0===d?null:{bitStringContents:d};return i.create(l,u,g,h,_)}i.fromDer=function(e,t){void 0===t&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"===typeof t&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.length(),i=s(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var o=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw o.byteCount=r,o.remaining=e.length(),o}return i},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,o=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:o.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&o.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(a=0;a<e.value.length;++a)o.putInt16(e.value.charCodeAt(a));else e.type===i.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0===(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128===(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var c=o.length(),l="";do{l+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|l.length);for(a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,r,i,o,s=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c<s.length;++c){t=!0,r=[],i=parseInt(s[c],10);do{o=127&i,i>>>=7,t||(o|=128),r.push(o),t=!1}while(i>0);for(var l=r.length-1;l>=0;--l)a.putByte(r[l])}return a},i.derToOid=function(e){var t;"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var h=e.length-5,d=e.charAt(h);"+"!==d&&"-"!==d||(l=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),l*=6e4,"+"===d&&(l*=-1),u=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,c),t.setTime(+t+l)):(t.setFullYear(r,n,i),t.setHours(o,s,a,c)),t},i.dateToUtcTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.dateToGeneralizedTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"===typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,o){var s=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;s&&c<t.value.length;++c)s=t.value[c].optional||!1,e.value[a]&&((s=i.validate(e.value[a],t.value[c],r,o))?++a:t.value[c].optional&&(s=!0)),!s&&o&&o.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(s&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else o&&o.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return s};var a=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var o="";r=r||2,(t=t||0)>0&&(o+="\n");for(var s="",c=0;c<t*r;++c)s+=" ";switch(o+=s+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:o+="Universal:";break;case i.Class.APPLICATION:o+="Application:";break;case i.Class.CONTEXT_SPECIFIC:o+="Context-Specific:";break;case i.Class.PRIVATE:o+="Private:"}if(e.tagClass===i.Class.UNIVERSAL)switch(o+=e.type,e.type){case i.Type.NONE:o+=" (None)";break;case i.Type.BOOLEAN:o+=" (Boolean)";break;case i.Type.INTEGER:o+=" (Integer)";break;case i.Type.BITSTRING:o+=" (Bit string)";break;case i.Type.OCTETSTRING:o+=" (Octet string)";break;case i.Type.NULL:o+=" (Null)";break;case i.Type.OID:o+=" (Object Identifier)";break;case i.Type.ODESC:o+=" (Object Descriptor)";break;case i.Type.EXTERNAL:o+=" (External or Instance of)";break;case i.Type.REAL:o+=" (Real)";break;case i.Type.ENUMERATED:o+=" (Enumerated)";break;case i.Type.EMBEDDED:o+=" (Embedded PDV)";break;case i.Type.UTF8:o+=" (UTF8)";break;case i.Type.ROID:o+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:o+=" (Sequence)";break;case i.Type.SET:o+=" (Set)";break;case i.Type.PRINTABLESTRING:o+=" (Printable String)";break;case i.Type.IA5String:o+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:o+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:o+=" (Generalized time)";break;case i.Type.BMPSTRING:o+=" (BMP String)"}else o+=e.type;if(o+="\n",o+=s+"Constructed: "+e.constructed+"\n",e.composed){var l=0,u="";for(c=0;c<e.value.length;++c)void 0!==e.value[c]&&(l+=1,u+=i.prettyPrint(e.value[c],t+1,r),c+1<e.value.length&&(u+=","));o+=s+"Sub values: "+l+u}else{if(o+=s+"Value: ",e.type===i.Type.OID){var h=i.derToOid(e.value);o+=h,n.pki&&n.pki.oids&&h in n.pki.oids&&(o+=" ("+n.pki.oids[h]+") ")}if(e.type===i.Type.INTEGER)try{o+=i.derToInteger(e.value)}catch(f){o+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?o+=" (1 unused bit shown)":d>1&&(o+=" ("+d+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)a.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{o+=n.util.decodeUtf8(e.value)}catch(p){if("URI malformed"!==p.message)throw p;o+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:a.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},2912:e=>{var t={};e.exports=t;var r={};t.encode=function(e,t,r){if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!==typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,o=t.length,s=t.charAt(0),a=[0];for(i=0;i<e.length;++i){for(var c=0,l=e[i];c<a.length;++c)l+=a[c]<<8,a[c]=l%o,l=l/o|0;for(;l>0;)a.push(l%o),l=l/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=s;for(i=a.length-1;i>=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var s=0,a=e.at(r);s<o.length;++s)a+=o[s]<<8,o[s]=a%n,a=a/n|0;for(;a>0;)o.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=o.length-1;r>=0;--r)c+=t[o[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},t.decode=function(e,t){if("string"!==typeof e)throw new TypeError('"input" must be a string.');if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');var n=r[t];if(!n){n=r[t]=[];for(var i=0;i<t.length;++i)n[t.charCodeAt(i)]=i}e=e.replace(/\s/g,"");var o=t.length,s=t.charAt(0),a=[0];for(i=0;i<e.length;i++){var c=n[e.charCodeAt(i)];if(void 0===c)return;for(var l=0,u=c;l<a.length;++l)u+=a[l]*o,a[l]=255&u,u>>=8;for(;u>0;)a.push(255&u),u>>=8}for(var h=0;e[h]===s&&h<e.length-1;++h)a.push(0);return"undefined"!==typeof Buffer?Buffer.from(a.reverse()):new Uint8Array(a.reverse())}},9362:(e,t,r)=>{var n=r(1102);r(5593),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},6676:(e,t,r)=>{var n=r(1102);r(5593),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e,t){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i<r.length;++i)e.putByte(r[i])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!n.util.isArray(e)){var o=[],s=t/4;for(i=0;i<s;++i)o.push(e.getInt32());e=o}return e}function s(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o<=0||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var o=[];this.cipher.encrypt(this._j0,o);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^o[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],c=(n-1-s%n)*t;a[s/n|0]=1<<t-1<<c,o[s]=this.generateSubHashTable(this.multiply(a,e),t)}return o},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],c=i[s];i[o+s]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var l=i[o^n];i[o]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return i}},4221:(e,t,r)=>{var n=r(1102);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(9362),r(6676),r(5593),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return f(r._keys,e,t,!1)},decrypt:function(e,t){return f(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w<y;w++){var E=e.getInt32(),_=e.getInt32();E^=(t=252645135&(E>>>4^_))<<4,E^=t=65535&((_^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(_^=t<<-16)))<<2,E^=t=65535&((_^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(_^=t<<-16)))<<1,E^=t=16711935&((_^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(_^=t<<8)))<<1)<<8|(_^=t)>>>20&240,E=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var S=0;S<v.length;++S){v[S]?(E=E<<2|E>>>26,_=_<<2|_>>>26):(E=E<<1|E>>>27,_=_<<1|_>>>27),_&=-15;var A=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|o[E>>>16&15]|s[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],k=l[_>>>28]|u[_>>>24&15]|h[_>>>20&15]|d[_>>>16&15]|f[_>>>12&15]|p[_>>>8&15]|g[_>>>4&15];t=65535&(k>>>16^A),m[b++]=A^t,m[b++]=k^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var o=[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],s=[-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],a=[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],c=[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],l=[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],u=[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],h=[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],d=[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 f(e,t,r,n){var i,f,p=32===e.length?3:9;i=3===p?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 g=t[0],y=t[1];g^=(f=252645135&(g>>>4^y))<<4,g^=(f=65535&(g>>>16^(y^=f)))<<16,g^=f=858993459&((y^=f)>>>2^g),g^=f=16711935&((y^=f<<2)>>>8^g),g=(g^=(f=1431655765&(g>>>1^(y^=f<<8)))<<1)<<1|g>>>31,y=(y^=f)<<1|y>>>31;for(var m=0;m<p;m+=3){for(var v=i[m+1],b=i[m+2],w=i[m];w!=v;w+=b){var E=y^e[w],_=(y>>>4|y<<28)^e[w+1];f=g,g=y,y=f^(s[E>>>24&63]|c[E>>>16&63]|u[E>>>8&63]|d[63&E]|o[_>>>24&63]|a[_>>>16&63]|l[_>>>8&63]|h[63&_])}f=g,g=y,y=f}y=y>>>1|y<<31,y^=f=1431655765&((g=g>>>1|g<<31)>>>1^y),y^=(f=16711935&(y>>>8^(g^=f<<1)))<<8,y^=(f=858993459&(y>>>2^(g^=f)))<<2,y^=f=65535&((g^=f)>>>16^y),y^=f=252645135&((g^=f<<16)>>>4^y),g^=f<<4,r[0]=g,r[1]=y}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},1102:e=>{e.exports={options:{usePureJavaScript:!1}}},5826:(e,t,r)=>{var n=r(1102);r(8432),r(5593),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"===typeof o){if(!((o=o.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"===typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var c=0;c<a.length;++c)s.putByte(a[c])}var l=s.length();l>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),l=s.length();for(c=0;c<l;++c){a=s.at(c);r.putByte(54^a),i.putByte(92^a)}if(l<t.blockLength)for(a=t.blockLength-l,c=0;c<a;++c)r.putByte(54),i.putByte(92);e=s,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return o.digest=o.getMac,o}},6766:(e,t,r)=>{var n,i=r(1102);e.exports=i.jsbn=i.jsbn||{};function o(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=a*c+l*s;i=((c=s*c+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+a*l,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=o,"undefined"===typeof navigator?(o.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=a*c+l*s;i=((c=s*c+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(o.prototype.am=a,n=28),o.prototype.DB=n,o.prototype.DM=(1<<n)-1,o.prototype.DV=1<<n;o.prototype.FV=Math.pow(2,52),o.prototype.F1=52-n,o.prototype.F2=2*n-52;var c,l,u="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array;for(c="0".charCodeAt(0),l=0;l<=9;++l)h[c++]=l;for(c="a".charCodeAt(0),l=10;l<36;++l)h[c++]=l;for(c="A".charCodeAt(0),l=10;l<36;++l)h[c++]=l;function d(e){return u.charAt(e)}function f(e,t){var r=h[e.charCodeAt(t)];return null==r?-1:r}function p(e){var t=s();return t.fromInt(e),t}function g(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function m(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function v(e,t){return e&t}function b(e,t){return e|t}function w(e,t){return e^t}function E(e,t){return e&~t}function _(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function A(){}function k(e){return e}function I(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},m.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},m.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},m.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var a=8==r?255&e[n]:f(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this.data[this.t++]=a>>this.DB-s):this.data[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&o.ZERO.subTo(this,this)},o.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},o.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>i|a,a=(this.data[r]&o)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&o)<<i,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},o.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},o.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&o.ZERO.subTo(t,t)},o.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=s());var a=s(),c=this.s,l=e.s,u=this.DB-g(n.data[n.t-1]);u>0?(n.lShiftTo(u,a),i.lShiftTo(u,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,d=a.data[h-1];if(0!=d){var f=d*(1<<this.F1)+(h>1?a.data[h-2]>>this.F2:0),p=this.FV/f,y=(1<<this.F1)/f,m=1<<this.F2,v=r.t,b=v-h,w=null==t?s():t;for(a.dlShiftTo(b,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a.data[a.t++]=0;for(;--b>=0;){var E=r.data[--v]==d?this.DM:Math.floor(r.data[v]*p+(r.data[v-1]+m)*y);if((r.data[v]+=a.am(0,E,r,b,0,h))<E)for(a.dlShiftTo(b,w),r.subTo(w,r);r.data[v]<--E;)r.subTo(w,r)}null!=t&&(r.drShiftTo(h,t),c!=l&&o.ZERO.subTo(t,t)),r.t=h,r.clamp(),u>0&&r.rShiftTo(u,r),c<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=g(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this.data[s]>>a)>0&&(i=!0,o=d(r));s>=0;)a<t?(r=(this.data[s]&(1<<a)-1)<<t-a,r|=this.data[--s]>>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=d(r));return i?o:"0"},o.prototype.negate=function(){var e=s();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+g(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new m(t),this.exp(e,r)},o.ZERO=p(0),o.ONE=p(1),A.prototype.convert=k,A.prototype.revert=k,A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},A.prototype.sqrTo=function(e,t){e.squareTo(t)},I.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},I.prototype.revert=function(e){return e},I.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},I.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},I.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var C=[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],R=(1<<26)/C[C.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=p(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,c=0;c<e.length;++c){var l=f(e,c);l<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(a=t*a+l,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),b,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},o.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},o.prototype.changeBit=function(e,t){var r=o.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},o.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},o.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},o.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},o.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new o(this.bitLength(),s)}while(n.compareTo(o.ONE)<=0||n.compareTo(t)>=0);var c=n.modPow(i,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(t)){for(var l=1;l++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(o.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},o.prototype.clone=function(){var e=s();return this.copyTo(e),e},o.prototype.intValue=function(){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]},o.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=s();return this.bitwiseTo(e,v,t),t},o.prototype.or=function(e){var t=s();return this.bitwiseTo(e,b,t),t},o.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,w,t),t},o.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},o.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},o.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},o.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},o.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+_(this.data[e]);return this.s<0?this.t*this.DB:-1},o.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e},o.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},o.prototype.setBit=function(e){return this.changeBit(e,b)},o.prototype.clearBit=function(e){return this.changeBit(e,E)},o.prototype.flipBit=function(e){return this.changeBit(e,w)},o.prototype.add=function(e){var t=s();return this.addTo(e,t),t},o.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t},o.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t},o.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t},o.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t},o.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)},o.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),o=p(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new I(t):new m(t);var a=new Array,c=3,l=r-1,u=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=s();for(n.sqrTo(a[1],h);c<=u;)a[c]=s(),n.mulTo(h,a[c-2],a[c]),c+=2}var d,f,v=e.t-1,b=!0,w=s();for(i=g(e.data[v])-1;v>=0;){for(i>=l?d=e.data[v]>>i-l&u:(d=(e.data[v]&(1<<i+1)-1)<<l-i,v>0&&(d|=e.data[v-1]>>this.DB+i-l)),c=r;0==(1&d);)d>>=1,--c;if((i-=c)<0&&(i+=this.DB,--v),b)a[d].copyTo(o),b=!1;else{for(;c>1;)n.sqrTo(o,w),n.sqrTo(w,o),c-=2;c>0?n.sqrTo(o,w):(f=o,o=w,w=f),n.mulTo(w,a[d],o)}for(;v>=0&&0==(e.data[v]&1<<i);)n.sqrTo(o,w),f=o,o=w,w=f,--i<0&&(i=this.DB-1,--v)}return n.revert(o)},o.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var r=e.clone(),n=this.clone(),i=p(1),s=p(0),a=p(0),c=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(c,s)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(s,c))}return 0!=n.compareTo(o.ONE)?o.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},o.prototype.pow=function(e){return this.exp(e,new A)},o.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},o.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=C[C.length-1]){for(t=0;t<C.length;++t)if(r.data[0]==C[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<C.length;){for(var n=C[t],i=t+1;i<C.length&&n<R;)n*=C[i++];for(n=r.modInt(n);t<i;)if(n%C[t++]==0)return!1}return r.millerRabin(e)}},8432:(e,t,r)=>{var n=r(1102);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},1920:(e,t,r)=>{var n=r(1102);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.3.101.112","EdDSA25519"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("1.3.14.3.2.29","sha1WithRSASignature"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("2.16.840.1.101.3.4.2.4","sha224"),o("2.16.840.1.101.3.4.2.5","sha512-224"),o("2.16.840.1.101.3.4.2.6","sha512-256"),o("1.2.840.113549.2.2","md2"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.4","surname"),o("2.5.4.5","serialNumber"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.9","streetAddress"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.5.4.12","title"),o("2.5.4.13","description"),o("2.5.4.15","businessCategory"),o("2.5.4.17","postalCode"),o("2.5.4.42","givenName"),o("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),o("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),o("2.16.840.1.113730.1.1","nsCertType"),o("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},8144:(e,t,r)=>{var n=r(1102);if(r(7510),r(5120),r(4221),r(8432),r(1920),r(548),r(9803),r(3918),r(4466),r(1903),r(5593),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},u={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=s.oids[o.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return f(t)}function f(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,l,u=n.random.getBytesSync(r.saltSize),h=r.count,d=o.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,g,y;switch(r.algorithm){case"aes128":i=16,p=16,g=a["aes128-CBC"],y=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,g=a["aes192-CBC"],y=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,g=a["aes256-CBC"],y=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,g=a.desCBC,y=n.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(m),b=n.pkcs5.pbkdf2(t,u,h,i,v),w=n.random.getBytesSync(p);(S=y(b)).start(w),S.update(o.toDer(e)),S.finish(),l=S.output.getBytes();var E=function(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]));return a}(u,d,i,m);c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,w)])])])}else{var _;if("3des"!==r.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_;i=24;var S,A=new n.util.ByteBuffer(u);b=s.pbe.generatePkcs12Key(t,A,1,h,i),w=s.pbe.generatePkcs12Key(t,A,2,h,i);(S=n.des.createEncryptionCipher(b)).start(w),S.update(o.toDer(e)),S.finish(),l=S.output.getBytes(),c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,u),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,d.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[c,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,l)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,c,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var u=o.derToOid(i.encryptionOid),h=s.pbe.getCipher(u,i.encryptionParams,t),d=n.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(r=o.fromDer(h.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,c,l,u;switch(r.algorithm){case"aes128":a="AES-128-CBC",l=16,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var d=u(n.pbe.opensslDeriveBytes(t,c.substr(0,8),l));d.start(c),d.update(o.toDer(s.privateKeyToAsn1(e))),d.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(f)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(l=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=l,l;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var l;throw(l=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,l}var u=n.util.hexToBytes(i.dekInfo.parameters),h=c(n.pbe.opensslDeriveBytes(t,u.substr(0,8),a));if(h.start(u),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,c;if("undefined"===typeof s||null===s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var l=s.digestLength,u=s.blockLength,h=new n.util.ByteBuffer,d=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c<e.length;c++)d.putInt16(e.charCodeAt(c));d.putInt16(0)}var f=d.length(),p=t.length(),g=new n.util.ByteBuffer;g.fillWithByte(r,u);var y=u*Math.ceil(p/u),m=new n.util.ByteBuffer;for(c=0;c<y;c++)m.putByte(t.at(c%p));var v=u*Math.ceil(f/u),b=new n.util.ByteBuffer;for(c=0;c<v;c++)b.putByte(d.at(c%f));var w=m;w.putBuffer(b);for(var E=Math.ceil(o/l),_=1;_<=E;_++){var S=new n.util.ByteBuffer;S.putBytes(g.bytes()),S.putBytes(w.bytes());for(var A=0;A<i;A++)s.start(),s.update(S.getBytes()),S=s.digest();var k=new n.util.ByteBuffer;for(c=0;c<u;c++)k.putByte(S.at(c%l));var I=Math.ceil(p/u)+Math.ceil(f/u),C=new n.util.ByteBuffer;for(a=0;a<I;a++){var R=new n.util.ByteBuffer(w.getBytes(u)),T=511;for(c=k.length()-1;c>=0;c--)T>>=8,T+=k.at(c)+R.at(c),R.setAt(c,255&T);C.putBuffer(R)}w=C,h.putBuffer(S)}return h.truncate(h.length()-o),h},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!o.validate(t,l,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=o.derToOid(a.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(a.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var u,h,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":u=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,h=n.des.createDecryptionCipher;break;case"desCBC":u=8,h=n.des.createDecryptionCipher}var g=d(a.prfOid),y=n.pkcs5.pbkdf2(r,f,p,u,g),m=a.encIv,v=h(y);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,u,i,a))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,g;var c,l,h,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,l=8,h=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,l=8,h=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,g}var y=d(i.prfOid),m=s.pbe.generatePkcs12Key(r,f,1,p,c,y);return y.start(),h(m,s.pbe.generatePkcs12Key(r,f,2,p,l,y))},s.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var o=[h(i,e+t)],s=16,a=1;s<r;++a,s+=16)o.push(h(i,o[a-1]+e+t));return o.join("").substr(0,r)}},548:(e,t,r)=>{var n=r(1102);r(5826),r(8432),r(5593);var i,o=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(310)),e.exports=n.pbkdf2=o.pbkdf2=function(e,t,r,o,s,a){if("function"===typeof s&&(a=s,s=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===s||"object"!==typeof s)&&(i.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!==typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===i.pbkdf2Sync.length?i.pbkdf2(e,t,r,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,r,o,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,r,o).toString("binary"):i.pbkdf2Sync(e,t,r,o,s).toString("binary");if("undefined"!==typeof s&&null!==s||(s="sha1"),"string"===typeof s){if(!(s in n.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=n.md[s].create()}var c=s.digestLength;if(o>4294967295*c){var l=new Error("Derived key is too long.");if(a)return a(l);throw l}var u=Math.ceil(o/c),h=o-(u-1)*c,d=n.hmac.create();d.start(s,e);var f,p,g,y="";if(!a){for(var m=1;m<=u;++m){d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=g=d.digest().getBytes();for(var v=2;v<=r;++v)d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),g=p;y+=m<u?f:f.substr(0,h)}return y}m=1;function b(){if(m>u)return a(null,y);d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=g=d.digest().getBytes(),v=2,w()}function w(){if(v<=r)return d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),g=p,++v,n.util.setImmediate(w);y+=m<u?f:f.substr(0,h),++m,b()}b()}},9803:(e,t,r)=>{var n=r(1102);r(5593);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var o=0,s=-1;for(i=0;i<t.length;++i,++o)if(o>65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=o(r)),e.headers)for(var s=0;s<e.headers.length;++s)i+=o(e.headers[s]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,o=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var c=t[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var l={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(l),t[2]){for(var u=t[2].split(a),h=0;t&&h<u.length;){for(var d=u[h].replace(/\s+$/,""),f=h+1;f<u.length;++f){var p=u[f];if(!/\s/.test(p[0]))break;d+=p,h=f}if(t=d.match(o)){for(var g={name:t[1],values:[]},y=t[2].split(","),m=0;m<y.length;++m)g.values.push(s(y[m]));if(l.procType)if(l.contentDomain||"Content-Domain"!==g.name)if(l.dekInfo||"DEK-Info"!==g.name)l.headers.push(g);else{if(0===g.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');l.dekInfo={algorithm:y[0],parameters:y[1]||null}}else l.contentDomain=y[0]||"";else{if("Proc-Type"!==g.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==g.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');l.procType={version:y[0],type:y[1]}}}++h}if("ENCRYPTED"===l.procType&&!l.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},9427:(e,t,r)=>{var n=r(1102);r(5593),r(3918),r(5704);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s<o;++s){var a=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,s,a,c;"string"===typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var l=Math.ceil(e.n.bitLength()/8),u=l-2*a.digestLength-2;if(t.length>u)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=t.length,y.maxLength=u,y;i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",f=u-t.length,p=0;p<f;p++)d+="\0";var g=h.getBytes()+d+"\x01"+t;if(s){if(s.length!==a.digestLength){var y;throw(y=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,y.digestLength=a.digestLength,y}}else s=n.random.getBytes(a.digestLength);var m=o(s,l-a.digestLength-1,c),v=n.util.xorBytes(g,m,g.length),b=o(v,a.digestLength,c);return"\0"+n.util.xorBytes(s,b,s.length)+v},i.decode_rsa_oaep=function(e,t,r){var i,s,a;"string"===typeof r?(i=r,s=arguments[3]||void 0):r&&(i=r.label||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var c=Math.ceil(e.n.bitLength()/8);if(t.length!==c)throw(m=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,m.expectedLength=c,m;if(void 0===s?s=n.md.sha1.create():s.start(),a||(a=s),c<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var l=s.digest().getBytes(),u=t.charAt(0),h=t.substring(1,s.digestLength+1),d=t.substring(1+s.digestLength),f=o(d,s.digestLength,a),p=o(n.util.xorBytes(h,f,h.length),c-s.digestLength-1,a),g=n.util.xorBytes(d,p,d.length),y=g.substring(0,s.digestLength),m="\0"!==u,v=0;v<s.digestLength;++v)m|=l.charAt(v)!==y.charAt(v);for(var b=1,w=s.digestLength,E=s.digestLength;E<g.length;E++){var _=g.charCodeAt(E);m|=_&(b?65534:0),w+=b&=1&_^1}if(m||1!==g.charCodeAt(w))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(w+1)}},4650:(e,t,r)=>{var n=r(1102);r(5593),r(6766),r(3918),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof o&&(o={name:o}),o.options=o.options||{};var s=t.prng||n.random,c={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===o.name)return function(e,t,i,o){if("workers"in i)return function(e,t,i,o){if("undefined"===typeof Worker)return a(e,t,i,o);var s=l(e,t),c=i.workers,u=i.workLoad||100,h=30*u/8,d=i.workerScript||"forge/prime.worker.js";if(-1===c)return n.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],i=0;i<c;++i)n[i]=new Worker(d);for(i=0;i<c;++i)n[i].addEventListener("message",f);var a=!1;function f(i){if(!a){0;var c=i.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return a=!0,o(null,new r(c.prime,16))}s.bitLength()>e&&(s=l(e,t));var f=s.toString(16);i.target.postMessage({hex:f,workLoad:u}),s.dAddOffset(h,0)}}}f()}(e,t,i,o);return a(e,t,i,o)}(e,c,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(e,t,r,n){var i=l(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),c(i,e,t,0,o,s,n)}function c(e,t,r,o,s,a,u){var h=+new Date;do{if(e.bitLength()>t&&(e=l(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-h<a);n.util.setImmediate((function(){c(e,t,r,o,s,a,u)}))}function l(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),s,n),n.dAddOffset(31-n.mod(o).byteValue(),0),n}}()},1896:(e,t,r)=>{var n=r(1102);r(5593);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(i=r(310)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,o=new Array(32),s=0;s<32;++s)o[s]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r===0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function l(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var o=n.util.createBuffer();if(t)for(;o.length()<e;){var s=Math.max(1,Math.min(e-o.length(),65536)/4),a=new Uint32Array(Math.floor(s));try{t(a);for(var c=0;c<a.length;++c)o.putInt32(a[c])}catch(f){if(!("undefined"!==typeof QuotaExceededError&&f instanceof QuotaExceededError))throw f}}if(o.length()<e)for(var l,u,h,d=Math.floor(65536*Math.random());o.length()<e;){u=16807*(65535&d),u+=(32767&(l=16807*(d>>16)))<<16,d=4294967295&(u=(2147483647&(u+=l>>15))+(u>>31));for(c=0;c<3;++c)h=d>>>(c<<3),h^=Math.floor(256*Math.random()),o.putByte(255&h)}return o.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,a=t.plugin.formatSeed,l=n.util.createBuffer();t.key=null,function u(h){if(h)return r(h);if(l.length()>=e)return r(null,l.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(u)}));var d=i(t.key,t.seed);t.generated+=d.length,l.putBytes(d),t.key=s(i(t.key,o(t.seed))),t.seed=a(i(t.key,t.seed)),n.util.setImmediate(u)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var l=r(t.key,t.seed);t.generated+=l.length,c.putBytes(l),t.key=o(r(t.key,i(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(r){t(r)}},t.seedFileSync=l),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},3918:(e,t,r)=>{var n=r(1102);r(7510),r(2302),r(1896),r(5593),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),c=null,l=n.util.globalScope,u=l.crypto||l.msCrypto;if(u&&u.getRandomValues&&(c=function(e){return u.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"===typeof window||window.document,a.collectInt(+new Date,32),"undefined"!==typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(f){}a.collect(h),h=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},4466:(e,t,r)=>{var n=r(1102);r(5593);var i=[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],o=[1,2,3,5],s=function(e,t){return e<<t&65535|(65535&e)>>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"===typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,o=e,s=e.length(),a=t,c=Math.ceil(a/8),l=255>>(7&a);for(r=s;r<128;r++)o.putByte(i[o.at(r-1)+o.at(r-s)&255]);for(o.setAt(128-c,i[o.at(128-c)&l]),r=127-c;r>=0;r--)o.setAt(r,i[o.at(r+1)^o.at(r+c)]);return o};var c=function(e,t,r){var i,c,l,u,h=!1,d=null,f=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),l=0;l<64;l++)g.push(e.getInt16Le());r?(i=function(e){for(l=0;l<4;l++)e[l]+=g[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),e[l]=s(e[l],o[l]),u++},c=function(e){for(l=0;l<4;l++)e[l]+=g[63&e[(l+3)%4]]}):(i=function(e){for(l=3;l>=0;l--)e[l]=a(e[l],o[l]),e[l]-=g[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),u--},c=function(e){for(l=3;l>=0;l--)e[l]-=g[63&e[(l+3)%4]]});var y=function(e){var t=[];for(l=0;l<4;l++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}u=r?0:63;for(var i=0;i<e.length;i++)for(var o=0;o<e[i][0];o++)e[i][1](t);for(l=0;l<4;l++)null!==p&&(r?p.putInt16Le(t[l]):t[l]^=p.getInt16Le()),f.putInt16Le(t[l])},m=null;return m={start:function(e,t){e&&"string"===typeof e&&(e=n.util.createBuffer(e)),h=!1,d=n.util.createBuffer(),f=t||new n.util.createBuffer,p=e,m.output=f},update:function(e){for(h||d.putBuffer(e);d.length()>=8;)y([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===d.length()))if(e)t=e(8,f,!r);else{var i=f.length(),o=f.at(i-1);o>i?t=!1:f.truncate(o)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},1903:(e,t,r)=>{var n=r(1102);if(r(5120),r(6766),r(1920),r(9427),r(4650),r(3918),r(5593),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.util.isNodejs?r(310):null,s=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,l=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},g=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),o=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);o.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),o.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var a=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),s.toDer(i).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=0||!o.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var c=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(o.modInverse(t.n)).mod(t.n)};function m(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a,c=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var l=0;l<c;++l)i.putByte(a)}else for(;c>0;){var u=0,h=n.random.getBytes(c);for(l=0;l<c;++l)0===(a=h.charCodeAt(l))?++u:i.putByte(a);c=u}return i.putByte(0),i.putBytes(e),i}function v(e,t,r,i){var o=Math.ceil(t.n.bitLength()/8),s=n.util.createBuffer(e),a=s.getByte(),c=s.getByte();if(0!==a||r&&0!==c&&1!==c||!r&&2!=c||r&&0===c&&"undefined"===typeof i)throw new Error("Encryption block is invalid.");var l=0;if(0===c){l=o-3-i;for(var u=0;u<l;++u)if(0!==s.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(l=0;s.length()>1;){if(255!==s.getByte()){--s.read;break}++l}else if(2===c)for(l=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++l}if(0!==s.getByte()||l!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0===(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128===(128&r.charCodeAt(1)))?r.substr(1):r}function w(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function E(e){return n.util.isNodejs&&"function"===typeof o[e]}function _(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.crypto&&"object"===typeof a.globalScope.crypto.subtle&&"function"===typeof a.globalScope.crypto.subtle[e]}function S(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.msCrypto&&"object"===typeof a.globalScope.msCrypto.subtle&&"function"===typeof a.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}c.rsa.encrypt=function(e,t,r){var o,s=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(s=2===r,o=m(e,t,r)):(o=n.util.createBuffer()).putBytes(e);for(var c=new i(o.toHex(),16),l=y(c,t,s).toString(16),u=n.util.createBuffer(),h=a-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),u.getBytes()},c.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=y(c,t,r).toString(16),u=n.util.createBuffer(),h=s-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),!1!==o?v(u.getBytes(),t,r):u.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(o={algorithm:c,state:0,bits:e,rng:a,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,o=0,s=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||u<t);){if(0===e.state){var h=null===e.p?e.pBits:e.qBits,d=h-1;0===e.pqState?(e.num=new i(h,e.rng),e.num.testBit(d)||e.num.bitwiseTo(i.ONE.shiftLeft(d),s,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>h?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(l[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}u+=(n=+new Date)-a,a=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,l){if(1===arguments.length?"object"===typeof e?(r=e,e=void 0):"function"===typeof e&&(l=e,e=void 0):2===arguments.length?"number"===typeof e?"function"===typeof t?(l=t,t=void 0):"number"!==typeof t&&(r=t,t=void 0):(r=e,l=t,e=void 0,t=void 0):3===arguments.length&&("number"===typeof t?"function"===typeof r&&(l=r,r=void 0):(l=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(l){if(E("generateKeyPair"))return o.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return l(e);l(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(_("generateKey")&&_("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){l(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));l(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(S("generateKey")&&S("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));l(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){l(e)}},void(u.onerror=function(e){l(e)})}}else if(E("generateKeyPairSync")){var h=o.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(h.privateKey),publicKey:c.publicKeyFromPem(h.publicKey)}}var d=c.rsa.createKeyPairGenerationState(e,t,r);if(!l)return c.rsa.stepKeyPairGenerationState(d,0),d.keys;!function(e,t,r){"function"===typeof t&&(r=t,t={});t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(o.prng=t.prng);function s(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?l(t,e.q):void a(e.qBits,l))}))}function a(e,t){n.prime.generateProbablePrime(e,o,t)}function l(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,l);var u=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}s()}(d,r,l)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return m(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"===typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return c.rsa.encrypt(o,r,!0)},verify:function(e,t,i,o){"string"===typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===o&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=v(t,r,!0);var i=s.fromDer(t,{parseAllBytes:o._parseAllDigestBytes}),a={},c=[];if(!s.validate(i,p,a,c))throw(l=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=c,l;var l,u=s.derToOid(a.algorithmIdentifier);if(u!==n.oids.md2&&u!==n.oids.md5&&u!==n.oids.sha1&&u!==n.oids.sha224&&u!==n.oids.sha256&&u!==n.oids.sha384&&u!==n.oids.sha512&&u!==n.oids["sha512-224"]&&u!==n.oids["sha512-256"])throw(l=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,l;if((u===n.oids.md2||u===n.oids.md5)&&!("parameters"in a))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===a.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=v(t,r,!0))}});var a=c.rsa.decrypt(t,r,!0,!1);return i.verify(e,a,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,o,s,a,l){var u={n:e,e:t,d:r,p:i,q:o,dP:s,dQ:a,qInv:l,decrypt:function(e,t,r){"string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,u,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,u,!1)},sign:function(e,t){var r=!1;"string"===typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:g},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,u.n.bitLength());return c.rsa.encrypt(n,u,r)}};return u},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,o,a,l,d,f,p,g={},y=[];if(s.validate(e,u,g,y)&&(e=s.fromDer(n.util.createBuffer(g.privateKey))),g={},y=[],!s.validate(e,h,g,y)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=y,m}return t=n.util.createBuffer(g.privateKeyModulus).toHex(),r=n.util.createBuffer(g.privateKeyPublicExponent).toHex(),o=n.util.createBuffer(g.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(g.privateKeyPrime1).toHex(),l=n.util.createBuffer(g.privateKeyPrime2).toHex(),d=n.util.createBuffer(g.privateKeyExponent1).toHex(),f=n.util.createBuffer(g.privateKeyExponent2).toHex(),p=n.util.createBuffer(g.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(r,16),new i(o,16),new i(a,16),new i(l,16),new i(d,16),new i(f,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,f,t,r)){var o,a=s.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=a,o;e=t.rsaPublicKey}if(r=[],!s.validate(e,d,t,r))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,o;var l=n.util.createBuffer(t.publicKeyModulus).toHex(),u=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(l,16),new i(u,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e))])}},5704:(e,t,r)=>{var n=r(1102);r(8432),r(5593);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var c=o.length;i.messageLength+=c,c=[c/4294967296>>>0,c>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=c[1],c[1]=c[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(o),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var c,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)u+=(c=8*i.fullMessageLength[h+1])/4294967296>>>0,s.putInt32(u>>>0),u=c>>>0;s.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,s);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var o=null,s=!1;function a(e,t,r){for(var n,i,o,s,a,c,l,u=r.length();u>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o&s|a&(o^s))+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^s^a)+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,u-=64}}},2302:(e,t,r)=>{var n=r(1102);r(8432),r(5593);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),a=[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],s=!0);var e=null,t=n.util.createBuffer(),r=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 r=i.messageLengthSize/4,o=0;o<r;++o)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var a=o.length;i.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)u+=(a=8*i.fullMessageLength[h+1])/4294967296>>>0,s.putInt32(u>>>0),u=a>>>0;s.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(d,r,s);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},i};var o=null,s=!1,a=null;function c(e,t,r){for(var n,i,o,s,c,l,u,h,d,f,p,g,y,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(l=e.h0,u=e.h1,h=e.h2,d=e.h3,f=e.h4,p=e.h5,g=e.h6,y=e.h7,c=0;c<64;++c)o=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&u|h&(l^u),n=y+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(g^f&(p^g))+a[c]+t[c],y=g,g=p,p=f,f=d+n>>>0,d=h,h=u,u=l,l=n+(i=o+s)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+h|0,e.h3=e.h3+d|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+g|0,e.h7=e.h7+y|0,m-=64}}},6975:(e,t,r)=>{var n=r(1102);r(8432),r(5593);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var o=n.sha384=n.sha512.sha384=n.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=o,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),c=[[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]],(l={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),"undefined"===typeof e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,i=n.util.createBuffer(),o=new Array(80),h=0;h<80;++h)o[h]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,o=0;o<e;++o)f.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(o=0;o<t.length;++o)r[o]=t[o].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var s=e.length;f.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=s[1],s[1]=s[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),u(r,o,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(s.substr(0,f.blockLength-c));for(var l=8*f.fullMessageLength[0],h=0;h<f.fullMessageLength.length-1;++h)l+=(a=8*f.fullMessageLength[h+1])/4294967296>>>0,t.putInt32(l>>>0),l=a>>>0;t.putInt32(l);var d=new Array(r.length);for(h=0;h<r.length;++h)d[h]=r[h].slice(0);u(d,o,t);var p,g=n.util.createBuffer();p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4;for(h=0;h<p;++h)g.putInt32(d[h][0]),h===p-1&&"SHA-512/224"===e||g.putInt32(d[h][1]);return g},f};var s=null,a=!1,c=null,l=null;function u(e,t,r){for(var n,i,o,s,a,l,u,h,d,f,p,g,y,m,v,b,w,E,_,S,A,k,I,C,R,T,x,P,D,N,O,L,B,M=r.length();M>=128;){for(x=0;x<16;++x)t[x][0]=r.getInt32()>>>0,t[x][1]=r.getInt32()>>>0;for(;x<80;++x)n=(((P=(N=t[x-2])[0])>>>19|(D=N[1])<<13)^(D>>>29|P<<3)^P>>>6)>>>0,i=((P<<13|D>>>19)^(D<<3|P>>>29)^(P<<26|D>>>6))>>>0,o=(((P=(L=t[x-15])[0])>>>1|(D=L[1])<<31)^(P>>>8|D<<24)^P>>>7)>>>0,s=((P<<31|D>>>1)^(P<<24|D>>>8)^(P<<25|D>>>7))>>>0,O=t[x-7],B=t[x-16],D=i+O[1]+s+B[1],t[x][0]=n+O[0]+o+B[0]+(D/4294967296>>>0)>>>0,t[x][1]=D>>>0;for(p=e[0][0],g=e[0][1],y=e[1][0],m=e[1][1],v=e[2][0],b=e[2][1],w=e[3][0],E=e[3][1],_=e[4][0],S=e[4][1],A=e[5][0],k=e[5][1],I=e[6][0],C=e[6][1],R=e[7][0],T=e[7][1],x=0;x<80;++x)u=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,h=(I^_&(A^I))>>>0,a=((p>>>28|g<<4)^(g>>>2|p<<30)^(g>>>7|p<<25))>>>0,l=((p<<4|g>>>28)^(g<<30|p>>>2)^(g<<25|p>>>7))>>>0,d=(p&y|v&(p^y))>>>0,f=(g&m|b&(g^m))>>>0,D=T+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((C^S&(k^C))>>>0)+c[x][1]+t[x][1],n=R+u+h+c[x][0]+t[x][0]+(D/4294967296>>>0)>>>0,i=D>>>0,o=a+d+((D=l+f)/4294967296>>>0)>>>0,s=D>>>0,R=I,T=C,I=A,C=k,A=_,k=S,_=w+n+((D=E+i)/4294967296>>>0)>>>0,S=D>>>0,w=v,E=b,v=y,b=m,y=p,m=g,p=n+o+((D=i+s)/4294967296>>>0)>>>0,g=D>>>0;D=e[0][1]+g,e[0][0]=e[0][0]+p+(D/4294967296>>>0)>>>0,e[0][1]=D>>>0,D=e[1][1]+m,e[1][0]=e[1][0]+y+(D/4294967296>>>0)>>>0,e[1][1]=D>>>0,D=e[2][1]+b,e[2][0]=e[2][0]+v+(D/4294967296>>>0)>>>0,e[2][1]=D>>>0,D=e[3][1]+E,e[3][0]=e[3][0]+w+(D/4294967296>>>0)>>>0,e[3][1]=D>>>0,D=e[4][1]+S,e[4][0]=e[4][0]+_+(D/4294967296>>>0)>>>0,e[4][1]=D>>>0,D=e[5][1]+k,e[5][0]=e[5][0]+A+(D/4294967296>>>0)>>>0,e[5][1]=D>>>0,D=e[6][1]+C,e[6][0]=e[6][0]+I+(D/4294967296>>>0)>>>0,e[6][1]=D>>>0,D=e[7][1]+T,e[7][0]=e[7][0]+R+(D/4294967296>>>0)>>>0,e[7][1]=D>>>0,M-=128}}},5593:(e,t,r)=>{var n=r(1102),i=r(2912),o=e.exports=n.util=n.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function a(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(o.isArrayBuffer(e)||o.isArrayBufferView(e))if("undefined"!==typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof a||"object"===typeof e&&"string"===typeof e.data&&"number"===typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!==typeof process&&process.nextTick&&!process.browser)return o.nextTick=process.nextTick,void("function"===typeof setImmediate?o.setImmediate=setImmediate:o.setImmediate=o.nextTick);if("function"===typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(o.nextTick=function(e){return setImmediate(e)});if(o.setImmediate=function(e){setTimeout(e,0)},"undefined"!==typeof window&&"function"===typeof window.postMessage){var e="forge.setImmediate",t=[];o.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!==typeof MutationObserver){var r=Date.now(),n=!0,i=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(i,{attributes:!0});var s=o.setImmediate;o.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&i.setAttribute("a",n=!n))}}o.nextTick=o.setImmediate}(),o.isNodejs="undefined"!==typeof process&&process.versions&&process.versions.node,o.globalScope=o.isNodejs?r.g:"undefined"===typeof self?window:self,o.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},o.isArrayBufferView=function(e){return e&&o.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},o.ByteBuffer=a,o.ByteStringBuffer=a;o.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},o.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},o.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},o.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(o.encodeUtf8(e))},o.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},o.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},o.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},o.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},o.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},o.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},o.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},o.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},o.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},o.ByteStringBuffer.prototype.getInt32=function(){var e=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,e},o.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},o.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},o.ByteStringBuffer.prototype.getInt32Le=function(){var e=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,e},o.ByteStringBuffer.prototype.getInt=function(e){s(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},o.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},o.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},o.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},o.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},o.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},o.ByteStringBuffer.prototype.copy=function(){var e=o.createBuffer(this.data);return e.read=this.read,e},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},o.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},o.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},o.ByteStringBuffer.prototype.toString=function(){return o.decodeUtf8(this.bytes())},o.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=o.isArrayBuffer(e),n=o.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},o.DataBuffer.prototype.length=function(){return this.write-this.read},o.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},o.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},o.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},o.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},o.DataBuffer.prototype.putBytes=function(e,t){if(o.isArrayBufferView(e)){var r=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(o.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof o.DataBuffer||"object"===typeof e&&"number"===typeof e.read&&"number"===typeof e.write&&o.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof o.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"===typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=o.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=o.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},o.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},o.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},o.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},o.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},o.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},o.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},o.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},o.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},o.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},o.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},o.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},o.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},o.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},o.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},o.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},o.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},o.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},o.DataBuffer.prototype.getInt=function(e){s(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},o.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},o.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},o.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},o.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},o.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this)},o.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},o.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},o.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},o.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return o.binary.raw.encode(t);if("hex"===e)return o.binary.hex.encode(t);if("base64"===e)return o.binary.base64.encode(t);if("utf8"===e)return o.text.utf8.decode(t);if("utf16"===e)return o.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},o.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=o.encodeUtf8(e)),new o.ByteBuffer(e)},o.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},o.xorBytes=function(e,t,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o},o.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},o.bytesToHex=function(e){return o.createBuffer(e).toHex()},o.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[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],u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(e,t){for(var r,n,i,o="",s="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),o+=c.charAt(r>>2),o+=c.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=c.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":c.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},o.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,o="",s=0;s<e.length;)t=l[e.charCodeAt(s++)-43],r=l[e.charCodeAt(s++)-43],n=l[e.charCodeAt(s++)-43],i=l[e.charCodeAt(s++)-43],o+=String.fromCharCode(t<<2|r>>4),64!==n&&(o+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(o+=String.fromCharCode((3&n)<<6|i)));return o},o.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},o.decodeUtf8=function(e){return decodeURIComponent(escape(e))},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:i.encode,decode:i.decode}},o.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},o.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,o=r=r||0;for(1&e.length&&(i=1,n[o++]=parseInt(e[0],16));i<e.length;i+=2)n[o++]=parseInt(e.substr(i,2),16);return t?o-r:n},o.binary.base64.encode=function(e,t){for(var r,n,i,o="",s="",a=0;a<e.byteLength;)r=e[a++],n=e[a++],i=e[a++],o+=c.charAt(r>>2),o+=c.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=c.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":c.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},o.binary.base64.decode=function(e,t,r){var n,i,o,s,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)n=l[e.charCodeAt(c++)-43],i=l[e.charCodeAt(c++)-43],o=l[e.charCodeAt(c++)-43],s=l[e.charCodeAt(c++)-43],a[u++]=n<<2|i>>4,64!==o&&(a[u++]=(15&i)<<4|o>>2,64!==s&&(a[u++]=(3&o)<<6|s));return t?u-r:a.subarray(0,u)},o.binary.base58.encode=function(e,t){return o.binary.baseN.encode(e,u,t)},o.binary.base58.decode=function(e,t){return o.binary.baseN.decode(e,u,t)},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(e,t,r){e=o.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},o.text.utf8.decode=function(e){return o.decodeUtf8(String.fromCharCode.apply(null,e))},o.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),o=r=r||0,s=r,a=0;a<e.length;++a)i[s++]=e.charCodeAt(a),o+=2;return t?o-r:n},o.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},o.deflate=function(e,t,r){if(t=o.decode64(e.deflate(o.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},o.inflate=function(e,t,r){var n=e.inflate(o.encode64(t)).rval;return null===n?null:o.decode64(n)};var h=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=o.encode64(JSON.stringify(r)),n=e.setItem(t,r)),"undefined"!==typeof n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},d=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(o.decode64(r))),r},f=function(e,t,r,n){var i=d(e,t);null===i&&(i={}),i[r]=n,h(e,t,i)},p=function(e,t,r){var n=d(e,t);return null!==n&&(n=r in n?n[r]:null),n},g=function(e,t,r){var n=d(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),h(e,t,n)}},y=function(e,t){h(e,t,null)},m=function(e,t,r){var n,i=null;"undefined"===typeof r&&(r=["web","flash"]);var o=!1,s=null;for(var a in r){n=r[a];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),o="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),o=!0)}catch(c){s=c}if(o)break}if(!o)throw s;return i};o.setItem=function(e,t,r,n,i){m(f,arguments,i)},o.getItem=function(e,t,r,n){return m(p,arguments,n)},o.removeItem=function(e,t,r,n){m(g,arguments,n)},o.clearItems=function(e,t,r){m(y,arguments,r)},o.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},o.format=function(e){for(var t,r,n=/%./g,i=0,o=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&o.push(r),s=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[1+i++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},o.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+a:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-l).toFixed(o).slice(2):"")},o.formatSize=function(e){return e=e>=1073741824?o.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?o.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?o.formatNumber(e/1024,0)+" KiB":o.formatNumber(e,0)+" bytes"},o.bytesFromIP=function(e){return-1!==e.indexOf(".")?o.bytesFromIPv4(e):-1!==e.indexOf(":")?o.bytesFromIPv6(e):null},o.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=o.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},o.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),n=o.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var s=o.hexToBytes(e[i]);s.length<2&&n.putByte(0),n.putBytes(s)}else n.fillWithByte(0,r),r=0;return n.getBytes()},o.bytesToIP=function(e){return 4===e.length?o.bytesToIPv4(e):16===e.length?o.bytesToIPv6(e):null},o.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},o.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var s=o.bytesToHex(e[i]+e[i+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var a=r[r.length-1],c=t.length;a&&c===a.end+1?(a.end=c,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var l=r[n];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},o.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in o&&!e.update)return t(null,o.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,t(null,o.cores);if("undefined"===typeof Worker)return o.cores=1,t(null,o.cores);if("undefined"===typeof Blob)return o.cores=2,t(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(n,i,s){if(0===i){var a=Math.floor(n.reduce((function(e,t){return e+t}),0)/n.length);return o.cores=Math.max(1,a),URL.revokeObjectURL(r),t(null,o.cores)}!function(e,t){for(var n=[],i=[],o=0;o<e;++o){var s=new Worker(r);s.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var o=0;o<e;++o)n[o].terminate();t(null,i)}})),n.push(s)}for(o=0;o<e;++o)n[o].postMessage(o)}(s,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],o=r[n]=[],s=0;s<e;++s)if(n!==s){var a=t[s];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&o.push(s)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(n,i-1,s)}))}([],5,16)}},9207:(e,t,r)=>{"use strict";e.exports=r(9630)},4833:e=>{"use strict";e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("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}}}}),n("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}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},8078:(e,t,r)=>{"use strict";var n=t,i=r(6361),o=r(7984);function s(e,t,r,n){var o=!1;if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",n);for(var s=t.resolvedType.values,a=Object.keys(s),c=0;c<a.length;++c)s[a[c]]!==t.typeDefault||o||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),t.repeated||e("break"),o=!0),e("case%j:",a[c])("case %i:",s[a[c]])("m%s=%j",n,s[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,r,n);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,l)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,r,n,n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var o=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("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",n,n,n,n,o?"true":"",n);break;case"bytes":e("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",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n<t.length;++n){var a=t[n].resolve(),c=o.safeProp(a.name);a.map?(r("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),s(r,a,n,c+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),s(r,a,n,c+"[i]")("}")("}")):(a.resolvedType instanceof i||r("if(d%s!=null){",c),s(r,a,n,c),a.resolvedType instanceof i||r("}"))}return r("return m")},n.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);if(!t.length)return o.codegen()("return {}");for(var r=o.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],s=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?n:t[l].map?s:c).push(t[l]);if(n.length){for(r("if(o.arrays||o.defaults){"),l=0;l<n.length;++l)r("d%s=[]",o.safeProp(n[l].name));r("}")}if(s.length){for(r("if(o.objects||o.defaults){"),l=0;l<s.length;++l)r("d%s={}",o.safeProp(s[l].name));r("}")}if(c.length){for(r("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],h=o.safeProp(u.name);if(u.resolvedType instanceof i)r("d%s=o.enums===String?%j:%j",h,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",h)("}else")("d%s=o.longs===String?%j:%i",h,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var d="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",h,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",h,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",h,h)("}")}else r("d%s=%j",h,u.typeDefault)}r("}")}var f=!1;for(l=0;l<t.length;++l){u=t[l];var p=e._fieldsArray.indexOf(u);h=o.safeProp(u.name);u.map?(f||(f=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(r,u,p,h+"[ks2[j]]")("}")):u.repeated?(r("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(r,u,p,h+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",h,u.name),a(r,u,p,h),u.partOf&&r("if(o.oneofs)")("d%s=%j",o.safeProp(u.partOf.name),u.name)),r("}")}return r("return d")}},2978:(e,t,r)=>{"use strict";e.exports=function(e){var t=o.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var a=e._fieldsArray[r].resolve(),c=a.resolvedType instanceof n?"int32":a.type,l="m"+o.safeProp(a.name);t("case %i: {",a.id),a.map?(t("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==i.defaults[a.keyType]?t("k=%j",i.defaults[a.keyType]):t("k=null"),void 0!==i.defaults[c]?t("value=%j",i.defaults[c]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===i.basic[c]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==i.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===i.basic[c]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,r):t("%s.push(r.%s())",l,c)):void 0===i.basic[c]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,r):t("%s=r.%s()",l,c),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var u=e._fieldsArray[r];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",s(u))}return t("return m")};var n=r(6361),i=r(3683),o=r(7984);function s(e){return"missing required '"+e.name+"'"}},6478:(e,t,r)=>{"use strict";e.exports=function(e){for(var t,r=o.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(o.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),u=e._fieldsArray.indexOf(l),h=l.resolvedType instanceof n?"int32":l.type,d=i.basic[h];t="m"+o.safeProp(l.name),l.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|i.mapKey[l.keyType],l.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),r("}")("}")):l.repeated?(r("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==i.packed[h]?r("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?s(r,l,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,h,t)),r("}")):(l.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?s(r,l,u,t):r("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,h,t))}return r("return w")};var n=r(6361),i=r(3683),o=r(7984);function s(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},6361:(e,t,r)=>{"use strict";e.exports=s;var n=r(243);((s.prototype=Object.create(n.prototype)).constructor=s).className="Enum";var i=r(3221),o=r(7984);function s(e,t,r,i,o,s){if(n.call(this,e,r),t&&"object"!==typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=o||{},this.valuesOptions=s,this.reserved=void 0,t)for(var a=Object.keys(t),c=0;c<a.length;++c)"number"===typeof t[a[c]]&&(this.valuesById[this.values[a[c]]=t[a[c]]]=a[c])}s.fromJSON=function(e,t){var r=new s(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},s.prototype.add=function(e,t,r,n){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return n&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=n||null),this.comments[e]=r||null,this},s.prototype.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},s.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},s.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},6554:(e,t,r)=>{"use strict";e.exports=l;var n=r(243);((l.prototype=Object.create(n.prototype)).constructor=l).className="Field";var i,o=r(6361),s=r(3683),a=r(7984),c=/^required|optional|repeated$/;function l(e,t,r,i,o,l,u){if(a.isObject(i)?(u=o,l=i,i=o=void 0):a.isObject(o)&&(u=l,l=o,o=void 0),n.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==i&&!c.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==o&&!a.isString(o))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=r,this.id=t,this.extend=o||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=!!a.Long&&void 0!==s.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=s.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=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 o&&"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 o)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"===typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},l.d=function(e,t,r,n){return"function"===typeof t?t=a.decorateType(t).name:t&&"object"===typeof t&&(t=a.decorateEnum(t).name),function(i,o){a.decorateType(i.constructor).add(new l(o,e,t,r,{default:n}))}},l._configure=function(e){i=e}},9339:(e,t,r)=>{"use strict";var n=e.exports=r(376);n.build="light",n.load=function(e,t,r){return"function"===typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(6478),n.decoder=r(2978),n.verifier=r(5390),n.converter=r(8078),n.ReflectionObject=r(243),n.Namespace=r(3221),n.Root=r(7336),n.Enum=r(6361),n.Type=r(2684),n.Field=r(6554),n.OneOf=r(3207),n.MapField=r(8186),n.Service=r(5325),n.Method=r(6641),n.Message=r(633),n.wrappers=r(5316),n.types=r(3683),n.util=r(7984),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},376:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(9647),n.BufferWriter=r(2472),n.Reader=r(9935),n.BufferReader=r(552),n.util=r(7428),n.rpc=r(421),n.roots=r(2759),n.configure=i,i()},9630:(e,t,r)=>{"use strict";var n=e.exports=r(9339);n.build="full",n.tokenize=r(8865),n.parse=r(6141),n.common=r(4833),n.Root._configure(n.Type,n.parse,n.common)},8186:(e,t,r)=>{"use strict";e.exports=s;var n=r(6554);((s.prototype=Object.create(n.prototype)).constructor=s).className="MapField";var i=r(3683),o=r(7984);function s(e,t,r,i,s,a){if(n.call(this,e,t,i,void 0,void 0,s,a),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},s.d=function(e,t,r){return"function"===typeof r?r=o.decorateType(r).name:r&&"object"===typeof r&&(r=o.decorateEnum(r).name),function(n,i){o.decorateType(n.constructor).add(new s(i,e,t,r))}}},633:(e,t,r)=>{"use strict";e.exports=i;var n=r(7428);function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)}},6641:(e,t,r)=>{"use strict";e.exports=o;var n=r(243);((o.prototype=Object.create(n.prototype)).constructor=o).className="Method";var i=r(7984);function o(e,t,r,o,s,a,c,l,u){if(i.isObject(s)?(c=s,s=a=void 0):i.isObject(a)&&(c=a,a=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(r))throw TypeError("requestType must be a string");if(!i.isString(o))throw TypeError("responseType must be a string");n.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=o,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}o.fromJSON=function(e,t){return new o(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.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",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},o.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},3221:(e,t,r)=>{"use strict";e.exports=h;var n=r(243);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var i,o,s,a=r(6554),c=r(7984),l=r(3207);function u(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function h(e,t){n.call(this,e,t),this.nested=void 0,this._nestedArray=null}function d(e){return e._nestedArray=null,e}h.fromJSON=function(e,t){return new h(e,t.options).addJSON(t.nested)},h.arrayToJSON=u,h.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!==typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=c.toArray(this.nested))}}),h.prototype.toJSON=function(e){return c.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},h.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),n=0;n<r.length;++n)t=e[r[n]],this.add((void 0!==t.fields?i.fromJSON:void 0!==t.values?s.fromJSON:void 0!==t.methods?o.fromJSON:void 0!==t.id?a.fromJSON:h.fromJSON)(r[n],t));return this},h.prototype.get=function(e){return this.nested&&this.nested[e]||null},h.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof s)return this.nested[e].values;throw Error("no such enum: "+e)},h.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof i||e instanceof l||e instanceof s||e instanceof o||e instanceof h))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof h&&e instanceof h)||t instanceof i||t instanceof o)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,n=0;n<r.length;++n)e.add(r[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),d(this)},h.prototype.remove=function(e){if(!(e instanceof n))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),d(this)},h.prototype.define=function(e,t){if(c.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 r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else r.add(r=new h(n))}return t&&r.addJSON(t),r},h.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof h?e[t++].resolveAll():e[t++].resolve();return this.resolve()},h.prototype.lookup=function(e,t,r){if("boolean"===typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),c.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),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof h&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof h&&(n=this._nestedArray[i].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},h.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},h.prototype.lookupEnum=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},h.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,s]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},h.prototype.lookupService=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},h._configure=function(e,t,r){i=e,o=t,s=r}},243:(e,t,r)=>{"use strict";e.exports=o,o.className="ReflectionObject";var n,i=r(7984);function o(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(o.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),o.prototype.toJSON=function(){throw Error()},o.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof n&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},o.prototype.getOption=function(e){if(this.options)return this.options[e]},o.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var o=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(o){var s=o[e];i.setProperty(s,r,t)}else(o={})[e]=i.setProperty({},r,t),n.push(o)}else{var a={};a[e]=t,n.push(a)}return this},o.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},o.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},o._configure=function(e){n=e}},3207:(e,t,r)=>{"use strict";e.exports=s;var n=r(243);((s.prototype=Object.create(n.prototype)).constructor=s).className="OneOf";var i=r(6554),o=r(7984);function s(e,t,r,i){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}s.fromJSON=function(e,t){return new s(e,t.oneof,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},s.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},s.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}a(this)},s.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);n.prototype.onRemove.call(this,e)},s.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){o.decorateType(t.constructor).add(new s(r,e)),Object.defineProperty(t,r,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}}},6141:(e,t,r)=>{"use strict";e.exports=A,A.filename=null,A.defaults={keepCase:!1};var n=r(8865),i=r(7336),o=r(2684),s=r(6554),a=r(8186),c=r(3207),l=r(6361),u=r(5325),h=r(6641),d=r(3683),f=r(7984),p=/^[1-9][0-9]*$/,g=/^-?[1-9][0-9]*$/,y=/^0[x][0-9a-fA-F]+$/,m=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,b=/^-?0[0-7]+$/,w=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,_=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,S=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function A(e,t,r){t instanceof i||(r=t,t=new i),r||(r=A.defaults);var k,I,C,R,T,x=r.preferTrailingComment||!1,P=n(e,r.alternateCommentMode||!1),D=P.next,N=P.push,O=P.peek,L=P.skip,B=P.cmnt,M=!0,U=!1,F=t,j=r.keepCase?function(e){return e}:f.camelCase;function z(e,t,r){var n=A.filename;return r||(A.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+P.line+")")}function q(){var e,t=[];do{if('"'!==(e=D())&&"'"!==e)throw z(e);t.push(D()),L(e),e=O()}while('"'===e||"'"===e);return t.join("")}function K(e){var t=D();switch(t){case"'":case'"':return N(t),q();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(e))return r*parseInt(e,10);if(y.test(e))return r*parseInt(e,16);if(v.test(e))return r*parseInt(e,8);if(w.test(e))return r*parseFloat(e);throw z(e,"number",t)}(t,!0)}catch(r){if(e&&_.test(t))return t;throw z(t,"value")}}function V(e,t){var r,n;do{!t||'"'!==(r=O())&&"'"!==r?e.push([n=H(D()),L("to",!0)?H(D()):n]):e.push(q())}while(L(",",!0));L(";")}function H(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw z(e,"id");if(g.test(e))return parseInt(e,10);if(m.test(e))return parseInt(e,16);if(b.test(e))return parseInt(e,8);throw z(e,"id")}function W(){if(void 0!==k)throw z("package");if(k=D(),!_.test(k))throw z(k,"name");F=F.define(k),L(";")}function G(){var e,t=O();switch(t){case"weak":e=C||(C=[]),D();break;case"public":D();default:e=I||(I=[])}t=q(),L(";"),e.push(t)}function Y(){if(L("="),R=q(),!(U="proto3"===R)&&"proto2"!==R)throw z(R,"syntax");L(";")}function Q(e,t){switch(t){case"option":return ee(e,t),L(";"),!0;case"message":return J(e,t),!0;case"enum":return Z(e,t),!0;case"service":return function(e,t){if(!E.test(t=D()))throw z(t,"service name");var r=new u(t);X(r,(function(e){if(!Q(r,e)){if("rpc"!==e)throw z(e);!function(e,t){var r=B(),n=t;if(!E.test(t=D()))throw z(t,"name");var i,o,s,a,c=t;L("("),L("stream",!0)&&(o=!0);if(!_.test(t=D()))throw z(t);i=t,L(")"),L("returns"),L("("),L("stream",!0)&&(a=!0);if(!_.test(t=D()))throw z(t);s=t,L(")");var l=new h(c,n,i,s,o,a);l.comment=r,X(l,(function(e){if("option"!==e)throw z(e);ee(l,e),L(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!_.test(t=D()))throw z(t,"reference");var r=t;X(null,(function(t){switch(t){case"required":case"repeated":$(e,t,r);break;case"optional":$(e,U?"proto3_optional":"optional",r);break;default:if(!U||!_.test(t))throw z(t);N(t),$(e,"optional",r)}}))}(e,t),!0}return!1}function X(e,t,r){var n=P.line;if(e&&("string"!==typeof e.comment&&(e.comment=B()),e.filename=A.filename),L("{",!0)){for(var i;"}"!==(i=D());)t(i);L(";",!0)}else r&&r(),L(";"),e&&("string"!==typeof e.comment||x)&&(e.comment=B(n)||e.comment)}function J(e,t){if(!E.test(t=D()))throw z(t,"type name");var r=new o(t);X(r,(function(e){if(!Q(r,e))switch(e){case"map":!function(e){L("<");var t=D();if(void 0===d.mapKey[t])throw z(t,"type");L(",");var r=D();if(!_.test(r))throw z(r,"type");L(">");var n=D();if(!E.test(n))throw z(n,"name");L("=");var i=new a(j(n),H(D()),t,r);X(i,(function(e){if("option"!==e)throw z(e);ee(i,e),L(";")}),(function(){ne(i)})),e.add(i)}(r);break;case"required":case"repeated":$(r,e);break;case"optional":$(r,U?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!E.test(t=D()))throw z(t,"name");var r=new c(j(t));X(r,(function(e){"option"===e?(ee(r,e),L(";")):(N(e),$(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":V(r.extensions||(r.extensions=[]));break;case"reserved":V(r.reserved||(r.reserved=[]),!0);break;default:if(!U||!_.test(e))throw z(e);N(e),$(r,"optional")}})),e.add(r)}function $(e,t,r){var n=D();if("group"!==n){for(;n.endsWith(".")||O().startsWith(".");)n+=D();if(!_.test(n))throw z(n,"type");var i=D();if(!E.test(i))throw z(i,"name");i=j(i),L("=");var a=new s(i,H(D()),n,t,r);if(X(a,(function(e){if("option"!==e)throw z(e);ee(a,e),L(";")}),(function(){ne(a)})),"proto3_optional"===t){var l=new c("_"+i);a.setOption("proto3_optional",!0),l.add(a),e.add(l)}else e.add(a);U||!a.repeated||void 0===d.packed[n]&&void 0!==d.basic[n]||a.setOption("packed",!1,!0)}else!function(e,t){var r=D();if(!E.test(r))throw z(r,"name");var n=f.lcFirst(r);r===n&&(r=f.ucFirst(r));L("=");var i=H(D()),a=new o(r);a.group=!0;var c=new s(n,i,r,t);c.filename=A.filename,X(a,(function(e){switch(e){case"option":ee(a,e),L(";");break;case"required":case"repeated":$(a,e);break;case"optional":$(a,U?"proto3_optional":"optional");break;case"message":J(a,e);break;case"enum":Z(a,e);break;default:throw z(e)}})),e.add(a).add(c)}(e,t)}function Z(e,t){if(!E.test(t=D()))throw z(t,"name");var r=new l(t);X(r,(function(e){switch(e){case"option":ee(r,e),L(";");break;case"reserved":V(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!E.test(t))throw z(t,"name");L("=");var r=H(D(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};X(n,(function(e){if("option"!==e)throw z(e);ee(n,e),L(";")}),(function(){ne(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function ee(e,t){var r=L("(",!0);if(!_.test(t=D()))throw z(t,"name");var n,i=t,o=i;r&&(L(")"),o=i="("+i+")",t=O(),S.test(t)&&(n=t.slice(1),i+=t,D())),L("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,o,te(e,i),n)}function te(e,t){if(L("{",!0)){for(var r={};!L("}",!0);){if(!E.test(T=D()))throw z(T,"name");if(null===T)throw z(T,"end of input");var n,i=T;if(L(":",!0),"{"===O())n=te(e,t+"."+T);else if("["===O()){var o;if(n=[],L("[",!0)){do{o=K(!0),n.push(o)}while(L(",",!0));L("]"),"undefined"!==typeof o&&re(e,t+"."+T,o)}}else n=K(!0),re(e,t+"."+T,n);var s=r[i];s&&(n=[].concat(s).concat(n)),r[i]=n,L(",",!0),L(";",!0)}return r}var a=K(!0);return re(e,t,a),a}function re(e,t,r){e.setOption&&e.setOption(t,r)}function ne(e){if(L("[",!0)){do{ee(e,"option")}while(L(",",!0));L("]")}return e}for(;null!==(T=D());)switch(T){case"package":if(!M)throw z(T);W();break;case"import":if(!M)throw z(T);G();break;case"syntax":if(!M)throw z(T);Y();break;case"option":ee(F,T),L(";");break;default:if(Q(F,T)){M=!1;continue}throw z(T)}return A.filename=null,{package:k,imports:I,weakImports:C,syntax:R,root:t}}},9935:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(7428),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>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(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,r);if(t===r){var n=i.Buffer;return n?n.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.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},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},552:(e,t,r)=>{"use strict";e.exports=o;var n=r(9935);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(7428);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},7336:(e,t,r)=>{"use strict";e.exports=h;var n=r(3221);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var i,o,s,a=r(6554),c=r(6361),l=r(3207),u=r(7984);function h(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,r,n){"function"===typeof r&&(n=r,r=void 0);var i=this;if(!n)return u.asPromise(e,i,t,r);var a=n===d;function c(e,t){if(n){if(a)throw e;var r=n;n=null,r(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in s)return r}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){o.filename=e;var n,s=o(t,i,r),h=0;if(s.imports)for(;h<s.imports.length;++h)(n=l(s.imports[h])||i.resolvePath(e,s.imports[h]))&&f(n);if(s.weakImports)for(h=0;h<s.weakImports.length;++h)(n=l(s.weakImports[h])||i.resolvePath(e,s.weakImports[h]))&&f(n,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(d){c(d)}a||p||c(null,i)}function f(e,t){if(e=l(e)||e,!(i.files.indexOf(e)>-1))if(i.files.push(e),e in s)a?h(e,s[e]):(++p,setTimeout((function(){--p,h(e,s[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(o){return void(t||c(o))}h(e,r)}else++p,i.fetch(e,(function(r,o){--p,n&&(r?t?p||c(null,i):c(r):h(e,o))}))}var p=0;u.isString(t)&&(t=[t]);for(var g,y=0;y<t.length;++y)(g=i.resolvePath("",t[y]))&&f(g);if(a)return i;p||c(null,i)},h.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,d)},h.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return r.get(n.name)||(n.declaringField=t,t.extensionField=n,r.add(n)),!0}return!1}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof c)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof l)){if(e instanceof i)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);f.test(e.name)&&(e.parent[e.name]=e)}},h.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);f.test(e.name)&&delete e.parent[e.name]}},h._configure=function(e,t,r){i=e,o=t,s=r}},2759:e=>{"use strict";e.exports={}},421:(e,t,r)=>{"use strict";t.Service=r(6349)},6349:(e,t,r)=>{"use strict";e.exports=i;var n=r(7428);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){s(c)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},5325:(e,t,r)=>{"use strict";e.exports=a;var n=r(3221);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var i=r(6641),o=r(7984),s=r(421);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),o=0;o<n.length;++o)r.add(i.fromJSON(n[o],t.methods[n[o]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||void 0,"methods",n.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||n.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return n.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,c(this)):n.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,c(this)}return n.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var n,i=new s.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var c=o.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[c]=o.codegen(["r","c"],o.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return i}},8865:e=>{"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,o=/^\s*\*?\/*/,s=/\n/g,a=/\s/,c=/\\(.?)/g,l={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(c,(function(e,t){switch(t){case"\\":case"":return t;default:return l[t]||""}}))}function h(e,c){e=e.toString();var l=0,h=e.length,d=1,f=0,p={},g=[],y=null;function m(e){return Error("illegal "+e+" (line "+d+")")}function v(t){return e.charAt(t)}function b(t,r,n){var a,l={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(c?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){l.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,r).split(s),g=0;g<h.length;++g)h[g]=h[g].replace(c?o:i,"").trim();l.text=h.join("\n").trim(),p[d]=l,f=d}function w(t){var r=E(t),n=e.substring(t,r);return/^\s*\/\//.test(n)}function E(e){for(var t=e;t<h&&"\n"!==v(t);)t++;return t}function _(){if(g.length>0)return g.shift();if(y)return function(){var t="'"===y?n:r;t.lastIndex=l-1;var i=t.exec(e);if(!i)throw m("string");return l=t.lastIndex,S(y),y=null,u(i[1])}();var i,o,s,f,p,_=0===l;do{if(l===h)return null;for(i=!1;a.test(s=v(l));)if("\n"===s&&(_=!0,++d),++l===h)return null;if("/"===v(l)){if(++l===h)throw m("comment");if("/"===v(l))if(c){if(f=l,p=!1,w(l-1)){p=!0;do{if((l=E(l))===h)break;if(l++,!_)break}while(w(l))}else l=Math.min(h,E(l)+1);p&&(b(f,l,_),_=!0),d++,i=!0}else{for(p="/"===v(f=l+1);"\n"!==v(++l);)if(l===h)return null;++l,p&&(b(f,l-1,_),_=!0),++d,i=!0}else{if("*"!==(s=v(l)))return"/";f=l+1,p=c||"*"===v(f);do{if("\n"===s&&++d,++l===h)throw m("comment");o=s,s=v(l)}while("*"!==o||"/"!==s);++l,p&&(b(f,l-2,_),_=!0),i=!0}}}while(i);var A=l;if(t.lastIndex=0,!t.test(v(A++)))for(;A<h&&!t.test(v(A));)++A;var k=e.substring(l,l=A);return'"'!==k&&"'"!==k||(y=k),k}function S(e){g.push(e)}function A(){if(!g.length){var e=_();if(null===e)return null;S(e)}return g[0]}return Object.defineProperty({next:_,peek:A,push:S,skip:function(e,t){var r=A();if(r===e)return _(),!0;if(!t)throw m("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t,r=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(c||"*"===t.type||t.lineEmpty)&&(r=t.leading?t.text:null)):(f<e&&A(),t=p[e],delete p[e],!t||t.lineEmpty||!c&&"/"!==t.type||(r=t.leading?null:t.text)),r}},"line",{get:function(){return d}})}h.unescape=u},2684:(e,t,r)=>{"use strict";e.exports=v;var n=r(3221);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var i=r(6361),o=r(3207),s=r(6554),a=r(8186),c=r(5325),l=r(633),u=r(9935),h=r(9647),d=r(7984),f=r(6478),p=r(2978),g=r(5390),y=r(8078),m=r(5316);function v(e,t){n.call(this,e,t),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 b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof l||((e.prototype=new l).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,l,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:d.oneOfGetter(this._oneofsArray[r].oneof),set:d.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),v.generateConstructor=function(e){for(var t,r=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",d.safeProp(t.name)):t.repeated&&r("this%s=[]",d.safeProp(t.name));return r("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]]")},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var l=Object.keys(t.fields),u=0;u<l.length;++u)r.add(("undefined"!==typeof t.fields[l[u]].keyType?a.fromJSON:s.fromJSON)(l[u],t.fields[l[u]]));if(t.oneofs)for(l=Object.keys(t.oneofs),u=0;u<l.length;++u)r.add(o.fromJSON(l[u],t.oneofs[l[u]]));if(t.nested)for(l=Object.keys(t.nested),u=0;u<l.length;++u){var h=t.nested[l[u]];r.add((void 0!==h.id?s.fromJSON:void 0!==h.fields?v.fromJSON:void 0!==h.values?i.fromJSON:void 0!==h.methods?c.fromJSON:n.fromJSON)(l[u],h))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return d.toObject(["options",t&&t.options||void 0,"oneofs",n.arrayToJSON(this.oneofsArray,e),"fields",n.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"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",t&&t.nested||void 0,"comment",r?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return n.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof s&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof o?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):n.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof s&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof o){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return n.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=f(this)({Writer:h,types:t,util:d}),this.decode=p(this)({Reader:u,types:t,util:d}),this.verify=g(this)({types:t,util:d}),this.fromObject=y.fromObject(this)({types:t,util:d}),this.toObject=y.toObject(this)({types:t,util:d});var n=m[e];if(n){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(i),i.toObject=this.toObject,this.toObject=n.toObject.bind(i)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){d.decorateType(t,e)}}},3683:(e,t,r)=>{"use strict";var n=t,i=r(7984),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var r=0,n={};for(t|=0;r<e.length;)n[o[r+t]]=e[r++];return n}n.basic=s([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=s([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),n.long=s([0,0,0,1,1],7),n.mapKey=s([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=s([1,5,0,0,0,5,5,0,0,0,1,1,0])},7984:(e,t,r)=>{"use strict";var n,i,o=e.exports=r(7428),s=r(2759);o.codegen=r(4011),o.fetch=r(6046),o.path=r(8845),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},o.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],i=e[r++];void 0!==i&&(t[n]=i)}return t};var a=/\\/g,c=/"/g;o.isReserved=function(e){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(e)},o.safeProp=function(e){return!/^[$\w_]+$/.test(e)||o.isReserved(e)?'["'+e.replace(a,"\\\\").replace(c,'\\"')+'"]':"."+e},o.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var l=/_([a-z])/g;o.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(l,(function(e,t){return t.toUpperCase()}))},o.compareFieldsById=function(e,t){return e.id-t.id},o.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(o.decorateRoot.remove(e.$type),e.$type.name=t,o.decorateRoot.add(e.$type)),e.$type;n||(n=r(2684));var i=new n(t||e.name);return o.decorateRoot.add(i),i.ctor=e,Object.defineProperty(e,"$type",{value:i,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:i,enumerable:!1}),i};var u=0;o.decorateEnum=function(e){if(e.$type)return e.$type;i||(i=r(6361));var t=new i("Enum"+u++,e);return o.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},o.setProperty=function(e,t,r){if("object"!==typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var i=r.shift();if("__proto__"===i||"prototype"===i)return t;if(r.length>0)t[i]=e(t[i]||{},r,n);else{var o=t[i];o&&(n=[].concat(o).concat(n)),t[i]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(r(7336)))}})},7069:(e,t,r)=>{"use strict";e.exports=i;var n=r(7428);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.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)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},7428:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(3159),n.base64=r(1313),n.EventEmitter=r(3456),n.float=r(4348),n.inquire=r(2867),n.utf8=r(7817),n.pool=r(2940),n.LongBits=r(7069),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},5390:(e,t,r)=>{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,n={};r.length&&t("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),u="m"+i.safeProp(l.name);if(l.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map)t("if(!util.isObject(%s))",u)("return%j",o(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),a(t,l,"k[i]"),s(t,l,c,u+"[k[i]]")("}");else if(l.repeated)t("if(!Array.isArray(%s))",u)("return%j",o(l,"array"))("for(var i=0;i<%s.length;++i){",u),s(t,l,c,u+"[i]")("}");else{if(l.partOf){var h=i.safeProp(l.partOf.name);1===n[l.partOf.name]&&t("if(p%s===1)",h)("return%j",l.partOf.name+": multiple values"),n[l.partOf.name]=1,t("p%s=1",h)}s(t,l,c,u)}l.optional&&t("}")}return t("return null")};var n=r(6361),i=r(7984);function o(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function s(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(%s){",i)("default:")("return%j",o(t,"enum value"));for(var s=Object.keys(t.resolvedType.values),a=0;a<s.length;++a)e("case %i:",t.resolvedType.values[s[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",o(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",o(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",o(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",o(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",o(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",o(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",o(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",o(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",o(t,"boolean key"))}return e}},5316:(e,t,r)=>{"use strict";var n=t,i=r(633);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var o=this.lookup(n);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var s=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=n,s}return this.toObject(e,t)}}},9647:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(7428),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.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 c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},2472:(e,t,r)=>{"use strict";e.exports=o;var n=r(9647);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(7428);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},9304:(e,t,r)=>{const n=r(7247),i=r(1400),o=r(386),s=r(7677),{RateLimiterClusterMaster:a,RateLimiterClusterMasterPM2:c,RateLimiterCluster:l}=r(6162),u=r(9293),h=r(9767),d=r(3452),f=r(3007),p=r(8587),g=r(6105),y=r(38);e.exports={RateLimiterRedis:n,RateLimiterMongo:i,RateLimiterMySQL:o,RateLimiterPostgres:s,RateLimiterMemory:u,RateLimiterMemcache:h,RateLimiterClusterMaster:a,RateLimiterClusterMasterPM2:c,RateLimiterCluster:l,RLWrapperBlackAndWhite:d,RateLimiterUnion:f,RateLimiterQueue:p,BurstyRateLimiter:g,RateLimiterRes:y}},6105:(e,t,r)=>{const n=r(38);e.exports=class{constructor(e,t){this._rateLimiter=e,this._burstLimiter=t}_combineRes(e,t){return e?new n(e.remainingPoints,Math.min(e.msBeforeNext,t?t.msBeforeNext:0),e.consumedPoints,e.isFirstInDuration):null}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._rateLimiter.consume(e,t,r).catch((i=>i instanceof n?this._burstLimiter.consume(e,t,r).then((e=>Promise.resolve(this._combineRes(i,e)))).catch((e=>e instanceof n?Promise.reject(this._combineRes(i,e)):Promise.reject(e))):Promise.reject(i)))}get(e){return Promise.all([this._rateLimiter.get(e),this._burstLimiter.get(e)]).then((e=>{let[t,r]=e;return this._combineRes(t,r)}))}get points(){return this._rateLimiter.points}}},3452:(e,t,r)=>{const n=r(38);e.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.limiter=e.limiter,this.blackList=e.blackList,this.whiteList=e.whiteList,this.isBlackListed=e.isBlackListed,this.isWhiteListed=e.isWhiteListed,this.runActionAnyway=e.runActionAnyway}get limiter(){return this._limiter}set limiter(e){if("undefined"===typeof e)throw new Error("limiter is not set");this._limiter=e}get runActionAnyway(){return this._runActionAnyway}set runActionAnyway(e){this._runActionAnyway="undefined"!==typeof e&&e}get blackList(){return this._blackList}set blackList(e){this._blackList=Array.isArray(e)?e:[]}get isBlackListed(){return this._isBlackListed}set isBlackListed(e){if("undefined"===typeof e&&(e=()=>!1),"function"!==typeof e)throw new Error("isBlackListed must be function");this._isBlackListed=e}get whiteList(){return this._whiteList}set whiteList(e){this._whiteList=Array.isArray(e)?e:[]}get isWhiteListed(){return this._isWhiteListed}set isWhiteListed(e){if("undefined"===typeof e&&(e=()=>!1),"function"!==typeof e)throw new Error("isWhiteListed must be function");this._isWhiteListed=e}isBlackListedSomewhere(e){return this.blackList.indexOf(e)>=0||this.isBlackListed(e)}isWhiteListedSomewhere(e){return this.whiteList.indexOf(e)>=0||this.isWhiteListed(e)}getBlackRes(){return new n(0,Number.MAX_SAFE_INTEGER,0,!1)}getWhiteRes(){return new n(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(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.isWhiteListedSomewhere(e)?t=this.resolveWhite():this.isBlackListedSomewhere(e)&&(t=this.rejectBlack()),"undefined"===typeof t?this.limiter.consume(e,r):(this.runActionAnyway&&this.limiter.consume(e,r).catch((()=>{})),t)}block(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.block(e,t):(this.runActionAnyway&&this.limiter.block(e,t).catch((()=>{})),r)}penalty(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.penalty(e,t):(this.runActionAnyway&&this.limiter.penalty(e,t).catch((()=>{})),r)}reward(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.reward(e,t):(this.runActionAnyway&&this.limiter.reward(e,t).catch((()=>{})),r)}get(e){let t;return this.isWhiteListedSomewhere(e)?t=this.resolveWhite():this.isBlackListedSomewhere(e)&&(t=this.resolveBlack()),"undefined"===typeof t||this.runActionAnyway?this.limiter.get(e):t}delete(e){return this.limiter.delete(e)}}},7276:e=>{e.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.points=e.points,this.duration=e.duration,this.blockDuration=e.blockDuration,this.execEvenly=e.execEvenly,this.execEvenlyMinDelayMs=e.execEvenlyMinDelayMs,this.keyPrefix=e.keyPrefix}get points(){return this._points}set points(e){this._points=e>=0?e:4}get duration(){return this._duration}set duration(e){this._duration="undefined"===typeof e?1:e}get msDuration(){return 1e3*this.duration}get blockDuration(){return this._blockDuration}set blockDuration(e){this._blockDuration="undefined"===typeof e?0:e}get msBlockDuration(){return 1e3*this.blockDuration}get execEvenly(){return this._execEvenly}set execEvenly(e){this._execEvenly="undefined"!==typeof e&&Boolean(e)}get execEvenlyMinDelayMs(){return this._execEvenlyMinDelayMs}set execEvenlyMinDelayMs(e){this._execEvenlyMinDelayMs="undefined"===typeof e?Math.ceil(this.msDuration/this.points):e}get keyPrefix(){return this._keyPrefix}set keyPrefix(e){if("undefined"===typeof e&&(e="rlflx"),"string"!==typeof e)throw new Error("keyPrefix must be string");this._keyPrefix=e}_getKeySecDuration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e&&e.customDuration>=0?e.customDuration:this.duration}getKey(e){return this.keyPrefix.length>0?"".concat(this.keyPrefix,":").concat(e):e}parseKey(e){return e.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'!")}}},6162:(e,t,r)=>{const n=r(4658),i=r(7287),o=r(7276),s=r(9293),a=r(38),c="rate_limiter_flexible";let l=null;const u=function(e,t,r,n){let i;i=null===n||!0===n||!1===n?n:{remainingPoints:n.remainingPoints,msBeforeNext:n.msBeforeNext,consumedPoints:n.consumedPoints,isFirstInDuration:n.isFirstInDuration},e.send({channel:c,keyPrefix:t.keyPrefix,promiseId:t.promiseId,type:r,data:i})},h=function(e){setTimeout((()=>{this._initiated?process.send(e):"undefined"!==typeof this._promises[e.promiseId]&&h.call(this,e)}),30)},d=function(e,t,r,n,i){const o={channel:c,keyPrefix:this.keyPrefix,func:e,promiseId:t,data:{key:r,arg:n,opts:i}};this._initiated?process.send(o):h.call(this,o)},f=function(e,t){if(!t||t.channel!==c||"undefined"===typeof this._rateLimiters[t.keyPrefix])return!1;let r;switch(t.func){case"consume":r=this._rateLimiters[t.keyPrefix].consume(t.data.key,t.data.arg,t.data.opts);break;case"penalty":r=this._rateLimiters[t.keyPrefix].penalty(t.data.key,t.data.arg,t.data.opts);break;case"reward":r=this._rateLimiters[t.keyPrefix].reward(t.data.key,t.data.arg,t.data.opts);break;case"block":r=this._rateLimiters[t.keyPrefix].block(t.data.key,t.data.arg,t.data.opts);break;case"get":r=this._rateLimiters[t.keyPrefix].get(t.data.key,t.data.opts);break;case"delete":r=this._rateLimiters[t.keyPrefix].delete(t.data.key,t.data.opts);break;default:return!1}r&&r.then((r=>{u(e,t,"resolve",r)})).catch((r=>{u(e,t,"reject",r)}))},p=function(e){if(!e||e.channel!==c||e.keyPrefix!==this.keyPrefix)return!1;if(this._promises[e.promiseId]){let t;switch(clearTimeout(this._promises[e.promiseId].timeoutId),t=null===e.data||!0===e.data||!1===e.data?e.data:new a(e.data.remainingPoints,e.data.msBeforeNext,e.data.consumedPoints,e.data.isFirstInDuration),e.type){case"resolve":this._promises[e.promiseId].resolve(t);break;case"reject":this._promises[e.promiseId].reject(t);break;default:throw new Error("RateLimiterCluster: no such message type '".concat(e.type,"'"))}delete this._promises[e.promiseId]}},g=function(){return{points:this.points,duration:this.duration,blockDuration:this.blockDuration,execEvenly:this.execEvenly,execEvenlyMinDelayMs:this.execEvenlyMinDelayMs,keyPrefix:this.keyPrefix}},y=function(e,t){const r=process.hrtime();let n=r[0].toString()+r[1].toString();return"undefined"!==typeof this._promises[n]&&(n+=i.randomBytes(12).toString("base64")),this._promises[n]={resolve:e,reject:t,timeoutId:setTimeout((()=>{delete this._promises[n],t(new Error("RateLimiterCluster timeout: no answer from master in time"))}),this.timeoutMs)},n};e.exports={RateLimiterClusterMaster:class{constructor(){if(l)return l;this._rateLimiters={},n.setMaxListeners(0),n.on("message",((e,t)=>{t&&t.channel===c&&"init"===t.type?("undefined"===typeof this._rateLimiters[t.opts.keyPrefix]&&(this._rateLimiters[t.opts.keyPrefix]=new s(t.opts)),e.send({channel:c,type:"init",keyPrefix:t.opts.keyPrefix})):f.call(this,e,t)})),l=this}},RateLimiterClusterMasterPM2:class{constructor(e){if(l)return l;this._rateLimiters={},e.launchBus(((t,r)=>{r.on("process:msg",(t=>{const r=t.raw;if(r&&r.channel===c&&"init"===r.type)"undefined"===typeof this._rateLimiters[r.opts.keyPrefix]&&(this._rateLimiters[r.opts.keyPrefix]=new s(r.opts)),e.sendDataToProcessId(t.process.pm_id,{data:{},topic:c,channel:c,type:"init",keyPrefix:r.opts.keyPrefix},((e,t)=>{e&&console.log(e,t)}));else{f.call(this,{send:r=>{const n=r;n.topic=c,"undefined"===typeof n.data&&(n.data={}),e.sendDataToProcessId(t.process.pm_id,n,((e,t)=>{e&&console.log(e,t)}))}},r)}}))})),l=this}},RateLimiterCluster:class extends o{get timeoutMs(){return this._timeoutMs}set timeoutMs(e){this._timeoutMs="undefined"===typeof e?5e3:Math.abs(parseInt(e))}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),process.setMaxListeners(0),this.timeoutMs=e.timeoutMs,this._initiated=!1,process.on("message",(e=>{e&&e.channel===c&&"init"===e.type&&e.keyPrefix===this.keyPrefix?this._initiated=!0:p.call(this,e)})),process.send({channel:c,type:"init",opts:g.call(this)}),this._promises={}}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"consume",o,e,t,r)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"penalty",o,e,t,r)}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"reward",o,e,t,r)}))}block(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"block",o,e,t,r)}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{const i=y.call(this,r,n);d.call(this,"get",i,e,t)}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{const i=y.call(this,r,n);d.call(this,"delete",i,e,t)}))}}}},9767:(e,t,r)=>{const n=r(7855),i=r(38);e.exports=class extends n{constructor(e){super(e),this.client=e.storeClient}_getRateLimiterRes(e,t,r){const n=new i;return n.consumedPoints=parseInt(r.consumedPoints),n.isFirstInDuration=r.consumedPoints===t,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=r.msBeforeNext,n}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return new Promise(((o,s)=>{const a=Date.now(),c=Math.floor(r/1e3);n?this.client.set(e,t,c,(r=>{r?s(r):this.client.set("".concat(e,"_expire"),c>0?a+1e3*c:-1,c,(()=>{o({consumedPoints:t,msBeforeNext:c>0?1e3*c:-1})}))})):this.client.incr(e,t,((l,u)=>{l||!1===u?this.client.add(e,t,c,((l,u)=>{if(l||!u)if("undefined"===typeof i.attemptNumber||i.attemptNumber<3){const a=Object.assign({},i);a.attemptNumber=a.attemptNumber?a.attemptNumber+1:1,this._upsert(e,t,r,n,a).then((e=>o(e))).catch((e=>s(e)))}else s(new Error("Can not add key"));else this.client.add("".concat(e,"_expire"),c>0?a+1e3*c:-1,c,(()=>{o({consumedPoints:t,msBeforeNext:c>0?1e3*c:-1})}))})):this.client.get("".concat(e,"_expire"),((e,t)=>{if(e)s(e);else{const e=!1===t?0:t,r={consumedPoints:u,msBeforeNext:e>=0?Math.max(e-a,0):-1};o(r)}}))}))}))}_get(e){return new Promise(((t,r)=>{const n=Date.now();this.client.get(e,((i,o)=>{o?this.client.get("".concat(e,"_expire"),((e,i)=>{if(e)r(e);else{const e=!1===i?0:i,r={consumedPoints:o,msBeforeNext:e>=0?Math.max(e-n,0):-1};t(r)}})):t(null)}))}))}_delete(e){return new Promise(((t,r)=>{this.client.del(e,((n,i)=>{n?r(n):!1===i?t(i):this.client.del("".concat(e,"_expire"),(e=>{e?r(e):t(i)}))}))}))}}},9293:(e,t,r)=>{const n=r(7276),i=r(4615),o=r(38);e.exports=class extends n{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this._memoryStorage=new i}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=this.getKey(e),s=this._getKeySecDuration(r);let a=this._memoryStorage.incrby(o,t,s);if(a.remainingPoints=Math.max(this.points-a.consumedPoints,0),a.consumedPoints>this.points)this.blockDuration>0&&a.consumedPoints<=this.points+t&&(a=this._memoryStorage.set(o,a.consumedPoints,this.blockDuration)),i(a);else if(this.execEvenly&&a.msBeforeNext>0&&!a.isFirstInDuration){let e=Math.ceil(a.msBeforeNext/(a.remainingPoints+2));e<this.execEvenlyMinDelayMs&&(e=a.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(n,e,a)}else n(a)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(r),o=this._memoryStorage.incrby(n,t,i);o.remainingPoints=Math.max(this.points-o.consumedPoints,0),e(o)}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(r),o=this._memoryStorage.incrby(n,-t,i);o.remainingPoints=Math.max(this.points-o.consumedPoints,0),e(o)}))}block(e,t){const r=1e3*t,n=this.points+1;return this._memoryStorage.set(this.getKey(e),n,t),Promise.resolve(new o(0,0===r?-1:r,n))}set(e,t,r){const n=1e3*(r>=0?r:this.duration);return this._memoryStorage.set(this.getKey(e),t,r),Promise.resolve(new o(0,0===n?-1:n,t))}get(e){const t=this._memoryStorage.get(this.getKey(e));return null!==t&&(t.remainingPoints=Math.max(this.points-t.consumedPoints,0)),Promise.resolve(t)}delete(e){return Promise.resolve(this._memoryStorage.delete(this.getKey(e)))}}},1400:(e,t,r)=>{const n=r(7855),i=r(38);function o(e){try{const t=e.client?e.client:e,{version:r}=t.topology.s.options.metadata.driver,n=r.split(".").map((e=>parseInt(e)));return{major:n[0],feature:n[1],patch:n[2]}}catch(t){return{major:0,feature:0,patch:0}}}class s extends n{constructor(e){super(e),this.dbName=e.dbName,this.tableName=e.tableName,this.indexKeyPrefix=e.indexKeyPrefix,e.mongo?this.client=e.mongo:this.client=e.storeClient,"function"===typeof this.client.then?this.client.then((e=>{this.client=e,this._initCollection(),this._driverVersion=o(this.client)})):(this._initCollection(),this._driverVersion=o(this.client))}get dbName(){return this._dbName}set dbName(e){this._dbName="undefined"===typeof e?s.getDbName():e}static getDbName(){return"node-rate-limiter-flexible"}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get client(){return this._client}set client(e){if("undefined"===typeof e)throw new Error("mongo is not set");this._client=e}get indexKeyPrefix(){return this._indexKeyPrefix}set indexKeyPrefix(e){this._indexKeyPrefix=e||{}}_initCollection(){const e=("function"===typeof this.client.db?this.client.db(this.dbName):this.client).collection(this.tableName);e.createIndex({expire:-1},{expireAfterSeconds:0}),e.createIndex(Object.assign({},this.indexKeyPrefix,{key:1}),{unique:!0}),this._collection=e}_getRateLimiterRes(e,t,r){const n=new i;let o;return o="undefined"===typeof r.value?r:r.value,n.isFirstInDuration=o.points===t,n.consumedPoints=o.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=null!==o.expire?Math.max(new Date(o.expire).getTime()-Date.now(),0):-1,n}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const o=i.attrs||{};let s,a;n?(s={key:e},s=Object.assign(s,o),a={$set:{key:e,points:t,expire:r>0?new Date(Date.now()+r):null}},a.$set=Object.assign(a.$set,o)):(s={$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}],key:e},s=Object.assign(s,o),a={$setOnInsert:{key:e,expire:r>0?new Date(Date.now()+r):null},$inc:{points:t}},a.$setOnInsert=Object.assign(a.$setOnInsert,o));const c={upsert:!0};return this._driverVersion.major>=4||3===this._driverVersion.major&&this._driverVersion.feature>=7||this._driverVersion.feature>=6&&this._driverVersion.patch>=7?c.returnDocument="after":c.returnOriginal=!1,new Promise(((i,l)=>{this._collection.findOneAndUpdate(s,a,c).then((e=>{i(e)})).catch((s=>{if(s&&11e3===s.code){const s=Object.assign({$or:[{expire:{$lte:new Date}},{expire:{$eq:null}}],key:e},o),a={$set:Object.assign({key:e,points:t,expire:r>0?new Date(Date.now()+r):null},o)};this._collection.findOneAndUpdate(s,a,c).then((e=>{i(e)})).catch((o=>{o&&11e3===o.code?this._upsert(e,t,r,n).then((e=>i(e))).catch((e=>l(e))):l(o)}))}else l(s)}))}))}_get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const r=t.attrs||{},n=Object.assign({key:e,$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}]},r);return this._collection.findOne(n)}_delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const r=t.attrs||{},n=Object.assign({key:e},r);return this._collection.deleteOne(n).then((e=>e.deletedCount>0))}}e.exports=s},386:(e,t,r)=>{const n=r(7855),i=r(38);e.exports=class extends n{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e),this.client=e.storeClient,this.clientType=e.storeType,this.dbName=e.dbName,this.tableName=e.tableName,this.clearExpiredByTimeout=e.clearExpiredByTimeout,this.tableCreated=e.tableCreated,this.tableCreated?(this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()):this._createDbAndTable().then((()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()})).catch((e=>{if("function"!==typeof t)throw e;t(e)}))}clearExpired(e){return new Promise((t=>{this._getConnection().then((r=>{r.query("DELETE FROM ??.?? WHERE expire < ?",[this.dbName,this.tableName,e],(()=>{this._releaseConnection(r),t()}))})).catch((()=>{t()}))}))}_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(((e,t)=>{this.client.getConnection(((r,n)=>{if(r)return t(r);e(n)}))}));case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();default:return Promise.resolve(this.client)}}_releaseConnection(e){switch(this.clientType){case"pool":return e.release();case"sequelize":return this.client.connectionManager.releaseConnection(e);case"knex":return this.client.client.releaseConnection(e);default:return!0}}_createDbAndTable(){return new Promise(((e,t)=>{this._getConnection().then((r=>{r.query("CREATE DATABASE IF NOT EXISTS `".concat(this.dbName,"`;"),(n=>{if(n)return this._releaseConnection(r),t(n);r.query(this._getCreateTableStmt(),(n=>{if(n)return this._releaseConnection(r),t(n);this._releaseConnection(r),e()}))}))})).catch((e=>{t(e)}))}))}_getCreateTableStmt(){return"CREATE TABLE IF NOT EXISTS `".concat(this.dbName,"`.`").concat(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(e){if("undefined"===typeof e)if("Connection"===this.client.constructor.name)e="connection";else if("Pool"===this.client.constructor.name)e="pool";else{if("Sequelize"!==this.client.constructor.name)throw new Error("storeType is not defined");e="sequelize"}this._clientType=e.toLowerCase()}get dbName(){return this._dbName}set dbName(e){this._dbName="undefined"===typeof e?"rtlmtrflx":e}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get tableCreated(){return this._tableCreated}set tableCreated(e){this._tableCreated="undefined"!==typeof e&&!!e}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(e){this._clearExpiredByTimeout="undefined"===typeof e||Boolean(e)}_getRateLimiterRes(e,t,r){const n=new i,[o]=r;return n.isFirstInDuration=t===o.points,n.consumedPoints=n.isFirstInDuration?t:o.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=o.expire?Math.max(o.expire-Date.now(),0):-1,n}_upsertTransaction(e,t,r,n,i){return new Promise(((o,s)=>{e.query("BEGIN",(a=>{if(a)return e.rollback(),s(a);const c=Date.now(),l=n>0?c+n:null;let u,h;i?(u="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = ?, \n expire = ?;",h=[this.dbName,this.tableName,t,r,l,r,l]):(u="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = IF(expire <= ?, ?, points + (?)), \n expire = IF(expire <= ?, ?, expire);",h=[this.dbName,this.tableName,t,r,l,c,r,r,c,l]),e.query(u,h,(r=>{if(r)return e.rollback(),s(r);e.query("SELECT points, expire FROM ??.?? WHERE `key` = ?;",[this.dbName,this.tableName,t],((t,r)=>{if(t)return e.rollback(),s(t);e.query("COMMIT",(t=>{if(t)return e.rollback(),s(t);o(r)}))}))}))}))}))}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.tableCreated?new Promise(((i,o)=>{this._getConnection().then((s=>{this._upsertTransaction(s,e,t,r,n).then((e=>{i(e),this._releaseConnection(s)})).catch((e=>{o(e),this._releaseConnection(s)}))})).catch((e=>{o(e)}))})):Promise.reject(Error("Table is not created yet"))}_get(e){return this.tableCreated?new Promise(((t,r)=>{this._getConnection().then((n=>{n.query("SELECT points, expire FROM ??.?? WHERE `key` = ? AND (`expire` > ? OR `expire` IS NULL)",[this.dbName,this.tableName,e,Date.now()],((e,i)=>{e?r(e):0===i.length?t(null):t(i),this._releaseConnection(n)}))})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}_delete(e){return this.tableCreated?new Promise(((t,r)=>{this._getConnection().then((n=>{n.query("DELETE FROM ??.?? WHERE `key` = ?",[this.dbName,this.tableName,e],((e,i)=>{e?r(e):t(i.affectedRows>0),this._releaseConnection(n)}))})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}}},7677:(e,t,r)=>{const n=r(7855),i=r(38);e.exports=class extends n{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e),this.client=e.storeClient,this.clientType=e.storeType,this.tableName=e.tableName,this.clearExpiredByTimeout=e.clearExpiredByTimeout,this.tableCreated=e.tableCreated,this.tableCreated?"function"===typeof t&&t():this._createTable().then((()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()})).catch((e=>{if("function"!==typeof t)throw e;t(e)}))}clearExpired(e){return new Promise((t=>{const r={name:"rlflx-clear-expired",text:"DELETE FROM ".concat(this.tableName," WHERE expire < $1"),values:[e]};this._query(r).then((()=>{t()})).catch((()=>{t()}))}))}_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(e){switch(this.clientType){case"pool":case"typeorm":default:return!0;case"sequelize":return this.client.connectionManager.releaseConnection(e);case"knex":return this.client.client.releaseConnection(e)}}_createTable(){return new Promise(((e,t)=>{this._query({text:this._getCreateTableStmt()}).then((()=>{e()})).catch((r=>{"23505"===r.code?e():t(r)}))}))}_getCreateTableStmt(){return"CREATE TABLE IF NOT EXISTS ".concat(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(e){const t=this.client.constructor.name;if("undefined"===typeof e)if("Client"===t)e="client";else if("Pool"===t||"BoundPool"===t)e="pool";else{if("Sequelize"!==t)throw new Error("storeType is not defined");e="sequelize"}this._clientType=e.toLowerCase()}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get tableCreated(){return this._tableCreated}set tableCreated(e){this._tableCreated="undefined"!==typeof e&&!!e}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(e){this._clearExpiredByTimeout="undefined"===typeof e||Boolean(e)}_getRateLimiterRes(e,t,r){const n=new i,o=r.rows[0];return n.isFirstInDuration=t===o.points,n.consumedPoints=n.isFirstInDuration?t:o.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=o.expire?Math.max(o.expire-Date.now(),0):-1,n}_query(e){const t=this.tableName.toLowerCase(),r={name:"".concat(t,":").concat(e.name),text:e.text,values:e.values};return new Promise(((e,t)=>{this._getConnection().then((n=>{n.query(r).then((t=>{e(t),this._releaseConnection(n)})).catch((e=>{t(e),this._releaseConnection(n)}))})).catch((e=>{t(e)}))}))}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.tableCreated)return Promise.reject(Error("Table is not created yet"));const i=r>0?Date.now()+r:null,o=n?" $3 ":" CASE\n WHEN ".concat(this.tableName,".expire <= $4 THEN $3\n ELSE ").concat(this.tableName,".expire\n END ");return this._query({name:n?"rlflx-upsert-force":"rlflx-upsert",text:"\n INSERT INTO ".concat(this.tableName," VALUES ($1, $2, $3)\n ON CONFLICT(key) DO UPDATE SET\n points = CASE\n WHEN (").concat(this.tableName,".expire <= $4 OR 1=").concat(n?1:0,") THEN $2\n ELSE ").concat(this.tableName,".points + ($2)\n END,\n expire = ").concat(o,"\n RETURNING points, expire;"),values:[e,t,i,Date.now()]})}_get(e){return this.tableCreated?new Promise(((t,r)=>{this._query({name:"rlflx-get",text:"\n SELECT points, expire FROM ".concat(this.tableName," WHERE key = $1 AND (expire > $2 OR expire IS NULL);"),values:[e,Date.now()]}).then((e=>{0===e.rowCount&&(e=null),t(e)})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}_delete(e){return this.tableCreated?this._query({name:"rlflx-delete",text:"DELETE FROM ".concat(this.tableName," WHERE key = $1"),values:[e]}).then((e=>e.rowCount>0)):Promise.reject(Error("Table is not created yet"))}}},8587:(e,t,r)=>{const n=r(1541),i=4294967295,o="limiter";e.exports=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{maxQueueSize:i};this._queueLimiters={KEY_DEFAULT:new s(e,t)},this._limiterFlexible=e,this._maxQueueSize=t.maxQueueSize}getTokensRemaining(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o;return this._queueLimiters[e]?this._queueLimiters[e].getTokensRemaining():Promise.resolve(this._limiterFlexible.points)}removeTokens(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;return this._queueLimiters[t]||(this._queueLimiters[t]=new s(this._limiterFlexible,{key:t,maxQueueSize:this._maxQueueSize})),this._queueLimiters[t].removeTokens(e)}};class s{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{maxQueueSize:i,key:o};this._key=t.key,this._waitTimeout=null,this._queue=[],this._limiterFlexible=e,this._maxQueueSize=t.maxQueueSize}getTokensRemaining(){return this._limiterFlexible.get(this._key).then((e=>null!==e?e.remainingPoints:this._limiterFlexible.points))}removeTokens(e){const t=this;return new Promise(((r,i)=>{e>t._limiterFlexible.points?i(new n("Requested tokens ".concat(e," exceeds maximum ").concat(t._limiterFlexible.points," tokens per interval"))):t._queue.length>0?t._queueRequest.call(t,r,i,e):t._limiterFlexible.consume(t._key,e).then((e=>{r(e.remainingPoints)})).catch((n=>{n instanceof Error?i(n):(t._queueRequest.call(t,r,i,e),null===t._waitTimeout&&(t._waitTimeout=setTimeout(t._processFIFO.bind(t),n.msBeforeNext)))}))}))}_queueRequest(e,t,r){const i=this;i._queue.length<i._maxQueueSize?i._queue.push({resolve:e,reject:t,tokens:r}):t(new n("Number of requests reached it's maximum ".concat(i._maxQueueSize)))}_processFIFO(){const e=this;if(null!==e._waitTimeout&&(clearTimeout(e._waitTimeout),e._waitTimeout=null),0===e._queue.length)return;const t=e._queue.shift();e._limiterFlexible.consume(e._key,t.tokens).then((r=>{t.resolve(r.remainingPoints),e._processFIFO.call(e)})).catch((r=>{r instanceof Error?(t.reject(r),e._processFIFO.call(e)):(e._queue.unshift(t),null===e._waitTimeout&&(e._waitTimeout=setTimeout(e._processFIFO.bind(e),r.msBeforeNext)))}))}}},7247:(e,t,r)=>{const n=r(7855),i=r(38),o="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} ";e.exports=class extends n{constructor(e){super(e),e.redis?this.client=e.redis:this.client=e.storeClient,this._rejectIfRedisNotReady=!!e.rejectIfRedisNotReady,"function"===typeof this.client.defineCommand&&this.client.defineCommand("rlflxIncr",{numberOfKeys:1,lua:o})}_isRedisReady(){return!this._rejectIfRedisNotReady||(!this.client.status||"ready"===this.client.status)&&!("function"===typeof this.client.isReady&&!this.client.isReady())}_getRateLimiterRes(e,t,r){let[n,o]=r;Array.isArray(n)&&([,n]=n,[,o]=o);const s=new i;return s.consumedPoints=parseInt(n),s.isFirstInDuration=s.consumedPoints===t,s.remainingPoints=Math.max(this.points-s.consumedPoints,0),s.msBeforeNext=o,s}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return new Promise(((i,s)=>{if(!this._isRedisReady())return s(new Error("Redis connection is not ready"));const a=Math.floor(r/1e3),c=this.client.multi();if(n)a>0?c.set(e,t,"EX",a):c.set(e,t),c.pttl(e).exec(((e,t)=>e?s(e):i(t)));else if(a>0){const r=function(e,t){return e?s(e):i(t)};"function"===typeof this.client.rlflxIncr?this.client.rlflxIncr(e,t,a,r):this.client.eval(o,1,e,t,a,r)}else c.incrby(e,t).pttl(e).exec(((e,t)=>e?s(e):i(t)))}))}_get(e){return new Promise(((t,r)=>{if(!this._isRedisReady())return r(new Error("Redis connection is not ready"));this.client.multi().get(e).pttl(e).exec(((e,n)=>{if(e)r(e);else{const[e]=n;if(null===e)return t(null);t(n)}}))}))}_delete(e){return new Promise(((t,r)=>{this.client.del(e,((e,n)=>{e?r(e):t(n>0)}))}))}}},38:e=>{e.exports=class{constructor(e,t,r,n){this.remainingPoints="undefined"===typeof e?0:e,this.msBeforeNext="undefined"===typeof t?0:t,this.consumedPoints="undefined"===typeof r?0:r,this.isFirstInDuration="undefined"!==typeof n&&n}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(e){return this._msBeforeNext=e,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(e){return this._remainingPoints=e,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(e){return this._consumedPoints=e,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(e){this._isFirstInDuration=Boolean(e)}_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()}}},7855:(e,t,r)=>{const n=r(7276),i=r(4435),o=r(38);e.exports=class extends n{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),this.inMemoryBlockOnConsumed=e.inMemoryBlockOnConsumed||e.inmemoryBlockOnConsumed,this.inMemoryBlockDuration=e.inMemoryBlockDuration||e.inmemoryBlockDuration,this.insuranceLimiter=e.insuranceLimiter,this._inMemoryBlockedKeys=new i}get client(){return this._client}set client(e){if("undefined"===typeof e)throw new Error("storeClient is not set");this._client=e}_afterConsume(e,t,r,n,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const s=this._getRateLimiterRes(r,n,i);if(this.inMemoryBlockOnConsumed>0&&!(this.inMemoryBlockDuration>0)&&s.consumedPoints>=this.inMemoryBlockOnConsumed)return this._inMemoryBlockedKeys.addMs(r,s.msBeforeNext),s.consumedPoints>this.points?t(s):e(s);if(s.consumedPoints>this.points){let e=Promise.resolve();this.blockDuration>0&&s.consumedPoints<=this.points+n&&(s.msBeforeNext=this.msBlockDuration,e=this._block(r,s.consumedPoints,this.msBlockDuration,o)),this.inMemoryBlockOnConsumed>0&&s.consumedPoints>=this.inMemoryBlockOnConsumed&&(this._inMemoryBlockedKeys.add(r,this.inMemoryBlockDuration),s.msBeforeNext=this.msInMemoryBlockDuration),e.then((()=>{t(s)})).catch((e=>{t(e)}))}else if(this.execEvenly&&s.msBeforeNext>0&&!s.isFirstInDuration){let t=Math.ceil(s.msBeforeNext/(s.remainingPoints+2));t<this.execEvenlyMinDelayMs&&(t=s.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(e,t,s)}else e(s)}_handleError(e,t,r,i,o){let s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{};this.insuranceLimiter instanceof n?this.insuranceLimiter[t](o,s,a).then((e=>{r(e)})).catch((e=>{i(e)})):i(e)}get _inmemoryBlockedKeys(){return this._inMemoryBlockedKeys}getInmemoryBlockMsBeforeExpire(e){return this.getInMemoryBlockMsBeforeExpire(e)}get inmemoryBlockOnConsumed(){return this.inMemoryBlockOnConsumed}set inmemoryBlockOnConsumed(e){this.inMemoryBlockOnConsumed=e}get inmemoryBlockDuration(){return this.inMemoryBlockDuration}set inmemoryBlockDuration(e){this.inMemoryBlockDuration=e}get msInmemoryBlockDuration(){return 1e3*this.inMemoryBlockDuration}getInMemoryBlockMsBeforeExpire(e){return this.inMemoryBlockOnConsumed>0?this._inMemoryBlockedKeys.msBeforeExpire(e):0}get inMemoryBlockOnConsumed(){return this._inMemoryBlockOnConsumed}set inMemoryBlockOnConsumed(e){if(this._inMemoryBlockOnConsumed=e?parseInt(e):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(e){if(this._inMemoryBlockDuration=e?parseInt(e):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(e){if("undefined"!==typeof e&&!(e instanceof n))throw new Error("insuranceLimiter must be instance of RateLimiterAbstract");this._insuranceLimiter=e,this._insuranceLimiter&&(this._insuranceLimiter.blockDuration=this.blockDuration,this._insuranceLimiter.execEvenly=this.execEvenly)}block(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=1e3*t;return this._block(this.getKey(e),this.points+1,n,r)}set(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=1e3*(r>=0?r:this.duration);return this._block(this.getKey(e),t,i,n)}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const s=this.getKey(e),a=this.getInMemoryBlockMsBeforeExpire(s);if(a>0)return i(new o(0,a));this._upsert(s,t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{this._afterConsume(n,i,s,t,e)})).catch((o=>{this._handleError(o,"consume",n,i,e,t,r)}))}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise(((i,o)=>{this._upsert(n,t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{i(this._getRateLimiterRes(n,t,e))})).catch((n=>{this._handleError(n,"penalty",i,o,e,t,r)}))}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise(((i,o)=>{this._upsert(n,-t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{i(this._getRateLimiterRes(n,-t,e))})).catch((n=>{this._handleError(n,"reward",i,o,e,t,r)}))}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.getKey(e);return new Promise(((n,i)=>{this._get(r,t).then((e=>{n(null===e||"undefined"===typeof e?null:this._getRateLimiterRes(r,0,e))})).catch((r=>{this._handleError(r,"get",n,i,e,t)}))}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.getKey(e);return new Promise(((n,i)=>{this._delete(r,t).then((e=>{this._inMemoryBlockedKeys.delete(r),n(e)})).catch((r=>{this._handleError(r,"delete",n,i,e,t)}))}))}deleteInMemoryBlockedAll(){this._inMemoryBlockedKeys.delete()}_getRateLimiterRes(e,t,r){throw new Error("You have to implement the method '_getRateLimiterRes'!")}_block(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((i,s)=>{this._upsert(e,t,r,!0,n).then((()=>{i(new o(0,r>0?r:-1,t))})).catch((t=>{this._handleError(t,"block",i,s,this.parseKey(e),r/1e3,n)}))}))}_get(e){throw new Error("You have to implement the method '_get'!")}_delete(e){throw new Error("You have to implement the method '_delete'!")}_upsert(e,t,r){throw new Error("You have to implement the method '_upsert'!")}}},3007:(e,t,r)=>{const n=r(7276);e.exports=class{constructor(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length<1)throw new Error("RateLimiterUnion: at least one limiter have to be passed");t.forEach((e=>{if(!(e instanceof n))throw new Error("RateLimiterUnion: all limiters have to be instance of RateLimiterAbstract")})),this._limiters=t}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise(((r,n)=>{const i=[];this._limiters.forEach((r=>{i.push(r.consume(e,t).catch((e=>({rejected:!0,rej:e}))))})),Promise.all(i).then((e=>{const t={};let i=!1;e.forEach((e=>{!0===e.rejected&&(i=!0)}));for(let r=0;r<e.length;r++)i&&!0===e[r].rejected?t[this._limiters[r].keyPrefix]=e[r].rej:i||(t[this._limiters[r].keyPrefix]=e[r]);i?n(t):r(t)}))}))}}},6003:e=>{e.exports=class{constructor(){this._keys={},this._addedKeysAmount=0}collectExpired(){const e=Date.now();Object.keys(this._keys).forEach((t=>{this._keys[t]<=e&&delete this._keys[t]})),this._addedKeysAmount=Object.keys(this._keys).length}add(e,t){this.addMs(e,1e3*t)}addMs(e,t){this._keys[e]=Date.now()+t,this._addedKeysAmount++,this._addedKeysAmount>999&&this.collectExpired()}msBeforeExpire(e){const t=this._keys[e];if(t&&t>=Date.now()){this.collectExpired();const e=Date.now();return t>=e?t-e:0}return 0}delete(e){e?delete this._keys[e]:Object.keys(this._keys).forEach((e=>{delete this._keys[e]}))}}},4435:(e,t,r)=>{const n=r(6003);e.exports=n},4615:(e,t,r)=>{const n=r(8654),i=r(38);e.exports=class{constructor(){this._storage={}}incrby(e,t,r){if(this._storage[e]){const n=this._storage[e].expiresAt?this._storage[e].expiresAt.getTime()-(new Date).getTime():-1;return 0!==n?(this._storage[e].value=this._storage[e].value+t,new i(0,n,this._storage[e].value,!1)):this.set(e,t,r)}return this.set(e,t,r)}set(e,t,r){const o=1e3*r;return this._storage[e]&&this._storage[e].timeoutId&&clearTimeout(this._storage[e].timeoutId),this._storage[e]=new n(t,o>0?new Date(Date.now()+o):null),o>0&&(this._storage[e].timeoutId=setTimeout((()=>{delete this._storage[e]}),o),this._storage[e].timeoutId.unref&&this._storage[e].timeoutId.unref()),new i(0,0===o?-1:o,this._storage[e].value,!0)}get(e){if(this._storage[e]){const t=this._storage[e].expiresAt?this._storage[e].expiresAt.getTime()-(new Date).getTime():-1;return new i(0,t,this._storage[e].value,!1)}return null}delete(e){return!!this._storage[e]&&(this._storage[e].timeoutId&&clearTimeout(this._storage[e].timeoutId),delete this._storage[e],!0)}}},8654:e=>{e.exports=class{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.value=e,this.expiresAt=t,this.timeoutId=r}get value(){return this._value}set value(e){this._value=parseInt(e)}get expiresAt(){return this._expiresAt}set expiresAt(e){e instanceof Date||!Number.isInteger(e)||(e=new Date(e)),this._expiresAt=e}get timeoutId(){return this._timeoutId}set timeoutId(e){this._timeoutId=e}}},1541:e=>{e.exports=class extends Error{constructor(e,t){super(),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="CustomError",this.message=e,t&&(this.extra=t)}}},8345:(e,t,r)=>{"use strict";var n=r(9950),i=r(5340);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function c(e,t){l(e,t),l(e+"Capture",t)}function l(e,t){for(a[e]=t,e=0;e<t.length;e++)s.add(t[e])}var u=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),h=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},p={};function g(e,t,r,n,i,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){y[e]=new g(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];y[t]=new g(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){y[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){y[e]=new g(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){y[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){y[e]=new g(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){y[e]=new g(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){y[e]=new g(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){y[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)}));var m=/[\-:]([a-z])/g;function v(e){return e[1].toUpperCase()}function b(e,t,r,n){var i=y.hasOwnProperty(t)?y[t]:null;(null!==i?0!==i.type:n||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,r,n){if(null===t||"undefined"===typeof t||function(e,t,r,n){if(null!==r&&0===r.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==r?!r.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,r,n))return!0;if(n)return!1;if(null!==r)switch(r.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,r,i,n)&&(r=null),n||null===i?function(e){return!!h.call(p,e)||!h.call(f,e)&&(d.test(e)?p[e]=!0:(f[e]=!0,!1))}(t)&&(null===r?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=null===r?3!==i.type&&"":r:(t=i.attributeName,n=i.attributeNamespace,null===r?e.removeAttribute(t):(r=3===(i=i.type)||4===i&&!0===r?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(m,v);y[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(m,v);y[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(m,v);y[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){y[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),y.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){y[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var w=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),C=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),D=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var N=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var O=Symbol.iterator;function L(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=O&&e[O]||e["@@iterator"])?e:null}var B,M=Object.assign;function U(e){if(void 0===B)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);B=t&&t[1]||""}return"\n"+B+e}var F=!1;function j(e,t){if(!e||F)return"";F=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(l){var n=l}Reflect.construct(e,[],t)}else{try{t.call()}catch(l){n=l}e.call(t.prototype)}else{try{throw Error()}catch(l){n=l}e()}}catch(l){if(l&&n&&"string"===typeof l.stack){for(var i=l.stack.split("\n"),o=n.stack.split("\n"),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||i[s]!==o[a]){var c="\n"+i[s].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=s&&0<=a);break}}}finally{F=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?U(e):""}function z(e){switch(e.tag){case 5:return U(e.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return e=j(e.type,!1);case 11:return e=j(e.type.render,!1);case 1:return e=j(e.type,!0);default:return""}}function q(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case S:return"Fragment";case _:return"Portal";case k:return"Profiler";case A:return"StrictMode";case T:return"Suspense";case x:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case C:return(e.displayName||"Context")+".Consumer";case I:return(e._context.displayName||"Context")+".Provider";case R:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case P:return null!==(t=e.displayName||null)?t:q(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return q(e(t))}catch(r){}}return null}function K(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return q(t);case 8:return t===A?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t}return null}function V(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function H(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function W(e){e._valueTracker||(e._valueTracker=function(e){var t=H(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof r&&"function"===typeof r.get&&"function"===typeof r.set){var i=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function G(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=H(e)?e.checked?"true":"false":e.value),(e=n)!==r&&(t.setValue(e),!0)}function Y(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Q(e,t){var r=t.checked;return M({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=r?r:e._wrapperState.initialChecked})}function X(e,t){var r=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;r=V(null!=t.value?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function J(e,t){null!=(t=t.checked)&&b(e,"checked",t,!1)}function $(e,t){J(e,t);var r=V(t.value),n=t.type;if(null!=r)"number"===n?(0===r&&""===e.value||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if("submit"===n||"reset"===n)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,r):t.hasOwnProperty("defaultValue")&&ee(e,t.type,V(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Z(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!("submit"!==n&&"reset"!==n||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}""!==(r=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==r&&(e.name=r)}function ee(e,t,r){"number"===t&&Y(e.ownerDocument)===e||(null==r?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var te=Array.isArray;function re(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+V(r),t=null,i=0;i<e.length;i++){if(e[i].value===r)return e[i].selected=!0,void(n&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function ne(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return M({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ie(e,t){var r=t.value;if(null==r){if(r=t.children,t=t.defaultValue,null!=r){if(null!=t)throw Error(o(92));if(te(r)){if(1<r.length)throw Error(o(93));r=r[0]}t=r}null==t&&(t=""),r=t}e._wrapperState={initialValue:V(r)}}function oe(e,t){var r=V(t.value),n=V(t.defaultValue);null!=r&&((r=""+r)!==e.value&&(e.value=r),null==t.defaultValue&&e.defaultValue!==r&&(e.defaultValue=r)),null!=n&&(e.defaultValue=""+n)}function se(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function ae(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ae(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var le,ue,he=(ue=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((le=le||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,r,n){MSApp.execUnsafeLocalFunction((function(){return ue(e,t)}))}:ue);function de(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&3===r.nodeType)return void(r.nodeValue=t)}e.textContent=t}var fe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pe=["Webkit","ms","Moz","O"];function ge(e,t,r){return null==t||"boolean"===typeof t||""===t?"":r||"number"!==typeof t||0===t||fe.hasOwnProperty(e)&&fe[e]?(""+t).trim():t+"px"}function ye(e,t){for(var r in e=e.style,t)if(t.hasOwnProperty(r)){var n=0===r.indexOf("--"),i=ge(r,t[r],n);"float"===r&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}Object.keys(fe).forEach((function(e){pe.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fe[t]=fe[e]}))}));var me=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ve(e,t){if(t){if(me[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(o(62))}}function be(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var we=null;function Ee(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var _e=null,Se=null,Ae=null;function ke(e){if(e=bi(e)){if("function"!==typeof _e)throw Error(o(280));var t=e.stateNode;t&&(t=Ei(t),_e(e.stateNode,e.type,t))}}function Ie(e){Se?Ae?Ae.push(e):Ae=[e]:Se=e}function Ce(){if(Se){var e=Se,t=Ae;if(Ae=Se=null,ke(e),t)for(e=0;e<t.length;e++)ke(t[e])}}function Re(e,t){return e(t)}function Te(){}var xe=!1;function Pe(e,t,r){if(xe)return e(t,r);xe=!0;try{return Re(e,t,r)}finally{xe=!1,(null!==Se||null!==Ae)&&(Te(),Ce())}}function De(e,t){var r=e.stateNode;if(null===r)return null;var n=Ei(r);if(null===n)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(r&&"function"!==typeof r)throw Error(o(231,t,typeof r));return r}var Ne=!1;if(u)try{var Oe={};Object.defineProperty(Oe,"passive",{get:function(){Ne=!0}}),window.addEventListener("test",Oe,Oe),window.removeEventListener("test",Oe,Oe)}catch(ue){Ne=!1}function Le(e,t,r,n,i,o,s,a,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(r,l)}catch(u){this.onError(u)}}var Be=!1,Me=null,Ue=!1,Fe=null,je={onError:function(e){Be=!0,Me=e}};function ze(e,t,r,n,i,o,s,a,c){Be=!1,Me=null,Le.apply(je,arguments)}function qe(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(r=t.return),e=t.return}while(e)}return 3===t.tag?r:null}function Ke(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ve(e){if(qe(e)!==e)throw Error(o(188))}function He(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=qe(e)))throw Error(o(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(n=i.return)){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return Ve(i),e;if(s===n)return Ve(i),t;s=s.sibling}throw Error(o(188))}if(r.return!==n.return)r=i,n=s;else{for(var a=!1,c=i.child;c;){if(c===r){a=!0,r=i,n=s;break}if(c===n){a=!0,n=i,r=s;break}c=c.sibling}if(!a){for(c=s.child;c;){if(c===r){a=!0,r=s,n=i;break}if(c===n){a=!0,n=s,r=i;break}c=c.sibling}if(!a)throw Error(o(189))}}if(r.alternate!==n)throw Error(o(190))}if(3!==r.tag)throw Error(o(188));return r.stateNode.current===r?e:t}(e))?We(e):null}function We(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=We(e);if(null!==t)return t;e=e.sibling}return null}var Ge=i.unstable_scheduleCallback,Ye=i.unstable_cancelCallback,Qe=i.unstable_shouldYield,Xe=i.unstable_requestPaint,Je=i.unstable_now,$e=i.unstable_getCurrentPriorityLevel,Ze=i.unstable_ImmediatePriority,et=i.unstable_UserBlockingPriority,tt=i.unstable_NormalPriority,rt=i.unstable_LowPriority,nt=i.unstable_IdlePriority,it=null,ot=null;var st=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(at(e)/ct|0)|0},at=Math.log,ct=Math.LN2;var lt=64,ut=4194304;function ht(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function dt(e,t){var r=e.pendingLanes;if(0===r)return 0;var n=0,i=e.suspendedLanes,o=e.pingedLanes,s=268435455&r;if(0!==s){var a=s&~i;0!==a?n=ht(a):0!==(o&=s)&&(n=ht(o))}else 0!==(s=r&~i)?n=ht(s):0!==o&&(n=ht(o));if(0===n)return 0;if(0!==t&&t!==n&&0===(t&i)&&((i=n&-n)>=(o=t&-t)||16===i&&0!==(4194240&o)))return t;if(0!==(4&n)&&(n|=16&r),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=n;0<t;)i=1<<(r=31-st(t)),n|=e[r],t&=~i;return n}function ft(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function pt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function gt(){var e=lt;return 0===(4194240&(lt<<=1))&&(lt=64),e}function yt(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function mt(e,t,r){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-st(t)]=r}function vt(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-st(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var bt=0;function wt(e){return 1<(e&=-e)?4<e?0!==(268435455&e)?16:536870912:4:1}var Et,_t,St,At,kt,It=!1,Ct=[],Rt=null,Tt=null,xt=null,Pt=new Map,Dt=new Map,Nt=[],Ot="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Lt(e,t){switch(e){case"focusin":case"focusout":Rt=null;break;case"dragenter":case"dragleave":Tt=null;break;case"mouseover":case"mouseout":xt=null;break;case"pointerover":case"pointerout":Pt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dt.delete(t.pointerId)}}function Bt(e,t,r,n,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:o,targetContainers:[i]},null!==t&&(null!==(t=bi(t))&&_t(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Mt(e){var t=vi(e.target);if(null!==t){var r=qe(t);if(null!==r)if(13===(t=r.tag)){if(null!==(t=Ke(r)))return e.blockedOn=t,void kt(e.priority,(function(){St(r)}))}else if(3===t&&r.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===r.tag?r.stateNode.containerInfo:null)}e.blockedOn=null}function Ut(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var r=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==r)return null!==(t=bi(r))&&_t(t),e.blockedOn=r,!1;var n=new(r=e.nativeEvent).constructor(r.type,r);we=n,r.target.dispatchEvent(n),we=null,t.shift()}return!0}function Ft(e,t,r){Ut(e)&&r.delete(t)}function jt(){It=!1,null!==Rt&&Ut(Rt)&&(Rt=null),null!==Tt&&Ut(Tt)&&(Tt=null),null!==xt&&Ut(xt)&&(xt=null),Pt.forEach(Ft),Dt.forEach(Ft)}function zt(e,t){e.blockedOn===t&&(e.blockedOn=null,It||(It=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,jt)))}function qt(e){function t(t){return zt(t,e)}if(0<Ct.length){zt(Ct[0],e);for(var r=1;r<Ct.length;r++){var n=Ct[r];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==Rt&&zt(Rt,e),null!==Tt&&zt(Tt,e),null!==xt&&zt(xt,e),Pt.forEach(t),Dt.forEach(t),r=0;r<Nt.length;r++)(n=Nt[r]).blockedOn===e&&(n.blockedOn=null);for(;0<Nt.length&&null===(r=Nt[0]).blockedOn;)Mt(r),null===r.blockedOn&&Nt.shift()}var Kt=w.ReactCurrentBatchConfig,Vt=!0;function Ht(e,t,r,n){var i=bt,o=Kt.transition;Kt.transition=null;try{bt=1,Gt(e,t,r,n)}finally{bt=i,Kt.transition=o}}function Wt(e,t,r,n){var i=bt,o=Kt.transition;Kt.transition=null;try{bt=4,Gt(e,t,r,n)}finally{bt=i,Kt.transition=o}}function Gt(e,t,r,n){if(Vt){var i=Qt(e,t,r,n);if(null===i)Vn(e,t,n,Yt,r),Lt(e,n);else if(function(e,t,r,n,i){switch(t){case"focusin":return Rt=Bt(Rt,e,t,r,n,i),!0;case"dragenter":return Tt=Bt(Tt,e,t,r,n,i),!0;case"mouseover":return xt=Bt(xt,e,t,r,n,i),!0;case"pointerover":var o=i.pointerId;return Pt.set(o,Bt(Pt.get(o)||null,e,t,r,n,i)),!0;case"gotpointercapture":return o=i.pointerId,Dt.set(o,Bt(Dt.get(o)||null,e,t,r,n,i)),!0}return!1}(i,e,t,r,n))n.stopPropagation();else if(Lt(e,n),4&t&&-1<Ot.indexOf(e)){for(;null!==i;){var o=bi(i);if(null!==o&&Et(o),null===(o=Qt(e,t,r,n))&&Vn(e,t,n,Yt,r),o===i)break;i=o}null!==i&&n.stopPropagation()}else Vn(e,t,n,null,r)}}var Yt=null;function Qt(e,t,r,n){if(Yt=null,null!==(e=vi(e=Ee(n))))if(null===(t=qe(e)))e=null;else if(13===(r=t.tag)){if(null!==(e=Ke(t)))return e;e=null}else if(3===r){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yt=e,null}function Xt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch($e()){case Ze:return 1;case et:return 4;case tt:case rt:return 16;case nt:return 536870912;default:return 16}default:return 16}}var Jt=null,$t=null,Zt=null;function er(){if(Zt)return Zt;var e,t,r=$t,n=r.length,i="value"in Jt?Jt.value:Jt.textContent,o=i.length;for(e=0;e<n&&r[e]===i[e];e++);var s=n-e;for(t=1;t<=s&&r[n-t]===i[o-t];t++);return Zt=i.slice(e,1<t?1-t:void 0)}function tr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function rr(){return!0}function nr(){return!1}function ir(e){function t(t,r,n,i,o){for(var s in this._reactName=t,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(i):i[s]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?rr:nr,this.isPropagationStopped=nr,this}return M(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=rr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=rr)},persist:function(){},isPersistent:rr}),t}var or,sr,ar,cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lr=ir(cr),ur=M({},cr,{view:0,detail:0}),hr=ir(ur),dr=M({},ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ar,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ar&&(ar&&"mousemove"===e.type?(or=e.screenX-ar.screenX,sr=e.screenY-ar.screenY):sr=or=0,ar=e),or)},movementY:function(e){return"movementY"in e?e.movementY:sr}}),fr=ir(dr),pr=ir(M({},dr,{dataTransfer:0})),gr=ir(M({},ur,{relatedTarget:0})),yr=ir(M({},cr,{animationName:0,elapsedTime:0,pseudoElement:0})),mr=M({},cr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vr=ir(mr),br=ir(M({},cr,{data:0})),wr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Er={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},_r={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=_r[e])&&!!t[e]}function Ar(){return Sr}var kr=M({},ur,{key:function(e){if(e.key){var t=wr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Er[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ar,charCode:function(e){return"keypress"===e.type?tr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Ir=ir(kr),Cr=ir(M({},dr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rr=ir(M({},ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ar})),Tr=ir(M({},cr,{propertyName:0,elapsedTime:0,pseudoElement:0})),xr=M({},dr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Pr=ir(xr),Dr=[9,13,27,32],Nr=u&&"CompositionEvent"in window,Or=null;u&&"documentMode"in document&&(Or=document.documentMode);var Lr=u&&"TextEvent"in window&&!Or,Br=u&&(!Nr||Or&&8<Or&&11>=Or),Mr=String.fromCharCode(32),Ur=!1;function Fr(e,t){switch(e){case"keyup":return-1!==Dr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jr(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var zr=!1;var qr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Kr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!qr[e.type]:"textarea"===t}function Vr(e,t,r,n){Ie(n),0<(t=Wn(t,"onChange")).length&&(r=new lr("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Hr=null,Wr=null;function Gr(e){Un(e,0)}function Yr(e){if(G(wi(e)))return e}function Qr(e,t){if("change"===e)return t}var Xr=!1;if(u){var Jr;if(u){var $r="oninput"in document;if(!$r){var Zr=document.createElement("div");Zr.setAttribute("oninput","return;"),$r="function"===typeof Zr.oninput}Jr=$r}else Jr=!1;Xr=Jr&&(!document.documentMode||9<document.documentMode)}function en(){Hr&&(Hr.detachEvent("onpropertychange",tn),Wr=Hr=null)}function tn(e){if("value"===e.propertyName&&Yr(Wr)){var t=[];Vr(t,Wr,e,Ee(e)),Pe(Gr,t)}}function rn(e,t,r){"focusin"===e?(en(),Wr=r,(Hr=t).attachEvent("onpropertychange",tn)):"focusout"===e&&en()}function nn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Yr(Wr)}function on(e,t){if("click"===e)return Yr(t)}function sn(e,t){if("input"===e||"change"===e)return Yr(t)}var an="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t};function cn(e,t){if(an(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!h.call(t,i)||!an(e[i],t[i]))return!1}return!0}function ln(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function un(e,t){var r,n=ln(e);for(e=0;n;){if(3===n.nodeType){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ln(n)}}function hn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?hn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function dn(){for(var e=window,t=Y();t instanceof e.HTMLIFrameElement;){try{var r="string"===typeof t.contentWindow.location.href}catch(n){r=!1}if(!r)break;t=Y((e=t.contentWindow).document)}return t}function fn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function pn(e){var t=dn(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&hn(r.ownerDocument.documentElement,r)){if(null!==n&&fn(r))if(t=n.start,void 0===(e=n.end)&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if((e=(t=r.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=void 0===n.end?o:Math.min(n.end,i),!e.extend&&o>n&&(i=n,n=o,o=i),i=un(r,o);var s=un(r,n);i&&s&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),o>n?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}for(t=[],e=r;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"===typeof r.focus&&r.focus(),r=0;r<t.length;r++)(e=t[r]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var gn=u&&"documentMode"in document&&11>=document.documentMode,yn=null,mn=null,vn=null,bn=!1;function wn(e,t,r){var n=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;bn||null==yn||yn!==Y(n)||("selectionStart"in(n=yn)&&fn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},vn&&cn(vn,n)||(vn=n,0<(n=Wn(mn,"onSelect")).length&&(t=new lr("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=yn)))}function En(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var _n={animationend:En("Animation","AnimationEnd"),animationiteration:En("Animation","AnimationIteration"),animationstart:En("Animation","AnimationStart"),transitionend:En("Transition","TransitionEnd")},Sn={},An={};function kn(e){if(Sn[e])return Sn[e];if(!_n[e])return e;var t,r=_n[e];for(t in r)if(r.hasOwnProperty(t)&&t in An)return Sn[e]=r[t];return e}u&&(An=document.createElement("div").style,"AnimationEvent"in window||(delete _n.animationend.animation,delete _n.animationiteration.animation,delete _n.animationstart.animation),"TransitionEvent"in window||delete _n.transitionend.transition);var In=kn("animationend"),Cn=kn("animationiteration"),Rn=kn("animationstart"),Tn=kn("transitionend"),xn=new Map,Pn="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Dn(e,t){xn.set(e,t),c(t,[e])}for(var Nn=0;Nn<Pn.length;Nn++){var On=Pn[Nn];Dn(On.toLowerCase(),"on"+(On[0].toUpperCase()+On.slice(1)))}Dn(In,"onAnimationEnd"),Dn(Cn,"onAnimationIteration"),Dn(Rn,"onAnimationStart"),Dn("dblclick","onDoubleClick"),Dn("focusin","onFocus"),Dn("focusout","onBlur"),Dn(Tn,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ln="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Bn=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ln));function Mn(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,function(e,t,r,n,i,s,a,c,l){if(ze.apply(this,arguments),Be){if(!Be)throw Error(o(198));var u=Me;Be=!1,Me=null,Ue||(Ue=!0,Fe=u)}}(n,t,void 0,e),e.currentTarget=null}function Un(e,t){t=0!==(4&t);for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var s=n.length-1;0<=s;s--){var a=n[s],c=a.instance,l=a.currentTarget;if(a=a.listener,c!==o&&i.isPropagationStopped())break e;Mn(i,a,l),o=c}else for(s=0;s<n.length;s++){if(c=(a=n[s]).instance,l=a.currentTarget,a=a.listener,c!==o&&i.isPropagationStopped())break e;Mn(i,a,l),o=c}}}if(Ue)throw e=Fe,Ue=!1,Fe=null,e}function Fn(e,t){var r=t[gi];void 0===r&&(r=t[gi]=new Set);var n=e+"__bubble";r.has(n)||(Kn(t,e,2,!1),r.add(n))}function jn(e,t,r){var n=0;t&&(n|=4),Kn(r,e,n,t)}var zn="_reactListening"+Math.random().toString(36).slice(2);function qn(e){if(!e[zn]){e[zn]=!0,s.forEach((function(t){"selectionchange"!==t&&(Bn.has(t)||jn(t,!1,e),jn(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[zn]||(t[zn]=!0,jn("selectionchange",!1,t))}}function Kn(e,t,r,n){switch(Xt(t)){case 1:var i=Ht;break;case 4:i=Wt;break;default:i=Gt}r=i.bind(null,t,r,e),i=void 0,!Ne||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),n?void 0!==i?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):void 0!==i?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function Vn(e,t,r,n,i){var o=n;if(0===(1&t)&&0===(2&t)&&null!==n)e:for(;;){if(null===n)return;var s=n.tag;if(3===s||4===s){var a=n.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===s)for(s=n.return;null!==s;){var c=s.tag;if((3===c||4===c)&&((c=s.stateNode.containerInfo)===i||8===c.nodeType&&c.parentNode===i))return;s=s.return}for(;null!==a;){if(null===(s=vi(a)))return;if(5===(c=s.tag)||6===c){n=o=s;continue e}a=a.parentNode}}n=n.return}Pe((function(){var n=o,i=Ee(r),s=[];e:{var a=xn.get(e);if(void 0!==a){var c=lr,l=e;switch(e){case"keypress":if(0===tr(r))break e;case"keydown":case"keyup":c=Ir;break;case"focusin":l="focus",c=gr;break;case"focusout":l="blur",c=gr;break;case"beforeblur":case"afterblur":c=gr;break;case"click":if(2===r.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=fr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=pr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Rr;break;case In:case Cn:case Rn:c=yr;break;case Tn:c=Tr;break;case"scroll":c=hr;break;case"wheel":c=Pr;break;case"copy":case"cut":case"paste":c=vr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Cr}var u=0!==(4&t),h=!u&&"scroll"===e,d=u?null!==a?a+"Capture":null:a;u=[];for(var f,p=n;null!==p;){var g=(f=p).stateNode;if(5===f.tag&&null!==g&&(f=g,null!==d&&(null!=(g=De(p,d))&&u.push(Hn(p,g,f)))),h)break;p=p.return}0<u.length&&(a=new c(a,l,null,r,i),s.push({event:a,listeners:u}))}}if(0===(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||r===we||!(l=r.relatedTarget||r.fromElement)||!vi(l)&&!l[pi])&&(c||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,c?(c=n,null!==(l=(l=r.relatedTarget||r.toElement)?vi(l):null)&&(l!==(h=qe(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=n),c!==l)){if(u=fr,g="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=Cr,g="onPointerLeave",d="onPointerEnter",p="pointer"),h=null==c?a:wi(c),f=null==l?a:wi(l),(a=new u(g,p+"leave",c,r,i)).target=h,a.relatedTarget=f,g=null,vi(i)===n&&((u=new u(d,p+"enter",l,r,i)).target=f,u.relatedTarget=h,g=u),h=g,c&&l)e:{for(d=l,p=0,f=u=c;f;f=Gn(f))p++;for(f=0,g=d;g;g=Gn(g))f++;for(;0<p-f;)u=Gn(u),p--;for(;0<f-p;)d=Gn(d),f--;for(;p--;){if(u===d||null!==d&&u===d.alternate)break e;u=Gn(u),d=Gn(d)}u=null}else u=null;null!==c&&Yn(s,a,c,u,!1),null!==l&&null!==h&&Yn(s,h,l,u,!0)}if("select"===(c=(a=n?wi(n):window).nodeName&&a.nodeName.toLowerCase())||"input"===c&&"file"===a.type)var y=Qr;else if(Kr(a))if(Xr)y=sn;else{y=nn;var m=rn}else(c=a.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(y=on);switch(y&&(y=y(e,n))?Vr(s,y,r,i):(m&&m(e,a,n),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&ee(a,"number",a.value)),m=n?wi(n):window,e){case"focusin":(Kr(m)||"true"===m.contentEditable)&&(yn=m,mn=n,vn=null);break;case"focusout":vn=mn=yn=null;break;case"mousedown":bn=!0;break;case"contextmenu":case"mouseup":case"dragend":bn=!1,wn(s,r,i);break;case"selectionchange":if(gn)break;case"keydown":case"keyup":wn(s,r,i)}var v;if(Nr)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else zr?Fr(e,r)&&(b="onCompositionEnd"):"keydown"===e&&229===r.keyCode&&(b="onCompositionStart");b&&(Br&&"ko"!==r.locale&&(zr||"onCompositionStart"!==b?"onCompositionEnd"===b&&zr&&(v=er()):($t="value"in(Jt=i)?Jt.value:Jt.textContent,zr=!0)),0<(m=Wn(n,b)).length&&(b=new br(b,e,null,r,i),s.push({event:b,listeners:m}),v?b.data=v:null!==(v=jr(r))&&(b.data=v))),(v=Lr?function(e,t){switch(e){case"compositionend":return jr(t);case"keypress":return 32!==t.which?null:(Ur=!0,Mr);case"textInput":return(e=t.data)===Mr&&Ur?null:e;default:return null}}(e,r):function(e,t){if(zr)return"compositionend"===e||!Nr&&Fr(e,t)?(e=er(),Zt=$t=Jt=null,zr=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Br&&"ko"!==t.locale?null:t.data}}(e,r))&&(0<(n=Wn(n,"onBeforeInput")).length&&(i=new br("onBeforeInput","beforeinput",null,r,i),s.push({event:i,listeners:n}),i.data=v))}Un(s,t)}))}function Hn(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Wn(e,t){for(var r=t+"Capture",n=[];null!==e;){var i=e,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=De(e,r))&&n.unshift(Hn(e,o,i)),null!=(o=De(e,t))&&n.push(Hn(e,o,i))),e=e.return}return n}function Gn(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Yn(e,t,r,n,i){for(var o=t._reactName,s=[];null!==r&&r!==n;){var a=r,c=a.alternate,l=a.stateNode;if(null!==c&&c===n)break;5===a.tag&&null!==l&&(a=l,i?null!=(c=De(r,o))&&s.unshift(Hn(r,c,a)):i||null!=(c=De(r,o))&&s.push(Hn(r,c,a))),r=r.return}0!==s.length&&e.push({event:t,listeners:s})}var Qn=/\r\n?/g,Xn=/\u0000|\uFFFD/g;function Jn(e){return("string"===typeof e?e:""+e).replace(Qn,"\n").replace(Xn,"")}function $n(e,t,r){if(t=Jn(t),Jn(e)!==t&&r)throw Error(o(425))}function Zn(){}var ei=null,ti=null;function ri(e,t){return"textarea"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ni="function"===typeof setTimeout?setTimeout:void 0,ii="function"===typeof clearTimeout?clearTimeout:void 0,oi="function"===typeof Promise?Promise:void 0,si="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof oi?function(e){return oi.resolve(null).then(e).catch(ai)}:ni;function ai(e){setTimeout((function(){throw e}))}function ci(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&8===i.nodeType)if("/$"===(r=i.data)){if(0===n)return e.removeChild(i),void qt(t);n--}else"$"!==r&&"$?"!==r&&"$!"!==r||n++;r=i}while(r);qt(t)}function li(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function ui(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var r=e.data;if("$"===r||"$!"===r||"$?"===r){if(0===t)return e;t--}else"/$"===r&&t++}e=e.previousSibling}return null}var hi=Math.random().toString(36).slice(2),di="__reactFiber$"+hi,fi="__reactProps$"+hi,pi="__reactContainer$"+hi,gi="__reactEvents$"+hi,yi="__reactListeners$"+hi,mi="__reactHandles$"+hi;function vi(e){var t=e[di];if(t)return t;for(var r=e.parentNode;r;){if(t=r[pi]||r[di]){if(r=t.alternate,null!==t.child||null!==r&&null!==r.child)for(e=ui(e);null!==e;){if(r=e[di])return r;e=ui(e)}return t}r=(e=r).parentNode}return null}function bi(e){return!(e=e[di]||e[pi])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function wi(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(o(33))}function Ei(e){return e[fi]||null}var _i=[],Si=-1;function Ai(e){return{current:e}}function ki(e){0>Si||(e.current=_i[Si],_i[Si]=null,Si--)}function Ii(e,t){Si++,_i[Si]=e.current,e.current=t}var Ci={},Ri=Ai(Ci),Ti=Ai(!1),xi=Ci;function Pi(e,t){var r=e.type.contextTypes;if(!r)return Ci;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in r)o[i]=t[i];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Di(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Ni(){ki(Ti),ki(Ri)}function Oi(e,t,r){if(Ri.current!==Ci)throw Error(o(168));Ii(Ri,t),Ii(Ti,r)}function Li(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,"function"!==typeof n.getChildContext)return r;for(var i in n=n.getChildContext())if(!(i in t))throw Error(o(108,K(e)||"Unknown",i));return M({},r,n)}function Bi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ci,xi=Ri.current,Ii(Ri,e),Ii(Ti,Ti.current),!0}function Mi(e,t,r){var n=e.stateNode;if(!n)throw Error(o(169));r?(e=Li(e,t,xi),n.__reactInternalMemoizedMergedChildContext=e,ki(Ti),ki(Ri),Ii(Ri,e)):ki(Ti),Ii(Ti,r)}var Ui=null,Fi=!1,ji=!1;function zi(e){null===Ui?Ui=[e]:Ui.push(e)}function qi(){if(!ji&&null!==Ui){ji=!0;var e=0,t=bt;try{var r=Ui;for(bt=1;e<r.length;e++){var n=r[e];do{n=n(!0)}while(null!==n)}Ui=null,Fi=!1}catch(i){throw null!==Ui&&(Ui=Ui.slice(e+1)),Ge(Ze,qi),i}finally{bt=t,ji=!1}}return null}var Ki=[],Vi=0,Hi=null,Wi=0,Gi=[],Yi=0,Qi=null,Xi=1,Ji="";function $i(e,t){Ki[Vi++]=Wi,Ki[Vi++]=Hi,Hi=e,Wi=t}function Zi(e,t,r){Gi[Yi++]=Xi,Gi[Yi++]=Ji,Gi[Yi++]=Qi,Qi=e;var n=Xi;e=Ji;var i=32-st(n)-1;n&=~(1<<i),r+=1;var o=32-st(t)+i;if(30<o){var s=i-i%5;o=(n&(1<<s)-1).toString(32),n>>=s,i-=s,Xi=1<<32-st(t)+i|r<<i|n,Ji=o+e}else Xi=1<<o|r<<i|n,Ji=e}function eo(e){null!==e.return&&($i(e,1),Zi(e,1,0))}function to(e){for(;e===Hi;)Hi=Ki[--Vi],Ki[Vi]=null,Wi=Ki[--Vi],Ki[Vi]=null;for(;e===Qi;)Qi=Gi[--Yi],Gi[Yi]=null,Ji=Gi[--Yi],Gi[Yi]=null,Xi=Gi[--Yi],Gi[Yi]=null}var ro=null,no=null,io=!1,oo=null;function so(e,t){var r=Dl(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,null===(t=e.deletions)?(e.deletions=[r],e.flags|=16):t.push(r)}function ao(e,t){switch(e.tag){case 5:var r=e.type;return null!==(t=1!==t.nodeType||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ro=e,no=li(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ro=e,no=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(r=null!==Qi?{id:Xi,overflow:Ji}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},(r=Dl(18,null,null,0)).stateNode=t,r.return=e,e.child=r,ro=e,no=null,!0);default:return!1}}function co(e){return 0!==(1&e.mode)&&0===(128&e.flags)}function lo(e){if(io){var t=no;if(t){var r=t;if(!ao(e,t)){if(co(e))throw Error(o(418));t=li(r.nextSibling);var n=ro;t&&ao(e,t)?so(n,r):(e.flags=-4097&e.flags|2,io=!1,ro=e)}}else{if(co(e))throw Error(o(418));e.flags=-4097&e.flags|2,io=!1,ro=e}}}function uo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ro=e}function ho(e){if(e!==ro)return!1;if(!io)return uo(e),io=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!ri(e.type,e.memoizedProps)),t&&(t=no)){if(co(e))throw fo(),Error(o(418));for(;t;)so(e,t),t=li(t.nextSibling)}if(uo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var r=e.data;if("/$"===r){if(0===t){no=li(e.nextSibling);break e}t--}else"$"!==r&&"$!"!==r&&"$?"!==r||t++}e=e.nextSibling}no=null}}else no=ro?li(e.stateNode.nextSibling):null;return!0}function fo(){for(var e=no;e;)e=li(e.nextSibling)}function po(){no=ro=null,io=!1}function go(e){null===oo?oo=[e]:oo.push(e)}var yo=w.ReactCurrentBatchConfig;function mo(e,t){if(e&&e.defaultProps){for(var r in t=M({},t),e=e.defaultProps)void 0===t[r]&&(t[r]=e[r]);return t}return t}var vo=Ai(null),bo=null,wo=null,Eo=null;function _o(){Eo=wo=bo=null}function So(e){var t=vo.current;ki(vo),e._currentValue=t}function Ao(e,t,r){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==n&&(n.childLanes|=t)):null!==n&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function ko(e,t){bo=e,Eo=wo=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(wa=!0),e.firstContext=null)}function Io(e){var t=e._currentValue;if(Eo!==e)if(e={context:e,memoizedValue:t,next:null},null===wo){if(null===bo)throw Error(o(308));wo=e,bo.dependencies={lanes:0,firstContext:e}}else wo=wo.next=e;return t}var Co=null;function Ro(e){null===Co?Co=[e]:Co.push(e)}function To(e,t,r,n){var i=t.interleaved;return null===i?(r.next=r,Ro(t)):(r.next=i.next,i.next=r),t.interleaved=r,xo(e,n)}function xo(e,t){e.lanes|=t;var r=e.alternate;for(null!==r&&(r.lanes|=t),r=e,e=e.return;null!==e;)e.childLanes|=t,null!==(r=e.alternate)&&(r.childLanes|=t),r=e,e=e.return;return 3===r.tag?r.stateNode:null}var Po=!1;function Do(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function No(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Oo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Lo(e,t,r){var n=e.updateQueue;if(null===n)return null;if(n=n.shared,0!==(2&Tc)){var i=n.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),n.pending=t,xo(e,r)}return null===(i=n.interleaved)?(t.next=t,Ro(n)):(t.next=i.next,i.next=t),n.interleaved=t,xo(e,r)}function Bo(e,t,r){if(null!==(t=t.updateQueue)&&(t=t.shared,0!==(4194240&r))){var n=t.lanes;r|=n&=e.pendingLanes,t.lanes=r,vt(e,r)}}function Mo(e,t){var r=e.updateQueue,n=e.alternate;if(null!==n&&r===(n=n.updateQueue)){var i=null,o=null;if(null!==(r=r.firstBaseUpdate)){do{var s={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};null===o?i=o=s:o=o.next=s,r=r.next}while(null!==r);null===o?i=o=t:o=o.next=t}else i=o=t;return r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:n.shared,effects:n.effects},void(e.updateQueue=r)}null===(e=r.lastBaseUpdate)?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Uo(e,t,r,n){var i=e.updateQueue;Po=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var c=a,l=c.next;c.next=null,null===s?o=l:s.next=l,s=c;var u=e.alternate;null!==u&&((a=(u=u.updateQueue).lastBaseUpdate)!==s&&(null===a?u.firstBaseUpdate=l:a.next=l,u.lastBaseUpdate=c))}if(null!==o){var h=i.baseState;for(s=0,u=l=c=null,a=o;;){var d=a.lane,f=a.eventTime;if((n&d)===d){null!==u&&(u=u.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,g=a;switch(d=t,f=r,g.tag){case 1:if("function"===typeof(p=g.payload)){h=p.call(f,h,d);break e}h=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null===(d="function"===typeof(p=g.payload)?p.call(f,h,d):p)||void 0===d)break e;h=M({},h,d);break e;case 2:Po=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=i.effects)?i.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===u?(l=u=f,c=h):u=u.next=f,s|=d;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(d=a).next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}if(null===u&&(c=h),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,null!==(t=i.shared.interleaved)){i=t;do{s|=i.lane,i=i.next}while(i!==t)}else null===o&&(i.shared.lanes=0);Mc|=s,e.lanes=s,e.memoizedState=h}}function Fo(e,t,r){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(null!==i){if(n.callback=null,n=r,"function"!==typeof i)throw Error(o(191,i));i.call(n)}}}var jo=(new n.Component).refs;function zo(e,t,r,n){r=null===(r=r(n,t=e.memoizedState))||void 0===r?t:M({},t,r),e.memoizedState=r,0===e.lanes&&(e.updateQueue.baseState=r)}var qo={isMounted:function(e){return!!(e=e._reactInternals)&&qe(e)===e},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=tl(),i=rl(e),o=Oo(n,i);o.payload=t,void 0!==r&&null!==r&&(o.callback=r),null!==(t=Lo(e,o,i))&&(nl(t,e,i,n),Bo(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=tl(),i=rl(e),o=Oo(n,i);o.tag=1,o.payload=t,void 0!==r&&null!==r&&(o.callback=r),null!==(t=Lo(e,o,i))&&(nl(t,e,i,n),Bo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=tl(),n=rl(e),i=Oo(r,n);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),null!==(t=Lo(e,i,n))&&(nl(t,e,n,r),Bo(t,e,n))}};function Ko(e,t,r,n,i,o,s){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!cn(r,n)||!cn(i,o))}function Vo(e,t,r){var n=!1,i=Ci,o=t.contextType;return"object"===typeof o&&null!==o?o=Io(o):(i=Di(t)?xi:Ri.current,o=(n=null!==(n=t.contextTypes)&&void 0!==n)?Pi(e,i):Ci),t=new t(r,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=qo,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function Ho(e,t,r,n){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(r,n),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&qo.enqueueReplaceState(t,t.state,null)}function Wo(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs=jo,Do(e);var o=t.contextType;"object"===typeof o&&null!==o?i.context=Io(o):(o=Di(t)?xi:Ri.current,i.context=Pi(e,o)),i.state=e.memoizedState,"function"===typeof(o=t.getDerivedStateFromProps)&&(zo(e,t,o,r),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&qo.enqueueReplaceState(i,i.state,null),Uo(e,r,i,n),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4194308)}function Go(e,t,r){if(null!==(e=r.ref)&&"function"!==typeof e&&"object"!==typeof e){if(r._owner){if(r=r._owner){if(1!==r.tag)throw Error(o(309));var n=r.stateNode}if(!n)throw Error(o(147,e));var i=n,s=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===s?t.ref:(t=function(e){var t=i.refs;t===jo&&(t=i.refs={}),null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!==typeof e)throw Error(o(284));if(!r._owner)throw Error(o(290,e))}return e}function Yo(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Qo(e){return(0,e._init)(e._payload)}function Xo(e){function t(t,r){if(e){var n=t.deletions;null===n?(t.deletions=[r],t.flags|=16):n.push(r)}}function r(r,n){if(!e)return null;for(;null!==n;)t(r,n),n=n.sibling;return null}function n(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=Ol(e,t)).index=0,e.sibling=null,e}function s(t,r,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<r?(t.flags|=2,r):n:(t.flags|=2,r):(t.flags|=1048576,r)}function a(t){return e&&null===t.alternate&&(t.flags|=2),t}function c(e,t,r,n){return null===t||6!==t.tag?((t=Ul(r,e.mode,n)).return=e,t):((t=i(t,r)).return=e,t)}function l(e,t,r,n){var o=r.type;return o===S?h(e,t,r.props.children,n,r.key):null!==t&&(t.elementType===o||"object"===typeof o&&null!==o&&o.$$typeof===D&&Qo(o)===t.type)?((n=i(t,r.props)).ref=Go(e,t,r),n.return=e,n):((n=Ll(r.type,r.key,r.props,null,e.mode,n)).ref=Go(e,t,r),n.return=e,n)}function u(e,t,r,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==r.containerInfo||t.stateNode.implementation!==r.implementation?((t=Fl(r,e.mode,n)).return=e,t):((t=i(t,r.children||[])).return=e,t)}function h(e,t,r,n,o){return null===t||7!==t.tag?((t=Bl(r,e.mode,n,o)).return=e,t):((t=i(t,r)).return=e,t)}function d(e,t,r){if("string"===typeof t&&""!==t||"number"===typeof t)return(t=Ul(""+t,e.mode,r)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case E:return(r=Ll(t.type,t.key,t.props,null,e.mode,r)).ref=Go(e,null,t),r.return=e,r;case _:return(t=Fl(t,e.mode,r)).return=e,t;case D:return d(e,(0,t._init)(t._payload),r)}if(te(t)||L(t))return(t=Bl(t,e.mode,r,null)).return=e,t;Yo(e,t)}return null}function f(e,t,r,n){var i=null!==t?t.key:null;if("string"===typeof r&&""!==r||"number"===typeof r)return null!==i?null:c(e,t,""+r,n);if("object"===typeof r&&null!==r){switch(r.$$typeof){case E:return r.key===i?l(e,t,r,n):null;case _:return r.key===i?u(e,t,r,n):null;case D:return f(e,t,(i=r._init)(r._payload),n)}if(te(r)||L(r))return null!==i?null:h(e,t,r,n,null);Yo(e,r)}return null}function p(e,t,r,n,i){if("string"===typeof n&&""!==n||"number"===typeof n)return c(t,e=e.get(r)||null,""+n,i);if("object"===typeof n&&null!==n){switch(n.$$typeof){case E:return l(t,e=e.get(null===n.key?r:n.key)||null,n,i);case _:return u(t,e=e.get(null===n.key?r:n.key)||null,n,i);case D:return p(e,t,r,(0,n._init)(n._payload),i)}if(te(n)||L(n))return h(t,e=e.get(r)||null,n,i,null);Yo(t,n)}return null}function g(i,o,a,c){for(var l=null,u=null,h=o,g=o=0,y=null;null!==h&&g<a.length;g++){h.index>g?(y=h,h=null):y=h.sibling;var m=f(i,h,a[g],c);if(null===m){null===h&&(h=y);break}e&&h&&null===m.alternate&&t(i,h),o=s(m,o,g),null===u?l=m:u.sibling=m,u=m,h=y}if(g===a.length)return r(i,h),io&&$i(i,g),l;if(null===h){for(;g<a.length;g++)null!==(h=d(i,a[g],c))&&(o=s(h,o,g),null===u?l=h:u.sibling=h,u=h);return io&&$i(i,g),l}for(h=n(i,h);g<a.length;g++)null!==(y=p(h,i,g,a[g],c))&&(e&&null!==y.alternate&&h.delete(null===y.key?g:y.key),o=s(y,o,g),null===u?l=y:u.sibling=y,u=y);return e&&h.forEach((function(e){return t(i,e)})),io&&$i(i,g),l}function y(i,a,c,l){var u=L(c);if("function"!==typeof u)throw Error(o(150));if(null==(c=u.call(c)))throw Error(o(151));for(var h=u=null,g=a,y=a=0,m=null,v=c.next();null!==g&&!v.done;y++,v=c.next()){g.index>y?(m=g,g=null):m=g.sibling;var b=f(i,g,v.value,l);if(null===b){null===g&&(g=m);break}e&&g&&null===b.alternate&&t(i,g),a=s(b,a,y),null===h?u=b:h.sibling=b,h=b,g=m}if(v.done)return r(i,g),io&&$i(i,y),u;if(null===g){for(;!v.done;y++,v=c.next())null!==(v=d(i,v.value,l))&&(a=s(v,a,y),null===h?u=v:h.sibling=v,h=v);return io&&$i(i,y),u}for(g=n(i,g);!v.done;y++,v=c.next())null!==(v=p(g,i,y,v.value,l))&&(e&&null!==v.alternate&&g.delete(null===v.key?y:v.key),a=s(v,a,y),null===h?u=v:h.sibling=v,h=v);return e&&g.forEach((function(e){return t(i,e)})),io&&$i(i,y),u}return function e(n,o,s,c){if("object"===typeof s&&null!==s&&s.type===S&&null===s.key&&(s=s.props.children),"object"===typeof s&&null!==s){switch(s.$$typeof){case E:e:{for(var l=s.key,u=o;null!==u;){if(u.key===l){if((l=s.type)===S){if(7===u.tag){r(n,u.sibling),(o=i(u,s.props.children)).return=n,n=o;break e}}else if(u.elementType===l||"object"===typeof l&&null!==l&&l.$$typeof===D&&Qo(l)===u.type){r(n,u.sibling),(o=i(u,s.props)).ref=Go(n,u,s),o.return=n,n=o;break e}r(n,u);break}t(n,u),u=u.sibling}s.type===S?((o=Bl(s.props.children,n.mode,c,s.key)).return=n,n=o):((c=Ll(s.type,s.key,s.props,null,n.mode,c)).ref=Go(n,o,s),c.return=n,n=c)}return a(n);case _:e:{for(u=s.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){r(n,o.sibling),(o=i(o,s.children||[])).return=n,n=o;break e}r(n,o);break}t(n,o),o=o.sibling}(o=Fl(s,n.mode,c)).return=n,n=o}return a(n);case D:return e(n,o,(u=s._init)(s._payload),c)}if(te(s))return g(n,o,s,c);if(L(s))return y(n,o,s,c);Yo(n,s)}return"string"===typeof s&&""!==s||"number"===typeof s?(s=""+s,null!==o&&6===o.tag?(r(n,o.sibling),(o=i(o,s)).return=n,n=o):(r(n,o),(o=Ul(s,n.mode,c)).return=n,n=o),a(n)):r(n,o)}}var Jo=Xo(!0),$o=Xo(!1),Zo={},es=Ai(Zo),ts=Ai(Zo),rs=Ai(Zo);function ns(e){if(e===Zo)throw Error(o(174));return e}function is(e,t){switch(Ii(rs,t),Ii(ts,e),Ii(es,Zo),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ce(null,"");break;default:t=ce(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ki(es),Ii(es,t)}function os(){ki(es),ki(ts),ki(rs)}function ss(e){ns(rs.current);var t=ns(es.current),r=ce(t,e.type);t!==r&&(Ii(ts,e),Ii(es,r))}function as(e){ts.current===e&&(ki(es),ki(ts))}var cs=Ai(0);function ls(e){for(var t=e;null!==t;){if(13===t.tag){var r=t.memoizedState;if(null!==r&&(null===(r=r.dehydrated)||"$?"===r.data||"$!"===r.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var us=[];function hs(){for(var e=0;e<us.length;e++)us[e]._workInProgressVersionPrimary=null;us.length=0}var ds=w.ReactCurrentDispatcher,fs=w.ReactCurrentBatchConfig,ps=0,gs=null,ys=null,ms=null,vs=!1,bs=!1,ws=0,Es=0;function _s(){throw Error(o(321))}function Ss(e,t){if(null===t)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!an(e[r],t[r]))return!1;return!0}function As(e,t,r,n,i,s){if(ps=s,gs=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ds.current=null===e||null===e.memoizedState?aa:ca,e=r(n,i),bs){s=0;do{if(bs=!1,ws=0,25<=s)throw Error(o(301));s+=1,ms=ys=null,t.updateQueue=null,ds.current=la,e=r(n,i)}while(bs)}if(ds.current=sa,t=null!==ys&&null!==ys.next,ps=0,ms=ys=gs=null,vs=!1,t)throw Error(o(300));return e}function ks(){var e=0!==ws;return ws=0,e}function Is(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ms?gs.memoizedState=ms=e:ms=ms.next=e,ms}function Cs(){if(null===ys){var e=gs.alternate;e=null!==e?e.memoizedState:null}else e=ys.next;var t=null===ms?gs.memoizedState:ms.next;if(null!==t)ms=t,ys=e;else{if(null===e)throw Error(o(310));e={memoizedState:(ys=e).memoizedState,baseState:ys.baseState,baseQueue:ys.baseQueue,queue:ys.queue,next:null},null===ms?gs.memoizedState=ms=e:ms=ms.next=e}return ms}function Rs(e,t){return"function"===typeof t?t(e):t}function Ts(e){var t=Cs(),r=t.queue;if(null===r)throw Error(o(311));r.lastRenderedReducer=e;var n=ys,i=n.baseQueue,s=r.pending;if(null!==s){if(null!==i){var a=i.next;i.next=s.next,s.next=a}n.baseQueue=i=s,r.pending=null}if(null!==i){s=i.next,n=n.baseState;var c=a=null,l=null,u=s;do{var h=u.lane;if((ps&h)===h)null!==l&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var d={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===l?(c=l=d,a=n):l=l.next=d,gs.lanes|=h,Mc|=h}u=u.next}while(null!==u&&u!==s);null===l?a=n:l.next=c,an(n,t.memoizedState)||(wa=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=l,r.lastRenderedState=n}if(null!==(e=r.interleaved)){i=e;do{s=i.lane,gs.lanes|=s,Mc|=s,i=i.next}while(i!==e)}else null===i&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function xs(e){var t=Cs(),r=t.queue;if(null===r)throw Error(o(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(null!==i){r.pending=null;var a=i=i.next;do{s=e(s,a.action),a=a.next}while(a!==i);an(s,t.memoizedState)||(wa=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Ps(){}function Ds(e,t){var r=gs,n=Cs(),i=t(),s=!an(n.memoizedState,i);if(s&&(n.memoizedState=i,wa=!0),n=n.queue,Vs(Ls.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||null!==ms&&1&ms.memoizedState.tag){if(r.flags|=2048,Fs(9,Os.bind(null,r,n,i,t),void 0,null),null===xc)throw Error(o(349));0!==(30&ps)||Ns(r,t,i)}return i}function Ns(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},null===(t=gs.updateQueue)?(t={lastEffect:null,stores:null},gs.updateQueue=t,t.stores=[e]):null===(r=t.stores)?t.stores=[e]:r.push(e)}function Os(e,t,r,n){t.value=r,t.getSnapshot=n,Bs(t)&&Ms(e)}function Ls(e,t,r){return r((function(){Bs(t)&&Ms(e)}))}function Bs(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!an(e,r)}catch(n){return!0}}function Ms(e){var t=xo(e,1);null!==t&&nl(t,e,1,-1)}function Us(e){var t=Is();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:e},t.queue=e,e=e.dispatch=ra.bind(null,gs,e),[t.memoizedState,e]}function Fs(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},null===(t=gs.updateQueue)?(t={lastEffect:null,stores:null},gs.updateQueue=t,t.lastEffect=e.next=e):null===(r=t.lastEffect)?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e),e}function js(){return Cs().memoizedState}function zs(e,t,r,n){var i=Is();gs.flags|=e,i.memoizedState=Fs(1|t,r,void 0,void 0===n?null:n)}function qs(e,t,r,n){var i=Cs();n=void 0===n?null:n;var o=void 0;if(null!==ys){var s=ys.memoizedState;if(o=s.destroy,null!==n&&Ss(n,s.deps))return void(i.memoizedState=Fs(t,r,o,n))}gs.flags|=e,i.memoizedState=Fs(1|t,r,o,n)}function Ks(e,t){return zs(8390656,8,e,t)}function Vs(e,t){return qs(2048,8,e,t)}function Hs(e,t){return qs(4,2,e,t)}function Ws(e,t){return qs(4,4,e,t)}function Gs(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ys(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,qs(4,4,Gs.bind(null,t,e),r)}function Qs(){}function Xs(e,t){var r=Cs();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&Ss(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Js(e,t){var r=Cs();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&Ss(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function $s(e,t,r){return 0===(21&ps)?(e.baseState&&(e.baseState=!1,wa=!0),e.memoizedState=r):(an(r,t)||(r=gt(),gs.lanes|=r,Mc|=r,e.baseState=!0),t)}function Zs(e,t){var r=bt;bt=0!==r&&4>r?r:4,e(!0);var n=fs.transition;fs.transition={};try{e(!1),t()}finally{bt=r,fs.transition=n}}function ea(){return Cs().memoizedState}function ta(e,t,r){var n=rl(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},na(e))ia(t,r);else if(null!==(r=To(e,t,r,n))){nl(r,e,n,tl()),oa(r,t,n)}}function ra(e,t,r){var n=rl(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(na(e))ia(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,a=o(s,r);if(i.hasEagerState=!0,i.eagerState=a,an(a,s)){var c=t.interleaved;return null===c?(i.next=i,Ro(t)):(i.next=c.next,c.next=i),void(t.interleaved=i)}}catch(l){}null!==(r=To(e,t,i,n))&&(nl(r,e,n,i=tl()),oa(r,t,n))}}function na(e){var t=e.alternate;return e===gs||null!==t&&t===gs}function ia(e,t){bs=vs=!0;var r=e.pending;null===r?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function oa(e,t,r){if(0!==(4194240&r)){var n=t.lanes;r|=n&=e.pendingLanes,t.lanes=r,vt(e,r)}}var sa={readContext:Io,useCallback:_s,useContext:_s,useEffect:_s,useImperativeHandle:_s,useInsertionEffect:_s,useLayoutEffect:_s,useMemo:_s,useReducer:_s,useRef:_s,useState:_s,useDebugValue:_s,useDeferredValue:_s,useTransition:_s,useMutableSource:_s,useSyncExternalStore:_s,useId:_s,unstable_isNewReconciler:!1},aa={readContext:Io,useCallback:function(e,t){return Is().memoizedState=[e,void 0===t?null:t],e},useContext:Io,useEffect:Ks,useImperativeHandle:function(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,zs(4194308,4,Gs.bind(null,t,e),r)},useLayoutEffect:function(e,t){return zs(4194308,4,e,t)},useInsertionEffect:function(e,t){return zs(4,2,e,t)},useMemo:function(e,t){var r=Is();return t=void 0===t?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Is();return t=void 0!==r?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=ta.bind(null,gs,e),[n.memoizedState,e]},useRef:function(e){return e={current:e},Is().memoizedState=e},useState:Us,useDebugValue:Qs,useDeferredValue:function(e){return Is().memoizedState=e},useTransition:function(){var e=Us(!1),t=e[0];return e=Zs.bind(null,e[1]),Is().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=gs,i=Is();if(io){if(void 0===r)throw Error(o(407));r=r()}else{if(r=t(),null===xc)throw Error(o(349));0!==(30&ps)||Ns(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Ks(Ls.bind(null,n,s,e),[e]),n.flags|=2048,Fs(9,Os.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=Is(),t=xc.identifierPrefix;if(io){var r=Ji;t=":"+t+"R"+(r=(Xi&~(1<<32-st(Xi)-1)).toString(32)+r),0<(r=ws++)&&(t+="H"+r.toString(32)),t+=":"}else t=":"+t+"r"+(r=Es++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ca={readContext:Io,useCallback:Xs,useContext:Io,useEffect:Vs,useImperativeHandle:Ys,useInsertionEffect:Hs,useLayoutEffect:Ws,useMemo:Js,useReducer:Ts,useRef:js,useState:function(){return Ts(Rs)},useDebugValue:Qs,useDeferredValue:function(e){return $s(Cs(),ys.memoizedState,e)},useTransition:function(){return[Ts(Rs)[0],Cs().memoizedState]},useMutableSource:Ps,useSyncExternalStore:Ds,useId:ea,unstable_isNewReconciler:!1},la={readContext:Io,useCallback:Xs,useContext:Io,useEffect:Vs,useImperativeHandle:Ys,useInsertionEffect:Hs,useLayoutEffect:Ws,useMemo:Js,useReducer:xs,useRef:js,useState:function(){return xs(Rs)},useDebugValue:Qs,useDeferredValue:function(e){var t=Cs();return null===ys?t.memoizedState=e:$s(t,ys.memoizedState,e)},useTransition:function(){return[xs(Rs)[0],Cs().memoizedState]},useMutableSource:Ps,useSyncExternalStore:Ds,useId:ea,unstable_isNewReconciler:!1};function ua(e,t){try{var r="",n=t;do{r+=z(n),n=n.return}while(n);var i=r}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i,digest:null}}function ha(e,t,r){return{value:e,source:null,stack:null!=r?r:null,digest:null!=t?t:null}}function da(e,t){try{console.error(t.value)}catch(r){setTimeout((function(){throw r}))}}var fa="function"===typeof WeakMap?WeakMap:Map;function pa(e,t,r){(r=Oo(-1,r)).tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Hc||(Hc=!0,Wc=n),da(0,t)},r}function ga(e,t,r){(r=Oo(-1,r)).tag=3;var n=e.type.getDerivedStateFromError;if("function"===typeof n){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){da(0,t)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(r.callback=function(){da(0,t),"function"!==typeof n&&(null===Gc?Gc=new Set([this]):Gc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),r}function ya(e,t,r){var n=e.pingCache;if(null===n){n=e.pingCache=new fa;var i=new Set;n.set(t,i)}else void 0===(i=n.get(t))&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=Il.bind(null,e,t,r),t.then(e,e))}function ma(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function va(e,t,r,n,i){return 0===(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,1===r.tag&&(null===r.alternate?r.tag=17:((t=Oo(-1,1)).tag=2,Lo(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var ba=w.ReactCurrentOwner,wa=!1;function Ea(e,t,r,n){t.child=null===e?$o(t,null,r,n):Jo(t,e.child,r,n)}function _a(e,t,r,n,i){r=r.render;var o=t.ref;return ko(t,i),n=As(e,t,r,n,o,i),r=ks(),null===e||wa?(io&&r&&eo(t),t.flags|=1,Ea(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ha(e,t,i))}function Sa(e,t,r,n,i){if(null===e){var o=r.type;return"function"!==typeof o||Nl(o)||void 0!==o.defaultProps||null!==r.compare||void 0!==r.defaultProps?((e=Ll(r.type,null,n,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Aa(e,t,o,n,i))}if(o=e.child,0===(e.lanes&i)){var s=o.memoizedProps;if((r=null!==(r=r.compare)?r:cn)(s,n)&&e.ref===t.ref)return Ha(e,t,i)}return t.flags|=1,(e=Ol(o,n)).ref=t.ref,e.return=t,t.child=e}function Aa(e,t,r,n,i){if(null!==e){var o=e.memoizedProps;if(cn(o,n)&&e.ref===t.ref){if(wa=!1,t.pendingProps=n=o,0===(e.lanes&i))return t.lanes=e.lanes,Ha(e,t,i);0!==(131072&e.flags)&&(wa=!0)}}return Ca(e,t,r,n,i)}function ka(e,t,r){var n=t.pendingProps,i=n.children,o=null!==e?e.memoizedState:null;if("hidden"===n.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ii(Oc,Nc),Nc|=r;else{if(0===(1073741824&r))return e=null!==o?o.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ii(Oc,Nc),Nc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=null!==o?o.baseLanes:r,Ii(Oc,Nc),Nc|=n}else null!==o?(n=o.baseLanes|r,t.memoizedState=null):n=r,Ii(Oc,Nc),Nc|=n;return Ea(e,t,i,r),t.child}function Ia(e,t){var r=t.ref;(null===e&&null!==r||null!==e&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ca(e,t,r,n,i){var o=Di(r)?xi:Ri.current;return o=Pi(t,o),ko(t,i),r=As(e,t,r,n,o,i),n=ks(),null===e||wa?(io&&n&&eo(t),t.flags|=1,Ea(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ha(e,t,i))}function Ra(e,t,r,n,i){if(Di(r)){var o=!0;Bi(t)}else o=!1;if(ko(t,i),null===t.stateNode)Va(e,t),Vo(t,r,n),Wo(t,r,n,i),n=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var c=s.context,l=r.contextType;"object"===typeof l&&null!==l?l=Io(l):l=Pi(t,l=Di(r)?xi:Ri.current);var u=r.getDerivedStateFromProps,h="function"===typeof u||"function"===typeof s.getSnapshotBeforeUpdate;h||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==n||c!==l)&&Ho(t,s,n,l),Po=!1;var d=t.memoizedState;s.state=d,Uo(t,n,s,i),c=t.memoizedState,a!==n||d!==c||Ti.current||Po?("function"===typeof u&&(zo(t,r,u,n),c=t.memoizedState),(a=Po||Ko(t,r,a,n,d,c,l))?(h||"function"!==typeof s.UNSAFE_componentWillMount&&"function"!==typeof s.componentWillMount||("function"===typeof s.componentWillMount&&s.componentWillMount(),"function"===typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"===typeof s.componentDidMount&&(t.flags|=4194308)):("function"===typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),s.props=n,s.state=c,s.context=l,n=a):("function"===typeof s.componentDidMount&&(t.flags|=4194308),n=!1)}else{s=t.stateNode,No(e,t),a=t.memoizedProps,l=t.type===t.elementType?a:mo(t.type,a),s.props=l,h=t.pendingProps,d=s.context,"object"===typeof(c=r.contextType)&&null!==c?c=Io(c):c=Pi(t,c=Di(r)?xi:Ri.current);var f=r.getDerivedStateFromProps;(u="function"===typeof f||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==h||d!==c)&&Ho(t,s,n,c),Po=!1,d=t.memoizedState,s.state=d,Uo(t,n,s,i);var p=t.memoizedState;a!==h||d!==p||Ti.current||Po?("function"===typeof f&&(zo(t,r,f,n),p=t.memoizedState),(l=Po||Ko(t,r,l,n,d,p,c)||!1)?(u||"function"!==typeof s.UNSAFE_componentWillUpdate&&"function"!==typeof s.componentWillUpdate||("function"===typeof s.componentWillUpdate&&s.componentWillUpdate(n,p,c),"function"===typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(n,p,c)),"function"===typeof s.componentDidUpdate&&(t.flags|=4),"function"===typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=p),s.props=n,s.state=p,s.context=c,n=l):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return Ta(e,t,r,n,o,i)}function Ta(e,t,r,n,i,o){Ia(e,t);var s=0!==(128&t.flags);if(!n&&!s)return i&&Mi(t,r,!1),Ha(e,t,o);n=t.stateNode,ba.current=t;var a=s&&"function"!==typeof r.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&s?(t.child=Jo(t,e.child,null,o),t.child=Jo(t,null,a,o)):Ea(e,t,a,o),t.memoizedState=n.state,i&&Mi(t,r,!0),t.child}function xa(e){var t=e.stateNode;t.pendingContext?Oi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Oi(0,t.context,!1),is(e,t.containerInfo)}function Pa(e,t,r,n,i){return po(),go(i),t.flags|=256,Ea(e,t,r,n),t.child}var Da,Na,Oa,La,Ba={dehydrated:null,treeContext:null,retryLane:0};function Ma(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ua(e,t,r){var n,i=t.pendingProps,s=cs.current,a=!1,c=0!==(128&t.flags);if((n=c)||(n=(null===e||null!==e.memoizedState)&&0!==(2&s)),n?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Ii(cs,1&s),null===e)return lo(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0===(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(c=i.children,e=i.fallback,a?(i=t.mode,a=t.child,c={mode:"hidden",children:c},0===(1&i)&&null!==a?(a.childLanes=0,a.pendingProps=c):a=Ml(c,i,0,null),e=Bl(e,i,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ma(r),t.memoizedState=Ba,e):Fa(t,c));if(null!==(s=e.memoizedState)&&null!==(n=s.dehydrated))return function(e,t,r,n,i,s,a){if(r)return 256&t.flags?(t.flags&=-257,ja(e,t,a,n=ha(Error(o(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=n.fallback,i=t.mode,n=Ml({mode:"visible",children:n.children},i,0,null),(s=Bl(s,i,a,null)).flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,0!==(1&t.mode)&&Jo(t,e.child,null,a),t.child.memoizedState=Ma(a),t.memoizedState=Ba,s);if(0===(1&t.mode))return ja(e,t,a,null);if("$!"===i.data){if(n=i.nextSibling&&i.nextSibling.dataset)var c=n.dgst;return n=c,ja(e,t,a,n=ha(s=Error(o(419)),n,void 0))}if(c=0!==(a&e.childLanes),wa||c){if(null!==(n=xc)){switch(a&-a){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}0!==(i=0!==(i&(n.suspendedLanes|a))?0:i)&&i!==s.retryLane&&(s.retryLane=i,xo(e,i),nl(n,e,i,-1))}return yl(),ja(e,t,a,n=ha(Error(o(421))))}return"$?"===i.data?(t.flags|=128,t.child=e.child,t=Rl.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,no=li(i.nextSibling),ro=t,io=!0,oo=null,null!==e&&(Gi[Yi++]=Xi,Gi[Yi++]=Ji,Gi[Yi++]=Qi,Xi=e.id,Ji=e.overflow,Qi=t),t=Fa(t,n.children),t.flags|=4096,t)}(e,t,c,i,n,s,r);if(a){a=i.fallback,c=t.mode,n=(s=e.child).sibling;var l={mode:"hidden",children:i.children};return 0===(1&c)&&t.child!==s?((i=t.child).childLanes=0,i.pendingProps=l,t.deletions=null):(i=Ol(s,l)).subtreeFlags=14680064&s.subtreeFlags,null!==n?a=Ol(n,a):(a=Bl(a,c,r,null)).flags|=2,a.return=t,i.return=t,i.sibling=a,t.child=i,i=a,a=t.child,c=null===(c=e.child.memoizedState)?Ma(r):{baseLanes:c.baseLanes|r,cachePool:null,transitions:c.transitions},a.memoizedState=c,a.childLanes=e.childLanes&~r,t.memoizedState=Ba,i}return e=(a=e.child).sibling,i=Ol(a,{mode:"visible",children:i.children}),0===(1&t.mode)&&(i.lanes=r),i.return=t,i.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=i,t.memoizedState=null,i}function Fa(e,t){return(t=Ml({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function ja(e,t,r,n){return null!==n&&go(n),Jo(t,e.child,null,r),(e=Fa(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function za(e,t,r){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),Ao(e.return,t,r)}function qa(e,t,r,n,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=i)}function Ka(e,t,r){var n=t.pendingProps,i=n.revealOrder,o=n.tail;if(Ea(e,t,n.children,r),0!==(2&(n=cs.current)))n=1&n|2,t.flags|=128;else{if(null!==e&&0!==(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&za(e,r,t);else if(19===e.tag)za(e,r,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Ii(cs,n),0===(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;null!==r;)null!==(e=r.alternate)&&null===ls(e)&&(i=r),r=r.sibling;null===(r=i)?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),qa(t,!1,i,r,o);break;case"backwards":for(r=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===ls(e)){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}qa(t,!0,r,null,o);break;case"together":qa(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Va(e,t){0===(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ha(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),Mc|=t.lanes,0===(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(r=Ol(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=Ol(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function Wa(e,t){if(!io)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;null!==t;)null!==t.alternate&&(r=t),t=t.sibling;null===r?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;null!==r;)null!==r.alternate&&(n=r),r=r.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function Ga(e){var t=null!==e.alternate&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;null!==i;)r|=i.lanes|i.childLanes,n|=14680064&i.subtreeFlags,n|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Ya(e,t,r){var n=t.pendingProps;switch(to(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ga(t),null;case 1:case 17:return Di(t.type)&&Ni(),Ga(t),null;case 3:return n=t.stateNode,os(),ki(Ti),ki(Ri),hs(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(ho(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,null!==oo&&(al(oo),oo=null))),Na(e,t),Ga(t),null;case 5:as(t);var i=ns(rs.current);if(r=t.type,null!==e&&null!=t.stateNode)Oa(e,t,r,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(null===t.stateNode)throw Error(o(166));return Ga(t),null}if(e=ns(es.current),ho(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[di]=t,n[fi]=s,e=0!==(1&t.mode),r){case"dialog":Fn("cancel",n),Fn("close",n);break;case"iframe":case"object":case"embed":Fn("load",n);break;case"video":case"audio":for(i=0;i<Ln.length;i++)Fn(Ln[i],n);break;case"source":Fn("error",n);break;case"img":case"image":case"link":Fn("error",n),Fn("load",n);break;case"details":Fn("toggle",n);break;case"input":X(n,s),Fn("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},Fn("invalid",n);break;case"textarea":ie(n,s),Fn("invalid",n)}for(var c in ve(r,s),i=null,s)if(s.hasOwnProperty(c)){var l=s[c];"children"===c?"string"===typeof l?n.textContent!==l&&(!0!==s.suppressHydrationWarning&&$n(n.textContent,l,e),i=["children",l]):"number"===typeof l&&n.textContent!==""+l&&(!0!==s.suppressHydrationWarning&&$n(n.textContent,l,e),i=["children",""+l]):a.hasOwnProperty(c)&&null!=l&&"onScroll"===c&&Fn("scroll",n)}switch(r){case"input":W(n),Z(n,s,!0);break;case"textarea":W(n),se(n);break;case"select":case"option":break;default:"function"===typeof s.onClick&&(n.onclick=Zn)}n=i,t.updateQueue=n,null!==n&&(t.flags|=4)}else{c=9===i.nodeType?i:i.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ae(r)),"http://www.w3.org/1999/xhtml"===e?"script"===r?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof n.is?e=c.createElement(r,{is:n.is}):(e=c.createElement(r),"select"===r&&(c=e,n.multiple?c.multiple=!0:n.size&&(c.size=n.size))):e=c.createElementNS(e,r),e[di]=t,e[fi]=n,Da(e,t,!1,!1),t.stateNode=e;e:{switch(c=be(r,n),r){case"dialog":Fn("cancel",e),Fn("close",e),i=n;break;case"iframe":case"object":case"embed":Fn("load",e),i=n;break;case"video":case"audio":for(i=0;i<Ln.length;i++)Fn(Ln[i],e);i=n;break;case"source":Fn("error",e),i=n;break;case"img":case"image":case"link":Fn("error",e),Fn("load",e),i=n;break;case"details":Fn("toggle",e),i=n;break;case"input":X(e,n),i=Q(e,n),Fn("invalid",e);break;case"option":default:i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=M({},n,{value:void 0}),Fn("invalid",e);break;case"textarea":ie(e,n),i=ne(e,n),Fn("invalid",e)}for(s in ve(r,i),l=i)if(l.hasOwnProperty(s)){var u=l[s];"style"===s?ye(e,u):"dangerouslySetInnerHTML"===s?null!=(u=u?u.__html:void 0)&&he(e,u):"children"===s?"string"===typeof u?("textarea"!==r||""!==u)&&de(e,u):"number"===typeof u&&de(e,""+u):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(a.hasOwnProperty(s)?null!=u&&"onScroll"===s&&Fn("scroll",e):null!=u&&b(e,s,u,c))}switch(r){case"input":W(e),Z(e,n,!1);break;case"textarea":W(e),se(e);break;case"option":null!=n.value&&e.setAttribute("value",""+V(n.value));break;case"select":e.multiple=!!n.multiple,null!=(s=n.value)?re(e,!!n.multiple,s,!1):null!=n.defaultValue&&re(e,!!n.multiple,n.defaultValue,!0);break;default:"function"===typeof i.onClick&&(e.onclick=Zn)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Ga(t),null;case 6:if(e&&null!=t.stateNode)La(e,t,e.memoizedProps,n);else{if("string"!==typeof n&&null===t.stateNode)throw Error(o(166));if(r=ns(rs.current),ns(es.current),ho(t)){if(n=t.stateNode,r=t.memoizedProps,n[di]=t,(s=n.nodeValue!==r)&&null!==(e=ro))switch(e.tag){case 3:$n(n.nodeValue,r,0!==(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&$n(n.nodeValue,r,0!==(1&e.mode))}s&&(t.flags|=4)}else(n=(9===r.nodeType?r:r.ownerDocument).createTextNode(n))[di]=t,t.stateNode=n}return Ga(t),null;case 13:if(ki(cs),n=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(io&&null!==no&&0!==(1&t.mode)&&0===(128&t.flags))fo(),po(),t.flags|=98560,s=!1;else if(s=ho(t),null!==n&&null!==n.dehydrated){if(null===e){if(!s)throw Error(o(318));if(!(s=null!==(s=t.memoizedState)?s.dehydrated:null))throw Error(o(317));s[di]=t}else po(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Ga(t),s=!1}else null!==oo&&(al(oo),oo=null),s=!0;if(!s)return 65536&t.flags?t:null}return 0!==(128&t.flags)?(t.lanes=r,t):((n=null!==n)!==(null!==e&&null!==e.memoizedState)&&n&&(t.child.flags|=8192,0!==(1&t.mode)&&(null===e||0!==(1&cs.current)?0===Lc&&(Lc=3):yl())),null!==t.updateQueue&&(t.flags|=4),Ga(t),null);case 4:return os(),Na(e,t),null===e&&qn(t.stateNode.containerInfo),Ga(t),null;case 10:return So(t.type._context),Ga(t),null;case 19:if(ki(cs),null===(s=t.memoizedState))return Ga(t),null;if(n=0!==(128&t.flags),null===(c=s.rendering))if(n)Wa(s,!1);else{if(0!==Lc||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(c=ls(e))){for(t.flags|=128,Wa(s,!1),null!==(n=c.updateQueue)&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;null!==r;)e=n,(s=r).flags&=14680066,null===(c=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ii(cs,1&cs.current|2),t.child}e=e.sibling}null!==s.tail&&Je()>Kc&&(t.flags|=128,n=!0,Wa(s,!1),t.lanes=4194304)}else{if(!n)if(null!==(e=ls(c))){if(t.flags|=128,n=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),Wa(s,!0),null===s.tail&&"hidden"===s.tailMode&&!c.alternate&&!io)return Ga(t),null}else 2*Je()-s.renderingStartTime>Kc&&1073741824!==r&&(t.flags|=128,n=!0,Wa(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(null!==(r=s.last)?r.sibling=c:t.child=c,s.last=c)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Je(),t.sibling=null,r=cs.current,Ii(cs,n?1&r|2:1&r),t):(Ga(t),null);case 22:case 23:return dl(),n=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==n&&(t.flags|=8192),n&&0!==(1&t.mode)?0!==(1073741824&Nc)&&(Ga(t),6&t.subtreeFlags&&(t.flags|=8192)):Ga(t),null;case 24:case 25:return null}throw Error(o(156,t.tag))}function Qa(e,t){switch(to(t),t.tag){case 1:return Di(t.type)&&Ni(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return os(),ki(Ti),ki(Ri),hs(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 5:return as(t),null;case 13:if(ki(cs),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(o(340));po()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return ki(cs),null;case 4:return os(),null;case 10:return So(t.type._context),null;case 22:case 23:return dl(),null;default:return null}}Da=function(e,t){for(var r=t.child;null!==r;){if(5===r.tag||6===r.tag)e.appendChild(r.stateNode);else if(4!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},Na=function(){},Oa=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,ns(es.current);var o,s=null;switch(r){case"input":i=Q(e,i),n=Q(e,n),s=[];break;case"select":i=M({},i,{value:void 0}),n=M({},n,{value:void 0}),s=[];break;case"textarea":i=ne(e,i),n=ne(e,n),s=[];break;default:"function"!==typeof i.onClick&&"function"===typeof n.onClick&&(e.onclick=Zn)}for(u in ve(r,n),r=null,i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&null!=i[u])if("style"===u){var c=i[u];for(o in c)c.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(a.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in n){var l=n[u];if(c=null!=i?i[u]:void 0,n.hasOwnProperty(u)&&l!==c&&(null!=l||null!=c))if("style"===u)if(c){for(o in c)!c.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&c[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(s||(s=[]),s.push(u,r)),r=l;else"dangerouslySetInnerHTML"===u?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(s=s||[]).push(u,l)):"children"===u?"string"!==typeof l&&"number"!==typeof l||(s=s||[]).push(u,""+l):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(a.hasOwnProperty(u)?(null!=l&&"onScroll"===u&&Fn("scroll",e),s||c===l||(s=[])):(s=s||[]).push(u,l))}r&&(s=s||[]).push("style",r);var u=s;(t.updateQueue=u)&&(t.flags|=4)}},La=function(e,t,r,n){r!==n&&(t.flags|=4)};var Xa=!1,Ja=!1,$a="function"===typeof WeakSet?WeakSet:Set,Za=null;function ec(e,t){var r=e.ref;if(null!==r)if("function"===typeof r)try{r(null)}catch(n){kl(e,t,n)}else r.current=null}function tc(e,t,r){try{r()}catch(n){kl(e,t,n)}}var rc=!1;function nc(e,t,r){var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var i=n=n.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&tc(t,r,o)}i=i.next}while(i!==n)}}function ic(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function oc(e){var t=e.ref;if(null!==t){var r=e.stateNode;e.tag,e=r,"function"===typeof t?t(e):t.current=e}}function sc(e){var t=e.alternate;null!==t&&(e.alternate=null,sc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[di],delete t[fi],delete t[gi],delete t[yi],delete t[mi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ac(e){return 5===e.tag||3===e.tag||4===e.tag}function cc(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||ac(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function lc(e,t,r){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?8===r.nodeType?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(8===r.nodeType?(t=r.parentNode).insertBefore(e,r):(t=r).appendChild(e),null!==(r=r._reactRootContainer)&&void 0!==r||null!==t.onclick||(t.onclick=Zn));else if(4!==n&&null!==(e=e.child))for(lc(e,t,r),e=e.sibling;null!==e;)lc(e,t,r),e=e.sibling}function uc(e,t,r){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(4!==n&&null!==(e=e.child))for(uc(e,t,r),e=e.sibling;null!==e;)uc(e,t,r),e=e.sibling}var hc=null,dc=!1;function fc(e,t,r){for(r=r.child;null!==r;)pc(e,t,r),r=r.sibling}function pc(e,t,r){if(ot&&"function"===typeof ot.onCommitFiberUnmount)try{ot.onCommitFiberUnmount(it,r)}catch(a){}switch(r.tag){case 5:Ja||ec(r,t);case 6:var n=hc,i=dc;hc=null,fc(e,t,r),dc=i,null!==(hc=n)&&(dc?(e=hc,r=r.stateNode,8===e.nodeType?e.parentNode.removeChild(r):e.removeChild(r)):hc.removeChild(r.stateNode));break;case 18:null!==hc&&(dc?(e=hc,r=r.stateNode,8===e.nodeType?ci(e.parentNode,r):1===e.nodeType&&ci(e,r),qt(e)):ci(hc,r.stateNode));break;case 4:n=hc,i=dc,hc=r.stateNode.containerInfo,dc=!0,fc(e,t,r),hc=n,dc=i;break;case 0:case 11:case 14:case 15:if(!Ja&&(null!==(n=r.updateQueue)&&null!==(n=n.lastEffect))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,void 0!==s&&(0!==(2&o)||0!==(4&o))&&tc(r,t,s),i=i.next}while(i!==n)}fc(e,t,r);break;case 1:if(!Ja&&(ec(r,t),"function"===typeof(n=r.stateNode).componentWillUnmount))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){kl(r,t,a)}fc(e,t,r);break;case 21:fc(e,t,r);break;case 22:1&r.mode?(Ja=(n=Ja)||null!==r.memoizedState,fc(e,t,r),Ja=n):fc(e,t,r);break;default:fc(e,t,r)}}function gc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var r=e.stateNode;null===r&&(r=e.stateNode=new $a),t.forEach((function(t){var n=Tl.bind(null,e,t);r.has(t)||(r.add(t),t.then(n,n))}))}}function yc(e,t){var r=t.deletions;if(null!==r)for(var n=0;n<r.length;n++){var i=r[n];try{var s=e,a=t,c=a;e:for(;null!==c;){switch(c.tag){case 5:hc=c.stateNode,dc=!1;break e;case 3:case 4:hc=c.stateNode.containerInfo,dc=!0;break e}c=c.return}if(null===hc)throw Error(o(160));pc(s,a,i),hc=null,dc=!1;var l=i.alternate;null!==l&&(l.return=null),i.return=null}catch(u){kl(i,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)mc(t,e),t=t.sibling}function mc(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yc(t,e),vc(e),4&n){try{nc(3,e,e.return),ic(3,e)}catch(y){kl(e,e.return,y)}try{nc(5,e,e.return)}catch(y){kl(e,e.return,y)}}break;case 1:yc(t,e),vc(e),512&n&&null!==r&&ec(r,r.return);break;case 5:if(yc(t,e),vc(e),512&n&&null!==r&&ec(r,r.return),32&e.flags){var i=e.stateNode;try{de(i,"")}catch(y){kl(e,e.return,y)}}if(4&n&&null!=(i=e.stateNode)){var s=e.memoizedProps,a=null!==r?r.memoizedProps:s,c=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===c&&"radio"===s.type&&null!=s.name&&J(i,s),be(c,a);var u=be(c,s);for(a=0;a<l.length;a+=2){var h=l[a],d=l[a+1];"style"===h?ye(i,d):"dangerouslySetInnerHTML"===h?he(i,d):"children"===h?de(i,d):b(i,h,d,u)}switch(c){case"input":$(i,s);break;case"textarea":oe(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;null!=p?re(i,!!s.multiple,p,!1):f!==!!s.multiple&&(null!=s.defaultValue?re(i,!!s.multiple,s.defaultValue,!0):re(i,!!s.multiple,s.multiple?[]:"",!1))}i[fi]=s}catch(y){kl(e,e.return,y)}}break;case 6:if(yc(t,e),vc(e),4&n){if(null===e.stateNode)throw Error(o(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(y){kl(e,e.return,y)}}break;case 3:if(yc(t,e),vc(e),4&n&&null!==r&&r.memoizedState.isDehydrated)try{qt(t.containerInfo)}catch(y){kl(e,e.return,y)}break;case 4:default:yc(t,e),vc(e);break;case 13:yc(t,e),vc(e),8192&(i=e.child).flags&&(s=null!==i.memoizedState,i.stateNode.isHidden=s,!s||null!==i.alternate&&null!==i.alternate.memoizedState||(qc=Je())),4&n&&gc(e);break;case 22:if(h=null!==r&&null!==r.memoizedState,1&e.mode?(Ja=(u=Ja)||h,yc(t,e),Ja=u):yc(t,e),vc(e),8192&n){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!h&&0!==(1&e.mode))for(Za=e,h=e.child;null!==h;){for(d=Za=h;null!==Za;){switch(p=(f=Za).child,f.tag){case 0:case 11:case 14:case 15:nc(4,f,f.return);break;case 1:ec(f,f.return);var g=f.stateNode;if("function"===typeof g.componentWillUnmount){n=f,r=f.return;try{t=n,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(y){kl(n,r,y)}}break;case 5:ec(f,f.return);break;case 22:if(null!==f.memoizedState){_c(d);continue}}null!==p?(p.return=f,Za=p):_c(d)}h=h.sibling}e:for(h=null,d=e;;){if(5===d.tag){if(null===h){h=d;try{i=d.stateNode,u?"function"===typeof(s=i.style).setProperty?s.setProperty("display","none","important"):s.display="none":(c=d.stateNode,a=void 0!==(l=d.memoizedProps.style)&&null!==l&&l.hasOwnProperty("display")?l.display:null,c.style.display=ge("display",a))}catch(y){kl(e,e.return,y)}}}else if(6===d.tag){if(null===h)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(y){kl(e,e.return,y)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===e)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;null===d.sibling;){if(null===d.return||d.return===e)break e;h===d&&(h=null),d=d.return}h===d&&(h=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:yc(t,e),vc(e),4&n&&gc(e);case 21:}}function vc(e){var t=e.flags;if(2&t){try{e:{for(var r=e.return;null!==r;){if(ac(r)){var n=r;break e}r=r.return}throw Error(o(160))}switch(n.tag){case 5:var i=n.stateNode;32&n.flags&&(de(i,""),n.flags&=-33),uc(e,cc(e),i);break;case 3:case 4:var s=n.stateNode.containerInfo;lc(e,cc(e),s);break;default:throw Error(o(161))}}catch(a){kl(e,e.return,a)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function bc(e,t,r){Za=e,wc(e,t,r)}function wc(e,t,r){for(var n=0!==(1&e.mode);null!==Za;){var i=Za,o=i.child;if(22===i.tag&&n){var s=null!==i.memoizedState||Xa;if(!s){var a=i.alternate,c=null!==a&&null!==a.memoizedState||Ja;a=Xa;var l=Ja;if(Xa=s,(Ja=c)&&!l)for(Za=i;null!==Za;)c=(s=Za).child,22===s.tag&&null!==s.memoizedState?Sc(i):null!==c?(c.return=s,Za=c):Sc(i);for(;null!==o;)Za=o,wc(o,t,r),o=o.sibling;Za=i,Xa=a,Ja=l}Ec(e)}else 0!==(8772&i.subtreeFlags)&&null!==o?(o.return=i,Za=o):Ec(e)}}function Ec(e){for(;null!==Za;){var t=Za;if(0!==(8772&t.flags)){var r=t.alternate;try{if(0!==(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Ja||ic(5,t);break;case 1:var n=t.stateNode;if(4&t.flags&&!Ja)if(null===r)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:mo(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&Fo(t,s,n);break;case 3:var a=t.updateQueue;if(null!==a){if(r=null,null!==t.child)switch(t.child.tag){case 5:case 1:r=t.child.stateNode}Fo(t,a,r)}break;case 5:var c=t.stateNode;if(null===r&&4&t.flags){r=c;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&r.focus();break;case"img":l.src&&(r.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var h=u.memoizedState;if(null!==h){var d=h.dehydrated;null!==d&&qt(d)}}}break;default:throw Error(o(163))}Ja||512&t.flags&&oc(t)}catch(f){kl(t,t.return,f)}}if(t===e){Za=null;break}if(null!==(r=t.sibling)){r.return=t.return,Za=r;break}Za=t.return}}function _c(e){for(;null!==Za;){var t=Za;if(t===e){Za=null;break}var r=t.sibling;if(null!==r){r.return=t.return,Za=r;break}Za=t.return}}function Sc(e){for(;null!==Za;){var t=Za;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{ic(4,t)}catch(c){kl(t,r,c)}break;case 1:var n=t.stateNode;if("function"===typeof n.componentDidMount){var i=t.return;try{n.componentDidMount()}catch(c){kl(t,i,c)}}var o=t.return;try{oc(t)}catch(c){kl(t,o,c)}break;case 5:var s=t.return;try{oc(t)}catch(c){kl(t,s,c)}}}catch(c){kl(t,t.return,c)}if(t===e){Za=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Za=a;break}Za=t.return}}var Ac,kc=Math.ceil,Ic=w.ReactCurrentDispatcher,Cc=w.ReactCurrentOwner,Rc=w.ReactCurrentBatchConfig,Tc=0,xc=null,Pc=null,Dc=0,Nc=0,Oc=Ai(0),Lc=0,Bc=null,Mc=0,Uc=0,Fc=0,jc=null,zc=null,qc=0,Kc=1/0,Vc=null,Hc=!1,Wc=null,Gc=null,Yc=!1,Qc=null,Xc=0,Jc=0,$c=null,Zc=-1,el=0;function tl(){return 0!==(6&Tc)?Je():-1!==Zc?Zc:Zc=Je()}function rl(e){return 0===(1&e.mode)?1:0!==(2&Tc)&&0!==Dc?Dc&-Dc:null!==yo.transition?(0===el&&(el=gt()),el):0!==(e=bt)?e:e=void 0===(e=window.event)?16:Xt(e.type)}function nl(e,t,r,n){if(50<Jc)throw Jc=0,$c=null,Error(o(185));mt(e,r,n),0!==(2&Tc)&&e===xc||(e===xc&&(0===(2&Tc)&&(Uc|=r),4===Lc&&cl(e,Dc)),il(e,n),1===r&&0===Tc&&0===(1&t.mode)&&(Kc=Je()+500,Fi&&qi()))}function il(e,t){var r=e.callbackNode;!function(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var s=31-st(o),a=1<<s,c=i[s];-1===c?0!==(a&r)&&0===(a&n)||(i[s]=ft(a,t)):c<=t&&(e.expiredLanes|=a),o&=~a}}(e,t);var n=dt(e,e===xc?Dc:0);if(0===n)null!==r&&Ye(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(null!=r&&Ye(r),1===t)0===e.tag?function(e){Fi=!0,zi(e)}(ll.bind(null,e)):zi(ll.bind(null,e)),si((function(){0===(6&Tc)&&qi()})),r=null;else{switch(wt(n)){case 1:r=Ze;break;case 4:r=et;break;case 16:default:r=tt;break;case 536870912:r=nt}r=xl(r,ol.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function ol(e,t){if(Zc=-1,el=0,0!==(6&Tc))throw Error(o(327));var r=e.callbackNode;if(Sl()&&e.callbackNode!==r)return null;var n=dt(e,e===xc?Dc:0);if(0===n)return null;if(0!==(30&n)||0!==(n&e.expiredLanes)||t)t=ml(e,n);else{t=n;var i=Tc;Tc|=2;var s=gl();for(xc===e&&Dc===t||(Vc=null,Kc=Je()+500,fl(e,t));;)try{bl();break}catch(c){pl(e,c)}_o(),Ic.current=s,Tc=i,null!==Pc?t=0:(xc=null,Dc=0,t=Lc)}if(0!==t){if(2===t&&(0!==(i=pt(e))&&(n=i,t=sl(e,i))),1===t)throw r=Bc,fl(e,0),cl(e,n),il(e,Je()),r;if(6===t)cl(e,n);else{if(i=e.current.alternate,0===(30&n)&&!function(e){for(var t=e;;){if(16384&t.flags){var r=t.updateQueue;if(null!==r&&null!==(r=r.stores))for(var n=0;n<r.length;n++){var i=r[n],o=i.getSnapshot;i=i.value;try{if(!an(o(),i))return!1}catch(a){return!1}}}if(r=t.child,16384&t.subtreeFlags&&null!==r)r.return=t,t=r;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(i)&&(2===(t=ml(e,n))&&(0!==(s=pt(e))&&(n=s,t=sl(e,s))),1===t))throw r=Bc,fl(e,0),cl(e,n),il(e,Je()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(o(345));case 2:case 5:_l(e,zc,Vc);break;case 3:if(cl(e,n),(130023424&n)===n&&10<(t=qc+500-Je())){if(0!==dt(e,0))break;if(((i=e.suspendedLanes)&n)!==n){tl(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ni(_l.bind(null,e,zc,Vc),t);break}_l(e,zc,Vc);break;case 4:if(cl(e,n),(4194240&n)===n)break;for(t=e.eventTimes,i=-1;0<n;){var a=31-st(n);s=1<<a,(a=t[a])>i&&(i=a),n&=~s}if(n=i,10<(n=(120>(n=Je()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*kc(n/1960))-n)){e.timeoutHandle=ni(_l.bind(null,e,zc,Vc),n);break}_l(e,zc,Vc);break;default:throw Error(o(329))}}}return il(e,Je()),e.callbackNode===r?ol.bind(null,e):null}function sl(e,t){var r=jc;return e.current.memoizedState.isDehydrated&&(fl(e,t).flags|=256),2!==(e=ml(e,t))&&(t=zc,zc=r,null!==t&&al(t)),e}function al(e){null===zc?zc=e:zc.push.apply(zc,e)}function cl(e,t){for(t&=~Fc,t&=~Uc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-st(t),n=1<<r;e[r]=-1,t&=~n}}function ll(e){if(0!==(6&Tc))throw Error(o(327));Sl();var t=dt(e,0);if(0===(1&t))return il(e,Je()),null;var r=ml(e,t);if(0!==e.tag&&2===r){var n=pt(e);0!==n&&(t=n,r=sl(e,n))}if(1===r)throw r=Bc,fl(e,0),cl(e,t),il(e,Je()),r;if(6===r)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,_l(e,zc,Vc),il(e,Je()),null}function ul(e,t){var r=Tc;Tc|=1;try{return e(t)}finally{0===(Tc=r)&&(Kc=Je()+500,Fi&&qi())}}function hl(e){null!==Qc&&0===Qc.tag&&0===(6&Tc)&&Sl();var t=Tc;Tc|=1;var r=Rc.transition,n=bt;try{if(Rc.transition=null,bt=1,e)return e()}finally{bt=n,Rc.transition=r,0===(6&(Tc=t))&&qi()}}function dl(){Nc=Oc.current,ki(Oc)}function fl(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(-1!==r&&(e.timeoutHandle=-1,ii(r)),null!==Pc)for(r=Pc.return;null!==r;){var n=r;switch(to(n),n.tag){case 1:null!==(n=n.type.childContextTypes)&&void 0!==n&&Ni();break;case 3:os(),ki(Ti),ki(Ri),hs();break;case 5:as(n);break;case 4:os();break;case 13:case 19:ki(cs);break;case 10:So(n.type._context);break;case 22:case 23:dl()}r=r.return}if(xc=e,Pc=e=Ol(e.current,null),Dc=Nc=t,Lc=0,Bc=null,Fc=Uc=Mc=0,zc=jc=null,null!==Co){for(t=0;t<Co.length;t++)if(null!==(n=(r=Co[t]).interleaved)){r.interleaved=null;var i=n.next,o=r.pending;if(null!==o){var s=o.next;o.next=i,n.next=s}r.pending=n}Co=null}return e}function pl(e,t){for(;;){var r=Pc;try{if(_o(),ds.current=sa,vs){for(var n=gs.memoizedState;null!==n;){var i=n.queue;null!==i&&(i.pending=null),n=n.next}vs=!1}if(ps=0,ms=ys=gs=null,bs=!1,ws=0,Cc.current=null,null===r||null===r.return){Lc=1,Bc=t,Pc=null;break}e:{var s=e,a=r.return,c=r,l=t;if(t=Dc,c.flags|=32768,null!==l&&"object"===typeof l&&"function"===typeof l.then){var u=l,h=c,d=h.tag;if(0===(1&h.mode)&&(0===d||11===d||15===d)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var p=ma(a);if(null!==p){p.flags&=-257,va(p,a,c,0,t),1&p.mode&&ya(s,u,t),l=u;var g=(t=p).updateQueue;if(null===g){var y=new Set;y.add(l),t.updateQueue=y}else g.add(l);break e}if(0===(1&t)){ya(s,u,t),yl();break e}l=Error(o(426))}else if(io&&1&c.mode){var m=ma(a);if(null!==m){0===(65536&m.flags)&&(m.flags|=256),va(m,a,c,0,t),go(ua(l,c));break e}}s=l=ua(l,c),4!==Lc&&(Lc=2),null===jc?jc=[s]:jc.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,Mo(s,pa(0,l,t));break e;case 1:c=l;var v=s.type,b=s.stateNode;if(0===(128&s.flags)&&("function"===typeof v.getDerivedStateFromError||null!==b&&"function"===typeof b.componentDidCatch&&(null===Gc||!Gc.has(b)))){s.flags|=65536,t&=-t,s.lanes|=t,Mo(s,ga(s,c,t));break e}}s=s.return}while(null!==s)}El(r)}catch(w){t=w,Pc===r&&null!==r&&(Pc=r=r.return);continue}break}}function gl(){var e=Ic.current;return Ic.current=sa,null===e?sa:e}function yl(){0!==Lc&&3!==Lc&&2!==Lc||(Lc=4),null===xc||0===(268435455&Mc)&&0===(268435455&Uc)||cl(xc,Dc)}function ml(e,t){var r=Tc;Tc|=2;var n=gl();for(xc===e&&Dc===t||(Vc=null,fl(e,t));;)try{vl();break}catch(i){pl(e,i)}if(_o(),Tc=r,Ic.current=n,null!==Pc)throw Error(o(261));return xc=null,Dc=0,Lc}function vl(){for(;null!==Pc;)wl(Pc)}function bl(){for(;null!==Pc&&!Qe();)wl(Pc)}function wl(e){var t=Ac(e.alternate,e,Nc);e.memoizedProps=e.pendingProps,null===t?El(e):Pc=t,Cc.current=null}function El(e){var t=e;do{var r=t.alternate;if(e=t.return,0===(32768&t.flags)){if(null!==(r=Ya(r,t,Nc)))return void(Pc=r)}else{if(null!==(r=Qa(r,t)))return r.flags&=32767,void(Pc=r);if(null===e)return Lc=6,void(Pc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Pc=t);Pc=t=e}while(null!==t);0===Lc&&(Lc=5)}function _l(e,t,r){var n=bt,i=Rc.transition;try{Rc.transition=null,bt=1,function(e,t,r,n){do{Sl()}while(null!==Qc);if(0!==(6&Tc))throw Error(o(327));r=e.finishedWork;var i=e.finishedLanes;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var s=r.lanes|r.childLanes;if(function(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-st(r),o=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~o}}(e,s),e===xc&&(Pc=xc=null,Dc=0),0===(2064&r.subtreeFlags)&&0===(2064&r.flags)||Yc||(Yc=!0,xl(tt,(function(){return Sl(),null}))),s=0!==(15990&r.flags),0!==(15990&r.subtreeFlags)||s){s=Rc.transition,Rc.transition=null;var a=bt;bt=1;var c=Tc;Tc|=4,Cc.current=null,function(e,t){if(ei=Vt,fn(e=dn())){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{var n=(r=(r=e.ownerDocument)&&r.defaultView||window).getSelection&&r.getSelection();if(n&&0!==n.rangeCount){r=n.anchorNode;var i=n.anchorOffset,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch(E){r=null;break e}var a=0,c=-1,l=-1,u=0,h=0,d=e,f=null;t:for(;;){for(var p;d!==r||0!==i&&3!==d.nodeType||(c=a+i),d!==s||0!==n&&3!==d.nodeType||(l=a+n),3===d.nodeType&&(a+=d.nodeValue.length),null!==(p=d.firstChild);)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++u===i&&(c=a),f===s&&++h===n&&(l=a),null!==(p=d.nextSibling))break;f=(d=f).parentNode}d=p}r=-1===c||-1===l?null:{start:c,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(ti={focusedElem:e,selectionRange:r},Vt=!1,Za=t;null!==Za;)if(e=(t=Za).child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,Za=e;else for(;null!==Za;){t=Za;try{var g=t.alternate;if(0!==(1024&t.flags))switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==g){var y=g.memoizedProps,m=g.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:mo(t.type,y),m);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;1===w.nodeType?w.textContent="":9===w.nodeType&&w.documentElement&&w.removeChild(w.documentElement);break;default:throw Error(o(163))}}catch(E){kl(t,t.return,E)}if(null!==(e=t.sibling)){e.return=t.return,Za=e;break}Za=t.return}g=rc,rc=!1}(e,r),mc(r,e),pn(ti),Vt=!!ei,ti=ei=null,e.current=r,bc(r,e,i),Xe(),Tc=c,bt=a,Rc.transition=s}else e.current=r;if(Yc&&(Yc=!1,Qc=e,Xc=i),s=e.pendingLanes,0===s&&(Gc=null),function(e){if(ot&&"function"===typeof ot.onCommitFiberRoot)try{ot.onCommitFiberRoot(it,e,void 0,128===(128&e.current.flags))}catch(t){}}(r.stateNode),il(e,Je()),null!==t)for(n=e.onRecoverableError,r=0;r<t.length;r++)i=t[r],n(i.value,{componentStack:i.stack,digest:i.digest});if(Hc)throw Hc=!1,e=Wc,Wc=null,e;0!==(1&Xc)&&0!==e.tag&&Sl(),s=e.pendingLanes,0!==(1&s)?e===$c?Jc++:(Jc=0,$c=e):Jc=0,qi()}(e,t,r,n)}finally{Rc.transition=i,bt=n}return null}function Sl(){if(null!==Qc){var e=wt(Xc),t=Rc.transition,r=bt;try{if(Rc.transition=null,bt=16>e?16:e,null===Qc)var n=!1;else{if(e=Qc,Qc=null,Xc=0,0!==(6&Tc))throw Error(o(331));var i=Tc;for(Tc|=4,Za=e.current;null!==Za;){var s=Za,a=s.child;if(0!==(16&Za.flags)){var c=s.deletions;if(null!==c){for(var l=0;l<c.length;l++){var u=c[l];for(Za=u;null!==Za;){var h=Za;switch(h.tag){case 0:case 11:case 15:nc(8,h,s)}var d=h.child;if(null!==d)d.return=h,Za=d;else for(;null!==Za;){var f=(h=Za).sibling,p=h.return;if(sc(h),h===u){Za=null;break}if(null!==f){f.return=p,Za=f;break}Za=p}}}var g=s.alternate;if(null!==g){var y=g.child;if(null!==y){g.child=null;do{var m=y.sibling;y.sibling=null,y=m}while(null!==y)}}Za=s}}if(0!==(2064&s.subtreeFlags)&&null!==a)a.return=s,Za=a;else e:for(;null!==Za;){if(0!==(2048&(s=Za).flags))switch(s.tag){case 0:case 11:case 15:nc(9,s,s.return)}var v=s.sibling;if(null!==v){v.return=s.return,Za=v;break e}Za=s.return}}var b=e.current;for(Za=b;null!==Za;){var w=(a=Za).child;if(0!==(2064&a.subtreeFlags)&&null!==w)w.return=a,Za=w;else e:for(a=b;null!==Za;){if(0!==(2048&(c=Za).flags))try{switch(c.tag){case 0:case 11:case 15:ic(9,c)}}catch(_){kl(c,c.return,_)}if(c===a){Za=null;break e}var E=c.sibling;if(null!==E){E.return=c.return,Za=E;break e}Za=c.return}}if(Tc=i,qi(),ot&&"function"===typeof ot.onPostCommitFiberRoot)try{ot.onPostCommitFiberRoot(it,e)}catch(_){}n=!0}return n}finally{bt=r,Rc.transition=t}}return!1}function Al(e,t,r){e=Lo(e,t=pa(0,t=ua(r,t),1),1),t=tl(),null!==e&&(mt(e,1,t),il(e,t))}function kl(e,t,r){if(3===e.tag)Al(e,e,r);else for(;null!==t;){if(3===t.tag){Al(t,e,r);break}if(1===t.tag){var n=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof n.componentDidCatch&&(null===Gc||!Gc.has(n))){t=Lo(t,e=ga(t,e=ua(r,e),1),1),e=tl(),null!==t&&(mt(t,1,e),il(t,e));break}}t=t.return}}function Il(e,t,r){var n=e.pingCache;null!==n&&n.delete(t),t=tl(),e.pingedLanes|=e.suspendedLanes&r,xc===e&&(Dc&r)===r&&(4===Lc||3===Lc&&(130023424&Dc)===Dc&&500>Je()-qc?fl(e,0):Fc|=r),il(e,t)}function Cl(e,t){0===t&&(0===(1&e.mode)?t=1:(t=ut,0===(130023424&(ut<<=1))&&(ut=4194304)));var r=tl();null!==(e=xo(e,t))&&(mt(e,t,r),il(e,r))}function Rl(e){var t=e.memoizedState,r=0;null!==t&&(r=t.retryLane),Cl(e,r)}function Tl(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;null!==i&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(o(314))}null!==n&&n.delete(t),Cl(e,r)}function xl(e,t){return Ge(e,t)}function Pl(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dl(e,t,r,n){return new Pl(e,t,r,n)}function Nl(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Ol(e,t){var r=e.alternate;return null===r?((r=Dl(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=14680064&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Ll(e,t,r,n,i,s){var a=2;if(n=e,"function"===typeof e)Nl(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case S:return Bl(r.children,i,s,t);case A:a=8,i|=8;break;case k:return(e=Dl(12,r,t,2|i)).elementType=k,e.lanes=s,e;case T:return(e=Dl(13,r,t,i)).elementType=T,e.lanes=s,e;case x:return(e=Dl(19,r,t,i)).elementType=x,e.lanes=s,e;case N:return Ml(r,i,s,t);default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case I:a=10;break e;case C:a=9;break e;case R:a=11;break e;case P:a=14;break e;case D:a=16,n=null;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=Dl(a,r,t,i)).elementType=e,t.type=n,t.lanes=s,t}function Bl(e,t,r,n){return(e=Dl(7,e,n,t)).lanes=r,e}function Ml(e,t,r,n){return(e=Dl(22,e,n,t)).elementType=N,e.lanes=r,e.stateNode={isHidden:!1},e}function Ul(e,t,r){return(e=Dl(6,e,null,t)).lanes=r,e}function Fl(e,t,r){return(t=Dl(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function jl(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yt(0),this.expirationTimes=yt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yt(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function zl(e,t,r,n,i,o,s,a,c){return e=new jl(e,t,r,a,c),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Dl(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Do(o),e}function ql(e){if(!e)return Ci;e:{if(qe(e=e._reactInternals)!==e||1!==e.tag)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Di(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(o(171))}if(1===e.tag){var r=e.type;if(Di(r))return Li(e,r,t)}return t}function Kl(e,t,r,n,i,o,s,a,c){return(e=zl(r,n,!0,e,0,o,0,a,c)).context=ql(null),r=e.current,(o=Oo(n=tl(),i=rl(r))).callback=void 0!==t&&null!==t?t:null,Lo(r,o,i),e.current.lanes=i,mt(e,i,n),il(e,n),e}function Vl(e,t,r,n){var i=t.current,o=tl(),s=rl(i);return r=ql(r),null===t.context?t.context=r:t.pendingContext=r,(t=Oo(o,s)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),null!==(e=Lo(i,t,s))&&(nl(e,i,s,o),Bo(e,i,s)),s}function Hl(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Wl(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var r=e.retryLane;e.retryLane=0!==r&&r<t?r:t}}function Gl(e,t){Wl(e,t),(e=e.alternate)&&Wl(e,t)}Ac=function(e,t,r){if(null!==e)if(e.memoizedProps!==t.pendingProps||Ti.current)wa=!0;else{if(0===(e.lanes&r)&&0===(128&t.flags))return wa=!1,function(e,t,r){switch(t.tag){case 3:xa(t),po();break;case 5:ss(t);break;case 1:Di(t.type)&&Bi(t);break;case 4:is(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Ii(vo,n._currentValue),n._currentValue=i;break;case 13:if(null!==(n=t.memoizedState))return null!==n.dehydrated?(Ii(cs,1&cs.current),t.flags|=128,null):0!==(r&t.child.childLanes)?Ua(e,t,r):(Ii(cs,1&cs.current),null!==(e=Ha(e,t,r))?e.sibling:null);Ii(cs,1&cs.current);break;case 19:if(n=0!==(r&t.childLanes),0!==(128&e.flags)){if(n)return Ka(e,t,r);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ii(cs,cs.current),n)break;return null;case 22:case 23:return t.lanes=0,ka(e,t,r)}return Ha(e,t,r)}(e,t,r);wa=0!==(131072&e.flags)}else wa=!1,io&&0!==(1048576&t.flags)&&Zi(t,Wi,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Va(e,t),e=t.pendingProps;var i=Pi(t,Ri.current);ko(t,r),i=As(null,t,n,e,i,r);var s=ks();return t.flags|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Di(n)?(s=!0,Bi(t)):s=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Do(t),i.updater=qo,t.stateNode=i,i._reactInternals=t,Wo(t,n,e,r),t=Ta(null,t,n,!0,s,r)):(t.tag=0,io&&s&&eo(t),Ea(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Va(e,t),e=t.pendingProps,n=(i=n._init)(n._payload),t.type=n,i=t.tag=function(e){if("function"===typeof e)return Nl(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===R)return 11;if(e===P)return 14}return 2}(n),e=mo(n,e),i){case 0:t=Ca(null,t,n,e,r);break e;case 1:t=Ra(null,t,n,e,r);break e;case 11:t=_a(null,t,n,e,r);break e;case 14:t=Sa(null,t,n,mo(n.type,e),r);break e}throw Error(o(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,Ca(e,t,n,i=t.elementType===n?i:mo(n,i),r);case 1:return n=t.type,i=t.pendingProps,Ra(e,t,n,i=t.elementType===n?i:mo(n,i),r);case 3:e:{if(xa(t),null===e)throw Error(o(387));n=t.pendingProps,i=(s=t.memoizedState).element,No(e,t),Uo(t,n,null,r);var a=t.memoizedState;if(n=a.element,s.isDehydrated){if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=Pa(e,t,n,r,i=ua(Error(o(423)),t));break e}if(n!==i){t=Pa(e,t,n,r,i=ua(Error(o(424)),t));break e}for(no=li(t.stateNode.containerInfo.firstChild),ro=t,io=!0,oo=null,r=$o(t,null,n,r),t.child=r;r;)r.flags=-3&r.flags|4096,r=r.sibling}else{if(po(),n===i){t=Ha(e,t,r);break e}Ea(e,t,n,r)}t=t.child}return t;case 5:return ss(t),null===e&&lo(t),n=t.type,i=t.pendingProps,s=null!==e?e.memoizedProps:null,a=i.children,ri(n,i)?a=null:null!==s&&ri(n,s)&&(t.flags|=32),Ia(e,t),Ea(e,t,a,r),t.child;case 6:return null===e&&lo(t),null;case 13:return Ua(e,t,r);case 4:return is(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=Jo(t,null,n,r):Ea(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,_a(e,t,n,i=t.elementType===n?i:mo(n,i),r);case 7:return Ea(e,t,t.pendingProps,r),t.child;case 8:case 12:return Ea(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value,Ii(vo,n._currentValue),n._currentValue=a,null!==s)if(an(s.value,a)){if(s.children===i.children&&!Ti.current){t=Ha(e,t,r);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var c=s.dependencies;if(null!==c){a=s.child;for(var l=c.firstContext;null!==l;){if(l.context===n){if(1===s.tag){(l=Oo(-1,r&-r)).tag=2;var u=s.updateQueue;if(null!==u){var h=(u=u.shared).pending;null===h?l.next=l:(l.next=h.next,h.next=l),u.pending=l}}s.lanes|=r,null!==(l=s.alternate)&&(l.lanes|=r),Ao(s.return,r,t),c.lanes|=r;break}l=l.next}}else if(10===s.tag)a=s.type===t.type?null:s.child;else if(18===s.tag){if(null===(a=s.return))throw Error(o(341));a.lanes|=r,null!==(c=a.alternate)&&(c.lanes|=r),Ao(a,r,t),a=s.sibling}else a=s.child;if(null!==a)a.return=s;else for(a=s;null!==a;){if(a===t){a=null;break}if(null!==(s=a.sibling)){s.return=a.return,a=s;break}a=a.return}s=a}Ea(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,ko(t,r),n=n(i=Io(i)),t.flags|=1,Ea(e,t,n,r),t.child;case 14:return i=mo(n=t.type,t.pendingProps),Sa(e,t,n,i=mo(n.type,i),r);case 15:return Aa(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:mo(n,i),Va(e,t),t.tag=1,Di(n)?(e=!0,Bi(t)):e=!1,ko(t,r),Vo(t,n,i),Wo(t,n,i,r),Ta(null,t,n,!0,e,r);case 19:return Ka(e,t,r);case 22:return ka(e,t,r)}throw Error(o(156,t.tag))};var Yl="function"===typeof reportError?reportError:function(e){console.error(e)};function Ql(e){this._internalRoot=e}function Xl(e){this._internalRoot=e}function Jl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function $l(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Zl(){}function eu(e,t,r,n,i){var o=r._reactRootContainer;if(o){var s=o;if("function"===typeof i){var a=i;i=function(){var e=Hl(s);a.call(e)}}Vl(t,s,e,i)}else s=function(e,t,r,n,i){if(i){if("function"===typeof n){var o=n;n=function(){var e=Hl(s);o.call(e)}}var s=Kl(t,n,e,0,null,!1,0,"",Zl);return e._reactRootContainer=s,e[pi]=s.current,qn(8===e.nodeType?e.parentNode:e),hl(),s}for(;i=e.lastChild;)e.removeChild(i);if("function"===typeof n){var a=n;n=function(){var e=Hl(c);a.call(e)}}var c=zl(e,0,!1,null,0,!1,0,"",Zl);return e._reactRootContainer=c,e[pi]=c.current,qn(8===e.nodeType?e.parentNode:e),hl((function(){Vl(t,c,r,n)})),c}(r,t,e,i,n);return Hl(s)}Xl.prototype.render=Ql.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(o(409));Vl(e,t,null,null)},Xl.prototype.unmount=Ql.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;hl((function(){Vl(null,e,null,null)})),t[pi]=null}},Xl.prototype.unstable_scheduleHydration=function(e){if(e){var t=At();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Nt.length&&0!==t&&t<Nt[r].priority;r++);Nt.splice(r,0,e),0===r&&Mt(e)}},Et=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ht(t.pendingLanes);0!==r&&(vt(t,1|r),il(t,Je()),0===(6&Tc)&&(Kc=Je()+500,qi()))}break;case 13:hl((function(){var t=xo(e,1);if(null!==t){var r=tl();nl(t,e,1,r)}})),Gl(e,1)}},_t=function(e){if(13===e.tag){var t=xo(e,134217728);if(null!==t)nl(t,e,134217728,tl());Gl(e,134217728)}},St=function(e){if(13===e.tag){var t=rl(e),r=xo(e,t);if(null!==r)nl(r,e,t,tl());Gl(e,t)}},At=function(){return bt},kt=function(e,t){var r=bt;try{return bt=e,t()}finally{bt=r}},_e=function(e,t,r){switch(t){case"input":if($(e,r),t=r.name,"radio"===r.type&&null!=t){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=Ei(n);if(!i)throw Error(o(90));G(n),$(n,i)}}}break;case"textarea":oe(e,r);break;case"select":null!=(t=r.value)&&re(e,!!r.multiple,t,!1)}},Re=ul,Te=hl;var tu={usingClientEntryPoint:!1,Events:[bi,wi,Ei,Ie,Ce,ul]},ru={findFiberByHostInstance:vi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},nu={bundleType:ru.bundleType,version:ru.version,rendererPackageName:ru.rendererPackageName,rendererConfig:ru.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=He(e))?null:e.stateNode},findFiberByHostInstance:ru.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var iu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iu.isDisabled&&iu.supportsFiber)try{it=iu.inject(nu),ot=iu}catch(ue){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tu,t.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Jl(t))throw Error(o(200));return function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:_,key:null==n?null:""+n,children:e,containerInfo:t,implementation:r}}(e,t,null,r)},t.createRoot=function(e,t){if(!Jl(e))throw Error(o(299));var r=!1,n="",i=Yl;return null!==t&&void 0!==t&&(!0===t.unstable_strictMode&&(r=!0),void 0!==t.identifierPrefix&&(n=t.identifierPrefix),void 0!==t.onRecoverableError&&(i=t.onRecoverableError)),t=zl(e,1,!1,null,0,r,0,n,i),e[pi]=t.current,qn(8===e.nodeType?e.parentNode:e),new Ql(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"===typeof e.render)throw Error(o(188));throw e=Object.keys(e).join(","),Error(o(268,e))}return e=null===(e=He(t))?null:e.stateNode},t.flushSync=function(e){return hl(e)},t.hydrate=function(e,t,r){if(!$l(t))throw Error(o(200));return eu(null,e,t,!0,r)},t.hydrateRoot=function(e,t,r){if(!Jl(e))throw Error(o(405));var n=null!=r&&r.hydratedSources||null,i=!1,s="",a=Yl;if(null!==r&&void 0!==r&&(!0===r.unstable_strictMode&&(i=!0),void 0!==r.identifierPrefix&&(s=r.identifierPrefix),void 0!==r.onRecoverableError&&(a=r.onRecoverableError)),t=Kl(t,null,e,1,null!=r?r:null,i,0,s,a),e[pi]=t.current,qn(e),n)for(e=0;e<n.length;e++)i=(i=(r=n[e])._getVersion)(r._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new Xl(t)},t.render=function(e,t,r){if(!$l(t))throw Error(o(200));return eu(null,e,t,!1,r)},t.unmountComponentAtNode=function(e){if(!$l(e))throw Error(o(40));return!!e._reactRootContainer&&(hl((function(){eu(null,null,e,!1,(function(){e._reactRootContainer=null,e[pi]=null}))})),!0)},t.unstable_batchedUpdates=ul,t.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!$l(r))throw Error(o(200));if(null==e||void 0===e._reactInternals)throw Error(o(38));return eu(e,t,r,!1,n)},t.version="18.2.0-next-9e3b772b8-20220608"},1352:(e,t,r)=>{"use strict";var n=r(7119);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},7119:(e,t,r)=>{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=r(8345)},2654:(e,t,r)=>{"use strict";var n=r(9950),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var n,o={},l=null,u=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,n)&&!c.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===o[n]&&(o[n]=t[n]);return{$$typeof:i,type:e,key:l,ref:u,props:o,_owner:a.current}}t.jsx=l,t.jsxs=l},2049:(e,t)=>{"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function m(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}function v(){}function b(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=m.prototype;var w=b.prototype=new v;w.constructor=b,g(w,m.prototype),w.isPureReactComponent=!0;var E=Array.isArray,_=Object.prototype.hasOwnProperty,S={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,n){var i,o={},s=null,a=null;if(null!=t)for(i in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(s=""+t.key),t)_.call(t,i)&&!A.hasOwnProperty(i)&&(o[i]=t[i]);var c=arguments.length-2;if(1===c)o.children=n;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];o.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps)void 0===o[i]&&(o[i]=c[i]);return{$$typeof:r,type:e,key:s,ref:a,props:o,_owner:S.current}}function I(e){return"object"===typeof e&&null!==e&&e.$$typeof===r}var C=/\/+/g;function R(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function T(e,t,i,o,s){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var c=!1;if(null===e)c=!0;else switch(a){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case r:case n:c=!0}}if(c)return s=s(c=e),e=""===o?"."+R(c,0):o,E(s)?(i="",null!=e&&(i=e.replace(C,"$&/")+"/"),T(s,t,i,"",(function(e){return e}))):null!=s&&(I(s)&&(s=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,i+(!s.key||c&&c.key===s.key?"":(""+s.key).replace(C,"$&/")+"/")+e)),t.push(s)),1;if(c=0,o=""===o?".":o+":",E(e))for(var l=0;l<e.length;l++){var u=o+R(a=e[l],l);c+=T(a,t,i,u,s)}else if(u=function(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"===typeof u)for(e=u.call(e),l=0;!(a=e.next()).done;)c+=T(a=a.value,t,i,u=o+R(a,l++),s);else if("object"===a)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function x(e,t,r){if(null==e)return e;var n=[],i=0;return T(e,n,"","",(function(e){return t.call(r,e,i++)})),n}function P(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var D={current:null},N={transition:null},O={ReactCurrentDispatcher:D,ReactCurrentBatchConfig:N,ReactCurrentOwner:S};t.Children={map:x,forEach:function(e,t,r){x(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return x(e,(function(){t++})),t},toArray:function(e){return x(e,(function(e){return e}))||[]},only:function(e){if(!I(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=m,t.Fragment=i,t.Profiler=s,t.PureComponent=b,t.StrictMode=o,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,t.cloneElement=function(e,t,n){if(null===e||void 0===e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=g({},e.props),o=e.key,s=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,a=S.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)_.call(t,l)&&!A.hasOwnProperty(l)&&(i[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)i.children=n;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:r,type:e.type,key:o,ref:s,props:i,_owner:a}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},t.createElement=k,t.createFactory=function(e){var t=k.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=I,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:P}},t.memo=function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return D.current.useCallback(e,t)},t.useContext=function(e){return D.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return D.current.useDeferredValue(e)},t.useEffect=function(e,t){return D.current.useEffect(e,t)},t.useId=function(){return D.current.useId()},t.useImperativeHandle=function(e,t,r){return D.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return D.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return D.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return D.current.useMemo(e,t)},t.useReducer=function(e,t,r){return D.current.useReducer(e,t,r)},t.useRef=function(e){return D.current.useRef(e)},t.useState=function(e){return D.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return D.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return D.current.useTransition()},t.version="18.2.0"},9950:(e,t,r)=>{"use strict";e.exports=r(2049)},4414:(e,t,r)=>{"use strict";e.exports=r(2654)},374:(e,t,r)=>{"use strict";var n=r(797),i=/[\/\?<>\\:\*\|"]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function l(e,t){if("string"!==typeof e)throw new Error("Input must be string");var r=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(c,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=l(e,r);return""===r?n:l(n,"")}},1761:(e,t)=>{"use strict";function r(e,t){var r=e.length;e.push(t);e:for(;0<r;){var n=r-1>>>1,i=e[n];if(!(0<o(i,t)))break e;e[n]=t,e[r]=i,r=n}}function n(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;e:for(var n=0,i=e.length,s=i>>>1;n<s;){var a=2*(n+1)-1,c=e[a],l=a+1,u=e[l];if(0>o(c,r))l<i&&0>o(u,c)?(e[n]=u,e[l]=r,n=l):(e[n]=c,e[a]=r,n=a);else{if(!(l<i&&0>o(u,r)))break e;e[n]=u,e[l]=r,n=l}}}return t}function o(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if("object"===typeof performance&&"function"===typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var l=[],u=[],h=1,d=null,f=3,p=!1,g=!1,y=!1,m="function"===typeof setTimeout?setTimeout:null,v="function"===typeof clearTimeout?clearTimeout:null,b="undefined"!==typeof setImmediate?setImmediate:null;function w(e){for(var t=n(u);null!==t;){if(null===t.callback)i(u);else{if(!(t.startTime<=e))break;i(u),t.sortIndex=t.expirationTime,r(l,t)}t=n(u)}}function E(e){if(y=!1,w(e),!g)if(null!==n(l))g=!0,N(_);else{var t=n(u);null!==t&&O(E,t.startTime-e)}}function _(e,r){g=!1,y&&(y=!1,v(I),I=-1),p=!0;var o=f;try{for(w(r),d=n(l);null!==d&&(!(d.expirationTime>r)||e&&!T());){var s=d.callback;if("function"===typeof s){d.callback=null,f=d.priorityLevel;var a=s(d.expirationTime<=r);r=t.unstable_now(),"function"===typeof a?d.callback=a:d===n(l)&&i(l),w(r)}else i(l);d=n(l)}if(null!==d)var c=!0;else{var h=n(u);null!==h&&O(E,h.startTime-r),c=!1}return c}finally{d=null,f=o,p=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,A=!1,k=null,I=-1,C=5,R=-1;function T(){return!(t.unstable_now()-R<C)}function x(){if(null!==k){var e=t.unstable_now();R=e;var r=!0;try{r=k(!0,e)}finally{r?S():(A=!1,k=null)}}else A=!1}if("function"===typeof b)S=function(){b(x)};else if("undefined"!==typeof MessageChannel){var P=new MessageChannel,D=P.port2;P.port1.onmessage=x,S=function(){D.postMessage(null)}}else S=function(){m(x,0)};function N(e){k=e,A||(A=!0,S())}function O(e,r){I=m((function(){e(t.unstable_now())}),r)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){g||p||(g=!0,N(_))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var r=f;f=t;try{return e()}finally{f=r}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=f;f=e;try{return t()}finally{f=r}},t.unstable_scheduleCallback=function(e,i,o){var s=t.unstable_now();switch("object"===typeof o&&null!==o?o="number"===typeof(o=o.delay)&&0<o?s+o:s:o=s,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return e={id:h++,callback:i,priorityLevel:e,startTime:o,expirationTime:a=o+a,sortIndex:-1},o>s?(e.sortIndex=o,r(u,e),null===n(l)&&e===n(u)&&(y?(v(I),I=-1):y=!0,O(E,o-s))):(e.sortIndex=a,r(l,e),g||p||(g=!0,N(_))),e},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(e){var t=f;return function(){var r=f;f=t;try{return e.apply(this,arguments)}finally{f=r}}}},5340:(e,t,r)=>{"use strict";e.exports=r(1761)},797:(e,t,r)=>{"use strict";var n=r(5155),i=r(8008);e.exports=n.bind(null,i)},5155:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e,n,i){if("string"!==typeof n)throw new Error("Input must be string");for(var o,s,a=n.length,c=0,l=0;l<a;l+=1){if(o=n.charCodeAt(l),s=n[l],t(o)&&r(n.charCodeAt(l+1))&&(s+=n[l+=1]),(c+=e(s))===i)return n.slice(0,l+1);if(c>i)return n.slice(0,l-s.length+1)}return n}},8008:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!==typeof e)throw new Error("Input must be string");for(var n=e.length,i=0,o=null,s=null,a=0;a<n;a++)r(o=e.charCodeAt(a))?null!=s&&t(s)?i+=1:i+=3:o<=127?i+=1:o>=128&&o<=2047?i+=2:o>=2048&&o<=65535&&(i+=3),s=o;return i}},2967:e=>{e.exports=function e(n,i){var o,s=0,a=0,c=i=i||0,l=n.length;do{if(c>=l||a>49)throw e.bytes=0,new RangeError("Could not decode varint");o=n[c++],s+=a<28?(o&r)<<a:(o&r)*Math.pow(2,a),a+=7}while(o>=t);return e.bytes=c-i,s};var t=128,r=127},6979:e=>{e.exports=function e(i,o,s){if(Number.MAX_SAFE_INTEGER&&i>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");o=o||[];var a=s=s||0;for(;i>=n;)o[s++]=255&i|t,i/=128;for(;i&r;)o[s++]=255&i|t,i>>>=7;return o[s]=0|i,e.bytes=s-a+1,o};var t=128,r=-128,n=Math.pow(2,31)},9085:(e,t,r)=>{e.exports={encode:r(6979),decode:r(2967),encodingLength:r(5901)}},5901:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<i?4:e<o?5:e<s?6:e<a?7:e<c?8:e<l?9:10}},9122:()=>{},495:()=>{},310:()=>{},4658:()=>{},7287:()=>{},2032:function(e,t,r){var n,i,o;i=[r(6516)],void 0===(o="function"===typeof(n=function(e){"use strict";var t=e.Reader,r=e.Writer,n=e.util,i=e.roots.default||(e.roots.default={});return i.RPC=function(){function o(e){if(this.subscriptions=[],this.messages=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var s;return o.prototype.subscriptions=n.emptyArray,o.prototype.messages=n.emptyArray,o.prototype.control=null,Object.defineProperty(o.prototype,"_control",{get:n.oneOfGetter(s=["control"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){if(t||(t=r.create()),null!=e.subscriptions&&e.subscriptions.length)for(var n=0;n<e.subscriptions.length;++n)i.RPC.SubOpts.encode(e.subscriptions[n],t.uint32(10).fork()).ldelim();if(null!=e.messages&&e.messages.length)for(n=0;n<e.messages.length;++n)i.RPC.Message.encode(e.messages[n],t.uint32(18).fork()).ldelim();return null!=e.control&&Object.hasOwnProperty.call(e,"control")&&i.RPC.ControlMessage.encode(e.control,t.uint32(26).fork()).ldelim(),t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.subscriptions&&o.subscriptions.length||(o.subscriptions=[]),o.subscriptions.push(i.RPC.SubOpts.decode(e,e.uint32()));break;case 2:o.messages&&o.messages.length||(o.messages=[]),o.messages.push(i.RPC.Message.decode(e,e.uint32()));break;case 3:o.control=i.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},o.fromObject=function(e){if(e instanceof i.RPC)return e;var t=new i.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r<e.subscriptions.length;++r){if("object"!==typeof e.subscriptions[r])throw TypeError(".RPC.subscriptions: object expected");t.subscriptions[r]=i.RPC.SubOpts.fromObject(e.subscriptions[r])}}if(e.messages){if(!Array.isArray(e.messages))throw TypeError(".RPC.messages: array expected");for(t.messages=[],r=0;r<e.messages.length;++r){if("object"!==typeof e.messages[r])throw TypeError(".RPC.messages: object expected");t.messages[r]=i.RPC.Message.fromObject(e.messages[r])}}if(null!=e.control){if("object"!==typeof e.control)throw TypeError(".RPC.control: object expected");t.control=i.RPC.ControlMessage.fromObject(e.control)}return t},o.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.subscriptions=[],r.messages=[]),e.subscriptions&&e.subscriptions.length){r.subscriptions=[];for(var n=0;n<e.subscriptions.length;++n)r.subscriptions[n]=i.RPC.SubOpts.toObject(e.subscriptions[n],t)}if(e.messages&&e.messages.length)for(r.messages=[],n=0;n<e.messages.length;++n)r.messages[n]=i.RPC.Message.toObject(e.messages[n],t);return null!=e.control&&e.hasOwnProperty("control")&&(r.control=i.RPC.ControlMessage.toObject(e.control,t),t.oneofs&&(r._control="control")),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o.SubOpts=function(){function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var s;return o.prototype.subscribe=null,o.prototype.topic=null,Object.defineProperty(o.prototype,"_subscribe",{get:n.oneOfGetter(s=["subscribe"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_topic",{get:n.oneOfGetter(s=["topic"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){return t||(t=r.create()),null!=e.subscribe&&Object.hasOwnProperty.call(e,"subscribe")&&t.uint32(8).bool(e.subscribe),null!=e.topic&&Object.hasOwnProperty.call(e,"topic")&&t.uint32(18).string(e.topic),t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.SubOpts;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.subscribe=e.bool();break;case 2:o.topic=e.string();break;default:e.skipType(7&s)}}return o},o.fromObject=function(e){if(e instanceof i.RPC.SubOpts)return e;var t=new i.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topic&&(t.topic=String(e.topic)),t},o.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic,t.oneofs&&(r._topic="topic")),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.Message=function(){function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var s;return o.prototype.from=null,o.prototype.data=null,o.prototype.seqno=null,o.prototype.topic="",o.prototype.signature=null,o.prototype.key=null,Object.defineProperty(o.prototype,"_from",{get:n.oneOfGetter(s=["from"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_data",{get:n.oneOfGetter(s=["data"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_seqno",{get:n.oneOfGetter(s=["seqno"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_signature",{get:n.oneOfGetter(s=["signature"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_key",{get:n.oneOfGetter(s=["key"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){return t||(t=r.create()),null!=e.from&&Object.hasOwnProperty.call(e,"from")&&t.uint32(10).bytes(e.from),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(26).bytes(e.seqno),t.uint32(34).string(e.topic),null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(50).bytes(e.key),t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var o=void 0===r?e.len:e.pos+r,s=new i.RPC.Message;e.pos<o;){var a=e.uint32();switch(a>>>3){case 1:s.from=e.bytes();break;case 2:s.data=e.bytes();break;case 3:s.seqno=e.bytes();break;case 4:s.topic=e.string();break;case 5:s.signature=e.bytes();break;case 6:s.key=e.bytes();break;default:e.skipType(7&a)}}if(!s.hasOwnProperty("topic"))throw n.ProtocolError("missing required 'topic'",{instance:s});return s},o.fromObject=function(e){if(e instanceof i.RPC.Message)return e;var t=new i.RPC.Message;return null!=e.from&&("string"===typeof e.from?n.base64.decode(e.from,t.from=n.newBuffer(n.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"===typeof e.data?n.base64.decode(e.data,t.data=n.newBuffer(n.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"===typeof e.seqno?n.base64.decode(e.seqno,t.seqno=n.newBuffer(n.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),null!=e.topic&&(t.topic=String(e.topic)),null!=e.signature&&("string"===typeof e.signature?n.base64.decode(e.signature,t.signature=n.newBuffer(n.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"===typeof e.key?n.base64.decode(e.key,t.key=n.newBuffer(n.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},o.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.topic=""),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?n.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?n.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?n.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),null!=e.topic&&e.hasOwnProperty("topic")&&(r.topic=e.topic),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?n.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?n.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlMessage=function(){function o(e){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return o.prototype.ihave=n.emptyArray,o.prototype.iwant=n.emptyArray,o.prototype.graft=n.emptyArray,o.prototype.prune=n.emptyArray,o.encode=function(e,t){if(t||(t=r.create()),null!=e.ihave&&e.ihave.length)for(var n=0;n<e.ihave.length;++n)i.RPC.ControlIHave.encode(e.ihave[n],t.uint32(10).fork()).ldelim();if(null!=e.iwant&&e.iwant.length)for(n=0;n<e.iwant.length;++n)i.RPC.ControlIWant.encode(e.iwant[n],t.uint32(18).fork()).ldelim();if(null!=e.graft&&e.graft.length)for(n=0;n<e.graft.length;++n)i.RPC.ControlGraft.encode(e.graft[n],t.uint32(26).fork()).ldelim();if(null!=e.prune&&e.prune.length)for(n=0;n<e.prune.length;++n)i.RPC.ControlPrune.encode(e.prune[n],t.uint32(34).fork()).ldelim();return t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.ihave&&o.ihave.length||(o.ihave=[]),o.ihave.push(i.RPC.ControlIHave.decode(e,e.uint32()));break;case 2:o.iwant&&o.iwant.length||(o.iwant=[]),o.iwant.push(i.RPC.ControlIWant.decode(e,e.uint32()));break;case 3:o.graft&&o.graft.length||(o.graft=[]),o.graft.push(i.RPC.ControlGraft.decode(e,e.uint32()));break;case 4:o.prune&&o.prune.length||(o.prune=[]),o.prune.push(i.RPC.ControlPrune.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},o.fromObject=function(e){if(e instanceof i.RPC.ControlMessage)return e;var t=new i.RPC.ControlMessage;if(e.ihave){if(!Array.isArray(e.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");t.ihave=[];for(var r=0;r<e.ihave.length;++r){if("object"!==typeof e.ihave[r])throw TypeError(".RPC.ControlMessage.ihave: object expected");t.ihave[r]=i.RPC.ControlIHave.fromObject(e.ihave[r])}}if(e.iwant){if(!Array.isArray(e.iwant))throw TypeError(".RPC.ControlMessage.iwant: array expected");for(t.iwant=[],r=0;r<e.iwant.length;++r){if("object"!==typeof e.iwant[r])throw TypeError(".RPC.ControlMessage.iwant: object expected");t.iwant[r]=i.RPC.ControlIWant.fromObject(e.iwant[r])}}if(e.graft){if(!Array.isArray(e.graft))throw TypeError(".RPC.ControlMessage.graft: array expected");for(t.graft=[],r=0;r<e.graft.length;++r){if("object"!==typeof e.graft[r])throw TypeError(".RPC.ControlMessage.graft: object expected");t.graft[r]=i.RPC.ControlGraft.fromObject(e.graft[r])}}if(e.prune){if(!Array.isArray(e.prune))throw TypeError(".RPC.ControlMessage.prune: array expected");for(t.prune=[],r=0;r<e.prune.length;++r){if("object"!==typeof e.prune[r])throw TypeError(".RPC.ControlMessage.prune: object expected");t.prune[r]=i.RPC.ControlPrune.fromObject(e.prune[r])}}return t},o.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.ihave=[],r.iwant=[],r.graft=[],r.prune=[]),e.ihave&&e.ihave.length){r.ihave=[];for(var n=0;n<e.ihave.length;++n)r.ihave[n]=i.RPC.ControlIHave.toObject(e.ihave[n],t)}if(e.iwant&&e.iwant.length)for(r.iwant=[],n=0;n<e.iwant.length;++n)r.iwant[n]=i.RPC.ControlIWant.toObject(e.iwant[n],t);if(e.graft&&e.graft.length)for(r.graft=[],n=0;n<e.graft.length;++n)r.graft[n]=i.RPC.ControlGraft.toObject(e.graft[n],t);if(e.prune&&e.prune.length)for(r.prune=[],n=0;n<e.prune.length;++n)r.prune[n]=i.RPC.ControlPrune.toObject(e.prune[n],t);return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlIHave=function(){function o(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var s;return o.prototype.topicID=null,o.prototype.messageIDs=n.emptyArray,Object.defineProperty(o.prototype,"_topicID",{get:n.oneOfGetter(s=["topicID"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.messageIDs&&e.messageIDs.length)for(var n=0;n<e.messageIDs.length;++n)t.uint32(18).bytes(e.messageIDs[n]);return t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlIHave;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.topicID=e.string();break;case 2:o.messageIDs&&o.messageIDs.length||(o.messageIDs=[]),o.messageIDs.push(e.bytes());break;default:e.skipType(7&s)}}return o},o.fromObject=function(e){if(e instanceof i.RPC.ControlIHave)return e;var t=new i.RPC.ControlIHave;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"===typeof e.messageIDs[r]?n.base64.decode(e.messageIDs[r],t.messageIDs[r]=n.newBuffer(n.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},o.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var i=0;i<e.messageIDs.length;++i)r.messageIDs[i]=t.bytes===String?n.base64.encode(e.messageIDs[i],0,e.messageIDs[i].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[i]):e.messageIDs[i]}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlIWant=function(){function o(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return o.prototype.messageIDs=n.emptyArray,o.encode=function(e,t){if(t||(t=r.create()),null!=e.messageIDs&&e.messageIDs.length)for(var n=0;n<e.messageIDs.length;++n)t.uint32(10).bytes(e.messageIDs[n]);return t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlIWant;e.pos<n;){var s=e.uint32();s>>>3===1?(o.messageIDs&&o.messageIDs.length||(o.messageIDs=[]),o.messageIDs.push(e.bytes())):e.skipType(7&s)}return o},o.fromObject=function(e){if(e instanceof i.RPC.ControlIWant)return e;var t=new i.RPC.ControlIWant;if(e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"===typeof e.messageIDs[r]?n.base64.decode(e.messageIDs[r],t.messageIDs[r]=n.newBuffer(n.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},o.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var i=0;i<e.messageIDs.length;++i)r.messageIDs[i]=t.bytes===String?n.base64.encode(e.messageIDs[i],0,e.messageIDs[i].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[i]):e.messageIDs[i]}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlGraft=function(){function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var s;return o.prototype.topicID=null,Object.defineProperty(o.prototype,"_topicID",{get:n.oneOfGetter(s=["topicID"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){return t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlGraft;e.pos<n;){var s=e.uint32();s>>>3===1?o.topicID=e.string():e.skipType(7&s)}return o},o.fromObject=function(e){if(e instanceof i.RPC.ControlGraft)return e;var t=new i.RPC.ControlGraft;return null!=e.topicID&&(t.topicID=String(e.topicID)),t},o.toObject=function(e,t){t||(t={});var r={};return null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlPrune=function(){function o(e){if(this.peers=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var s;return o.prototype.topicID=null,o.prototype.peers=n.emptyArray,o.prototype.backoff=null,Object.defineProperty(o.prototype,"_topicID",{get:n.oneOfGetter(s=["topicID"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_backoff",{get:n.oneOfGetter(s=["backoff"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.peers&&e.peers.length)for(var n=0;n<e.peers.length;++n)i.RPC.PeerInfo.encode(e.peers[n],t.uint32(18).fork()).ldelim();return null!=e.backoff&&Object.hasOwnProperty.call(e,"backoff")&&t.uint32(24).uint64(e.backoff),t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlPrune;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.topicID=e.string();break;case 2:o.peers&&o.peers.length||(o.peers=[]),o.peers.push(i.RPC.PeerInfo.decode(e,e.uint32()));break;case 3:o.backoff=e.uint64();break;default:e.skipType(7&s)}}return o},o.fromObject=function(e){if(e instanceof i.RPC.ControlPrune)return e;var t=new i.RPC.ControlPrune;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.peers){if(!Array.isArray(e.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");t.peers=[];for(var r=0;r<e.peers.length;++r){if("object"!==typeof e.peers[r])throw TypeError(".RPC.ControlPrune.peers: object expected");t.peers[r]=i.RPC.PeerInfo.fromObject(e.peers[r])}}return null!=e.backoff&&(n.Long?(t.backoff=n.Long.fromValue(e.backoff)).unsigned=!0:"string"===typeof e.backoff?t.backoff=parseInt(e.backoff,10):"number"===typeof e.backoff?t.backoff=e.backoff:"object"===typeof e.backoff&&(t.backoff=new n.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0))),t},o.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.peers=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.peers&&e.peers.length){r.peers=[];for(var o=0;o<e.peers.length;++o)r.peers[o]=i.RPC.PeerInfo.toObject(e.peers[o],t)}return null!=e.backoff&&e.hasOwnProperty("backoff")&&("number"===typeof e.backoff?r.backoff=t.longs===String?String(e.backoff):e.backoff:r.backoff=t.longs===String?n.Long.prototype.toString.call(e.backoff):t.longs===Number?new n.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0):e.backoff,t.oneofs&&(r._backoff="backoff")),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.PeerInfo=function(){function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var s;return o.prototype.peerID=null,o.prototype.signedPeerRecord=null,Object.defineProperty(o.prototype,"_peerID",{get:n.oneOfGetter(s=["peerID"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_signedPeerRecord",{get:n.oneOfGetter(s=["signedPeerRecord"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){return t||(t=r.create()),null!=e.peerID&&Object.hasOwnProperty.call(e,"peerID")&&t.uint32(10).bytes(e.peerID),null!=e.signedPeerRecord&&Object.hasOwnProperty.call(e,"signedPeerRecord")&&t.uint32(18).bytes(e.signedPeerRecord),t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.PeerInfo;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.peerID=e.bytes();break;case 2:o.signedPeerRecord=e.bytes();break;default:e.skipType(7&s)}}return o},o.fromObject=function(e){if(e instanceof i.RPC.PeerInfo)return e;var t=new i.RPC.PeerInfo;return null!=e.peerID&&("string"===typeof e.peerID?n.base64.decode(e.peerID,t.peerID=n.newBuffer(n.base64.length(e.peerID)),0):e.peerID.length&&(t.peerID=e.peerID)),null!=e.signedPeerRecord&&("string"===typeof e.signedPeerRecord?n.base64.decode(e.signedPeerRecord,t.signedPeerRecord=n.newBuffer(n.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},o.toObject=function(e,t){t||(t={});var r={};return null!=e.peerID&&e.hasOwnProperty("peerID")&&(r.peerID=t.bytes===String?n.base64.encode(e.peerID,0,e.peerID.length):t.bytes===Array?Array.prototype.slice.call(e.peerID):e.peerID,t.oneofs&&(r._peerID="peerID")),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?n.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord,t.oneofs&&(r._signedPeerRecord="signedPeerRecord")),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o}(),i})?n.apply(t,i):n)||(e.exports=o)}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.amdO={},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;__webpack_require__.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"===typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"===typeof r.then)return r}var i=Object.create(null);__webpack_require__.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>r[e]));return o.default=()=>r,__webpack_require__.d(i,o),i}})(),__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";var e={};__webpack_require__.r(e),__webpack_require__.d(e,{base58btc:()=>St,base58flickr:()=>At});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{base32:()=>kt,base32hex:()=>Tt,base32hexpad:()=>Pt,base32hexpadupper:()=>Dt,base32hexupper:()=>xt,base32pad:()=>Ct,base32padupper:()=>Rt,base32upper:()=>It,base32z:()=>Nt});var r={};__webpack_require__.r(r),__webpack_require__.d(r,{base10:()=>hr});var n={};__webpack_require__.r(n),__webpack_require__.d(n,{base16:()=>dr,base16upper:()=>fr});var i={};__webpack_require__.r(i),__webpack_require__.d(i,{base2:()=>pr});var o={};__webpack_require__.r(o),__webpack_require__.d(o,{base256emoji:()=>vr});var s={};__webpack_require__.r(s),__webpack_require__.d(s,{base36:()=>br,base36upper:()=>wr});var a={};__webpack_require__.r(a),__webpack_require__.d(a,{base64:()=>Er,base64pad:()=>_r,base64url:()=>Sr,base64urlpad:()=>Ar});var c={};__webpack_require__.r(c),__webpack_require__.d(c,{base8:()=>kr});var l={};__webpack_require__.r(l),__webpack_require__.d(l,{identity:()=>Ir});var u={};__webpack_require__.r(u),__webpack_require__.d(u,{code:()=>xr,decode:()=>Dr,encode:()=>Pr,name:()=>Tr});var h={};__webpack_require__.r(h),__webpack_require__.d(h,{code:()=>Or,decode:()=>Br,encode:()=>Lr,name:()=>Nr});var d={};__webpack_require__.r(d),__webpack_require__.d(d,{identity:()=>Ur});var f={};__webpack_require__.r(f),__webpack_require__.d(f,{sha256:()=>qr,sha512:()=>Kr});var p={};__webpack_require__.r(p),__webpack_require__.d(p,{base10:()=>Yi});var g={};__webpack_require__.r(g),__webpack_require__.d(g,{base16:()=>Qi,base16upper:()=>Xi});var y={};__webpack_require__.r(y),__webpack_require__.d(y,{base2:()=>Ji});var m={};__webpack_require__.r(m),__webpack_require__.d(m,{base256emoji:()=>to});var v={};__webpack_require__.r(v),__webpack_require__.d(v,{base32:()=>ro,base32hex:()=>so,base32hexpad:()=>co,base32hexpadupper:()=>lo,base32hexupper:()=>ao,base32pad:()=>io,base32padupper:()=>oo,base32upper:()=>no,base32z:()=>uo});var b={};__webpack_require__.r(b),__webpack_require__.d(b,{base36:()=>ho,base36upper:()=>fo});var w={};__webpack_require__.r(w),__webpack_require__.d(w,{base58btc:()=>po,base58flickr:()=>go});var E={};__webpack_require__.r(E),__webpack_require__.d(E,{base64:()=>yo,base64pad:()=>mo,base64url:()=>vo,base64urlpad:()=>bo});var _={};__webpack_require__.r(_),__webpack_require__.d(_,{base8:()=>wo});var S={};__webpack_require__.r(S),__webpack_require__.d(S,{identity:()=>Eo});var A={};__webpack_require__.r(A),__webpack_require__.d(A,{code:()=>ko,decode:()=>Co,encode:()=>Io,name:()=>Ao});var k={};__webpack_require__.r(k),__webpack_require__.d(k,{code:()=>To,decode:()=>Po,encode:()=>xo,name:()=>Ro});var I={};__webpack_require__.r(I),__webpack_require__.d(I,{identity:()=>es});var C={};__webpack_require__.r(C),__webpack_require__.d(C,{sha256:()=>is,sha512:()=>os});var R={};__webpack_require__.r(R),__webpack_require__.d(R,{base10:()=>oc});var T={};__webpack_require__.r(T),__webpack_require__.d(T,{base16:()=>sc,base16upper:()=>ac});var x={};__webpack_require__.r(x),__webpack_require__.d(x,{base2:()=>cc});var P={};__webpack_require__.r(P),__webpack_require__.d(P,{base256emoji:()=>dc});var D={};__webpack_require__.r(D),__webpack_require__.d(D,{base32:()=>fc,base32hex:()=>mc,base32hexpad:()=>bc,base32hexpadupper:()=>wc,base32hexupper:()=>vc,base32pad:()=>gc,base32padupper:()=>yc,base32upper:()=>pc,base32z:()=>Ec});var N={};__webpack_require__.r(N),__webpack_require__.d(N,{base36:()=>_c,base36upper:()=>Sc});var O={};__webpack_require__.r(O),__webpack_require__.d(O,{base58btc:()=>Ac,base58flickr:()=>kc});var L={};__webpack_require__.r(L),__webpack_require__.d(L,{base64:()=>Ic,base64pad:()=>Cc,base64url:()=>Rc,base64urlpad:()=>Tc});var B={};__webpack_require__.r(B),__webpack_require__.d(B,{base8:()=>xc});var M={};__webpack_require__.r(M),__webpack_require__.d(M,{identity:()=>Pc});var U={};__webpack_require__.r(U),__webpack_require__.d(U,{code:()=>Lc,decode:()=>Mc,encode:()=>Bc,name:()=>Oc});var F={};__webpack_require__.r(F),__webpack_require__.d(F,{code:()=>Fc,decode:()=>zc,encode:()=>jc,name:()=>Uc});var j={};__webpack_require__.r(j),__webpack_require__.d(j,{identity:()=>ul});var z={};__webpack_require__.r(z),__webpack_require__.d(z,{sha256:()=>pl,sha512:()=>gl});var q={};__webpack_require__.r(q),__webpack_require__.d(q,{base58btc:()=>Kd,base58flickr:()=>Vd});var K={};__webpack_require__.r(K),__webpack_require__.d(K,{identity:()=>yf});var V={};__webpack_require__.r(V),__webpack_require__.d(V,{sha256:()=>wf,sha512:()=>Ef});var H={};__webpack_require__.r(H),__webpack_require__.d(H,{base64:()=>Cp,base64pad:()=>Rp,base64url:()=>Tp,base64urlpad:()=>xp});var W={};__webpack_require__.r(W),__webpack_require__.d(W,{Ed25519PrivateKey:()=>jp,Ed25519PublicKey:()=>Fp,generateKeyPair:()=>Kp,generateKeyPairFromSeed:()=>Vp,unmarshalEd25519PrivateKey:()=>zp,unmarshalEd25519PublicKey:()=>qp});var G={};__webpack_require__.r(G),__webpack_require__.d(G,{RsaPrivateKey:()=>dy,RsaPublicKey:()=>hy,fromJwk:()=>gy,generateKeyPair:()=>yy,unmarshalRsaPrivateKey:()=>fy,unmarshalRsaPublicKey:()=>py});var Y={};__webpack_require__.r(Y),__webpack_require__.d(Y,{Secp256k1PrivateKey:()=>by,Secp256k1PublicKey:()=>vy,generateKeyPair:()=>_y,unmarshalSecp256k1PrivateKey:()=>wy,unmarshalSecp256k1PublicKey:()=>Ey});var Q={};__webpack_require__.r(Q),__webpack_require__.d(Q,{identity:()=>Py});var X={};__webpack_require__.r(X),__webpack_require__.d(X,{base2:()=>Dy});var J={};__webpack_require__.r(J),__webpack_require__.d(J,{base8:()=>Ny});var $={};__webpack_require__.r($),__webpack_require__.d($,{base10:()=>Oy});var Z={};__webpack_require__.r(Z),__webpack_require__.d(Z,{base16:()=>Ly,base16upper:()=>By});var ee={};__webpack_require__.r(ee),__webpack_require__.d(ee,{base32:()=>My,base32hex:()=>zy,base32hexpad:()=>Ky,base32hexpadupper:()=>Vy,base32hexupper:()=>qy,base32pad:()=>Fy,base32padupper:()=>jy,base32upper:()=>Uy,base32z:()=>Hy});var te={};__webpack_require__.r(te),__webpack_require__.d(te,{base36:()=>Wy,base36upper:()=>Gy});var re={};__webpack_require__.r(re),__webpack_require__.d(re,{base256emoji:()=>Jy});var ne={};__webpack_require__.r(ne),__webpack_require__.d(ne,{code:()=>Zy,decode:()=>tm,encode:()=>em,name:()=>$y});var ie={};__webpack_require__.r(ie),__webpack_require__.d(ie,{code:()=>om,decode:()=>am,encode:()=>sm,name:()=>im});var oe={};__webpack_require__.r(oe),__webpack_require__.d(oe,{base10:()=>Qv});var se={};__webpack_require__.r(se),__webpack_require__.d(se,{base16:()=>Xv,base16upper:()=>Jv});var ae={};__webpack_require__.r(ae),__webpack_require__.d(ae,{base2:()=>$v});var ce={};__webpack_require__.r(ce),__webpack_require__.d(ce,{base256emoji:()=>rb});var le={};__webpack_require__.r(le),__webpack_require__.d(le,{base32:()=>nb,base32hex:()=>ab,base32hexpad:()=>lb,base32hexpadupper:()=>ub,base32hexupper:()=>cb,base32pad:()=>ob,base32padupper:()=>sb,base32upper:()=>ib,base32z:()=>hb});var ue={};__webpack_require__.r(ue),__webpack_require__.d(ue,{base36:()=>db,base36upper:()=>fb});var he={};__webpack_require__.r(he),__webpack_require__.d(he,{base58btc:()=>pb,base58flickr:()=>gb});var de={};__webpack_require__.r(de),__webpack_require__.d(de,{base64:()=>yb,base64pad:()=>mb,base64url:()=>vb,base64urlpad:()=>bb});var fe={};__webpack_require__.r(fe),__webpack_require__.d(fe,{base8:()=>wb});var pe={};__webpack_require__.r(pe),__webpack_require__.d(pe,{identity:()=>Eb});var ge={};__webpack_require__.r(ge),__webpack_require__.d(ge,{code:()=>kb,decode:()=>Cb,encode:()=>Ib,name:()=>Ab});var ye={};__webpack_require__.r(ye),__webpack_require__.d(ye,{code:()=>Tb,decode:()=>Pb,encode:()=>xb,name:()=>Rb});var me={};__webpack_require__.r(me),__webpack_require__.d(me,{identity:()=>ew});var ve={};__webpack_require__.r(ve),__webpack_require__.d(ve,{sha256:()=>iw,sha512:()=>ow});var be={};__webpack_require__.r(be),__webpack_require__.d(be,{base10:()=>iI});var we={};__webpack_require__.r(we),__webpack_require__.d(we,{base16:()=>oI,base16upper:()=>sI});var Ee={};__webpack_require__.r(Ee),__webpack_require__.d(Ee,{base2:()=>aI});var _e={};__webpack_require__.r(_e),__webpack_require__.d(_e,{base256emoji:()=>hI});var Se={};__webpack_require__.r(Se),__webpack_require__.d(Se,{base32:()=>dI,base32hex:()=>yI,base32hexpad:()=>vI,base32hexpadupper:()=>bI,base32hexupper:()=>mI,base32pad:()=>pI,base32padupper:()=>gI,base32upper:()=>fI,base32z:()=>wI});var Ae={};__webpack_require__.r(Ae),__webpack_require__.d(Ae,{base36:()=>EI,base36upper:()=>_I});var ke={};__webpack_require__.r(ke),__webpack_require__.d(ke,{base58btc:()=>SI,base58flickr:()=>AI});var Ie={};__webpack_require__.r(Ie),__webpack_require__.d(Ie,{base64:()=>kI,base64pad:()=>II,base64url:()=>CI,base64urlpad:()=>RI});var Ce={};__webpack_require__.r(Ce),__webpack_require__.d(Ce,{base8:()=>TI});var Re={};__webpack_require__.r(Re),__webpack_require__.d(Re,{identity:()=>xI});var Te={};__webpack_require__.r(Te),__webpack_require__.d(Te,{code:()=>OI,decode:()=>BI,encode:()=>LI,name:()=>NI});var xe={};__webpack_require__.r(xe),__webpack_require__.d(xe,{code:()=>UI,decode:()=>jI,encode:()=>FI,name:()=>MI});var Pe={};__webpack_require__.r(Pe),__webpack_require__.d(Pe,{identity:()=>lC});var De={};__webpack_require__.r(De),__webpack_require__.d(De,{sha256:()=>fC,sha512:()=>pC});var Ne={};__webpack_require__.r(Ne),__webpack_require__.d(Ne,{base10:()=>wx});var Oe={};__webpack_require__.r(Oe),__webpack_require__.d(Oe,{base16:()=>Ex,base16upper:()=>_x});var Le={};__webpack_require__.r(Le),__webpack_require__.d(Le,{base2:()=>Sx});var Be={};__webpack_require__.r(Be),__webpack_require__.d(Be,{base256emoji:()=>Cx});var Me={};__webpack_require__.r(Me),__webpack_require__.d(Me,{base32:()=>Rx,base32hex:()=>Dx,base32hexpad:()=>Ox,base32hexpadupper:()=>Lx,base32hexupper:()=>Nx,base32pad:()=>xx,base32padupper:()=>Px,base32upper:()=>Tx,base32z:()=>Bx});var Ue={};__webpack_require__.r(Ue),__webpack_require__.d(Ue,{base36:()=>Mx,base36upper:()=>Ux});var Fe={};__webpack_require__.r(Fe),__webpack_require__.d(Fe,{base58btc:()=>Fx,base58flickr:()=>jx});var je={};__webpack_require__.r(je),__webpack_require__.d(je,{base64:()=>zx,base64pad:()=>qx,base64url:()=>Kx,base64urlpad:()=>Vx});var ze={};__webpack_require__.r(ze),__webpack_require__.d(ze,{base8:()=>Hx});var qe={};__webpack_require__.r(qe),__webpack_require__.d(qe,{identity:()=>Wx});var Ke={};__webpack_require__.r(Ke),__webpack_require__.d(Ke,{code:()=>Xx,decode:()=>$x,encode:()=>Jx,name:()=>Qx});var Ve={};__webpack_require__.r(Ve),__webpack_require__.d(Ve,{code:()=>eP,decode:()=>rP,encode:()=>tP,name:()=>Zx});var He={};__webpack_require__.r(He),__webpack_require__.d(He,{identity:()=>kP});var We={};__webpack_require__.r(We),__webpack_require__.d(We,{sha256:()=>TP,sha512:()=>xP});var Ge=__webpack_require__(9950),Ye=__webpack_require__(1352),Qe=__webpack_require__(9207),Xe=__webpack_require__.n(Qe);function Je(e){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Je(e)}function $e(e){var t=function(e,t){if("object"!=Je(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Je(t)?t:t+""}function Ze(e,t,r){return(t=$e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const et=Symbol.for("@libp2p/peer-id");function tt(e){return null!=e&&Boolean(e[et])}function rt(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function nt(e,t,r){rt(e,t),t.set(e,r)}function it(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}function ot(e,t){return e.get(it(e,t))}function st(e,t,r){return e.set(it(e,t),r),r}class at extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The operation was aborted"),Ze(this,"code",void 0),Ze(this,"type",void 0),this.name="AbortError",this.code=at.code,this.type=at.type}}Ze(at,"code","ABORT_ERR"),Ze(at,"type","aborted");class ct extends Error{constructor(e,t,r){var n;super(e),Ze(this,"code",void 0),Ze(this,"props",void 0),this.code=t,this.name=null!==(n=null===r||void 0===r?void 0:r.name)&&void 0!==n?n:"CodeError",this.props=null!==r&&void 0!==r?r:{}}}AggregateError;class lt extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected Peer"),Ze(this,"code",void 0),this.name="UnexpectedPeerError",this.code=lt.code}}Ze(lt,"code","ERR_UNEXPECTED_PEER");class ut extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto exchange"),Ze(this,"code",void 0),this.name="InvalidCryptoExchangeError",this.code=ut.code}}Ze(ut,"code","ERR_INVALID_CRYPTO_EXCHANGE");class ht extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto transmission"),Ze(this,"code",void 0),this.name="InvalidCryptoTransmissionError",this.code=ht.code}}Ze(ht,"code","ERR_INVALID_CRYPTO_TRANSMISSION");new Uint8Array(0);function dt(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}var ft=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const pt=ft;class gt{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class yt{constructor(e,t,r){if(Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseDecode",void 0),Ze(this,"prefixCodePoint",void 0),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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return vt(this,e)}}class mt{constructor(e){Ze(this,"decoders",void 0),this.decoders=e}or(e){return vt(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}function vt(e,t){var r,n;return new mt({...null!==(r=e.decoders)&&void 0!==r?r:{[e.prefix]:e},...null!==(n=t.decoders)&&void 0!==n?n:{[t.prefix]:t}})}class bt{constructor(e,t,r,n){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),Ze(this,"baseDecode",void 0),Ze(this,"encoder",void 0),Ze(this,"decoder",void 0),this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new gt(e,t,r),this.decoder=new yt(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}function wt(e){let{name:t,prefix:r,encode:n,decode:i}=e;return new bt(t,r,n,i)}function Et(e){let{name:t,prefix:r,alphabet:n}=e;const{encode:i,decode:o}=pt(n,t);return wt({prefix:r,name:t,encode:i,decode:e=>dt(o(e))})}function _t(e){let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return wt({prefix:r,name:t,encode:e=>function(e,t,r){const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(0!==s&&(o+=t[i&a<<r-s]),n)for(;0!==(o.length*r&7);)o+="=";return o}(e,i,n),decode:e=>function(e,t,r,n){const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||0!==(255&c<<8-a))throw new SyntaxError("Unexpected end of data");return s}(e,i,n,t)})}const St=Et({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),At=Et({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),kt=_t({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),It=_t({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ct=_t({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Rt=_t({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Tt=_t({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),xt=_t({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Pt=_t({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Dt=_t({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Nt=_t({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ot=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=Mt;)r[n++]=255&t|Lt,t/=128;for(;t&Bt;)r[n++]=255&t|Lt,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},Lt=128,Bt=-128,Mt=Math.pow(2,31);var Ut=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&jt)<<o:(n&jt)*Math.pow(2,o),o+=7}while(n>=Ft);return e.bytes=s-r,i},Ft=128,jt=127;var zt=Math.pow(2,7),qt=Math.pow(2,14),Kt=Math.pow(2,21),Vt=Math.pow(2,28),Ht=Math.pow(2,35),Wt=Math.pow(2,42),Gt=Math.pow(2,49),Yt=Math.pow(2,56),Qt=Math.pow(2,63);const Xt={encode:Ot,decode:Ut,encodingLength:function(e){return e<zt?1:e<qt?2:e<Kt?3:e<Vt?4:e<Ht?5:e<Wt?6:e<Gt?7:e<Yt?8:e<Qt?9:10}};function Jt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return[Xt.decode(e,t),Xt.decode.bytes]}function $t(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Xt.encode(e,t,r),t}function Zt(e){return Xt.encodingLength(e)}function er(e,t){const r=t.byteLength,n=Zt(e),i=n+Zt(r),o=new Uint8Array(i+r);return $t(e,o,0),$t(r,o,n),o.set(t,i),new rr(e,r,t,o)}function tr(e){const t=dt(e),[r,n]=Jt(t),[i,o]=Jt(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new rr(r,i,s,t)}class rr{constructor(e,t,r,n){Ze(this,"code",void 0),Ze(this,"size",void 0),Ze(this,"digest",void 0),Ze(this,"bytes",void 0),this.code=e,this.size=t,this.digest=r,this.bytes=n}}function nr(e,t){const{bytes:r,version:n}=e;return 0===n?function(e,t,r){const{prefix:n}=r;if(n!==St.prefix)throw Error("Cannot string encode V0 in ".concat(r.name," encoding"));const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i}(r,or(e),null!==t&&void 0!==t?t:St.encoder):function(e,t,r){const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i}(r,or(e),null!==t&&void 0!==t?t:kt.encoder)}const ir=new WeakMap;function or(e){const t=ir.get(e);if(null==t){const t=new Map;return ir.set(e,t),t}return t}class sr{constructor(e,t,r,n){Ze(this,"code",void 0),Ze(this,"version",void 0),Ze(this,"multihash",void 0),Ze(this,"bytes",void 0),Ze(this,"/",void 0),Ze(this,Symbol.toStringTag,"CID"),this.code=t,this.version=e,this.multihash=r,this.bytes=n,this["/"]=n}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!==ar)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==cr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return sr.createV0(t)}default:throw Error("Can not convert CID version ".concat(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=er(e,t);return sr.createV1(this.code,r)}case 1:return this;default:throw Error("Can not convert CID version ".concat(this.version," to version 1. This is a bug please report"))}}equals(e){return sr.equals(this,e)}static equals(e,t){const r=t;return null!=r&&e.code===r.code&&e.version===r.version&&function(e,t){if(e===t)return!0;{const r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}(e.bytes,r.bytes)}}(e.multihash,r.multihash)}toString(e){return nr(this,e)}toJSON(){return{"/":nr(this)}}link(){return this}[Symbol.for("nodejs.util.inspect.custom")](){return"CID(".concat(this.toString(),")")}static asCID(e){if(null==e)return null;const t=e;if(t instanceof sr)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:e,code:r,multihash:n,bytes:i}=t;return new sr(e,r,n,null!==i&&void 0!==i?i:lr(e,r,n.bytes))}if(!0===t[ur]){const{version:e,multihash:r,code:n}=t,i=tr(r);return sr.create(e,n,i)}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!==ar)throw new Error("Version 0 CID must use dag-pb (code: ".concat(ar,") block encoding"));return new sr(e,t,r,r.bytes);case 1:{const n=lr(e,t,r.bytes);return new sr(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return sr.create(0,ar,e)}static createV1(e,t){return sr.create(1,e,t)}static decode(e){const[t,r]=sr.decodeFirst(e);if(0!==r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=sr.inspectBytes(e),r=t.size-t.multihashSize,n=dt(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=n.subarray(t.multihashSize-t.digestSize),o=new rr(t.multihashCode,t.digestSize,i,n);return[0===t.version?sr.createV0(o):sr.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=Jt(e.subarray(t));return t+=n,r};let n=r(),i=ar;if(18===n?(n=0,t=0):i=r(),0!==n&&1!==n)throw new RangeError("Invalid CID version ".concat(n));const o=t,s=r(),a=r(),c=t+a;return{version:n,codec:i,multihashCode:s,digestSize:a,multihashSize:c-o,size:c}}static parse(e,t){const[r,n]=function(e,t){switch(e[0]){case"Q":{const r=null!==t&&void 0!==t?t:St;return[St.prefix,r.decode("".concat(St.prefix).concat(e))]}case St.prefix:{const r=null!==t&&void 0!==t?t:St;return[St.prefix,r.decode(e)]}case kt.prefix:{const r=null!==t&&void 0!==t?t:kt;return[kt.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}(e,t),i=sr.decode(n);if(0===i.version&&"Q"!==e[0])throw Error("Version 0 CID string must not include multibase prefix");return or(i).set(r,e),i}}const ar=112,cr=18;function lr(e,t,r){const n=Zt(e),i=n+Zt(t),o=new Uint8Array(i+r.byteLength);return $t(e,o,0),$t(t,o,n),o.set(r,i),o}const ur=Symbol.for("@ipld/js-cid/CID");const hr=Et({prefix:"9",name:"base10",alphabet:"0123456789"}),dr=_t({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),fr=_t({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),pr=_t({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),gr=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),yr=gr.reduce(((e,t,r)=>(e[r]=t,e)),[]),mr=gr.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const vr=wt({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=yr[t]),"")},decode:function(e){const t=[];for(const r of e){const e=mr[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),br=Et({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wr=Et({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Er=_t({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_r=_t({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sr=_t({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ar=_t({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),kr=_t({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Ir=wt({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)}),Cr=new TextEncoder,Rr=new TextDecoder,Tr="json",xr=512;function Pr(e){return Cr.encode(JSON.stringify(e))}function Dr(e){return JSON.parse(Rr.decode(e))}const Nr="raw",Or=85;function Lr(e){return dt(e)}function Br(e){return dt(e)}const Mr=dt;const Ur={code:0,name:"identity",encode:Mr,digest:function(e){return er(0,Mr(e))}};function Fr(e){let{name:t,code:r,encode:n}=e;return new jr(t,r,n)}class jr{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"code",void 0),Ze(this,"encode",void 0),this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?er(this.code,t):t.then((e=>er(this.code,e)))}throw Error("Unknown type, must be binary type")}}function zr(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}const qr=Fr({name:"sha2-256",code:18,encode:zr("SHA-256")}),Kr=Fr({name:"sha2-512",code:19,encode:zr("SHA-512")}),Vr={...l,...i,...c,...r,...n,...t,...s,...e,...a,...o};function Hr(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}function Wr(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const Gr=Wr("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Yr=Wr("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=Hr((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),Qr={utf8:Gr,"utf-8":Gr,hex:Vr.base16,latin1:Yr,ascii:Yr,binary:Yr,...Vr};function Xr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=Qr[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.encoder.encode(e).substring(1)}const Jr=Math.pow(2,7),$r=Math.pow(2,14),Zr=Math.pow(2,21),en=Math.pow(2,28),tn=Math.pow(2,35),rn=Math.pow(2,42),nn=Math.pow(2,49),on=128,sn=127;function an(e){if(e<Jr)return 1;if(e<$r)return 2;if(e<Zr)return 3;if(e<en)return 4;if(e<tn)return 5;if(e<rn)return 6;if(e<nn)return 7;if(null!=Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function cn(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;switch(an(e)){case 8:t[r++]=255&e|on,e/=128;case 7:t[r++]=255&e|on,e/=128;case 6:t[r++]=255&e|on,e/=128;case 5:t[r++]=255&e|on,e/=128;case 4:t[r++]=255&e|on,e>>>=7;case 3:t[r++]=255&e|on,e>>>=7;case 2:t[r++]=255&e|on,e>>>=7;case 1:t[r++]=255&e,e>>>=7;break;default:throw new Error("unreachable")}return t}function ln(e,t){let r=e[t],n=0;if(n+=r&sn,r<on)return n;if(r=e[t+1],n+=(r&sn)<<7,r<on)return n;if(r=e[t+2],n+=(r&sn)<<14,r<on)return n;if(r=e[t+3],n+=(r&sn)<<21,r<on)return n;if(r=e[t+4],n+=(r&sn)*en,r<on)return n;if(r=e[t+5],n+=(r&sn)*tn,r<on)return n;if(r=e[t+6],n+=(r&sn)*rn,r<on)return n;if(r=e[t+7],n+=(r&sn)*nn,r<on)return n;throw new RangeError("Could not decode varint")}function un(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==t&&(t=function(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}(an(e))),t instanceof Uint8Array?cn(e,t,r):function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;switch(an(e)){case 8:t.set(r++,255&e|on),e/=128;case 7:t.set(r++,255&e|on),e/=128;case 6:t.set(r++,255&e|on),e/=128;case 5:t.set(r++,255&e|on),e/=128;case 4:t.set(r++,255&e|on),e>>>=7;case 3:t.set(r++,255&e|on),e>>>=7;case 2:t.set(r++,255&e|on),e>>>=7;case 1:t.set(r++,255&e),e>>>=7;break;default:throw new Error("unreachable")}return t}(e,t,r)}function hn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e instanceof Uint8Array?ln(e,t):function(e,t){let r=e.get(t),n=0;if(n+=r&sn,r<on)return n;if(r=e.get(t+1),n+=(r&sn)<<7,r<on)return n;if(r=e.get(t+2),n+=(r&sn)<<14,r<on)return n;if(r=e.get(t+3),n+=(r&sn)<<21,r<on)return n;if(r=e.get(t+4),n+=(r&sn)*en,r<on)return n;if(r=e.get(t+5),n+=(r&sn)*tn,r<on)return n;if(r=e.get(t+6),n+=(r&sn)*rn,r<on)return n;if(r=e.get(t+7),n+=(r&sn)*nn,r<on)return n;throw new RangeError("Could not decode varint")}(e,t)}function dn(e,t){null==t&&(t=e.reduce(((e,t)=>e+t.length),0));const r=Hr(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}const fn=45,pn=15,gn=new class{constructor(){Ze(this,"index",0),Ze(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,n){return this.readAtomically((()=>{let i=0,o=0;const s=this.peekChar();if(void 0===s)return;const a="0"===s,c=2**(8*n)-1;for(;;){const r=this.readAtomically((()=>{const t=this.readChar();if(void 0===t)return;const r=Number.parseInt(t,e);return Number.isNaN(r)?void 0:r}));if(void 0===r)break;if(i*=e,i+=r,i>c)return;if(o+=1,void 0!==t&&o>t)return}return 0===o||!r&&a&&o>1?void 0:i}))}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=e=>{for(let t=0;t<e.length/2;t++){const r=2*t;if(t<e.length-3){const n=this.readSeparator(":",t,(()=>this.readIPv4Addr()));if(void 0!==n)return e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3],[r+4,!0]}const n=this.readSeparator(":",t,(()=>this.readNumber(16,4,!0,2)));if(void 0===n)return[r,!1];e[r]=n>>8,e[r+1]=255&n}return[e.length,!1]};return this.readAtomically((()=>{const t=new Uint8Array(16),[r,n]=e(t);if(16===r)return t;if(n)return;if(void 0===this.readGivenChar(":"))return;if(void 0===this.readGivenChar(":"))return;const i=new Uint8Array(14),o=16-(r+2),[s]=e(i.subarray(0,o));return t.set(i.subarray(0,s),16-s),t}))}readIPAddr(){var e;return null!==(e=this.readIPv4Addr())&&void 0!==e?e:this.readIPv6Addr()}};parseInt("0xFFFF",16),new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function yn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=Qr[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.decoder.decode("".concat(r.prefix).concat(e))}function mn(e){return Boolean(function(e){if(!(e.length>pn))return gn.new(e).parseWith((()=>gn.readIPv4Addr()))}(e))}function vn(e){return Boolean(function(e){if(e.includes("%")&&(e=e.split("%")[0]),!(e.length>fn))return gn.new(e).parseWith((()=>gn.readIPv6Addr()))}(e))}function bn(e){return Boolean(function(e){if(e.includes("%")&&(e=e.split("%")[0]),!(e.length>fn))return gn.new(e).parseWith((()=>gn.readIPAddr()))}(e))}const wn=mn,En=vn,_n=function(e){let t=0;if(e=e.toString().trim(),wn(e)){const r=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{r[t++]=255&parseInt(e,10)})),r}if(En(e)){const r=e.split(":",8);let n;for(n=0;n<r.length;n++){let e;wn(r[n])&&(e=_n(r[n]),r[n]=Xr(e.slice(0,2),"base16")),null!=e&&++n<8&&r.splice(n,0,Xr(e.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&""!==r[n];n++);const e=[n,1];for(n=9-r.length;n>0;n--)e.push("0");r.splice.apply(r,e)}const i=new Uint8Array(t+16);for(n=0;n<r.length;n++){const e=parseInt(r[n],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},Sn=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;r=~~r,n=null!==(t=n)&&void 0!==t?t:e.length-r;const i=new DataView(e.buffer);if(4===n){const t=[];for(let i=0;i<n;i++)t.push(e[r+i]);return t.join(".")}if(16===n){const e=[];for(let t=0;t<n;t+=2)e.push(i.getUint16(r+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},An=-1,kn={},In={};function Cn(e){if("number"===typeof e){if(null!=In[e])return In[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=kn[e])return kn[e];throw new Error("no protocol with name: ".concat(e))}throw new Error("invalid protocol id type: ".concat(typeof e))}[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,An,"ip6zone"],[43,8,"ipcidr"],[53,An,"dns",!0],[54,An,"dns4",!0],[55,An,"dns6",!0],[56,An,"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-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,An,"unix",!1,!0],[421,An,"ipfs"],[421,An,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,An,"garlic64"],[448,0,"tls"],[449,An,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,An,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,An,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);In[t.code]=t,kn[t.name]=t}));Cn("ip4"),Cn("ip6"),Cn("ipcidr");function Rn(e,t){switch(Cn(e).code){case 4:case 41:return function(e){const t=Sn(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!bn(t))throw new Error("invalid ip address");return t}(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Bn(t);case 6:case 273:case 33:case 132:return On(t).toString();case 421:return function(e){const t=hn(e),r=e.slice(an(t));if(r.length!==t)throw new Error("inconsistent lengths");return Xr(r,"base58btc")}(t);case 444:case 445:return Mn(t);case 466:return function(e){const t=hn(e),r=e.slice(an(t));if(r.length!==t)throw new Error("inconsistent lengths");return"u"+Xr(r,"base64url")}(t);default:return Xr(t,"base16")}}function Tn(e,t){switch(Cn(e).code){case 4:case 41:return Dn(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Ln(t);case 6:case 273:case 33:case 132:return Nn(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?tr(St.decode("z".concat(e))).bytes:sr.parse(e).multihash.bytes;const r=Uint8Array.from(un(t.length));return dn([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(16!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion address."));const r=kt.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=Nn(n);return dn([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(56!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion3 address."));const r=kt.decode("b".concat(t[0])),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=Nn(n);return dn([r,i],r.length+i.length)}(t);case 466:return function(e){const t=Pn.decode(e),r=Uint8Array.from(un(t.length));return dn([r,t],r.length+t.length)}(t);default:return yn(t,"base16")}}const xn=Object.values(Vr).map((e=>e.decoder)),Pn=function(){let e=xn[0].or(xn[1]);return xn.slice(2).forEach((t=>e=e.or(t))),e}();function Dn(e){if(!bn(e))throw new Error("invalid ip address");return _n(e)}function Nn(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function On(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function Ln(e){const t=yn(e),r=Uint8Array.from(un(t.length));return dn([r,t],r.length+t.length)}function Bn(e){const t=hn(e);if((e=e.slice(an(t))).length!==t)throw new Error("inconsistent lengths");return Xr(e)}function Mn(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=Xr(t,"base32"),i=On(r);return"".concat(n,":").concat(i)}function Un(e){const t=[],r=[];let n=null,i=0;for(;i<e.length;){const o=hn(e,i),s=an(o),a=Cn(o),c=zn(a,e.slice(i+s));if(0===c){t.push([o]),r.push([o]),i+=s;continue}const l=e.slice(i+s,i+s+c);if(i+=c+s,i>e.length)throw Kn("Invalid address Uint8Array: "+Xr(e,"base16"));t.push([o,l]);const u=Rn(o,l);if(r.push([o,u]),!0===a.path){n=u;break}}return{bytes:Uint8Array.from(e),string:Fn(r),tuples:t,stringTuples:r,path:n}}function Fn(e){const t=[];return e.map((e=>{const r=Cn(e[0]);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),qn(t.join("/"))}function jn(e){return dn(e.map((e=>{const t=Cn(e[0]);let r=Uint8Array.from(un(t.code));return e.length>1&&null!=e[1]&&(r=dn([r,e[1]])),r})))}function zn(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;{const e=hn(t instanceof Uint8Array?t:Uint8Array.from(t));return e+an(e)}}function qn(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function Kn(e){return new Error("Error parsing address: "+e)}const Vn=Symbol.for("nodejs.util.inspect.custom"),Hn=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Wn=[Cn("dns").code,Cn("dns4").code,Cn("dns6").code,Cn("dnsaddr").code];var Gn=new WeakMap,Yn=new WeakMap,Qn=new WeakMap,Xn=new WeakMap;class Jn{constructor(e){let t;if(Ze(this,"bytes",void 0),nt(this,Gn,void 0),nt(this,Yn,void 0),nt(this,Qn,void 0),nt(this,Xn,void 0),Ze(this,Hn,!0),null==e&&(e=""),e instanceof Uint8Array)t=Un(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));t=function(e){const t=[],r=[];let n=null;const i=(e=qn(e)).split("/").slice(1);if(1===i.length&&""===i[0])return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){const s=Cn(i[o]);if(0===s.size){t.push([s.code]),r.push([s.code]);continue}if(o++,o>=i.length)throw Kn("invalid address: "+e);if(!0===s.path){n=qn(i.slice(o).join("/")),t.push([s.code,Tn(s.code,n)]),r.push([s.code,n]);break}const a=Tn(s.code,i[o]);t.push([s.code,a]),r.push([s.code,Rn(s.code,a)])}return{string:Fn(r),bytes:jn(t),tuples:t,stringTuples:r,path:n}}(e)}else{if(!Zn(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");t=Un(e.bytes)}this.bytes=t.bytes,st(Gn,this,t.string),st(Yn,this,t.tuples),st(Qn,this,t.stringTuples),st(Xn,this,t.path)}toString(){return ot(Gn,this)}toJSON(){return this.toString()}toOptions(){let e,t,r,n,i="";const o=Cn("tcp"),s=Cn("udp"),a=Cn("ip4"),c=Cn("ip6"),l=Cn("dns6"),u=Cn("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),Wn.includes(h)&&(t=o.name,n=443,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=Cn(h).name,n=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=Cn(h).name,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==r||null==n)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:r,transport:t,port:n}}protos(){return ot(Yn,this).map((e=>{let[t]=e;return Object.assign({},Cn(t))}))}protoCodes(){return ot(Yn,this).map((e=>{let[t]=e;return t}))}protoNames(){return ot(Yn,this).map((e=>{let[t]=e;return Cn(t).name}))}tuples(){return ot(Yn,this)}stringTuples(){return ot(Qn,this)}encapsulate(e){return e=new Jn(e),new Jn(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new Jn(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new Jn(jn(t.slice(0,r)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach((t=>{let[r,n]=t;r===kn.p2p.code&&e.push([r,n]),r===kn["p2p-circuit"].code&&(e=[])}));const t=e.pop();if(null!=(null===t||void 0===t?void 0:t[1])){const e=t[1];return"Q"===e[0]||"1"===e[0]?Xr(St.decode("z".concat(e)),"base58btc"):Xr(sr.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){return ot(Xn,this)}equals(e){return function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const r=$n.get(t.name);if(null==r)throw new ct("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this,e)).map((e=>ei(e)))}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: "'.concat(e.transport,'". Must have a valid transport protocol: "{tcp, udp}"'));return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){const t=(null!==e&&void 0!==e?e:this).protos();return 2===t.length&&((4===t[0].code||41===t[0].code)&&(6===t[1].code||273===t[1].code))}[Vn](){return"Multiaddr(".concat(ot(Gn,this),")")}}const $n=new Map;function Zn(e){return Boolean(null===e||void 0===e?void 0:e[Hn])}function ei(e){return new Jn(e)}var ti,ri,ni,ii,oi;!function(e){e.Relay="relay",e.Store="store",e.LightPush="lightpush",e.Filter="filter"}(ti||(ti={})),function(e){e.GENERIC_FAIL="Generic error",e.ENCODE_FAILED="Failed to encode",e.DECODE_FAILED="Failed to decode",e.SIZE_TOO_BIG="Size is too big",e.NO_RPC_RESPONSE="No RPC response"}(ri||(ri={})),function(e){e.BACKWARD="backward",e.FORWARD="forward"}(ni||(ni={})),function(e){e.BOOTSTRAP="bootstrap",e.PEER_EXCHANGE="peer-exchange"}(ii||(ii={})),function(e){e.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",e.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",e.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",e.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"}(oi||(oi={}));var si,ai=__webpack_require__(255),ci=new WeakMap;class li extends EventTarget{constructor(){super(...arguments),nt(this,ci,new Map)}listenerCount(e){const t=ot(ci,this).get(e);return null==t?0:t.length}addEventListener(e,t,r){var n;super.addEventListener(e,t,r);let i=ot(ci,this).get(e);null==i&&(i=[],ot(ci,this).set(e,i)),i.push({callback:t,once:null!==(n=!0!==r&&!1!==r&&(null===r||void 0===r?void 0:r.once))&&void 0!==n&&n})}removeEventListener(e,t,r){super.removeEventListener(e.toString(),null!==t&&void 0!==t?t:null,r);let n=ot(ci,this).get(e);null!=n&&(n=n.filter((e=>{let{callback:r}=e;return r!==t})),ot(ci,this).set(e,n))}dispatchEvent(e){const t=super.dispatchEvent(e);let r=ot(ci,this).get(e.type);return null==r||(r=r.filter((e=>{let{once:t}=e;return!t})),ot(ci,this).set(e.type,r)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new hi(e,t))}}class ui extends Event{constructor(e,t){super(e,t),Ze(this,"detail",void 0),this.detail=null===t||void 0===t?void 0:t.detail}}const hi=null!==(si=globalThis.CustomEvent)&&void 0!==si?si:ui,di=ai("waku:keep-alive");class fi{constructor(e,t){Ze(this,"pingKeepAliveTimers",void 0),Ze(this,"relayKeepAliveTimers",void 0),Ze(this,"options",void 0),Ze(this,"relay",void 0),this.pingKeepAliveTimers=new Map,this.relayKeepAliveTimers=new Map,this.options=e,this.relay=t}start(e,t){this.stop(e);const{pingKeepAlive:r,relayKeepAlive:n}=this.options,i=e.toString();if(0!==r){const n=setInterval((()=>{t.ping(e).catch((e=>{di("Ping failed (".concat(i,")"),e)}))}),1e3*r);this.pingKeepAliveTimers.set(i,n)}const o=this.relay;if(o&&0!==n){const t=la({contentTopic:"/relay-ping/1/ping/null",ephemeral:!0}),r=setInterval((()=>{di("Sending Waku Relay ping message"),o.send(t,{payload:new Uint8Array([1])}).catch((e=>di("Failed to send relay ping",e)))}),1e3*n);this.relayKeepAliveTimers.set(e,r)}}stop(e){const t=e.toString();this.pingKeepAliveTimers.has(t)&&(clearInterval(this.pingKeepAliveTimers.get(t)),this.pingKeepAliveTimers.delete(t)),this.relayKeepAliveTimers.has(e)&&(clearInterval(this.relayKeepAliveTimers.get(e)),this.relayKeepAliveTimers.delete(e))}stopAll(){for(const e of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(e);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}}const pi=ai("waku:connection-manager");class gi extends li{static create(e,t,r,n,i){let o=gi.instances.get(e);return o||(o=new gi(t,r,n,i),gi.instances.set(e,o)),o}async getPeersByDiscovery(){const e=await this.libp2p.peerStore.all(),t=this.libp2p.getConnections().map((e=>e.remotePeer)),r=[],n=[],i=[],o=[];for(const s of e){const e=await this.getTagNamesForPeer(s.id);e.includes(ii.BOOTSTRAP)?r.push(s):e.includes(ii.PEER_EXCHANGE)&&n.push(s)}for(const s of t){const e=await this.libp2p.peerStore.get(s),t=await this.getTagNamesForPeer(s);t.includes(ii.BOOTSTRAP)?i.push(e):t.includes(ii.PEER_EXCHANGE)&&o.push(e)}return{DISCOVERED:{[ii.BOOTSTRAP]:r,[ii.PEER_EXCHANGE]:n},CONNECTED:{[ii.BOOTSTRAP]:i,[ii.PEER_EXCHANGE]:o}}}constructor(e,t,r,n){super(),Ze(this,"keepAliveManager",void 0),Ze(this,"options",void 0),Ze(this,"libp2p",void 0),Ze(this,"dialAttemptsForPeer",new Map),Ze(this,"dialErrorsForPeer",new Map),Ze(this,"currentActiveDialCount",0),Ze(this,"pendingPeerDialQueue",[]),Ze(this,"onEventHandlers",{"peer:discovery":e=>{(async()=>{const{id:t}=e.detail,r=(await this.getTagNamesForPeer(t)).includes(ii.BOOTSTRAP);this.dispatchEvent(new hi(r?oi.PEER_DISCOVERY_BOOTSTRAP:oi.PEER_DISCOVERY_PEER_EXCHANGE,{detail:t}));try{await this.attemptDial(t)}catch(n){pi("Error dialing peer ".concat(t.toString()," : ").concat(n))}})()},"peer:connect":e=>{(async()=>{const t=e.detail;this.keepAliveManager.start(t,this.libp2p.services.ping);if((await this.getTagNamesForPeer(t)).includes(ii.BOOTSTRAP)){this.libp2p.getConnections().filter((e=>e.tags.includes(ii.BOOTSTRAP))).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(t):this.dispatchEvent(new hi(oi.PEER_CONNECT_BOOTSTRAP,{detail:t}))}else this.dispatchEvent(new hi(oi.PEER_CONNECT_PEER_EXCHANGE,{detail:t}))})()},"peer:disconnect":()=>e=>{this.keepAliveManager.stop(e.detail)}}),this.libp2p=e,this.options={maxDialAttemptsForPeer:3,maxBootstrapPeersAllowed:1,maxParallelDials:3,...n},this.keepAliveManager=new fi(t,r),this.run().then((()=>pi("Connection Manager is now running"))).catch((e=>pi("Unexpected error while running service",e))),this.dialPeerStorePeers().catch((e=>pi("Unexpected error while dialing peer store peers",e)))}async dialPeerStorePeers(){const e=await this.libp2p.peerStore.all(),t=[];for(const n of e)this.libp2p.getConnections().find((e=>e.remotePeer===n.id))||t.push(this.attemptDial(n.id));try{await Promise.all(t)}catch(r){pi("Unexpected error while dialing peer store peers",r)}}async run(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener()}stop(){this.keepAliveManager.stopAll(),this.libp2p.removeEventListener("peer:connect",this.onEventHandlers["peer:connect"]),this.libp2p.removeEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"]),this.libp2p.removeEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}async dialPeer(e){this.currentActiveDialCount+=1;let t=0;for(;t<this.options.maxDialAttemptsForPeer;)try{pi("Dialing peer ".concat(e.toString()," on attempt ").concat(t+1)),await this.libp2p.dial(e);const r=await this.getTagNamesForPeer(e);this.libp2p.getConnections(e).forEach((e=>{e.tags=Array.from(new Set([...e.tags,...r]))})),this.dialAttemptsForPeer.delete(e.toString());break}catch(r){r instanceof AggregateError?pi("Error dialing peer ".concat(e.toString()," - ").concat(r.errors)):pi("Error dialing peer ".concat(e.toString()," - ").concat(r.message)),this.dialErrorsForPeer.set(e.toString(),r),t++,this.dialAttemptsForPeer.set(e.toString(),t)}if(this.currentActiveDialCount--,this.processDialQueue(),t===this.options.maxDialAttemptsForPeer)try{const t=this.dialErrorsForPeer.get(e.toString());let r;r=t instanceof AggregateError?JSON.stringify(t.errors[0]):t.message,pi("Deleting undialable peer ".concat(e.toString()," from peer store. Error: ").concat(r)),this.dialErrorsForPeer.delete(e.toString()),await this.libp2p.peerStore.delete(e)}catch(r){throw new Error("Error deleting undialable peer ".concat(e.toString()," from peer store - ").concat(r))}}async dropConnection(e){try{this.keepAliveManager.stop(e),await this.libp2p.hangUp(e),pi("Dropped connection with peer ".concat(e.toString()))}catch(t){pi("Error dropping connection with peer ".concat(e.toString()," - ").concat(t))}}processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveDialCount<this.options.maxParallelDials){const e=this.pendingPeerDialQueue.shift();if(!e)return;this.attemptDial(e).catch((e=>{pi(e)}))}}startPeerDiscoveryListener(){this.libp2p.addEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}startPeerConnectionListener(){this.libp2p.addEventListener("peer:connect",this.onEventHandlers["peer:connect"])}startPeerDisconnectionListener(){this.libp2p.addEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"])}async attemptDial(e){this.currentActiveDialCount>=this.options.maxParallelDials?this.pendingPeerDialQueue.push(e):await this.shouldDialPeer(e)&&this.dialPeer(e).catch((t=>{throw"Error dialing peer ".concat(e.toString()," : ").concat(t)}))}async shouldDialPeer(e){if(this.libp2p.getConnections(e).length>0)return!1;if(!(await this.getTagNamesForPeer(e)).some((e=>e===ii.BOOTSTRAP)))return!0;if(this.libp2p.getConnections().filter((e=>e.tags.find((e=>e===ii.BOOTSTRAP)))).length<this.options.maxBootstrapPeersAllowed)return!0;return!1}async getTagNamesForPeer(e){try{const t=await this.libp2p.peerStore.get(e);return Array.from(t.tags.keys())}catch(t){return pi("Failed to get peer ".concat(e,", error: ").concat(t)),[]}}}Ze(gi,"instances",new Map);const yi="js-waku",mi=ai("waku:waku");class vi{constructor(e,t,r,n,i,o){Ze(this,"libp2p",void 0),Ze(this,"relay",void 0),Ze(this,"store",void 0),Ze(this,"filter",void 0),Ze(this,"lightPush",void 0),Ze(this,"connectionManager",void 0),this.libp2p=t,r&&(this.store=r(t)),i&&(this.filter=i(t)),n&&(this.lightPush=n(t)),o&&(this.relay=o(t));const s=e.pingKeepAlive||0,a=this.relay?e.relayKeepAlive||300:0,c=this.libp2p.peerId.toString();this.connectionManager=gi.create(c,t,{pingKeepAlive:s,relayKeepAlive:a},this.relay),mi("Waku node created",c,"relay: ".concat(!!this.relay,", store: ").concat(!!this.store,", light push: ").concat(!!this.lightPush,", filter: ").concat(!!this.filter))}async dial(e,t){const r=null!==t&&void 0!==t?t:[],n=function(e){return tt(e)?e:ei(e)}(e);"undefined"===typeof t&&(this.relay&&r.push(ti.Relay),this.store&&r.push(ti.Store),this.filter&&r.push(ti.Filter),this.lightPush&&r.push(ti.LightPush));const i=[];return r.includes(ti.Relay)&&(this.relay?this.relay.gossipSub.multicodecs.forEach((e=>i.push(e))):mi("Relay codec not included in dial codec: protocol not mounted locally")),r.includes(ti.Store)&&(this.store?i.push(this.store.multicodec):mi("Store codec not included in dial codec: protocol not mounted locally")),r.includes(ti.LightPush)&&(this.lightPush?i.push(this.lightPush.multicodec):mi("Light Push codec not included in dial codec: protocol not mounted locally")),r.includes(ti.Filter)&&(this.filter?i.push(this.filter.multicodec):mi("Filter codec not included in dial codec: protocol not mounted locally")),mi("Dialing to ".concat(n.toString()," with protocols ").concat(r)),this.libp2p.dialProtocol(n,i)}async start(){await this.libp2p.start()}async stop(){this.connectionManager.stop(),await this.libp2p.stop()}isStarted(){return this.libp2p.isStarted()}getLocalMultiaddrWithID(){const e=this.libp2p.getMultiaddrs().find((e=>e.toString().match(/127\.0\.0\.1/)));if(!e||""===e.toString())throw"Not listening on localhost";return e+"/p2p/"+this.libp2p.peerId.toString()}}const bi="/waku/2/default-waku/proto",wi=new Float32Array([-0]),Ei=new Uint8Array(wi.buffer);function _i(e,t,r){wi[0]=e,t[r]=Ei[0],t[r+1]=Ei[1],t[r+2]=Ei[2],t[r+3]=Ei[3]}const Si=new Float64Array([-0]),Ai=new Uint8Array(Si.buffer);function ki(e,t,r){Si[0]=e,t[r]=Ai[0],t[r+1]=Ai[1],t[r+2]=Ai[2],t[r+3]=Ai[3],t[r+4]=Ai[4],t[r+5]=Ai[5],t[r+6]=Ai[6],t[r+7]=Ai[7]}const Ii=BigInt(Number.MAX_SAFE_INTEGER),Ci=BigInt(Number.MIN_SAFE_INTEGER);class Ri{constructor(e,t){Ze(this,"lo",void 0),Ze(this,"hi",void 0),this.lo=0|e,this.hi=0|t}toNumber(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.hi>>>31>0){const e=1+~this.lo>>>0;let t=~this.hi>>>0;return 0===e&&(t=t+1>>>0),-(e+4294967296*t)}return this.lo+4294967296*this.hi}toBigInt(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0])return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!==0){const e=1+~this.lo>>>0;let t=~this.hi>>>0;return 0===e&&(t=t+1>>>0),-(BigInt(e)+(BigInt(t)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.toBigInt(e).toString()}zzEncode(){const e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){const e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){const e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}static fromBigInt(e){if(0n===e)return Ti;if(e<Ii&&e>Ci)return this.fromNumber(Number(e));const t=e<0n;t&&(e=-e);let r=e>>32n,n=e-(r<<32n);return t&&(r=0n|~r,n=0n|~n,++n>xi&&(n=0n,++r>xi&&(r=0n))),new Ri(Number(n),Number(r))}static fromNumber(e){if(0===e)return Ti;const t=e<0;t&&(e=-e);let r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new Ri(r,n)}static from(e){return"number"===typeof e?Ri.fromNumber(e):"bigint"===typeof e?Ri.fromBigInt(e):"string"===typeof e?Ri.fromBigInt(BigInt(e)):null!=e.low||null!=e.high?new Ri(e.low>>>0,e.high>>>0):Ti}}const Ti=new Ri(0,0);Ti.toBigInt=function(){return 0n},Ti.zzEncode=Ti.zzDecode=function(){return this},Ti.length=function(){return 1};const xi=4294967296n;function Pi(e,t,r){const n=r;let i,o;for(let s=0;s<e.length;++s)i=e.charCodeAt(s),i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296===(64512&i)&&56320===(64512&(o=e.charCodeAt(s+1)))?(i=65536+((1023&i)<<10)+(1023&o),++s,t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128);return r-n}function Di(e,t){return RangeError("index out of range: ".concat(e.pos," + ").concat(null!==t&&void 0!==t?t:1," > ").concat(e.len))}function Ni(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}class Oi{constructor(e){Ze(this,"buf",void 0),Ze(this,"pos",void 0),Ze(this,"len",void 0),Ze(this,"_slice",Uint8Array.prototype.subarray),this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Di(this,10);return e}int32(){return 0|this.uint32()}sint32(){const e=this.uint32();return e>>>1^-(1&e)}bool(){return 0!==this.uint32()}fixed32(){if(this.pos+4>this.len)throw Di(this,4);return Ni(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Di(this,4);return 0|Ni(this.buf,this.pos+=4)}float(){if(this.pos+4>this.len)throw Di(this,4);const e=(t=this.buf,r=this.pos,Ei[0]=t[r],Ei[1]=t[r+1],Ei[2]=t[r+2],Ei[3]=t[r+3],wi[0]);var t,r;return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Di(this,4);const e=(t=this.buf,r=this.pos,Ai[0]=t[r],Ai[1]=t[r+1],Ai[2]=t[r+2],Ai[3]=t[r+3],Ai[4]=t[r+4],Ai[5]=t[r+5],Ai[6]=t[r+6],Ai[7]=t[r+7],Si[0]);var t,r;return this.pos+=8,e}bytes(){const e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw Di(this,e);return this.pos+=e,t===r?new Uint8Array(0):this.buf.subarray(t,r)}string(){const e=this.bytes();return function(e,t,r){if(r-t<1)return"";let n;const i=[];let o,s=0;for(;t<r;){var a;o=e[t++],o<128?i[s++]=o:o>191&&o<224?i[s++]=(31&o)<<6|63&e[t++]:o>239&&o<365?(o=((7&o)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(o>>10),i[s++]=56320+(1023&o)):i[s++]=(15&o)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((null!==(a=n)&&void 0!==a?a:n=[]).push(String.fromCharCode.apply(String,i)),s=0)}return null!=n?(s>0&&n.push(String.fromCharCode.apply(String,i.slice(0,s))),n.join("")):String.fromCharCode.apply(String,i.slice(0,s))}(e,0,e.length)}skip(e){if("number"===typeof e){if(this.pos+e>this.len)throw Di(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw Di(this)}while(0!==(128&this.buf[this.pos++]));return this}skipType(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 ".concat(e," at offset ").concat(this.pos))}return this}readLongVarint(){const e=new Ri(0,0);let t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw Di(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>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(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Di(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Di(this,8);const e=Ni(this.buf,this.pos+=4),t=Ni(this.buf,this.pos+=4);return new Ri(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const e=ln(this.buf,this.pos);return this.pos+=an(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function Li(e,t,r){const n=function(e){return new Oi(e instanceof Uint8Array?e:e.subarray())}(e);return t.decode(n,void 0,r)}function Bi(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}new Uint8Array(0);function Mi(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}var Ui=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const Fi=Ui;class ji{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class zi{constructor(e,t,r){if(Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseDecode",void 0),Ze(this,"prefixCodePoint",void 0),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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Ki(this,e)}}class qi{constructor(e){Ze(this,"decoders",void 0),this.decoders=e}or(e){return Ki(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}function Ki(e,t){var r,n;return new qi({...null!==(r=e.decoders)&&void 0!==r?r:{[e.prefix]:e},...null!==(n=t.decoders)&&void 0!==n?n:{[t.prefix]:t}})}class Vi{constructor(e,t,r,n){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),Ze(this,"baseDecode",void 0),Ze(this,"encoder",void 0),Ze(this,"decoder",void 0),this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new ji(e,t,r),this.decoder=new zi(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}function Hi(e){let{name:t,prefix:r,encode:n,decode:i}=e;return new Vi(t,r,n,i)}function Wi(e){let{name:t,prefix:r,alphabet:n}=e;const{encode:i,decode:o}=Fi(n,t);return Hi({prefix:r,name:t,encode:i,decode:e=>Mi(o(e))})}function Gi(e){let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return Hi({prefix:r,name:t,encode:e=>function(e,t,r){const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(0!==s&&(o+=t[i&a<<r-s]),n)for(;0!==(o.length*r&7);)o+="=";return o}(e,i,n),decode:e=>function(e,t,r,n){const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||0!==(255&c<<8-a))throw new SyntaxError("Unexpected end of data");return s}(e,i,n,t)})}const Yi=Wi({prefix:"9",name:"base10",alphabet:"0123456789"}),Qi=Gi({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xi=Gi({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Ji=Gi({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),$i=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),Zi=$i.reduce(((e,t,r)=>(e[r]=t,e)),[]),eo=$i.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const to=Hi({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Zi[t]),"")},decode:function(e){const t=[];for(const r of e){const e=eo[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),ro=Gi({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),no=Gi({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),io=Gi({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oo=Gi({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),so=Gi({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ao=Gi({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),co=Gi({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lo=Gi({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uo=Gi({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ho=Wi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fo=Wi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),po=Wi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),go=Wi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yo=Gi({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mo=Gi({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vo=Gi({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bo=Gi({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),wo=Gi({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Eo=Hi({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)}),_o=new TextEncoder,So=new TextDecoder,Ao="json",ko=512;function Io(e){return _o.encode(JSON.stringify(e))}function Co(e){return JSON.parse(So.decode(e))}const Ro="raw",To=85;function xo(e){return Mi(e)}function Po(e){return Mi(e)}var Do=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=Lo;)r[n++]=255&t|No,t/=128;for(;t&Oo;)r[n++]=255&t|No,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},No=128,Oo=-128,Lo=Math.pow(2,31);var Bo=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&Uo)<<o:(n&Uo)*Math.pow(2,o),o+=7}while(n>=Mo);return e.bytes=s-r,i},Mo=128,Uo=127;var Fo=Math.pow(2,7),jo=Math.pow(2,14),zo=Math.pow(2,21),qo=Math.pow(2,28),Ko=Math.pow(2,35),Vo=Math.pow(2,42),Ho=Math.pow(2,49),Wo=Math.pow(2,56),Go=Math.pow(2,63);const Yo={encode:Do,decode:Bo,encodingLength:function(e){return e<Fo?1:e<jo?2:e<zo?3:e<qo?4:e<Ko?5:e<Vo?6:e<Ho?7:e<Wo?8:e<Go?9:10}};function Qo(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Yo.encode(e,t,r),t}function Xo(e){return Yo.encodingLength(e)}function Jo(e,t){const r=t.byteLength,n=Xo(e),i=n+Xo(r),o=new Uint8Array(i+r);return Qo(e,o,0),Qo(r,o,n),o.set(t,i),new $o(e,r,t,o)}class $o{constructor(e,t,r,n){Ze(this,"code",void 0),Ze(this,"size",void 0),Ze(this,"digest",void 0),Ze(this,"bytes",void 0),this.code=e,this.size=t,this.digest=r,this.bytes=n}}const Zo=Mi;const es={code:0,name:"identity",encode:Zo,digest:function(e){return Jo(0,Zo(e))}};function ts(e){let{name:t,code:r,encode:n}=e;return new rs(t,r,n)}class rs{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"code",void 0),Ze(this,"encode",void 0),this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Jo(this.code,t):t.then((e=>Jo(this.code,e)))}throw Error("Unknown type, must be binary type")}}function ns(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}const is=ts({name:"sha2-256",code:18,encode:ns("SHA-256")}),os=ts({name:"sha2-512",code:19,encode:ns("SHA-512")});new WeakMap;Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const ss={...S,...y,..._,...p,...g,...v,...b,...w,...E,...m};function as(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const cs=as("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),ls=as("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=Bi((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),us={utf8:cs,"utf-8":cs,hex:ss.base16,latin1:ls,ascii:ls,binary:ls,...ss};class hs{constructor(e,t,r){Ze(this,"fn",void 0),Ze(this,"len",void 0),Ze(this,"next",void 0),Ze(this,"val",void 0),this.fn=e,this.len=t,this.next=void 0,this.val=r}}function ds(){}class fs{constructor(e){Ze(this,"head",void 0),Ze(this,"tail",void 0),Ze(this,"len",void 0),Ze(this,"next",void 0),this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}}const ps=function(e){const t=null!==e&&void 0!==e?e:8192,r=t>>>1;let n,i=t;return function(e){if(e<1||e>r)return Bi(e);i+e>t&&(n=Bi(t),i=0);const o=n.subarray(i,i+=e);return 0!==(7&i)&&(i=1+(7|i)),o}}();class gs{constructor(){Ze(this,"len",void 0),Ze(this,"head",void 0),Ze(this,"tail",void 0),Ze(this,"states",void 0),this.len=0,this.head=new hs(ds,0,0),this.tail=this.head,this.states=null}_push(e,t,r){return this.tail=this.tail.next=new hs(e,t,r),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new vs((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(bs,10,Ri.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){const t=Ri.fromBigInt(e);return this._push(bs,t.length(),t)}uint64Number(e){return this._push(cn,an(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){const t=Ri.fromBigInt(e).zzEncode();return this._push(bs,t.length(),t)}sint64Number(e){const t=Ri.fromNumber(e).zzEncode();return this._push(bs,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(ys,1,e?1:0)}fixed32(e){return this._push(ws,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){const t=Ri.fromBigInt(e);return this._push(ws,4,t.lo)._push(ws,4,t.hi)}fixed64Number(e){const t=Ri.fromNumber(e);return this._push(ws,4,t.lo)._push(ws,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(_i,4,e)}double(e){return this._push(ki,8,e)}bytes(e){const t=e.length>>>0;return 0===t?this._push(ys,1,0):this.uint32(t)._push(Es,t,e)}string(e){const t=function(e){let t=0,r=0;for(let n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?t+=1:r<2048?t+=2:55296===(64512&r)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t}(e);return 0!==t?this.uint32(t)._push(Pi,t,e):this._push(ys,1,0)}fork(){return this.states=new fs(this),this.head=this.tail=new hs(ds,0,0),this.len=0,this}reset(){return null!=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 hs(ds,0,0),this.len=0),this}ldelim(){const e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),0!==r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this}finish(){let e=this.head.next;const t=(r=this.len,null!=globalThis.Buffer?Bi(r):ps(r));var r;let n=0;for(;null!=e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}}function ys(e,t,r){t[r]=255&e}function ms(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e}class vs extends hs{constructor(e,t){super(ms,e,t),Ze(this,"next",void 0),this.next=void 0}}function bs(e,t,r){for(;0!==e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function ws(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function Es(e,t,r){t.set(e,r)}function _s(e,t,r){t.set(e,r)}function Ss(e,t,r){e.length<40?Pi(e,t,r):null!=t.utf8Write?t.utf8Write(e,r):t.set(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=us[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.decoder.decode("".concat(r.prefix).concat(e))}(e),r)}function As(e,t){const r=new gs;return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var ks,Is,Cs,Rs,Ts,xs,Ps,Ds,Ns,Os,Ls,Bs,Ms,Us,Fs,js,zs,qs,Ks,Vs,Hs,Ws,Gs,Ys,Qs,Xs,Js,$s,Zs,ea,ta;function ra(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function na(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return ra("enum",ks.VARINT,(function(e,r){const n=t(e);r.int32(n)}),(function(e){return t(e.int32())}))}function ia(e,t){return ra("message",ks.LENGTH_DELIMITED,e,t)}null!=globalThis.Buffer&&(gs.prototype.bytes=function(e){const t=e.length>>>0;return this.uint32(t),t>0&&this._push(_s,t,e),this},gs.prototype.string=function(e){const t=globalThis.Buffer.byteLength(e);return this.uint32(t),t>0&&this._push(Ss,t,e),this}),function(e){e[e.VARINT=0]="VARINT",e[e.BIT64=1]="BIT64",e[e.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",e[e.START_GROUP=3]="START_GROUP",e[e.END_GROUP=4]="END_GROUP",e[e.BIT32=5]="BIT32"}(ks||(ks={}));Error;!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={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)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Is||(Is={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),Is.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=Is.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Cs||(Cs={})),function(e){let t,r;!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(t=e.ContentFilter||(e.ContentFilter={})),e.codec=()=>(null==r&&(r=ia((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null!=t.subscribe&&!1!==t.subscribe&&(r.uint32(8),r.bool(t.subscribe)),null!=t.topic&&""!==t.topic&&(r.uint32(18),r.string(t.topic)),null!=t.contentFilters)for(const i of t.contentFilters)r.uint32(26),e.ContentFilter.codec().encode(i,r);!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={subscribe:!1,topic:"",contentFilters:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.subscribe=t.bool();break;case 2:n.topic=t.string();break;case 3:n.contentFilters.push(e.ContentFilter.codec().decode(t,t.uint32()));break;default:t.skipType(7&r)}}return n}))),r),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Rs||(Rs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.messages)for(const n of e.messages)t.uint32(10),Ds.codec().encode(n,t);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={messages:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.messages.push(Ds.codec().decode(e,e.uint32()));else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ts||(Ts={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),Rs.codec().encode(e.request,t)),null!=e.push&&(t.uint32(26),Ts.codec().encode(e.push,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.request=Rs.codec().decode(e,e.uint32());break;case 3:r.push=Ts.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(xs||(xs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={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)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ps||(Ps={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),Ps.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=Ps.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ds||(Ds={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===2)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ns||(Ns={})),function(e){let t,r,n;!function(e){e.SUBSCRIBER_PING="SUBSCRIBER_PING",e.SUBSCRIBE="SUBSCRIBE",e.UNSUBSCRIBE="UNSUBSCRIBE",e.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"}(t=e.FilterSubscribeType||(e.FilterSubscribeType={})),function(e){e[e.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",e[e.SUBSCRIBE=1]="SUBSCRIBE",e[e.UNSUBSCRIBE=2]="UNSUBSCRIBE",e[e.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"}(r||(r={})),function(e){e.codec=()=>na(r)}(t=e.FilterSubscribeType||(e.FilterSubscribeType={})),e.codec=()=>(null==n&&(n=ia((function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==i.lengthDelimited&&n.fork(),null!=t.requestId&&""!==t.requestId&&(n.uint32(10),n.string(t.requestId)),null!=t.filterSubscribeType&&0!==r[t.filterSubscribeType]&&(n.uint32(16),e.FilterSubscribeType.codec().encode(t.filterSubscribeType,n)),null!=t.pubsubTopic&&(n.uint32(82),n.string(t.pubsubTopic)),null!=t.contentTopics)for(const e of t.contentTopics)n.uint32(90),n.string(e);!1!==i.lengthDelimited&&n.ldelim()}),((r,n)=>{const i={requestId:"",filterSubscribeType:t.SUBSCRIBER_PING,contentTopics:[]},o=null==n?r.len:r.pos+n;for(;r.pos<o;){const t=r.uint32();switch(t>>>3){case 1:i.requestId=r.string();break;case 2:i.filterSubscribeType=e.FilterSubscribeType.codec().decode(r);break;case 10:i.pubsubTopic=r.string();break;case 11:i.contentTopics.push(r.string());break;default:r.skipType(7&t)}}return i}))),n),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Os||(Os={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.statusCode&&0!==e.statusCode&&(t.uint32(80),t.uint32(e.statusCode)),null!=e.statusDesc&&(t.uint32(90),t.string(e.statusDesc)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:"",statusCode:0},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 10:r.statusCode=e.uint32();break;case 11:r.statusDesc=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ls||(Ls={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.wakuMessage&&(t.uint32(10),Us.codec().encode(e.wakuMessage,t)),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.wakuMessage=Us.codec().decode(e,e.uint32());break;case 2:r.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Bs||(Bs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={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)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ms||(Ms={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),Ms.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=Ms.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Us||(Us={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&""!==e.pubsubTopic&&(t.uint32(10),t.string(e.pubsubTopic)),null!=e.message&&(t.uint32(18),Ks.codec().encode(e.message,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={pubsubTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.pubsubTopic=e.string();break;case 2:r.message=Ks.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Fs||(Fs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.isSuccess&&!1!==e.isSuccess&&(t.uint32(8),t.bool(e.isSuccess)),null!=e.info&&(t.uint32(18),t.string(e.info)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={isSuccess:!1},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.isSuccess=e.bool();break;case 2:r.info=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(js||(js={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),Fs.codec().encode(e.request,t)),null!=e.response&&(t.uint32(26),js.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.request=Fs.codec().decode(e,e.uint32());break;case 3:r.response=js.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(zs||(zs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={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)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(qs||(qs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),qs.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=qs.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ks||(Ks={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.digest&&e.digest.byteLength>0&&(t.uint32(10),t.bytes(e.digest)),null!=e.receiverTime&&0n!==e.receiverTime&&(t.uint32(16),t.sint64(e.receiverTime)),null!=e.senderTime&&0n!==e.senderTime&&(t.uint32(24),t.sint64(e.senderTime)),null!=e.pubsubTopic&&""!==e.pubsubTopic&&(t.uint32(34),t.string(e.pubsubTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={digest:new Uint8Array(0),receiverTime:0n,senderTime:0n,pubsubTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.digest=e.bytes();break;case 2:r.receiverTime=e.sint64();break;case 3:r.senderTime=e.sint64();break;case 4:r.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Vs||(Vs={})),function(e){let t,r,n;!function(e){e.BACKWARD="BACKWARD",e.FORWARD="FORWARD"}(t=e.Direction||(e.Direction={})),function(e){e[e.BACKWARD=0]="BACKWARD",e[e.FORWARD=1]="FORWARD"}(r||(r={})),function(e){e.codec=()=>na(r)}(t=e.Direction||(e.Direction={})),e.codec=()=>(null==n&&(n=ia((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&r.fork(),null!=t.pageSize&&(r.uint32(8),r.uint64(t.pageSize)),null!=t.cursor&&(r.uint32(18),Vs.codec().encode(t.cursor,r)),null!=t.direction&&(r.uint32(24),e.Direction.codec().encode(t.direction,r)),!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.pageSize=t.uint64();break;case 2:n.cursor=Vs.codec().decode(t,t.uint32());break;case 3:n.direction=e.Direction.codec().decode(t);break;default:t.skipType(7&r)}}return n}))),n),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Hs||(Hs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ws||(Ws={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),null!=e.contentFilters)for(const n of e.contentFilters)t.uint32(26),Ws.codec().encode(n,t);null!=e.pagingInfo&&(t.uint32(34),Hs.codec().encode(e.pagingInfo,t)),null!=e.startTime&&(t.uint32(40),t.sint64(e.startTime)),null!=e.endTime&&(t.uint32(48),t.sint64(e.endTime)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentFilters:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 2:r.pubsubTopic=e.string();break;case 3:r.contentFilters.push(Ws.codec().decode(e,e.uint32()));break;case 4:r.pagingInfo=Hs.codec().decode(e,e.uint32());break;case 5:r.startTime=e.sint64();break;case 6:r.endTime=e.sint64();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Gs||(Gs={})),function(e){let t,r,n;!function(e){e.NONE="NONE",e.INVALID_CURSOR="INVALID_CURSOR"}(t=e.HistoryError||(e.HistoryError={})),function(e){e[e.NONE=0]="NONE",e[e.INVALID_CURSOR=1]="INVALID_CURSOR"}(r||(r={})),function(e){e.codec=()=>na(r)}(t=e.HistoryError||(e.HistoryError={})),e.codec=()=>(null==n&&(n=ia((function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==i.lengthDelimited&&n.fork(),null!=t.messages)for(const e of t.messages)n.uint32(18),Js.codec().encode(e,n);null!=t.pagingInfo&&(n.uint32(26),Hs.codec().encode(t.pagingInfo,n)),null!=t.error&&0!==r[t.error]&&(n.uint32(32),e.HistoryError.codec().encode(t.error,n)),!1!==i.lengthDelimited&&n.ldelim()}),((r,n)=>{const i={messages:[],error:t.NONE},o=null==n?r.len:r.pos+n;for(;r.pos<o;){const t=r.uint32();switch(t>>>3){case 2:i.messages.push(Js.codec().decode(r,r.uint32()));break;case 3:i.pagingInfo=Hs.codec().decode(r,r.uint32());break;case 4:i.error=e.HistoryError.codec().decode(r);break;default:r.skipType(7&t)}}return i}))),n),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Ys||(Ys={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.query&&(t.uint32(18),Gs.codec().encode(e.query,t)),null!=e.response&&(t.uint32(26),Ys.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.query=Gs.codec().decode(e,e.uint32());break;case 3:r.response=Ys.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Qs||(Qs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={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)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Xs||(Xs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),Xs.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=Xs.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Js||(Js={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.enr&&(t.uint32(10),t.bytes(e.enr)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.enr=e.bytes();else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}($s||($s={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.numPeers&&(t.uint32(8),t.uint64(e.numPeers)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.numPeers=e.uint64();else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Zs||(Zs={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.peerInfos)for(const n of e.peerInfos)t.uint32(10),$s.codec().encode(n,t);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={peerInfos:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.peerInfos.push($s.codec().decode(e,e.uint32()));else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(ea||(ea={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.query&&(t.uint32(10),Zs.codec().encode(e.query,t)),null!=e.response&&(t.uint32(18),ea.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.query=Zs.codec().decode(e,e.uint32());break;case 2:r.response=ea.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(ta||(ta={}));const oa=ai("waku:message:version-0"),sa=BigInt(1e6);class aa{constructor(e,t){Ze(this,"pubSubTopic",void 0),Ze(this,"proto",void 0),this.pubSubTopic=e,this.proto=t}get ephemeral(){return Boolean(this.proto.ephemeral)}get payload(){return this.proto.payload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp){const e=this.proto.timestamp/sa;return new Date(Number(e))}return}catch(e){return}}get meta(){return this.proto.meta}get version(){var e;return null!==(e=this.proto.version)&&void 0!==e?e:0}get rateLimitProof(){return this.proto.rateLimitProof}}class ca{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;if(Ze(this,"contentTopic",void 0),Ze(this,"ephemeral",void 0),Ze(this,"metaSetter",void 0),this.contentTopic=e,this.ephemeral=t,this.metaSetter=r,!e||""===e)throw new Error("Content topic must be specified")}async toWire(e){return Cs.encode(await this.toProtoObj(e))}async toProtoObj(e){var t;const r=null!==(t=e.timestamp)&&void 0!==t?t:new Date,n={payload:e.payload,version:0,contentTopic:this.contentTopic,timestamp:BigInt(r.valueOf())*sa,meta:void 0,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const e=this.metaSetter(n);return{...n,meta:e}}return n}}function la(e){let{contentTopic:t,ephemeral:r,metaSetter:n}=e;return new ca(t,r,n)}class ua{constructor(e){if(Ze(this,"contentTopic",void 0),this.contentTopic=e,!e||""===e)throw new Error("Content topic must be specified")}fromWireToProtoObj(e){var t,r,n,i,o;const s=Cs.decode(e);return oa("Message decoded",s),Promise.resolve({payload:s.payload,contentTopic:s.contentTopic,version:null!==(t=s.version)&&void 0!==t?t:void 0,timestamp:null!==(r=s.timestamp)&&void 0!==r?r:void 0,meta:null!==(n=s.meta)&&void 0!==n?n:void 0,rateLimitProof:null!==(i=s.rateLimitProof)&&void 0!==i?i:void 0,ephemeral:null!==(o=s.ephemeral)&&void 0!==o&&o})}async fromProtoObj(e,t){var r;return null!==(r=t.version)&&void 0!==r&&r?(oa("Failed to decode due to incorrect version, expected:",0,", actual:",t.version),Promise.resolve(void 0)):new aa(e,t)}}function ha(e){const t=new Map;return e.forEach((e=>{let r=t.get(e.contentTopic);r||(t.set(e.contentTopic,[]),r=t.get(e.contentTopic)),r.push(e)})),t}async function da(e,t,r,n){var i,o;const s=null!==(i=null===n||void 0===n?void 0:n.iteratorDelay)&&void 0!==i?i:60,a=[];let c;c=await e.subscribe(t,(e=>{a.push(e)}),r);const l=Number.isInteger(null===n||void 0===n?void 0:n.timeoutMs),u=null!==(o=null===n||void 0===n?void 0:n.timeoutMs)&&void 0!==o?o:0,h=Date.now();return{iterator:async function*(){for(;;){if(l&&Date.now()-h>=u)return;await fa(s);const e=a.shift();if(!c&&0===a.length)return e;!e&&c||(yield e)}}(),async stop(){c&&(await c(),c=void 0)}}}function fa(e){return new Promise((t=>{setTimeout(t,e)}))}const pa=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{const t=[];for await(const r of e)t.push(r);return t})();const t=[];for(const r of e)t.push(r);return t};function ga(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}function ya(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}function ma(e,t){null==t&&(t=e.reduce(((e,t)=>e+t.length),0));const r=ya(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}function va(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}const ba=Symbol.for("@achingbrain/uint8arraylist");function wa(e,t){if(null==t||t<0)throw new RangeError("index is out of bounds");let r=0;for(const n of e){const e=r+n.byteLength;if(t<e)return{buf:n,index:t-r};r=e}throw new RangeError("index is out of bounds")}function Ea(e){return Boolean(null===e||void 0===e?void 0:e[ba])}class _a{constructor(){Ze(this,"bufs",void 0),Ze(this,"length",void 0),Ze(this,ba,!0),this.bufs=[],this.length=0;for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.appendAll(t)}appendAll(e){let t=0;for(const r of e)if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.push(r);else{if(!Ea(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(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.prependAll(t)}prependAll(e){let t=0;for(const r of e.reverse())if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.unshift(r);else{if(!Ea(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=wa(this.bufs,e);return t.buf[t.index]}set(e,t){const r=wa(this.bufs,e);r.buf[r.index]=t}write(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e instanceof Uint8Array)for(let r=0;r<e.length;r++)this.set(t+r,e[r]);else{if(!Ea(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:n}=this._subList(e,t);return ma(r,n)}subarray(e,t){const{bufs:r,length:n}=this._subList(e,t);return 1===r.length?r[0]:ma(r,n)}sublist(e,t){const{bufs:r,length:n}=this._subList(e,t),i=new _a;return i.length=n,i.bufs=[...r],i}_subList(e,t){var r,n;if(e=null!==(r=e)&&void 0!==r?r:0,t=null!==(n=t)&&void 0!==n?n:this.length,e<0&&(e=this.length+e),t<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 i=[];let o=0;for(let s=0;s<this.bufs.length;s++){const r=this.bufs[s],n=o,a=n+r.byteLength;if(o=a,e>=a)continue;const c=e>=n&&e<a,l=t>n&&t<=a;if(c&&l){if(e===n&&t===a){i.push(r);break}const o=e-n;i.push(r.subarray(o,o+(t-e)));break}if(c){if(0===e){i.push(r);continue}i.push(r.subarray(e-n))}else{if(l){if(t===a){i.push(r);break}i.push(r.subarray(0,t-n));break}i.push(r)}}return{bufs:i,length:t-e}}indexOf(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!Ea(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const n=e instanceof Uint8Array?e:e.subarray();if(r=Number(null!==(t=r)&&void 0!==t?t:0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),0===e.length)return r>this.length?this.length:r;const i=n.byteLength;if(0===i)throw new TypeError("search must be at least 1 byte long");const o=new Int32Array(256);for(let u=0;u<256;u++)o[u]=-1;for(let u=0;u<i;u++)o[n[u]]=u;const s=o,a=this.byteLength-n.byteLength,c=n.byteLength-1;let l;for(let u=r;u<=a;u+=l){l=0;for(let e=c;e>=0;e--){const t=this.get(u+e);if(n[e]!==t){l=Math.max(1,e-s[t]);break}}if(0===l)return u}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=ya(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 n=ga(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt16(0,t,r),this.write(n,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 n=ga(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt32(0,t,r),this.write(n,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 n=ga(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigInt64(0,t,r),this.write(n,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=ya(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 n=ga(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint16(0,t,r),this.write(n,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 n=ga(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,t,r),this.write(n,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 n=ga(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigUint64(0,t,r),this.write(n,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 n=ga(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat32(0,t,r),this.write(n,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 n=ga(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat64(0,t,r),this.write(n,e)}equals(e){if(null==e)return!1;if(!(e instanceof _a))return!1;if(e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!va(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){const r=new _a;return r.bufs=e,null==t&&(t=e.reduce(((e,t)=>e+t.byteLength),0)),r.length=t,r}}function Sa(e){return null!=e[Symbol.asyncIterator]}const Aa=e=>{const t=an(e),r=function(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}(t);return un(e,r),Aa.bytes=t,r};function ka(e,t){var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:Aa;function*o(e){const t=i(e.byteLength);t instanceof Uint8Array?yield t:yield*t,e instanceof Uint8Array?yield e:yield*e}return Sa(e)?async function*(){for await(const t of e)yield*o(t)}():function*(){for(const t of e)yield*o(t)}()}Aa.bytes=0,ka.single=(e,t)=>{var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:Aa;return new _a(i(e.byteLength),e)};var Ia=__webpack_require__(2956);const Ca=8,Ra=4194304;var Ta;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(Ta||(Ta={}));const xa=e=>{const t=hn(e);return xa.bytes=an(t),t};function Pa(e,t){var r,n,i;const o=new _a;let s=Ta.LENGTH,a=-1;const c=null!==(r=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==r?r:xa,l=null!==(n=null===t||void 0===t?void 0:t.maxLengthLength)&&void 0!==n?n:Ca,u=null!==(i=null===t||void 0===t?void 0:t.maxDataLength)&&void 0!==i?i:Ra;function*h(){for(;o.byteLength>0;){if(s===Ta.LENGTH)try{if(a=c(o),a<0)throw Ia(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw Ia(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");const e=c.bytes;o.consume(e),null!=(null===t||void 0===t?void 0:t.onLength)&&t.onLength(a),s=Ta.DATA}catch(e){if(e instanceof RangeError){if(o.byteLength>l)throw Ia(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw e}if(s===Ta.DATA){if(o.byteLength<a)break;const e=o.sublist(0,a);o.consume(a),null!=(null===t||void 0===t?void 0:t.onData)&&t.onData(e),yield e,s=Ta.LENGTH}}}return Sa(e)?async function*(){for await(const t of e)o.append(t),yield*h();if(o.byteLength>0)throw Ia(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(const t of e)o.append(t),yield*h();if(o.byteLength>0)throw Ia(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}function Da(){const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}xa.bytes=0,Pa.fromReader=(e,t)=>{let r=1;return Pa(async function*(){for(;;)try{const{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}(),{...null!==t&&void 0!==t?t:{},onLength:e=>{r=e}})};class Na{constructor(e){if(Ze(this,"buffer",void 0),Ze(this,"mask",void 0),Ze(this,"top",void 0),Ze(this,"btm",void 0),Ze(this,"next",void 0),!(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 Oa{constructor(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ze(this,"size",void 0),Ze(this,"hwm",void 0),Ze(this,"head",void 0),Ze(this,"tail",void 0),this.hwm=null!==(e=t.splitLimit)&&void 0!==e?e:16,this.head=new Na(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return null!=(null===e||void 0===e?void 0:e.byteLength)?e.byteLength:1}push(e){if(null!=(null===e||void 0===e?void 0:e.value)&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){const t=this.head;this.head=t.next=new Na(2*this.head.buffer.length),this.head.push(e)}}shift(){var e;let t=this.tail.shift();if(void 0===t&&null!=this.tail.next){const e=this.tail.next;this.tail.next=null,this.tail=e,t=this.tail.shift()}return null!=(null===(e=t)||void 0===e?void 0:e.value)&&(this.size-=this.calculateSize(t.value)),t}isEmpty(){return this.head.isEmpty()}}class La extends Error{constructor(e,t){super(null!==e&&void 0!==e?e:"The operation was aborted"),Ze(this,"type",void 0),Ze(this,"code",void 0),this.type="aborted",this.code=null!==t&&void 0!==t?t:"ABORT_ERR"}}function Ba(){return Ma((e=>{const t=e.shift();if(null==t)return{done:!0};if(null!=t.error)throw t.error;return{done:!0===t.done,value:t.value}}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}function Ma(e,t){var r;let n,i,o,s=(t=null!==(r=t)&&void 0!==r?r:{}).onEnd,a=new Oa,c=Da();const l=e=>null!=i?i(e):(a.push(e),n),u=e=>{var r;if(o)return n;if(!0!==(null===(r=t)||void 0===r?void 0:r.objectMode)&&null==(null===e||void 0===e?void 0:e.byteLength))throw new Error("objectMode was not true but tried to push non-Uint8Array value");return l({done:!1,value:e})},h=e=>o?n:(o=!0,null!=e?(e=>(a=new Oa,null!=i?i({error:e}):(a.push({error:e}),n)))(e):l({done:!0}));if(n={[Symbol.asyncIterator](){return this},next:async()=>{try{return a.isEmpty()?o?{done:!0}:await new Promise(((t,r)=>{i=o=>{i=null,a.push(o);try{t(e(a))}catch(s){r(s)}return n}})):e(a)}finally{a.isEmpty()&&queueMicrotask((()=>{c.resolve(),c=Da()}))}},return:()=>(a=new Oa,h(),{done:!0}),throw:e=>(h(e),{done:!0}),push:u,end:h,get readableLength(){return a.size},onEmpty:async e=>{const t=null===e||void 0===e?void 0:e.signal;if(null===t||void 0===t||t.throwIfAborted(),a.isEmpty())return;let r,n;null!=t&&(r=new Promise(((e,r)=>{n=()=>{r(new La)},t.addEventListener("abort",n)})));try{await Promise.race([c.promise,r])}finally{null!=n&&null!=t&&(null===t||void 0===t||t.removeEventListener("abort",n))}}},null==s)return n;const d=n;return n={[Symbol.asyncIterator](){return this},next:()=>d.next(),throw:e=>(d.throw(e),null!=s&&(s(e),s=void 0),{done:!0}),return:()=>(d.return(),null!=s&&(s(),s=void 0),{done:!0}),push:u,end:e=>(d.end(e),null!=s&&(s(e),s=void 0),n),get readableLength(){return d.readableLength},onEmpty:e=>d.onEmpty(e)},n}const Ua=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[];for(const i of t)null==i[Symbol.asyncIterator]&&n.push(i);return n.length===t.length?function*(){for(const e of n)yield*e}():async function*(){const e=Ba({objectMode:!0});Promise.resolve().then((async()=>{try{await Promise.all(t.map((async t=>{for await(const r of t)e.push(r)}))),e.end()}catch(r){e.end(r)}})),yield*e}()};function Fa(e){if(null==e)throw new Error("Empty pipeline");if(Ka(e)){const t=e;e=()=>t.source}else if(qa(e)||za(e)){const t=e;e=()=>t}for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const i=[e,...r];if(i.length>1&&Ka(i[i.length-1])&&(i[i.length-1]=i[i.length-1].sink),i.length>2)for(let o=1;o<i.length-1;o++)Ka(i[o])&&(i[o]=Va(i[o]));return ja(...i)}const ja=function(){let e;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(;r.length>0;)e=r.shift()(e);return e},za=e=>null!=(null===e||void 0===e?void 0:e[Symbol.asyncIterator]),qa=e=>null!=(null===e||void 0===e?void 0:e[Symbol.iterator]),Ka=e=>null!=e&&(null!=e.sink&&null!=e.source),Va=e=>t=>{const r=e.sink(t);if(null!=(null===r||void 0===r?void 0:r.then)){const t=Ba({objectMode:!0});let n;r.then((()=>{t.end()}),(e=>{t.end(e)}));const i=e.source;if(za(i))n=async function*(){yield*i,t.end()};else{if(!qa(i))throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");n=function*(){yield*i,t.end()}}return Ua(t,n())}return e.source};ai("waku:libp2p-utils");"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);new Uint8Array(16);const Ha=[];for(let pO=0;pO<256;++pO)Ha.push((pO+256).toString(16).slice(1));ai("waku:filter:v2");const Wa=e=>!(e.length/1048576>1);ai("waku:light-push");function Ga(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}var Ya=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const Qa=Ya,Xa=(new Uint8Array(0),e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class Ja{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class $a{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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return ec(this,e)}}class Za{constructor(e){this.decoders=e}or(e){return ec(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const ec=(e,t)=>new Za({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class tc{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ja(e,t,r),this.decoder=new $a(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const rc=e=>{let{name:t,prefix:r,encode:n,decode:i}=e;return new tc(t,r,n,i)},nc=e=>{let{prefix:t,name:r,alphabet:n}=e;const{encode:i,decode:o}=Qa(n,r);return rc({prefix:t,name:r,encode:i,decode:e=>Xa(o(e))})},ic=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return rc({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,n,t)})},oc=nc({prefix:"9",name:"base10",alphabet:"0123456789"}),sc=ic({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ac=ic({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),cc=ic({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),lc=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),uc=lc.reduce(((e,t,r)=>(e[r]=t,e)),[]),hc=lc.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const dc=rc({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=uc[t]),"")},decode:function(e){const t=[];for(const r of e){const e=hc[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),fc=ic({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pc=ic({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),gc=ic({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),yc=ic({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),mc=ic({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),vc=ic({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),bc=ic({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),wc=ic({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ec=ic({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),_c=nc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Sc=nc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ac=nc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),kc=nc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Ic=ic({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Cc=ic({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Rc=ic({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Tc=ic({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),xc=ic({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Pc=rc({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),Dc=new TextEncoder,Nc=new TextDecoder,Oc="json",Lc=512,Bc=e=>Dc.encode(JSON.stringify(e)),Mc=e=>JSON.parse(Nc.decode(e)),Uc="raw",Fc=85,jc=e=>Xa(e),zc=e=>Xa(e);var qc=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=Hc;)r[n++]=255&t|Kc,t/=128;for(;t&Vc;)r[n++]=255&t|Kc,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},Kc=128,Vc=-128,Hc=Math.pow(2,31);var Wc=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&Yc)<<o:(n&Yc)*Math.pow(2,o),o+=7}while(n>=Gc);return e.bytes=s-r,i},Gc=128,Yc=127;var Qc=Math.pow(2,7),Xc=Math.pow(2,14),Jc=Math.pow(2,21),$c=Math.pow(2,28),Zc=Math.pow(2,35),el=Math.pow(2,42),tl=Math.pow(2,49),rl=Math.pow(2,56),nl=Math.pow(2,63);const il={encode:qc,decode:Wc,encodingLength:function(e){return e<Qc?1:e<Xc?2:e<Jc?3:e<$c?4:e<Zc?5:e<el?6:e<tl?7:e<rl?8:e<nl?9:10}},ol=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return il.encode(e,t,r),t},sl=e=>il.encodingLength(e),al=(e,t)=>{const r=t.byteLength,n=sl(e),i=n+sl(r),o=new Uint8Array(i+r);return ol(e,o,0),ol(r,o,n),o.set(t,i),new cl(e,r,t,o)};class cl{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const ll=Xa,ul={code:0,name:"identity",encode:ll,digest:e=>al(0,ll(e))},hl=e=>{let{name:t,code:r,encode:n}=e;return new dl(t,r,n)};class dl{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?al(this.code,t):t.then((e=>al(this.code,e)))}throw Error("Unknown type, must be binary type")}}const fl=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),pl=hl({name:"sha2-256",code:18,encode:fl("SHA-256")}),gl=hl({name:"sha2-512",code:19,encode:fl("SHA-512")});new WeakMap;Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const yl={...M,...x,...B,...R,...T,...D,...N,...O,...L,...P};function ml(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=(null===(e=globalThis.Buffer)||void 0===e?void 0:e.allocUnsafe)?Ga(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function vl(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const bl=vl("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),wl=vl("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=ml((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),El={utf8:bl,"utf-8":bl,hex:yl.base16,latin1:wl,ascii:wl,binary:wl,...yl};function _l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=El[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode("".concat(r.prefix).concat(e)):Ga(globalThis.Buffer.from(e,"utf-8"))}function Sl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=El[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function Al(e){if("string"===typeof e){return _l(e.replace(/^0x/i,"").toLowerCase(),"base16")}return e}const kl=e=>Sl(e,"base16"),Il=e=>Sl(e,"utf8");new Uint8Array;BigInt(1e6);var Cl;!function(e){e.BACKWARD="backward",e.FORWARD="forward"}(Cl||(Cl={}));Ys.HistoryError;ai("waku:store");class Rl extends Error{constructor(e){super(e),this.name="TimeoutError"}}class Tl extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const xl=e=>void 0===globalThis.DOMException?new Tl(e):new DOMException(e),Pl=e=>{const t=void 0===e.reason?xl("This operation was aborted."):e.reason;return t instanceof Error?t:xl(t)};const Dl=e=>{const t=e.on||e.addListener||e.addEventListener,r=e.off||e.removeListener||e.removeEventListener;if(!t||!r)throw new TypeError("Emitter is not compatible");return{addListener:t.bind(e),removeListener:r.bind(e)}};function Nl(e,t,r){let n;const i=new Promise(((i,o)=>{if(!((r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r}).count>=0)||r.count!==Number.POSITIVE_INFINITY&&!Number.isInteger(r.count))throw new TypeError("The `count` option should be at least 0 or more");const s=[t].flat(),a=[],{addListener:c,removeListener:l}=Dl(e),u=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];const s=r.multiArgs?t:t[0];r.filter&&!r.filter(s)||(a.push(s),r.count===a.length&&(n(),i(a)))},h=e=>{n(),o(e)};n=()=>{for(const e of s)l(e,u);for(const e of r.rejectionEvents)l(e,h)};for(const e of s)c(e,u);for(const e of r.rejectionEvents)c(e,h);r.resolveImmediately&&i(a)}));if(i.cancel=n,"number"===typeof r.timeout){const e=function(e,t,r,n){let i;const o=new Promise(((o,s)=>{if("number"!==typeof t||1!==Math.sign(t))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(t,"`"));if(t!==Number.POSITIVE_INFINITY){if((n={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...n}).signal){const{signal:e}=n;e.aborted&&s(Pl(e)),e.addEventListener("abort",(()=>{s(Pl(e))}))}i=n.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof r){try{o(r())}catch(a){s(a)}return}const n="string"===typeof r?r:"Promise timed out after ".concat(t," milliseconds"),i=r instanceof Error?r:new Rl(n);"function"===typeof e.cancel&&e.cancel(),s(i)}),t),(async()=>{try{o(await e)}catch(t){s(t)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()}else o(e)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(i,r.timeout);return e.cancel=n,e}return i}function Ol(e,t,r){"function"===typeof r&&(r={filter:r});const n=Nl(e,t,r={...r,count:1,resolveImmediately:!1}),i=n.then((e=>e[0]));return i.cancel=n.cancel,i}const Ll=ai("waku:wait-for-remote-peer");async function Bl(e,t,r){var n;if(t=null!==(n=t)&&void 0!==n?n:function(e){const t=[];e.relay&&t.push(ti.Relay);e.filter&&t.push(ti.Filter);e.store&&t.push(ti.Store);e.lightPush&&t.push(ti.LightPush);return t}(e),!e.isStarted())return Promise.reject("Waku node is not started");const i=[];if(t.includes(ti.Relay)){if(!e.relay)throw new Error("Cannot wait for Relay peer: protocol not mounted");i.push(async function(e){let t=e.getMeshPeers();for(;0==t.length;)await Ol(e.gossipSub,"gossipsub:heartbeat"),t=e.getMeshPeers()}(e.relay))}if(t.includes(ti.Store)){if(!e.store)throw new Error("Cannot wait for Store peer: protocol not mounted");i.push(Ml(e.store))}if(t.includes(ti.LightPush)){if(!e.lightPush)throw new Error("Cannot wait for LightPush peer: protocol not mounted");i.push(Ml(e.lightPush))}if(t.includes(ti.Filter)){if(!e.filter)throw new Error("Cannot wait for Filter peer: protocol not mounted");i.push(Ml(e.filter))}r?await async function(e,t,r){await Promise.race([e,Ul(t,r)])}(Promise.all(i),r,"Timed out waiting for a remote peer."):await Promise.all(i)}async function Ml(e){const t=e.multicodec,r=await e.peers();r.length?Ll("".concat(t," peer found: "),r[0].id.toString()):await new Promise((r=>{const n=i=>{var o;null!==(o=i.detail)&&void 0!==o&&null!==(o=o.protocols)&&void 0!==o&&o.includes(t)&&(Ll("Resolving for",t,i.detail.protocols),e.removeLibp2pEventListener("peer:identify",n),r())};e.addLibp2pEventListener("peer:identify",n)}))}const Ul=(e,t)=>new Promise(((r,n)=>setTimeout((()=>n(t)),e)));function Fl(){const e=Da();let t=!1;return{sink:async r=>{if(t)throw new Error("already piped");t=!0,e.resolve(r)},source:async function*(){const t=await e.promise;yield*t}()}}function jl(e){return e instanceof Uint8Array?{get:t=>e[t],set(t,r){e[t]=r}}:{get:t=>e.get(t),set(t,r){e.set(t,r)}}}const zl=4294967296;class ql{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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 e=1+~this.lo>>>0;let t=~this.hi>>>0;return 0===e&&(t=t+1>>>0),-(BigInt(e)+(BigInt(t)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(e){return Number(this.toBigInt(e))}zzDecode(){const e=-(1&this.lo),t=((this.lo>>>1|this.hi<<31)^e)>>>0,r=(this.hi>>>1^e)>>>0;return new ql(r,t)}zzEncode(){const e=this.hi>>31,t=((this.hi<<1|this.lo>>>31)^e)>>>0,r=(this.lo<<1^e)>>>0;return new ql(t,r)}toBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=jl(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 ql;const t=e<0;t&&(e=-e);let r=0|Number(e>>32n),n=0|Number(e-(BigInt(r)<<32n));return t&&(r=~r>>>0,n=~n>>>0,++n>zl&&(n=0,++r>zl&&(r=0))),new ql(r,n)}static fromNumber(e){if(0===e)return new ql;const t=e<0;t&&(e=-e);let r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new ql(n,r)}static fromBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=jl(e),n=new ql;let i=0;if(e.length-t>4){for(;i<4;++i)if(n.lo=(n.lo|(127&r.get(t))<<7*i)>>>0,r.get(t++)<128)return n;if(n.lo=(n.lo|(127&r.get(t))<<28)>>>0,n.hi=(n.hi|(127&r.get(t))>>4)>>>0,r.get(t++)<128)return n;i=0}else for(;i<4;++i){if(t>=e.length)throw RangeError("index out of range: ".concat(t," > ").concat(e.length));if(n.lo=(n.lo|(127&r.get(t))<<7*i)>>>0,r.get(t++)<128)return n}if(e.length-t>4){for(;i<5;++i)if(n.hi=(n.hi|(127&r.get(t))<<7*i+3)>>>0,r.get(t++)<128)return n}else if(t<e.byteLength)for(;i<5;++i){if(t>=e.length)throw RangeError("index out of range: ".concat(t," > ").concat(e.length));if(n.hi=(n.hi|(127&r.get(t))<<7*i+3)>>>0,r.get(t++)<128)return n}throw RangeError("invalid varint encoding")}}const Kl=Math.pow(2,7),Vl=Math.pow(2,14),Hl=Math.pow(2,21),Wl=Math.pow(2,28),Gl=Math.pow(2,35),Yl=Math.pow(2,42),Ql=Math.pow(2,49),Xl=Math.pow(2,56),Jl=Math.pow(2,63),$l={encodingLength:e=>e<Kl?1:e<Vl?2:e<Hl?3:e<Wl?4:e<Gl?5:e<Yl?6:e<Ql?7:e<Xl?8:e<Jl?9:10,encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null!=Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return null==t&&(t=ml($l.encodingLength(e))),ql.fromNumber(e).toBytes(t,r),t},decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return ql.fromBytes(e,t).toNumber(!0)}},Zl=e=>$l.decode(e);function eu(e,t){const r=Ba();e.sink(r).catch((e=>{r.end(e)})),e.sink=async e=>{for await(const t of e)r.push(t);r.end()};let n=e.source;null!=e.source[Symbol.iterator]?n=e.source[Symbol.iterator]():null!=e.source[Symbol.asyncIterator]&&(n=e.source[Symbol.asyncIterator]());const i=new _a,o={read:async e=>{if(null==e){const{done:e,value:t}=await n.next();return!0===e?new _a:t}for(;i.byteLength<e;){const{value:e,done:t}=await n.next();if(!0===t)throw Ia(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF");i.append(e)}const t=i.sublist(0,e);return i.consume(e),t},readLP:async()=>{var e;let r=-1;const n=new _a,i=null!==(e=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==e?e:Zl;for(;;){n.append(await o.read(1));try{r=i(n)}catch(s){if(s instanceof RangeError)continue;throw s}if(r>-1)break;if(null!=(null===t||void 0===t?void 0:t.maxLengthLength)&&n.byteLength>t.maxLengthLength)throw Ia(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG")}if(null!=(null===t||void 0===t?void 0:t.maxDataLength)&&r>t.maxDataLength)throw Ia(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");return o.read(r)},readPB:async e=>{const t=await o.readLP();if(null==t)throw new Error("Value is null");const r=t instanceof Uint8Array?t:t.subarray();return e.decode(r)},write:e=>{e instanceof Uint8Array?r.push(e):r.push(e.subarray())},writeLP:e=>{o.write(ka.single(e,t))},writePB:(e,t)=>{o.writeLP(t.encode(e))},pb:e=>({read:async()=>o.readPB(e),write:t=>{o.writePB(t,e)},unwrap:()=>o}),unwrap:()=>{const t=e.source;return e.source=async function*(){yield*i,yield*t}(),e}};return o}var tu;Zl.bytes=0;const ru=65535,nu=Boolean(null===(tu=globalThis.process)||void 0===tu||null===(tu=tu.env)||void 0===tu?void 0:tu.DUMP_SESSION_KEYS),iu=e=>e instanceof Uint8Array,ou=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function su(e){if("string"!==typeof e)throw new Error("utf8ToBytes expected string, got ".concat(typeof e));return new Uint8Array((new TextEncoder).encode(e))}function au(e){if("string"===typeof e&&(e=su(e)),!iu(e))throw new Error("expected Uint8Array, got ".concat(typeof e));return e}function cu(e,t){if(void 0!==t&&("object"!==typeof t||(r=t,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new Error("Options should be object or undefined");var r;return Object.assign(e,t)}function lu(e,t){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");if("number"===typeof t&&e.length!==t)throw new Error("Uint8Array length ".concat(t," expected"))}function uu(e,t,r,n){if("function"===typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,l=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+l,a,n)}function hu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Wrong positive integer: ".concat(e))}function du(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r.length>0&&!r.includes(e.length))throw new Error("Expected Uint8Array of length ".concat(r,", not of length=").concat(e.length))}const fu={number:hu,bool:function(e){if("boolean"!==typeof e)throw new Error("Expected boolean, not ".concat(e))},bytes:du,hash:function(e){if("function"!==typeof e||"function"!==typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");hu(e.outputLen),hu(e.blockLen)},exists:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},output:function(e,t){du(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least ".concat(r))}},pu=fu,gu=(e,t)=>255&e[t++]|(255&e[t++])<<8;class yu{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,lu(e=au(e),32);const t=gu(e,0),r=gu(e,2),n=gu(e,4),i=gu(e,6),o=gu(e,8),s=gu(e,10),a=gu(e,12),c=gu(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|r<<3),this.r[2]=7939&(r>>>10|n<<6),this.r[3]=8191&(n>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127;for(let l=0;l<8;l++)this.pad[l]=gu(e,16+2*l)}process(e,t){const r=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?0:2048,{h:n,r:i}=this,o=i[0],s=i[1],a=i[2],c=i[3],l=i[4],u=i[5],h=i[6],d=i[7],f=i[8],p=i[9],g=gu(e,t+0),y=gu(e,t+2),m=gu(e,t+4),v=gu(e,t+6),b=gu(e,t+8),w=gu(e,t+10),E=gu(e,t+12),_=gu(e,t+14);let S=n[0]+(8191&g),A=n[1]+(8191&(g>>>13|y<<3)),k=n[2]+(8191&(y>>>10|m<<6)),I=n[3]+(8191&(m>>>7|v<<9)),C=n[4]+(8191&(v>>>4|b<<12)),R=n[5]+(b>>>1&8191),T=n[6]+(8191&(b>>>14|w<<2)),x=n[7]+(8191&(w>>>11|E<<5)),P=n[8]+(8191&(E>>>8|_<<8)),D=n[9]+(_>>>5|r),N=0,O=N+S*o+A*(5*p)+k*(5*f)+I*(5*d)+C*(5*h);N=O>>>13,O&=8191,O+=R*(5*u)+T*(5*l)+x*(5*c)+P*(5*a)+D*(5*s),N+=O>>>13,O&=8191;let L=N+S*s+A*o+k*(5*p)+I*(5*f)+C*(5*d);N=L>>>13,L&=8191,L+=R*(5*h)+T*(5*u)+x*(5*l)+P*(5*c)+D*(5*a),N+=L>>>13,L&=8191;let B=N+S*a+A*s+k*o+I*(5*p)+C*(5*f);N=B>>>13,B&=8191,B+=R*(5*d)+T*(5*h)+x*(5*u)+P*(5*l)+D*(5*c),N+=B>>>13,B&=8191;let M=N+S*c+A*a+k*s+I*o+C*(5*p);N=M>>>13,M&=8191,M+=R*(5*f)+T*(5*d)+x*(5*h)+P*(5*u)+D*(5*l),N+=M>>>13,M&=8191;let U=N+S*l+A*c+k*a+I*s+C*o;N=U>>>13,U&=8191,U+=R*(5*p)+T*(5*f)+x*(5*d)+P*(5*h)+D*(5*u),N+=U>>>13,U&=8191;let F=N+S*u+A*l+k*c+I*a+C*s;N=F>>>13,F&=8191,F+=R*o+T*(5*p)+x*(5*f)+P*(5*d)+D*(5*h),N+=F>>>13,F&=8191;let j=N+S*h+A*u+k*l+I*c+C*a;N=j>>>13,j&=8191,j+=R*s+T*o+x*(5*p)+P*(5*f)+D*(5*d),N+=j>>>13,j&=8191;let z=N+S*d+A*h+k*u+I*l+C*c;N=z>>>13,z&=8191,z+=R*a+T*s+x*o+P*(5*p)+D*(5*f),N+=z>>>13,z&=8191;let q=N+S*f+A*d+k*h+I*u+C*l;N=q>>>13,q&=8191,q+=R*c+T*a+x*s+P*o+D*(5*p),N+=q>>>13,q&=8191;let K=N+S*p+A*f+k*d+I*h+C*u;N=K>>>13,K&=8191,K+=R*l+T*c+x*a+P*s+D*o,N+=K>>>13,K&=8191,N=(N<<2)+N|0,N=N+O|0,O=8191&N,N>>>=13,L+=N,n[0]=O,n[1]=L,n[2]=B,n[3]=M,n[4]=U,n[5]=F,n[6]=j,n[7]=z,n[8]=q,n[9]=K}finalize(){const{h:e,pad:t}=this,r=new Uint16Array(10);let n=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=n,n=e[s]>>>13,e[s]&=8191;e[0]+=5*n,n=e[0]>>>13,e[0]&=8191,e[1]+=n,n=e[1]>>>13,e[1]&=8191,e[2]+=n,r[0]=e[0]+5,n=r[0]>>>13,r[0]&=8191;for(let s=1;s<10;s++)r[s]=e[s]+n,n=r[s]>>>13,r[s]&=8191;r[9]-=8192;let i=(1^n)-1;for(let s=0;s<10;s++)r[s]&=i;i=~i;for(let s=0;s<10;s++)e[s]=e[s]&i|r[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+t[0];e[0]=65535&o;for(let s=1;s<8;s++)o=(e[s]+t[s]|0)+(o>>>16)|0,e[s]=65535&o}update(e){pu.exists(this);const{buffer:t,blockLen:r}=this,n=(e=au(e)).length;for(let i=0;i<n;){const o=Math.min(r-this.pos,n-i);if(o!==r)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(t,0,!1),this.pos=0);else for(;r<=n-i;i+=r)this.process(e,i)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){pu.exists(this),pu.output(e,this),this.finished=!0;const{buffer:t,h:r}=this;let{pos:n}=this;if(n){for(t[n++]=1;n<16;n++)t[n]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=r[o]>>>0,e[i++]=r[o]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}}const mu=function(e){const t=(t,r)=>e(r).update(au(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}((e=>new yu(e))),vu=su("expand 16-byte k"),bu=su("expand 32-byte k"),wu=ou(vu),Eu=ou(bu),_u=e=>!(e.byteOffset%4),Su=e=>{const{core:t,rounds:r,counterRight:n,counterLen:i,allow128bitKeys:o,extendNonceFn:s,blockLen:a}=cu({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},e);pu.number(i),pu.number(r),pu.number(a),pu.bool(n),pu.bool(o);const c=a/4;if(a%4!==0)throw new Error("Salsa/ChaCha: blockLen should be aligned to 4 bytes");return function(e,l,u,h){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(pu.bytes(e),pu.bytes(l),pu.bytes(u),h||(h=new Uint8Array(u.length)),pu.bytes(h),pu.number(d),d<0||d>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if(h.length<u.length)throw new Error("Salsa/ChaCha: output (".concat(h.length,") is shorter than data (").concat(u.length,")"));const f=[];let p,g;if(32===e.length)p=e,g=Eu;else{if(16!==e.length||!o)throw new Error("Salsa/ChaCha: wrong key length=".concat(e.length,", expected"));p=new Uint8Array(32),p.set(e),p.set(e,16),g=wu,f.push(p)}if(s){if(l.length<=16)throw new Error("Salsa/ChaCha: extended nonce should be bigger than 16 bytes");p=s(g,p,l.subarray(0,16),new Uint8Array(32)),f.push(p),l=l.subarray(16)}const y=16-i;if(l.length!==y)throw new Error("Salsa/ChaCha: nonce should be ".concat(y," or 16 bytes"));if(12!==y){const e=new Uint8Array(12);e.set(l,n?0:12-l.length),f.push(l=e)}const m=new Uint8Array(a),v=ou(m),b=ou(p),w=ou(l),E=_u(u)&&ou(u),_=_u(h)&&ou(h);f.push(v);const S=u.length;for(let n=0,i=d;n<S;i++){if(t(g,b,w,v,i,r),i>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");const e=Math.min(a,S-n);if(e===a&&_&&E){const e=n/4;if(n%4!==0)throw new Error("Salsa/ChaCha: wrong block position");for(let t=0;t<c;t++)_[e+t]=E[e+t]^v[t];n+=a}else{for(let t=0;t<e;t++)h[n+t]=u[n+t]^m[t];n+=e}}for(let t=0;t<f.length;t++)f[t].fill(0);return h}},Au=(e,t)=>e<<t|e>>>32-t;function ku(e,t,r,n,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:20,s=e[0],a=e[1],c=e[2],l=e[3],u=t[0],h=t[1],d=t[2],f=t[3],p=t[4],g=t[5],y=t[6],m=t[7],v=i,b=r[0],w=r[1],E=r[2],_=s,S=a,A=c,k=l,I=u,C=h,R=d,T=f,x=p,P=g,D=y,N=m,O=v,L=b,B=w,M=E;for(let F=0;F<o;F+=2)_=_+I|0,O=Au(O^_,16),x=x+O|0,I=Au(I^x,12),_=_+I|0,O=Au(O^_,8),x=x+O|0,I=Au(I^x,7),S=S+C|0,L=Au(L^S,16),P=P+L|0,C=Au(C^P,12),S=S+C|0,L=Au(L^S,8),P=P+L|0,C=Au(C^P,7),A=A+R|0,B=Au(B^A,16),D=D+B|0,R=Au(R^D,12),A=A+R|0,B=Au(B^A,8),D=D+B|0,R=Au(R^D,7),k=k+T|0,M=Au(M^k,16),N=N+M|0,T=Au(T^N,12),k=k+T|0,M=Au(M^k,8),N=N+M|0,T=Au(T^N,7),_=_+C|0,M=Au(M^_,16),D=D+M|0,C=Au(C^D,12),_=_+C|0,M=Au(M^_,8),D=D+M|0,C=Au(C^D,7),S=S+R|0,O=Au(O^S,16),N=N+O|0,R=Au(R^N,12),S=S+R|0,O=Au(O^S,8),N=N+O|0,R=Au(R^N,7),A=A+T|0,L=Au(L^A,16),x=x+L|0,T=Au(T^x,12),A=A+T|0,L=Au(L^A,8),x=x+L|0,T=Au(T^x,7),k=k+I|0,B=Au(B^k,16),P=P+B|0,I=Au(I^P,12),k=k+I|0,B=Au(B^k,8),P=P+B|0,I=Au(I^P,7);let U=0;n[U++]=s+_|0,n[U++]=a+S|0,n[U++]=c+A|0,n[U++]=l+k|0,n[U++]=u+I|0,n[U++]=h+C|0,n[U++]=d+R|0,n[U++]=f+T|0,n[U++]=p+x|0,n[U++]=g+P|0,n[U++]=y+D|0,n[U++]=m+N|0,n[U++]=v+O|0,n[U++]=b+L|0,n[U++]=w+B|0,n[U++]=E+M|0}Su({core:ku,counterRight:!1,counterLen:8});const Iu=Su({core:ku,counterRight:!1,counterLen:4,allow128bitKeys:!1}),Cu=Su({core:ku,counterRight:!1,counterLen:8,extendNonceFn:function(e,t,r,n){const i=ou(t),o=ou(r),s=ou(n);let a=e[0],c=e[1],l=e[2],u=e[3],h=i[0],d=i[1],f=i[2],p=i[3],g=i[4],y=i[5],m=i[6],v=i[7],b=o[0],w=o[1],E=o[2],_=o[3];for(let S=0;S<20;S+=2)a=a+h|0,b=Au(b^a,16),g=g+b|0,h=Au(h^g,12),a=a+h|0,b=Au(b^a,8),g=g+b|0,h=Au(h^g,7),c=c+d|0,w=Au(w^c,16),y=y+w|0,d=Au(d^y,12),c=c+d|0,w=Au(w^c,8),y=y+w|0,d=Au(d^y,7),l=l+f|0,E=Au(E^l,16),m=m+E|0,f=Au(f^m,12),l=l+f|0,E=Au(E^l,8),m=m+E|0,f=Au(f^m,7),u=u+p|0,_=Au(_^u,16),v=v+_|0,p=Au(p^v,12),u=u+p|0,_=Au(_^u,8),v=v+_|0,p=Au(p^v,7),a=a+d|0,_=Au(_^a,16),m=m+_|0,d=Au(d^m,12),a=a+d|0,_=Au(_^a,8),m=m+_|0,d=Au(d^m,7),c=c+f|0,b=Au(b^c,16),v=v+b|0,f=Au(f^v,12),c=c+f|0,b=Au(b^c,8),v=v+b|0,f=Au(f^v,7),l=l+p|0,w=Au(w^l,16),g=g+w|0,p=Au(p^g,12),l=l+p|0,w=Au(w^l,8),g=g+w|0,p=Au(p^g,7),u=u+h|0,E=Au(E^u,16),y=y+E|0,h=Au(h^y,12),u=u+h|0,E=Au(E^u,8),y=y+E|0,h=Au(h^y,7);return s[0]=a,s[1]=c,s[2]=l,s[3]=u,s[4]=b,s[5]=w,s[6]=E,s[7]=_,n},allow128bitKeys:!1}),Ru=(Su({core:ku,counterRight:!1,counterLen:4,rounds:8}),Su({core:ku,counterRight:!1,counterLen:4,rounds:12}),new Uint8Array(16)),Tu=(e,t)=>{e.update(t);const r=t.length%16;r&&e.update(Ru.subarray(r))},xu=(e,t,r,n,i)=>{const o=e(t,r,new Uint8Array(32)),s=mu.create(o);i&&Tu(s,i),Tu(s,n);const a=new Uint8Array(16),c=(l=a,new DataView(l.buffer,l.byteOffset,l.byteLength));var l;uu(c,0,BigInt(i?i.length:0),!0),uu(c,8,BigInt(n.length),!0),s.update(a);const u=s.digest();return o.fill(0),u},Pu=e=>(t,r,n)=>{const i=16;return lu(t,32),lu(r),{tagLength:i,encrypt:o=>{const s=new Uint8Array(o.length+i);e(t,r,o,s,1);const a=xu(e,t,r,s.subarray(0,-16),n);return s.set(a,o.length),s},decrypt:o=>{if(o.length<i)throw new Error("Encrypted data should be at least ".concat(i));const s=o.subarray(-16),a=o.subarray(0,-16);if(!function(e,t){if(e.length!==t.length)throw new Error("equalBytes: Different size of Uint8Arrays");let r=!0;for(let n=0;n<e.length;n++)r&&(r=e[n]===t[n]);return r}(s,xu(e,t,r,a,n)))throw new Error("Wrong tag");return e(t,r,a,void 0,1)}}},Du=Pu(Iu);Pu(Cu);function Nu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, not ".concat(e))}function Ou(e){if(!((t=e)instanceof Uint8Array||null!=t&&"object"===typeof t&&"Uint8Array"===t.constructor.name))throw new Error("Uint8Array expected");for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];if(n.length>0&&!n.includes(e.length))throw new Error("Uint8Array expected of length ".concat(n,", not of length=").concat(e.length))}function Lu(e){if("function"!==typeof e||"function"!==typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Nu(e.outputLen),Nu(e.blockLen)}function Bu(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Mu(e,t){Ou(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least ".concat(r))}const Uu="object"===typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;const Fu=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ju=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];function zu(e){if("string"!==typeof e)throw new Error("utf8ToBytes expected string, got ".concat(typeof e));return new Uint8Array((new TextEncoder).encode(e))}function qu(e){return"string"===typeof e&&(e=zu(e)),Ou(e),e}class Ku{clone(){return this._cloneInto()}}function Vu(e){const t=t=>e().update(qu(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Hu(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Uu&&"function"===typeof Uu.getRandomValues)return Uu.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const Wu=(e,t,r)=>e&t^e&r^t&r;class Gu extends Ku{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Fu(this.buffer)}update(e){Bu(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=qu(e)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=Fu(e);for(;n<=i-o;o+=n)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Bu(this),Mu(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let u=o;u<n;u++)t[u]=0;!function(e,t,r,n){if("function"===typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,l=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+l,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Fu(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}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:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}const Yu=BigInt(2**32-1),Qu=BigInt(32);function Xu(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&Yu),l:Number(e>>Qu&Yu)}:{h:0|Number(e>>Qu&Yu),l:0|Number(e&Yu)}}const Ju={fromBig:Xu,split:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=Xu(e[i],t);[r[i],n[i]]=[o,s]}return[r,n]},toBig:(e,t)=>BigInt(e>>>0)<<Qu|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:function(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},[$u,Zu]=(()=>Ju.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),eh=new Uint32Array(80),th=new Uint32Array(80);class rh extends Gu{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:l,Fh:u,Fl:h,Gh:d,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,n,i,o,s,a,c,l,u,h,d,f,p,g]}set(e,t,r,n,i,o,s,a,c,l,u,h,d,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|h,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let v=0;v<16;v++,t+=4)eh[v]=e.getUint32(t),th[v]=e.getUint32(t+=4);for(let v=16;v<80;v++){const e=0|eh[v-15],t=0|th[v-15],r=Ju.rotrSH(e,t,1)^Ju.rotrSH(e,t,8)^Ju.shrSH(e,t,7),n=Ju.rotrSL(e,t,1)^Ju.rotrSL(e,t,8)^Ju.shrSL(e,t,7),i=0|eh[v-2],o=0|th[v-2],s=Ju.rotrSH(i,o,19)^Ju.rotrBH(i,o,61)^Ju.shrSH(i,o,6),a=Ju.rotrSL(i,o,19)^Ju.rotrBL(i,o,61)^Ju.shrSL(i,o,6),c=Ju.add4L(n,a,th[v-7],th[v-16]),l=Ju.add4H(c,r,s,eh[v-7],eh[v-16]);eh[v]=0|l,th[v]=0|c}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:f,Gh:p,Gl:g,Hh:y,Hl:m}=this;for(let v=0;v<80;v++){const e=Ju.rotrSH(u,h,14)^Ju.rotrSH(u,h,18)^Ju.rotrBH(u,h,41),t=Ju.rotrSL(u,h,14)^Ju.rotrSL(u,h,18)^Ju.rotrBL(u,h,41),b=u&d^~u&p,w=h&f^~h&g,E=Ju.add5L(m,t,w,Zu[v],th[v]),_=Ju.add5H(E,y,e,b,$u[v],eh[v]),S=0|E,A=Ju.rotrSH(r,n,28)^Ju.rotrBH(r,n,34)^Ju.rotrBH(r,n,39),k=Ju.rotrSL(r,n,28)^Ju.rotrBL(r,n,34)^Ju.rotrBL(r,n,39),I=r&i^r&s^i&s,C=n&o^n&a^o&a;y=0|p,m=0|g,p=0|d,g=0|f,d=0|u,f=0|h,({h:u,l:h}=Ju.add(0|c,0|l,0|_,0|S)),c=0|s,l=0|a,s=0|i,a=0|o,i=0|r,o=0|n;const R=Ju.add3L(S,k,C);r=Ju.add3H(R,_,A,I),n=0|R}({h:r,l:n}=Ju.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=Ju.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=Ju.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:l}=Ju.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:h}=Ju.add(0|this.Eh,0|this.El,0|u,0|h)),({h:d,l:f}=Ju.add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:g}=Ju.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:m}=Ju.add(0|this.Hh,0|this.Hl,0|y,0|m)),this.set(r,n,i,o,s,a,c,l,u,h,d,f,p,g,y,m)}roundClean(){eh.fill(0),th.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const nh=Vu((()=>new rh)),ih=(BigInt(0),BigInt(1)),oh=BigInt(2);function sh(e){return e instanceof Uint8Array||null!=e&&"object"===typeof e&&"Uint8Array"===e.constructor.name}function ah(e){if(!sh(e))throw new Error("Uint8Array expected")}const ch=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function lh(e){ah(e);let t="";for(let r=0;r<e.length;r++)t+=ch[e[r]];return t}function uh(e){if("string"!==typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":"0x".concat(e))}const hh={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function dh(e){return e>=hh._0&&e<=hh._9?e-hh._0:e>=hh._A&&e<=hh._F?e-(hh._A-10):e>=hh._a&&e<=hh._f?e-(hh._a-10):void 0}function fh(e){if("string"!==typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){const t=dh(e.charCodeAt(o)),r=dh(e.charCodeAt(o+1));if(void 0===t||void 0===r){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}n[i]=16*t+r}return n}function ph(e){return ah(e),uh(lh(Uint8Array.from(e).reverse()))}function gh(e,t){return fh(e.toString(16).padStart(2*t,"0"))}function yh(e,t){return gh(e,t).reverse()}function mh(e,t,r){let n;if("string"===typeof t)try{n=fh(t)}catch(o){throw new Error("".concat(e,' must be valid hex string, got "').concat(t,'". Cause: ').concat(o))}else{if(!sh(t))throw new Error("".concat(e," must be hex string or Uint8Array"));n=Uint8Array.from(t)}const i=n.length;if("number"===typeof r&&i!==r)throw new Error("".concat(e," expected ").concat(r," bytes, got ").concat(i));return n}function vh(){let e=0;for(let r=0;r<arguments.length;r++){const t=r<0||arguments.length<=r?void 0:arguments[r];ah(t),e+=t.length}const t=new Uint8Array(e);for(let r=0,n=0;r<arguments.length;r++){const e=r<0||arguments.length<=r?void 0:arguments[r];t.set(e,n),n+=e.length}return t}const bh={bigint:e=>"bigint"===typeof e,function:e=>"function"===typeof e,boolean:e=>"boolean"===typeof e,string:e=>"string"===typeof e,stringOrUint8Array:e=>"string"===typeof e||sh(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"===typeof e&&Number.isSafeInteger(e.outputLen)};function wh(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=(t,r,n)=>{const i=bh[r];if("function"!==typeof i)throw new Error('Invalid validator "'.concat(r,'", expected function'));const o=e[t];if((!n||void 0!==o)&&!i(o,e))throw new Error("Invalid param ".concat(String(t),"=").concat(o," (").concat(typeof o,"), expected ").concat(r))};for(const[i,o]of Object.entries(t))n(i,o,!1);for(const[i,o]of Object.entries(r))n(i,o,!0);return e}const Eh=BigInt(0),_h=BigInt(1),Sh=BigInt(2),Ah=BigInt(3),kh=BigInt(4),Ih=BigInt(5),Ch=BigInt(8);BigInt(9),BigInt(16);function Rh(e,t){const r=e%t;return r>=Eh?r:t+r}function Th(e,t,r){if(r<=Eh||t<Eh)throw new Error("Expected power/modulo > 0");if(r===_h)return Eh;let n=_h;for(;t>Eh;)t&_h&&(n=n*e%r),e=e*e%r,t>>=_h;return n}function xh(e,t,r){let n=e;for(;t-- >Eh;)n*=n,n%=r;return n}function Ph(e,t){if(e===Eh||t<=Eh)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=Rh(e,t),n=t,i=Eh,o=_h,s=_h,a=Eh;for(;r!==Eh;){const e=n/r,t=n%r,c=i-s*e,l=o-a*e;n=r,r=t,i=s,o=a,s=c,a=l}if(n!==_h)throw new Error("invert: does not exist");return Rh(i,t)}function Dh(e){if(e%kh===Ah){const t=(e+_h)/kh;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%Ch===Ih){const t=(e-Ih)/Ch;return function(e,r){const n=e.mul(r,Sh),i=e.pow(n,t),o=e.mul(r,i),s=e.mul(e.mul(o,Sh),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),r))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-_h)/Sh;let r,n,i;for(r=e-_h,n=0;r%Sh===Eh;r/=Sh,n++);for(i=Sh;i<e&&Th(i,t,e)!==e-_h;i++);if(1===n){const t=(e+_h)/kh;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const o=(r+_h)/Sh;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=n,c=e.pow(e.mul(e.ONE,i),r),l=e.pow(s,o),u=e.pow(s,r);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(u);t<a&&!e.eql(n,e.ONE);t++)n=e.sqr(n);const r=e.pow(c,_h<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),u=e.mul(u,c),a=t}return l}}(e)}const Nh=(e,t)=>(Rh(e,t)&_h)===_h,Oh=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Lh(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}const Bh=BigInt(0),Mh=BigInt(1);function Uh(e){return function(e){const t=Oh.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});wh(e,t)}(e.Fp),wh(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Lh(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const Fh=BigInt(0),jh=BigInt(1),zh=BigInt(2),qh=BigInt(8),Kh={zip215:!0};function Vh(e){const t=function(e){const t=Uh(e);return wh(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n:n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=t,l=zh<<BigInt(8*a)-jh,u=r.create,h=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(n){return{isValid:!1,value:Fh}}}),d=t.adjustScalarBytes||(e=>e),f=t.domain||((e,t,r)=>{if(t.length||r)throw new Error("Contexts/pre-hash are not supported");return e}),p=e=>"bigint"===typeof e&&Fh<e,g=(e,t)=>p(e)&&p(t)&&e<t,y=e=>e===Fh||g(e,l);function m(e,t){if(g(e,t))return e;throw new Error("Expected valid scalar < ".concat(t,", got ").concat(typeof e," ").concat(e))}function v(e){return e===Fh?e:m(e,n)}const b=new Map;function w(e){if(!(e instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(e,t,r,n){if(this.ex=e,this.ey=t,this.ez=r,this.et=n,!y(e))throw new Error("x required");if(!y(t))throw new Error("y required");if(!y(r))throw new Error("z required");if(!y(n))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof E)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};if(!y(t)||!y(r))throw new Error("invalid affine point");return new E(t,r,jh,u(t*r))}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.ez)));return e.map(((e,r)=>e.toAffine(t[r]))).map(E.fromAffine)}_setWindowSize(e){this._WINDOW_SIZE=e,b.delete(this)}assertValidity(){const{a:e,d:r}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:n,ey:i,ez:o,et:s}=this,a=u(n*n),c=u(i*i),l=u(o*o),h=u(l*l),d=u(a*e);if(u(l*u(d+c))!==u(h+u(r*u(a*c))))throw new Error("bad point: equation left != right (1)");if(u(n*i)!==u(o*s))throw new Error("bad point: equation left != right (2)")}equals(e){w(e);const{ex:t,ey:r,ez:n}=this,{ex:i,ey:o,ez:s}=e,a=u(t*s),c=u(i*n),l=u(r*s),h=u(o*n);return a===c&&l===h}is0(){return this.equals(E.ZERO)}negate(){return new E(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:e}=t,{ex:r,ey:n,ez:i}=this,o=u(r*r),s=u(n*n),a=u(zh*u(i*i)),c=u(e*o),l=r+n,h=u(u(l*l)-o-s),d=c+s,f=d-a,p=c-s,g=u(h*f),y=u(d*p),m=u(h*p),v=u(f*d);return new E(g,y,v,m)}add(e){w(e);const{a:r,d:n}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:c,ey:l,ez:h,et:d}=e;if(r===BigInt(-1)){const e=u((o-i)*(l+c)),t=u((o+i)*(l-c)),r=u(t-e);if(r===Fh)return this.double();const n=u(s*zh*d),f=u(a*zh*h),p=f+n,g=t+e,y=f-n,m=u(p*r),v=u(g*y),b=u(p*y),w=u(r*g);return new E(m,v,w,b)}const f=u(i*c),p=u(o*l),g=u(a*n*d),y=u(s*h),m=u((i+o)*(c+l)-f-p),v=y-g,b=y+g,_=u(p-r*f),S=u(m*v),A=u(b*_),k=u(m*_),I=u(v*b);return new E(S,A,I,k)}subtract(e){return this.add(e.negate())}wNAF(e){return A.wNAFCached(this,b,e,E.normalizeZ)}multiply(e){const{p:t,f:r}=this.wNAF(m(e,n));return E.normalizeZ([t,r])[0]}multiplyUnsafe(e){let t=v(e);return t===Fh?S:this.equals(S)||t===jh?this:this.equals(_)?this.wNAF(t).p:A.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return A.unsafeLadder(this,n).is0()}toAffine(e){const{ex:t,ey:n,ez:i}=this,o=this.is0();null==e&&(e=o?qh:r.inv(i));const s=u(t*e),a=u(n*e),c=u(i*e);if(o)return{x:Fh,y:jh};if(c!==jh)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:e}=t;return e===jh?this:this.multiplyUnsafe(e)}static fromHex(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{d:i,a:o}=t,s=r.BYTES,a=(e=mh("pointHex",e,s)).slice(),c=e[s-1];a[s-1]=-129&c;const d=ph(a);d===Fh||m(d,n?l:r.ORDER);const f=u(d*d),p=u(f-jh),g=u(i*f-o);let{isValid:y,value:v}=h(p,g);if(!y)throw new Error("Point.fromHex: invalid y coordinate");const b=(v&jh)===jh,w=0!==(128&c);if(!n&&v===Fh&&w)throw new Error("Point.fromHex: x=0 and x_0=1");return w!==b&&(v=u(-v)),E.fromAffine({x:v,y:d})}static fromPrivateKey(e){return C(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=yh(t,r.BYTES);return n[n.length-1]|=e&jh?128:0,n}toHex(){return lh(this.toRawBytes())}}E.BASE=new E(t.Gx,t.Gy,jh,u(t.Gx*t.Gy)),E.ZERO=new E(Fh,jh,jh,Fh);const{BASE:_,ZERO:S}=E,A=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>Bh;)r&Mh&&(n=n.add(i)),i=i.double(),r>>=Mh;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let s=e,a=s;for(let n=0;n<r;n++){a=s,o.push(a);for(let e=1;e<i;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(t,i,o){const{windows:s,windowSize:a}=n(t);let c=e.ZERO,l=e.BASE;const u=BigInt(2**t-1),h=2**t,d=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let n=Number(o&u);o>>=d,n>a&&(n-=h,o+=Mh);const s=t,f=t+Math.abs(n)-1,p=e%2!==0,g=n<0;0===n?l=l.add(r(p,i[s])):c=c.add(r(g,i[f]))}return{p:c,f:l}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}(E,8*a);function k(e){return Rh(e,n)}function I(e){return k(ph(e))}function C(e){const t=a;e=mh("private key",e,t);const r=mh("hashed private key",o(e),2*t),n=d(r.slice(0,t)),i=r.slice(t,2*t),s=I(n),c=_.multiply(s),l=c.toRawBytes();return{head:n,prefix:i,scalar:s,point:c,pointBytes:l}}function R(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const s=vh(...r);return I(o(f(s,mh("context",e),!!i)))}const T=Kh;_._setWindowSize(8);const x={getExtendedPublicKey:C,randomPrivateKey:()=>s(r.BYTES),precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}};return{CURVE:t,getPublicKey:function(e){return C(e).pointBytes},sign:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e=mh("message",e),i&&(e=i(e));const{prefix:o,scalar:s,pointBytes:c}=C(t),l=R(n.context,o,e),u=_.multiply(l).toRawBytes(),h=k(l+R(n.context,u,c,e)*s);return v(h),mh("result",vh(u,yh(h,r.BYTES)),2*a)},verify:function(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:T;const{context:s,zip215:a}=o,c=r.BYTES;e=mh("signature",e,2*c),t=mh("message",t),i&&(t=i(t));const l=ph(e.slice(c,2*c));let u,h,d;try{u=E.fromHex(n,a),h=E.fromHex(e.slice(0,c),a),d=_.multiplyUnsafe(l)}catch(p){return!1}if(!a&&u.isSmallOrder())return!1;const f=R(s,h.toRawBytes(),u.toRawBytes(),t);return h.add(u.multiplyUnsafe(f)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:x}}const Hh=BigInt(0),Wh=BigInt(1);function Gh(e){const t=(wh(r=e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...r}));var r;const{P:n}=t,i=e=>Rh(e,n),o=t.montgomeryBits,s=Math.ceil(o/8),a=t.nByteLength,c=t.adjustScalarBytes||(e=>e),l=t.powPminus2||(e=>Th(e,n-BigInt(2),n));function u(e,t,r){const n=i(e*(t-r));return[t=i(t-n),r=i(r+n)]}function h(e){if("bigint"===typeof e&&Hh<=e&&e<n)return e;throw new Error("Expected valid scalar 0 < scalar < CURVE.P")}const d=(t.a-BigInt(2))/BigInt(4);function f(e){return yh(i(e),s)}function p(e,t){const r=function(e){const t=mh("u coordinate",e,s);return 32===a&&(t[31]&=127),ph(t)}(t),n=function(e){const t=mh("scalar",e),r=t.length;if(r!==s&&r!==a)throw new Error("Expected ".concat(s," or ").concat(a," bytes, got ").concat(r));return ph(c(t))}(e),p=function(e,t){const r=h(e),n=h(t),s=r;let a,c=Wh,f=Hh,p=r,g=Wh,y=Hh;for(let l=BigInt(o-1);l>=Hh;l--){const e=n>>l&Wh;y^=e,a=u(y,c,p),c=a[0],p=a[1],a=u(y,f,g),f=a[0],g=a[1],y=e;const t=c+f,r=i(t*t),o=c-f,h=i(o*o),m=r-h,v=p+g,b=i((p-g)*t),w=i(v*o),E=b+w,_=b-w;p=i(E*E),g=i(s*i(_*_)),c=i(r*h),f=i(m*(r+i(d*m)))}a=u(y,c,p),c=a[0],p=a[1],a=u(y,f,g),f=a[0],g=a[1];const m=l(f);return i(c*m)}(r,n);if(p===Hh)throw new Error("Invalid private or public key received");return f(p)}const g=f(t.Gu);function y(e){return p(e,g)}return{scalarMult:p,scalarMultBase:y,getSharedSecret:(e,t)=>p(e,t),getPublicKey:e=>y(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:g}}const Yh=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Qh=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Xh=(BigInt(0),BigInt(1)),Jh=BigInt(2),$h=BigInt(5),Zh=BigInt(10),ed=BigInt(20),td=BigInt(40),rd=BigInt(80);function nd(e){const t=Yh,r=e*e%t*e%t,n=xh(r,Jh,t)*r%t,i=xh(n,Xh,t)*e%t,o=xh(i,$h,t)*i%t,s=xh(o,Zh,t)*o%t,a=xh(s,ed,t)*s%t,c=xh(a,td,t)*a%t,l=xh(c,rd,t)*c%t,u=xh(l,rd,t)*c%t,h=xh(u,Zh,t)*o%t;return{pow_p_5_8:xh(h,Jh,t)*e%t,b2:r}}function id(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function od(e,t){const r=Yh,n=Rh(t*t*t,r),i=Rh(n*n*t,r);let o=Rh(e*n*nd(e*i).pow_p_5_8,r);const s=Rh(t*o*o,r),a=o,c=Rh(o*Qh,r),l=s===e,u=s===Rh(-e,r),h=s===Rh(-e*Qh,r);return l&&(o=a),(u||h)&&(o=c),Nh(o,r)&&(o=Rh(-o,r)),{isValid:l||u,value:o}}const sd=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e<=Eh)throw new Error("Expected Field ORDER > 0, got ".concat(e));const{nBitLength:i,nByteLength:o}=Lh(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Dh(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:(c=i,(oh<<BigInt(c-1))-ih),ZERO:Eh,ONE:_h,create:t=>Rh(t,e),isValid:t=>{if("bigint"!==typeof t)throw new Error("Invalid field element: expected bigint, got ".concat(typeof t));return Eh<=t&&t<e},is0:e=>e===Eh,isOdd:e=>(e&_h)===_h,neg:t=>Rh(-t,e),eql:(e,t)=>e===t,sqr:t=>Rh(t*t,e),add:(t,r)=>Rh(t+r,e),sub:(t,r)=>Rh(t-r,e),mul:(t,r)=>Rh(t*r,e),pow:(e,t)=>function(e,t,r){if(r<Eh)throw new Error("Expected power > 0");if(r===Eh)return e.ONE;if(r===_h)return t;let n=e.ONE,i=t;for(;r>Eh;)r&_h&&(n=e.mul(n,i)),i=e.sqr(i),r>>=_h;return n}(a,e,t),div:(t,r)=>Rh(t*Ph(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Ph(t,e),sqrt:n.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?yh(e,o):gh(e,o),fromBytes:e=>{if(e.length!==o)throw new Error("Fp.fromBytes: expected ".concat(o,", got ").concat(e.length));return r?ph(e):function(e){return uh(lh(e))}(e)}});var c;return Object.freeze(a)}(Yh,void 0,!0),ad={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:sd,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:nh,randomBytes:Hu,adjustScalarBytes:id,uvRatio:od};function cd(e,t,r){if(t.length>255)throw new Error("Context is too big");return function(){let e=0;for(let r=0;r<arguments.length;r++){const t=r<0||arguments.length<=r?void 0:arguments[r];Ou(t),e+=t.length}const t=new Uint8Array(e);for(let r=0,n=0;r<arguments.length;r++){const e=r<0||arguments.length<=r?void 0:arguments[r];t.set(e,n),n+=e.length}return t}(zu("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}const ld=(()=>Gh({P:Yh,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=Yh,{pow_p_5_8:r,b2:n}=nd(e);return Rh(xh(r,BigInt(3),t)*n,t)},adjustScalarBytes:id,randomBytes:Hu}))();const ud=(sd.ORDER+BigInt(3))/BigInt(8);sd.pow(Jh,ud),sd.sqrt(sd.neg(sd.ONE)),sd.ORDER,BigInt(5),BigInt(8),BigInt(486662);!function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);e.isOdd(r)&&e.neg(r)}(sd,sd.neg(BigInt(486664)));BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class hd extends Ku{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Lu(e);const r=qu(t);if(this.iHash=e.create(),"function"!==typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Bu(this),this.iHash.update(e),this}digestInto(e){Bu(this),Ou(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const dd=(e,t,r)=>new hd(e,t).update(r).digest();function fd(e,t,r){return Lu(e),void 0===r&&(r=new Uint8Array(e.outputLen)),dd(e,qu(r),qu(t))}dd.create=(e,t)=>new hd(e,t);const pd=new Uint8Array([0]),gd=new Uint8Array;function yd(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32;if(Lu(e),Nu(n),n>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(n/e.outputLen);void 0===r&&(r=gd);const o=new Uint8Array(i*e.outputLen),s=dd.create(e,t),a=s._cloneInto(),c=new Uint8Array(s.outputLen);for(let l=0;l<i;l++)pd[0]=l+1,a.update(0===l?gd:c).update(r).update(pd).digestInto(c),o.set(c,e.outputLen*l),s._cloneInto(a);return s.destroy(),a.destroy(),c.fill(0),pd.fill(0),o.slice(0,n)}const md=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]),vd=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),bd=new Uint32Array(64);class wd extends Gu{constructor(){super(64,32,8,!1),this.A=0|vd[0],this.B=0|vd[1],this.C=0|vd[2],this.D=0|vd[3],this.E=0|vd[4],this.F=0|vd[5],this.G=0|vd[6],this.H=0|vd[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let h=0;h<16;h++,t+=4)bd[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const e=bd[h-15],t=bd[h-2],r=ju(e,7)^ju(e,18)^e>>>3,n=ju(t,17)^ju(t,19)^t>>>10;bd[h]=n+bd[h-7]+r+bd[h-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let h=0;h<64;h++){const e=l+(ju(s,6)^ju(s,11)^ju(s,25))+((u=s)&a^~u&c)+md[h]+bd[h]|0,t=(ju(r,2)^ju(r,13)^ju(r,22))+Wu(r,n,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+t|0}var u;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,o,s,a,c,l)}roundClean(){bd.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Ed=Vu((()=>new wd)),_d={hashSHA256:e=>Ed(e),getHKDF(e,t){const r=fd(Ed,t,e),n=yd(Ed,r,void 0,96);return[n.subarray(0,32),n.subarray(32,64),n.subarray(64,96)]},generateX25519KeyPair(){const e=ld.utils.randomPrivateKey();return{publicKey:ld.getPublicKey(e),privateKey:e}},generateX25519KeyPairFromSeed:e=>({publicKey:ld.getPublicKey(e),privateKey:e}),generateX25519SharedKey:(e,t)=>ld.getSharedSecret(e,t),chaCha20Poly1305Encrypt:(e,t,r,n)=>Du(n,t,r).encrypt(e),chaCha20Poly1305Decrypt(e,t,r,n,i){const o=Du(n,t,r).decrypt(e);return i?(i.set(o),o):o}};function Sd(e,t){null==t&&(t=e.reduce(((e,t)=>e+t.length),0));const r=ml(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return Ga(r)}const Ad=e=>{const t=(r=2,globalThis.Buffer?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r));var r;return new DataView(t.buffer,t.byteOffset,t.byteLength).setUint16(0,e,!1),t};Ad.bytes=2;const kd=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,!1):e.getUint16(0)};kd.bytes=2;class Id extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected Peer"),Ze(this,"code",void 0),this.code=Id.code}}Ze(Id,"code","ERR_UNEXPECTED_PEER");class Cd extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto exchange"),Ze(this,"code",void 0),this.code=Cd.code}}Ze(Cd,"code","ERR_INVALID_CRYPTO_EXCHANGE");class Rd extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto transmission"),Ze(this,"code",void 0),this.code=Rd.code}}Ze(Rd,"code","ERR_INVALID_CRYPTO_TRANSMISSION");__webpack_require__(5120),__webpack_require__(8144);class Td extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The operation was aborted"),Ze(this,"code",void 0),Ze(this,"type",void 0),this.code=Td.code,this.type=Td.type}}Ze(Td,"code","ABORT_ERR"),Ze(Td,"type","aborted");class xd extends Error{constructor(e,t,r){var n;super(e),Ze(this,"code",void 0),Ze(this,"props",void 0),this.code=t,this.name=null!==(n=null===r||void 0===r?void 0:r.name)&&void 0!==n?n:"CodeError",this.props=null!==r&&void 0!==r?r:{}}}var Pd=__webpack_require__(1102);var Dd=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const Nd=Dd,Od=(new Uint8Array(0),e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class Ld{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class Bd{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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Ud(this,e)}}class Md{constructor(e){this.decoders=e}or(e){return Ud(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const Ud=(e,t)=>new Md({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Fd{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ld(e,t,r),this.decoder=new Bd(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const jd=e=>{let{name:t,prefix:r,encode:n,decode:i}=e;return new Fd(t,r,n,i)},zd=e=>{let{prefix:t,name:r,alphabet:n}=e;const{encode:i,decode:o}=Nd(n,r);return jd({prefix:t,name:r,encode:i,decode:e=>Od(o(e))})},qd=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return jd({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,n,t)})},Kd=zd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Vd=zd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Hd=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=Yd;)r[n++]=255&t|Wd,t/=128;for(;t&Gd;)r[n++]=255&t|Wd,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},Wd=128,Gd=-128,Yd=Math.pow(2,31);var Qd=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&Jd)<<o:(n&Jd)*Math.pow(2,o),o+=7}while(n>=Xd);return e.bytes=s-r,i},Xd=128,Jd=127;var $d=Math.pow(2,7),Zd=Math.pow(2,14),ef=Math.pow(2,21),tf=Math.pow(2,28),rf=Math.pow(2,35),nf=Math.pow(2,42),of=Math.pow(2,49),sf=Math.pow(2,56),af=Math.pow(2,63);const cf={encode:Hd,decode:Qd,encodingLength:function(e){return e<$d?1:e<Zd?2:e<ef?3:e<tf?4:e<rf?5:e<nf?6:e<of?7:e<sf?8:e<af?9:10}},lf=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return[cf.decode(e,t),cf.decode.bytes]},uf=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return cf.encode(e,t,r),t},hf=e=>cf.encodingLength(e),df=(e,t)=>{const r=t.byteLength,n=hf(e),i=n+hf(r),o=new Uint8Array(i+r);return uf(e,o,0),uf(r,o,n),o.set(t,i),new pf(e,r,t,o)},ff=e=>{const t=Od(e),[r,n]=lf(t),[i,o]=lf(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new pf(r,i,s,t)};class pf{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const gf=Od,yf={code:0,name:"identity",encode:gf,digest:e=>df(0,gf(e))},mf=e=>{let{name:t,code:r,encode:n}=e;return new vf(t,r,n)};class vf{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?df(this.code,t):t.then((e=>df(this.code,e)))}throw Error("Unknown type, must be binary type")}}const bf=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),wf=mf({name:"sha2-256",code:18,encode:bf("SHA-256")}),Ef=mf({name:"sha2-512",code:19,encode:bf("SHA-512")});function _f(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}var Sf=__webpack_require__(9122),Af=__webpack_require__.t(Sf,2);const kf=BigInt(0),If=BigInt(1),Cf=BigInt(2),Rf=BigInt(8),Tf=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),xf=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:Tf,n:Tf,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),Pf=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),Df=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Nf=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),Of=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Lf=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Bf=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class Mf{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof Vf))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(Vf.ZERO)?Mf.ZERO:new Mf(e.x,e.y,If,rp(e.x*e.y))}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xf.P;const r=new Array(e.length),n=np(e.reduce(((e,n,i)=>n===kf?e:(r[i]=e,rp(e*n,t))),If),t);return e.reduceRight(((e,n,i)=>n===kf?e:(r[i]=rp(e*r[i],t),rp(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){Ff(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,a=rp(t*s),c=rp(i*n),l=rp(r*s),u=rp(o*n);return a===c&&l===u}negate(){return new Mf(rp(-this.x),this.y,this.z,rp(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=xf,i=rp(e*e),o=rp(t*t),s=rp(Cf*rp(r*r)),a=rp(n*i),c=e+t,l=rp(rp(c*c)-i-o),u=a+o,h=u-s,d=a-o,f=rp(l*h),p=rp(u*d),g=rp(l*d),y=rp(h*u);return new Mf(f,p,y,g)}add(e){Ff(e);const{x:t,y:r,z:n,t:i}=this,{x:o,y:s,z:a,t:c}=e,l=rp((r-t)*(s+o)),u=rp((r+t)*(s-o)),h=rp(u-l);if(h===kf)return this.double();const d=rp(n*Cf*c),f=rp(i*Cf*a),p=f+d,g=u+l,y=f-d,m=rp(p*h),v=rp(g*y),b=rp(p*y),w=rp(h*g);return new Mf(m,v,w,b)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(Mf.BASE)&&(t=Vf.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 n=t&&Kf.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=Mf.normalizeZ(n),Kf.set(t,n)));let i=Mf.ZERO,o=Mf.BASE;const s=1+256/r,a=2**(r-1),c=BigInt(2**r-1),l=2**r,u=BigInt(r);for(let h=0;h<s;h++){const t=h*a;let r=Number(e&c);e>>=u,r>a&&(r-=l,e+=If);const s=t,d=t+Math.abs(r)-1,f=h%2!==0,p=r<0;0===r?o=o.add(Uf(f,n[s])):i=i.add(Uf(p,n[d]))}return Mf.normalizeZ([i,o])[0]}multiply(e,t){return this.wNAF(up(e,xf.l),t)}multiplyUnsafe(e){let t=up(e,xf.l,!1);const r=Mf.BASE,n=Mf.ZERO;if(t===kf)return n;if(this.equals(n)||t===If)return this;if(this.equals(r))return this.wNAF(t);let i=n,o=this;for(;t>kf;)t&If&&(i=i.add(o)),o=o.double(),t>>=If;return i}isSmallOrder(){return this.multiplyUnsafe(xf.h).equals(Mf.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(xf.l/Cf).double();return xf.l%Cf&&(e=e.add(this)),e.equals(Mf.ZERO)}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(Mf.ZERO);null==e&&(e=i?Rf:np(n));const o=rp(t*e),s=rp(r*e),a=rp(n*e);if(i)return Vf.ZERO;if(a!==If)throw new Error("invZ was invalid");return new Vf(o,s)}fromRistrettoBytes(){zf()}toRistrettoBytes(){zf()}fromRistrettoHash(){zf()}}function Uf(e,t){const r=t.negate();return e?r:t}function Ff(e){if(!(e instanceof Mf))throw new TypeError("ExtendedPoint expected")}function jf(e){if(!(e instanceof qf))throw new TypeError("RistrettoPoint expected")}function zf(){throw new Error("Legacy method: switch to RistrettoPoint")}Mf.BASE=new Mf(xf.Gx,xf.Gy,If,rp(xf.Gx*xf.Gy)),Mf.ZERO=new Mf(kf,If,If,kf);class qf{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=xf,r=rp(Df*e*e),n=rp((r+If)*Lf);let i=BigInt(-1);const o=rp((i-t*r)*rp(r+t));let{isValid:s,value:a}=sp(n,o),c=rp(a*e);$f(c)||(c=rp(-c)),s||(a=c),s||(i=r);const l=rp(i*(r-If)*Bf-o),u=a*a,h=rp((a+a)*o),d=rp(l*Nf),f=rp(If-u),p=rp(If+u);return new Mf(rp(h*p),rp(f*d),rp(d*p),rp(h*f))}static hashToCurve(e){const t=tp((e=lp(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=tp(e.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new qf(r.add(i))}static fromHex(e){e=lp(e,32);const{a:t,d:r}=xf,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=tp(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(Jf(i),e)||$f(i))throw new Error(n);const o=rp(i*i),s=rp(If+t*o),a=rp(If-t*o),c=rp(s*s),l=rp(a*a),u=rp(t*r*c-l),{isValid:h,value:d}=ap(rp(u*l)),f=rp(d*a),p=rp(d*f*u);let g=rp((i+i)*f);$f(g)&&(g=rp(-g));const y=rp(s*p),m=rp(g*y);if(!h||$f(m)||y===kf)throw new Error(n);return new qf(new Mf(g,y,If,m))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=rp(rp(r+t)*rp(r-t)),o=rp(e*t),s=rp(o*o),{value:a}=ap(rp(i*s)),c=rp(a*i),l=rp(a*o),u=rp(c*l*n);let h;if($f(n*u)){let r=rp(t*Df),n=rp(e*Df);e=r,t=n,h=rp(c*Of)}else h=l;$f(e*u)&&(t=rp(-t));let d=rp((r-t)*h);return $f(d)&&(d=rp(-d)),Jf(d)}toHex(){return Yf(this.toRawBytes())}toString(){return this.toHex()}equals(e){jf(e);const t=this.ep,r=e.ep,n=rp(t.x*r.y)===rp(t.y*r.x),i=rp(t.y*r.y)===rp(t.x*r.x);return n||i}add(e){return jf(e),new qf(this.ep.add(e.ep))}subtract(e){return jf(e),new qf(this.ep.subtract(e.ep))}multiply(e){return new qf(this.ep.multiply(e))}multiplyUnsafe(e){return new qf(this.ep.multiplyUnsafe(e))}}qf.BASE=new qf(Mf.BASE),qf.ZERO=new qf(Mf.ZERO);const Kf=new WeakMap;class Vf{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,Kf.delete(this)}static fromHex(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{d:r,P:n}=xf,i=(e=lp(e,32)).slice();i[31]=-129&e[31];const o=Zf(i);if(t&&o>=n)throw new Error("Expected 0 < hex < P");if(!t&&o>=Pf)throw new Error("Expected 0 < hex < 2**256");const s=rp(o*o),a=rp(s-If),c=rp(r*s+If);let{isValid:l,value:u}=sp(a,c);if(!l)throw new Error("Point.fromHex: invalid y coordinate");const h=(u&If)===If;return 0!==(128&e[31])!==h&&(u=rp(-u)),new Vf(u,o)}static async fromPrivateKey(e){return(await gp(e)).point}toRawBytes(){const e=Jf(this.y);return e[31]|=this.x&If?128:0,e}toHex(){return Yf(this.toRawBytes())}toX25519(){const{y:e}=this;return Jf(rp((If+e)*np(If-e)))}isTorsionFree(){return Mf.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new Vf(rp(-this.x),this.y)}add(e){return Mf.fromAffine(this).add(Mf.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Mf.fromAffine(this).multiply(e,this).toAffine()}}Vf.BASE=new Vf(xf.Gx,xf.Gy),Vf.ZERO=new Vf(kf,If);class Hf{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=lp(e,64),r=Vf.fromHex(t.slice(0,32),!1),n=Zf(t.slice(32,64));return new Hf(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof Vf))throw new Error("Expected Point instance");return up(t,xf.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(Jf(this.s),32),e}toHex(){return Yf(this.toRawBytes())}}function Wf(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}const Gf=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Yf(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Gf[e[r]];return t}function Qf(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function Xf(e){return Qf(e.toString(16).padStart(64,"0"))}function Jf(e){return Xf(e).reverse()}function $f(e){return(rp(e)&If)===If}function Zf(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+Yf(Uint8Array.from(e).reverse()))}const ep=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function tp(e){return rp(Zf(e)&ep)}function rp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xf.P;const r=e%t;return r>=kf?r:t+r}function np(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xf.P;if(e===kf||t<=kf)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=rp(e,t),n=t,i=kf,o=If,s=If,a=kf;for(;r!==kf;){const e=n/r,t=n%r,c=i-s*e,l=o-a*e;n=r,r=t,i=s,o=a,s=c,a=l}if(n!==If)throw new Error("invert: does not exist");return rp(i,t)}function ip(e,t){const{P:r}=xf;let n=e;for(;t-- >kf;)n*=n,n%=r;return n}function op(e){const{P:t}=xf,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),s=BigInt(80),a=e*e%t*e%t,c=ip(a,Cf)*a%t,l=ip(c,If)*e%t,u=ip(l,r)*l%t,h=ip(u,n)*u%t,d=ip(h,i)*h%t,f=ip(d,o)*d%t,p=ip(f,s)*f%t,g=ip(p,s)*f%t,y=ip(g,n)*u%t;return{pow_p_5_8:ip(y,Cf)*e%t,b2:a}}function sp(e,t){const r=rp(t*t*t),n=rp(r*r*t);let i=rp(e*r*op(e*n).pow_p_5_8);const o=rp(t*i*i),s=i,a=rp(i*Df),c=o===e,l=o===rp(-e),u=o===rp(-e*Df);return c&&(i=s),(l||u)&&(i=a),$f(i)&&(i=rp(-i)),{isValid:c||l,value:i}}function ap(e){return sp(If,e)}function cp(e){return rp(Zf(e),xf.l)}function lp(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):Qf(e);if("number"===typeof t&&r.length!==t)throw new Error("Expected ".concat(t," bytes"));return r}function up(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)throw new TypeError("Specify max value");if("number"===typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"===typeof e&&e<t)if(r){if(kf<e)return e}else if(kf<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function hp(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function dp(e){if(32!==(e="bigint"===typeof e||"number"===typeof e?Xf(up(e,Pf)):lp(e)).length)throw new Error("Expected 32 bytes");return e}function fp(e){const t=hp(e.slice(0,32)),r=e.slice(32,64),n=cp(t),i=Vf.BASE.multiply(n),o=i.toRawBytes();return{head:t,prefix:r,scalar:n,point:i,pointBytes:o}}let pp;async function gp(e){return fp(await wp.sha512(dp(e)))}async function yp(e){return(await gp(e)).pointBytes}function mp(e,t,r){t=lp(t),r instanceof Vf||(r=Vf.fromHex(r,!1));const{r:n,s:i}=e instanceof Hf?e.assertValidity():Hf.fromHex(e);return{r:n,s:i,SB:Mf.BASE.multiplyUnsafe(i),pub:r,msg:t}}function vp(e,t,r,n){const i=cp(n),o=Mf.fromAffine(e).multiplyUnsafe(i);return Mf.fromAffine(t).add(o).subtract(r).multiplyUnsafe(xf.h).equals(Mf.ZERO)}Vf.BASE._setWindowSize(8);const bp={node:Af,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},wp={bytesToHex:Yf,hexToBytes:Qf,concatBytes:Wf,getExtendedPublicKey:gp,mod:rp,invert:np,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:e=>{if((e=lp(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return rp(Zf(e),xf.l-If)+If},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(bp.web)return bp.web.getRandomValues(new Uint8Array(e));if(bp.node){const{randomBytes:t}=bp.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>wp.randomBytes(32),sha512:async function(){const e=Wf(...arguments);if(bp.web){const t=await bp.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(bp.node)return Uint8Array.from(bp.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vf.BASE;const r=t.equals(Vf.BASE)?t:new Vf(t.x,t.y);return r._setWindowSize(e),r.multiply(Cf),r},sha512Sync:void 0};Object.defineProperties(wp,{sha512Sync:{configurable:!1,get:()=>pp,set(e){pp||(pp=e)}}});const Ep=32,_p=64,Sp=32;async function Ap(e,t){return async function(e,t){e=lp(e);const{prefix:r,scalar:n,pointBytes:i}=await gp(t),o=cp(await wp.sha512(r,e)),s=Vf.BASE.multiply(o),a=rp(o+cp(await wp.sha512(s.toRawBytes(),i,e))*n,xf.l);return new Hf(s,a).toRawBytes()}(t,e.subarray(0,Sp))}async function kp(e,t,r){return async function(e,t,r){const{r:n,SB:i,msg:o,pub:s}=mp(e,t,r),a=await wp.sha512(n.toRawBytes(),s.toRawBytes(),o);return vp(s,n,i,a)}(t,r,e)}function Ip(e,t){const r=new Uint8Array(_p);for(let n=0;n<Sp;n++)r[n]=e[n],r[Sp+n]=t[n];return r}const Cp=qd({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Rp=qd({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Tp=qd({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xp=qd({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Pp={get(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:globalThis).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}},Dp={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Np(e){var t,r,n,i,o,s;const a=null!==(t=null===e||void 0===e?void 0:e.algorithm)&&void 0!==t?t:"AES-GCM";let c=null!==(r=null===e||void 0===e?void 0:e.keyLength)&&void 0!==r?r:16;const l=null!==(n=null===e||void 0===e?void 0:e.nonceLength)&&void 0!==n?n:12,u=null!==(i=null===e||void 0===e?void 0:e.digest)&&void 0!==i?i:"SHA-256",h=null!==(o=null===e||void 0===e?void 0:e.saltLength)&&void 0!==o?o:16,d=null!==(s=null===e||void 0===e?void 0:e.iterations)&&void 0!==s?s:32767,f=Pp.get();c*=8;return{encrypt:async function(e,t){const r=f.getRandomValues(new Uint8Array(h)),n=f.getRandomValues(new Uint8Array(l)),i={name:a,iv:n};let o;if("string"===typeof t&&(t=_l(t)),0===t.length){o=await f.subtle.importKey("jwk",Dp,{name:"AES-GCM"},!0,["encrypt"]);try{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);o=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["encrypt"])}catch{o=await f.subtle.importKey("jwk",Dp,{name:"AES-GCM"},!0,["encrypt"])}}else{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);o=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["encrypt"])}const s=await f.subtle.encrypt(i,o,e);return Sd([r,i.iv,new Uint8Array(s)])},decrypt:async function(e,t){const r=e.subarray(0,h),n=e.subarray(h,h+l),i=e.subarray(h+l),o={name:a,iv:n};let s;if("string"===typeof t&&(t=_l(t)),0===t.length)try{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);s=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["decrypt"])}catch{s=await f.subtle.importKey("jwk",Dp,{name:"AES-GCM"},!0,["decrypt"])}else{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);s=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["decrypt"])}const p=await f.subtle.decrypt(o,s,i);return new Uint8Array(p)}}}async function Op(e,t){const r=Np(),n=await r.encrypt(e,t);return Cp.encode(n)}var Lp,Bp,Mp,Up;!function(e){e.RSA="RSA",e.Ed25519="Ed25519",e.Secp256k1="Secp256k1"}(Lp||(Lp={})),function(e){e[e.RSA=0]="RSA",e[e.Ed25519=1]="Ed25519",e[e.Secp256k1=2]="Secp256k1"}(Bp||(Bp={})),function(e){e.codec=()=>na(Bp)}(Lp||(Lp={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),Lp.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.Type=Lp.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Mp||(Mp={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),Lp.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.Type=Lp.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Up||(Up={}));class Fp{constructor(e){Ze(this,"_key",void 0),this._key=Hp(e,Ep)}async verify(e,t){return kp(this._key,t,e)}marshal(){return this._key}get bytes(){return Mp.encode({Type:Lp.Ed25519,Data:this.marshal()}).subarray()}equals(e){return _f(this.bytes,e.bytes)}async hash(){const{bytes:e}=await wf.digest(this.bytes);return e}}class jp{constructor(e,t){Ze(this,"_key",void 0),Ze(this,"_publicKey",void 0),this._key=Hp(e,_p),this._publicKey=Hp(t,Ep)}async sign(e){return Ap(this._key,e)}get public(){return new Fp(this._publicKey)}marshal(){return this._key}get bytes(){return Up.encode({Type:Lp.Ed25519,Data:this.marshal()}).subarray()}equals(e){return _f(this.bytes,e.bytes)}async hash(){const{bytes:e}=await wf.digest(this.bytes);return e}async id(){const e=yf.digest(this.public.bytes);return Kd.encode(e.bytes).substring(1)}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"libp2p-key";if("libp2p-key"===t)return Op(this.bytes,e);throw new xd("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}function zp(e){if(e.length>_p){const t=(e=Hp(e,_p+Ep)).subarray(0,_p),r=e.subarray(_p,e.length);return new jp(t,r)}const t=(e=Hp(e,_p)).subarray(0,_p),r=e.subarray(Ep);return new jp(t,r)}function qp(e){return e=Hp(e,Ep),new Fp(e)}async function Kp(){const{privateKey:e,publicKey:t}=await async function(){const e=wp.randomPrivateKey(),t=await yp(e);return{privateKey:Ip(e,t),publicKey:t}}();return new jp(e,t)}async function Vp(e){const{privateKey:t,publicKey:r}=await async function(e){if(e.length!==Sp)throw new TypeError('"seed" must be 32 bytes in length.');if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');const t=e,r=await yp(t);return{privateKey:Ip(t,r),publicKey:r}}(e);return new jp(t,r)}function Hp(e,t){var r;if((e=Uint8Array.from(null!==(r=e)&&void 0!==r?r:[])).length!==t)throw new xd("Key must be a Uint8Array of length ".concat(t,", got ").concat(e.length),"ERR_INVALID_KEY_TYPE");return e}var Wp=__webpack_require__(5593);__webpack_require__(6766);function Gp(e,t){let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.subarray(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=Sd([new Uint8Array(t-r.length),r])}return Sl(r,"base64url")}function Yp(e){const t=function(e,t){let r=_l(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=Sd([new Uint8Array(t-r.length),r])}return r}(e);return new Pd.jsbn.BigInteger(Sl(t,"base16"),16)}const Qp={"P-256":256,"P-384":384,"P-521":521};Object.keys(Qp).join(" / ");__webpack_require__(6975);var Xp=__webpack_require__(495),Jp=__webpack_require__.t(Xp,2);const $p=BigInt(0),Zp=BigInt(1),eg=BigInt(2),tg=BigInt(3),rg=BigInt(8),ng=Object.freeze({a:$p,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:Zp,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),ig=(e,t)=>(e+t/eg)/t,og={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(e){const{n:t}=ng,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Zp*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=ig(o*e,t),c=ig(-n*e,t);let l=Og(e-a*r-c*i,t),u=Og(-a*n-c*o,t);const h=l>s,d=u>s;if(h&&(l=t-l),d&&(u=t-u),l>s||u>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:h,k1:l,k2neg:d,k2:u}}},sg=32,ag=32,cg=32,lg=sg+1,ug=2*sg+1;function hg(e){const{a:t,b:r}=ng,n=Og(e*e),i=Og(n*e);return Og(i+t*e+r)}const dg=ng.a===$p;class fg extends Error{constructor(e){super(e)}}function pg(e){if(!(e instanceof gg))throw new TypeError("JacobianPoint expected")}class gg{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof vg))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(vg.ZERO)?gg.ZERO:new gg(e.x,e.y,Zp)}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ng.P;const r=new Array(e.length),n=Bg(e.reduce(((e,n,i)=>n===$p?e:(r[i]=e,Og(e*n,t))),Zp),t);return e.reduceRight(((e,n,i)=>n===$p?e:(r[i]=Og(e*r[i],t),Og(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return gg.toAffineBatch(e).map(gg.fromAffine)}equals(e){pg(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,a=Og(n*n),c=Og(s*s),l=Og(t*c),u=Og(i*a),h=Og(Og(r*s)*c),d=Og(Og(o*n)*a);return l===u&&h===d}negate(){return new gg(this.x,Og(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=Og(e*e),i=Og(t*t),o=Og(i*i),s=e+i,a=Og(eg*(Og(s*s)-n-o)),c=Og(tg*n),l=Og(c*c),u=Og(l-eg*a),h=Og(c*(a-u)-rg*o),d=Og(eg*t*r);return new gg(u,h,d)}add(e){pg(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e;if(i===$p||o===$p)return this;if(t===$p||r===$p)return e;const a=Og(n*n),c=Og(s*s),l=Og(t*c),u=Og(i*a),h=Og(Og(r*s)*c),d=Og(Og(o*n)*a),f=Og(u-l),p=Og(d-h);if(f===$p)return p===$p?this.double():gg.ZERO;const g=Og(f*f),y=Og(f*g),m=Og(l*g),v=Og(p*p-y-eg*m),b=Og(p*(m-v)-h*y),w=Og(n*s*f);return new gg(v,b,w)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=gg.ZERO;if("bigint"===typeof e&&e===$p)return t;let r=Ng(e);if(r===Zp)return this;if(!dg){let e=t,n=this;for(;r>$p;)r&Zp&&(e=e.add(n)),n=n.double(),r>>=Zp;return e}let{k1neg:n,k1:i,k2neg:o,k2:s}=og.splitScalar(r),a=t,c=t,l=this;for(;i>$p||s>$p;)i&Zp&&(a=a.add(l)),s&Zp&&(c=c.add(l)),l=l.double(),i>>=Zp,s>>=Zp;return n&&(a=a.negate()),o&&(c=c.negate()),c=new gg(Og(c.x*og.beta),c.y,c.z),a.add(c)}precomputeWindow(e){const t=dg?128/e+1:256/e+1,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(gg.BASE)&&(t=vg.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 n=t&&mg.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=gg.normalizeZ(n),mg.set(t,n)));let i=gg.ZERO,o=gg.BASE;const s=1+(dg?128/r:256/r),a=2**(r-1),c=BigInt(2**r-1),l=2**r,u=BigInt(r);for(let h=0;h<s;h++){const t=h*a;let r=Number(e&c);e>>=u,r>a&&(r-=l,e+=Zp);const s=t,d=t+Math.abs(r)-1,f=h%2!==0,p=r<0;0===r?o=o.add(yg(f,n[s])):i=i.add(yg(p,n[d]))}return{p:i,f:o}}multiply(e,t){let r,n,i=Ng(e);if(dg){const{k1neg:e,k1:o,k2neg:s,k2:a}=og.splitScalar(i);let{p:c,f:l}=this.wNAF(o,t),{p:u,f:h}=this.wNAF(a,t);c=yg(e,c),u=yg(s,u),u=new gg(Og(u.x*og.beta),u.y,u.z),r=c.add(u),n=l.add(h)}else{const{p:e,f:o}=this.wNAF(i,t);r=e,n=o}return gg.normalizeZ([r,n])[0]}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(gg.ZERO);null==e&&(e=i?rg:Bg(n));const o=e,s=Og(o*o),a=Og(s*o),c=Og(t*s),l=Og(r*a),u=Og(n*o);if(i)return vg.ZERO;if(u!==Zp)throw new Error("invZ was invalid");return new vg(c,l)}}function yg(e,t){const r=t.negate();return e?r:t}gg.BASE=new gg(ng.Gx,ng.Gy,Zp),gg.ZERO=new gg($p,Zp,$p);const mg=new WeakMap;class vg{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,mg.delete(this)}hasEvenY(){return this.y%eg===$p}static fromCompressedHex(e){const t=32===e.length,r=Pg(t?e:e.subarray(1));if(!qg(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=ng,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),c=e*e*e%t,l=c*c*e%t,u=Lg(l,tg)*l%t,h=Lg(u,tg)*l%t,d=Lg(h,eg)*c%t,f=Lg(d,n)*d%t,p=Lg(f,i)*f%t,g=Lg(p,s)*p%t,y=Lg(g,a)*g%t,m=Lg(y,s)*p%t,v=Lg(m,tg)*l%t,b=Lg(v,o)*f%t,w=Lg(b,r)*c%t,E=Lg(w,eg);if(E*E%t!==e)throw new Error("Cannot find square root");return E}(hg(r));const i=(n&Zp)===Zp;if(t)i&&(n=Og(-n));else{1===(1&e[0])!==i&&(n=Og(-n))}const o=new vg(r,n);return o.assertValidity(),o}static fromUncompressedHex(e){const t=Pg(e.subarray(1,sg+1)),r=Pg(e.subarray(sg+1,2*sg+1)),n=new vg(t,r);return n.assertValidity(),n}static fromHex(e){const t=Dg(e),r=t.length,n=t[0];if(r===sg)return this.fromCompressedHex(t);if(r===lg&&(2===n||3===n))return this.fromCompressedHex(t);if(r===ug&&4===n)return this.fromUncompressedHex(t);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(lg," compressed bytes or ").concat(ug," uncompressed bytes, not ").concat(r))}static fromPrivateKey(e){return vg.BASE.multiply(Vg(e))}static fromSignature(e,t,r){const{r:n,s:i}=Wg(t);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const o=Mg(Dg(e)),{n:s}=ng,a=2===r||3===r?n+s:n,c=Bg(a,s),l=Og(-o*c,s),u=Og(i*c,s),h=1&r?"03":"02",d=vg.fromHex(h+Ig(a)),f=vg.BASE.multiplyAndAddUnsafe(d,l,u);if(!f)throw new Error("Cannot recover signature: point at infinify");return f.assertValidity(),f}toRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return xg(this.toHex(e))}toHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=Ig(this.x);if(e){const e=this.hasEvenY()?"02":"03";return"".concat(e).concat(t)}return"04".concat(t).concat(Ig(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(!qg(t)||!qg(r))throw new Error(e);const n=Og(r*r);if(Og(n-hg(t))!==$p)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new vg(this.x,Og(-this.y))}double(){return gg.fromAffine(this).double().toAffine()}add(e){return gg.fromAffine(this).add(gg.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return gg.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const n=gg.fromAffine(this),i=t===$p||t===Zp||this!==vg.BASE?n.multiplyUnsafe(t):n.multiply(t),o=gg.fromAffine(e).multiplyUnsafe(r),s=i.add(o);return s.equals(gg.ZERO)?void 0:s.toAffine()}}function bg(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function wg(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(Ag(e)));const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Pg(r),left:e.subarray(t+2)}}vg.BASE=new vg(ng.Gx,ng.Gy),vg.ZERO=new vg($p,$p);class Eg{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("".concat(r,": Expected string or Uint8Array"));const n=t?Ag(e):e;if(128!==n.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new Eg(Tg(n.slice(0,64)),Tg(n.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:r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error("Invalid signature tag: ".concat(Ag(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=wg(e.subarray(2)),{data:n,left:i}=wg(r);if(i.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(Ag(i)));return{r:t,s:n}}(t?e:xg(e));return new Eg(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!zg(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!zg(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=ng.n>>Zp;return this.s>e}normalizeS(){return this.hasHighS()?new Eg(this.r,Og(-this.s,ng.n)):this}toDERRawBytes(){return xg(this.toDERHex())}toDERHex(){const e=bg(Rg(this.s)),t=bg(Rg(this.r)),r=e.length/2,n=t.length/2,i=Rg(r),o=Rg(n),s=Rg(n+r+4);return"30".concat(s,"02").concat(o).concat(t,"02").concat(i).concat(e)}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return xg(this.toCompactHex())}toCompactHex(){return Ig(this.r)+Ig(this.s)}}function _g(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}const Sg=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Ag(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r<e.length;r++)t+=Sg[e[r]];return t}const kg=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function Ig(e){if("bigint"!==typeof e)throw new Error("Expected bigint");if(!($p<=e&&e<kg))throw new Error("Expected number 0 <= n < 2^256");return e.toString(16).padStart(64,"0")}function Cg(e){const t=xg(Ig(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function Rg(e){const t=e.toString(16);return 1&t.length?"0".concat(t):t}function Tg(e){if("string"!==typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt("0x".concat(e))}function xg(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function Pg(e){return Tg(Ag(e))}function Dg(e){return e instanceof Uint8Array?Uint8Array.from(e):xg(e)}function Ng(e){if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"===typeof e&&zg(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Og(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ng.P;const r=e%t;return r>=$p?r:t+r}function Lg(e,t){const{P:r}=ng;let n=e;for(;t-- >$p;)n*=n,n%=r;return n}function Bg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ng.P;if(e===$p||t<=$p)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=Og(e,t),n=t,i=$p,o=Zp,s=Zp,a=$p;for(;r!==$p;){const e=n/r,t=n%r,c=i-s*e,l=o-a*e;n=r,r=t,i=s,o=a,s=c,a=l}if(n!==Zp)throw new Error("invert: does not exist");return Og(i,t)}function Mg(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=function(e){const t=8*e.length-8*ag,r=Pg(e);return t>0?r>>BigInt(t):r}(e);if(t)return r;const{n:n}=ng;return r>=n?r-n:r}let Ug,Fg;class jg{constructor(e,t){if(this.hashLen=e,this.qByteLen=t,"number"!==typeof e||e<2)throw new Error("hashLen must be a number");if("number"!==typeof t||t<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}hmac(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return iy.hmacSha256(this.k,...t)}hmacSync(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Fg(this.k,...t)}checkSync(){if("function"!==typeof Fg)throw new fg("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}async reseed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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))}async generate(){this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=await this.hmac(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return _g(...t)}generateSync(){this.checkSync(),this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=this.hmacSync(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return _g(...t)}}function zg(e){return $p<e&&e<ng.n}function qg(e){return $p<e&&e<ng.P}function Kg(e,t,r){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const{n:i}=ng,o=Mg(e,!0);if(!zg(o))return;const s=Bg(o,i),a=vg.BASE.multiply(o),c=Og(a.x,i);if(c===$p)return;const l=Og(s*Og(t+r*c,i),i);if(l===$p)return;let u=new Eg(c,l),h=(a.x===u.r?0:2)|Number(a.y&Zp);return n&&u.hasHighS()&&(u=u.normalizeS(),h^=1),{sig:u,recovery:h}}function Vg(e){let t;if("bigint"===typeof e)t=e;else if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"===typeof e){if(e.length!==2*ag)throw new Error("Expected 32 bytes of private key");t=Tg(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(e.length!==ag)throw new Error("Expected 32 bytes of private key");t=Pg(e)}if(!zg(t))throw new Error("Expected private key: 0 < key < n");return t}function Hg(e){return e instanceof vg?(e.assertValidity(),e):vg.fromHex(e)}function Wg(e){if(e instanceof Eg)return e.assertValidity(),e;try{return Eg.fromDER(e)}catch(t){return Eg.fromCompact(e)}}function Gg(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return vg.fromPrivateKey(e).toRawBytes(t)}function Yg(e){return Pg(e.length>sg?e.slice(0,sg):e)}function Qg(e){const t=Yg(e),r=Og(t,ng.n);return Xg(r<$p?t:r)}function Xg(e){return Cg(e)}function Jg(e,t,r){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));const n=Dg(e),i=Vg(t),o=[Xg(i),Qg(n)];if(null!=r){!0===r&&(r=iy.randomBytes(sg));const e=Dg(r);if(e.length!==sg)throw new Error("sign: Expected ".concat(sg," bytes of extra data"));o.push(e)}return{seed:_g(...o),m:Yg(n),d:i}}function $g(e,t){const{sig:r,recovery:n}=e,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},t),s=i?r.toDERRawBytes():r.toCompactRawBytes();return o?[s,n]:s}async function Zg(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:o}=Jg(e,t,r.extraEntropy),s=new jg(cg,ag);let a;for(await s.reseed(n);!(a=Kg(await s.generate(),i,o,r.canonical));)await s.reseed();return $g(a,r)}const ey={strict:!0};function ty(e,t,r){let n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ey;try{n=Wg(e),t=Dg(t)}catch(p){return!1}const{r:o,s:s}=n;if(i.strict&&n.hasHighS())return!1;const a=Mg(t);let c;try{c=Hg(r)}catch(p){return!1}const{n:l}=ng,u=Bg(s,l),h=Og(a*u,l),d=Og(o*u,l),f=vg.BASE.multiplyAndAddUnsafe(c,h,d);if(!f)return!1;return Og(f.x,l)===o}vg.BASE._setWindowSize(8);const ry={node:Jp,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},ny={},iy={bytesToHex:Ag,hexToBytes:xg,concatBytes:_g,mod:Og,invert:Bg,isValidPrivateKey(e){try{return Vg(e),!0}catch(t){return!1}},_bigintTo32Bytes:Cg,_normalizePrivateKey:Vg,hashToPrivateKey:e=>{e=Dg(e);const t=ag+8;if(e.length<t||e.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return Cg(Og(Pg(e),ng.n-Zp)+Zp)},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(ry.web)return ry.web.getRandomValues(new Uint8Array(e));if(ry.node){const{randomBytes:t}=ry.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>iy.hashToPrivateKey(iy.randomBytes(ag+8)),precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vg.BASE;const r=t===vg.BASE?t:new vg(t.x,t.y);return r._setWindowSize(e),r.multiply(tg),r},sha256:async function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(ry.web){const e=await ry.web.subtle.digest("SHA-256",_g(...t));return new Uint8Array(e)}if(ry.node){const{createHash:e}=ry.node,r=e("sha256");return t.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(ry.web){const t=await ry.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=_g(...r),i=await ry.web.subtle.sign("HMAC",t,n);return new Uint8Array(i)}if(ry.node){const{createHmac:t}=ry.node,n=t("sha256",e);return r.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async function(e){let t=ny[e];if(void 0===t){const r=await iy.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=_g(r,r),ny[e]=t}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return iy.sha256(t,...n)},taggedHashSync:function(e){if("function"!==typeof Ug)throw new fg("sha256Sync is undefined, you need to set it");let t=ny[e];if(void 0===t){const r=Ug(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=_g(r,r),ny[e]=t}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return Ug(t,...n)},_JacobianPoint:gg};function oy(e){if(isNaN(e)||e<=0)throw new xd("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return iy.randomBytes(e)}Object.defineProperties(iy,{sha256Sync:{configurable:!1,get:()=>Ug,set(e){Ug||(Ug=e)}},hmacSha256Sync:{configurable:!1,get:()=>Fg,set(e){Fg||(Fg=e)}}});__webpack_require__(1903);function sy(e,t){return t.map((t=>Yp(e[t])))}async function ay(e){const t=[await Pp.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await ly(e)],r=await cy({privateKey:t[0],publicKey:t[1]});return{privateKey:r[0],publicKey:r[1]}}async function cy(e){if(null==e.privateKey||null==e.publicKey)throw new xd("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([Pp.get().subtle.exportKey("jwk",e.privateKey),Pp.get().subtle.exportKey("jwk",e.publicKey)])}async function ly(e){return Pp.get().subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function uy(e,t,r,n){const i=t?function(e){return Pd.pki.setRsaPublicKey(...sy(e,["n","e"]))}(e):function(e){return Pd.pki.setRsaPrivateKey(...sy(e,["n","e","d","p","q","dp","dq","qi"]))}(e);return _l(n(Sl(Uint8Array.from(r),"ascii"),i),"ascii")}class hy{constructor(e){Ze(this,"_key",void 0),this._key=e}async verify(e,t){return async function(e,t,r){const n=await Pp.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Pp.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,t,r)}(this._key,t,e)}marshal(){return function(e){if(null==e.n||null==e.e)throw new xd("JWK was missing components","ERR_INVALID_PARAMETERS");const t=Pd.pki.publicKeyToAsn1({n:Yp(e.n),e:Yp(e.e)});return _l(Pd.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return Mp.encode({Type:Lp.RSA,Data:this.marshal()}).subarray()}encrypt(e){return uy(this._key,!0,e,((e,t)=>t.encrypt(e)))}equals(e){return _f(this.bytes,e.bytes)}async hash(){const{bytes:e}=await wf.digest(this.bytes);return e}}class dy{constructor(e,t){Ze(this,"_key",void 0),Ze(this,"_publicKey",void 0),this._key=e,this._publicKey=t}genSecret(){return oy(16)}async sign(e){return async function(e,t){const r=await Pp.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await Pp.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(n,0,n.byteLength)}(this._key,e)}get public(){if(null==this._publicKey)throw new xd("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new hy(this._publicKey)}decrypt(e){return uy(this._key,!1,e,((e,t)=>t.decrypt(e)))}marshal(){return function(e){if(null==e.n||null==e.e||null==e.d||null==e.p||null==e.q||null==e.dp||null==e.dq||null==e.qi)throw new xd("JWK was missing components","ERR_INVALID_PARAMETERS");const t=Pd.pki.privateKeyToAsn1({n:Yp(e.n),e:Yp(e.e),d:Yp(e.d),p:Yp(e.p),q:Yp(e.q),dP:Yp(e.dp),dQ:Yp(e.dq),qInv:Yp(e.qi)});return _l(Pd.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return Up.encode({Type:Lp.RSA,Data:this.marshal()}).subarray()}equals(e){return _f(this.bytes,e.bytes)}async hash(){const{bytes:e}=await wf.digest(this.bytes);return e}async id(){return Sl(await this.public.hash(),"base58btc")}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pkcs-8";if("pkcs-8"===t){const t=new Pd.util.ByteBuffer(this.marshal()),r=Pd.asn1.fromDer(t),n=Pd.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return Pd.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return Op(this.bytes,e);throw new xd("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}async function fy(e){const t=function(e){const t=Pd.asn1.fromDer(Sl(e,"ascii")),r=Pd.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:Gp(r.n),e:Gp(r.e),d:Gp(r.d),p:Gp(r.p),q:Gp(r.q),dp:Gp(r.dP),dq:Gp(r.dQ),qi:Gp(r.qInv),alg:"RS256"}}(e),r=await ay(t);return new dy(r.privateKey,r.publicKey)}function py(e){const t=function(e){const t=Pd.asn1.fromDer(Sl(e,"ascii")),r=Pd.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:Gp(r.n),e:Gp(r.e)}}(e);return new hy(t)}async function gy(e){const t=await ay(e);return new dy(t.privateKey,t.publicKey)}async function yy(e){const t=await async function(e){const t=await Pp.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await cy(t);return{privateKey:r[0],publicKey:r[1]}}(e);return new dy(t.privateKey,t.publicKey)}function my(e){try{vg.fromHex(e)}catch(t){throw new xd(String(t),"ERR_INVALID_PUBLIC_KEY")}}class vy{constructor(e){Ze(this,"_key",void 0),my(e),this._key=e}async verify(e,t){return async function(e,t,r){try{const{digest:n}=await wf.digest(r);return ty(t,n,e)}catch(n){throw new xd(String(n),"ERR_INVALID_INPUT")}}(this._key,t,e)}marshal(){return e=this._key,vg.fromHex(e).toRawBytes(!0);var e}get bytes(){return Mp.encode({Type:Lp.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return _f(this.bytes,e.bytes)}async hash(){const{bytes:e}=await wf.digest(this.bytes);return e}}class by{constructor(e,t){Ze(this,"_key",void 0),Ze(this,"_publicKey",void 0),this._key=e,this._publicKey=null!==t&&void 0!==t?t:function(e){try{return Gg(e,!0)}catch(t){throw new xd(String(t),"ERR_INVALID_PRIVATE_KEY")}}(e),function(e){try{Gg(e,!0)}catch(t){throw new xd(String(t),"ERR_INVALID_PRIVATE_KEY")}}(this._key),my(this._publicKey)}async sign(e){return async function(e,t){const{digest:r}=await wf.digest(t);try{return await Zg(r,e)}catch(n){throw new xd(String(n),"ERR_INVALID_INPUT")}}(this._key,e)}get public(){return new vy(this._publicKey)}marshal(){return this._key}get bytes(){return Up.encode({Type:Lp.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return _f(this.bytes,e.bytes)}async hash(){const{bytes:e}=await wf.digest(this.bytes);return e}async id(){return Sl(await this.public.hash(),"base58btc")}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"libp2p-key";if("libp2p-key"===t)return Op(this.bytes,e);throw new xd("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}function wy(e){return new by(e)}function Ey(e){return new vy(e)}async function _y(){const e=iy.randomPrivateKey();return new by(e)}const Sy={rsa:G,ed25519:W,secp256k1:Y};function Ay(e){const t=Object.keys(Sy).join(" / ");return new xd("invalid or unsupported key type ".concat(e,". Must be ").concat(t),"ERR_UNSUPPORTED_KEY_TYPE")}function ky(e){if("rsa"===(e=e.toLowerCase())||"ed25519"===e||"secp256k1"===e)return Sy[e];throw Ay(e)}async function Iy(e,t){return ky(e).generateKeyPair(null!==t&&void 0!==t?t:2048)}function Cy(e){var t,r;const n=Mp.decode(e),i=null!==(t=n.Data)&&void 0!==t?t:new Uint8Array;switch(n.Type){case Lp.RSA:return Sy.rsa.unmarshalRsaPublicKey(i);case Lp.Ed25519:return Sy.ed25519.unmarshalEd25519PublicKey(i);case Lp.Secp256k1:return Sy.secp256k1.unmarshalSecp256k1PublicKey(i);default:throw Ay(null!==(r=n.Type)&&void 0!==r?r:"RSA")}}function Ry(e,t){var r;return ky(t=(null!==(r=t)&&void 0!==r?r:"rsa").toLowerCase()),e.bytes}async function Ty(e){var t,r;const n=Up.decode(e),i=null!==(t=n.Data)&&void 0!==t?t:new Uint8Array;switch(n.Type){case Lp.RSA:return Sy.rsa.unmarshalRsaPrivateKey(i);case Lp.Ed25519:return Sy.ed25519.unmarshalEd25519PrivateKey(i);case Lp.Secp256k1:return Sy.secp256k1.unmarshalSecp256k1PrivateKey(i);default:throw Ay(null!==(r=n.Type)&&void 0!==r?r:"RSA")}}async function xy(e,t){try{const r=await async function(e,t){const r=Cp.decode(e);return Np().decrypt(r,t)}(e,t);return await Ty(r)}catch(i){}const r=Pd.pki.decryptRsaPrivateKey(e,t);if(null===r)throw new xd("Cannot read the key, most likely the password is wrong or not a RSA key","ERR_CANNOT_DECRYPT_PEM");let n=Pd.asn1.toDer(Pd.pki.privateKeyToAsn1(r));return n=_l(n.getBytes(),"ascii"),Sy.rsa.unmarshalRsaPrivateKey(n)}const Py=jd({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),Dy=qd({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Ny=qd({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Oy=zd({prefix:"9",name:"base10",alphabet:"0123456789"}),Ly=qd({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),By=qd({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),My=qd({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Uy=qd({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Fy=qd({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),jy=qd({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),zy=qd({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qy=qd({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ky=qd({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Vy=qd({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Hy=qd({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Wy=zd({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Gy=zd({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Yy=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),Qy=Yy.reduce(((e,t,r)=>(e[r]=t,e)),[]),Xy=Yy.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const Jy=jd({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Qy[t]),"")},decode:function(e){const t=[];for(const r of e){const e=Xy[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),$y="raw",Zy=85,em=e=>Od(e),tm=e=>Od(e),rm=new TextEncoder,nm=new TextDecoder,im="json",om=512,sm=e=>rm.encode(JSON.stringify(e)),am=e=>JSON.parse(nm.decode(e)),cm=(e,t)=>{const{bytes:r,version:n}=e;return 0===n?fm(r,um(e),t||Kd.encoder):pm(r,um(e),t||My.encoder)},lm=new WeakMap,um=e=>{const t=lm.get(e);if(null==t){const t=new Map;return lm.set(e,t),t}return t};class hm{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this["/"]=n}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!==gm)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ym)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return hm.createV0(t)}default:throw Error("Can not convert CID version ".concat(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=df(e,t);return hm.createV1(this.code,r)}case 1:return this;default:throw Error("Can not convert CID version ".concat(this.version," to version 1. This is a bug please report"))}}equals(e){return hm.equals(this,e)}static equals(e,t){const r=t;return r&&e.code===r.code&&e.version===r.version&&((e,t)=>{if(e===t)return!0;{const r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0})(e.bytes,r.bytes)}})(e.multihash,r.multihash)}toString(e){return cm(this,e)}toJSON(){return{"/":cm(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID(".concat(this.toString(),")")}static asCID(e){if(null==e)return null;const t=e;if(t instanceof hm)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:e,code:r,multihash:n,bytes:i}=t;return new hm(e,r,n,i||mm(e,r,n.bytes))}if(!0===t[vm]){const{version:e,multihash:r,code:n}=t,i=ff(r);return hm.create(e,n,i)}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!==gm)throw new Error("Version 0 CID must use dag-pb (code: ".concat(gm,") block encoding"));return new hm(e,t,r,r.bytes);case 1:{const n=mm(e,t,r.bytes);return new hm(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return hm.create(0,gm,e)}static createV1(e,t){return hm.create(1,e,t)}static decode(e){const[t,r]=hm.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=hm.inspectBytes(e),r=t.size-t.multihashSize,n=Od(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=n.subarray(t.multihashSize-t.digestSize),o=new pf(t.multihashCode,t.digestSize,i,n);return[0===t.version?hm.createV0(o):hm.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=lf(e.subarray(t));return t+=n,r};let n=r(),i=gm;if(18===n?(n=0,t=0):i=r(),0!==n&&1!==n)throw new RangeError("Invalid CID version ".concat(n));const o=t,s=r(),a=r(),c=t+a;return{version:n,codec:i,multihashCode:s,digestSize:a,multihashSize:c-o,size:c}}static parse(e,t){const[r,n]=dm(e,t),i=hm.decode(n);if(0===i.version&&"Q"!==e[0])throw Error("Version 0 CID string must not include multibase prefix");return um(i).set(r,e),i}}const dm=(e,t)=>{switch(e[0]){case"Q":{const r=t||Kd;return[Kd.prefix,r.decode("".concat(Kd.prefix).concat(e))]}case Kd.prefix:{const r=t||Kd;return[Kd.prefix,r.decode(e)]}case My.prefix:{const r=t||My;return[My.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},fm=(e,t,r)=>{const{prefix:n}=r;if(n!==Kd.prefix)throw Error("Cannot string encode V0 in ".concat(r.name," encoding"));const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i},pm=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},gm=112,ym=18,mm=(e,t,r)=>{const n=hf(e),i=n+hf(t),o=new Uint8Array(i+r.byteLength);return uf(e,o,0),uf(t,o,n),o.set(r,i),o},vm=Symbol.for("@ipld/js-cid/CID"),bm={...Q,...X,...J,...$,...Z,...ee,...te,...q,...H,...re},wm=Symbol.for("nodejs.util.inspect.custom"),Em=Object.values(bm).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),bm.identity.decoder),_m=114,Sm=36,Am=37;class km{constructor(e){Ze(this,"type",void 0),Ze(this,"multihash",void 0),Ze(this,"privateKey",void 0),Ze(this,"publicKey",void 0),Ze(this,"string",void 0),Ze(this,et,!0),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(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=Kd.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return hm.createV1(_m,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return _f(this.multihash.bytes,e);if("string"===typeof e)return Tm(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return _f(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[wm](){return"PeerId(".concat(this.toString(),")")}}class Im extends km{constructor(e){super({...e,type:"RSA"}),Ze(this,"type","RSA"),Ze(this,"publicKey",void 0),this.publicKey=e.publicKey}}class Cm extends km{constructor(e){super({...e,type:"Ed25519"}),Ze(this,"type","Ed25519"),Ze(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class Rm extends km{constructor(e){super({...e,type:"secp256k1"}),Ze(this,"type","secp256k1"),Ze(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function Tm(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:Em,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=ff(Kd.decode("z".concat(e)));return e.startsWith("12D")?new Cm({multihash:t}):e.startsWith("16U")?new Rm({multihash:t}):new Im({multihash:t})}return xm(Em.decode(e))}function xm(e){try{const t=ff(e);if(t.code===yf.code){if(t.digest.length===Sm)return new Cm({multihash:t});if(t.digest.length===Am)return new Rm({multihash:t})}if(t.code===wf.code)return new Im({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==_m)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===wf.code)return new Im({multihash:e.multihash});if(t.code===yf.code){if(t.digest.length===Sm)return new Cm({multihash:e.multihash});if(t.digest.length===Am)return new Rm({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(hm.decode(e))}throw new Error("Supplied PeerID CID is invalid")}async function Pm(e,t){return e.length===Sm?new Cm({multihash:df(yf.code,e),privateKey:t}):e.length===Am?new Rm({multihash:df(yf.code,e),privateKey:t}):new Im({multihash:await wf.digest(e),publicKey:e,privateKey:t})}var Dm,Nm;async function Om(e,t,r){const n=await async function(e,t){if(null==e.privateKey)throw new Error("PrivateKey was missing from PeerId");return(await Ty(e.privateKey)).sign(t)}(e,Mm(t));if(null==e.publicKey)throw new Error("PublicKey was missing from local PeerId");return function(e,t,r){return Nm.encode({identityKey:e,identitySig:t,extensions:null!==r&&void 0!==r?r:{webtransportCerthashes:[]}}).subarray()}(e.publicKey,n,r)}async function Lm(e){return Pm(e.identityKey)}function Bm(e){return Nm.decode(e)}function Mm(e){const t=_l("noise-libp2p-static-key:");return Sd([t,e],t.length+e.length)}async function Um(e,t,r){const n=await Pm(t.identityKey);if(!n.equals(r))throw new Error("Payload identity key ".concat(n.toString()," does not match expected remote peer ").concat(r.toString()));const i=Mm(e);if(null==n.publicKey)throw new Error("PublicKey was missing from PeerId");if(null==t.identitySig)throw new Error("Signature was missing from message");const o=Cy(n.publicKey);if(!await o.verify(i,t.identitySig))throw new Error("Static key doesn't match to peer that signed payload!");return n}function Fm(e){return e instanceof Uint8Array&&32===e.length}function jm(e){let t=function(e){const t=()=>{};return t.enabled=!1,t.color="",t.diff=0,t.log=()=>{},t.namespace=e,t.destroy=()=>!0,t.extend=()=>t,t}("".concat(e,":trace"));return ai.enabled("".concat(e,":trace"))&&null!=ai.names.map((e=>e.toString())).find((e=>e.includes(":trace")))&&(t=ai("".concat(e,":trace"))),Object.assign(ai(e),{error:ai("".concat(e,":error")),trace:t})}!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.webtransportCerthashes)for(const n of e.webtransportCerthashes)t.uint32(10),t.bytes(n);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={webtransportCerthashes:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.webtransportCerthashes.push(e.bytes());else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Dm||(Dm={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var n,i;(!1!==r.lengthDelimited&&t.fork(),!0===r.writeDefaults||null!=e.identityKey&&e.identityKey.byteLength>0)&&(t.uint32(10),t.bytes(null!==(n=e.identityKey)&&void 0!==n?n:new Uint8Array(0)));(!0===r.writeDefaults||null!=e.identitySig&&e.identitySig.byteLength>0)&&(t.uint32(18),t.bytes(null!==(i=e.identitySig)&&void 0!==i?i:new Uint8Array(0)));null!=e.extensions&&(t.uint32(34),Dm.codec().encode(e.extensions,t,{writeDefaults:!1})),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={identityKey:new Uint8Array(0),identitySig:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.identityKey=e.bytes();break;case 2:r.identitySig=e.bytes();break;case 4:r.extensions=Dm.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(Nm||(Nm={})),ai.formatters.b=e=>null==e?"undefined":Kd.baseEncode(e),ai.formatters.t=e=>null==e?"undefined":My.baseEncode(e),ai.formatters.m=e=>null==e?"undefined":Cp.baseEncode(e),ai.formatters.p=e=>null==e?"undefined":e.toString(),ai.formatters.c=e=>null==e?"undefined":e.toString(),ai.formatters.k=e=>null==e?"undefined":e.toString(),ai.formatters.a=e=>null==e?"undefined":e.toString();const zm=jm("libp2p:noise");let qm;function Km(e){e?(qm("LOCAL_PUBLIC_EPHEMERAL_KEY ".concat(Sl(e.publicKey,"hex"))),qm("LOCAL_PRIVATE_EPHEMERAL_KEY ".concat(Sl(e.privateKey,"hex")))):qm("Missing local ephemeral keys.")}function Vm(e){qm("REMOTE_EPHEMERAL_PUBLIC_KEY ".concat(Sl(e,"hex")))}qm=nu?zm:Object.assign((()=>{}),{enabled:!1,trace:()=>{},error:()=>{}});class Hm{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;Ze(this,"n",void 0),Ze(this,"bytes",void 0),Ze(this,"view",void 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 Wm{constructor(e){Ze(this,"crypto",void 0),this.crypto=e}encryptWithAd(e,t,r){const n=this.encrypt(e.k,e.n,t,r);return e.n.increment(),n}decryptWithAd(e,t,r,n){const{plaintext:i,valid:o}=this.decrypt(e.k,e.n,t,r,n);return o&&e.n.increment(),{plaintext:i,valid:o}}hasKey(e){return!this.isEmptyKey(e.k)}createEmptyKey(){return new Uint8Array(32)}isEmptyKey(e){return _f(this.createEmptyKey(),e)}encrypt(e,t,r,n){return t.assertValue(),this.crypto.chaCha20Poly1305Encrypt(n,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,n,i){t.assertValue();const o=this.crypto.chaCha20Poly1305Decrypt(n,t.getBytes(),r,e,i);return o?{plaintext:o,valid:!0}:{plaintext:new Uint8Array(0),valid:!1}}decryptAndHash(e,t){let r,n=!0;return this.hasKey(e.cs)?({plaintext:r,valid:n}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:n}}dh(e,t){try{const r=this.crypto.generateX25519SharedKey(e,t);return 32===r.length?r:r.subarray(0,32)}catch(r){const e=r;return zm.error(e),new Uint8Array(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return this.crypto.hashSHA256(Sd([e,t],e.length+t.length))}mixKey(e,t){const[r,n]=this.crypto.getHKDF(e.ck,t);e.cs=this.initializeKey(n),e.ck=r}initializeKey(e){return{k:e,n:new Hm}}initializeSymmetric(e){const t=_l(e,"utf-8"),r=this.hashProtocolName(t),n=r,i=this.createEmptyKey();return{cs:this.initializeKey(i),ck:n,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)}}class Gm extends Wm{initializeInitiator(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}initializeResponder(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}writeMessageA(e,t,r){const n=new Uint8Array(0);e.e=void 0!==r?r:this.crypto.generateX25519KeyPair();const i=e.e.publicKey;this.mixHash(e.ss,i);return{ne:i,ns:n,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 n=e.s.publicKey,i=this.encryptAndHash(e.ss,n);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:r,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=e.s.publicKey,n=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const i=this.encryptAndHash(e.ss,t),o={ne:this.createEmptyKey(),ns:n,ciphertext:i},{cs1:s,cs2:a}=this.split(e.ss);return{h:e.ss.h,messageBuffer:o,cs1:s,cs2:a}}readMessageA(e,t){return Fm(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(Fm(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:n}=this.decryptAndHash(e.ss,t.ns);n&&Fm(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:i,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:i,valid:n&&o}}readMessageC(e,t){const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);if(n&&Fm(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:i,valid:o}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:s,cs2:a}=this.split(e.ss);return{h:e.ss.h,plaintext:i,valid:n&&o,cs1:s,cs2:a}}initSession(e,t,r){const n=this.createEmptyKey(),i=new Uint8Array(32);let o;return o=e?this.initializeInitiator(t,r,i,n):this.initializeResponder(t,r,i,n),{hs:o,i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:i,cs1:o,cs2:s}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=o,e.cs2=s}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");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}return e.mc++,n}recvMessage(e,t){let r=new Uint8Array(0),n=!1;if(0===e.mc)({plaintext:r,valid:n}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:n}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:i,plaintext:o,valid:s,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=o,n=s,e.h=i,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}}class Ym{constructor(e,t,r,n,i,o,s,a){Ze(this,"isInitiator",void 0),Ze(this,"session",void 0),Ze(this,"remotePeer",void 0),Ze(this,"remoteExtensions",{webtransportCerthashes:[]}),Ze(this,"payload",void 0),Ze(this,"connection",void 0),Ze(this,"xx",void 0),Ze(this,"staticKeypair",void 0),Ze(this,"prologue",void 0),this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=i,this.connection=o,s&&(this.remotePeer=s),this.xx=null!==a&&void 0!==a?a:new Gm(n),this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair)}async propose(){var e;if(e=this.session.hs.s,qm("LOCAL_STATIC_PUBLIC_KEY ".concat(Sl(e.publicKey,"hex"))),qm("LOCAL_STATIC_PRIVATE_KEY ".concat(Sl(e.privateKey,"hex"))),this.isInitiator){zm.trace("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,new Uint8Array(0));this.connection.writeLP(function(e){return Sd([e.ne,e.ciphertext],e.ne.length+e.ciphertext.length)}(e)),zm.trace("Stage 0 - Initiator finished sending first message."),Km(this.session.hs.e)}else{zm.trace("Stage 0 - Responder waiting to receive first message...");const e=function(e){if(e.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:e.subarray(0,32),ciphertext:e.subarray(32,e.length),ns:new Uint8Array(0)}}((await this.connection.readLP()).subarray()),{valid:t}=this.xx.recvMessage(this.session,e);if(!t)throw new Cd("xx handshake stage 0 validation fail");zm.trace("Stage 0 - Responder received first message."),Vm(this.session.hs.re)}}async exchange(){if(this.isInitiator){zm.trace("Stage 1 - Initiator waiting to receive first message from responder...");const r=function(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.subarray(0,32),ns:e.subarray(32,80),ciphertext:e.subarray(80,e.length)}}((await this.connection.readLP()).subarray()),{plaintext:n,valid:i}=this.xx.recvMessage(this.session,r);if(!i)throw new Cd("xx handshake stage 1 validation fail");zm.trace("Stage 1 - Initiator received the message."),Vm(this.session.hs.re),e=this.session.hs.rs,qm("REMOTE_STATIC_PUBLIC_KEY ".concat(Sl(e,"hex"))),zm.trace("Initiator going to check remote's signature...");try{const e=Bm(n);this.remotePeer=this.remotePeer||await Lm(e),await Um(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Id("Error occurred while verifying signed payload: ".concat(t.message))}zm.trace("All good with the signature!")}else{zm.trace("Stage 1 - Responder sending out first message with signed payload and static key.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(function(e){return Sd([e.ne,e.ns,e.ciphertext],e.ne.length+e.ns.length+e.ciphertext.length)}(e)),zm.trace("Stage 1 - Responder sent the second handshake message with signed payload."),Km(this.session.hs.e)}var e}async finish(){if(this.isInitiator){zm.trace("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(function(e){return Sd([e.ns,e.ciphertext],e.ns.length+e.ciphertext.length)}(e)),zm.trace("Stage 2 - Initiator sent message with signed payload.")}else{zm.trace("Stage 2 - Responder waiting for third handshake message...");const e=function(e){if(e.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:new Uint8Array(0),ns:e.subarray(0,48),ciphertext:e.subarray(48,e.length)}}((await this.connection.readLP()).subarray()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,e);if(!n)throw new Cd("xx handshake stage 2 validation fail");zm.trace("Stage 2 - Responder received the message, finished handshake.");try{const e=Bm(r);this.remotePeer=this.remotePeer||await Lm(e),await Um(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Id("Error occurred while verifying signed payload: ".concat(t.message))}}var e;(e=this.session).cs1&&e.cs2?(qm("CIPHER_STATE_1 ".concat(e.cs1.n.getUint64()," ").concat(Sl(e.cs1.k,"hex"))),qm("CIPHER_STATE_2 ".concat(e.cs2.n.getUint64()," ").concat(Sl(e.cs2.k,"hex")))):qm("Missing cipher state.")}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,new Uint8Array(0),e)}decrypt(e,t,r){const n=this.getCS(t,!1);return this.xx.decryptWithAd(n,new Uint8Array(0),e,r)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e.cs1||!e.cs2)throw new Cd("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 Qm{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ze(this,"protocol","/noise"),Ze(this,"crypto",void 0),Ze(this,"prologue",void 0),Ze(this,"staticKeys",void 0),Ze(this,"extensions",void 0),Ze(this,"metrics",void 0);const{staticNoiseKey:t,extensions:r,crypto:n,prologueBytes:i,metrics:o}=e;this.crypto=null!==n&&void 0!==n?n:_d,this.extensions=r,this.metrics=o?function(e){return{xxHandshakeSuccesses:e.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:e.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:e.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:e.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:e.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=null!==i&&void 0!==i?i:new Uint8Array(0)}async secureOutbound(e,t,r){const n=eu(t,{lengthEncoder:Ad,lengthDecoder:kd,maxDataLength:ru}),i=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteExtensions:i.remoteExtensions,remotePeer:i.remotePeer}}async secureInbound(e,t,r){const n=eu(t,{lengthEncoder:Ad,lengthDecoder:kd,maxDataLength:ru}),i=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remotePeer:i.remotePeer,remoteExtensions:i.remoteExtensions}}async performHandshake(e){const t=await Om(e.localPeer,this.staticKeys.publicKey,this.extensions);return this.performXXHandshake(e,t)}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:n,connection:i}=e,o=new Ym(r,t,this.prologue,this.crypto,this.staticKeys,i,n);try{var s;await o.propose(),await o.exchange(),await o.finish(),null===(s=this.metrics)||void 0===s||s.xxHandshakeSuccesses.increment()}catch(c){var a;if(null===(a=this.metrics)||void 0===a||a.xxHandshakeErrors.increment(),c instanceof Error)throw c.message="Error occurred during XX handshake: ".concat(c.message),c}return o}async createSecureConnection(e,t){const[r,n]=function(){const e=Fl(),t=Fl();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}(),i=e.unwrap();return await Fa(r,function(e,t){return async function*(r){for await(const n of r)for(let r=0;r<n.length;r+=65519){let i=r+65519;i>n.length&&(i=n.length);const o=e.encrypt(n.subarray(r,i),e.session);null===t||void 0===t||t.encryptedPackets.increment(),yield Ad(o.byteLength),yield o}}}(t,this.metrics),i,(e=>Pa(e,{lengthDecoder:kd})),function(e,t){return async function*(r){for await(const n of r)for(let r=0;r<n.length;r+=ru){let i=r+ru;if(i>n.length&&(i=n.length),i-16<r)throw new Error("Invalid chunk");const o=n.subarray(r,i),s=n.subarray(r,i-16),{plaintext:a,valid:c}=e.decrypt(o,e.session,s);if(!c)throw null===t||void 0===t||t.decryptErrors.increment(),new Error("Failed to validate decrypted chunk");null===t||void 0===t||t.decryptedPackets.increment(),yield a}}}(t,this.metrics),r),n}}function Xm(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new Qm(e)}class Jm extends Error{constructor(e,t){super(null!==e&&void 0!==e?e:"The operation was aborted"),this.type="aborted",this.code=null!==t&&void 0!==t?t:"ABORT_ERR"}}function $m(e,t,r){const n=null!==r&&void 0!==r?r:{},i=function(e){if(null!=e){if("function"===typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"===typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"===typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}(e);return async function*(){let r;const o=()=>{null!=r&&r()};for(t.addEventListener("abort",o);;){let a;try{if(t.aborted){const{abortMessage:e,abortCode:t}=n;throw new Jm(e,t)}const e=new Promise(((e,t)=>{r=()=>{const{abortMessage:e,abortCode:r}=n;t(new Jm(e,r))}}));a=await Promise.race([e,i.next()]),r=null}catch(s){t.removeEventListener("abort",o);const r="aborted"===s.type&&t.aborted;if(r&&null!=n.onAbort&&n.onAbort(e),"function"===typeof i.return)try{const e=i.return();e instanceof Promise&&e.catch((e=>{null!=n.onReturnError&&n.onReturnError(e)}))}catch(s){null!=n.onReturnError&&n.onReturnError(s)}if(r&&!0===n.returnOnAbort)return;throw s}if(!0===a.done)break;yield a.value}t.removeEventListener("abort",o)}()}function Zm(e,t,r){return n=>e($m(n,t,r))}function ev(e,t,r){return{sink:Zm(e.sink,t,{...r,onAbort:void 0}),source:$m(e.source,t,r)}}function tv(e){const t=new globalThis.AbortController;function r(){t.abort();for(const t of e)null!=(null===t||void 0===t?void 0:t.removeEventListener)&&t.removeEventListener("abort",r)}for(const i of e){if(!0===(null===i||void 0===i?void 0:i.aborted)){r();break}null!=(null===i||void 0===i?void 0:i.addEventListener)&&i.addEventListener("abort",r)}const n=t.signal;return n.clear=function(){for(const t of e)null!=(null===t||void 0===t?void 0:t.removeEventListener)&&t.removeEventListener("abort",r)},n}var rv,nv=__webpack_require__(9304);!function(e){e[e.NEW_STREAM=0]="NEW_STREAM",e[e.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",e[e.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",e[e.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",e[e.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",e[e.RESET_RECEIVER=5]="RESET_RECEIVER",e[e.RESET_INITIATOR=6]="RESET_INITIATOR"}(rv||(rv={}));const iv=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),ov=Object.freeze({NEW_STREAM:rv.NEW_STREAM,MESSAGE:rv.MESSAGE_INITIATOR,CLOSE:rv.CLOSE_INITIATOR,RESET:rv.RESET_INITIATOR}),sv=Object.freeze({MESSAGE:rv.MESSAGE_RECEIVER,CLOSE:rv.CLOSE_RECEIVER,RESET:rv.RESET_RECEIVER}),av=1<<20;class cv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:av,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4194304;Ze(this,"_buffer",void 0),Ze(this,"_headerInfo",void 0),Ze(this,"_maxMessageSize",void 0),Ze(this,"_maxUnprocessedMessageQueueSize",void 0),this._buffer=new _a,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(r){if("ERR_MSG_TOO_BIG"===r.code)throw r;break}const{id:e,type:n,length:i,offset:o}=this._headerInfo;if(this._buffer.length-o<i)break;const s={id:e,type:n};n!==rv.NEW_STREAM&&n!==rv.MESSAGE_INITIATOR&&n!==rv.MESSAGE_RECEIVER||(s.data=this._buffer.sublist(o,o+i)),t.push(s),this._buffer.consume(o+i),this._headerInfo=null}return t}_decodeHeader(e){const{value:t,offset:r}=hv(e),{value:n,offset:i}=hv(e,r),o=7&t;if(null==iv[o])throw new Error("Invalid type received: ".concat(o));if(n>this._maxMessageSize)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"});return{id:t>>3,type:o,offset:r+i,length:n}}}const lv=128,uv=127;function hv(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0,i=0,o=r;const s=e.length;do{if(o>=s||i>49)throw r=0,new RangeError("Could not decode varint");t=e.get(o++),n+=i<28?(t&uv)<<i:(t&uv)*Math.pow(2,i),i+=7}while(t>=lv);return r=o-r,{value:n,offset:r}}const dv=1048576,fv=(e,t)=>{t.append(e)};const pv=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(r,n,i){let o=new _a,s=!1,a=Da(),c=Number(null!==(r=null===t||void 0===t?void 0:t.size)&&void 0!==r?r:dv);if((isNaN(c)||0===c||c<0)&&(c=dv),c!==Math.round(c))throw new Error("Batch size must be an integer");const l=null!==(n=null===t||void 0===t?void 0:t.yieldAfter)&&void 0!==n?n:0,u=null!==(i=null===t||void 0===t?void 0:t.serialize)&&void 0!==i?i:fv;for(Promise.resolve().then((async()=>{try{let t;for await(const r of e)u(r,o),o.byteLength>=c?(clearTimeout(t),a.resolve()):t=setTimeout((()=>{a.resolve()}),l);clearTimeout(t),a.resolve()}catch(t){a.reject(t)}finally{s=!0}}));!s;)if(await a.promise,a=Da(),o.byteLength>0){const e=o;o=new _a,yield e.subarray()}}():function*(r,n){const i=new _a;let o=Number(null!==(r=null===t||void 0===t?void 0:t.size)&&void 0!==r?r:dv);if((isNaN(o)||0===o||o<0)&&(o=dv),o!==Math.round(o))throw new Error("Batch size must be an integer");const s=null!==(n=null===t||void 0===t?void 0:t.serialize)&&void 0!==n?n:fv;for(const t of e)s(t,i),i.byteLength>=o&&(yield i.subarray(0,o),i.consume(o));i.byteLength>0&&(yield i.subarray())}()};var gv=__webpack_require__(9085);function yv(e){return new Uint8Array(e)}const mv=10240;const vv=new class{constructor(){Ze(this,"_pool",void 0),Ze(this,"_poolOffset",void 0),this._pool=yv(mv),this._poolOffset=0}write(e,t){var r,n;const i=this._pool;let o=this._poolOffset;gv.encode(e.id<<3|e.type,i,o),o+=null!==(r=gv.encode.bytes)&&void 0!==r?r:0,e.type!==rv.NEW_STREAM&&e.type!==rv.MESSAGE_INITIATOR&&e.type!==rv.MESSAGE_RECEIVER||null==e.data?gv.encode(0,i,o):gv.encode(e.data.length,i,o),o+=null!==(n=gv.encode.bytes)&&void 0!==n?n:0;const s=i.subarray(this._poolOffset,o);mv-o<100?(this._pool=yv(mv),this._poolOffset=0):this._poolOffset=o,t.append(s),e.type!==rv.NEW_STREAM&&e.type!==rv.MESSAGE_INITIATOR&&e.type!==rv.MESSAGE_RECEIVER||null==e.data||t.append(e.data)}};const bv=jm("libp2p:stream"),wv="ERR_STREAM_RESET";function Ev(e){return null!=e&&"function"===typeof e.then}class _v{constructor(e){var t;Ze(this,"id",void 0),Ze(this,"stat",void 0),Ze(this,"metadata",void 0),Ze(this,"source",void 0),Ze(this,"abortController",void 0),Ze(this,"resetController",void 0),Ze(this,"closeController",void 0),Ze(this,"sourceEnded",void 0),Ze(this,"sinkEnded",void 0),Ze(this,"sinkSunk",void 0),Ze(this,"endErr",void 0),Ze(this,"streamSource",void 0),Ze(this,"onEnd",void 0),Ze(this,"maxDataSize",void 0),this.abortController=new AbortController,this.resetController=new AbortController,this.closeController=new AbortController,this.sourceEnded=!1,this.sinkEnded=!1,this.sinkSunk=!1,this.id=e.id,this.metadata=null!==(t=e.metadata)&&void 0!==t?t:{},this.stat={direction:e.direction,timeline:{open:Date.now()}},this.maxDataSize=e.maxDataSize,this.onEnd=e.onEnd,this.source=this.streamSource=Ba({onEnd:()=>{if(null!==this.stat.timeline.reset){const e=this.sendCloseRead();Ev(e)&&e.catch((e=>{bv.error("error while sending close read",e)}))}this.onSourceEnd()}}),this.sink=this.sink.bind(this)}onSourceEnd(e){this.sourceEnded||(this.stat.timeline.closeRead=Date.now(),this.sourceEnded=!0,bv.trace("%s stream %s source end - err: %o",this.stat.direction,this.id,e),null!=e&&null==this.endErr&&(this.endErr=e),this.sinkEnded&&(this.stat.timeline.close=Date.now(),null!=this.onEnd&&this.onEnd(this.endErr)))}onSinkEnd(e){this.sinkEnded||(this.stat.timeline.closeWrite=Date.now(),this.sinkEnded=!0,bv.trace("%s stream %s sink end - err: %o",this.stat.direction,this.id,e),null!=e&&null==this.endErr&&(this.endErr=e),this.sourceEnded&&(this.stat.timeline.close=Date.now(),null!=this.onEnd&&this.onEnd(this.endErr)))}close(){bv.trace("%s stream %s close",this.stat.direction,this.id),this.closeRead(),this.closeWrite()}closeRead(){bv.trace("%s stream %s closeRead",this.stat.direction,this.id),this.sourceEnded||this.streamSource.end()}closeWrite(){if(bv.trace("%s stream %s closeWrite",this.stat.direction,this.id),!this.sinkEnded){this.closeController.abort();try{const e=this.sendCloseWrite();Ev(e)&&e.catch((e=>{bv.error("error while sending close write",e)}))}catch(e){bv.trace("%s stream %s error sending close",this.stat.direction,this.id,e)}this.onSinkEnd()}}abort(e){bv.trace("%s stream %s abort",this.stat.direction,this.id,e),this.streamSource.end(e),this.abortController.abort(),this.onSinkEnd(e)}reset(){const e=new xd("stream reset",wv);this.resetController.abort(),this.streamSource.end(e),this.onSinkEnd(e)}async sink(e){if(this.sinkSunk)throw new xd("sink already called on stream","ERR_DOUBLE_SINK");if(this.sinkSunk=!0,this.sinkEnded)throw new xd("stream closed for writing","ERR_SINK_ENDED");const t=tv([this.abortController.signal,this.resetController.signal,this.closeController.signal]);try{if(e=$m(e,t),"outbound"===this.stat.direction){const e=this.sendNewStream();Ev(e)&&await e}for await(let t of e)for(;t.length>0;){if(t.length<=this.maxDataSize){const e=this.sendData(t instanceof Uint8Array?new _a(t):t);Ev(e)&&await e;break}t=t instanceof Uint8Array?new _a(t):t;const e=this.sendData(t.sublist(0,this.maxDataSize));Ev(e)&&await e,t.consume(this.maxDataSize)}}catch(r){if("aborted"===r.type&&"The operation was aborted"===r.message){if(this.closeController.signal.aborted)return;this.resetController.signal.aborted&&(r.message="stream reset",r.code=wv),this.abortController.signal.aborted&&(r.message="stream aborted",r.code="ERR_STREAM_ABORT")}if(r.code===wv)bv.trace("%s stream %s reset",this.stat.direction,this.id);else{bv.trace("%s stream %s error",this.stat.direction,this.id,r);try{const e=this.sendReset();Ev(e)&&await e,this.stat.timeline.reset=Date.now()}catch(r){bv.trace("%s stream %s error sending reset",this.stat.direction,this.id,r)}}throw this.streamSource.end(r),this.onSinkEnd(r),r}finally{t.clear()}try{const e=this.sendCloseWrite();Ev(e)&&await e}catch(r){bv.trace("%s stream %s error sending close",this.stat.direction,this.id,r)}this.onSinkEnd()}sourcePush(e){this.streamSource.push(e)}sourceReadableLength(){return this.streamSource.readableLength}}class Sv extends _v{constructor(e){super(e),Ze(this,"name",void 0),Ze(this,"streamId",void 0),Ze(this,"send",void 0),Ze(this,"types",void 0),this.types="outbound"===e.direction?ov:sv,this.send=e.send,this.name=e.name,this.streamId=e.streamId}sendNewStream(){this.send({id:this.streamId,type:ov.NEW_STREAM,data:new _a(_l(this.name))})}sendData(e){this.send({id:this.streamId,type:this.types.MESSAGE,data:e})}sendReset(){this.send({id:this.streamId,type:this.types.RESET})}sendCloseWrite(){this.send({id:this.streamId,type:this.types.CLOSE})}sendCloseRead(){}}const Av=jm("libp2p:mplex");function kv(e){const t={...e,type:"".concat(iv[e.type]," (").concat(e.type,")")};return e.type===rv.NEW_STREAM&&(t.data=Sl(e.data instanceof Uint8Array?e.data:e.data.subarray())),e.type!==rv.MESSAGE_INITIATOR&&e.type!==rv.MESSAGE_RECEIVER||(t.data=Sl(e.data instanceof Uint8Array?e.data:e.data.subarray(),"base16")),t}class Iv{constructor(e){var t,r;Ze(this,"protocol","/mplex/6.7.0"),Ze(this,"sink",void 0),Ze(this,"source",void 0),Ze(this,"_streamId",void 0),Ze(this,"_streams",void 0),Ze(this,"_init",void 0),Ze(this,"_source",void 0),Ze(this,"closeController",void 0),Ze(this,"rateLimiter",void 0),e=null!==(t=e)&&void 0!==t?t:{},this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=e,this.sink=this._createSink();const n=this._createSource();this._source=n,this.source=n,this.closeController=new AbortController,this.rateLimiter=new nv.RateLimiterMemory({points:null!==(r=e.disconnectThreshold)&&void 0!==r?r: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++;e=null==e?t.toString():e.toString();const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}close(e){this.closeController.signal.aborted||(null!=e?this.streams.forEach((t=>{t.abort(e)})):this.streams.forEach((e=>{e.close()})),this.closeController.abort())}_newReceiverStream(e){const{id:t,name:r}=e,n=this._streams.receivers;return this._newStream({id:t,name:r,type:"receiver",registry:n})}_newStream(e){var t;const{id:r,name:n,type:i,registry:o}=e;if(Av("new %s stream %s",i,r),"initiator"===i&&this._streams.initiators.size===(null!==(t=this._init.maxOutboundStreams)&&void 0!==t?t:1024))throw new xd("Too many outbound streams open","ERR_TOO_MANY_OUTBOUND_STREAMS");if(o.has(r))throw new Error("".concat(i," stream ").concat(r," already exists!"));const s=function(e){const{id:t,name:r,send:n,onEnd:i,type:o="initiator",maxMsgSize:s=av}=e;return new Sv({id:"initiator"===o?"i".concat(t):"r".concat(t),streamId:t,name:"".concat(null==r?t:r),direction:"initiator"===o?"outbound":"inbound",maxDataSize:s,onEnd:i,send:n})}({id:r,name:n,send:e=>{Av.enabled&&Av.trace("%s stream %s send",i,r,kv(e)),this._source.push(e)},type:i,onEnd:()=>{Av("%s stream with id %s and protocol %s ended",i,r,s.stat.protocol),o.delete(r),null!=this._init.onStreamEnd&&this._init.onStreamEnd(s)},maxMsgSize:this._init.maxMsgSize});return o.set(r,s),s}_createSink(){return async e=>{const t=tv([this.closeController.signal,this._init.signal]);try{e=$m(e,t);const r=new cv(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(const t of e)for(const e of r.write(t))await this._handleIncoming(e);this._source.end()}catch(r){Av("error in sink",r),this._source.end(r)}finally{t.clear()}}}_createSource(){const e=function(){return Ma((e=>{let t;const r=[];for(;!e.isEmpty()&&(t=e.shift(),null!=t);){if(null!=t.error)throw t.error;!1===t.done&&r.push(t.value)}return null==t?{done:!0}:{done:!0===t.done,value:r}}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}({objectMode:!0,onEnd:e=>{this.close(e)}});return Object.assign(function(e){try{let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return async function*(){if(null!=t&&0!==t)yield*pv(e,{size:t,serialize:(e,t)=>{for(const r of e)vv.write(r,t)}});else for await(const t of e){const e=new _a;for(const r of t)vv.write(r,e);yield e.subarray()}}()}catch(t){return Promise.reject(t)}}(e,this._init.minSendBytes),{push:e.push,end:e.end,return:e.return})}async _handleIncoming(e){var t;const{id:r,type:n}=e;if(Av.enabled&&Av.trace("incoming message",kv(e)),e.type===rv.NEW_STREAM){var i;if(this._streams.receivers.size===(null!==(i=this._init.maxInboundStreams)&&void 0!==i?i:1024)){Av("too many inbound streams open"),this._source.push({id:r,type:rv.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{return Av("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),void this._source.end(new Error("Too many open streams"))}return}const t=this._newReceiverStream({id:r,name:Sl(e.data instanceof Uint8Array?e.data:e.data.subarray())});return void(null!=this._init.onIncomingStream&&this._init.onIncomingStream(t))}const o=(1===(1&n)?this._streams.initiators:this._streams.receivers).get(r);if(null==o)return void Av("missing stream %s for message type %s",r,iv[n]);const s=null!==(t=this._init.maxStreamBufferSize)&&void 0!==t?t:4194304;switch(n){case rv.MESSAGE_INITIATOR:case rv.MESSAGE_RECEIVER:if(o.sourceReadableLength()>s){this._source.push({id:e.id,type:n===rv.MESSAGE_INITIATOR?rv.RESET_RECEIVER:rv.RESET_INITIATOR});const t=new xd("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers","ERR_STREAM_INPUT_BUFFER_FULL");return void o.abort(t)}o.sourcePush(e.data);break;case rv.CLOSE_INITIATOR:case rv.CLOSE_RECEIVER:o.closeRead();break;case rv.RESET_INITIATOR:case rv.RESET_RECEIVER:o.reset();break;default:Av("unknown message type %s",n)}}}class Cv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ze(this,"protocol","/mplex/6.7.0"),Ze(this,"_init",void 0),this._init=e}createStreamMuxer(){return new Iv({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},...this._init})}}function Rv(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new Cv(e)}const Tv=Symbol.for("@libp2p/transport");var xv;function Pv(e){let t;try{t=Cn("sni").code}catch(r){return null}for(const[n,i]of e)if(n===t&&void 0!==i)return i;return null}function Dv(e){return e.some((e=>{let[t,r]=e;return t===Cn("tls").code}))}function Nv(e,t,r){const n=Ov[Cn(e).name];if(void 0===n)throw new Error("Can't interpret protocol ".concat(Cn(e).name));const i=n(t,r);return e===Cn("ip6").code?"[".concat(i,"]"):i}!function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"}(xv||(xv={}));const Ov={ip4:(e,t)=>e,ip6:(e,t)=>0===t.length?e:"[".concat(e,"]"),tcp:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return"tcp://".concat(Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t),":").concat(e)},udp:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return"udp://".concat(Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t),":").concat(e)},dnsaddr:(e,t)=>e,dns4:(e,t)=>e,dns6:(e,t)=>e,dns:(e,t)=>e,ipfs:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return"".concat(Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t),"/ipfs/").concat(e)},p2p:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return"".concat(Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t),"/p2p/").concat(e)},http:(e,t)=>{var r;const n=Dv(t),i=Pv(t);if(n&&null!==i)return"https://".concat(i);const o=n?"https://":"http://",s=t.pop();if(void 0===s)throw new Error("Unexpected end of multiaddr");let a=Nv(s[0],null!==(r=s[1])&&void 0!==r?r:"",t);return a=a.replace("tcp://",""),"".concat(o).concat(a)},tls:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t)},sni:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t)},https:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");let i=Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t);return i=i.replace("tcp://",""),"https://".concat(i)},ws:(e,t)=>{var r;const n=Dv(t),i=Pv(t);if(n&&null!==i)return"wss://".concat(i);const o=n?"wss://":"ws://",s=t.pop();if(void 0===s)throw new Error("Unexpected end of multiaddr");let a=Nv(s[0],null!==(r=s[1])&&void 0!==r?r:"",t);return a=a.replace("tcp://",""),"".concat(o).concat(a)},wss:(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");let i=Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t);return i=i.replace("tcp://",""),"wss://".concat(i)},"p2p-websocket-star":(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return"".concat(Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t),"/p2p-websocket-star")},"p2p-webrtc-star":(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return"".concat(Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t),"/p2p-webrtc-star")},"p2p-webrtc-direct":(e,t)=>{var r;const n=t.pop();if(void 0===n)throw new Error("Unexpected end of multiaddr");return"".concat(Nv(n[0],null!==(r=n[1])&&void 0!==r?r:"",t),"/p2p-webrtc-direct")}};const Lv=async e=>{if(e.readyState>=2)throw new Error("socket closed");1!==e.readyState&&await new Promise(((t,r)=>{function n(){e.removeEventListener("open",i),e.removeEventListener("error",o)}function i(){n(),t()}function o(t){var i;n(),r(null!==(i=t.error)&&void 0!==i?i:new Error("connect ECONNREFUSED ".concat(e.url)))}e.addEventListener("open",i),e.addEventListener("error",o)}))},Bv=(e,t)=>{var r;(t=null!==(r=t)&&void 0!==r?r:{}).closeOnEnd=!1!==t.closeOnEnd;return async r=>{for await(const t of r){try{await Lv(e)}catch(n){if("socket closed"===n.message)break;throw n}if(e.readyState===e.CLOSING||e.readyState===e.CLOSED)break;e.send(t)}null!=t.closeOnEnd&&e.readyState<=1&&await new Promise(((t,r)=>{e.addEventListener("close",(e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});r(t)}})),setTimeout((()=>{e.close()}))}))}};var Mv=__webpack_require__(3394);new Uint8Array(0);function Uv(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}var Fv=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const jv=Fv;class zv{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class qv{constructor(e,t,r){if(Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseDecode",void 0),Ze(this,"prefixCodePoint",void 0),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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Vv(this,e)}}class Kv{constructor(e){Ze(this,"decoders",void 0),this.decoders=e}or(e){return Vv(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}function Vv(e,t){var r,n;return new Kv({...null!==(r=e.decoders)&&void 0!==r?r:{[e.prefix]:e},...null!==(n=t.decoders)&&void 0!==n?n:{[t.prefix]:t}})}class Hv{constructor(e,t,r,n){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),Ze(this,"baseDecode",void 0),Ze(this,"encoder",void 0),Ze(this,"decoder",void 0),this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new zv(e,t,r),this.decoder=new qv(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}function Wv(e){let{name:t,prefix:r,encode:n,decode:i}=e;return new Hv(t,r,n,i)}function Gv(e){let{name:t,prefix:r,alphabet:n}=e;const{encode:i,decode:o}=jv(n,t);return Wv({prefix:r,name:t,encode:i,decode:e=>Uv(o(e))})}function Yv(e){let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return Wv({prefix:r,name:t,encode:e=>function(e,t,r){const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(0!==s&&(o+=t[i&a<<r-s]),n)for(;0!==(o.length*r&7);)o+="=";return o}(e,i,n),decode:e=>function(e,t,r,n){const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||0!==(255&c<<8-a))throw new SyntaxError("Unexpected end of data");return s}(e,i,n,t)})}const Qv=Gv({prefix:"9",name:"base10",alphabet:"0123456789"}),Xv=Yv({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Jv=Yv({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),$v=Yv({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Zv=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),eb=Zv.reduce(((e,t,r)=>(e[r]=t,e)),[]),tb=Zv.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const rb=Wv({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=eb[t]),"")},decode:function(e){const t=[];for(const r of e){const e=tb[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),nb=Yv({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ib=Yv({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ob=Yv({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sb=Yv({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ab=Yv({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cb=Yv({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lb=Yv({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ub=Yv({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hb=Yv({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),db=Gv({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fb=Gv({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),pb=Gv({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),gb=Gv({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),yb=Yv({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),mb=Yv({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vb=Yv({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),bb=Yv({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),wb=Yv({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Eb=Wv({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)}),_b=new TextEncoder,Sb=new TextDecoder,Ab="json",kb=512;function Ib(e){return _b.encode(JSON.stringify(e))}function Cb(e){return JSON.parse(Sb.decode(e))}const Rb="raw",Tb=85;function xb(e){return Uv(e)}function Pb(e){return Uv(e)}var Db=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=Lb;)r[n++]=255&t|Nb,t/=128;for(;t&Ob;)r[n++]=255&t|Nb,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},Nb=128,Ob=-128,Lb=Math.pow(2,31);var Bb=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&Ub)<<o:(n&Ub)*Math.pow(2,o),o+=7}while(n>=Mb);return e.bytes=s-r,i},Mb=128,Ub=127;var Fb=Math.pow(2,7),jb=Math.pow(2,14),zb=Math.pow(2,21),qb=Math.pow(2,28),Kb=Math.pow(2,35),Vb=Math.pow(2,42),Hb=Math.pow(2,49),Wb=Math.pow(2,56),Gb=Math.pow(2,63);const Yb={encode:Db,decode:Bb,encodingLength:function(e){return e<Fb?1:e<jb?2:e<zb?3:e<qb?4:e<Kb?5:e<Vb?6:e<Hb?7:e<Wb?8:e<Gb?9:10}};function Qb(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Yb.encode(e,t,r),t}function Xb(e){return Yb.encodingLength(e)}function Jb(e,t){const r=t.byteLength,n=Xb(e),i=n+Xb(r),o=new Uint8Array(i+r);return Qb(e,o,0),Qb(r,o,n),o.set(t,i),new $b(e,r,t,o)}class $b{constructor(e,t,r,n){Ze(this,"code",void 0),Ze(this,"size",void 0),Ze(this,"digest",void 0),Ze(this,"bytes",void 0),this.code=e,this.size=t,this.digest=r,this.bytes=n}}const Zb=Uv;const ew={code:0,name:"identity",encode:Zb,digest:function(e){return Jb(0,Zb(e))}};function tw(e){let{name:t,code:r,encode:n}=e;return new rw(t,r,n)}class rw{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"code",void 0),Ze(this,"encode",void 0),this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Jb(this.code,t):t.then((e=>Jb(this.code,e)))}throw Error("Unknown type, must be binary type")}}function nw(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}const iw=tw({name:"sha2-256",code:18,encode:nw("SHA-256")}),ow=tw({name:"sha2-512",code:19,encode:nw("SHA-512")});new WeakMap;Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const sw={...pe,...ae,...fe,...oe,...se,...le,...ue,...he,...de,...ce};function aw(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const cw=aw("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),lw=aw("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=function(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),uw={utf8:cw,"utf-8":cw,hex:sw.base16,latin1:lw,ascii:lw,binary:lw,...sw};function hw(e){var t;return e instanceof ArrayBuffer||"ArrayBuffer"===(null===e||void 0===e||null===(t=e.constructor)||void 0===t?void 0:t.name)&&"number"===typeof(null===e||void 0===e?void 0:e.byteLength)}const dw=e=>{e.binaryType="arraybuffer";const t=async()=>{await new Promise(((t,r)=>{if(i)return void t();if(null!=n)return void r(n);const o=t=>{e.removeEventListener("open",s),e.removeEventListener("error",a),t()},s=()=>{o(t)},a=t=>{o((()=>{var n;r(null!==(n=t.error)&&void 0!==n?n:new Error("connect ECONNREFUSED ".concat(e.url)))}))};e.addEventListener("open",s),e.addEventListener("error",a)}))},r=async function*(){const r=new Mv.PP((t=>{let{push:r,stop:n,fail:i}=t;const o=e=>{let t=null;"string"===typeof e.data&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=uw[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.decoder.decode("".concat(r.prefix).concat(e))}(e.data)),hw(e.data)&&(t=new Uint8Array(e.data)),e.data instanceof Uint8Array&&(t=e.data),null!=t&&r(t)},s=e=>{var t;i(null!==(t=e.error)&&void 0!==t?t:new Error("Socket error"))};return e.addEventListener("message",o),e.addEventListener("error",s),e.addEventListener("close",n),()=>{e.removeEventListener("message",o),e.removeEventListener("error",s),e.removeEventListener("close",n)}}),{highWaterMark:1/0});await t();for await(const e of r)yield hw(e)?new Uint8Array(e):e}();let n,i=1===e.readyState;return e.addEventListener("open",(()=>{i=!0,n=null})),e.addEventListener("close",(()=>{i=!1,n=null})),e.addEventListener("error",(t=>{var r;i||(n=null!==(r=t.error)&&void 0!==r?r:new Error("connect ECONNREFUSED ".concat(e.url)))})),Object.assign(r,{connected:t})},fw=WebSocket,pw={"http:":"ws:","https:":"wss:"};function gw(e,t){var r;t=null!==(r=t)&&void 0!==r?r:{};const n=((e,t)=>{var r;if(e.startsWith("//")&&(e="".concat(null!==(r=null===t||void 0===t?void 0:t.protocol)&&void 0!==r?r:"ws:").concat(e)),e.startsWith("/")&&null!=t){var n;const r=null!==(n=t.protocol)&&void 0!==n?n:"ws:",i=t.host,o=null!=t.port&&!0!==(null===i||void 0===i?void 0:i.endsWith(":".concat(t.port)))?":".concat(t.port):"";e="".concat(r,"//").concat(i).concat(o).concat(e)}const i=new URL(e);for(const[o,s]of Object.entries(pw))i.protocol===o&&(i.protocol=s);return i})(e,"undefined"===typeof window?void 0:window.location);return((e,t)=>{var r;t=null!==(r=t)&&void 0!==r?r:{};const n=dw(e);let i=t.remoteAddress,o=t.remotePort;if(null!=e.url)try{const t=new URL(e.url);i=t.hostname,o=parseInt(t.port,10)}catch{}if(null==i||null==o)throw new Error("Remote connection did not have address and/or port");return{sink:Bv(e,t),source:n,connected:async()=>{await n.connected()},close:async()=>{e.readyState!==e.CONNECTING&&e.readyState!==e.OPEN||await new Promise((t=>{e.addEventListener("close",(()=>{t()})),e.close()}))},destroy:()=>{null!=e.terminate?e.terminate():e.close()},remoteAddress:i,remotePort:o,socket:e}})(new fw(n.toString(),t.websocket),t)}var yw=__webpack_require__(9152);const mw="object"===typeof window&&"object"===typeof document&&9===document.nodeType,vw=yw(),bw=mw&&!vw,ww=vw&&!mw,Ew=vw&&mw,_w="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.release&&"node"===globalThis.process.release.name&&!vw,Sw="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,Aw=("undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.env&&globalThis.process.env.NODE_ENV,"undefined"!==typeof navigator&&"ReactNative"===navigator.product),kw=tE("dns4"),Iw=tE("dns6"),Cw=tE("dnsaddr"),Rw=eE(tE("dns"),Cw,kw,Iw),Tw=eE(tE("ip4"),tE("ip6")),xw=eE(Zw(Tw,tE("tcp")),Zw(Rw,tE("tcp"))),Pw=Zw(Tw,tE("udp")),Dw=Zw(Pw,tE("utp")),Nw=Zw(Pw,tE("quic")),Ow=Zw(Pw,tE("quic-v1")),Lw=eE(Zw(xw,tE("ws")),Zw(Rw,tE("ws"))),Bw=eE(Zw(Lw,tE("p2p")),Lw),Mw=eE(Zw(xw,tE("wss")),Zw(Rw,tE("wss")),Zw(xw,tE("tls"),tE("ws")),Zw(Rw,tE("tls"),tE("ws"))),Uw=eE(Zw(Mw,tE("p2p")),Mw),Fw=eE(Zw(xw,tE("http")),Zw(Tw,tE("http")),Zw(Rw,tE("http"))),jw=eE(Zw(xw,tE("https")),Zw(Tw,tE("https")),Zw(Rw,tE("https"))),zw=Zw(Pw,tE("webrtc-direct"),tE("certhash")),qw=eE(Zw(zw,tE("p2p")),zw),Kw=Zw(Ow,tE("webtransport"),tE("certhash"),tE("certhash")),Vw=eE(Zw(Kw,tE("p2p")),Kw),Hw=eE(Zw(Bw,tE("p2p-webrtc-star"),tE("p2p")),Zw(Uw,tE("p2p-webrtc-star"),tE("p2p")),Zw(Bw,tE("p2p-webrtc-star")),Zw(Uw,tE("p2p-webrtc-star"))),Ww=(eE(Zw(Bw,tE("p2p-websocket-star"),tE("p2p")),Zw(Uw,tE("p2p-websocket-star"),tE("p2p")),Zw(Bw,tE("p2p-websocket-star")),Zw(Uw,tE("p2p-websocket-star"))),eE(Zw(Fw,tE("p2p-webrtc-direct"),tE("p2p")),Zw(jw,tE("p2p-webrtc-direct"),tE("p2p")),Zw(Fw,tE("p2p-webrtc-direct")),Zw(jw,tE("p2p-webrtc-direct")))),Gw=eE(Lw,Mw,Fw,jw,Hw,Ww,xw,Dw,Nw,Rw,qw,Vw),Yw=(eE(Zw(Gw,tE("p2p-stardust"),tE("p2p")),Zw(Gw,tE("p2p-stardust"))),eE(Zw(Gw,tE("p2p")),Hw,Ww,qw,Vw,tE("p2p"))),Qw=eE(Zw(Yw,tE("p2p-circuit"),Yw),Zw(Yw,tE("p2p-circuit")),Zw(tE("p2p-circuit"),Yw),Zw(Gw,tE("p2p-circuit")),Zw(tE("p2p-circuit"),Gw),tE("p2p-circuit")),Xw=()=>eE(Zw(Qw,Xw),Qw),Jw=Xw();eE(Zw(Jw,Yw,Jw),Zw(Yw,Jw),Zw(Jw,Yw),Jw,Yw),eE(Zw(Jw,tE("webrtc"),tE("p2p")),Zw(Jw,tE("webrtc")),Zw(Gw,tE("webrtc"),tE("p2p")),Zw(Gw,tE("webrtc")),tE("webrtc"));function $w(e){return function(t){let r;try{r=ei(t)}catch(i){return!1}const n=e(r.protoNames());return null!==n&&(!0===n||!1===n?n:0===n.length)}}function Zw(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){if(e.length<t.length)return null;let r=e;return t.some((t=>(r="function"===typeof t?t().partialMatch(e):t.partialMatch(e),Array.isArray(r)&&(e=r),null===r))),r}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:$w(n),partialMatch:n}}function eE(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){let r=null;return t.some((t=>{const n="function"===typeof t?t().partialMatch(e):t.partialMatch(e);return null!=n&&(r=n,!0)})),r}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:$w(n),partialMatch:n}}function tE(e){const t=e;return{toString:function(){return t},matches:function(e){let r;try{r=ei(e)}catch(i){return!1}const n=r.protoNames();return 1===n.length&&n[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}const rE=421,nE=290;function iE(e){return e.filter((e=>{if(e.protoCodes().includes(nE))return!1;const t=e.decapsulateCode(rE);return Bw.matches(t)||Uw.matches(t)}))}class oE extends Error{constructor(e){super(e),this.name="TimeoutError"}}class sE extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const aE=e=>void 0===globalThis.DOMException?new sE(e):new DOMException(e),cE=e=>{const t=void 0===e.reason?aE("This operation was aborted."):e.reason;return t instanceof Error?t:aE(t)};function lE(e,t){const{milliseconds:r,fallback:n,message:i,customTimers:o={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let s;const a=new Promise(((a,c)=>{if("number"!==typeof r||1!==Math.sign(r))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(r,"`"));if(t.signal){const{signal:e}=t;e.aborted&&c(cE(e)),e.addEventListener("abort",(()=>{c(cE(e))}))}if(r===Number.POSITIVE_INFINITY)return void e.then(a,c);const l=new oE;s=o.setTimeout.call(void 0,(()=>{if(n)try{a(n())}catch(t){c(t)}else"function"===typeof e.cancel&&e.cancel(),!1===i?a():i instanceof Error?c(i):(l.message=null!==i&&void 0!==i?i:"Promise timed out after ".concat(r," milliseconds"),c(l))}),r),(async()=>{try{a(await e)}catch(t){c(t)}})()})).finally((()=>{a.clear()}));return a.clear=()=>{o.clearTimeout.call(void 0,s),s=void 0},a}const uE=jm("libp2p:websockets:socket");const hE=jm("libp2p:websockets");class dE{constructor(e){Ze(this,"init",void 0),Ze(this,Symbol.toStringTag,"@libp2p/websockets"),Ze(this,Tv,!0),this.init=e}async dial(e,t){var r;hE("dialing %s",e),t=null!==(r=t)&&void 0!==r?r:{};const n=function(e,t,r){var n;const i={async sink(t){var n;null!=(null===(n=r)||void 0===n?void 0:n.signal)&&(t=$m(t,r.signal));try{await e.sink(t)}catch(i){"aborted"!==i.type&&uE.error(i)}},source:null!=(r=null!==(n=r)&&void 0!==n?n:{}).signal?$m(e.source,r.signal):e.source,remoteAddr:t,timeline:{open:Date.now()},async close(){const t=Date.now();try{await lE(e.close(),{milliseconds:2e3})}catch(r){const{host:n,port:o}=i.remoteAddr.toOptions();uE("timeout closing stream to %s:%s after %dms, destroying it manually",n,o,Date.now()-t),e.destroy()}finally{i.timeline.close=Date.now()}}};return e.socket.addEventListener("close",(()=>{null==i.timeline.close&&(i.timeline.close=Date.now())}),{once:!0}),i}(await this._connect(e,t),e);hE("new outbound connection %s",n.remoteAddr);const i=await t.upgrader.upgradeOutbound(n);return hE("outbound connection %s upgraded",n.remoteAddr),i}async _connect(e,t){var r;if(!0===(null===t||void 0===t||null===(r=t.signal)||void 0===r?void 0:r.aborted))throw new Td;const n=e.toOptions();hE("dialing %s:%s",n.host,n.port);const i=Da(),o=e=>{hE.error("connection error:",e),i.reject(e)},s=gw(function(e,t){var r;const n=ei(e).stringTuples(),i=n.pop();if(void 0===i)throw new Error("Unexpected end of multiaddr");const o=Cn(i[0]),s=Ov[o.name];if(null==s)throw new Error("No interpreter found for ".concat(o.name));let a=s(null!==(r=i[1])&&void 0!==r?r:"",n);return!1!==(null===t||void 0===t?void 0:t.assumeHttp)&&i[0]===Cn("tcp").code&&(a=a.replace("tcp://","http://"),"443"!==i[1]&&"80"!==i[1]||("443"===i[1]&&(a=a.replace("http://","https://")),a=a.substring(0,a.lastIndexOf(":")))),a}(e),this.init);if(null!=s.socket.on?s.socket.on("error",o):s.socket.onerror=o,null==t.signal)return await Promise.race([s.connected(),i.promise]),hE("connected %s",e),s;let a;const c=new Promise(((e,r)=>{var n,i;a=()=>{r(new Td),s.close().catch((e=>{hE.error("error closing raw socket",e)}))},!0!==(null===t||void 0===t||null===(n=t.signal)||void 0===n?void 0:n.aborted)?null===t||void 0===t||null===(i=t.signal)||void 0===i||i.addEventListener("abort",a):a()}));try{await Promise.race([c,i.promise,s.connected()])}finally{var l;if(null!=a)null===t||void 0===t||null===(l=t.signal)||void 0===l||l.removeEventListener("abort",a)}return hE("connected %s",e),s}createListener(e){return function(){throw new Error("WebSocket Servers can not be created in the browser!")}(this.init)}filter(e){var t,r;return e=Array.isArray(e)?e:[e],null!=(null===(t=this.init)||void 0===t?void 0:t.filter)?null===(r=this.init)||void 0===r?void 0:r.filter(e):bw||Sw?function(e){return e.filter((e=>{if(e.protoCodes().includes(nE))return!1;const t=e.decapsulateCode(rE);return Uw.matches(t)}))}(e):iE(e)}}function fE(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new dE(e)}const pE=Symbol.for("@libp2p/peer-discovery");var gE=__webpack_require__(7674);function yE(e){return new Uint8Array(gE.keccak256.arrayBuffer(e))}function mE(e,t,r){try{return ty(Eg.fromCompact(e.slice(0,64)),t,r)}catch{return!1}}const vE="Invalid record id";function bE(e,t){switch(t){case"udp":return bE(e,"udp4")||bE(e,"udp6");case"tcp":return bE(e,"tcp4")||bE(e,"tcp6")}const r=t.endsWith("6"),n=e.get(r?"ip6":"ip");if(!n)return;const i=t.slice(0,3);let o;switch(i){case"udp":o=r?e.get("udp6"):e.get("udp");break;case"tcp":o=r?e.get("tcp6"):e.get("tcp");break;default:return}return o?function(e,t,r,n){let i=ei("/"+e+"/"+Rn(e,r));return i=i.encapsulate(ei("/"+t+"/"+Rn(t,n))),i}(r?"ip6":"ip4",i,n,o):void 0}function wE(e){const t=e.reduce(((e,t)=>e+2+t.bytes.length),0),r=new Uint8Array(t),n=new DataView(r.buffer);let i=0;return e.forEach((e=>{if(e.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");n.setUint16(i,e.bytes.length),i+=2,r.set(e.bytes,i),i+=e.bytes.length})),r}function EE(e){let t=0;return e.lightPush&&(t+=1),t<<=1,e.filter&&(t+=1),t<<=1,e.store&&(t+=1),t<<=1,e.relay&&(t+=1),t}class _E extends Map{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:BigInt(1),r=arguments.length>2?arguments[2]:void 0;super(Object.entries(e)),Ze(this,"seq",void 0),Ze(this,"signature",void 0),this.seq=t,this.signature=r}set(e,t){return this.signature=void 0,this.seq++,super.set(e,t)}get id(){const e=this.get("id");if(!e)throw new Error("id not found.");return Il(e)}get publicKey(){if("v4"===this.id)return this.get("secp256k1");throw new Error(vE)}get ip(){return SE(this,"ip","ip4")}set ip(e){kE(this,"ip","ip4",e)}get tcp(){return AE(this,"tcp","tcp")}set tcp(e){IE(this,"tcp","tcp",e)}get udp(){return AE(this,"udp","udp")}set udp(e){IE(this,"udp","udp",e)}get ip6(){return SE(this,"ip6","ip6")}set ip6(e){kE(this,"ip6","ip6",e)}get tcp6(){return AE(this,"tcp6","tcp")}set tcp6(e){IE(this,"tcp6","tcp",e)}get udp6(){return AE(this,"udp6","udp")}set udp6(e){IE(this,"udp6","udp",e)}get multiaddrs(){const e=this.get("multiaddrs");if(e)return function(e){const t=[];let r=0;for(;r<e.length;){const n=new DataView(e.buffer,r,2).getUint16(0);r+=2;const i=e.slice(r,r+n);r+=n,t.push(ei(i))}return t}(e)}set multiaddrs(e){CE(this,"multiaddrs",e,wE)}get waku2(){const e=this.get("waku2");if(e)return function(e){const t={relay:!1,store:!1,filter:!1,lightPush:!1};return e%2&&(t.relay=!0),(e>>=1)%2&&(t.store=!0),(e>>=1)%2&&(t.filter=!0),(e>>=1)%2&&(t.lightPush=!0),t}(e[0])}set waku2(e){CE(this,"waku2",e,(e=>new Uint8Array([EE(e)])))}}function SE(e,t,r){const n=e.get(t);if(n)return Rn(r,n)}function AE(e,t,r){const n=e.get(t);if(n)return Number(Rn(r,n))}function kE(e,t,r,n){CE(e,t,n,Tn.bind({},r))}function IE(e,t,r,n){kE(e,t,r,null===n||void 0===n?void 0:n.toString(10))}function CE(e,t,r,n){void 0!==r?e.set(t,n(r)):e.delete(t)}const RE=ai("waku:enr");var TE,xE;!function(e){e.TCP="tcp",e.UDP="udp"}(TE||(TE={})),function(e){e.TCP4="tcp4",e.UDP4="udp4",e.TCP6="tcp6",e.UDP6="udp6"}(xE||(xE={}));class PE extends _E{constructor(){super(...arguments),Ze(this,"peerId",void 0),Ze(this,"getLocationMultiaddr",bE.bind({},this))}static async create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:BigInt(1);const r=new PE(e,t,arguments.length>2?arguments[2]:void 0);try{const e=r.publicKey;e&&(r.peerId=await function(e){return Pm(new Sy.secp256k1.Secp256k1PublicKey(e).bytes,void 0)}(e))}catch(n){RE("Could not calculate peer id for ENR",n)}return r}get nodeId(){if("v4"===this.id)return this.publicKey?function(e){const t=vg.fromHex(e).toRawBytes(!1);return kl(yE(t.slice(1)))}(this.publicKey):void 0;throw new Error(vE)}setLocationMultiaddr(e){const t=e.protoNames();if(2!==t.length&&"udp"!==t[1]&&"tcp"!==t[1])throw new Error("Invalid multiaddr");const r=e.tuples();if(!r[0][1]||!r[1][1])throw new Error("Invalid multiaddr");4===r[0][0]?(this.set("ip",r[0][1]),this.set(t[1],r[1][1])):(this.set("ip6",r[0][1]),this.set(t[1]+"6",r[1][1]))}getAllLocationMultiaddrs(){var e;const t=[];for(const n of Object.values(xE)){const e=this.getLocationMultiaddr(n);e&&t.push(e)}const r=null!==(e=this.multiaddrs)&&void 0!==e?e:[];return t.concat(r)}get peerInfo(){const e=this.peerId;if(e)return{id:e,multiaddrs:this.getAllLocationMultiaddrs(),protocols:[]}}getFullMultiaddr(e){if(this.peerId){const t=this.getLocationMultiaddr(e);if(t)return t.encapsulate("/p2p/".concat(this.peerId.toString()))}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){const e=this.peerId;return this.multiaddrs.map((t=>t.encapsulate("/p2p/".concat(e.toString()))))}return[]}verify(e,t){if(!this.get("id")||"v4"!==this.id)throw new Error(vE);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return mE(t,yE(e),this.publicKey)}async sign(e,t){if("v4"!==this.id)throw new Error(vE);return this.signature=await async function(e,t){return Zg(yE(t),e,{der:!1})}(t,e),this.signature}}Ze(PE,"RECORD_PREFIX","enr:");let DE=!1,NE=!1;const OE={debug:1,default:2,info:2,warning:3,error:4,off:5};let LE=OE.default,BE=null;const ME=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var UE,FE;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(UE||(UE={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(FE||(FE={}));const jE="0123456789abcdef";class zE{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==OE[r]&&this.throwArgumentError("invalid log level name","logLevel",e),LE>OE[r]||console.log.apply(console,t)}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(zE.levels.DEBUG,t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(zE.levels.INFO,t)}warn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(zE.levels.WARNING,t)}makeError(e,t,r){if(NE)return this.makeError("censored error",t,{});t||(t=zE.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=jE[t[e]>>4],r+=jE[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(s){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push("code=".concat(t)),n.push("version=".concat(this.version));const i=e;let o="";switch(t){case FE.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case FE.CALL_EXCEPTION:case FE.INSUFFICIENT_FUNDS:case FE.MISSING_NEW:case FE.NONCE_EXPIRED:case FE.REPLACEMENT_UNDERPRICED:case FE.TRANSACTION_REPLACED:case FE.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const s=new Error(e);return s.reason=i,s.code=t,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,zE.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),ME&&this.throwError("platform missing String.prototype.normalize",zE.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ME})}checkSafeUint53(e,t){"number"===typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,zE.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,zE.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,zE.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,zE.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",zE.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",zE.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",zE.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return BE||(BE=new zE("logger/5.7.0")),BE}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",zE.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),DE){if(!e)return;this.globalLogger().throwError("error censorship permanent",zE.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}NE=!!e,DE=!!t}static setLogLevel(e){const t=OE[e.toLowerCase()];null!=t?LE=t:zE.globalLogger().warn("invalid log level - "+e)}static from(e){return new zE(e)}}zE.errors=FE,zE.levels=UE;const qE=new zE("bytes/5.7.0");function KE(e){return!!e.toHexString}function VE(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return VE(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function HE(e){return QE(e)&&!(e.length%2)||GE(e)}function WE(e){return"number"===typeof e&&e==e&&e%1===0}function GE(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!WE(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!WE(r)||r<0||r>=256)return!1}return!0}function YE(e,t){if(t||(t={}),"number"===typeof e){qE.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),VE(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),KE(e)&&(e=e.toHexString()),QE(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":qE.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return VE(new Uint8Array(n))}return GE(e)?VE(new Uint8Array(e)):qE.throwArgumentError("invalid arrayify value","value",e)}function QE(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const XE="0123456789abcdef";function JE(e,t){if(t||(t={}),"number"===typeof e){qE.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=XE[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),KE(e))return e.toHexString();if(QE(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":qE.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(GE(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=XE[(240&n)>>4]+XE[15&n]}return t}return qE.throwArgumentError("invalid hexlify value","value",e)}const $E=new zE("rlp/5.7.0");function ZE(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function e_(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function t_(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(t_(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=ZE(t.length);return r.unshift(247+r.length),r.concat(t)}HE(e)||$E.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(YE(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=ZE(t.length);return r.unshift(183+r.length),r.concat(t)}function r_(e){return JE(t_(e))}function n_(e,t,r,n){const i=[];for(;r<t+1+n;){const o=i_(e,r);i.push(o.result),(r+=o.consumed)>t+1+n&&$E.throwError("child data too short",zE.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function i_(e,t){if(0===e.length&&$E.throwError("data too short",zE.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&$E.throwError("data short segment too short",zE.errors.BUFFER_OVERRUN,{});const n=e_(e,t+1,r);return t+1+r+n>e.length&&$E.throwError("data long segment too short",zE.errors.BUFFER_OVERRUN,{}),n_(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&$E.throwError("data array too short",zE.errors.BUFFER_OVERRUN,{}),n_(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&$E.throwError("data array too short",zE.errors.BUFFER_OVERRUN,{});const n=e_(e,t+1,r);t+1+r+n>e.length&&$E.throwError("data array too short",zE.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:JE(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&$E.throwError("data too short",zE.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:JE(e.slice(t+1,t+1+r))}}return{consumed:1,result:JE(e[t])}}class o_{static fromString(e){if(!e.startsWith(PE.RECORD_PREFIX))throw new Error("\"string encoded ENR must start with '".concat(PE.RECORD_PREFIX,"'"));return o_.fromRLP(_l(e.slice(4),"base64url"))}static fromRLP(e){const t=function(e){const t=YE(e),r=i_(t,0);return r.consumed!==t.length&&$E.throwArgumentError("invalid rlp data","data",e),r.result}(e).map(Al);return async function(e){const{signature:t,seq:r,kvs:n}=function(e){if(!Array.isArray(e))throw new Error("Decoded ENR must be an array");if(e.length%2!==0)throw new Error("Decoded ENR must have an even number of elements");const[t,r,...n]=e;if(!t||Array.isArray(t))throw new Error("Decoded ENR invalid signature: must be a byte array");if(!r||Array.isArray(r))throw new Error("Decoded ENR invalid sequence number: must be a byte array");return{signature:t,seq:r,kvs:n}}(e),i={};for(let c=0;c<n.length;c+=2)try{i[Il(n[c])]=n[c+1]}catch(a){(0,ai.log)("Failed to decode ENR key to UTF-8, skipping it",n[c],a)}const o=function(e){return e.length?BigInt("0x"+kl(e)):BigInt(0)}(r),s=await PE.create(i,o,t);return function(e,t,r,n){const i=Al(r_([e,...t]));if(!r.verify(i,n))throw new Error("Unable to verify ENR signature")}(r,n,s,t),s}(t)}}const s_=/^(\d{1,3}\.){3,3}\d{1,3}$/,a_=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,c_={name:"v4",size:4,isFormat:e=>s_.test(e),encode(e,t,r){r=~~r,t=t||new Uint8Array(r+4);const n=e.length;let i=0;for(let o=0;o<n;){const n=e.charCodeAt(o++);46===n?(t[r++]=i,i=0):i=10*i+(n-48)}return t[r]=i,t},decode:(e,t)=>(t=~~t,"".concat(e[t++],".").concat(e[t++],".").concat(e[t++],".").concat(e[t]))},l_={name:"v6",size:16,isFormat:e=>e.length>0&&a_.test(e),encode(e,t,r){let n=(r=~~r)+16,i=-1,o=0,s=0,a=!0,c=!1;t=t||new Uint8Array(r+16);for(let l=0;l<e.length;l++){let u=e.charCodeAt(l);58===u?(a?-1!==i?(r<n&&(t[r]=0),r<n-1&&(t[r+1]=0),r+=2):r<n&&(i=r):(!0===c?(r<n&&(t[r]=s),r++):(r<n&&(t[r]=o>>8),r<n-1&&(t[r+1]=255&o),r+=2),o=0,s=0),a=!0,c=!1):46===u?(r<n&&(t[r]=s),r++,s=0,o=0,a=!1,c=!0):(a=!1,u>=97?u-=87:u>=65?u-=55:(u-=48,s=10*s+u),o=(o<<4)+u)}if(!1===a)!0===c?(r<n&&(t[r]=s),r++):(r<n&&(t[r]=o>>8),r<n-1&&(t[r+1]=255&o),r+=2);else if(0===i)r<n&&(t[r]=0),r<n-1&&(t[r+1]=0),r+=2;else if(-1!==i){r+=2;for(let e=Math.min(r-1,n-1);e>=i+2;e--)t[e]=t[e-2];t[i]=0,t[i+1]=0,i=r}if(i!==r&&-1!==i)for(r>n-2&&(r=n-2);n>i;)t[--n]=r<n&&r>i?t[--r]:0;else for(;r<n;)t[r++]=0;return t},decode(e,t){t=~~t;let r="";for(let n=0;n<16;n+=2)0!==n&&(r+=":"),r+=(e[t+n]<<8|e[t+n+1]).toString(16);return r.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};function u_(e){if(c_.isFormat(e))return c_.size;if(l_.isFormat(e))return l_.size;throw Error("Invalid ip address: ".concat(e))}function h_(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e}function d_(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}function f_(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e}function p_(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e}function g_(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e}function y_(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}function m_(e){if("number"===typeof e)return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}const t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}const v_=55296,b_=56320;function w_(e){let t=0;const r=e.length;for(let n=0;n<r;n+=1){const i=e.charCodeAt(n);if(i<=127)t+=1;else if(i<=2047)t+=2;else if((63488&i)!==v_)t+=3;else{const o=n+1;if(o===r||i>=b_)t+=3;else{(64512&e.charCodeAt(o))!==b_?t+=3:(n=o,t+=4)}}}return t}function E_(e,t,r){const n=e.length;void 0!==r&&null!==r||(r=0),void 0===t&&(t=new Uint8Array(w_(e)+r));let i=r;for(let o=0;o<n;o+=1){let r=e.charCodeAt(o);if(r<=127)t[i++]=r;else if(r<=2047)t[i++]=192|(1984&r)>>6,t[i++]=128|63&r;else if((63488&r)!==v_)t[i++]=224|(61440&r)>>12,t[i++]=128|(4032&r)>>6,t[i++]=128|63&r;else{const s=o+1;if(s===n||r>=b_)t[i++]=239,t[i++]=191,t[i++]=189;else{const n=e.charCodeAt(s);(64512&n)!==b_?(t[i++]=239,t[i++]=191,t[i++]=189):(o=s,r=65536|(1023&r)<<10|1023&n,t[i++]=240|(1835008&r)>>18,t[i++]=128|(258048&r)>>12,t[i++]=128|(4032&r)>>6,t[i++]=128|63&r)}}}return E_.bytes=i-r,t}function __(e,t,r){let n="";void 0!==t&&null!==t||(t=0),void 0!==r&&null!==r||(r=e.length);for(let i=t;i<r;){const t=e[i++];let r;if(t<=128)r=t;else if(t>191&&t<224)r=(31&t)<<6|63&e[i++];else if(t>239&&t<365){r=((7&t)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536;const o=v_|r>>10&1023;n+=String.fromCharCode(o),r=b_|1023&r}else r=(15&t)<<12|(63&e[i++])<<6|63&e[i++];n+=String.fromCharCode(r)}return __.bytes=r-t,n}E_.bytes=0,__.bytes=0;const S_=e=>e instanceof Uint8Array;function A_(e){return"string"===typeof e?w_(e):e.byteLength}function k_(e){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):E_(e)}function I_(e,t,r){if("string"!==typeof t)throw new Error("unknown input type");return E_(t,e,r),E_.bytes}const C_=Math.pow(2,24),R_=Math.pow(2,16),T_=Math.pow(2,8),x_=(e,t)=>e[t]*C_+e[t+1]*R_+e[t+2]*T_+e[t+3],P_=(e,t)=>e[t]<<8|e[t+1],D_=(e,t,r)=>(t=+t,e[r+3]=t,t>>>=8,e[r+2]=t,t>>>=8,e[r+1]=t,t>>>=8,e[r]=t,r+4),N_=(e,t,r)=>(e[r]=t>>8,e[r+1]=255&t,r+2);function O_(e,t,r,n,i){return r<0&&(n-=r,r=0),n<0&&(n=0),i<0?new Uint8Array(0):r>=t.length||n>=i?0:function(e,t,r,n,i){i-n>t.length-r&&(i=n+t.length-r);let o=i-n;const s=e.length-n;o>s&&(o=s);(0!==n||i<e.length)&&(e=new Uint8Array(e.buffer,e.byteOffset+n,o));return t.set(e,r),o}(e,t,r,n,i)}const L_=32768;function B_(e){let{bytes:t=0,encode:r,decode:n,encodingLength:i}=e;return r.bytes=t,n.bytes=t,{encode:r,decode:n,encodingLength:i||(()=>t)}}const M_=B_({encode(e,t,r){t||(t=new Uint8Array(M_.encodingLength(e))),r||(r=0);const n=r,i=e.replace(/^\.|\.$/gm,"");if(i.length){const e=i.split(".");for(let n=0;n<e.length;n++){const i=I_(t,e[n],r+1);t[r]=i,r+=i+1}}return t[r++]=0,M_.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=[];let n=t,i=0,o=0,s=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");const a=e[t++];if(o+=s?0:1,0===a)break;if(0===(192&a)){if(t+a>e.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=a+1,i>254)throw new Error("Cannot decode name (name too long)");r.push(__(e,t,t+a)),t+=a,o+=s?0:a}else{if(192!==(192&a))throw new Error("Cannot decode name (bad label)");{if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");const r=P_(e,t-1)-49152;if(r>=n)throw new Error("Cannot decode name (bad pointer)");t=r,n=r,o+=s?0:1,s=!0}}}return M_.decode.bytes=o,0===r.length?".":r.join(".")},encodingLength:e=>"."===e||".."===e?1:A_(e.replace(/^\.|\.$/gm,""))+2}),U_=B_({encode(e,t,r){t||(t=new Uint8Array(U_.encodingLength(e))),r||(r=0);const n=I_(t,e,r+1);return t[r]=n,U_.encode.bytes=n+1,t},decode(e,t){t||(t=0);const r=e[t],n=__(e,t+1,t+1+r);return U_.decode.bytes=r+1,n},encodingLength:e=>A_(e)+1}),F_=B_({bytes:12,encode(e,t,r){t||(t=new Uint8Array(F_.encodingLength(e))),r||(r=0);const n=32767&(e.flags||0),i="response"===e.type?32768:0;return N_(t,e.id||0,r),N_(t,n|i,r+2),N_(t,e.questions.length,r+4),N_(t,e.answers.length,r+6),N_(t,e.authorities.length,r+8),N_(t,e.additionals.length,r+10),t},decode(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const r=P_(e,t+2);return{id:P_(e,t),type:32768&r?"response":"query",flags:32767&r,flag_qr:1===(r>>15&1),opcode:p_(r>>11&15),flag_aa:1===(r>>10&1),flag_tc:1===(r>>9&1),flag_rd:1===(r>>8&1),flag_ra:1===(r>>7&1),flag_z:1===(r>>6&1),flag_ad:1===(r>>5&1),flag_cd:1===(r>>4&1),rcode:f_(15&r),questions:new Array(P_(e,t+4)),answers:new Array(P_(e,t+6)),authorities:new Array(P_(e,t+8)),additionals:new Array(P_(e,t+10))}},encodingLength:()=>12}),j_=B_({encode(e,t,r){t||(t=new Uint8Array(j_.encodingLength(e))),r||(r=0);const n=e.length;return N_(t,n,r),O_(e,t,r+2,0,n),j_.encode.bytes=n+2,t},decode(e,t){t||(t=0);const r=P_(e,t),n=e.slice(t+2,t+2+r);return j_.decode.bytes=r+2,n},encodingLength:e=>e.length+2}),z_=B_({encode:(e,t,r)=>(t||(t=new Uint8Array(z_.encodingLength(e))),r||(r=0),M_.encode(e,t,r+2),N_(t,M_.encode.bytes,r),z_.encode.bytes=M_.encode.bytes+2,t),decode(e,t){t||(t=0);const r=P_(e,t),n=M_.decode(e,t+2);return z_.decode.bytes=r+2,n},encodingLength:e=>M_.encodingLength(e)+2}),q_=B_({encode(e,t,r){t||(t=new Uint8Array(q_.encodingLength(e))),r||(r=0);const n=r;return r+=2,M_.encode(e.mname,t,r),r+=M_.encode.bytes,M_.encode(e.rname,t,r),r+=M_.encode.bytes,D_(t,e.serial||0,r),r+=4,D_(t,e.refresh||0,r),r+=4,D_(t,e.retry||0,r),r+=4,D_(t,e.expire||0,r),r+=4,D_(t,e.minimum||0,r),N_(t,(r+=4)-n-2,n),q_.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.mname=M_.decode(e,t),t+=M_.decode.bytes,n.rname=M_.decode(e,t),t+=M_.decode.bytes,n.serial=x_(e,t),t+=4,n.refresh=x_(e,t),t+=4,n.retry=x_(e,t),t+=4,n.expire=x_(e,t),t+=4,n.minimum=x_(e,t),t+=4,q_.decode.bytes=t-r,n},encodingLength:e=>22+M_.encodingLength(e.mname)+M_.encodingLength(e.rname)}),K_=B_({encode(e,t,r){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)if("string"===typeof e[i]&&(e[i]=k_(e[i])),!S_(e[i]))throw new Error("Must be a Buffer");t||(t=new Uint8Array(K_.encodingLength(e))),r||(r=0);const n=r;return r+=2,e.forEach((function(e){t[r++]=e.length,O_(e,t,r,0,e.length),r+=e.length})),N_(t,r-n-2,n),K_.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t;let n=P_(e,t);t+=2;const i=[];for(;n>0;){const r=e[t++];if(--n,n<r)throw new Error("Buffer overflow");i.push(e.slice(t,t+r)),t+=r,n-=r}return K_.decode.bytes=t-r,i},encodingLength(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach((function(e){t+="string"===typeof e?A_(e)+1:e.length+1})),t}}),V_=B_({encode(e,t,r){t||(t=new Uint8Array(V_.encodingLength(e))),r||(r=0),"string"===typeof e&&(e=k_(e)),e||(e=new Uint8Array(0));const n=r;r+=2;const i=e.length;return O_(e,t,r,0,i),N_(t,(r+=i)-n-2,n),V_.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n=P_(e,t);t+=2;const i=e.slice(t,t+n);return t+=n,V_.decode.bytes=t-r,i},encodingLength:e=>e?(S_(e)?e.length:A_(e))+2:2}),H_=B_({encode(e,t,r){t||(t=new Uint8Array(H_.encodingLength(e))),r||(r=0);const n=r;return r+=2,U_.encode(e.cpu,t,r),r+=U_.encode.bytes,U_.encode(e.os,t,r),r+=U_.encode.bytes,N_(t,r-n-2,n),H_.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.cpu=U_.decode(e,t),t+=U_.decode.bytes,n.os=U_.decode(e,t),t+=U_.decode.bytes,H_.decode.bytes=t-r,n},encodingLength:e=>U_.encodingLength(e.cpu)+U_.encodingLength(e.os)+2}),W_=B_({encode:(e,t,r)=>(t||(t=new Uint8Array(W_.encodingLength(e))),r||(r=0),M_.encode(e,t,r+2),N_(t,M_.encode.bytes,r),W_.encode.bytes=M_.encode.bytes+2,t),decode(e,t){t||(t=0);const r=M_.decode(e,t+2);return W_.decode.bytes=M_.decode.bytes+2,r},encodingLength:e=>M_.encodingLength(e)+2}),G_=B_({encode(e,t,r){t||(t=new Uint8Array(G_.encodingLength(e))),r||(r=0),N_(t,e.priority||0,r+2),N_(t,e.weight||0,r+4),N_(t,e.port||0,r+6),M_.encode(e.target,t,r+8);const n=M_.encode.bytes+6;return N_(t,n,r),G_.encode.bytes=n+2,t},decode(e,t){t||(t=0);const r=P_(e,t),n={};return n.priority=P_(e,t+2),n.weight=P_(e,t+4),n.port=P_(e,t+6),n.target=M_.decode(e,t+8),G_.decode.bytes=r+2,n},encodingLength:e=>8+M_.encodingLength(e.target)}),Y_=B_({encode(e,t,r){const n=Y_.encodingLength(e);return t||(t=new Uint8Array(Y_.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=Y_.ISSUER_CRITICAL),N_(t,n-2,r),t[r+=2]=e.flags||0,r+=1,U_.encode(e.tag,t,r),r+=U_.encode.bytes,I_(t,e.value,r),r+=A_(e.value),Y_.encode.bytes=n,t},decode(e,t){t||(t=0);const r=P_(e,t),n=t+=2,i={};return i.flags=e[t],t+=1,i.tag=U_.decode(e,t),t+=U_.decode.bytes,i.value=__(e,t,n+r),i.issuerCritical=!!(i.flags&Y_.ISSUER_CRITICAL),Y_.decode.bytes=r+2,i},encodingLength:e=>U_.encodingLength(e.tag)+U_.encodingLength(e.value)+2});Y_.ISSUER_CRITICAL=128;const Q_=B_({encode(e,t,r){t||(t=new Uint8Array(Q_.encodingLength(e))),r||(r=0);const n=r;return r+=2,N_(t,e.preference||0,r),r+=2,M_.encode(e.exchange,t,r),r+=M_.encode.bytes,N_(t,r-n-2,n),Q_.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.preference=P_(e,t),t+=2,n.exchange=M_.decode(e,t),t+=M_.decode.bytes,Q_.decode.bytes=t-r,n},encodingLength:e=>4+M_.encodingLength(e.exchange)}),X_=B_({encode:(e,t,r)=>(t||(t=new Uint8Array(X_.encodingLength(e))),r||(r=0),N_(t,4,r),r+=2,c_.encode(e,t,r),t),decode(e,t){t||(t=0),t+=2;return c_.decode(e,t)},bytes:6}),J_=B_({encode:(e,t,r)=>(t||(t=new Uint8Array(J_.encodingLength(e))),r||(r=0),N_(t,16,r),r+=2,l_.encode(e,t,r),J_.encode.bytes=18,t),decode(e,t){t||(t=0),t+=2;const r=l_.decode(e,t);return J_.decode.bytes=18,r},bytes:18}),$_=e=>new Uint8Array(e),Z_=B_({encode(e,t,r){t||(t=new Uint8Array(Z_.encodingLength(e))),r||(r=0);const n=r,i=m_(e.code);if(N_(t,i,r),r+=2,e.data)N_(t,e.data.length,r),r+=2,O_(e.data,t,r),r+=e.data.length;else switch(i){case 8:{const n=e.sourcePrefixLength||0,i=e.family||function(e){return u_(e)===c_.size?1:2}(e.ip),o=function(e,t,r){r=~~r;const n=u_(e);return"function"===typeof t&&(t=t(r+n)),n===c_.size?c_.encode(e,t,r):l_.encode(e,t,r)}(e.ip,$_),s=Math.ceil(n/8);N_(t,s+4,r),N_(t,i,r+=2),r+=2,t[r++]=n,t[r++]=e.scopePrefixLength||0,O_(o,t,r,0,s),r+=s}break;case 11:e.timeout?(N_(t,2,r),r+=2,N_(t,e.timeout,r),r+=2):(N_(t,0,r),r+=2);break;case 12:{const n=e.length||0;N_(t,n,r),r+=2,t.fill(0,r,r+n),r+=n}break;case 14:{const n=2*e.tags.length;N_(t,n,r),r+=2;for(const i of e.tags)N_(t,i,r),r+=2}break;default:throw new Error("Unknown roption code: ".concat(e.code))}return Z_.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r={};r.code=P_(e,t),r.type=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:"OPTION_".concat(e)}(r.code);const n=P_(e,t+=2);switch(t+=2,r.data=e.slice(t,t+n),r.code){case 8:r.family=P_(e,t),t+=2,r.sourcePrefixLength=e[t++],r.scopePrefixLength=e[t++];{const i=new Uint8Array(1===r.family?4:16);O_(e,i,0,t,t+n-4),r.ip=function(e,t,r){if(t=~~t,(r=r||e.length-t)===c_.size)return c_.decode(e,t,r);if(r===l_.size)return l_.decode(e,t,r);throw Error("Invalid buffer size needs to be ".concat(c_.size," for v4 or ").concat(l_.size," for v6."))}(i)}break;case 11:n>0&&(r.timeout=P_(e,t),t+=2);break;case 14:r.tags=[];for(let i=0;i<n;i+=2)r.tags.push(P_(e,t)),t+=2}return Z_.decode.bytes=n+4,r},encodingLength(e){if(e.data)return e.data.length+4;switch(m_(e.code)){case 8:{const t=e.sourcePrefixLength||0;return Math.ceil(t/8)+8}case 11:return"number"===typeof e.timeout?6:4;case 12:return e.length+4;case 14:return 4+2*e.tags.length}throw new Error("Unknown roption code: ".concat(e.code))}}),eS=B_({encode(e,t,r){t||(t=new Uint8Array(eS.encodingLength(e))),r||(r=0);const n=r,i=bS(e,Z_);return N_(t,i,r),r=wS(e,Z_,t,r+2),eS.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n=[];let i=P_(e,t);t+=2;let o=0;for(;i>0;)n[o++]=Z_.decode(e,t),t+=Z_.decode.bytes,i-=Z_.decode.bytes;return eS.decode.bytes=t-r,n},encodingLength:e=>2+bS(e||[],Z_)}),tS=B_({encode(e,t,r){t||(t=new Uint8Array(tS.encodingLength(e))),r||(r=0);const n=r,i=e.key;if(!S_(i))throw new Error("Key must be a Buffer");return r+=2,N_(t,e.flags,r),t[r+=2]=tS.PROTOCOL_DNSSEC,t[r+=1]=e.algorithm,O_(i,t,r+=1,0,i.length),r+=i.length,tS.encode.bytes=r-n,N_(t,tS.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=P_(e,t);if(t+=2,n.flags=P_(e,t),e[t+=2]!==tS.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e[t],t+=1,n.key=e.slice(t,r+i+2),t+=n.key.length,tS.decode.bytes=t-r,n},encodingLength:e=>6+A_(e.key)});tS.PROTOCOL_DNSSEC=3,tS.ZONE_KEY=128,tS.SECURE_ENTRYPOINT=32768;const rS=B_({encode(e,t,r){t||(t=new Uint8Array(rS.encodingLength(e))),r||(r=0);const n=r,i=e.signature;if(!S_(i))throw new Error("Signature must be a Buffer");return r+=2,N_(t,d_(e.typeCovered),r),t[r+=2]=e.algorithm,t[r+=1]=e.labels,r+=1,D_(t,e.originalTTL,r),r+=4,D_(t,e.expiration,r),r+=4,D_(t,e.inception,r),r+=4,N_(t,e.keyTag,r),r+=2,M_.encode(e.signersName,t,r),O_(i,t,r+=M_.encode.bytes,0,i.length),r+=i.length,rS.encode.bytes=r-n,N_(t,rS.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=P_(e,t);return t+=2,n.typeCovered=h_(P_(e,t)),t+=2,n.algorithm=e[t],t+=1,n.labels=e[t],t+=1,n.originalTTL=x_(e,t),t+=4,n.expiration=x_(e,t),t+=4,n.inception=x_(e,t),t+=4,n.keyTag=P_(e,t),t+=2,n.signersName=M_.decode(e,t),t+=M_.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,rS.decode.bytes=t-r,n},encodingLength:e=>20+M_.encodingLength(e.signersName)+A_(e.signature)}),nS=B_({encode(e,t,r){t||(t=new Uint8Array(nS.encodingLength(e))),r||(r=0);const n=r;return r+=2,M_.encode(e.mbox||".",t,r),r+=M_.encode.bytes,M_.encode(e.txt||".",t,r),r+=M_.encode.bytes,nS.encode.bytes=r-n,N_(t,nS.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.mbox=M_.decode(e,t)||".",t+=M_.decode.bytes,n.txt=M_.decode(e,t)||".",t+=M_.decode.bytes,nS.decode.bytes=t-r,n},encodingLength:e=>2+M_.encodingLength(e.mbox||".")+M_.encodingLength(e.txt||".")}),iS=B_({encode(e,t,r){t||(t=new Uint8Array(iS.encodingLength(e))),r||(r=0);const n=r,i=[];for(let o=0;o<e.length;o++){const t=d_(e[o]);void 0===i[t>>8]&&(i[t>>8]=[]),i[t>>8][t>>3&31]|=1<<7-(7&t)}for(let o=0;o<i.length;o++)if(void 0!==i[o]){const e=k_(i[o]);t[r]=o,t[r+=1]=e.length,O_(e,t,r+=1,0,e.length),r+=e.length}return iS.encode.bytes=r-n,t},decode(e,t,r){t||(t=0);const n=t,i=[];for(;t-n<r;){const r=e[t],n=e[t+=1];t+=1;for(let o=0;o<n;o++){const n=e[t+o];for(let e=0;e<8;e++)if(n&1<<7-e){const t=h_(r<<8|o<<3|e);i.push(t)}}t+=n}return iS.decode.bytes=t-n,i},encodingLength(e){const t=[];for(let n=0;n<e.length;n++){const r=d_(e[n]);t[r>>8]=Math.max(t[r>>8]||0,255&r)}let r=0;for(let n=0;n<t.length;n++)void 0!==t[n]&&(r+=2+Math.ceil((t[n]+1)/8));return r}}),oS=B_({encode(e,t,r){t||(t=new Uint8Array(oS.encodingLength(e))),r||(r=0);const n=r;return r+=2,M_.encode(e.nextDomain,t,r),r+=M_.encode.bytes,iS.encode(e.rrtypes,t,r),r+=iS.encode.bytes,oS.encode.bytes=r-n,N_(t,oS.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=P_(e,t);return t+=2,n.nextDomain=M_.decode(e,t),t+=M_.decode.bytes,n.rrtypes=iS.decode(e,t,i-(t-r)),t+=iS.decode.bytes,oS.decode.bytes=t-r,n},encodingLength:e=>2+M_.encodingLength(e.nextDomain)+iS.encodingLength(e.rrtypes)}),sS=B_({encode(e,t,r){t||(t=new Uint8Array(sS.encodingLength(e))),r||(r=0);const n=r,i=e.salt;if(!S_(i))throw new Error("salt must be a Buffer");const o=e.nextDomain;if(!S_(o))throw new Error("nextDomain must be a Buffer");return t[r+=2]=e.algorithm,t[r+=1]=e.flags,r+=1,N_(t,e.iterations,r),t[r+=2]=i.length,O_(i,t,r+=1,0,i.length),t[r+=i.length]=o.length,O_(o,t,r+=1,0,o.length),r+=o.length,iS.encode(e.rrtypes,t,r),r+=iS.encode.bytes,sS.encode.bytes=r-n,N_(t,sS.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=P_(e,t);t+=2,n.algorithm=e[t],t+=1,n.flags=e[t],t+=1,n.iterations=P_(e,t);const o=e[t+=2];t+=1,n.salt=e.slice(t,t+o);const s=e[t+=o];return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=iS.decode(e,t,i-(t-r)),t+=iS.decode.bytes,sS.decode.bytes=t-r,n},encodingLength:e=>8+e.salt.length+e.nextDomain.length+iS.encodingLength(e.rrtypes)}),aS=B_({encode(e,t,r){t||(t=new Uint8Array(aS.encodingLength(e))),r||(r=0);const n=r,i=e.digest;if(!S_(i))throw new Error("Digest must be a Buffer");return r+=2,N_(t,e.keyTag,r),t[r+=2]=e.algorithm,t[r+=1]=e.digestType,O_(i,t,r+=1,0,i.length),r+=i.length,aS.encode.bytes=r-n,N_(t,aS.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=P_(e,t);return t+=2,n.keyTag=P_(e,t),t+=2,n.algorithm=e[t],t+=1,n.digestType=e[t],t+=1,n.digest=e.slice(t,r+i+2),t+=n.digest.length,aS.decode.bytes=t-r,n},encodingLength:e=>6+A_(e.digest)});function cS(e){switch(e.toUpperCase()){case"A":return X_;case"PTR":case"CNAME":case"DNAME":return W_;case"TXT":return K_;case"NULL":return V_;case"AAAA":return J_;case"SRV":return G_;case"HINFO":return H_;case"CAA":return Y_;case"NS":return z_;case"SOA":return q_;case"MX":return Q_;case"OPT":return eS;case"DNSKEY":return tS;case"RRSIG":return rS;case"RP":return nS;case"NSEC":return oS;case"NSEC3":return sS;case"DS":return aS}return j_}const lS=B_({encode(e,t,r){t||(t=new Uint8Array(lS.encodingLength(e))),r||(r=0);const n=r;if(M_.encode(e.name,t,r),r+=M_.encode.bytes,N_(t,d_(e.type),r),"OPT"===e.type.toUpperCase()){if("."!==e.name)throw new Error("OPT name must be root.");N_(t,e.udpPayloadSize||4096,r+2),t[r+4]=e.extendedRcode||0,t[r+5]=e.ednsVersion||0,N_(t,e.flags||0,r+6),r+=8,eS.encode(e.options||[],t,r),r+=eS.encode.bytes}else{let n=y_(void 0===e.class?"IN":e.class);e.flush&&(n|=L_),N_(t,n,r+2),D_(t,e.ttl||0,r+4),r+=8;const i=cS(e.type);i.encode(e.data,t,r),r+=i.encode.bytes}return lS.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r={},n=t;if(r.name=M_.decode(e,t),t+=M_.decode.bytes,r.type=h_(P_(e,t)),"OPT"===r.type)r.udpPayloadSize=P_(e,t+2),r.extendedRcode=e[t+4],r.ednsVersion=e[t+5],r.flags=P_(e,t+6),r.flag_do=1===(r.flags>>15&1),r.options=eS.decode(e,t+8),t+=8+eS.decode.bytes;else{const n=P_(e,t+2);r.ttl=x_(e,t+4),r.class=g_(-32769&n),r.flush=!!(n&L_);const i=cS(r.type);r.data=i.decode(e,t+8),t+=8+i.decode.bytes}return lS.decode.bytes=t-n,r},encodingLength(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return M_.encodingLength(e.name)+8+cS(e.type).encodingLength(t)}}),uS=B_({encode(e,t,r){t||(t=new Uint8Array(uS.encodingLength(e))),r||(r=0);const n=r;return M_.encode(e.name,t,r),r+=M_.encode.bytes,N_(t,d_(e.type),r),r+=2,N_(t,y_(void 0===e.class?"IN":e.class),r),r+=2,uS.encode.bytes=r-n,e},decode(e,t){t||(t=0);const r=t,n={};n.name=M_.decode(e,t),t+=M_.decode.bytes,n.type=h_(P_(e,t)),t+=2,n.class=g_(P_(e,t)),t+=2;return!!(32768&n.class)&&(n.class&=-32769),uS.decode.bytes=t-r,n},encodingLength:e=>M_.encodingLength(e.name)+4}),hS=256,dS={encode:function(e,t,r){const n=!t;n&&(t=new Uint8Array(vS(e))),r||(r=0);const i=r;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),F_.encode(e,t,r),r+=F_.encode.bytes,r=wS(e.questions,uS,t,r),r=wS(e.answers,lS,t,r),r=wS(e.authorities,lS,t,r),r=wS(e.additionals,lS,t,r),dS.encode.bytes=r-i,n&&yS.bytes!==t.length?t.slice(0,yS.bytes):t},decode:function(e,t){t||(t=0);const r=t,n=F_.decode(e,t);return t+=F_.decode.bytes,t=ES(n.questions,uS,e,t),t=ES(n.answers,lS,e,t),t=ES(n.authorities,lS,e,t),t=ES(n.additionals,lS,e,t),dS.decode.bytes=t-r,n},encodingLength:function(e){return F_.encodingLength(e)+bS(e.questions||[],uS)+bS(e.answers||[],lS)+bS(e.authorities||[],lS)+bS(e.additionals||[],lS)}};function fS(e,t){if(e.questions)throw new Error("Only one .question object expected instead of a .questions array!");const r=Object.assign({type:t},e);return r.question&&(r.questions=[r.question],delete r.question),r}dS.encode.bytes=0,dS.decode.bytes=0;const pS={encode:function(e,t,r){return t=dS.encode(fS(e,"query"),t,r),pS.encode.bytes=dS.encode.bytes,t},decode:function(e,t){const r=dS.decode(e,t);return pS.decode.bytes=dS.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(e){return dS.encodingLength(fS(e,"query"))}};pS.encode.bytes=0,pS.decode.bytes=0;const gS={encode:function(e,t,r){return t=dS.encode(fS(e,"response"),t,r),gS.encode.bytes=dS.encode.bytes,t},decode:function(e,t){const r=dS.decode(e,t);return gS.decode.bytes=dS.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(e){return dS.encodingLength(fS(e,"response"))}};gS.encode.bytes=0,gS.decode.bytes=0;const yS=dS.encode,mS=dS.decode,vS=dS.encodingLength;function bS(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function wS(e,t,r,n){for(let i=0;i<e.length;i++)t.encode(e[i],r,n),n+=t.encode.bytes;return n}function ES(e,t,r,n){for(let i=0;i<e.length;i++)e[i]=t.decode(r,n),n+=t.decode.bytes;return n}function _S(e,t,r,n){if(64!==t.length)throw new Error("Charset needs to be 64 characters long! (".concat(t.length,")"));const i=new Uint8Array(256),o=new Uint8Array(64);for(let c=0;c<64;c+=1){const e=t.charCodeAt(c);if(e>255)throw new Error("Character #".concat(c," in charset [code=").concat(e,", char=").concat(t.charAt(c),"] is too high! (max=255)"));if(0!==i[e])throw new Error("Character [code=".concat(e,", char=").concat(t.charAt(c),"] is more than once in the charset!"));i[e]=c,o[c]=e}const s=r.charCodeAt(0),a={name:e,encodingLength(e){const t=e.length,r=.75*t|0;return e.charCodeAt(t-1)===s?e.charCodeAt(t-2)===s?r-2:r-1:r},encode(e,t,r){null!==t&&void 0!==t||(t=new Uint8Array(a.encodingLength(e))),null!==r&&void 0!==r||(r=0);let n=e.length;e.charCodeAt(n-1)===s&&(e.charCodeAt(n-2)===s?n-=2:n-=1);const o=n%4,c=n-o;let l=r,u=0;for(;u<c;){const r=i[e.charCodeAt(u)]<<18|i[e.charCodeAt(u+1)]<<12|i[e.charCodeAt(u+2)]<<6|i[e.charCodeAt(u+3)];t[l++]=r>>16,t[l++]=r>>8,t[l++]=r,u+=4}if(3===o){const r=i[e.charCodeAt(u)]<<10|i[e.charCodeAt(u+1)]<<4|i[e.charCodeAt(u+2)]>>2;t[l++]=r>>8,t[l++]=r}else 2===o&&(t[l++]=i[e.charCodeAt(u)]<<2|i[e.charCodeAt(u+1)]>>4);return a.encode.bytes=l-r,t},decode(e,t,r){null!==t&&void 0!==t||(t=0),null!==r&&void 0!==r||(r=e.length);const i=r-t,c=i%3,l=t+i-c,u=[];for(let n=t;n<l;n+=3){const t=e[n]<<16|e[n+1]<<8|e[n+2];u.push(o[t>>18&63],o[t>>12&63],o[t>>6&63],o[63&t])}if(2===c){const t=(e[r-2]<<8)+e[r-1];u.push(o[t>>10],o[t>>4&63],o[t<<2&63]),1===n&&u.push(s)}else if(1===c){const t=e[r-1];u.push(o[t>>2],o[t<<4&63]),1===n&&u.push(s,s)}return a.decode.bytes=i,String.fromCharCode.apply(String,u)}};return a}_S("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",1);const SS=_S("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",2);let AS="undefined"!==typeof global?global.AbortError:"undefined"!==typeof window?window.AbortError:null;AS||(AS=class extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Request aborted.")}}),AS.prototype.name="AbortError",AS.prototype.code="ABORT_ERR";const kS="undefined"!==typeof globalThis&&globalThis.URL||require("url").URL;class IS extends Error{constructor(e,t,r){super("status="+t+" while requesting "+e+" ["+r+"]"),this.uri=e,this.status=t,this.method=r}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}IS.prototype.name="HTTPStatusError",IS.prototype.code="HTTP_STATUS";class CS extends Error{constructor(e,t){super(e),this.cause=t}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:PS(this.cause)}}}CS.prototype.name="ResponseError",CS.prototype.code="RESPONSE_ERR";class RS extends Error{constructor(e){super("Timeout (t="+e+")."),this.timeout=e}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}RS.prototype.name="TimeoutError",RS.prototype.code="ETIMEOUT";const TS=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,xS=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function PS(e){if("string"===typeof e)return{message:e};try{const t=JSON.stringify(e);if("{}"!==t)return JSON.parse(t)}catch(r){}const t={message:String(e.message||e)};return void 0!==e.code&&(t.code=String(e.code)),t}const DS=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,NS=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/gi,OS=/\[(((pk|name)=([^\]]+)))\]/gi;function LS(e,t){t.lastIndex=0;const r={};for(;;){const n=t.exec(e);if(!n)break;n[2]?r[n[3].toLowerCase()]=n[4]:r[n[1].toLowerCase()]=!0}return r}class BS extends Error{constructor(e,t){super('Invalid Endpoint: unsupported protocol "'.concat(e,'" for endpoint: ').concat(t,", supported protocols: ").concat(MS.join(", "))),this.protocol=e,this.endpoint=t}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}BS.prototype.name="InvalidProtocolError",BS.prototype.code="EPROTOCOL";const MS=["http:","https:","udp4:","udp6:"];class US{constructor(e,t){this.name=e.name||null,this.protocol=e.protocol;const r="string"===typeof e.port?e.port=parseInt(e.port,10):e.port;if(void 0===r||null===r)this.port=t?"https:"===this.protocol?443:80:e.pk?443:53;else{if("number"!==typeof r&&!isNaN(r))throw new Error('Invalid Endpoint: port "'.concat(e.port,'" needs to be a number: ').concat(JSON.stringify(e)));this.port=r}}toJSON(){return this.toString()}}class FS extends US{constructor(e){super(e,!1),this.pk=e.pk||null}toString(){const e=this.port!==(this.pk?443:53)?":".concat(this.port):"",t=this.pk?" [pk=".concat(this.pk,"]"):"",r=this.name?" [name=".concat(this.name,"]"):"";return"udp://".concat(this.ipv4||"[".concat(this.ipv6,"]")).concat(e).concat(t).concat(r)}}class jS extends FS{constructor(e){if(super(Object.assign({protocol:"udp4:"},e)),!e.ipv4||"string"!==typeof e.ipv4)throw new Error('Invalid Endpoint: .ipv4 "'.concat(e.ipv4,'" needs to be set: ').concat(JSON.stringify(e)));this.ipv4=e.ipv4}}class zS extends FS{constructor(e){if(super(Object.assign({protocol:"udp6:"},e)),!e.ipv6||"string"!==typeof e.ipv6)throw new Error('Invalid Endpoint: .ipv6 "'.concat(e.ipv6,'" needs to be set: ').concat(JSON.stringify(e)));this.ipv6=e.ipv6}}function qS(e){return xS.test(e)&&!TS.test(e)?"[".concat(e,"]"):e}class KS extends US{constructor(e){if(super(Object.assign({protocol:"https:"},e),!0),e.host||(e.ipv4&&(e.host=e.ipv4),e.ipv6&&(e.host="[".concat(e.ipv6,"]"))),!e.host||"string"!==typeof e.host)throw new Error('Invalid Endpoint: host "'.concat(e.path,'" needs to be set: ').concat(JSON.stringify(e)));if(this.host=e.host,this.path=e.path||"/dns-query",this.method=/^post$/i.test(e.method)?"POST":"GET",this.ipv4=e.ipv4,this.ipv6=e.ipv6,!this.ipv6){const e=xS.exec(this.host);e&&(this.ipv6=e[1])}this.ipv4||TS.test(this.host)&&(this.ipv4=this.host);const t="".concat(this.protocol,"//").concat(qS(this.host),":").concat(this.port).concat(this.path);try{this.url=new kS(t)}catch(r){throw new Error(r.message+" [".concat(t,"]"))}}toString(){const e="https:"===this.protocol?"":"http://",t=this.port!==("https:"===this.protocol?443:80)?":".concat(this.port):"",r="GET"!==this.method?" [post]":"",n="/dns-query"===this.path?"":this.path,i=this.name?" [name=".concat(this.name,"]"):"",o=this.ipv4&&this.ipv4!==this.host?" [ipv4=".concat(this.ipv4,"]"):"",s=this.ipv6&&this.ipv6!==this.host?" [ipv6=".concat(this.ipv6,"]"):"";return"".concat(e).concat(qS(this.host)).concat(t).concat(n).concat(r).concat(o).concat(s).concat(i)}}function VS(e){let t;if("string"===typeof e)t=function(e){const t=DS.exec(e),r=t[2]||"https:",n=t[3],i=t[5],o=t[6],s=t[7];if("https:"===r||"http:"===r){const e=LS(s,NS);return{name:e.name,protocol:r,ipv4:e.ipv4,ipv6:e.ipv6,host:n,port:i,path:o,method:e.post?"POST":"GET"}}if("udp:"===r||"udp4:"===r||"udp6:"===r){const t=LS(s,OS),o=/^\[(.*)\]$/.exec(n);if(o&&"udp4:"===r)throw new Error("Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=".concat(e,")"));if(!o&&"udp6:"===r)throw new Error("Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=".concat(e,")"));return o?new zS({protocol:"udp6:",ipv6:o[1],port:i,pk:t.pk,name:t.name}):new jS({protocol:"udp4:",ipv4:n,port:i,pk:t.pk,name:t.name})}throw new BS(r,e)}(e);else{if("object"!==typeof e||null===e||Array.isArray(e))throw new Error("Can not convert ".concat(e," to an endpoint"));if(e instanceof US)return e;t=e}null!==t.protocol&&void 0!==t.protocol||(t.protocol="https:");const r=t.protocol;if("udp4:"===r)return new jS(t);if("udp6:"===r)return new zS(t);if("https:"===r||"http:"===r)return new KS(t);throw new BS(r,JSON.stringify(t))}const HS="application/dns-message";function WS(){}function GS(e,t,r,n,i){return new Promise(((o,s)=>{const a=new kS(e);"GET"===t&&r&&(a.search="?dns="+SS.decode(r));const c=a.toString(),l=new XMLHttpRequest;l.open(t,c,!0),l.setRequestHeader("Accept",HS),"POST"===t&&l.setRequestHeader("Content-Type",HS),l.responseType="arraybuffer",l.timeout=n,l.ontimeout=function(){u(new RS(n));try{l.abort()}catch(e){}},l.onreadystatechange=function(){if(l.readyState>1&&200!==l.status&&0!==l.status){u(new IS(c,l.status,t));try{l.abort()}catch(e){}}},l.onerror=function(){u(200===l.status?new Error("Inexplicable XHR Error"):new IS(c,l.status,t))},l.onload=function(){if(200!==l.status)u(new IS(c,l.status,t));else{let e;if("string"===typeof l.response)e=E_(l.response);else if(l.response instanceof Uint8Array)e=l.response;else{if(!(Array.isArray(l.response)||l.response instanceof ArrayBuffer))throw new Error("Unprocessable response "+l.response);e=new Uint8Array(l.response)}u(null,e)}},"POST"===t?l.send(r):l.send(),i&&i.addEventListener("abort",h);let u=function(e,t){u=WS,i&&i.removeEventListener("abort",h),o(e?{error:e,response:l}:{data:t,response:l})};function h(){u(new AS);try{l.abort()}catch(e){}}}))}Error;function YS(e){const t=null===e.time||void 0===e.time?Date.now():e.time,r=function(e){return e.filter((e=>e.cors||e.endpoint.cors))}(e.data.map((e=>(e.endpoint=VS(Object.assign({name:e.name},e.endpoint)),e)))),n=r.map((e=>e.endpoint));return{data:{resolvers:r,resolverByName:r.reduce(((e,t)=>(e[t.name]=t,e)),{}),endpoints:n,endpointByName:n.reduce(((e,t)=>(e[t.name]=t,e)),{})},time:t}}const QS=YS({data:[{name:"adfree.usableprivacy.net",endpoint:{protocol:"https:",host:"adfree.usableprivacy.net"},description:"Public updns DoH service with advertising, tracker and malware filters.\nHosted in Europe by @usableprivacy, details see: https://docs.usableprivacy.com",country:"Germany",location:{lat:51.2993,long:9.491},filter:!0},{name:"adguard-dns-doh",endpoint:{protocol:"https:",host:"dns.adguard.com",ipv4:"94.140.15.15"},description:"Remove ads and protect your computer from malware (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-family-doh",endpoint:{protocol:"https:",host:"dns-family.adguard.com",ipv4:"94.140.15.16"},description:"Adguard DNS with safesearch and adult content blocking (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-unfiltered-doh",endpoint:{protocol:"https:",host:"dns-unfiltered.adguard.com",ipv4:"94.140.14.140"},description:"AdGuard public DNS servers without filters (over DoH)",country:"France",location:{lat:48.8582,long:2.3387}},{name:"ahadns-doh-chi",endpoint:{protocol:"https:",host:"doh.chi.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Chicago, USA. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=chi",country:"United States",location:{lat:41.8483,long:-87.6517},filter:!0,cors:!0},{name:"ahadns-doh-in",endpoint:{protocol:"https:",host:"doh.in.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Mumbai, India. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=in",country:"India",location:{lat:19.0748,long:72.8856},filter:!0,cors:!0},{name:"ahadns-doh-la",endpoint:{protocol:"https:",host:"doh.la.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Los Angeles, USA. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=la",country:"United States",location:{lat:34.0549,long:-118.2578},filter:!0,cors:!0},{name:"ahadns-doh-nl",endpoint:{protocol:"https:",host:"doh.nl.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Amsterdam, Netherlands. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=nl",country:"Netherlands",location:{lat:52.3824,long:4.8995},filter:!0,cors:!0},{name:"ahadns-doh-ny",endpoint:{protocol:"https:",host:"doh.ny.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in New York. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=ny",country:"United States",location:{lat:40.7308,long:-73.9975},filter:!0,cors:!0},{name:"ahadns-doh-pl",endpoint:{protocol:"https:",host:"doh.pl.ahadns.net",cors:!0},description:"A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Poland. By https://ahadns.com/\nServer statistics can be seen at: https://statistics.ahadns.com/?server=pl",country:"Netherlands",location:{lat:52.3824,long:4.8995},filter:!0,cors:!0},{name:"alidns-doh",endpoint:{protocol:"https:",host:"dns.alidns.com",ipv4:"223.5.5.5",cors:!0},description:"A public DNS resolver that supports DoH/DoT in mainland China, provided by Alibaba-Cloud.\nWarning: GFW filtering rules are applied by that resolver.\nHomepage: https://alidns.com/",country:"China",location:{lat:34.7725,long:113.7266},filter:!0,log:!0,cors:!0},{name:"ams-ads-doh-nl",endpoint:{protocol:"https:",host:"dnsnl-noads.alekberg.net"},description:"Resolver in Amsterdam. DoH protocol. Non-logging. Blocks ads, malware and trackers. DNSSEC enabled.",country:"Romania",location:{lat:45.9968,long:24.997},filter:!0},{name:"ams-doh-nl",endpoint:{protocol:"https:",host:"dnsnl.alekberg.net"},description:"Resolver in Amsterdam. DoH protocol. Non-logging, non-filtering, DNSSEC.",country:"Romania",location:{lat:45.9968,long:24.997}},{name:"att",endpoint:{protocol:"https:",host:"dohtrial.att.net"},description:"AT&T test DoH server.",log:!0},{name:"bcn-ads-doh",endpoint:{protocol:"https:",host:"dnses-noads.alekberg.net"},description:"Resolver in Spain. DoH protocol. Non-logging, remove ads and malware, DNSSEC.",country:"Spain",location:{lat:41.3891,long:2.1611},filter:!0},{name:"bcn-doh",endpoint:{protocol:"https:",host:"dnses.alekberg.net"},description:"Resolver in Spain. DoH protocol. Non-logging, non-filtering, DNSSEC.",country:"Spain",location:{lat:41.3891,long:2.1611}},{name:"brahma-world",endpoint:{protocol:"https:",host:"dns.brahma.world"},description:"DNS-over-HTTPS server. Non Logging, filters ads, trackers and malware. DNSSEC ready, QNAME Minimization, No EDNS Client-Subnet.\nHosted in Stockholm, Sweden. (https://dns.brahma.world)",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"cisco-doh",endpoint:{protocol:"https:",host:"doh.opendns.com",ipv4:"146.112.41.2"},description:"Remove your DNS blind spot (DoH protocol)\nWarning: modifies your queries to include a copy of your network\naddress when forwarding them to a selection of companies and organizations.",country:"United States",location:{lat:37.751,long:-97.822},filter:!0,log:!0},{name:"cloudflare",endpoint:{protocol:"https:",host:"dns.cloudflare.com",ipv4:"1.0.0.1",cors:!0},description:"Cloudflare DNS (anycast) - aka 1.1.1.1 / 1.0.0.1",country:"Australia",location:{lat:-33.494,long:143.2104},cors:!0},{name:"cloudflare-family",endpoint:{protocol:"https:",host:"family.cloudflare-dns.com",ipv4:"1.0.0.3",cors:!0},description:"Cloudflare DNS (anycast) with malware protection and parental control - aka 1.1.1.3 / 1.0.0.3",country:"Australia",location:{lat:-33.494,long:143.2104},filter:!0,cors:!0},{name:"cloudflare-ipv6",endpoint:{protocol:"https:",host:"1dot1dot1dot1.cloudflare-dns.com",cors:!0},description:"Cloudflare DNS over IPv6 (anycast)",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"cloudflare-security",endpoint:{protocol:"https:",host:"security.cloudflare-dns.com",ipv4:"1.0.0.2",cors:!0},description:"Cloudflare DNS (anycast) with malware blocking - aka 1.1.1.2 / 1.0.0.2",country:"Australia",location:{lat:-33.494,long:143.2104},filter:!0,cors:!0},{name:"controld-block-malware",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p1"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-block-malware-ad",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p2"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware, Ads & Tracking domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-block-malware-ad-social",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p3"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware, Ads & Tracking and Social Networks domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-family-friendly",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/family"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS blocks Malware, Ads & Tracking, Adult Content and Drugs domains.",country:"Canada",location:{lat:43.6319,long:-79.3716},filter:!0},{name:"controld-uncensored",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/uncensored"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis DNS unblocks censored domains from various countries.",country:"Canada",location:{lat:43.6319,long:-79.3716}},{name:"controld-unfiltered",endpoint:{protocol:"https:",host:"freedns.controld.com",path:"/p0"},description:"ControlD Free DNS. Take CONTROL of your Internet. Block unwanted content, bypass geo-restrictions and be more productive. DoH protocol and No logging. - https://controld.com/free-dns\nThis is a Unfiltered DNS, no DNS record blocking or manipulation here, if you want to block Malware, Ads & Tracking or Social Network domains, use the other ControlD DNS configs.",country:"Canada",location:{lat:43.6319,long:-79.3716}},{name:"dns.digitale-gesellschaft.ch",endpoint:{protocol:"https:",host:"dns.digitale-gesellschaft.ch"},description:"Public DoH resolver operated by the Digital Society (https://www.digitale-gesellschaft.ch).\nHosted in Zurich, Switzerland.\nNon-logging, non-filtering, supports DNSSEC.",country:"Switzerland",location:{lat:47.1449,long:8.1551}},{name:"dns.ryan-palmer",endpoint:{protocol:"https:",host:"dns1.ryan-palmer.com"},description:"Non-logging, non-filtering, DNSSEC DoH Server. Hosted in the UK.",country:"United Kingdom",location:{lat:51.5164,long:-.093}},{name:"dns.sb",endpoint:{protocol:"https:",host:"doh.sb",ipv4:"185.222.222.222",cors:!0},description:"DNSSEC-enabled DoH server by https://xtom.com/\nhttps://dns.sb/doh/",country:"Unknown",location:{lat:47,long:8},cors:!0},{name:"dns.therifleman.name",endpoint:{protocol:"https:",host:"dns.therifleman.name"},description:"DNS-over-HTTPS DNS forwarder from Mumbai, India. Blocks web and Android trackers and ads.\nIP addresses are not logged, but queries are logged for 24 hours for debugging.\nReport issues, send suggestions @ joker349 at protonmail.com.\nAlso supports DoT (for android) @ dns.therifleman.name and plain DNS @ 172.104.206.174",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"dnsforfamily-doh",endpoint:{protocol:"https:",host:"dns-doh.dnsforfamily.com"},description:"(DoH Protocol) (Now supports DNSSEC). Block adult websites, gambling websites, malwares and advertisements.\nIt also enforces safe search in: Google, YouTube, Bing, DuckDuckGo and Yandex.\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\nProvided by: https://dnsforfamily.com",country:"Finland",location:{lat:60.1758,long:24.9349},filter:!0},{name:"dnsforfamily-doh-no-safe-search",endpoint:{protocol:"https:",host:"dns-doh-no-safe-search.dnsforfamily.com"},description:"(DoH Protocol) (Now supports DNSSEC) Block adult websites, gambling websites, malwares and advertisements.\nUnlike other dnsforfamily servers, this one does not enforces safe search. So Google, YouTube, Bing, DuckDuckGo and Yandex are completely accessible without any restriction.\nSocial websites like Facebook and Instagram are not blocked. No DNS queries are logged.\nAs of 26-May-2022 5.9 million websites are blocked and new websites are added to blacklist daily.\nCompletely free, no ads or any commercial motive. Operating for 4 years now.\nWarning: This server is incompatible with anonymization.\nProvided by: https://dnsforfamily.com",country:"Finland",location:{lat:60.1758,long:24.9349},filter:!0},{name:"dnsforge.de",endpoint:{protocol:"https:",host:"dnsforge.de",cors:!0},description:"Public DoH resolver running with Pihole for Adblocking (https://dnsforge.de).\nNon-logging, AD-filtering, supports DNSSEC. Hosted in Germany.",country:"Germany",location:{lat:52.2998,long:9.447},filter:!0,cors:!0},{name:"dnshome-doh",endpoint:{protocol:"https:",host:"dns.dnshome.de"},description:"https://www.dnshome.de/ public resolver in Germany"},{name:"dnspod-doh",endpoint:{protocol:"https:",host:"doh.pub",cors:!0},description:"A public DNS resolver in mainland China provided by DNSPod (Tencent Cloud).\nhttps://www.dnspod.cn/Products/Public.DNS?lang=en",filter:!0,log:!0,cors:!0},{name:"dnswarden-asia-adblock-dohv4",endpoint:{protocol:"https:",host:"doh.asia.dnswarden.com",path:"/adblock"},description:"Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Singapore",location:{lat:1.2929,long:103.8547},filter:!0},{name:"dnswarden-asia-adultfilter-dohv4",endpoint:{protocol:"https:",host:"doh.asia.dnswarden.com",path:"/adultfilter"},description:"Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Singapore",location:{lat:1.2929,long:103.8547},filter:!0},{name:"dnswarden-asia-uncensor-dohv4",endpoint:{protocol:"https:",host:"doh.asia.dnswarden.com",path:"/uncensored"},description:"Hosted in Singapore. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Singapore",location:{lat:1.2929,long:103.8547}},{name:"dnswarden-eu-adblock-dohv4",endpoint:{protocol:"https:",host:"doh.eu.dnswarden.com"},description:"Hosted in Germany. For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"Germany",location:{lat:50.1103,long:8.7147},filter:!0},{name:"dnswarden-us-adblock-dohv4",endpoint:{protocol:"https:",host:"doh.us.dnswarden.com"},description:"Hosted in USA (Dallas) . For more information look [here](https://github.com/bhanupratapys/dnswarden) or [here](https://dnswarden.com).",country:"United States",location:{lat:32.7889,long:-96.8021},filter:!0},{name:"doh-ch-blahdns",endpoint:{protocol:"https:",host:"doh-ch.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Switzerland. By https://blahdns.com/",country:"Netherlands",location:{lat:52.3824,long:4.8995},filter:!0,cors:!0},{name:"doh-cleanbrowsing-adult",endpoint:{protocol:"https:",host:"doh.cleanbrowsing.org",path:"/doh/adult-filter/",cors:!0},description:"Blocks access to all adult, pornographic and explicit sites. It does\nnot block proxy or VPNs, nor mixed-content sites. Sites like Reddit\nare allowed. Google and Bing are set to the Safe Mode.\nBy https://cleanbrowsing.org/",filter:!0,cors:!0},{name:"doh-cleanbrowsing-family",endpoint:{protocol:"https:",host:"doh.cleanbrowsing.org",path:"/doh/family-filter/",cors:!0},description:"Blocks access to all adult, pornographic and explicit sites. It also\nblocks proxy and VPN domains that are used to bypass the filters.\nMixed content sites (like Reddit) are also blocked. Google, Bing and\nYoutube are set to the Safe Mode.\nBy https://cleanbrowsing.org/",filter:!0,cors:!0},{name:"doh-cleanbrowsing-security",endpoint:{protocol:"https:",host:"doh.cleanbrowsing.org",path:"/doh/security-filter/",cors:!0},description:"Block access to phishing, malware and malicious domains. It does not block adult content.\nBy https://cleanbrowsing.org/",filter:!0,cors:!0},{name:"doh-crypto-sx",endpoint:{protocol:"https:",host:"doh.crypto.sx",cors:!0},description:"DNS-over-HTTPS server. Anycast, no logs, no censorship, DNSSEC.\nBackend hosted by Scaleway, globally cached via Cloudflare.\nMaintained by Frank Denis.",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"doh-crypto-sx-ipv6",endpoint:{protocol:"https:",host:"doh-ipv6.crypto.sx",cors:!0},description:"DNS-over-HTTPS server accessible over IPv6. Anycast, no logs, no censorship, DNSSEC.\nBackend hosted by Scaleway, globally cached via Cloudflare.\nMaintained by Frank Denis.",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"doh-de-blahdns",endpoint:{protocol:"https:",host:"doh-de.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Germany. By https://blahdns.com/",country:"Germany",location:{lat:51.2993,long:9.491},filter:!0,cors:!0},{name:"doh-fi-blahdns",endpoint:{protocol:"https:",host:"doh-fi.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Finland. By https://blahdns.com/",country:"Finland",location:{lat:60.1758,long:24.9349},filter:!0,cors:!0},{name:"doh-ibksturm",endpoint:{protocol:"https:",host:"ibksturm.synology.me"},description:"DoH & DoT Server, No Logging, No Filters, DNSSEC\nRunning privately by ibksturm in Thurgau, Switzerland"},{name:"doh-jp-blahdns",endpoint:{protocol:"https:",host:"doh-jp.blahdns.com",cors:!0},description:"Blocks ad and Tracking, no Logging, DNSSEC, Hosted in Japan. By https://blahdns.com/",country:"Japan",location:{lat:35.6882,long:139.7532},filter:!0,cors:!0},{name:"doh.ffmuc.net",endpoint:{protocol:"https:",host:"doh.ffmuc.net"},description:"An open (non-logging, non-filtering, non-censoring) DoH resolver operated by Freifunk Munich with nodes in DE.\nhttps://ffmuc.net/",country:"Germany",location:{lat:51.2993,long:9.491}},{name:"doh.tiarap.org",endpoint:{protocol:"https:",host:"doh.tiarap.org"},description:"Non-Logging DNS-over-HTTPS server, cached via Cloudflare.\nFilters out ads, trackers and malware, NO ECS, supports DNSSEC.",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"google",endpoint:{protocol:"https:",host:"dns.google",ipv4:"8.8.8.8",cors:!0},description:"Google DNS (anycast)",country:"United States",location:{lat:37.751,long:-97.822},log:!0,cors:!0},{name:"hdns",endpoint:{protocol:"https:",host:"query.hdns.io",cors:!0},description:"HDNS is a public DNS resolver that supports Handshake domains.\nhttps://www.hdns.io",country:"United States",location:{lat:37.7771,long:-122.406},cors:!0},{name:"he",endpoint:{protocol:"https:",host:"ordns.he.net"},description:"Hurricane Electric DoH server (anycast)\nUnknown logging policy.",country:"United States",location:{lat:37.751,long:-97.822},log:!0},{name:"id-gmail-doh",endpoint:{protocol:"https:",host:"doh.tiar.app"},description:"Non-Logging DNS-over-HTTPS server located in Singapore.\nFilters out ads, trackers and malware, supports DNSSEC, provided by id-gmail.",country:"Singapore",location:{lat:1.2929,long:103.8547},filter:!0},{name:"iij",endpoint:{protocol:"https:",host:"public.dns.iij.jp"},description:"DoH server operated by Internet Initiative Japan in Tokyo.\nhttps://www.iij.ad.jp/",country:"Japan",location:{lat:35.69,long:139.69},log:!0},{name:"iqdns-doh",endpoint:{protocol:"https:",host:"a.passcloud.xyz"},description:'Non-logging DoH service runned by V2EX.com user johnsonwil.\nReturns "no such domain" for anti-Chinese government websites. Supports DNSSEC.\nFor more information: https://www.v2ex.com/t/785666',filter:!0},{name:"jp.tiar.app-doh",endpoint:{protocol:"https:",host:"jp.tiar.app"},description:"Non-Logging, Non-Filtering DNS-over-HTTPS server in Japan.\nNo ECS, Support DNSSEC",country:"Japan",location:{lat:35.6882,long:139.7532}},{name:"jp.tiarap.org",endpoint:{protocol:"https:",host:"jp.tiarap.org"},description:"DNS-over-HTTPS Server. Non-Logging, Non-Filtering, No ECS, Support DNSSEC.\nCached via Cloudflare."},{name:"libredns",endpoint:{protocol:"https:",host:"doh.libredns.gr"},description:"DoH server in Germany. No logging, but no DNS padding and no DNSSEC support.\nhttps://libredns.gr/",country:"Germany",location:{lat:51.2993,long:9.491}},{name:"nextdns",endpoint:{protocol:"https:",host:"anycsast.dns.nextdns.io"},description:"NextDNS is a cloud-based private DNS service that gives you full control\nover what is allowed and what is blocked on the Internet.\nDNSSEC, Anycast, Non-logging, NoFilters\nhttps://www.nextdns.io/",country:"Netherlands",location:{lat:52.3891,long:4.6563}},{name:"nextdns-ultralow",endpoint:{protocol:"https:",host:"dns.nextdns.io",path:"/dnscrypt-proxy"},description:'NextDNS is a cloud-based private DNS service that gives you full control\nover what is allowed and what is blocked on the Internet.\nhttps://www.nextdns.io/\nTo select the server location, the "-ultralow" variant relies on bootstrap servers\ninstead of anycast.'},{name:"njalla-doh",endpoint:{protocol:"https:",host:"dns.njal.la",cors:!0},description:"Non-logging DoH server in Sweden operated by Njalla.\nhttps://dns.njal.la/",country:"Sweden",location:{lat:59.3247,long:18.056},cors:!0},{name:"odoh-cloudflare",endpoint:{protocol:"https:",host:"odoh.cloudflare-dns.com",cors:!0},description:"Cloudflare ODoH server.\nhttps://cloudflare.com",cors:!0},{name:"odoh-crypto-sx",endpoint:{protocol:"https:",host:"odoh.crypto.sx",cors:!0},description:"ODoH target server. Anycast, no logs.\nBackend hosted by Scaleway. Maintained by Frank Denis.",cors:!0},{name:"odoh-id-gmail",endpoint:{protocol:"https:",host:"doh.tiar.app",path:"/odoh"},description:"ODoH target server. Based in Singapore, no logs.\nFilter ads, trackers and malware.",filter:!0},{name:"odoh-jp.tiar.app",endpoint:{protocol:"https:",host:"jp.tiar.app",path:"/odoh"},description:"ODoH target server. no logs."},{name:"odoh-jp.tiarap.org",endpoint:{protocol:"https:",host:"jp.tiarap.org",path:"/odoh"},description:"ODoH target server via Cloudflare, no logs."},{name:"odoh-resolver4.dns.openinternet.io",endpoint:{protocol:"https:",host:"resolver4.dns.openinternet.io"},description:"ODoH target server. no logs, no filter, DNSSEC.\nRunning on dedicated hardware colocated at Sonic.net in Santa Rosa, CA in the United States.\nUses Sonic's recusrive DNS servers as upstream resolvers (but is not affiliated with Sonic\nin any way). Provided by https://openinternet.io"},{name:"odoh-tiarap.org",endpoint:{protocol:"https:",host:"doh.tiarap.org",path:"/odoh"},description:"ODoH target server via Cloudflare, no logs.\nFilter ads, trackers and malware.",filter:!0},{name:"publicarray-au2-doh",endpoint:{protocol:"https:",host:"doh-2.seby.io",cors:!0},description:"DNSSEC \u2022 OpenNIC \u2022 Non-logging \u2022 Uncensored - hosted on ovh.com.au\nMaintained by publicarray - https://dns.seby.io",country:"Australia",location:{lat:-33.8591,long:151.2002},cors:!0},{name:"puredns-doh",endpoint:{protocol:"https:",host:"puredns.org",ipv4:"146.190.6.13",cors:!0},description:"Public uncensored DNS resolver in Singapore - https://puredns.org\n** Only available in Indonesia and Singapore **",country:"United States",location:{lat:37.751,long:-97.822},cors:!0},{name:"quad101",endpoint:{protocol:"https:",host:"dns.twnic.tw",cors:!0},description:"DNSSEC-aware public resolver by the Taiwan Network Information Center (TWNIC)\nhttps://101.101.101.101/index_en.html",cors:!0},{name:"quad9-doh-ip4-port443-filter-ecs-pri",endpoint:{protocol:"https:",host:"dns11.quad9.net",ipv4:"149.112.112.11"},description:"Quad9 (anycast) dnssec/no-log/filter/ecs 9.9.9.11 - 149.112.112.11",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"quad9-doh-ip4-port443-filter-pri",endpoint:{protocol:"https:",host:"dns.quad9.net",ipv4:"149.112.112.112"},description:"Quad9 (anycast) dnssec/no-log/filter 9.9.9.9 - 149.112.112.9 - 149.112.112.112",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"quad9-doh-ip4-port443-nofilter-ecs-pri",endpoint:{protocol:"https:",host:"dns12.quad9.net",ipv4:"9.9.9.12"},description:"Quad9 (anycast) no-dnssec/no-log/no-filter/ecs 9.9.9.12 - 149.112.112.12",country:"United States",location:{lat:37.751,long:-97.822}},{name:"quad9-doh-ip4-port443-nofilter-pri",endpoint:{protocol:"https:",host:"dns10.quad9.net",ipv4:"149.112.112.10"},description:"Quad9 (anycast) no-dnssec/no-log/no-filter 9.9.9.10 - 149.112.112.10",country:"United States",location:{lat:37.751,long:-97.822}},{name:"quad9-doh-ip6-port5053-filter-pri",endpoint:{protocol:"https:",host:"dns9.quad9.net"},description:"Quad9 (anycast) dnssec/no-log/filter 2620:fe::fe - 2620:fe::9 - 2620:fe::fe:9",country:"United States",location:{lat:37.751,long:-97.822},filter:!0},{name:"safesurfer-doh",endpoint:{protocol:"https:",host:"doh.safesurfer.io"},description:"Family safety focused blocklist for over 2 million adult sites, as well as phishing and malware and more.\nFree to use, paid for customizing blocking for more categories+sites and viewing usage at my.safesurfer.io. Logs taken for viewing\nusage, data never sold - https://safesurfer.io",filter:!0,log:!0},{name:"sth-ads-doh-se",endpoint:{protocol:"https:",host:"dnsse-noads.alekberg.net"},description:"Resolver in Stockholm, Sweden. DoH server. Non-logging, remove ads and malware, DNSSEC.",country:"Bulgaria",location:{lat:42.696,long:23.332},filter:!0},{name:"sth-doh-se",endpoint:{protocol:"https:",host:"dnsse.alekberg.net"},description:"Resolver in Stockholm, Sweden. DoH server. Non-logging, non-filtering, DNSSEC.",country:"Bulgaria",location:{lat:42.696,long:23.332}},{name:"switch",endpoint:{protocol:"https:",host:"dns.switch.ch"},description:"Public DoH service provided by SWITCH in Switzerland\nhttps://www.switch.ch\nProvides protection against malware, but does not block ads.",filter:!0},{name:"uncensoreddns-dk-ipv4",endpoint:{protocol:"https:",host:"unicast.uncensoreddns.org"},description:"Also known as censurfridns.\nDoH, no logs, no filter, DNSSEC, unicast hosted in Denmark - https://blog.uncensoreddns.org",country:"Denmark",location:{lat:55.7123,long:12.0564}},{name:"uncensoreddns-ipv4",endpoint:{protocol:"https:",host:"anycast.uncensoreddns.org"},description:"Also known as censurfridns.\nDoH, no logs, no filter, DNSSEC, anycast - https://blog.uncensoreddns.org",country:"Denmark",location:{lat:55.7123,long:12.0564}},{name:"v.dnscrypt.uk-doh-ipv4",endpoint:{protocol:"https:",host:"v.dnscrypt.uk"},description:"DoH, no logs, uncensored, DNSSEC. Hosted in London UK on Digital Ocean\nhttps://www.dnscrypt.uk",country:"United Kingdom",location:{lat:51.4964,long:-.1224}}],time:1654187067783});function XS(e,t,r,n){return n&&n.aborted?Promise.reject(new AS):"udp4:"===e.protocol||"udp6:"===e.protocol?function(){throw new Error('Only "doh" endpoints are supported in the browser')}():function(e,t,r,n){return function(e,t,r,n,i){return GS(e,t,r,n,i)}(e.url,e.method,yS(Object.assign({flags:hS},t)),r,n).then((function(e){const t=e.data,r=e.response;let n=e.error;if(void 0===n)if(0===t.length)n=new CS("Empty.");else try{const e=mS(t);return e.response=r,e}catch(i){n=new CS("Invalid packet (cause="+i.message+")",i)}throw Object.assign(n,{response:r})}))}(e,t,r,n)}const JS=new kS("https://martinheidegger.github.io/dns-query/resolvers.json");function $S(e){return/^@/.test(e)}const ZS=new class{constructor(e){this.opts=Object.assign({timeout:5e3,update:!0,updateURL:JS,persist:!1,localStoragePrefix:"dnsquery_",maxAge:3e5},e),this._dataP=null}_data(e,t){return e||null===this._dataP?(this._dataP=this.opts.update?async function(e,t,r,n){const i=t?t.localStoragePrefix+t.name:null;if(i)try{const e=JSON.parse(localStorage.getItem(i));if(e&&e.time>t.maxTime)return e}catch(a){}const{data:o}=await GS(e,"GET",null,r,n),s={time:Date.now(),data:JSON.parse(__(o))};if(i)try{localStorage.setItem(i,JSON.stringify(s))}catch(a){s.time=null}return s}(this.opts.updateURL,this.opts.persist?{name:"resolvers.json",localStoragePrefix:this.opts.localStoragePrefix,maxTime:Date.now()-this.opts.maxAge}:null,this.opts.timeout).then((e=>YS({data:e.data.resolvers,time:e.time}))).catch((()=>t||QS)):Promise.resolve(QS),this._dataP):this._dataP.then((e=>e.time<Date.now()-this.opts.maxAge?this._data(!0,e):e))}data(){return this._data(!1).then((e=>e.data))}endpoints(e){if(null===e||void 0===e)return this.data().then((e=>e.endpoints));if("doh"===e&&(e=rA),"dns"===e&&(e=nA),"function"===typeof e)return this.data().then((t=>t.endpoints.filter(e)));if("string"===typeof e||"function"!==typeof e[Symbol.iterator])return Promise.reject(new Error("Endpoints (".concat(e,") needs to be iterable (array).")));if(-1===(e=Array.from(e).filter(Boolean)).findIndex($S))try{return Promise.resolve(e.map(VS))}catch(t){return Promise.reject(t)}return this.data().then((t=>e.map((e=>{if($S(e)){const r=t.endpointByName[e.substring(1)];if(!r)throw new Error("Endpoint ".concat(e," is not known."));return r}return VS(e)}))))}};function eA(e,t){return t=Object.assign({retries:5,timeout:3e4},t),e.question?(r=t.endpoints,function(e){return null!==e&&"object"===typeof e&&"function"===typeof e.then}(r)?r:Promise.resolve(r)).then((r=>{if(!Array.isArray(r)||0===r.length)throw new Error("No endpoints defined to lookup dns records.");return tA(r.map(VS),function(e){const t=Object.assign({type:"query"},e);return delete t.question,t.questions=[],e.question&&t.questions.push(e.question),t}(e),t)})).then((e=>(e.question=e.questions[0],delete e.questions,e))):Promise.reject(new Error("To request data you need to specify a .question!"));var r}function tA(e,t,r){const n=1===e.length?e[0]:e[Math.floor(Math.random()*e.length)%e.length];return XS(n,t,r.timeout,r.signal).then((e=>(e.endpoint=n.toString(),e)),(i=>{if("AbortError"===i.name||0===r.retries)throw i.endpoint=n.toString(),i;return r.retries>0&&(r.retries-=1),tA(e,t,r)}))}function rA(e){return"https:"===e.protocol||"http:"===e.protocol}function nA(e){return"udp4:"===e.protocol||"udp6:"===e.protocol}const iA=ai("waku:dns-over-https");class oA{static async create(e,t){const r=null!==e&&void 0!==e?e:await ZS.endpoints("doh");return new oA(r,t)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;Ze(this,"endpoints",void 0),Ze(this,"retries",void 0),this.endpoints=e,this.retries=t}async resolveTXT(e){let t;try{t=(await eA({question:{type:"TXT",name:e}},{endpoints:this.endpoints,retries:this.retries})).answers}catch(i){throw iA("query failed: ",i),new Error("DNS query failed")}if(!t)throw new Error("Could not resolve ".concat(e));const r=t.map((e=>e.data)),n=[];return r.forEach((e=>{"string"===typeof e?n.push(e):Array.isArray(e)?e.forEach((e=>{"string"===typeof e?n.push(e):n.push(Il(e))})):n.push(Il(e))})),n}}var sA=__webpack_require__(3628);class aA{static parseAndVerifyRoot(e,t){if(!e.startsWith(this.ROOT_PREFIX))throw new Error("ENRTree root entry must start with '".concat(this.ROOT_PREFIX,"'"));const r=aA.parseRootValues(e),n=sA.decode.asBytes(t),i=e.split(" sig")[0],o=_l(i,"utf8");if(!mE(_l(r.signature,"base64url").slice(0,64),yE(o),new Uint8Array(n)))throw new Error("Unable to verify ENRTree root signature");return r.eRoot}static parseRootValues(e){const t=e.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(t))throw new Error("Could not parse ENRTree root entry");t.shift();const[r,n,i,o]=t;if(!r)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!n)throw new Error("Could not parse 'l' value from ENRTree root entry");if(!i)throw new Error("Could not parse 'seq' value from ENRTree root entry");if(!o)throw new Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:r,lRoot:n,seq:Number(i),signature:o}}static parseTree(e){if(!e.startsWith(this.TREE_PREFIX))throw new Error("ENRTree tree entry must start with '".concat(this.TREE_PREFIX,"'"));const t=e.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(t))throw new Error("Could not parse ENRTree tree entry");t.shift();const[r,n]=t;if(!r)throw new Error("Could not parse public key from ENRTree tree entry");if(!n)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:r,domain:n}}static parseBranch(e){if(!e.startsWith(this.BRANCH_PREFIX))throw new Error("ENRTree branch entry must start with '".concat(this.BRANCH_PREFIX,"'"));return e.split(this.BRANCH_PREFIX)[1].split(",")}}Ze(aA,"RECORD_PREFIX",PE.RECORD_PREFIX),Ze(aA,"TREE_PREFIX","enrtree:"),Ze(aA,"BRANCH_PREFIX","enrtree-branch:"),Ze(aA,"ROOT_PREFIX","enrtree-root:");const cA=ai("waku:discovery:fetch_nodes");function lA(e,t){return t.relay>=e.relay&&t.store>=e.store&&t.filter>=e.filter&&t.lightPush>=e.lightPush}function uA(e,t){if(!e.nodeId)return!1;for(const r of t)if(e.nodeId===r.nodeId)return!1;return!0}function hA(e,t){e.relay&&(t.relay+=1),e.store&&(t.store+=1),e.filter&&(t.filter+=1),e.lightPush&&(t.lightPush+=1)}function dA(e,t,r){if(lA(t,r))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const n=function(e,t){return{relay:t.relay<e.relay,store:t.store<e.store,filter:t.filter<e.filter,lightPush:t.lightPush<e.lightPush}}(t,r);return n.relay&&e.relay||n.store&&e.store||n.filter&&e.filter||n.lightPush&&e.lightPush}const fA=ai("waku:discovery:dns");class pA{static async dnsOverHttp(e){return e||(e=await oA.create()),new pA(e)}async getPeers(e,t){const r=Math.floor(Math.random()*e.length),{publicKey:n,domain:i}=aA.parseTree(e[r]),o={domain:i,publicKey:n,visits:{}},s=await async function(e,t,r){var n,i,o,s;const a={relay:null!==(n=e.relay)&&void 0!==n?n:0,store:null!==(i=e.store)&&void 0!==i?i:0,filter:null!==(o=e.filter)&&void 0!==o?o:0,lightPush:null!==(s=e.lightPush)&&void 0!==s?s:0},c=a.relay+a.store+a.filter+a.lightPush,l={relay:0,store:0,filter:0,lightPush:0};let u=0;const h=[];for(;!lA(a,l)&&u<c+t;){const e=await r();e&&uA(e,h)&&(e.waku2&&dA(e.waku2,a,l)&&(hA(e.waku2,l),h.push(e)),cA("got new peer candidate from DNS address=".concat(e.nodeId,"@").concat(e.ip))),u++}return h}(t,this._errorTolerance,(()=>this._search(i,o)));return fA("retrieved peers: ",s.map((e=>{var t,r;return{id:null===(t=e.peerId)||void 0===t?void 0:t.toString(),multiaddrs:null===(r=e.multiaddrs)||void 0===r?void 0:r.map((e=>e.toString()))}}))),s}constructor(e){Ze(this,"dns",void 0),Ze(this,"_DNSTreeCache",void 0),Ze(this,"_errorTolerance",10),this._DNSTreeCache={},this.dns=e}async*getNextPeer(e,t){const r=Math.floor(Math.random()*e.length),{publicKey:n,domain:i}=aA.parseTree(e[r]),o={domain:i,publicKey:n,visits:{}};for await(const s of async function*(e,t,r){var n,i,o,s;const a={relay:null!==(n=e.relay)&&void 0!==n?n:0,store:null!==(i=e.store)&&void 0!==i?i:0,filter:null!==(o=e.filter)&&void 0!==o?o:0,lightPush:null!==(s=e.lightPush)&&void 0!==s?s:0},c=a.relay+a.store+a.filter+a.lightPush,l={relay:0,store:0,filter:0,lightPush:0};let u=0;const h=new Set;for(;!lA(a,l)&&u<c+t;){const e=await r();e&&e.nodeId&&!h.has(e.nodeId)&&(h.add(e.nodeId),e.waku2&&dA(e.waku2,a,l)&&(hA(e.waku2,l),yield e),cA("got new peer candidate from DNS address=".concat(e.nodeId,"@").concat(e.ip))),u++}}(t,this._errorTolerance,(()=>this._search(i,o))))yield s}async _search(e,t){try{const n=await this._getTXTRecord(e,t);let i,o;t.visits[e]=!0;const s=function(e){return e.startsWith(aA.ROOT_PREFIX)?aA.ROOT_PREFIX:e.startsWith(aA.BRANCH_PREFIX)?aA.BRANCH_PREFIX:e.startsWith(aA.RECORD_PREFIX)?aA.RECORD_PREFIX:""}(n);try{switch(s){case aA.ROOT_PREFIX:return i=aA.parseAndVerifyRoot(n,t.publicKey),await this._search(i,t);case aA.BRANCH_PREFIX:return o=aA.parseBranch(n),i=function(e,t){const r={};for(const[i,o]of e.entries())t.visits[o]&&(r[i]=!0);if(Object.keys(r).length===e.length)throw new Error("Unresolvable circular path detected");let n;do{n=Math.floor(Math.random()*e.length)}while(r[n]);return e[n]}(o,t),await this._search(i,t);case aA.RECORD_PREFIX:return o_.fromString(n);default:return null}}catch(r){return fA("Failed to search DNS tree ".concat(s," at subdomain ").concat(e,": ").concat(r)),null}}catch(r){return fA("Failed to retrieve TXT record at subdomain ".concat(e,": ").concat(r)),null}}async _getTXTRecord(e,t){if(this._DNSTreeCache[e])return this._DNSTreeCache[e];const r=e!==t.domain?"".concat(e,".").concat(t.domain):t.domain,n=await this.dns.resolveTXT(r);if(!n.length)throw new Error("Received empty result array while fetching TXT record");if(!n[0].length)throw new Error("Received empty TXT record");const i=n.join("");return this._DNSTreeCache[e]=i,i}}const gA=ai("waku:peer-discovery-dns"),yA={TEST:"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im",PROD:"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"},mA="bootstrap";class vA extends li{constructor(e,t){super(),Ze(this,"nextPeer",void 0),Ze(this,"_started",void 0),Ze(this,"_components",void 0),Ze(this,"_options",void 0),this._started=!1,this._components=e,this._options=t;const{enrUrls:r}=t;gA("Use following EIP-1459 ENR Tree URLs: ",r)}async start(){if(gA("Starting peer discovery via dns"),this._started=!0,void 0===this.nextPeer){let{enrUrls:e}=this._options;Array.isArray(e)||(e=[e]);const{wantedNodeCapabilityCount:t}=this._options,r=await pA.dnsOverHttp();this.nextPeer=r.getNextPeer.bind(r,e,t)}for await(const r of this.nextPeer()){var e,t;if(!this._started)return;const n=r.peerInfo;if(!n)continue;const i={tags:{[mA]:{value:null!==(e=this._options.tagValue)&&void 0!==e?e:50,ttl:null!==(t=this._options.tagTTL)&&void 0!==t?t:1e8}}};let o=!1;if(await this._components.peerStore.has(n.id)){(await this._components.peerStore.get(n.id)).tags.has(mA)||(o=!0,await this._components.peerStore.merge(n.id,i))}else o=!0,await this._components.peerStore.save(n.id,i);o&&this.dispatchEvent(new hi("peer",{detail:n}))}}stop(){this._started=!1}get[pE](){return!0}get[Symbol.toStringTag](){return"@waku/bootstrap"}}const bA=Symbol.for("@libp2p/topology");const wA=()=>{};class EA{constructor(e){var t,r,n,i;Ze(this,"min",void 0),Ze(this,"max",void 0),Ze(this,"peers",void 0),Ze(this,"onConnect",void 0),Ze(this,"onDisconnect",void 0),Ze(this,"registrar",void 0),Ze(this,bA,!0),this.min=null!==(t=e.min)&&void 0!==t?t:0,this.max=null!==(r=e.max)&&void 0!==r?r:1/0,this.peers=new Set,this.onConnect=null!==(n=e.onConnect)&&void 0!==n?n:wA,this.onDisconnect=null!==(i=e.onDisconnect)&&void 0!==i?i:wA}get[Symbol.toStringTag](){return bA.toString()}async setRegistrar(e){this.registrar=e}disconnect(e){this.onDisconnect(e)}}class _A{constructor(e,t,r){this.gossip=e,this.msgs=new Map,this.history=[],this.notValidatedCount=0,this.msgIdToStrFn=r;for(let n=0;n<t;n++)this.history[n]=[]}get size(){return this.msgs.size}put(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{msgIdStr:n}=e;return!this.msgs.has(n)&&(this.msgs.set(n,{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){var t;return null===(t=this.msgs.get(this.msgIdToStrFn(e)))||void 0===t?void 0:t.message}getWithIWantCount(e,t){var r;const n=this.msgs.get(e);if(!n)return null;const i=(null!==(r=n.iwantCounts.get(t))&&void 0!==r?r:0)+1;return n.iwantCounts.set(t,i),{msg:n.message,count:i}}getGossipIDs(e){const t=new Map;for(let r=0;r<this.gossip;r++)this.history[r].forEach((r=>{const n=this.msgs.get(r.msgIdStr);if(n&&n.validated&&e.has(r.topic)){let e=t.get(r.topic);e||(e=[],t.set(r.topic,e)),e.push(r.msgId)}}));return t}validate(e){const t=this.msgs.get(e);if(!t)return null;t.validated||this.notValidatedCount--;const{message:r,originatingPeers:n}=t;return t.validated=!0,t.originatingPeers=new Set,{message:r,originatingPeers:n}}shift(){this.history[this.history.length-1].forEach((e=>{const t=this.msgs.get(e.msgIdStr);t&&(this.msgs.delete(e.msgIdStr),t.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 SA=__webpack_require__(2032);const{RPC:AA}=SA,kA="/floodsub/1.0.0",IA="/meshsub/1.0.0",CA="/meshsub/1.1.0",RA=5e3;function TA(e){if(e.length<=1)return e;for(let t=0;t<e.length;t++){const r=Math.floor(Math.random()*Math.floor(e.length)),n=e[t];e[t]=e[r],e[r]=n}return e}function xA(e){return Sl(e,"base64")}const PA="StrictSign",DA="StrictNoSign";var NA,OA,LA,BA,MA,UA;function FA(e){switch(e){case NA.Ignore:return BA.Ignore;case NA.Reject:return BA.Reject}}!function(e){e.Accept="accept",e.Ignore="ignore",e.Reject="reject"}(NA||(NA={})),function(e){e.StrictSign="StrictSign",e.StrictNoSign="StrictNoSign"}(OA||(OA={})),function(e){e[e.Signing=0]="Signing",e[e.Anonymous=1]="Anonymous"}(LA||(LA={})),function(e){e.Error="error",e.Ignore="ignore",e.Reject="reject",e.Blacklisted="blacklisted"}(BA||(BA={})),function(e){e.InvalidSignature="invalid_signature",e.InvalidSeqno="invalid_seqno",e.InvalidPeerId="invalid_peerid",e.SignaturePresent="signature_present",e.SeqnoPresent="seqno_present",e.FromPresent="from_present",e.TransformFailed="transform_failed"}(MA||(MA={})),function(e){e.duplicate="duplicate",e.invalid="invalid",e.valid="valid"}(UA||(UA={}));const jA="ERR_INVALID_PEER_SCORE_PARAMS",zA={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},qA={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 KA(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...zA,...e,topics:e.topics?Object.entries(e.topics).reduce(((e,t)=>{let[r,n]=t;return e[r]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...qA,...e}}(n),e}),{}):{}}}function VA(e){if(e.topicWeight<0)throw new xd("invalid topic weight; must be >= 0",jA);if(0===e.timeInMeshQuantum)throw new xd("invalid TimeInMeshQuantum; must be non zero",jA);if(e.timeInMeshWeight<0)throw new xd("invalid TimeInMeshWeight; must be positive (or 0 to disable)",jA);if(0!==e.timeInMeshWeight&&e.timeInMeshQuantum<=0)throw new xd("invalid TimeInMeshQuantum; must be positive",jA);if(0!==e.timeInMeshWeight&&e.timeInMeshCap<=0)throw new xd("invalid TimeInMeshCap; must be positive",jA);if(e.firstMessageDeliveriesWeight<0)throw new xd("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)",jA);if(0!==e.firstMessageDeliveriesWeight&&(e.firstMessageDeliveriesDecay<=0||e.firstMessageDeliveriesDecay>=1))throw new xd("invalid FirstMessageDeliveriesDecay; must be between 0 and 1",jA);if(0!==e.firstMessageDeliveriesWeight&&e.firstMessageDeliveriesCap<=0)throw new xd("invalid FirstMessageDeliveriesCap; must be positive",jA);if(e.meshMessageDeliveriesWeight>0)throw new xd("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)",jA);if(0!==e.meshMessageDeliveriesWeight&&(e.meshMessageDeliveriesDecay<=0||e.meshMessageDeliveriesDecay>=1))throw new xd("invalid MeshMessageDeliveriesDecay; must be between 0 and 1",jA);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesCap<=0)throw new xd("invalid MeshMessageDeliveriesCap; must be positive",jA);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesThreshold<=0)throw new xd("invalid MeshMessageDeliveriesThreshold; must be positive",jA);if(e.meshMessageDeliveriesWindow<0)throw new xd("invalid MeshMessageDeliveriesWindow; must be non-negative",jA);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesActivation<1e3)throw new xd("invalid MeshMessageDeliveriesActivation; must be at least 1s",jA);if(e.meshFailurePenaltyWeight>0)throw new xd("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)",jA);if(0!==e.meshFailurePenaltyWeight&&(e.meshFailurePenaltyDecay<=0||e.meshFailurePenaltyDecay>=1))throw new xd("invalid MeshFailurePenaltyDecay; must be between 0 and 1",jA);if(e.invalidMessageDeliveriesWeight>0)throw new xd("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)",jA);if(e.invalidMessageDeliveriesDecay<=0||e.invalidMessageDeliveriesDecay>=1)throw new xd("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1",jA)}const HA={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function WA(){return{...HA,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}function GA(e,t,r,n){let i=0;Object.entries(t.topics).forEach((e=>{let[t,n]=e;const o=r.topics[t];if(void 0===o)return;let s=0;if(n.inMesh){let e=n.meshTime/o.timeInMeshQuantum;e>o.timeInMeshCap&&(e=o.timeInMeshCap),s+=e*o.timeInMeshWeight}let a=n.firstMessageDeliveries;if(a>o.firstMessageDeliveriesCap&&(a=o.firstMessageDeliveriesCap),s+=a*o.firstMessageDeliveriesWeight,n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<o.meshMessageDeliveriesThreshold){const e=o.meshMessageDeliveriesThreshold-n.meshMessageDeliveries;s+=e*e*o.meshMessageDeliveriesWeight}s+=n.meshFailurePenalty*o.meshFailurePenaltyWeight;s+=n.invalidMessageDeliveries*n.invalidMessageDeliveries*o.invalidMessageDeliveriesWeight,i+=s*o.topicWeight})),r.topicScoreCap>0&&i>r.topicScoreCap&&(i=r.topicScoreCap);const o=r.appSpecificScore(e);if(i+=o*r.appSpecificWeight,t.knownIPs.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),o=t?t.size:0;if(o>r.IPColocationFactorThreshold){const e=o-r.IPColocationFactorThreshold;i+=e*e*r.IPColocationFactorWeight}})),t.behaviourPenalty>r.behaviourPenaltyThreshold){const e=t.behaviourPenalty-r.behaviourPenaltyThreshold;i+=e*e*r.behaviourPenaltyWeight}return i}var YA,QA=__webpack_require__(8467);!function(e){e[e.unknown=0]="unknown",e[e.valid=1]="valid",e[e.invalid=2]="invalid",e[e.ignored=3]="ignored"}(YA||(YA={}));class XA{constructor(){this.records=new Map,this.queue=new QA}getRecord(e){return this.records.get(e)}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:YA.unknown,firstSeenTsMs: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 JA(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=new Set;if(t<=0)return n;for(const i of e){if(n.size>=t)break;r(i)&&(n.add(i),e.delete(i))}return n}class $A 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 ZA=jm("libp2p:gossipsub:score");class ek{constructor(e,t,r){var n;this.params=e,this.metrics=t,this.peerStats=new Map,this.peerIPs=new $A((()=>new Set)),this.scoreCache=new Map,this.deliveryRecords=new XA,function(e){for(const[r,n]of Object.entries(e.topics))try{VA(n)}catch(t){throw new xd("invalid score parameters for topic ".concat(r,": ").concat(t.message),jA)}if(e.topicScoreCap<0)throw new xd("invalid topic score cap; must be positive (or 0 for no cap)",jA);if(null===e.appSpecificScore||void 0===e.appSpecificScore)throw new xd("missing application specific score function",jA);if(e.IPColocationFactorWeight>0)throw new xd("invalid IPColocationFactorWeight; must be negative (or 0 to disable)",jA);if(0!==e.IPColocationFactorWeight&&e.IPColocationFactorThreshold<1)throw new xd("invalid IPColocationFactorThreshold; must be at least 1",jA);if(e.behaviourPenaltyWeight>0)throw new xd("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)",jA);if(0!==e.behaviourPenaltyWeight&&(e.behaviourPenaltyDecay<=0||e.behaviourPenaltyDecay>=1))throw new xd("invalid BehaviourPenaltyDecay; must be between 0 and 1",jA);if(e.decayInterval<1e3)throw new xd("invalid DecayInterval; must be at least 1s",jA);if(e.decayToZero<=0||e.decayToZero>=1)throw new xd("invalid DecayToZero; must be between 0 and 1",jA)}(e),this.scoreCacheValidityMs=r.scoreCacheValidityMs,this.computeScore=null!==(n=r.computeScore)&&void 0!==n?n:GA}get size(){return this.peerStats.size}start(){this._backgroundInterval?ZA("Peer score already running"):(this._backgroundInterval=setInterval((()=>this.background()),this.params.decayInterval),ZA("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),ZA("stopped")):ZA("Peer score already stopped")}background(){this.refreshScores(),this.deliveryRecords.gc()}dumpPeerScoreStats(){return Object.fromEntries(Array.from(this.peerStats.entries()).map((e=>{let[t,r]=e;return[t,r]})))}messageFirstSeenTimestampMs(e){const t=this.deliveryRecords.getRecord(e);return t?t.firstSeenTsMs:null}refreshScores(){const e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach(((r,n)=>{r.connected?(Object.entries(r.topics).forEach((r=>{let[n,i]=r;const o=this.params.topics[n];void 0!==o&&(i.firstMessageDeliveries*=o.firstMessageDeliveriesDecay,i.firstMessageDeliveries<t&&(i.firstMessageDeliveries=0),i.meshMessageDeliveries*=o.meshMessageDeliveriesDecay,i.meshMessageDeliveries<t&&(i.meshMessageDeliveries=0),i.meshFailurePenalty*=o.meshFailurePenaltyDecay,i.meshFailurePenalty<t&&(i.meshFailurePenalty=0),i.invalidMessageDeliveries*=o.invalidMessageDeliveriesDecay,i.invalidMessageDeliveries<t&&(i.invalidMessageDeliveries=0),i.inMesh&&(i.meshTime=e-i.graftTime,i.meshTime>o.meshMessageDeliveriesActivation&&(i.meshMessageDeliveriesActive=!0)))})),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenalty<t&&(r.behaviourPenalty=0)):e>r.expire&&(this.removeIPsForPeer(n,r.knownIPs),this.peerStats.delete(n),this.scoreCache.delete(n))}))}score(e){var t,r;null===(t=this.metrics)||void 0===t||t.scoreFnCalls.inc();const n=this.peerStats.get(e);if(!n)return 0;const i=Date.now(),o=this.scoreCache.get(e);if(o&&o.cacheUntil>i)return o.score;null===(r=this.metrics)||void 0===r||r.scoreFnRuns.inc();const s=this.computeScore(e,n,this.params,this.peerIPs),a=i+this.scoreCacheValidityMs;var c;o?(null===(c=this.metrics)||void 0===c||c.scoreCachedDelta.observe(Math.abs(s-o.score)),o.score=s,o.cacheUntil=a):this.scoreCache.set(e,{score:s,cacheUntil:a});return s}addPenalty(e,t,r){const n=this.peerStats.get(e);var i;n&&(n.behaviourPenalty+=t,null===(i=this.metrics)||void 0===i||i.onScorePenalty(r))}addPeer(e){const t={connected:!0,expire:0,topics:{},knownIPs:new Set,behaviourPenalty:0};this.peerStats.set(e,t)}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 n=this.peerIPs.get(t);n&&(n.delete(e),0===n.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((e=>{let[t,r]=e;r.firstMessageDeliveries=0;const n=this.params.topics[t].meshMessageDeliveriesThreshold;if(r.inMesh&&r.meshMessageDeliveriesActive&&r.meshMessageDeliveries<n){const e=n-r.meshMessageDeliveries;r.meshFailurePenalty+=e*e}r.inMesh=!1,r.meshMessageDeliveriesActive=!1})),t.connected=!1,t.expire=Date.now()+this.params.retainScore}}graft(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);e&&(e.inMesh=!0,e.graftTime=Date.now(),e.meshTime=0,e.meshMessageDeliveriesActive=!1)}}prune(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);if(e){const r=this.params.topics[t].meshMessageDeliveriesThreshold;if(e.meshMessageDeliveriesActive&&e.meshMessageDeliveries<r){const t=r-e.meshMessageDeliveries;e.meshFailurePenalty+=t*t}e.meshMessageDeliveriesActive=!1,e.inMesh=!1}}}validateMessage(e){this.deliveryRecords.ensureRecord(e)}deliverMessage(e,t,r){this.markFirstMessageDelivery(e,r);const n=this.deliveryRecords.ensureRecord(t),i=Date.now();n.status===YA.unknown?(n.status=YA.valid,n.validated=i,n.peers.forEach((t=>{t!==e.toString()&&this.markDuplicateMessageDelivery(t,r)}))):ZA("unexpected delivery: message from %s was first seen %s ago and has delivery status %s",e,i-n.firstSeenTsMs,YA[n.status])}rejectInvalidMessage(e,t){this.markInvalidMessageDelivery(e,t)}rejectMessage(e,t,r,n){switch(n){case BA.Error:return void this.markInvalidMessageDelivery(e,r);case BA.Blacklisted:return}const i=this.deliveryRecords.ensureRecord(t);if(i.status===YA.unknown){if(n===BA.Ignore)return i.status=YA.ignored,void i.peers.clear();i.status=YA.invalid,this.markInvalidMessageDelivery(e,r),i.peers.forEach((e=>{this.markInvalidMessageDelivery(e,r)})),i.peers.clear()}else ZA("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",e,Date.now()-i.firstSeenTsMs,YA[i.status])}duplicateMessage(e,t,r){const n=this.deliveryRecords.ensureRecord(t);if(!n.peers.has(e))switch(n.status){case YA.unknown:n.peers.add(e);break;case YA.valid:n.peers.add(e),this.markDuplicateMessageDelivery(e,r,n.validated);break;case YA.invalid:this.markInvalidMessageDelivery(e,r);case YA.ignored:}}markInvalidMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);e&&(e.invalidMessageDeliveries+=1)}}markFirstMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);if(e){let r=this.params.topics[t].firstMessageDeliveriesCap;e.firstMessageDeliveries=Math.min(r,e.firstMessageDeliveries+1),e.inMesh&&(r=this.params.topics[t].meshMessageDeliveriesCap,e.meshMessageDeliveries=Math.min(r,e.meshMessageDeliveries+1))}}}markDuplicateMessageDelivery(e,t,r){const n=this.peerStats.get(e);if(n){const e=void 0!==r?Date.now():0,o=this.getPtopicStats(n,t);if(o&&o.inMesh){const n=this.params.topics[t];if(void 0!==r){var i;const o=e-r,s=o>n.meshMessageDeliveriesWindow;if(null===(i=this.metrics)||void 0===i||i.onDuplicateMsgDelivery(t,o,s),s)return}const s=n.meshMessageDeliveriesCap;o.meshMessageDeliveries=Math.min(s,o.meshMessageDeliveries+1)}}}removeIPsForPeer(e,t){for(const r of t){const t=this.peerIPs.get(r);t&&(t.delete(e),0===t.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 tk{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=t[Math.floor(Math.random()*t.length)],n=this.msgIdToStrFn(r);let i=this.promises.get(n);i||(i=new Map,this.promises.set(n,i));const o=Date.now();i.has(e)||(i.set(e,o+this.gossipsubIWantFollowupMs),this.metrics&&(this.metrics.iwantPromiseStarted.inc(1),this.requestMsByMsg.has(n)||this.requestMsByMsg.set(n,o)))}getBrokenPromises(){var e;const t=Date.now(),r=new Map;let n=0;return this.promises.forEach(((e,i)=>{e.forEach(((i,o)=>{var s;i<t&&(r.set(o,(null!==(s=r.get(o))&&void 0!==s?s:0)+1),e.delete(o),n++)})),e.size||this.promises.delete(i)})),null===(e=this.metrics)||void 0===e||e.iwantPromiseBroken.inc(n),r}deliverMessage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[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!==BA.Error&&this.promises.delete(e)}clear(){this.promises.clear()}prune(){var e;const t=Date.now()-this.requestMsByMsgExpire;let r=0;for(const[n,i]of this.requestMsByMsg.entries()){if(!(i<t))break;this.requestMsByMsg.delete(n),r++}null===(e=this.metrics)||void 0===e||e.iwantMessagePruned.inc(r)}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 rk{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 nk,ik,ok,sk,ak,ck;!function(e){e.forward="forward",e.publish="publish"}(nk||(nk={})),function(e){e.Fanout="fanout",e.Random="random",e.Subscribed="subscribed",e.Outbound="outbound",e.NotEnough="not_enough",e.Opportunistic="opportunistic"}(ik||(ik={})),function(e){e.Dc="disconnected",e.BadScore="bad_score",e.Prune="prune",e.Excess="excess"}(ok||(ok={})),function(e){e.GraftBackoff="graft_backoff",e.BrokenPromise="broken_promise",e.MessageDeficit="message_deficit",e.IPColocation="IP_colocation"}(sk||(sk={})),function(e){e.LowScore="low_score",e.MaxIhave="max_ihave",e.MaxIasked="max_iasked"}(ak||(ak={})),function(e){e.graylist="graylist",e.publish="publish",e.gossip="gossip",e.mesh="mesh"}(ck||(ck={}));__webpack_require__(7510);var lk=__webpack_require__(548);const uk={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function hk(e,t,r,n,i){if("sha1"!==i&&"sha2-256"!==i&&"sha2-512"!==i){const e=Object.keys(uk).join(" / ");throw new xd("Hash '".concat(i,"' is unknown or not supported. Must be ").concat(e),"ERR_UNSUPPORTED_HASH_TYPE")}const o=lk(e,t,r,n,uk[i]);return Wp.encode64(o,null)}const dk=_l("libp2p-pubsub:");function fk(e){if("signed"!==e.type)throw new Error("expected signed message type");if(null==e.sequenceNumber)throw Error("missing seqno field");return((e,t)=>{const r=_l(t.toString(16).padStart(16,"0"),"base16"),n=new Uint8Array(e.length+r.length);return n.set(e,0),n.set(r,e.length),n})(e.from.toBytes(),e.sequenceNumber)}async function pk(e){return await wf.encode(e.data)}function gk(e,t,r,n,i){let o=0;const s=new Map;if(Object.entries(t.topics).forEach((e=>{var t;let[n,a]=e;const c=null!==(t=i.get(n))&&void 0!==t?t:"unknown",l=r.topics[n];if(void 0===l)return;let u=s.get(c);u||(u={p1w:0,p2w:0,p3w:0,p3bw:0,p4w:0},s.set(c,u));let h=0,d=0,f=0,p=0,g=0;if(a.inMesh){h+=Math.max(a.meshTime/l.timeInMeshQuantum,l.timeInMeshCap)*l.timeInMeshWeight}let y=a.firstMessageDeliveries;if(y>l.firstMessageDeliveriesCap&&(y=l.firstMessageDeliveriesCap),d+=y*l.firstMessageDeliveriesWeight,a.meshMessageDeliveriesActive&&a.meshMessageDeliveries<l.meshMessageDeliveriesThreshold){const e=l.meshMessageDeliveriesThreshold-a.meshMessageDeliveries;f+=e*e*l.meshMessageDeliveriesWeight}p+=a.meshFailurePenalty*l.meshFailurePenaltyWeight;g+=a.invalidMessageDeliveries*a.invalidMessageDeliveries*l.invalidMessageDeliveriesWeight,o+=(h+d+f+p+g)*l.topicWeight,u.p1w+=h,u.p2w+=d,u.p3w+=f,u.p3bw+=p,u.p4w+=g})),r.topicScoreCap>0&&o>r.topicScoreCap){o=r.topicScoreCap;const e=r.topicScoreCap/o;for(const t of s.values())t.p1w*=e,t.p2w*=e,t.p3w*=e,t.p3bw*=e,t.p4w*=e}let a=0,c=0,l=0;a+=r.appSpecificScore(e)*r.appSpecificWeight,t.knownIPs.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),i=t?t.size:0;if(i>r.IPColocationFactorThreshold){const e=i-r.IPColocationFactorThreshold;c+=e*e*r.IPColocationFactorWeight}}));return l+=t.behaviourPenalty*t.behaviourPenalty*r.behaviourPenaltyWeight,o+=a+c+l,{byTopic:s,p5w:a,p6w:c,p7w:l,score:o}}class yk{constructor(e,t,r){var n;this.rawStream=e,this.pushable=Ba({objectMode:!1}),this.closeController=new AbortController,this.maxBufferSize=null!==(n=r.maxBufferSize)&&void 0!==n?n:1/0,Fa($m(this.pushable,this.closeController.signal,{returnOnAbort:!0}),(e=>ka(e)),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 > ".concat(this.maxBufferSize));this.pushable.push(e)}close(){this.closeController.abort(),this.pushable.return(),this.rawStream.close()}}class mk{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.rawStream=e,this.closeController=new AbortController,this.source=$m(Fa(this.rawStream,(e=>Pa(e,t))),this.closeController.signal,{returnOnAbort:!0})}close(){this.closeController.abort(),this.rawStream.close()}}var vk=__webpack_require__(6516);const bk={maxSubscriptions:1/0,maxMessages:1/0,maxIhaveMessageIDs:1/0,maxIwantMessageIDs:1/0,maxControlMessages:1/0,maxPeerInfos:1/0};function wk(e,t){t={...t};const r=vk.Reader.create(e),n=e.length,i=void 0===n?r.len:r.pos+n,o={};for(;r.pos<i;){const e=r.uint32();switch(e>>>3){case 1:o.subscriptions&&o.subscriptions.length||(o.subscriptions=[]),o.subscriptions.length<t.maxSubscriptions?o.subscriptions.push(Ek(r,r.uint32())):r.skipType(7&e);break;case 2:o.messages&&o.messages.length||(o.messages=[]),o.messages.length<t.maxMessages?o.messages.push(_k(r,r.uint32())):r.skipType(7&e);break;case 3:o.control=Sk(r,r.uint32(),t);break;default:r.skipType(7&e)}}return o}function Ek(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.subscribe=e.bool();break;case 2:n.topic=e.string();break;default:e.skipType(7&t)}}return n}function _k(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.from=e.bytes();break;case 2:n.data=e.bytes();break;case 3:n.seqno=e.bytes();break;case 4:n.topic=e.string();break;case 5:n.signature=e.bytes();break;case 6:n.key=e.bytes();break;default:e.skipType(7&t)}}if(!n.topic)throw Error("missing required 'topic'");return n}function Sk(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.ihave&&i.ihave.length||(i.ihave=[]),i.ihave.length<r.maxControlMessages?i.ihave.push(Ak(e,e.uint32(),r)):e.skipType(7&t);break;case 2:i.iwant&&i.iwant.length||(i.iwant=[]),i.iwant.length<r.maxControlMessages?i.iwant.push(kk(e,e.uint32(),r)):e.skipType(7&t);break;case 3:i.graft&&i.graft.length||(i.graft=[]),i.graft.length<r.maxControlMessages?i.graft.push(Ik(e,e.uint32())):e.skipType(7&t);break;case 4:i.prune&&i.prune.length||(i.prune=[]),i.prune.length<r.maxControlMessages?i.prune.push(Ck(e,e.uint32(),r)):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function Ak(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),r.maxIhaveMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function kk(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),r.maxIwantMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);else e.skipType(7&t)}return i}function Ik(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.topicID=e.string();else e.skipType(7&t)}return n}function Ck(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.peers&&i.peers.length||(i.peers=[]),r.maxPeerInfos-- >0?i.peers.push(Rk(e,e.uint32())):e.skipType(7&t);break;case 3:i.backoff=e.uint64();break;default:e.skipType(7&t)}}return i}function Rk(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.peerID=e.bytes();break;case 2:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return n}var Tk;!function(e){e[e.ip4=4]="ip4",e[e.ip6=41]="ip6"}(Tk||(Tk={}));var xk;!function(e){e[e.started=0]="started",e[e.stopped=1]="stopped"}(xk||(xk={}));class Pk extends li{constructor(e){var t,r,n,i;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.multicodecs=[CA,IA],this.peers=new Set,this.streamsInbound=new Map,this.streamsOutbound=new Map,this.outboundInflightQueue=Ba({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:xk.stopped},this.heartbeatTimer=null,this.runHeartbeat=()=>{var e;const t=null===(e=this.metrics)||void 0===e?void 0:e.heartbeatDuration.startTimer();this.heartbeat().catch((e=>{this.log("Error running heartbeat",e)})).finally((()=>{if(null!=t&&t(),this.status.code===xk.started){clearTimeout(this.status.heartbeatTimeout);let t=this.opts.heartbeatInterval-(Date.now()-this.status.hearbeatStartMs)%this.opts.heartbeatInterval;var e;if(t<.25*this.opts.heartbeatInterval)t+=this.opts.heartbeatInterval,null===(e=this.metrics)||void 0===e||e.heartbeatSkipped.inc();this.status.heartbeatTimeout=setTimeout(this.runHeartbeat,t)}}))};const s={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,unsubcribeBackoff:1e4,graftFloodThreshold:1e4,opportunisticGraftPeers:2,opportunisticGraftTicks:60,directConnectTicks:300,...o,scoreParams:KA(o.scoreParams),scoreThresholds:WA(o.scoreThresholds)};if(this.components=e,this.decodeRpcLimits=null!==(t=s.decodeRpcLimits)&&void 0!==t?t:bk,this.globalSignaturePolicy=null!==(r=s.globalSignaturePolicy)&&void 0!==r?r:PA,s.fallbackToFloodsub&&this.multicodecs.push(kA),this.log=jm(null!==(n=s.debugName)&&void 0!==n?n:"libp2p:gossipsub"),this.opts=s,this.direct=new Set(s.directPeers.map((e=>e.id.toString()))),this.seenCache=new rk({validityMs:s.seenTTL}),this.publishedMessageIds=new rk({validityMs:s.seenTTL}),o.msgIdFn)this.msgIdFn=o.msgIdFn;else switch(this.globalSignaturePolicy){case PA:this.msgIdFn=fk;break;case DA:this.msgIdFn=pk}if(o.fastMsgIdFn&&(this.fastMsgIdFn=o.fastMsgIdFn,this.fastMsgIdCache=new rk({validityMs:s.seenTTL})),this.msgIdToStrFn=null!==(i=o.msgIdToStrFn)&&void 0!==i?i:xA,this.mcache=o.messageCache||new _A(s.mcacheGossip,s.mcacheLength,this.msgIdToStrFn),o.dataTransform&&(this.dataTransform=o.dataTransform),o.metricsRegister){if(!o.metricsTopicStrToLabel)throw Error("Must set metricsTopicStrToLabel with metrics");const e=Math.max(...Object.values(s.scoreParams.topics).map((e=>e.meshMessageDeliveriesWindow)),1e3),t=function(e,t,r){return{protocolsEnabled:e.gauge({name:"gossipsub_protocol",help:"Status of enabled protocols",labelNames:["protocol"]}),topicSubscriptionStatus:e.gauge({name:"gossipsub_topic_subscription_status",help:"Status of our subscription to this topic",labelNames:["topicStr"]}),topicPeersCount:e.gauge({name:"gossipsub_topic_peer_count",help:"Number of peers subscribed to each topic",labelNames:["topicStr"]}),meshPeerCounts:e.gauge({name:"gossipsub_mesh_peer_count",help:"Number of peers in our mesh",labelNames:["topicStr"]}),meshPeerInclusionEvents:e.gauge({name:"gossipsub_mesh_peer_inclusion_events_total",help:"Number of times we include peers in a topic mesh for different reasons",labelNames:["reason"]}),meshPeerInclusionEventsByTopic:e.gauge({name:"gossipsub_mesh_peer_inclusion_events_by_topic_total",help:"Number of times we include peers in a topic",labelNames:["topic"]}),meshPeerChurnEvents:e.gauge({name:"gossipsub_peer_churn_events_total",help:"Number of times we remove peers in a topic mesh for different reasons",labelNames:["reason"]}),meshPeerChurnEventsByTopic:e.gauge({name:"gossipsub_peer_churn_events_by_topic_total",help:"Number of times we remove peers in a topic",labelNames:["topic"]}),peersPerProtocol:e.gauge({name:"gossipsub_peers_per_protocol_count",help:"Peers connected for each topic",labelNames:["protocol"]}),heartbeatDuration:e.histogram({name:"gossipsub_heartbeat_duration_seconds",help:"The time it takes to complete one iteration of the heartbeat",buckets:[.01,.1,1]}),heartbeatSkipped:e.gauge({name:"gossipsub_heartbeat_skipped",help:"Heartbeat run took longer than heartbeat interval so next is skipped"}),asyncValidationResult:e.gauge({name:"gossipsub_async_validation_result_total",help:"Message validation result",labelNames:["acceptance"]}),asyncValidationResultByTopic:e.gauge({name:"gossipsub_async_validation_result_by_topic_total",help:"Message validation result for each topic",labelNames:["topic"]}),asyncValidationMcacheHit:e.gauge({name:"gossipsub_async_validation_mcache_hit_total",help:"Async validation result reported by the user layer",labelNames:["hit"]}),asyncValidationDelayFromFirstSeenSec:e.histogram({name:"gossipsub_async_validation_delay_from_first_seen",help:"Async validation report delay from first seen in second",labelNames:["topic"],buckets:[.01,.03,.1,.3,1,3,10]}),asyncValidationUnknownFirstSeen:e.gauge({name:"gossipsub_async_validation_unknown_first_seen_count_total",help:"Async validation report unknown first seen value for message"}),peerReadStreamError:e.gauge({name:"gossipsub_peer_read_stream_err_count_total",help:"Peer read stream error"}),rpcRecvBytes:e.gauge({name:"gossipsub_rpc_recv_bytes_total",help:"RPC recv"}),rpcRecvCount:e.gauge({name:"gossipsub_rpc_recv_count_total",help:"RPC recv"}),rpcRecvSubscription:e.gauge({name:"gossipsub_rpc_recv_subscription_total",help:"RPC recv"}),rpcRecvMessage:e.gauge({name:"gossipsub_rpc_recv_message_total",help:"RPC recv"}),rpcRecvControl:e.gauge({name:"gossipsub_rpc_recv_control_total",help:"RPC recv"}),rpcRecvIHave:e.gauge({name:"gossipsub_rpc_recv_ihave_total",help:"RPC recv"}),rpcRecvIWant:e.gauge({name:"gossipsub_rpc_recv_iwant_total",help:"RPC recv"}),rpcRecvGraft:e.gauge({name:"gossipsub_rpc_recv_graft_total",help:"RPC recv"}),rpcRecvPrune:e.gauge({name:"gossipsub_rpc_recv_prune_total",help:"RPC recv"}),rpcDataError:e.gauge({name:"gossipsub_rpc_data_err_count_total",help:"RPC data error"}),rpcRecvError:e.gauge({name:"gossipsub_rpc_recv_err_count_total",help:"RPC recv error"}),rpcRecvNotAccepted:e.gauge({name:"gossipsub_rpc_rcv_not_accepted_total",help:"Total count of RPC dropped because acceptFrom() == false"}),rpcSentBytes:e.gauge({name:"gossipsub_rpc_sent_bytes_total",help:"RPC sent"}),rpcSentCount:e.gauge({name:"gossipsub_rpc_sent_count_total",help:"RPC sent"}),rpcSentSubscription:e.gauge({name:"gossipsub_rpc_sent_subscription_total",help:"RPC sent"}),rpcSentMessage:e.gauge({name:"gossipsub_rpc_sent_message_total",help:"RPC sent"}),rpcSentControl:e.gauge({name:"gossipsub_rpc_sent_control_total",help:"RPC sent"}),rpcSentIHave:e.gauge({name:"gossipsub_rpc_sent_ihave_total",help:"RPC sent"}),rpcSentIWant:e.gauge({name:"gossipsub_rpc_sent_iwant_total",help:"RPC sent"}),rpcSentGraft:e.gauge({name:"gossipsub_rpc_sent_graft_total",help:"RPC sent"}),rpcSentPrune:e.gauge({name:"gossipsub_rpc_sent_prune_total",help:"RPC sent"}),msgPublishCount:e.gauge({name:"gossipsub_msg_publish_count_total",help:"Total count of msg published by topic",labelNames:["topic"]}),msgPublishPeersByTopic:e.gauge({name:"gossipsub_msg_publish_peers_total",help:"Total count of peers that we publish a msg to",labelNames:["topic"]}),msgPublishPeersByGroup:e.gauge({name:"gossipsub_msg_publish_peers_by_group",help:"Total count of peers (by group) that we publish a msg to",labelNames:["peerGroup"]}),msgPublishBytes:e.gauge({name:"gossipsub_msg_publish_bytes_total",help:"Total count of msg publish data.length bytes",labelNames:["topic"]}),msgForwardCount:e.gauge({name:"gossipsub_msg_forward_count_total",help:"Total count of msg forwarded by topic",labelNames:["topic"]}),msgForwardPeers:e.gauge({name:"gossipsub_msg_forward_peers_total",help:"Total count of peers that we forward a msg to",labelNames:["topic"]}),msgReceivedPreValidation:e.gauge({name:"gossipsub_msg_received_prevalidation_total",help:"Total count of recv msgs before any validation",labelNames:["topic"]}),msgReceivedError:e.gauge({name:"gossipsub_msg_received_error_total",help:"Total count of recv msgs error",labelNames:["topic"]}),msgReceivedStatus:e.gauge({name:"gossipsub_msg_received_status_total",help:"Tracks distribution of recv msgs by duplicate, invalid, valid",labelNames:["status"]}),msgReceivedTopic:e.gauge({name:"gossipsub_msg_received_topic_total",help:"Tracks distribution of recv msgs by topic label",labelNames:["topic"]}),msgReceivedInvalid:e.gauge({name:"gossipsub_msg_received_invalid_total",help:"Tracks specific reason of invalid",labelNames:["error"]}),msgReceivedInvalidByTopic:e.gauge({name:"gossipsub_msg_received_invalid_by_topic_total",help:"Tracks specific invalid message by topic",labelNames:["topic"]}),duplicateMsgDeliveryDelay:e.histogram({name:"gossisub_duplicate_msg_delivery_delay_seconds",help:"Time since the 1st duplicated message validated",labelNames:["topic"],buckets:[.25*r.maxMeshMessageDeliveriesWindowSec,.5*r.maxMeshMessageDeliveriesWindowSec,1*r.maxMeshMessageDeliveriesWindowSec,2*r.maxMeshMessageDeliveriesWindowSec,4*r.maxMeshMessageDeliveriesWindowSec]}),duplicateMsgLateDelivery:e.gauge({name:"gossisub_duplicate_msg_late_delivery_total",help:"Total count of late duplicate message delivery by topic, which triggers P3 penalty",labelNames:["topic"]}),duplicateMsgIgnored:e.gauge({name:"gossisub_ignored_published_duplicate_msgs_total",help:"Total count of published duplicate message ignored by topic",labelNames:["topic"]}),scoreFnCalls:e.gauge({name:"gossipsub_score_fn_calls_total",help:"Total times score() is called"}),scoreFnRuns:e.gauge({name:"gossipsub_score_fn_runs_total",help:"Total times score() call actually computed computeScore(), no cache"}),scoreCachedDelta:e.histogram({name:"gossipsub_score_cache_delta",help:"Delta of score between cached values that expired",buckets:[10,100,1e3]}),peersByScoreThreshold:e.gauge({name:"gossipsub_peers_by_score_threshold_count",help:"Current count of peers by score threshold",labelNames:["threshold"]}),score:e.avgMinMax({name:"gossipsub_score",help:"Avg min max of gossip scores"}),scoreWeights:e.avgMinMax({name:"gossipsub_score_weights",help:"Separate score weights",labelNames:["topic","p"]}),scorePerMesh:e.avgMinMax({name:"gossipsub_score_per_mesh",help:"Histogram of the scores for each mesh topic",labelNames:["topic"]}),scoringPenalties:e.gauge({name:"gossipsub_scoring_penalties_total",help:"A counter of the kind of penalties being applied to peers",labelNames:["penalty"]}),behaviourPenalty:e.histogram({name:"gossipsub_peer_stat_behaviour_penalty",help:"Current peer stat behaviour_penalty at each scrape",buckets:[.25*r.behaviourPenaltyThreshold,.5*r.behaviourPenaltyThreshold,1*r.behaviourPenaltyThreshold,2*r.behaviourPenaltyThreshold,4*r.behaviourPenaltyThreshold]}),ihaveRcvIgnored:e.gauge({name:"gossipsub_ihave_rcv_ignored_total",help:"Total received IHAVE messages that we ignore for some reason",labelNames:["reason"]}),ihaveRcvMsgids:e.gauge({name:"gossipsub_ihave_rcv_msgids_total",help:"Total received IHAVE messages by topic",labelNames:["topic"]}),ihaveRcvNotSeenMsgids:e.gauge({name:"gossipsub_ihave_rcv_not_seen_msgids_total",help:"Total messages per topic we do not have, not actual requests",labelNames:["topic"]}),iwantRcvMsgids:e.gauge({name:"gossipsub_iwant_rcv_msgids_total",help:"Total received IWANT messages by topic",labelNames:["topic"]}),iwantRcvDonthaveMsgids:e.gauge({name:"gossipsub_iwant_rcv_dont_have_msgids_total",help:"Total requested messageIDs that we do not have"}),iwantPromiseStarted:e.gauge({name:"gossipsub_iwant_promise_sent_total",help:"Total count of started IWANT promises"}),iwantPromiseResolved:e.gauge({name:"gossipsub_iwant_promise_resolved_total",help:"Total count of resolved IWANT promises"}),iwantPromiseResolvedFromDuplicate:e.gauge({name:"gossipsub_iwant_promise_resolved_from_duplicate_total",help:"Total count of resolved IWANT promises from duplicate messages"}),iwantPromiseResolvedPeers:e.gauge({name:"gossipsub_iwant_promise_resolved_peers",help:"Total count of peers we have asked IWANT promises that are resolved"}),iwantPromiseBroken:e.gauge({name:"gossipsub_iwant_promise_broken",help:"Total count of broken IWANT promises"}),iwantMessagePruned:e.gauge({name:"gossipsub_iwant_message_pruned",help:"Total count of pruned IWANT messages"}),iwantPromiseDeliveryTime:e.histogram({name:"gossipsub_iwant_promise_delivery_seconds",help:"Histogram of delivery time of resolved IWANT promises",buckets:[.5*r.gossipPromiseExpireSec,1*r.gossipPromiseExpireSec,2*r.gossipPromiseExpireSec,4*r.gossipPromiseExpireSec]}),iwantPromiseUntracked:e.gauge({name:"gossip_iwant_promise_untracked",help:"Total count of untracked IWANT promise"}),connectedPeersBackoffSec:e.histogram({name:"gossipsub_connected_peers_backoff_seconds",help:"Backoff time in seconds",buckets:[1,2,4,10,20,60,120]}),cacheSize:e.gauge({name:"gossipsub_cache_size",help:"Unbounded cache sizes",labelNames:["cache"]}),mcacheSize:e.gauge({name:"gossipsub_mcache_size",help:"Current mcache msg count"}),mcacheNotValidatedCount:e.gauge({name:"gossipsub_mcache_not_validated_count",help:"Current mcache msg count not validated"}),fastMsgIdCacheCollision:e.gauge({name:"gossipsub_fastmsgid_cache_collision_total",help:"Total count of key collisions on fastmsgid cache put"}),newConnectionCount:e.gauge({name:"gossipsub_new_connection_total",help:"Total new connection by status",labelNames:["status"]}),topicStrToLabel:t,toTopic(e){var t;return null!==(t=this.topicStrToLabel.get(e))&&void 0!==t?t:e},onJoin(e){this.topicSubscriptionStatus.set({topicStr:e},1),this.meshPeerCounts.set({topicStr:e},0)},onLeave(e){this.topicSubscriptionStatus.set({topicStr:e},0),this.meshPeerCounts.set({topicStr:e},0)},onAddToMesh(e,t,r){const n=this.toTopic(e);this.meshPeerInclusionEvents.inc({reason:t},r),this.meshPeerInclusionEventsByTopic.inc({topic:n},r)},onRemoveFromMesh(e,t,r){const n=this.toTopic(e);this.meshPeerChurnEvents.inc({reason:t},r),this.meshPeerChurnEventsByTopic.inc({topic:n},r)},onReportValidation(e,t,r){if(this.asyncValidationMcacheHit.inc({hit:null!=e?"hit":"miss"}),null!=e){const r=this.toTopic(e.message.topic);this.asyncValidationResult.inc({acceptance:t}),this.asyncValidationResultByTopic.inc({topic:r})}null!=r?this.asyncValidationDelayFromFirstSeenSec.observe((Date.now()-r)/1e3):this.asyncValidationUnknownFirstSeen.inc()},onScorePenalty(e){this.scoringPenalties.inc({penalty:e},1)},onIhaveRcv(e,t,r){const n=this.toTopic(e);this.ihaveRcvMsgids.inc({topic:n},t),this.ihaveRcvNotSeenMsgids.inc({topic:n},r)},onIwantRcv(e,t){for(const[r,n]of e){const e=this.toTopic(r);this.iwantRcvMsgids.inc({topic:e},n)}this.iwantRcvDonthaveMsgids.inc(t)},onForwardMsg(e,t){const r=this.toTopic(e);this.msgForwardCount.inc({topic:r},1),this.msgForwardPeers.inc({topic:r},t)},onPublishMsg(e,t,r,n){const i=this.toTopic(e);this.msgPublishCount.inc({topic:i},1),this.msgPublishBytes.inc({topic:i},r*n),this.msgPublishPeersByTopic.inc({topic:i},r),this.msgPublishPeersByGroup.inc({peerGroup:"direct"},t.direct),this.msgPublishPeersByGroup.inc({peerGroup:"floodsub"},t.floodsub),this.msgPublishPeersByGroup.inc({peerGroup:"mesh"},t.mesh),this.msgPublishPeersByGroup.inc({peerGroup:"fanout"},t.fanout)},onMsgRecvPreValidation(e){const t=this.toTopic(e);this.msgReceivedPreValidation.inc({topic:t},1)},onMsgRecvError(e){const t=this.toTopic(e);this.msgReceivedError.inc({topic:t},1)},onMsgRecvResult(e,t){const r=this.toTopic(e);this.msgReceivedTopic.inc({topic:r}),this.msgReceivedStatus.inc({status:t})},onMsgRecvInvalid(e,t){const r=this.toTopic(e),n=t.reason===BA.Error?t.error:t.reason;this.msgReceivedInvalid.inc({error:n},1),this.msgReceivedInvalidByTopic.inc({topic:r},1)},onDuplicateMsgDelivery(e,t,r){if(this.duplicateMsgDeliveryDelay.observe(t/1e3),r){const t=this.toTopic(e);this.duplicateMsgLateDelivery.inc({topic:t},1)}},onPublishDuplicateMsg(e){const t=this.toTopic(e);this.duplicateMsgIgnored.inc({topic:t},1)},onPeerReadStreamError(){this.peerReadStreamError.inc(1)},onRpcRecvError(){this.rpcRecvError.inc(1)},onRpcDataError(){this.rpcDataError.inc(1)},onRpcRecv(e,t){this.rpcRecvBytes.inc(t),this.rpcRecvCount.inc(1),e.subscriptions&&this.rpcRecvSubscription.inc(e.subscriptions.length),e.messages&&this.rpcRecvMessage.inc(e.messages.length),e.control&&(this.rpcRecvControl.inc(1),e.control.ihave&&this.rpcRecvIHave.inc(e.control.ihave.length),e.control.iwant&&this.rpcRecvIWant.inc(e.control.iwant.length),e.control.graft&&this.rpcRecvGraft.inc(e.control.graft.length),e.control.prune&&this.rpcRecvPrune.inc(e.control.prune.length))},onRpcSent(e,t){if(this.rpcSentBytes.inc(t),this.rpcSentCount.inc(1),e.subscriptions&&this.rpcSentSubscription.inc(e.subscriptions.length),e.messages&&this.rpcSentMessage.inc(e.messages.length),e.control){var r,n,i,o,s,a,c,l;const t=null!==(r=null===(n=e.control.ihave)||void 0===n?void 0:n.length)&&void 0!==r?r:0,u=null!==(i=null===(o=e.control.iwant)||void 0===o?void 0:o.length)&&void 0!==i?i:0,h=null!==(s=null===(a=e.control.graft)||void 0===a?void 0:a.length)&&void 0!==s?s:0,d=null!==(c=null===(l=e.control.prune)||void 0===l?void 0:l.length)&&void 0!==c?c:0;t>0&&this.rpcSentIHave.inc(t),u>0&&this.rpcSentIWant.inc(u),h>0&&this.rpcSentGraft.inc(h),d>0&&this.rpcSentPrune.inc(d),(t>0||u>0||h>0||d>0)&&this.rpcSentControl.inc(1)}},registerScores(e,t){let r=0,n=0,i=0,o=0;for(const s of e)s>=t.graylistThreshold&&r++,s>=t.publishThreshold&&n++,s>=t.gossipThreshold&&i++,s>=0&&o++;this.peersByScoreThreshold.set({threshold:ck.graylist},r),this.peersByScoreThreshold.set({threshold:ck.publish},n),this.peersByScoreThreshold.set({threshold:ck.gossip},i),this.peersByScoreThreshold.set({threshold:ck.mesh},o),this.score.set(e)},registerScoreWeights(e){for(const[t,r]of e.byTopic)this.scoreWeights.set({topic:t,p:"p1"},r.p1w),this.scoreWeights.set({topic:t,p:"p2"},r.p2w),this.scoreWeights.set({topic:t,p:"p3"},r.p3w),this.scoreWeights.set({topic:t,p:"p3b"},r.p3bw),this.scoreWeights.set({topic:t,p:"p4"},r.p4w);this.scoreWeights.set({p:"p5"},e.p5w),this.scoreWeights.set({p:"p6"},e.p6w),this.scoreWeights.set({p:"p7"},e.p7w)},registerScorePerMesh(e,t){const r=new Map;e.forEach(((e,t)=>{var n;const i=null!==(n=this.topicStrToLabel.get(t))&&void 0!==n?n:"unknown";let o=r.get(i);o||(o=new Set,r.set(i,o)),e.forEach((e=>{var t;return null===(t=o)||void 0===t?void 0:t.add(e)}))}));for(const[n,i]of r){const e=[];i.forEach((r=>{var n;e.push(null!==(n=t.get(r))&&void 0!==n?n:0)})),this.scorePerMesh.set({topic:n},e)}}}}(o.metricsRegister,o.metricsTopicStrToLabel,{gossipPromiseExpireSec:this.opts.gossipsubIWantFollowupMs/1e3,behaviourPenaltyThreshold:s.scoreParams.behaviourPenaltyThreshold,maxMeshMessageDeliveriesWindowSec:e/1e3});t.mcacheSize.addCollect((()=>this.onScrapeMetrics(t)));for(const r of this.multicodecs)t.protocolsEnabled.set({protocol:r},1);this.metrics=t}else this.metrics=null;this.gossipTracer=new tk(this.opts.gossipsubIWantFollowupMs,this.msgIdToStrFn,this.metrics),this.score=new ek(this.opts.scoreParams,this.metrics,{scoreCacheValidityMs:s.heartbeatInterval}),this.maxInboundStreams=o.maxInboundStreams,this.maxOutboundStreams=o.maxOutboundStreams,this.allowedTopics=s.allowedTopics?new Set(s.allowedTopics):null}getPeers(){return[...this.peers.keys()].map((e=>Tm(e)))}isStarted(){return this.status.code===xk.started}async start(){if(this.isStarted())return;this.log("starting"),this.publishConfig=await async function(e,t){switch(e){case PA:{if(!t)throw Error("Must provide PeerId");if(null==t.privateKey)throw Error("Cannot sign message, no private key present");if(null==t.publicKey)throw Error("Cannot sign message, no public key present");const e=await Ty(t.privateKey);return{type:LA.Signing,author:t,key:t.publicKey,privateKey:e}}case DA:return{type:LA.Anonymous};default:throw new Error('Unknown signature policy "'.concat(e,'"'))}}(this.globalSignaturePolicy,this.components.peerId),this.outboundInflightQueue=Ba({objectMode:!0}),Fa(this.outboundInflightQueue,(async e=>{for await(const{peerId:t,connection:r}of e)await this.createOutboundStream(t,r)})).catch((e=>this.log.error("outbound inflight queue error",e))),await Promise.all(this.opts.directPeers.map((async e=>{await this.components.peerStore.merge(e.id,{multiaddrs:e.addrs})})));const e=this.components.registrar;await Promise.all(this.multicodecs.map((t=>e.handle(t,this.onIncomingStream.bind(this),{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}))));const t=(r={onConnect:this.onPeerConnected.bind(this),onDisconnect:this.onPeerDisconnected.bind(this)},new EA(r));var r;const n=await Promise.all(this.multicodecs.map((r=>e.register(r,t)))),i=setTimeout(this.runHeartbeat,100);this.status={code:xk.started,registrarTopologyIds:n,heartbeatTimeout:i,hearbeatStartMs:Date.now()+100},this.score.start(),this.directPeerInitial=setTimeout((()=>{Promise.resolve().then((async()=>{await Promise.all(Array.from(this.direct).map((async e=>await this.connect(e))))})).catch((e=>{this.log(e)}))}),1e3),this.log("started")}async stop(){if(this.log("stopping"),this.status.code!==xk.started)return;const{registrarTopologyIds:e}=this.status;this.status={code:xk.stopped};const t=this.components.registrar;await Promise.all(this.multicodecs.map((e=>t.unhandle(e)))),e.forEach((e=>t.unregister(e))),this.outboundInflightQueue.end();for(const r of this.streamsOutbound.values())r.close();this.streamsOutbound.clear();for(const r of this.streamsInbound.values())r.close();this.streamsInbound.clear(),this.peers.clear(),this.subscriptions.clear(),this.heartbeatTimer&&(this.heartbeatTimer.cancel(),this.heartbeatTimer=null),this.score.stop(),this.mesh.clear(),this.fanout.clear(),this.fanoutLastpub.clear(),this.gossip.clear(),this.control.clear(),this.peerhave.clear(),this.iasked.clear(),this.backoff.clear(),this.outbound.clear(),this.gossipTracer.clear(),this.seenCache.clear(),this.fastMsgIdCache&&this.fastMsgIdCache.clear(),this.directPeerInitial&&clearTimeout(this.directPeerInitial),this.log("stopped")}dumpPeerScoreStats(){return this.score.dumpPeerScoreStats()}onIncomingStream(e){let{stream:t,connection:r}=e;if(!this.isStarted())return;const n=r.remotePeer;this.addPeer(n,r.stat.direction,r.remoteAddr),this.createInboundStream(n,t),this.outboundInflightQueue.push({peerId:n,connection:r})}onPeerConnected(e,t){var r;null===(r=this.metrics)||void 0===r||r.newConnectionCount.inc({status:t.stat.status}),this.isStarted()&&"OPEN"===t.stat.status&&(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)}async createOutboundStream(e,t){if(!this.isStarted())return;const r=e.toString();if(this.peers.has(r)&&!this.streamsOutbound.has(r))try{var n;const i=new yk(await t.newStream(this.multicodecs),(e=>this.log.error("outbound pipe error",e)),{maxBufferSize:this.opts.maxOutboundBufferSize});this.log("create outbound stream %p",e),this.streamsOutbound.set(r,i);const o=i.protocol;o===kA&&this.floodsubPeers.add(r),null===(n=this.metrics)||void 0===n||n.peersPerProtocol.inc({protocol:o},1),this.subscriptions.size>0&&(this.log("send subscriptions to",r),this.sendSubscriptions(r,Array.from(this.subscriptions),!0))}catch(i){this.log.error("createOutboundStream error",i)}}async createInboundStream(e,t){if(!this.isStarted())return;const r=e.toString();if(!this.peers.has(r))return;const n=this.streamsInbound.get(r);void 0!==n&&(this.log("replacing existing inbound steam %s",r),n.close()),this.log("create inbound stream %s",r);const i=new mk(t,{maxDataLength:this.opts.maxInboundDataLength});this.streamsInbound.set(r,i),this.pipePeerReadStream(e,i.source).catch((e=>this.log(e)))}addPeer(e,t,r){const n=e.toString();if(!this.peers.has(n)){this.log("new peer %p",e),this.peers.add(n),this.score.addPeer(n);const i=function(e){for(const t of e.tuples())switch(t[0]){case Tk.ip4:case Tk.ip6:return Rn(t[0],t[1])}return null}(r);null!==i?this.score.addIP(n,i):this.log("Added peer has no IP in current address %s %s",n,r.toString()),this.outbound.has(n)||this.outbound.set(n,"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),n=this.streamsInbound.get(t);var i;r&&(null===(i=this.metrics)||void 0===i||i.peersPerProtocol.inc({protocol:r.protocol},-1));null===r||void 0===r||r.close(),null===n||void 0===n||n.close(),this.streamsOutbound.delete(t),this.streamsInbound.delete(t);for(const s of this.topics.values())s.delete(t);for(const[s,a]of this.mesh){var o;if(!0===a.delete(t))null===(o=this.metrics)||void 0===o||o.onRemoveFromMesh(s,ok.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===xk.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((e=>Tm(e)))}getTopics(){return Array.from(this.subscriptions)}async pipePeerReadStream(e,t){try{await Fa(t,(async t=>{for await(const a of t)try{var r;const t=a.subarray(),i=wk(t,this.decodeRpcLimits);if(null===(r=this.metrics)||void 0===r||r.onRpcRecv(i,t.length),this.opts.awaitRpcHandler)try{await this.handleReceivedRpc(e,i)}catch(o){var n;null===(n=this.metrics)||void 0===n||n.onRpcRecvError(),this.log(o)}else this.handleReceivedRpc(e,i).catch((e=>{var t;null===(t=this.metrics)||void 0===t||t.onRpcRecvError(),this.log(e)}))}catch(s){var i;null===(i=this.metrics)||void 0===i||i.onRpcDataError(),this.log(s)}}))}catch(n){var r;null===(r=this.metrics)||void 0===r||r.onPeerReadStreamError(),this.handlePeerReadStreamError(n,e)}}handlePeerReadStreamError(e,t){this.log.error(e),this.onPeerDisconnected(t)}async handleReceivedRpc(e,t){var r;if(!this.acceptFrom(e.toString()))return this.log("received message from unacceptable peer %p",e),void(null===(r=this.metrics)||void 0===r||r.rpcRecvNotAccepted.inc());const n=t.subscriptions?t.subscriptions.length:0,i=t.messages?t.messages.length:0;let o=0,s=0,a=0,c=0;if(t.control&&(t.control.ihave&&(o=t.control.ihave.length),t.control.iwant&&(s=t.control.iwant.length),t.control.graft&&(a=t.control.graft.length),t.control.prune&&(c=t.control.prune.length)),this.log("rpc.from ".concat(e.toString()," subscriptions ").concat(n," messages ").concat(i," ihave ").concat(o," iwant ").concat(s," graft ").concat(a," prune ").concat(c)),t.subscriptions&&t.subscriptions.length>0){const r=[];t.subscriptions.forEach((t=>{const n=t.topic,i=!0===t.subscribe;if(null!=n){if(this.allowedTopics&&!this.allowedTopics.has(n))return;this.handleReceivedSubscription(e,n,i),r.push({topic:n,subscribe:i})}})),this.dispatchEvent(new hi("subscription-change",{detail:{peerId:e,subscriptions:r}}))}if(t.messages)for(const l of t.messages){if(this.allowedTopics&&!this.allowedTopics.has(l.topic))continue;const t=this.handleReceivedMessage(e,l).catch((e=>{var t;null===(t=this.metrics)||void 0===t||t.onMsgRecvError(l.topic),this.log(e)}));this.opts.awaitRpcMessageHandler&&await t}t.control&&await this.handleControlMessage(e.toString(),t.control)}handleReceivedSubscription(e,t,r){this.log("subscription update from %p topic %s",e,t);let n=this.topics.get(t);null==n&&(n=new Set,this.topics.set(t,n)),r?n.add(e.toString()):n.delete(e.toString())}async handleReceivedMessage(e,t){var r,n,i;null===(r=this.metrics)||void 0===r||r.onMsgRecvPreValidation(t.topic);const o=await this.validateReceivedMessage(e,t);switch(null===(n=this.metrics)||void 0===n||n.onMsgRecvResult(t.topic,o.code),o.code){case UA.duplicate:return this.score.duplicateMessage(e.toString(),o.msgIdStr,t.topic),this.gossipTracer.deliverMessage(o.msgIdStr,!0),void this.mcache.observeDuplicate(o.msgIdStr,e.toString());case UA.invalid:if(o.msgIdStr){const r=o.msgIdStr;this.score.rejectMessage(e.toString(),r,t.topic,o.reason),this.gossipTracer.rejectMessage(r,o.reason)}else this.score.rejectInvalidMessage(e.toString(),t.topic);return void(null===(i=this.metrics)||void 0===i||i.onMsgRecvInvalid(t.topic,o));case UA.valid:if(this.score.validateMessage(o.messageId.msgIdStr),this.gossipTracer.deliverMessage(o.messageId.msgIdStr),this.mcache.put(o.messageId,t,!this.opts.asyncValidation),this.subscriptions.has(t.topic)){this.components.peerId.equals(e)&&!this.opts.emitSelf||(super.dispatchEvent(new hi("gossipsub:message",{detail:{propagationSource:e,msgId:o.messageId.msgIdStr,msg:o.msg}})),super.dispatchEvent(new hi("message",{detail:o.msg})))}this.opts.asyncValidation||this.forwardMessage(o.messageId.msgIdStr,t,e.toString())}}async validateReceivedMessage(e,t){var r,n;const i=null===(r=this.fastMsgIdFn)||void 0===r?void 0:r.call(this,t),o=void 0!==i?null===(n=this.fastMsgIdCache)||void 0===n?void 0:n.get(i):void 0;if(o)return{code:UA.duplicate,msgIdStr:o};const s=await async function(e,t){var r;switch(e){case DA:return null!=t.signature?{valid:!1,error:MA.SignaturePresent}:null!=t.seqno?{valid:!1,error:MA.SeqnoPresent}:null!=t.key?{valid:!1,error:MA.FromPresent}:{valid:!0,message:{type:"unsigned",topic:t.topic,data:null!==(r=t.data)&&void 0!==r?r:new Uint8Array(0)}};case PA:{var n,i;if(null==t.seqno)return{valid:!1,error:MA.InvalidSeqno};if(8!==t.seqno.length)return{valid:!1,error:MA.InvalidSeqno};if(null==t.signature)return{valid:!1,error:MA.InvalidSignature};if(null==t.from)return{valid:!1,error:MA.InvalidPeerId};let e,r;try{e=xm(t.from)}catch(o){return{valid:!1,error:MA.InvalidPeerId}}if(t.key){if(r=Cy(t.key),void 0!==e.publicKey&&!_f(r.bytes,e.publicKey))return{valid:!1,error:MA.InvalidPeerId}}else{if(null==e.publicKey)return{valid:!1,error:MA.InvalidPeerId};r=Cy(e.publicKey)}const s={from:t.from,data:t.data,seqno:t.seqno,topic:t.topic,signature:void 0,key:void 0},a=Sd([dk,AA.Message.encode(s).finish()]);return await r.verify(a,t.signature)?{valid:!0,message:{type:"signed",from:e,data:null!==(n=t.data)&&void 0!==n?n:new Uint8Array(0),sequenceNumber:BigInt("0x".concat(Sl(t.seqno,"base16"))),topic:t.topic,signature:t.signature,key:null!==(i=t.key)&&void 0!==i?i:Ry(r)}}:{valid:!1,error:MA.InvalidSignature}}}}(this.globalSignaturePolicy,t);if(!s.valid)return{code:UA.invalid,reason:BA.Error,error:s.error};const a=s.message;try{this.dataTransform&&(a.data=this.dataTransform.inboundTransform(t.topic,a.data))}catch(f){return this.log("Invalid message, transform failed",f),{code:UA.invalid,reason:BA.Error,error:MA.TransformFailed}}const c=await this.msgIdFn(a),l=this.msgIdToStrFn(c),u={msgId:c,msgIdStr:l};if(void 0!==i&&this.fastMsgIdCache){var h;if(this.fastMsgIdCache.put(i,l))null===(h=this.metrics)||void 0===h||h.fastMsgIdCacheCollision.inc()}if(this.seenCache.has(l))return{code:UA.duplicate,msgIdStr:l};this.seenCache.put(l);const d=this.topicValidators.get(t.topic);if(null!=d){let t;try{t=await d(e,a)}catch(f){const e=f.code;"ERR_TOPIC_VALIDATOR_IGNORE"===e&&(t=NA.Ignore),t="ERR_TOPIC_VALIDATOR_REJECT"===e?NA.Reject:NA.Ignore}if(t!==NA.Accept)return{code:UA.invalid,reason:FA(t),msgIdStr:l}}return{code:UA.valid,messageId:u,msg:a}}getScore(e){return this.score.score(e)}sendSubscriptions(e,t,r){this.sendRpc(e,{subscriptions:t.map((e=>({topic:e,subscribe:r})))})}async handleControlMessage(e,t){var r;if(void 0===t)return;const n=t.ihave?this.handleIHave(e,t.ihave):[],i=t.iwant?this.handleIWant(e,t.iwant):[],o=t.graft?await this.handleGraft(e,t.graft):[];if(t.prune&&await this.handlePrune(e,t.prune),!n.length&&!i.length&&!o.length)return;const s=this.sendRpc(e,{messages:i,control:{iwant:n,prune:o}}),a=null===(r=n[0])||void 0===r?void 0:r.messageIDs;var c;a&&(s?this.gossipTracer.addPromise(e,a):null===(c=this.metrics)||void 0===c||c.iwantPromiseUntracked.inc(1))}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 n=this.score.score(e);return n>=0?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+1e3}):this.acceptFromWhitelist.delete(e),n>=this.opts.scoreThresholds.graylistThreshold}handleIHave(e,t){var r,n;if(!t.length)return[];const i=this.score.score(e);var o;if(i<this.opts.scoreThresholds.gossipThreshold)return this.log("IHAVE: ignoring peer %s with score below threshold [ score = %d ]",e,i),null===(o=this.metrics)||void 0===o||o.ihaveRcvIgnored.inc({reason:ak.LowScore}),[];const s=(null!==(r=this.peerhave.get(e))&&void 0!==r?r:0)+1;var a;if(this.peerhave.set(e,s),s>10)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,s),null===(a=this.metrics)||void 0===a||a.ihaveRcvIgnored.inc({reason:ak.MaxIhave}),[];const c=null!==(n=this.iasked.get(e))&&void 0!==n?n:0;var l;if(c>=RA)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,c),null===(l=this.metrics)||void 0===l||l.ihaveRcvIgnored.inc({reason:ak.MaxIasked}),[];const u=new Map;if(t.forEach((e=>{var t;let{topicID:r,messageIDs:n}=e;if(!r||!n||!this.mesh.has(r))return;let i=0;n.forEach((e=>{const t=this.msgIdToStrFn(e);this.seenCache.has(t)||(u.set(t,e),i++)})),null===(t=this.metrics)||void 0===t||t.onIhaveRcv(r,n.length,i)})),!u.size)return[];let h=u.size;h+c>RA&&(h=RA-c),this.log("IHAVE: Asking for %d out of %d messages from %s",h,u.size,e);let d=Array.from(u.values());return TA(d),d=d.slice(0,h),this.iasked.set(e,c+h),[{messageIDs:d}]}handleIWant(e,t){var r;if(!t.length)return[];const n=this.score.score(e);if(n<this.opts.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,n),[];const i=new Map,o=new Map;let s=0;return t.forEach((t=>{let{messageIDs:r}=t;r&&r.forEach((t=>{var r;const n=this.msgIdToStrFn(t),a=this.mcache.getWithIWantCount(n,e);null!=a?(o.set(a.msg.topic,1+(null!==(r=o.get(a.msg.topic))&&void 0!==r?r:0)),a.count>3?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,t):i.set(n,a.msg)):s++}))})),null===(r=this.metrics)||void 0===r||r.onIwantRcv(o,s),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),[])}async handleGraft(e,t){const r=[],n=this.score.score(e),i=Date.now();let o=this.opts.doPX;if(t.forEach((t=>{var s,a;let{topicID:c}=t;if(!c)return;const l=this.mesh.get(c);if(!l)return void(o=!1);if(l.has(e))return;if(this.direct.has(e))return this.log("GRAFT: ignoring request from direct peer %s",e),r.push(c),void(o=!1);const u=null===(s=this.backoff.get(c))||void 0===s?void 0:s.get(e);if("number"===typeof u&&i<u){this.log("GRAFT: ignoring backed off peer %s",e),this.score.addPenalty(e,1,sk.GraftBackoff),o=!1;const t=u+this.opts.graftFloodThreshold-this.opts.pruneBackoff;return i<t&&this.score.addPenalty(e,1,sk.GraftBackoff),this.addBackoff(e,c),void r.push(c)}return n<0?(this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,n,c),r.push(c),o=!1,void this.addBackoff(e,c)):l.size>=this.opts.Dhi&&!this.outbound.get(e)?(r.push(c),void this.addBackoff(e,c)):(this.log("GRAFT: Add mesh link from %s in %s",e,c),this.score.graft(e,c),l.add(e),void(null===(a=this.metrics)||void 0===a||a.onAddToMesh(c,ik.Subscribed,1)))})),!r.length)return[];return await Promise.all(r.map((t=>this.makePrune(e,t,o,false))))}async handlePrune(e,t){const r=this.score.score(e);for(const{topicID:i,backoff:o,peers:s}of t){if(null==i)continue;const t=this.mesh.get(i);if(!t)return;var n;if(this.log("PRUNE: Remove mesh link to %s in %s",e,i),this.score.prune(e,i),t.has(e))t.delete(e),null===(n=this.metrics)||void 0===n||n.onRemoveFromMesh(i,ok.Prune,1);if("number"===typeof o&&o>0?this.doAddBackoff(e,i,1e3*o):this.addBackoff(e,i),s&&s.length){if(r<this.opts.scoreThresholds.acceptPXThreshold){this.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,r,i);continue}await this.pxConnect(s)}}}addBackoff(e,t){this.doAddBackoff(e,t,this.opts.pruneBackoff)}doAddBackoff(e,t,r){var n;let i=this.backoff.get(t);i||(i=new Map,this.backoff.set(t,i));const o=Date.now()+r;(null!==(n=i.get(e))&&void 0!==n?n:0)<o&&i.set(e,o)}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,sk.BrokenPromise)}))}clearBackoff(){if(this.heartbeatTicks%15!==0)return;const e=Date.now();this.backoff.forEach(((t,r)=>{t.forEach(((r,n)=>{r+1*this.opts.heartbeatInterval<e&&t.delete(n)})),0===t.size&&this.backoff.delete(r)}))}async directConnect(){const e=[];this.direct.forEach((t=>{this.streamsOutbound.has(t)||e.push(t)})),await Promise.all(e.map((async e=>await this.connect(e))))}async pxConnect(e){e.length>this.opts.prunePeers&&(TA(e),e=e.slice(0,this.opts.prunePeers));const t=[];await Promise.all(e.map((async e=>{if(!e.peerID)return;const r=xm(e.peerID),n=r.toString();if(!this.peers.has(n))if(e.signedPeerRecord)try{if(!await this.components.peerStore.consumePeerRecord(e.signedPeerRecord,r))return void this.log("bogus peer record obtained through px: could not add peer record to address book");t.push(n)}catch(i){this.log("bogus peer record obtained through px: invalid signature or not a peer record")}else t.push(n)}))),t.length&&await Promise.all(t.map((async e=>await this.connect(e))))}async connect(e){this.log("Initiating connection with %s",e);const t=Tm(e),r=await this.components.connectionManager.openConnection(t);for(const n of this.multicodecs)for(const e of this.components.registrar.getTopologies(n))e.onConnect(t,r)}subscribe(e){if(this.status.code!==xk.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!==xk.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){var t;if(this.status.code!==xk.started)throw new Error("Gossipsub has not started");if(this.mesh.has(e))return;this.log("JOIN %s",e),null===(t=this.metrics)||void 0===t||t.onJoin(e);const r=new Set,n=this.backoff.get(e),i=this.fanout.get(e);var o;i&&(this.fanout.delete(e),this.fanoutLastpub.delete(e),i.forEach((e=>{this.direct.has(e)||!(this.score.score(e)>=0)||n&&n.has(e)||r.add(e)})),null===(o=this.metrics)||void 0===o||o.onAddToMesh(e,ik.Fanout,r.size));if(r.size<this.opts.D){var s;const t=r.size;this.getRandomGossipPeers(e,this.opts.D,(e=>!r.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0&&(!n||!n.has(e)))).forEach((e=>{r.add(e)})),null===(s=this.metrics)||void 0===s||s.onAddToMesh(e,ik.Random,r.size-t)}this.mesh.set(e,r),r.forEach((t=>{this.log("JOIN: Add mesh link to %s in %s",t,e),this.sendGraft(t,e)}))}leave(e){var t;if(this.status.code!==xk.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e),null===(t=this.metrics)||void 0===t||t.onLeave(e);const r=this.mesh.get(e);r&&(Promise.all(Array.from(r).map((async t=>(this.log("LEAVE: Remove mesh link to %s in %s",t,e),await this.sendPrune(t,e))))).catch((e=>{this.log("Error sending prunes to mesh peers",e)})),this.mesh.delete(e))}selectPeersToForward(e,t,r){const n=new Set,i=this.topics.get(e);i&&(this.direct.forEach((e=>{!i.has(e)||t===e||null!==r&&void 0!==r&&r.has(e)||n.add(e)})),this.floodsubPeers.forEach((e=>{i.has(e)&&t!==e&&(null===r||void 0===r||!r.has(e))&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&n.add(e)})));const o=this.mesh.get(e);return o&&o.size>0&&o.forEach((e=>{t===e||null!==r&&void 0!==r&&r.has(e)||n.add(e)})),n}selectPeersToPublish(e){const t=new Set,r={direct:0,floodsub:0,mesh:0,fanout:0},n=this.topics.get(e);if(n)if(this.opts.floodPublish)n.forEach((e=>{this.direct.has(e)?(t.add(e),r.direct++):this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)}));else{this.direct.forEach((e=>{n.has(e)&&(t.add(e),r.direct++)})),this.floodsubPeers.forEach((e=>{n.has(e)&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)}));const i=this.mesh.get(e);if(i&&i.size>0)i.forEach((e=>{t.add(e),r.mesh++}));else{const n=this.fanout.get(e);if(n&&n.size>0)n.forEach((e=>{t.add(e),r.fanout++}));else{const n=this.getRandomGossipPeers(e,this.opts.D,(e=>this.score.score(e)>=this.opts.scoreThresholds.publishThreshold));n.size>0&&(this.fanout.set(e,n),n.forEach((e=>{t.add(e),r.fanout++})))}this.fanoutLastpub.set(e,Date.now())}}return{tosend:t,tosendCount:r}}forwardMessage(e,t,r,n){var i;r&&this.score.deliverMessage(r,e,t.topic);const o=this.selectPeersToForward(t.topic,r,n);o.forEach((e=>{this.sendRpc(e,{messages:[t]})})),null===(i=this.metrics)||void 0===i||i.onForwardMsg(t.topic,o.size)}async publish(e,t,r){var n,i,o;const s=this.dataTransform?this.dataTransform.outboundTransform(e,t):t;if(null==this.publishConfig)throw Error("PublishError.Uninitialized");const{raw:a,msg:c}=await async function(e,t,r,n){switch(e.type){case LA.Signing:{const i={from:e.author.toBytes(),data:n,seqno:oy(8),topic:t,signature:void 0,key:void 0},o=Sd([dk,AA.Message.encode(i).finish()]);return i.signature=await e.privateKey.sign(o),i.key=e.key,{raw:i,msg:{type:"signed",from:e.author,data:r,sequenceNumber:BigInt("0x".concat(Sl(i.seqno,"base16"))),topic:t,signature:i.signature,key:i.key}}}case LA.Anonymous:return{raw:{from:void 0,data:n,seqno:void 0,topic:t,signature:void 0,key:void 0},msg:{type:"unsigned",data:r,topic:t}}}}(this.publishConfig,e,t,s),l=await this.msgIdFn(c),u=this.msgIdToStrFn(l),h=null!==(n=null===r||void 0===r?void 0:r.ignoreDuplicatePublishError)&&void 0!==n?n:this.opts.ignoreDuplicatePublishError;if(this.seenCache.has(u)){var d;if(h)return null===(d=this.metrics)||void 0===d||d.onPublishDuplicateMsg(e),{recipients:[]};throw Error("PublishError.Duplicate")}const{tosend:f,tosendCount:p}=this.selectPeersToPublish(e),g=!0===this.opts.emitSelf&&this.subscriptions.has(e),y=null!==(i=null===r||void 0===r?void 0:r.allowPublishToZeroPeers)&&void 0!==i?i:this.opts.allowPublishToZeroPeers;if(0===f.size&&!y&&!g)throw Error("PublishError.InsufficientPeers");this.seenCache.put(u),this.mcache.put({msgId:l,msgIdStr:u},a,!0),this.publishedMessageIds.put(u);for(const m of f){this.sendRpc(m,{messages:[a]})||f.delete(m)}return null===(o=this.metrics)||void 0===o||o.onPublishMsg(e,p,f.size,null!=a.data?a.data.length:0),g&&(f.add(this.components.peerId.toString()),super.dispatchEvent(new hi("gossipsub:message",{detail:{propagationSource:this.components.peerId,msgId:u,msg:c}})),super.dispatchEvent(new hi("message",{detail:c}))),{recipients:Array.from(f.values()).map((e=>Tm(e)))}}reportMessageValidationResult(e,t,r){var n;let i;if(r===NA.Accept){if(i=this.mcache.validate(e),null!=i){const{message:r,originatingPeers:n}=i;this.score.deliverMessage(t,e,r.topic),this.forwardMessage(e,i.message,t,n)}}else if(i=this.mcache.remove(e),i){const n=FA(r),{message:o,originatingPeers:s}=i;this.score.rejectMessage(t,e,o.topic,n);for(const t of s)this.score.rejectMessage(t,e,o.topic,n)}const o=this.score.messageFirstSeenTimestampMs(e);null===(n=this.metrics)||void 0===n||n.onReportValidation(i,r,o)}sendGraft(e,t){const r=[{topicID:t}];this.sendRpc(e,{control:{graft:r}})}async sendPrune(e,t){const r=[await this.makePrune(e,t,this.opts.doPX,!0)];this.sendRpc(e,{control:{prune:r}})}sendRpc(e,t){var r;const n=this.streamsOutbound.get(e);if(!n)return this.log("Cannot send RPC to ".concat(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 o=this.gossip.get(e);o&&(this.piggybackGossip(e,t,o),this.gossip.delete(e));const s=AA.encode(t).finish();try{n.push(s)}catch(a){return this.log.error("Cannot send rpc to ".concat(e),a),i&&this.control.set(e,i),o&&this.gossip.set(e,o),!1}return null===(r=this.metrics)||void 0===r||r.onRpcSent(t,s.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){var n;i.topicID&&null!==(n=this.mesh.get(i.topicID))&&void 0!==n&&n.has(e)&&t.control.graft.push(i)}}if(r.prune){t.control||(t.control={}),t.control.prune||(t.control.prune=[]);for(const n of r.prune){var i;!n.topicID||null!==(i=this.mesh.get(n.topicID))&&void 0!==i&&i.has(e)||t.control.prune.push(n)}}}piggybackGossip(e,t,r){t.control||(t.control={}),t.control.ihave=r}async sendGraftPrune(e,t,r){const n=this.opts.doPX,i=!1;for(const[o,s]of e){const e=s.map((e=>({topicID:e})));let a=[];const c=t.get(o);c&&(a=await Promise.all(c.map((async e=>{var t;return await this.makePrune(o,e,n&&!(null!==(t=r.get(o))&&void 0!==t&&t),i)}))),t.delete(o)),this.sendRpc(o,{control:{graft:e,prune:a}})}for(const[o,s]of t){const e=await Promise.all(s.map((async e=>{var t;return await this.makePrune(o,e,n&&!(null!==(t=r.get(o))&&void 0!==t&&t),i)})));this.sendRpc(o,{control:{prune:e}})}}emitGossip(e){const t=this.mcache.getGossipIDs(new Set(e.keys()));for(const[n,i]of e){var r;this.doEmitGossip(n,i,null!==(r=t.get(n))&&void 0!==r?r:[])}}doEmitGossip(e,t,r){if(!r.length)return;if(TA(r),r.length>RA&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length),!t.size)return;let n=this.opts.Dlazy;const i=.25*t.size;let o=t;i>n&&(n=i),n>o.size?n=o.size:o=TA(Array.from(o)).slice(0,n),o.forEach((t=>{let n=r;r.length>RA&&(n=TA(n.slice()).slice(0,RA)),this.pushGossip(t,{topicID:e,messageIDs:n})}))}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))}async makePrune(e,t,r,n){if(this.score.prune(e,t),this.streamsOutbound.get(e).protocol===IA)return{topicID:t,peers:[]};const i=n?this.opts.unsubcribeBackoff:this.opts.pruneBackoff,o=i/1e3;if(this.doAddBackoff(e,t,i),!r)return{topicID:t,peers:[],backoff:o};const s=this.getRandomGossipPeers(t,this.opts.prunePeers,(t=>t!==e&&this.score.score(t)>=0)),a=await Promise.all(Array.from(s).map((async e=>{var t;const r=Tm(e);let n;try{n=await this.components.peerStore.get(r)}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}return{peerID:r.toBytes(),signedPeerRecord:null===(t=n)||void 0===t?void 0:t.peerRecordEnvelope}})));return{topicID:t,peers:a,backoff:o}}async heartbeat(){var e,t;const{D:r,Dlo:n,Dhi:i,Dscore:o,Dout:s,fanoutTTL:a}=this.opts;this.heartbeatTicks++;const c=new Map,l=e=>{let t=c.get(e);return void 0===t&&(t=this.score.score(e),c.set(e,t)),t},u=new Map,h=new Map,d=new Map;this.clearBackoff(),this.peerhave.clear(),null===(e=this.metrics)||void 0===e||e.cacheSize.set({cache:"iasked"},this.iasked.size),this.iasked.clear(),this.applyIwantPenalties(),this.heartbeatTicks%this.opts.directConnectTicks===0&&await this.directConnect(),null===(t=this.fastMsgIdCache)||void 0===t||t.prune(),this.seenCache.prune(),this.gossipTracer.prune(),this.publishedMessageIds.prune();const f=new Map;this.mesh.forEach(((e,t)=>{const a=this.topics.get(t),c=new Set,p=new Set;if(f.set(t,p),a){const r=TA(Array.from(a)),n=this.backoff.get(t);for(const t of r){const r=this.streamsOutbound.get(t);if(r&&this.multicodecs.includes(r.protocol)&&!e.has(t)&&!this.direct.has(t)){const e=l(t);n&&n.has(t)||!(e>=0)||c.add(t),e>=this.opts.scoreThresholds.gossipThreshold&&p.add(t)}}}const g=(r,n)=>{var i;this.log("HEARTBEAT: Remove mesh link to %s in %s",r,t),this.addBackoff(r,t),e.delete(r),l(r)>=this.opts.scoreThresholds.gossipThreshold&&p.add(r),null===(i=this.metrics)||void 0===i||i.onRemoveFromMesh(t,n,1);const o=h.get(r);o?o.push(t):h.set(r,[t])},y=(r,n)=>{var i;this.log("HEARTBEAT: Add mesh link to %s in %s",r,t),this.score.graft(r,t),e.add(r),p.delete(r),null===(i=this.metrics)||void 0===i||i.onAddToMesh(t,n,1);const o=u.get(r);o?o.push(t):u.set(r,[t])};if(e.forEach((e=>{const r=l(e);r<0&&(this.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,r,t),g(e,ok.BadScore),d.set(e,!0))})),e.size<n){const t=function(e,t){return JA(e,t,(()=>!0))}(c,r-e.size);t.forEach((e=>{y(e,ik.NotEnough)}))}if(e.size>i){let t=Array.from(e);t.sort(((e,t)=>l(t)-l(e))),t=t.slice(0,o).concat(TA(t.slice(o)));let n=0;if(t.slice(0,r).forEach((e=>{this.outbound.get(e)&&n++})),n<s){const e=e=>{const r=t[e];for(let n=e;n>0;n--)t[n]=t[n-1];t[0]=r};if(n>0){let i=n;for(let n=1;n<r&&i>0;n++)this.outbound.get(t[n])&&(e(n),i--)}let i=r-n;for(let n=r;n<t.length&&i>0;n++)this.outbound.get(t[n])&&(e(n),i--)}t.slice(r).forEach((e=>{g(e,ok.Excess)}))}if(e.size>=n){let t=0;if(e.forEach((e=>{this.outbound.get(e)&&t++})),t<s){JA(c,s-t,(e=>!0===this.outbound.get(e))).forEach((e=>{y(e,ik.Outbound)}))}}if(this.heartbeatTicks%this.opts.opportunisticGraftTicks===0&&e.size>1){const r=Array.from(e).sort(((e,t)=>l(e)-l(t))),n=Math.floor(e.size/2),i=l(r[n]);if(i<this.opts.scoreThresholds.opportunisticGraftThreshold){const e=JA(c,this.opts.opportunisticGraftPeers,(e=>l(e)>i));for(const r of e)this.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",r,t),y(r,ik.Opportunistic)}}}));const p=Date.now();this.fanoutLastpub.forEach(((e,t)=>{e+a<p&&(this.fanout.delete(t),this.fanoutLastpub.delete(t))})),this.fanout.forEach(((e,t)=>{const n=this.topics.get(t);e.forEach((t=>{(!n.has(t)||l(t)<this.opts.scoreThresholds.publishThreshold)&&e.delete(t)}));const i=this.topics.get(t),o=[],s=new Set;if(f.set(t,s),i){const t=TA(Array.from(i));for(const r of t){const t=this.streamsOutbound.get(r);if(t&&this.multicodecs.includes(t.protocol)&&!e.has(r)&&!this.direct.has(r)){const e=l(r);e>=this.opts.scoreThresholds.publishThreshold&&o.push(r),e>=this.opts.scoreThresholds.gossipThreshold&&s.add(r)}}}if(e.size<r){const t=r-e.size;o.slice(0,t).forEach((t=>{e.add(t),null===s||void 0===s||s.delete(t)}))}})),this.emitGossip(f),await this.sendGraftPrune(u,h,d),this.flush(),this.mcache.shift(),this.dispatchEvent(new hi("gossipsub:heartbeat"))}getRandomGossipPeers(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=this.topics.get(e);if(!n)return new Set;let i=[];return n.forEach((e=>{const t=this.streamsOutbound.get(e);t&&this.multicodecs.includes(t.protocol)&&r(e)&&i.push(e)})),i=TA(i),t>0&&i.length>t&&(i=i.slice(0,t)),new Set(i)}onScrapeMetrics(e){var t,r;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"},null!==(t=null===(r=this.fastMsgIdCache)||void 0===r?void 0:r.size)&&void 0!==t?t: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 n=0;const i=Date.now();e.connectedPeersBackoffSec.reset();for(const u of this.backoff.values()){n+=u.size;for(const[t,r]of u.entries())this.peers.has(t)&&e.connectedPeersBackoffSec.observe(Math.max(0,r-i)/1e3)}e.cacheSize.set({cache:"backoff"},n);for(const[u,h]of this.topics)e.topicPeersCount.set({topicStr:u},h.size);for(const[u,h]of this.mesh)e.meshPeerCounts.set({topicStr:u},h.size);const o=[],s=new Map;e.behaviourPenalty.reset();for(const u of this.peers.keys()){var a,c;const t=this.score.score(u);o.push(t),s.set(u,t),e.behaviourPenalty.observe(null!==(a=null===(c=this.score.peerStats.get(u))||void 0===c?void 0:c.behaviourPenalty)&&void 0!==a?a:0)}e.registerScores(o,this.opts.scoreThresholds),e.registerScorePerMesh(this.mesh,s);const l=function(e,t,r,n,i){const o={byTopic:new Map,p5w:[],p6w:[],p7w:[],score:[]};for(const s of e){const e=t.get(s);if(e){const t=gk(s,e,r,n,i);for(const[e,r]of t.byTopic){let t=o.byTopic.get(e);t||(t={p1w:[],p2w:[],p3w:[],p3bw:[],p4w:[]},o.byTopic.set(e,t)),t.p1w.push(r.p1w),t.p2w.push(r.p2w),t.p3w.push(r.p3w),t.p3bw.push(r.p3bw),t.p4w.push(r.p4w)}o.p5w.push(t.p5w),o.p6w.push(t.p6w),o.p7w.push(t.p7w),o.score.push(t.score)}else o.p5w.push(0),o.p6w.push(0),o.p7w.push(0),o.score.push(0)}return o}(this.peers.keys(),this.score.peerStats,this.score.params,this.score.peerIPs,e.topicStrToLabel);e.registerScoreWeights(l)}}Pk.multicodec=CA;const Dk=["/vac/waku/relay/2.0.0"],Nk=ai("waku:relay");function Ok(e,t){const r=performance.now();Nk("validating message from ".concat(e," received on ").concat(t.topic));let n=NA.Accept;try{const e=Cs.decode(t.data);e.contentTopic&&e.contentTopic.length&&e.payload&&e.payload.length||(n=NA.Reject)}catch(o){n=NA.Reject}const i=performance.now();return Nk("Validation time (must be <100ms): ".concat(i-r,"ms")),n}const Lk=ai("waku:message:topic-only");class Bk{constructor(e,t){Ze(this,"pubSubTopic",void 0),Ze(this,"proto",void 0),Ze(this,"payload",new Uint8Array),Ze(this,"rateLimitProof",void 0),Ze(this,"timestamp",void 0),Ze(this,"meta",void 0),Ze(this,"ephemeral",void 0),this.pubSubTopic=e,this.proto=t}get contentTopic(){return this.proto.contentTopic}}class Mk{constructor(){Ze(this,"contentTopic","")}fromWireToProtoObj(e){const t=Ns.decode(e);return Lk("Message decoded",t),Promise.resolve({contentTopic:t.contentTopic,payload:new Uint8Array,rateLimitProof:void 0,timestamp:void 0,meta:void 0,version:void 0,ephemeral:void 0})}async fromProtoObj(e,t){return new Bk(e,t)}}const Uk=ai("waku:relay");class Fk{constructor(e,t){var r;if(Ze(this,"pubSubTopic",void 0),Ze(this,"defaultDecoder",void 0),Ze(this,"gossipSub",void 0),Ze(this,"observers",void 0),!this.isRelayPubSub(e.services.pubsub))throw Error("Failed to initialize Relay. libp2p.pubsub does not support ".concat(Fk.multicodec));this.gossipSub=e.services.pubsub,this.pubSubTopic=null!==(r=null===t||void 0===t?void 0:t.pubSubTopic)&&void 0!==r?r:bi,this.gossipSub.isStarted()&&this.gossipSubSubscribe(this.pubSubTopic),this.observers=new Map,this.defaultDecoder=new Mk}async start(){if(this.gossipSub.isStarted())throw Error("GossipSub already started.");await this.gossipSub.start(),this.gossipSubSubscribe(this.pubSubTopic)}async send(e,t){if(!Wa(t.payload))return Uk("Failed to send waku relay: message is bigger that 1MB"),{recipients:[],error:ri.SIZE_TOO_BIG};const r=await e.toWire(t);return r?this.gossipSub.publish(this.pubSubTopic,r):(Uk("Failed to encode message, aborting publish"),{recipients:[],error:ri.ENCODE_FAILED})}subscribe(e,t){const r=Array.isArray(e)?jk(e,t):jk([e],t);for(const n of r.keys()){const e=this.observers.get(n)||new Set,t=r.get(n)||new Set;this.observers.set(n,zk(e,t))}return()=>{for(const e of r.keys()){const t=qk(this.observers.get(e)||new Set,r.get(e)||new Set);t.size?this.observers.set(e,t):this.observers.delete(e)}}}toSubscriptionIterator(e,t){return da(this,e,t)}getActiveSubscriptions(){const e=new Map;return e.set(this.pubSubTopic,this.observers.keys()),e}getMeshPeers(e){return this.gossipSub.getMeshPeers(null!==e&&void 0!==e?e:this.pubSubTopic)}async processIncomingMessage(e,t){const r=await this.defaultDecoder.fromWireToProtoObj(t);if(!r||!r.contentTopic)return void Uk("Message does not have a content topic, skipping");const n=this.observers.get(r.contentTopic);n&&await Promise.all(Array.from(n).map((n=>{let{decoder:i,callback:o}=n;return(async()=>{try{const n=await i.fromWireToProtoObj(t);if(!n)return void Uk("Internal error: message previously decoded failed on 2nd pass.");const s=await i.fromProtoObj(e,n);s?await o(s):Uk("Failed to decode messages on",r.contentTopic)}catch(n){Uk("Error while decoding message:",n)}})()})))}gossipSubSubscribe(e){this.gossipSub.addEventListener("gossipsub:message",(t=>{t.detail.msg.topic===e&&(Uk("Message received on ".concat(e)),this.processIncomingMessage(t.detail.msg.topic,t.detail.msg.data).catch((e=>Uk("Failed to process incoming message",e))))})),this.gossipSub.topicValidators.set(e,Ok),this.gossipSub.subscribe(e)}isRelayPubSub(e){var t;return(null===e||void 0===e||null===(t=e.multicodecs)||void 0===t?void 0:t.includes(Fk.multicodec))||!1}}function jk(e,t){const r=Array.from(ha(e).entries()).map((e=>{let[r,n]=e;return[r,new Set(n.map((e=>({decoder:e,callback:t}))))]}));return new Map(r)}function zk(e,t){for(const r of t.values())e.add(r);return e}function qk(e,t){for(const r of t.values())e.has(r)&&e.delete(r);return e}function Kk(e,t){rt(e,t),t.add(e)}Ze(Fk,"multicodec",Dk[0]);var Vk=__webpack_require__(8981);const Hk=Symbol.for("@libp2p/content-routing"),Wk=Symbol.for("@libp2p/peer-routing");new Uint8Array(0);function Gk(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}var Yk=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const Qk=Yk;class Xk{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class Jk{constructor(e,t,r){if(Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseDecode",void 0),Ze(this,"prefixCodePoint",void 0),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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Zk(this,e)}}class $k{constructor(e){Ze(this,"decoders",void 0),this.decoders=e}or(e){return Zk(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}function Zk(e,t){var r,n;return new $k({...null!==(r=e.decoders)&&void 0!==r?r:{[e.prefix]:e},...null!==(n=t.decoders)&&void 0!==n?n:{[t.prefix]:t}})}class eI{constructor(e,t,r,n){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),Ze(this,"baseDecode",void 0),Ze(this,"encoder",void 0),Ze(this,"decoder",void 0),this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Xk(e,t,r),this.decoder=new Jk(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}function tI(e){let{name:t,prefix:r,encode:n,decode:i}=e;return new eI(t,r,n,i)}function rI(e){let{name:t,prefix:r,alphabet:n}=e;const{encode:i,decode:o}=Qk(n,t);return tI({prefix:r,name:t,encode:i,decode:e=>Gk(o(e))})}function nI(e){let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return tI({prefix:r,name:t,encode:e=>function(e,t,r){const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(0!==s&&(o+=t[i&a<<r-s]),n)for(;0!==(o.length*r&7);)o+="=";return o}(e,i,n),decode:e=>function(e,t,r,n){const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||0!==(255&c<<8-a))throw new SyntaxError("Unexpected end of data");return s}(e,i,n,t)})}const iI=rI({prefix:"9",name:"base10",alphabet:"0123456789"}),oI=nI({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),sI=nI({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),aI=nI({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),cI=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),lI=cI.reduce(((e,t,r)=>(e[r]=t,e)),[]),uI=cI.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const hI=tI({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=lI[t]),"")},decode:function(e){const t=[];for(const r of e){const e=uI[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),dI=nI({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),fI=nI({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),pI=nI({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),gI=nI({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yI=nI({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),mI=nI({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vI=nI({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),bI=nI({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),wI=nI({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),EI=rI({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_I=rI({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),SI=rI({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),AI=rI({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),kI=nI({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),II=nI({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),CI=nI({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),RI=nI({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),TI=nI({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),xI=tI({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)}),PI=new TextEncoder,DI=new TextDecoder,NI="json",OI=512;function LI(e){return PI.encode(JSON.stringify(e))}function BI(e){return JSON.parse(DI.decode(e))}const MI="raw",UI=85;function FI(e){return Gk(e)}function jI(e){return Gk(e)}var zI=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=VI;)r[n++]=255&t|qI,t/=128;for(;t&KI;)r[n++]=255&t|qI,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},qI=128,KI=-128,VI=Math.pow(2,31);var HI=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&GI)<<o:(n&GI)*Math.pow(2,o),o+=7}while(n>=WI);return e.bytes=s-r,i},WI=128,GI=127;var YI=Math.pow(2,7),QI=Math.pow(2,14),XI=Math.pow(2,21),JI=Math.pow(2,28),$I=Math.pow(2,35),ZI=Math.pow(2,42),eC=Math.pow(2,49),tC=Math.pow(2,56),rC=Math.pow(2,63);const nC={encode:zI,decode:HI,encodingLength:function(e){return e<YI?1:e<QI?2:e<XI?3:e<JI?4:e<$I?5:e<ZI?6:e<eC?7:e<tC?8:e<rC?9:10}};function iC(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return nC.encode(e,t,r),t}function oC(e){return nC.encodingLength(e)}function sC(e,t){const r=t.byteLength,n=oC(e),i=n+oC(r),o=new Uint8Array(i+r);return iC(e,o,0),iC(r,o,n),o.set(t,i),new aC(e,r,t,o)}class aC{constructor(e,t,r,n){Ze(this,"code",void 0),Ze(this,"size",void 0),Ze(this,"digest",void 0),Ze(this,"bytes",void 0),this.code=e,this.size=t,this.digest=r,this.bytes=n}}const cC=Gk;const lC={code:0,name:"identity",encode:cC,digest:function(e){return sC(0,cC(e))}};function uC(e){let{name:t,code:r,encode:n}=e;return new hC(t,r,n)}class hC{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"code",void 0),Ze(this,"encode",void 0),this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?sC(this.code,t):t.then((e=>sC(this.code,e)))}throw Error("Unknown type, must be binary type")}}function dC(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}const fC=uC({name:"sha2-256",code:18,encode:dC("SHA-256")}),pC=uC({name:"sha2-512",code:19,encode:dC("SHA-512")});new WeakMap;Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const gC={...Re,...Ee,...Ce,...be,...we,...Se,...Ae,...ke,...Ie,..._e};function yC(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const mC=yC("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),vC=yC("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=function(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),bC={utf8:mC,"utf-8":mC,hex:gC.base16,latin1:vC,ascii:vC,binary:vC,...gC};const wC="/",EC=(new TextEncoder).encode(wC),_C=EC[0];class SC{constructor(e,t){if(Ze(this,"_buf",void 0),"string"===typeof e)this._buf=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=bC[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.decoder.decode("".concat(r.prefix).concat(e))}(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]!==_C)throw new Error("Invalid key")}toString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"utf8";return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=bC[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.encoder.encode(e).substring(1)}(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return"Key(".concat(this.toString(),")")}static withNamespaces(e){return new SC(e.join(wC))}static random(){return new SC(Math.random().toString().substring(2))}static asKey(e){return e instanceof Uint8Array||"string"===typeof e?new SC(e):"function"===typeof e.uint8Array?new SC(e.uint8Array()):null}clean(){if(null!=this._buf&&0!==this._buf.byteLength||(this._buf=EC),this._buf[0]!==_C){const e=new Uint8Array(this._buf.byteLength+1);e.fill(_C,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===_C;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;n<t.length;n++){if(r.length<n+1)return!1;const e=t[n],i=r[n];if(e<i)return!0;if(e>i)return!1}return t.length<r.length}reverse(){return SC.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(wC).slice(1)}type(){return function(e){const t=e.split(":");if(t.length<2)return"";return t.slice(0,-1).join(":")}(this.baseNamespace())}name(){return function(e){const t=e.split(":");return t[t.length-1]}(this.baseNamespace())}instance(e){return new SC(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(wC)||(e+=wC),e+=this.type(),new SC(e)}parent(){const e=this.list();return 1===e.length?new SC(wC):new SC(e.slice(0,-1).join(wC))}child(e){return this.toString()===wC?e:e.toString()===wC?this:new SC(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(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return SC.withNamespaces([...this.namespaces(),...(n=t.map((e=>e.namespaces())),[].concat(...n))]);var n}}const AC=__webpack_require__(6754);var kC,IC=__webpack_require__(374);!function(e){e.ERR_INVALID_PARAMETERS="ERR_INVALID_PARAMETERS",e.ERR_INVALID_KEY_NAME="ERR_INVALID_KEY_NAME",e.ERR_INVALID_KEY_TYPE="ERR_INVALID_KEY_TYPE",e.ERR_KEY_ALREADY_EXISTS="ERR_KEY_ALREADY_EXISTS",e.ERR_INVALID_KEY_SIZE="ERR_INVALID_KEY_SIZE",e.ERR_KEY_NOT_FOUND="ERR_KEY_NOT_FOUND",e.ERR_OLD_KEY_NAME_INVALID="ERR_OLD_KEY_NAME_INVALID",e.ERR_NEW_KEY_NAME_INVALID="ERR_NEW_KEY_NAME_INVALID",e.ERR_PASSWORD_REQUIRED="ERR_PASSWORD_REQUIRED",e.ERR_PEM_REQUIRED="ERR_PEM_REQUIRED",e.ERR_CANNOT_READ_KEY="ERR_CANNOT_READ_KEY",e.ERR_MISSING_PRIVATE_KEY="ERR_MISSING_PRIVATE_KEY",e.ERR_INVALID_OLD_PASS_TYPE="ERR_INVALID_OLD_PASS_TYPE",e.ERR_INVALID_NEW_PASS_TYPE="ERR_INVALID_NEW_PASS_TYPE",e.ERR_INVALID_PASS_LENGTH="ERR_INVALID_PASS_LENGTH"}(kC||(kC={}));const CC=jm("libp2p:keychain"),RC="/info/",TC=new WeakMap,xC=14,PC=16,DC=1e3,NC={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function OC(e){return null!=e&&("string"===typeof e&&(e===IC(e.trim())&&e.length>0))}async function LC(){const e=800*Math.random()+200;await new Promise((t=>setTimeout(t,e)))}function BC(e){return new SC("/pkcs8/"+e)}function MC(e){return new SC(RC+e)}class UC{constructor(e,t){var r,n,i,o,s,a,c,l,u;if(Ze(this,"components",void 0),Ze(this,"init",void 0),this.components=e,this.init=AC(NC,t),null!=this.init.pass&&(null===(r=this.init.pass)||void 0===r?void 0:r.length)<20)throw new Error("pass must be least 20 characters");if(null!=(null===(n=this.init.dek)||void 0===n?void 0:n.keyLength)&&this.init.dek.keyLength<xC)throw new Error("dek.keyLength must be least ".concat(xC," bytes"));if(null!=(null===(i=this.init.dek)||void 0===i||null===(i=i.salt)||void 0===i?void 0:i.length)&&this.init.dek.salt.length<PC)throw new Error("dek.saltLength must be least ".concat(PC," bytes"));if(null!=(null===(o=this.init.dek)||void 0===o?void 0:o.iterationCount)&&this.init.dek.iterationCount<DC)throw new Error("dek.iterationCount must be least ".concat(DC));const h=null!=this.init.pass&&null!=(null===(s=this.init.dek)||void 0===s?void 0:s.salt)?hk(this.init.pass,null===(a=this.init.dek)||void 0===a?void 0:a.salt,null===(c=this.init.dek)||void 0===c?void 0:c.iterationCount,null===(l=this.init.dek)||void 0===l?void 0:l.keyLength,null===(u=this.init.dek)||void 0===u?void 0:u.hash):"";TC.set(this,{dek:h})}static generateOptions(){const e=Object.assign({},NC),t=3*Math.ceil(PC/3);return e.dek.salt=Sl(oy(t),"base64"),e}static get options(){return NC}async createKey(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2048;if(!OC(e)||"self"===e)throw await LC(),new xd("Invalid key name",kC.ERR_INVALID_KEY_NAME);if("string"!==typeof t)throw await LC(),new xd("Invalid key type",kC.ERR_INVALID_KEY_TYPE);const n=BC(e);if(await this.components.datastore.has(n))throw await LC(),new xd("Key name already exists",kC.ERR_KEY_ALREADY_EXISTS);if("rsa"===t.toLowerCase())if(!Number.isSafeInteger(r)||r<2048)throw await LC(),new xd("Invalid RSA key size",kC.ERR_INVALID_KEY_SIZE);let i;try{const o=await Iy(t,r),s=await o.id(),a=TC.get(this);if(null==a)throw new xd("dek missing",kC.ERR_INVALID_PARAMETERS);const c=a.dek,l=await o.export(c);i={name:e,id:s};const u=this.components.datastore.batch();u.put(n,_l(l)),u.put(MC(e),_l(JSON.stringify(i))),await u.commit()}catch(o){throw await LC(),o}return i}async listKeys(){const e={prefix:RC},t=[];for await(const r of this.components.datastore.query(e))t.push(JSON.parse(Sl(r.value)));return t}async findKeyById(e){try{const t=(await this.listKeys()).find((t=>t.id===e));if(null==t)throw new xd("Key with id '".concat(e,"' does not exist."),kC.ERR_KEY_NOT_FOUND);return t}catch(t){throw await LC(),t}}async findKeyByName(e){if(!OC(e))throw await LC(),new xd("Invalid key name '".concat(e,"'"),kC.ERR_INVALID_KEY_NAME);const t=MC(e);try{const e=await this.components.datastore.get(t);return JSON.parse(Sl(e))}catch(r){throw await LC(),CC.error(r),new xd("Key '".concat(e,"' does not exist."),kC.ERR_KEY_NOT_FOUND)}}async removeKey(e){if(!OC(e)||"self"===e)throw await LC(),new xd("Invalid key name '".concat(e,"'"),kC.ERR_INVALID_KEY_NAME);const t=BC(e),r=await this.findKeyByName(e),n=this.components.datastore.batch();return n.delete(t),n.delete(MC(e)),await n.commit(),r}async renameKey(e,t){if(!OC(e)||"self"===e)throw await LC(),new xd("Invalid old key name '".concat(e,"'"),kC.ERR_OLD_KEY_NAME_INVALID);if(!OC(t)||"self"===t)throw await LC(),new xd("Invalid new key name '".concat(t,"'"),kC.ERR_NEW_KEY_NAME_INVALID);const r=BC(e),n=BC(t),i=MC(e),o=MC(t);if(await this.components.datastore.has(n))throw await LC(),new xd("Key '".concat(t,"' already exists"),kC.ERR_KEY_ALREADY_EXISTS);try{const e=await this.components.datastore.get(r),s=await this.components.datastore.get(i),a=JSON.parse(Sl(s));a.name=t;const c=this.components.datastore.batch();return c.put(n,e),c.put(o,_l(JSON.stringify(a))),c.delete(r),c.delete(i),await c.commit(),a}catch(s){throw await LC(),s}}async exportKey(e,t){if(!OC(e))throw await LC(),new xd("Invalid key name '".concat(e,"'"),kC.ERR_INVALID_KEY_NAME);if(null==t)throw await LC(),new xd("Password is required",kC.ERR_PASSWORD_REQUIRED);const r=BC(e);try{const e=Sl(await this.components.datastore.get(r)),n=TC.get(this);if(null==n)throw new xd("dek missing",kC.ERR_INVALID_PARAMETERS);const i=n.dek,o=await xy(e,i);return await o.export(t)}catch(n){throw await LC(),n}}async exportPeerId(e){const t="temporary-password",r=await this.exportKey(e,t),n=await xy(r,t);return Pm(n.public.bytes,n.bytes)}async importKey(e,t,r){if(!OC(e)||"self"===e)throw await LC(),new xd("Invalid key name '".concat(e,"'"),kC.ERR_INVALID_KEY_NAME);if(null==t)throw await LC(),new xd("PEM encoded key is required",kC.ERR_PEM_REQUIRED);const n=BC(e);if(await this.components.datastore.has(n))throw await LC(),new xd("Key '".concat(e,"' already exists"),kC.ERR_KEY_ALREADY_EXISTS);let i,o;try{i=await xy(t,r)}catch(c){throw await LC(),new xd("Cannot read the key, most likely the password is wrong",kC.ERR_CANNOT_READ_KEY)}try{o=await i.id();const e=TC.get(this);if(null==e)throw new xd("dek missing",kC.ERR_INVALID_PARAMETERS);const r=e.dek;t=await i.export(r)}catch(c){throw await LC(),c}const s={name:e,id:o},a=this.components.datastore.batch();return a.put(n,_l(t)),a.put(MC(e),_l(JSON.stringify(s))),await a.commit(),s}async importPeer(e,t){try{if(!OC(e))throw new xd("Invalid key name '".concat(e,"'"),kC.ERR_INVALID_KEY_NAME);if(null==t)throw new xd("PeerId is required",kC.ERR_MISSING_PRIVATE_KEY);if(null==t.privateKey)throw new xd("PeerId.privKey is required",kC.ERR_MISSING_PRIVATE_KEY);const r=await Ty(t.privateKey),n=BC(e);if(await this.components.datastore.has(n))throw await LC(),new xd("Key '".concat(e,"' already exists"),kC.ERR_KEY_ALREADY_EXISTS);const i=TC.get(this);if(null==i)throw new xd("dek missing",kC.ERR_INVALID_PARAMETERS);const o=i.dek,s=await r.export(o),a={name:e,id:t.toString()},c=this.components.datastore.batch();return c.put(n,_l(s)),c.put(MC(e),_l(JSON.stringify(a))),await c.commit(),a}catch(r){throw await LC(),r}}async getPrivateKey(e){if(!OC(e))throw await LC(),new xd("Invalid key name '".concat(e,"'"),kC.ERR_INVALID_KEY_NAME);try{const t=BC(e);return Sl(await this.components.datastore.get(t))}catch(t){throw await LC(),CC.error(t),new xd("Key '".concat(e,"' does not exist."),kC.ERR_KEY_NOT_FOUND)}}async rotateKeychainPass(e,t){var r,n,i,o;if("string"!==typeof e)throw await LC(),new xd("Invalid old pass type '".concat(typeof e,"'"),kC.ERR_INVALID_OLD_PASS_TYPE);if("string"!==typeof t)throw await LC(),new xd("Invalid new pass type '".concat(typeof t,"'"),kC.ERR_INVALID_NEW_PASS_TYPE);if(t.length<20)throw await LC(),new xd("Invalid pass length ".concat(t.length),kC.ERR_INVALID_PASS_LENGTH);CC("recreating keychain");const s=TC.get(this);if(null==s)throw new xd("dek missing",kC.ERR_INVALID_PARAMETERS);const a=s.dek;this.init.pass=t;const c=null!=t&&null!=(null===(r=this.init.dek)||void 0===r?void 0:r.salt)?hk(t,this.init.dek.salt,null===(n=this.init.dek)||void 0===n?void 0:n.iterationCount,null===(i=this.init.dek)||void 0===i?void 0:i.keyLength,null===(o=this.init.dek)||void 0===o?void 0:o.hash):"";TC.set(this,{dek:c});const l=await this.listKeys();for(const u of l){const e=Sl(await this.components.datastore.get(BC(u.name))),t=await xy(e,a),r=c.toString(),n=await t.export(r),i=this.components.datastore.batch(),o={name:u.name,id:u.id};i.put(BC(u.name),_l(n)),i.put(MC(u.name),_l(JSON.stringify(o))),await i.commit()}CC("keychain reconstructed")}}function FC(e,t){const r={[Symbol.iterator]:()=>r,next:()=>{const r=e.next(),n=r.value;if(!0===r.done||null==n){return{done:!0,value:void 0}}return{done:!1,value:t(n)}}};return r}class jC{constructor(e){if(Ze(this,"map",void 0),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 FC(this.map.entries(),(e=>[Tm(e[0]),e[1]]))}forEach(e){this.map.forEach(((t,r)=>{e(t,Tm(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 FC(this.map.keys(),(e=>Tm(e)))}values(){return this.map.values()}get size(){return this.map.size}}class zC{constructor(e){if(Ze(this,"set",void 0),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 FC(this.set.entries(),(e=>{const t=Tm(e[0]);return[t,t]}))}forEach(e){this.set.forEach((t=>{const r=Tm(t);e(r,r,this)}))}has(e){return this.set.has(e.toString())}values(){return FC(this.set.values(),(e=>Tm(e)))}intersection(e){const t=new zC;for(const r of e)this.has(r)&&t.add(r);return t}difference(e){const t=new zC;for(const r of this)e.has(r)||t.add(r);return t}union(e){const t=new zC;for(const r of e)t.add(r);for(const r of this)t.add(r);return t}}Symbol.iterator;var qC;!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.id&&(t.uint32(10),t.bytes(e.id)),null!=e.pubKey&&(t.uint32(18),t.bytes(e.pubKey)),null!=e.privKey&&(t.uint32(26),t.bytes(e.privKey)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.id=e.bytes();break;case 2:r.pubKey=e.bytes();break;case 3:r.privKey=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(qC||(qC={}));const KC=async()=>{const e=await Iy("Ed25519"),t=await VC(e);if("Ed25519"===t.type)return t;throw new Error('Generated unexpected PeerId type "'.concat(t.type,'"'))};async function VC(e){return Pm(Ry(e.public),function(e,t){var r;return ky(t=(null!==(r=t)&&void 0!==r?r:"rsa").toLowerCase()),e.bytes}(e))}const HC=Math.pow(2,7),WC=Math.pow(2,14),GC=Math.pow(2,21),YC=Math.pow(2,28),QC=Math.pow(2,35),XC=Math.pow(2,42),JC=Math.pow(2,49),$C=Math.pow(2,56),ZC=Math.pow(2,63),eR={encodingLength:e=>e<HC?1:e<WC?2:e<GC?3:e<YC?4:e<QC?5:e<XC?6:e<JC?7:e<$C?8:e<ZC?9:10,encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null!=Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return null==t&&(t=ml(eR.encodingLength(e))),ql.fromNumber(e).toBytes(t,r),t},decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return ql.fromBytes(e,t).toNumber(!0)}},tR="ERR_SIGNATURE_NOT_VALID";var rR,nR;!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.publicKey&&e.publicKey.byteLength>0&&(t.uint32(10),t.bytes(e.publicKey)),null!=e.payloadType&&e.payloadType.byteLength>0&&(t.uint32(18),t.bytes(e.payloadType)),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(26),t.bytes(e.payload)),null!=e.signature&&e.signature.byteLength>0&&(t.uint32(42),t.bytes(e.signature)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.publicKey=e.bytes();break;case 2:r.payloadType=e.bytes();break;case 3:r.payload=e.bytes();break;case 5:r.signature=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(rR||(rR={}));class iR{constructor(e){Ze(this,"peerId",void 0),Ze(this,"payloadType",void 0),Ze(this,"payload",void 0),Ze(this,"signature",void 0),Ze(this,"marshaled",void 0);const{peerId:t,payloadType:r,payload:n,signature:i}=e;this.peerId=t,this.payloadType=r,this.payload=n,this.signature=i}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=rR.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return _f(this.marshal(),e.marshal())}async validate(e){const t=oR(e,this.payloadType,this.payload);if(null==this.peerId.publicKey)throw new Error("Missing public key");return Cy(this.peerId.publicKey).verify(t.subarray(),this.signature)}}nR=iR,Ze(iR,"createFromProtobuf",(async e=>{const t=rR.decode(e),r=await Pm(t.publicKey);return new nR({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})})),Ze(iR,"seal",(async(e,t)=>{if(null==t.privateKey)throw new Error("Missing private key");const r=e.domain,n=e.codec,i=e.marshal(),o=oR(r,n,i),s=await Ty(t.privateKey),a=await s.sign(o.subarray());return new nR({peerId:t,payloadType:n,payload:i,signature:a})})),Ze(iR,"openAndCertify",(async(e,t)=>{const r=await nR.createFromProtobuf(e);if(!await r.validate(t))throw new xd("envelope signature is not valid for the given domain",tR);return r}));const oR=(e,t,r)=>{const n=_l(e),i=eR.encode(n.byteLength),o=eR.encode(t.length),s=eR.encode(r.length);return new _a(i,n,o,t,s,r)};const sR=Uint8Array.from([3,1]);var aR,cR;!function(e){let t,r;!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.multiaddr&&e.multiaddr.byteLength>0&&(t.uint32(10),t.bytes(e.multiaddr)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.multiaddr=e.bytes();else e.skipType(7&t)}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(t=e.AddressInfo||(e.AddressInfo={})),e.codec=()=>(null==r&&(r=ia((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null!=t.peerId&&t.peerId.byteLength>0&&(r.uint32(10),r.bytes(t.peerId)),null!=t.seq&&0n!==t.seq&&(r.uint32(16),r.uint64(t.seq)),null!=t.addresses)for(const i of t.addresses)r.uint32(26),e.AddressInfo.codec().encode(i,r);!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={peerId:new Uint8Array(0),seq:0n,addresses:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.peerId=t.bytes();break;case 2:n.seq=t.uint64();break;case 3:n.addresses.push(e.AddressInfo.codec().decode(t,t.uint32()));break;default:t.skipType(7&r)}}return n}))),r),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(aR||(aR={}));class lR{constructor(e){Ze(this,"peerId",void 0),Ze(this,"multiaddrs",void 0),Ze(this,"seqNumber",void 0),Ze(this,"domain",lR.DOMAIN),Ze(this,"codec",lR.CODEC),Ze(this,"marshaled",void 0);const{peerId:t,multiaddrs:r,seqNumber:n}=e;this.peerId=t,this.multiaddrs=null!==r&&void 0!==r?r:[],this.seqNumber=null!==n&&void 0!==n?n:BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=aR.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))})),this.marshaled}equals(e){return e instanceof lR&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!function(e,t){const r=(e,t)=>e.toString().localeCompare(t.toString());return e.length===t.length&&(t.sort(r),e.sort(r).every(((e,r)=>t[r].equals(e))))}(this.multiaddrs,e.multiaddrs)))}}function uR(e,t,r){return r(it(e,t))}cR=lR,Ze(lR,"createFromProtobuf",(e=>{var t;const r=aR.decode(e),n=xm(r.peerId),i=(null!==(t=r.addresses)&&void 0!==t?t:[]).map((e=>ei(e.multiaddr))),o=r.seq;return new cR({peerId:n,multiaddrs:i,seqNumber:o})})),Ze(lR,"DOMAIN","libp2p-peer-record"),Ze(lR,"CODEC",sR);var hR=__webpack_require__(5438);var dR=new WeakMap;class fR{constructor(){nt(this,dR,[])}enqueue(e,t){const r={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&ot(dR,this)[this.size-1].priority>=t.priority)return void ot(dR,this).push(r);const n=function(e,t,r){let n=0,i=e.length;for(;i>0;){const o=Math.trunc(i/2);let s=n+o;r(e[s],t)<=0?(n=++s,i-=o+1):i=o}return n}(ot(dR,this),r,((e,t)=>t.priority-e.priority));ot(dR,this).splice(n,0,r)}dequeue(){const e=ot(dR,this).shift();return null===e||void 0===e?void 0:e.run}filter(e){return ot(dR,this).filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return ot(dR,this).length}}var pR=new WeakMap,gR=new WeakMap,yR=new WeakMap,mR=new WeakMap,vR=new WeakMap,bR=new WeakMap,wR=new WeakMap,ER=new WeakMap,_R=new WeakMap,SR=new WeakMap,AR=new WeakMap,kR=new WeakMap,IR=new WeakMap,CR=new WeakMap,RR=new WeakSet;class TR extends hR{constructor(e){var t,r,n,i;if(super(),Kk(this,RR),nt(this,pR,void 0),nt(this,gR,void 0),nt(this,yR,0),nt(this,mR,void 0),nt(this,vR,void 0),nt(this,bR,0),nt(this,wR,void 0),nt(this,ER,void 0),nt(this,_R,void 0),nt(this,SR,void 0),nt(this,AR,0),nt(this,kR,void 0),nt(this,IR,void 0),nt(this,CR,void 0),Ze(this,"timeout",void 0),!("number"===typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:fR,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(t=null===(r=e.intervalCap)||void 0===r?void 0:r.toString())&&void 0!==t?t:"","` (").concat(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 `".concat(null!==(n=null===(i=e.interval)||void 0===i?void 0:i.toString())&&void 0!==n?n:"","` (").concat(typeof e.interval,")"));st(pR,this,e.carryoverConcurrencyCount),st(gR,this,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval),st(mR,this,e.intervalCap),st(vR,this,e.interval),st(_R,this,new e.queueClass),st(SR,this,e.queueClass),this.concurrency=e.concurrency,this.timeout=e.timeout,st(CR,this,!0===e.throwOnTimeout),st(IR,this,!1===e.autoStart)}get concurrency(){return ot(kR,this)}set concurrency(e){if(!("number"===typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(typeof e,")"));st(kR,this,e),it(RR,this,UR).call(this)}async add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t={timeout:this.timeout,throwOnTimeout:ot(CR,this),...t},new Promise(((r,n)=>{ot(_R,this).enqueue((async()=>{var i,o;st(AR,this,(i=ot(AR,this),i++,i)),st(yR,this,(o=ot(yR,this),o++,o));try{var s;null===(s=t.signal)||void 0===s||s.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=lE(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,it(RR,this,FR).call(this,t.signal)]));const i=await n;r(i),this.emit("completed",i)}catch(a){if(a instanceof oE&&!t.throwOnTimeout)return void r();n(a),this.emit("error",a)}finally{it(RR,this,DR).call(this)}}),t),this.emit("add"),it(RR,this,LR).call(this)}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return ot(IR,this)?(st(IR,this,!1),it(RR,this,UR).call(this),this):this}pause(){st(IR,this,!0)}clear(){st(_R,this,new(ot(SR,this)))}async onEmpty(){0!==ot(_R,this).size&&await it(RR,this,jR).call(this,"empty")}async onSizeLessThan(e){ot(_R,this).size<e||await it(RR,this,jR).call(this,"next",(()=>ot(_R,this).size<e))}async onIdle(){0===ot(AR,this)&&0===ot(_R,this).size||await it(RR,this,jR).call(this,"idle")}get size(){return ot(_R,this).size}sizeBy(e){return ot(_R,this).filter(e).length}get pending(){return ot(AR,this)}get isPaused(){return ot(IR,this)}}function xR(e){return ot(gR,e)||ot(yR,e)<ot(mR,e)}function PR(e){return ot(AR,e)<ot(kR,e)}function DR(){var e;st(AR,this,(e=ot(AR,this),e--,e)),it(RR,this,LR).call(this),this.emit("next")}function NR(){it(RR,this,MR).call(this),it(RR,this,BR).call(this),st(ER,this,void 0)}function OR(e){const t=Date.now();if(void 0===ot(wR,e)){const r=ot(bR,e)-t;if(!(r<0))return void 0===ot(ER,e)&&st(ER,e,setTimeout((()=>{it(RR,e,NR).call(e)}),r)),!0;st(yR,e,ot(pR,e)?ot(AR,e):0)}return!1}function LR(){if(0===ot(_R,this).size)return ot(wR,this)&&clearInterval(ot(wR,this)),st(wR,this,void 0),this.emit("empty"),0===ot(AR,this)&&this.emit("idle"),!1;if(!ot(IR,this)){const e=!uR(RR,this,OR);if(uR(RR,this,xR)&&uR(RR,this,PR)){const t=ot(_R,this).dequeue();return!!t&&(this.emit("active"),t(),e&&it(RR,this,BR).call(this),!0)}}return!1}function BR(){ot(gR,this)||void 0!==ot(wR,this)||(st(wR,this,setInterval((()=>{it(RR,this,MR).call(this)}),ot(vR,this))),st(bR,this,Date.now()+ot(vR,this)))}function MR(){0===ot(yR,this)&&0===ot(AR,this)&&ot(wR,this)&&(clearInterval(ot(wR,this)),st(wR,this,void 0)),st(yR,this,ot(pR,this)?ot(AR,this):0),it(RR,this,UR).call(this)}function UR(){for(;it(RR,this,LR).call(this););}async function FR(e){return new Promise(((t,r)=>{e.addEventListener("abort",(()=>{r(e.reason)}),{once:!0})}))}async function jR(e,t){return new Promise((r=>{const n=()=>{t&&!t()||(this.off(e,n),r())};this.on(e,n)}))}const zR={},qR=e=>{e.addEventListener("message",(t=>{qR.dispatchEvent("message",e,t)})),null!=e.port&&e.port.addEventListener("message",(t=>{qR.dispatchEvent("message",e,t)}))};qR.addEventListener=(e,t)=>{null==zR[e]&&(zR[e]=[]),zR[e].push(t)},qR.removeEventListener=(e,t)=>{null!=zR[e]&&(zR[e]=zR[e].filter((e=>e===t)))},qR.dispatchEvent=function(e,t,r){null!=zR[e]&&zR[e].forEach((e=>e(t,r)))};const KR=qR,VR="lock:worker:request-read",HR="lock:worker:release-read",WR="lock:master:grant-read",GR="lock:worker:request-write",YR="lock:worker:release-write",QR="lock:master:grant-write",XR=(e,t,r,n,i)=>(o,s)=>{if(s.data.type!==r)return;const a={type:s.data.type,name:s.data.name,identifier:s.data.identifier};e.dispatchEvent(new MessageEvent(t,{data:{name:a.name,handler:async()=>{o.postMessage({type:i,name:a.name,identifier:a.identifier}),await new Promise((e=>{const t=r=>{if(null==r||null==r.data)return;const i=r.data.type,s=(r.data.name,r.data.identifier);i===n&&s===a.identifier&&(o.removeEventListener("message",t),e())};o.addEventListener("message",t)}))}}}))},JR=(e,t,r,n)=>async()=>{const i=Math.random().toString().substring(2);return globalThis.postMessage({type:t,identifier:i,name:e}),new Promise((t=>{const o=s=>{if(null==s||null==s.data)return;const a=s.data.type,c=s.data.identifier;a===r&&c===i&&(globalThis.removeEventListener("message",o),t((()=>{globalThis.postMessage({type:n,identifier:i,name:e})})))};globalThis.addEventListener("message",o)}))},$R={singleProcess:!1},ZR={};let eT;async function tT(e,t){let r;const n=new Promise((e=>{r=e}));return e.add((async()=>lE((async()=>{await new Promise((e=>{r((()=>{e()}))}))})(),{milliseconds:t.timeout}))),n}const rT={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function nT(e){const t=Object.assign({},rT,e);return null==eT&&(eT=(e=>{if(e=Object.assign({},$R,e),Boolean(globalThis.document)||e.singleProcess){const e=new EventTarget;return KR.addEventListener("message",XR(e,"requestReadLock",VR,HR,WR)),KR.addEventListener("message",XR(e,"requestWriteLock",GR,YR,QR)),e}return{isWorker:!0,readLock:e=>JR(e,VR,WR,HR),writeLock:e=>JR(e,GR,QR,YR)}})(t),!0!==eT.isWorker&&(eT.addEventListener("requestReadLock",(e=>{null!=ZR[e.data.name]&&ZR[e.data.name].readLock().then((async t=>e.data.handler().finally((()=>{t()}))))})),eT.addEventListener("requestWriteLock",(async e=>{null!=ZR[e.data.name]&&ZR[e.data.name].writeLock().then((async t=>e.data.handler().finally((()=>{t()}))))})))),null==ZR[t.name]&&(ZR[t.name]=((e,t)=>{if(!0===eT.isWorker)return{readLock:eT.readLock(e,t),writeLock:eT.writeLock(e,t)};const r=new TR({concurrency:1});let n;return{async readLock(){if(null!=n)return tT(n,t);n=new TR({concurrency:t.concurrency,autoStart:!1});const e=n,i=tT(n,t);return r.add((async()=>{e.start(),await e.onIdle().then((()=>{n===e&&(n=null)}))})),i},writeLock:async()=>(n=null,tT(r,t))}})(t.name,t)),ZR[t.name]}const iT={ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS"};var oT,sT,aT;function cT(e,t){var r;const n=oT.decode(t);null!=n.publicKey&&null==e.publicKey&&(e=function(e){if("RSA"===e.type)return new Im(e);if("Ed25519"===e.type)return new Cm(e);if("secp256k1"===e.type)return new Rm(e);throw new xd("Not a PeerId","ERR_INVALID_PARAMETERS")}({...e,publicKey:e.publicKey}));const i=new Map,o=BigInt(Date.now());for(const[s,a]of n.tags.entries())null!=a.expiry&&a.expiry<o||i.set(s,a);return{...n,id:e,addresses:n.addresses.map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:ei(t),isCertified:null!==r&&void 0!==r&&r}})),metadata:n.metadata,peerRecordEnvelope:null!==(r=n.peerRecordEnvelope)&&void 0!==r?r:void 0,tags:i}}!function(e){let t,r,n;!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.key&&""!==e.key&&(t.uint32(10),t.string(e.key)),null!=e.value&&e.value.byteLength>0&&(t.uint32(18),t.bytes(e.value)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={key:"",value:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.key=e.string();break;case 2:r.value=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(t=e.Peer$metadataEntry||(e.Peer$metadataEntry={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.key&&""!==e.key&&(t.uint32(10),t.string(e.key)),null!=e.value&&(t.uint32(18),aT.codec().encode(e.value,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={key:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.key=e.string();break;case 2:r.value=aT.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(r=e.Peer$tagsEntry||(e.Peer$tagsEntry={})),e.codec=()=>(null==n&&(n=ia((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null!=t.addresses)for(const e of t.addresses)r.uint32(10),sT.codec().encode(e,r);if(null!=t.protocols)for(const e of t.protocols)r.uint32(18),r.string(e);if(null!=t.publicKey&&(r.uint32(34),r.bytes(t.publicKey)),null!=t.peerRecordEnvelope&&(r.uint32(42),r.bytes(t.peerRecordEnvelope)),null!=t.metadata&&0!==t.metadata.size)for(const[i,o]of t.metadata.entries())r.uint32(50),e.Peer$metadataEntry.codec().encode({key:i,value:o},r);if(null!=t.tags&&0!==t.tags.size)for(const[i,o]of t.tags.entries())r.uint32(58),e.Peer$tagsEntry.codec().encode({key:i,value:o},r);!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={addresses:[],protocols:[],metadata:new Map,tags:new Map},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.addresses.push(sT.codec().decode(t,t.uint32()));break;case 2:n.protocols.push(t.string());break;case 4:n.publicKey=t.bytes();break;case 5:n.peerRecordEnvelope=t.bytes();break;case 6:{const r=e.Peer$metadataEntry.codec().decode(t,t.uint32());n.metadata.set(r.key,r.value);break}case 7:{const r=e.Peer$tagsEntry.codec().decode(t,t.uint32());n.tags.set(r.key,r.value);break}default:t.skipType(7&r)}}return n}))),n),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(oT||(oT={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.multiaddr&&e.multiaddr.byteLength>0&&(t.uint32(10),t.bytes(e.multiaddr)),null!=e.isCertified&&(t.uint32(16),t.bool(e.isCertified)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.multiaddr=e.bytes();break;case 2:r.isCertified=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(sT||(sT={})),function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.value&&0!==e.value&&(t.uint32(8),t.uint32(e.value)),null!=e.expiry&&(t.uint32(16),t.uint64(e.expiry)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={value:0},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.value=e.uint32();break;case 2:r.expiry=e.uint64();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(aT||(aT={}));const lT="/peers/";function uT(e){if(!tt(e)||null==e.type)throw new xd("Invalid PeerId",iT.ERR_INVALID_PARAMETERS);const t=e.toCID().toString();return new SC("".concat(lT).concat(t))}async function hT(e,t,r){const n=new Map;for(const o of r){var i;if(null==o)continue;if(o.multiaddr instanceof Uint8Array&&(o.multiaddr=ei(o.multiaddr)),!Zn(o.multiaddr))throw new xd("Multiaddr was invalid",iT.ERR_INVALID_PARAMETERS);if(!await t(e,o.multiaddr))continue;const r=null!==(i=o.isCertified)&&void 0!==i&&i,s=o.multiaddr.toString(),a=n.get(s);null!=a?o.isCertified=a.isCertified||r:n.set(s,{multiaddr:o.multiaddr,isCertified:r})}return[...n.values()].sort(((e,t)=>e.multiaddr.toString().localeCompare(t.multiaddr.toString()))).map((e=>{let{isCertified:t,multiaddr:r}=e;return{isCertified:t,multiaddr:r.bytes}}))}async function dT(e,t,r,n){var i,o,s,a,c,l,u;if(null==t)throw new xd("Invalid PeerData",iT.ERR_INVALID_PARAMETERS);if(null!=t.publicKey&&null!=e.publicKey&&!_f(t.publicKey,e.publicKey))throw new xd("publicKey bytes do not match peer id publicKey bytes",iT.ERR_INVALID_PARAMETERS);const h=n.existingPeer;if(null!=h&&!e.equals(h.id))throw new xd("peer id did not match existing peer id",iT.ERR_INVALID_PARAMETERS);let d=null!==(i=null===h||void 0===h?void 0:h.addresses)&&void 0!==i?i:[],f=new Set(null!==(o=null===h||void 0===h?void 0:h.protocols)&&void 0!==o?o:[]),p=null!==(s=null===h||void 0===h?void 0:h.metadata)&&void 0!==s?s:new Map,g=null!==(a=null===h||void 0===h?void 0:h.tags)&&void 0!==a?a:new Map,y=null===h||void 0===h?void 0:h.peerRecordEnvelope;if("patch"===r){if(null==t.multiaddrs&&null==t.addresses||(d=[],null!=t.multiaddrs&&d.push(...t.multiaddrs.map((e=>({isCertified:!1,multiaddr:e})))),null!=t.addresses&&d.push(...t.addresses)),null!=t.protocols&&(f=new Set(t.protocols)),null!=t.metadata){p=fT(t.metadata instanceof Map?[...t.metadata.entries()]:Object.entries(t.metadata),{validate:pT})}if(null!=t.tags){g=fT(t.tags instanceof Map?[...t.tags.entries()]:Object.entries(t.tags),{validate:gT,map:yT})}null!=t.peerRecordEnvelope&&(y=t.peerRecordEnvelope)}if("merge"===r){if(null!=t.multiaddrs&&d.push(...t.multiaddrs.map((e=>({isCertified:!1,multiaddr:e})))),null!=t.addresses&&d.push(...t.addresses),null!=t.protocols&&(f=new Set([...f,...t.protocols])),null!=t.metadata){const e=t.metadata instanceof Map?[...t.metadata.entries()]:Object.entries(t.metadata);for(const[t,r]of e)null==r?p.delete(t):p.set(t,r);p=fT([...p.entries()],{validate:pT})}if(null!=t.tags){const e=t.tags instanceof Map?[...t.tags.entries()]:Object.entries(t.tags),r=new Map(g);for(const[t,n]of e)null==n?r.delete(t):r.set(t,n);g=fT([...r.entries()],{validate:gT,map:yT})}null!=t.peerRecordEnvelope&&(y=t.peerRecordEnvelope)}const m={addresses:await hT(e,null!==(c=n.addressFilter)&&void 0!==c?c:async()=>!0,d),protocols:[...f.values()].sort(((e,t)=>e.localeCompare(t))),metadata:p,tags:g,publicKey:null!==(l=null!==(u=null===h||void 0===h?void 0:h.id.publicKey)&&void 0!==u?u:t.publicKey)&&void 0!==l?l:e.publicKey,peerRecordEnvelope:y};return"RSA"!==e.type&&delete m.publicKey,m}function fT(e,t){const r=new Map;for(const[o,s]of e)null!=s&&t.validate(o,s);for(const[o,s]of e.sort(((e,t)=>{let[r]=e,[n]=t;return r.localeCompare(n)}))){var n,i;if(null!=s)r.set(o,null!==(n=null===(i=t.map)||void 0===i?void 0:i.call(t,o,s))&&void 0!==n?n:s)}return r}function pT(e,t){if("string"!==typeof e)throw new xd("Metadata key must be a string",iT.ERR_INVALID_PARAMETERS);if(!(t instanceof Uint8Array))throw new xd("Metadata value must be a Uint8Array",iT.ERR_INVALID_PARAMETERS)}function gT(e,t){if("string"!==typeof e)throw new xd("Tag name must be a string",iT.ERR_INVALID_PARAMETERS);if(null!=t.value){if(parseInt("".concat(t.value),10)!==t.value)throw new xd("Tag value must be an integer",iT.ERR_INVALID_PARAMETERS);if(t.value<0||t.value>100)throw new xd("Tag value must be between 0-100",iT.ERR_INVALID_PARAMETERS)}if(null!=t.ttl){if(parseInt("".concat(t.ttl),10)!==t.ttl)throw new xd("Tag ttl must be an integer",iT.ERR_INVALID_PARAMETERS);if(t.ttl<0)throw new xd("Tag ttl must be between greater than 0",iT.ERR_INVALID_PARAMETERS)}}function yT(e,t){var r;let n;return null!=t.expiry&&(n=t.expiry),null!=t.ttl&&(n=BigInt(Date.now()+Number(t.ttl))),{value:null!==(r=t.value)&&void 0!==r?r:0,expiry:n}}function mT(e,t,r){const n=e.toString().split("/")[2],i=xm(My.decode(n)),o=r.get(i);if(null!=o)return o;const s=cT(i,t);return r.set(i,s),s}var vT=new WeakSet;class bT{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Kk(this,vT),Ze(this,"peerId",void 0),Ze(this,"datastore",void 0),Ze(this,"lock",void 0),Ze(this,"addressFilter",void 0),this.peerId=e.peerId,this.datastore=e.datastore,this.addressFilter=t.addressFilter,this.lock=nT({name:"peer-store",singleProcess:!0})}async has(e){return this.datastore.has(uT(e))}async delete(e){if(this.peerId.equals(e))throw new xd("Cannot delete self peer",iT.ERR_INVALID_PARAMETERS);await this.datastore.delete(uT(e))}async load(e){return cT(e,await this.datastore.get(uT(e)))}async save(e,t){const{existingBuf:r,existingPeer:n}=await it(vT,this,wT).call(this,e),i=await dT(e,t,"patch",{addressFilter:this.addressFilter});return it(vT,this,ET).call(this,e,i,r,n)}async patch(e,t){const{existingBuf:r,existingPeer:n}=await it(vT,this,wT).call(this,e),i=await dT(e,t,"patch",{addressFilter:this.addressFilter,existingPeer:n});return it(vT,this,ET).call(this,e,i,r,n)}async merge(e,t){const{existingBuf:r,existingPeer:n}=await it(vT,this,wT).call(this,e),i=await dT(e,t,"merge",{addressFilter:this.addressFilter,existingPeer:n});return it(vT,this,ET).call(this,e,i,r,n)}async*all(e){const t=new jC;for await(const{key:r,value:n}of this.datastore.query(function(e,t){var r,n;return null==e?{}:{prefix:lT,filters:(null!==(r=e.filters)&&void 0!==r?r:[]).map((e=>r=>{let{key:n,value:i}=r;return e(mT(n,i,t))})),orders:(null!==(n=e.orders)&&void 0!==n?n:[]).map((e=>(r,n)=>e(mT(r.key,r.value,t),mT(n.key,n.value,t))))}}(null!==e&&void 0!==e?e:{},t))){const e=mT(r,n,t);e.id.equals(this.peerId)||(yield e)}}}async function wT(e){try{const t=await this.datastore.get(uT(e));return{existingBuf:t,existingPeer:cT(e,t)}}catch(t){if("ERR_NOT_FOUND"!==t.code)throw t}return{}}async function ET(e,t,r,n){const i=oT.encode(t);return null!=r&&_f(i,r)?{peer:cT(e,i),previous:n,updated:!1}:(await this.datastore.put(uT(e),i),{peer:cT(e,i),previous:n,updated:!0})}const _T=jm("libp2p:peer-store");var ST=new WeakSet;class AT{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Kk(this,ST),Ze(this,"store",void 0),Ze(this,"events",void 0),Ze(this,"peerId",void 0),this.events=e.events,this.peerId=e.peerId,this.store=new bT(e,t)}async forEach(e,t){_T.trace("forEach await read lock");const r=await this.store.lock.readLock();_T.trace("forEach got read lock");try{for await(const r of this.store.all(t))e(r)}finally{_T.trace("forEach release read lock"),r()}}async all(e){_T.trace("all await read lock");const t=await this.store.lock.readLock();_T.trace("all got read lock");try{return await pa(this.store.all(e))}finally{_T.trace("all release read lock"),t()}}async delete(e){_T.trace("delete await write lock");const t=await this.store.lock.writeLock();_T.trace("delete got write lock");try{await this.store.delete(e)}finally{_T.trace("delete release write lock"),t()}}async has(e){_T.trace("has await read lock");const t=await this.store.lock.readLock();_T.trace("has got read lock");try{return await this.store.has(e)}finally{_T.trace("has release read lock"),t()}}async get(e){_T.trace("get await read lock");const t=await this.store.lock.readLock();_T.trace("get got read lock");try{return await this.store.load(e)}finally{_T.trace("get release read lock"),t()}}async save(e,t){_T.trace("save await write lock");const r=await this.store.lock.writeLock();_T.trace("save got write lock");try{const r=await this.store.save(e,t);return it(ST,this,kT).call(this,e,r),r.peer}finally{_T.trace("save release write lock"),r()}}async patch(e,t){_T.trace("patch await write lock");const r=await this.store.lock.writeLock();_T.trace("patch got write lock");try{const r=await this.store.patch(e,t);return it(ST,this,kT).call(this,e,r),r.peer}finally{_T.trace("patch release write lock"),r()}}async merge(e,t){_T.trace("merge await write lock");const r=await this.store.lock.writeLock();_T.trace("merge got write lock");try{const r=await this.store.merge(e,t);return it(ST,this,kT).call(this,e,r),r.peer}finally{_T.trace("merge release write lock"),r()}}async consumePeerRecord(e,t){var r;const n=await iR.openAndCertify(e,lR.DOMAIN);if(!1===(null===t||void 0===t?void 0:t.equals(n.peerId)))return _T("envelope peer id was not the expected peer id - expected: %p received: %p",t,n.peerId),!1;const i=lR.createFromProtobuf(n.payload);let o;try{o=await this.get(n.peerId)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}if(null!=(null===(r=o)||void 0===r?void 0:r.peerRecordEnvelope)){const e=await iR.createFromProtobuf(o.peerRecordEnvelope),t=lR.createFromProtobuf(e.payload);if(t.seqNumber>=i.seqNumber)return _T("sequence number was lower or equal to existing sequence number - stored: %d received: %d",t.seqNumber,i.seqNumber),!1}return await this.patch(i.peerId,{peerRecordEnvelope:e,addresses:i.multiaddrs.map((e=>({isCertified:!0,multiaddr:e})))}),!0}}function kT(e,t){t.updated&&(this.peerId.equals(e)?this.events.safeDispatchEvent("self:peer:update",{detail:t}):this.events.safeDispatchEvent("peer:update",{detail:t}))}const IT=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{for await(const t of e);})();for(const t of e);};const CT=function(e){const[t,r]=null!=e[Symbol.asyncIterator]?[e[Symbol.asyncIterator](),Symbol.asyncIterator]:[e[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>t.next(),push:e=>{n.push(e)},next:()=>n.length>0?{done:!1,value:n.shift()}:t.next(),[r](){return this}}};const RT=function(e,t){if(null!=e[Symbol.asyncIterator])return async function*(){for await(const r of e)await t(r)&&(yield r)}();const r=CT(e),{value:n,done:i}=r.next();if(!0===i)return function*(){}();const o=t(n);if("function"===typeof o.then)return async function*(){await o&&(yield n);for await(const e of r)await t(e)&&(yield e)}();const s=t;return function*(){!0===o&&(yield n);for(const e of r)s(e)&&(yield e)}()};const TT=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(){const r=await pa(e);yield*r.sort(t)}():function*(){const r=pa(e);yield*r.sort(t)}()};const xT=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}():function*(){let r=0;if(!(t<1))for(const n of e)if(yield n,r++,r===t)return}()};class PT{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){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const{key:n,value:i}of e)await t.put(n,i,r),yield n}()}catch(r){return Promise.reject(r)}}getMany(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const n of e)yield{key:n,value:await t.get(n,r)}}()}catch(r){return Promise.reject(r)}}deleteMany(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const n of e)await t.delete(n,r),yield n}()}catch(r){return Promise.reject(r)}}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await IT(this.putMany(e,r)),e=[],await IT(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}async*_allKeys(e,t){throw new Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix){const t=e.prefix;r=RT(r,(e=>e.key.toString().startsWith(t)))}if(Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>RT(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>TT(e,t)),r)),null!=e.offset){let t=0;const n=e.offset;r=RT(r,(()=>t++>=n))}return null!=e.limit&&(r=xT(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix){const t=e.prefix;r=RT(r,(e=>e.toString().startsWith(t)))}if(Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>RT(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>TT(e,t)),r)),null!=e.offset){const t=e.offset;let n=0;r=RT(r,(()=>n++>=t))}return null!=e.limit&&(r=xT(r,e.limit)),r}}class DT extends PT{constructor(){super(),Ze(this,"data",void 0),this.data=new Map}put(e,t){return this.data.set(e.toString(),t),e}get(e){const t=this.data.get(e.toString());if(null==t)throw function(e){var t;return e=null!==(t=e)&&void 0!==t?t:new Error("Not Found"),Ia(e,"ERR_NOT_FOUND")}();return t}has(e){return this.data.has(e.toString())}delete(e){this.data.delete(e.toString())}*_all(){for(const[e,t]of this.data.entries())yield{key:new SC(e),value:t}}*_allKeys(){for(const e of this.data.keys())yield new SC(e)}}const NT=jm("libp2p:address-manager"),OT=e=>e;function LT(e,t){const r=e.getPeerId();if(null!=r){Tm(r).equals(t)&&(e=e.decapsulate(ei("/p2p/".concat(t.toString()))))}return e}class BT{constructor(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ze(this,"components",void 0),Ze(this,"listen",void 0),Ze(this,"announce",void 0),Ze(this,"observed",void 0),Ze(this,"announceFilter",void 0);const{listen:n=[],announce:i=[]}=r;this.components=e,this.listen=n.map((e=>e.toString())),this.announce=new Set(i.map((e=>e.toString()))),this.observed=new Map,this.announceFilter=null!==(t=r.announceFilter)&&void 0!==t?t:OT,this._updatePeerStoreAddresses=function(e,t){let r;return function(){clearTimeout(r),r=setTimeout((function(){r=void 0,e()}),t)}}(this._updatePeerStoreAddresses.bind(this),1e3),e.events.addEventListener("transport:listening",(()=>{this._updatePeerStoreAddresses()})),e.events.addEventListener("transport:close",(()=>{this._updatePeerStoreAddresses()}))}_updatePeerStoreAddresses(){const e=this.getAnnounceAddrs().concat(this.components.transportManager.getAddrs()).concat([...this.observed.entries()].filter((e=>{let[t,r]=e;return r.confident})).map((e=>{let[t]=e;return ei(t)}))).map((e=>e.getPeerId()===this.components.peerId.toString()?e.decapsulate("/p2p/".concat(this.components.peerId.toString())):e));this.components.peerStore.patch(this.components.peerId,{multiaddrs:e}).catch((e=>{NT.error("error updating addresses",e)}))}getListenAddrs(){return Array.from(this.listen).map((e=>ei(e)))}getAnnounceAddrs(){return Array.from(this.announce).map((e=>ei(e)))}getObservedAddrs(){return Array.from(this.observed).map((e=>{let[t]=e;return ei(t)}))}addObservedAddr(e){const t=(e=LT(e,this.components.peerId)).toString();this.observed.has(t)||this.observed.set(t,{confident:!1})}confirmObservedAddr(e){var t;const r=(e=LT(e,this.components.peerId)).toString(),n=(null!==(t=this.observed.get(r))&&void 0!==t?t:{confident:!1}).confident;this.observed.set(r,{confident:!0}),n||this._updatePeerStoreAddresses()}removeObservedAddr(e){const t=(e=LT(e,this.components.peerId)).toString();this.observed.delete(t)}getAddresses(){let e=this.getAnnounceAddrs().map((e=>e.toString()));0===e.length&&(e=this.components.transportManager.getAddrs().map((e=>e.toString()))),e=e.concat(Array.from(this.observed).filter((e=>{let[t,r]=e;return r.confident})).map((e=>{let[t]=e;return t})));const t=new Set(e);return this.announceFilter(Array.from(t).map((e=>ei(e)))).map((e=>{var t;return!0===(null===(t=e.protos().pop())||void 0===t?void 0:t.path)||e.getPeerId()===this.components.peerId.toString()?e:e.encapsulate("/p2p/".concat(this.components.peerId.toString()))}))}}function MT(e){return null!=e&&"function"===typeof e.start&&"function"===typeof e.stop}class UT{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ze(this,"components",{}),Ze(this,"_started",!1),this.components={};for(const[t,r]of Object.entries(e))this.components[t]=r}isStarted(){return this._started}async _invokeStartableMethod(e){await Promise.all(Object.values(this.components).filter((e=>MT(e))).map((async t=>{var r;await(null===(r=t[e])||void 0===r?void 0:r.call(t))})))}async beforeStart(){await this._invokeStartableMethod("beforeStart")}async start(){await this._invokeStartableMethod("start"),this._started=!0}async afterStart(){await this._invokeStartableMethod("afterStart")}async beforeStop(){await this._invokeStartableMethod("beforeStop")}async stop(){await this._invokeStartableMethod("stop"),this._started=!1}async afterStop(){await this._invokeStartableMethod("afterStop")}}const FT=["metrics","connectionProtector"],jT=["components","isStarted","beforeStart","start","afterStart","beforeStop","stop","afterStop","then","_invokeStartableMethod"];var zT=__webpack_require__(3297);const qT="[a-fA-F\\d:]",KT=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(qT,")|(?<=").concat(qT,")(?=\\s|$))"):"",VT="(?: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}",HT="[a-fA-F\\d]{1,4}",WT="\n(?:\n(?:".concat(HT,":){7}(?:").concat(HT,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(HT,":){6}(?:").concat(VT,"|:").concat(HT,"|:)| // 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(?:").concat(HT,":){5}(?::").concat(VT,"|(?::").concat(HT,"){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(?:").concat(HT,":){4}(?:(?::").concat(HT,"){0,1}:").concat(VT,"|(?::").concat(HT,"){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(?:").concat(HT,":){3}(?:(?::").concat(HT,"){0,2}:").concat(VT,"|(?::").concat(HT,"){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(?:").concat(HT,":){2}(?:(?::").concat(HT,"){0,3}:").concat(VT,"|(?::").concat(HT,"){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(?:").concat(HT,":){1}(?:(?::").concat(HT,"){0,4}:").concat(VT,"|(?::").concat(HT,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(HT,"){0,5}:").concat(VT,"|(?::").concat(HT,"){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(),GT=new RegExp("(?:^".concat(VT,"$)|(?:^").concat(WT,"$)")),YT=new RegExp("^".concat(VT,"$")),QT=new RegExp("^".concat(WT,"$")),XT=e=>e&&e.exact?GT:new RegExp("(?:".concat(KT(e)).concat(VT).concat(KT(e),")|(?:").concat(KT(e)).concat(WT).concat(KT(e),")"),"g");XT.v4=e=>e&&e.exact?YT:new RegExp("".concat(KT(e)).concat(VT).concat(KT(e)),"g"),XT.v6=e=>e&&e.exact?QT:new RegExp("".concat(KT(e)).concat(WT).concat(KT(e)),"g");const JT=XT;var $T=__webpack_require__(5958);const{isValid:ZT,parse:ex}=$T,tx=["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((e=>new zT.Netmask(e)));function rx(e){return/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^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(e)||/^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(e)||/^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(e)||/^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(e)||/^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(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e)}const nx=e=>{if(ZT(e)){const t=ex(e);if("ipv4"===t.kind())return function(e){for(let t of tx)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return rx(e)}else if(bn(e)&&JT.v6().test(e))return rx(e)};function ix(){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async e=>{const t=e.stringTuples();return(4===t[0][0]||41===t[0][0])&&Boolean(nx("".concat(t[0][1])))},denyInboundConnection:async()=>!1,denyOutboundConnection:async()=>!1,denyInboundEncryptedConnection:async()=>!1,denyOutboundEncryptedConnection:async()=>!1,denyInboundUpgradedConnection:async()=>!1,denyOutboundUpgradedConnection:async()=>!1,filterMultiaddrForPeer:async()=>!0,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}function ox(e){try{const{address:t}=e.nodeAddress();return Boolean(nx(t))}catch{return!0}}function sx(e,t){const r=ox(e.multiaddr),n=ox(t.multiaddr);return r&&!n?1:!r&&n||e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}class ax extends Event{constructor(e,t){super(e),this.detail=t}}function cx(e){const t=[VP.A];return null==e?t:Array.isArray(e)?0===e.length?t:e:[e]}new Uint8Array(0);function lx(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}var ux=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const hx=ux;class dx{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class fx{constructor(e,t,r){if(Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseDecode",void 0),Ze(this,"prefixCodePoint",void 0),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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return gx(this,e)}}class px{constructor(e){Ze(this,"decoders",void 0),this.decoders=e}or(e){return gx(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(null!=r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}function gx(e,t){var r,n;return new px({...null!==(r=e.decoders)&&void 0!==r?r:{[e.prefix]:e},...null!==(n=t.decoders)&&void 0!==n?n:{[t.prefix]:t}})}class yx{constructor(e,t,r,n){Ze(this,"name",void 0),Ze(this,"prefix",void 0),Ze(this,"baseEncode",void 0),Ze(this,"baseDecode",void 0),Ze(this,"encoder",void 0),Ze(this,"decoder",void 0),this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new dx(e,t,r),this.decoder=new fx(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}function mx(e){let{name:t,prefix:r,encode:n,decode:i}=e;return new yx(t,r,n,i)}function vx(e){let{name:t,prefix:r,alphabet:n}=e;const{encode:i,decode:o}=hx(n,t);return mx({prefix:r,name:t,encode:i,decode:e=>lx(o(e))})}function bx(e){let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return mx({prefix:r,name:t,encode:e=>function(e,t,r){const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(0!==s&&(o+=t[i&a<<r-s]),n)for(;0!==(o.length*r&7);)o+="=";return o}(e,i,n),decode:e=>function(e,t,r,n){const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||0!==(255&c<<8-a))throw new SyntaxError("Unexpected end of data");return s}(e,i,n,t)})}const wx=vx({prefix:"9",name:"base10",alphabet:"0123456789"}),Ex=bx({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_x=bx({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Sx=bx({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Ax=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),kx=Ax.reduce(((e,t,r)=>(e[r]=t,e)),[]),Ix=Ax.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const Cx=mx({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=kx[t]),"")},decode:function(e){const t=[];for(const r of e){const e=Ix[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),Rx=bx({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Tx=bx({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),xx=bx({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Px=bx({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Dx=bx({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Nx=bx({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ox=bx({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Lx=bx({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Bx=bx({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Mx=vx({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ux=vx({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Fx=vx({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),jx=vx({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),zx=bx({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qx=bx({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Kx=bx({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Vx=bx({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Hx=bx({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Wx=mx({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>function(e){return(new TextEncoder).encode(e)}(e)}),Gx=new TextEncoder,Yx=new TextDecoder,Qx="json",Xx=512;function Jx(e){return Gx.encode(JSON.stringify(e))}function $x(e){return JSON.parse(Yx.decode(e))}const Zx="raw",eP=85;function tP(e){return lx(e)}function rP(e){return lx(e)}var nP=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=sP;)r[n++]=255&t|iP,t/=128;for(;t&oP;)r[n++]=255&t|iP,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},iP=128,oP=-128,sP=Math.pow(2,31);var aP=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&lP)<<o:(n&lP)*Math.pow(2,o),o+=7}while(n>=cP);return e.bytes=s-r,i},cP=128,lP=127;var uP=Math.pow(2,7),hP=Math.pow(2,14),dP=Math.pow(2,21),fP=Math.pow(2,28),pP=Math.pow(2,35),gP=Math.pow(2,42),yP=Math.pow(2,49),mP=Math.pow(2,56),vP=Math.pow(2,63);const bP={encode:nP,decode:aP,encodingLength:function(e){return e<uP?1:e<hP?2:e<dP?3:e<fP?4:e<pP?5:e<gP?6:e<yP?7:e<mP?8:e<vP?9:10}};function wP(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return bP.encode(e,t,r),t}function EP(e){return bP.encodingLength(e)}function _P(e,t){const r=t.byteLength,n=EP(e),i=n+EP(r),o=new Uint8Array(i+r);return wP(e,o,0),wP(r,o,n),o.set(t,i),new SP(e,r,t,o)}class SP{constructor(e,t,r,n){Ze(this,"code",void 0),Ze(this,"size",void 0),Ze(this,"digest",void 0),Ze(this,"bytes",void 0),this.code=e,this.size=t,this.digest=r,this.bytes=n}}const AP=lx;const kP={code:0,name:"identity",encode:AP,digest:function(e){return _P(0,AP(e))}};function IP(e){let{name:t,code:r,encode:n}=e;return new CP(t,r,n)}class CP{constructor(e,t,r){Ze(this,"name",void 0),Ze(this,"code",void 0),Ze(this,"encode",void 0),this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?_P(this.code,t):t.then((e=>_P(this.code,e)))}throw Error("Unknown type, must be binary type")}}function RP(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}const TP=IP({name:"sha2-256",code:18,encode:RP("SHA-256")}),xP=IP({name:"sha2-512",code:19,encode:RP("SHA-512")});new WeakMap;Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const PP={...qe,...Le,...ze,...Ne,...Oe,...Me,...Ue,...Fe,...je,...Be};function DP(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const NP=DP("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),OP=DP("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=function(){return new Uint8Array(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),LP={utf8:NP,"utf-8":NP,hex:PP.base16,latin1:OP,ascii:OP,binary:OP,...PP};function BP(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=LP[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.encoder.encode(e).substring(1)}const MP=60;function UP(e){var t,r,n,i,o,s,a,c,l,u,h,d,f,p,g;return{Status:null!==(t=e.Status)&&void 0!==t?t:0,TC:null!==(r=null!==(n=e.TC)&&void 0!==n?n:e.flag_tc)&&void 0!==r&&r,RD:null!==(i=null!==(o=e.RD)&&void 0!==o?o:e.flag_rd)&&void 0!==i&&i,RA:null!==(s=null!==(a=e.RA)&&void 0!==a?a:e.flag_ra)&&void 0!==s&&s,AD:null!==(c=null!==(l=e.AD)&&void 0!==l?l:e.flag_ad)&&void 0!==c&&c,CD:null!==(u=null!==(h=e.CD)&&void 0!==h?h:e.flag_cd)&&void 0!==u&&u,Question:(null!==(d=null!==(f=e.Question)&&void 0!==f?f:e.questions)&&void 0!==d?d:[]).map((e=>({name:e.name,type:VP[e.type]}))),Answer:(null!==(p=null!==(g=e.Answer)&&void 0!==g?g:e.answers)&&void 0!==p?p:[]).map((e=>{var t,r;return{name:e.name,type:VP[e.type],TTL:null!==(t=null!==(r=e.TTL)&&void 0!==r?r:e.ttl)&&void 0!==t?t:MP,data:e.data instanceof Uint8Array?BP(e.data):e.data}}))}}const FP=4;function jP(e){var t;const r=new TR({concurrency:null!==(t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).queryConcurrency)&&void 0!==t?t:FP});return async function(t){var n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=new URLSearchParams;o.set("name",t),cx(i.types).forEach((e=>{o.append("type",e.toString())})),null===(n=i.onProgress)||void 0===n||n.call(i,new ax("dns:query",{detail:t}));const s=await r.add((async()=>{var t;const r=await fetch("".concat(e,"?").concat(o),{headers:{accept:"application/dns-json"},signal:null===i||void 0===i?void 0:i.signal});if(200!==r.status)throw new Error("Unexpected HTTP status: ".concat(r.status," - ").concat(r.statusText));const n=UP(await r.json());return null===(t=i.onProgress)||void 0===t||t.call(i,new ax("dns:response",{detail:n})),n}),{signal:i.signal});if(null==s)throw new Error("No DNS response received");return s}}var zP=__webpack_require__(1196);class qP{constructor(e){Ze(this,"lru",void 0),this.lru=zP(e)}get(e,t){let r=!0;const n=[];for(const i of t){const t=this.getAnswers(e,i);if(0===t.length){r=!1;break}n.push(...t)}if(r)return UP({answers:n})}getAnswers(e,t){const r="".concat(e.toLowerCase(),"-").concat(t),n=this.lru.get(r);if(null!=n){const e=n.filter((e=>e.expires>Date.now())).map((e=>{let{expires:t,value:r}=e;return{...r,TTL:Math.round((t-Date.now())/1e3),type:VP[r.type]}}));return 0===e.length&&this.lru.remove(r),e}return[]}add(e,t){var r,n;const i="".concat(e.toLowerCase(),"-").concat(t.type),o=null!==(r=this.lru.get(i))&&void 0!==r?r:[];o.push({expires:Date.now()+1e3*(null!==(n=t.TTL)&&void 0!==n?n:MP),value:t}),this.lru.set(i,o)}remove(e,t){const r="".concat(e.toLowerCase(),"-").concat(t);this.lru.remove(r)}clear(){this.lru.clear()}}class KP{constructor(e){var t,r,n;Ze(this,"resolvers",void 0),Ze(this,"cache",void 0),this.resolvers={},this.cache=(n=null!==(t=e.cacheSize)&&void 0!==t?t:1e3,new qP(n)),Object.entries(null!==(r=e.resolvers)&&void 0!==r?r:{}).forEach((e=>{let[t,r]=e;Array.isArray(r)||(r=[r]),t.endsWith(".")||(t="".concat(t,".")),this.resolvers[t]=r})),null==this.resolvers["."]&&(this.resolvers["."]=[jP("https://cloudflare-dns.com/dns-query"),jP("https://dns.google/resolve")])}async query(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=cx(r.types),i=!1!==r.cached?this.cache.get(e,n):void 0;var o;if(null!=i)return null===(o=r.onProgress)||void 0===o||o.call(r,new ax("dns:cache",{detail:i})),i;const s="".concat(e.split(".").pop(),"."),a=(null!==(t=this.resolvers[s])&&void 0!==t?t:this.resolvers["."]).sort((()=>Math.random()>.5?-1:1)),c=[];for(const d of a){var l;if(!0===(null===(l=r.signal)||void 0===l?void 0:l.aborted))break;try{const t=await d(e,{...r,types:n});for(const r of t.Answer)this.cache.add(e,r);return t}catch(h){var u;c.push(h),null===(u=r.onProgress)||void 0===u||u.call(r,new ax("dns:error",{detail:h}))}}if(1===c.length)throw c[0];throw new AggregateError(c,"DNS lookup of ".concat(e," ").concat(n," failed"))}}var VP;!function(e){e[e.A=1]="A",e[e.CNAME=5]="CNAME",e[e.TXT=16]="TXT",e[e.AAAA=28]="AAAA"}(VP||(VP={}));const{code:HP}=Cn("dnsaddr"),WP=async function(e){var t,r,n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=null!==(t=i.maxRecursiveDepth)&&void 0!==t?t:32;if(0===o)throw new ct("Max recursive depth reached","ERR_MAX_RECURSIVE_DEPTH_REACHED");const[,s]=null!==(r=e.stringTuples().find((e=>{let[t]=e;return t===HP})))&&void 0!==r?r:[],a=null!==(n=null===i||void 0===i?void 0:i.dns)&&void 0!==n?n:function(){return new KP(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}(),c=await a.query("_dnsaddr.".concat(s),{signal:null===i||void 0===i?void 0:i.signal,types:[VP.TXT]}),l=e.getPeerId(),u=[];for(const h of c.Answer){const e=h.data.split("=")[1];if(null==e)continue;if(null!=l&&!e.includes(l))continue;const t=ei(e);if(e.startsWith("/dnsaddr")){const e=await t.resolve({...i,maxRecursiveDepth:o-1});u.push(...e.map((e=>e.toString())))}else u.push(t.toString())}return u};var GP,YP;!function(e){e.NOT_STARTED_YET="The libp2p node is not started yet",e.DHT_DISABLED="DHT is not available",e.PUBSUB_DISABLED="PubSub is not available",e.CONN_ENCRYPTION_REQUIRED="At least one connection encryption module is required",e.ERR_TRANSPORTS_REQUIRED="At least one transport module is required",e.ERR_PROTECTOR_REQUIRED="Private network is enforced, but no protector was provided",e.NOT_FOUND="Not found"}(GP||(GP={})),function(e){e.DHT_DISABLED="ERR_DHT_DISABLED",e.ERR_PUBSUB_DISABLED="ERR_PUBSUB_DISABLED",e.PUBSUB_NOT_STARTED="ERR_PUBSUB_NOT_STARTED",e.DHT_NOT_STARTED="ERR_DHT_NOT_STARTED",e.CONN_ENCRYPTION_REQUIRED="ERR_CONN_ENCRYPTION_REQUIRED",e.ERR_TRANSPORTS_REQUIRED="ERR_TRANSPORTS_REQUIRED",e.ERR_PROTECTOR_REQUIRED="ERR_PROTECTOR_REQUIRED",e.ERR_PEER_DIAL_INTERCEPTED="ERR_PEER_DIAL_INTERCEPTED",e.ERR_CONNECTION_INTERCEPTED="ERR_CONNECTION_INTERCEPTED",e.ERR_INVALID_PROTOCOLS_FOR_STREAM="ERR_INVALID_PROTOCOLS_FOR_STREAM",e.ERR_CONNECTION_ENDED="ERR_CONNECTION_ENDED",e.ERR_CONNECTION_FAILED="ERR_CONNECTION_FAILED",e.ERR_NODE_NOT_STARTED="ERR_NODE_NOT_STARTED",e.ERR_ALREADY_ABORTED="ERR_ALREADY_ABORTED",e.ERR_TOO_MANY_ADDRESSES="ERR_TOO_MANY_ADDRESSES",e.ERR_NO_VALID_ADDRESSES="ERR_NO_VALID_ADDRESSES",e.ERR_RELAYED_DIAL="ERR_RELAYED_DIAL",e.ERR_DIALED_SELF="ERR_DIALED_SELF",e.ERR_DISCOVERED_SELF="ERR_DISCOVERED_SELF",e.ERR_DUPLICATE_TRANSPORT="ERR_DUPLICATE_TRANSPORT",e.ERR_ENCRYPTION_FAILED="ERR_ENCRYPTION_FAILED",e.ERR_HOP_REQUEST_FAILED="ERR_HOP_REQUEST_FAILED",e.ERR_INVALID_KEY="ERR_INVALID_KEY",e.ERR_INVALID_MESSAGE="ERR_INVALID_MESSAGE",e.ERR_INVALID_PARAMETERS="ERR_INVALID_PARAMETERS",e.ERR_INVALID_PEER="ERR_INVALID_PEER",e.ERR_MUXER_UNAVAILABLE="ERR_MUXER_UNAVAILABLE",e.ERR_NOT_FOUND="ERR_NOT_FOUND",e.ERR_TIMEOUT="ERR_TIMEOUT",e.ERR_TRANSPORT_UNAVAILABLE="ERR_TRANSPORT_UNAVAILABLE",e.ERR_TRANSPORT_DIAL_FAILED="ERR_TRANSPORT_DIAL_FAILED",e.ERR_UNSUPPORTED_PROTOCOL="ERR_UNSUPPORTED_PROTOCOL",e.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED="ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED",e.ERR_INVALID_MULTIADDR="ERR_INVALID_MULTIADDR",e.ERR_SIGNATURE_NOT_VALID="ERR_SIGNATURE_NOT_VALID",e.ERR_FIND_SELF="ERR_FIND_SELF",e.ERR_NO_ROUTERS_AVAILABLE="ERR_NO_ROUTERS_AVAILABLE",e.ERR_CONNECTION_NOT_MULTIPLEXED="ERR_CONNECTION_NOT_MULTIPLEXED",e.ERR_NO_DIAL_TOKENS="ERR_NO_DIAL_TOKENS",e.ERR_KEYCHAIN_REQUIRED="ERR_KEYCHAIN_REQUIRED",e.ERR_INVALID_CMS="ERR_INVALID_CMS",e.ERR_MISSING_KEYS="ERR_MISSING_KEYS",e.ERR_NO_KEY="ERR_NO_KEY",e.ERR_INVALID_KEY_NAME="ERR_INVALID_KEY_NAME",e.ERR_INVALID_KEY_TYPE="ERR_INVALID_KEY_TYPE",e.ERR_KEY_ALREADY_EXISTS="ERR_KEY_ALREADY_EXISTS",e.ERR_INVALID_KEY_SIZE="ERR_INVALID_KEY_SIZE",e.ERR_KEY_NOT_FOUND="ERR_KEY_NOT_FOUND",e.ERR_OLD_KEY_NAME_INVALID="ERR_OLD_KEY_NAME_INVALID",e.ERR_NEW_KEY_NAME_INVALID="ERR_NEW_KEY_NAME_INVALID",e.ERR_PASSWORD_REQUIRED="ERR_PASSWORD_REQUIRED",e.ERR_PEM_REQUIRED="ERR_PEM_REQUIRED",e.ERR_CANNOT_READ_KEY="ERR_CANNOT_READ_KEY",e.ERR_MISSING_PRIVATE_KEY="ERR_MISSING_PRIVATE_KEY",e.ERR_MISSING_PUBLIC_KEY="ERR_MISSING_PUBLIC_KEY",e.ERR_INVALID_OLD_PASS_TYPE="ERR_INVALID_OLD_PASS_TYPE",e.ERR_INVALID_NEW_PASS_TYPE="ERR_INVALID_NEW_PASS_TYPE",e.ERR_INVALID_PASS_LENGTH="ERR_INVALID_PASS_LENGTH",e.ERR_NOT_IMPLEMENTED="ERR_NOT_IMPLEMENTED",e.ERR_WRONG_PING_ACK="ERR_WRONG_PING_ACK",e.ERR_INVALID_RECORD="ERR_INVALID_RECORD",e.ERR_ALREADY_SUCCEEDED="ERR_ALREADY_SUCCEEDED",e.ERR_NO_HANDLER_FOR_PROTOCOL="ERR_NO_HANDLER_FOR_PROTOCOL",e.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS",e.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS="ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS",e.ERR_CONNECTION_DENIED="ERR_CONNECTION_DENIED",e.ERR_TRANSFER_LIMIT_EXCEEDED="ERR_TRANSFER_LIMIT_EXCEEDED"}(YP||(YP={}));const QP={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{resolvers:{dnsaddr:WP},addressSorter:sx},transportManager:{faultTolerance:xv.FATAL_ALL}};const XP=jm("libp2p:get-peer");function JP(e){if(tt(e))return{peerId:e,multiaddrs:[]};let t;if(Array.isArray(e)||(e=[e]),e.length>0){const r=e[0].getPeerId();t=null==r?void 0:Tm(r),e.forEach((e=>{if(!Zn(e))throw XP.error("multiaddr %s was invalid",e),new xd("Invalid Multiaddr",YP.ERR_INVALID_MULTIADDR);const r=e.getPeerId();if(null==r){if(null!=t)throw new xd("Multiaddrs must all have the same peer id or have no peer id",YP.ERR_INVALID_PARAMETERS)}else{const e=Tm(r);if(null==t||!t.equals(e))throw new xd("Multiaddrs must all have the same peer id or have no peer id",YP.ERR_INVALID_PARAMETERS)}}))}return{peerId:t,multiaddrs:e}}class $P extends Error{constructor(e){super(e),this.name="TimeoutError"}}class ZP extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const eD=e=>void 0===globalThis.DOMException?new ZP(e):new DOMException(e),tD=e=>{const t=void 0===e.reason?eD("This operation was aborted."):e.reason;return t instanceof Error?t:eD(t)};var rD,nD=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};rD=new WeakMap;const iD=class{constructor(){rD.set(this,[])}enqueue(e,t){const r={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&nD(this,rD,"f")[this.size-1].priority>=t.priority)return void nD(this,rD,"f").push(r);const n=function(e,t,r){let n=0,i=e.length;for(;i>0;){const o=Math.trunc(i/2);let s=n+o;r(e[s],t)<=0?(n=++s,i-=o+1):i=o}return n}(nD(this,rD,"f"),r,((e,t)=>t.priority-e.priority));nD(this,rD,"f").splice(n,0,r)}dequeue(){const e=nD(this,rD,"f").shift();return null===e||void 0===e?void 0:e.run}filter(e){return nD(this,rD,"f").filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return nD(this,rD,"f").length}};var oD,sD,aD,cD,lD,uD,hD,dD,fD,pD,gD,yD,mD,vD,bD,wD,ED,_D,SD,AD,kD,ID,CD,RD,TD,xD,PD=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},DD=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ND extends Error{}sD=new WeakMap,aD=new WeakMap,cD=new WeakMap,lD=new WeakMap,uD=new WeakMap,hD=new WeakMap,dD=new WeakMap,fD=new WeakMap,pD=new WeakMap,gD=new WeakMap,yD=new WeakMap,mD=new WeakMap,vD=new WeakMap,bD=new WeakMap,oD=new WeakSet,wD=function(){return DD(this,aD,"f")||DD(this,cD,"f")<DD(this,lD,"f")},ED=function(){return DD(this,yD,"f")<DD(this,mD,"f")},_D=function(){var e;PD(this,yD,(e=DD(this,yD,"f"),--e),"f"),DD(this,oD,"m",kD).call(this),this.emit("next")},SD=function(){DD(this,oD,"m",CD).call(this),DD(this,oD,"m",ID).call(this),PD(this,fD,void 0,"f")},AD=function(){const e=Date.now();if(void 0===DD(this,dD,"f")){const t=DD(this,hD,"f")-e;if(!(t<0))return void 0===DD(this,fD,"f")&&PD(this,fD,setTimeout((()=>{DD(this,oD,"m",SD).call(this)}),t),"f"),!0;PD(this,cD,DD(this,sD,"f")?DD(this,yD,"f"):0,"f")}return!1},kD=function(){if(0===DD(this,pD,"f").size)return DD(this,dD,"f")&&clearInterval(DD(this,dD,"f")),PD(this,dD,void 0,"f"),this.emit("empty"),0===DD(this,yD,"f")&&this.emit("idle"),!1;if(!DD(this,vD,"f")){const e=!DD(this,oD,"a",AD);if(DD(this,oD,"a",wD)&&DD(this,oD,"a",ED)){const t=DD(this,pD,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&DD(this,oD,"m",ID).call(this),!0)}}return!1},ID=function(){DD(this,aD,"f")||void 0!==DD(this,dD,"f")||(PD(this,dD,setInterval((()=>{DD(this,oD,"m",CD).call(this)}),DD(this,uD,"f")),"f"),PD(this,hD,Date.now()+DD(this,uD,"f"),"f"))},CD=function(){0===DD(this,cD,"f")&&0===DD(this,yD,"f")&&DD(this,dD,"f")&&(clearInterval(DD(this,dD,"f")),PD(this,dD,void 0,"f")),PD(this,cD,DD(this,sD,"f")?DD(this,yD,"f"):0,"f"),DD(this,oD,"m",RD).call(this)},RD=function(){for(;DD(this,oD,"m",kD).call(this););},TD=async function(e){return new Promise(((t,r)=>{e.addEventListener("abort",(()=>{r(new ND("The task was aborted."))}),{once:!0})}))},xD=async function(e,t){return new Promise((r=>{const n=()=>{t&&!t()||(this.off(e,n),r())};this.on(e,n)}))};const OD=class extends hR{constructor(e){var t,r,n,i;if(super(),oD.add(this),sD.set(this,void 0),aD.set(this,void 0),cD.set(this,0),lD.set(this,void 0),uD.set(this,void 0),hD.set(this,0),dD.set(this,void 0),fD.set(this,void 0),pD.set(this,void 0),gD.set(this,void 0),yD.set(this,0),mD.set(this,void 0),vD.set(this,void 0),bD.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:iD,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:"","` (").concat(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 `".concat(null!==(i=null===(n=e.interval)||void 0===n?void 0:n.toString())&&void 0!==i?i:"","` (").concat(typeof e.interval,")"));PD(this,sD,e.carryoverConcurrencyCount,"f"),PD(this,aD,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,"f"),PD(this,lD,e.intervalCap,"f"),PD(this,uD,e.interval,"f"),PD(this,pD,new e.queueClass,"f"),PD(this,gD,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,PD(this,bD,!0===e.throwOnTimeout,"f"),PD(this,vD,!1===e.autoStart,"f")}get concurrency(){return DD(this,mD,"f")}set concurrency(e){if(!("number"===typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(typeof e,")"));PD(this,mD,e,"f"),DD(this,oD,"m",RD).call(this)}async add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t={timeout:this.timeout,throwOnTimeout:DD(this,bD,"f"),...t},new Promise(((r,n)=>{DD(this,pD,"f").enqueue((async()=>{var i,o,s;PD(this,yD,(o=DD(this,yD,"f"),++o),"f"),PD(this,cD,(s=DD(this,cD,"f"),++s),"f");try{if(null===(i=t.signal)||void 0===i?void 0:i.aborted)throw new ND("The task was aborted.");let n=e({signal:t.signal});t.timeout&&(n=function(e,t,r,n){let i;const o=new Promise(((o,s)=>{if("number"!==typeof t||1!==Math.sign(t))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(t,"`"));if(t!==Number.POSITIVE_INFINITY){if((n={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...n}).signal){const{signal:e}=n;e.aborted&&s(tD(e)),e.addEventListener("abort",(()=>{s(tD(e))}))}i=n.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof r){try{o(r())}catch(a){s(a)}return}const n="string"===typeof r?r:"Promise timed out after ".concat(t," milliseconds"),i=r instanceof Error?r:new $P(n);"function"===typeof e.cancel&&e.cancel(),s(i)}),t),(async()=>{try{o(await e)}catch(t){s(t)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()}else o(e)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(Promise.resolve(n),t.timeout)),t.signal&&(n=Promise.race([n,DD(this,oD,"m",TD).call(this,t.signal)]));const o=await n;r(o),this.emit("completed",o)}catch(a){if(a instanceof $P&&!t.throwOnTimeout)return void r();n(a),this.emit("error",a)}finally{DD(this,oD,"m",_D).call(this)}}),t),this.emit("add"),DD(this,oD,"m",kD).call(this)}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return DD(this,vD,"f")?(PD(this,vD,!1,"f"),DD(this,oD,"m",RD).call(this),this):this}pause(){PD(this,vD,!0,"f")}clear(){PD(this,pD,new(DD(this,gD,"f")),"f")}async onEmpty(){0!==DD(this,pD,"f").size&&await DD(this,oD,"m",xD).call(this,"empty")}async onSizeLessThan(e){DD(this,pD,"f").size<e||await DD(this,oD,"m",xD).call(this,"next",(()=>DD(this,pD,"f").size<e))}async onIdle(){0===DD(this,yD,"f")&&0===DD(this,pD,"f").size||await DD(this,oD,"m",xD).call(this,"idle")}get size(){return DD(this,pD,"f").size}sizeBy(e){return DD(this,pD,"f").filter(e).length}get pending(){return DD(this,yD,"f")}get isPaused(){return DD(this,vD,"f")}};var LD=new WeakMap;class BD{constructor(){nt(this,LD,[])}enqueue(e,t){var r;const n=null===t||void 0===t?void 0:t.peerId,i=null!==(r=null===t||void 0===t?void 0:t.priority)&&void 0!==r?r:0;if(null==n)throw new xd("missing peer id",YP.ERR_INVALID_PARAMETERS);const o={priority:i,peerId:n,run:e};if(this.size>0&&ot(LD,this)[this.size-1].priority>=i)return void ot(LD,this).push(o);const s=function(e,t,r){let n=0,i=e.length;for(;i>0;){const o=Math.trunc(i/2);let s=n+o;r(e[s],t)<=0?(n=++s,i-=o+1):i=o}return n}(ot(LD,this),o,((e,t)=>t.priority-e.priority));ot(LD,this).splice(s,0,o)}dequeue(){const e=ot(LD,this).shift();return null===e||void 0===e?void 0:e.run}filter(e){if(null!=e.peerId){const t=e.peerId;return ot(LD,this).filter((e=>t.equals(e.peerId))).map((e=>e.run))}return ot(LD,this).filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return ot(LD,this).length}}class MD extends OD{constructor(){super({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},queueClass:BD})}hasJob(e){return this.sizeBy({peerId:e})>0}}const UD=jm("libp2p:connection-manager:auto-dial"),FD=50,jD=100,zD=25,qD=0,KD=5e3;class VD{constructor(e,t){var r,n,i,o,s;Ze(this,"connectionManager",void 0),Ze(this,"peerStore",void 0),Ze(this,"queue",void 0),Ze(this,"minConnections",void 0),Ze(this,"autoDialPriority",void 0),Ze(this,"autoDialIntervalMs",void 0),Ze(this,"autoDialMaxQueueLength",void 0),Ze(this,"autoDialInterval",void 0),Ze(this,"started",void 0),Ze(this,"running",void 0),this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.minConnections=null!==(r=t.minConnections)&&void 0!==r?r:FD,this.autoDialPriority=null!==(n=t.autoDialPriority)&&void 0!==n?n:qD,this.autoDialIntervalMs=null!==(i=t.autoDialInterval)&&void 0!==i?i:KD,this.autoDialMaxQueueLength=null!==(o=t.maxQueueLength)&&void 0!==o?o:jD,this.started=!1,this.running=!1,this.queue=new MD({concurrency:null!==(s=t.autoDialConcurrency)&&void 0!==s?s:zD}),this.queue.addListener("error",(e=>{UD.error("error during auto-dial",e)})),e.events.addEventListener("connection:close",(()=>{this.autoDial().catch((e=>{UD.error(e)}))}))}isStarted(){return this.started}start(){this.autoDialInterval=setTimeout((()=>{this.autoDial().catch((e=>{UD.error("error while autodialing",e)}))}),this.autoDialIntervalMs),this.started=!0}afterStart(){this.autoDial().catch((e=>{UD.error("error while autodialing",e)}))}stop(){this.queue.clear(),clearTimeout(this.autoDialInterval),this.started=!1,this.running=!1}async autoDial(){if(!this.started)return;const e=this.connectionManager.getConnectionsMap(),t=e.size;if(t>=this.minConnections)return void UD.trace("have enough connections %d/%d",t,this.minConnections);if(this.queue.size>this.autoDialMaxQueueLength)return void UD("not enough connections %d/%d but auto dial queue is full",t,this.minConnections);if(this.running)return void UD("not enough connections %d/%d - but skipping autodial as it is already running",t,this.minConnections);this.running=!0,UD("not enough connections %d/%d - will dial peers to increase the number of connections",t,this.minConnections);const r=new zC(this.connectionManager.getDialQueue().map((e=>e.peerId)).filter(Boolean)),n=await this.peerStore.all({filters:[t=>0===t.addresses.length?(UD.trace("not autodialing %p because they have no addresses"),!1):e.has(t.id)?(UD.trace("not autodialing %p because they are already connected"),!1):r.has(t.id)?(UD.trace("not autodialing %p because they are already being dialed"),!1):!this.queue.hasJob(t.id)||(UD.trace("not autodialing %p because they are already being autodialed"),!1)]}),i=n.sort((()=>Math.random()>.5?1:-1)),o=new jC;for(const a of i)o.has(a.id)||o.set(a.id,[...a.tags.values()].reduce(((e,t)=>e+t.value),0));const s=i.sort(((e,t)=>{var r,n;const i=null!==(r=o.get(e.id))&&void 0!==r?r:0,s=null!==(n=o.get(t.id))&&void 0!==n?n:0;return i>s?-1:i<s?1:0}));UD("selected %d/%d peers to dial",s.length,n.length);for(const a of s)this.queue.add((async()=>{const e=this.connectionManager.getConnectionsMap().size;if(e>=this.minConnections)return UD("got enough connections now %d/%d",e,this.minConnections),void this.queue.clear();UD("connecting to a peerStore stored peer %p",a.id),await this.connectionManager.openConnection(a.id,{priority:this.autoDialPriority})}),{peerId:a.id}).catch((e=>{UD.error("could not connect to peerStore stored peer",e)}));this.running=!1,this.started&&(this.autoDialInterval=setTimeout((()=>{this.autoDial().catch((e=>{UD.error("error while autodialing",e)}))}),this.autoDialIntervalMs))}}const HD=jm("libp2p:connection-manager:connection-pruner"),WD={maxConnections:300,allow:[]};class GD{constructor(e){var t,r;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ze(this,"maxConnections",void 0),Ze(this,"connectionManager",void 0),Ze(this,"peerStore",void 0),Ze(this,"allow",void 0),Ze(this,"events",void 0),this.maxConnections=null!==(t=n.maxConnections)&&void 0!==t?t:WD.maxConnections,this.allow=null!==(r=n.allow)&&void 0!==r?r:WD.allow,this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.events=e.events,e.events.addEventListener("connection:open",(()=>{this.maybePruneConnections().catch((e=>{HD.error(e)}))}))}async maybePruneConnections(){const e=this.connectionManager.getConnections(),t=e.length,r=Math.max(t-this.maxConnections,0);if(HD("checking max connections limit %d/%d",t,this.maxConnections),t<=this.maxConnections)return;HD("max connections limit exceeded %d/%d, pruning %d connection(s)",t,this.maxConnections,r);const n=new jC;for(const a of e){const e=a.remotePeer;if(!n.has(e)){n.set(e,0);try{const t=await this.peerStore.get(e);n.set(e,[...t.tags.values()].reduce(((e,t)=>e+t.value),0))}catch(s){"ERR_NOT_FOUND"!==s.code&&HD.error("error loading peer tags",s)}}}const i=e.sort(((e,t)=>{var r,i;const o=null!==(r=n.get(e.remotePeer))&&void 0!==r?r:0,s=null!==(i=n.get(t.remotePeer))&&void 0!==i?i:0;if(o>s)return 1;if(o<s)return-1;const a=e.stat.timeline.open,c=t.stat.timeline.open;return a<c?1:a>c?-1:0})),o=[];for(const a of i){HD("too many connections open - closing a connection to %p",a.remotePeer);if(this.allow.some((e=>a.remoteAddr.toString().startsWith(e.toString())))||o.push(a),o.length===r)break}await Promise.all(o.map((async e=>{try{await e.close()}catch(s){HD.error(s)}}))),this.events.safeDispatchEvent("connection:prune",{detail:o})}}const YD=jm("libp2p:connection-manager:utils");async function QD(e,t){if(!e.protoNames().includes("dnsaddr"))return[e];const r=await async function(e,t){try{e=ei(e.toString());return await e.resolve(t)}catch(r){return YD.error("multiaddr ".concat(e.toString()," could not be resolved"),r),[]}}(e,t),n=(await Promise.all(r.map((async e=>QD(e,t))))).flat().reduce(((e,t)=>(null==e.find((e=>e.equals(t)))&&e.push(t),e)),[]);return YD("resolved %s to",e,n.map((e=>e.toString()))),n}const XD=jm("libp2p:connection-manager:dial-queue"),JD={addressSorter:sx,maxParallelDials:100,maxPeerAddrsToDial:25,maxParallelDialsPerPeer:10,dialTimeout:3e4,resolvers:{dnsaddr:WP}};class $D{constructor(e){var t,r,n,i,o,s,a;let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ze(this,"pendingDials",void 0),Ze(this,"queue",void 0),Ze(this,"peerId",void 0),Ze(this,"peerStore",void 0),Ze(this,"connectionGater",void 0),Ze(this,"transportManager",void 0),Ze(this,"addressSorter",void 0),Ze(this,"maxPeerAddrsToDial",void 0),Ze(this,"maxParallelDialsPerPeer",void 0),Ze(this,"dialTimeout",void 0),Ze(this,"inProgressDialCount",void 0),Ze(this,"pendingDialCount",void 0),Ze(this,"shutDownController",void 0),this.addressSorter=null!==(t=c.addressSorter)&&void 0!==t?t:JD.addressSorter,this.maxPeerAddrsToDial=null!==(r=c.maxPeerAddrsToDial)&&void 0!==r?r:JD.maxPeerAddrsToDial,this.maxParallelDialsPerPeer=null!==(n=c.maxParallelDialsPerPeer)&&void 0!==n?n:JD.maxParallelDialsPerPeer,this.dialTimeout=null!==(i=c.dialTimeout)&&void 0!==i?i:JD.dialTimeout,this.peerId=e.peerId,this.peerStore=e.peerStore,this.connectionGater=e.connectionGater,this.transportManager=e.transportManager,this.shutDownController=new AbortController;try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,this.shutDownController.signal)}catch{}this.pendingDialCount=null===(o=e.metrics)||void 0===o?void 0:o.registerMetric("libp2p_dialler_pending_dials"),this.inProgressDialCount=null===(s=e.metrics)||void 0===s?void 0:s.registerMetric("libp2p_dialler_in_progress_dials"),this.pendingDials=[];for(const[u,h]of Object.entries(null!==(l=c.resolvers)&&void 0!==l?l:{})){var l;$n.set(u,h)}this.queue=new OD({concurrency:null!==(a=c.maxParallelDials)&&void 0!==a?a:JD.maxParallelDials}),this.queue.on("add",(()=>{var e,t;null===(e=this.pendingDialCount)||void 0===e||e.update(this.queue.size),null===(t=this.inProgressDialCount)||void 0===t||t.update(this.queue.pending)})),this.queue.on("active",(()=>{var e,t;null===(e=this.pendingDialCount)||void 0===e||e.update(this.queue.size),null===(t=this.inProgressDialCount)||void 0===t||t.update(this.queue.pending)})),this.queue.on("completed",(()=>{var e,t;null===(e=this.pendingDialCount)||void 0===e||e.update(this.queue.size),null===(t=this.inProgressDialCount)||void 0===t||t.update(this.queue.pending)})),this.queue.on("error",(e=>{var t,r;XD.error("error in dial queue",e),null===(t=this.pendingDialCount)||void 0===t||t.update(this.queue.size),null===(r=this.inProgressDialCount)||void 0===r||r.update(this.queue.pending)})),this.queue.on("empty",(()=>{var e,t;null===(e=this.pendingDialCount)||void 0===e||e.update(this.queue.size),null===(t=this.inProgressDialCount)||void 0===t||t.update(this.queue.pending)})),this.queue.on("idle",(()=>{var e,t;null===(e=this.pendingDialCount)||void 0===e||e.update(this.queue.size),null===(t=this.inProgressDialCount)||void 0===t||t.update(this.queue.pending)}))}stop(){this.shutDownController.abort()}async dial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{peerId:r,multiaddrs:n}=JP(e),i=n.map((e=>({multiaddr:e,isCertified:!1}))),o=this.createDialAbortControllers(t.signal);let s;try{s=await this.calculateMultiaddrs(r,i,{...t,signal:o})}catch(l){throw o.clear(),l}const a=this.pendingDials.find((e=>!(null==e.peerId||null==r||!e.peerId.equals(r))||s.map((e=>{let{multiaddr:t}=e;return t.toString()})).join()===e.multiaddrs.map((e=>e.toString())).join()));if(null!=a)return XD("joining existing dial target for %p",r),o.clear(),a.promise;XD("creating dial target for",s.map((e=>{let{multiaddr:t}=e;return t.toString()})));const c={id:"".concat(parseInt(String(1e9*Math.random()),10).toString()).concat(Date.now()),status:"queued",peerId:r,multiaddrs:s.map((e=>{let{multiaddr:t}=e;return t}))};return c.promise=this.performDial(c,{...t,signal:o}).finally((()=>{this.pendingDials=this.pendingDials.filter((e=>e.id!==c.id)),o.clear()})).catch((e=>{if(XD.error("dial failed to %s",c.multiaddrs.map((e=>e.toString())).join(", "),e),o.aborted){throw new xd(e.message,YP.ERR_TIMEOUT)}throw e})),this.pendingDials.push(c),c.promise}createDialAbortControllers(e){const t=tv([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,e]);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,t)}catch{}return t}async calculateMultiaddrs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!=e){var n,i;if(this.peerId.equals(e))throw new xd("Tried to dial self",YP.ERR_DIALED_SELF);if(!0===await(null===(n=(i=this.connectionGater).denyDialPeer)||void 0===n?void 0:n.call(i,e)))throw new xd("The dial request is blocked by gater.allowDialPeer",YP.ERR_PEER_DIAL_INTERCEPTED);if(0===t.length){XD("loading multiaddrs for %p",e);try{const r=await this.peerStore.get(e);t.push(...r.addresses),XD("loaded multiaddrs for %p",e,t.map((e=>{let{multiaddr:t}=e;return t.toString()})))}catch(h){if(h.code!==YP.ERR_NOT_FOUND)throw h}}}const o=(await Promise.all(t.map((async e=>{const t=await QD(e.multiaddr,r);return 1===t.length&&t[0].equals(e.multiaddr)?e:t.map((e=>({multiaddr:e,isCertified:!1})))})))).flat(),s=o.filter((e=>Boolean(this.transportManager.transportForMultiaddr(e.multiaddr)))),a=new Map;for(const d of s){const e=d.multiaddr.toString(),t=a.get(e);null==t?a.set(e,d):t.isCertified=t.isCertified||d.isCertified||!1}let c=[...a.values()];if((0===c.length||c.length>this.maxPeerAddrsToDial)&&(XD("addresses for %p before filtering",null!==e&&void 0!==e?e:"unknown peer",o.map((e=>{let{multiaddr:t}=e;return t.toString()}))),XD("addresses for %p after filtering",null!==e&&void 0!==e?e:"unknown peer",c.map((e=>{let{multiaddr:t}=e;return t.toString()})))),0===c.length)throw new xd("The dial request has no valid addresses",YP.ERR_NO_VALID_ADDRESSES);if(c.length>this.maxPeerAddrsToDial)throw new xd("dial with more addresses than allowed",YP.ERR_TOO_MANY_ADDRESSES);if(null!=e){const t="/p2p/".concat(e.toString());c=c.map((r=>{const n=r.multiaddr.getPeerId(),i=r.multiaddr.protos().pop();return!0===(null===i||void 0===i?void 0:i.path)?r:n!==e.toString()?{multiaddr:r.multiaddr.encapsulate(t),isCertified:r.isCertified}:r}))}const l=[];for(const d of c)null!=this.connectionGater.denyDialMultiaddr&&await this.connectionGater.denyDialMultiaddr(d.multiaddr)||l.push(d);const u=l.sort(this.addressSorter);if(0===u.length)throw new xd("The connection gater denied all addresses in the dial request",YP.ERR_NO_VALID_ADDRESSES);return u}async performDial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=e.multiaddrs.map((()=>new AbortController));try{const n=new OD({concurrency:this.maxParallelDialsPerPeer});n.on("error",(e=>{XD.error("error dialling",e)}));const i=await Promise.any(e.multiaddrs.map((async(i,o)=>{const s=r[o];if(null==s)throw new xd("dialAction did not come with an AbortController",YP.ERR_INVALID_PARAMETERS);const a=function(){const e=[];for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(const o of r)if(null!=o){try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,o)}catch{}e.push(o)}const i=tv(e);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,i)}catch{}return i}(s.signal,t.signal);a.addEventListener("abort",(()=>{XD("dial to %s aborted",i)}));const c=Da();return await n.add((async()=>{if(a.aborted)return XD("dial to %s was aborted before reaching the head of the peer dial queue",i),void c.reject(new Td);await this.queue.add((async()=>{try{if(a.aborted)return XD("dial to %s was aborted before reaching the head of the dial queue",i),void c.reject(new Td);e.status="active";const n=await this.transportManager.dial(i,{...t,signal:a});if(s.signal.aborted)return XD("multiple dials succeeded, closing superfluous connection"),n.close().catch((e=>{XD.error("error closing superfluous connection",e)})),void c.reject(new Td);r[o]=void 0,r.forEach((e=>{void 0!==e&&e.abort()})),XD("dial to %s succeeded",i),c.resolve(n)}catch(n){XD.error("error during dial of %s",i,n),c.reject(n)}}),{...t,signal:a}).catch((e=>{c.reject(e)}))}),{signal:a}).catch((e=>{c.reject(e)})).finally((()=>{a.clear()})),c.promise})));if(null==i)throw new xd("successful dial led to empty object returned from peer dial queue",YP.ERR_TRANSPORT_DIAL_FAILED);return e.status="success",i}catch(n){if(e.status="error",1===e.multiaddrs.length&&"AggregateError"===n.name)throw n.errors[0];throw n}}}const ZD=jm("libp2p:connection-manager"),eN=50,tN=300,rN=5,nN=10,iN=25,oN=0,sN=100;class aN{constructor(e){var t,r,n,i,o,s,a,c,l,u,h,d,f,p;let g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ze(this,"started",void 0),Ze(this,"connections",void 0),Ze(this,"allow",void 0),Ze(this,"deny",void 0),Ze(this,"maxIncomingPendingConnections",void 0),Ze(this,"incomingPendingConnections",void 0),Ze(this,"maxConnections",void 0),Ze(this,"dialQueue",void 0),Ze(this,"autoDial",void 0),Ze(this,"connectionPruner",void 0),Ze(this,"inboundConnectionRateLimiter",void 0),Ze(this,"peerStore",void 0),Ze(this,"metrics",void 0),Ze(this,"events",void 0),this.maxConnections=null!==(t=g.maxConnections)&&void 0!==t?t:tN;const y=null!==(r=g.minConnections)&&void 0!==r?r:eN;if(this.maxConnections<y)throw new xd("Connection Manager maxConnections must be greater than minConnections",YP.ERR_INVALID_PARAMETERS);this.connections=new jC,this.started=!1,this.peerStore=e.peerStore,this.metrics=e.metrics,this.events=e.events,this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.events.addEventListener("connection:open",this.onConnect),this.events.addEventListener("connection:close",this.onDisconnect),this.allow=(null!==(n=g.allow)&&void 0!==n?n:[]).map((e=>ei(e))),this.deny=(null!==(i=g.deny)&&void 0!==i?i:[]).map((e=>ei(e))),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=null!==(o=g.maxIncomingPendingConnections)&&void 0!==o?o:nN,this.inboundConnectionRateLimiter=new nv.RateLimiterMemory({points:null!==(s=g.inboundConnectionThreshold)&&void 0!==s?s:rN,duration:1}),this.autoDial=new VD({connectionManager:this,peerStore:e.peerStore,events:e.events},{minConnections:y,autoDialConcurrency:null!==(a=g.autoDialConcurrency)&&void 0!==a?a:iN,autoDialPriority:null!==(c=g.autoDialPriority)&&void 0!==c?c:oN,maxQueueLength:null!==(l=g.autoDialMaxQueueLength)&&void 0!==l?l:sN}),this.connectionPruner=new GD({connectionManager:this,peerStore:e.peerStore,events:e.events},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new $D({peerId:e.peerId,metrics:e.metrics,peerStore:e.peerStore,transportManager:e.transportManager,connectionGater:e.connectionGater},{addressSorter:null!==(u=g.addressSorter)&&void 0!==u?u:sx,maxParallelDials:null!==(h=g.maxParallelDials)&&void 0!==h?h:100,maxPeerAddrsToDial:null!==(d=g.maxPeerAddrsToDial)&&void 0!==d?d:25,dialTimeout:null!==(f=g.dialTimeout)&&void 0!==f?f:3e4,resolvers:null!==(p=g.resolvers)&&void 0!==p?p:{dnsaddr:WP}})}isStarted(){return this.started}async start(){var e,t,r;null===(e=this.metrics)||void 0===e||e.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{const e={inbound:0,outbound:0};for(const t of this.connections.values())for(const r of t)"inbound"===r.stat.direction?e.inbound++:e.outbound++;return e}}),null===(t=this.metrics)||void 0===t||t.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{const e={};for(const n of this.connections.values())for(const i of n)for(const n of i.streams){var t,r;const i="".concat(n.stat.direction," ").concat(null!==(t=n.stat.protocol)&&void 0!==t?t:"unnegotiated");e[i]=(null!==(r=e[i])&&void 0!==r?r:0)+1}return e}}),null===(r=this.metrics)||void 0===r||r.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{const e={};for(const o of this.connections.values())for(const i of o){const o={};for(const e of i.streams){var t,r;const n="".concat(e.stat.direction," ").concat(null!==(t=e.stat.protocol)&&void 0!==t?t:"unnegotiated");o[n]=(null!==(r=o[n])&&void 0!==r?r:0)+1}for(const[t,r]of Object.entries(o)){var n;e[t]=null!==(n=e[t])&&void 0!==n?n:[],e[t].push(r)}}const i={};for(let[o,s]of Object.entries(e)){s=s.sort(((e,t)=>e-t));const e=Math.floor(.9*s.length);i[o]=s[e]}return i}}),this.autoDial.start(),this.started=!0,ZD("started")}async afterStart(){Promise.resolve().then((async()=>{const e=await this.peerStore.all({filters:[e=>e.tags.has("keep-alive")]});await Promise.all(e.map((async e=>{await this.openConnection(e.id).catch((e=>{ZD.error(e)}))})))})).catch((e=>{ZD.error(e)})),this.autoDial.afterStart()}async stop(){this.dialQueue.stop(),this.autoDial.stop();const e=[];for(const t of this.connections.values())for(const r of t)e.push((async()=>{try{await r.close()}catch(e){ZD.error(e)}})());ZD("closing %d connections",e.length),await Promise.all(e),this.connections.clear(),ZD("stopped")}onConnect(e){this._onConnect(e).catch((e=>{ZD.error(e)}))}async _onConnect(e){const{detail:t}=e;if(!this.started)return void await t.close();const r=t.remotePeer,n=this.connections.get(r);let i=!1;null!=n?n.push(t):(i=!0,this.connections.set(r,[t])),null!=r.publicKey&&"RSA"===r.type&&await this.peerStore.patch(r,{publicKey:r.publicKey}),i&&this.events.safeDispatchEvent("peer:connect",{detail:t.remotePeer})}onDisconnect(e){const{detail:t}=e;if(!this.started)return;const r=t.remotePeer;let n=this.connections.get(r);null!=n&&n.length>1?(n=n.filter((e=>e.id!==t.id)),this.connections.set(r,n)):null!=n&&(this.connections.delete(r),this.events.safeDispatchEvent("peer:disconnect",{detail:t.remotePeer}))}getConnections(e){var t;if(null!=e)return null!==(t=this.connections.get(e))&&void 0!==t?t:[];let r=[];for(const n of this.connections.values())r=r.concat(n);return r}getConnectionsMap(){return this.connections}async openConnection(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isStarted())throw new xd("Not started",YP.ERR_NODE_NOT_STARTED);const{peerId:n}=JP(e);if(null!=n){ZD("dial %p",n);const e=this.getConnections(n);if(e.length>0)return ZD("had an existing connection to %p",n),e[0]}const i=await this.dialQueue.dial(e,{...r,priority:null!==(t=r.priority)&&void 0!==t?t:50});let o=this.connections.get(i.remotePeer);null==o&&(o=[],this.connections.set(i.remotePeer,o));let s=!1;for(const a of o)a.id===i.id&&(s=!0);return s||o.push(i),i}async closeConnections(e){var t;const r=null!==(t=this.connections.get(e))&&void 0!==t?t:[];await Promise.all(r.map((async e=>{await e.close()})))}async acceptIncomingConnection(e){if(this.deny.some((t=>e.remoteAddr.toString().startsWith(t.toString()))))return ZD("connection from %s refused - connection remote address was in deny list",e.remoteAddr),!1;if(this.allow.some((t=>e.remoteAddr.toString().startsWith(t.toString()))))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.maxIncomingPendingConnections)return ZD("connection from %s refused - incomingPendingConnections exceeded by peer %s",e.remoteAddr),!1;if(e.remoteAddr.isThinWaistAddress()){const t=e.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(t,1)}catch{return ZD("connection from %s refused - inboundConnectionThreshold exceeded by host %s",t,e.remoteAddr),!1}}return this.getConnections().length<this.maxConnections?(this.incomingPendingConnections++,!0):(ZD("connection from %s refused - maxConnections exceeded",e.remoteAddr),!1)}afterUpgradeInbound(){this.incomingPendingConnections--}getDialQueue(){return this.dialQueue.pendingDials}}const cN=function(e,t){if(null!=e[Symbol.asyncIterator])return async function*(){for await(const r of e)yield t(r)}();const r=CT(e),{value:n,done:i}=r.next();if(!0===i)return function*(){}();const o=t(n);if("function"===typeof o.then)return async function*(){yield await o;for await(const e of r)yield t(e)}();const s=t;return function*(){yield o;for(const e of r)yield s(e)}()};async function*lN(e,t){yield*cN(e,(async e=>(await t.merge(e.id,{multiaddrs:e.multiaddrs}),e)))}function uN(e){const t=new Set;return RT(e,(e=>!t.has(e.id.toString())&&(t.add(e.id.toString()),!0)))}function hN(e){try{let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return async function*(){let r=0;for await(const t of e)r++,yield t;if(r<t)throw new xd("more peers required, seen: ".concat(r," min: ").concat(t),"NOT_FOUND")}()}catch(t){return Promise.reject(t)}}class dN{constructor(e,t){var r;Ze(this,"routers",void 0),Ze(this,"started",void 0),Ze(this,"components",void 0),this.routers=null!==(r=t.routers)&&void 0!==r?r:[],this.started=!1,this.components=e}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}findProviders(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){if(0===t.routers.length)throw new xd("No content routers available",YP.ERR_NO_ROUTERS_AVAILABLE);yield*Fa(Ua(...t.routers.map((t=>t.findProviders(e,r)))),(e=>lN(e,t.components.peerStore)),(e=>uN(e)),(e=>hN(e)))}()}catch(r){return Promise.reject(r)}}async provide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===this.routers.length)throw new xd("No content routers available",YP.ERR_NO_ROUTERS_AVAILABLE);await Promise.all(this.routers.map((async r=>{await r.provide(e,t)})))}async put(e,t,r){if(!this.isStarted())throw new xd(GP.NOT_STARTED_YET,YP.DHT_NOT_STARTED);await Promise.all(this.routers.map((async n=>{await n.put(e,t,r)})))}async get(e,t){if(!this.isStarted())throw new xd(GP.NOT_STARTED_YET,YP.DHT_NOT_STARTED);return Promise.any(this.routers.map((async r=>r.get(e,t))))}}const fN=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{for await(const t of e)return t})();for(const t of e)return t},pN=jm("libp2p:peer-routing");class gN{constructor(e,t){var r;Ze(this,"components",void 0),Ze(this,"routers",void 0),this.components=e,this.routers=null!==(r=t.routers)&&void 0!==r?r:[]}async findPeer(e,t){if(0===this.routers.length)throw new xd("No peer routers available",YP.ERR_NO_ROUTERS_AVAILABLE);if(e.toString()===this.components.peerId.toString())throw new xd("Should not try to find self",YP.ERR_FIND_SELF);const r=await Fa(Ua(...this.routers.map((r=>async function*(){try{yield await r.findPeer(e,t)}catch(n){pN.error(n)}}()))),(e=>RT(e,Boolean)),(e=>lN(e,this.components.peerStore)),(async e=>fN(e)));if(null!=r)return r;throw new xd(GP.NOT_FOUND,YP.ERR_NOT_FOUND)}async*getClosestPeers(e,t){if(0===this.routers.length)throw new xd("No peer routers available",YP.ERR_NO_ROUTERS_AVAILABLE);yield*Fa(Ua(...this.routers.map((r=>r.getClosestPeers(e,t)))),(e=>lN(e,this.components.peerStore)),(e=>uN(e)),(e=>hN(e)))}}const yN=jm("libp2p:registrar");class mN{constructor(e){Ze(this,"topologies",void 0),Ze(this,"handlers",void 0),Ze(this,"components",void 0),this.topologies=new Map,this.handlers=new Map,this.components=e,this._onDisconnect=this._onDisconnect.bind(this),this._onPeerUpdate=this._onPeerUpdate.bind(this),this._onConnect=this._onConnect.bind(this),this.components.events.addEventListener("peer:disconnect",this._onDisconnect),this.components.events.addEventListener("peer:connect",this._onConnect),this.components.events.addEventListener("peer:update",this._onPeerUpdate)}getProtocols(){return Array.from(new Set([...this.handlers.keys()])).sort()}getHandler(e){const t=this.handlers.get(e);if(null==t)throw new xd("No handler registered for protocol ".concat(e),YP.ERR_NO_HANDLER_FOR_PROTOCOL);return t}getTopologies(e){const t=this.topologies.get(e);return null==t?[]:[...t.values()]}async handle(e,t,r){if(this.handlers.has(e))throw new xd("Handler already registered for protocol ".concat(e),YP.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);const n=AC.bind({ignoreUndefined:!0})({maxInboundStreams:32,maxOutboundStreams:64},r);this.handlers.set(e,{handler:t,options:n}),await this.components.peerStore.merge(this.components.peerId,{protocols:[e]})}async unhandle(e){const t=Array.isArray(e)?e:[e];t.forEach((e=>{this.handlers.delete(e)})),await this.components.peerStore.patch(this.components.peerId,{protocols:t})}async register(e,t){if(null==(r=t)||!Boolean(r[bA]))throw yN.error("topology must be an instance of interfaces/topology"),new xd("topology must be an instance of interfaces/topology",YP.ERR_INVALID_PARAMETERS);var r;const n="".concat((1e9*Math.random()).toString(36)).concat(Date.now());let i=this.topologies.get(e);return null==i&&(i=new Map,this.topologies.set(e,i)),i.set(n,t),await t.setRegistrar(this),n}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.get(t).then((e=>{for(const r of e.protocols){const e=this.topologies.get(r);if(null!=e)for(const r of e.values())r.onDisconnect(t)}})).catch((e=>{e.code!==YP.ERR_NOT_FOUND&&yN.error("could not inform topologies of disconnecting peer %p",t,e)}))}_onConnect(e){const t=e.detail;this.components.peerStore.get(t).then((e=>{const r=this.components.connectionManager.getConnections(e.id)[0];if(null!=r)for(const n of e.protocols){const e=this.topologies.get(n);if(null!=e)for(const n of e.values())n.onConnect(t,r)}else yN("peer %p connected but the connection manager did not have a connection",e)})).catch((e=>{e.code!==YP.ERR_NOT_FOUND&&yN.error("could not inform topologies of connecting peer %p",t,e)}))}_onPeerUpdate(e){var t;const{peer:r,previous:n}=e.detail,i=(null!==(t=null===n||void 0===n?void 0:n.protocols)&&void 0!==t?t:[]).filter((e=>!r.protocols.includes(e))),o=r.protocols.filter((e=>{var t;return!(null!==(t=null===n||void 0===n?void 0:n.protocols)&&void 0!==t?t:[]).includes(e)}));for(const s of i){const e=this.topologies.get(s);if(null!=e)for(const t of e.values())t.onDisconnect(r.id)}for(const s of o){const e=this.topologies.get(s);if(null!=e)for(const t of e.values()){const e=this.components.connectionManager.getConnections(r.id)[0];null!=e&&t.onConnect(r.id,e)}}}}class vN extends Map{constructor(e){super(),Ze(this,"metric",void 0);const{name:t,metrics:r}=e;this.metric=r.registerMetric(t),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.metric.update(this.size)}}const bN=jm("libp2p:transports");class wN{constructor(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ze(this,"components",void 0),Ze(this,"transports",void 0),Ze(this,"listeners",void 0),Ze(this,"faultTolerance",void 0),Ze(this,"started",void 0),this.components=e,this.started=!1,this.transports=new Map,this.listeners=function(e){const{name:t,metrics:r}=e;let n;return n=null!=r?new vN({name:t,metrics:r}):new Map,n}({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=null!==(t=r.faultTolerance)&&void 0!==t?t:xv.FATAL_ALL}add(e){const t=e[Symbol.toStringTag];if(null==t)throw new xd("Transport must have a valid tag",YP.ERR_INVALID_KEY);if(this.transports.has(t))throw new xd("There is already a transport with the tag ".concat(t),YP.ERR_DUPLICATE_TRANSPORT);bN("adding transport %s",t),this.transports.set(t,e),this.listeners.has(t)||this.listeners.set(t,[])}isStarted(){return this.started}start(){this.started=!0}async afterStart(){const e=this.components.addressManager.getListenAddrs();await this.listen(e)}async stop(){const e=[];for(const[t,r]of this.listeners)for(bN("closing listeners for %s",t);r.length>0;){const t=r.pop();null!=t&&e.push(t.close())}await Promise.all(e),bN("all listeners closed");for(const t of this.listeners.keys())this.listeners.set(t,[]);this.started=!1}async dial(e,t){const r=this.transportForMultiaddr(e);if(null==r)throw new xd("No transport available for address ".concat(String(e)),YP.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,{...t,upgrader:this.components.upgrader})}catch(n){throw null==n.code&&(n.code=YP.ERR_TRANSPORT_DIAL_FAILED),n}}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())}getListeners(){return Array.of(...this.listeners.values()).flat()}transportForMultiaddr(e){for(const t of this.transports.values()){if(t.filter([e]).length>0)return t}}async listen(e){if(null==e||0===e.length)return void bN("no addresses were provided for listening, this node is dial only");const t=[];for(const[n,i]of this.transports.entries()){const o=i.filter(e),s=[];for(const e of o){var r;bN("creating listener for %s on %s",n,e);const t=i.createListener({upgrader:this.components.upgrader});let o=null!==(r=this.listeners.get(n))&&void 0!==r?r:[];null==o&&(o=[],this.listeners.set(n,o)),o.push(t),t.addEventListener("listening",(()=>{this.components.events.safeDispatchEvent("transport:listening",{detail:t})})),t.addEventListener("close",(()=>{const e=o.findIndex((e=>e===t));o.splice(e,1),this.components.events.safeDispatchEvent("transport:close",{detail:t})})),s.push(t.listen(e))}if(0===s.length){t.push(n);continue}if(null==(await Promise.allSettled(s)).find((e=>"fulfilled"===e.status))&&this.faultTolerance!==xv.NO_FATAL)throw new xd("Transport (".concat(n,") could not listen on any available address"),YP.ERR_NO_VALID_ADDRESSES)}if(t.length===this.transports.size){const e="no valid addresses were provided for transports [".concat(t.join(", "),"]");if(this.faultTolerance===xv.FATAL_ALL)throw new xd(e,YP.ERR_NO_VALID_ADDRESSES);bN("libp2p in dial mode only: ".concat(e))}}async remove(e){bN("removing %s",e);for(const r of null!==(t=this.listeners.get(e))&&void 0!==t?t:[]){var t;await r.close()}this.transports.delete(e),this.listeners.delete(e)}async removeAll(){const e=[];for(const t of this.transports.keys())e.push(this.remove(t));await Promise.all(e)}}const EN="/multistream/1.0.0",_N=1024;function SN(e){const t=Ba(),r=function(e){const t=async function*(){let t=yield,r=new _a;for await(const n of e)if(null!=t)for(r.append(n);r.length>=t;){const e=r.sublist(0,t);if(r.consume(t),t=yield e,null==t){r.length>0&&(t=yield r,r=new _a);break}}else r.append(n),t=yield r,r=new _a;if(null!=t)throw Object.assign(new Error("stream ended before ".concat(t," bytes became available")),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}(e.source),n=Da();let i;const o=e.sink(async function*(){yield*t;const e=await n.promise;yield*e}());o.catch((e=>{i=e}));return{reader:r,writer:t,stream:{sink:async e=>{null==i?(n.resolve(e),await o):await Promise.reject(i)},source:r},rest:()=>t.end(),write:t.push,read:async()=>{const e=await r.next();if(null!=e.value)return e.value}}}const AN=jm("libp2p:mss"),kN=_l("\n");function IN(e){const t=new _a(e,kN);return ka.single(t)}function CN(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=IN(t);!0===r.writeBytes?e.push(n.subarray()):e.push(n)}async function RN(e,t){const r=await async function(e,t){let r=1;const n={[Symbol.asyncIterator]:()=>n,next:async()=>e.next(r)};let i=n;null!=(null===t||void 0===t?void 0:t.signal)&&(i=$m(n,t.signal));const o=e=>{r=e},s=await Fa(i,(e=>Pa(e,{onLength:o,maxDataLength:_N})),(async e=>fN(e)));if(null==s||0===s.length)throw new xd("no buffer returned","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(s.get(s.byteLength-1)!==kN[0])throw AN.error("Invalid mss message - missing newline - %s",s.subarray()),new xd("missing newline","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return s.sublist(0,-1)}(e,t);return Sl(r.subarray())}const TN=jm("libp2p:mss:select");async function xN(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Array.isArray(t)?[...t]:[t];const{reader:n,writer:i,rest:o,stream:s}=SN(e),a=t.shift();if(null==a)throw new Error("At least one protocol must be specified");TN.trace('select: write ["%s", "%s"]',EN,a);!function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=new _a;for(const i of t)n.append(IN(i));!0===r.writeBytes?e.push(n.subarray()):e.push(n)}(i,[_l(EN),_l(a)],r);let c=await RN(n,r);if(TN.trace('select: read "%s"',c),c===EN&&(c=await RN(n,r),TN.trace('select: read "%s"',c)),c===a)return o(),{stream:s,protocol:a};for(const l of t){TN.trace('select: write "%s"',l),CN(i,_l(l),r);const e=await RN(n,r);if(TN.trace('select: read "%s" for "%s"',e,l),e===l)return o(),{stream:s,protocol:l}}throw o(),new xd("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}const PN=jm("libp2p:mss:handle");async function DN(e,t,r){t=Array.isArray(t)?t:[t];const{writer:n,reader:i,rest:o,stream:s}=SN(e);for(;;){const e=await RN(i,r);if(PN.trace('read "%s"',e),e!==EN){if(t.includes(e))return CN(n,_l(e),r),PN.trace('respond with "%s" for "%s"',e,e),o(),{stream:s,protocol:e};"ls"!==e?(CN(n,_l("na"),r),PN('respond with "na" for "%s"',e)):(CN(n,new _a(...t.map((e=>IN(_l(e))))),r),PN.trace('respond with "%s" for %s',t,e))}else PN.trace('respond with "%s" for "%s"',EN,e),CN(n,_l(EN),r)}}const NN=Symbol.for("@libp2p/connection");const ON="CLOSING",LN="CLOSED",BN=jm("libp2p:connection");class MN{constructor(e){Ze(this,"id",void 0),Ze(this,"remoteAddr",void 0),Ze(this,"remotePeer",void 0),Ze(this,"stat",void 0),Ze(this,"tags",void 0),Ze(this,"_newStream",void 0),Ze(this,"_close",void 0),Ze(this,"_getStreams",void 0),Ze(this,"_closing",void 0),Ze(this,Symbol.toStringTag,"Connection"),Ze(this,NN,!0);const{remoteAddr:t,remotePeer:r,newStream:n,close:i,getStreams:o,stat:s}=e;this.id="".concat(parseInt(String(1e9*Math.random())).toString(36)).concat(Date.now()),this.remoteAddr=t,this.remotePeer=r,this.stat={...s,status:"OPEN"},this._newStream=n,this._close=i,this._getStreams=o,this.tags=[],this._closing=!1}get streams(){return this._getStreams()}async newStream(e,t){if(this.stat.status===ON)throw new xd("the connection is being closed","ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===LN)throw new xd("the connection is closed","ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const r=await this._newStream(e,t);return r.stat.direction="outbound",r}addStream(e){e.stat.direction="inbound"}removeStream(e){}async close(){if(this.stat.status!==LN&&!this._closing){this.stat.status=ON;try{this.streams.forEach((e=>{e.close()}))}catch(e){BN.error(e)}this._closing=!0,await this._close(),this._closing=!1,this.stat.timeline.close=Date.now(),this.stat.status=LN}}}const UN=jm("libp2p:upgrader");function FN(e,t,r){let n=0;return r.streams.forEach((r=>{r.stat.direction===t&&r.stat.protocol===e&&n++})),n}class jN{constructor(e,t){var r;Ze(this,"components",void 0),Ze(this,"connectionEncryption",void 0),Ze(this,"muxers",void 0),Ze(this,"inboundUpgradeTimeout",void 0),Ze(this,"events",void 0),this.components=e,this.connectionEncryption=new Map,t.connectionEncryption.forEach((e=>{this.connectionEncryption.set(e.protocol,e)})),this.muxers=new Map,t.muxers.forEach((e=>{this.muxers.set(e.protocol,e)})),this.inboundUpgradeTimeout=null!==(r=t.inboundUpgradeTimeout)&&void 0!==r?r:3e4,this.events=e.events}async shouldBlockConnection(e,t,r){const n=this.components.connectionGater[r];if(void 0!==n&&await n(e,t))throw new xd("The multiaddr connection is blocked by gater.".concat(r),YP.ERR_CONNECTION_INTERCEPTED)}async upgradeInbound(e,t){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw new xd("connection denied",YP.ERR_CONNECTION_DENIED);let r,n,i,o,s;const a=tv([AbortSignal.timeout(this.inboundUpgradeTimeout)]);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,a)}catch{}try{var c,l,u;const d=ev(e,a);if(e.source=d.source,e.sink=d.sink,!0===await(null===(c=(l=this.components.connectionGater).denyInboundConnection)||void 0===c?void 0:c.call(l,e)))throw new xd("The multiaddr connection is blocked by gater.acceptConnection",YP.ERR_CONNECTION_INTERCEPTED);null===(u=this.components.metrics)||void 0===u||u.trackMultiaddrConnection(e),UN("starting the inbound connection upgrade");let f=e;if(!0!==(null===t||void 0===t?void 0:t.skipProtection)){const t=this.components.connectionProtector;null!=t&&(UN("protecting the inbound connection"),f=await t.protect(e))}try{if(r=f,!0!==(null===t||void 0===t?void 0:t.skipEncryption)){({conn:r,remotePeer:n,protocol:s}=await this._encryptInbound(f));const e={...f,...r};await this.shouldBlockConnection(n,e,"denyInboundEncryptedConnection")}else{const t=e.remoteAddr.getPeerId();if(null==t)throw new xd("inbound connection that skipped encryption must have a peer id",YP.ERR_INVALID_MULTIADDR);const r=Tm(t);s="native",n=r}if(i=r,null!=(null===t||void 0===t?void 0:t.muxerFactory))o=t.muxerFactory;else if(this.muxers.size>0){const e=await this._multiplexInbound({...f,...r},this.muxers);o=e.muxerFactory,i=e.stream}}catch(h){throw UN.error("Failed to upgrade inbound connection",h),h}return await this.shouldBlockConnection(n,e,"denyInboundUpgradedConnection"),UN("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:s,direction:"inbound",maConn:e,upgradedConn:i,muxerFactory:o,remotePeer:n})}finally{this.components.connectionManager.afterUpgradeInbound(),a.clear()}}async upgradeOutbound(e,t){var r;const n=e.remoteAddr.getPeerId();let i,o,s,a,c,l;null!=n&&(i=Tm(n),await this.shouldBlockConnection(i,e,"denyOutboundConnection")),null===(r=this.components.metrics)||void 0===r||r.trackMultiaddrConnection(e),UN("Starting the outbound connection upgrade");let u=e;if(!0!==(null===t||void 0===t?void 0:t.skipProtection)){const t=this.components.connectionProtector;null!=t&&(u=await t.protect(e))}try{if(o=u,!0!==(null===t||void 0===t?void 0:t.skipEncryption)){({conn:o,remotePeer:s,protocol:c}=await this._encryptOutbound(u,i));const e={...u,...o};await this.shouldBlockConnection(s,e,"denyOutboundEncryptedConnection")}else{if(null==i)throw new xd("Encryption was skipped but no peer id was passed",YP.ERR_INVALID_PEER);c="native",s=i}if(a=o,null!=(null===t||void 0===t?void 0:t.muxerFactory))l=t.muxerFactory;else if(this.muxers.size>0){const e=await this._multiplexOutbound({...u,...o},this.muxers);l=e.muxerFactory,a=e.stream}}catch(h){throw UN.error("Failed to upgrade outbound connection",h),await e.close(h),h}return await this.shouldBlockConnection(s,e,"denyOutboundUpgradedConnection"),UN("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:l,remotePeer:s})}_createConnection(e){var t,r,n=this;const{cryptoProtocol:i,direction:o,maConn:s,upgradedConn:a,remotePeer:c,muxerFactory:l}=e;let u,h,d;null!=l&&(u=l.createStreamMuxer({direction:o,onIncomingStream:e=>{null!=d&&Promise.resolve().then((async()=>{var t;const r=this.components.registrar.getProtocols(),{stream:n,protocol:i}=await DN(e,r);if(UN("%s: incoming stream opened on %s",o,i),null==d)return;const s=function(e,t){try{const{options:r}=t.getHandler(e);return r.maxInboundStreams}catch(r){if(r.code!==YP.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return 32}(i,this.components.registrar);if(FN(i,"inbound",d)===s){const t=new xd('Too many inbound protocol streams for protocol "'.concat(i,'" - limit ').concat(s),YP.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);throw e.abort(t),t}e.source=n.source,e.sink=n.sink,e.stat.protocol=i,await this.components.peerStore.merge(c,{protocols:[i]}),d.addStream(e),null===(t=this.components.metrics)||void 0===t||t.trackProtocolStream(e,d),this._onStream({connection:d,stream:e,protocol:i})})).catch((t=>{UN.error(t),null==e.stat.timeline.close&&e.close()}))},onStreamEnd:e=>{var t;null===(t=d)||void 0===t||t.removeStream(e.id)}}),h=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==u)throw new xd("Stream is not multiplexed",YP.ERR_MUXER_UNAVAILABLE);UN("%s: starting new stream on %s",o,e);const r=await u.newStream();try{var i;if(null==t.signal){UN("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",e),t.signal=AbortSignal.timeout(3e4);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,t.signal)}catch{}}const{stream:o,protocol:s}=await xN(r,e,t),a=function(e,t){var r;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const{options:r}=t.getHandler(e);if(null!=r.maxOutboundStreams)return r.maxOutboundStreams}catch(i){if(i.code!==YP.ERR_NO_HANDLER_FOR_PROTOCOL)throw i}return null!==(r=n.maxOutboundStreams)&&void 0!==r?r:64}(s,n.components.registrar,t);if(FN(s,"outbound",d)>=a){const e=new xd('Too many outbound protocol streams for protocol "'.concat(s,'" - limit ').concat(a),YP.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw r.abort(e),e}return await n.components.peerStore.merge(c,{protocols:[s]}),r.source=o.source,r.sink=o.sink,r.stat.protocol=s,null===(i=n.components.metrics)||void 0===i||i.trackProtocolStream(r,d),r}catch(s){if(UN.error("could not create new stream",s),null==r.stat.timeline.close&&r.close(),null!=s.code)throw s;throw new xd(String(s),YP.ERR_UNSUPPORTED_PROTOCOL)}},Promise.all([u.sink(a.source),a.sink(u.source)]).catch((e=>{UN.error(e)})));const f=s.timeline;s.timeline=new Proxy(f,{set:function(){return null!=d&&"close"===(arguments.length<=1?void 0:arguments[1])&&null!=(arguments.length<=2?void 0:arguments[2])&&null==f.close&&(async()=>{try{"OPEN"===d.stat.status&&await d.close()}catch(e){UN.error(e)}finally{n.events.safeDispatchEvent("connection:close",{detail:d})}})().catch((e=>{UN.error(e)})),Reflect.set(...arguments)}}),s.timeline.upgraded=Date.now();const p=()=>{throw new xd("connection is not multiplexed",YP.ERR_CONNECTION_NOT_MULTIPLEXED)};var g;return g={remoteAddr:s.remoteAddr,remotePeer:c,stat:{status:"OPEN",direction:o,timeline:s.timeline,multiplexer:null===(t=u)||void 0===t?void 0:t.protocol,encryption:i},newStream:null!==(r=h)&&void 0!==r?r:p,getStreams:()=>null!=u?u.streams:p(),close:async()=>{await s.close(),null!=u&&u.close()}},d=new MN(g),this.events.safeDispatchEvent("connection:open",{detail:d}),d}_onStream(e){const{connection:t,stream:r,protocol:n}=e,{handler:i}=this.components.registrar.getHandler(n);i({connection:t,stream:r})}async _encryptInbound(e){const t=Array.from(this.connectionEncryption.keys());UN("handling inbound crypto protocol selection",t);try{const{stream:r,protocol:n}=await DN(e,t,{writeBytes:!0}),i=this.connectionEncryption.get(n);if(null==i)throw new Error("no crypto module found for ".concat(n));return UN("encrypting inbound connection..."),{...await i.secureInbound(this.components.peerId,r),protocol:n}}catch(r){throw new xd(String(r),YP.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t){const r=Array.from(this.connectionEncryption.keys());UN("selecting outbound crypto protocol",r);try{const{stream:n,protocol:i}=await xN(e,r,{writeBytes:!0}),o=this.connectionEncryption.get(i);if(null==o)throw new Error("no crypto module found for ".concat(i));return UN("encrypting outbound connection to %p",t),{...await o.secureOutbound(this.components.peerId,n,t),protocol:i}}catch(n){throw new xd(String(n),YP.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=Array.from(t.keys());UN("outbound selecting muxer %s",r);try{const{stream:n,protocol:i}=await xN(e,r,{writeBytes:!0});UN("%s selected as muxer protocol",i);return{stream:n,muxerFactory:t.get(i)}}catch(n){throw UN.error("error multiplexing outbound stream",n),new xd(String(n),YP.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=Array.from(t.keys());UN("inbound handling muxers %s",r);try{const{stream:n,protocol:i}=await DN(e,r,{writeBytes:!0});return{stream:n,muxerFactory:t.get(i)}}catch(n){throw UN.error("error multiplexing inbound stream",n),new xd(String(n),YP.ERR_MUXER_UNAVAILABLE)}}}const zN=jm("libp2p");var qN=new WeakMap,KN=new WeakSet;class VN extends li{constructor(e){var t,r,n,i,o,s;super(),Kk(this,KN),Ze(this,"peerId",void 0),Ze(this,"peerStore",void 0),Ze(this,"contentRouting",void 0),Ze(this,"peerRouting",void 0),Ze(this,"keychain",void 0),Ze(this,"metrics",void 0),Ze(this,"services",void 0),Ze(this,"components",void 0),nt(this,qN,void 0);const a=new li,c=a.dispatchEvent.bind(a);a.dispatchEvent=e=>{const t=c(e),r=this.dispatchEvent(new hi(e.type,{detail:e.detail}));return t||r};try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,a)}catch{}st(qN,this,!1),this.peerId=e.peerId,this.services={};const l=this.components=function(){const e=new UT(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return new Proxy(e,{get(t,r,n){if("string"===typeof r&&!jT.includes(r)){const t=e.components[r];if(null==t&&!FT.includes(r))throw new xd("".concat(r," not set"),"ERR_SERVICE_MISSING");return t}return Reflect.get(t,r,n)},set:(t,r,n)=>("string"===typeof r?e.components[r]=n:Reflect.set(t,r,n),!0)})}({peerId:e.peerId,events:a,datastore:null!==(t=e.datastore)&&void 0!==t?t:new DT,connectionGater:ix(e.connectionGater)});this.peerStore=this.configureComponent("peerStore",new AT(l,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...e.peerStore})),null!=e.metrics&&(this.metrics=this.configureComponent("metrics",e.metrics(this.components))),l.events.addEventListener("peer:update",(e=>{null==e.detail.previous&&this.safeDispatchEvent("peer:discovery",{detail:e.detail.peer})})),null!=e.connectionProtector&&this.configureComponent("connectionProtector",e.connectionProtector(l)),this.components.upgrader=new jN(this.components,{connectionEncryption:(null!==(r=e.connectionEncryption)&&void 0!==r?r:[]).map(((e,t)=>this.configureComponent("connection-encryption-".concat(t),e(this.components)))),muxers:(null!==(n=e.streamMuxers)&&void 0!==n?n:[]).map(((e,t)=>this.configureComponent("stream-muxers-".concat(t),e(this.components)))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.configureComponent("transportManager",new wN(this.components,e.transportManager)),this.configureComponent("connectionManager",new aN(this.components,e.connectionManager)),this.configureComponent("registrar",new mN(this.components)),this.configureComponent("addressManager",new BT(this.components,e.addresses));const u=UC.generateOptions();this.keychain=this.configureComponent("keyChain",new UC(this.components,{...u,...e.keychain}));const h=(null!==(i=e.peerRouters)&&void 0!==i?i:[]).map(((e,t)=>this.configureComponent("peer-router-".concat(t),e(this.components))));this.peerRouting=this.components.peerRouting=this.configureComponent("peerRouting",new gN(this.components,{routers:h}));const d=(null!==(o=e.contentRouters)&&void 0!==o?o:[]).map(((e,t)=>this.configureComponent("content-router-".concat(t),e(this.components))));if(this.contentRouting=this.components.contentRouting=this.configureComponent("contentRouting",new dN(this.components,{routers:d})),(null!==(s=e.peerDiscovery)&&void 0!==s?s:[]).forEach(((e,t)=>{this.configureComponent("peer-discovery-".concat(t),e(this.components)).addEventListener("peer",(e=>{it(KN,this,HN).call(this,e)}))})),e.transports.forEach(((e,t)=>{this.components.transportManager.add(this.configureComponent("transport-".concat(t),e(this.components)))})),null!=e.services)for(const f of Object.keys(e.services)){const t=(0,e.services[f])(this.components);null!=t?(this.services[f]=t,this.configureComponent(f,t),null!=t[Hk]&&(zN("registering service %s for content routing",f),d.push(t[Hk])),null!=t[Wk]&&(zN("registering service %s for peer routing",f),h.push(t[Wk])),null!=t[pE]&&(zN("registering service %s for peer discovery",f),t[pE].addEventListener("peer",(e=>{it(KN,this,HN).call(this,e)})))):zN.error("service factory %s returned null or undefined instance",f)}}configureComponent(e,t){return null==t&&zN.error("component %s was null or undefined",e),this.components[e]=t,t}async start(){if(ot(qN,this))return;st(qN,this,!0),zN("libp2p is starting");null==(await this.keychain.listKeys()).find((e=>"self"===e.name))&&(zN("importing self key into keychain"),await this.keychain.importPeer("self",this.components.peerId));try{var e,t,r,n;await(null===(e=(t=this.components).beforeStart)||void 0===e?void 0:e.call(t)),await this.components.start(),await(null===(r=(n=this.components).afterStart)||void 0===r?void 0:r.call(n)),this.safeDispatchEvent("start",{detail:this}),zN("libp2p has started")}catch(i){throw zN.error("An error occurred starting libp2p",i),await this.stop(),i}}async stop(){var e,t,r,n;ot(qN,this)&&(zN("libp2p is stopping"),st(qN,this,!1),await(null===(e=(t=this.components).beforeStop)||void 0===e?void 0:e.call(t)),await this.components.stop(),await(null===(r=(n=this.components).afterStop)||void 0===r?void 0:r.call(n)),this.safeDispatchEvent("stop",{detail:this}),zN("libp2p has stopped"))}isStarted(){return ot(qN,this)}getConnections(e){return this.components.connectionManager.getConnections(e)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){const e=new zC;for(const t of this.components.connectionManager.getConnections())e.add(t.remotePeer);return Array.from(e)}async dial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.components.connectionManager.openConnection(e,t)}async dialProtocol(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==t)throw new xd("no protocols were provided to open a stream",YP.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(0===(t=Array.isArray(t)?t:[t]).length)throw new xd("no protocols were provided to open a stream",YP.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this.dial(e,r)).newStream(t,r)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(e){var t;Zn(e)&&(e=Tm(null!==(t=e.getPeerId())&&void 0!==t?t:""));await this.components.connectionManager.closeConnections(e)}async getPublicKey(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(zN("getPublicKey %p",e),null!=e.publicKey)return e.publicKey;const r=await this.peerStore.get(e);if(null!=r.id.publicKey)return r.id.publicKey;const n=Sd([_l("/pk/"),e.multihash.digest]),i=await this.contentRouting.get(n,t);return Cy(i),await this.peerStore.patch(e,{publicKey:i}),i}async handle(e,t,r){Array.isArray(e)||(e=[e]),await Promise.all(e.map((async e=>{await this.components.registrar.handle(e,t,r)})))}async unhandle(e){Array.isArray(e)||(e=[e]),await Promise.all(e.map((async e=>{await this.components.registrar.unhandle(e)})))}async register(e,t){return this.components.registrar.register(e,t)}unregister(e){this.components.registrar.unregister(e)}}function HN(e){const{detail:t}=e;t.id.toString()!==this.peerId.toString()?this.components.peerStore.merge(t.id,{multiaddrs:t.multiaddrs,protocols:t.protocols}).catch((e=>{zN.error(e)})):zN.error(new Error(YP.ERR_DISCOVERED_SELF))}async function WN(e){if(null==e.peerId){const r=e.datastore;if(null!=r)try{const t=new UC({datastore:r},AC(UC.generateOptions(),e.keychain));e.peerId=await t.exportPeerId("self")}catch(t){if("ERR_NOT_FOUND"!==t.code)throw t}}return null==e.peerId&&(e.peerId=await KC()),new VN(function(e){var t;const r=AC(QP,e);if(null==r.transports||r.transports.length<1)throw new xd(GP.ERR_TRANSPORTS_REQUIRED,YP.ERR_TRANSPORTS_REQUIRED);if(null===r.connectionProtector&&null!=(null===(t=globalThis.process)||void 0===t||null===(t=t.env)||void 0===t?void 0:t.LIBP2P_FORCE_PNET))throw new xd(GP.ERR_PROTECTOR_REQUIRED,YP.ERR_PROTECTOR_REQUIRED);return r}(e))}const GN="js-libp2p/".concat("0.45.9");var YN;!function(e){let t;e.codec=()=>(null==t&&(t=ia((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.protocolVersion&&(t.uint32(42),t.string(e.protocolVersion)),null!=e.agentVersion&&(t.uint32(50),t.string(e.agentVersion)),null!=e.publicKey&&(t.uint32(10),t.bytes(e.publicKey)),null!=e.listenAddrs)for(const n of e.listenAddrs)t.uint32(18),t.bytes(n);if(null!=e.observedAddr&&(t.uint32(34),t.bytes(e.observedAddr)),null!=e.protocols)for(const n of e.protocols)t.uint32(26),t.string(n);null!=e.signedPeerRecord&&(t.uint32(66),t.bytes(e.signedPeerRecord)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={listenAddrs:[],protocols:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 5:r.protocolVersion=e.string();break;case 6:r.agentVersion=e.string();break;case 1:r.publicKey=e.bytes();break;case 2:r.listenAddrs.push(e.bytes());break;case 4:r.observedAddr=e.bytes();break;case 3:r.protocols.push(e.string());break;case 8:r.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>As(t,e.codec()),e.decode=t=>Li(t,e.codec())}(YN||(YN={}));const QN=jm("libp2p:identify"),XN={protocolPrefix:"ipfs",agentVersion:GN,timeout:6e4,maxInboundStreams:1,maxOutboundStreams:1,maxPushIncomingStreams:1,maxPushOutgoingStreams:1,maxObservedAddresses:10,maxIdentifyMessageSize:8192};var JN=new WeakSet;class $N{constructor(e,t){var r,n,i,o,s,a,c,l,u,h,d;Kk(this,JN),Ze(this,"identifyProtocolStr",void 0),Ze(this,"identifyPushProtocolStr",void 0),Ze(this,"host",void 0),Ze(this,"started",void 0),Ze(this,"timeout",void 0),Ze(this,"peerId",void 0),Ze(this,"peerStore",void 0),Ze(this,"registrar",void 0),Ze(this,"connectionManager",void 0),Ze(this,"addressManager",void 0),Ze(this,"maxInboundStreams",void 0),Ze(this,"maxOutboundStreams",void 0),Ze(this,"maxPushIncomingStreams",void 0),Ze(this,"maxPushOutgoingStreams",void 0),Ze(this,"maxIdentifyMessageSize",void 0),Ze(this,"maxObservedAddresses",void 0),Ze(this,"events",void 0),this.started=!1,this.peerId=e.peerId,this.peerStore=e.peerStore,this.registrar=e.registrar,this.addressManager=e.addressManager,this.connectionManager=e.connectionManager,this.events=e.events,this.identifyProtocolStr="/".concat(null!==(r=t.protocolPrefix)&&void 0!==r?r:XN.protocolPrefix,"/").concat("id","/").concat("1.0.0"),this.identifyPushProtocolStr="/".concat(null!==(n=t.protocolPrefix)&&void 0!==n?n:XN.protocolPrefix,"/").concat("id/push","/").concat("1.0.0"),this.timeout=null!==(i=t.timeout)&&void 0!==i?i:XN.timeout,this.maxInboundStreams=null!==(o=t.maxInboundStreams)&&void 0!==o?o:XN.maxInboundStreams,this.maxOutboundStreams=null!==(s=t.maxOutboundStreams)&&void 0!==s?s:XN.maxOutboundStreams,this.maxPushIncomingStreams=null!==(a=t.maxPushIncomingStreams)&&void 0!==a?a:XN.maxPushIncomingStreams,this.maxPushOutgoingStreams=null!==(c=t.maxPushOutgoingStreams)&&void 0!==c?c:XN.maxPushOutgoingStreams,this.maxIdentifyMessageSize=null!==(l=t.maxIdentifyMessageSize)&&void 0!==l?l:XN.maxIdentifyMessageSize,this.maxObservedAddresses=null!==(u=t.maxObservedAddresses)&&void 0!==u?u:XN.maxObservedAddresses,this.host={protocolVersion:"".concat(null!==(h=t.protocolPrefix)&&void 0!==h?h:XN.protocolPrefix,"/").concat("0.1.0"),agentVersion:null!==(d=t.agentVersion)&&void 0!==d?d:XN.agentVersion},e.events.addEventListener("connection:open",(e=>{const t=e.detail;this.identify(t).catch((e=>{QN.error("error during identify trigged by connection:open",e)}))})),e.events.addEventListener("self:peer:update",(e=>{this.push().catch((e=>{QN.error(e)}))})),this.host.agentVersion===GN&&(_w||ww?this.host.agentVersion+=" UserAgent=".concat(globalThis.process.version):(bw||Sw||Ew||Aw)&&(this.host.agentVersion+=" UserAgent=".concat(globalThis.navigator.userAgent)))}isStarted(){return this.started}async start(){this.started||(await this.peerStore.merge(this.peerId,{metadata:{AgentVersion:_l(this.host.agentVersion),ProtocolVersion:_l(this.host.protocolVersion)}}),await this.registrar.handle(this.identifyProtocolStr,(e=>{this._handleIdentify(e).catch((e=>{QN.error(e)}))}),{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}),await this.registrar.handle(this.identifyPushProtocolStr,(e=>{this._handlePush(e).catch((e=>{QN.error(e)}))}),{maxInboundStreams:this.maxPushIncomingStreams,maxOutboundStreams:this.maxPushOutgoingStreams}),this.started=!0)}async stop(){await this.registrar.unhandle(this.identifyProtocolStr),await this.registrar.unhandle(this.identifyPushProtocolStr),this.started=!1}async pushToConnections(e){var t,r;const n=this.addressManager.getAddresses().map((e=>e.decapsulateCode(Cn("p2p").code))),i=new lR({peerId:this.peerId,multiaddrs:n}),o=await iR.seal(i,this.peerId),s=this.registrar.getProtocols(),a=await this.peerStore.get(this.peerId),c=Sl(null!==(t=a.metadata.get("AgentVersion"))&&void 0!==t?t:_l(this.host.agentVersion)),l=Sl(null!==(r=a.metadata.get("ProtocolVersion"))&&void 0!==r?r:_l(this.host.protocolVersion)),u=e.map((async e=>{let t;const r=AbortSignal.timeout(this.timeout);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,r)}catch{}try{t=await e.newStream([this.identifyPushProtocolStr],{signal:r});const i=ev(t,r);await i.sink(Fa([YN.encode({listenAddrs:n.map((e=>e.bytes)),signedPeerRecord:o.marshal(),protocols:s,agentVersion:c,protocolVersion:l})],(e=>ka(e))))}catch(i){QN.error("could not push identify update to peer",i)}finally{null!=t&&t.close()}}));await Promise.all(u)}async push(){if(!this.isStarted())return;const e=[];await Promise.all(this.connectionManager.getConnections().map((async t=>{try{if(!(await this.peerStore.get(t.remotePeer)).protocols.includes(this.identifyPushProtocolStr))return;e.push(t)}catch(r){if(r.code!==YP.ERR_NOT_FOUND)throw r}}))),await this.pushToConnections(e)}async _identify(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=tv([AbortSignal.timeout(this.timeout),null===r||void 0===r?void 0:r.signal]);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,n)}catch{}try{t=await e.newStream([this.identifyProtocolStr],{signal:n});const r=ev(t,n),o=await Fa([],r,(e=>{var t;return Pa(e,{maxDataLength:null!==(t=this.maxIdentifyMessageSize)&&void 0!==t?t:8192})}),(async e=>fN(e)));if(null==o)throw new xd("No data could be retrieved",YP.ERR_CONNECTION_ENDED);try{return YN.decode(o)}catch(i){throw new xd(String(i),YP.ERR_INVALID_MESSAGE)}}finally{null!=t&&t.close(),n.clear()}}async identify(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await this._identify(e,r),{publicKey:i,protocols:o,observedAddr:s}=n;if(null==i)throw new xd("public key was missing from identify message",YP.ERR_MISSING_PUBLIC_KEY);const a=await Pm(i);if(!e.remotePeer.equals(a))throw new xd("identified peer does not match the expected peer",YP.ERR_INVALID_PEER);if(this.peerId.equals(a))throw new xd("identified peer is our own peer id?",YP.ERR_INVALID_PEER);const c=function(e){if(null!=e&&e.length>0)try{return ei(e)}catch{}}(s);QN("identify completed for peer %p and protocols %o",a,o),QN("our observed address is %s",c),null!=c&&this.addressManager.getObservedAddrs().length<(null!==(t=this.maxObservedAddresses)&&void 0!==t?t:1/0)&&(QN("storing our observed address %s",null===c||void 0===c?void 0:c.toString()),this.addressManager.addObservedAddr(c));const l=await it(JN,this,ZN).call(this,e.remotePeer,n),u={peerId:a,protocolVersion:n.protocolVersion,agentVersion:n.agentVersion,publicKey:n.publicKey,listenAddrs:n.listenAddrs.map((e=>ei(e))),observedAddr:null==n.observedAddr?void 0:ei(n.observedAddr),protocols:n.protocols,signedPeerRecord:l};this.events.safeDispatchEvent("peer:identify",{detail:u})}async _handleIdentify(e){const{connection:t,stream:r}=e,n=AbortSignal.timeout(this.timeout);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,n)}catch{}try{var i;const e=null!==(i=this.peerId.publicKey)&&void 0!==i?i:new Uint8Array(0),o=await this.peerStore.get(this.peerId),s=this.addressManager.getAddresses().map((e=>e.decapsulateCode(Cn("p2p").code)));let a=o.peerRecordEnvelope;if(s.length>0&&null==a){const e=new lR({peerId:this.peerId,multiaddrs:s});a=(await iR.seal(e,this.peerId)).marshal().subarray()}const c=YN.encode({protocolVersion:this.host.protocolVersion,agentVersion:this.host.agentVersion,publicKey:e,listenAddrs:s.map((e=>e.bytes)),signedPeerRecord:a,observedAddr:t.remoteAddr.bytes,protocols:o.protocols}),l=ev(r,n),u=Fa([c],(e=>ka(e)));await l.sink(u)}catch(o){QN.error("could not respond to identify request",o)}finally{r.close()}}async _handlePush(e){const{connection:t,stream:r}=e;try{var n;if(this.peerId.equals(t.remotePeer))throw new Error("received push from ourselves?");const e=eu(ev(r,AbortSignal.timeout(this.timeout)),{maxDataLength:null!==(n=this.maxIdentifyMessageSize)&&void 0!==n?n:8192}),i=await e.readPB(YN);await it(JN,this,ZN).call(this,t.remotePeer,i)}catch(i){return void QN.error("received invalid message",i)}finally{r.close()}QN("handled push from %p",t.remotePeer)}}async function ZN(e,t){if(QN("received identify from %p",e),null==t)throw new Error("Message was null or undefined");const r={addresses:t.listenAddrs.map((e=>({isCertified:!1,multiaddr:ei(e)}))),protocols:t.protocols,metadata:new Map,peerRecordEnvelope:t.signedPeerRecord};let n;if(null!=t.signedPeerRecord){QN("received signedPeerRecord in push from %p",e);let o=t.signedPeerRecord;const s=await iR.openAndCertify(o,lR.DOMAIN);let a,c=lR.createFromProtobuf(s.payload);if(!c.peerId.equals(s.peerId))throw new Error("signing key does not match PeerId in the PeerRecord");if(!e.equals(c.peerId))throw new Error("signing key does not match remote PeerId");try{a=await this.peerStore.get(c.peerId)}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}if(null!=a&&(r.metadata=a.metadata,null!=a.peerRecordEnvelope)){const e=await iR.createFromProtobuf(a.peerRecordEnvelope),t=lR.createFromProtobuf(e.payload);t.seqNumber>=c.seqNumber&&(QN("sequence number was lower or equal to existing sequence number - stored: %d received: %d",t.seqNumber,c.seqNumber),c=t,o=a.peerRecordEnvelope)}r.peerRecordEnvelope=o,r.addresses=c.multiaddrs.map((e=>({isCertified:!0,multiaddr:e}))),n={seq:c.seqNumber,addresses:c.multiaddrs}}else QN("%p did not send a signed peer record",e);return null!=t.agentVersion&&r.metadata.set("AgentVersion",_l(t.agentVersion)),null!=t.protocolVersion&&r.metadata.set("ProtocolVersion",_l(t.protocolVersion)),await this.peerStore.patch(e,r),n}function eO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new $N(t,e)}const tO=jm("libp2p:ping");class rO{constructor(e,t){var r,n,i,o;Ze(this,"protocol",void 0),Ze(this,"components",void 0),Ze(this,"started",void 0),Ze(this,"timeout",void 0),Ze(this,"maxInboundStreams",void 0),Ze(this,"maxOutboundStreams",void 0),this.components=e,this.started=!1,this.protocol="/".concat(null!==(r=t.protocolPrefix)&&void 0!==r?r:"ipfs","/").concat("ping","/").concat("1.0.0"),this.timeout=null!==(n=t.timeout)&&void 0!==n?n:1e4,this.maxInboundStreams=null!==(i=t.maxInboundStreams)&&void 0!==i?i:2,this.maxOutboundStreams=null!==(o=t.maxOutboundStreams)&&void 0!==o?o:1}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}handleMessage(e){const{stream:t}=e;Fa(t,t).catch((e=>{tO.error(e)}))}async ping(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};tO("dialing %s to %p",this.protocol,e);const r=Date.now(),n=oy(32),i=await this.components.connectionManager.openConnection(e,t);let o;const s=tv([AbortSignal.timeout(this.timeout),null===t||void 0===t?void 0:t.signal]);try{null===Vk.setMaxListeners||void 0===Vk.setMaxListeners||(0,Vk.setMaxListeners)(1/0,s)}catch{}try{o=await i.newStream([this.protocol],{signal:s});const e=ev(o,s),t=await Fa([n],e,(async e=>fN(e))),a=Date.now();if(null==t||!_f(n,t.subarray()))throw new xd("Received wrong ping ack",YP.ERR_WRONG_PING_ACK);return a-r}finally{null!=o&&o.close(),s.clear()}}}function nO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new rO(t,e)}const iO={lightPush:1,filter:1,store:1};async function oO(e){var t,r;const n=null!==(t=null===e||void 0===e?void 0:e.libp2p)&&void 0!==t?t:{},i=null!==(r=n.peerDiscovery)&&void 0!==r?r:[];null!==e&&void 0!==e&&e.defaultBootstrap&&(i.push(sO()),Object.assign(n,{peerDiscovery:i}));const o=await aO(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>{e={...e,msgIdFn:e=>{let{data:t}=e;return Ed(t)},globalSignaturePolicy:OA.StrictNoSign,fallbackToFloodsub:!1};const r=new Pk(t,e);return r.multicodecs=Dk,r}}(e),n,null===e||void 0===e?void 0:e.userAgent),s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new Fk(t,e)}(e);return new vi(null!==e&&void 0!==e?e:{},o,void 0,void 0,void 0,s)}function sO(){return e=[yA.PROD],t=iO,r=>new vA(r,{enrUrls:e,wantedNodeCapabilityCount:t});var e,t}async function aO(e,t,r){const n=e?{pubsub:e}:{};return async function(e){const t=await WN(e);return!1!==e.start&&await t.start(),t}({connectionManager:{minConnections:1},transports:[fE({filter:iE})],streamMuxers:[Rv()],connectionEncryption:[Xm()],...t,services:{identify:eO({agentVersion:null!==r&&void 0!==r?r:yi}),ping:nO(),...n,...null===t||void 0===t?void 0:t.services}})}var cO=__webpack_require__(4414);const lO="/js-waku-examples/1/chat/proto",uO=la({contentTopic:lO}),hO=new ua(lO);const dO=new(Xe().Type)("SimpleChatMessage").add(new(Xe().Field)("timestamp",1,"uint32")).add(new(Xe().Field)("text",2,"string"));const fO=function(){const[e,t]=Ge.useState(void 0),[r,n]=Ge.useState("None"),[i,o]=Ge.useState(0),[s,a]=Ge.useState([]);Ge.useEffect((()=>{e||"None"===r&&(n("Starting"),(async()=>{const e=await oO({defaultBootstrap:!0});t(e),await e.start(),n("Connecting"),await Bl(e,["relay"]),n("Ready")})())}),[e,r]);const c=Ge.useCallback((e=>{if(console.log("Message received",e),!e.payload)return;const{text:t,timestamp:r}=dO.decode(e.payload),n=new Date;n.setTime(r);const i={text:t,timestamp:n};a((e=>[i].concat(e)))}),[]);return Ge.useEffect((()=>{if(!e)return;return e.relay.subscribe(hO,c)}),[e,r,c]),(0,cO.jsx)("div",{className:"App",children:(0,cO.jsxs)("header",{className:"App-header",children:[(0,cO.jsx)("p",{children:r}),(0,cO.jsx)("button",{onClick:()=>{"Ready"===r&&(function(e,t,r){const n=r.getTime(),i=dO.create({timestamp:n,text:e}),o=dO.encode(i).finish();return t.relay.send(uO,{payload:o})}("Here is message #".concat(i),e,new Date).then((()=>console.log("Message sent"))),o(i+1))},disabled:"Ready"!==r,children:"Send Message"}),(0,cO.jsx)("ul",{children:s.map((e=>(0,cO.jsx)("li",{children:(0,cO.jsxs)("p",{children:[e.timestamp.toString(),": ",e.text]})},e.timestamp.valueOf())))})]})})};Ye.createRoot(document.getElementById("root")).render((0,cO.jsx)(Ge.StrictMode,{children:(0,cO.jsx)(fO,{})}))})()})();