mirror of
https://github.com/logos-messaging/examples.waku.org.git
synced 2026-01-10 08:43:12 +00:00
3 lines
1.3 MiB
3 lines
1.3 MiB
/*! For license information please see main.b340864c.js.LICENSE.txt */
|
|
(()=>{var __webpack_modules__={8958:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(6243),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},7845:(e,t,n)=>{"use strict";e.exports=o;var r=n(8958);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(6243);function o(e){r.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()},9185:(e,t,n)=>{"use strict";e.exports=i;var r=n(6243);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},6243:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(9185),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},6162:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(6243),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},3952:(e,t,n)=>{"use strict";e.exports=o;var r=n(6162);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(6243);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},3415:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(6405),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},3419:(e,t,n)=>{"use strict";e.exports=o;var r=n(3415);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(6405);function o(e){r.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()},1272:(e,t,n)=>{"use strict";e.exports=i;var r=n(6405);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},6405:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(1272),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},2634:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(6405),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},7517:(e,t,n)=>{"use strict";e.exports=o;var r=n(2634);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(6405);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},2171:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(9460),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},2552:(e,t,n)=>{"use strict";e.exports=o;var r=n(2171);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(9460);function o(e){r.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()},3750:(e,t,n)=>{"use strict";e.exports=i;var r=n(9460);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},9460:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(3750),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},310:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(9460),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},2685:(e,t,n)=>{"use strict";e.exports=o;var r=n(310);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(9460);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},5538:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(8858),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},9462:(e,t,n)=>{"use strict";e.exports=o;var r=n(5538);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(8858);function o(e){r.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()},9867:(e,t,n)=>{"use strict";e.exports=i;var r=n(8858);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},8858:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(9867),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},9114:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(8858),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},4934:(e,t,n)=>{"use strict";e.exports=o;var r=n(9114);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(8858);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},5124:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(8765),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},8389:(e,t,n)=>{"use strict";e.exports=o;var r=n(5124);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(8765);function o(e){r.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()},2465:(e,t,n)=>{"use strict";e.exports=i;var r=n(8765);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},8765:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(2465),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},172:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(8765),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},2710:(e,t,n)=>{"use strict";e.exports=o;var r=n(172);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(8765);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},4309:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(2791),o=(s(i),s(n(2007)));function s(e){return e&&e.__esModule?e:{default:e}}var a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"componentDidMount",value:function(){this.props.contentDidMount()}},{key:"componentDidUpdate",value:function(){this.props.contentDidUpdate()}},{key:"render",value:function(){return i.Children.only(this.props.children)}}]),t}(i.Component);a.propTypes={children:o.default.element.isRequired,contentDidMount:o.default.func.isRequired,contentDidUpdate:o.default.func.isRequired},t.default=a},3401:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FrameContextConsumer=t.FrameContextProvider=t.useFrame=t.FrameContext=void 0;var r,i=n(2791),o=(r=i)&&r.__esModule?r:{default:r};var s=void 0,a=void 0;"undefined"!==typeof document&&(s=document),"undefined"!==typeof window&&(a=window);var c=t.FrameContext=o.default.createContext({document:s,window:a}),l=(t.useFrame=function(){return o.default.useContext(c)},c.Provider),u=c.Consumer;t.FrameContextProvider=l,t.FrameContextConsumer=u},4623:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Frame=void 0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(2791),s=h(o),a=h(n(4164)),c=h(n(2007)),l=n(3401),u=h(n(4309));function h(e){return e&&e.__esModule?e:{default:e}}var d=t.Frame=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.setRef=function(e){r.nodeRef.current=e;var t=r.props.forwardedRef;"function"===typeof t?t(e):t&&(t.current=e)},r.handleLoad=function(){clearInterval(r.loadCheck),r.state.iframeLoaded||r.setState({iframeLoaded:!0})},r.loadCheck=function(){return setInterval((function(){r.handleLoad()}),500)},r._isMounted=!1,r.nodeRef=s.default.createRef(),r.state={iframeLoaded:!1},r}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"componentDidMount",value:function(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}},{key:"getDoc",value:function(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}},{key:"getMountTarget",value:function(){var e=this.getDoc();return this.props.mountTarget?e.querySelector(this.props.mountTarget):e.body.children[0]}},{key:"renderFrameContents",value:function(){if(!this._isMounted)return null;var e=this.getDoc();if(!e)return null;var t=this.props.contentDidMount,n=this.props.contentDidUpdate,r=e.defaultView||e.parentView,i=s.default.createElement(u.default,{contentDidMount:t,contentDidUpdate:n},s.default.createElement(l.FrameContextProvider,{value:{document:e,window:r}},s.default.createElement("div",{className:"frame-content"},this.props.children))),o=this.getMountTarget();return[a.default.createPortal(this.props.head,this.getDoc().head),a.default.createPortal(i,o)]}},{key:"render",value:function(){var e=r({},this.props,{srcDoc:this.props.initialContent,children:void 0});return delete e.head,delete e.initialContent,delete e.mountTarget,delete e.contentDidMount,delete e.contentDidUpdate,delete e.forwardedRef,s.default.createElement("iframe",r({},e,{ref:this.setRef,onLoad:this.handleLoad}),this.state.iframeLoaded&&this.renderFrameContents())}}]),t}(o.Component);d.propTypes={style:c.default.object,head:c.default.node,initialContent:c.default.string,mountTarget:c.default.string,contentDidMount:c.default.func,contentDidUpdate:c.default.func,children:c.default.oneOfType([c.default.element,c.default.arrayOf(c.default.element)])},d.defaultProps={style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:function(){},contentDidUpdate:function(){},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'},t.default=s.default.forwardRef((function(e,t){return s.default.createElement(d,r({},e,{forwardedRef:t}))}))},4014:(e,t,n)=>{"use strict";var r=n(4623);var i=n(3401)},7206:e=>{"use strict";e.exports=function(e,t){var n=new Array(arguments.length-1),r=0,i=2,o=!0;for(;i<arguments.length;)n[r++]=arguments[i++];return new Promise((function(i,s){n[r]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];i.apply(null,t)}};try{e.apply(t||null,n)}catch(a){o&&(o=!1,s(a))}}))}},1:(e,t)=>{"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var r=new Array(64),i=new Array(123),o=0;o<64;)i[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,n){for(var i,o=null,s=[],a=0,c=0;t<n;){var l=e[t++];switch(c){case 0:s[a++]=r[l>>2],i=(3&l)<<4,c=1;break;case 1:s[a++]=r[i|l>>4],i=(15&l)<<2,c=2;break;case 2:s[a++]=r[i|l>>6],s[a++]=r[63&l],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=r[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";n.decode=function(e,t,n){for(var r,o=n,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:r=l,a=1;break;case 1:t[n++]=r<<2|(48&l)>>4,r=l,a=2;break;case 2:t[n++]=(15&r)<<4|(60&l)>>2,r=l,a=3;break;case 3:t[n++]=(3&r)<<6|l,a=0}}if(1===a)throw Error(s);return n-o},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},3297:e=>{"use strict";function t(e,n){"string"===typeof e&&(n=e,e=void 0);var r=[];function i(e){if("string"!==typeof e){var n=o();if(t.verbose&&console.log("codegen: "+n),n="return "+n,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]=n,Function.apply(null,a).apply(null,c)}return Function(n)()}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 n=u[h++];switch(t){case"d":case"f":return String(Number(n));case"i":return String(Math.floor(n));case"j":return JSON.stringify(n);case"s":return String(n)}return"%"})),h!==u.length)throw Error("parameter count mismatch");return r.push(e),i}function o(t){return"function "+(t||n||"")+"("+(e&&e.join(",")||"")+"){\n "+r.join("\n ")+"\n}"}return i.toString=o,i}e.exports=t,t.verbose=!1},7111:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||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 n=this._listeners[e],r=0;r<n.length;)n[r].fn===t?n.splice(r,1):++r;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,n)}return this}},7635:(e,t,n)=>{"use strict";e.exports=o;var r=n(7206),i=n(7172)("fs");function o(e,t,n){return"function"===typeof t?(n=t,t={}):t||(t={}),n?!t.xhr&&i&&i.readFile?i.readFile(e,(function(r,i){return r&&"undefined"!==typeof XMLHttpRequest?o.xhr(e,t,n):r?n(r):n(null,t.binary?i:i.toString("utf8"))})):o.xhr(e,t,n):r(o,this,e,t)}o.xhr=function(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState){if(0!==r.status&&200!==r.status)return n(Error("status "+r.status));if(t.binary){var e=r.response;if(!e){e=[];for(var i=0;i<r.responseText.length;++i)e.push(255&r.responseText.charCodeAt(i))}return n(null,"undefined"!==typeof Uint8Array?new Uint8Array(e):e)}return n(null,r.responseText)}},t.binary&&("overrideMimeType"in r&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.responseType="arraybuffer"),r.open("GET",e),r.send()}},802:e=>{"use strict";function t(e){return"undefined"!==typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),r=128===n[3];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function o(e,r,i){t[0]=e,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],t[0]}function a(e,r){return n[3]=e[r],n[2]=e[r+1],n[1]=e[r+2],n[0]=e[r+3],t[0]}e.writeFloatLE=r?i:o,e.writeFloatBE=r?o:i,e.readFloatLE=r?s:a,e.readFloatBE=r?a:s}():function(){function t(e,t,n,r){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,n,r);else if(isNaN(t))e(2143289344,n,r);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,n,r);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,n,r);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,n,r)}}function s(e,t,n){var r=e(t,n),i=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;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,n),e.writeFloatBE=t.bind(null,r),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),r=128===n[7];function i(e,r,i){t[0]=e,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function o(e,r,i){t[0]=e,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function s(e,r){return n[0]=e[r],n[1]=e[r+1],n[2]=e[r+2],n[3]=e[r+3],n[4]=e[r+4],n[5]=e[r+5],n[6]=e[r+6],n[7]=e[r+7],t[0]}function a(e,r){return n[7]=e[r],n[6]=e[r+1],n[5]=e[r+2],n[4]=e[r+3],n[3]=e[r+4],n[2]=e[r+5],n[1]=e[r+6],n[0]=e[r+7],t[0]}e.writeDoubleLE=r?i:o,e.writeDoubleBE=r?o:i,e.readDoubleLE=r?s:a,e.readDoubleBE=r?a:s}():function(){function t(e,t,n,r,i,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,i,o+t),e(1/r>0?0:2147483648,i,o+n);else if(isNaN(r))e(0,i,o+t),e(2146959360,i,o+n);else if(r>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+n);else{var a;if(r<22250738585072014e-324)e((a=r/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+n);else{var c=Math.floor(Math.log(r)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=r*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+n)}}}function s(e,t,n,r,i){var o=e(r,i+t),s=e(r,i+n),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,n,0,4),e.writeDoubleBE=t.bind(null,r,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function r(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+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)},7172: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},7468:(e,t)=>{"use strict";var n=t,r=n.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=n.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),i="";n&&(i=t.shift()+"/");for(var o=0;o<t.length;)".."===t[o]?o>0&&".."!==t[o-1]?t.splice(--o,2):n?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return i+t.join("/")};n.resolve=function(e,t,n){return n||(t=i(t)),r(t)?t:(n||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},8236:e=>{"use strict";e.exports=function(e,t,n){var r=n||8192,i=r>>>1,o=null,s=r;return function(n){if(n<1||n>i)return e(n);s+n>r&&(o=e(r),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},3861:(e,t)=>{"use strict";var n=t;n.length=function(e){for(var t=0,n=0,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t+=1:n<2048?t+=2:55296===(64512&n)&&56320===(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},n.read=function(e,t,n){if(n-t<1)return"";for(var r,i=null,o=[],s=0;t<n;)(r=e[t++])<128?o[s++]=r:r>191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<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))},n.write=function(e,t,n){for(var r,i,o=n,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296===(64512&r)&&56320===(64512&(i=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&i),++s,t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128);return n-o}},6276:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(5934),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},6453:(e,t,n)=>{"use strict";e.exports=o;var r=n(6276);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(5934);function o(e){r.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()},7060:(e,t,n)=>{"use strict";e.exports=i;var r=n(5934);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},5934:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(7060),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},1928:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(5934),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},651:(e,t,n)=>{"use strict";e.exports=o;var r=n(1928);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(5934);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},2951:e=>{e.exports=e=>t=>(n,r)=>{0===n&&t(0,((t,n)=>{r(t,1===t?e(n):n)}))}},2042:e=>{e.exports=function(){let e=[];return(t,n)=>{if(0===t){const t=n;e.push(t),t(0,(n=>{if(2===n){const n=e.indexOf(t);n>-1&&e.splice(n,1)}}))}else{const r=e.slice(0);for(let i,o=0,s=r.length;o<s;o++)i=r[o],e.indexOf(i)>-1&&i(t,n)}}}},8392:(e,t,n)=>{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 n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(n){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(n){}!e&&"undefined"!==typeof process&&"env"in process&&(e={NODE_ENV:"production",PUBLIC_URL:"/web-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=n(8472)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},8472:(e,t,n)=>{e.exports=function(e){function t(e){let n,i,o,s=null;function a(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(!a.enabled)return;const o=a,s=Number(new Date),c=s-(n||s);o.diff=c,o.prev=n,o.curr=s,n=s,r[0]=t.coerce(r[0]),"string"!==typeof r[0]&&r.unshift("%O");let l=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,((e,n)=>{if("%%"===e)return"%";l++;const i=t.formatters[n];if("function"===typeof i){const t=r[l];e=i.call(o,t),r.splice(l,1),l--}return e})),t.formatArgs.call(o,r);(o.log||t.log).apply(o,r)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,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 r(e,n){const r=t(this.namespace+("undefined"===typeof n?":":n)+e);return r.log=this.log,r}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 n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"===typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].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 n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(8193),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((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},8718: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 n=this.size();if(!(t>=n||t<-n))return t<0&&(t+=n),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 n=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),n}},t.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var n=this.size(),r=this._list.length;if(!(t>=n||t<-n)){t<0&&(t+=n),t=this._head+t&this._capacityMask;var i,o=this._list[t];if(e<n/2){for(i=e;i>0;i--)this._list[t]=this._list[t=t-1+r&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+r&this._capacityMask}else{for(i=n-1-e;i>0;i--)this._list[t]=this._list[t=t+1+r&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+r&this._capacityMask}return o}}},t.prototype.remove=function(e,t){var n,r=e,i=t;if(r===(0|r)&&this._head!==this._tail){var o=this.size(),s=this._list.length;if(!(r>=o||r<-o||t<1)){if(r<0&&(r+=o),1===t||!t)return(n=new Array(1))[0]=this.removeOne(r),n;if(0===r&&r+t>=o)return n=this.toArray(),this.clear(),n;var a;for(r+t>o&&(t=o-r),n=new Array(t),a=0;a<t;a++)n[a]=this._list[this._head+r+a&this._capacityMask];if(r=this._head+r&this._capacityMask,e+t===o){for(this._tail=this._tail-t+s&this._capacityMask,a=t;a>0;a--)this._list[r=r+1+s&this._capacityMask]=void 0;return n}if(0===e){for(this._head=this._head+t+s&this._capacityMask,a=t-1;a>0;a--)this._list[r=r+1+s&this._capacityMask]=void 0;return n}if(r<o/2){for(this._head=this._head+e+t+s&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[r=r-1+s&this._capacityMask]);for(r=this._head-1+s&this._capacityMask;i>0;)this._list[r=r-1+s&this._capacityMask]=void 0,i--;e<0&&(this._tail=r)}else{for(this._tail=r,r=r+t+s&this._capacityMask,a=o-(t+e);a>0;a--)this.push(this._list[r++]);for(r=this._tail;i>0;)this._list[r=r+1+s&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=s>>>2&&this._shrinkArray(),n}}},t.prototype.splice=function(e,t){var n=e;if(n===(0|n)){var r=this.size();if(n<0&&(n+=r),!(n>r)){if(arguments.length>2){var i,o,s,a=arguments.length,c=this._list.length,l=2;if(!r||n<r/2){for(o=new Array(n),i=0;i<n;i++)o[i]=this._list[this._head+i&this._capacityMask];for(0===t?(s=[],n>0&&(this._head=this._head+n+c&this._capacityMask)):(s=this.remove(n,t),this._head=this._head+n+c&this._capacityMask);a>l;)this.unshift(arguments[--a]);for(i=n;i>0;i--)this.unshift(o[i-1])}else{var u=(o=new Array(r-(n+t))).length;for(i=0;i<u;i++)o[i]=this._list[this._head+n+t+i&this._capacityMask];for(0===t?(s=[],n!=r&&(this._tail=this._head+n+c&this._capacityMask)):(s=this.remove(n,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(n,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,n=[],r=this._list,i=r.length;if(e||this._head>this._tail){for(t=this._head;t<i;t++)n.push(r[t]);for(t=0;t<this._tail;t++)n.push(r[t])}else for(t=this._head;t<this._tail;t++)n.push(r[t]);return n},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},7963:e=>{"use strict";function t(e,t){for(const n in t)Object.defineProperty(e,n,{value:t[n],enumerable:!0,configurable:!0});return e}e.exports=function(e,n,r){if(!e||"string"===typeof e)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"===typeof n&&(r=n,n=""),n&&(r.code=n);try{return t(e,r)}catch(i){r.message=e.message,r.stack=e.stack;const n=function(){};n.prototype=Object.create(Object.getPrototypeOf(e));return t(new n,r)}}},3634:(e,t,n)=>{"use strict";const r=n(5413);t.zN=r.EventIterator,r.EventIterator},5413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{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 r{constructor(e){let{highWaterMark:t=100,lowWaterMark:r=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new n;i.highWaterMark=t,i.lowWaterMark=r,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=r,t.default=r},7143:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,s){if("function"!==typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||e,s),c=n?n+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 r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,i,o,s){var a=n?n+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,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,o),!0;case 6:return u.fn.call(u.context,t,r,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,r);break;case 4:u[l].fn.call(u[l].context,t,r,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,n){return o(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,i){var o=n?n+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||r&&a.context!==r||s(this,o);else{for(var c=0,l=[],u=a.length;c<u;c++)(a[c].fn!==t||i&&!a[c].once||r&&a[c].context!==r)&&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=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a},7465:e=>{"use strict";var t,n="object"===typeof Reflect?Reflect:null,r=n&&"function"===typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"===typeof n.ownKeys?n.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(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"===typeof e.on&&g(e,"error",t,n)}(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,n,r){var i,o,s,l;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"===typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(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,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"===typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"===typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t,n,r){if("function"===typeof e.on)r.once?e.once(t,n):e.on(t,n);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){r.once&&e.removeEventListener(t,i),n(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=[],n=1;n<arguments.length;n++)t.push(arguments[n]);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)r(c,this,t);else{var l=c.length,u=p(c,l);for(n=0;n<l;++n)r(u[n],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 n,r,i,o,s;if(a(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!==typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"===typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);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):[]}},9437:(e,t,n)=>{var r;!function(){"use strict";var t="object"===typeof window?window:{};!t.HI_BASE32_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node&&(t=n.g);var i=!t.HI_BASE32_NO_COMMON_JS&&e.exports,o=n.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 n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},u=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,n,r,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++)],n=a[e.charAt(f++)],r=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|n>>>2),u[h++]=255&(n<<6|r<<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++)],n=a[e.charAt(f++)],u[h++]=255&(t<<3|n>>>2)):4===g?(t=a[e.charAt(f++)],n=a[e.charAt(f++)],r=a[e.charAt(f++)],i=a[e.charAt(f++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4)):5===g?(t=a[e.charAt(f++)],n=a[e.charAt(f++)],r=a[e.charAt(f++)],i=a[e.charAt(f++)],o=a[e.charAt(f++)],u[h++]=255&(t<<3|n>>>2),u[h++]=255&(n<<6|r<<1|i>>>4),u[h++]=255&(i<<4|o>>>1)):7===g&&(t=a[e.charAt(f++)],n=a[e.charAt(f++)],r=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|n>>>2),u[h++]=255&(n<<6|r<<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,n,r="",i=e.length,o=0,s=0;o<i;)if((t=e[o++])<=127)r+=String.fromCharCode(t);else{t>191&&t<=223?(n=31&t,s=1):t<=239?(n=15&t,s=2):t<=247?(n=7&t,s=3):l(o,r);for(var a=0;a<s;++a)((t=e[o++])<128||t>191)&&l(o,r),n<<=6,n+=63&t;n>=55296&&n<=57343&&l(o,r),n>1114111&&l(o,r),n<=65535?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10)),r+=String.fromCharCode(56320+(1023&n)))}return r}(u(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,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;)n=a[e.charAt(g++)],r=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&(n<<3|r>>>2))+String.fromCharCode(255&(r<<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?(n=a[e.charAt(g++)],r=a[e.charAt(g++)],f+=String.fromCharCode(255&(n<<3|r>>>2))):4===m?(n=a[e.charAt(g++)],r=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],f+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))):5===m?(n=a[e.charAt(g++)],r=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],s=a[e.charAt(g++)],f+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===m&&(n=a[e.charAt(g++)],r=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&(n<<3|r>>>2))+String.fromCharCode(255&(r<<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 n="string"!==typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?function(e){for(var t,n,r,i,o,a="",c=e.length,l=0,u=5*parseInt(c/5);l<u;)t=e[l++],n=e[l++],r=e[l++],i=e[l++],o=e[l++],a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[31&(r<<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++],n=e[l],a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[n<<4&31]+"===="):3===h?(t=e[l++],n=e[l++],r=e[l],a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[r<<1&31]+"==="):4===h&&(t=e[l++],n=e[l++],r=e[l++],i=e[l],a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[31&(r<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"="),a}(e):t?function(e){for(var t,n,r,i,o,a="",c=e.length,l=0,u=5*parseInt(c/5);l<u;)t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l++),o=e.charCodeAt(l++),a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[31&(r<<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++),n=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[n<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[r<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[31&(r<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"="),a}(e):function(e){var t,n,r,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?(n=c[1],r=c[2],i=c[3],o=c[4],h+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[31&(r<<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?(n=c[1],h+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[n<<4&31]+"===="):3===l?(n=c[1],r=c[2],h+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[r<<1&31]+"==="):(n=c[1],r=c[2],i=c[3],h+=s[t>>>3]+s[31&(t<<2|n>>>6)]+s[n>>>1&31]+s[31&(n<<4|r>>>4)]+s[31&(r<<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===(r=function(){return d}.call(d,n,d,e))||(e.exports=r)))}()},2110:(e,t,n)=>{"use strict";var r=n(7441),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function c(e){return r.isMemo(e)?s:a[e.$$typeof]||i}a[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[r.Memo]=s;var l=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(p){var i=f(n);i&&i!==p&&e(t,i,r)}var s=u(n);h&&(s=s.concat(h(n)));for(var a=c(t),g=c(n),y=0;y<s.length;++y){var m=s[y];if(!o[m]&&(!r||!r[m])&&(!g||!g[m])&&(!a||!a[m])){var v=d(n,m);try{l(t,m,v)}catch(b){}}}}return t}},7201:function(e){!function(t){"use strict";const n="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp("^".concat(n,"\\.").concat(n,"\\.").concat(n,"\\.").concat(n,"$"),"i"),threeOctet:new RegExp("^".concat(n,"\\.").concat(n,"\\.").concat(n,"$"),"i"),twoOctet:new RegExp("^".concat(n,"\\.").concat(n,"$"),"i"),longValue:new RegExp("^".concat(n,"$"),"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(n,"\\.").concat(n,"\\.").concat(n,"\\.").concat(n,"(").concat(s,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(n,"\\.").concat(n,"\\.").concat(n,"\\.").concat(n,"(").concat(s,")?$"),"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let n,r,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(r=t-i,n=":";r--;)n+="0:";return":"===(e=e.replace("::",n))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n}(),zoneId:s}}function u(e,t,n,r){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,o=0;for(;r>0;){if(i=n-r,i<0&&(i=0),e[o]>>i!==t[o]>>i)return!1;r-=n,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,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=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 n;if(void 0===t&&(n=e,e=n[0],t=n[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 n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let r,i,o;for(r=3;r>=0;r-=1){if(i=this.octets[r],!(i in n))return null;if(o=n[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),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(n[o],10)|255^parseInt(r[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,n,r,i,o;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(o[n],10)),n++;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 n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return function(){const e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(h(n));return r}();if(t=e.match(r.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(r.twoOctet))?function(){const e=t.slice(1,4),n=[];if(i=h(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return n.push(h(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(255&i),n}():(t=e.match(r.threeOctet))?function(){const e=t.slice(1,5),n=[];if(i=h(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return n.push(h(e[0])),n.push(h(e[1])),n.push(i>>8&255),n.push(255&i),n}():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 n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.IPv6=function(){function e(e,t){let n,r;if(16===e.length)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=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 n;if(void 0===t&&(n=e,e=n[0],t=n[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 n={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 r,i;for(let o=7;o>=0;o-=1){if(r=this.parts[o],!(r in n))return null;if(i=n[r],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=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],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],n=e[1];return new f.IPv4([t>>8,255&t,n>>8,255&n])},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 n,r=0,i=-1;for(;n=e.exec(t);)n[0].length>i&&(r=n.index,i=n[0].length);return i<0?t:"".concat(t.substring(0,r),"::").concat(t.substring(r+i))},e.prototype.toString=function(){return this.toRFC5952String()},e}(),f.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(n[o],10)|255^parseInt(r[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,n,r,i,o;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(o[n],10)),n++;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,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(e){let t,n,r,i,o,s;if(r=e.match(c.deprecatedTransitional))return this.parser("::ffff:".concat(r[1]));if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(s=r[6]||"",t=l(r[1].slice(0,-1)+s,6),t.parts)){for(o=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<o.length;n++)if(i=o[n],!(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 n=0;const r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=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(n){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,n){let r,i,o,s;for(i in void 0!==n&&null!==n||(n="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,i))for(o=t[i],!o[0]||o[0]instanceof Array||(o=[o]),r=0;r<o.length;r++)if(s=o[r],e.kind()===s[0].kind()&&e.match.apply(e,s))return i;return n},e.exports?e.exports=f:t.ipaddr=f}(this)},2193: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)}},887: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}},6791:(e,t,n)=>{"use strict";const{URLWithLegacySupport:r,format:i,URLSearchParams:o,defaultBase:s}=n(5732),a=n(9640);e.exports={URL:r,URLSearchParams:o,format:i,relative:a,defaultBase:s}},9640:(e,t,n)=>{"use strict";const{URLWithLegacySupport:r,format:i}=n(5732);e.exports=function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0,a=n.protocol?n.protocol.replace(":",""):"http";a=(o[a]||s||a)+":";try{t=new r(e)}catch(l){t={}}const c=Object.assign({},n,{protocol:a||t.protocol,host:n.host||t.host});return new r(e,i(c)).toString()}},5732:e=>{"use strict";const t="undefined"!==typeof navigator&&"ReactNative"===navigator.product;const n=self.URL,r=t?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";e.exports={URLWithLegacySupport:class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;this.super=new n(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return n.createObjectURL(e)}static revokeObjectURL(e){n.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:r,format:function(e){if("string"===typeof e){return new n(e).toString()}if(!(e instanceof n)){const t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",n=e.auth?e.auth+"@":"",r=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",l=e.pathname||"",u=e.path||l+a;return"".concat(i).concat(t||n).concat(o||s+r).concat(u).concat(c)}}}},7898:(e,t,n)=>{var r;!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=n.g:a&&(s=self);var c=!s.JS_SHA3_NO_COMMON_JS&&e.exports,l=n.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,n){return function(r){return new O(e,t,e).update(r)[n]()}},w=function(e,t,n){return function(r,i){return new O(e,t,i).update(r)[n]()}},E=function(e,t,n){return function(t,r,i,o){return T["cshake"+e].update(t,r,i,o)[n]()}},_=function(e,t,n){return function(t,r,i,o){return T["kmac"+e].update(t,r,i,o)[n]()}},S=function(e,t,n,r){for(var i=0;i<m.length;++i){var o=m[i];e[o]=t(n,r,o)}return e},A=function(e,t){var n=b(e,t,"hex");return n.create=function(){return new O(e,t,e)},n.update=function(e){return n.create().update(e)},S(n,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 n=w(e,t,"hex");return n.create=function(n){return new O(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},S(n,w,e,t)}},{name:"cshake",padding:d,bits:y,createMethod:function(e,t){var n=v[e],r=E(e,0,"hex");return r.create=function(r,i,o){return i||o?new O(e,t,r).bytepad([i,o],n):T["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},S(r,E,e,t)}},{name:"kmac",padding:d,bits:y,createMethod:function(e,t){var n=v[e],r=_(e,0,"hex");return r.create=function(r,i,o){return new B(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},S(r,_,e,t)}}],T={},I=[],C=0;C<k.length;++C)for(var R=k[C],x=R.bits,P=0;P<x.length;++P){var D=R.name+"_"+x[P];if(I.push(D),T[D]=R.createMethod(x[P],R.padding),"sha3"!==R.name){var N=R.name+x[P];I.push(N),T[N]=T[D]}}function O(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,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=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function B(e,t,n){O.call(this,e,t,n)}O.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,n=typeof e;if("string"!==n){if("object"!==n)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 r,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,r=1;r<l+1;++r)s[r]=0;if(t)for(r=this.start;h<c&&r<a;++h)s[r>>2]|=e[h]<<f[3&r++];else for(r=this.start;h<c&&r<a;++h)(o=e.charCodeAt(h))<128?s[r>>2]|=o<<f[3&r++]:o<2048?(s[r>>2]|=(192|o>>6)<<f[3&r++],s[r>>2]|=(128|63&o)<<f[3&r++]):o<55296||o>=57344?(s[r>>2]|=(224|o>>12)<<f[3&r++],s[r>>2]|=(128|o>>6&63)<<f[3&r++],s[r>>2]|=(128|63&o)<<f[3&r++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[r>>2]|=(240|o>>18)<<f[3&r++],s[r>>2]|=(128|o>>12&63)<<f[3&r++],s[r>>2]|=(128|o>>6&63)<<f[3&r++],s[r>>2]|=(128|63&o)<<f[3&r++]);if(this.lastByteIndex=r,r>=a){for(this.start=r-a,this.block=s[l],r=0;r<l;++r)d[r]^=s[r];L(d),this.reset=!0}else this.start=r}return this},O.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},O.prototype.encodeString=function(e){var t,n=typeof e;if("string"!==n){if("object"!==n)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 r=0,o=e.length;if(t)r=o;else for(var s=0;s<e.length;++s){var a=e.charCodeAt(s);a<128?r+=1:a<2048?r+=2:a<55296||a>=57344?r+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),r+=4)}return r+=this.encode(8*r),this.update(e),r},O.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%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,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];L(r)}},O.prototype.toString=O.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<r;){for(o=0;o<t&&s<r;++o,++s)e=n[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&&(L(n),o=0)}return i&&(e=n[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,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<r;){for(o=0;o<t&&s<r;++o,++s)c[s]=n[o];s%t===0&&L(n)}return i&&(c[o]=n[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,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<n&&a<i;++s,++a)e=a<<2,t=r[s],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%n===0&&L(r)}return o&&(e=a<<2,t=r[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},B.prototype=new O,B.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var L=function(e){var t,n,r,i,o,s,a,c,l,u,h,d,f,g,y,m,v,b,w,E,_,S,A,k,T,I,C,R,x,P,D,N,O,B,L,M,U,F,j,z,K,q,V,H,W,G,$,Y,Q,X,J,Z,ee,te,ne,re,ie,oe,se,ae,ce,le,ue;for(r=0;r<48;r+=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),n=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(c<<1|l>>>31),n=o^(l<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=s^(u<<1|h>>>31),n=a^(h<<1|u>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(d<<1|f>>>31),n=l^(f<<1|d>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=u^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,g=e[0],y=e[1],G=e[11]<<4|e[10]>>>28,$=e[10]<<4|e[11]>>>28,R=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,q=e[40]<<18|e[41]>>>14,V=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,Q=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,ne=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,X=e[34]<<15|e[35]>>>17,J=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,T=e[7]<<28|e[6]>>>4,re=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,I=e[18]<<20|e[19]>>>12,C=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,K=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^~I&R,e[11]=T^~C&x,e[20]=B^~M&F,e[21]=L^~U&j,e[30]=H^~G&Y,e[31]=W^~$&Q,e[40]=te^~re&oe,e[41]=ne^~ie&se,e[2]=m^~b&E,e[3]=v^~w&_,e[12]=I^~R&P,e[13]=C^~x&D,e[22]=M^~F&z,e[23]=U^~j&K,e[32]=G^~Y&X,e[33]=$^~Q&J,e[42]=re^~oe&ae,e[43]=ie^~se&ce,e[4]=b^~E&S,e[5]=w^~_&A,e[14]=R^~P&N,e[15]=x^~D&O,e[24]=F^~z&q,e[25]=j^~K&V,e[34]=Y^~X&Z,e[35]=Q^~J&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&T,e[26]=z^~q&B,e[27]=K^~V&L,e[36]=X^~Z&H,e[37]=J^~ee&W,e[46]=ae^~le&te,e[47]=ce^~ue&ne,e[8]=S^~g&m,e[9]=A^~y&v,e[18]=N^~k&I,e[19]=O^~T&C,e[28]=q^~B&M,e[29]=V^~L&U,e[38]=Z^~H&G,e[39]=ee^~W&$,e[48]=le^~te&re,e[49]=ue^~ne&ie,e[0]^=p[r],e[1]^=p[r+1]};if(c)e.exports=T;else{for(C=0;C<I.length;++C)s[I[C]]=T[I[C]];l&&(void 0===(r=function(){return T}.call(t,n,t,e))||(e.exports=r))}}()},6296:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(2751),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},2546:(e,t,n)=>{"use strict";e.exports=o;var r=n(6296);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(2751);function o(e){r.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()},5664:(e,t,n)=>{"use strict";e.exports=i;var r=n(2751);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},2751:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(5664),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},100:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(2751),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},6153:(e,t,n)=>{"use strict";e.exports=o;var r=n(100);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(2751);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},9842:function(e,t,n){"use strict";const r=n(887),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:o}=Object,s=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},l=e=>{const t=[];for(const n in e)i.call(e,n)&&t.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(e);for(const r of n)o.call(e,r)&&t.push(r)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return l(e).forEach((n=>{s(t,n,u(e[n]))})),t}(e):r(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach((n=>{s(t,n,u(e[n]))})),t}(e):e}const h=(e,t,n,r)=>(n.forEach((n=>{"undefined"===typeof t[n]&&r.ignoreUndefined||(n in e&&e[n]!==Object.getPrototypeOf(e)?s(e,n,f(e[n],t[n],r)):s(e,n,u(t[n])))})),e),d=(e,t,n)=>{let r=e.slice(0,0),o=0;return[e,t].forEach((t=>{const a=[];for(let n=0;n<t.length;n++)i.call(t,n)&&(a.push(String(n)),s(r,o++,t===e?t[n]:u(t[n])));r=h(r,t,l(t).filter((e=>!a.includes(e))),n)})),r};function f(e,t,n){return n.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,n):r(t)&&r(e)?h(e,t,l(t),n):u(t)}e.exports=function(){const e=f(u(c),this!==a&&this||{},c);let t={_:{}};for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];for(const s of i)if(void 0!==s){if(!r(s))throw new TypeError("`"+s+"` is not an Option Object");t=f(t,{_:s},e)}return t._}},8193:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i,s=365.25*i;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(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*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*n;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>=r)return a(e,o,r,"hour");if(o>=n)return a(e,o,n,"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>=r)return Math.round(e/r)+"h";if(o>=n)return Math.round(e/n)+"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))}},7922:function(e,t){(function(){var e,n,r,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,r,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=n(e))[0],r=a[1],e=e.substring(r),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=(r=function(e){return e.charCodeAt(0)})("0"),s=r("a"),o=r("A"),n=function(e){var t,n,a,c,l;for(c=0,t=10,n="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,n="7")),l=a;a<e.length;){if("0"<=e[a]&&e[a]<=n)c=c*t+(r(e[a])-i)>>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+r(e[a])-s)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+r(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 n,r,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(n=r=32;r>=0;n=--r)if(this.maskLong===4294967295<<32-n>>>0){this.bitmask=n;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,n,r;for(r=a(this.first),n=a(this.last),t=0;r<=n;)e(c(r),r,t),t++,r++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=c,t.Netmask=e}).call(this)},8605:(e,t,n)=>{var r=n(392);function i(e,t){r.cipher.registerAlgorithm(e,(function(){return new r.aes.Algorithm(e,t)}))}n(3397),n(4533),n(3877),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=g({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=g({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){u||d();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(n._w,e,t,!1)},decrypt:function(e,t){return p(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,n=e.key;if("string"!==typeof n||16!==n.length&&24!==n.length&&32!==n.length){if(r.util.isArray(n)&&(16===n.length||24===n.length||32===n.length)){t=n,n=r.util.createBuffer();for(var i=0;i<t.length;++i)n.putByte(t[i])}}else n=r.util.createBuffer(n);if(!r.util.isArray(n)){t=n,n=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++i)n.push(t.getInt32())}}if(!r.util.isArray(n)||4!==n.length&&6!==n.length&&8!==n.length)throw new Error("Invalid key parameter.");var s=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=f(n,e.decrypt&&!a),this._init=!0}},r.aes._expandKey=function(e,t){return u||d(),f(e,t)},r.aes._updateBlock=p,i("AES-ECB",r.cipher.modes.ecb),i("AES-CBC",r.cipher.modes.cbc),i("AES-CFB",r.cipher.modes.cfb),i("AES-OFB",r.cipher.modes.ofb),i("AES-CTR",r.cipher.modes.ctr),i("AES-GCM",r.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 n,r,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=((n=e[g])^(r=e[n])^(i=e[r]))<<24^(g^i)<<16^(g^r^i)<<8^g^n^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=n^e[e[e[n^i]]],y^=e[e[y]])}}function f(e,t){for(var n,r=e.slice(0),i=1,s=r.length,c=h*(s+6+1),u=s;u<c;++u)n=r[u-1],u%s===0?(n=o[n>>>16&255]<<24^o[n>>>8&255]<<16^o[255&n]<<8^o[n>>>24]^a[i]<<24,i++):s>6&&u%s===4&&(n=o[n>>>24]<<24^o[n>>>16&255]<<16^o[n>>>8&255]<<8^o[255&n]),r[u]=r[u-s]^n;if(t){for(var d,f=l[0],p=l[1],g=l[2],y=l[3],m=r.slice(0),v=(u=0,(c=r.length)-h);u<c;u+=h,v-=h)if(0===u||u===c-h)m[u]=r[v],m[u+1]=r[v+3],m[u+2]=r[v+2],m[u+3]=r[v+1];else for(var b=0;b<h;++b)d=r[v+b],m[u+(3&-b)]=f[o[d>>>24]]^p[o[d>>>16&255]]^g[o[d>>>8&255]]^y[o[255&d]];r=m}return r}function p(e,t,n,r){var i,a,u,h,d,f,p,g,y,m,v,b,w=e.length/4-1;r?(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[r?3:1]^e[1],g=t[2]^e[2],y=t[r?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;n[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[g>>>8&255]<<8^d[255&y]^e[++E],n[r?3:1]=d[p>>>24]<<24^d[g>>>16&255]<<16^d[y>>>8&255]<<8^d[255&f]^e[++E],n[2]=d[g>>>24]<<24^d[y>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],n[r?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,n="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key)).start;return t.start=function(e,n){var o=null;n instanceof r.util.ByteBuffer&&(o=n,n={}),(n=n||{}).output=o,n.iv=e,i.call(t,n)},t}},5049:(e,t,n)=>{var r=n(392);n(3877),n(2886);var i=e.exports=r.asn1=r.asn1||{};function o(e,t,n){if(n>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}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,n,o,s){if(r.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:n,composed:n||r.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 n;if(r.util.isArray(e)){n=[];for(var o=0;o<e.length;++o)n.push(i.copy(e[o],t));return n}return"string"===typeof e?e:(n={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(n.bitStringContents=e.bitStringContents),n)},i.equals=function(e,t,n){if(r.util.isArray(e)){if(!r.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 n&&n.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};var s=function(e,t){var n=e.getByte();if(t--,128!==n){var r;if(128&n){var i=127&n;o(e,t,i),r=e.getInt(i<<3)}else r=n;if(r<0)throw new Error("Negative length: "+r);return r}};function a(e,t,n,r){var c;o(e,t,2);var l=e.getByte();t--;var u=192&l,h=31&l;c=e.length();var d,f,p=s(e,t);if(t-=c-e.length(),void 0!==p&&p>t){if(r.strict){var g=new Error("Too few bytes to read ASN.1 value.");throw g.available=e.length(),g.remaining=t,g.requested=p,g}p=t}var y=32===(32&l);if(y)if(d=[],void 0===p)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}c=e.length(),d.push(a(e,t,n+1,r)),t-=c-e.length()}else for(;p>0;)c=e.length(),d.push(a(e,p,n+1,r)),t-=c-e.length(),p-=c-e.length();if(void 0===d&&u===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&(f=e.bytes(p)),void 0===d&&r.decodeBitStrings&&u===i.Class.UNIVERSAL&&h===i.Type.BITSTRING&&p>1){var m=e.read,v=t,b=0;if(h===i.Type.BITSTRING&&(o(e,t,1),b=e.getByte(),t--),0===b)try{c=e.length();var w=a(e,t,n+1,{strict:!0,decodeBitStrings:!0}),E=c-e.length();t-=E,h==i.Type.BITSTRING&&E++;var _=w.tagClass;E!==p||_!==i.Class.UNIVERSAL&&_!==i.Class.CONTEXT_SPECIFIC||(d=[w])}catch(A){}void 0===d&&(e.read=m,t=v)}if(void 0===d){if(void 0===p){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=t}if(h===i.Type.BMPSTRING)for(d="";p>0;p-=2)o(e,t,2),d+=String.fromCharCode(e.getInt16()),t-=2;else d=e.getBytes(p),t-=p}var S=void 0===f?null:{bitStringContents:f};return i.create(u,h,y,d,S)}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=r.util.createBuffer(e));var n=e.length(),i=a(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=n,o.remaining=e.length(),o}return i},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.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?n|=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(n),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,n,i,o,s=e.split("."),a=r.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c<s.length;++c){t=!0,n=[],i=parseInt(s[c],10);do{o=127&i,i>>>=7,t||(o|=128),n.push(o),t=!1}while(i>0);for(var l=n.length-1;l>=0;--l)a.putByte(n[l])}return a},i.derToOid=function(e){var t;"string"===typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)i<<=7,128&(n=e.getByte())?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=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(n,r,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,n=parseInt(e.substr(0,4),10),r=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(n,r,i),t.setUTCHours(o,s,a,c),t.setTime(+t+l)):(t.setFullYear(n,r,i),t.setHours(o,s,a,c)),t},i.dateToUtcTime=function(e){if("string"===typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r<n.length;++r)n[r].length<2&&(t+="0"),t+=n[r];return t+="Z"},i.dateToGeneralizedTime=function(e){if("string"===typeof e)return e;var t="",n=[];n.push(""+e.getUTCFullYear()),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r<n.length;++r)n[r].length<2&&(t+="0"),t+=n[r];return t+="Z"},i.integerToDer=function(e){var t=r.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 n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"===typeof e&&(e=r.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,n,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&&r.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],n,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&&n)if(t.capture&&(n[t.capture]=e.value),t.captureAsn1&&(n[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(n[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)n[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");n[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else o&&o.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return s};var c=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,n){var o="";n=n||2,(t=t||0)>0&&(o+="\n");for(var s="",a=0;a<t*n;++a)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(a=0;a<e.value.length;++a)void 0!==e.value[a]&&(l+=1,u+=i.prettyPrint(e.value[a],t+1,n),a+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,r.pki&&r.pki.oids&&h in r.pki.oids&&(o+=" ("+r.pki.oids[h]+") ")}if(e.type===i.Type.INTEGER)try{o+=i.derToInteger(e.value)}catch(f){o+="0x"+r.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?o+="0x"+r.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)c.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{o+=r.util.decodeUtf8(e.value)}catch(p){if("URI malformed"!==p.message)throw p;o+="0x"+r.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:c.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},5754:e=>{var t={};e.exports=t;var n={};t.encode=function(e,t,n){if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!==typeof n)throw new TypeError('"maxline" must be a number.');var r="";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)r+=s;for(i=a.length-1;i>=0;--i)r+=t[a[i]]}else r=function(e,t){var n=0,r=t.length,i=t.charAt(0),o=[0];for(n=0;n<e.length();++n){for(var s=0,a=e.at(n);s<o.length;++s)a+=o[s]<<8,o[s]=a%r,a=a/r|0;for(;a>0;)o.push(a%r),a=a/r|0}var c="";for(n=0;0===e.at(n)&&n<e.length()-1;++n)c+=i;for(n=o.length-1;n>=0;--n)c+=t[o[n]];return c}(e,t);if(n){var u=new RegExp(".{1,"+n+"}","g");r=r.match(u).join("\r\n")}return r},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 r=n[t];if(!r){r=n[t]=[];for(var i=0;i<t.length;++i)r[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=r[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())}},3397:(e,t,n)=>{var r=n(392);n(3877),e.exports=r.cipher=r.cipher||{},r.cipher.algorithms=r.cipher.algorithms||{},r.cipher.createCipher=function(e,t){var n=e;if("string"===typeof n&&(n=r.cipher.getAlgorithm(n))&&(n=n()),!n)throw new Error("Unsupported algorithm: "+e);return new r.cipher.BlockCipher({algorithm:n,key:t,decrypt:!1})},r.cipher.createDecipher=function(e,t){var n=e;if("string"===typeof n&&(n=r.cipher.getAlgorithm(n))&&(n=n()),!n)throw new Error("Unsupported algorithm: "+e);return new r.cipher.BlockCipher({algorithm:n,key:t,decrypt:!0})},r.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),r.cipher.algorithms[e]=t},r.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in r.cipher.algorithms?r.cipher.algorithms[e]:null};var i=r.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 n in e)t[n]=e[n];t.decrypt=this._decrypt,this._finish=!1,this._input=r.util.createBuffer(),this.output=e.output||r.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)))}},4533:(e,t,n)=>{var r=n(392);n(3877),r.cipher=r.cipher||{};var i=e.exports=r.cipher.modes=r.cipher.modes||{};function o(e,t){if("string"===typeof e&&(e=r.util.createBuffer(e)),r.util.isArray(e)&&e.length>4){var n=e;e=r.util.createBuffer();for(var i=0;i<n.length;++i)e.putByte(n[i])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!r.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,n){if(e.length()<this.blockSize&&!(n&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])},i.ecb.prototype.decrypt=function(e,t,n){if(e.length()<this.blockSize&&!(n&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])},i.ecb.prototype.pad=function(e,t){var n=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(n,n),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!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,n){if(e.length()<this.blockSize&&!(n&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(r=0;r<this._ints;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,n){if(e.length()<this.blockSize&&!(n&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(r=0;r<this._ints;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var n=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(n,n),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2)&&(e.truncate(r),!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=r.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,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=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-r)%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&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=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-r)%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&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-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=r.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,n){var r=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=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-r)%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&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-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=r.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,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var o=(this.blockSize-r)%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&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-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=r.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,n=r.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?r.util.createBuffer(e.additionalData):r.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=r.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=n.length();if(12===i)this._j0=[n.getInt32(),n.getInt32(),n.getInt32(),1];else{for(this._j0=[0,0,0,0];n.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[n.getInt32(),n.getInt32(),n.getInt32(),n.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=r.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,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=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-r)%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||n){if(n){var a=r%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&&!n)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-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,n){var r=e.length();if(r<this.blockSize&&!(n&&r>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]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var n=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=r.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&&(n=!1),n},i.gcm.prototype.multiply=function(e,t){for(var n=[0,0,0,0],r=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(n[0]^=r[0],n[1]^=r[1],n[2]^=r[2],n[3]^=r[3]),this.pow(r,r)}return n},i.gcm.prototype.pow=function(e,t){for(var n=1&e[3],r=3;r>0;--r)t[r]=e[r]>>>1|(1&e[r-1])<<31;t[0]=e[0]>>>1,n&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],n=0;n<32;++n){var r=e[n/8|0]>>>4*(7-n%8)&15,i=this._m[n][r];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,n){return t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var n=8/t,r=4*n,i=16*n,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],c=(r-1-s%r)*t;a[s/r|0]=1<<t-1<<c,o[s]=this.generateSubHashTable(this.multiply(a,e),t)}return o},i.gcm.prototype.generateSubHashTable=function(e,t){var n=1<<t,r=n>>>1,i=new Array(n);i[r]=e.slice(0);for(var o=r>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<r;){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=r+1;o<n;++o){var l=i[o^r];i[o]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return i}},1400:(e,t,n)=>{var r=n(392);function i(e,t){r.cipher.registerAlgorithm(e,(function(){return new r.des.Algorithm(e,t)}))}n(3397),n(4533),n(3877),e.exports=r.des=r.des||{},r.des.startEncrypting=function(e,t,n,r){var i=p({key:e,output:n,decrypt:!1,mode:r||(null===t?"ECB":"CBC")});return i.start(t),i},r.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},r.des.startDecrypting=function(e,t,n,r){var i=p({key:e,output:n,decrypt:!0,mode:r||(null===t?"ECB":"CBC")});return i.start(t),i},r.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},r.des.Algorithm=function(e,t){var n=this;n.name=e,n.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return f(n._keys,e,t,!1)},decrypt:function(e,t){return f(n._keys,e,t,!0)}}}),n._init=!1},r.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=r.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,n=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],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=n[(E&=-15)>>>28]|r[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",r.cipher.modes.ecb),i("DES-CBC",r.cipher.modes.cbc),i("DES-CFB",r.cipher.modes.cfb),i("DES-OFB",r.cipher.modes.ofb),i("DES-CTR",r.cipher.modes.ctr),i("3DES-ECB",r.cipher.modes.ecb),i("3DES-CBC",r.cipher.modes.cbc),i("3DES-CFB",r.cipher.modes.cfb),i("3DES-OFB",r.cipher.modes.ofb),i("3DES-CTR",r.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,n,r){var i,f,p=32===e.length?3:9;i=3===p?r?[30,-2,-2]:[0,32,2]:r?[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,n[0]=g,n[1]=y}function p(e){var t,n="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key)).start;return t.start=function(e,n){var o=null;n instanceof r.util.ByteBuffer&&(o=n,n={}),(n=n||{}).output=o,n.iv=e,i.call(t,n)},t}},392:e=>{e.exports={options:{usePureJavaScript:!1}}},878:(e,t,n)=>{var r=n(392);n(29),n(3877),(e.exports=r.hmac=r.hmac||{}).create=function(){var e=null,t=null,n=null,i=null,o={start:function(o,s){if(null!==o)if("string"===typeof o){if(!((o=o.toLowerCase())in r.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=r.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"===typeof s)s=r.util.createBuffer(s);else if(r.util.isArray(s)){var a=s;s=r.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()),n=r.util.createBuffer(),i=r.util.createBuffer(),l=s.length();for(c=0;c<l;++c){a=s.at(c);n.putByte(54^a),i.putByte(92^a)}if(l<t.blockLength)for(a=t.blockLength-l,c=0;c<a;++c)n.putByte(54),i.putByte(92);e=s,n=n.bytes(),i=i.bytes()}t.start(),t.update(n)},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}},3055:(e,t,n)=>{var r,i=n(392);e.exports=i.jsbn=i.jsbn||{};function o(e,t,n){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,n,r,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)+n.data[r]+i)>>28)+(u>>14)+a*l,n.data[r++]=268435455&c}return i}i.jsbn.BigInteger=o,"undefined"===typeof navigator?(o.prototype.am=a,r=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,n,r,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)+n.data[r]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),n.data[r++]=1073741823&c}return i},r=30):"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var s=t*this.data[e++]+n.data[r]+i;i=Math.floor(s/67108864),n.data[r++]=67108863&s}return i},r=26):(o.prototype.am=a,r=28),o.prototype.DB=r,o.prototype.DM=(1<<r)-1,o.prototype.DV=1<<r;o.prototype.FV=Math.pow(2,52),o.prototype.F1=52-r,o.prototype.F2=2*r-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 n=h[e.charCodeAt(t)];return null==n?-1:n}function p(e){var t=s();return t.fromInt(e),t}function g(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}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 T(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,n){e.multiplyTo(t,n),this.reduce(n)},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 n=32767&e.data[t],r=n*this.mpl+((n*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e.data[n]+=this.m.am(0,r,e,t,0,this.m.t);e.data[n]>=e.DV;)e.data[n]-=e.DV,e.data[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},m.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},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 n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,s=0;--r>=0;){var a=8==n?255&e[r]:f(e,r);a<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+n>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+=n)>=this.DB&&(s-=this.DB))}8==n&&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 n;for(n=this.t-1;n>=0;--n)t.data[n+e]=this.data[n];for(n=e-1;n>=0;--n)t.data[n]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t.data[n-e]=this.data[n];t.t=Math.max(this.t-e,0),t.s=this.s},o.prototype.lShiftTo=function(e,t){var n,r=e%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t.data[n+s+1]=this.data[n]>>i|a,a=(this.data[n]&o)<<r;for(n=s-1;n>=0;--n)t.data[n]=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 n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t.data[0]=this.data[n]>>r;for(var s=n+1;s<this.t;++s)t.data[s-n-1]|=(this.data[s]&o)<<i,t.data[s-n]=this.data[s]>>r;r>0&&(t.data[this.t-n-1]|=(this.s&o)<<i),t.t=this.t-n,t.clamp()}},o.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this.data[n]-e.data[n],t.data[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this.data[n],t.data[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e.data[n],t.data[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[n++]=this.DV+r:r>0&&(t.data[n++]=r),t.t=n,t.clamp()},o.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t.data[i]=0;for(i=0;i<r.t;++i)t.data[i+n.t]=n.am(0,r.data[i],t,i,0,n.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(),n=e.t=2*t.t;--n>=0;)e.data[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t.data[n],e,2*n,0,1);(e.data[n+t.t]+=t.am(n+1,2*t.data[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e.data[n+t.t]-=t.DV,e.data[n+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(n,t.data[n],e,2*n,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=s());var a=s(),c=this.s,l=e.s,u=this.DB-g(r.data[r.t-1]);u>0?(r.lShiftTo(u,a),i.lShiftTo(u,n)):(r.copyTo(a),i.copyTo(n));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=n.t,b=v-h,w=null==t?s():t;for(a.dlShiftTo(b,w),n.compareTo(w)>=0&&(n.data[n.t++]=1,n.subTo(w,n)),o.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a.data[a.t++]=0;for(;--b>=0;){var E=n.data[--v]==d?this.DM:Math.floor(n.data[v]*p+(n.data[v-1]+m)*y);if((n.data[v]+=a.am(0,E,n,b,0,h))<E)for(a.dlShiftTo(b,w),n.subTo(w,n);n.data[v]<--E;)n.subTo(w,n)}null!=t&&(n.drShiftTo(h,t),c!=l&&o.ZERO.subTo(t,t)),n.t=h,n.clamp(),u>0&&n.rShiftTo(u,n),c<0&&o.ZERO.subTo(n,n)}}},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 n=s(),r=s(),i=t.convert(this),a=g(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<<a)>0)t.mulTo(r,i,n);else{var c=n;n=r,r=c}return t.revert(n)},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 n,r=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this.data[s]>>a)>0&&(i=!0,o=d(n));s>=0;)a<t?(n=(this.data[s]&(1<<a)-1)<<t-a,n|=this.data[--s]>>(a+=this.DB-t)):(n=this.data[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=d(n));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 n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this.data[n]-e.data[n]))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 n;return n=e<256||t.isEven()?new y(t):new m(t),this.exp(e,n)},o.ZERO=p(0),o.ONE=p(1),A.prototype.convert=k,A.prototype.revert=k,A.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},A.prototype.sqrTo=function(e,t){e.squareTo(t)},T.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},T.prototype.revert=function(e){return e},T.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)},T.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},T.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[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],C=(1<<26)/I[I.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),n=Math.pow(e,t),r=p(n),i=s(),o=s(),a="";for(this.divRemTo(r,i,o);i.signum()>0;)a=(n+o.intValue()).toString(e).substr(1)+a,i.divRemTo(r,i,o);return o.intValue().toString(e)+a},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),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>=n&&(this.dMultiply(r),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,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),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 r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<<i)-1:r[0]=0,this.fromString(r,256)}},o.prototype.bitwiseTo=function(e,t,n){var r,i,o=Math.min(e.t,this.t);for(r=0;r<o;++r)n.data[r]=t(this.data[r],e.data[r]);if(e.t<this.t){for(i=e.s&this.DM,r=o;r<this.t;++r)n.data[r]=t(this.data[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<e.t;++r)n.data[r]=t(i,e.data[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},o.prototype.changeBit=function(e,t){var n=o.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n},o.prototype.addTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this.data[n]+e.data[n],t.data[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;n<this.t;)r+=this.data[n],t.data[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r+=e.data[n],t.data[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[n++]=r:r<-1&&(t.data[n++]=this.DV+r),t.t=n,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,n){var r,i=Math.min(this.t+e.t,t);for(n.s=0,n.t=i;i>0;)n.data[--i]=0;for(r=n.t-this.t;i<r;++i)n.data[i+this.t]=this.am(0,e.data[i],n,i,0,this.t);for(r=Math.min(e.t,t);i<r;++i)this.am(0,e.data[i],n,i,0,t-i);n.clamp()},o.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;for(n.s=0;--r>=0;)n.data[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n.data[this.t+r-t]=this.am(t-r,e.data[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},o.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this.data[r])%e;return n},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),n=t.getLowestSetBit();if(n<=0)return!1;for(var r,i=t.shiftRight(n),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{r=new o(this.bitLength(),s)}while(r.compareTo(o.ONE)<=0||r.compareTo(t)>=0);var c=r.modPow(i,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(t)){for(var l=1;l++<n&&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 n,r=this.DB-e*this.DB%8,i=0;if(e-- >0)for(r<this.DB&&(n=this.data[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this.data[e]&(1<<r)-1)<<8-r,n|=this.data[--e]>>(r+=this.DB-8)):(n=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);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,n=0;n<this.t;++n)e+=S(this.data[n]^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(),n=s();return this.divRemTo(e,t,n),new Array(t,n)},o.prototype.modPow=function(e,t){var n,r,i=e.bitLength(),o=p(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new y(t):t.isEven()?new T(t):new m(t);var a=new Array,c=3,l=n-1,u=(1<<n)-1;if(a[1]=r.convert(this),n>1){var h=s();for(r.sqrTo(a[1],h);c<=u;)a[c]=s(),r.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=n;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;)r.sqrTo(o,w),r.sqrTo(w,o),c-=2;c>0?r.sqrTo(o,w):(f=o,o=w,w=f),r.mulTo(w,a[d],o)}for(;v>=0&&0==(e.data[v]&1<<i);)r.sqrTo(o,w),f=o,o=w,w=f,--i<0&&(i=this.DB-1,--v)}return r.revert(o)},o.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var n=e.clone(),r=this.clone(),i=p(1),s=p(0),a=p(0),c=p(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),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(;r.isEven();)r.rShiftTo(1,r),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);n.compareTo(r)>=0?(n.subTo(r,n),t&&i.subTo(a,i),s.subTo(c,s)):(r.subTo(n,r),t&&a.subTo(i,a),c.subTo(s,c))}return 0!=r.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(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},o.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n.data[0]<=I[I.length-1]){for(t=0;t<I.length;++t)if(n.data[0]==I[t])return!0;return!1}if(n.isEven())return!1;for(t=1;t<I.length;){for(var r=I[t],i=t+1;i<I.length&&r<C;)r*=I[i++];for(r=n.modInt(r);t<i;)if(r%I[t++]==0)return!1}return n.millerRabin(e)}},29:(e,t,n)=>{var r=n(392);e.exports=r.md=r.md||{},r.md.algorithms=r.md.algorithms||{}},2886:(e,t,n)=>{var r=n(392);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.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")},9835:(e,t,n)=>{var r=n(392);if(n(8605),n(5049),n(1400),n(29),n(2886),n(6019),n(6193),n(3860),n(654),n(5493),n(3877),"undefined"===typeof i)var i=r.jsbn.BigInteger;var o=r.asn1,s=r.pki=r.pki||{};e.exports=s.pbe=r.pbe=r.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 n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return f(t)}function f(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}s.encryptPrivateKeyInfo=function(e,t,n){(n=n||{}).saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i,c,l,u=r.random.getBytesSync(n.saltSize),h=n.count,d=o.integerToDer(h);if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var p,g,y;switch(n.algorithm){case"aes128":i=16,p=16,g=a["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,g=a["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,g=a["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":i=8,p=8,g=a.desCBC,y=r.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=n.algorithm,_}var m="hmacWith"+n.prfAlgorithm.toUpperCase(),v=f(m),b=r.pkcs5.pbkdf2(t,u,h,i,v),w=r.random.getBytesSync(p);(S=y(b)).start(w),S.update(o.toDer(e)),S.finish(),l=S.output.getBytes();var E=function(e,t,n,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,r.util.hexToBytes(n.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"!==n.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=n.algorithm,_;i=24;var S,A=new r.util.ByteBuffer(u);b=s.pbe.generatePkcs12Key(t,A,1,h,i),w=s.pbe.generatePkcs12Key(t,A,2,h,i);(S=r.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 n=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=r.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(n=o.fromDer(h.output)),n},s.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}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,n){if(!(n=n||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,n),s.encryptedPrivateKeyToPem(i)}var a,c,l,u;switch(n.algorithm){case"aes128":a="AES-128-CBC",l=16,c=r.random.getBytesSync(16),u=r.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,c=r.random.getBytesSync(16),u=r.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,c=r.random.getBytesSync(16),u=r.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,c=r.random.getBytesSync(8),u=r.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,c=r.random.getBytesSync(8),u=r.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw h.algorithm=n.algorithm,h}var d=u(r.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:r.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return r.pem.encode(f)},s.decryptRsaPrivateKey=function(e,t){var n=null,i=r.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=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=r.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=r.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=r.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return r.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=r.util.hexToBytes(i.dekInfo.parameters),h=c(r.pbe.opensslDeriveBytes(t,u.substr(0,8),a));if(h.start(u),h.update(r.util.createBuffer(i.body)),!h.finish())return n;n=h.output.getBytes()}else n=i.body;return null!==(n="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n))&&(n=s.privateKeyFromAsn1(n)),n},s.pbe.generatePkcs12Key=function(e,t,n,i,o,s){var a,c;if("undefined"===typeof s||null===s){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');s=r.md.sha1.create()}var l=s.digestLength,u=s.blockLength,h=new r.util.ByteBuffer,d=new r.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 r.util.ByteBuffer;g.fillWithByte(n,u);var y=u*Math.ceil(p/u),m=new r.util.ByteBuffer;for(c=0;c<y;c++)m.putByte(t.at(c%p));var v=u*Math.ceil(f/u),b=new r.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 r.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 r.util.ByteBuffer;for(c=0;c<u;c++)k.putByte(S.at(c%l));var T=Math.ceil(p/u)+Math.ceil(f/u),I=new r.util.ByteBuffer;for(a=0;a<T;a++){var C=new r.util.ByteBuffer(w.getBytes(u)),R=511;for(c=k.length()-1;c>=0;c--)R>>=8,R+=k.at(c)+C.at(c),C.setAt(c,255&R);I.putBuffer(C)}w=I,h.putBuffer(S)}return h.truncate(h.length()-o),h},s.pbe.getCipher=function(e,t,n){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,n);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},s.pbe.getCipherForPBES2=function(e,t,n){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=r.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":u=16,h=r.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,h=r.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,h=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,h=r.des.createDecryptionCipher;break;case"desCBC":u=8,h=r.des.createDecryptionCipher}var g=d(a.prfOid),y=r.pkcs5.pbkdf2(n,f,p,u,g),m=a.encIv,v=h(y);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,n){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=r.util.createBuffer(i.salt),p=r.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,l=8,h=r.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,l=8,h=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};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(n,f,1,p,c,y);return y.start(),h(m,s.pbe.generatePkcs12Key(n,f,2,p,l,y))},s.pbe.opensslDeriveBytes=function(e,t,n,i){if("undefined"===typeof i||null===i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[h(i,e+t)],s=16,a=1;s<n;++a,s+=16)o.push(h(i,o[a-1]+e+t));return o.join("").substr(0,n)}},6019:(e,t,n)=>{var r=n(392);n(878),n(29),n(3877);var i,o=r.pkcs5=r.pkcs5||{};r.util.isNodejs&&!r.options.usePureJavaScript&&(i=n(5819)),e.exports=r.pbkdf2=o.pbkdf2=function(e,t,n,o,s,a){if("function"===typeof s&&(a=s,s=null),r.util.isNodejs&&!r.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,n,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,n,o,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,n,o).toString("binary"):i.pbkdf2Sync(e,t,n,o,s).toString("binary");if("undefined"!==typeof s&&null!==s||(s="sha1"),"string"===typeof s){if(!(s in r.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=r.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=r.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(r.util.int32ToBytes(m)),f=g=d.digest().getBytes();for(var v=2;v<=n;++v)d.start(null,null),d.update(g),p=d.digest().getBytes(),f=r.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(r.util.int32ToBytes(m)),f=g=d.digest().getBytes(),v=2,w()}function w(){if(v<=n)return d.start(null,null),d.update(g),p=d.digest().getBytes(),f=r.util.xorBytes(f,p,c),g=p,++v,r.util.setImmediate(w);y+=m<u?f:f.substr(0,h),++m,b()}b()}},6193:(e,t,n)=>{var r=n(392);n(3877);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i<e.values.length;++i)n.push(e.values[i].replace(/^(\S+\r\n)/,r));t+=n.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 n,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(n={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),i+=o(n)),e.headers)for(var s=0;s<e.headers.length;++s)i+=o(e.headers[s]);return e.procType&&(i+="\r\n"),i+=r.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,n=[],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:r.util.decode64(t[3])};if(n.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===n.length)throw new Error("Invalid PEM formatted message.");return n}},2627:(e,t,n)=>{var r=n(392);n(3877),n(3860),n(928);var i=e.exports=r.pkcs1=r.pkcs1||{};function o(e,t,n){n||(n=r.md.sha1.create());for(var i="",o=Math.ceil(t/n.digestLength),s=0;s<o;++s){var a=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);n.start(),n.update(e+a),i+=n.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,n){var i,s,a,c;"string"===typeof n?(i=n,s=arguments[3]||void 0,a=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(c=n.mgf1.md)),a?a.start():a=r.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=r.random.getBytes(a.digestLength);var m=o(s,l-a.digestLength-1,c),v=r.util.xorBytes(g,m,g.length),b=o(v,a.digestLength,c);return"\0"+r.util.xorBytes(s,b,s.length)+v},i.decode_rsa_oaep=function(e,t,n){var i,s,a;"string"===typeof n?(i=n,s=arguments[3]||void 0):n&&(i=n.label||void 0,s=n.md||void 0,n.mgf1&&n.mgf1.md&&(a=n.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=r.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(r.util.xorBytes(h,f,h.length),c-s.digestLength-1,a),g=r.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)}},5132:(e,t,n)=>{var r=n(392);n(3877),n(3055),n(3860),function(){if(r.prime)e.exports=r.prime;else{var t=e.exports=r.prime=r.prime||{},n=r.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new n(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||r.random,c={nextBytes:function(e){for(var t=s.getBytesSync(e.length),n=0;n<e.length;++n)e[n]=t.charCodeAt(n)}};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 r.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var r=[],i=0;i<c;++i)r[i]=new Worker(d);for(i=0;i<c;++i)r[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<r.length;++d)r[d].terminate();return a=!0,o(null,new n(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,n,r){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 n&&(o=n.millerRabinTests);var s=10;"maxBlockTime"in n&&(s=n.maxBlockTime),c(i,e,t,0,o,s,r)}function c(e,t,n,o,s,a,u){var h=+new Date;do{if(e.bitLength()>t&&(e=l(t,n)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-h<a);r.util.setImmediate((function(){c(e,t,n,o,s,a,u)}))}function l(e,t){var r=new n(e,t),i=e-1;return r.testBit(i)||r.bitwiseTo(n.ONE.shiftLeft(i),s,r),r.dAddOffset(31-r.mod(o).byteValue(),0),r}}()},6140:(e,t,n)=>{var r=n(392);n(3877);var i=null;!r.util.isNodejs||r.options.usePureJavaScript||process.versions["node-webkit"]||(i=n(5819)),(e.exports=r.prng=r.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,o=new Array(32),s=0;s<32;++s)o[s]=n.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 n=1,r=0;r<32;++r)t.reseeds%n===0&&(e.update(t.pools[r].digest().getBytes()),t.pools[r].start()),n<<=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,n=r.util.globalScope,i=n.crypto||n.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var o=r.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,n){if(!n)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,a=t.plugin.formatSeed,l=r.util.createBuffer();t.key=null,function u(h){if(h)return n(h);if(l.length()>=e)return n(null,l.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return r.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var n=32-t.pools[0].messageLength<<5;t.seedFile(n,(function(n,r){if(n)return e(n);t.collect(r),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)),r.util.setImmediate(u)}()},t.generateSync=function(e){var n=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=r.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var l=n(t.key,t.seed);t.generated+=l.length,c.putBytes(l),t.key=o(n(t.key,i(t.seed))),t.seed=s(n(t.key,t.seed))}return c.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,n){if(e)return t(e);t(null,n.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(n){t(n)}},t.seedFileSync=l),t.collect=function(e){for(var n=e.length,r=0;r<n;++r)t.pools[t.pool].update(e.substr(r,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,n){for(var r="",i=0;i<n;i+=8)r+=String.fromCharCode(e>>i&255);t.collect(r)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(n){var r=n.data;r.forge&&r.forge.prng&&(self.removeEventListener("message",e),t(r.forge.prng.err,r.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(n){var r=n.data;r.forge&&r.forge.prng&&t.seedFile(r.forge.prng.needed,(function(t,n){e.postMessage({forge:{prng:{err:t,bytes:n}}})}))}))}},t}},3860:(e,t,n)=>{var r=n(392);n(8605),n(7404),n(6140),n(3877),r.random&&r.random.getBytes?e.exports=r.random:function(t){var n={},i=new Array(4),o=r.util.createBuffer();function s(){var e=r.prng.create(n);return e.getBytes=function(t,n){return e.generate(t,n)},e.getBytesSync=function(t){return e.generate(t)},e}n.formatKey=function(e){var t=r.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),r.aes._expandKey(e,!1)},n.formatSeed=function(e){var t=r.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},n.cipher=function(e,t){return r.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=r.md.sha256;var a=s(),c=null,l=r.util.globalScope,u=l.crypto||l.msCrypto;if(u&&u.getRandomValues&&(c=function(e){return u.getRandomValues(e)}),r.options.usePureJavaScript||!r.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(r.random)for(var d in a)r.random[d]=a[d];else r.random=a;r.random.createInstance=s,e.exports=r.random}("undefined"!==typeof jQuery?jQuery:null)},654:(e,t,n)=>{var r=n(392);n(3877);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=r.rc2=r.rc2||{},r.rc2.expandKey=function(e,t){"string"===typeof e&&(e=r.util.createBuffer(e)),t=t||128;var n,o=e,s=e.length(),a=t,c=Math.ceil(a/8),l=255>>(7&a);for(n=s;n<128;n++)o.putByte(i[o.at(n-1)+o.at(n-s)&255]);for(o.setAt(128-c,i[o.at(128-c)&l]),n=127-c;n>=0;n--)o.setAt(n,i[o.at(n+1)^o.at(n+c)]);return o};var c=function(e,t,n){var i,c,l,u,h=!1,d=null,f=null,p=null,g=[];for(e=r.rc2.expandKey(e,t),l=0;l<64;l++)g.push(e.getInt16Le());n?(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 r=d.getInt16Le();null!==p&&(n?r^=p.getInt16Le():p.putInt16Le(r)),t.push(65535&r)}u=n?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&&(n?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=r.util.createBuffer(e)),h=!1,d=r.util.createBuffer(),f=t||new r.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(n)if(e)t=e(8,d,!n);else{var r=8===d.length()?8:8-d.length();d.fillWithByte(r,r)}if(t&&(h=!0,m.update()),!n&&(t=0===d.length()))if(e)t=e(8,f,!n);else{var i=f.length(),o=f.at(i-1);o>i?t=!1:f.truncate(o)}return t}}};r.rc2.startEncrypting=function(e,t,n){var i=r.rc2.createEncryptionCipher(e,128);return i.start(t,n),i},r.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},r.rc2.startDecrypting=function(e,t,n){var i=r.rc2.createDecryptionCipher(e,128);return i.start(t,n),i},r.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},5493:(e,t,n)=>{var r=n(392);if(n(5049),n(3055),n(2886),n(2627),n(5132),n(3860),n(3877),"undefined"===typeof i)var i=r.jsbn.BigInteger;var o=r.util.isNodejs?n(5819):null,s=r.asn1,a=r.util;r.pki=r.pki||{},e.exports=r.pki.rsa=r.rsa=r.rsa||{};var c=r.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=r.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 n=new Error("Unknown message digest algorithm.");throw n.algorithm=e.algorithm,n}t=c.oids[e.algorithm];var r=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,r)),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,n){if(n)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(r.util.bytesToHex(r.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,n){var i=r.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(n);var a,c=o-3-e.length;if(0===n||1===n){a=0===n?0:255;for(var l=0;l<c;++l)i.putByte(a)}else for(;c>0;){var u=0,h=r.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,n,i){var o=Math.ceil(t.n.bitLength()/8),s=r.util.createBuffer(e),a=s.getByte(),c=s.getByte();if(0!==a||n&&0!==c&&1!==c||!n&&2!=c||n&&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 n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0===(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128===(128&n.charCodeAt(1)))?n.substr(1):n}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 r.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=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}c.rsa.encrypt=function(e,t,n){var o,s=n,a=Math.ceil(t.n.bitLength()/8);!1!==n&&!0!==n?(s=2===n,o=m(e,t,n)):(o=r.util.createBuffer()).putBytes(e);for(var c=new i(o.toHex(),16),l=y(c,t,s).toString(16),u=r.util.createBuffer(),h=a-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(r.util.hexToBytes(l)),u.getBytes()},c.rsa.decrypt=function(e,t,n,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(r.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=y(c,t,n).toString(16),u=r.util.createBuffer(),h=s-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(r.util.hexToBytes(l)),!1!==o?v(u.getBytes(),t,n):u.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,n){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(n=n||{}).prng||r.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),n=0;n<e.length;++n)e[n]=t.charCodeAt(n)}},c=n.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 n=new i(null);n.fromInt(30);for(var r,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(n).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+=(r=+new Date)-a,a=r}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,n,l){if(1===arguments.length?"object"===typeof e?(n=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&&(n=t,t=void 0):(n=e,l=t,e=void 0,t=void 0):3===arguments.length&&("number"===typeof t?"function"===typeof n&&(l=n,n=void 0):(l=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&!n.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,n){if(e)return l(e);l(null,{privateKey:c.privateKeyFromPem(n),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(r.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,n=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=c.privateKeyFromAsn1(s.fromDer(r.util.createBuffer(t)));l(null,{privateKey:n,publicKey:c.setRsaPublicKey(n.n,n.e)})},n.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,n);if(!l)return c.rsa.stepKeyPairGenerationState(d,0),d.keys;!function(e,t,n){"function"===typeof t&&(n=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,r){return t?n(t):(e.p=r,null!==e.q?l(t,e.q):void a(e.qBits,l))}))}function a(e,t){r.prime.generateProbablePrime(e,o,t)}function l(t,r){if(t)return n(t);if(e.q=r,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)},n(null,e.keys)}s()}(d,n,l)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var n={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,n){return m(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.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,n,!0);return c.rsa.encrypt(o,n,!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,n,!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!==r.oids.md2&&u!==r.oids.md5&&u!==r.oids.sha1&&u!==r.oids.sha224&&u!==r.oids.sha256&&u!==r.oids.sha384&&u!==r.oids.sha512&&u!==r.oids["sha512-224"]&&u!==r.oids["sha512-256"])throw(l=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,l;if((u===r.oids.md2||u===r.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,n,!0))}});var a=c.rsa.decrypt(t,n,!0,!1);return i.verify(e,a,n.n.bitLength())}};return n},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,n,i,o,s,a,l){var u={n:e,e:t,d:n,p:i,q:o,dP:s,dQ:a,qInv:l,decrypt:function(e,t,n){"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 r.pkcs1.decode_rsa_oaep(t,e,n)}};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 n=!1;"string"===typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:g},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,u.n.bitLength());return c.rsa.encrypt(r,u,n)}};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,n,o,a,l,d,f,p,g={},y=[];if(s.validate(e,u,g,y)&&(e=s.fromDer(r.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=r.util.createBuffer(g.privateKeyModulus).toHex(),n=r.util.createBuffer(g.privateKeyPublicExponent).toHex(),o=r.util.createBuffer(g.privateKeyPrivateExponent).toHex(),a=r.util.createBuffer(g.privateKeyPrime1).toHex(),l=r.util.createBuffer(g.privateKeyPrime2).toHex(),d=r.util.createBuffer(g.privateKeyExponent1).toHex(),f=r.util.createBuffer(g.privateKeyExponent2).toHex(),p=r.util.createBuffer(g.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(n,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={},n=[];if(s.validate(e,f,t,n)){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(n=[],!s.validate(e,d,t,n))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=n,o;var l=r.util.createBuffer(t.publicKeyModulus).toHex(),u=r.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))])}},928:(e,t,n)=>{var r=n(392);n(29),n(3877);var i=e.exports=r.sha1=r.sha1||{};r.md.sha1=r.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=r.util.createBuffer(),n=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 n=i.messageLengthSize/4,o=0;o<n;++o)i.fullMessageLength.push(0);return t=r.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=r.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,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.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,n,s);var f=r.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,n){for(var r,i,o,s,a,c,l,u=n.length();u>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)r=n.getInt32(),t[l]=r,r=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+r,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;l<20;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+r,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;l<32;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(i<<5|i>>>27)+(o^s^a)+c+1859775393+r,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;l<40;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(i<<5|i>>>27)+(o^s^a)+c+1859775393+r,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;l<60;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(i<<5|i>>>27)+(o&s|a&(o^s))+c+2400959708+r,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;for(;l<80;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(i<<5|i>>>27)+(o^s^a)+c+3395469782+r,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=r;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}}},7404:(e,t,n)=>{var r=n(392);n(29),n(3877);var i=e.exports=r.sha256=r.sha256||{};r.md.sha256=r.md.algorithms.sha256=i,i.create=function(){s||(o=String.fromCharCode(128),o+=r.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=r.util.createBuffer(),n=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 n=i.messageLengthSize/4,o=0;o<n;++o)i.fullMessageLength.push(0);return t=r.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=r.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,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=r.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,n,s);var f=r.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,n){for(var r,i,o,s,c,l,u,h,d,f,p,g,y,m=n.length();m>=64;){for(c=0;c<16;++c)t[c]=n.getInt32();for(;c<64;++c)r=((r=t[c-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=r+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),r=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+r>>>0,d=h,h=u,u=l,l=r+(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}}},4770:(e,t,n)=>{var r=n(392);n(29),n(3877);var i=e.exports=r.sha512=r.sha512||{};r.md.sha512=r.md.algorithms.sha512=i;var o=r.sha384=r.sha512.sha384=r.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},r.md.sha384=r.md.algorithms.sha384=o,r.sha512.sha256=r.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},r.md["sha512/256"]=r.md.algorithms["sha512/256"]=r.sha512.sha256,r.sha512.sha224=r.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},r.md["sha512/224"]=r.md.algorithms["sha512/224"]=r.sha512.sha224,i.create=function(e){if(a||(s=String.fromCharCode(128),s+=r.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],n=null,i=r.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=r.util.createBuffer(),n=new Array(t.length);for(o=0;o<t.length;++o)n[o]=t[o].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=r.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(n,o,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=r.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(n.length);for(h=0;h<n.length;++h)d[h]=n[h].slice(0);u(d,o,t);var p,g=r.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,n){for(var r,i,o,s,a,l,u,h,d,f,p,g,y,m,v,b,w,E,_,S,A,k,T,I,C,R,x,P,D,N,O,B,L,M=n.length();M>=128;){for(x=0;x<16;++x)t[x][0]=n.getInt32()>>>0,t[x][1]=n.getInt32()>>>0;for(;x<80;++x)r=(((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=(B=t[x-15])[0])>>>1|(D=B[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],L=t[x-16],D=i+O[1]+s+L[1],t[x][0]=r+O[0]+o+L[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],T=e[6][0],I=e[6][1],C=e[7][0],R=e[7][1],x=0;x<80;++x)u=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,h=(T^_&(A^T))>>>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=R+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((I^S&(k^I))>>>0)+c[x][1]+t[x][1],r=C+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,C=T,R=I,T=A,I=k,A=_,k=S,_=w+r+((D=E+i)/4294967296>>>0)>>>0,S=D>>>0,w=v,E=b,v=y,b=m,y=p,m=g,p=r+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]+I,e[6][0]=e[6][0]+T+(D/4294967296>>>0)>>>0,e[6][1]=D>>>0,D=e[7][1]+R,e[7][0]=e[7][0]+C+(D/4294967296>>>0)>>>0,e[7][1]=D>>>0,M-=128}}},3877:(e,t,n)=>{var r=n(392),i=n(5754),o=e.exports=r.util=r.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(r){for(var n=0;n<t.length;++n)this.putByte(t[n])}}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(n){t.push(n),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(n){if(n.source===window&&n.data===e){n.stopPropagation();var r=t.slice();t.length=0,r.forEach((function(e){e()}))}}),!0)}if("undefined"!==typeof MutationObserver){var n=Date.now(),r=!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()-n>15?(n=Date.now(),s(e)):(t.push(e),1===t.length&&i.setAttribute("a",r=!r))}}o.nextTick=o.setImmediate}(),o.isNodejs="undefined"!==typeof process&&process.versions&&process.versions.node,o.globalScope=o.isNodejs?n.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 n=this.data;t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return this.data=n,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 n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},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),n=2<<e-2;return t>=n&&(t-=n<<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 n=this.data.charCodeAt(t);n<16&&(e+="0"),e+=n.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 n=o.isArrayBuffer(e),r=o.isArrayBufferView(e);if(n||r)return this.data=n?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 n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.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 n=0;n<t;++n)this.data.setUint8(e);return this},o.DataBuffer.prototype.putBytes=function(e,t){if(o.isArrayBufferView(e)){var n=(r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-r.byteOffset;return this.accommodate(n),new Uint8Array(this.data.buffer,this.write).set(r),this.write+=n,this}if(o.isArrayBuffer(e)){var r=new Uint8Array(e);return this.accommodate(r.byteLength),new Uint8Array(this.data.buffer).set(r,this.write),this.write+=r.byteLength,this}if(e instanceof o.DataBuffer||"object"===typeof e&&"number"===typeof e.read&&"number"===typeof e.write&&o.isArrayBufferView(e.data)){r=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(r.byteLength),new Uint8Array(e.data.byteLength,this.write).set(r),this.write+=r.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),n=2<<e-2;return t>=n&&(t-=n<<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 n=this.data.getUint8(t);n<16&&(e+="0"),e+=n.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 n="";t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return n},o.xorBytes=function(e,t,n){for(var r="",i="",o="",s=0,a=0;n>0;--n,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(r+=o,o="",a=0),o+=String.fromCharCode(i),++a;return r+=o},o.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n<e.length;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,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 n,r,i,o="",s="",a=0;a<e.length;)n=e.charCodeAt(a++),r=e.charCodeAt(a++),i=e.charCodeAt(a++),o+=c.charAt(n>>2),o+=c.charAt((3&n)<<4|r>>4),isNaN(r)?o+="==":(o+=c.charAt((15&r)<<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,n,r,i,o="",s=0;s<e.length;)t=l[e.charCodeAt(s++)-43],n=l[e.charCodeAt(s++)-43],r=l[e.charCodeAt(s++)-43],i=l[e.charCodeAt(s++)-43],o+=String.fromCharCode(t<<2|n>>4),64!==r&&(o+=String.fromCharCode((15&n)<<4|r>>2),64!==i&&(o+=String.fromCharCode((3&r)<<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,n){var r=t;r||(r=new Uint8Array(e.length));for(var i=n=n||0,o=0;o<e.length;++o)r[i++]=e.charCodeAt(o);return t?i-n:r},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2)));var i=0,o=n=n||0;for(1&e.length&&(i=1,r[o++]=parseInt(e[0],16));i<e.length;i+=2)r[o++]=parseInt(e.substr(i,2),16);return t?o-n:r},o.binary.base64.encode=function(e,t){for(var n,r,i,o="",s="",a=0;a<e.byteLength;)n=e[a++],r=e[a++],i=e[a++],o+=c.charAt(n>>2),o+=c.charAt((3&n)<<4|r>>4),isNaN(r)?o+="==":(o+=c.charAt((15&r)<<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,n){var r,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=n=n||0;c<e.length;)r=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++]=r<<2|i>>4,64!==o&&(a[u++]=(15&i)<<4|o>>2,64!==s&&(a[u++]=(3&o)<<6|s));return t?u-n: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,n){e=o.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length));for(var i=n=n||0,s=0;s<e.length;++s)r[i++]=e.charCodeAt(s);return t?i-n:r},o.text.utf8.decode=function(e){return o.decodeUtf8(String.fromCharCode.apply(null,e))},o.text.utf16.encode=function(e,t,n){var r=t;r||(r=new Uint8Array(2*e.length));for(var i=new Uint16Array(r.buffer),o=n=n||0,s=n,a=0;a<e.length;++a)i[s++]=e.charCodeAt(a),o+=2;return t?o-n:r},o.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},o.deflate=function(e,t,n){if(t=o.decode64(e.deflate(o.encode64(t)).rval),n){var r=2;32&t.charCodeAt(1)&&(r=6),t=t.substring(r,t.length-4)}return t},o.inflate=function(e,t,n){var r=e.inflate(o.encode64(t)).rval;return null===r?null:o.decode64(r)};var h=function(e,t,n){if(!e)throw new Error("WebStorage not available.");var r;if(null===n?r=e.removeItem(t):(n=o.encode64(JSON.stringify(n)),r=e.setItem(t,n)),"undefined"!==typeof r&&!0!==r.rval){var i=new Error(r.error.message);throw i.id=r.error.id,i.name=r.error.name,i}},d=function(e,t){if(!e)throw new Error("WebStorage not available.");var n=e.getItem(t);if(e.init)if(null===n.rval){if(n.error){var r=new Error(n.error.message);throw r.id=n.error.id,r.name=n.error.name,r}n=null}else n=n.rval;return null!==n&&(n=JSON.parse(o.decode64(n))),n},f=function(e,t,n,r){var i=d(e,t);null===i&&(i={}),i[n]=r,h(e,t,i)},p=function(e,t,n){var r=d(e,t);return null!==r&&(r=n in r?r[n]:null),r},g=function(e,t,n){var r=d(e,t);if(null!==r&&n in r){delete r[n];var i=!0;for(var o in r){i=!1;break}i&&(r=null),h(e,t,r)}},y=function(e,t){h(e,t,null)},m=function(e,t,n){var r,i=null;"undefined"===typeof n&&(n=["web","flash"]);var o=!1,s=null;for(var a in n){r=n[a];try{if("flash"===r||"both"===r){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),o="flash"===r}"web"!==r&&"both"!==r||(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,n,r,i){m(f,arguments,i)},o.getItem=function(e,t,n,r){return m(p,arguments,r)},o.removeItem=function(e,t,n,r){m(g,arguments,r)},o.clearItems=function(e,t,n){m(y,arguments,n)},o.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},o.format=function(e){for(var t,n,r=/%./g,i=0,o=[],s=0;t=r.exec(e);){(n=e.substring(s,r.lastIndex-2)).length>0&&o.push(n),s=r.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,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===n?",":n,a=void 0===r?".":r,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(),n=0;n<e.length;++n){var r=parseInt(e[n],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()},o.bytesFromIPv6=function(e){for(var t=0,n=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),r=o.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var s=o.hexToBytes(e[i]);s.length<2&&r.putByte(0),r.putBytes(s)}else r.fillWithByte(0,n),n=0;return r.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=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t.join(".")},o.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],n=[],r=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=n[n.length-1],c=t.length;a&&c===a.end+1?(a.end=c,a.end-a.start>n[r].end-n[r].start&&(r=n.length-1)):n.push({start:c,end:c})}t.push(s)}if(n.length>0){var l=n[r];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 n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),n=t+4;Date.now()<n;);self.postMessage({st:t,et:n})}))}.toString(),")()"],{type:"application/javascript"}));!function e(r,i,s){if(0===i){var a=Math.floor(r.reduce((function(e,t){return e+t}),0)/r.length);return o.cores=Math.max(1,a),URL.revokeObjectURL(n),t(null,o.cores)}!function(e,t){for(var r=[],i=[],o=0;o<e;++o){var s=new Worker(n);s.addEventListener("message",(function(n){if(i.push(n.data),i.length===e){for(var o=0;o<e;++o)r[o].terminate();t(null,i)}})),r.push(s)}for(o=0;o<e;++o)r[o].postMessage(o)}(s,(function(t,n){r.push(function(e,t){for(var n=[],r=0;r<e;++r)for(var i=t[r],o=n[r]=[],s=0;s<e;++s)if(r!==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 n.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,n)),e(r,i-1,s)}))}([],5,16)}},1725:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,i){for(var o,s,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var l in o=Object(arguments[c]))n.call(o,l)&&(a[l]=o[l]);if(t){s=t(o);for(var u=0;u<s.length;u++)r.call(o,s[u])&&(a[s[u]]=o[s[u]])}}return a}},888:(e,t,n)=>{"use strict";var r=n(9047);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},2007:(e,t,n)=>{e.exports=n(888)()},9047:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},886:(e,t,n)=>{"use strict";e.exports=n(4722)},4722:(e,t,n)=>{"use strict";var r=t;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(7063),r.BufferWriter=n(2815),r.Reader=n(6216),r.BufferReader=n(3557),r.util=n(3097),r.rpc=n(9994),r.roots=n(7907),r.configure=i,i()},6216:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(3097),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},3557:(e,t,n)=>{"use strict";e.exports=o;var r=n(6216);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(3097);function o(e){r.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()},7907:e=>{"use strict";e.exports={}},9994:(e,t,n)=>{"use strict";t.Service=n(4281)},4281:(e,t,n)=>{"use strict";e.exports=i;var r=n(3097);function i(e,t,n){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null!==n){if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}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}},9351:(e,t,n)=>{"use strict";e.exports=i;var r=n(3097);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},3097:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(9351),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},7063:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(3097),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},2815:(e,t,n)=>{"use strict";e.exports=o;var r=n(7063);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(3097);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},7310:(e,t,n)=>{"use strict";e.exports=n(3641)},506:e=>{"use strict";e.exports=r;var t,n=/\/|\./;function r(e,t){n.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),r[e]=t}r("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),r("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),r("timestamp",{Timestamp:t}),r("empty",{Empty:{fields:{}}}),r("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),r("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),r("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),r.get=function(e){return r[e]||null}},4176:(e,t,n)=>{"use strict";var r=t,i=n(9200),o=n(7159);function s(e,t,n,r){var o=!1;if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",r);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}',r,r,r),t.repeated||e("break"),o=!0),e("case%j:",a[c])("case %i:",s[a[c]])("m%s=%j",r,s[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',r)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",r,n,r);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",r,r);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",r,r);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",r,r);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",r,r,l)('else if(typeof d%s==="string")',r)("m%s=parseInt(d%s,10)",r,r)('else if(typeof d%s==="number")',r)("m%s=d%s",r,r)('else if(typeof d%s==="object")',r)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",r,r,r,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',r)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",r,r,r)("else if(d%s.length >= 0)",r)("m%s=d%s",r,r);break;case"string":e("m%s=String(d%s)",r,r);break;case"bool":e("m%s=Boolean(d%s)",r,r)}}return e}function a(e,t,n,r){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",r,n,r,r,n,r,r):e("d%s=types[%i].toObject(m%s,o)",r,n,r);else{var o=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",r,r,r,r);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',r)("d%s=o.longs===String?String(m%s):m%s",r,r,r)("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",r,r,r,r,o?"true":"",r);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",r,r,r,r,r);break;default:e("d%s=m%s",r,r)}}return e}r.fromObject=function(e){var t=e.fieldsArray,n=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return n("return new this.ctor");n("var m=new this.ctor");for(var r=0;r<t.length;++r){var a=t[r].resolve(),c=o.safeProp(a.name);a.map?(n("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(n,a,r,c+"[ks[i]]")("}")("}")):a.repeated?(n("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(n,a,r,c+"[i]")("}")("}")):(a.resolvedType instanceof i||n("if(d%s!=null){",c),s(n,a,r,c),a.resolvedType instanceof i||n("}"))}return n("return m")},r.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);if(!t.length)return o.codegen()("return {}");for(var n=o.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),r=[],s=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?r:t[l].map?s:c).push(t[l]);if(r.length){for(n("if(o.arrays||o.defaults){"),l=0;l<r.length;++l)n("d%s=[]",o.safeProp(r[l].name));n("}")}if(s.length){for(n("if(o.objects||o.defaults){"),l=0;l<s.length;++l)n("d%s={}",o.safeProp(s[l].name));n("}")}if(c.length){for(n("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],h=o.safeProp(u.name);if(u.resolvedType instanceof i)n("d%s=o.enums===String?%j:%j",h,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)n("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(",")+"]";n("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 n("d%s=%j",h,u.typeDefault)}n("}")}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,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(n,u,p,h+"[ks2[j]]")("}")):u.repeated?(n("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(n,u,p,h+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",h,u.name),a(n,u,p,h),u.partOf&&n("if(o.oneofs)")("d%s=%j",o.safeProp(u.partOf.name),u.name)),n("}")}return n("return d")}},2327:(e,t,n)=>{"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 n=0;n<e.fieldsArray.length;++n){var a=e._fieldsArray[n].resolve(),c=a.resolvedType instanceof r?"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())",n):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,n):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,n):t("%s=r.%s()",l,c),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),n=0;n<e._fieldsArray.length;++n){var u=e._fieldsArray[n];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",s(u))}return t("return m")};var r=n(9200),i=n(2688),o=n(7159);function s(e){return"missing required '"+e.name+"'"}},2067:(e,t,n)=>{"use strict";e.exports=function(e){for(var t,n=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 r?"int32":l.type,d=i.basic[h];t="m"+o.safeProp(l.name),l.map?(n("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?n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):n(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),n("}")("}")):l.repeated?(n("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==i.packed[h]?n("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()"):(n("for(var i=0;i<%s.length;++i)",t),void 0===d?s(n,l,u,t+"[i]"):n("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,h,t)),n("}")):(l.optional&&n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?s(n,l,u,t):n("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,h,t))}return n("return w")};var r=n(9200),i=n(2688),o=n(7159);function s(e,t,n,r){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",n,r,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",n,r,(t.id<<3|2)>>>0)}},9200:(e,t,n)=>{"use strict";e.exports=s;var r=n(8871);((s.prototype=Object.create(r.prototype)).constructor=s).className="Enum";var i=n(4226),o=n(7159);function s(e,t,n,i,o,s){if(r.call(this,e,n),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 n=new s(e,t.values,t.options,t.comment,t.comments);return n.reserved=t.reserved,n},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,n,r){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 r&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=r||null),this.comments[e]=n||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)}},8771:(e,t,n)=>{"use strict";e.exports=l;var r=n(8871);((l.prototype=Object.create(r.prototype)).constructor=l).className="Field";var i,o=n(9200),s=n(2688),a=n(7159),c=/^required|optional|repeated$/;function l(e,t,n,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),r.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(n))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=n,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[n],this.bytes="bytes"===n,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,n){return"packed"===e&&(this._packed=null),r.prototype.setOption.call(this,e,t,n)},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),r.prototype.resolve.call(this)},l.d=function(e,t,n,r){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,n,{default:r}))}},l._configure=function(e){i=e}},1324:(e,t,n)=>{"use strict";var r=e.exports=n(5656);r.build="light",r.load=function(e,t,n){return"function"===typeof t?(n=t,t=new r.Root):t||(t=new r.Root),t.load(e,n)},r.loadSync=function(e,t){return t||(t=new r.Root),t.loadSync(e)},r.encoder=n(2067),r.decoder=n(2327),r.verifier=n(4196),r.converter=n(4176),r.ReflectionObject=n(8871),r.Namespace=n(4226),r.Root=n(5998),r.Enum=n(9200),r.Type=n(3936),r.Field=n(8771),r.OneOf=n(6604),r.MapField=n(4483),r.Service=n(9730),r.Method=n(5762),r.Message=n(4375),r.wrappers=n(8003),r.types=n(2688),r.util=n(7159),r.ReflectionObject._configure(r.Root),r.Namespace._configure(r.Type,r.Service,r.Enum),r.Root._configure(r.Type),r.Field._configure(r.Type)},5656:(e,t,n)=>{"use strict";var r=t;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(1748),r.BufferWriter=n(4080),r.Reader=n(95),r.BufferReader=n(8418),r.util=n(7469),r.rpc=n(2328),r.roots=n(1858),r.configure=i,i()},3641:(e,t,n)=>{"use strict";var r=e.exports=n(1324);r.build="full",r.tokenize=n(4794),r.parse=n(3924),r.common=n(506),r.Root._configure(r.Type,r.parse,r.common)},4483:(e,t,n)=>{"use strict";e.exports=s;var r=n(8771);((s.prototype=Object.create(r.prototype)).constructor=s).className="MapField";var i=n(2688),o=n(7159);function s(e,t,n,i,s,a){if(r.call(this,e,t,i,void 0,void 0,s,a),!o.isString(n))throw TypeError("keyType must be a string");this.keyType=n,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 r.prototype.resolve.call(this)},s.d=function(e,t,n){return"function"===typeof n?n=o.decorateType(n).name:n&&"object"===typeof n&&(n=o.decorateEnum(n).name),function(r,i){o.decorateType(r.constructor).add(new s(i,e,t,n))}}},4375:(e,t,n)=>{"use strict";e.exports=i;var r=n(7469);function i(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)this[t[n]]=e[t[n]]}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,r.toJSONOptions)}},5762:(e,t,n)=>{"use strict";e.exports=o;var r=n(8871);((o.prototype=Object.create(r.prototype)).constructor=o).className="Method";var i=n(7159);function o(e,t,n,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(n))throw TypeError("requestType must be a string");if(!i.isString(o))throw TypeError("responseType must be a string");r.call(this,e,c),this.type=t||"rpc",this.requestType=n,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),r.prototype.resolve.call(this))}},4226:(e,t,n)=>{"use strict";e.exports=h;var r=n(8871);((h.prototype=Object.create(r.prototype)).constructor=h).className="Namespace";var i,o,s,a=n(8771),c=n(7159),l=n(6604);function u(e,t){if(e&&e.length){for(var n={},r=0;r<e.length;++r)n[e[r].name]=e[r].toJSON(t);return n}}function h(e,t){r.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 n=0;n<e.length;++n)if("string"!==typeof e[n]&&e[n][0]<=t&&e[n][1]>t)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var n=0;n<e.length;++n)if(e[n]===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,n=Object.keys(e),r=0;r<n.length;++r)t=e[n[r]],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)(n[r],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 n=t.nestedArray,r=0;r<n.length;++r)e.add(n[r]);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 r))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 n=this;e.length>0;){var r=e.shift();if(n.nested&&n.nested[r]){if(!((n=n.nested[r])instanceof h))throw Error("path conflicts with non-namespace objects")}else n.add(n=new h(r))}return t&&n.addJSON(t),n},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,n){if("boolean"===typeof t?(n=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 r=this.get(e[0]);if(r){if(1===e.length){if(!t||t.indexOf(r.constructor)>-1)return r}else if(r instanceof h&&(r=r.lookup(e.slice(1),t,!0)))return r}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof h&&(r=this._nestedArray[i].lookup(e,t,!0)))return r;return null===this.parent||n?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,n){i=e,o=t,s=n}},8871:(e,t,n)=>{"use strict";e.exports=o,o.className="ReflectionObject";var r,i=n(7159);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 r&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof r&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof r&&(this.resolved=!0),this},o.prototype.getOption=function(e){if(this.options)return this.options[e]},o.prototype.setOption=function(e,t,n){return n&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.prototype.setParsedOption=function(e,t,n){this.parsedOptions||(this.parsedOptions=[]);var r=this.parsedOptions;if(n){var o=r.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(o){var s=o[e];i.setProperty(s,n,t)}else(o={})[e]=i.setProperty({},n,t),r.push(o)}else{var a={};a[e]=t,r.push(a)}return this},o.prototype.setOptions=function(e,t){if(e)for(var n=Object.keys(e),r=0;r<n.length;++r)this.setOption(n[r],e[n[r]],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){r=e}},6604:(e,t,n)=>{"use strict";e.exports=s;var r=n(8871);((s.prototype=Object.create(r.prototype)).constructor=s).className="OneOf";var i=n(8771),o=n(7159);function s(e,t,n,i){if(Array.isArray(t)||(n=t,t=void 0),r.call(this,e,n),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){r.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var n=e.get(this.oneof[t]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}a(this)},s.prototype.onRemove=function(e){for(var t,n=0;n<this.fieldsArray.length;++n)(t=this.fieldsArray[n]).parent&&t.parent.remove(t);r.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,n){o.decorateType(t.constructor).add(new s(n,e)),Object.defineProperty(t,n,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}}},3924:(e,t,n)=>{"use strict";e.exports=A,A.filename=null,A.defaults={keepCase:!1};var r=n(4794),i=n(5998),o=n(3936),s=n(8771),a=n(4483),c=n(6604),l=n(9200),u=n(9730),h=n(5762),d=n(2688),f=n(7159),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,n){t instanceof i||(n=t,t=new i),n||(n=A.defaults);var k,T,I,C,R,x=n.preferTrailingComment||!1,P=r(e,n.alternateCommentMode||!1),D=P.next,N=P.push,O=P.peek,B=P.skip,L=P.cmnt,M=!0,U=!1,F=t,j=n.keepCase?function(e){return e}:f.camelCase;function z(e,t,n){var r=A.filename;return n||(A.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(r?r+", ":"")+"line "+P.line+")")}function K(){var e,t=[];do{if('"'!==(e=D())&&"'"!==e)throw z(e);t.push(D()),B(e),e=O()}while('"'===e||"'"===e);return t.join("")}function q(e){var t=D();switch(t){case"'":case'"':return N(t),K();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var n=1;"-"===e.charAt(0)&&(n=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return n*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(e))return n*parseInt(e,10);if(y.test(e))return n*parseInt(e,16);if(v.test(e))return n*parseInt(e,8);if(w.test(e))return n*parseFloat(e);throw z(e,"number",t)}(t,!0)}catch(n){if(e&&_.test(t))return t;throw z(t,"value")}}function V(e,t){var n,r;do{!t||'"'!==(n=O())&&"'"!==n?e.push([r=H(D()),B("to",!0)?H(D()):r]):e.push(K())}while(B(",",!0));B(";")}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),B(";")}function G(){var e,t=O();switch(t){case"weak":e=I||(I=[]),D();break;case"public":D();default:e=T||(T=[])}t=K(),B(";"),e.push(t)}function $(){if(B("="),C=K(),!(U="proto3"===C)&&"proto2"!==C)throw z(C,"syntax");B(";")}function Y(e,t){switch(t){case"option":return ee(e,t),B(";"),!0;case"message":return X(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 n=new u(t);Q(n,(function(e){if(!Y(n,e)){if("rpc"!==e)throw z(e);!function(e,t){var n=L(),r=t;if(!E.test(t=D()))throw z(t,"name");var i,o,s,a,c=t;B("("),B("stream",!0)&&(o=!0);if(!_.test(t=D()))throw z(t);i=t,B(")"),B("returns"),B("("),B("stream",!0)&&(a=!0);if(!_.test(t=D()))throw z(t);s=t,B(")");var l=new h(c,r,i,s,o,a);l.comment=n,Q(l,(function(e){if("option"!==e)throw z(e);ee(l,e),B(";")})),e.add(l)}(n,e)}})),e.add(n)}(e,t),!0;case"extend":return function(e,t){if(!_.test(t=D()))throw z(t,"reference");var n=t;Q(null,(function(t){switch(t){case"required":case"repeated":J(e,t,n);break;case"optional":J(e,U?"proto3_optional":"optional",n);break;default:if(!U||!_.test(t))throw z(t);N(t),J(e,"optional",n)}}))}(e,t),!0}return!1}function Q(e,t,n){var r=P.line;if(e&&("string"!==typeof e.comment&&(e.comment=L()),e.filename=A.filename),B("{",!0)){for(var i;"}"!==(i=D());)t(i);B(";",!0)}else n&&n(),B(";"),e&&("string"!==typeof e.comment||x)&&(e.comment=L(r)||e.comment)}function X(e,t){if(!E.test(t=D()))throw z(t,"type name");var n=new o(t);Q(n,(function(e){if(!Y(n,e))switch(e){case"map":!function(e){B("<");var t=D();if(void 0===d.mapKey[t])throw z(t,"type");B(",");var n=D();if(!_.test(n))throw z(n,"type");B(">");var r=D();if(!E.test(r))throw z(r,"name");B("=");var i=new a(j(r),H(D()),t,n);Q(i,(function(e){if("option"!==e)throw z(e);ee(i,e),B(";")}),(function(){re(i)})),e.add(i)}(n);break;case"required":case"repeated":J(n,e);break;case"optional":J(n,U?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!E.test(t=D()))throw z(t,"name");var n=new c(j(t));Q(n,(function(e){"option"===e?(ee(n,e),B(";")):(N(e),J(n,"optional"))})),e.add(n)}(n,e);break;case"extensions":V(n.extensions||(n.extensions=[]));break;case"reserved":V(n.reserved||(n.reserved=[]),!0);break;default:if(!U||!_.test(e))throw z(e);N(e),J(n,"optional")}})),e.add(n)}function J(e,t,n){var r=D();if("group"!==r){if(!_.test(r))throw z(r,"type");var i=D();if(!E.test(i))throw z(i,"name");i=j(i),B("=");var a=new s(i,H(D()),r,t,n);if(Q(a,(function(e){if("option"!==e)throw z(e);ee(a,e),B(";")}),(function(){re(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[r]&&void 0!==d.basic[r]||a.setOption("packed",!1,!0)}else!function(e,t){var n=D();if(!E.test(n))throw z(n,"name");var r=f.lcFirst(n);n===r&&(n=f.ucFirst(n));B("=");var i=H(D()),a=new o(n);a.group=!0;var c=new s(r,i,n,t);c.filename=A.filename,Q(a,(function(e){switch(e){case"option":ee(a,e),B(";");break;case"required":case"repeated":J(a,e);break;case"optional":J(a,U?"proto3_optional":"optional");break;case"message":X(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 n=new l(t);Q(n,(function(e){switch(e){case"option":ee(n,e),B(";");break;case"reserved":V(n.reserved||(n.reserved=[]),!0);break;default:!function(e,t){if(!E.test(t))throw z(t,"name");B("=");var n=H(D(),!0),r={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Q(r,(function(e){if("option"!==e)throw z(e);ee(r,e),B(";")}),(function(){re(r)})),e.add(t,n,r.comment,r.options)}(n,e)}})),e.add(n)}function ee(e,t){var n=B("(",!0);if(!_.test(t=D()))throw z(t,"name");var r,i=t,o=i;n&&(B(")"),o=i="("+i+")",t=O(),S.test(t)&&(r=t.slice(1),i+=t,D())),B("="),function(e,t,n,r){e.setParsedOption&&e.setParsedOption(t,n,r)}(e,o,te(e,i),r)}function te(e,t){if(B("{",!0)){for(var n={};!B("}",!0);){if(!E.test(R=D()))throw z(R,"name");var r,i=R;if(B(":",!0),"{"===O())r=te(e,t+"."+R);else if("["===O()){var o;if(r=[],B("[",!0)){do{o=q(!0),r.push(o)}while(B(",",!0));B("]"),"undefined"!==typeof o&&ne(e,t+"."+R,o)}}else r=q(!0),ne(e,t+"."+R,r);var s=n[i];s&&(r=[].concat(s).concat(r)),n[i]=r,B(",",!0),B(";",!0)}return n}var a=q(!0);return ne(e,t,a),a}function ne(e,t,n){e.setOption&&e.setOption(t,n)}function re(e){if(B("[",!0)){do{ee(e,"option")}while(B(",",!0));B("]")}return e}for(;null!==(R=D());)switch(R){case"package":if(!M)throw z(R);W();break;case"import":if(!M)throw z(R);G();break;case"syntax":if(!M)throw z(R);$();break;case"option":ee(F,R),B(";");break;default:if(Y(F,R)){M=!1;continue}throw z(R)}return A.filename=null,{package:k,imports:T,weakImports:I,syntax:C,root:t}}},95:(e,t,n)=>{"use strict";e.exports=c;var r,i=n(7469),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 r(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)|0},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,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},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){r=e,c.create=u(),r._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)}})}},8418:(e,t,n)=>{"use strict";e.exports=o;var r=n(95);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(7469);function o(e){r.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()},5998:(e,t,n)=>{"use strict";e.exports=h;var r=n(4226);((h.prototype=Object.create(r.prototype)).constructor=h).className="Root";var i,o,s,a=n(8771),c=n(9200),l=n(6604),u=n(7159);function h(e){r.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,n,r){"function"===typeof n&&(r=n,n=void 0);var i=this;if(!r)return u.asPromise(e,i,t,n);var a=r===d;function c(e,t){if(r){var n=r;if(r=null,a)throw e;n(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var n=e.substring(t);if(n in s)return n}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 r,s=o(t,i,n),h=0;if(s.imports)for(;h<s.imports.length;++h)(r=l(s.imports[h])||i.resolvePath(e,s.imports[h]))&&f(r);if(s.weakImports)for(h=0;h<s.weakImports.length;++h)(r=l(s.weakImports[h])||i.resolvePath(e,s.weakImports[h]))&&f(r,!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 n;try{n=u.fs.readFileSync(e).toString("utf8")}catch(o){return void(t||c(o))}h(e,n)}else++p,i.fetch(e,(function(n,o){--p,r&&(n?t?p||c(null,i):c(n):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 r.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var n=t.parent.lookup(t.extend);if(n){var r=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.get(r.name)||(r.declaringField=t,t.extensionField=r,n.add(r)),!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 n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);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 r){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);f.test(e.name)&&delete e.parent[e.name]}},h._configure=function(e,t,n){i=e,o=t,s=n}},1858:e=>{"use strict";e.exports={}},2328:(e,t,n)=>{"use strict";t.Service=n(8103)},8103:(e,t,n)=>{"use strict";e.exports=i;var r=n(7469);function i(e,t,n){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,n,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return r.asPromise(e,a,t,n,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null!==n){if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}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}},9730:(e,t,n)=>{"use strict";e.exports=a;var r=n(4226);((a.prototype=Object.create(r.prototype)).constructor=a).className="Service";var i=n(5762),o=n(7159),s=n(2328);function a(e,t){r.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var n=new a(e,t.options);if(t.methods)for(var r=Object.keys(t.methods),o=0;o<r.length;++o)n.add(i.fromJSON(r[o],t.methods[r[o]]));return t.nested&&n.addJSON(t.nested),n.comment=t.comment,n},a.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||void 0,"methods",r.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",n?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]||r.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return r.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)):r.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 r.prototype.remove.call(this,e)},a.prototype.create=function(e,t,n){for(var r,i=new s.Service(e,t,n),a=0;a<this.methodsArray.length;++a){var c=o.lcFirst((r=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:r,q:r.resolvedRequestType.ctor,s:r.resolvedResponseType.ctor})}return i}},4794:e=>{"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,n=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,r=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/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,n,r){var a,l={type:e.charAt(t++),lineEmpty:!1,leading:r},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,n).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 n=E(t),r=e.substring(t,n);return/^\s*\/{1,2}/.test(r)}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?r:n;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)){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 n=A();if(n===e)return _(),!0;if(!t)throw m("token '"+n+"', '"+e+"' expected");return!1},cmnt:function(e){var t,n=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(c||"*"===t.type||t.lineEmpty)&&(n=t.leading?t.text:null)):(f<e&&A(),t=p[e],delete p[e],!t||t.lineEmpty||!c&&"/"!==t.type||(n=t.leading?null:t.text)),n}},"line",{get:function(){return d}})}h.unescape=u},3936:(e,t,n)=>{"use strict";e.exports=v;var r=n(4226);((v.prototype=Object.create(r.prototype)).constructor=v).className="Type";var i=n(9200),o=n(6604),s=n(8771),a=n(4483),c=n(9730),l=n(4375),u=n(95),h=n(1748),d=n(7159),f=n(2067),p=n(2327),g=n(4196),y=n(4176),m=n(8003);function v(e,t){r.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 n=this.fields[e[t]],r=n.id;if(this._fieldsById[r])throw Error("duplicate id "+r+" in "+this);this._fieldsById[r]=n}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 n=0;n<this.fieldsArray.length;++n)this._fieldsArray[n].resolve();var r={};for(n=0;n<this.oneofsArray.length;++n)r[this._oneofsArray[n].resolve().name]={get:d.oneOfGetter(this._oneofsArray[n].oneof),set:d.oneOfSetter(this._oneofsArray[n].oneof)};n&&Object.defineProperties(e.prototype,r)}}}),v.generateConstructor=function(e){for(var t,n=d.codegen(["p"],e.name),r=0;r<e.fieldsArray.length;++r)(t=e._fieldsArray[r]).map?n("this%s={}",d.safeProp(t.name)):t.repeated&&n("this%s=[]",d.safeProp(t.name));return n("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 n=new v(e,t.options);n.extensions=t.extensions,n.reserved=t.reserved;for(var l=Object.keys(t.fields),u=0;u<l.length;++u)n.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)n.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]];n.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:r.fromJSON)(l[u],h))}return t.extensions&&t.extensions.length&&(n.extensions=t.extensions),t.reserved&&t.reserved.length&&(n.reserved=t.reserved),t.group&&(n.group=!0),t.comment&&(n.comment=t.comment),n},v.prototype.toJSON=function(e){var t=r.prototype.toJSON.call(this,e),n=!!e&&Boolean(e.keepComments);return d.toObject(["options",t&&t.options||void 0,"oneofs",r.arrayToJSON(this.oneofsArray,e),"fields",r.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",n?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var n=this.oneofsArray;for(t=0;t<n.length;)n[t++].resolve();return r.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)):r.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 r.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return r.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return r.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],n=0;n<this.fieldsArray.length;++n)t.push(this._fieldsArray[n].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 r=m[e];if(r){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=r.fromObject.bind(i),i.toObject=this.toObject,this.toObject=r.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)}}},2688:(e,t,n)=>{"use strict";var r=t,i=n(7159),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var n=0,r={};for(t|=0;n<e.length;)r[o[n+t]]=e[n++];return r}r.basic=s([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),r.defaults=s([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),r.long=s([0,0,0,1,1],7),r.mapKey=s([0,0,0,5,5,0,0,0,1,1,0,2],2),r.packed=s([1,5,0,0,0,5,5,0,0,0,1,1,0])},7159:(e,t,n)=>{"use strict";var r,i,o=e.exports=n(7469),s=n(1858);o.codegen=n(3297),o.fetch=n(7635),o.path=n(7468),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),n=new Array(t.length),r=0;r<t.length;)n[r]=e[t[r++]];return n}return[]},o.toObject=function(e){for(var t={},n=0;n<e.length;){var r=e[n++],i=e[n++];void 0!==i&&(t[r]=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;r||(r=n(3936));var i=new r(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=n(9200));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,n){if("object"!==typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,n,r){var i=n.shift();if("__proto__"===i)return t;if(n.length>0)t[i]=e(t[i]||{},n,r);else{var o=t[i];o&&(r=[].concat(o).concat(r)),t[i]=r}return t}(e,t=t.split("."),n)},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(n(5998)))}})},1537:(e,t,n)=>{"use strict";e.exports=i;var r=n(7469);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 n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(r.isString(e)){if(!r.Long)return i.fromNumber(parseInt(e,10));e=r.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,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return r.Long?new r.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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},7469:function(e,t,n){"use strict";var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}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}r.asPromise=n(7206),r.base64=n(1),r.EventEmitter=n(7111),r.float=n(802),r.inquire=n(7172),r.utf8=n(3861),r.pool=n(8236),r.LongBits=n(1537),r.isNode=Boolean("undefined"!==typeof n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),r.global=r.isNode&&n.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"===typeof e||e instanceof String},r.isObject=function(e){return e&&"object"===typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!==typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"===typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=o,r.ProtocolError=o("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}},4196:(e,t,n)=>{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),n=e.oneofsArray,r={};n.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===r[l.partOf.name]&&t("if(p%s===1)",h)("return%j",l.partOf.name+": multiple values"),r[l.partOf.name]=1,t("p%s=1",h)}s(t,l,c,u)}l.optional&&t("}")}return t("return null")};var r=n(9200),i=n(7159);function o(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function s(e,t,n,i){if(t.resolvedType)if(t.resolvedType instanceof r){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);",n,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,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",o(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",o(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",o(t,"boolean key"))}return e}},8003:(e,t,n)=>{"use strict";var r=t,i=n(4375);r[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),n=this.lookup(t);if(n){var r="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===r.indexOf("/")&&(r="/"+r),this.create({type_url:r,value:n.encode(n.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var n="",r="";if(t&&t.json&&e.type_url&&e.value){r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var o=this.lookup(r);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var s=e.$type.toObject(e,t);return""===n&&(n="type.googleapis.com/"),r=n+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=r,s}return this.toObject(e,t)}}},1748:(e,t,n)=>{"use strict";e.exports=h;var r,i=n(7469),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}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 r})()}:function(){return new h}};function f(e,t,n){t[n]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function y(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+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,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=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,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=h.alloc(t=s.length(e));s.decode(e,n,0),e=n}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,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},h._configure=function(e){r=e,h.create=d(),r._configure()}},4080:(e,t,n)=>{"use strict";e.exports=o;var r=n(1748);(o.prototype=Object.create(r.prototype)).constructor=o;var i=n(7469);function o(){r.call(this)}function s(e,t,n){e.length<40?i.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}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,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var r=0;r<e.length;)t[n++]=e[r++]}},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()},7896:(e,t,n)=>{const r=n(8139),i=n(5339),o=n(4052),s=n(3654),{RateLimiterClusterMaster:a,RateLimiterClusterMasterPM2:c,RateLimiterCluster:l}=n(5503),u=n(2408),h=n(8134),d=n(5e3),f=n(4066),p=n(3081),g=n(438),y=n(4819);e.exports={RateLimiterRedis:r,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}},438:(e,t,n)=>{const r=n(4819);e.exports=class{constructor(e,t){this._rateLimiter=e,this._burstLimiter=t}_combineRes(e,t){return e?new r(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,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._rateLimiter.consume(e,t,n).catch((i=>i instanceof r?this._burstLimiter.consume(e,t,n).then((e=>Promise.resolve(this._combineRes(i,e)))).catch((e=>e instanceof r?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,n]=e;return this._combineRes(t,n)}))}get points(){return this._rateLimiter.points}}},5e3:(e,t,n)=>{const r=n(4819);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 r(0,Number.MAX_SAFE_INTEGER,0,!1)}getWhiteRes(){return new r(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,n=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,n):(this.runActionAnyway&&this.limiter.consume(e,n).catch((()=>{})),t)}block(e,t){let n;return this.isWhiteListedSomewhere(e)?n=this.resolveWhite():this.isBlackListedSomewhere(e)&&(n=this.resolveBlack()),"undefined"===typeof n?this.limiter.block(e,t):(this.runActionAnyway&&this.limiter.block(e,t).catch((()=>{})),n)}penalty(e,t){let n;return this.isWhiteListedSomewhere(e)?n=this.resolveWhite():this.isBlackListedSomewhere(e)&&(n=this.resolveBlack()),"undefined"===typeof n?this.limiter.penalty(e,t):(this.runActionAnyway&&this.limiter.penalty(e,t).catch((()=>{})),n)}reward(e,t){let n;return this.isWhiteListedSomewhere(e)?n=this.resolveWhite():this.isBlackListedSomewhere(e)&&(n=this.resolveBlack()),"undefined"===typeof n?this.limiter.reward(e,t):(this.runActionAnyway&&this.limiter.reward(e,t).catch((()=>{})),n)}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)}}},8855: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'!")}}},5503:(e,t,n)=>{const r=n(1265),i=n(5539),o=n(8855),s=n(2408),a=n(4819),c="rate_limiter_flexible";let l=null;const u=function(e,t,n,r){let i;i=null===r||!0===r||!1===r?r:{remainingPoints:r.remainingPoints,msBeforeNext:r.msBeforeNext,consumedPoints:r.consumedPoints,isFirstInDuration:r.isFirstInDuration},e.send({channel:c,keyPrefix:t.keyPrefix,promiseId:t.promiseId,type:n,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,n,r,i){const o={channel:c,keyPrefix:this.keyPrefix,func:e,promiseId:t,data:{key:n,arg:r,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 n;switch(t.func){case"consume":n=this._rateLimiters[t.keyPrefix].consume(t.data.key,t.data.arg,t.data.opts);break;case"penalty":n=this._rateLimiters[t.keyPrefix].penalty(t.data.key,t.data.arg,t.data.opts);break;case"reward":n=this._rateLimiters[t.keyPrefix].reward(t.data.key,t.data.arg,t.data.opts);break;case"block":n=this._rateLimiters[t.keyPrefix].block(t.data.key,t.data.arg,t.data.opts);break;case"get":n=this._rateLimiters[t.keyPrefix].get(t.data.key,t.data.opts);break;case"delete":n=this._rateLimiters[t.keyPrefix].delete(t.data.key,t.data.opts);break;default:return!1}n&&n.then((n=>{u(e,t,"resolve",n)})).catch((n=>{u(e,t,"reject",n)}))},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 n=process.hrtime();let r=n[0].toString()+n[1].toString();return"undefined"!==typeof this._promises[r]&&(r+=i.randomBytes(12).toString("base64")),this._promises[r]={resolve:e,reject:t,timeoutId:setTimeout((()=>{delete this._promises[r],t(new Error("RateLimiterCluster timeout: no answer from master in time"))}),this.timeoutMs)},r};e.exports={RateLimiterClusterMaster:class{constructor(){if(l)return l;this._rateLimiters={},r.setMaxListeners(0),r.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,n)=>{n.on("process:msg",(t=>{const n=t.raw;if(n&&n.channel===c&&"init"===n.type)"undefined"===typeof this._rateLimiters[n.opts.keyPrefix]&&(this._rateLimiters[n.opts.keyPrefix]=new s(n.opts)),e.sendDataToProcessId(t.process.pm_id,{data:{},topic:c,channel:c,type:"init",keyPrefix:n.opts.keyPrefix},((e,t)=>{e&&console.log(e,t)}));else{f.call(this,{send:n=>{const r=n;r.topic=c,"undefined"===typeof r.data&&(r.data={}),e.sendDataToProcessId(t.process.pm_id,r,((e,t)=>{e&&console.log(e,t)}))}},n)}}))})),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,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,i)=>{const o=y.call(this,r,i);d.call(this,"consume",o,e,t,n)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,i)=>{const o=y.call(this,r,i);d.call(this,"penalty",o,e,t,n)}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,i)=>{const o=y.call(this,r,i);d.call(this,"reward",o,e,t,n)}))}block(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,i)=>{const o=y.call(this,r,i);d.call(this,"block",o,e,t,n)}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const i=y.call(this,n,r);d.call(this,"get",i,e,t)}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,r)=>{const i=y.call(this,n,r);d.call(this,"delete",i,e,t)}))}}}},8134:(e,t,n)=>{const r=n(1434),i=n(4819);e.exports=class extends r{constructor(e){super(e),this.client=e.storeClient}_getRateLimiterRes(e,t,n){const r=new i;return r.consumedPoints=parseInt(n.consumedPoints),r.isFirstInDuration=n.consumedPoints===t,r.remainingPoints=Math.max(this.points-r.consumedPoints,0),r.msBeforeNext=n.msBeforeNext,r}_upsert(e,t,n){let r=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(n/1e3);r?this.client.set(e,t,c,(n=>{n?s(n):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,n,r,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,n={consumedPoints:u,msBeforeNext:e>=0?Math.max(e-a,0):-1};o(n)}}))}))}))}_get(e){return new Promise(((t,n)=>{const r=Date.now();this.client.get(e,((i,o)=>{o?this.client.get("".concat(e,"_expire"),((e,i)=>{if(e)n(e);else{const e=!1===i?0:i,n={consumedPoints:o,msBeforeNext:e>=0?Math.max(e-r,0):-1};t(n)}})):t(null)}))}))}_delete(e){return new Promise(((t,n)=>{this.client.del(e,((r,i)=>{r?n(r):!1===i?t(i):this.client.del("".concat(e,"_expire"),(e=>{e?n(e):t(i)}))}))}))}}},2408:(e,t,n)=>{const r=n(8855),i=n(4327),o=n(4819);e.exports=class extends r{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,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,i)=>{const o=this.getKey(e),s=this._getKeySecDuration(n);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(r,e,a)}else r(a)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(n),o=this._memoryStorage.incrby(r,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,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(n),o=this._memoryStorage.incrby(r,-t,i);o.remainingPoints=Math.max(this.points-o.consumedPoints,0),e(o)}))}block(e,t){const n=1e3*t,r=this.points+1;return this._memoryStorage.set(this.getKey(e),r,t),Promise.resolve(new o(0,0===n?-1:n,r))}set(e,t,n){const r=1e3*(n>=0?n:this.duration);return this._memoryStorage.set(this.getKey(e),t,n),Promise.resolve(new o(0,0===r?-1:r,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)))}}},5339:(e,t,n)=>{const r=n(1434),i=n(4819);function o(e){try{const t=e.client?e.client:e,{version:n}=t.topology.s.options.metadata.driver,r=n.split(".").map((e=>parseInt(e)));return{major:r[0],feature:r[1],patch:r[2]}}catch(t){return{major:0,feature:0,patch:0}}}class s extends r{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,n){const r=new i;let o;return o="undefined"===typeof n.value?n:n.value,r.isFirstInDuration=o.points===t,r.consumedPoints=o.points,r.remainingPoints=Math.max(this.points-r.consumedPoints,0),r.msBeforeNext=null!==o.expire?Math.max(new Date(o.expire).getTime()-Date.now(),0):-1,r}_upsert(e,t,n){let r=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;r?(s={key:e},s=Object.assign(s,o),a={$set:{key:e,points:t,expire:n>0?new Date(Date.now()+n):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:n>0?new Date(Date.now()+n):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:n>0?new Date(Date.now()+n):null},o)};this._collection.findOneAndUpdate(s,a,c).then((e=>{i(e)})).catch((o=>{o&&11e3===o.code?this._upsert(e,t,n,r).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 n=t.attrs||{},r=Object.assign({key:e,$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}]},n);return this._collection.findOne(r)}_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 n=t.attrs||{},r=Object.assign({key:e},n);return this._collection.deleteOne(r).then((e=>e.deletedCount>0))}}e.exports=s},4052:(e,t,n)=>{const r=n(1434),i=n(4819);e.exports=class extends r{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((n=>{n.query("DELETE FROM ??.?? WHERE expire < ?",[this.dbName,this.tableName,e],(()=>{this._releaseConnection(n),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(((n,r)=>{if(n)return t(n);e(r)}))}));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((n=>{n.query("CREATE DATABASE IF NOT EXISTS `".concat(this.dbName,"`;"),(r=>{if(r)return this._releaseConnection(n),t(r);n.query(this._getCreateTableStmt(),(r=>{if(r)return this._releaseConnection(n),t(r);this._releaseConnection(n),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,n){const r=new i,[o]=n;return r.isFirstInDuration=t===o.points,r.consumedPoints=r.isFirstInDuration?t:o.points,r.remainingPoints=Math.max(this.points-r.consumedPoints,0),r.msBeforeNext=o.expire?Math.max(o.expire-Date.now(),0):-1,r}_upsertTransaction(e,t,n,r,i){return new Promise(((o,s)=>{e.query("BEGIN",(a=>{if(a)return e.rollback(),s(a);const c=Date.now(),l=r>0?c+r:null;let u,h;i?(u="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = ?, \n expire = ?;",h=[this.dbName,this.tableName,t,n,l,n,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,n,l,c,n,n,c,l]),e.query(u,h,(n=>{if(n)return e.rollback(),s(n);e.query("SELECT points, expire FROM ??.?? WHERE `key` = ?;",[this.dbName,this.tableName,t],((t,n)=>{if(t)return e.rollback(),s(t);e.query("COMMIT",(t=>{if(t)return e.rollback(),s(t);o(n)}))}))}))}))}))}_upsert(e,t,n){let r=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,n,r).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,n)=>{this._getConnection().then((r=>{r.query("SELECT points, expire FROM ??.?? WHERE `key` = ? AND (`expire` > ? OR `expire` IS NULL)",[this.dbName,this.tableName,e,Date.now()],((e,i)=>{e?n(e):0===i.length?t(null):t(i),this._releaseConnection(r)}))})).catch((e=>{n(e)}))})):Promise.reject(Error("Table is not created yet"))}_delete(e){return this.tableCreated?new Promise(((t,n)=>{this._getConnection().then((r=>{r.query("DELETE FROM ??.?? WHERE `key` = ?",[this.dbName,this.tableName,e],((e,i)=>{e?n(e):t(i.affectedRows>0),this._releaseConnection(r)}))})).catch((e=>{n(e)}))})):Promise.reject(Error("Table is not created yet"))}}},3654:(e,t,n)=>{const r=n(1434),i=n(4819);e.exports=class extends r{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 n={name:"rlflx-clear-expired",text:"DELETE FROM ".concat(this.tableName," WHERE expire < $1"),values:[e]};this._query(n).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((n=>{"23505"===n.code?e():t(n)}))}))}_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,n){const r=new i,o=n.rows[0];return r.isFirstInDuration=t===o.points,r.consumedPoints=r.isFirstInDuration?t:o.points,r.remainingPoints=Math.max(this.points-r.consumedPoints,0),r.msBeforeNext=o.expire?Math.max(o.expire-Date.now(),0):-1,r}_query(e){const t=this.tableName.toLowerCase(),n={name:"".concat(t,":").concat(e.name),text:e.text,values:e.values};return new Promise(((e,t)=>{this._getConnection().then((r=>{r.query(n).then((t=>{e(t),this._releaseConnection(r)})).catch((e=>{t(e),this._releaseConnection(r)}))})).catch((e=>{t(e)}))}))}_upsert(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.tableCreated)return Promise.reject(Error("Table is not created yet"));const i=n>0?Date.now()+n:null,o=r?" $3 ":" CASE\n WHEN ".concat(this.tableName,".expire <= $4 THEN $3\n ELSE ").concat(this.tableName,".expire\n END ");return this._query({name:r?"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(r?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,n)=>{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=>{n(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"))}}},3081:(e,t,n)=>{const r=n(4688),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(((n,i)=>{e>t._limiterFlexible.points?i(new r("Requested tokens ".concat(e," exceeds maximum ").concat(t._limiterFlexible.points," tokens per interval"))):t._queue.length>0?t._queueRequest.call(t,n,i,e):t._limiterFlexible.consume(t._key,e).then((e=>{n(e.remainingPoints)})).catch((r=>{r instanceof Error?i(r):(t._queueRequest.call(t,n,i,e),null===t._waitTimeout&&(t._waitTimeout=setTimeout(t._processFIFO.bind(t),r.msBeforeNext)))}))}))}_queueRequest(e,t,n){const i=this;i._queue.length<i._maxQueueSize?i._queue.push({resolve:e,reject:t,tokens:n}):t(new r("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((n=>{t.resolve(n.remainingPoints),e._processFIFO.call(e)})).catch((n=>{n instanceof Error?(t.reject(n),e._processFIFO.call(e)):(e._queue.unshift(t),null===e._waitTimeout&&(e._waitTimeout=setTimeout(e._processFIFO.bind(e),n.msBeforeNext)))}))}}},8139:(e,t,n)=>{const r=n(1434),i=n(4819),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 r{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,n){let[r,o]=n;Array.isArray(r)&&([,r]=r,[,o]=o);const s=new i;return s.consumedPoints=parseInt(r),s.isFirstInDuration=s.consumedPoints===t,s.remainingPoints=Math.max(this.points-s.consumedPoints,0),s.msBeforeNext=o,s}_upsert(e,t,n){let r=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(n/1e3),c=this.client.multi();if(r)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 n=function(e,t){return e?s(e):i(t)};"function"===typeof this.client.rlflxIncr?this.client.rlflxIncr(e,t,a,n):this.client.eval(o,1,e,t,a,n)}else c.incrby(e,t).pttl(e).exec(((e,t)=>e?s(e):i(t)))}))}_get(e){return new Promise(((t,n)=>{if(!this._isRedisReady())return n(new Error("Redis connection is not ready"));this.client.multi().get(e).pttl(e).exec(((e,r)=>{if(e)n(e);else{const[e]=r;if(null===e)return t(null);t(r)}}))}))}_delete(e){return new Promise(((t,n)=>{this.client.del(e,((e,r)=>{e?n(e):t(r>0)}))}))}}},4819:e=>{e.exports=class{constructor(e,t,n,r){this.remainingPoints="undefined"===typeof e?0:e,this.msBeforeNext="undefined"===typeof t?0:t,this.consumedPoints="undefined"===typeof n?0:n,this.isFirstInDuration="undefined"!==typeof r&&r}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()}}},1434:(e,t,n)=>{const r=n(8855),i=n(6704),o=n(4819);e.exports=class extends r{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,n,r,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const s=this._getRateLimiterRes(n,r,i);if(this.inMemoryBlockOnConsumed>0&&!(this.inMemoryBlockDuration>0)&&s.consumedPoints>=this.inMemoryBlockOnConsumed)return this._inMemoryBlockedKeys.addMs(n,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+r&&(s.msBeforeNext=this.msBlockDuration,e=this._block(n,s.consumedPoints,this.msBlockDuration,o)),this.inMemoryBlockOnConsumed>0&&s.consumedPoints>=this.inMemoryBlockOnConsumed&&(this._inMemoryBlockedKeys.add(n,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,n,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 r?this.insuranceLimiter[t](o,s,a).then((e=>{n(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 r))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 n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=1e3*t;return this._block(this.getKey(e),this.points+1,r,n)}set(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=1e3*(n>=0?n:this.duration);return this._block(this.getKey(e),t,i,r)}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((r,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(n),!1,n).then((e=>{this._afterConsume(r,i,s,t,e)})).catch((o=>{this._handleError(o,"consume",r,i,e,t,n)}))}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getKey(e);return new Promise(((i,o)=>{this._upsert(r,t,1e3*this._getKeySecDuration(n),!1,n).then((e=>{i(this._getRateLimiterRes(r,t,e))})).catch((r=>{this._handleError(r,"penalty",i,o,e,t,n)}))}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=this.getKey(e);return new Promise(((i,o)=>{this._upsert(r,-t,1e3*this._getKeySecDuration(n),!1,n).then((e=>{i(this._getRateLimiterRes(r,-t,e))})).catch((r=>{this._handleError(r,"reward",i,o,e,t,n)}))}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getKey(e);return new Promise(((r,i)=>{this._get(n,t).then((e=>{r(null===e||"undefined"===typeof e?null:this._getRateLimiterRes(n,0,e))})).catch((n=>{this._handleError(n,"get",r,i,e,t)}))}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.getKey(e);return new Promise(((r,i)=>{this._delete(n,t).then((e=>{this._inMemoryBlockedKeys.delete(n),r(e)})).catch((n=>{this._handleError(n,"delete",r,i,e,t)}))}))}deleteInMemoryBlockedAll(){this._inMemoryBlockedKeys.delete()}_getRateLimiterRes(e,t,n){throw new Error("You have to implement the method '_getRateLimiterRes'!")}_block(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((i,s)=>{this._upsert(e,t,n,!0,r).then((()=>{i(new o(0,n>0?n:-1,t))})).catch((t=>{this._handleError(t,"block",i,s,this.parseKey(e),n/1e3,r)}))}))}_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,n){throw new Error("You have to implement the method '_upsert'!")}}},4066:(e,t,n)=>{const r=n(8855);e.exports=class{constructor(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t.length<1)throw new Error("RateLimiterUnion: at least one limiter have to be passed");t.forEach((e=>{if(!(e instanceof r))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(((n,r)=>{const i=[];this._limiters.forEach((n=>{i.push(n.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 n=0;n<e.length;n++)i&&!0===e[n].rejected?t[this._limiters[n].keyPrefix]=e[n].rej:i||(t[this._limiters[n].keyPrefix]=e[n]);i?r(t):n(t)}))}))}}},9682: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]}))}}},6704:(e,t,n)=>{const r=n(9682);e.exports=r},4327:(e,t,n)=>{const r=n(9359),i=n(4819);e.exports=class{constructor(){this._storage={}}incrby(e,t,n){if(this._storage[e]){const r=this._storage[e].expiresAt?this._storage[e].expiresAt.getTime()-(new Date).getTime():-1;return 0!==r?(this._storage[e].value=this._storage[e].value+t,new i(0,r,this._storage[e].value,!1)):this.set(e,t,n)}return this.set(e,t,n)}set(e,t,n){const o=1e3*n;return this._storage[e]&&this._storage[e].timeoutId&&clearTimeout(this._storage[e].timeoutId),this._storage[e]=new r(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)}}},9359:e=>{e.exports=class{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.value=e,this.expiresAt=t,this.timeoutId=n}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}}},4688: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)}}},4463:(e,t,n)=>{"use strict";var r=n(2791),i=n(1725),o=n(5296);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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."}if(!r)throw Error(s(227));var a=new Set,c={};function l(e,t){u(e,t),u(e+"Capture",t)}function u(e,t){for(c[e]=t,e=0;e<t.length;e++)a.add(t[e])}var h=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),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=Object.prototype.hasOwnProperty,p={},g={};function y(e,t,n,r,i,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var m={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){m[e]=new y(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];m[t]=new y(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){m[e]=new y(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){m[e]=new y(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){m[e]=new y(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){m[e]=new y(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){m[e]=new y(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){m[e]=new y(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){m[e]=new y(e,5,!1,e.toLowerCase(),null,!1,!1)}));var v=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}function w(e,t,n,r){var i=m.hasOwnProperty(t)?m[t]:null;(null!==i?0===i.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.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,n,i,r)&&(n=null),r||null===i?function(e){return!!f.call(g,e)||!f.call(p,e)&&(d.test(e)?g[e]=!0:(p[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"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(v,b);m[t]=new y(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(v,b);m[t]=new y(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(v,b);m[t]=new y(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){m[e]=new y(e,1,!1,e.toLowerCase(),null,!1,!1)})),m.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){m[e]=new y(e,1,!1,e.toLowerCase(),null,!0,!0)}));var E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_=60103,S=60106,A=60107,k=60108,T=60114,I=60109,C=60110,R=60112,x=60113,P=60120,D=60115,N=60116,O=60121,B=60128,L=60129,M=60130,U=60131;if("function"===typeof Symbol&&Symbol.for){var F=Symbol.for;_=F("react.element"),S=F("react.portal"),A=F("react.fragment"),k=F("react.strict_mode"),T=F("react.profiler"),I=F("react.provider"),C=F("react.context"),R=F("react.forward_ref"),x=F("react.suspense"),P=F("react.suspense_list"),D=F("react.memo"),N=F("react.lazy"),O=F("react.block"),F("react.scope"),B=F("react.opaque.id"),L=F("react.debug_trace_mode"),M=F("react.offscreen"),U=F("react.legacy_hidden")}var j,z="function"===typeof Symbol&&Symbol.iterator;function K(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=z&&e[z]||e["@@iterator"])?e:null}function q(e){if(void 0===j)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);j=t&&t[1]||""}return"\n"+j+e}var V=!1;function H(e,t){if(!e||V)return"";V=!0;var n=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(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&"string"===typeof c.stack){for(var i=c.stack.split("\n"),o=r.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])return"\n"+i[s].replace(" at new "," at ")}while(1<=s&&0<=a);break}}}finally{V=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?q(e):""}function W(e){switch(e.tag){case 5:return q(e.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return e=H(e.type,!1);case 11:return e=H(e.type.render,!1);case 22:return e=H(e.type._render,!1);case 1:return e=H(e.type,!0);default:return""}}function G(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 A:return"Fragment";case S:return"Portal";case T:return"Profiler";case k:return"StrictMode";case x:return"Suspense";case P: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 t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case D:return G(e.type);case O:return G(e._render);case N:t=e._payload,e=e._init;try{return G(e(t))}catch(n){}}return null}function $(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Y(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Q(e){e._valueTracker||(e._valueTracker=function(e){var t=Y(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function X(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Y(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function J(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 Z(e,t){var n=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function ee(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=$(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&w(e,"checked",t,!1)}function ne(e,t){te(e,t);var n=$(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ie(e,t.type,n):t.hasOwnProperty("defaultValue")&&ie(e,t.type,$(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function re(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ie(e,t,n){"number"===t&&J(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function oe(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function se(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+$(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function ae(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(s(91));return i({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ce(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(s(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(s(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:$(n)}}function le(e,t){var n=$(t.value),r=$(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ue(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var he={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function de(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 fe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?de(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var pe,ge,ye=(ge=function(e,t){if(e.namespaceURI!==he.svg||"innerHTML"in e)e.innerHTML=t;else{for((pe=pe||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=pe.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return ge(e,t)}))}:ge);function me(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ve={animationIterationCount:!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},be=["Webkit","ms","Moz","O"];function we(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||ve.hasOwnProperty(e)&&ve[e]?(""+t).trim():t+"px"}function Ee(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=we(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(ve).forEach((function(e){be.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ve[t]=ve[e]}))}));var _e=i({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 Se(e,t){if(t){if(_e[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(s(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(s(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(s(62))}}function Ae(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}}function ke(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Te=null,Ie=null,Ce=null;function Re(e){if(e=ni(e)){if("function"!==typeof Te)throw Error(s(280));var t=e.stateNode;t&&(t=ii(t),Te(e.stateNode,e.type,t))}}function xe(e){Ie?Ce?Ce.push(e):Ce=[e]:Ie=e}function Pe(){if(Ie){var e=Ie,t=Ce;if(Ce=Ie=null,Re(e),t)for(e=0;e<t.length;e++)Re(t[e])}}function De(e,t){return e(t)}function Ne(e,t,n,r,i){return e(t,n,r,i)}function Oe(){}var Be=De,Le=!1,Me=!1;function Ue(){null===Ie&&null===Ce||(Oe(),Pe())}function Fe(e,t){var n=e.stateNode;if(null===n)return null;var r=ii(n);if(null===r)return null;n=r[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":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!==typeof n)throw Error(s(231,t,typeof n));return n}var je=!1;if(h)try{var ze={};Object.defineProperty(ze,"passive",{get:function(){je=!0}}),window.addEventListener("test",ze,ze),window.removeEventListener("test",ze,ze)}catch(ge){je=!1}function Ke(e,t,n,r,i,o,s,a,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(u){this.onError(u)}}var qe=!1,Ve=null,He=!1,We=null,Ge={onError:function(e){qe=!0,Ve=e}};function $e(e,t,n,r,i,o,s,a,c){qe=!1,Ve=null,Ke.apply(Ge,arguments)}function Ye(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(1026&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Qe(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 Xe(e){if(Ye(e)!==e)throw Error(s(188))}function Je(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ye(e)))throw Error(s(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Xe(i),e;if(o===r)return Xe(i),t;o=o.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,c=i.child;c;){if(c===n){a=!0,n=i,r=o;break}if(c===r){a=!0,r=i,n=o;break}c=c.sibling}if(!a){for(c=o.child;c;){if(c===n){a=!0,n=o,r=i;break}if(c===r){a=!0,r=o,n=i;break}c=c.sibling}if(!a)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(3!==n.tag)throw Error(s(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Ze(e,t){for(var n=e.alternate;null!==t;){if(t===e||t===n)return!0;t=t.return}return!1}var et,tt,nt,rt,it=!1,ot=[],st=null,at=null,ct=null,lt=new Map,ut=new Map,ht=[],dt="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 ft(e,t,n,r,i){return{blockedOn:e,domEventName:t,eventSystemFlags:16|n,nativeEvent:i,targetContainers:[r]}}function pt(e,t){switch(e){case"focusin":case"focusout":st=null;break;case"dragenter":case"dragleave":at=null;break;case"mouseover":case"mouseout":ct=null;break;case"pointerover":case"pointerout":lt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ut.delete(t.pointerId)}}function gt(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e=ft(t,n,r,i,o),null!==t&&(null!==(t=ni(t))&&tt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function yt(e){var t=ti(e.target);if(null!==t){var n=Ye(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Qe(n)))return e.blockedOn=t,void rt(e.lanePriority,(function(){o.unstable_runWithPriority(e.priority,(function(){nt(n)}))}))}else if(3===t&&n.stateNode.hydrate)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function mt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=ni(n))&&tt(t),e.blockedOn=n,!1;t.shift()}return!0}function vt(e,t,n){mt(e)&&n.delete(t)}function bt(){for(it=!1;0<ot.length;){var e=ot[0];if(null!==e.blockedOn){null!==(e=ni(e.blockedOn))&&et(e);break}for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n){e.blockedOn=n;break}t.shift()}null===e.blockedOn&&ot.shift()}null!==st&&mt(st)&&(st=null),null!==at&&mt(at)&&(at=null),null!==ct&&mt(ct)&&(ct=null),lt.forEach(vt),ut.forEach(vt)}function wt(e,t){e.blockedOn===t&&(e.blockedOn=null,it||(it=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,bt)))}function Et(e){function t(t){return wt(t,e)}if(0<ot.length){wt(ot[0],e);for(var n=1;n<ot.length;n++){var r=ot[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==st&&wt(st,e),null!==at&&wt(at,e),null!==ct&&wt(ct,e),lt.forEach(t),ut.forEach(t),n=0;n<ht.length;n++)(r=ht[n]).blockedOn===e&&(r.blockedOn=null);for(;0<ht.length&&null===(n=ht[0]).blockedOn;)yt(n),null===n.blockedOn&&ht.shift()}function _t(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var St={animationend:_t("Animation","AnimationEnd"),animationiteration:_t("Animation","AnimationIteration"),animationstart:_t("Animation","AnimationStart"),transitionend:_t("Transition","TransitionEnd")},At={},kt={};function Tt(e){if(At[e])return At[e];if(!St[e])return e;var t,n=St[e];for(t in n)if(n.hasOwnProperty(t)&&t in kt)return At[e]=n[t];return e}h&&(kt=document.createElement("div").style,"AnimationEvent"in window||(delete St.animationend.animation,delete St.animationiteration.animation,delete St.animationstart.animation),"TransitionEvent"in window||delete St.transitionend.transition);var It=Tt("animationend"),Ct=Tt("animationiteration"),Rt=Tt("animationstart"),xt=Tt("transitionend"),Pt=new Map,Dt=new Map,Nt=["abort","abort",It,"animationEnd",Ct,"animationIteration",Rt,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",xt,"transitionEnd","waiting","waiting"];function Ot(e,t){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];i="on"+(i[0].toUpperCase()+i.slice(1)),Dt.set(r,t),Pt.set(r,i),l(i,[r])}}(0,o.unstable_now)();var Bt=8;function Lt(e){if(0!==(1&e))return Bt=15,1;if(0!==(2&e))return Bt=14,2;if(0!==(4&e))return Bt=13,4;var t=24&e;return 0!==t?(Bt=12,t):0!==(32&e)?(Bt=11,32):0!==(t=192&e)?(Bt=10,t):0!==(256&e)?(Bt=9,256):0!==(t=3584&e)?(Bt=8,t):0!==(4096&e)?(Bt=7,4096):0!==(t=4186112&e)?(Bt=6,t):0!==(t=62914560&e)?(Bt=5,t):67108864&e?(Bt=4,67108864):0!==(134217728&e)?(Bt=3,134217728):0!==(t=805306368&e)?(Bt=2,t):0!==(1073741824&e)?(Bt=1,1073741824):(Bt=8,e)}function Mt(e,t){var n=e.pendingLanes;if(0===n)return Bt=0;var r=0,i=0,o=e.expiredLanes,s=e.suspendedLanes,a=e.pingedLanes;if(0!==o)r=o,i=Bt=15;else if(0!==(o=134217727&n)){var c=o&~s;0!==c?(r=Lt(c),i=Bt):0!==(a&=o)&&(r=Lt(a),i=Bt)}else 0!==(o=n&~s)?(r=Lt(o),i=Bt):0!==a&&(r=Lt(a),i=Bt);if(0===r)return 0;if(r=n&((0>(r=31-qt(r))?0:1<<r)<<1)-1,0!==t&&t!==r&&0===(t&s)){if(Lt(t),i<=Bt)return t;Bt=i}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-qt(t)),r|=e[n],t&=~i;return r}function Ut(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Ft(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=jt(24&~t))?Ft(10,t):e;case 10:return 0===(e=jt(192&~t))?Ft(8,t):e;case 8:return 0===(e=jt(3584&~t))&&(0===(e=jt(4186112&~t))&&(e=512)),e;case 2:return 0===(t=jt(805306368&~t))&&(t=268435456),t}throw Error(s(358,e))}function jt(e){return e&-e}function zt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Kt(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-qt(t)]=n}var qt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Vt(e)/Ht|0)|0},Vt=Math.log,Ht=Math.LN2;var Wt=o.unstable_UserBlockingPriority,Gt=o.unstable_runWithPriority,$t=!0;function Yt(e,t,n,r){Le||Oe();var i=Xt,o=Le;Le=!0;try{Ne(i,e,t,n,r)}finally{(Le=o)||Ue()}}function Qt(e,t,n,r){Gt(Wt,Xt.bind(null,e,t,n,r))}function Xt(e,t,n,r){var i;if($t)if((i=0===(4&t))&&0<ot.length&&-1<dt.indexOf(e))e=ft(null,e,t,n,r),ot.push(e);else{var o=Jt(e,t,n,r);if(null===o)i&&pt(e,r);else{if(i){if(-1<dt.indexOf(e))return e=ft(o,e,t,n,r),void ot.push(e);if(function(e,t,n,r,i){switch(t){case"focusin":return st=gt(st,e,t,n,r,i),!0;case"dragenter":return at=gt(at,e,t,n,r,i),!0;case"mouseover":return ct=gt(ct,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return lt.set(o,gt(lt.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,ut.set(o,gt(ut.get(o)||null,e,t,n,r,i)),!0}return!1}(o,e,t,n,r))return;pt(e,r)}Or(e,t,r,null,n)}}}function Jt(e,t,n,r){var i=ke(r);if(null!==(i=ti(i))){var o=Ye(i);if(null===o)i=null;else{var s=o.tag;if(13===s){if(null!==(i=Qe(o)))return i;i=null}else if(3===s){if(o.stateNode.hydrate)return 3===o.tag?o.stateNode.containerInfo:null;i=null}else o!==i&&(i=null)}}return Or(e,t,r,i,n),null}var Zt=null,en=null,tn=null;function nn(){if(tn)return tn;var e,t,n=en,r=n.length,i="value"in Zt?Zt.value:Zt.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var s=r-e;for(t=1;t<=s&&n[r-t]===i[o-t];t++);return tn=i.slice(e,1<t?1-t:void 0)}function rn(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 on(){return!0}function sn(){return!1}function an(e){function t(t,n,r,i,o){for(var s in this._reactName=t,this._targetInst=r,this.type=n,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)?on:sn,this.isPropagationStopped=sn,this}return i(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=on)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=on)},persist:function(){},isPersistent:on}),t}var cn,ln,un,hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dn=an(hn),fn=i({},hn,{view:0,detail:0}),pn=an(fn),gn=i({},fn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:In,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!==un&&(un&&"mousemove"===e.type?(cn=e.screenX-un.screenX,ln=e.screenY-un.screenY):ln=cn=0,un=e),cn)},movementY:function(e){return"movementY"in e?e.movementY:ln}}),yn=an(gn),mn=an(i({},gn,{dataTransfer:0})),vn=an(i({},fn,{relatedTarget:0})),bn=an(i({},hn,{animationName:0,elapsedTime:0,pseudoElement:0})),wn=i({},hn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),En=an(wn),_n=an(i({},hn,{data:0})),Sn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},An={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"},kn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=kn[e])&&!!t[e]}function In(){return Tn}var Cn=i({},fn,{key:function(e){if(e.key){var t=Sn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=rn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?An[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:In,charCode:function(e){return"keypress"===e.type?rn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?rn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Rn=an(Cn),xn=an(i({},gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=an(i({},fn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:In})),Dn=an(i({},hn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Nn=i({},gn,{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}),On=an(Nn),Bn=[9,13,27,32],Ln=h&&"CompositionEvent"in window,Mn=null;h&&"documentMode"in document&&(Mn=document.documentMode);var Un=h&&"TextEvent"in window&&!Mn,Fn=h&&(!Ln||Mn&&8<Mn&&11>=Mn),jn=String.fromCharCode(32),zn=!1;function Kn(e,t){switch(e){case"keyup":return-1!==Bn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qn(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Vn=!1;var Hn={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 Wn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Hn[e.type]:"textarea"===t}function Gn(e,t,n,r){xe(r),0<(t=Lr(t,"onChange")).length&&(n=new dn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var $n=null,Yn=null;function Qn(e){Cr(e,0)}function Xn(e){if(X(ri(e)))return e}function Jn(e,t){if("change"===e)return t}var Zn=!1;if(h){var er;if(h){var tr="oninput"in document;if(!tr){var nr=document.createElement("div");nr.setAttribute("oninput","return;"),tr="function"===typeof nr.oninput}er=tr}else er=!1;Zn=er&&(!document.documentMode||9<document.documentMode)}function rr(){$n&&($n.detachEvent("onpropertychange",ir),Yn=$n=null)}function ir(e){if("value"===e.propertyName&&Xn(Yn)){var t=[];if(Gn(t,Yn,e,ke(e)),e=Qn,Le)e(t);else{Le=!0;try{De(e,t)}finally{Le=!1,Ue()}}}}function or(e,t,n){"focusin"===e?(rr(),Yn=n,($n=t).attachEvent("onpropertychange",ir)):"focusout"===e&&rr()}function sr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Xn(Yn)}function ar(e,t){if("click"===e)return Xn(t)}function cr(e,t){if("input"===e||"change"===e)return Xn(t)}var lr="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},ur=Object.prototype.hasOwnProperty;function hr(e,t){if(lr(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!ur.call(t,n[r])||!lr(e[n[r]],t[n[r]]))return!1;return!0}function dr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fr(e,t){var n,r=dr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=dr(r)}}function pr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?pr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function gr(){for(var e=window,t=J();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=J((e=t.contentWindow).document)}return t}function yr(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)}var mr=h&&"documentMode"in document&&11>=document.documentMode,vr=null,br=null,wr=null,Er=!1;function _r(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;Er||null==vr||vr!==J(r)||("selectionStart"in(r=vr)&&yr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},wr&&hr(wr,r)||(wr=r,0<(r=Lr(br,"onSelect")).length&&(t=new dn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=vr)))}Ot("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Ot("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Ot(Nt,2);for(var Sr="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Ar=0;Ar<Sr.length;Ar++)Dt.set(Sr[Ar],0);u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tr=new Set("cancel close invalid load scroll toggle".split(" ").concat(kr));function Ir(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,i,o,a,c,l){if($e.apply(this,arguments),qe){if(!qe)throw Error(s(198));var u=Ve;qe=!1,Ve=null,He||(He=!0,We=u)}}(r,t,void 0,e),e.currentTarget=null}function Cr(e,t){t=0!==(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],c=a.instance,l=a.currentTarget;if(a=a.listener,c!==o&&i.isPropagationStopped())break e;Ir(i,a,l),o=c}else for(s=0;s<r.length;s++){if(c=(a=r[s]).instance,l=a.currentTarget,a=a.listener,c!==o&&i.isPropagationStopped())break e;Ir(i,a,l),o=c}}}if(He)throw e=We,He=!1,We=null,e}function Rr(e,t){var n=oi(t),r=e+"__bubble";n.has(r)||(Nr(t,e,2,!1),n.add(r))}var xr="_reactListening"+Math.random().toString(36).slice(2);function Pr(e){e[xr]||(e[xr]=!0,a.forEach((function(t){Tr.has(t)||Dr(t,!1,e,null),Dr(t,!0,e,null)})))}function Dr(e,t,n,r){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=n;if("selectionchange"===e&&9!==n.nodeType&&(o=n.ownerDocument),null!==r&&!t&&Tr.has(e)){if("scroll"!==e)return;i|=2,o=r}var s=oi(o),a=e+"__"+(t?"capture":"bubble");s.has(a)||(t&&(i|=4),Nr(o,e,i,t),s.add(a))}function Nr(e,t,n,r){var i=Dt.get(t);switch(void 0===i?2:i){case 0:i=Yt;break;case 1:i=Qt;break;default:i=Xt}n=i.bind(null,t,n,e),i=void 0,!je||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Or(e,t,n,r,i){var o=r;if(0===(1&t)&&0===(2&t)&&null!==r)e:for(;;){if(null===r)return;var s=r.tag;if(3===s||4===s){var a=r.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===s)for(s=r.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=ti(a)))return;if(5===(c=s.tag)||6===c){r=o=s;continue e}a=a.parentNode}}r=r.return}!function(e,t,n){if(Me)return e(t,n);Me=!0;try{return Be(e,t,n)}finally{Me=!1,Ue()}}((function(){var r=o,i=ke(n),s=[];e:{var a=Pt.get(e);if(void 0!==a){var c=dn,l=e;switch(e){case"keypress":if(0===rn(n))break e;case"keydown":case"keyup":c=Rn;break;case"focusin":l="focus",c=vn;break;case"focusout":l="blur",c=vn;break;case"beforeblur":case"afterblur":c=vn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=yn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=mn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Pn;break;case It:case Ct:case Rt:c=bn;break;case xt:c=Dn;break;case"scroll":c=pn;break;case"wheel":c=On;break;case"copy":case"cut":case"paste":c=En;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=xn}var u=0!==(4&t),h=!u&&"scroll"===e,d=u?null!==a?a+"Capture":null:a;u=[];for(var f,p=r;null!==p;){var g=(f=p).stateNode;if(5===f.tag&&null!==g&&(f=g,null!==d&&(null!=(g=Fe(p,d))&&u.push(Br(p,g,f)))),h)break;p=p.return}0<u.length&&(a=new c(a,l,null,n,i),s.push({event:a,listeners:u}))}}if(0===(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||0!==(16&t)||!(l=n.relatedTarget||n.fromElement)||!ti(l)&&!l[Zr])&&(c||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,c?(c=r,null!==(l=(l=n.relatedTarget||n.toElement)?ti(l):null)&&(l!==(h=Ye(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=r),c!==l)){if(u=yn,g="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=xn,g="onPointerLeave",d="onPointerEnter",p="pointer"),h=null==c?a:ri(c),f=null==l?a:ri(l),(a=new u(g,p+"leave",c,n,i)).target=h,a.relatedTarget=f,g=null,ti(i)===r&&((u=new u(d,p+"enter",l,n,i)).target=f,u.relatedTarget=h,g=u),h=g,c&&l)e:{for(d=l,p=0,f=u=c;f;f=Mr(f))p++;for(f=0,g=d;g;g=Mr(g))f++;for(;0<p-f;)u=Mr(u),p--;for(;0<f-p;)d=Mr(d),f--;for(;p--;){if(u===d||null!==d&&u===d.alternate)break e;u=Mr(u),d=Mr(d)}u=null}else u=null;null!==c&&Ur(s,a,c,u,!1),null!==l&&null!==h&&Ur(s,h,l,u,!0)}if("select"===(c=(a=r?ri(r):window).nodeName&&a.nodeName.toLowerCase())||"input"===c&&"file"===a.type)var y=Jn;else if(Wn(a))if(Zn)y=cr;else{y=sr;var m=or}else(c=a.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(y=ar);switch(y&&(y=y(e,r))?Gn(s,y,n,i):(m&&m(e,a,r),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&ie(a,"number",a.value)),m=r?ri(r):window,e){case"focusin":(Wn(m)||"true"===m.contentEditable)&&(vr=m,br=r,wr=null);break;case"focusout":wr=br=vr=null;break;case"mousedown":Er=!0;break;case"contextmenu":case"mouseup":case"dragend":Er=!1,_r(s,n,i);break;case"selectionchange":if(mr)break;case"keydown":case"keyup":_r(s,n,i)}var v;if(Ln)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 Vn?Kn(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Fn&&"ko"!==n.locale&&(Vn||"onCompositionStart"!==b?"onCompositionEnd"===b&&Vn&&(v=nn()):(en="value"in(Zt=i)?Zt.value:Zt.textContent,Vn=!0)),0<(m=Lr(r,b)).length&&(b=new _n(b,e,null,n,i),s.push({event:b,listeners:m}),v?b.data=v:null!==(v=qn(n))&&(b.data=v))),(v=Un?function(e,t){switch(e){case"compositionend":return qn(t);case"keypress":return 32!==t.which?null:(zn=!0,jn);case"textInput":return(e=t.data)===jn&&zn?null:e;default:return null}}(e,n):function(e,t){if(Vn)return"compositionend"===e||!Ln&&Kn(e,t)?(e=nn(),tn=en=Zt=null,Vn=!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 Fn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Lr(r,"onBeforeInput")).length&&(i=new _n("onBeforeInput","beforeinput",null,n,i),s.push({event:i,listeners:r}),i.data=v))}Cr(s,t)}))}function Br(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Lr(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=Fe(e,n))&&r.unshift(Br(e,o,i)),null!=(o=Fe(e,t))&&r.push(Br(e,o,i))),e=e.return}return r}function Mr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Ur(e,t,n,r,i){for(var o=t._reactName,s=[];null!==n&&n!==r;){var a=n,c=a.alternate,l=a.stateNode;if(null!==c&&c===r)break;5===a.tag&&null!==l&&(a=l,i?null!=(c=Fe(n,o))&&s.unshift(Br(n,c,a)):i||null!=(c=Fe(n,o))&&s.push(Br(n,c,a))),n=n.return}0!==s.length&&e.push({event:t,listeners:s})}function Fr(){}var jr=null,zr=null;function Kr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function qr(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Vr="function"===typeof setTimeout?setTimeout:void 0,Hr="function"===typeof clearTimeout?clearTimeout:void 0;function Wr(e){1===e.nodeType?e.textContent="":9===e.nodeType&&(null!=(e=e.body)&&(e.textContent=""))}function Gr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function $r(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var Yr=0;var Qr=Math.random().toString(36).slice(2),Xr="__reactFiber$"+Qr,Jr="__reactProps$"+Qr,Zr="__reactContainer$"+Qr,ei="__reactEvents$"+Qr;function ti(e){var t=e[Xr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Zr]||n[Xr]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=$r(e);null!==e;){if(n=e[Xr])return n;e=$r(e)}return t}n=(e=n).parentNode}return null}function ni(e){return!(e=e[Xr]||e[Zr])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function ri(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(s(33))}function ii(e){return e[Jr]||null}function oi(e){var t=e[ei];return void 0===t&&(t=e[ei]=new Set),t}var si=[],ai=-1;function ci(e){return{current:e}}function li(e){0>ai||(e.current=si[ai],si[ai]=null,ai--)}function ui(e,t){ai++,si[ai]=e.current,e.current=t}var hi={},di=ci(hi),fi=ci(!1),pi=hi;function gi(e,t){var n=e.type.contextTypes;if(!n)return hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function yi(e){return null!==(e=e.childContextTypes)&&void 0!==e}function mi(){li(fi),li(di)}function vi(e,t,n){if(di.current!==hi)throw Error(s(168));ui(di,t),ui(fi,n)}function bi(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in e))throw Error(s(108,G(t)||"Unknown",o));return i({},n,r)}function wi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,pi=di.current,ui(di,e),ui(fi,fi.current),!0}function Ei(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=bi(e,t,pi),r.__reactInternalMemoizedMergedChildContext=e,li(fi),li(di),ui(di,e)):li(fi),ui(fi,n)}var _i=null,Si=null,Ai=o.unstable_runWithPriority,ki=o.unstable_scheduleCallback,Ti=o.unstable_cancelCallback,Ii=o.unstable_shouldYield,Ci=o.unstable_requestPaint,Ri=o.unstable_now,xi=o.unstable_getCurrentPriorityLevel,Pi=o.unstable_ImmediatePriority,Di=o.unstable_UserBlockingPriority,Ni=o.unstable_NormalPriority,Oi=o.unstable_LowPriority,Bi=o.unstable_IdlePriority,Li={},Mi=void 0!==Ci?Ci:function(){},Ui=null,Fi=null,ji=!1,zi=Ri(),Ki=1e4>zi?Ri:function(){return Ri()-zi};function qi(){switch(xi()){case Pi:return 99;case Di:return 98;case Ni:return 97;case Oi:return 96;case Bi:return 95;default:throw Error(s(332))}}function Vi(e){switch(e){case 99:return Pi;case 98:return Di;case 97:return Ni;case 96:return Oi;case 95:return Bi;default:throw Error(s(332))}}function Hi(e,t){return e=Vi(e),Ai(e,t)}function Wi(e,t,n){return e=Vi(e),ki(e,t,n)}function Gi(){if(null!==Fi){var e=Fi;Fi=null,Ti(e)}$i()}function $i(){if(!ji&&null!==Ui){ji=!0;var e=0;try{var t=Ui;Hi(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),Ui=null}catch(n){throw null!==Ui&&(Ui=Ui.slice(e+1)),ki(Pi,Gi),n}finally{ji=!1}}}var Yi=E.ReactCurrentBatchConfig;function Qi(e,t){if(e&&e.defaultProps){for(var n in t=i({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var Xi=ci(null),Ji=null,Zi=null,eo=null;function to(){eo=Zi=Ji=null}function no(e){var t=Xi.current;li(Xi),e.type._context._currentValue=t}function ro(e,t){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)===t){if(null===n||(n.childLanes&t)===t)break;n.childLanes|=t}else e.childLanes|=t,null!==n&&(n.childLanes|=t);e=e.return}}function io(e,t){Ji=e,eo=Zi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(Ls=!0),e.firstContext=null)}function oo(e,t){if(eo!==e&&!1!==t&&0!==t)if("number"===typeof t&&1073741823!==t||(eo=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Zi){if(null===Ji)throw Error(s(308));Zi=t,Ji.dependencies={lanes:0,firstContext:t,responders:null}}else Zi=Zi.next=t;return e._currentValue}var so=!1;function ao(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function co(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 lo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function uo(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function ho(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=s:o=o.next=s,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function fo(e,t,n,r){var o=e.updateQueue;so=!1;var s=o.firstBaseUpdate,a=o.lastBaseUpdate,c=o.shared.pending;if(null!==c){o.shared.pending=null;var l=c,u=l.next;l.next=null,null===a?s=u:a.next=u,a=l;var h=e.alternate;if(null!==h){var d=(h=h.updateQueue).lastBaseUpdate;d!==a&&(null===d?h.firstBaseUpdate=u:d.next=u,h.lastBaseUpdate=l)}}if(null!==s){for(d=o.baseState,a=0,h=u=l=null;;){c=s.lane;var f=s.eventTime;if((r&c)===c){null!==h&&(h=h.next={eventTime:f,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var p=e,g=s;switch(c=t,f=n,g.tag){case 1:if("function"===typeof(p=g.payload)){d=p.call(f,d,c);break e}d=p;break e;case 3:p.flags=-4097&p.flags|64;case 0:if(null===(c="function"===typeof(p=g.payload)?p.call(f,d,c):p)||void 0===c)break e;d=i({},d,c);break e;case 2:so=!0}}null!==s.callback&&(e.flags|=32,null===(c=o.effects)?o.effects=[s]:c.push(s))}else f={eventTime:f,lane:c,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===h?(u=h=f,l=d):h=h.next=f,a|=c;if(null===(s=s.next)){if(null===(c=o.shared.pending))break;s=c.next,c.next=null,o.lastBaseUpdate=c,o.shared.pending=null}}null===h&&(l=d),o.baseState=l,o.firstBaseUpdate=u,o.lastBaseUpdate=h,za|=a,e.lanes=a,e.memoizedState=d}}function po(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!==typeof i)throw Error(s(191,i));i.call(r)}}}var go=(new r.Component).refs;function yo(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:i({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var mo={isMounted:function(e){return!!(e=e._reactInternals)&&Ye(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=dc(),i=fc(e),o=lo(r,i);o.payload=t,void 0!==n&&null!==n&&(o.callback=n),uo(e,o),pc(e,i,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=dc(),i=fc(e),o=lo(r,i);o.tag=1,o.payload=t,void 0!==n&&null!==n&&(o.callback=n),uo(e,o),pc(e,i,r)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=dc(),r=fc(e),i=lo(n,r);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),uo(e,i),pc(e,r,n)}};function vo(e,t,n,r,i,o,s){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!hr(n,r)||!hr(i,o))}function bo(e,t,n){var r=!1,i=hi,o=t.contextType;return"object"===typeof o&&null!==o?o=oo(o):(i=yi(t)?pi:di.current,o=(r=null!==(r=t.contextTypes)&&void 0!==r)?gi(e,i):hi),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=mo,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function wo(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&mo.enqueueReplaceState(t,t.state,null)}function Eo(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=go,ao(e);var o=t.contextType;"object"===typeof o&&null!==o?i.context=oo(o):(o=yi(t)?pi:di.current,i.context=gi(e,o)),fo(e,n,i,r),i.state=e.memoizedState,"function"===typeof(o=t.getDerivedStateFromProps)&&(yo(e,t,o,n),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&&mo.enqueueReplaceState(i,i.state,null),fo(e,n,i,r),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4)}var _o=Array.isArray;function So(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(s(309));var r=n.stateNode}if(!r)throw Error(s(147,e));var i=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===i?t.ref:(t=function(e){var t=r.refs;t===go&&(t=r.refs={}),null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!==typeof e)throw Error(s(284));if(!n._owner)throw Error(s(290,e))}return e}function Ao(e,t){if("textarea"!==e.type)throw Error(s(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function ko(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.flags=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(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=Wc(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags=2,n):r:(t.flags=2,n):n}function a(t){return e&&null===t.alternate&&(t.flags=2),t}function c(e,t,n,r){return null===t||6!==t.tag?((t=Qc(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function l(e,t,n,r){return null!==t&&t.elementType===n.type?((r=i(t,n.props)).ref=So(e,t,n),r.return=e,r):((r=Gc(n.type,n.key,n.props,null,e.mode,r)).ref=So(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Xc(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function h(e,t,n,r,o){return null===t||7!==t.tag?((t=$c(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function d(e,t,n){if("string"===typeof t||"number"===typeof t)return(t=Qc(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case _:return(n=Gc(t.type,t.key,t.props,null,e.mode,n)).ref=So(e,null,t),n.return=e,n;case S:return(t=Xc(t,e.mode,n)).return=e,t}if(_o(t)||K(t))return(t=$c(t,e.mode,n,null)).return=e,t;Ao(e,t)}return null}function f(e,t,n,r){var i=null!==t?t.key:null;if("string"===typeof n||"number"===typeof n)return null!==i?null:c(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case _:return n.key===i?n.type===A?h(e,t,n.props.children,r,i):l(e,t,n,r):null;case S:return n.key===i?u(e,t,n,r):null}if(_o(n)||K(n))return null!==i?null:h(e,t,n,r,null);Ao(e,n)}return null}function p(e,t,n,r,i){if("string"===typeof r||"number"===typeof r)return c(t,e=e.get(n)||null,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case _:return e=e.get(null===r.key?n:r.key)||null,r.type===A?h(t,e,r.props.children,i,r.key):l(t,e,r,i);case S:return u(t,e=e.get(null===r.key?n:r.key)||null,r,i)}if(_o(r)||K(r))return h(t,e=e.get(n)||null,r,i,null);Ao(t,r)}return null}function g(i,s,a,c){for(var l=null,u=null,h=s,g=s=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),s=o(m,s,g),null===u?l=m:u.sibling=m,u=m,h=y}if(g===a.length)return n(i,h),l;if(null===h){for(;g<a.length;g++)null!==(h=d(i,a[g],c))&&(s=o(h,s,g),null===u?l=h:u.sibling=h,u=h);return l}for(h=r(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),s=o(y,s,g),null===u?l=y:u.sibling=y,u=y);return e&&h.forEach((function(e){return t(i,e)})),l}function y(i,a,c,l){var u=K(c);if("function"!==typeof u)throw Error(s(150));if(null==(c=u.call(c)))throw Error(s(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=o(b,a,y),null===h?u=b:h.sibling=b,h=b,g=m}if(v.done)return n(i,g),u;if(null===g){for(;!v.done;y++,v=c.next())null!==(v=d(i,v.value,l))&&(a=o(v,a,y),null===h?u=v:h.sibling=v,h=v);return u}for(g=r(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=o(v,a,y),null===h?u=v:h.sibling=v,h=v);return e&&g.forEach((function(e){return t(i,e)})),u}return function(e,r,o,c){var l="object"===typeof o&&null!==o&&o.type===A&&null===o.key;l&&(o=o.props.children);var u="object"===typeof o&&null!==o;if(u)switch(o.$$typeof){case _:e:{for(u=o.key,l=r;null!==l;){if(l.key===u){if(7===l.tag){if(o.type===A){n(e,l.sibling),(r=i(l,o.props.children)).return=e,e=r;break e}}else if(l.elementType===o.type){n(e,l.sibling),(r=i(l,o.props)).ref=So(e,l,o),r.return=e,e=r;break e}n(e,l);break}t(e,l),l=l.sibling}o.type===A?((r=$c(o.props.children,e.mode,c,o.key)).return=e,e=r):((c=Gc(o.type,o.key,o.props,null,e.mode,c)).ref=So(e,r,o),c.return=e,e=c)}return a(e);case S:e:{for(l=o.key;null!==r;){if(r.key===l){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=i(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Xc(o,e.mode,c)).return=e,e=r}return a(e)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,o)).return=e,e=r):(n(e,r),(r=Qc(o,e.mode,c)).return=e,e=r),a(e);if(_o(o))return g(e,r,o,c);if(K(o))return y(e,r,o,c);if(u&&Ao(e,o),"undefined"===typeof o&&!l)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(s(152,G(e.type)||"Component"))}return n(e,r)}}var To=ko(!0),Io=ko(!1),Co={},Ro=ci(Co),xo=ci(Co),Po=ci(Co);function Do(e){if(e===Co)throw Error(s(174));return e}function No(e,t){switch(ui(Po,t),ui(xo,e),ui(Ro,Co),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fe(null,"");break;default:t=fe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}li(Ro),ui(Ro,t)}function Oo(){li(Ro),li(xo),li(Po)}function Bo(e){Do(Po.current);var t=Do(Ro.current),n=fe(t,e.type);t!==n&&(ui(xo,e),ui(Ro,n))}function Lo(e){xo.current===e&&(li(Ro),li(xo))}var Mo=ci(0);function Uo(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(64&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 Fo=null,jo=null,zo=!1;function Ko(e,t){var n=Vc(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function qo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Vo(e){if(zo){var t=jo;if(t){var n=t;if(!qo(e,t)){if(!(t=Gr(n.nextSibling))||!qo(e,t))return e.flags=-1025&e.flags|2,zo=!1,void(Fo=e);Ko(Fo,n)}Fo=e,jo=Gr(t.firstChild)}else e.flags=-1025&e.flags|2,zo=!1,Fo=e}}function Ho(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Fo=e}function Wo(e){if(e!==Fo)return!1;if(!zo)return Ho(e),zo=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!qr(t,e.memoizedProps))for(t=jo;t;)Ko(e,t),t=Gr(t.nextSibling);if(Ho(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){jo=Gr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}jo=null}}else jo=Fo?Gr(e.stateNode.nextSibling):null;return!0}function Go(){jo=Fo=null,zo=!1}var $o=[];function Yo(){for(var e=0;e<$o.length;e++)$o[e]._workInProgressVersionPrimary=null;$o.length=0}var Qo=E.ReactCurrentDispatcher,Xo=E.ReactCurrentBatchConfig,Jo=0,Zo=null,es=null,ts=null,ns=!1,rs=!1;function is(){throw Error(s(321))}function os(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lr(e[n],t[n]))return!1;return!0}function ss(e,t,n,r,i,o){if(Jo=o,Zo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Qo.current=null===e||null===e.memoizedState?Ds:Ns,e=n(r,i),rs){o=0;do{if(rs=!1,!(25>o))throw Error(s(301));o+=1,ts=es=null,t.updateQueue=null,Qo.current=Os,e=n(r,i)}while(rs)}if(Qo.current=Ps,t=null!==es&&null!==es.next,Jo=0,ts=es=Zo=null,ns=!1,t)throw Error(s(300));return e}function as(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ts?Zo.memoizedState=ts=e:ts=ts.next=e,ts}function cs(){if(null===es){var e=Zo.alternate;e=null!==e?e.memoizedState:null}else e=es.next;var t=null===ts?Zo.memoizedState:ts.next;if(null!==t)ts=t,es=e;else{if(null===e)throw Error(s(310));e={memoizedState:(es=e).memoizedState,baseState:es.baseState,baseQueue:es.baseQueue,queue:es.queue,next:null},null===ts?Zo.memoizedState=ts=e:ts=ts.next=e}return ts}function ls(e,t){return"function"===typeof t?t(e):t}function us(e){var t=cs(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=es,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var c=a=o=null,l=i;do{var u=l.lane;if((Jo&u)===u)null!==c&&(c=c.next={lane:0,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null}),r=l.eagerReducer===e?l.eagerState:e(r,l.action);else{var h={lane:u,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};null===c?(a=c=h,o=r):c=c.next=h,Zo.lanes|=u,za|=u}l=l.next}while(null!==l&&l!==i);null===c?o=r:c.next=a,lr(r,t.memoizedState)||(Ls=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function hs(e){var t=cs(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);lr(o,t.memoizedState)||(Ls=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ds(e,t,n){var r=t._getVersion;r=r(t._source);var i=t._workInProgressVersionPrimary;if(null!==i?e=i===r:(e=e.mutableReadLanes,(e=(Jo&e)===e)&&(t._workInProgressVersionPrimary=r,$o.push(t))),e)return n(t._source);throw $o.push(t),Error(s(350))}function fs(e,t,n,r){var i=Na;if(null===i)throw Error(s(349));var o=t._getVersion,a=o(t._source),c=Qo.current,l=c.useState((function(){return ds(i,t,n)})),u=l[1],h=l[0];l=ts;var d=e.memoizedState,f=d.refs,p=f.getSnapshot,g=d.source;d=d.subscribe;var y=Zo;return e.memoizedState={refs:f,source:t,subscribe:r},c.useEffect((function(){f.getSnapshot=n,f.setSnapshot=u;var e=o(t._source);if(!lr(a,e)){e=n(t._source),lr(h,e)||(u(e),e=fc(y),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var r=i.entanglements,s=e;0<s;){var c=31-qt(s),l=1<<c;r[c]|=e,s&=~l}}}),[n,t,r]),c.useEffect((function(){return r(t._source,(function(){var e=f.getSnapshot,n=f.setSnapshot;try{n(e(t._source));var r=fc(y);i.mutableReadLanes|=r&i.pendingLanes}catch(o){n((function(){throw o}))}}))}),[t,r]),lr(p,n)&&lr(g,t)&&lr(d,r)||((e={pending:null,dispatch:null,lastRenderedReducer:ls,lastRenderedState:h}).dispatch=u=xs.bind(null,Zo,e),l.queue=e,l.baseQueue=null,h=ds(i,t,n),l.memoizedState=l.baseState=h),h}function ps(e,t,n){return fs(cs(),e,t,n)}function gs(e){var t=as();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:ls,lastRenderedState:e}).dispatch=xs.bind(null,Zo,e),[t.memoizedState,e]}function ys(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Zo.updateQueue)?(t={lastEffect:null},Zo.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ms(e){return e={current:e},as().memoizedState=e}function vs(){return cs().memoizedState}function bs(e,t,n,r){var i=as();Zo.flags|=e,i.memoizedState=ys(1|t,n,void 0,void 0===r?null:r)}function ws(e,t,n,r){var i=cs();r=void 0===r?null:r;var o=void 0;if(null!==es){var s=es.memoizedState;if(o=s.destroy,null!==r&&os(r,s.deps))return void ys(t,n,o,r)}Zo.flags|=e,i.memoizedState=ys(1|t,n,o,r)}function Es(e,t){return bs(516,4,e,t)}function _s(e,t){return ws(516,4,e,t)}function Ss(e,t){return ws(4,2,e,t)}function As(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 ks(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,ws(4,2,As.bind(null,t,e),n)}function Ts(){}function Is(e,t){var n=cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&os(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Cs(e,t){var n=cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&os(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Rs(e,t){var n=qi();Hi(98>n?98:n,(function(){e(!0)})),Hi(97<n?97:n,(function(){var n=Xo.transition;Xo.transition=1;try{e(!1),t()}finally{Xo.transition=n}}))}function xs(e,t,n){var r=dc(),i=fc(e),o={lane:i,action:n,eagerReducer:null,eagerState:null,next:null},s=t.pending;if(null===s?o.next=o:(o.next=s.next,s.next=o),t.pending=o,s=e.alternate,e===Zo||null!==s&&s===Zo)rs=ns=!0;else{if(0===e.lanes&&(null===s||0===s.lanes)&&null!==(s=t.lastRenderedReducer))try{var a=t.lastRenderedState,c=s(a,n);if(o.eagerReducer=s,o.eagerState=c,lr(c,a))return}catch(l){}pc(e,i,r)}}var Ps={readContext:oo,useCallback:is,useContext:is,useEffect:is,useImperativeHandle:is,useLayoutEffect:is,useMemo:is,useReducer:is,useRef:is,useState:is,useDebugValue:is,useDeferredValue:is,useTransition:is,useMutableSource:is,useOpaqueIdentifier:is,unstable_isNewReconciler:!1},Ds={readContext:oo,useCallback:function(e,t){return as().memoizedState=[e,void 0===t?null:t],e},useContext:oo,useEffect:Es,useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,bs(4,2,As.bind(null,t,e),n)},useLayoutEffect:function(e,t){return bs(4,2,e,t)},useMemo:function(e,t){var n=as();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=as();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=xs.bind(null,Zo,e),[r.memoizedState,e]},useRef:ms,useState:gs,useDebugValue:Ts,useDeferredValue:function(e){var t=gs(e),n=t[0],r=t[1];return Es((function(){var t=Xo.transition;Xo.transition=1;try{r(e)}finally{Xo.transition=t}}),[e]),n},useTransition:function(){var e=gs(!1),t=e[0];return ms(e=Rs.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,n){var r=as();return r.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:n},fs(r,e,t,n)},useOpaqueIdentifier:function(){if(zo){var e=!1,t=function(e){return{$$typeof:B,toString:e,valueOf:e}}((function(){throw e||(e=!0,n("r:"+(Yr++).toString(36))),Error(s(355))})),n=gs(t)[1];return 0===(2&Zo.mode)&&(Zo.flags|=516,ys(5,(function(){n("r:"+(Yr++).toString(36))}),void 0,null)),t}return gs(t="r:"+(Yr++).toString(36)),t},unstable_isNewReconciler:!1},Ns={readContext:oo,useCallback:Is,useContext:oo,useEffect:_s,useImperativeHandle:ks,useLayoutEffect:Ss,useMemo:Cs,useReducer:us,useRef:vs,useState:function(){return us(ls)},useDebugValue:Ts,useDeferredValue:function(e){var t=us(ls),n=t[0],r=t[1];return _s((function(){var t=Xo.transition;Xo.transition=1;try{r(e)}finally{Xo.transition=t}}),[e]),n},useTransition:function(){var e=us(ls)[0];return[vs().current,e]},useMutableSource:ps,useOpaqueIdentifier:function(){return us(ls)[0]},unstable_isNewReconciler:!1},Os={readContext:oo,useCallback:Is,useContext:oo,useEffect:_s,useImperativeHandle:ks,useLayoutEffect:Ss,useMemo:Cs,useReducer:hs,useRef:vs,useState:function(){return hs(ls)},useDebugValue:Ts,useDeferredValue:function(e){var t=hs(ls),n=t[0],r=t[1];return _s((function(){var t=Xo.transition;Xo.transition=1;try{r(e)}finally{Xo.transition=t}}),[e]),n},useTransition:function(){var e=hs(ls)[0];return[vs().current,e]},useMutableSource:ps,useOpaqueIdentifier:function(){return hs(ls)[0]},unstable_isNewReconciler:!1},Bs=E.ReactCurrentOwner,Ls=!1;function Ms(e,t,n,r){t.child=null===e?Io(t,null,n,r):To(t,e.child,n,r)}function Us(e,t,n,r,i){n=n.render;var o=t.ref;return io(t,i),r=ss(e,t,n,r,o,i),null===e||Ls?(t.flags|=1,Ms(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,oa(e,t,i))}function Fs(e,t,n,r,i,o){if(null===e){var s=n.type;return"function"!==typeof s||Hc(s)||void 0!==s.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Gc(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=s,js(e,t,s,r,i,o))}return s=e.child,0===(i&o)&&(i=s.memoizedProps,(n=null!==(n=n.compare)?n:hr)(i,r)&&e.ref===t.ref)?oa(e,t,o):(t.flags|=1,(e=Wc(s,r)).ref=t.ref,e.return=t,t.child=e)}function js(e,t,n,r,i,o){if(null!==e&&hr(e.memoizedProps,r)&&e.ref===t.ref){if(Ls=!1,0===(o&i))return t.lanes=e.lanes,oa(e,t,o);0!==(16384&e.flags)&&(Ls=!0)}return qs(e,t,n,r,o)}function zs(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode||"unstable-defer-without-hiding"===r.mode)if(0===(4&t.mode))t.memoizedState={baseLanes:0},_c(t,n);else{if(0===(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},_c(t,e),null;t.memoizedState={baseLanes:0},_c(t,null!==o?o.baseLanes:n)}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,_c(t,r);return Ms(e,t,i,n),t.child}function Ks(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=128)}function qs(e,t,n,r,i){var o=yi(n)?pi:di.current;return o=gi(t,o),io(t,i),n=ss(e,t,n,r,o,i),null===e||Ls?(t.flags|=1,Ms(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,oa(e,t,i))}function Vs(e,t,n,r,i){if(yi(n)){var o=!0;wi(t)}else o=!1;if(io(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),bo(t,n,r),Eo(t,n,r,i),r=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var c=s.context,l=n.contextType;"object"===typeof l&&null!==l?l=oo(l):l=gi(t,l=yi(n)?pi:di.current);var u=n.getDerivedStateFromProps,h="function"===typeof u||"function"===typeof s.getSnapshotBeforeUpdate;h||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==r||c!==l)&&wo(t,s,r,l),so=!1;var d=t.memoizedState;s.state=d,fo(t,r,s,i),c=t.memoizedState,a!==r||d!==c||fi.current||so?("function"===typeof u&&(yo(t,n,u,r),c=t.memoizedState),(a=so||vo(t,n,a,r,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|=4)):("function"===typeof s.componentDidMount&&(t.flags|=4),t.memoizedProps=r,t.memoizedState=c),s.props=r,s.state=c,s.context=l,r=a):("function"===typeof s.componentDidMount&&(t.flags|=4),r=!1)}else{s=t.stateNode,co(e,t),a=t.memoizedProps,l=t.type===t.elementType?a:Qi(t.type,a),s.props=l,h=t.pendingProps,d=s.context,"object"===typeof(c=n.contextType)&&null!==c?c=oo(c):c=gi(t,c=yi(n)?pi:di.current);var f=n.getDerivedStateFromProps;(u="function"===typeof f||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==h||d!==c)&&wo(t,s,r,c),so=!1,d=t.memoizedState,s.state=d,fo(t,r,s,i);var p=t.memoizedState;a!==h||d!==p||fi.current||so?("function"===typeof f&&(yo(t,n,f,r),p=t.memoizedState),(l=so||vo(t,n,l,r,d,p,c))?(u||"function"!==typeof s.UNSAFE_componentWillUpdate&&"function"!==typeof s.componentWillUpdate||("function"===typeof s.componentWillUpdate&&s.componentWillUpdate(r,p,c),"function"===typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,p,c)),"function"===typeof s.componentDidUpdate&&(t.flags|=4),"function"===typeof s.getSnapshotBeforeUpdate&&(t.flags|=256)):("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|=256),t.memoizedProps=r,t.memoizedState=p),s.props=r,s.state=p,s.context=c,r=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|=256),r=!1)}return Hs(e,t,n,r,o,i)}function Hs(e,t,n,r,i,o){Ks(e,t);var s=0!==(64&t.flags);if(!r&&!s)return i&&Ei(t,n,!1),oa(e,t,o);r=t.stateNode,Bs.current=t;var a=s&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=To(t,e.child,null,o),t.child=To(t,null,a,o)):Ms(e,t,a,o),t.memoizedState=r.state,i&&Ei(t,n,!0),t.child}function Ws(e){var t=e.stateNode;t.pendingContext?vi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&vi(0,t.context,!1),No(e,t.containerInfo)}var Gs,$s,Ys,Qs,Xs={dehydrated:null,retryLane:0};function Js(e,t,n){var r,i=t.pendingProps,o=Mo.current,s=!1;return(r=0!==(64&t.flags))||(r=(null===e||null!==e.memoizedState)&&0!==(2&o)),r?(s=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===i.fallback||!0===i.unstable_avoidThisFallback||(o|=1),ui(Mo,1&o),null===e?(void 0!==i.fallback&&Vo(t),e=i.children,o=i.fallback,s?(e=Zs(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xs,e):"number"===typeof i.unstable_expectedLoadTime?(e=Zs(t,e,o,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xs,t.lanes=33554432,e):((n=Yc({mode:"visible",children:e},t.mode,n,null)).return=t,t.child=n)):(e.memoizedState,s?(i=ta(e,t,i.children,i.fallback,n),s=t.child,o=e.child.memoizedState,s.memoizedState=null===o?{baseLanes:n}:{baseLanes:o.baseLanes|n},s.childLanes=e.childLanes&~n,t.memoizedState=Xs,i):(n=ea(e,t,i.children,n),t.memoizedState=null,n))}function Zs(e,t,n,r){var i=e.mode,o=e.child;return t={mode:"hidden",children:t},0===(2&i)&&null!==o?(o.childLanes=0,o.pendingProps=t):o=Yc(t,i,0,null),n=$c(n,i,r,null),o.return=e,n.return=e,o.sibling=n,e.child=o,n}function ea(e,t,n,r){var i=e.child;return e=i.sibling,n=Wc(i,{mode:"visible",children:n}),0===(2&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=n}function ta(e,t,n,r,i){var o=t.mode,s=e.child;e=s.sibling;var a={mode:"hidden",children:n};return 0===(2&o)&&t.child!==s?((n=t.child).childLanes=0,n.pendingProps=a,null!==(s=n.lastEffect)?(t.firstEffect=n.firstEffect,t.lastEffect=s,s.nextEffect=null):t.firstEffect=t.lastEffect=null):n=Wc(s,a),null!==e?r=Wc(e,r):(r=$c(r,o,i,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}function na(e,t){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),ro(e.return,t)}function ra(e,t,n,r,i,o){var s=e.memoizedState;null===s?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,lastEffect:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i,s.lastEffect=o)}function ia(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Ms(e,t,r.children,n),0!==(2&(r=Mo.current)))r=1&r|2,t.flags|=64;else{if(null!==e&&0!==(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&na(e,n);else if(19===e.tag)na(e,n);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}r&=1}if(ui(Mo,r),0===(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Uo(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ra(t,!1,i,n,o,t.lastEffect);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Uo(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ra(t,!0,n,null,o,t.lastEffect);break;case"together":ra(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function oa(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),za|=t.lanes,0!==(n&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(n=Wc(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Wc(e,e.pendingProps)).return=t;n.sibling=null}return t.child}return null}function sa(e,t){if(!zo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function aa(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return yi(t.type)&&mi(),null;case 3:return Oo(),li(fi),li(di),Yo(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(Wo(t)?t.flags|=4:r.hydrate||(t.flags|=256)),$s(t),null;case 5:Lo(t);var o=Do(Po.current);if(n=t.type,null!==e&&null!=t.stateNode)Ys(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=128);else{if(!r){if(null===t.stateNode)throw Error(s(166));return null}if(e=Do(Ro.current),Wo(t)){r=t.stateNode,n=t.type;var a=t.memoizedProps;switch(r[Xr]=t,r[Jr]=a,n){case"dialog":Rr("cancel",r),Rr("close",r);break;case"iframe":case"object":case"embed":Rr("load",r);break;case"video":case"audio":for(e=0;e<kr.length;e++)Rr(kr[e],r);break;case"source":Rr("error",r);break;case"img":case"image":case"link":Rr("error",r),Rr("load",r);break;case"details":Rr("toggle",r);break;case"input":ee(r,a),Rr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!a.multiple},Rr("invalid",r);break;case"textarea":ce(r,a),Rr("invalid",r)}for(var l in Se(n,a),e=null,a)a.hasOwnProperty(l)&&(o=a[l],"children"===l?"string"===typeof o?r.textContent!==o&&(e=["children",o]):"number"===typeof o&&r.textContent!==""+o&&(e=["children",""+o]):c.hasOwnProperty(l)&&null!=o&&"onScroll"===l&&Rr("scroll",r));switch(n){case"input":Q(r),re(r,a,!0);break;case"textarea":Q(r),ue(r);break;case"select":case"option":break;default:"function"===typeof a.onClick&&(r.onclick=Fr)}r=e,t.updateQueue=r,null!==r&&(t.flags|=4)}else{switch(l=9===o.nodeType?o:o.ownerDocument,e===he.html&&(e=de(n)),e===he.html?"script"===n?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof r.is?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),"select"===n&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[Xr]=t,e[Jr]=r,Gs(e,t,!1,!1),t.stateNode=e,l=Ae(n,r),n){case"dialog":Rr("cancel",e),Rr("close",e),o=r;break;case"iframe":case"object":case"embed":Rr("load",e),o=r;break;case"video":case"audio":for(o=0;o<kr.length;o++)Rr(kr[o],e);o=r;break;case"source":Rr("error",e),o=r;break;case"img":case"image":case"link":Rr("error",e),Rr("load",e),o=r;break;case"details":Rr("toggle",e),o=r;break;case"input":ee(e,r),o=Z(e,r),Rr("invalid",e);break;case"option":o=oe(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=i({},r,{value:void 0}),Rr("invalid",e);break;case"textarea":ce(e,r),o=ae(e,r),Rr("invalid",e);break;default:o=r}Se(n,o);var u=o;for(a in u)if(u.hasOwnProperty(a)){var h=u[a];"style"===a?Ee(e,h):"dangerouslySetInnerHTML"===a?null!=(h=h?h.__html:void 0)&&ye(e,h):"children"===a?"string"===typeof h?("textarea"!==n||""!==h)&&me(e,h):"number"===typeof h&&me(e,""+h):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(c.hasOwnProperty(a)?null!=h&&"onScroll"===a&&Rr("scroll",e):null!=h&&w(e,a,h,l))}switch(n){case"input":Q(e),re(e,r,!1);break;case"textarea":Q(e),ue(e);break;case"option":null!=r.value&&e.setAttribute("value",""+$(r.value));break;case"select":e.multiple=!!r.multiple,null!=(a=r.value)?se(e,!!r.multiple,a,!1):null!=r.defaultValue&&se(e,!!r.multiple,r.defaultValue,!0);break;default:"function"===typeof o.onClick&&(e.onclick=Fr)}Kr(n,r)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)Qs(e,t,e.memoizedProps,r);else{if("string"!==typeof r&&null===t.stateNode)throw Error(s(166));n=Do(Po.current),Do(Ro.current),Wo(t)?(r=t.stateNode,n=t.memoizedProps,r[Xr]=t,r.nodeValue!==n&&(t.flags|=4)):((r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[Xr]=t,t.stateNode=r)}return null;case 13:return li(Mo),r=t.memoizedState,0!==(64&t.flags)?(t.lanes=n,t):(r=null!==r,n=!1,null===e?void 0!==t.memoizedProps.fallback&&Wo(t):n=null!==e.memoizedState,r&&!n&&0!==(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!==(1&Mo.current)?0===Ua&&(Ua=3):(0!==Ua&&3!==Ua||(Ua=4),null===Na||0===(134217727&za)&&0===(134217727&Ka)||vc(Na,Ba))),(r||n)&&(t.flags|=4),null);case 4:return Oo(),$s(t),null===e&&Pr(t.stateNode.containerInfo),null;case 10:return no(t),null;case 19:if(li(Mo),null===(r=t.memoizedState))return null;if(a=0!==(64&t.flags),null===(l=r.rendering))if(a)sa(r,!1);else{if(0!==Ua||null!==e&&0!==(64&e.flags))for(e=t.child;null!==e;){if(null!==(l=Uo(e))){for(t.flags|=64,sa(r,!1),null!==(a=l.updateQueue)&&(t.updateQueue=a,t.flags|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=n,n=t.child;null!==n;)e=r,(a=n).flags&=2,a.nextEffect=null,a.firstEffect=null,a.lastEffect=null,null===(l=a.alternate)?(a.childLanes=0,a.lanes=e,a.child=null,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=l.childLanes,a.lanes=l.lanes,a.child=l.child,a.memoizedProps=l.memoizedProps,a.memoizedState=l.memoizedState,a.updateQueue=l.updateQueue,a.type=l.type,e=l.dependencies,a.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ui(Mo,1&Mo.current|2),t.child}e=e.sibling}null!==r.tail&&Ki()>Wa&&(t.flags|=64,a=!0,sa(r,!1),t.lanes=33554432)}else{if(!a)if(null!==(e=Uo(l))){if(t.flags|=64,a=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),sa(r,!0),null===r.tail&&"hidden"===r.tailMode&&!l.alternate&&!zo)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Ki()-r.renderingStartTime>Wa&&1073741824!==n&&(t.flags|=64,a=!0,sa(r,!1),t.lanes=33554432);r.isBackwards?(l.sibling=t.child,t.child=l):(null!==(n=r.last)?n.sibling=l:t.child=l,r.last=l)}return null!==r.tail?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Ki(),n.sibling=null,t=Mo.current,ui(Mo,a?1&t|2:1&t),n):null;case 23:case 24:return Sc(),null!==e&&null!==e.memoizedState!==(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(s(156,t.tag))}function ca(e){switch(e.tag){case 1:yi(e.type)&&mi();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Oo(),li(fi),li(di),Yo(),0!==(64&(t=e.flags)))throw Error(s(285));return e.flags=-4097&t|64,e;case 5:return Lo(e),null;case 13:return li(Mo),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return li(Mo),null;case 4:return Oo(),null;case 10:return no(e),null;case 23:case 24:return Sc(),null;default:return null}}function la(e,t){try{var n="",r=t;do{n+=W(r),r=r.return}while(r);var i=n}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i}}function ua(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}Gs=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},$s=function(){},Ys=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Do(Ro.current);var s,a=null;switch(n){case"input":o=Z(e,o),r=Z(e,r),a=[];break;case"option":o=oe(e,o),r=oe(e,r),a=[];break;case"select":o=i({},o,{value:void 0}),r=i({},r,{value:void 0}),a=[];break;case"textarea":o=ae(e,o),r=ae(e,r),a=[];break;default:"function"!==typeof o.onClick&&"function"===typeof r.onClick&&(e.onclick=Fr)}for(h in Se(n,r),n=null,o)if(!r.hasOwnProperty(h)&&o.hasOwnProperty(h)&&null!=o[h])if("style"===h){var l=o[h];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else"dangerouslySetInnerHTML"!==h&&"children"!==h&&"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&"autoFocus"!==h&&(c.hasOwnProperty(h)?a||(a=[]):(a=a||[]).push(h,null));for(h in r){var u=r[h];if(l=null!=o?o[h]:void 0,r.hasOwnProperty(h)&&u!==l&&(null!=u||null!=l))if("style"===h)if(l){for(s in l)!l.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&l[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(a||(a=[]),a.push(h,n)),n=u;else"dangerouslySetInnerHTML"===h?(u=u?u.__html:void 0,l=l?l.__html:void 0,null!=u&&l!==u&&(a=a||[]).push(h,u)):"children"===h?"string"!==typeof u&&"number"!==typeof u||(a=a||[]).push(h,""+u):"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&(c.hasOwnProperty(h)?(null!=u&&"onScroll"===h&&Rr("scroll",e),a||l===u||(a=[])):"object"===typeof u&&null!==u&&u.$$typeof===B?u.toString():(a=a||[]).push(h,u))}n&&(a=a||[]).push("style",n);var h=a;(t.updateQueue=h)&&(t.flags|=4)}},Qs=function(e,t,n,r){n!==r&&(t.flags|=4)};var ha="function"===typeof WeakMap?WeakMap:Map;function da(e,t,n){(n=lo(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Qa||(Qa=!0,Xa=r),ua(0,t)},n}function fa(e,t,n){(n=lo(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return ua(0,t),r(i)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===Ja?Ja=new Set([this]):Ja.add(this),ua(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var pa="function"===typeof WeakSet?WeakSet:Set;function ga(e){var t=e.ref;if(null!==t)if("function"===typeof t)try{t(null)}catch(n){jc(e,n)}else t.current=null}function ya(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Qi(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Wr(t.stateNode.containerInfo))}throw Error(s(163))}function ma(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3===(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;r=i.next,0!==(4&(i=i.tag))&&0!==(1&i)&&(Mc(n,e),Lc(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:Qi(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&po(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}po(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&Kr(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&Et(n)))))}throw Error(s(163))}function va(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)"function"===typeof(r=r.style).setProperty?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var i=n.memoizedProps.style;i=void 0!==i&&null!==i&&i.hasOwnProperty("display")?i.display:null,r.style.display=we("display",i)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function ba(e,t){if(Si&&"function"===typeof Si.onCommitFiberUnmount)try{Si.onCommitFiberUnmount(_i,t)}catch(o){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,i=r.destroy;if(r=r.tag,void 0!==i)if(0!==(4&r))Mc(t,n);else{r=t;try{i()}catch(o){jc(r,o)}}n=n.next}while(n!==e)}break;case 1:if(ga(t),"function"===typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(o){jc(t,o)}break;case 5:ga(t);break;case 4:ka(e,t)}}function wa(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function Ea(e){return 5===e.tag||3===e.tag||4===e.tag}function _a(e){e:{for(var t=e.return;null!==t;){if(Ea(t))break e;t=t.return}throw Error(s(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(s(161))}16&n.flags&&(me(t,""),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Ea(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?Sa(e,n,t):Aa(e,n,t)}function Sa(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!==(n=n._reactRootContainer)&&void 0!==n||null!==t.onclick||(t.onclick=Fr));else if(4!==r&&null!==(e=e.child))for(Sa(e,t,n),e=e.sibling;null!==e;)Sa(e,t,n),e=e.sibling}function Aa(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(Aa(e,t,n),e=e.sibling;null!==e;)Aa(e,t,n),e=e.sibling}function ka(e,t){for(var n,r,i=t,o=!1;;){if(!o){o=i.return;e:for(;;){if(null===o)throw Error(s(160));switch(n=o.stateNode,o.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}o=o.return}o=!0}if(5===i.tag||6===i.tag){e:for(var a=e,c=i,l=c;;)if(ba(a,l),null!==l.child&&4!==l.tag)l.child.return=l,l=l.child;else{if(l===c)break e;for(;null===l.sibling;){if(null===l.return||l.return===c)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}r?(a=n,c=i.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):n.removeChild(i.stateNode)}else if(4===i.tag){if(null!==i.child){n=i.stateNode.containerInfo,r=!0,i.child.return=i,i=i.child;continue}}else if(ba(e,i),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(o=!1)}i.sibling.return=i.return,i=i.sibling}}function Ta(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var r=n=n.next;do{3===(3&r.tag)&&(e=r.destroy,r.destroy=void 0,void 0!==e&&e()),r=r.next}while(r!==n)}return;case 1:case 12:case 17:return;case 5:if(null!=(n=t.stateNode)){r=t.memoizedProps;var i=null!==e?e.memoizedProps:r;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(n[Jr]=r,"input"===e&&"radio"===r.type&&null!=r.name&&te(n,r),Ae(e,i),t=Ae(e,r),i=0;i<o.length;i+=2){var a=o[i],c=o[i+1];"style"===a?Ee(n,c):"dangerouslySetInnerHTML"===a?ye(n,c):"children"===a?me(n,c):w(n,a,c,t)}switch(e){case"input":ne(n,r);break;case"textarea":le(n,r);break;case"select":e=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(o=r.value)?se(n,!!r.multiple,o,!1):e!==!!r.multiple&&(null!=r.defaultValue?se(n,!!r.multiple,r.defaultValue,!0):se(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(s(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((n=t.stateNode).hydrate&&(n.hydrate=!1,Et(n.containerInfo)));case 13:return null!==t.memoizedState&&(Ha=Ki(),va(t.child,!0)),void Ia(t);case 19:return void Ia(t);case 23:case 24:return void va(t,null!==t.memoizedState)}throw Error(s(163))}function Ia(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new pa),t.forEach((function(t){var r=Kc.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function Ca(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var Ra=Math.ceil,xa=E.ReactCurrentDispatcher,Pa=E.ReactCurrentOwner,Da=0,Na=null,Oa=null,Ba=0,La=0,Ma=ci(0),Ua=0,Fa=null,ja=0,za=0,Ka=0,qa=0,Va=null,Ha=0,Wa=1/0;function Ga(){Wa=Ki()+500}var $a,Ya=null,Qa=!1,Xa=null,Ja=null,Za=!1,ec=null,tc=90,nc=[],rc=[],ic=null,oc=0,sc=null,ac=-1,cc=0,lc=0,uc=null,hc=!1;function dc(){return 0!==(48&Da)?Ki():-1!==ac?ac:ac=Ki()}function fc(e){if(0===(2&(e=e.mode)))return 1;if(0===(4&e))return 99===qi()?1:2;if(0===cc&&(cc=ja),0!==Yi.transition){0!==lc&&(lc=null!==Va?Va.pendingLanes:0),e=cc;var t=4186112&~lc;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=qi(),0!==(4&Da)&&98===e?e=Ft(12,cc):e=Ft(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),cc),e}function pc(e,t,n){if(50<oc)throw oc=0,sc=null,Error(s(185));if(null===(e=gc(e,t)))return null;Kt(e,t,n),e===Na&&(Ka|=t,4===Ua&&vc(e,Ba));var r=qi();1===t?0!==(8&Da)&&0===(48&Da)?bc(e):(yc(e,n),0===Da&&(Ga(),Gi())):(0===(4&Da)||98!==r&&99!==r||(null===ic?ic=new Set([e]):ic.add(e)),yc(e,n)),Va=e}function gc(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function yc(e,t){for(var n=e.callbackNode,r=e.suspendedLanes,i=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var c=31-qt(a),l=1<<c,u=o[c];if(-1===u){if(0===(l&r)||0!==(l&i)){u=t,Lt(l);var h=Bt;o[c]=10<=h?u+250:6<=h?u+5e3:-1}}else u<=t&&(e.expiredLanes|=l);a&=~l}if(r=Mt(e,e===Na?Ba:0),t=Bt,0===r)null!==n&&(n!==Li&&Ti(n),e.callbackNode=null,e.callbackPriority=0);else{if(null!==n){if(e.callbackPriority===t)return;n!==Li&&Ti(n)}15===t?(n=bc.bind(null,e),null===Ui?(Ui=[n],Fi=ki(Pi,$i)):Ui.push(n),n=Li):14===t?n=Wi(99,bc.bind(null,e)):(n=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(s(358,e))}}(t),n=Wi(n,mc.bind(null,e))),e.callbackPriority=t,e.callbackNode=n}}function mc(e){if(ac=-1,lc=cc=0,0!==(48&Da))throw Error(s(327));var t=e.callbackNode;if(Bc()&&e.callbackNode!==t)return null;var n=Mt(e,e===Na?Ba:0);if(0===n)return null;var r=n,i=Da;Da|=16;var o=Tc();for(Na===e&&Ba===r||(Ga(),Ac(e,r));;)try{Rc();break}catch(c){kc(e,c)}if(to(),xa.current=o,Da=i,null!==Oa?r=0:(Na=null,Ba=0,r=Ua),0!==(ja&Ka))Ac(e,0);else if(0!==r){if(2===r&&(Da|=64,e.hydrate&&(e.hydrate=!1,Wr(e.containerInfo)),0!==(n=Ut(e))&&(r=Ic(e,n))),1===r)throw t=Fa,Ac(e,0),vc(e,n),yc(e,Ki()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=n,r){case 0:case 1:throw Error(s(345));case 2:case 5:Dc(e);break;case 3:if(vc(e,n),(62914560&n)===n&&10<(r=Ha+500-Ki())){if(0!==Mt(e,0))break;if(((i=e.suspendedLanes)&n)!==n){dc(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Vr(Dc.bind(null,e),r);break}Dc(e);break;case 4:if(vc(e,n),(4186112&n)===n)break;for(r=e.eventTimes,i=-1;0<n;){var a=31-qt(n);o=1<<a,(a=r[a])>i&&(i=a),n&=~o}if(n=i,10<(n=(120>(n=Ki()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Ra(n/1960))-n)){e.timeoutHandle=Vr(Dc.bind(null,e),n);break}Dc(e);break;default:throw Error(s(329))}}return yc(e,Ki()),e.callbackNode===t?mc.bind(null,e):null}function vc(e,t){for(t&=~qa,t&=~Ka,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-qt(t),r=1<<n;e[n]=-1,t&=~r}}function bc(e){if(0!==(48&Da))throw Error(s(327));if(Bc(),e===Na&&0!==(e.expiredLanes&Ba)){var t=Ba,n=Ic(e,t);0!==(ja&Ka)&&(n=Ic(e,t=Mt(e,t)))}else n=Ic(e,t=Mt(e,0));if(0!==e.tag&&2===n&&(Da|=64,e.hydrate&&(e.hydrate=!1,Wr(e.containerInfo)),0!==(t=Ut(e))&&(n=Ic(e,t))),1===n)throw n=Fa,Ac(e,0),vc(e,t),yc(e,Ki()),n;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Dc(e),yc(e,Ki()),null}function wc(e,t){var n=Da;Da|=1;try{return e(t)}finally{0===(Da=n)&&(Ga(),Gi())}}function Ec(e,t){var n=Da;Da&=-2,Da|=8;try{return e(t)}finally{0===(Da=n)&&(Ga(),Gi())}}function _c(e,t){ui(Ma,La),La|=t,ja|=t}function Sc(){La=Ma.current,li(Ma)}function Ac(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Hr(n)),null!==Oa)for(n=Oa.return;null!==n;){var r=n;switch(r.tag){case 1:null!==(r=r.type.childContextTypes)&&void 0!==r&&mi();break;case 3:Oo(),li(fi),li(di),Yo();break;case 5:Lo(r);break;case 4:Oo();break;case 13:case 19:li(Mo);break;case 10:no(r);break;case 23:case 24:Sc()}n=n.return}Na=e,Oa=Wc(e.current,null),Ba=La=ja=t,Ua=0,Fa=null,qa=Ka=za=0}function kc(e,t){for(;;){var n=Oa;try{if(to(),Qo.current=Ps,ns){for(var r=Zo.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}ns=!1}if(Jo=0,ts=es=Zo=null,rs=!1,Pa.current=null,null===n||null===n.return){Ua=1,Fa=t,Oa=null;break}e:{var o=e,s=n.return,a=n,c=t;if(t=Ba,a.flags|=2048,a.firstEffect=a.lastEffect=null,null!==c&&"object"===typeof c&&"function"===typeof c.then){var l=c;if(0===(2&a.mode)){var u=a.alternate;u?(a.updateQueue=u.updateQueue,a.memoizedState=u.memoizedState,a.lanes=u.lanes):(a.updateQueue=null,a.memoizedState=null)}var h=0!==(1&Mo.current),d=s;do{var f;if(f=13===d.tag){var p=d.memoizedState;if(null!==p)f=null!==p.dehydrated;else{var g=d.memoizedProps;f=void 0!==g.fallback&&(!0!==g.unstable_avoidThisFallback||!h)}}if(f){var y=d.updateQueue;if(null===y){var m=new Set;m.add(l),d.updateQueue=m}else y.add(l);if(0===(2&d.mode)){if(d.flags|=64,a.flags|=16384,a.flags&=-2981,1===a.tag)if(null===a.alternate)a.tag=17;else{var v=lo(-1,1);v.tag=2,uo(a,v)}a.lanes|=1;break e}c=void 0,a=t;var b=o.pingCache;if(null===b?(b=o.pingCache=new ha,c=new Set,b.set(l,c)):void 0===(c=b.get(l))&&(c=new Set,b.set(l,c)),!c.has(a)){c.add(a);var w=zc.bind(null,o,l,a);l.then(w,w)}d.flags|=4096,d.lanes=t;break e}d=d.return}while(null!==d);c=Error((G(a.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Ua&&(Ua=2),c=la(c,a),d=s;do{switch(d.tag){case 3:o=c,d.flags|=4096,t&=-t,d.lanes|=t,ho(d,da(0,o,t));break e;case 1:o=c;var E=d.type,_=d.stateNode;if(0===(64&d.flags)&&("function"===typeof E.getDerivedStateFromError||null!==_&&"function"===typeof _.componentDidCatch&&(null===Ja||!Ja.has(_)))){d.flags|=4096,t&=-t,d.lanes|=t,ho(d,fa(d,o,t));break e}}d=d.return}while(null!==d)}Pc(n)}catch(S){t=S,Oa===n&&null!==n&&(Oa=n=n.return);continue}break}}function Tc(){var e=xa.current;return xa.current=Ps,null===e?Ps:e}function Ic(e,t){var n=Da;Da|=16;var r=Tc();for(Na===e&&Ba===t||Ac(e,t);;)try{Cc();break}catch(i){kc(e,i)}if(to(),Da=n,xa.current=r,null!==Oa)throw Error(s(261));return Na=null,Ba=0,Ua}function Cc(){for(;null!==Oa;)xc(Oa)}function Rc(){for(;null!==Oa&&!Ii();)xc(Oa)}function xc(e){var t=$a(e.alternate,e,La);e.memoizedProps=e.pendingProps,null===t?Pc(e):Oa=t,Pa.current=null}function Pc(e){var t=e;do{var n=t.alternate;if(e=t.return,0===(2048&t.flags)){if(null!==(n=aa(n,t,La)))return void(Oa=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!==(1073741824&La)||0===(4&n.mode)){for(var r=0,i=n.child;null!==i;)r|=i.lanes|i.childLanes,i=i.sibling;n.childLanes=r}null!==e&&0===(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(n=ca(t)))return n.flags&=2047,void(Oa=n);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(Oa=t);Oa=t=e}while(null!==t);0===Ua&&(Ua=5)}function Dc(e){var t=qi();return Hi(99,Nc.bind(null,e,t)),null}function Nc(e,t){do{Bc()}while(null!==ec);if(0!==(48&Da))throw Error(s(327));var n=e.finishedWork;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(s(177));e.callbackNode=null;var r=n.lanes|n.childLanes,i=r,o=e.pendingLanes&~i;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=i,e.mutableReadLanes&=i,e.entangledLanes&=i,i=e.entanglements;for(var a=e.eventTimes,c=e.expirationTimes;0<o;){var l=31-qt(o),u=1<<l;i[l]=0,a[l]=-1,c[l]=-1,o&=~u}if(null!==ic&&0===(24&r)&&ic.has(e)&&ic.delete(e),e===Na&&(Oa=Na=null,Ba=0),1<n.flags?null!==n.lastEffect?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,null!==r){if(i=Da,Da|=32,Pa.current=null,jr=$t,yr(a=gr())){if("selectionStart"in a)c={start:a.selectionStart,end:a.selectionEnd};else e:if(c=(c=a.ownerDocument)&&c.defaultView||window,(u=c.getSelection&&c.getSelection())&&0!==u.rangeCount){c=u.anchorNode,o=u.anchorOffset,l=u.focusNode,u=u.focusOffset;try{c.nodeType,l.nodeType}catch(T){c=null;break e}var h=0,d=-1,f=-1,p=0,g=0,y=a,m=null;t:for(;;){for(var v;y!==c||0!==o&&3!==y.nodeType||(d=h+o),y!==l||0!==u&&3!==y.nodeType||(f=h+u),3===y.nodeType&&(h+=y.nodeValue.length),null!==(v=y.firstChild);)m=y,y=v;for(;;){if(y===a)break t;if(m===c&&++p===o&&(d=h),m===l&&++g===u&&(f=h),null!==(v=y.nextSibling))break;m=(y=m).parentNode}y=v}c=-1===d||-1===f?null:{start:d,end:f}}else c=null;c=c||{start:0,end:0}}else c=null;zr={focusedElem:a,selectionRange:c},$t=!1,uc=null,hc=!1,Ya=r;do{try{Oc()}catch(T){if(null===Ya)throw Error(s(330));jc(Ya,T),Ya=Ya.nextEffect}}while(null!==Ya);uc=null,Ya=r;do{try{for(a=e;null!==Ya;){var b=Ya.flags;if(16&b&&me(Ya.stateNode,""),128&b){var w=Ya.alternate;if(null!==w){var E=w.ref;null!==E&&("function"===typeof E?E(null):E.current=null)}}switch(1038&b){case 2:_a(Ya),Ya.flags&=-3;break;case 6:_a(Ya),Ya.flags&=-3,Ta(Ya.alternate,Ya);break;case 1024:Ya.flags&=-1025;break;case 1028:Ya.flags&=-1025,Ta(Ya.alternate,Ya);break;case 4:Ta(Ya.alternate,Ya);break;case 8:ka(a,c=Ya);var _=c.alternate;wa(c),null!==_&&wa(_)}Ya=Ya.nextEffect}}catch(T){if(null===Ya)throw Error(s(330));jc(Ya,T),Ya=Ya.nextEffect}}while(null!==Ya);if(E=zr,w=gr(),b=E.focusedElem,a=E.selectionRange,w!==b&&b&&b.ownerDocument&&pr(b.ownerDocument.documentElement,b)){null!==a&&yr(b)&&(w=a.start,void 0===(E=a.end)&&(E=w),"selectionStart"in b?(b.selectionStart=w,b.selectionEnd=Math.min(E,b.value.length)):(E=(w=b.ownerDocument||document)&&w.defaultView||window).getSelection&&(E=E.getSelection(),c=b.textContent.length,_=Math.min(a.start,c),a=void 0===a.end?_:Math.min(a.end,c),!E.extend&&_>a&&(c=a,a=_,_=c),c=fr(b,_),o=fr(b,a),c&&o&&(1!==E.rangeCount||E.anchorNode!==c.node||E.anchorOffset!==c.offset||E.focusNode!==o.node||E.focusOffset!==o.offset)&&((w=w.createRange()).setStart(c.node,c.offset),E.removeAllRanges(),_>a?(E.addRange(w),E.extend(o.node,o.offset)):(w.setEnd(o.node,o.offset),E.addRange(w))))),w=[];for(E=b;E=E.parentNode;)1===E.nodeType&&w.push({element:E,left:E.scrollLeft,top:E.scrollTop});for("function"===typeof b.focus&&b.focus(),b=0;b<w.length;b++)(E=w[b]).element.scrollLeft=E.left,E.element.scrollTop=E.top}$t=!!jr,zr=jr=null,e.current=n,Ya=r;do{try{for(b=e;null!==Ya;){var S=Ya.flags;if(36&S&&ma(b,Ya.alternate,Ya),128&S){w=void 0;var A=Ya.ref;if(null!==A){var k=Ya.stateNode;Ya.tag,w=k,"function"===typeof A?A(w):A.current=w}}Ya=Ya.nextEffect}}catch(T){if(null===Ya)throw Error(s(330));jc(Ya,T),Ya=Ya.nextEffect}}while(null!==Ya);Ya=null,Mi(),Da=i}else e.current=n;if(Za)Za=!1,ec=e,tc=t;else for(Ya=r;null!==Ya;)t=Ya.nextEffect,Ya.nextEffect=null,8&Ya.flags&&((S=Ya).sibling=null,S.stateNode=null),Ya=t;if(0===(r=e.pendingLanes)&&(Ja=null),1===r?e===sc?oc++:(oc=0,sc=e):oc=0,n=n.stateNode,Si&&"function"===typeof Si.onCommitFiberRoot)try{Si.onCommitFiberRoot(_i,n,void 0,64===(64&n.current.flags))}catch(T){}if(yc(e,Ki()),Qa)throw Qa=!1,e=Xa,Xa=null,e;return 0!==(8&Da)||Gi(),null}function Oc(){for(;null!==Ya;){var e=Ya.alternate;hc||null===uc||(0!==(8&Ya.flags)?Ze(Ya,uc)&&(hc=!0):13===Ya.tag&&Ca(e,Ya)&&Ze(Ya,uc)&&(hc=!0));var t=Ya.flags;0!==(256&t)&&ya(e,Ya),0===(512&t)||Za||(Za=!0,Wi(97,(function(){return Bc(),null}))),Ya=Ya.nextEffect}}function Bc(){if(90!==tc){var e=97<tc?97:tc;return tc=90,Hi(e,Uc)}return!1}function Lc(e,t){nc.push(t,e),Za||(Za=!0,Wi(97,(function(){return Bc(),null})))}function Mc(e,t){rc.push(t,e),Za||(Za=!0,Wi(97,(function(){return Bc(),null})))}function Uc(){if(null===ec)return!1;var e=ec;if(ec=null,0!==(48&Da))throw Error(s(331));var t=Da;Da|=32;var n=rc;rc=[];for(var r=0;r<n.length;r+=2){var i=n[r],o=n[r+1],a=i.destroy;if(i.destroy=void 0,"function"===typeof a)try{a()}catch(l){if(null===o)throw Error(s(330));jc(o,l)}}for(n=nc,nc=[],r=0;r<n.length;r+=2){i=n[r],o=n[r+1];try{var c=i.create;i.destroy=c()}catch(l){if(null===o)throw Error(s(330));jc(o,l)}}for(c=e.current.firstEffect;null!==c;)e=c.nextEffect,c.nextEffect=null,8&c.flags&&(c.sibling=null,c.stateNode=null),c=e;return Da=t,Gi(),!0}function Fc(e,t,n){uo(e,t=da(0,t=la(n,t),1)),t=dc(),null!==(e=gc(e,1))&&(Kt(e,1,t),yc(e,t))}function jc(e,t){if(3===e.tag)Fc(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){Fc(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"===typeof n.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===Ja||!Ja.has(r))){var i=fa(n,e=la(t,e),1);if(uo(n,i),i=dc(),null!==(n=gc(n,1)))Kt(n,1,i),yc(n,i);else if("function"===typeof r.componentDidCatch&&(null===Ja||!Ja.has(r)))try{r.componentDidCatch(t,e)}catch(o){}break}}n=n.return}}function zc(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=dc(),e.pingedLanes|=e.suspendedLanes&n,Na===e&&(Ba&n)===n&&(4===Ua||3===Ua&&(62914560&Ba)===Ba&&500>Ki()-Ha?Ac(e,0):qa|=n),yc(e,t)}function Kc(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0===(2&(t=e.mode))?t=1:0===(4&t)?t=99===qi()?1:2:(0===cc&&(cc=ja),0===(t=jt(62914560&~cc))&&(t=4194304))),n=dc(),null!==(e=gc(e,t))&&(Kt(e,t,n),yc(e,n))}function qc(e,t,n,r){this.tag=e,this.key=n,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=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Vc(e,t,n,r){return new qc(e,t,n,r)}function Hc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Wc(e,t){var n=e.alternate;return null===n?((n=Vc(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Gc(e,t,n,r,i,o){var a=2;if(r=e,"function"===typeof e)Hc(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case A:return $c(n.children,i,o,t);case L:a=8,i|=16;break;case k:a=8,i|=1;break;case T:return(e=Vc(12,n,t,8|i)).elementType=T,e.type=T,e.lanes=o,e;case x:return(e=Vc(13,n,t,i)).type=x,e.elementType=x,e.lanes=o,e;case P:return(e=Vc(19,n,t,i)).elementType=P,e.lanes=o,e;case M:return Yc(n,i,o,t);case U:return(e=Vc(24,n,t,i)).elementType=U,e.lanes=o,e;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 D:a=14;break e;case N:a=16,r=null;break e;case O:a=22;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=Vc(a,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function $c(e,t,n,r){return(e=Vc(7,e,r,t)).lanes=n,e}function Yc(e,t,n,r){return(e=Vc(23,e,r,t)).elementType=M,e.lanes=n,e}function Qc(e,t,n){return(e=Vc(6,e,null,t)).lanes=n,e}function Xc(e,t,n){return(t=Vc(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Jc(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=zt(0),this.expirationTimes=zt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zt(0),this.mutableSourceEagerHydrationData=null}function Zc(e,t,n,r){var i=t.current,o=dc(),a=fc(i);e:if(n){t:{if(Ye(n=n._reactInternals)!==n||1!==n.tag)throw Error(s(170));var c=n;do{switch(c.tag){case 3:c=c.stateNode.context;break t;case 1:if(yi(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break t}}c=c.return}while(null!==c);throw Error(s(171))}if(1===n.tag){var l=n.type;if(yi(l)){n=bi(n,l,c);break e}}n=c}else n=hi;return null===t.context?t.context=n:t.pendingContext=n,(t=lo(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),uo(i,t),pc(i,a,o),a}function el(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function tl(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function nl(e,t){tl(e,t),(e=e.alternate)&&tl(e,t)}function rl(e,t,n){var r=null!=n&&null!=n.hydrationOptions&&n.hydrationOptions.mutableSources||null;if(n=new Jc(e,t,null!=n&&!0===n.hydrate),t=Vc(3,null,null,2===t?7:1===t?3:0),n.current=t,t.stateNode=n,ao(t),e[Zr]=n.current,Pr(8===e.nodeType?e.parentNode:e),r)for(e=0;e<r.length;e++){var i=(t=r[e])._getVersion;i=i(t._source),null==n.mutableSourceEagerHydrationData?n.mutableSourceEagerHydrationData=[t,i]:n.mutableSourceEagerHydrationData.push(t,i)}this._internalRoot=n}function il(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function ol(e,t,n,r,i){var o=n._reactRootContainer;if(o){var s=o._internalRoot;if("function"===typeof i){var a=i;i=function(){var e=el(s);a.call(e)}}Zc(t,s,e,i)}else{if(o=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new rl(e,0,t?{hydrate:!0}:void 0)}(n,r),s=o._internalRoot,"function"===typeof i){var c=i;i=function(){var e=el(s);c.call(e)}}Ec((function(){Zc(t,s,e,i)}))}return el(s)}function sl(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!il(t))throw Error(s(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:S,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)}$a=function(e,t,n){var r=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||fi.current)Ls=!0;else{if(0===(n&r)){switch(Ls=!1,t.tag){case 3:Ws(t),Go();break;case 5:Bo(t);break;case 1:yi(t.type)&&wi(t);break;case 4:No(t,t.stateNode.containerInfo);break;case 10:r=t.memoizedProps.value;var i=t.type._context;ui(Xi,i._currentValue),i._currentValue=r;break;case 13:if(null!==t.memoizedState)return 0!==(n&t.child.childLanes)?Js(e,t,n):(ui(Mo,1&Mo.current),null!==(t=oa(e,t,n))?t.sibling:null);ui(Mo,1&Mo.current);break;case 19:if(r=0!==(n&t.childLanes),0!==(64&e.flags)){if(r)return ia(e,t,n);t.flags|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),ui(Mo,Mo.current),r)break;return null;case 23:case 24:return t.lanes=0,zs(e,t,n)}return oa(e,t,n)}Ls=0!==(16384&e.flags)}else Ls=!1;switch(t.lanes=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=gi(t,di.current),io(t,n),i=ss(null,t,r,e,i,n),t.flags|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,yi(r)){var o=!0;wi(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,ao(t);var a=r.getDerivedStateFromProps;"function"===typeof a&&yo(t,r,a,e),i.updater=mo,t.stateNode=i,i._reactInternals=t,Eo(t,r,e,n),t=Hs(null,t,r,!0,o,n)}else t.tag=0,Ms(null,t,i,n),t=t.child;return t;case 16:i=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=(o=i._init)(i._payload),t.type=i,o=t.tag=function(e){if("function"===typeof e)return Hc(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===R)return 11;if(e===D)return 14}return 2}(i),e=Qi(i,e),o){case 0:t=qs(null,t,i,e,n);break e;case 1:t=Vs(null,t,i,e,n);break e;case 11:t=Us(null,t,i,e,n);break e;case 14:t=Fs(null,t,i,Qi(i.type,e),r,n);break e}throw Error(s(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,qs(e,t,r,i=t.elementType===r?i:Qi(r,i),n);case 1:return r=t.type,i=t.pendingProps,Vs(e,t,r,i=t.elementType===r?i:Qi(r,i),n);case 3:if(Ws(t),r=t.updateQueue,null===e||null===r)throw Error(s(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,co(e,t),fo(t,r,null,n),(r=t.memoizedState.element)===i)Go(),t=oa(e,t,n);else{if((o=(i=t.stateNode).hydrate)&&(jo=Gr(t.stateNode.containerInfo.firstChild),Fo=t,o=zo=!0),o){if(null!=(e=i.mutableSourceEagerHydrationData))for(i=0;i<e.length;i+=2)(o=e[i])._workInProgressVersionPrimary=e[i+1],$o.push(o);for(n=Io(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|1024,n=n.sibling}else Ms(e,t,r,n),Go();t=t.child}return t;case 5:return Bo(t),null===e&&Vo(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,qr(r,i)?a=null:null!==o&&qr(r,o)&&(t.flags|=16),Ks(e,t),Ms(e,t,a,n),t.child;case 6:return null===e&&Vo(t),null;case 13:return Js(e,t,n);case 4:return No(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=To(t,null,r,n):Ms(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,Us(e,t,r,i=t.elementType===r?i:Qi(r,i),n);case 7:return Ms(e,t,t.pendingProps,n),t.child;case 8:case 12:return Ms(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value;var c=t.type._context;if(ui(Xi,c._currentValue),c._currentValue=o,null!==a)if(c=a.value,0===(o=lr(c,o)?0:0|("function"===typeof r._calculateChangedBits?r._calculateChangedBits(c,o):1073741823))){if(a.children===i.children&&!fi.current){t=oa(e,t,n);break e}}else for(null!==(c=t.child)&&(c.return=t);null!==c;){var l=c.dependencies;if(null!==l){a=c.child;for(var u=l.firstContext;null!==u;){if(u.context===r&&0!==(u.observedBits&o)){1===c.tag&&((u=lo(-1,n&-n)).tag=2,uo(c,u)),c.lanes|=n,null!==(u=c.alternate)&&(u.lanes|=n),ro(c.return,n),l.lanes|=n;break}u=u.next}}else a=10===c.tag&&c.type===t.type?null:c.child;if(null!==a)a.return=c;else for(a=c;null!==a;){if(a===t){a=null;break}if(null!==(c=a.sibling)){c.return=a.return,a=c;break}a=a.return}c=a}Ms(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=(o=t.pendingProps).children,io(t,n),r=r(i=oo(i,o.unstable_observedBits)),t.flags|=1,Ms(e,t,r,n),t.child;case 14:return o=Qi(i=t.type,t.pendingProps),Fs(e,t,i,o=Qi(i.type,o),r,n);case 15:return js(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Qi(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,yi(r)?(e=!0,wi(t)):e=!1,io(t,n),bo(t,r,i),Eo(t,r,i,n),Hs(null,t,r,!0,e,n);case 19:return ia(e,t,n);case 23:case 24:return zs(e,t,n)}throw Error(s(156,t.tag))},rl.prototype.render=function(e){Zc(e,this._internalRoot,null,null)},rl.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Zc(null,e,null,(function(){t[Zr]=null}))},et=function(e){13===e.tag&&(pc(e,4,dc()),nl(e,4))},tt=function(e){13===e.tag&&(pc(e,67108864,dc()),nl(e,67108864))},nt=function(e){if(13===e.tag){var t=dc(),n=fc(e);pc(e,n,t),nl(e,n)}},rt=function(e,t){return t()},Te=function(e,t,n){switch(t){case"input":if(ne(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=ii(r);if(!i)throw Error(s(90));X(r),ne(r,i)}}}break;case"textarea":le(e,n);break;case"select":null!=(t=n.value)&&se(e,!!n.multiple,t,!1)}},De=wc,Ne=function(e,t,n,r,i){var o=Da;Da|=4;try{return Hi(98,e.bind(null,t,n,r,i))}finally{0===(Da=o)&&(Ga(),Gi())}},Oe=function(){0===(49&Da)&&(function(){if(null!==ic){var e=ic;ic=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,yc(e,Ki())}))}Gi()}(),Bc())},Be=function(e,t){var n=Da;Da|=2;try{return e(t)}finally{0===(Da=n)&&(Ga(),Gi())}};var al={Events:[ni,ri,ii,xe,Pe,Bc,{current:!1}]},cl={findFiberByHostInstance:ti,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},ll={bundleType:cl.bundleType,version:cl.version,rendererPackageName:cl.rendererPackageName,rendererConfig:cl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Je(e))?null:e.stateNode},findFiberByHostInstance:cl.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ul=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ul.isDisabled&&ul.supportsFiber)try{_i=ul.inject(ll),Si=ul}catch(ge){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=al,t.createPortal=sl,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(s(188));throw Error(s(268,Object.keys(e)))}return e=null===(e=Je(t))?null:e.stateNode},t.flushSync=function(e,t){var n=Da;if(0!==(48&n))return e(t);Da|=1;try{if(e)return Hi(99,e.bind(null,t))}finally{Da=n,Gi()}},t.hydrate=function(e,t,n){if(!il(t))throw Error(s(200));return ol(null,e,t,!0,n)},t.render=function(e,t,n){if(!il(t))throw Error(s(200));return ol(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!il(e))throw Error(s(40));return!!e._reactRootContainer&&(Ec((function(){ol(null,null,e,!1,(function(){e._reactRootContainer=null,e[Zr]=null}))})),!0)},t.unstable_batchedUpdates=wc,t.unstable_createPortal=function(e,t){return sl(e,t,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)},t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!il(n))throw Error(s(200));if(null==e||void 0===e._reactInternals)throw Error(s(38));return ol(e,t,n,!1,r)},t.version="17.0.2"},4164:(e,t,n)=>{"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=n(4463)},1372:(e,t)=>{"use strict";var n="function"===typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,g=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,m=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function E(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case h:case o:case a:case s:case f:return e;default:switch(e=e&&e.$$typeof){case l:case d:case y:case g:case c:return e;default:return t}}case i:return t}}}function _(e){return E(e)===h}t.AsyncMode=u,t.ConcurrentMode=h,t.ContextConsumer=l,t.ContextProvider=c,t.Element=r,t.ForwardRef=d,t.Fragment=o,t.Lazy=y,t.Memo=g,t.Portal=i,t.Profiler=a,t.StrictMode=s,t.Suspense=f,t.isAsyncMode=function(e){return _(e)||E(e)===u},t.isConcurrentMode=_,t.isContextConsumer=function(e){return E(e)===l},t.isContextProvider=function(e){return E(e)===c},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===d},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===y},t.isMemo=function(e){return E(e)===g},t.isPortal=function(e){return E(e)===i},t.isProfiler=function(e){return E(e)===a},t.isStrictMode=function(e){return E(e)===s},t.isSuspense=function(e){return E(e)===f},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===o||e===h||e===a||e===s||e===f||e===p||"object"===typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===c||e.$$typeof===l||e.$$typeof===d||e.$$typeof===v||e.$$typeof===b||e.$$typeof===w||e.$$typeof===m)},t.typeOf=E},7441:(e,t,n)=>{"use strict";e.exports=n(1372)},6374:(e,t,n)=>{"use strict";n(1725);var r=n(2791),i=60103;if(60107,"function"===typeof Symbol&&Symbol.for){var o=Symbol.for;i=o("react.element"),o("react.fragment")}var s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a=Object.prototype.hasOwnProperty,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var r,o={},l=null,u=null;for(r in void 0!==n&&(l=""+n),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!c.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:i,type:e,key:l,ref:u,props:o,_owner:s.current}}t.jsx=l,t.jsxs=l},9117:(e,t,n)=>{"use strict";var r=n(1725),i=60103,o=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var s=60109,a=60110,c=60112;t.Suspense=60113;var l=60115,u=60116;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;i=h("react.element"),o=h("react.portal"),t.Fragment=h("react.fragment"),t.StrictMode=h("react.strict_mode"),t.Profiler=h("react.profiler"),s=h("react.provider"),a=h("react.context"),c=h("react.forward_ref"),t.Suspense=h("react.suspense"),l=h("react.memo"),u=h("react.lazy")}var d="function"===typeof Symbol&&Symbol.iterator;function f(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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 p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g={};function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||p}function m(){}function v(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||p}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error(f(85));this.updater.enqueueSetState(this,e,t,"setState")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},m.prototype=y.prototype;var b=v.prototype=new m;b.constructor=v,r(b,y.prototype),b.isPureReactComponent=!0;var w={current:null},E=Object.prototype.hasOwnProperty,_={key:!0,ref:!0,__self:!0,__source:!0};function S(e,t,n){var r,o={},s=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(s=""+t.key),t)E.call(t,r)&&!_.hasOwnProperty(r)&&(o[r]=t[r]);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(r in c=e.defaultProps)void 0===o[r]&&(o[r]=c[r]);return{$$typeof:i,type:e,key:s,ref:a,props:o,_owner:w.current}}function A(e){return"object"===typeof e&&null!==e&&e.$$typeof===i}var k=/\/+/g;function T(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 I(e,t,n,r,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 i:case o:c=!0}}if(c)return s=s(c=e),e=""===r?"."+T(c,0):r,Array.isArray(s)?(n="",null!=e&&(n=e.replace(k,"$&/")+"/"),I(s,t,n,"",(function(e){return e}))):null!=s&&(A(s)&&(s=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,n+(!s.key||c&&c.key===s.key?"":(""+s.key).replace(k,"$&/")+"/")+e)),t.push(s)),1;if(c=0,r=""===r?".":r+":",Array.isArray(e))for(var l=0;l<e.length;l++){var u=r+T(a=e[l],l);c+=I(a,t,n,u,s)}else if(u=function(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=d&&e[d]||e["@@iterator"])?e:null}(e),"function"===typeof u)for(e=u.call(e),l=0;!(a=e.next()).done;)c+=I(a=a.value,t,n,u=r+T(a,l++),s);else if("object"===a)throw t=""+e,Error(f(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return c}function C(e,t,n){if(null==e)return e;var r=[],i=0;return I(e,r,"","",(function(e){return t.call(n,e,i++)})),r}function R(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var x={current:null};function P(){var e=x.current;if(null===e)throw Error(f(321));return e}var D={ReactCurrentDispatcher:x,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:w,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:C,forEach:function(e,t,n){C(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return C(e,(function(){t++})),t},toArray:function(e){return C(e,(function(e){return e}))||[]},only:function(e){if(!A(e))throw Error(f(143));return e}},t.Component=y,t.PureComponent=v,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,t.cloneElement=function(e,t,n){if(null===e||void 0===e)throw Error(f(267,e));var o=r({},e.props),s=e.key,a=e.ref,c=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,c=w.current),void 0!==t.key&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(u in t)E.call(t,u)&&!_.hasOwnProperty(u)&&(o[u]=void 0===t[u]&&void 0!==l?l[u]:t[u])}var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){l=Array(u);for(var h=0;h<u;h++)l[h]=arguments[h+2];o.children=l}return{$$typeof:i,type:e.type,key:s,ref:a,props:o,_owner:c}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:a,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=S,t.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=A,t.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:R}},t.memo=function(e,t){return{$$typeof:l,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return P().useCallback(e,t)},t.useContext=function(e,t){return P().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return P().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return P().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return P().useLayoutEffect(e,t)},t.useMemo=function(e,t){return P().useMemo(e,t)},t.useReducer=function(e,t,n){return P().useReducer(e,t,n)},t.useRef=function(e){return P().useRef(e)},t.useState=function(e){return P().useState(e)},t.version="17.0.2"},2791:(e,t,n)=>{"use strict";e.exports=n(9117)},184:(e,t,n)=>{"use strict";e.exports=n(6374)},449:(e,t,n)=>{"use strict";e.exports=s;var r=n(8193),i=s.prototype,o=new Date%1e9;function s(e){e=e||{},this.id=e.id||(1e9*Math.random()>>>0)+o++,this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,n,r=this.items.length;r--;)t=this.items[r],n=new Date(t.expires)-new Date,this._lookup[t.key]=t,n>0?this.expire(t.key,n):n<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,n){var r=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,r?(clearTimeout(r.timeout),this.items.splice(this.items.indexOf(r),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),n&&("ttl"in n&&this.expire(e,n.ttl),"meta"in n&&(i.meta=n.meta),n.refresh&&(i.refresh=n.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var n=t||0,i=this._lookup[e];if(!i)return this;if("string"===typeof n&&(n=r(t)),"number"!==typeof n)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),n),i.expires=Number(new Date)+n,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e,t=new Array(this.items.length),n=t.length;n--;)e=this.items[n],t[n]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}},6327:(e,t,n)=>{"use strict";var r=n(206),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 n=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(c,t);return r(n,255)}e.exports=function(e,t){var n=t&&t.replacement||"",r=l(e,n);return""===n?r:l(r,"")}},6813:(e,t)=>{"use strict";var n,r,i,o;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}}if("undefined"===typeof window||"function"!==typeof MessageChannel){var l=null,u=null,h=function(){if(null!==l)try{var e=t.unstable_now();l(!0,e),l=null}catch(n){throw setTimeout(h,0),n}};n=function(e){null!==l?setTimeout(n,0,e):(l=e,setTimeout(h,0))},r=function(e,t){u=setTimeout(e,t)},i=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var d=window.setTimeout,f=window.clearTimeout;if("undefined"!==typeof console){var p=window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!==typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var g=!1,y=null,m=-1,v=5,b=0;t.unstable_shouldYield=function(){return t.unstable_now()>=b},o=function(){},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"):v=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,E=w.port2;w.port1.onmessage=function(){if(null!==y){var e=t.unstable_now();b=e+v;try{y(!0,e)?E.postMessage(null):(g=!1,y=null)}catch(n){throw E.postMessage(null),n}}else g=!1},n=function(e){y=e,g||(g=!0,E.postMessage(null))},r=function(e,n){m=d((function(){e(t.unstable_now())}),n)},i=function(){f(m),m=-1}}function _(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,i=e[r];if(!(void 0!==i&&0<k(i,t)))break e;e[r]=t,e[n]=i,n=r}}function S(e){return void 0===(e=e[0])?null:e}function A(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var o=2*(r+1)-1,s=e[o],a=o+1,c=e[a];if(void 0!==s&&0>k(s,n))void 0!==c&&0>k(c,s)?(e[r]=c,e[a]=n,r=a):(e[r]=s,e[o]=n,r=o);else{if(!(void 0!==c&&0>k(c,n)))break e;e[r]=c,e[a]=n,r=a}}}return t}return null}function k(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var T=[],I=[],C=1,R=null,x=3,P=!1,D=!1,N=!1;function O(e){for(var t=S(I);null!==t;){if(null===t.callback)A(I);else{if(!(t.startTime<=e))break;A(I),t.sortIndex=t.expirationTime,_(T,t)}t=S(I)}}function B(e){if(N=!1,O(e),!D)if(null!==S(T))D=!0,n(L);else{var t=S(I);null!==t&&r(B,t.startTime-e)}}function L(e,n){D=!1,N&&(N=!1,i()),P=!0;var o=x;try{for(O(n),R=S(T);null!==R&&(!(R.expirationTime>n)||e&&!t.unstable_shouldYield());){var s=R.callback;if("function"===typeof s){R.callback=null,x=R.priorityLevel;var a=s(R.expirationTime<=n);n=t.unstable_now(),"function"===typeof a?R.callback=a:R===S(T)&&A(T),O(n)}else A(T);R=S(T)}if(null!==R)var c=!0;else{var l=S(I);null!==l&&r(B,l.startTime-n),c=!1}return c}finally{R=null,x=o,P=!1}}var M=o;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(){D||P||(D=!0,n(L))},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return S(T)},t.unstable_next=function(e){switch(x){case 1:case 2:case 3:var t=3;break;default:t=x}var n=x;x=t;try{return e()}finally{x=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=M,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=x;x=e;try{return t()}finally{x=n}},t.unstable_scheduleCallback=function(e,o,s){var a=t.unstable_now();switch("object"===typeof s&&null!==s?s="number"===typeof(s=s.delay)&&0<s?a+s:a:s=a,e){case 1:var c=-1;break;case 2:c=250;break;case 5:c=1073741823;break;case 4:c=1e4;break;default:c=5e3}return e={id:C++,callback:o,priorityLevel:e,startTime:s,expirationTime:c=s+c,sortIndex:-1},s>a?(e.sortIndex=s,_(I,e),null===S(T)&&e===S(I)&&(N?i():N=!0,r(B,s-a))):(e.sortIndex=c,_(T,e),D||P||(D=!0,n(L))),e},t.unstable_wrapCallback=function(e){var t=x;return function(){var n=x;x=t;try{return e.apply(this,arguments)}finally{x=n}}}},5296:(e,t,n)=>{"use strict";e.exports=n(6813)},2145:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Nouns=t.Adjectives=void 0,t.Adjectives=["Adorable","Adventurous","Agressive","Alert","Alive","Amused","Angry","Annoyed","Annoying","silent","empty","dry","dark","summer","icy","delicate","quiet","white","cool","spring","winter","patient","twilight","dawn","crimson","wispy","weathered","blue","billowing","broken","cold","damp","falling","frosty","green","long","late","lingering","bold","little","morning","muddy","old","red","rough","still","small","sparkling","throbbing","shy","wandering","withered","wild","black","young","holy","solitary","fragrant","aged","snowy","proud","floral","restless","divine","polished","ancient","purple","lively","nameless"],t.Nouns=["waterfall","river","breeze","moon","rain","wind","sea","morning","snow","lake","sunset","pine","shadow","leaf","dawn","glitter","forest","hill","cloud","meadow","sun","glade","bird","brook","butterfly","bush","dew","dust","field","fire","flower","firefly","feather","grass","haze","mountain","night","pond","darkness","snowflake","silence","sound","sky","shape","surf","thunder","violet","water","wildflower","wave","water","resonance","sun","wood","dream","cherry","tree","fog","frost","voice","paper","frog","smoke","star"]},2861:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2145);t.default=()=>r.Adjectives[Math.floor(Math.random()*r.Adjectives.length)]+" "+r.Nouns[Math.floor(Math.random()*r.Nouns.length)]},8555:(e,t,n)=>{"use strict";var r=n(2861);Object.defineProperty(t,"R",{enumerable:!0,get:function(){return r.default}})},206:(e,t,n)=>{"use strict";var r=n(9022),i=n(4847);e.exports=r.bind(null,i)},9022:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function n(e){return e>=56320&&e<=57343}e.exports=function(e,r,i){if("string"!==typeof r)throw new Error("Input must be string");for(var o,s,a=r.length,c=0,l=0;l<a;l+=1){if(o=r.charCodeAt(l),s=r[l],t(o)&&n(r.charCodeAt(l+1))&&(s+=r[l+=1]),(c+=e(s))===i)return r.slice(0,l+1);if(c>i)return r.slice(0,l-s.length+1)}return r}},5942:(e,t,n)=>{"use strict";var r=n(7248)},3210:(e,t,n)=>{"use strict";n(5942)},1561:(e,t,n)=>{"use strict";var r=n(2791);var i="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,c=r.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(r){return!0}}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=o({inst:{value:n,getSnapshot:t}}),i=r[0].inst,u=r[1];return a((function(){i.value=n,i.getSnapshot=t,l(i)&&u({inst:i})}),[e,n,t]),s((function(){return l(i)&&u({inst:i}),e((function(){l(i)&&u({inst:i})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},7248:(e,t,n)=>{"use strict";e.exports=n(1561)},4847:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function n(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!==typeof e)throw new Error("Input must be string");for(var r=e.length,i=0,o=null,s=null,a=0;a<r;a++)n(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}},3522:e=>{e.exports=function e(r,i){var o,s=0,a=0,c=i=i||0,l=r.length;do{if(c>=l||a>49)throw e.bytes=0,new RangeError("Could not decode varint");o=r[c++],s+=a<28?(o&n)<<a:(o&n)*Math.pow(2,a),a+=7}while(o>=t);return e.bytes=c-i,s};var t=128,n=127},6993: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>=r;)o[s++]=255&i|t,i/=128;for(;i&n;)o[s++]=255&i|t,i>>>=7;return o[s]=0|i,e.bytes=s-a+1,o};var t=128,n=-128,r=Math.pow(2,31)},4561:(e,t,n)=>{e.exports={encode:n(6993),decode:n(3522),encodingLength:n(2570)}},2570:e=>{var t=Math.pow(2,7),n=Math.pow(2,14),r=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<n?2:e<r?3:e<i?4:e<o?5:e<s?6:e<a?7:e<c?8:e<l?9:10}},7420:()=>{},5856:()=>{},5819:()=>{},1265:()=>{},5539:()=>{}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.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(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"===typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"===typeof n.then)return n}var i=Object.create(null);__webpack_require__.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&r&&n;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>n[e]));return o.default=()=>n,__webpack_require__.d(i,o),i}})(),__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__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})},__webpack_require__.p="/web-chat/";var __webpack_exports__={};(()=>{"use strict";var e={};__webpack_require__.r(e),__webpack_require__.d(e,{base58btc:()=>vc,base58flickr:()=>bc});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{base32:()=>qc,base32hex:()=>Gc,base32hexpad:()=>Yc,base32hexpadupper:()=>Qc,base32hexupper:()=>$c,base32pad:()=>Hc,base32padupper:()=>Wc,base32upper:()=>Vc,base32z:()=>Xc});var n={};__webpack_require__.r(n),__webpack_require__.d(n,{identity:()=>ul});var r={};__webpack_require__.r(r),__webpack_require__.d(r,{base2:()=>hl});var i={};__webpack_require__.r(i),__webpack_require__.d(i,{base8:()=>dl});var o={};__webpack_require__.r(o),__webpack_require__.d(o,{base10:()=>fl});var s={};__webpack_require__.r(s),__webpack_require__.d(s,{base16:()=>pl,base16upper:()=>gl});var a={};__webpack_require__.r(a),__webpack_require__.d(a,{base36:()=>yl,base36upper:()=>ml});var c={};__webpack_require__.r(c),__webpack_require__.d(c,{base64:()=>vl,base64pad:()=>bl,base64url:()=>wl,base64urlpad:()=>El});var l={};__webpack_require__.r(l),__webpack_require__.d(l,{base256emoji:()=>kl});var u={};__webpack_require__.r(u),__webpack_require__.d(u,{sha256:()=>Rl,sha512:()=>xl});var h={};__webpack_require__.r(h),__webpack_require__.d(h,{identity:()=>Dl});var d={};__webpack_require__.r(d),__webpack_require__.d(d,{code:()=>Ol,decode:()=>Ll,encode:()=>Bl,name:()=>Nl});var f={};__webpack_require__.r(f),__webpack_require__.d(f,{code:()=>jl,decode:()=>Kl,encode:()=>zl,name:()=>Fl});var p={};__webpack_require__.r(p),__webpack_require__.d(p,{Ed25519PrivateKey:()=>nv,Ed25519PublicKey:()=>tv,generateKeyPair:()=>ov,generateKeyPairFromSeed:()=>sv,unmarshalEd25519PrivateKey:()=>rv,unmarshalEd25519PublicKey:()=>iv});var g={};__webpack_require__.r(g),__webpack_require__.d(g,{RsaPrivateKey:()=>Cb,RsaPublicKey:()=>Ib,fromJwk:()=>Pb,generateKeyPair:()=>Db,unmarshalRsaPrivateKey:()=>Rb,unmarshalRsaPublicKey:()=>xb});var y={};__webpack_require__.r(y),__webpack_require__.d(y,{Secp256k1PrivateKey:()=>Bb,Secp256k1PublicKey:()=>Ob,generateKeyPair:()=>Ub,unmarshalSecp256k1PrivateKey:()=>Lb,unmarshalSecp256k1PublicKey:()=>Mb});var m={};__webpack_require__.r(m),__webpack_require__.d(m,{base58btc:()=>mj,base58flickr:()=>vj});var v={};__webpack_require__.r(v),__webpack_require__.d(v,{base32:()=>bj,base32hex:()=>Sj,base32hexpad:()=>kj,base32hexpadupper:()=>Tj,base32hexupper:()=>Aj,base32pad:()=>Ej,base32padupper:()=>_j,base32upper:()=>wj,base32z:()=>Ij});var b={};__webpack_require__.r(b),__webpack_require__.d(b,{identity:()=>Uj});var w={};__webpack_require__.r(w),__webpack_require__.d(w,{base2:()=>Fj});var E={};__webpack_require__.r(E),__webpack_require__.d(E,{base8:()=>jj});var _={};__webpack_require__.r(_),__webpack_require__.d(_,{base10:()=>zj});var S={};__webpack_require__.r(S),__webpack_require__.d(S,{base16:()=>Kj,base16upper:()=>qj});var A={};__webpack_require__.r(A),__webpack_require__.d(A,{base36:()=>Vj,base36upper:()=>Hj});var k={};__webpack_require__.r(k),__webpack_require__.d(k,{base64:()=>Wj,base64pad:()=>Gj,base64url:()=>$j,base64urlpad:()=>Yj});var T={};__webpack_require__.r(T),__webpack_require__.d(T,{base256emoji:()=>Zj});var I={};__webpack_require__.r(I),__webpack_require__.d(I,{sha256:()=>rz,sha512:()=>iz});var C={};__webpack_require__.r(C),__webpack_require__.d(C,{identity:()=>sz});var R={};__webpack_require__.r(R),__webpack_require__.d(R,{code:()=>cz,decode:()=>uz,encode:()=>lz,name:()=>az});var x={};__webpack_require__.r(x),__webpack_require__.d(x,{code:()=>pz,decode:()=>yz,encode:()=>gz,name:()=>fz});var P=__webpack_require__(2791),D=__webpack_require__.t(P,2),N=__webpack_require__(4164);function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},O.apply(this,arguments)}const B=function(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}};var L=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;const M=B((function(e){return L.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));var U=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(r){0}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){return e.parentNode&&e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0},e}(),F=Math.abs,j=String.fromCharCode,z=Object.assign;function K(e){return e.trim()}function q(e,t,n){return e.replace(t,n)}function V(e,t){return e.indexOf(t)}function H(e,t){return 0|e.charCodeAt(t)}function W(e,t,n){return e.slice(t,n)}function G(e){return e.length}function $(e){return e.length}function Y(e,t){return t.push(e),e}var Q=1,X=1,J=0,Z=0,ee=0,te="";function ne(e,t,n,r,i,o,s){return{value:e,root:t,parent:n,type:r,props:i,children:o,line:Q,column:X,length:s,return:""}}function re(e,t){return z(ne("",null,null,"",null,null,0),e,{length:-e.length},t)}function ie(){return ee=Z>0?H(te,--Z):0,X--,10===ee&&(X=1,Q--),ee}function oe(){return ee=Z<J?H(te,Z++):0,X++,10===ee&&(X=1,Q++),ee}function se(){return H(te,Z)}function ae(){return Z}function ce(e,t){return W(te,e,t)}function le(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ue(e){return Q=X=1,J=G(te=e),Z=0,[]}function he(e){return te="",e}function de(e){return K(ce(Z-1,ge(91===e?e+2:40===e?e+1:e)))}function fe(e){for(;(ee=se())&&ee<33;)oe();return le(e)>2||le(ee)>3?"":" "}function pe(e,t){for(;--t&&oe()&&!(ee<48||ee>102||ee>57&&ee<65||ee>70&&ee<97););return ce(e,ae()+(t<6&&32==se()&&32==oe()))}function ge(e){for(;oe();)switch(ee){case e:return Z;case 34:case 39:34!==e&&39!==e&&ge(ee);break;case 40:41===e&&ge(e);break;case 92:oe()}return Z}function ye(e,t){for(;oe()&&e+ee!==57&&(e+ee!==84||47!==se()););return"/*"+ce(t,Z-1)+"*"+j(47===e?e:oe())}function me(e){for(;!le(se());)oe();return ce(e,Z)}var ve="-ms-",be="-moz-",we="-webkit-",Ee="comm",_e="rule",Se="decl",Ae="@import",ke="@keyframes";function Te(e,t){for(var n="",r=$(e),i=0;i<r;i++)n+=t(e[i],i,e,t)||"";return n}function Ie(e,t,n,r){switch(e.type){case Ae:case Se:return e.return=e.return||e.value;case Ee:return"";case ke:return e.return=e.value+"{"+Te(e.children,r)+"}";case _e:e.value=e.props.join(",")}return G(n=Te(e.children,r))?e.return=e.value+"{"+n+"}":""}function Ce(e){return he(Re("",null,null,null,[""],e=ue(e),0,[0],e))}function Re(e,t,n,r,i,o,s,a,c){for(var l=0,u=0,h=s,d=0,f=0,p=0,g=1,y=1,m=1,v=0,b="",w=i,E=o,_=r,S=b;y;)switch(p=v,v=oe()){case 40:if(108!=p&&58==H(S,h-1)){-1!=V(S+=q(de(v),"&","&\f"),"&\f")&&(m=-1);break}case 34:case 39:case 91:S+=de(v);break;case 9:case 10:case 13:case 32:S+=fe(p);break;case 92:S+=pe(ae()-1,7);continue;case 47:switch(se()){case 42:case 47:Y(Pe(ye(oe(),ae()),t,n),c);break;default:S+="/"}break;case 123*g:a[l++]=G(S)*m;case 125*g:case 59:case 0:switch(v){case 0:case 125:y=0;case 59+u:f>0&&G(S)-h&&Y(f>32?De(S+";",r,n,h-1):De(q(S," ","")+";",r,n,h-2),c);break;case 59:S+=";";default:if(Y(_=xe(S,t,n,l,u,i,a,b,w=[],E=[],h),o),123===v)if(0===u)Re(S,t,_,_,w,o,h,a,E);else switch(99===d&&110===H(S,3)?100:d){case 100:case 109:case 115:Re(e,_,_,r&&Y(xe(e,_,_,0,0,i,a,b,i,w=[],h),E),i,E,h,a,r?w:E);break;default:Re(S,_,_,_,[""],E,0,a,E)}}l=u=f=0,g=m=1,b=S="",h=s;break;case 58:h=1+G(S),f=p;default:if(g<1)if(123==v)--g;else if(125==v&&0==g++&&125==ie())continue;switch(S+=j(v),v*g){case 38:m=u>0?1:(S+="\f",-1);break;case 44:a[l++]=(G(S)-1)*m,m=1;break;case 64:45===se()&&(S+=de(oe())),d=se(),u=h=G(b=S+=me(ae())),v++;break;case 45:45===p&&2==G(S)&&(g=0)}}return o}function xe(e,t,n,r,i,o,s,a,c,l,u){for(var h=i-1,d=0===i?o:[""],f=$(d),p=0,g=0,y=0;p<r;++p)for(var m=0,v=W(e,h+1,h=F(g=s[p])),b=e;m<f;++m)(b=K(g>0?d[m]+" "+v:q(v,/&\f/g,d[m])))&&(c[y++]=b);return ne(e,t,n,0===i?_e:a,c,l,u)}function Pe(e,t,n){return ne(e,t,n,Ee,j(ee),W(e,2,-2),0)}function De(e,t,n,r){return ne(e,t,n,Se,W(e,0,r),W(e,r+1,-1),r)}var Ne=function(e,t,n){for(var r=0,i=0;r=i,i=se(),38===r&&12===i&&(t[n]=1),!le(i);)oe();return ce(e,Z)},Oe=function(e,t){return he(function(e,t){var n=-1,r=44;do{switch(le(r)){case 0:38===r&&12===se()&&(t[n]=1),e[n]+=Ne(Z-1,t,n);break;case 2:e[n]+=de(r);break;case 4:if(44===r){e[++n]=58===se()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=j(r)}}while(r=oe());return e}(ue(e),t))},Be=new WeakMap,Le=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Be.get(n))&&!r){Be.set(e,!0);for(var i=[],o=Oe(t,i),s=n.props,a=0,c=0;a<o.length;a++)for(var l=0;l<s.length;l++,c++)e.props[c]=i[a]?o[a].replace(/&\f/g,s[l]):s[l]+" "+o[a]}}},Me=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function Ue(e,t){switch(function(e,t){return 45^H(e,0)?(((t<<2^H(e,0))<<2^H(e,1))<<2^H(e,2))<<2^H(e,3):0}(e,t)){case 5103:return we+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return we+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return we+e+be+e+ve+e+e;case 6828:case 4268:return we+e+ve+e+e;case 6165:return we+e+ve+"flex-"+e+e;case 5187:return we+e+q(e,/(\w+).+(:[^]+)/,we+"box-$1$2"+ve+"flex-$1$2")+e;case 5443:return we+e+ve+"flex-item-"+q(e,/flex-|-self/,"")+e;case 4675:return we+e+ve+"flex-line-pack"+q(e,/align-content|flex-|-self/,"")+e;case 5548:return we+e+ve+q(e,"shrink","negative")+e;case 5292:return we+e+ve+q(e,"basis","preferred-size")+e;case 6060:return we+"box-"+q(e,"-grow","")+we+e+ve+q(e,"grow","positive")+e;case 4554:return we+q(e,/([^-])(transform)/g,"$1"+we+"$2")+e;case 6187:return q(q(q(e,/(zoom-|grab)/,we+"$1"),/(image-set)/,we+"$1"),e,"")+e;case 5495:case 3959:return q(e,/(image-set\([^]*)/,we+"$1$`$1");case 4968:return q(q(e,/(.+:)(flex-)?(.*)/,we+"box-pack:$3"+ve+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+we+e+e;case 4095:case 3583:case 4068:case 2532:return q(e,/(.+)-inline(.+)/,we+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(G(e)-1-t>6)switch(H(e,t+1)){case 109:if(45!==H(e,t+4))break;case 102:return q(e,/(.+:)(.+)-([^]+)/,"$1"+we+"$2-$3$1"+be+(108==H(e,t+3)?"$3":"$2-$3"))+e;case 115:return~V(e,"stretch")?Ue(q(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==H(e,t+1))break;case 6444:switch(H(e,G(e)-3-(~V(e,"!important")&&10))){case 107:return q(e,":",":"+we)+e;case 101:return q(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+we+(45===H(e,14)?"inline-":"")+"box$3$1"+we+"$2$3$1"+ve+"$2box$3")+e}break;case 5936:switch(H(e,t+11)){case 114:return we+e+ve+q(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return we+e+ve+q(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return we+e+ve+q(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return we+e+ve+e+e}return e}var Fe=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Se:e.return=Ue(e.value,e.length);break;case ke:return Te([re(e,{value:q(e.value,"@","@"+we)})],r);case _e:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Te([re(e,{props:[q(t,/:(read-\w+)/,":"+be+"$1")]})],r);case"::placeholder":return Te([re(e,{props:[q(t,/:(plac\w+)/,":"+we+"input-$1")]}),re(e,{props:[q(t,/:(plac\w+)/,":"+be+"$1")]}),re(e,{props:[q(t,/:(plac\w+)/,ve+"input-$1")]})],r)}return""}))}}];const je=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r=e.stylisPlugins||Fe;var i,o,s={},a=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)s[t[n]]=!0;a.push(e)}));var c,l,u=[Ie,(l=function(e){c.insert(e)},function(e){e.root||(e=e.return)&&l(e)})],h=function(e){var t=$(e);return function(n,r,i,o){for(var s="",a=0;a<t;a++)s+=e[a](n,r,i,o)||"";return s}}([Le,Me].concat(r,u));o=function(e,t,n,r){c=n,Te(Ce(e?e+"{"+t.styles+"}":t.styles),h),r&&(d.inserted[t.name]=!0)};var d={key:t,sheet:new U({key:t,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:o};return d.sheet.hydrate(a),d};const ze=function(e){var t=new WeakMap;return function(n){if(t.has(n))return t.get(n);var r=e(n);return t.set(n,r),r}};function Ke(e,t,n){var r="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):r+=n+" "})),r}var qe=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},Ve=function(e,t,n){qe(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var i=t;do{e.insert(t===i?"."+r:"",i,e.sheet,!0);i=i.next}while(void 0!==i)}};const He=function(e){for(var t,n=0,r=0,i=e.length;i>=4;++r,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(i){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)};const We={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var Ge=/[A-Z]|^ms/g,$e=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Ye=function(e){return 45===e.charCodeAt(1)},Qe=function(e){return null!=e&&"boolean"!==typeof e},Xe=B((function(e){return Ye(e)?e:e.replace(Ge,"-$&").toLowerCase()})),Je=function(e,t){switch(e){case"animation":case"animationName":if("string"===typeof t)return t.replace($e,(function(e,t,n){return et={name:t,styles:n,next:et},t}))}return 1===We[e]||Ye(e)||"number"!==typeof t||0===t?t:t+"px"};function Ze(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return et={name:n.name,styles:n.styles,next:et},n.name;if(void 0!==n.styles){var r=n.next;if(void 0!==r)for(;void 0!==r;)et={name:r.name,styles:r.styles,next:et},r=r.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var i=0;i<n.length;i++)r+=Ze(e,t,n[i])+";";else for(var o in n){var s=n[o];if("object"!==typeof s)null!=t&&void 0!==t[s]?r+=o+"{"+t[s]+"}":Qe(s)&&(r+=Xe(o)+":"+Je(o,s)+";");else if(!Array.isArray(s)||"string"!==typeof s[0]||null!=t&&void 0!==t[s[0]]){var a=Ze(e,t,s);switch(o){case"animation":case"animationName":r+=Xe(o)+":"+a+";";break;default:r+=o+"{"+a+"}"}}else for(var c=0;c<s.length;c++)Qe(s[c])&&(r+=Xe(o)+":"+Je(o,s[c])+";")}return r}(e,t,n);case"function":if(void 0!==e){var i=et,o=n(e);return et=i,Ze(e,t,o)}}if(null==t)return n;var s=t[n];return void 0!==s?s:n}var et,tt=/label:\s*([^\s;\n{]+)\s*(;|$)/g;var nt=function(e,t,n){if(1===e.length&&"object"===typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,i="";et=void 0;var o=e[0];null==o||void 0===o.raw?(r=!1,i+=Ze(n,t,o)):i+=o[0];for(var s=1;s<e.length;s++)i+=Ze(n,t,e[s]),r&&(i+=o[s]);tt.lastIndex=0;for(var a,c="";null!==(a=tt.exec(i));)c+="-"+a[1];return{name:He(i)+c,styles:i,next:et}},rt=!!D.useInsertionEffect&&D.useInsertionEffect,it=rt||function(e){return e()},ot=(rt||P.useLayoutEffect,{}.hasOwnProperty),st=(0,P.createContext)("undefined"!==typeof HTMLElement?je({key:"css"}):null);st.Provider;var at=function(e){return(0,P.forwardRef)((function(t,n){var r=(0,P.useContext)(st);return e(t,r,n)}))},ct=(0,P.createContext)({});var lt=function(){return(0,P.useContext)(ct)},ut=ze((function(e){return ze((function(t){return function(e,t){return"function"===typeof t?t(e):O({},e,t)}(e,t)}))})),ht=function(e){var t=(0,P.useContext)(ct);return e.theme!==t&&(t=ut(t)(e.theme)),(0,P.createElement)(ct.Provider,{value:t},e.children)};var dt="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",ft=function(e,t){var n={};for(var r in t)ot.call(t,r)&&(n[r]=t[r]);return n[dt]=e,n},pt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;qe(t,n,r);it((function(){return Ve(t,n,r)}));return null},gt=at((function(e,t,n){var r=e.css;"string"===typeof r&&void 0!==t.registered[r]&&(r=t.registered[r]);var i=e[dt],o=[r],s="";"string"===typeof e.className?s=Ke(t.registered,o,e.className):null!=e.className&&(s=e.className+" ");var a=nt(o,void 0,(0,P.useContext)(ct));s+=t.key+"-"+a.name;var c={};for(var l in e)ot.call(e,l)&&"css"!==l&&l!==dt&&(c[l]=e[l]);return c.ref=n,c.className=s,(0,P.createElement)(P.Fragment,null,(0,P.createElement)(pt,{cache:t,serialized:a,isStringTag:"string"===typeof i}),(0,P.createElement)(i,c))}));var yt=M,mt=function(e){return"theme"!==e},vt=function(e){return"string"===typeof e&&e.charCodeAt(0)>96?yt:mt},bt=function(e,t,n){var r;if(t){var i=t.shouldForwardProp;r=e.__emotion_forwardProp&&i?function(t){return e.__emotion_forwardProp(t)&&i(t)}:i}return"function"!==typeof r&&n&&(r=e.__emotion_forwardProp),r},wt=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;qe(t,n,r);it((function(){return Ve(t,n,r)}));return null};const Et=function e(t,n){var r,i,o=t.__emotion_real===t,s=o&&t.__emotion_base||t;void 0!==n&&(r=n.label,i=n.target);var a=bt(t,n,o),c=a||vt(s),l=!c("as");return function(){var u=arguments,h=o&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&h.push("label:"+r+";"),null==u[0]||void 0===u[0].raw)h.push.apply(h,u);else{0,h.push(u[0][0]);for(var d=u.length,f=1;f<d;f++)h.push(u[f],u[0][f])}var p=at((function(e,t,n){var r=l&&e.as||s,o="",u=[],d=e;if(null==e.theme){for(var f in d={},e)d[f]=e[f];d.theme=(0,P.useContext)(ct)}"string"===typeof e.className?o=Ke(t.registered,u,e.className):null!=e.className&&(o=e.className+" ");var p=nt(h.concat(u),t.registered,d);o+=t.key+"-"+p.name,void 0!==i&&(o+=" "+i);var g=l&&void 0===a?vt(r):c,y={};for(var m in e)l&&"as"===m||g(m)&&(y[m]=e[m]);return y.className=o,y.ref=n,(0,P.createElement)(P.Fragment,null,(0,P.createElement)(wt,{cache:t,serialized:p,isStringTag:"string"===typeof r}),(0,P.createElement)(r,y))}));return p.displayName=void 0!==r?r:"Styled("+("string"===typeof s?s:s.displayName||s.name||"Component")+")",p.defaultProps=t.defaultProps,p.__emotion_real=p,p.__emotion_base=s,p.__emotion_styles=h,p.__emotion_forwardProp=a,Object.defineProperty(p,"toString",{value:function(){return"."+i}}),p.withComponent=function(t,r){return e(t,O({},n,r,{shouldForwardProp:bt(p,r,!0)})).apply(void 0,h)},p}};var _t=Et.bind();["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){_t[e]=_t(e)}));const St=_t;var At={}.hasOwnProperty;function kt(e,t){return At.call(t,e)}var Tt=Array.isArray;function It(e){return"object"===typeof e&&null!==e&&!Tt(e)}function Ct(e,t){return Object.keys(t).reduce((function(n,r){return n[r]=e(t[r]),n}),{})}function Rt(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(e(r))return r}}function xt(e,t){for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}function Pt(e){return e}function Dt(e,t){return Object.keys(t).forEach((function(n){e(t[n],n)}))}function Nt(){return Math.random().toString(36).substring(2)}function Ot(e){return 0===(Tt(e)?e:Object.keys(e)).length}function Bt(e,t){return Object.keys(t).reduce((function(n,r){return n[e(r)]=t[r],n}),{})}function Lt(e,t){if(Ot(t))return e;var n={};return Dt((function(r,i){if(kt(i,t))if(It(e[i])&&It(t[i]))n[i]=Lt(e[i],t[i]);else if(Tt(e[i])&&Tt(t[i])){var o=Math.max(e[i].length,t[i].length);n[i]=new Array(o);for(var s=0;s<o;s++)s in t[i]?n[i][s]=t[i][s]:s in e[i]&&(n[i][s]=e[i][s])}else n[i]=t[i];else n[i]=e[i]}),e),Dt((function(e,r){kt(r,n)||(n[r]=t[r])}),t),n}function Mt(){}function Ut(e,t){return Object.keys(t).reduce((function(n,r){return e(t[r],r)||(n[r]=t[r]),n}),{})}function Ft(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(void 0,arguments))}}function jt(e,t){return Object.keys(t).reduce((function(n,r){return e(t[r],r)&&(n[r]=t[r]),n}),{})}var zt=/\s+$/;__webpack_require__(2110);var Kt=function(e,t){var n=arguments;if(null==t||!ot.call(t,"css"))return P.createElement.apply(void 0,n);var r=n.length,i=new Array(r);i[0]=gt,i[1]=ft(e,t);for(var o=2;o<r;o++)i[o]=n[o];return P.createElement.apply(null,i)};function qt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return nt(t)}var Vt=function e(t){for(var n=t.length,r=0,i="";r<n;r++){var o=t[r];if(null!=o){var s=void 0;switch(typeof o){case"boolean":break;case"object":if(Array.isArray(o))s=e(o);else for(var a in s="",o)o[a]&&a&&(s&&(s+=" "),s+=a);break;default:s=o}s&&(i&&(i+=" "),i+=s)}}return i};var Ht=function(e){var t=e.cache,n=e.serializedArr;it((function(){for(var e=0;e<n.length;e++)Ve(t,n[e],!1)}));return null},Wt=at((function(e,t){var n=[],r=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var o=nt(r,t.registered);return n.push(o),qe(t,o,!1),t.key+"-"+o.name},i={css:r,cx:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return function(e,t,n){var r=[],i=Ke(e,r,n);return r.length<2?n:i+t(r)}(t.registered,r,Vt(n))},theme:(0,P.useContext)(ct)},o=e.children(i);return!0,(0,P.createElement)(P.Fragment,null,(0,P.createElement)(Ht,{cache:t,serializedArr:n}),o)}));function Gt(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var $t=__webpack_require__(2007),Yt=__webpack_require__.n($t);function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qt(e,t)}function Xt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Qt(e,t)}const Jt=!1,Zt=P.createContext(null);var en=function(e){return e.scrollTop},tn="unmounted",nn="exited",rn="entering",on="entered",sn="exiting",an=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var i,o=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?o?(i=nn,r.appearStatus=rn):i=on:i=t.unmountOnExit||t.mountOnEnter?tn:nn,r.state={status:i},r.nextCallback=null,r}Xt(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===tn?{status:nn}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==rn&&n!==on&&(t=rn):n!==rn&&n!==on||(t=sn)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!==typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===rn){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:N.findDOMNode(this);n&&en(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===nn&&this.setState({status:tn})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,i=this.props.nodeRef?[r]:[N.findDOMNode(this),r],o=i[0],s=i[1],a=this.getTimeouts(),c=r?a.appear:a.enter;!e&&!n||Jt?this.safeSetState({status:on},(function(){t.props.onEntered(o)})):(this.props.onEnter(o,s),this.safeSetState({status:rn},(function(){t.props.onEntering(o,s),t.onTransitionEnd(c,(function(){t.safeSetState({status:on},(function(){t.props.onEntered(o,s)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:N.findDOMNode(this);t&&!Jt?(this.props.onExit(r),this.safeSetState({status:sn},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:nn},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:nn},(function(){e.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:N.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],o=i[0],s=i[1];this.props.addEndListener(o,s)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===tn)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,Gt(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return P.createElement(Zt.Provider,{value:null},"function"===typeof n?n(e,r):P.cloneElement(P.Children.only(n),r))},t}(P.Component);function cn(){}an.contextType=Zt,an.propTypes={},an.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:cn,onEntering:cn,onEntered:cn,onExit:cn,onExiting:cn,onExited:cn},an.UNMOUNTED=tn,an.EXITED=nn,an.ENTERING=rn,an.ENTERED=on,an.EXITING=sn;const ln=an;function un(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var hn=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"===typeof n.className?n.className=un(n.className,r):n.setAttribute("class",un(n.className&&n.className.baseVal||"",r)));var n,r}))},dn=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1];t.removeClasses(i,"exit"),t.addClass(i,o?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,n)},t.onEntering=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1]?"appear":"enter";t.addClass(i,o,"active"),t.props.onEntering&&t.props.onEntering(e,n)},t.onEntered=function(e,n){var r=t.resolveArguments(e,n),i=r[0],o=r[1]?"appear":"enter";t.removeClasses(i,o),t.addClass(i,o,"done"),t.props.onEntered&&t.props.onEntered(e,n)},t.onExit=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"appear"),t.removeClasses(n,"enter"),t.addClass(n,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var n=t.resolveArguments(e)[0];t.addClass(n,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var n=t.resolveArguments(e)[0];t.removeClasses(n,"exit"),t.addClass(n,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,n){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,n]},t.getClassNames=function(e){var n=t.props.classNames,r="string"===typeof n,i=r?""+(r&&n?n+"-":"")+e:n[e];return{baseClassName:i,activeClassName:r?i+"-active":n[e+"Active"],doneClassName:r?i+"-done":n[e+"Done"]}},t}Xt(t,e);var n=t.prototype;return n.addClass=function(e,t,n){var r=this.getClassNames(t)[n+"ClassName"],i=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&i&&(r+=" "+i),"active"===n&&e&&en(e),r&&(this.appliedClasses[t][n]=r,function(e,t){e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"===typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r}))}(e,r))},n.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,i=n.active,o=n.done;this.appliedClasses[t]={},r&&hn(e,r),i&&hn(e,i),o&&hn(e,o)},n.render=function(){var e=this.props,t=(e.classNames,Gt(e,["classNames"]));return P.createElement(ln,O({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(P.Component);dn.defaultProps={classNames:""},dn.propTypes={};const fn=dn;function pn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gn(e,t){var n=Object.create(null);return e&&P.Children.map(e,(function(e){return e})).forEach((function(e){n[e.key]=function(e){return t&&(0,P.isValidElement)(e)?t(e):e}(e)})),n}function yn(e,t,n){return null!=n[t]?n[t]:e.props[t]}function mn(e,t,n){var r=gn(e.children),i=function(e,t){function n(n){return n in t?t[n]:e[n]}e=e||{},t=t||{};var r,i=Object.create(null),o=[];for(var s in e)s in t?o.length&&(i[s]=o,o=[]):o.push(s);var a={};for(var c in t){if(i[c])for(r=0;r<i[c].length;r++){var l=i[c][r];a[i[c][r]]=n(l)}a[c]=n(c)}for(r=0;r<o.length;r++)a[o[r]]=n(o[r]);return a}(t,r);return Object.keys(i).forEach((function(o){var s=i[o];if((0,P.isValidElement)(s)){var a=o in t,c=o in r,l=t[o],u=(0,P.isValidElement)(l)&&!l.props.in;!c||a&&!u?c||!a||u?c&&a&&(0,P.isValidElement)(l)&&(i[o]=(0,P.cloneElement)(s,{onExited:n.bind(null,s),in:l.props.in,exit:yn(s,"exit",e),enter:yn(s,"enter",e)})):i[o]=(0,P.cloneElement)(s,{in:!1}):i[o]=(0,P.cloneElement)(s,{onExited:n.bind(null,s),in:!0,exit:yn(s,"exit",e),enter:yn(s,"enter",e)})}})),i}var vn=Object.values||function(e){return Object.keys(e).map((function(t){return e[t]}))},bn=function(e){function t(t,n){var r,i=(r=e.call(this,t,n)||this).handleExited.bind(pn(r));return r.state={contextValue:{isMounting:!0},handleExited:i,firstRender:!0},r}Xt(t,e);var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var n,r,i=t.children,o=t.handleExited;return{children:t.firstRender?(n=e,r=o,gn(n.children,(function(e){return(0,P.cloneElement)(e,{onExited:r.bind(null,e),in:!0,appear:yn(e,"appear",n),enter:yn(e,"enter",n),exit:yn(e,"exit",n)})}))):mn(e,i,o),firstRender:!1}},n.handleExited=function(e,t){var n=gn(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState((function(t){var n=O({},t.children);return delete n[e.key],{children:n}})))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=Gt(e,["component","childFactory"]),i=this.state.contextValue,o=vn(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,null===t?P.createElement(Zt.Provider,{value:i},o):P.createElement(Zt.Provider,{value:i},P.createElement(t,r,o))},t}(P.Component);bn.propTypes={},bn.defaultProps={component:"div",childFactory:function(e){return e}};const wn=bn;function En(e,t){return t||(t=e.slice(0)),e.raw=t,e}function _n(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=_n(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const Sn=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=_n(e))&&(r&&(r+=" "),r+=t);return r},An="undefined"!==typeof window?P.useLayoutEffect:()=>{};let kn=new Map;function Tn(e,t){if(e===t)return e;let n=kn.get(e);if(n)return n(t),t;let r=kn.get(t);return r?(r(e),e):t}function In(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){for(let e of t)"function"===typeof e&&e(...arguments)}}function Cn(){let e={...arguments.length<=0?void 0:arguments[0]};for(let t=1;t<arguments.length;t++){let n=t<0||arguments.length<=t?void 0:arguments[t];for(let t in n){let r=e[t],i=n[t];"function"===typeof r&&"function"===typeof i&&"o"===t[0]&&"n"===t[1]&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90?e[t]=In(r,i):"className"!==t&&"UNSAFE_className"!==t||"string"!==typeof r||"string"!==typeof i?"id"===t&&r&&i?e.id=Tn(r,i):e[t]=void 0!==i?i:r:e[t]=Sn(r,i)}}return e}const Rn=new Set(["id"]),xn=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),Pn=/^(data-.*)$/;function Dn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{labelable:n,propNames:r}=t,i={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Rn.has(o)||n&&xn.has(o)||(null===r||void 0===r?void 0:r.has(o))||Pn.test(o))&&(i[o]=e[o]);return i}function Nn(e){if(function(){if(null==On){On=!1;try{document.createElement("div").focus({get preventScroll(){return On=!0,!0}})}catch(e){}}return On}())e.focus({preventScroll:!0});else{let t=function(e){var t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft});return n}(e);e.focus(),function(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}let On=null;let Bn=new Map,Ln=new Set;function Mn(){if("undefined"===typeof window)return;let e=t=>{let n=Bn.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),Bn.delete(t.target)),0===Bn.size)){for(let e of Ln)e();Ln.clear()}};document.body.addEventListener("transitionrun",(t=>{let n=Bn.get(t.target);n||(n=new Set,Bn.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function Un(e){requestAnimationFrame((()=>{0===Bn.size?e():Ln.add(e)}))}"undefined"!==typeof document&&("loading"!==document.readyState?Mn():document.addEventListener("DOMContentLoaded",Mn));function Fn(){let e=(0,P.useRef)(new Map),t=(0,P.useCallback)(((t,n,r,i)=>{let o=(null===i||void 0===i?void 0:i.once)?function(){e.current.delete(r),r(...arguments)}:r;e.current.set(r,{type:n,eventTarget:t,fn:o,options:i}),t.addEventListener(n,r,i)}),[]),n=(0,P.useCallback)(((t,n,r,i)=>{var o;let s=(null===(o=e.current.get(r))||void 0===o?void 0:o.fn)||r;t.removeEventListener(n,s,i),e.current.delete(r)}),[]),r=(0,P.useCallback)((()=>{e.current.forEach(((e,t)=>{n(e.eventTarget,e.type,t,e.options)}))}),[n]);return(0,P.useEffect)((()=>r),[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function jn(e,t){An((()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref.current=null}}),[e,t])}"undefined"!==typeof window&&window.visualViewport;new Map;function zn(e){var t;return"undefined"!==typeof window&&null!=window.navigator&&((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands.some((t=>e.test(t.brand))))||e.test(window.navigator.userAgent))}function Kn(e){var t;return"undefined"!==typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function qn(){return Kn(/^Mac/i)}function Vn(){return Kn(/^iPhone/i)||Kn(/^iPad/i)||qn()&&navigator.maxTouchPoints>1}function Hn(e){return!(0!==e.mozInputSource||!e.isTrusted)||(zn(/Android/i)&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}let Wn="default",Gn="",$n=new WeakMap;function Yn(e){Vn()?("default"===Wn&&(Gn=document.documentElement.style.webkitUserSelect,document.documentElement.style.webkitUserSelect="none"),Wn="disabled"):(e instanceof HTMLElement||e instanceof SVGElement)&&($n.set(e,e.style.userSelect),e.style.userSelect="none")}function Qn(e){if(Vn()){if("disabled"!==Wn)return;Wn="restoring",setTimeout((()=>{Un((()=>{"restoring"===Wn&&("none"===document.documentElement.style.webkitUserSelect&&(document.documentElement.style.webkitUserSelect=Gn||""),Gn="",Wn="default")}))}),300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&$n.has(e)){let t=$n.get(e);"none"===e.style.userSelect&&(e.style.userSelect=t),""===e.getAttribute("style")&&e.removeAttribute("style"),$n.delete(e)}}const Xn=P.createContext(null);function Jn(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:o,isDisabled:s,isPressed:a,preventFocusOnPress:c,shouldCancelOnPointerExit:l,allowTextSelectionOnPress:u,ref:h,...d}=function(e){let t=(0,P.useContext)(Xn);if(t){let{register:n,...r}=t;e=Cn(r,e),n()}return jn(t,e.ref),e}(e),f=(0,P.useRef)(null);f.current={onPress:t,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:o,isDisabled:s,shouldCancelOnPointerExit:l};let[p,g]=(0,P.useState)(!1),y=(0,P.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:m,removeAllGlobalListeners:v}=Fn(),b=(0,P.useMemo)((()=>{let e=y.current,t=(t,n)=>{let{onPressStart:r,onPressChange:i,isDisabled:o}=f.current;o||e.didFirePressStart||(r&&r({type:"pressstart",pointerType:n,target:t.currentTarget,shiftKey:t.shiftKey,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey}),i&&i(!0),e.didFirePressStart=!0,g(!0))},n=function(t,n){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],{onPressEnd:i,onPressChange:o,onPress:s,isDisabled:a}=f.current;e.didFirePressStart&&(e.ignoreClickAfterPress=!0,e.didFirePressStart=!1,i&&i({type:"pressend",pointerType:n,target:t.currentTarget,shiftKey:t.shiftKey,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey}),o&&o(!1),g(!1),s&&r&&!a&&s({type:"press",pointerType:n,target:t.currentTarget,shiftKey:t.shiftKey,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey}))},r=(e,t)=>{let{onPressUp:n,isDisabled:r}=f.current;r||n&&n({type:"pressup",pointerType:t,target:e.currentTarget,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey})},i=t=>{e.isPressed&&(e.isOverTarget&&n(nr(e.target,t),e.pointerType,!1),e.isPressed=!1,e.isOverTarget=!1,e.activePointerId=null,e.pointerType=null,v(),u||Qn(e.target))},o={onKeyDown(n){er(n.nativeEvent,n.currentTarget)&&n.currentTarget.contains(n.target)?(or(n.target,n.key)&&n.preventDefault(),n.stopPropagation(),e.isPressed||n.repeat||(e.target=n.currentTarget,e.isPressed=!0,t(n,"keyboard"),m(document,"keyup",a,!1))):"Enter"===n.key&&Zn(n.currentTarget)&&n.stopPropagation()},onKeyUp(t){er(t.nativeEvent,t.currentTarget)&&!t.repeat&&t.currentTarget.contains(t.target)&&r(nr(e.target,t),"keyboard")},onClick(i){i&&!i.currentTarget.contains(i.target)||i&&0===i.button&&(i.stopPropagation(),s&&i.preventDefault(),e.ignoreClickAfterPress||e.ignoreEmulatedMouseEvents||"virtual"!==e.pointerType&&!Hn(i.nativeEvent)||(s||c||Nn(i.currentTarget),t(i,"virtual"),r(i,"virtual"),n(i,"virtual")),e.ignoreEmulatedMouseEvents=!1,e.ignoreClickAfterPress=!1)}},a=t=>{if(e.isPressed&&er(t,e.target)){or(t.target,t.key)&&t.preventDefault(),t.stopPropagation(),e.isPressed=!1;let r=t.target;n(nr(e.target,t),"keyboard",e.target.contains(r)),v(),e.target instanceof HTMLElement&&e.target.contains(r)&&(Zn(e.target)||"link"===e.target.getAttribute("role"))&&e.target.click()}};if("undefined"!==typeof PointerEvent){o.onPointerDown=n=>{var r;0===n.button&&n.currentTarget.contains(n.target)&&(0===(r=n.nativeEvent).width&&0===r.height||1===r.width&&1===r.height&&0===r.pressure&&0===r.detail&&"mouse"===r.pointerType?e.pointerType="virtual":(ir(n.currentTarget)&&n.preventDefault(),e.pointerType=n.pointerType,n.stopPropagation(),e.isPressed||(e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=n.pointerId,e.target=n.currentTarget,s||c||Nn(n.currentTarget),u||Yn(e.target),t(n,e.pointerType),m(document,"pointermove",a,!1),m(document,"pointerup",l,!1),m(document,"pointercancel",h,!1))))},o.onMouseDown=e=>{e.currentTarget.contains(e.target)&&0===e.button&&(ir(e.currentTarget)&&e.preventDefault(),e.stopPropagation())},o.onPointerUp=t=>{t.currentTarget.contains(t.target)&&"virtual"!==e.pointerType&&0===t.button&&rr(t,t.currentTarget)&&r(t,e.pointerType||t.pointerType)};let a=r=>{r.pointerId===e.activePointerId&&(rr(r,e.target)?e.isOverTarget||(e.isOverTarget=!0,t(nr(e.target,r),e.pointerType)):e.isOverTarget&&(e.isOverTarget=!1,n(nr(e.target,r),e.pointerType,!1),f.current.shouldCancelOnPointerExit&&i(r)))},l=t=>{t.pointerId===e.activePointerId&&e.isPressed&&0===t.button&&(rr(t,e.target)?n(nr(e.target,t),e.pointerType):e.isOverTarget&&n(nr(e.target,t),e.pointerType,!1),e.isPressed=!1,e.isOverTarget=!1,e.activePointerId=null,e.pointerType=null,v(),u||Qn(e.target))},h=e=>{i(e)};o.onDragStart=e=>{e.currentTarget.contains(e.target)&&i(e)}}else{o.onMouseDown=n=>{0===n.button&&n.currentTarget.contains(n.target)&&(ir(n.currentTarget)&&n.preventDefault(),n.stopPropagation(),e.ignoreEmulatedMouseEvents||(e.isPressed=!0,e.isOverTarget=!0,e.target=n.currentTarget,e.pointerType=Hn(n.nativeEvent)?"virtual":"mouse",s||c||Nn(n.currentTarget),t(n,e.pointerType),m(document,"mouseup",a,!1)))},o.onMouseEnter=n=>{n.currentTarget.contains(n.target)&&(n.stopPropagation(),e.isPressed&&!e.ignoreEmulatedMouseEvents&&(e.isOverTarget=!0,t(n,e.pointerType)))},o.onMouseLeave=t=>{t.currentTarget.contains(t.target)&&(t.stopPropagation(),e.isPressed&&!e.ignoreEmulatedMouseEvents&&(e.isOverTarget=!1,n(t,e.pointerType,!1),f.current.shouldCancelOnPointerExit&&i(t)))},o.onMouseUp=t=>{t.currentTarget.contains(t.target)&&(e.ignoreEmulatedMouseEvents||0!==t.button||r(t,e.pointerType))};let a=t=>{0===t.button&&(e.isPressed=!1,v(),e.ignoreEmulatedMouseEvents?e.ignoreEmulatedMouseEvents=!1:(rr(t,e.target)?n(nr(e.target,t),e.pointerType):e.isOverTarget&&n(nr(e.target,t),e.pointerType,!1),e.isOverTarget=!1))};o.onTouchStart=n=>{if(!n.currentTarget.contains(n.target))return;n.stopPropagation();let r=function(e){const{targetTouches:t}=e;return t.length>0?t[0]:null}(n.nativeEvent);r&&(e.activePointerId=r.identifier,e.ignoreEmulatedMouseEvents=!0,e.isOverTarget=!0,e.isPressed=!0,e.target=n.currentTarget,e.pointerType="touch",s||c||Nn(n.currentTarget),u||Yn(e.target),t(n,e.pointerType),m(window,"scroll",l,!0))},o.onTouchMove=r=>{if(!r.currentTarget.contains(r.target))return;if(r.stopPropagation(),!e.isPressed)return;let o=tr(r.nativeEvent,e.activePointerId);o&&rr(o,r.currentTarget)?e.isOverTarget||(e.isOverTarget=!0,t(r,e.pointerType)):e.isOverTarget&&(e.isOverTarget=!1,n(r,e.pointerType,!1),f.current.shouldCancelOnPointerExit&&i(r))},o.onTouchEnd=t=>{if(!t.currentTarget.contains(t.target))return;if(t.stopPropagation(),!e.isPressed)return;let i=tr(t.nativeEvent,e.activePointerId);i&&rr(i,t.currentTarget)?(r(t,e.pointerType),n(t,e.pointerType)):e.isOverTarget&&n(t,e.pointerType,!1),e.isPressed=!1,e.activePointerId=null,e.isOverTarget=!1,e.ignoreEmulatedMouseEvents=!0,u||Qn(e.target),v()},o.onTouchCancel=t=>{t.currentTarget.contains(t.target)&&(t.stopPropagation(),e.isPressed&&i(t))};let l=t=>{e.isPressed&&t.target.contains(e.target)&&i({currentTarget:e.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};o.onDragStart=e=>{e.currentTarget.contains(e.target)&&i(e)}}return o}),[m,s,c,v,u]);return(0,P.useEffect)((()=>()=>{u||Qn(y.current.target)}),[u]),{isPressed:a||p,pressProps:Cn(d,b)}}function Zn(e){return"A"===e.tagName&&e.hasAttribute("href")}function er(e,t){const{key:n,code:r}=e,i=t,o=i.getAttribute("role");return("Enter"===n||" "===n||"Spacebar"===n||"Space"===r)&&!(i instanceof HTMLInputElement&&!ar(i,n)||i instanceof HTMLTextAreaElement||i.isContentEditable)&&(!Zn(i)||"button"===o&&"Enter"!==n)&&!("link"===o&&"Enter"!==n)}function tr(e,t){const n=e.changedTouches;for(let r=0;r<n.length;r++){const e=n[r];if(e.identifier===t)return e}return null}function nr(e,t){return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey}}function rr(e,t){let n=t.getBoundingClientRect(),r=function(e){let t=e.width/2||e.radiusX||0,n=e.height/2||e.radiusY||0;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}(e);return function(e,t){return!(e.left>t.right||t.left>e.right)&&!(e.top>t.bottom||t.top>e.bottom)}(n,r)}function ir(e){return!(e instanceof HTMLElement)||!e.draggable}function or(e,t){return e instanceof HTMLInputElement?!ar(e,t):!(e instanceof HTMLButtonElement)||"submit"!==e.type}Xn.displayName="PressResponderContext";const sr=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function ar(e,t){return"checkbox"===e.type||"radio"===e.type?" "===t:sr.has(e.type)}class cr{isDefaultPrevented(){return this.nativeEvent.defaultPrevented}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPropagationStopped=()=>!0}isPropagationStopped(){return!1}persist(){}constructor(e,t){this.nativeEvent=t,this.target=t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget,this.bubbles=t.bubbles,this.cancelable=t.cancelable,this.defaultPrevented=t.defaultPrevented,this.eventPhase=t.eventPhase,this.isTrusted=t.isTrusted,this.timeStamp=t.timeStamp,this.type=e}}function lr(e){let t=(0,P.useRef)({isFocused:!1,onBlur:e,observer:null});return t.current.onBlur=e,An((()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}}),[]),(0,P.useCallback)((e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let n=e.target,r=e=>{var r,i;t.current.isFocused=!1,n.disabled&&(null===(i=(r=t.current).onBlur)||void 0===i||i.call(r,new cr("blur",e))),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};n.addEventListener("focusout",r,{once:!0}),t.current.observer=new MutationObserver((()=>{t.current.isFocused&&n.disabled&&(t.current.observer.disconnect(),n.dispatchEvent(new FocusEvent("blur")),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0})))})),t.current.observer.observe(n,{attributes:!0,attributeFilter:["disabled"]})}}),[])}function ur(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e;const o=(0,P.useCallback)((e=>{if(e.target===e.currentTarget)return r&&r(e),i&&i(!1),!0}),[r,i]),s=lr(o),a=(0,P.useCallback)((e=>{e.target===e.currentTarget&&(n&&n(e),i&&i(!0),s(e))}),[i,n,s]);return{focusProps:{onFocus:!t&&(n||i||r)?a:void 0,onBlur:t||!r&&!i?void 0:o}}}let hr=null,dr=new Set,fr=!1,pr=!1,gr=!1;const yr={Tab:!0,Escape:!0};function mr(e,t){for(let n of dr)n(e,t)}function vr(e){pr=!0,function(e){return!(e.metaKey||!qn()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(hr="keyboard",mr("keyboard",e))}function br(e){hr="pointer","mousedown"!==e.type&&"pointerdown"!==e.type||(pr=!0,mr("pointer",e))}function wr(e){Hn(e)&&(pr=!0,hr="virtual")}function Er(e){e.target!==window&&e.target!==document&&(pr||gr||(hr="virtual",mr("virtual",e)),pr=!1,gr=!1)}function _r(){pr=!1,gr=!0}function Sr(){if("undefined"===typeof window||fr)return;let e=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(){pr=!0,e.apply(this,arguments)},document.addEventListener("keydown",vr,!0),document.addEventListener("keyup",vr,!0),document.addEventListener("click",wr,!0),window.addEventListener("focus",Er,!0),window.addEventListener("blur",_r,!1),"undefined"!==typeof PointerEvent?(document.addEventListener("pointerdown",br,!0),document.addEventListener("pointermove",br,!0),document.addEventListener("pointerup",br,!0)):(document.addEventListener("mousedown",br,!0),document.addEventListener("mousemove",br,!0),document.addEventListener("mouseup",br,!0)),fr=!0}function Ar(){return"pointer"!==hr}function kr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{isTextInput:t,autoFocus:n}=e,[r,i]=(0,P.useState)(n||Ar());var o,s,a;return o=e=>{i(e)},s=[t],a={isTextInput:t},Sr(),(0,P.useEffect)((()=>{let e=(e,t)=>{(function(e,t,n){return!(e&&"keyboard"===t&&n instanceof KeyboardEvent&&!yr[n.key])})(null===a||void 0===a?void 0:a.isTextInput,e,t)&&o(Ar())};return dr.add(e),()=>{dr.delete(e)}}),s),{isFocusVisible:r}}"undefined"!==typeof document&&("loading"!==document.readyState?Sr():document.addEventListener("DOMContentLoaded",Sr));function Tr(e){if(!e)return;let t=!0;return n=>{let r={...n,preventDefault(){n.preventDefault()},isDefaultPrevented:()=>n.isDefaultPrevented(),stopPropagation(){console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.")},continuePropagation(){t=!1}};e(r),t&&n.stopPropagation()}}function Ir(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Tr(e.onKeyDown),onKeyUp:Tr(e.onKeyUp)}}}var Cr=function(e,t){"function"!==typeof e?e.current=t:e(t)};const Rr=function(e,t){var n=(0,P.useRef)();return(0,P.useCallback)((function(r){e.current=r,n.current&&Cr(n.current,null),n.current=t,t&&Cr(t,r)}),[t])};const xr=P.useLayoutEffect;var Pr=function(e){var t=P.useRef(e);return xr((function(){t.current=e})),t};document;var Dr=function(){return Dr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Dr.apply(this,arguments)};var Nr=function(e,t){return function(n){return Math.max(Math.min(n,t),e)}},Or=function(e){return e%1?Number(e.toFixed(5)):e},Br=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Lr={test:function(e){return"number"===typeof e},parse:parseFloat,transform:function(e){return e}},Mr=Dr(Dr({},Lr),{transform:Nr(0,1)}),Ur=(Dr(Dr({},Lr),{default:1}),function(e){return{test:function(t){return"string"===typeof t&&t.endsWith(e)&&1===t.split(" ").length},parse:parseFloat,transform:function(t){return""+t+e}}}),Fr=(Ur("deg"),Ur("%")),jr=(Ur("px"),Ur("vh"),Ur("vw"),Dr(Dr({},Fr),{parse:function(e){return Fr.parse(e)/100},transform:function(e){return Fr.transform(100*e)}}),function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))}),zr=Nr(0,255),Kr=function(e){return void 0!==e.red},qr=function(e){return void 0!==e.hue};var Vr=function(e){return function(t){if("string"!==typeof t)return t;for(var n={},r=jr(t).replace(/(,|\/)/g," ").split(/ \s*/),i=0;i<4;i++)n[e[i]]=void 0!==r[i]?parseFloat(r[i]):1;return n}},Hr=Dr(Dr({},Lr),{transform:function(e){return Math.round(zr(e))}});function Wr(e,t){return e.startsWith(t)&&Br.test(e)}var Gr={test:function(e){return"string"===typeof e?Wr(e,"rgb"):Kr(e)},parse:Vr(["red","green","blue","alpha"]),transform:function(e){var t=e.red,n=e.green,r=e.blue,i=e.alpha,o=void 0===i?1:i;return function(e){var t=e.red,n=e.green,r=e.blue,i=e.alpha;return"rgba("+t+", "+n+", "+r+", "+(void 0===i?1:i)+")"}({red:Hr.transform(t),green:Hr.transform(n),blue:Hr.transform(r),alpha:Or(Mr.transform(o))})}};Vr(["hue","saturation","lightness","alpha"]),Dr(Dr({},Gr),{test:function(e){return"string"===typeof e&&Wr(e,"#")},parse:function(e){var t="",n="",r="";return e.length>4?(t=e.substr(1,2),n=e.substr(3,2),r=e.substr(5,2)):(t=e.substr(1,1),n=e.substr(2,1),r=e.substr(3,1),t+=t,n+=n,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:1}}});var $r=0;"undefined"!==typeof window&&window.requestAnimationFrame;var Yr=function(e){return function(t,n,r){return void 0!==r?e(t,n,r):function(r){return e(t,n,r)}}},Qr=Yr((function(e,t,n){return Math.min(Math.max(n,e),t)}));var Xr=function(e){return e},Jr=function(e){return void 0===e&&(e=Xr),Yr((function(t,n,r){var i=n-r,o=-(0-t+1)*(0-e(Math.abs(i)));return i<=0?n+o:n-o}))};Jr(),Jr(Math.sqrt),Yr((function(e,t,n){var r=t-e;return((n-e)%r+r)%r+e})),Qr(0,1);__webpack_require__(2951);__webpack_require__(2042);__webpack_require__(3210);__webpack_require__(4014);var Zr,ei="undefined"!==typeof document;!function(){if(void 0!==Zr)return Zr;if(!ei)return Zr=!1,!1;var e=!1,t={get passive(){e=!0}},n=function(){};window.addEventListener("t",n,t),window.removeEventListener("t",n,t),Zr=e}();var ti=new Map,ni=(0,P.createContext)(ti);ni.Provider;function ri(e){return ri=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ri(e)}function ii(e,t,n){return ii=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&Qt(i,n.prototype),i},ii.apply(null,arguments)}function oi(e){var t="function"===typeof Map?new Map:void 0;return oi=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ii(e,arguments,ri(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Qt(r,e)},oi(e)}var si=function(e){function t(t){return pn(e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this)}return Xt(t,e),t}(oi(Error));function ai(e){return Math.round(255*e)}function ci(e,t,n){return ai(e)+","+ai(t)+","+ai(n)}function li(e,t,n,r){if(void 0===r&&(r=ci),0===t)return r(n,n,n);var i=(e%360+360)%360/60,o=(1-Math.abs(2*n-1))*t,s=o*(1-Math.abs(i%2-1)),a=0,c=0,l=0;i>=0&&i<1?(a=o,c=s):i>=1&&i<2?(a=s,c=o):i>=2&&i<3?(c=o,l=s):i>=3&&i<4?(c=s,l=o):i>=4&&i<5?(a=s,l=o):i>=5&&i<6&&(a=o,l=s);var u=n-o/2;return r(a+u,c+u,l+u)}var ui={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var hi=/^#[a-fA-F0-9]{6}$/,di=/^#[a-fA-F0-9]{8}$/,fi=/^#[a-fA-F0-9]{3}$/,pi=/^#[a-fA-F0-9]{4}$/,gi=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,yi=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,mi=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,vi=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function bi(e){if("string"!==typeof e)throw new si(3);var t=function(e){if("string"!==typeof e)return e;var t=e.toLowerCase();return ui[t]?"#"+ui[t]:e}(e);if(t.match(hi))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(di)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(fi))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(pi)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var i=gi.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var o=yi.exec(t.substring(0,50));if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10),alpha:parseFloat(""+o[4])};var s=mi.exec(t);if(s){var a="rgb("+li(parseInt(""+s[1],10),parseInt(""+s[2],10)/100,parseInt(""+s[3],10)/100)+")",c=gi.exec(a);if(!c)throw new si(4,t,a);return{red:parseInt(""+c[1],10),green:parseInt(""+c[2],10),blue:parseInt(""+c[3],10)}}var l=vi.exec(t.substring(0,50));if(l){var u="rgb("+li(parseInt(""+l[1],10),parseInt(""+l[2],10)/100,parseInt(""+l[3],10)/100)+")",h=gi.exec(u);if(!h)throw new si(4,t,u);return{red:parseInt(""+h[1],10),green:parseInt(""+h[2],10),blue:parseInt(""+h[3],10),alpha:parseFloat(""+l[4])}}throw new si(5)}function wi(e){return function(e){var t,n=e.red/255,r=e.green/255,i=e.blue/255,o=Math.max(n,r,i),s=Math.min(n,r,i),a=(o+s)/2;if(o===s)return void 0!==e.alpha?{hue:0,saturation:0,lightness:a,alpha:e.alpha}:{hue:0,saturation:0,lightness:a};var c=o-s,l=a>.5?c/(2-o-s):c/(o+s);switch(o){case n:t=(r-i)/c+(r<i?6:0);break;case r:t=(i-n)/c+2;break;default:t=(n-r)/c+4}return t*=60,void 0!==e.alpha?{hue:t,saturation:l,lightness:a,alpha:e.alpha}:{hue:t,saturation:l,lightness:a}}(bi(e))}var Ei=function(e){return 7===e.length&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e};function _i(e){var t=e.toString(16);return 1===t.length?"0"+t:t}function Si(e){return _i(Math.round(255*e))}function Ai(e,t,n){return Ei("#"+Si(e)+Si(t)+Si(n))}function ki(e,t,n){return li(e,t,n,Ai)}function Ti(e,t,n){if("number"===typeof e&&"number"===typeof t&&"number"===typeof n)return ki(e,t,n);if("object"===typeof e&&void 0===t&&void 0===n)return ki(e.hue,e.saturation,e.lightness);throw new si(1)}function Ii(e,t,n,r){if("number"===typeof e&&"number"===typeof t&&"number"===typeof n&&"number"===typeof r)return r>=1?ki(e,t,n):"rgba("+li(e,t,n)+","+r+")";if("object"===typeof e&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?ki(e.hue,e.saturation,e.lightness):"rgba("+li(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new si(2)}function Ci(e,t,n){if("number"===typeof e&&"number"===typeof t&&"number"===typeof n)return Ei("#"+_i(e)+_i(t)+_i(n));if("object"===typeof e&&void 0===t&&void 0===n)return Ei("#"+_i(e.red)+_i(e.green)+_i(e.blue));throw new si(6)}function Ri(e,t,n,r){if("string"===typeof e&&"number"===typeof t){var i=bi(e);return"rgba("+i.red+","+i.green+","+i.blue+","+t+")"}if("number"===typeof e&&"number"===typeof t&&"number"===typeof n&&"number"===typeof r)return r>=1?Ci(e,t,n):"rgba("+e+","+t+","+n+","+r+")";if("object"===typeof e&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?Ci(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new si(7)}var xi=function(e){return"number"===typeof e.red&&"number"===typeof e.green&&"number"===typeof e.blue&&("number"!==typeof e.alpha||"undefined"===typeof e.alpha)},Pi=function(e){return"number"===typeof e.red&&"number"===typeof e.green&&"number"===typeof e.blue&&"number"===typeof e.alpha},Di=function(e){return"number"===typeof e.hue&&"number"===typeof e.saturation&&"number"===typeof e.lightness&&("number"!==typeof e.alpha||"undefined"===typeof e.alpha)},Ni=function(e){return"number"===typeof e.hue&&"number"===typeof e.saturation&&"number"===typeof e.lightness&&"number"===typeof e.alpha};function Oi(e){if("object"!==typeof e)throw new si(8);if(Pi(e))return Ri(e);if(xi(e))return Ci(e);if(Ni(e))return Ii(e);if(Di(e))return Ti(e);throw new si(8)}function Bi(e,t,n){return function(){var r=n.concat(Array.prototype.slice.call(arguments));return r.length>=t?e.apply(this,r):Bi(e,t,r)}}function Li(e){return Bi(e,e.length,[])}function Mi(e,t,n){return Math.max(e,Math.min(t,n))}function Ui(e,t){if("transparent"===t)return t;var n=wi(t);return Oi(O({},n,{lightness:Mi(0,1,n.lightness-parseFloat(e))}))}var Fi=Li(Ui);function ji(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zi(e){if("virtual"===hr){let t=document.activeElement;Un((()=>{document.activeElement===t&&document.contains(e)&&Nn(e)}))}else Nn(e)}const Ki=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"];Ki.join(":not([hidden]),");Ki.push('[tabindex]:not([tabindex="-1"]):not([disabled])');Ki.join(':not([hidden]):not([tabindex="-1"]),');function qi(e,t){return t.some((t=>t.contains(e)))}class Vi{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(null!==t&&void 0!==t?t:null),i=new Hi({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(null===e)return;let t=this.fastMap.get(e),n=t.parent;for(let i of this.traverse())i!==t&&t.nodeToRestore&&i.nodeToRestore&&t.scopeRef.current&&qi(i.nodeToRestore,t.scopeRef.current)&&(i.nodeToRestore=t.nodeToRestore);let r=t.children;n.removeChild(t),r.size>0&&r.forEach((e=>n.addChild(e))),this.fastMap.delete(t.scopeRef)}traverse(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.root;return function*(){if(null!=t.scopeRef&&(yield t),t.children.size>0)for(let n of t.children)yield*e.traverse(n)}()}clone(){let e=new Vi;for(let t of this.traverse())e.addTreeNode(t.scopeRef,t.parent.scopeRef,t.nodeToRestore);return e}constructor(){ji(this,"fastMap",new Map),this.root=new Hi({scopeRef:null}),this.fastMap.set(null,this.root)}}class Hi{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){ji(this,"children",new Set),ji(this,"contain",!1),this.scopeRef=e.scopeRef}}new Vi;let Wi=P.createContext(null);function Gi(e,t){let{focusProps:n}=ur(e),{keyboardProps:r}=Ir(e),i=Cn(n,r),o=function(e){let t=(0,P.useContext)(Wi)||{};jn(t,e);let{ref:n,...r}=t;return r}(t),s=e.isDisabled?{}:o,a=(0,P.useRef)(e.autoFocus);return(0,P.useEffect)((()=>{a.current&&t.current&&zi(t.current),a.current=!1}),[t]),{focusableProps:Cn({...i,tabIndex:e.excludeFromTabOrder&&!e.isDisabled?-1:void 0},s)}}function $i(e,t){let n,{elementType:r="button",isDisabled:i,onPress:o,onPressStart:s,onPressEnd:a,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:h,href:d,target:f,rel:p,type:g="button"}=e;n="button"===r?{type:g,disabled:i}:{role:"button",tabIndex:i?void 0:0,href:"a"===r&&i?void 0:d,target:"a"===r?f:void 0,type:"input"===r?g:void 0,disabled:"input"===r?i:void 0,"aria-disabled":i&&"input"!==r?i:void 0,rel:"a"===r?p:void 0};let{pressProps:y,isPressed:m}=Jn({onPressStart:s,onPressEnd:a,onPressChange:c,onPress:o,isDisabled:i,preventFocusOnPress:l,ref:t}),{focusableProps:v}=Gi(e,t);u&&(v.tabIndex=i?-1:v.tabIndex);let b=Cn(v,y,Dn(e,{labelable:!0}));return{isPressed:m,buttonProps:Cn(n,b,{"aria-haspopup":e["aria-haspopup"],"aria-expanded":e["aria-expanded"],"aria-controls":e["aria-controls"],"aria-pressed":e["aria-pressed"],onClick:e=>{h&&(h(e),console.warn("onClick is deprecated, please use onPress"))}})}}var Yi={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},Qi=function(e){Object.keys(Yi).forEach((function(t){e.style.setProperty(t,Yi[t],"important")}))},Xi=null,Ji=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize};var Zi=function(){},eo=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],to=!!document.documentElement.currentStyle,no=function(e,t){var n=e.cacheMeasurements,r=e.maxRows,i=e.minRows,o=e.onChange,s=void 0===o?Zi:o,a=e.onHeightChange,c=void 0===a?Zi:a,l=Gt(e,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]);var u=void 0!==l.value,h=(0,P.useRef)(null),d=Rr(h,t),f=(0,P.useRef)(0),p=(0,P.useRef)(),g=function(){var e=h.current,t=n&&p.current?p.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n,r=(n=t,eo.reduce((function(e,t){return e[t]=n[t],e}),{})),i=r.boxSizing;return""===i?null:(to&&"border-box"===i&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px"),{sizingStyle:r,paddingSize:parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),borderSize:parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth)})}(e);if(t){p.current=t;var o=function(e,t,n,r){void 0===n&&(n=1),void 0===r&&(r=1/0),Xi||((Xi=document.createElement("textarea")).setAttribute("tabindex","-1"),Xi.setAttribute("aria-hidden","true"),Qi(Xi)),null===Xi.parentNode&&document.body.appendChild(Xi);var i=e.paddingSize,o=e.borderSize,s=e.sizingStyle,a=s.boxSizing;Object.keys(s).forEach((function(e){var t=e;Xi.style[t]=s[t]})),Qi(Xi),Xi.value=t;var c=Ji(Xi,e);Xi.value="x";var l=Xi.scrollHeight-i,u=l*n;"border-box"===a&&(u=u+i+o),c=Math.max(u,c);var h=l*r;return"border-box"===a&&(h=h+i+o),[c=Math.min(h,c),l]}(t,e.value||e.placeholder||"x",i,r),s=o[0],a=o[1];f.current!==s&&(f.current=s,e.style.setProperty("height",s+"px","important"),c(s,{rowHeight:a}))}};return(0,P.useLayoutEffect)(g),function(e){var t=Pr(e);(0,P.useLayoutEffect)((function(){var e=function(e){t.current(e)};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[])}(g),(0,P.createElement)("textarea",O({},l,{onChange:function(e){u||g(),s(e)},ref:d}))};const ro=(0,P.forwardRef)(no);var io=function(){if("undefined"!==typeof Map)return Map;function e(e,t){var n=-1;return e.some((function(e,r){return e[0]===t&&(n=r,!0)})),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var i=r[n];e.call(t,i[1],i[0])}},t}()}(),oo="undefined"!==typeof window&&"undefined"!==typeof document&&window.document===document,so="undefined"!==typeof __webpack_require__.g&&__webpack_require__.g.Math===Math?__webpack_require__.g:"undefined"!==typeof self&&self.Math===Math?self:"undefined"!==typeof window&&window.Math===Math?window:Function("return this")(),ao="function"===typeof requestAnimationFrame?requestAnimationFrame.bind(so):function(e){return setTimeout((function(){return e(Date.now())}),1e3/60)},co=2;var lo=20,uo=["top","right","bottom","left","width","height","size","weight"],ho="undefined"!==typeof MutationObserver,fo=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,r=!1,i=0;function o(){n&&(n=!1,e()),r&&a()}function s(){ao(o)}function a(){var e=Date.now();if(n){if(e-i<co)return;r=!0}else n=!0,r=!1,setTimeout(s,t);i=e}return a}(this.refresh.bind(this),lo)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.prototype.connect_=function(){oo&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ho?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){oo&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;uo.some((function(e){return!!~n.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),po=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},go=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||so},yo=_o(0,0,0,0);function mo(e){return parseFloat(e)||0}function vo(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce((function(t,n){return t+mo(e["border-"+n+"-width"])}),0)}function bo(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return yo;var r=go(e).getComputedStyle(e),i=function(e){for(var t={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var i=r[n],o=e["padding-"+i];t[i]=mo(o)}return t}(r),o=i.left+i.right,s=i.top+i.bottom,a=mo(r.width),c=mo(r.height);if("border-box"===r.boxSizing&&(Math.round(a+o)!==t&&(a-=vo(r,"left","right")+o),Math.round(c+s)!==n&&(c-=vo(r,"top","bottom")+s)),!function(e){return e===go(e).document.documentElement}(e)){var l=Math.round(a+o)-t,u=Math.round(c+s)-n;1!==Math.abs(l)&&(a-=l),1!==Math.abs(u)&&(c-=u)}return _o(i.left,i.top,a,c)}var wo="undefined"!==typeof SVGGraphicsElement?function(e){return e instanceof go(e).SVGGraphicsElement}:function(e){return e instanceof go(e).SVGElement&&"function"===typeof e.getBBox};function Eo(e){return oo?wo(e)?function(e){var t=e.getBBox();return _o(0,0,t.width,t.height)}(e):bo(e):yo}function _o(e,t,n,r){return{x:e,y:t,width:n,height:r}}var So=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=_o(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=Eo(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),Ao=function(e,t){var n=function(e){var t=e.x,n=e.y,r=e.width,i=e.height,o="undefined"!==typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(o.prototype);return po(s,{x:t,y:n,width:r,height:i,top:n,right:t+r,bottom:i+n,left:t}),s}(t);po(this,{target:e,contentRect:n})},ko=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new io,"function"!==typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!==typeof Element&&Element instanceof Object){if(!(e instanceof go(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new So(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!==typeof Element&&Element instanceof Object){if(!(e instanceof go(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new Ao(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),To="undefined"!==typeof WeakMap?new WeakMap:new io,Io=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=fo.getInstance(),r=new ko(t,n,this);To.set(this,r)};["observe","unobserve","disconnect"].forEach((function(e){Io.prototype[e]=function(){var t;return(t=To.get(this))[e].apply(t,arguments)}}));"undefined"!==typeof so.ResizeObserver&&so.ResizeObserver;var Co=function(e){var t={};if(e.flexFill&&(t.flexGrow=1,t.maxWidth="100%"),e.flexFit&&(t.flexGrow=0),e.noShrink&&(t.flexShrink=0),e.ellipsis&&(t.whiteSpace="nowrap",t.overflow="hidden",t.textOverflow="ellipsis"),e.nowrap&&(t.whiteSpace="nowrap"),"isFocusVisible"in e&&(t["&:focus"]={outlineStyle:e.isFocusVisible?"auto":"none"}),e.preserveLines&&(t.whiteSpace="pre-line"),e.textWrap){var n="break-word";t.wordWrap=n,t.overflowWrap=n,t.wordBreak=n}return t},Ro=(0,P.createContext)(),xo=function(e){var t=e.value,n=e.children;return(0,P.createElement)(ht,{theme:t},(0,P.createElement)(Ro.Provider,{value:t},n))},Po=function(e){return e.charAt(0)!==e.charAt(0).toLowerCase()},Do=function(e,t){return Po(t)},No=(Ut.bind(null,Do),jt.bind(null,Do)),Oo={},Bo=function(e){return t=function(t){return Po(t)?"components":It(e[t])?"propsDescriptions":"themeProps"},n=e,Object.keys(n).reduce((function(e,r){var i=t(r);return e[i]=e[i]||{},e[i][r]=n[r],e}),{});var t,n},Lo=function(e){if(!e)return Oo;var t=e.css,n=e.vars,r=Gt(e,["css","vars"]);return O({css:t,vars:n},Bo(r))},Mo=function(e){return function(t){return function(n){var r=n[e];if(!r)return n;var i=Lo(r),o=i.propsDescriptions,s=i.components;if(!o&&!s)return n;var a=function(e,t,n){void 0===n&&(n={});var r=jt((function(e,n){return t[n]}),n);return Object.keys(r).map((function(t){var n,i=r[t],o=Lo(i),s=o.themeProps,a=o.components;if(!s)return a;var c=((n={})[e]=s,n);return a?O({},c,a):c}))}(e,t,o);return function(e){if(0===e.length)return{};var t=e[0];return e.slice(1).reduce((function(e,t){return Lt(e,t)}),t)}([n,s].concat(a).filter(Boolean))}}},Uo=function(e){var t=e.__ui_kit_name,n=Mo(t);return(0,P.forwardRef)((function(t,r){return(0,P.createElement)(xo,{value:n(t)},(0,P.createElement)(e,O({},t,{ref:r})))}))},Fo=function e(t,n){var r,i,o,s=(r=It,i=n,Object.keys(i).reduce((function(e,t){return r(i[t])&&(e[t]=i[t]),e}),{}));return 0===Object.keys(s)?n:(o=function(e,t){return Object.keys(t).reduce((function(n,r){return n[r]=e(t[r],r),n}),{})}((function(n,r){return It(n)?":"===r[0]?e(t,n):n[Rt((function(e){return t[e]}),Object.keys(n))]||n.default:n}),n),Tt(o)?o.filter((function(e){return null!==e&&void 0!==e&&!Number.isNaN(e)})):Object.keys(o).reduce((function(e,t){var n=o[t];return null===n||void 0===n||Number.isNaN(n)||(e[t]=n),e}),{}))},jo=function(e,t,n){var r=e.theme,i=e.style,o=Lo(r[t]),s=o.css,a=o.vars,c=o.themeProps;return[a?O({},r.vars,a):r.vars,"function"===typeof n&&void 0!==c&&n(c),s&&Fo(e,s),Co(e),"function"===typeof n&&n(O({},c,e)),i]},zo=function(e,t){void 0===t&&(t={});var n=t,r=n.displayName,i=n.displayType,o=n.mapPropsToStyles;var s=St(e,t);return function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];if(n.length>0&&void 0!==n[0].raw){var c=n;n=[c[0][0]];for(var l=1;l<c.length;l++)n.push(c[l],c[0][l])}var u=r||i||null,h=s.apply(void 0,n.concat([function(e){return jo(e,u,o)}]));return h.__ui_kit_name=u,t.section?Object.defineProperty(Uo(h),"toString",{value:h.toString}):h}};var Ko=zo("div",{displayName:"FixedWrapperMaximized",mapPropsToStyles:function(e){var t={};return e.theme&&(t.right="right"===e.theme.FixedWrapperRoot.position?"0":"auto",t.left="left"===e.theme.FixedWrapperRoot.position?"0":"auto"),e.animationDuration&&(t.transition="all "+e.animationDuration+"ms ease-out"),e.state&&(t.transform="entered"===e.state?"none":"scale(0.8) translate(10%, 30%)",t.opacity="entered"===e.state?"1":"0"),e.height&&(t.height=e.height),e.width&&(t.width=e.width),t},target:"ep7mz240"})({name:"1jmpskd",styles:"display:flex;flex-direction:column;max-height:100vh;position:absolute;bottom:0;@media (max-width: 490px){width:100%;height:100%;position:fixed;}"}),qo=function(e){var t=lt();return(0,P.createElement)(ln,{in:e.active,mountOnEnter:!0,timeout:t.FixedWrapperMaximized.animationDuration,unmountOnExit:!0},(function(t){return(0,P.createElement)(Ko,O({},e,{state:t}),P.Children.map(e.children,(function(t){return(0,P.cloneElement)(t,{minimize:e.minimize})})))}))};qo.propTypes={active:$t.bool,children:$t.node.isRequired,minimize:$t.func,style:(0,$t.shape)()};var Vo=zo("div",{displayName:"FixedWrapperMinimized",mapPropsToStyles:function(e){var t=e.state,n=e.theme,r={};return n&&(r.transition="all "+n.FixedWrapperMaximized.animationDuration+"ms ease-out",r.right="right"===n.FixedWrapperRoot.position?"0":"auto",r.left="left"===n.FixedWrapperRoot.position?"0":"auto"),t&&(r.transform="entered"===t?"none":"scale(0.8) translate(10%, 30%)",r.opacity="entered"===t?"1":"0"),r},target:"eq1nrcm0"})({name:"m2cnsn",styles:"width:60px;height:60px;position:absolute;bottom:1em"}),Ho=function(e){var t=lt();return(0,P.createElement)(ln,{in:e.active,mountOnEnter:!0,timeout:t.FixedWrapperMinimized.animationDuration,unmountOnExit:!0},(function(t){return(0,P.createElement)(Vo,O({},e,{state:t}),P.Children.map(e.children,(function(t){return(0,P.cloneElement)(t,{maximize:e.maximize})})))}))};Ho.propTypes={active:$t.bool,children:$t.node.isRequired,maximize:$t.func,style:(0,$t.shape)()};var Wo=zo("div",{displayName:"FixedWrapperRoot",mapPropsToStyles:function(e){var t={};return"right"===e.position?(t.right="1em",t.left="auto"):"left"===e.position&&(t.right="auto",t.left="1em"),t},target:"e7t7c040"})({name:"1inca8e",styles:"position:fixed;bottom:0;z-index:99;font-size:16px"}),Go=function(e){var t=(0,P.useState)(e.maximizedOnInit),n=t[0],r=t[1];return(0,P.createElement)(Wo,e,(0,P.createElement)("div",null,P.Children.map(e.children,(function(e){return e.type===qo?(0,P.cloneElement)(e,{minimize:function(){return r(!1)},active:n}):e.type===Ho?(0,P.cloneElement)(e,{maximize:function(){return r(!0)},active:!n}):e}))))};Go.defaultProps={maximizedOnInit:!1},Go.propTypes={children:$t.node.isRequired,maximizedOnInit:$t.bool,style:(0,$t.shape)()};var $o=zo("div",{mapPropsToStyles:function(e){var t={};return e.verticalAlign&&("top"===e.verticalAlign?t.alignItems="flex-start":"bottom"===e.verticalAlign?t.alignItems="flex-end":t.alignItems=e.verticalAlign),e.justify&&(!0===e.justify?t.justifyContent="space-between":"left"===e.justify?t.justifyContent="flex-start":"right"===e.justify?t.justifyContent="flex-end":t.justifyContent=e.justify),e.reverse&&(t.flexDirection="row-reverse"),t},target:"e108e6fy0"})({name:"14u08z3",styles:"display:flex;min-width:0"});$t.bool,$t.node.isRequired;$t.node;var Yo,Qo=function(e){var t=e.color;return t?{fill:t,"& *":{fill:t}}:null},Xo=(Yo=function(e){return zo(e,{displayType:"Icon",mapPropsToStyles:Qo,shouldForwardProp:M,target:"e5ibypu0"})({name:"y0b0au",styles:"&{display:block;}&,& *{fill:currentColor;}"})},function(e,t){var n={};return function(){var r=e.apply(void 0,arguments);if(kt(r,n))return n[r];var i=t.apply(void 0,arguments);return n[r]=i,i}}(Pt,Yo)),Jo=function(e){var t=e.children,n=Gt(e,["children"]),r=Xo(t.type);return(0,P.createElement)(r,n)};Jo.propTypes={children:$t.node.isRequired};var Zo=function(e){return(0,P.createElement)("svg",O({viewBox:"0 0 58 58",style:{enableBackground:"new 0 0 58 58"}},e),(0,P.createElement)("rect",{style:{fillRule:"evenodd",clipRule:"evenodd",fill:"#F2F2F2"},width:"58",height:"58"}),(0,P.createElement)("path",{style:{fillRule:"evenodd",clipRule:"evenodd",fill:"#424D57"},d:"M40,38c7.3,3.8,11,8.4,11,13.9v6c0,0.2-0.1,0.3-0.2,0.4C47.9,62,6.1,62,6.1,58l0-0.1l0-0.1 v-6c0-5.5,3.7-10.1,11-13.9c1.2-0.7,2-0.2,2-0.2c2.5,2.3,5.8,3.7,9.5,3.7l-0.1,0l0.3,0c3.5-0.1,6.7-1.5,9.1-3.7 C38,37.8,38.8,37.3,40,38z M28.5,17C34.3,17,39,21.7,39,27.5S34.3,38,28.5,38S18,33.3,18,27.5S22.7,17,28.5,17z"}))},es=function(e){return(0,P.createElement)(Jo,e,(0,P.createElement)(Zo,null))},ts=function(e){return(0,P.createElement)("svg",O({height:"18px",viewBox:"0 0 21 18",width:"21px"},e),(0,P.createElement)("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},(0,P.createElement)("g",{fill:"#000000"},(0,P.createElement)("polygon",{points:"0.01 18 21 9 0.01 0 0 7 15 9 0 11"}))))},ns=function(e){return(0,P.createElement)(Jo,e,(0,P.createElement)(ts,null))};function rs(){var e=En(["\n\t0% {\n\t\topacity: 1.0;\n\t}\n\n\t50% {\n\t\topacity: 0.4;\n\t}\n\n\t100% {\n\t\topacity: 1.0;\n\t}\n"]);return rs=function(){return e},e}var is=function(){var e=qt.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}(rs()),os=qt("animation:1.5s ease-in-out 0s infinite;animation-name:",is,";"),ss=zo("div",{displayName:"ImgOverlay",target:"e11eolwx0"})("width:100vw;max-width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:",(function(e){return e.theme.colors.surfaceDecorative}),";&>svg{width:32px;height:32px;fill:",(function(e){return e.theme.colors.secondaryTextColor}),";}"),as=function(e){return Kt(ss,e,Kt("svg",{viewBox:"0 0 32 32",css:os},Kt("path",{d:"M6.1,22.1l5.3-4.8c0.4-0.3,1-0.3,1.3,0l3.2,2.8l6.5-5.8c0.4-0.3,1-0.3,1.3,0l2.3,2.1V9c0-0.6-0.4-1-1-1h-18 c-0.6,0-1,0.4-1,1L6.1,22.1C6.1,22,6.1,22,6.1,22.1z M8,23h8.1l-4.1-3.7L8,23z M19.1,23h5.9c0.6,0,1-0.4,1-1v-3l-3-2.7l-5.7,5.1 L19.1,23z M7.1,6h18c1.7,0,3,1.3,3,3v13c0,1.7-1.3,3-3,3h-18c-1.7,0-3-1.3-3-3V9C4.1,7.3,5.4,6,7.1,6z M15.1,16c-1.7,0-3-1.3-3-3 s1.3-3,3-3s3,1.3,3,3S16.8,16,15.1,16z M15.1,14c0.6,0,1-0.4,1-1s-0.4-1-1-1c-0.6,0-1,0.4-1,1S14.5,14,15.1,14z"})))},cs=function(e){return Kt(ss,e,Kt("svg",{viewBox:"0 0 32 32"},Kt("path",{d:"M3.6,5.1L3.6,5.1l24.1,21.1c0.4,0.4,0.5,1,0.1,1.4c-0.3,0.4-0.9,0.4-1.3,0.2l-0.1-0.1l-8.1-7.1l-2,1.8 l1.7,1.5h4l2.3,2l-0.1,0L24,26H6c-1.6,0-2.9-1.2-3-2.8L3,23L3,7.3L2.3,6.7c-0.4-0.4-0.5-1-0.1-1.4C2.6,4.9,3.1,4.9,3.6,5.1z M11,20.3L6.9,24h8.1L11,20.3z M26,5c1.6,0,2.9,1.2,3,2.8L29,8v15.4l0,0l-2-1.7l0-3.7l-3-2.7l-2.2,2L20.3,16l3.1-2.8 c0.3-0.3,0.9-0.3,1.2-0.1l0.1,0.1l2.3,2.1V8c0-0.5-0.4-0.9-0.9-1L26,7H10L7.7,5l0.1,0L8,5H26z M5,9.1l0,14l5.3-4.8 c0.3-0.3,0.9-0.3,1.2-0.1l0.1,0.1l3.2,2.8l1.9-1.7L5,9.1z M20,8c1.7,0,3,1.3,3,3s-1.3,3-3,3s-3-1.3-3-3S18.3,8,20,8z M20,10 c-0.6,0-1,0.4-1,1s0.4,1,1,1s1-0.4,1-1S20.6,10,20,10z"})))};function ls(){var e=En(["\n\t&-enter {\n\t\topacity: 0;\n\t\theight: 0;\n\t}\n\n\t&-enter&-enter-active {\n\t\topacity: 1;\n\t\theight: 1.2em;\n\t\ttransition: height 200ms ease-in-out, opacity 100ms ease-in-out 100ms;\n\t}\n\n\t&-exit {\n\t\topacity: 1;\n\t\theight: 1.2em;\n\t}\n\n\t&-exit&-exit-active {\n\t\topacity: 0;\n\t\theight: 0;\n\t\ttransition: height 100ms ease-in-out 100ms, opacity 200ms ease-in-out;\n\t}\n"]);return ls=function(){return e},e}var us=function(e){return e(ls())},hs=function(e){return(0,P.createElement)(Wt,null,(function(t){var n=t.css;return(0,P.createElement)(fn,O({},e,{classNames:us(n),timeout:200}))}))};function ds(){var e=En(["\n\t&-enter {\n\t\topacity: 0;\n\t\ttransform: scale(1.2);\n\t}\n\n\t&-enter-active {\n\t\topacity: 1;\n\t\ttransform: scale(1);\n\t\ttransition: opacity ","ms ",", transform ","ms ",";\n\t}\n\n\t&-enter-done {\n\t\topacity: 1;\n\t\ttransform: scale(1);\n\t}\n"]);return ds=function(){return e},e}hs.propTypes={children:$t.node};var fs="cubic-bezier(0.14, 0, 0, 1)",ps=function(e){return e(ds(),200,fs,200,fs)},gs=function(e){return(0,P.createElement)(Wt,null,(function(t){var n=t.css;return(0,P.createElement)(fn,O({},e,{classNames:ps(n),timeout:500}))}))},ys=zo("img",{displayName:"Img",target:"e1lw40el0"})("display:",(function(e){return e.isLoaded?"inline-block":"none"}),";"),ms=function(e){var t=e.children,n=e.src,r=e.srcSet,i=(e.scaleImage,e.className),o=e.alt,s=void 0===o?"":o,a=Gt(e,["children","src","srcSet","scaleImage","className","alt"]),c=(0,P.useState)("pending"),l=c[0],u=c[1],h=(0,P.useState)(!1),d=h[0],f=h[1],p=(0,P.useRef)(0),g="loaded"===l,y=null;if(t)y=t({imageStatus:l,shouldAnimate:d});else switch(l){case"pending":y=(0,P.createElement)(as,a);break;case"failed":y=(0,P.createElement)(cs,a);break;default:y=null}return(0,P.useLayoutEffect)((function(){return u("pending"),f(!1),p.current=setTimeout((function(){return f(!0)}),300),function(){return clearTimeout(p.current)}}),[n,r]),(0,P.createElement)(P.Fragment,null,(0,P.createElement)(gs,{in:d&&g},(0,P.createElement)(ys,O({alt:s},a,{src:n,isLoaded:g,srcSet:r,className:i,onLoad:function(){u("loaded"),clearTimeout(p.current)},onError:function(){return u("failed")}}))),y)};ms.propTypes={children:$t.func};var vs={name:"n7acn9",styles:"border-radius:inherit;width:100%;height:100%;object-fit:cover"},bs=zo("div",{displayName:"Avatar",mapPropsToStyles:function(e){var t={},n={},r=e.size,i=e.radius,o=e.fontSize;return r&&(t.width=r,t.height=r,t.lineHeight=r),i&&(t.borderRadius=i,n.borderRadius=i),o&&(t.fontSize=o),O({},t,{"& img":n})},target:"e11ezd0e0"})({name:"1f2to7",styles:"border:1px solid #fff;border-radius:50%;text-align:center;background-color:#fff;text-transform:uppercase;overflow:hidden"}),ws=function(e){var t=e.imgUrl,n=e.letter,r=null;return t||n?t?r=Kt(ms,{src:t,css:vs,alt:"avatar",draggable:!1},(function(e){var t=e.imageStatus,n=e.shouldAnimate;switch(t){case"pending":return Kt(es,{css:[vs,n&&os,""]});case"failed":return Kt(es,{css:vs});default:return null}})):n&&(r=Kt("span",null,n)):r=Kt("div",{css:vs},Kt(es,{css:vs})),Kt(bs,e,r)};ws.propTypes={imgUrl:$t.string,letter:$t.string,size:$t.string,style:(0,$t.shape)()};var Es={name:"1oep8ze",styles:"&>:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:0;border-bottom-left-radius:0;}&>:last-child{border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit;}&>:first-child:last-child{border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit;}"},_s=zo("div",{displayName:"Bubble",mapPropsToStyles:function(e){var t=e.isOwn,n=e.ovalBorderRadius,r=e.sharpBorderRadius,i=e.radiusType,o={borderTopLeftRadius:"single"===i||"first"===i?n:r,borderTopRightRadius:n,borderBottomRightRadius:n,borderBottomLeftRadius:"single"===i||"last"===i?n:r};return t?function(e){var t=e.borderTopLeftRadius,n=e.borderTopRightRadius,r=e.borderBottomRightRadius;return{borderTopLeftRadius:n,borderTopRightRadius:t,borderBottomRightRadius:e.borderBottomLeftRadius,borderBottomLeftRadius:r}}(o):o},target:"emwkn670"})(Es,";border:1px solid rgba(0, 0, 0, 0.05);display:inline-block;max-width:100%;margin-bottom:0.1em;& img{max-width:100%;display:block;}");_s.propTypes={children:$t.node,isOwn:$t.bool,radiusType:(0,$t.oneOf)(["single","first","last"])};var Ss=zo("div",{mapPropsToStyles:function(e){return{flexShrink:e.shrink?1:0}},target:"e1jdwequ0"})(""),As=function(e){return(0,P.createElement)(Ss,O({flexFill:!0},e))};As.defaultProps={shrink:!0},As.propTypes={shrink:$t.bool};var ks=zo("div",{mapPropsToStyles:function(e){return{flexShrink:e.shrink?1:0}},target:"e1yi1p4d0"})(""),Ts=function(e){return(0,P.createElement)(ks,O({flexFit:!0},e))};Ts.defaultProps={shrink:!0},Ts.propTypes={shrink:$t.bool};var Is=zo("button",{displayName:"IconButton",section:!0,target:"e1m5b1js0"})({name:"1dor5y1",styles:"appearance:none;background:transparent;border:0;display:inline-block;margin:0;padding:0.5em;color:inherit;cursor:pointer;&:disabled{cursor:not-allowed;}"}),Cs=(0,P.forwardRef)((function(e,t){var n=kr(e);return(0,P.createElement)(Is,O({ref:t},n,e))}));Cs.propTypes={active:$t.bool,disabled:$t.bool,children:$t.node.isRequired,color:$t.string,onClick:$t.func};var Rs=function(e){return e.getBoundingClientRect().top+window.pageYOffset};var xs=(0,P.createContext)({registerUnseenListItem:Mt,isScrollOnBottom:Mt,scrollToBottom:Mt}),Ps=xs.Provider,Ds=xs.Consumer,Ns=function(e){void 0===e&&(e=0);var t=e;return function(){return t++}}(),Os=zo("div",{displayName:"MessageList",target:"e1i3n9g60"})({name:"1qptc4e",styles:"padding:0.5em;overflow-y:auto;height:100%;outline-offset:-5px"}),Bs=(0,P.forwardRef)((function(e,t){var n=e.active,r=void 0===n||n,i=e.onScroll,o=Gt(e,["active","onScroll"]),s=(0,P.useRef)(),a=Rr(s,t),c=function(){var e=(0,P.useRef)([]),t=(0,P.useCallback)((function(t){var n=Ns(),r=e.current;return r.push(O({},t,{id:n})),function(){var e=xt((function(e){return e.id===n}),r);-1!==e&&r.splice(e,1)}}),[]);return{getAll:function(){return e.current},registerItem:t}}(),l=c.getAll,u=c.registerItem,h=Pr(r),d=Pr(i),f=kr(),p=(0,P.useCallback)((function(){l().forEach((function(e){var t,n;(t=s.current,n=e.ref,Rs(n)-Rs(t)+n.clientHeight<=t.clientHeight)&&e.onSeen()}))}),[l]),g=(0,P.useMemo)((function(){return function(e,t){var n,r=Date.now()-2*e,i=function(){r=Date.now(),t.apply(void 0,arguments)},o=function(){return clearTimeout(n)},s=function(){for(var t=Date.now(),s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];t-r>=e?i.apply(void 0,a):(o(),n=setTimeout.apply(void 0,[i,r-t+e].concat(a)))};return s.cancel=o,s}(300,(function(){h.current&&p()}))}),[h,p]),y=(0,P.useCallback)((function(e){g(),d.current&&d.current(e)}),[d,g]);(0,P.useEffect)((function(){r&&p()}),[r,p]);var m=(0,P.useMemo)((function(){return{registerUnseenListItem:u,isScrollOnBottom:function(){return function(e,t){return void 0===t&&(t=0),e.scrollTop+e.clientHeight-e.scrollHeight>=-t}(s.current,20)},scrollToBottom:function(){var e;(e=s.current).scrollTop=e.scrollHeight}}}),[u]);return(0,P.createElement)(Ps,{value:m},(0,P.createElement)(Os,O({},f,o,{ref:a,onScroll:y,role:"grid","aria-live":"polite","aria-relevant":"additions"})))})),Ls=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this)._unregisterFromMessageList=Mt,t._registerInMessageList=function(e){var t,n,r=!1;return function(){return r&&(arguments.length<=0?void 0:arguments[0])===n?t:(r=!0,n=arguments.length<=0?void 0:arguments[0],t=e.apply(void 0,arguments))}}((function(e){return function(n){t._unregisterFromMessageList(),n&&(t._unregisterFromMessageList=e({ref:n,onSeen:t.props.onSeen}))}})),t}Xt(t,e);var n=t.prototype;return n.componentWillUnmount=function(){this._unregisterFromMessageList()},n.render=function(){var e=this;return(0,P.createElement)(Ds,null,(function(t){var n=t.registerUnseenListItem;return(0,P.createElement)("div",{ref:e.props.seen?null:e._registerInMessageList(n),role:"row"},P.Children.only(e.props.children))}))},t}(P.Component);Ls.propTypes={children:$t.node.isRequired,onSeen:$t.func},Ls.defaultProps={onSeen:Mt};var Ms=zo("div",{displayName:"Message",mapPropsToStyles:function(e){var t=e.horizontalAlign;return t?{flexDirection:"left"===t?"row":"row-reverse"}:null},section:!0,target:"e10ccb475"})({name:"stzj7g",styles:"align-items:flex-start;font-size:0.9em;margin:0.3em;margin-top:0;max-width:100%"}),Us=zo("span",{displayName:"AuthorName",target:"e10ccb474"})({name:"1rawn5e",styles:"font-size:0.8em"}),Fs=zo("div",{displayName:"MessageMeta",target:"e10ccb473"})({name:"v86cdg",styles:"text-align:left;margin-bottom:0.1em"}),js=zo("div",{displayName:"Content",target:"e10ccb472"})({name:"65ztgt",styles:"display:flex;flex-direction:column;overflow:visible;align-items:flex-start"}),zs=zo("span",{displayName:"Time",target:"e10ccb471"})({name:"1rawn5e",styles:"font-size:0.8em"}),Ks=zo("div",{displayName:"Status",target:"e10ccb470"})({name:"5m4wg",styles:"text-align:right;font-size:0.8em"}),qs={name:"oldbq4",styles:"user-select:none"},Vs=(0,P.forwardRef)((function(e,t){var n=e.children,r=e.authorName,i=e.deliveryStatus,o=void 0===i?"":i,s=e.isOwn,a=e.date,c=e.showMetaOnClick,l=e.onSeen,u=(e.radiusType,e.seen),h=e.enforceDeliveryStatusDisplay,d=e.onClick,f=void 0===d?Mt:d,p=e.onKeyUp,g=void 0===p?Mt:p,y=Gt(e,["children","authorName","deliveryStatus","isOwn","date","showMetaOnClick","onSeen","radiusType","seen","enforceDeliveryStatusDisplay","onClick","onKeyUp"]),m=kr(),v=function(e){var t=(0,P.useState)(e),n=t[0],r=t[1];return[n,(0,P.useCallback)((function(){r((function(e){return!e}))}),[])]}(!1),b=v[0],w=v[1];return Kt(Ls,{onSeen:l,seen:u},Kt(Ms,O({ref:t,"aria-expanded":c?b:null},y,{onKeyUp:function(e){g(e),"Enter"!==e.key&&" "!==e.key||w()},onClick:function(e){f(e),w()},own:s,tabIndex:null}),Kt(js,O({role:"gridcell"},m),Kt(wn,null,(!c||b)&&Kt(hs,null,Kt(Fs,null,r&&Kt(Us,null,r," "),a&&Kt(zs,null,a)))),n,o?Kt(Ks,null,o):h?Kt(Ks,{css:qs},"\xa0"):null)))}));Vs.propTypes={authorName:(0,$t.oneOfType)([$t.string,$t.node]),authorOpen:$t.bool,children:$t.node,date:$t.string,deliveryStatus:$t.string,enforceDeliveryStatusDisplay:$t.bool,isOwn:$t.bool,onClick:$t.func,onSeen:$t.func,showMetaOnClick:$t.bool,style:(0,$t.shape)(),toggleAuthor:$t.func,radiusType:(0,$t.oneOf)(["single","first","last"]),seen:$t.bool},Vs.defaultProps={onClick:Mt,seen:!1};var Hs=zo("div",{displayName:"SubTitle",target:"e1fut3qs0"})({name:"1ecjc06",styles:"font-weight:300;opacity:0.7"});Hs.defaultProps={textWrap:!0};var Ws=zo("div",{displayName:"Title",target:"e9xf8br0"})({name:"mmvz9h",styles:"font-weight:400"});Ws.defaultProps={textWrap:!0};Ft(console.warn.bind(console));var Gs=zo("div",{displayName:"MessageTitle",target:"e1ykjxgu0"})({name:"1kj42yy",styles:"font-weight:600;padding:1em"}),$s={name:"11rcwxl",styles:"margin-bottom:4px"},Ys=function(e){var t=e.children,n=e.title,r=e.subtitle,i=Gt(e,["children","title","subtitle"]);var o=t||[n&&Kt(Ws,{key:"title",preserveLines:!0,css:$s},n),r&&Kt(Hs,{key:"subtitle",preserveLines:!0},r)];return Kt(Gs,i,o)};Ys.propTypes={children:(0,$t.oneOfType)([(0,$t.arrayOf)($t.node),$t.node]),subtitle:$t.string,title:$t.string};var Qs=zo("div",{displayName:"MessageText",target:"eovu8nx0"})({name:"iim4r7",styles:"white-space:pre-line;word-wrap:break-word;overflow-wrap:anywhere;max-width:100%;padding:1em"});var Xs=zo("div",{displayName:"MessageMedia",mapPropsToStyles:function(e){var t=e.style||{};return{img:{borderTopLeftRadius:t.borderTopLeftRadius,borderTopRightRadius:t.borderTopRightRadius,borderBottomRightRadius:t.borderBottomRightRadius,borderBottomLeftRadius:t.borderBottomLeftRadius}}},target:"evmhqt80"})({name:"d3v9zr",styles:"overflow:hidden"}),Js="rgba(0, 0, 0, 0.1)",Zs="1px solid "+Js,ea=zo("div",{displayName:"MessageButtons",target:"edowbh60"})(Es,";&>:first-child{border-top:",Zs,";}&:first-child>:first-child{border-top:0;}&>:last-child{border-bottom:",Zs,";}&:last-child>:last-child{border-bottom:0;}>*{border-color:",Js,"!important;}");var ta=Fi(.2),na=zo((0,P.forwardRef)((function(e,t){var n=e.href,r=Gt(e,["href"]);return n?(0,P.createElement)("a",O({href:n,rel:"nofollow noopener"},r,{ref:t})):(0,P.createElement)("button",O({},r,{ref:t}))})),{displayName:"Button",mapPropsToStyles:function(e){var t=e.primary?e.theme.vars["--primary-color"]:"black",n=ta(t);return{borderColor:t,color:t,"&:hover":{color:n,borderColor:n}}},shouldForwardProp:M,target:"e1972fzd0"})({name:"1x6954b",styles:"border-width:1px;border-style:solid;background-color:#fff;font-size:1em;font-family:inherit;line-height:1.4em;text-align:center;text-decoration:none;appearance:none;padding:0.8em;transition:box-shadow 0.1s,color 0.1s,border-color 0.2s;&:hover{cursor:pointer;}&:active{box-shadow:none;outline:none;}&[disabled]{pointer-events:none;}"}),ra=function(e){var t=e.label,n=e.onPress,r=e.disabled,i=Gt(e,["label","onPress","disabled"]),o=kr(),s=(0,P.useRef)(),a=$i(O({onPress:n,isDisabled:r},i),s).buttonProps;return(0,P.createElement)(na,Cn(o,a,i,{ref:s}),t)};ra.propTypes={label:(0,$t.oneOfType)([$t.string,$t.node])};var ia=zo(ra,{target:"e121y1dq0"})("display:inline-block;width:100%;border-left:0;border-right:0;border-top:0;border-bottom-color:rgba(0, 0, 0, 0.1);box-shadow:none;transition:background-color 0.1s;background:transparent;color:",(function(e){return e.disabled?"#8D9BA9":"inherit"}),";margin:0;&:hover{border-bottom-color:rgba(0, 0, 0, 0.15);background:rgba(0, 0, 0, 0.02);color:inherit;}&:active{background:rgba(0, 0, 0, 0.04);color:inherit;}"),oa=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).handleClick=function(e){e.stopPropagation(),t.props.onClick(e)},t}return Xt(t,e),t.prototype.render=function(){return(0,P.createElement)(ia,O({},this.props,{onClick:this.handleClick}))},t}(P.Component);oa.propTypes={className:$t.string,label:$t.string,onClick:$t.func,primary:$t.bool,value:(0,$t.oneOfType)([$t.string,$t.number])},oa.defaultProps={onClick:Mt};var sa=function(e){return P.Children.toArray(e).filter(Boolean)};$t.string,$t.string,$t.node,$t.bool,$t.bool;var aa="#fff",ca={vars:{"primary-color":"#427fe1","secondary-color":"#fbfbfb","tertiary-color":aa},AgentBar:{Avatar:{size:"42px",css:{marginRight:".6em"}},css:{backgroundColor:"var(--secondary-color)"}},Avatar:{size:"30px"},Bubble:{sharpBorderRadius:"0.3em",ovalBorderRadius:"1.4em",css:{backgroundColor:{default:"var(--secondary-color)",bot:"green"}}},Button:{},ChatListItem:{Avatar:{css:{marginRight:".5em"}}},FixedWrapperMaximized:{animationDuration:100,width:"400px",height:"500px"},FixedWrapperMinimized:{animationDuration:100},FixedWrapperRoot:{position:"right",css:{}},Message:{secondaryTextColor:"#000",horizontalAlign:"left",own:{horizontalAlign:"right",Bubble:{css:{backgroundColor:"var(--primary-color)",color:aa}},Content:{css:{alignItems:"flex-end"}},MessageMeta:{css:{textAlign:"right"}},Time:{css:{textAlign:"right"}}},bot:{Bubble:{css:{backgroundColor:"green"}}}},MessageButtons:{},MessageGroup:{},MessageList:{css:{backgroundColor:"var(--tertiary-color)"}},MessageMedia:{},MessageText:{},MessageTitle:{},QuickReply:{css:{borderColor:"var(--primary-color)",backgroundColor:"#fff",color:"var(--primary-color)"}},TextComposer:{inputColor:"#000",Icon:{color:"#aaa"},IconButton:{active:{Icon:{color:"var(--primary-color)"}}}},TitleBar:{iconsColor:"#fff",behaviour:"default",css:{backgroundColor:"var(--primary-color)"}}},la=function e(t){var n=No(t);return 0===Object.keys(n).length?O({},t,{vars:Bt((function(e){return"--"+e}),t.vars||{})}):O({},t,Ct((function(t){return O({},e(t),{css:t.css||{}})}),n),{vars:Bt((function(e){return"--"+e}),t.vars||{})})},ua=function(e){var t=e.theme,n=void 0===t?{}:t,r=e.children,i=la(Lt(ca,n));return(0,P.createElement)(xo,{value:i},r)},ha={id:"data-lc-id",focus:"data-lc-focus",event:"data-lc-event",prop:"data-lc-prop"},da=new Map,fa=new Map,pa={value:-1};var ga=zo("button",{displayName:"QuickReply",target:"e1gt5po80"})({name:"hta3ic",styles:"border-width:1px;border-style:solid;font-size:1em;line-height:1em;appearance:none;transition:box-shadow 0.1s,color 0.1s,border-color 0.2s;margin:0.25em;background-color:#fff;border-radius:1.4em;box-shadow:0 0.1em 0.1em 0 rgba(32, 34, 40, 0.05);font-weight:400;overflow:hidden;padding:0.375em 1em 0.5em;word-break:break-word;&:hover{cursor:pointer;}&:active{outline:none;}"}),ya=function(e){var t=e.value,n=e.onSelect,r=void 0===n?Mt:n,i=e.onClick,o=void 0===i?Mt:i,s=Gt(e,["value","onSelect","onClick"]),a=kr(),c=(0,P.useCallback)((function(e){r(t),o(e)}),[o,r,t]);return(0,P.createElement)(ga,O({value:t},s,a,function(e){var t,n,r,i=++pa.value,o=O({},e,{onFocus:function(t){e.onFocus&&e.onFocus(t),fa.set(i,!0)},onBlur:function(t){e.onBlur&&e.onBlur(t),fa.delete(i)}});return O({},o,((t={})[ha.id]=String(i),t),fa.has(i)&&((n={})[ha.focus]="true",n),((r={})[ha.event]=Object.keys(o).map((function(e){var t=e.replace(/^on/,"").toLowerCase(),n=Nt();return"press"===t&&(t="click"),da.set(n,o[e]),t+":"+n})).join(";"),r))}({onClick:c})))};Ft(console.warn.bind(console));var ma=zo("div",{displayName:"QuickReplies",target:"e1dnb9qc0"})({name:"1q028wg",styles:"display:flex;flex-wrap:wrap;text-align:center;justify-content:center;width:100%"}),va=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this)._handleSelect=function(e){return t.props.onSelect(e)},t}return Xt(t,e),t.prototype.render=function(){var e=this,t=this.props,n=t.children,r=t.replies,i=(t.onSelect,Gt(t,["children","replies","onSelect"]));var o=n?sa(n):r.map((function(e,t){return(0,P.createElement)(ya,{key:t,value:e},e)}));return(0,P.createElement)(ma,O({},i,{role:"group"}),P.Children.map(o,(function(t){return(0,P.cloneElement)(t,{onSelect:e._handleSelect})})))},t}(P.Component);va.defaultProps={onSelect:Mt},va.propTypes={children:$t.node,onSelect:$t.func,replies:(0,$t.arrayOf)($t.string)};var ba=zo("div",{displayName:"TitleBar",section:!0,target:"e1ohfhv1"})({name:"1rw1ajx",styles:"display:flex;justify-content:center;align-items:center;width:100%;border:#000;color:#fff;position:relative;z-index:2;text-align:center;padding:0.4em"}),wa=zo("div",{displayName:"TitleBarTitle",target:"e1ohfhv0"})("width:100%;margin:0;margin-bottom:4px;margin-left:",(function(e){return!e.isIconProvided&&"32px"}),";padding:0 2px;text-align:center;font-size:0.9em;flex-grow:1;"),Ea=(0,P.forwardRef)((function(e,t){var n=e.leftIcons,r=e.rightIcons,i=e.title,o=Gt(e,["leftIcons","rightIcons","title"]),s=n[0];return(0,P.createElement)(ba,O({},o,{ref:t}),n,(0,P.createElement)(wa,{ellipsis:!0,isIconProvided:s},i),r)}));Ea.displayName="TitleBar",Ea.propTypes={leftIcons:(0,$t.arrayOf)($t.node),rightIcons:(0,$t.arrayOf)($t.node),theme:(0,$t.shape)(),title:$t.node};var _a=function(e){return 13===e.which},Sa=function(e){return _a(e)&&(e.altKey||e.shiftKey)},Aa=function(e){return _a(e)&&!e.altKey&&!e.shiftKey};var ka=(0,P.createContext)(),Ta=function(){return(0,P.useContext)(ka)},Ia=zo("div",{displayName:"TextComposer",section:!0,target:"eyij3xx0"})({name:"1xbhw8e",styles:"padding:0;background:#fff;border-top:1px solid rgba(0, 0, 0, 0.1)"}),Ca=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state={value:t._getValue({value:t.props.defaultValue})},t._handleButtonClick=function(e){t.maybeSend()&&t.props.onButtonClick(e)},t._handleChange=function(e){var n=e.target.value;t._isControlled()||t.setState({value:n}),t.props.onValueChange(n),t.props.onChange(e)},t._handleInputRef=function(e){t._inputRef=e},t._handleKeyDown=function(e){var n=t.props.onKeyDown;Aa(e)&&e.preventDefault(),_a(e)&&!Sa(e)?(t.maybeSend(),n(e)):n(e)},t.maybeSend=function(){return!!t._canSend()&&(t._isControlled()||t.setState({value:""}),t.props.onSend(t._getValue().replace(zt,"")),!0)},t}Xt(t,e);var n=t.prototype;return n._getValue=function(e,t){return void 0===e&&(e=this.state),void 0===t&&(t=this.props),this._isControlled()?t.value:e.value},n._canSend=function(){return this.props.active&&""!==this._getValue().trim()},n._isControlled=function(){return"string"===typeof this.props.value},n._setCursorAtTheEnd=function(){var e=this._inputRef.value.length;this._inputRef.setSelectionRange(e,e)},n.componentDidMount=function(){this.props.defaultValue&&this._inputRef&&document.activeElement===this._inputRef&&this._setCursorAtTheEnd()},n.componentDidUpdate=function(e,t){var n=this._getValue();n!==this._getValue(t,e)&&""===n&&this._inputRef.focus()},n.render=function(){var e=this.props,t=(e.active,e.children),n=(e.defaultValue,e.onButtonClick,e.onChange,e.onKeyDown,e.onSend,e.onValueChange,e.value,Gt(e,["active","children","defaultValue","onButtonClick","onChange","onKeyDown","onSend","onValueChange","value"])),r={active:this._canSend(),inputRef:this._handleInputRef,value:this._getValue(),maybeSend:this.maybeSend,onButtonClick:this._handleButtonClick,onChange:this._handleChange,onKeyDown:this._handleKeyDown};return(0,P.createElement)(ka.Provider,{value:r},(0,P.createElement)(Ia,n,t))},t}(P.Component);function Ra(e){var t=e.icon,n=e.onClick,r=void 0===n?Mt:n,i=Gt(e,["icon","onClick"]),o=Ta(),s=o.active,a=o.onButtonClick;return(0,P.createElement)(Cs,O({},i,{active:s,disabled:!s,onClick:function(e){s&&(a(e),r(e))}}),t?(0,P.createElement)(Jo,{"aria-hidden":!0},t):(0,P.createElement)(ns,null))}function xa(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&n.path)}},e(n,n.exports),n.exports}Ca.propTypes={active:$t.bool,children:$t.node,defaultValue:$t.string,onButtonClick:$t.func,onChange:$t.func,onKeyDown:$t.func,onSend:$t.func,value:$t.string},Ca.defaultProps={active:!0,defaultValue:"",onButtonClick:Mt,onChange:Mt,onKeyDown:Mt,onSend:Mt,onValueChange:Mt};var Pa=xa((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.FrameContextConsumer=t.FrameContextProvider=t.useFrame=t.FrameContext=void 0;var n,r=(n=P)&&n.__esModule?n:{default:n};var i=void 0,o=void 0;"undefined"!==typeof document&&(i=document),"undefined"!==typeof window&&(o=window);var s=t.FrameContext=r.default.createContext({document:i,window:o}),a=(t.useFrame=function(){return r.default.useContext(s)},s.Provider),c=s.Consumer;t.FrameContextProvider=a,t.FrameContextConsumer=c})),Da=xa((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=(i(P),i(Yt()));function i(e){return e&&e.__esModule?e:{default:e}}var o=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"componentDidMount",value:function(){this.props.contentDidMount()}},{key:"componentDidUpdate",value:function(){this.props.contentDidUpdate()}},{key:"render",value:function(){return P.Children.only(this.props.children)}}]),t}(P.Component);o.propTypes={children:r.default.element.isRequired,contentDidMount:r.default.func.isRequired,contentDidUpdate:r.default.func.isRequired},t.default=o})),Na=xa((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=c(P),o=c(N),s=c(Yt()),a=c(Da);function c(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.setRef=function(e){r.node=e},r.handleLoad=function(){r.setState({iframeLoaded:!0})},r._isMounted=!1,r.state={iframeLoaded:!1},r}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),r(t,[{key:"componentDidMount",value:function(){this._isMounted=!0;var e=this.getDoc();e&&"complete"===e.readyState?this.forceUpdate():this.node.addEventListener("load",this.handleLoad)}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.node.removeEventListener("load",this.handleLoad)}},{key:"getDoc",value:function(){return this.node?this.node.contentDocument:null}},{key:"getMountTarget",value:function(){var e=this.getDoc();return this.props.mountTarget?e.querySelector(this.props.mountTarget):e.body.children[0]}},{key:"renderFrameContents",value:function(){if(!this._isMounted)return null;var e=this.getDoc();if(!e)return null;var t=this.props.contentDidMount,n=this.props.contentDidUpdate,r=e.defaultView||e.parentView,s=i.default.createElement(a.default,{contentDidMount:t,contentDidUpdate:n},i.default.createElement(Pa.FrameContextProvider,{value:{document:e,window:r}},i.default.createElement("div",{className:"frame-content"},this.props.children))),c=this.getMountTarget();return[o.default.createPortal(this.props.head,this.getDoc().head),o.default.createPortal(s,c)]}},{key:"render",value:function(){var e=n({},this.props,{srcDoc:this.props.initialContent,children:void 0});return delete e.head,delete e.initialContent,delete e.mountTarget,delete e.contentDidMount,delete e.contentDidUpdate,i.default.createElement("iframe",n({},e,{ref:this.setRef,onLoad:this.handleLoad}),this.state.iframeLoaded&&this.renderFrameContents())}}]),t}(P.Component);l.propTypes={style:s.default.object,head:s.default.node,initialContent:s.default.string,mountTarget:s.default.string,contentDidMount:s.default.func,contentDidUpdate:s.default.func,children:s.default.oneOfType([s.default.element,s.default.arrayOf(s.default.element)])},l.defaultProps={style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:function(){},contentDidUpdate:function(){},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'},t.default=l})),Oa=xa((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.useFrame=t.FrameContextConsumer=t.FrameContext=void 0,Object.defineProperty(t,"FrameContext",{enumerable:!0,get:function(){return Pa.FrameContext}}),Object.defineProperty(t,"FrameContextConsumer",{enumerable:!0,get:function(){return Pa.FrameContextConsumer}}),Object.defineProperty(t,"useFrame",{enumerable:!0,get:function(){return Pa.useFrame}});var n,r=(n=Na)&&n.__esModule?n:{default:n};t.default=r.default}));var Ba=zo((0,P.forwardRef)((function(e,t){e.flexFill;var n=Gt(e,["flexFill"]);return(0,P.createElement)(ro,O({ref:t},n))})),{displayName:"TextInput",target:"e1m92qam0"})({name:"1c0v4at",styles:"appearance:none;border:0;resize:none;background-color:#fff;height:1.5em;line-height:1.5em;min-width:0;width:100%;font-size:1em;&:focus,&:active{outline:none;}"}),La=(0,P.forwardRef)((function(e,t){var n=e.maxRows,r=void 0===n?3:n,i=e.placeholder,o=void 0===i?"Write a message...":i,s=Gt(e,["maxRows","placeholder"]),a=(0,P.useRef)(),c=Rr(a,t),l=Ta(),u=l.value,h=l.inputRef,d=l.onChange,f=l.onKeyDown,p=Oa.useFrame().document;return(0,P.createElement)(Ba,O({},s,{onChange:function(e){d(e),s.onChange&&s.onChange(e)},onKeyDown:function(e){f(e),s.onKeyDown&&s.onKeyDown(e)},value:u,maxRows:r,placeholder:o,ref:function(e){c(e),h(e)},document:p}))})),Ma=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).handleButtonClick=function(e){return function(n){t.props.onButtonClick(n,e)}},t}return Xt(t,e),t.prototype.render=function(){var e=this,t=null,n=xt((function(e){return e.showMore}),this.props.buttons);if(-1!==n){var r=this.props.buttons[n],i=r.text,o=Gt(r,["text"]);t=(0,P.createElement)(oa,O({},o,{label:i,"data-variant":"show-more",onClick:this.handleButtonClick(n)}))}return(0,P.createElement)(P.Fragment,null,(0,P.createElement)(ea,null,this.props.buttons.map((function(t,r){var i=t.text,o=t.key,s=(t.showMore,Gt(t,["text","key","showMore"])),a=void 0!==o?o:r;return r!==n?(0,P.createElement)(oa,O({key:a,label:i.length>20?i.slice(0,20).trim()+"\u2026":i,onClick:e.handleButtonClick(a)},s)):null}))),t)},t}(P.Component);Ma.defaultProps={onButtonClick:Mt};var Ua=function(e){return e.stopPropagation()},Fa=function(e){return Kt("a",O({},e,{onClick:Ua,rel:"nofollow noopener",target:"_blank"}))},ja=function(e){return qt("display:block;width:100%;height:",e?"100%":"150px",";object-fit:cover;")},za=zo("div",{target:"e9ztsyy0"})("display:flex;margin:0 auto;overflow:hidden;width:100%;min-width:110px;height:",(function(e){return e.horizontalLayout?"100%":"150px"}),";align-items:center;justify-content:center;background:#fff;"),Ka=function(e){var t=e.link,n=e.url,r=e.srcset,i=e.horizontalLayout,o=Gt(e,["link","url","srcset","horizontalLayout"]),s=Kt(Xs,o,Kt(za,{horizontalLayout:i},Kt(ms,O({alt:"",css:ja(i)},function(e,t){var n={src:e};return void 0!==t&&(n.srcSet=t),n}(n,r)))));return t?Kt(Fa,{href:t,style:o.style},s):s};Ka.propTypes={link:$t.string,url:$t.string.isRequired,srcSet:$t.string};var qa={name:"oipjxo",styles:"width:230px"},Va={name:"ho1qnd",styles:"display:flex;flex-direction:row"},Ha={name:"1mb649y",styles:"max-width:110px"},Wa=zo("div",{target:"es7wtci0"})("width:230px;min-width:0px;max-width:",(function(e){return e.horizontalLayout?"66%":"100%"}),";"),Ga={borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit",borderBottomRightRadius:0,borderBottomLeftRadius:0},$a={borderTopLeftRadius:"inherit",borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:"inherit"};P.Component;function Ya(e){return Ya="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},Ya(e)}function Qa(e){var t=function(e,t){if("object"!==Ya(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ya(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ya(t)?t:String(t)}function Xa(e,t,n){return(t=Qa(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ja=Symbol.for("@libp2p/peer-id");function Za(e){return null!=e&&Boolean(e[Ja])}function ec(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function tc(e,t,n){ec(e,t),t.set(e,n)}function nc(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function rc(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,nc(e,t,"set"),n),n}function ic(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,nc(e,t,"get"))}class oc extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The operation was aborted"),Xa(this,"code",void 0),Xa(this,"type",void 0),this.code=oc.code,this.type=oc.type}}Xa(oc,"code","ABORT_ERR"),Xa(oc,"type","aborted");class sc extends Error{constructor(e,t,n){var r;super(e),Xa(this,"code",void 0),Xa(this,"props",void 0),this.code=t,this.name=null!==(r=null===n||void 0===n?void 0:n.name)&&void 0!==r?r:"CodeError",this.props=null!==n&&void 0!==n?n:{}}}var ac=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[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 r=0,i=0;e[t]===c;)r++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=n[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(r+(o-f)),g=r;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 n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;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<r)&&-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");r=d,i++}for(var p=s-r;p!==s&&0===l[p];)p++;for(var g=c.repeat(n);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var n=h(e);if(n)return n;throw new Error("Non-".concat(t," character"))}}};const cc=ac,lc=(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 uc{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class hc{constructor(e,t,n){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=n}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 fc(this,e)}}class dc{constructor(e){this.decoders=e}or(e){return fc(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.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 fc=(e,t)=>new dc({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class pc{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new uc(e,t,n),this.decoder=new hc(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gc=e=>{let{name:t,prefix:n,encode:r,decode:i}=e;return new pc(t,n,r,i)},yc=e=>{let{prefix:t,name:n,alphabet:r}=e;const{encode:i,decode:o}=cc(r,n);return gc({prefix:t,name:n,encode:i,decode:e=>lc(o(e))})},mc=e=>{let{name:t,prefix:n,bitsPerChar:r,alphabet:i}=e;return gc({prefix:n,name:t,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o})(e,i,r),decode:e=>((e,t,n,r)=>{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*n/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(r," character"));c=c<<n|t,a+=n,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,r,t)})},vc=yc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bc=yc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var wc=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=Sc;)n[r++]=255&t|Ec,t/=128;for(;t&_c;)n[r++]=255&t|Ec,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Ec=128,_c=-128,Sc=Math.pow(2,31);var Ac=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(r&Tc)<<o:(r&Tc)*Math.pow(2,o),o+=7}while(r>=kc);return e.bytes=s-n,i},kc=128,Tc=127;var Ic=Math.pow(2,7),Cc=Math.pow(2,14),Rc=Math.pow(2,21),xc=Math.pow(2,28),Pc=Math.pow(2,35),Dc=Math.pow(2,42),Nc=Math.pow(2,49),Oc=Math.pow(2,56),Bc=Math.pow(2,63);const Lc={encode:wc,decode:Ac,encodingLength:function(e){return e<Ic?1:e<Cc?2:e<Rc?3:e<xc?4:e<Pc?5:e<Dc?6:e<Nc?7:e<Oc?8:e<Bc?9:10}},Mc=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return[Lc.decode(e,t),Lc.decode.bytes]},Uc=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Lc.encode(e,t,n),t},Fc=e=>Lc.encodingLength(e),jc=(e,t)=>{const n=t.byteLength,r=Fc(e),i=r+Fc(n),o=new Uint8Array(i+n);return Uc(e,o,0),Uc(n,o,r),o.set(t,i),new Kc(e,n,t,o)},zc=e=>{const t=lc(e),[n,r]=Mc(t),[i,o]=Mc(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Kc(n,i,s,t)};class Kc{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const qc=mc({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vc=mc({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Hc=mc({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wc=mc({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gc=mc({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$c=mc({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Yc=mc({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Qc=mc({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Xc=mc({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Jc=(e,t)=>{const{bytes:n,version:r}=e;return 0===r?rl(n,el(e),t||vc.encoder):il(n,el(e),t||qc.encoder)},Zc=new WeakMap,el=e=>{const t=Zc.get(e);if(null==t){const t=new Map;return Zc.set(e,t),t}return t};class tl{constructor(e,t,n,r){this.code=t,this.version=e,this.multihash=n,this.bytes=r,this["/"]=r}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!==ol)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==sl)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return tl.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,n=jc(e,t);return tl.createV1(this.code,n)}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 tl.equals(this,e)}static equals(e,t){const n=t;return n&&e.code===n.code&&e.version===n.version&&((e,t)=>{if(e===t)return!0;{const n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0})(e.bytes,n.bytes)}})(e.multihash,n.multihash)}toString(e){return Jc(this,e)}toJSON(){return{"/":Jc(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 tl)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:e,code:n,multihash:r,bytes:i}=t;return new tl(e,n,r,i||al(e,n,r.bytes))}if(!0===t[cl]){const{version:e,multihash:n,code:r}=t,i=zc(n);return tl.create(e,r,i)}return null}static create(e,t,n){if("number"!==typeof t)throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:if(t!==ol)throw new Error("Version 0 CID must use dag-pb (code: ".concat(ol,") block encoding"));return new tl(e,t,n,n.bytes);case 1:{const r=al(e,t,n.bytes);return new tl(e,t,n,r)}default:throw new Error("Invalid version")}}static createV0(e){return tl.create(0,ol,e)}static createV1(e,t){return tl.create(1,e,t)}static decode(e){const[t,n]=tl.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=tl.inspectBytes(e),n=t.size-t.multihashSize,r=lc(e.subarray(n,n+t.multihashSize));if(r.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=r.subarray(t.multihashSize-t.digestSize),o=new Kc(t.multihashCode,t.digestSize,i,r);return[0===t.version?tl.createV0(o):tl.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const n=()=>{const[n,r]=Mc(e.subarray(t));return t+=r,n};let r=n(),i=ol;if(18===r?(r=0,t=0):i=n(),0!==r&&1!==r)throw new RangeError("Invalid CID version ".concat(r));const o=t,s=n(),a=n(),c=t+a;return{version:r,codec:i,multihashCode:s,digestSize:a,multihashSize:c-o,size:c}}static parse(e,t){const[n,r]=nl(e,t),i=tl.decode(r);if(0===i.version&&"Q"!==e[0])throw Error("Version 0 CID string must not include multibase prefix");return el(i).set(n,e),i}}const nl=(e,t)=>{switch(e[0]){case"Q":{const n=t||vc;return[vc.prefix,n.decode("".concat(vc.prefix).concat(e))]}case vc.prefix:{const n=t||vc;return[vc.prefix,n.decode(e)]}case qc.prefix:{const n=t||qc;return[qc.prefix,n.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)]}},rl=(e,t,n)=>{const{prefix:r}=n;if(r!==vc.prefix)throw Error("Cannot string encode V0 in ".concat(n.name," encoding"));const i=t.get(r);if(null==i){const i=n.encode(e).slice(1);return t.set(r,i),i}return i},il=(e,t,n)=>{const{prefix:r}=n,i=t.get(r);if(null==i){const i=n.encode(e);return t.set(r,i),i}return i},ol=112,sl=18,al=(e,t,n)=>{const r=Fc(e),i=r+Fc(t),o=new Uint8Array(i+n.byteLength);return Uc(e,o,0),Uc(t,o,r),o.set(n,i),o},cl=Symbol.for("@ipld/js-cid/CID");function ll(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}const ul=gc({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),hl=mc({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),dl=mc({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),fl=yc({prefix:"9",name:"base10",alphabet:"0123456789"}),pl=mc({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),gl=mc({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),yl=yc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ml=yc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),vl=mc({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bl=mc({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wl=mc({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),El=mc({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),_l=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"),Sl=_l.reduce(((e,t,n)=>(e[n]=t,e)),[]),Al=_l.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const kl=gc({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Sl[t]),"")},decode:function(e){const t=[];for(const n of e){const e=Al[n.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(n));t.push(e)}return new Uint8Array(t)}}),Tl=e=>{let{name:t,code:n,encode:r}=e;return new Il(t,n,r)};class Il{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?jc(this.code,t):t.then((e=>jc(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Cl=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Rl=Tl({name:"sha2-256",code:18,encode:Cl("SHA-256")}),xl=Tl({name:"sha2-512",code:19,encode:Cl("SHA-512")}),Pl=lc,Dl={code:0,name:"identity",encode:Pl,digest:e=>jc(0,Pl(e))},Nl="raw",Ol=85,Bl=e=>lc(e),Ll=e=>lc(e),Ml=new TextEncoder,Ul=new TextDecoder,Fl="json",jl=512,zl=e=>Ml.encode(JSON.stringify(e)),Kl=e=>JSON.parse(Ul.decode(e)),ql={...n,...r,...i,...o,...s,...t,...a,...e,...c,...l};function Vl(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Hl(){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.alloc)?Vl(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Wl(){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)?Vl(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Gl(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const $l=Gl("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Yl=Gl("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=Wl((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),Ql={utf8:$l,"utf-8":$l,hex:ql.base16,latin1:Yl,ascii:Yl,binary:Yl,...ql};function Xl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const n=Ql[t];if(null==n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}var Jl=__webpack_require__(4561);function Zl(e,t){null==t&&(t=e.reduce(((e,t)=>e+t.length),0));const n=Wl(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return Vl(n)}const eu=45,tu=15,nu=new class{constructor(){Xa(this,"index",0),Xa(this,"input","")}new(e){return this.index=0,this.input=e,this}readAtomically(e){const t=this.index,n=e();return void 0===n&&(this.index=t),n}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,n){return this.readAtomically((()=>{if(!(t>0&&void 0===this.readGivenChar(e)))return n()}))}readNumber(e,t,n,r){return this.readAtomically((()=>{let i=0,o=0;const s=this.peekChar();if(void 0===s)return;const a="0"===s,c=2**(8*r)-1;for(;;){const n=this.readAtomically((()=>{const t=this.readChar();if(void 0===t)return;const n=Number.parseInt(t,e);return Number.isNaN(n)?void 0:n}));if(void 0===n)break;if(i*=e,i+=n,i>c)return;if(o+=1,void 0!==t&&o>t)return}return 0===o||!n&&a&&o>1?void 0:i}))}readIPv4Addr(){return this.readAtomically((()=>{const e=new Uint8Array(4);for(let t=0;t<e.length;t++){const n=this.readSeparator(".",t,(()=>this.readNumber(10,3,!1,1)));if(void 0===n)return;e[t]=n}return e}))}readIPv6Addr(){const e=e=>{for(let t=0;t<e.length/2;t++){const n=2*t;if(t<e.length-3){const r=this.readSeparator(":",t,(()=>this.readIPv4Addr()));if(void 0!==r)return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],[n+4,!0]}const r=this.readSeparator(":",t,(()=>this.readNumber(16,4,!0,2)));if(void 0===r)return[n,!1];e[n]=r>>8,e[n+1]=255&r}return[e.length,!1]};return this.readAtomically((()=>{const t=new Uint8Array(16),[n,r]=e(t);if(16===n)return t;if(r)return;if(void 0===this.readGivenChar(":"))return;if(void 0===this.readGivenChar(":"))return;const i=new Uint8Array(14),o=16-(n+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 ru(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const n=Ql[t];if(null==n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(e)):Vl(globalThis.Buffer.from(e,"utf-8"))}function iu(e){return Boolean(function(e){if(!(e.length>tu))return nu.new(e).parseWith((()=>nu.readIPv4Addr()))}(e))}function ou(e){return Boolean(function(e){if(!(e.length>eu))return nu.new(e).parseWith((()=>nu.readIPv6Addr()))}(e))}function su(e){return Boolean(function(e){if(!(e.length>eu))return nu.new(e).parseWith((()=>nu.readIPAddr()))}(e))}const au=iu,cu=ou,lu=function(e){let t=0;if(e=e.toString().trim(),au(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(cu(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;au(n[r])&&(e=lu(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},uu=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},hu=-1,du={},fu={};function pu(e){if("number"===typeof e){if(null!=fu[e])return fu[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=du[e])return du[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,hu,"ip6zone"],[43,8,"ipcidr"],[53,hu,"dns",!0],[54,hu,"dns4",!0],[55,hu,"dns6",!0],[56,hu,"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,hu,"unix",!1,!0],[421,hu,"ipfs"],[421,hu,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,hu,"garlic64"],[448,0,"tls"],[449,hu,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,hu,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,hu,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);fu[t.code]=t,du[t.name]=t}));pu("ip4"),pu("ip6"),pu("ipcidr");function gu(e,t){switch(pu(e).code){case 4:case 41:return function(e){const t=uu(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 Su(t);case 6:case 273:case 33:case 132:return Eu(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return Au(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function yu(e,t){switch(pu(e).code){case 4:case 41:return bu(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return _u(t);case 6:case 273:case 33:case 132:return wu(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?zc(vc.decode("z".concat(e))).bytes:tl.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=qc.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=wu(r);return Zl([n,i],n.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 n=qc.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=wu(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=vu.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const mu=Object.values(ql).map((e=>e.decoder)),vu=function(){let e=mu[0].or(mu[1]);return mu.slice(2).forEach((t=>e=e.or(t))),e}();function bu(e){if(!su(e))throw new Error("invalid ip address");return lu(e)}function wu(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function Eu(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function _u(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}function Su(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function Au(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=Eu(n);return"".concat(r,":").concat(i)}function ku(e){return e.map((e=>{const t=Bu(e);return null!=e[1]?[t.code,gu(t.code,e[1])]:[t.code]}))}function Tu(e){return Pu(Zl(e.map((e=>{const t=Bu(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function Iu(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var n;return Jl.decode(t)+(null!==(n=Jl.decode.bytes)&&void 0!==n?n:0)}function Cu(e){const t=[];let n=0;for(;n<e.length;){var r;const i=Jl.decode(e,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0,s=Iu(pu(i),e.slice(n+o));if(0===s){t.push([i]),n+=o;continue}const a=e.slice(n+o,n+o+s);if(n+=s+o,n>e.length)throw Ou("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([i,a])}return t}function Ru(e){return function(e){const t=[];return e.map((e=>{const n=Bu(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),Nu(t.join("/"))}(ku(Cu(e)))}function xu(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=pu(i);if(0!==o.size){if(r++,r>=n.length)throw Ou("invalid address: "+e);if(!0===o.path){t.push([i,Nu(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=Nu(e));return Tu(t.map((e=>{Array.isArray(e)||(e=[e]);const t=Bu(e);return e.length>1?[t.code,yu(t.code,e[1])]:[t.code]})))}function Pu(e){const t=Du(e);if(null!=t)throw t;return Uint8Array.from(e)}function Du(e){try{Cu(e)}catch(t){return t}}function Nu(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function Ou(e){return new Error("Error parsing address: "+e)}function Bu(e){return pu(e[0])}const Lu=Symbol.for("nodejs.util.inspect.custom"),Mu=[pu("dns").code,pu("dns4").code,pu("dns6").code,pu("dnsaddr").code],Uu=new Map,Fu=Symbol.for("@multiformats/js-multiaddr/multiaddr");function ju(e){return Boolean(null===e||void 0===e?void 0:e[Fu])}var zu,Ku,qu,Vu,Hu,Wu=new WeakMap,Gu=new WeakMap,$u=new WeakMap,Yu=new WeakMap;class Qu{constructor(e){if(Xa(this,"bytes",void 0),tc(this,Wu,{writable:!0,value:void 0}),tc(this,Gu,{writable:!0,value:void 0}),tc(this,$u,{writable:!0,value:void 0}),tc(this,Yu,{writable:!0,value:void 0}),Xa(this,Fu,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=Pu(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=xu(e)}else{if(!ju(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=Pu(e.bytes)}}toString(){return null==ic(this,Wu)&&rc(this,Wu,Ru(this.bytes)),ic(this,Wu)}toJSON(){return this.toString()}toOptions(){let e,t,n,r,i="";const o=pu("tcp"),s=pu("udp"),a=pu("ip4"),c=pu("ip6"),l=pu("dns6"),u=pu("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),Mu.includes(h)&&(t=o.name,r=443,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=pu(h).name,r=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=pu(h).name,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==n||null==r)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},pu(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){var r;const i=Jl.decode(t,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0;n+=Iu(pu(i),t.slice(n+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==ic(this,Gu)&&rc(this,Gu,Cu(this.bytes)),ic(this,Gu)}stringTuples(){return null==ic(this,$u)&&rc(this,$u,ku(this.tuples())),ic(this,$u)}encapsulate(e){return e=new Qu(e),new Qu(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new Qu(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new Qu(Tu(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===du.ipfs.code)),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]?Xl(vc.decode("z".concat(e)),"base58btc"):Xl(tl.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===ic(this,Yu))try{rc(this,Yu,this.stringTuples().filter((e=>!0===pu(e[0]).path))[0][1]),null==ic(this,Yu)&&rc(this,Yu,null)}catch{rc(this,Yu,null)}return ic(this,Yu)}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=Uu.get(t.name);if(null==n)throw new sc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new Qu(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))}[Lu](){return"Multiaddr(".concat(Ru(this.bytes),")")}}!function(e){e.Relay="relay",e.Store="store",e.LightPush="lightpush",e.Filter="filter"}(zu||(zu={})),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"}(Ku||(Ku={})),function(e){e.BACKWARD="backward",e.FORWARD="forward"}(qu||(qu={})),function(e){e.BOOTSTRAP="bootstrap",e.PEER_EXCHANGE="peer-exchange"}(Vu||(Vu={})),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"}(Hu||(Hu={}));var Xu,Ju=__webpack_require__(8392),Zu=new WeakMap;class eh extends EventTarget{constructor(){super(...arguments),tc(this,Zu,{writable:!0,value:new Map})}listenerCount(e){const t=ic(this,Zu).get(e);return null==t?0:t.length}addEventListener(e,t,n){var r;super.addEventListener(e,t,n);let i=ic(this,Zu).get(e);null==i&&(i=[],ic(this,Zu).set(e,i)),i.push({callback:t,once:null!==(r=!0!==n&&!1!==n&&(null===n||void 0===n?void 0:n.once))&&void 0!==r&&r})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),null!==t&&void 0!==t?t:null,n);let r=ic(this,Zu).get(e);null!=r&&(r=r.filter((e=>{let{callback:n}=e;return n!==t})),ic(this,Zu).set(e,r))}dispatchEvent(e){const t=super.dispatchEvent(e);let n=ic(this,Zu).get(e.type);return null==n||(n=n.filter((e=>{let{once:t}=e;return!t})),ic(this,Zu).set(e.type,n)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new nh(e,t))}}class th extends Event{constructor(e,t){super(e,t),Xa(this,"detail",void 0),this.detail=null===t||void 0===t?void 0:t.detail}}const nh=null!==(Xu=globalThis.CustomEvent)&&void 0!==Xu?Xu:th,rh=Ju("waku:keep-alive");class ih{constructor(e,t){Xa(this,"pingKeepAliveTimers",void 0),Xa(this,"relayKeepAliveTimers",void 0),Xa(this,"options",void 0),Xa(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:n,relayKeepAlive:r}=this.options,i=e.toString();if(0!==n){const r=setInterval((()=>{t.ping(e).catch((e=>{rh("Ping failed (".concat(i,")"),e)}))}),1e3*n);this.pingKeepAliveTimers.set(i,r)}const o=this.relay;if(o&&0!==r){const t=id({contentTopic:"/relay-ping/1/ping/null",ephemeral:!0}),n=setInterval((()=>{rh("Sending Waku Relay ping message"),o.send(t,{payload:new Uint8Array([1])}).catch((e=>rh("Failed to send relay ping",e)))}),1e3*r);this.relayKeepAliveTimers.set(e,n)}}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 oh=Ju("waku:connection-manager");class sh extends eh{static create(e,t,n,r,i){let o=sh.instances.get(e);return o||(o=new sh(t,n,r,i),sh.instances.set(e,o)),o}async getPeersByDiscovery(){const e=await this.libp2p.peerStore.all(),t=this.libp2p.getConnections().map((e=>e.remotePeer)),n=[],r=[],i=[],o=[];for(const s of e){const e=await this.getTagNamesForPeer(s.id);e.includes(Vu.BOOTSTRAP)?n.push(s):e.includes(Vu.PEER_EXCHANGE)&&r.push(s)}for(const s of t){const e=await this.libp2p.peerStore.get(s),t=await this.getTagNamesForPeer(s);t.includes(Vu.BOOTSTRAP)?i.push(e):t.includes(Vu.PEER_EXCHANGE)&&o.push(e)}return{DISCOVERED:{[Vu.BOOTSTRAP]:n,[Vu.PEER_EXCHANGE]:r},CONNECTED:{[Vu.BOOTSTRAP]:i,[Vu.PEER_EXCHANGE]:o}}}constructor(e,t,n,r){super(),Xa(this,"keepAliveManager",void 0),Xa(this,"options",void 0),Xa(this,"libp2p",void 0),Xa(this,"dialAttemptsForPeer",new Map),Xa(this,"dialErrorsForPeer",new Map),Xa(this,"currentActiveDialCount",0),Xa(this,"pendingPeerDialQueue",[]),Xa(this,"onEventHandlers",{"peer:discovery":e=>{(async()=>{const{id:t}=e.detail;(await this.getTagNamesForPeer(t)).includes(Vu.BOOTSTRAP)?this.dispatchEvent(new nh(Hu.PEER_DISCOVERY_BOOTSTRAP,{detail:t})):this.dispatchEvent(new nh(Hu.PEER_DISCOVERY_PEER_EXCHANGE,{detail:t}));try{await this.attemptDial(t)}catch(n){oh("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(Vu.BOOTSTRAP)){this.libp2p.getConnections().filter((e=>e.tags.includes(Vu.BOOTSTRAP))).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(t):this.dispatchEvent(new nh(Hu.PEER_CONNECT_BOOTSTRAP,{detail:t}))}else this.dispatchEvent(new nh(Hu.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,...r},this.keepAliveManager=new ih(t,n),this.run().then((()=>oh("Connection Manager is now running"))).catch((e=>oh("Unexpected error while running service",e))),this.dialPeerStorePeers().catch((e=>oh("Unexpected error while dialing peer store peers",e)))}async dialPeerStorePeers(){const e=await this.libp2p.peerStore.all(),t=[];for(const r of e)this.libp2p.getConnections().find((e=>e.remotePeer===r.id))||t.push(this.attemptDial(r.id));try{await Promise.all(t)}catch(n){oh("Unexpected error while dialing peer store peers",n)}}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{oh("Dialing peer ".concat(e.toString())),await this.libp2p.dial(e);const t=await this.getTagNamesForPeer(e);return this.libp2p.getConnections(e).forEach((e=>e.tags=Array.from(new Set([...e.tags,...t])))),void this.dialAttemptsForPeer.delete(e.toString())}catch(r){var n;const i=r;this.dialErrorsForPeer.set(e.toString(),i),oh("Error dialing peer ".concat(e.toString()," - ").concat(i.errors)),t=null!==(n=this.dialAttemptsForPeer.get(e.toString()))&&void 0!==n?n:1,this.dialAttemptsForPeer.set(e.toString(),t+1),t<=this.options.maxDialAttemptsForPeer&&oh("Reattempting dial (".concat(t,")"))}try{return oh("Deleting undialable peer ".concat(e.toString()," from peer store. Error: ").concat(JSON.stringify(this.dialErrorsForPeer.get(e.toString()).errors[0]),"\n }")),this.dialErrorsForPeer.delete(e.toString()),await this.libp2p.peerStore.delete(e)}catch(i){throw"Error deleting undialable peer ".concat(e.toString()," from peer store - ").concat(i)}finally{this.currentActiveDialCount-=1,this.processDialQueue()}}async dropConnection(e){try{this.keepAliveManager.stop(e),await this.libp2p.hangUp(e),oh("Dropped connection with peer ".concat(e.toString()))}catch(t){oh("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=>{oh(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===Vu.BOOTSTRAP)))return!0;if(this.libp2p.getConnections().filter((e=>e.tags.find((e=>e===Vu.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 oh("Failed to get peer ".concat(e,", error: ").concat(t)),[]}}}Xa(sh,"instances",new Map);const ah="js-waku",ch=Ju("waku:waku");class lh{constructor(e,t,n,r,i,o){Xa(this,"libp2p",void 0),Xa(this,"relay",void 0),Xa(this,"store",void 0),Xa(this,"filter",void 0),Xa(this,"lightPush",void 0),Xa(this,"connectionManager",void 0),this.libp2p=t,n&&(this.store=n(t)),i&&(this.filter=i(t)),r&&(this.lightPush=r(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=sh.create(c,t,{pingKeepAlive:s,relayKeepAlive:a},this.relay),ch("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 n=null!==t&&void 0!==t?t:[],r=function(e){return Za(e)?e:(t=e,new Qu(t));var t}(e);"undefined"===typeof t&&(this.relay&&n.push(zu.Relay),this.store&&n.push(zu.Store),this.filter&&n.push(zu.Filter),this.lightPush&&n.push(zu.LightPush));const i=[];return n.includes(zu.Relay)&&(this.relay?this.relay.gossipSub.multicodecs.forEach((e=>i.push(e))):ch("Relay codec not included in dial codec: protocol not mounted locally")),n.includes(zu.Store)&&(this.store?i.push(this.store.multicodec):ch("Store codec not included in dial codec: protocol not mounted locally")),n.includes(zu.LightPush)&&(this.lightPush?i.push(this.lightPush.multicodec):ch("Light Push codec not included in dial codec: protocol not mounted locally")),n.includes(zu.Filter)&&(this.filter?i.push(this.filter.multicodec):ch("Filter codec not included in dial codec: protocol not mounted locally")),ch("Dialing to ".concat(r.toString()," with protocols ").concat(n)),this.libp2p.dialProtocol(r,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()}}var uh=__webpack_require__(6276),hh=__webpack_require__(6453),dh=__webpack_require__(5934),fh=__webpack_require__(1928),ph=__webpack_require__(651);dh._configure(),uh._configure(hh),fh._configure(ph);const gh=["uint64","int64","sint64","fixed64","sfixed64"];function yh(e){return function(e){for(const t of gh){if(null==e[t])continue;const n=e[t];e[t]=function(){return BigInt(n.call(this).toString())}}return e}(new uh(e))}function mh(){return function(e){for(const t of gh){if(null==e[t])continue;const n=e[t];e[t]=function(e){return n.call(this,e.toString())}}return e}(fh.create())}function vh(e,t){const n=yh(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}function bh(e,t){const n=mh();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}var wh,Eh,_h,Sh,Ah,kh,Th,Ih,Ch,Rh,xh,Ph,Dh,Nh,Oh,Bh,Lh,Mh,Uh,Fh,jh,zh,Kh,qh,Vh,Hh,Wh,Gh,$h,Yh,Qh;function Xh(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}function Jh(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return Xh("enum",wh.VARINT,(function(e,n){const r=t(e);n.int32(r)}),(function(e){return t(e.int32())}))}function Zh(e,t){return Xh("message",wh.LENGTH_DELIMITED,e,t)}!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"}(wh||(wh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={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)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Eh||(Eh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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),Eh.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={payload:new Uint8Array(0),contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=Eh.codec().decode(e,e.uint32());break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(_h||(_h={})),function(e){let t,n;!function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.contentTopic=e.string();else e.skipType(7&t)}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(t=e.ContentFilter||(e.ContentFilter={})),e.codec=()=>(null==n&&(n=Zh((function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&n.fork(),null!=t.subscribe&&!1!==t.subscribe&&(n.uint32(8),n.bool(t.subscribe)),null!=t.topic&&""!==t.topic&&(n.uint32(18),n.string(t.topic)),null!=t.contentFilters)for(const i of t.contentFilters)n.uint32(26),e.ContentFilter.codec().encode(i,n);!1!==r.lengthDelimited&&n.ldelim()}),((t,n)=>{const r={subscribe:!1,topic:"",contentFilters:[]},i=null==n?t.len:t.pos+n;for(;t.pos<i;){const n=t.uint32();switch(n>>>3){case 1:r.subscribe=t.bool();break;case 2:r.topic=t.string();break;case 3:r.contentFilters.push(e.ContentFilter.codec().decode(t,t.uint32()));break;default:t.skipType(7&n)}}return r}))),n),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Sh||(Sh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&t.fork(),null!=e.messages)for(const r of e.messages)t.uint32(10),Ih.codec().encode(r,t);!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={messages:[]},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.messages.push(Ih.codec().decode(e,e.uint32()));else e.skipType(7&t)}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Ah||(Ah={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),Sh.codec().encode(e.request,t)),null!=e.push&&(t.uint32(26),Ah.codec().encode(e.push,t)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={requestId:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.requestId=e.string();break;case 2:n.request=Sh.codec().decode(e,e.uint32());break;case 3:n.push=Ah.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(kh||(kh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={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)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Th||(Th={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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),Th.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={payload:new Uint8Array(0),contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=Th.codec().decode(e,e.uint32());break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Ih||(Ih={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===2)n.contentTopic=e.string();else e.skipType(7&t)}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Ch||(Ch={})),function(e){let t,n,r;!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"}(n||(n={})),function(e){e.codec=()=>Jh(n)}(t=e.FilterSubscribeType||(e.FilterSubscribeType={})),e.codec=()=>(null==r&&(r=Zh((function(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==i.lengthDelimited&&r.fork(),null!=t.requestId&&""!==t.requestId&&(r.uint32(10),r.string(t.requestId)),null!=t.filterSubscribeType&&0!==n[t.filterSubscribeType]&&(r.uint32(16),e.FilterSubscribeType.codec().encode(t.filterSubscribeType,r)),null!=t.pubsubTopic&&(r.uint32(82),r.string(t.pubsubTopic)),null!=t.contentTopics)for(const e of t.contentTopics)r.uint32(90),r.string(e);!1!==i.lengthDelimited&&r.ldelim()}),((n,r)=>{const i={requestId:"",filterSubscribeType:t.SUBSCRIBER_PING,contentTopics:[]},o=null==r?n.len:n.pos+r;for(;n.pos<o;){const t=n.uint32();switch(t>>>3){case 1:i.requestId=n.string();break;case 2:i.filterSubscribeType=e.FilterSubscribeType.codec().decode(n);break;case 10:i.pubsubTopic=n.string();break;case 11:i.contentTopics.push(n.string());break;default:n.skipType(7&t)}}return i}))),r),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Rh||(Rh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={requestId:"",statusCode:0},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.requestId=e.string();break;case 10:n.statusCode=e.uint32();break;case 11:n.statusDesc=e.string();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(xh||(xh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.wakuMessage&&(t.uint32(10),Nh.codec().encode(e.wakuMessage,t)),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.wakuMessage=Nh.codec().decode(e,e.uint32());break;case 2:n.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Ph||(Ph={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={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)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Dh||(Dh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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),Dh.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={payload:new Uint8Array(0),contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=Dh.codec().decode(e,e.uint32());break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Nh||(Nh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&""!==e.pubsubTopic&&(t.uint32(10),t.string(e.pubsubTopic)),null!=e.message&&(t.uint32(18),Uh.codec().encode(e.message,t)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={pubsubTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.pubsubTopic=e.string();break;case 2:n.message=Uh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Oh||(Oh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={isSuccess:!1},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.isSuccess=e.bool();break;case 2:n.info=e.string();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Bh||(Bh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),Oh.codec().encode(e.request,t)),null!=e.response&&(t.uint32(26),Bh.codec().encode(e.response,t)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={requestId:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.requestId=e.string();break;case 2:n.request=Oh.codec().decode(e,e.uint32());break;case 3:n.response=Bh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Lh||(Lh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={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)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Mh||(Mh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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),Mh.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={payload:new Uint8Array(0),contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=Mh.codec().decode(e,e.uint32());break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Uh||(Uh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={digest:new Uint8Array(0),receiverTime:0n,senderTime:0n,pubsubTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.digest=e.bytes();break;case 2:n.receiverTime=e.sint64();break;case 3:n.senderTime=e.sint64();break;case 4:n.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Fh||(Fh={})),function(e){let t,n,r;!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"}(n||(n={})),function(e){e.codec=()=>Jh(n)}(t=e.Direction||(e.Direction={})),e.codec=()=>(null==r&&(r=Zh((function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&n.fork(),null!=t.pageSize&&(n.uint32(8),n.uint64(t.pageSize)),null!=t.cursor&&(n.uint32(18),Fh.codec().encode(t.cursor,n)),null!=t.direction&&(n.uint32(24),e.Direction.codec().encode(t.direction,n)),!1!==r.lengthDelimited&&n.ldelim()}),((t,n)=>{const r={},i=null==n?t.len:t.pos+n;for(;t.pos<i;){const n=t.uint32();switch(n>>>3){case 1:r.pageSize=t.uint64();break;case 2:r.cursor=Fh.codec().decode(t,t.uint32());break;case 3:r.direction=e.Direction.codec().decode(t);break;default:t.skipType(7&n)}}return r}))),r),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(jh||(jh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.contentTopic=e.string();else e.skipType(7&t)}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(zh||(zh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),null!=e.contentFilters)for(const r of e.contentFilters)t.uint32(26),zh.codec().encode(r,t);null!=e.pagingInfo&&(t.uint32(34),jh.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={contentFilters:[]},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 2:n.pubsubTopic=e.string();break;case 3:n.contentFilters.push(zh.codec().decode(e,e.uint32()));break;case 4:n.pagingInfo=jh.codec().decode(e,e.uint32());break;case 5:n.startTime=e.sint64();break;case 6:n.endTime=e.sint64();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Kh||(Kh={})),function(e){let t,n,r;!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"}(n||(n={})),function(e){e.codec=()=>Jh(n)}(t=e.HistoryError||(e.HistoryError={})),e.codec=()=>(null==r&&(r=Zh((function(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==i.lengthDelimited&&r.fork(),null!=t.messages)for(const e of t.messages)r.uint32(18),Wh.codec().encode(e,r);null!=t.pagingInfo&&(r.uint32(26),jh.codec().encode(t.pagingInfo,r)),null!=t.error&&0!==n[t.error]&&(r.uint32(32),e.HistoryError.codec().encode(t.error,r)),!1!==i.lengthDelimited&&r.ldelim()}),((n,r)=>{const i={messages:[],error:t.NONE},o=null==r?n.len:n.pos+r;for(;n.pos<o;){const t=n.uint32();switch(t>>>3){case 2:i.messages.push(Wh.codec().decode(n,n.uint32()));break;case 3:i.pagingInfo=jh.codec().decode(n,n.uint32());break;case 4:i.error=e.HistoryError.codec().decode(n);break;default:n.skipType(7&t)}}return i}))),r),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(qh||(qh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.query&&(t.uint32(18),Kh.codec().encode(e.query,t)),null!=e.response&&(t.uint32(26),qh.codec().encode(e.response,t)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={requestId:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.requestId=e.string();break;case 2:n.query=Kh.codec().decode(e,e.uint32());break;case 3:n.response=qh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Vh||(Vh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={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)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.proof=e.bytes();break;case 2:n.merkleRoot=e.bytes();break;case 3:n.epoch=e.bytes();break;case 4:n.shareX=e.bytes();break;case 5:n.shareY=e.bytes();break;case 6:n.nullifier=e.bytes();break;case 7:n.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Hh||(Hh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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),Hh.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={payload:new Uint8Array(0),contentTopic:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.payload=e.bytes();break;case 2:n.contentTopic=e.string();break;case 3:n.version=e.uint32();break;case 10:n.timestamp=e.sint64();break;case 11:n.meta=e.bytes();break;case 21:n.rateLimitProof=Hh.codec().decode(e,e.uint32());break;case 31:n.ephemeral=e.bool();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Wh||(Wh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.enr&&(t.uint32(10),t.bytes(e.enr)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.enr=e.bytes();else e.skipType(7&t)}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Gh||(Gh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.numPeers&&(t.uint32(8),t.uint64(e.numPeers)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.numPeers=e.uint64();else e.skipType(7&t)}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}($h||($h={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&t.fork(),null!=e.peerInfos)for(const r of e.peerInfos)t.uint32(10),Gh.codec().encode(r,t);!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={peerInfos:[]},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.peerInfos.push(Gh.codec().decode(e,e.uint32()));else e.skipType(7&t)}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Yh||(Yh={})),function(e){let t;e.codec=()=>(null==t&&(t=Zh((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.query&&(t.uint32(10),$h.codec().encode(e.query,t)),null!=e.response&&(t.uint32(18),Yh.codec().encode(e.response,t)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.query=$h.codec().decode(e,e.uint32());break;case 2:n.response=Yh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>bh(t,e.codec()),e.decode=t=>vh(t,e.codec())}(Qh||(Qh={}));const ed=Ju("waku:message:version-0"),td=BigInt(1e6);class nd{constructor(e,t){Xa(this,"pubSubTopic",void 0),Xa(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/td;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 rd{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;if(Xa(this,"contentTopic",void 0),Xa(this,"ephemeral",void 0),Xa(this,"metaSetter",void 0),this.contentTopic=e,this.ephemeral=t,this.metaSetter=n,!e||""===e)throw new Error("Content topic must be specified")}async toWire(e){return _h.encode(await this.toProtoObj(e))}async toProtoObj(e){var t;const n=null!==(t=e.timestamp)&&void 0!==t?t:new Date,r={payload:e.payload,version:0,contentTopic:this.contentTopic,timestamp:BigInt(n.valueOf())*td,meta:void 0,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const e=this.metaSetter(r);return{...r,meta:e}}return r}}function id(e){let{contentTopic:t,ephemeral:n,metaSetter:r}=e;return new rd(t,n,r)}class od{constructor(e){if(Xa(this,"contentTopic",void 0),this.contentTopic=e,!e||""===e)throw new Error("Content topic must be specified")}fromWireToProtoObj(e){var t,n,r,i,o;const s=_h.decode(e);return ed("Message decoded",s),Promise.resolve({payload:s.payload,contentTopic:s.contentTopic,version:null!==(t=s.version)&&void 0!==t?t:void 0,timestamp:null!==(n=s.timestamp)&&void 0!==n?n:void 0,meta:null!==(r=s.meta)&&void 0!==r?r: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 n;return null!==(n=t.version)&&void 0!==n&&n?(ed("Failed to decode due to incorrect version, expected:",0,", actual:",t.version),Promise.resolve(void 0)):new nd(e,t)}}function sd(e){return new od(e)}function ad(e){const t=new Map;return e.forEach((e=>{let n=t.get(e.contentTopic);n||(t.set(e.contentTopic,[]),n=t.get(e.contentTopic)),n.push(e)})),t}const cd=60;async function ld(e,t,n,r){var i,o;const s=null!==(i=null===r||void 0===r?void 0:r.iteratorDelay)&&void 0!==i?i:cd,a=[];let c;c=await e.subscribe(t,(e=>{a.push(e)}),n);const l=Number.isInteger(null===r||void 0===r?void 0:r.timeoutMs),u=null!==(o=null===r||void 0===r?void 0:r.timeoutMs)&&void 0!==o?o:0,h=Date.now();return{iterator:async function*(){for(;;){if(l&&Date.now()-h>=u)return;await ud(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 ud(e){return new Promise((t=>{setTimeout(t,e)}))}const hd=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{const t=[];for await(const n of e)t.push(n);return t})();const t=[];for(const n of e)t.push(n);return t},dd=Symbol.for("@achingbrain/uint8arraylist");function fd(e,t){if(null==t||t<0)throw new RangeError("index is out of bounds");let n=0;for(const r of e){const e=n+r.byteLength;if(t<e)return{buf:r,index:t-n};n=e}throw new RangeError("index is out of bounds")}function pd(e){return Boolean(null===e||void 0===e?void 0:e[dd])}class gd{constructor(){Object.defineProperty(this,dd,{value:!0}),this.bufs=[],this.length=0;for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];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),n=0;n<e;n++)t[n]=arguments[n];this.appendAll(t)}appendAll(e){let t=0;for(const n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else{if(!pd(n))throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");t+=n.byteLength,this.bufs.push(...n.bufs)}this.length+=t}prepend(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.prependAll(t)}prependAll(e){let t=0;for(const n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else{if(!pd(n))throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");t+=n.byteLength,this.bufs.unshift(...n.bufs)}this.length+=t}get(e){const t=fd(this.bufs,e);return t.buf[t.index]}set(e,t){const n=fd(this.bufs,e);n.buf[n.index]=t}write(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else{if(!pd(e))throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList");for(let n=0;n<e.length;n++)this.set(t+n,e.get(n))}}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:n,length:r}=this._subList(e,t);return Zl(n,r)}subarray(e,t){const{bufs:n,length:r}=this._subList(e,t);return 1===n.length?n[0]:Zl(n,r)}sublist(e,t){const{bufs:n,length:r}=this._subList(e,t),i=new gd;return i.length=r,i.bufs=n,i}_subList(e,t){var n,r;if(e=null!==(n=e)&&void 0!==n?n:0,t=null!==(r=t)&&void 0!==r?r: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 n=this.bufs[s],r=o,a=r+n.byteLength;if(o=a,e>=a)continue;const c=e>=r&&e<a,l=t>r&&t<=a;if(c&&l){if(e===r&&t===a){i.push(n);break}const o=e-r;i.push(n.subarray(o,o+(t-e)));break}if(c){if(0===e){i.push(n);continue}i.push(n.subarray(e-r))}else{if(l){if(t===a){i.push(n);break}i.push(n.subarray(0,t-r));break}i.push(n)}}return{bufs:i,length:t-e}}indexOf(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!pd(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const r=e instanceof Uint8Array?e:e.subarray();if(n=Number(null!==(t=n)&&void 0!==t?t:0),isNaN(n)&&(n=0),n<0&&(n=this.length+n),n<0&&(n=0),0===e.length)return n>this.length?this.length:n;const i=r.byteLength;if(0===i)throw new TypeError("search must be at least 1 byte long");const o=new Int32Array(256);for(let u=0;u<256;u++)o[u]=-1;for(let u=0;u<i;u++)o[r[u]]=u;const s=o,a=this.byteLength-r.byteLength,c=r.byteLength-1;let l;for(let u=n;u<=a;u+=l){l=0;for(let e=c;e>=0;e--){const t=this.get(u+e);if(r[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 n=Wl(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){const n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){const r=Hl(2);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt16(0,t,n),this.write(r,e)}getInt32(e,t){const n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){const r=Hl(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt32(0,t,n),this.write(r,e)}getBigInt64(e,t){const n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){const r=Hl(8);new DataView(r.buffer,r.byteOffset,r.byteLength).setBigInt64(0,t,n),this.write(r,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 n=Wl(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){const n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){const r=Hl(2);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint16(0,t,n),this.write(r,e)}getUint32(e,t){const n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){const r=Hl(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint32(0,t,n),this.write(r,e)}getBigUint64(e,t){const n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){const r=Hl(8);new DataView(r.buffer,r.byteOffset,r.byteLength).setBigUint64(0,t,n),this.write(r,e)}getFloat32(e,t){const n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){const r=Hl(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat32(0,t,n),this.write(r,e)}getFloat64(e,t){const n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){const r=Hl(8);new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat64(0,t,n),this.write(r,e)}equals(e){if(null==e)return!1;if(!(e instanceof gd))return!1;if(e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!ll(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){const n=new gd;return n.bufs=e,null==t&&(t=e.reduce(((e,t)=>e+t.byteLength),0)),n.length=t,n}}function yd(e){return e instanceof Uint8Array?{get:t=>e[t],set(t,n){e[t]=n}}:{get:t=>e.get(t),set(t,n){e.set(t,n)}}}const md=4294967296;class vd{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,n=(this.hi>>>1^e)>>>0;return new vd(n,t)}zzEncode(){const e=this.hi>>31,t=((this.hi<<1|this.lo>>>31)^e)>>>0,n=(this.lo<<1^e)>>>0;return new vd(t,n)}toBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=yd(e);for(;this.hi>0;)n.set(t++,127&this.lo|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)n.set(t++,127&this.lo|128),this.lo=this.lo>>>7;n.set(t++,this.lo)}static fromBigInt(e){if(0n===e)return new vd;const t=e<0;t&&(e=-e);let n=0|Number(e>>32n),r=0|Number(e-(BigInt(n)<<32n));return t&&(n=~n>>>0,r=~r>>>0,++r>md&&(r=0,++n>md&&(n=0))),new vd(n,r)}static fromNumber(e){if(0===e)return new vd;const t=e<0;t&&(e=-e);let n=e>>>0,r=(e-n)/4294967296>>>0;return t&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new vd(r,n)}static fromBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=yd(e),r=new vd;let i=0;if(e.length-t>4){for(;i<4;++i)if(r.lo=(r.lo|(127&n.get(t))<<7*i)>>>0,n.get(t++)<128)return r;if(r.lo=(r.lo|(127&n.get(t))<<28)>>>0,r.hi=(r.hi|(127&n.get(t))>>4)>>>0,n.get(t++)<128)return r;i=0}else for(;i<4;++i){if(t>=e.length)throw RangeError("index out of range: ".concat(t," > ").concat(e.length));if(r.lo=(r.lo|(127&n.get(t))<<7*i)>>>0,n.get(t++)<128)return r}if(e.length-t>4){for(;i<5;++i)if(r.hi=(r.hi|(127&n.get(t))<<7*i+3)>>>0,n.get(t++)<128)return r}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(r.hi=(r.hi|(127&n.get(t))<<7*i+3)>>>0,n.get(t++)<128)return r}throw RangeError("invalid varint encoding")}}const bd=Math.pow(2,7),wd=Math.pow(2,14),Ed=Math.pow(2,21),_d=Math.pow(2,28),Sd=Math.pow(2,35),Ad=Math.pow(2,42),kd=Math.pow(2,49),Td=Math.pow(2,56),Id=Math.pow(2,63),Cd={encodingLength:e=>e<bd?1:e<wd?2:e<Ed?3:e<_d?4:e<Sd?5:e<Ad?6:e<kd?7:e<Td?8:e<Id?9:10,encode(e,t){let n=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=Wl(Cd.encodingLength(e))),vd.fromNumber(e).toBytes(t,n),t},decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return vd.fromBytes(e,t).toNumber(!0)}};function Rd(e){return null!=e[Symbol.asyncIterator]}const xd=e=>{const t=Cd.encodingLength(e),n=Wl(t);return Cd.encode(e,n),xd.bytes=t,n};function Pd(e,t){var n,r;const i=null!==(r=(t=null!==(n=t)&&void 0!==n?n:{}).lengthEncoder)&&void 0!==r?r:xd;function*o(e){const t=i(e.byteLength);t instanceof Uint8Array?yield t:yield*t,e instanceof Uint8Array?yield e:yield*e}return Rd(e)?async function*(){for await(const t of e)yield*o(t)}():function*(){for(const t of e)yield*o(t)}()}xd.bytes=0,Pd.single=(e,t)=>{var n,r;const i=null!==(r=(t=null!==(n=t)&&void 0!==n?n:{}).lengthEncoder)&&void 0!==r?r:xd;return new gd(i(e.byteLength),e)};var Dd=__webpack_require__(7963);const Nd=8,Od=4194304;var Bd;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(Bd||(Bd={}));const Ld=e=>{const t=Cd.decode(e);return Ld.bytes=Cd.encodingLength(t),t};function Md(e,t){var n,r,i;const o=new gd;let s=Bd.LENGTH,a=-1;const c=null!==(n=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==n?n:Ld,l=null!==(r=null===t||void 0===t?void 0:t.maxLengthLength)&&void 0!==r?r:Nd,u=null!==(i=null===t||void 0===t?void 0:t.maxDataLength)&&void 0!==i?i:Od;function*h(){for(;o.byteLength>0;){if(s===Bd.LENGTH)try{if(a=c(o),a<0)throw Dd(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw Dd(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=Bd.DATA}catch(e){if(e instanceof RangeError){if(o.byteLength>l)throw Dd(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw e}if(s===Bd.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=Bd.LENGTH}}}return Rd(e)?async function*(){for await(const t of e)o.append(t),yield*h();if(o.byteLength>0)throw Dd(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 Dd(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}function Ud(){const e={};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e}Ld.bytes=0,Md.fromReader=(e,t)=>{let n=1;return Md(async function*(){for(;;)try{const{done:t,value:r}=await e.next(n);if(!0===t)return;null!=r&&(yield r)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{n=1}}(),{...null!==t&&void 0!==t?t:{},onLength:e=>{n=e}})};class Fd{constructor(e){if(Xa(this,"buffer",void 0),Xa(this,"mask",void 0),Xa(this,"top",void 0),Xa(this,"btm",void 0),Xa(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 jd{constructor(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Xa(this,"size",void 0),Xa(this,"hwm",void 0),Xa(this,"head",void 0),Xa(this,"tail",void 0),this.hwm=null!==(e=t.splitLimit)&&void 0!==e?e:16,this.head=new Fd(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 Fd(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 zd extends Error{constructor(e,t){super(null!==e&&void 0!==e?e:"The operation was aborted"),Xa(this,"type",void 0),Xa(this,"code",void 0),this.type="aborted",this.code=null!==t&&void 0!==t?t:"ABORT_ERR"}}function Kd(){return qd((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 qd(e,t){var n;let r,i,o,s=(t=null!==(n=t)&&void 0!==n?n:{}).onEnd,a=new jd,c=Ud();const l=e=>null!=i?i(e):(a.push(e),r),u=e=>{var n;if(o)return r;if(!0!==(null===(n=t)||void 0===n?void 0:n.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?r:(o=!0,null!=e?(e=>(a=new jd,null!=i?i({error:e}):(a.push({error:e}),r)))(e):l({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:async()=>{try{return a.isEmpty()?o?{done:!0}:await new Promise(((t,n)=>{i=o=>{i=null,a.push(o);try{t(e(a))}catch(s){n(s)}return r}})):e(a)}finally{a.isEmpty()&&queueMicrotask((()=>{c.resolve(),c=Ud()}))}},return:()=>(a=new jd,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 n,r;null!=t&&(n=new Promise(((e,n)=>{r=()=>{n(new zd)},t.addEventListener("abort",r)})));try{await Promise.race([c.promise,n])}finally{null!=r&&null!=t&&(null===t||void 0===t||t.removeEventListener("abort",r))}}},null==s)return r;const d=r;return r={[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),r),get readableLength(){return d.readableLength}},r}const Vd=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=[];for(const i of t)null==i[Symbol.asyncIterator]&&r.push(i);return r.length===t.length?function*(){for(const e of r)yield*e}():async function*(){const e=Kd({objectMode:!0});Promise.resolve().then((async()=>{try{await Promise.all(t.map((async t=>{for await(const n of t)e.push(n)}))),e.end()}catch(n){e.end(n)}})),yield*e}()};function Hd(e){if(null==e)throw new Error("Empty pipeline");if(Yd(e)){const t=e;e=()=>t.source}else if($d(e)||Gd(e)){const t=e;e=()=>t}for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const i=[e,...n];if(i.length>1&&Yd(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++)Yd(i[o])&&(i[o]=Qd(i[o]));return Wd(...i)}const Wd=function(){let e;for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(;n.length>0;)e=n.shift()(e);return e},Gd=e=>null!=(null===e||void 0===e?void 0:e[Symbol.asyncIterator]),$d=e=>null!=(null===e||void 0===e?void 0:e[Symbol.iterator]),Yd=e=>null!=e&&(null!=e.sink&&null!=e.source),Qd=e=>t=>{const n=e.sink(t);if(null!=(null===n||void 0===n?void 0:n.then)){const t=Kd({objectMode:!0});let r;n.then((()=>{t.end()}),(e=>{t.end(e)}));const i=e.source;if(Gd(i))r=async function*(){yield*i,t.end()};else{if(!$d(i))throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");r=function*(){yield*i,t.end()}}return Vd(t,r())}return e.source},Xd=Ju("waku:libp2p-utils");async function Jd(e,t){const n=[];return await e.forEach((e=>{for(let r=0;r<t.length;r++)if(e.protocols.includes(t[r])){n.push(e);break}})),n}async function Zd(e,t,n){let r,i;if(n){if(r=await e.get(n),!r)throw new Error("Failed to retrieve connection details for provided peer in peer store: ".concat(n.toString()))}else{if(r=function(e){if(0===e.length)return;return e[Math.round(Math.random()*(e.length-1))]}(await Jd(e,t)),!r)throw new Error("Failed to find known peer that registers protocols: ".concat(t))}for(const o of t)r.protocols.includes(o)&&(i=o);if(Xd("Using codec ".concat(i)),!i)throw new Error("Peer does not register required protocols (".concat(r.id.toString(),"): ").concat(t));return{peer:r,protocol:i}}function ef(e){if(!e.length)return;if(1===e.length)return e[0];let t;return e.forEach((e=>{"OPEN"===e.stat.status&&(t?e.stat.timeline.open>t.stat.timeline.open&&(t=e):t=e)})),t}class tf{constructor(e,t){Xa(this,"multicodec",void 0),Xa(this,"components",void 0),Xa(this,"addLibp2pEventListener",void 0),Xa(this,"removeLibp2pEventListener",void 0),this.multicodec=e,this.components=t,this.addLibp2pEventListener=t.events.addEventListener.bind(t.events),this.removeLibp2pEventListener=t.events.removeEventListener.bind(t.events)}get peerStore(){return this.components.peerStore}async peers(){return Jd(this.peerStore,[this.multicodec])}async getPeer(e){const{peer:t}=await Zd(this.peerStore,[this.multicodec],e);return t}async newStream(e){const t=ef(this.components.connectionManager.getConnections(e.id));if(!t)throw new Error("Failed to get a connection to the peer");return t.newStream(this.multicodec)}}const nf="/waku/2/default-waku/proto",rf={randomUUID:"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let of;const sf=new Uint8Array(16);function af(){if(!of&&(of="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!of))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return of(sf)}const cf=[];for(let SK=0;SK<256;++SK)cf.push((SK+256).toString(16).slice(1));function lf(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(cf[e[t+0]]+cf[e[t+1]]+cf[e[t+2]]+cf[e[t+3]]+"-"+cf[e[t+4]]+cf[e[t+5]]+"-"+cf[e[t+6]]+cf[e[t+7]]+"-"+cf[e[t+8]]+cf[e[t+9]]+"-"+cf[e[t+10]]+cf[e[t+11]]+cf[e[t+12]]+cf[e[t+13]]+cf[e[t+14]]+cf[e[t+15]]).toLowerCase()}const uf=function(e,t,n){if(rf.randomUUID&&!t&&!e)return rf.randomUUID();const r=(e=e||{}).random||(e.rng||af)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return lf(r)};class hf{constructor(e){Xa(this,"proto",void 0),this.proto=e}static decode(e){const t=Ph.decode(e);return new hf(t)}encode(){return Ph.encode(this.proto)}get wakuMessage(){return this.proto.wakuMessage}get pubsubTopic(){return this.proto.pubsubTopic}}class df{constructor(e){Xa(this,"proto",void 0),this.proto=e}static createSubscribeRequest(e,t){return new df({requestId:uf(),filterSubscribeType:Rh.FilterSubscribeType.SUBSCRIBE,pubsubTopic:e,contentTopics:t})}static createUnsubscribeRequest(e,t){return new df({requestId:uf(),filterSubscribeType:Rh.FilterSubscribeType.UNSUBSCRIBE,pubsubTopic:e,contentTopics:t})}static createUnsubscribeAllRequest(e){return new df({requestId:uf(),filterSubscribeType:Rh.FilterSubscribeType.UNSUBSCRIBE_ALL,pubsubTopic:e,contentTopics:[]})}static createSubscriberPingRequest(){return new df({requestId:uf(),filterSubscribeType:Rh.FilterSubscribeType.SUBSCRIBER_PING,pubsubTopic:"",contentTopics:[]})}static decode(e){const t=Rh.decode(e);return new df(t)}encode(){return Rh.encode(this.proto)}get filterSubscribeType(){return this.proto.filterSubscribeType}get requestId(){return this.proto.requestId}get pubsubTopic(){return this.proto.pubsubTopic}get contentTopics(){return this.proto.contentTopics}}class ff{constructor(e){Xa(this,"proto",void 0),this.proto=e}static decode(e){const t=xh.decode(e);return new ff(t)}encode(){return xh.encode(this.proto)}get statusCode(){return this.proto.statusCode}get statusDesc(){return this.proto.statusDesc}get requestId(){return this.proto.requestId}}const pf=Ju("waku:filter:v2"),gf="/vac/waku/filter-subscribe/2.0.0-beta1",yf="/vac/waku/filter-push/2.0.0-beta1";class mf{constructor(e,t,n){Xa(this,"peer",void 0),Xa(this,"pubSubTopic",void 0),Xa(this,"newStream",void 0),Xa(this,"subscriptionCallbacks",void 0),this.peer=t,this.pubSubTopic=e,this.newStream=n,this.subscriptionCallbacks=new Map}async subscribe(e,t){const n=ad(Array.isArray(e)?e:[e]),r=Array.from(n.keys()),i=await this.newStream(this.peer),o=df.createSubscribeRequest(this.pubSubTopic,r);try{const e=await Hd([o.encode()],Pd,i,Md,(async e=>await hd(e))),{statusCode:t,requestId:n,statusDesc:s}=ff.decode(e[0].slice());if(t<200||t>=300)throw new Error("Filter subscribe request ".concat(n," failed with status code ").concat(t,": ").concat(s));pf("Subscribed to peer ",this.peer.id.toString(),"for content topics",r)}catch(s){throw new Error("Error subscribing to peer: "+this.peer.id.toString()+" for content topics: "+r+": "+s)}n.forEach(((e,n)=>{const r={decoders:e,callback:t};this.subscriptionCallbacks.set(n,r)}))}async unsubscribe(e){const t=await this.newStream(this.peer),n=df.createUnsubscribeRequest(this.pubSubTopic,e);try{await Hd([n.encode()],Pd,t.sink)}catch(r){throw new Error("Error subscribing: "+r)}e.forEach((e=>{this.subscriptionCallbacks.delete(e)}))}async ping(){const e=await this.newStream(this.peer),t=df.createSubscriberPingRequest();try{const n=await Hd([t.encode()],Pd,e,Md,(async e=>await hd(e))),{statusCode:r,requestId:i,statusDesc:o}=ff.decode(n[0].slice());if(r<200||r>=300)throw new Error("Filter ping request ".concat(i," failed with status code ").concat(r,": ").concat(o));pf("Ping successful")}catch(n){throw pf("Error pinging: ",n),new Error("Error pinging: "+n)}}async unsubscribeAll(){const e=await this.newStream(this.peer),t=df.createUnsubscribeAllRequest(this.pubSubTopic);try{const n=await Hd([t.encode()],Pd,e,Md,(async e=>await hd(e))),{statusCode:r,requestId:i,statusDesc:o}=ff.decode(n[0].slice());if(r<200||r>=300)throw new Error("Filter unsubscribe all request ".concat(i," failed with status code ").concat(r,": ").concat(o));this.subscriptionCallbacks.clear(),pf("Unsubscribed from all content topics")}catch(n){throw new Error("Error unsubscribing from all content topics: "+n)}}async processMessage(e){const t=e.contentTopic,n=this.subscriptionCallbacks.get(t);n?await async function(e,t,n){const{decoders:r,callback:i}=e,{contentTopic:o}=n;if(!o)return void pf("Message has no content topic, skipping");let s=!1;for(const a of r){if(s)break;const e=await a.fromProtoObj(t,n);e?(s=Boolean(e),await i(e)):pf("Not able to decode message")}}(n,this.pubSubTopic,e):pf("No subscription callback available for ",t)}}class vf extends tf{getActiveSubscription(e,t){return this.activeSubscriptions.get("".concat(e,"_").concat(t))}setActiveSubscription(e,t,n){return this.activeSubscriptions.set("".concat(e,"_").concat(t),n),n}constructor(e,t){super(gf,e.components),Xa(this,"options",void 0),Xa(this,"activeSubscriptions",new Map),e.handle(yf,this.onRequest.bind(this)).catch((e=>{pf("Failed to register ",yf,e)})),this.activeSubscriptions=new Map,this.options=null!==t&&void 0!==t?t:{}}async createSubscription(e,t){var n,r;const i=null!==(n=null!==e&&void 0!==e?e:this.options.pubSubTopic)&&void 0!==n?n:nf,o=await this.getPeer(t);return null!==(r=this.getActiveSubscription(i,o.id.toString()))&&void 0!==r?r:this.setActiveSubscription(i,o.id.toString(),new mf(i,o,this.newStream.bind(this,o)))}toSubscriptionIterator(e,t){return ld(this,e,t)}async subscribe(e,t,n){const r=await this.createSubscription(void 0,null===n||void 0===n?void 0:n.peerId);await r.subscribe(e,t);const i=Array.from(ad(Array.isArray(e)?e:[e]).keys());return async()=>{await r.unsubscribe(i)}}onRequest(e){pf("Receiving message push");try{Hd(e.stream,Md,(async t=>{for await(const n of t){const t=hf.decode(n.slice()),{pubsubTopic:r,wakuMessage:i}=t;if(!i)return void pf("Received empty message");if(!r)return void pf("PubSub topic missing from push message");const o=e.connection.remotePeer.toString(),s=this.getActiveSubscription(r,o);if(!s)return void pf("No subscription locally registered for topic ".concat(r));await s.processMessage(i)}})).then((()=>{pf("Receiving pipe closed.")}),(e=>{pf("Error with receiving pipe",e)}))}catch(t){pf("Error decoding message",t)}}}const bf=e=>!(e.length/1048576>1);class wf{constructor(e){Xa(this,"proto",void 0),this.proto=e}static createRequest(e,t){return new wf({requestId:uf(),request:{message:e,pubsubTopic:t},response:void 0})}static decode(e){const t=Lh.decode(e);return new wf(t)}encode(){return Lh.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}const Ef=Ju("waku:light-push");class _f extends tf{constructor(e,t){super("/vac/waku/lightpush/2.0.0-beta1",e.components),Xa(this,"options",void 0),this.options=t||{}}async send(e,t,n){const{pubSubTopic:r=nf}=this.options,i=await this.getPeer(null===n||void 0===n?void 0:n.peerId),o=await this.newStream(i),s=[];let a;try{if(!bf(t.payload))return Ef("Failed to send waku light push: message is bigger that 1MB"),{recipients:s,error:Ku.SIZE_TOO_BIG};const n=await e.toProtoObj(t);if(!n)return Ef("Failed to encode to protoMessage, aborting push"),{recipients:s,error:Ku.ENCODE_FAILED};const l=wf.createRequest(n,r),u=await Hd([l.encode()],Pd,o,Md,(async e=>await hd(e)));try{const e=new gd;u.forEach((t=>{e.append(t)}));const t=wf.decode(e).response;null!==t&&void 0!==t&&t.isSuccess?s.push(i.id):(Ef("No response in PushRPC"),a=Ku.NO_RPC_RESPONSE)}catch(c){Ef("Failed to decode push reply",c),a=Ku.DECODE_FAILED}}catch(c){Ef("Failed to send waku light push request",c),a=Ku.GENERIC_FAIL}return{error:a,recipients:s}}}function Sf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Wrong positive integer: ".concat(e))}function Af(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new Error("Expected Uint8Array of length ".concat(n,", not of length=").concat(e.length))}const kf={number:Sf,bool:function(e){if("boolean"!==typeof e)throw new Error("Expected boolean, not ".concat(e))},bytes:Af,hash:function(e){if("function"!==typeof e||"function"!==typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Sf(e.outputLen),Sf(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){Af(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least ".concat(n))}},Tf=kf,If="object"===typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,Cf=e=>e instanceof Uint8Array,Rf=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),xf=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Pf(e){if("string"!==typeof e)throw new Error("utf8ToBytes expected string, got ".concat(typeof e));return new Uint8Array((new TextEncoder).encode(e))}function Df(e){if("string"===typeof e&&(e=Pf(e)),!Cf(e))throw new Error("expected Uint8Array, got ".concat(typeof e));return e}class Nf{clone(){return this._cloneInto()}}function Of(e){const t=t=>e().update(Df(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Bf(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(If&&"function"===typeof If.getRandomValues)return If.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}class Lf extends Nf{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Rf(this.buffer)}update(e){Tf.exists(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=Df(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=Rf(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Tf.exists(this),Tf.output(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)t[u]=0;!function(e,t,n,r){if("function"===typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=Rf(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 n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.length=r,e.pos=s,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}}const Mf=(e,t,n)=>e&t^~e&n,Uf=(e,t,n)=>e&t^e&n^t&n,Ff=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]),jf=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),zf=new Uint32Array(64);class Kf extends Lf{constructor(){super(64,32,8,!1),this.A=0|jf[0],this.B=0|jf[1],this.C=0|jf[2],this.D=0|jf[3],this.E=0|jf[4],this.F=0|jf[5],this.G=0|jf[6],this.H=0|jf[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)zf[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=zf[u-15],t=zf[u-2],n=xf(e,7)^xf(e,18)^e>>>3,r=xf(t,17)^xf(t,19)^t>>>10;zf[u]=r+zf[u-7]+n+zf[u-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const e=l+(xf(s,6)^xf(s,11)^xf(s,25))+Mf(s,a,c)+Ff[u]+zf[u]|0,t=(xf(n,2)^xf(n,13)^xf(n,22))+Uf(n,r,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+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(n,r,i,o,s,a,c,l)}roundClean(){zf.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class qf extends Kf{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const Vf=Of((()=>new Kf));Of((()=>new qf));function Hf(e){return Boolean(e)}function Wf(e){if("string"===typeof e){return ru(e.replace(/^0x/i,"").toLowerCase(),"base16")}return e}const Gf=e=>Xl(e,"base16"),$f=e=>Xl(e,"utf8"),Yf=e=>ru(e,"utf8");const Qf={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function Xf(e){return{...Qf,...e}}const Jf=BigInt(1e6);var Zf;!function(e){e.BACKWARD="backward",e.FORWARD="forward"}(Zf||(Zf={}));class ep{constructor(e){Xa(this,"proto",void 0),this.proto=e}get query(){return this.proto.query}get response(){return this.proto.response}static createQuery(e){const t=e.contentTopics.map((e=>({contentTopic:e}))),n=function(e){switch(e){case Zf.BACKWARD:return jh.Direction.BACKWARD;case Zf.FORWARD:return jh.Direction.FORWARD;default:return jh.Direction.BACKWARD}}(e.pageDirection),r={pageSize:BigInt(e.pageSize),cursor:e.cursor,direction:n};let i,o;return e.startTime&&(i=BigInt(e.startTime.valueOf())*Jf),e.endTime&&(o=BigInt(e.endTime.valueOf())*Jf),new ep({requestId:uf(),query:{pubsubTopic:e.pubSubTopic,contentFilters:t,pagingInfo:r,startTime:i,endTime:o},response:void 0})}decode(e){const t=Vh.decode(e);return new ep(t)}encode(){return Vh.encode(this.proto)}}var tp=qh.HistoryError;const np=Ju("waku:store");class rp extends tf{constructor(e,t){super("/vac/waku/store/2.0.0-beta4",e.components),Xa(this,"options",void 0),this.options=null!==t&&void 0!==t?t:{}}async queryOrderedCallback(e,t,n){let r=!1;for await(const i of this.queryGenerator(e,n)){if(r)break;let e=(await Promise.all(i)).filter(Hf);"undefined"!==typeof(null===n||void 0===n?void 0:n.pageDirection)&&(null===n||void 0===n?void 0:n.pageDirection)!==Zf.BACKWARD||(e=e.reverse()),await Promise.all(e.map((async e=>{e&&!r&&(r=Boolean(await t(e)))})))}}async queryCallbackOnPromise(e,t,n){let r=!1,i=[];for await(const o of this.queryGenerator(e,n)){const e=o.map((async e=>{r||(r=Boolean(await t(e)))}));i=i.concat(e)}await Promise.all(i)}async*queryGenerator(e,t){var n;const{pubSubTopic:r=nf}=this.options;let i,o;null!==t&&void 0!==t&&t.timeFilter&&(i=t.timeFilter.startTime,o=t.timeFilter.endTime);const s=new Map;e.forEach((e=>{if(s.has(e.contentTopic))throw new Error("API does not support different decoder per content topic");s.set(e.contentTopic,e)}));const a=e.map((e=>e.contentTopic)),c=Object.assign({pubSubTopic:r,pageDirection:Zf.BACKWARD,pageSize:10},t,{contentTopics:a,startTime:i,endTime:o});np("Querying history with the following options",{...t,peerId:null===t||void 0===t||null===(n=t.peerId)||void 0===n?void 0:n.toString()});const l=await this.getPeer(null===t||void 0===t?void 0:t.peerId);for await(const u of async function*(e,t,n,r){if(t.contentTopics.toString()!==Array.from(n.keys()).toString())throw new Error("Internal error, the decoders should match the query's content topics");let i=r;for(;;){var o,s,a,c;t.cursor=i;const r=ep.createQuery(t);np("Querying store peer","for (".concat(t.pubSubTopic,")"),t.contentTopics);const l=await e(),u=await Hd([r.encode()],Pd,l,Md,(async e=>await hd(e))),h=new gd;u.forEach((e=>{h.append(e)}));const d=r.decode(h);if(!d.response){np("Stopping pagination due to store `response` field missing");break}const f=d.response;if(f.error&&f.error!==tp.NONE)throw"History response contains an Error: "+f.error;if(!f.messages||!f.messages.length){np("Stopping pagination due to store `response.messages` field missing or empty");break}np("".concat(f.messages.length," messages retrieved from store")),yield f.messages.map((e=>{const r=e.contentTopic;if("undefined"!==typeof r){const i=n.get(r);if(i)return i.fromProtoObj(t.pubSubTopic,Xf(e))}return Promise.resolve(void 0)}));const p=null===(o=f.pagingInfo)||void 0===o?void 0:o.cursor;if("undefined"===typeof p){np("Stopping pagination due to `response.pagingInfo.cursor` missing from store response");break}i=p;const g=null===(s=f.pagingInfo)||void 0===s?void 0:s.pageSize,y=null===(a=r.query)||void 0===a||null===(c=a.pagingInfo)||void 0===c?void 0:c.pageSize;if(g&&y&&g<y)break}}(this.newStream.bind(this,l),c,s,null===t||void 0===t?void 0:t.cursor))yield u}}class ip extends Error{constructor(e){super(e),this.name="TimeoutError"}}class op extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const sp=e=>void 0===globalThis.DOMException?new op(e):new DOMException(e),ap=e=>{const t=void 0===e.reason?sp("This operation was aborted."):e.reason;return t instanceof Error?t:sp(t)};const cp=e=>{const t=e.on||e.addListener||e.addEventListener,n=e.off||e.removeListener||e.removeEventListener;if(!t||!n)throw new TypeError("Emitter is not compatible");return{addListener:t.bind(e),removeListener:n.bind(e)}};function lp(e,t,n){let r;const i=new Promise(((i,o)=>{if(!((n={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...n}).count>=0)||n.count!==Number.POSITIVE_INFINITY&&!Number.isInteger(n.count))throw new TypeError("The `count` option should be at least 0 or more");const s=[t].flat(),a=[],{addListener:c,removeListener:l}=cp(e),u=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];const s=n.multiArgs?t:t[0];n.filter&&!n.filter(s)||(a.push(s),n.count===a.length&&(r(),i(a)))},h=e=>{r(),o(e)};r=()=>{for(const e of s)l(e,u);for(const e of n.rejectionEvents)l(e,h)};for(const e of s)c(e,u);for(const e of n.rejectionEvents)c(e,h);n.resolveImmediately&&i(a)}));if(i.cancel=r,"number"===typeof n.timeout){const e=function(e,t,n,r){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((r={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...r}).signal){const{signal:e}=r;e.aborted&&s(ap(e)),e.addEventListener("abort",(()=>{s(ap(e))}))}i=r.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof n){try{o(n())}catch(a){s(a)}return}const r="string"===typeof n?n:"Promise timed out after ".concat(t," milliseconds"),i=n instanceof Error?n:new ip(r);"function"===typeof e.cancel&&e.cancel(),s(i)}),t),(async()=>{try{o(await e)}catch(t){s(t)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()}else o(e)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(i,n.timeout);return e.cancel=r,e}return i}function up(e,t,n){"function"===typeof n&&(n={filter:n});const r=lp(e,t,n={...n,count:1,resolveImmediately:!1}),i=r.then((e=>e[0]));return i.cancel=r.cancel,i}const hp=Ju("waku:wait-for-remote-peer");async function dp(e,t,n){var r;if(t=null!==(r=t)&&void 0!==r?r:function(e){const t=[];e.relay&&t.push(zu.Relay);e.filter&&t.push(zu.Filter);e.store&&t.push(zu.Store);e.lightPush&&t.push(zu.LightPush);return t}(e),!e.isStarted())return Promise.reject("Waku node is not started");const i=[];if(t.includes(zu.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 up(e.gossipSub,"gossipsub:heartbeat"),t=e.getMeshPeers()}(e.relay))}if(t.includes(zu.Store)){if(!e.store)throw new Error("Cannot wait for Store peer: protocol not mounted");i.push(fp(e.store))}if(t.includes(zu.LightPush)){if(!e.lightPush)throw new Error("Cannot wait for LightPush peer: protocol not mounted");i.push(fp(e.lightPush))}if(t.includes(zu.Filter)){if(!e.filter)throw new Error("Cannot wait for Filter peer: protocol not mounted");i.push(fp(e.filter))}n?await async function(e,t,n){await Promise.race([e,pp(t,n)])}(Promise.all(i),n,"Timed out waiting for a remote peer."):await Promise.all(i)}async function fp(e){const t=e.multicodec,n=await e.peers();n.length?hp("".concat(t," peer found: "),n[0].id.toString()):await new Promise((n=>{const r=i=>{var o,s;null!==(o=i.detail)&&void 0!==o&&null!==(s=o.protocols)&&void 0!==s&&s.includes(t)&&(hp("Resolving for",t,i.detail.protocols),e.removeLibp2pEventListener("peer:identify",r),n())};e.addLibp2pEventListener("peer:identify",r)}))}const pp=(e,t)=>new Promise(((n,r)=>setTimeout((()=>r(t)),e)));function gp(){const e=Ud();let t=!1;return{sink:async n=>{if(t)throw new Error("already piped");t=!0,e.resolve(n)},source:async function*(){const t=await e.promise;yield*t}()}}const yp=e=>Cd.decode(e);function mp(e,t){const n=Kd();e.sink(n).catch((e=>{n.end(e)})),e.sink=async e=>{for await(const t of e)n.push(t);n.end()};let r=e.source;null!=e.source[Symbol.iterator]?r=e.source[Symbol.iterator]():null!=e.source[Symbol.asyncIterator]&&(r=e.source[Symbol.asyncIterator]());const i=new gd,o={read:async e=>{if(null==e){const{done:e,value:t}=await r.next();return!0===e?new gd:t}for(;i.byteLength<e;){const{value:e,done:t}=await r.next();if(!0===t)throw Dd(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 n=-1;const r=new gd,i=null!==(e=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==e?e:yp;for(;;){r.append(await o.read(1));try{n=i(r)}catch(s){if(s instanceof RangeError)continue;throw s}if(n>-1)break;if(null!=(null===t||void 0===t?void 0:t.maxLengthLength)&&r.byteLength>t.maxLengthLength)throw Dd(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG")}if(null!=(null===t||void 0===t?void 0:t.maxDataLength)&&n>t.maxDataLength)throw Dd(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");return o.read(n)},readPB:async e=>{const t=await o.readLP();if(null==t)throw new Error("Value is null");const n=t instanceof Uint8Array?t:t.subarray();return e.decode(n)},write:e=>{e instanceof Uint8Array?n.push(e):n.push(e.subarray())},writeLP:e=>{o.write(Pd.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 vp,bp;yp.bytes=0;const wp=65535,Ep=wp-16,_p=Boolean(null===(vp=globalThis.process)||void 0===vp||null===(bp=vp.env)||void 0===bp?void 0:bp.DUMP_SESSION_KEYS),Sp=e=>e instanceof Uint8Array,Ap=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 kp(e){if("string"!==typeof e)throw new Error("utf8ToBytes expected string, got ".concat(typeof e));return new Uint8Array((new TextEncoder).encode(e))}function Tp(e){if("string"===typeof e&&(e=kp(e)),!Sp(e))throw new Error("expected Uint8Array, got ".concat(typeof e));return e}const Ip=e=>"[object Object]"===Object.prototype.toString.call(e)&&e.constructor===Object;function Cp(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 Rp(e,t,n,r){if("function"===typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}function xp(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Wrong positive integer: ".concat(e))}function Pp(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new Error("Expected Uint8Array of length ".concat(n,", not of length=").concat(e.length))}const Dp={number:xp,bool:function(e){if("boolean"!==typeof e)throw new Error("Expected boolean, not ".concat(e))},bytes:Pp,hash:function(e){if("function"!==typeof e||"function"!==typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");xp(e.outputLen),xp(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){Pp(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least ".concat(n))}},Np=Dp,Op=(e,t)=>255&e[t++]|(255&e[t++])<<8;class Bp{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,Cp(e=Tp(e),32);const t=Op(e,0),n=Op(e,2),r=Op(e,4),i=Op(e,6),o=Op(e,8),s=Op(e,10),a=Op(e,12),c=Op(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>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]=Op(e,16+2*l)}process(e,t){const n=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?0:2048,{h:r,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=Op(e,t+0),y=Op(e,t+2),m=Op(e,t+4),v=Op(e,t+6),b=Op(e,t+8),w=Op(e,t+10),E=Op(e,t+12),_=Op(e,t+14);let S=r[0]+(8191&g),A=r[1]+(8191&(g>>>13|y<<3)),k=r[2]+(8191&(y>>>10|m<<6)),T=r[3]+(8191&(m>>>7|v<<9)),I=r[4]+(8191&(v>>>4|b<<12)),C=r[5]+(b>>>1&8191),R=r[6]+(8191&(b>>>14|w<<2)),x=r[7]+(8191&(w>>>11|E<<5)),P=r[8]+(8191&(E>>>8|_<<8)),D=r[9]+(_>>>5|n),N=0,O=N+S*o+A*(5*p)+k*(5*f)+T*(5*d)+I*(5*h);N=O>>>13,O&=8191,O+=C*(5*u)+R*(5*l)+x*(5*c)+P*(5*a)+D*(5*s),N+=O>>>13,O&=8191;let B=N+S*s+A*o+k*(5*p)+T*(5*f)+I*(5*d);N=B>>>13,B&=8191,B+=C*(5*h)+R*(5*u)+x*(5*l)+P*(5*c)+D*(5*a),N+=B>>>13,B&=8191;let L=N+S*a+A*s+k*o+T*(5*p)+I*(5*f);N=L>>>13,L&=8191,L+=C*(5*d)+R*(5*h)+x*(5*u)+P*(5*l)+D*(5*c),N+=L>>>13,L&=8191;let M=N+S*c+A*a+k*s+T*o+I*(5*p);N=M>>>13,M&=8191,M+=C*(5*f)+R*(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+T*s+I*o;N=U>>>13,U&=8191,U+=C*(5*p)+R*(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+T*a+I*s;N=F>>>13,F&=8191,F+=C*o+R*(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+T*c+I*a;N=j>>>13,j&=8191,j+=C*s+R*o+x*(5*p)+P*(5*f)+D*(5*d),N+=j>>>13,j&=8191;let z=N+S*d+A*h+k*u+T*l+I*c;N=z>>>13,z&=8191,z+=C*a+R*s+x*o+P*(5*p)+D*(5*f),N+=z>>>13,z&=8191;let K=N+S*f+A*d+k*h+T*u+I*l;N=K>>>13,K&=8191,K+=C*c+R*a+x*s+P*o+D*(5*p),N+=K>>>13,K&=8191;let q=N+S*p+A*f+k*d+T*h+I*u;N=q>>>13,q&=8191,q+=C*l+R*c+x*a+P*s+D*o,N+=q>>>13,q&=8191,N=(N<<2)+N|0,N=N+O|0,O=8191&N,N>>>=13,B+=N,r[0]=O,r[1]=B,r[2]=L,r[3]=M,r[4]=U,r[5]=F,r[6]=j,r[7]=z,r[8]=K,r[9]=q}finalize(){const{h:e,pad:t}=this,n=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=r,r=e[s]>>>13,e[s]&=8191;e[0]+=5*r,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let s=1;s<10;s++)n[s]=e[s]+r,r=n[s]>>>13,n[s]&=8191;n[9]-=8192;let i=(1^r)-1;for(let s=0;s<10;s++)n[s]&=i;i=~i;for(let s=0;s<10;s++)e[s]=e[s]&i|n[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){Np.exists(this);const{buffer:t,blockLen:n}=this,r=(e=Tp(e)).length;for(let i=0;i<r;){const o=Math.min(n-this.pos,r-i);if(o!==n)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(t,0,!1),this.pos=0);else for(;n<=r-i;i+=n)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){Np.exists(this),Np.output(e,this),this.finished=!0;const{buffer:t,h:n}=this;let{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=n[o]>>>0,e[i++]=n[o]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}}const Lp=function(e){const t=(t,n)=>e(n).update(Tp(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}((e=>new Bp(e))),Mp=kp("expand 16-byte k"),Up=kp("expand 32-byte k"),Fp=Ap(Mp),jp=Ap(Up),zp=e=>!(e.byteOffset%4),Kp=e=>{const{core:t,rounds:n,counterRight:r,counterLen:i,allow128bitKeys:o,extendNonceFn:s,blockLen:a}=function(e,t){if(void 0!==t&&("object"!==typeof t||!Ip(t)))throw new Error("Options should be object or undefined");return Object.assign(e,t)}({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},e);Np.number(i),Np.number(n),Np.number(a),Np.bool(r),Np.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(Np.bytes(e),Np.bytes(l),Np.bytes(u),h||(h=new Uint8Array(u.length)),Np.bytes(h),Np.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=jp;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=Fp,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,r?0:12-l.length),f.push(l=e)}const m=new Uint8Array(a),v=Ap(m),b=Ap(p),w=Ap(l),E=zp(u)&&Ap(u),_=zp(h)&&Ap(h);f.push(v);const S=u.length;for(let r=0,i=d;r<S;i++){if(t(g,b,w,v,i,n),i>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");const e=Math.min(a,S-r);if(e===a&&_&&E){const e=r/4;if(r%4!==0)throw new Error("Salsa/ChaCha: wrong block position");for(let t=0;t<c;t++)_[e+t]=E[e+t]^v[t];r+=a}else{for(let t=0;t<e;t++)h[r+t]=u[r+t]^m[t];r+=e}}for(let t=0;t<f.length;t++)f[t].fill(0);return h}},qp=(e,t)=>e<<t|e>>>32-t;function Vp(e,t,n,r,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=n[0],w=n[1],E=n[2],_=s,S=a,A=c,k=l,T=u,I=h,C=d,R=f,x=p,P=g,D=y,N=m,O=v,B=b,L=w,M=E;for(let F=0;F<o;F+=2)_=_+T|0,O=qp(O^_,16),x=x+O|0,T=qp(T^x,12),_=_+T|0,O=qp(O^_,8),x=x+O|0,T=qp(T^x,7),S=S+I|0,B=qp(B^S,16),P=P+B|0,I=qp(I^P,12),S=S+I|0,B=qp(B^S,8),P=P+B|0,I=qp(I^P,7),A=A+C|0,L=qp(L^A,16),D=D+L|0,C=qp(C^D,12),A=A+C|0,L=qp(L^A,8),D=D+L|0,C=qp(C^D,7),k=k+R|0,M=qp(M^k,16),N=N+M|0,R=qp(R^N,12),k=k+R|0,M=qp(M^k,8),N=N+M|0,R=qp(R^N,7),_=_+I|0,M=qp(M^_,16),D=D+M|0,I=qp(I^D,12),_=_+I|0,M=qp(M^_,8),D=D+M|0,I=qp(I^D,7),S=S+C|0,O=qp(O^S,16),N=N+O|0,C=qp(C^N,12),S=S+C|0,O=qp(O^S,8),N=N+O|0,C=qp(C^N,7),A=A+R|0,B=qp(B^A,16),x=x+B|0,R=qp(R^x,12),A=A+R|0,B=qp(B^A,8),x=x+B|0,R=qp(R^x,7),k=k+T|0,L=qp(L^k,16),P=P+L|0,T=qp(T^P,12),k=k+T|0,L=qp(L^k,8),P=P+L|0,T=qp(T^P,7);let U=0;r[U++]=s+_|0,r[U++]=a+S|0,r[U++]=c+A|0,r[U++]=l+k|0,r[U++]=u+T|0,r[U++]=h+I|0,r[U++]=d+C|0,r[U++]=f+R|0,r[U++]=p+x|0,r[U++]=g+P|0,r[U++]=y+D|0,r[U++]=m+N|0,r[U++]=v+O|0,r[U++]=b+B|0,r[U++]=w+L|0,r[U++]=E+M|0}Kp({core:Vp,counterRight:!1,counterLen:8});const Hp=Kp({core:Vp,counterRight:!1,counterLen:4,allow128bitKeys:!1}),Wp=Kp({core:Vp,counterRight:!1,counterLen:8,extendNonceFn:function(e,t,n,r){const i=Ap(t),o=Ap(n),s=Ap(r);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=qp(b^a,16),g=g+b|0,h=qp(h^g,12),a=a+h|0,b=qp(b^a,8),g=g+b|0,h=qp(h^g,7),c=c+d|0,w=qp(w^c,16),y=y+w|0,d=qp(d^y,12),c=c+d|0,w=qp(w^c,8),y=y+w|0,d=qp(d^y,7),l=l+f|0,E=qp(E^l,16),m=m+E|0,f=qp(f^m,12),l=l+f|0,E=qp(E^l,8),m=m+E|0,f=qp(f^m,7),u=u+p|0,_=qp(_^u,16),v=v+_|0,p=qp(p^v,12),u=u+p|0,_=qp(_^u,8),v=v+_|0,p=qp(p^v,7),a=a+d|0,_=qp(_^a,16),m=m+_|0,d=qp(d^m,12),a=a+d|0,_=qp(_^a,8),m=m+_|0,d=qp(d^m,7),c=c+f|0,b=qp(b^c,16),v=v+b|0,f=qp(f^v,12),c=c+f|0,b=qp(b^c,8),v=v+b|0,f=qp(f^v,7),l=l+p|0,w=qp(w^l,16),g=g+w|0,p=qp(p^g,12),l=l+p|0,w=qp(w^l,8),g=g+w|0,p=qp(p^g,7),u=u+h|0,E=qp(E^u,16),y=y+E|0,h=qp(h^y,12),u=u+h|0,E=qp(E^u,8),y=y+E|0,h=qp(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]=_,r},allow128bitKeys:!1}),Gp=(Kp({core:Vp,counterRight:!1,counterLen:4,rounds:8}),Kp({core:Vp,counterRight:!1,counterLen:4,rounds:12}),new Uint8Array(16)),$p=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(Gp.subarray(n))},Yp=(e,t,n,r,i)=>{const o=e(t,n,new Uint8Array(32)),s=Lp.create(o);i&&$p(s,i),$p(s,r);const a=new Uint8Array(16),c=(l=a,new DataView(l.buffer,l.byteOffset,l.byteLength));var l;Rp(c,0,BigInt(i?i.length:0),!0),Rp(c,8,BigInt(r.length),!0),s.update(a);const u=s.digest();return o.fill(0),u},Qp=e=>(t,n,r)=>{const i=16;return Cp(t,32),Cp(n),{tagLength:i,encrypt:o=>{const s=new Uint8Array(o.length+i);e(t,n,o,s,1);const a=Yp(e,t,n,s.subarray(0,-16),r);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 n=!0;for(let r=0;r<e.length;r++)n&&(n=e[r]===t[r]);return n}(s,Yp(e,t,n,a,r)))throw new Error("Wrong tag");return e(t,n,a,void 0,1)}}},Xp=Qp(Hp),Jp=(Qp(Wp),BigInt(2**32-1)),Zp=BigInt(32);function eg(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&Jp),l:Number(e>>Zp&Jp)}:{h:0|Number(e>>Zp&Jp),l:0|Number(e&Jp)}}const tg={fromBig:eg,split:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=eg(e[i],t);[n[i],r[i]]=[o,s]}return[n,r]},toBig:(e,t)=>BigInt(e>>>0)<<Zp|BigInt(t>>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<<n|t>>>32-n,rotlSL:(e,t,n)=>t<<n|e>>>32-n,rotlBH:(e,t,n)=>t<<n-32|e>>>64-n,rotlBL:(e,t,n)=>e<<n-32|t>>>64-n,add:function(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5H:(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,add5L:(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[ng,rg]=tg.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)))),ig=new Uint32Array(80),og=new Uint32Array(80);class sg extends Lf{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:n,Bl:r,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,n,r,i,o,s,a,c,l,u,h,d,f,p,g]}set(e,t,n,r,i,o,s,a,c,l,u,h,d,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,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)ig[v]=e.getUint32(t),og[v]=e.getUint32(t+=4);for(let v=16;v<80;v++){const e=0|ig[v-15],t=0|og[v-15],n=tg.rotrSH(e,t,1)^tg.rotrSH(e,t,8)^tg.shrSH(e,t,7),r=tg.rotrSL(e,t,1)^tg.rotrSL(e,t,8)^tg.shrSL(e,t,7),i=0|ig[v-2],o=0|og[v-2],s=tg.rotrSH(i,o,19)^tg.rotrBH(i,o,61)^tg.shrSH(i,o,6),a=tg.rotrSL(i,o,19)^tg.rotrBL(i,o,61)^tg.shrSL(i,o,6),c=tg.add4L(r,a,og[v-7],og[v-16]),l=tg.add4H(c,n,s,ig[v-7],ig[v-16]);ig[v]=0|l,og[v]=0|c}let{Ah:n,Al:r,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=tg.rotrSH(u,h,14)^tg.rotrSH(u,h,18)^tg.rotrBH(u,h,41),t=tg.rotrSL(u,h,14)^tg.rotrSL(u,h,18)^tg.rotrBL(u,h,41),b=u&d^~u&p,w=h&f^~h&g,E=tg.add5L(m,t,w,rg[v],og[v]),_=tg.add5H(E,y,e,b,ng[v],ig[v]),S=0|E,A=tg.rotrSH(n,r,28)^tg.rotrBH(n,r,34)^tg.rotrBH(n,r,39),k=tg.rotrSL(n,r,28)^tg.rotrBL(n,r,34)^tg.rotrBL(n,r,39),T=n&i^n&s^i&s,I=r&o^r&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}=tg.add(0|c,0|l,0|_,0|S)),c=0|s,l=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const C=tg.add3L(S,k,I);n=tg.add3H(C,_,A,T),r=0|C}({h:n,l:r}=tg.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=tg.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=tg.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:l}=tg.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:h}=tg.add(0|this.Eh,0|this.El,0|u,0|h)),({h:d,l:f}=tg.add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:g}=tg.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:m}=tg.add(0|this.Hh,0|this.Hl,0|y,0|m)),this.set(n,r,i,o,s,a,c,l,u,h,d,f,p,g,y,m)}roundClean(){ig.fill(0),og.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)}}class ag extends sg{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class cg extends sg{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class lg extends sg{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}const ug=Of((()=>new sg)),hg=(Of((()=>new ag)),Of((()=>new cg)),Of((()=>new lg)),BigInt(0),BigInt(1)),dg=BigInt(2),fg=e=>e instanceof Uint8Array,pg=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function gg(e){if(!fg(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=pg[e[n]];return t}function yg(e){if("string"!==typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":"0x".concat(e))}function mg(e){if("string"!==typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const t=2*r,i=e.slice(t,t+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");n[r]=o}return n}function vg(e){if(!fg(e))throw new Error("Uint8Array expected");return yg(gg(Uint8Array.from(e).reverse()))}function bg(e,t){return mg(e.toString(16).padStart(2*t,"0"))}function wg(e,t){return bg(e,t).reverse()}function Eg(e,t,n){let r;if("string"===typeof t)try{r=mg(t)}catch(o){throw new Error("".concat(e,' must be valid hex string, got "').concat(t,'". Cause: ').concat(o))}else{if(!fg(t))throw new Error("".concat(e," must be hex string or Uint8Array"));r=Uint8Array.from(t)}const i=r.length;if("number"===typeof n&&i!==n)throw new Error("".concat(e," expected ").concat(n," bytes, got ").concat(i));return r}function _g(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=new Uint8Array(t.reduce(((e,t)=>e+t.length),0));let i=0;return t.forEach((e=>{if(!fg(e))throw new Error("Uint8Array expected");r.set(e,i),i+=e.length})),r}const Sg=e=>(dg<<BigInt(e-1))-hg;const Ag={bigint:e=>"bigint"===typeof e,function:e=>"function"===typeof e,boolean:e=>"boolean"===typeof e,string:e=>"string"===typeof 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 kg(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(t,n,r)=>{const i=Ag[n];if("function"!==typeof i)throw new Error('Invalid validator "'.concat(n,'", expected function'));const o=e[t];if((!r||void 0!==o)&&!i(o,e))throw new Error("Invalid param ".concat(String(t),"=").concat(o," (").concat(typeof o,"), expected ").concat(n))};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e}const Tg=BigInt(0),Ig=BigInt(1),Cg=BigInt(2),Rg=BigInt(3),xg=BigInt(4),Pg=BigInt(5),Dg=BigInt(8);BigInt(9),BigInt(16);function Ng(e,t){const n=e%t;return n>=Tg?n:t+n}function Og(e,t,n){if(n<=Tg||t<Tg)throw new Error("Expected power/modulo > 0");if(n===Ig)return Tg;let r=Ig;for(;t>Tg;)t&Ig&&(r=r*e%n),e=e*e%n,t>>=Ig;return r}function Bg(e,t,n){let r=e;for(;t-- >Tg;)r*=r,r%=n;return r}function Lg(e,t){if(e===Tg||t<=Tg)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let n=Ng(e,t),r=t,i=Tg,o=Ig,s=Ig,a=Tg;for(;n!==Tg;){const e=r/n,t=r%n,c=i-s*e,l=o-a*e;r=n,n=t,i=s,o=a,s=c,a=l}if(r!==Ig)throw new Error("invert: does not exist");return Ng(i,t)}function Mg(e){if(e%xg===Rg){const t=(e+Ig)/xg;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%Dg===Pg){const t=(e-Pg)/Dg;return function(e,n){const r=e.mul(n,Cg),i=e.pow(r,t),o=e.mul(n,i),s=e.mul(e.mul(o,Cg),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-Ig)/Cg;let n,r,i;for(n=e-Ig,r=0;n%Cg===Tg;n/=Cg,r++);for(i=Cg;i<e&&Og(i,t,e)!==e-Ig;i++);if(1===r){const t=(e+Ig)/xg;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const o=(n+Ig)/Cg;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),n),l=e.pow(s,o),u=e.pow(s,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const n=e.pow(c,Ig<<BigInt(a-t-1));c=e.sqr(n),l=e.mul(l,n),u=e.mul(u,c),a=t}return l}}(e)}const Ug=(e,t)=>(Ng(e,t)&Ig)===Ig,Fg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function jg(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}const zg=BigInt(0),Kg=BigInt(1);function qg(e){return kg(e.Fp,Fg.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),kg(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...jg(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const Vg=BigInt(0),Hg=BigInt(1),Wg=BigInt(2),Gg=BigInt(8),$g={zip215:!0};function Yg(e){const t=function(e){const t=qg(e);return kg(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=t,l=Wg<<BigInt(8*a)-Hg,u=n.create,h=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(r){return{isValid:!1,value:Vg}}}),d=t.adjustScalarBytes||(e=>e),f=t.domain||((e,t,n)=>{if(t.length||n)throw new Error("Contexts/pre-hash are not supported");return e}),p=e=>"bigint"===typeof e&&Vg<e,g=(e,t)=>p(e)&&p(t)&&e<t,y=e=>e===Vg||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===Vg?e:m(e,r)}const b=new Map;function w(e){if(!(e instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(e,t,n,r){if(this.ex=e,this.ey=t,this.ez=n,this.et=r,!y(e))throw new Error("x required");if(!y(t))throw new Error("y required");if(!y(n))throw new Error("z required");if(!y(r))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:n}=e||{};if(!y(t)||!y(n))throw new Error("invalid affine point");return new E(t,n,Hg,u(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.ez)));return e.map(((e,n)=>e.toAffine(t[n]))).map(E.fromAffine)}_setWindowSize(e){this._WINDOW_SIZE=e,b.delete(this)}assertValidity(){const{a:e,d:n}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:r,ey:i,ez:o,et:s}=this,a=u(r*r),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(n*u(a*c))))throw new Error("bad point: equation left != right (1)");if(u(r*i)!==u(o*s))throw new Error("bad point: equation left != right (2)")}equals(e){w(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=e,a=u(t*s),c=u(i*r),l=u(n*s),h=u(o*r);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:n,ey:r,ez:i}=this,o=u(n*n),s=u(r*r),a=u(Wg*u(i*i)),c=u(e*o),l=n+r,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:n,d:r}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:c,ey:l,ez:h,et:d}=e;if(n===BigInt(-1)){const e=u((o-i)*(l+c)),t=u((o+i)*(l-c)),n=u(t-e);if(n===Vg)return this.double();const r=u(s*Wg*d),f=u(a*Wg*h),p=f+r,g=t+e,y=f-r,m=u(p*n),v=u(g*y),b=u(p*y),w=u(n*g);return new E(m,v,w,b)}const f=u(i*c),p=u(o*l),g=u(a*r*d),y=u(s*h),m=u((i+o)*(c+l)-f-p),v=y-g,b=y+g,_=u(p-n*f),S=u(m*v),A=u(b*_),k=u(m*_),T=u(v*b);return new E(S,A,T,k)}subtract(e){return this.add(e.negate())}wNAF(e){return A.wNAFCached(this,b,e,E.normalizeZ)}multiply(e){const{p:t,f:n}=this.wNAF(m(e,r));return E.normalizeZ([t,n])[0]}multiplyUnsafe(e){let t=v(e);return t===Vg?S:this.equals(S)||t===Hg?this:this.equals(_)?this.wNAF(t).p:A.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return A.unsafeLadder(this,r).is0()}toAffine(e){const{ex:t,ey:r,ez:i}=this,o=this.is0();null==e&&(e=o?Gg:n.inv(i));const s=u(t*e),a=u(r*e),c=u(i*e);if(o)return{x:Vg,y:Hg};if(c!==Hg)throw new Error("invZ was invalid");return{x:s,y:a}}clearCofactor(){const{h:e}=t;return e===Hg?this:this.multiplyUnsafe(e)}static fromHex(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{d:i,a:o}=t,s=n.BYTES,a=(e=Eg("pointHex",e,s)).slice(),c=e[s-1];a[s-1]=-129&c;const d=vg(a);d===Vg||m(d,r?l:n.ORDER);const f=u(d*d),p=u(f-Hg),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&Hg)===Hg,w=0!==(128&c);if(!r&&v===Vg&&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 I(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=wg(t,n.BYTES);return r[r.length-1]|=e&Hg?128:0,r}toHex(){return gg(this.toRawBytes())}}E.BASE=new E(t.Gx,t.Gy,Hg,u(t.Gx*t.Gy)),E.ZERO=new E(Vg,Hg,Hg,Vg);const{BASE:_,ZERO:S}=E,A=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>zg;)n&Kg&&(r=r.add(i)),i=i.double(),n>>=Kg;return r},precomputeWindow(e,t){const{windows:n,windowSize:i}=r(t),o=[];let s=e,a=s;for(let r=0;r<n;r++){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}=r(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 r=Number(o&u);o>>=d,r>a&&(r-=h,o+=Kg);const s=t,f=t+Math.abs(r)-1,p=e%2!==0,g=r<0;0===r?l=l.add(n(p,i[s])):c=c.add(n(g,i[f]))}return{p:c,f:l}},wNAFCached(e,t,n,r){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,r(o))),this.wNAF(i,o,n)}}}(E,8*a);function k(e){return Ng(e,r)}function T(e){return k(vg(e))}function I(e){const t=a;e=Eg("private key",e,t);const n=Eg("hashed private key",o(e),2*t),r=d(n.slice(0,t)),i=n.slice(t,2*t),s=T(r),c=_.multiply(s),l=c.toRawBytes();return{head:r,prefix:i,scalar:s,point:c,pointBytes:l}}function C(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const s=_g(...n);return T(o(f(s,Eg("context",e),!!i)))}const R=$g;_._setWindowSize(8);const x={getExtendedPublicKey:I,randomPrivateKey:()=>s(n.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 I(e).pointBytes},sign:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e=Eg("message",e),i&&(e=i(e));const{prefix:o,scalar:s,pointBytes:c}=I(t),l=C(r.context,o,e),u=_.multiply(l).toRawBytes(),h=k(l+C(r.context,u,c,e)*s);return v(h),Eg("result",_g(u,wg(h,n.BYTES)),2*a)},verify:function(e,t,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:R;const{context:s,zip215:a}=o,c=n.BYTES;e=Eg("signature",e,2*c),t=Eg("message",t),i&&(t=i(t));const l=vg(e.slice(c,2*c));let u,h,d;try{u=E.fromHex(r,a),h=E.fromHex(e.slice(0,c),a),d=_.multiplyUnsafe(l)}catch(p){return!1}if(!a&&u.isSmallOrder())return!1;const f=C(s,h.toRawBytes(),u.toRawBytes(),t);return h.add(u.multiplyUnsafe(f)).subtract(d).clearCofactor().equals(E.ZERO)},ExtendedPoint:E,utils:x}}const Qg=BigInt(0),Xg=BigInt(1);function Jg(e){const t=(kg(n=e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...n}));var n;const{P:r}=t,i=e=>Ng(e,r),o=t.montgomeryBits,s=Math.ceil(o/8),a=t.nByteLength,c=t.adjustScalarBytes||(e=>e),l=t.powPminus2||(e=>Og(e,r-BigInt(2),r));function u(e,t,n){const r=i(e*(t-n));return[t=i(t-r),n=i(n+r)]}function h(e){if("bigint"===typeof e&&Qg<=e&&e<r)return e;throw new Error("Expected valid scalar 0 < scalar < CURVE.P")}const d=(t.a-BigInt(2))/BigInt(4);function f(e){return wg(i(e),s)}function p(e,t){const n=function(e){const t=Eg("u coordinate",e,s);return a===s&&(t[a-1]&=127),vg(t)}(t),r=function(e){const t=Eg("scalar",e);if(t.length!==s&&t.length!==a)throw new Error("Expected ".concat(s," or ").concat(a," bytes, got ").concat(t.length));return vg(c(t))}(e),p=function(e,t){const n=h(e),r=h(t),s=n;let a,c=Xg,f=Qg,p=n,g=Xg,y=Qg;for(let l=BigInt(o-1);l>=Qg;l--){const e=r>>l&Xg;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,n=i(t*t),o=c-f,h=i(o*o),m=n-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(n*h),f=i(m*(n+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)}(n,r);if(p===Qg)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 Zg=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ey=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),ty=(BigInt(0),BigInt(1)),ny=BigInt(2),ry=BigInt(5),iy=BigInt(10),oy=BigInt(20),sy=BigInt(40),ay=BigInt(80);function cy(e){const t=Zg,n=e*e%t*e%t,r=Bg(n,ny,t)*n%t,i=Bg(r,ty,t)*e%t,o=Bg(i,ry,t)*i%t,s=Bg(o,iy,t)*o%t,a=Bg(s,oy,t)*s%t,c=Bg(a,sy,t)*a%t,l=Bg(c,ay,t)*c%t,u=Bg(l,ay,t)*c%t,h=Bg(u,iy,t)*o%t;return{pow_p_5_8:Bg(h,ny,t)*e%t,b2:n}}function ly(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function uy(e,t){const n=Zg,r=Ng(t*t*t,n),i=Ng(r*r*t,n);let o=Ng(e*r*cy(e*i).pow_p_5_8,n);const s=Ng(t*o*o,n),a=o,c=Ng(o*ey,n),l=s===e,u=s===Ng(-e,n),h=s===Ng(-e*ey,n);return l&&(o=a),(u||h)&&(o=c),Ug(o,n)&&(o=Ng(-o,n)),{isValid:l||u,value:o}}const hy=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e<=Tg)throw new Error("Expected Fp ORDER > 0, got ".concat(e));const{nBitLength:i,nByteLength:o}=jg(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Mg(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:Sg(i),ZERO:Tg,ONE:Ig,create:t=>Ng(t,e),isValid:t=>{if("bigint"!==typeof t)throw new Error("Invalid field element: expected bigint, got ".concat(typeof t));return Tg<=t&&t<e},is0:e=>e===Tg,isOdd:e=>(e&Ig)===Ig,neg:t=>Ng(-t,e),eql:(e,t)=>e===t,sqr:t=>Ng(t*t,e),add:(t,n)=>Ng(t+n,e),sub:(t,n)=>Ng(t-n,e),mul:(t,n)=>Ng(t*n,e),pow:(e,t)=>function(e,t,n){if(n<Tg)throw new Error("Expected power > 0");if(n===Tg)return e.ONE;if(n===Ig)return t;let r=e.ONE,i=t;for(;n>Tg;)n&Ig&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Ig;return r}(a,e,t),div:(t,n)=>Ng(t*Lg(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Lg(t,e),sqrt:r.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?wg(e,o):bg(e,o),fromBytes:e=>{if(e.length!==o)throw new Error("Fp.fromBytes: expected ".concat(o,", got ").concat(e.length));return n?vg(e):function(e){return yg(gg(e))}(e)}});return Object.freeze(a)}(Zg,void 0,!0),dy={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:hy,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ug,randomBytes:Bf,adjustScalarBytes:ly,uvRatio:uy};Yg(dy);function fy(e,t,n){if(t.length>255)throw new Error("Context is too big");return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=new Uint8Array(t.reduce(((e,t)=>e+t.length),0));let i=0;return t.forEach((e=>{if(!Cf(e))throw new Error("Uint8Array expected");r.set(e,i),i+=e.length})),r}(Pf("SigEd25519 no Ed25519 collisions"),new Uint8Array([n?1:0,t.length]),t,e)}Yg({...dy,domain:fy}),Yg({...dy,domain:fy,prehash:ug});const py=(()=>Jg({P:Zg,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=Zg,{pow_p_5_8:n,b2:r}=cy(e);return Ng(Bg(n,BigInt(3),t)*r,t)},adjustScalarBytes:ly,randomBytes:Bf}))();const gy=(hy.ORDER+BigInt(3))/BigInt(8);hy.pow(ny,gy),hy.sqrt(hy.neg(hy.ONE)),hy.ORDER,BigInt(5),BigInt(8),BigInt(486662);!function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);e.isOdd(n)&&e.neg(n)}(hy,hy.neg(BigInt(486664)));BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class yy extends Nf{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Tf.hash(e);const n=Df(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 r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);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 Tf.exists(this),this.iHash.update(e),this}digestInto(e){Tf.exists(this),Tf.bytes(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:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const my=(e,t,n)=>new yy(e,t).update(n).digest();function vy(e,t,n){return Tf.hash(e),void 0===n&&(n=new Uint8Array(e.outputLen)),my(e,Df(n),Df(t))}my.create=(e,t)=>new yy(e,t);const by=new Uint8Array([0]),wy=new Uint8Array;function Ey(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32;if(Tf.hash(e),Tf.number(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/e.outputLen);void 0===n&&(n=wy);const o=new Uint8Array(i*e.outputLen),s=my.create(e,t),a=s._cloneInto(),c=new Uint8Array(s.outputLen);for(let l=0;l<i;l++)by[0]=l+1,a.update(0===l?wy:c).update(n).update(by).digestInto(c),o.set(c,e.outputLen*l),s._cloneInto(a);return s.destroy(),a.destroy(),c.fill(0),by.fill(0),o.slice(0,r)}const _y={hashSHA256:e=>Vf(e),getHKDF(e,t){const n=vy(Vf,t,e),r=Ey(Vf,n,void 0,96);return[r.subarray(0,32),r.subarray(32,64),r.subarray(64,96)]},generateX25519KeyPair(){const e=py.utils.randomPrivateKey();return{publicKey:py.getPublicKey(e),privateKey:e}},generateX25519KeyPairFromSeed:e=>({publicKey:py.getPublicKey(e),privateKey:e}),generateX25519SharedKey:(e,t)=>py.getSharedSecret(e,t),chaCha20Poly1305Encrypt:(e,t,n,r)=>Xp(r,t,n).encrypt(e),chaCha20Poly1305Decrypt(e,t,n,r,i){const o=Xp(r,t,n).decrypt(e);return i?(i.set(o),o):o}},Sy=e=>{const t=(n=2,globalThis.Buffer?globalThis.Buffer.allocUnsafe(n):new Uint8Array(n));var n;return new DataView(t.buffer,t.byteOffset,t.byteLength).setUint16(0,e,!1),t};Sy.bytes=2;const Ay=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)};Ay.bytes=2;const ky=16;class Ty extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected Peer"),Xa(this,"code",void 0),this.code=Ty.code}}Xa(Ty,"code","ERR_UNEXPECTED_PEER");class Iy extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto exchange"),Xa(this,"code",void 0),this.code=Iy.code}}Xa(Iy,"code","ERR_INVALID_CRYPTO_EXCHANGE");class Cy extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto transmission"),Xa(this,"code",void 0),this.code=Cy.code}}Xa(Cy,"code","ERR_INVALID_CRYPTO_TRANSMISSION");__webpack_require__(5049),__webpack_require__(9835);var Ry=__webpack_require__(392),xy=__webpack_require__(7420),Py=__webpack_require__.t(xy,2);const Dy=BigInt(0),Ny=BigInt(1),Oy=BigInt(2),By=BigInt(8),Ly=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),My=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:Ly,n:Ly,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),Uy=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),Fy=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),jy=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),zy=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Ky=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),qy=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class Vy{constructor(e,t,n,r){this.x=e,this.y=t,this.z=n,this.t=r}static fromAffine(e){if(!(e instanceof Xy))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(Xy.ZERO)?Vy.ZERO:new Vy(e.x,e.y,Ny,lm(e.x*e.y))}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:My.P;const n=new Array(e.length),r=um(e.reduce(((e,r,i)=>r===Dy?e:(n[i]=e,lm(e*r,t))),Ny),t);return e.reduceRight(((e,r,i)=>r===Dy?e:(n[i]=lm(e*n[i],t),lm(e*r,t))),r),n}(e.map((e=>e.z)));return e.map(((e,n)=>e.toAffine(t[n])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){Wy(e);const{x:t,y:n,z:r}=this,{x:i,y:o,z:s}=e,a=lm(t*s),c=lm(i*r),l=lm(n*s),u=lm(o*r);return a===c&&l===u}negate(){return new Vy(lm(-this.x),this.y,this.z,lm(-this.t))}double(){const{x:e,y:t,z:n}=this,{a:r}=My,i=lm(e*e),o=lm(t*t),s=lm(Oy*lm(n*n)),a=lm(r*i),c=e+t,l=lm(lm(c*c)-i-o),u=a+o,h=u-s,d=a-o,f=lm(l*h),p=lm(u*d),g=lm(l*d),y=lm(h*u);return new Vy(f,p,y,g)}add(e){Wy(e);const{x:t,y:n,z:r,t:i}=this,{x:o,y:s,z:a,t:c}=e,l=lm((n-t)*(s+o)),u=lm((n+t)*(s-o)),h=lm(u-l);if(h===Dy)return this.double();const d=lm(r*Oy*c),f=lm(i*Oy*a),p=f+d,g=u+l,y=f-d,m=lm(p*h),v=lm(g*y),b=lm(p*y),w=lm(h*g);return new Vy(m,v,w,b)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,n=[];let r=this,i=r;for(let o=0;o<t;o++){i=r,n.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(e,t){!t&&this.equals(Vy.BASE)&&(t=Xy.BASE);const n=t&&t._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=t&&Qy.get(t);r||(r=this.precomputeWindow(n),t&&1!==n&&(r=Vy.normalizeZ(r),Qy.set(t,r)));let i=Vy.ZERO,o=Vy.BASE;const s=1+256/n,a=2**(n-1),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let h=0;h<s;h++){const t=h*a;let n=Number(e&c);e>>=u,n>a&&(n-=l,e+=Ny);const s=t,d=t+Math.abs(n)-1,f=h%2!==0,p=n<0;0===n?o=o.add(Hy(f,r[s])):i=i.add(Hy(p,r[d]))}return Vy.normalizeZ([i,o])[0]}multiply(e,t){return this.wNAF(mm(e,My.l),t)}multiplyUnsafe(e){let t=mm(e,My.l,!1);const n=Vy.BASE,r=Vy.ZERO;if(t===Dy)return r;if(this.equals(r)||t===Ny)return this;if(this.equals(n))return this.wNAF(t);let i=r,o=this;for(;t>Dy;)t&Ny&&(i=i.add(o)),o=o.double(),t>>=Ny;return i}isSmallOrder(){return this.multiplyUnsafe(My.h).equals(Vy.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(My.l/Oy).double();return My.l%Oy&&(e=e.add(this)),e.equals(Vy.ZERO)}toAffine(e){const{x:t,y:n,z:r}=this,i=this.equals(Vy.ZERO);null==e&&(e=i?By:um(r));const o=lm(t*e),s=lm(n*e),a=lm(r*e);if(i)return Xy.ZERO;if(a!==Ny)throw new Error("invZ was invalid");return new Xy(o,s)}fromRistrettoBytes(){$y()}toRistrettoBytes(){$y()}fromRistrettoHash(){$y()}}function Hy(e,t){const n=t.negate();return e?n:t}function Wy(e){if(!(e instanceof Vy))throw new TypeError("ExtendedPoint expected")}function Gy(e){if(!(e instanceof Yy))throw new TypeError("RistrettoPoint expected")}function $y(){throw new Error("Legacy method: switch to RistrettoPoint")}Vy.BASE=new Vy(My.Gx,My.Gy,Ny,lm(My.Gx*My.Gy)),Vy.ZERO=new Vy(Dy,Ny,Ny,Dy);class Yy{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=My,n=lm(Fy*e*e),r=lm((n+Ny)*Ky);let i=BigInt(-1);const o=lm((i-t*n)*lm(n+t));let{isValid:s,value:a}=fm(r,o),c=lm(a*e);om(c)||(c=lm(-c)),s||(a=c),s||(i=n);const l=lm(i*(n-Ny)*qy-o),u=a*a,h=lm((a+a)*o),d=lm(l*jy),f=lm(Ny-u),p=lm(Ny+u);return new Vy(lm(h*p),lm(f*d),lm(d*p),lm(h*f))}static hashToCurve(e){const t=cm((e=ym(e,64)).slice(0,32)),n=this.calcElligatorRistrettoMap(t),r=cm(e.slice(32,64)),i=this.calcElligatorRistrettoMap(r);return new Yy(n.add(i))}static fromHex(e){e=ym(e,32);const{a:t,d:n}=My,r="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=cm(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(im(i),e)||om(i))throw new Error(r);const o=lm(i*i),s=lm(Ny+t*o),a=lm(Ny-t*o),c=lm(s*s),l=lm(a*a),u=lm(t*n*c-l),{isValid:h,value:d}=pm(lm(u*l)),f=lm(d*a),p=lm(d*f*u);let g=lm((i+i)*f);om(g)&&(g=lm(-g));const y=lm(s*p),m=lm(g*y);if(!h||om(m)||y===Dy)throw new Error(r);return new Yy(new Vy(g,y,Ny,m))}toRawBytes(){let{x:e,y:t,z:n,t:r}=this.ep;const i=lm(lm(n+t)*lm(n-t)),o=lm(e*t),s=lm(o*o),{value:a}=pm(lm(i*s)),c=lm(a*i),l=lm(a*o),u=lm(c*l*r);let h;if(om(r*u)){let n=lm(t*Fy),r=lm(e*Fy);e=n,t=r,h=lm(c*zy)}else h=l;om(e*u)&&(t=lm(-t));let d=lm((n-t)*h);return om(d)&&(d=lm(-d)),im(d)}toHex(){return tm(this.toRawBytes())}toString(){return this.toHex()}equals(e){Gy(e);const t=this.ep,n=e.ep,r=lm(t.x*n.y)===lm(t.y*n.x),i=lm(t.y*n.y)===lm(t.x*n.x);return r||i}add(e){return Gy(e),new Yy(this.ep.add(e.ep))}subtract(e){return Gy(e),new Yy(this.ep.subtract(e.ep))}multiply(e){return new Yy(this.ep.multiply(e))}multiplyUnsafe(e){return new Yy(this.ep.multiplyUnsafe(e))}}Yy.BASE=new Yy(Vy.BASE),Yy.ZERO=new Yy(Vy.ZERO);const Qy=new WeakMap;class Xy{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,Qy.delete(this)}static fromHex(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{d:n,P:r}=My,i=(e=ym(e,32)).slice();i[31]=-129&e[31];const o=sm(i);if(t&&o>=r)throw new Error("Expected 0 < hex < P");if(!t&&o>=Uy)throw new Error("Expected 0 < hex < 2**256");const s=lm(o*o),a=lm(s-Ny),c=lm(n*s+Ny);let{isValid:l,value:u}=fm(a,c);if(!l)throw new Error("Point.fromHex: invalid y coordinate");const h=(u&Ny)===Ny;return 0!==(128&e[31])!==h&&(u=lm(-u)),new Xy(u,o)}static async fromPrivateKey(e){return(await _m(e)).point}toRawBytes(){const e=im(this.y);return e[31]|=this.x&Ny?128:0,e}toHex(){return tm(this.toRawBytes())}toX25519(){const{y:e}=this;return im(lm((Ny+e)*um(Ny-e)))}isTorsionFree(){return Vy.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new Xy(lm(-this.x),this.y)}add(e){return Vy.fromAffine(this).add(Vy.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Vy.fromAffine(this).multiply(e,this).toAffine()}}Xy.BASE=new Xy(My.Gx,My.Gy),Xy.ZERO=new Xy(Dy,Ny);class Jy{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=ym(e,64),n=Xy.fromHex(t.slice(0,32),!1),r=sm(t.slice(32,64));return new Jy(n,r)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof Xy))throw new Error("Expected Point instance");return mm(t,My.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(im(this.s),32),e}toHex(){return tm(this.toRawBytes())}}function Zy(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const r=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(r);for(let o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}const em=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function tm(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=em[e[n]];return t}function nm(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 n=0;n<t.length;n++){const r=2*n,i=e.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[n]=o}return t}function rm(e){return nm(e.toString(16).padStart(64,"0"))}function im(e){return rm(e).reverse()}function om(e){return(lm(e)&Ny)===Ny}function sm(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+tm(Uint8Array.from(e).reverse()))}const am=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function cm(e){return lm(sm(e)&am)}function lm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:My.P;const n=e%t;return n>=Dy?n:t+n}function um(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:My.P;if(e===Dy||t<=Dy)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let n=lm(e,t),r=t,i=Dy,o=Ny,s=Ny,a=Dy;for(;n!==Dy;){const e=r/n,t=r%n,c=i-s*e,l=o-a*e;r=n,n=t,i=s,o=a,s=c,a=l}if(r!==Ny)throw new Error("invert: does not exist");return lm(i,t)}function hm(e,t){const{P:n}=My;let r=e;for(;t-- >Dy;)r*=r,r%=n;return r}function dm(e){const{P:t}=My,n=BigInt(5),r=BigInt(10),i=BigInt(20),o=BigInt(40),s=BigInt(80),a=e*e%t*e%t,c=hm(a,Oy)*a%t,l=hm(c,Ny)*e%t,u=hm(l,n)*l%t,h=hm(u,r)*u%t,d=hm(h,i)*h%t,f=hm(d,o)*d%t,p=hm(f,s)*f%t,g=hm(p,s)*f%t,y=hm(g,r)*u%t;return{pow_p_5_8:hm(y,Oy)*e%t,b2:a}}function fm(e,t){const n=lm(t*t*t),r=lm(n*n*t);let i=lm(e*n*dm(e*r).pow_p_5_8);const o=lm(t*i*i),s=i,a=lm(i*Fy),c=o===e,l=o===lm(-e),u=o===lm(-e*Fy);return c&&(i=s),(l||u)&&(i=a),om(i)&&(i=lm(-i)),{isValid:c||l,value:i}}function pm(e){return fm(Ny,e)}function gm(e){return lm(sm(e),My.l)}function ym(e,t){const n=e instanceof Uint8Array?Uint8Array.from(e):nm(e);if("number"===typeof t&&n.length!==t)throw new Error("Expected ".concat(t," bytes"));return n}function mm(e,t){let n=!(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(n){if(Dy<e)return e}else if(Dy<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function vm(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function bm(e){if(32!==(e="bigint"===typeof e||"number"===typeof e?rm(mm(e,Uy)):ym(e)).length)throw new Error("Expected 32 bytes");return e}function wm(e){const t=vm(e.slice(0,32)),n=e.slice(32,64),r=gm(t),i=Xy.BASE.multiply(r),o=i.toRawBytes();return{head:t,prefix:n,scalar:r,point:i,pointBytes:o}}let Em;async function _m(e){return wm(await Im.sha512(bm(e)))}async function Sm(e){return(await _m(e)).pointBytes}function Am(e,t,n){t=ym(t),n instanceof Xy||(n=Xy.fromHex(n,!1));const{r:r,s:i}=e instanceof Jy?e.assertValidity():Jy.fromHex(e);return{r:r,s:i,SB:Vy.BASE.multiplyUnsafe(i),pub:n,msg:t}}function km(e,t,n,r){const i=gm(r),o=Vy.fromAffine(e).multiplyUnsafe(i);return Vy.fromAffine(t).add(o).subtract(n).multiplyUnsafe(My.h).equals(Vy.ZERO)}Xy.BASE._setWindowSize(8);const Tm={node:Py,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},Im={bytesToHex:tm,hexToBytes:nm,concatBytes:Zy,getExtendedPublicKey:_m,mod:lm,invert:um,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:e=>{if((e=ym(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return lm(sm(e),My.l-Ny)+Ny},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Tm.web)return Tm.web.getRandomValues(new Uint8Array(e));if(Tm.node){const{randomBytes:t}=Tm.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Im.randomBytes(32),sha512:async function(){const e=Zy(...arguments);if(Tm.web){const t=await Tm.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(Tm.node)return Uint8Array.from(Tm.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]:Xy.BASE;const n=t.equals(Xy.BASE)?t:new Xy(t.x,t.y);return n._setWindowSize(e),n.multiply(Oy),n},sha512Sync:void 0};Object.defineProperties(Im,{sha512Sync:{configurable:!1,get:()=>Em,set(e){Em||(Em=e)}}});const Cm=32,Rm=64,xm=32;async function Pm(e,t){return async function(e,t){e=ym(e);const{prefix:n,scalar:r,pointBytes:i}=await _m(t),o=gm(await Im.sha512(n,e)),s=Xy.BASE.multiply(o),a=lm(o+gm(await Im.sha512(s.toRawBytes(),i,e))*r,My.l);return new Jy(s,a).toRawBytes()}(t,e.subarray(0,xm))}async function Dm(e,t,n){return async function(e,t,n){const{r:r,SB:i,msg:o,pub:s}=Am(e,t,n),a=await Im.sha512(r.toRawBytes(),s.toRawBytes(),o);return km(s,r,i,a)}(t,n,e)}function Nm(e,t){const n=new Uint8Array(Rm);for(let r=0;r<xm;r++)n[r]=e[r],n[xm+r]=t[r];return n}const Om={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}},Bm={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Lm(e){var t,n,r,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!==(n=null===e||void 0===e?void 0:e.keyLength)&&void 0!==n?n:16;const l=null!==(r=null===e||void 0===e?void 0:e.nonceLength)&&void 0!==r?r: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=Om.get();c*=8;return{encrypt:async function(e,t){const n=f.getRandomValues(new Uint8Array(h)),r=f.getRandomValues(new Uint8Array(l)),i={name:a,iv:r};let o;if("string"===typeof t&&(t=ru(t)),0===t.length){o=await f.subtle.importKey("jwk",Bm,{name:"AES-GCM"},!0,["encrypt"]);try{const e={name:"PBKDF2",salt:n,iterations:d,hash:{name:u}},r=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);o=await f.subtle.deriveKey(e,r,{name:a,length:c},!0,["encrypt"])}catch{o=await f.subtle.importKey("jwk",Bm,{name:"AES-GCM"},!0,["encrypt"])}}else{const e={name:"PBKDF2",salt:n,iterations:d,hash:{name:u}},r=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);o=await f.subtle.deriveKey(e,r,{name:a,length:c},!0,["encrypt"])}const s=await f.subtle.encrypt(i,o,e);return Zl([n,i.iv,new Uint8Array(s)])},decrypt:async function(e,t){const n=e.subarray(0,h),r=e.subarray(h,h+l),i=e.subarray(h+l),o={name:a,iv:r};let s;if("string"===typeof t&&(t=ru(t)),0===t.length)try{const e={name:"PBKDF2",salt:n,iterations:d,hash:{name:u}},r=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);s=await f.subtle.deriveKey(e,r,{name:a,length:c},!0,["decrypt"])}catch{s=await f.subtle.importKey("jwk",Bm,{name:"AES-GCM"},!0,["decrypt"])}else{const e={name:"PBKDF2",salt:n,iterations:d,hash:{name:u}},r=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);s=await f.subtle.deriveKey(e,r,{name:a,length:c},!0,["decrypt"])}const p=await f.subtle.decrypt(o,s,i);return new Uint8Array(p)}}}async function Mm(e,t){const n=Lm(),r=await n.encrypt(e,t);return vl.encode(r)}var Um=__webpack_require__(3415),Fm=__webpack_require__(3419),jm=__webpack_require__(6405),zm=__webpack_require__(2634),Km=__webpack_require__(7517);jm._configure(),Um._configure(Fm),zm._configure(Km);const qm=["uint64","int64","sint64","fixed64","sfixed64"];function Vm(e){return function(e){for(const t of qm){if(null==e[t])continue;const n=e[t];e[t]=function(){return BigInt(n.call(this).toString())}}return e}(new Um(e))}function Hm(){return function(e){for(const t of qm){if(null==e[t])continue;const n=e[t];e[t]=function(e){return n.call(this,e.toString())}}return e}(zm.create())}function Wm(e,t){const n=Vm(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}function Gm(e,t){const n=Hm();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}var $m,Ym,Qm,Xm,Jm;function Zm(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}function ev(e,t){return Zm("message",$m.LENGTH_DELIMITED,e,t)}!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"}($m||($m={})),function(e){e.RSA="RSA",e.Ed25519="Ed25519",e.Secp256k1="Secp256k1"}(Ym||(Ym={})),function(e){e[e.RSA=0]="RSA",e[e.Ed25519=1]="Ed25519",e[e.Secp256k1=2]="Secp256k1"}(Qm||(Qm={})),function(e){e.codec=()=>function(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return Zm("enum",$m.VARINT,(function(e,n){const r=t(e);n.int32(r)}),(function(e){return t(e.int32())}))}(Qm)}(Ym||(Ym={})),function(e){let t;e.codec=()=>(null==t&&(t=ev((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),Ym.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.Type=Ym.codec().decode(e);break;case 2:n.Data=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>Gm(t,e.codec()),e.decode=t=>Wm(t,e.codec())}(Xm||(Xm={})),function(e){let t;e.codec=()=>(null==t&&(t=ev((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),Ym.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.Type=Ym.codec().decode(e);break;case 2:n.Data=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>Gm(t,e.codec()),e.decode=t=>Wm(t,e.codec())}(Jm||(Jm={}));class tv{constructor(e){Xa(this,"_key",void 0),this._key=av(e,Cm)}async verify(e,t){return Dm(this._key,t,e)}marshal(){return this._key}get bytes(){return Xm.encode({Type:Ym.Ed25519,Data:this.marshal()}).subarray()}equals(e){return ll(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Rl.digest(this.bytes);return e}}class nv{constructor(e,t){Xa(this,"_key",void 0),Xa(this,"_publicKey",void 0),this._key=av(e,Rm),this._publicKey=av(t,Cm)}async sign(e){return Pm(this._key,e)}get public(){return new tv(this._publicKey)}marshal(){return this._key}get bytes(){return Jm.encode({Type:Ym.Ed25519,Data:this.marshal()}).subarray()}equals(e){return ll(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Rl.digest(this.bytes);return e}async id(){const e=Dl.digest(this.public.bytes);return vc.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 Mm(this.bytes,e);throw new sc("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}function rv(e){if(e.length>Rm){const t=(e=av(e,Rm+Cm)).subarray(0,Rm),n=e.subarray(Rm,e.length);return new nv(t,n)}const t=(e=av(e,Rm)).subarray(0,Rm),n=e.subarray(Cm);return new nv(t,n)}function iv(e){return e=av(e,Cm),new tv(e)}async function ov(){const{privateKey:e,publicKey:t}=await async function(){const e=Im.randomPrivateKey(),t=await Sm(e);return{privateKey:Nm(e,t),publicKey:t}}();return new nv(e,t)}async function sv(e){const{privateKey:t,publicKey:n}=await async function(e){if(e.length!==xm)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,n=await Sm(t);return{privateKey:Nm(t,n),publicKey:n}}(e);return new nv(t,n)}function av(e,t){var n;if((e=Uint8Array.from(null!==(n=e)&&void 0!==n?n:[])).length!==t)throw new sc("Key must be a Uint8Array of length ".concat(t,", got ").concat(e.length),"ERR_INVALID_KEY_TYPE");return e}var cv=__webpack_require__(3877);__webpack_require__(3055);function lv(e,t){let n=Uint8Array.from(e.abs().toByteArray());if(n=0===n[0]?n.subarray(1):n,null!=t){if(n.length>t)throw new Error("byte array longer than desired length");n=Zl([new Uint8Array(t-n.length),n])}return Xl(n,"base64url")}function uv(e){const t=function(e,t){let n=ru(e,"base64urlpad");if(null!=t){if(n.length>t)throw new Error("byte array longer than desired length");n=Zl([new Uint8Array(t-n.length),n])}return n}(e);return new Ry.jsbn.BigInteger(Xl(t,"base16"),16)}const hv={"P-256":256,"P-384":384,"P-521":521};Object.keys(hv).join(" / ");__webpack_require__(4770);var dv=__webpack_require__(5856),fv=__webpack_require__.t(dv,2);const pv=BigInt(0),gv=BigInt(1),yv=BigInt(2),mv=BigInt(3),vv=BigInt(8),bv=Object.freeze({a:pv,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:gv,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),wv=(e,t)=>(e+t/yv)/t,Ev={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(e){const{n:t}=bv,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-gv*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=wv(o*e,t),c=wv(-r*e,t);let l=Qv(e-a*n-c*i,t),u=Qv(-a*r-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}}},_v=32,Sv=32,Av=32,kv=_v+1,Tv=2*_v+1;function Iv(e){const{a:t,b:n}=bv,r=Qv(e*e),i=Qv(r*e);return Qv(i+t*e+n)}const Cv=bv.a===pv;class Rv extends Error{constructor(e){super(e)}}function xv(e){if(!(e instanceof Pv))throw new TypeError("JacobianPoint expected")}class Pv{constructor(e,t,n){this.x=e,this.y=t,this.z=n}static fromAffine(e){if(!(e instanceof Ov))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(Ov.ZERO)?Pv.ZERO:new Pv(e.x,e.y,gv)}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bv.P;const n=new Array(e.length),r=Jv(e.reduce(((e,r,i)=>r===pv?e:(n[i]=e,Qv(e*r,t))),gv),t);return e.reduceRight(((e,r,i)=>r===pv?e:(n[i]=Qv(e*n[i],t),Qv(e*r,t))),r),n}(e.map((e=>e.z)));return e.map(((e,n)=>e.toAffine(t[n])))}static normalizeZ(e){return Pv.toAffineBatch(e).map(Pv.fromAffine)}equals(e){xv(e);const{x:t,y:n,z:r}=this,{x:i,y:o,z:s}=e,a=Qv(r*r),c=Qv(s*s),l=Qv(t*c),u=Qv(i*a),h=Qv(Qv(n*s)*c),d=Qv(Qv(o*r)*a);return l===u&&h===d}negate(){return new Pv(this.x,Qv(-this.y),this.z)}double(){const{x:e,y:t,z:n}=this,r=Qv(e*e),i=Qv(t*t),o=Qv(i*i),s=e+i,a=Qv(yv*(Qv(s*s)-r-o)),c=Qv(mv*r),l=Qv(c*c),u=Qv(l-yv*a),h=Qv(c*(a-u)-vv*o),d=Qv(yv*t*n);return new Pv(u,h,d)}add(e){xv(e);const{x:t,y:n,z:r}=this,{x:i,y:o,z:s}=e;if(i===pv||o===pv)return this;if(t===pv||n===pv)return e;const a=Qv(r*r),c=Qv(s*s),l=Qv(t*c),u=Qv(i*a),h=Qv(Qv(n*s)*c),d=Qv(Qv(o*r)*a),f=Qv(u-l),p=Qv(d-h);if(f===pv)return p===pv?this.double():Pv.ZERO;const g=Qv(f*f),y=Qv(f*g),m=Qv(l*g),v=Qv(p*p-y-yv*m),b=Qv(p*(m-v)-h*y),w=Qv(r*s*f);return new Pv(v,b,w)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=Pv.ZERO;if("bigint"===typeof e&&e===pv)return t;let n=Yv(e);if(n===gv)return this;if(!Cv){let e=t,r=this;for(;n>pv;)n&gv&&(e=e.add(r)),r=r.double(),n>>=gv;return e}let{k1neg:r,k1:i,k2neg:o,k2:s}=Ev.splitScalar(n),a=t,c=t,l=this;for(;i>pv||s>pv;)i&gv&&(a=a.add(l)),s&gv&&(c=c.add(l)),l=l.double(),i>>=gv,s>>=gv;return r&&(a=a.negate()),o&&(c=c.negate()),c=new Pv(Qv(c.x*Ev.beta),c.y,c.z),a.add(c)}precomputeWindow(e){const t=Cv?128/e+1:256/e+1,n=[];let r=this,i=r;for(let o=0;o<t;o++){i=r,n.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(r),n.push(i);r=i.double()}return n}wNAF(e,t){!t&&this.equals(Pv.BASE)&&(t=Ov.BASE);const n=t&&t._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let r=t&&Nv.get(t);r||(r=this.precomputeWindow(n),t&&1!==n&&(r=Pv.normalizeZ(r),Nv.set(t,r)));let i=Pv.ZERO,o=Pv.BASE;const s=1+(Cv?128/n:256/n),a=2**(n-1),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let h=0;h<s;h++){const t=h*a;let n=Number(e&c);e>>=u,n>a&&(n-=l,e+=gv);const s=t,d=t+Math.abs(n)-1,f=h%2!==0,p=n<0;0===n?o=o.add(Dv(f,r[s])):i=i.add(Dv(p,r[d]))}return{p:i,f:o}}multiply(e,t){let n,r,i=Yv(e);if(Cv){const{k1neg:e,k1:o,k2neg:s,k2:a}=Ev.splitScalar(i);let{p:c,f:l}=this.wNAF(o,t),{p:u,f:h}=this.wNAF(a,t);c=Dv(e,c),u=Dv(s,u),u=new Pv(Qv(u.x*Ev.beta),u.y,u.z),n=c.add(u),r=l.add(h)}else{const{p:e,f:o}=this.wNAF(i,t);n=e,r=o}return Pv.normalizeZ([n,r])[0]}toAffine(e){const{x:t,y:n,z:r}=this,i=this.equals(Pv.ZERO);null==e&&(e=i?vv:Jv(r));const o=e,s=Qv(o*o),a=Qv(s*o),c=Qv(t*s),l=Qv(n*a),u=Qv(r*o);if(i)return Ov.ZERO;if(u!==gv)throw new Error("invZ was invalid");return new Ov(c,l)}}function Dv(e,t){const n=t.negate();return e?n:t}Pv.BASE=new Pv(bv.Gx,bv.Gy,gv),Pv.ZERO=new Pv(pv,gv,pv);const Nv=new WeakMap;class Ov{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,Nv.delete(this)}hasEvenY(){return this.y%yv===pv}static fromCompressedHex(e){const t=32===e.length,n=Gv(t?e:e.subarray(1));if(!ib(n))throw new Error("Point is not on curve");let r=function(e){const{P:t}=bv,n=BigInt(6),r=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=Xv(l,mv)*l%t,h=Xv(u,mv)*l%t,d=Xv(h,yv)*c%t,f=Xv(d,r)*d%t,p=Xv(f,i)*f%t,g=Xv(p,s)*p%t,y=Xv(g,a)*g%t,m=Xv(y,s)*p%t,v=Xv(m,mv)*l%t,b=Xv(v,o)*f%t,w=Xv(b,n)*c%t,E=Xv(w,yv);if(E*E%t!==e)throw new Error("Cannot find square root");return E}(Iv(n));const i=(r&gv)===gv;if(t)i&&(r=Qv(-r));else{1===(1&e[0])!==i&&(r=Qv(-r))}const o=new Ov(n,r);return o.assertValidity(),o}static fromUncompressedHex(e){const t=Gv(e.subarray(1,_v+1)),n=Gv(e.subarray(_v+1,2*_v+1)),r=new Ov(t,n);return r.assertValidity(),r}static fromHex(e){const t=$v(e),n=t.length,r=t[0];if(n===_v)return this.fromCompressedHex(t);if(n===kv&&(2===r||3===r))return this.fromCompressedHex(t);if(n===Tv&&4===r)return this.fromUncompressedHex(t);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(kv," compressed bytes or ").concat(Tv," uncompressed bytes, not ").concat(n))}static fromPrivateKey(e){return Ov.BASE.multiply(sb(e))}static fromSignature(e,t,n){const{r:r,s:i}=cb(t);if(![0,1,2,3].includes(n))throw new Error("Cannot recover: invalid recovery bit");const o=Zv($v(e)),{n:s}=bv,a=2===n||3===n?r+s:r,c=Jv(a,s),l=Qv(-o*c,s),u=Qv(i*c,s),h=1&n?"03":"02",d=Ov.fromHex(h+Kv(a)),f=Ov.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 Wv(this.toHex(e))}toHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=Kv(this.x);if(e){const e=this.hasEvenY()?"02":"03";return"".concat(e).concat(t)}return"04".concat(t).concat(Kv(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:n}=this;if(!ib(t)||!ib(n))throw new Error(e);const r=Qv(n*n);if(Qv(r-Iv(t))!==pv)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new Ov(this.x,Qv(-this.y))}double(){return Pv.fromAffine(this).double().toAffine()}add(e){return Pv.fromAffine(this).add(Pv.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Pv.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,n){const r=Pv.fromAffine(this),i=t===pv||t===gv||this!==Ov.BASE?r.multiplyUnsafe(t):r.multiply(t),o=Pv.fromAffine(e).multiplyUnsafe(n),s=i.add(o);return s.equals(Pv.ZERO)?void 0:s.toAffine()}}function Bv(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function Lv(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(jv(e)));const t=e[1],n=e.subarray(2,t+2);if(!t||n.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Gv(n),left:e.subarray(t+2)}}Ov.BASE=new Ov(bv.Gx,bv.Gy),Ov.ZERO=new Ov(pv,pv);class Mv{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=e instanceof Uint8Array,n="Signature.fromCompact";if("string"!==typeof e&&!t)throw new TypeError("".concat(n,": Expected string or Uint8Array"));const r=t?jv(e):e;if(128!==r.length)throw new Error("".concat(n,": Expected 64-byte hex"));return new Mv(Hv(r.slice(0,64)),Hv(r.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:n,s:r}=function(e){if(e.length<2||48!=e[0])throw new Error("Invalid signature tag: ".concat(jv(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:n}=Lv(e.subarray(2)),{data:r,left:i}=Lv(n);if(i.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(jv(i)));return{r:t,s:r}}(t?e:Wv(e));return new Mv(n,r)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!rb(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!rb(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=bv.n>>gv;return this.s>e}normalizeS(){return this.hasHighS()?new Mv(this.r,Qv(-this.s,bv.n)):this}toDERRawBytes(){return Wv(this.toDERHex())}toDERHex(){const e=Bv(Vv(this.s)),t=Bv(Vv(this.r)),n=e.length/2,r=t.length/2,i=Vv(n),o=Vv(r),s=Vv(r+n+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 Wv(this.toCompactHex())}toCompactHex(){return Kv(this.r)+Kv(this.s)}}function Uv(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const r=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(r);for(let o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}const Fv=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function jv(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let n=0;n<e.length;n++)t+=Fv[e[n]];return t}const zv=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function Kv(e){if("bigint"!==typeof e)throw new Error("Expected bigint");if(!(pv<=e&&e<zv))throw new Error("Expected number 0 <= n < 2^256");return e.toString(16).padStart(64,"0")}function qv(e){const t=Wv(Kv(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function Vv(e){const t=e.toString(16);return 1&t.length?"0".concat(t):t}function Hv(e){if("string"!==typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt("0x".concat(e))}function Wv(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 n=0;n<t.length;n++){const r=2*n,i=e.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[n]=o}return t}function Gv(e){return Hv(jv(e))}function $v(e){return e instanceof Uint8Array?Uint8Array.from(e):Wv(e)}function Yv(e){if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"===typeof e&&rb(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Qv(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bv.P;const n=e%t;return n>=pv?n:t+n}function Xv(e,t){const{P:n}=bv;let r=e;for(;t-- >pv;)r*=r,r%=n;return r}function Jv(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bv.P;if(e===pv||t<=pv)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let n=Qv(e,t),r=t,i=pv,o=gv,s=gv,a=pv;for(;n!==pv;){const e=r/n,t=r%n,c=i-s*e,l=o-a*e;r=n,n=t,i=s,o=a,s=c,a=l}if(r!==gv)throw new Error("invert: does not exist");return Qv(i,t)}function Zv(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=function(e){const t=8*e.length-8*Sv,n=Gv(e);return t>0?n>>BigInt(t):n}(e);if(t)return n;const{n:r}=bv;return n>=r?n-r:n}let eb,tb;class nb{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),n=0;n<e;n++)t[n]=arguments[n];return wb.hmacSha256(this.k,...t)}hmacSync(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return tb(this.k,...t)}checkSync(){if("function"!==typeof tb)throw new Rv("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 n=this.v.slice();t.push(n),e+=this.v.length}return Uv(...t)}generateSync(){this.checkSync(),this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=this.hmacSync(this.v);const n=this.v.slice();t.push(n),e+=this.v.length}return Uv(...t)}}function rb(e){return pv<e&&e<bv.n}function ib(e){return pv<e&&e<bv.P}function ob(e,t,n){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const{n:i}=bv,o=Zv(e,!0);if(!rb(o))return;const s=Jv(o,i),a=Ov.BASE.multiply(o),c=Qv(a.x,i);if(c===pv)return;const l=Qv(s*Qv(t+n*c,i),i);if(l===pv)return;let u=new Mv(c,l),h=(a.x===u.r?0:2)|Number(a.y&gv);return r&&u.hasHighS()&&(u=u.normalizeS(),h^=1),{sig:u,recovery:h}}function sb(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*Sv)throw new Error("Expected 32 bytes of private key");t=Hv(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(e.length!==Sv)throw new Error("Expected 32 bytes of private key");t=Gv(e)}if(!rb(t))throw new Error("Expected private key: 0 < key < n");return t}function ab(e){return e instanceof Ov?(e.assertValidity(),e):Ov.fromHex(e)}function cb(e){if(e instanceof Mv)return e.assertValidity(),e;try{return Mv.fromDER(e)}catch(t){return Mv.fromCompact(e)}}function lb(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Ov.fromPrivateKey(e).toRawBytes(t)}function ub(e){return Gv(e.length>_v?e.slice(0,_v):e)}function hb(e){const t=ub(e),n=Qv(t,bv.n);return db(n<pv?t:n)}function db(e){return qv(e)}function fb(e,t,n){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));const r=$v(e),i=sb(t),o=[db(i),hb(r)];if(null!=n){!0===n&&(n=wb.randomBytes(_v));const e=$v(n);if(e.length!==_v)throw new Error("sign: Expected ".concat(_v," bytes of extra data"));o.push(e)}return{seed:Uv(...o),m:ub(r),d:i}}function pb(e,t){const{sig:n,recovery:r}=e,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},t),s=i?n.toDERRawBytes():n.toCompactRawBytes();return o?[s,r]:s}async function gb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:r,m:i,d:o}=fb(e,t,n.extraEntropy),s=new nb(Av,Sv);let a;for(await s.reseed(r);!(a=ob(await s.generate(),i,o,n.canonical));)await s.reseed();return pb(a,n)}const yb={strict:!0};function mb(e,t,n){let r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:yb;try{r=cb(e),t=$v(t)}catch(p){return!1}const{r:o,s:s}=r;if(i.strict&&r.hasHighS())return!1;const a=Zv(t);let c;try{c=ab(n)}catch(p){return!1}const{n:l}=bv,u=Jv(s,l),h=Qv(a*u,l),d=Qv(o*u,l),f=Ov.BASE.multiplyAndAddUnsafe(c,h,d);if(!f)return!1;return Qv(f.x,l)===o}Ov.BASE._setWindowSize(8);const vb={node:fv,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},bb={},wb={bytesToHex:jv,hexToBytes:Wv,concatBytes:Uv,mod:Qv,invert:Jv,isValidPrivateKey(e){try{return sb(e),!0}catch(t){return!1}},_bigintTo32Bytes:qv,_normalizePrivateKey:sb,hashToPrivateKey:e=>{e=$v(e);const t=Sv+8;if(e.length<t||e.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return qv(Qv(Gv(e),bv.n-gv)+gv)},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(vb.web)return vb.web.getRandomValues(new Uint8Array(e));if(vb.node){const{randomBytes:t}=vb.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>wb.hashToPrivateKey(wb.randomBytes(Sv+8)),precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ov.BASE;const n=t===Ov.BASE?t:new Ov(t.x,t.y);return n._setWindowSize(e),n.multiply(mv),n},sha256:async function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(vb.web){const e=await vb.web.subtle.digest("SHA-256",Uv(...t));return new Uint8Array(e)}if(vb.node){const{createHash:e}=vb.node,n=e("sha256");return t.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(vb.web){const t=await vb.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=Uv(...n),i=await vb.web.subtle.sign("HMAC",t,r);return new Uint8Array(i)}if(vb.node){const{createHmac:t}=vb.node,r=t("sha256",e);return n.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async function(e){let t=bb[e];if(void 0===t){const n=await wb.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=Uv(n,n),bb[e]=t}for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return wb.sha256(t,...r)},taggedHashSync:function(e){if("function"!==typeof eb)throw new Rv("sha256Sync is undefined, you need to set it");let t=bb[e];if(void 0===t){const n=eb(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=Uv(n,n),bb[e]=t}for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return eb(t,...r)},_JacobianPoint:Pv};function Eb(e){if(isNaN(e)||e<=0)throw new sc("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return wb.randomBytes(e)}Object.defineProperties(wb,{sha256Sync:{configurable:!1,get:()=>eb,set(e){eb||(eb=e)}},hmacSha256Sync:{configurable:!1,get:()=>tb,set(e){tb||(tb=e)}}});__webpack_require__(5493);function _b(e,t){return t.map((t=>uv(e[t])))}async function Sb(e){const t=[await Om.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await kb(e)],n=await Ab({privateKey:t[0],publicKey:t[1]});return{privateKey:n[0],publicKey:n[1]}}async function Ab(e){if(null==e.privateKey||null==e.publicKey)throw new sc("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([Om.get().subtle.exportKey("jwk",e.privateKey),Om.get().subtle.exportKey("jwk",e.publicKey)])}async function kb(e){return Om.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 Tb(e,t,n,r){const i=t?function(e){return Ry.pki.setRsaPublicKey(..._b(e,["n","e"]))}(e):function(e){return Ry.pki.setRsaPrivateKey(..._b(e,["n","e","d","p","q","dp","dq","qi"]))}(e);return ru(r(Xl(Uint8Array.from(n),"ascii"),i),"ascii")}class Ib{constructor(e){Xa(this,"_key",void 0),this._key=e}async verify(e,t){return async function(e,t,n){const r=await Om.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Om.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},r,t,n)}(this._key,t,e)}marshal(){return function(e){if(null==e.n||null==e.e)throw new sc("JWK was missing components","ERR_INVALID_PARAMETERS");const t=Ry.pki.publicKeyToAsn1({n:uv(e.n),e:uv(e.e)});return ru(Ry.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return Xm.encode({Type:Ym.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Tb(this._key,!0,e,((e,t)=>t.encrypt(e)))}equals(e){return ll(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Rl.digest(this.bytes);return e}}class Cb{constructor(e,t){Xa(this,"_key",void 0),Xa(this,"_publicKey",void 0),this._key=e,this._publicKey=t}genSecret(){return Eb(16)}async sign(e){return async function(e,t){const n=await Om.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),r=await Om.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},n,Uint8Array.from(t));return new Uint8Array(r,0,r.byteLength)}(this._key,e)}get public(){if(null==this._publicKey)throw new sc("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new Ib(this._publicKey)}decrypt(e){return Tb(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 sc("JWK was missing components","ERR_INVALID_PARAMETERS");const t=Ry.pki.privateKeyToAsn1({n:uv(e.n),e:uv(e.e),d:uv(e.d),p:uv(e.p),q:uv(e.q),dP:uv(e.dp),dQ:uv(e.dq),qInv:uv(e.qi)});return ru(Ry.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return Jm.encode({Type:Ym.RSA,Data:this.marshal()}).subarray()}equals(e){return ll(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Rl.digest(this.bytes);return e}async id(){return Xl(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 Ry.util.ByteBuffer(this.marshal()),n=Ry.asn1.fromDer(t),r=Ry.pki.privateKeyFromAsn1(n),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return Ry.pki.encryptRsaPrivateKey(r,e,i)}if("libp2p-key"===t)return Mm(this.bytes,e);throw new sc("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}async function Rb(e){const t=function(e){const t=Ry.asn1.fromDer(Xl(e,"ascii")),n=Ry.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:lv(n.n),e:lv(n.e),d:lv(n.d),p:lv(n.p),q:lv(n.q),dp:lv(n.dP),dq:lv(n.dQ),qi:lv(n.qInv),alg:"RS256"}}(e),n=await Sb(t);return new Cb(n.privateKey,n.publicKey)}function xb(e){const t=function(e){const t=Ry.asn1.fromDer(Xl(e,"ascii")),n=Ry.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:lv(n.n),e:lv(n.e)}}(e);return new Ib(t)}async function Pb(e){const t=await Sb(e);return new Cb(t.privateKey,t.publicKey)}async function Db(e){const t=await async function(e){const t=await Om.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),n=await Ab(t);return{privateKey:n[0],publicKey:n[1]}}(e);return new Cb(t.privateKey,t.publicKey)}function Nb(e){try{Ov.fromHex(e)}catch(t){throw new sc(String(t),"ERR_INVALID_PUBLIC_KEY")}}class Ob{constructor(e){Xa(this,"_key",void 0),Nb(e),this._key=e}async verify(e,t){return async function(e,t,n){try{const{digest:r}=await Rl.digest(n);return mb(t,r,e)}catch(r){throw new sc(String(r),"ERR_INVALID_INPUT")}}(this._key,t,e)}marshal(){return e=this._key,Ov.fromHex(e).toRawBytes(!0);var e}get bytes(){return Xm.encode({Type:Ym.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return ll(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Rl.digest(this.bytes);return e}}class Bb{constructor(e,t){Xa(this,"_key",void 0),Xa(this,"_publicKey",void 0),this._key=e,this._publicKey=null!==t&&void 0!==t?t:function(e){try{return lb(e,!0)}catch(t){throw new sc(String(t),"ERR_INVALID_PRIVATE_KEY")}}(e),function(e){try{lb(e,!0)}catch(t){throw new sc(String(t),"ERR_INVALID_PRIVATE_KEY")}}(this._key),Nb(this._publicKey)}async sign(e){return async function(e,t){const{digest:n}=await Rl.digest(t);try{return await gb(n,e)}catch(r){throw new sc(String(r),"ERR_INVALID_INPUT")}}(this._key,e)}get public(){return new Ob(this._publicKey)}marshal(){return this._key}get bytes(){return Jm.encode({Type:Ym.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return ll(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Rl.digest(this.bytes);return e}async id(){return Xl(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 Mm(this.bytes,e);throw new sc("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}function Lb(e){return new Bb(e)}function Mb(e){return new Ob(e)}async function Ub(){const e=wb.randomPrivateKey();return new Bb(e)}const Fb={rsa:g,ed25519:p,secp256k1:y};function jb(e){const t=Object.keys(Fb).join(" / ");return new sc("invalid or unsupported key type ".concat(e,". Must be ").concat(t),"ERR_UNSUPPORTED_KEY_TYPE")}function zb(e){if("rsa"===(e=e.toLowerCase())||"ed25519"===e||"secp256k1"===e)return Fb[e];throw jb(e)}async function Kb(e,t){return zb(e).generateKeyPair(null!==t&&void 0!==t?t:2048)}function qb(e){var t,n;const r=Xm.decode(e),i=null!==(t=r.Data)&&void 0!==t?t:new Uint8Array;switch(r.Type){case Ym.RSA:return Fb.rsa.unmarshalRsaPublicKey(i);case Ym.Ed25519:return Fb.ed25519.unmarshalEd25519PublicKey(i);case Ym.Secp256k1:return Fb.secp256k1.unmarshalSecp256k1PublicKey(i);default:throw jb(null!==(n=r.Type)&&void 0!==n?n:"RSA")}}function Vb(e,t){var n;return zb(t=(null!==(n=t)&&void 0!==n?n:"rsa").toLowerCase()),e.bytes}async function Hb(e){var t,n;const r=Jm.decode(e),i=null!==(t=r.Data)&&void 0!==t?t:new Uint8Array;switch(r.Type){case Ym.RSA:return Fb.rsa.unmarshalRsaPrivateKey(i);case Ym.Ed25519:return Fb.ed25519.unmarshalEd25519PrivateKey(i);case Ym.Secp256k1:return Fb.secp256k1.unmarshalSecp256k1PrivateKey(i);default:throw jb(null!==(n=r.Type)&&void 0!==n?n:"RSA")}}async function Wb(e,t){try{const n=await async function(e,t){const n=vl.decode(e);return Lm().decrypt(n,t)}(e,t);return await Hb(n)}catch(i){}const n=Ry.pki.decryptRsaPrivateKey(e,t);if(null===n)throw new sc("Cannot read the key, most likely the password is wrong or not a RSA key","ERR_CANNOT_DECRYPT_PEM");let r=Ry.asn1.toDer(Ry.pki.privateKeyToAsn1(n));return r=ru(r.getBytes(),"ascii"),Fb.rsa.unmarshalRsaPrivateKey(r)}let Gb;const $b=Symbol.for("nodejs.util.inspect.custom"),Yb=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),Qb=114,Xb=36,Jb=37;Gb=Symbol.toStringTag;class Zb{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Gb](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(Qb,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:Yb,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new tw({multihash:t}):e.startsWith("16U")?new nw({multihash:t}):new ew({multihash:t})}return function(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===Xb)return new tw({multihash:t});if(t.digest.length===Jb)return new nw({multihash:t})}if(t.code===Rl.code)return new ew({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==Qb)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new ew({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===Xb)return new tw({multihash:e.multihash});if(t.digest.length===Jb)return new nw({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(Yb.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[$b](){return"PeerId(".concat(this.toString(),")")}}class ew extends Zb{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class tw extends Zb{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class nw extends Zb{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}async function rw(e,t){return e.length===Xb?new tw({multihash:jc(Dl.code,e),privateKey:t}):e.length===Jb?new nw({multihash:jc(Dl.code,e),privateKey:t}):new ew({multihash:await Rl.digest(e),publicKey:e,privateKey:t})}var iw=__webpack_require__(8958),ow=__webpack_require__(7845),sw=__webpack_require__(6243),aw=__webpack_require__(6162),cw=__webpack_require__(3952);sw._configure(),iw._configure(ow),aw._configure(cw);const lw=["uint64","int64","sint64","fixed64","sfixed64"];function uw(e){return function(e){for(const t of lw){if(null==e[t])continue;const n=e[t];e[t]=function(){return BigInt(n.call(this).toString())}}return e}(new iw(e))}function hw(){return function(e){for(const t of lw){if(null==e[t])continue;const n=e[t];e[t]=function(e){return n.call(this,e.toString())}}return e}(aw.create())}function dw(e,t){const n=uw(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}function fw(e,t){const n=hw();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}var pw,gw,yw;function mw(e,t){return function(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}("message",pw.LENGTH_DELIMITED,e,t)}async function vw(e,t,n){const r=await async function(e,t){if(null==e.privateKey)throw new Error("PrivateKey was missing from PeerId");return(await Hb(e.privateKey)).sign(t)}(e,Ew(t));if(null==e.publicKey)throw new Error("PublicKey was missing from local PeerId");return function(e,t,n){return yw.encode({identityKey:e,identitySig:t,extensions:null!==n&&void 0!==n?n:{webtransportCerthashes:[]}}).subarray()}(e.publicKey,r,n)}async function bw(e){return rw(e.identityKey)}function ww(e){return yw.decode(e)}function Ew(e){const t=ru("noise-libp2p-static-key:");return Zl([t,e],t.length+e.length)}async function _w(e,t,n){const r=await rw(t.identityKey);if(!r.equals(n))throw new Error("Payload identity key ".concat(r.toString()," does not match expected remote peer ").concat(n.toString()));const i=Ew(e);if(null==r.publicKey)throw new Error("PublicKey was missing from PeerId");if(null==t.identitySig)throw new Error("Signature was missing from message");const o=qb(r.publicKey);if(!await o.verify(i,t.identitySig))throw new Error("Static key doesn't match to peer that signed payload!");return r}function Sw(e){return e instanceof Uint8Array&&32===e.length}function Aw(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 Ju.enabled("".concat(e,":trace"))&&null!=Ju.names.map((e=>e.toString())).find((e=>e.includes(":trace")))&&(t=Ju("".concat(e,":trace"))),Object.assign(Ju(e),{error:Ju("".concat(e,":error")),trace:t})}!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"}(pw||(pw={})),function(e){let t;e.codec=()=>(null==t&&(t=mw((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&t.fork(),null!=e.webtransportCerthashes)for(const r of e.webtransportCerthashes)t.uint32(10),t.bytes(r);!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={webtransportCerthashes:[]},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.webtransportCerthashes.push(e.bytes());else e.skipType(7&t)}return n}))),t),e.encode=t=>fw(t,e.codec()),e.decode=t=>dw(t,e.codec())}(gw||(gw={})),function(e){let t;e.codec=()=>(null==t&&(t=mw((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var r,i;(!1!==n.lengthDelimited&&t.fork(),!0===n.writeDefaults||null!=e.identityKey&&e.identityKey.byteLength>0)&&(t.uint32(10),t.bytes(null!==(r=e.identityKey)&&void 0!==r?r:new Uint8Array(0)));(!0===n.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),gw.codec().encode(e.extensions,t,{writeDefaults:!1})),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={identityKey:new Uint8Array(0),identitySig:new Uint8Array(0)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.identityKey=e.bytes();break;case 2:n.identitySig=e.bytes();break;case 4:n.extensions=gw.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>fw(t,e.codec()),e.decode=t=>dw(t,e.codec())}(yw||(yw={})),Ju.formatters.b=e=>null==e?"undefined":vc.baseEncode(e),Ju.formatters.t=e=>null==e?"undefined":qc.baseEncode(e),Ju.formatters.m=e=>null==e?"undefined":vl.baseEncode(e),Ju.formatters.p=e=>null==e?"undefined":e.toString(),Ju.formatters.c=e=>null==e?"undefined":e.toString(),Ju.formatters.k=e=>null==e?"undefined":e.toString(),Ju.formatters.a=e=>null==e?"undefined":e.toString();const kw=Aw("libp2p:noise");let Tw;function Iw(e){e?(Tw("LOCAL_PUBLIC_EPHEMERAL_KEY ".concat(Xl(e.publicKey,"hex"))),Tw("LOCAL_PRIVATE_EPHEMERAL_KEY ".concat(Xl(e.privateKey,"hex")))):Tw("Missing local ephemeral keys.")}function Cw(e){Tw("REMOTE_EPHEMERAL_PUBLIC_KEY ".concat(Xl(e,"hex")))}Tw=_p?kw:Object.assign((()=>{}),{enabled:!1,trace:()=>{},error:()=>{}});class Rw{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;Xa(this,"n",void 0),Xa(this,"bytes",void 0),Xa(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 xw{constructor(e){Xa(this,"crypto",void 0),this.crypto=e}encryptWithAd(e,t,n){const r=this.encrypt(e.k,e.n,t,n);return e.n.increment(),r}decryptWithAd(e,t,n,r){const{plaintext:i,valid:o}=this.decrypt(e.k,e.n,t,n,r);return o&&e.n.increment(),{plaintext:i,valid:o}}hasKey(e){return!this.isEmptyKey(e.k)}createEmptyKey(){return new Uint8Array(32)}isEmptyKey(e){return ll(this.createEmptyKey(),e)}encrypt(e,t,n,r){return t.assertValue(),this.crypto.chaCha20Poly1305Encrypt(r,t.getBytes(),n,e)}encryptAndHash(e,t){let n;return n=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,n),n}decrypt(e,t,n,r,i){t.assertValue();const o=this.crypto.chaCha20Poly1305Decrypt(r,t.getBytes(),n,e,i);return o?{plaintext:o,valid:!0}:{plaintext:new Uint8Array(0),valid:!1}}decryptAndHash(e,t){let n,r=!0;return this.hasKey(e.cs)?({plaintext:n,valid:r}=this.decryptWithAd(e.cs,e.h,t)):n=t,this.mixHash(e,t),{plaintext:n,valid:r}}dh(e,t){try{const n=this.crypto.generateX25519SharedKey(e,t);return 32===n.length?n:n.subarray(0,32)}catch(n){const e=n;return kw.error(e),new Uint8Array(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return this.crypto.hashSHA256(Zl([e,t],e.length+t.length))}mixKey(e,t){const[n,r]=this.crypto.getHKDF(e.ck,t);e.cs=this.initializeKey(r),e.ck=n}initializeKey(e){return{k:e,n:new Rw}}initializeSymmetric(e){const t=ru(e,"utf-8"),n=this.hashProtocolName(t),r=n,i=this.createEmptyKey();return{cs:this.initializeKey(i),ck:r,h:n}}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,n]=this.crypto.getHKDF(e.ck,new Uint8Array(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(n)}}writeMessageRegular(e,t){const n=this.encryptWithAd(e,new Uint8Array(0),t);return{ne:this.createEmptyKey(),ns:new Uint8Array(0),ciphertext:n}}readMessageRegular(e,t){return this.decryptWithAd(e,new Uint8Array(0),t.ciphertext)}}class Pw extends xw{initializeInitiator(e,t,n,r){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:n,psk:r,re:new Uint8Array(32)}}initializeResponder(e,t,n,r){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:n,psk:r,re:new Uint8Array(32)}}writeMessageA(e,t,n){const r=new Uint8Array(0);e.e=void 0!==n?n:this.crypto.generateX25519KeyPair();const i=e.e.publicKey;this.mixHash(e.ss,i);return{ne:i,ns:r,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=this.crypto.generateX25519KeyPair();const n=e.e.publicKey;this.mixHash(e.ss,n),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const r=e.s.publicKey,i=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:n,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const n=e.s.publicKey,r=this.encryptAndHash(e.ss,n);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const i=this.encryptAndHash(e.ss,t),o={ne:this.createEmptyKey(),ns:r,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 Sw(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(Sw(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:n,valid:r}=this.decryptAndHash(e.ss,t.ns);r&&Sw(n)&&(e.rs=n),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:r&&o}}readMessageC(e,t){const{plaintext:n,valid:r}=this.decryptAndHash(e.ss,t.ns);if(r&&Sw(n)&&(e.rs=n),!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:r&&o,cs1:s,cs2:a}}initSession(e,t,n){const r=this.createEmptyKey(),i=new Uint8Array(32);let o;return o=e?this.initializeInitiator(t,n,i,r):this.initializeResponder(t,n,i,r),{hs:o,i:e,mc:0}}sendMessage(e,t,n){let r;if(0===e.mc)r=this.writeMessageA(e.hs,t,n);else if(1===e.mc)r=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:n,messageBuffer:i,cs1:o,cs2:s}=this.writeMessageC(e.hs,t);r=i,e.h=n,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");r=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");r=this.writeMessageRegular(e.cs2,t)}}return e.mc++,r}recvMessage(e,t){let n=new Uint8Array(0),r=!1;if(0===e.mc)({plaintext:n,valid:r}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:n,valid:r}=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);n=o,r=s,e.h=i,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:n,valid:r}}}class Dw{constructor(e,t,n,r,i,o,s,a){Xa(this,"isInitiator",void 0),Xa(this,"session",void 0),Xa(this,"remotePeer",void 0),Xa(this,"remoteExtensions",{webtransportCerthashes:[]}),Xa(this,"payload",void 0),Xa(this,"connection",void 0),Xa(this,"xx",void 0),Xa(this,"staticKeypair",void 0),Xa(this,"prologue",void 0),this.isInitiator=e,this.payload=t,this.prologue=n,this.staticKeypair=i,this.connection=o,s&&(this.remotePeer=s),this.xx=null!==a&&void 0!==a?a:new Pw(r),this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair)}async propose(){var e;if(e=this.session.hs.s,Tw("LOCAL_STATIC_PUBLIC_KEY ".concat(Xl(e.publicKey,"hex"))),Tw("LOCAL_STATIC_PRIVATE_KEY ".concat(Xl(e.privateKey,"hex"))),this.isInitiator){kw.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 Zl([e.ne,e.ciphertext],e.ne.length+e.ciphertext.length)}(e)),kw.trace("Stage 0 - Initiator finished sending first message."),Iw(this.session.hs.e)}else{kw.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 Iy("xx handshake stage 0 validation fail");kw.trace("Stage 0 - Responder received first message."),Cw(this.session.hs.re)}}async exchange(){if(this.isInitiator){kw.trace("Stage 1 - Initiator waiting to receive first message from responder...");const n=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:r,valid:i}=this.xx.recvMessage(this.session,n);if(!i)throw new Iy("xx handshake stage 1 validation fail");kw.trace("Stage 1 - Initiator received the message."),Cw(this.session.hs.re),e=this.session.hs.rs,Tw("REMOTE_STATIC_PUBLIC_KEY ".concat(Xl(e,"hex"))),kw.trace("Initiator going to check remote's signature...");try{const e=ww(r);this.remotePeer=this.remotePeer||await bw(e),await _w(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Ty("Error occurred while verifying signed payload: ".concat(t.message))}kw.trace("All good with the signature!")}else{kw.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 Zl([e.ne,e.ns,e.ciphertext],e.ne.length+e.ns.length+e.ciphertext.length)}(e)),kw.trace("Stage 1 - Responder sent the second handshake message with signed payload."),Iw(this.session.hs.e)}var e}async finish(){if(this.isInitiator){kw.trace("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(function(e){return Zl([e.ns,e.ciphertext],e.ns.length+e.ciphertext.length)}(e)),kw.trace("Stage 2 - Initiator sent message with signed payload.")}else{kw.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:n,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Iy("xx handshake stage 2 validation fail");kw.trace("Stage 2 - Responder received the message, finished handshake.");try{const e=ww(n);this.remotePeer=this.remotePeer||await bw(e),await _w(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Ty("Error occurred while verifying signed payload: ".concat(t.message))}}var e;(e=this.session).cs1&&e.cs2?(Tw("CIPHER_STATE_1 ".concat(e.cs1.n.getUint64()," ").concat(Xl(e.cs1.k,"hex"))),Tw("CIPHER_STATE_2 ".concat(e.cs2.n.getUint64()," ").concat(Xl(e.cs2.k,"hex")))):Tw("Missing cipher state.")}encrypt(e,t){const n=this.getCS(t);return this.xx.encryptWithAd(n,new Uint8Array(0),e)}decrypt(e,t,n){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,new Uint8Array(0),e,n)}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 Iy("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 Nw{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Xa(this,"protocol","/noise"),Xa(this,"crypto",void 0),Xa(this,"prologue",void 0),Xa(this,"staticKeys",void 0),Xa(this,"extensions",void 0),Xa(this,"metrics",void 0);const{staticNoiseKey:t,extensions:n,crypto:r,prologueBytes:i,metrics:o}=e;this.crypto=null!==r&&void 0!==r?r:_y,this.extensions=n,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,n){const r=mp(t,{lengthEncoder:Sy,lengthDecoder:Ay,maxDataLength:wp}),i=await this.performHandshake({connection:r,isInitiator:!0,localPeer:e,remotePeer:n});return{conn:await this.createSecureConnection(r,i),remoteExtensions:i.remoteExtensions,remotePeer:i.remotePeer}}async secureInbound(e,t,n){const r=mp(t,{lengthEncoder:Sy,lengthDecoder:Ay,maxDataLength:wp}),i=await this.performHandshake({connection:r,isInitiator:!1,localPeer:e,remotePeer:n});return{conn:await this.createSecureConnection(r,i),remotePeer:i.remotePeer,remoteExtensions:i.remoteExtensions}}async performHandshake(e){const t=await vw(e.localPeer,this.staticKeys.publicKey,this.extensions);return this.performXXHandshake(e,t)}async performXXHandshake(e,t){const{isInitiator:n,remotePeer:r,connection:i}=e,o=new Dw(n,t,this.prologue,this.crypto,this.staticKeys,i,r);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[n,r]=function(){const e=gp(),t=gp();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}(),i=e.unwrap();return await Hd(n,function(e,t){return async function*(n){for await(const r of n)for(let n=0;n<r.length;n+=Ep){let i=n+Ep;i>r.length&&(i=r.length);const o=e.encrypt(r.subarray(n,i),e.session);null===t||void 0===t||t.encryptedPackets.increment(),yield Sy(o.byteLength),yield o}}}(t,this.metrics),i,(e=>Md(e,{lengthDecoder:Ay})),function(e,t){return async function*(n){for await(const r of n)for(let n=0;n<r.length;n+=wp){let i=n+wp;if(i>r.length&&(i=r.length),i-ky<n)throw new Error("Invalid chunk");const o=r.subarray(n,i),s=r.subarray(n,i-ky),{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),n),r}}function Ow(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new Nw(e)}class Bw 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 Lw(e,t,n){const r=null!==n&&void 0!==n?n:{},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 n;const o=()=>{null!=n&&n()};for(t.addEventListener("abort",o);;){let a;try{if(t.aborted){const{abortMessage:e,abortCode:t}=r;throw new Bw(e,t)}const e=new Promise(((e,t)=>{n=()=>{const{abortMessage:e,abortCode:n}=r;t(new Bw(e,n))}}));a=await Promise.race([e,i.next()]),n=null}catch(s){t.removeEventListener("abort",o);const n="aborted"===s.type&&t.aborted;if(n&&null!=r.onAbort&&r.onAbort(e),"function"===typeof i.return)try{const e=i.return();e instanceof Promise&&e.catch((e=>{null!=r.onReturnError&&r.onReturnError(e)}))}catch(s){null!=r.onReturnError&&r.onReturnError(s)}if(n&&!0===r.returnOnAbort)return;throw s}if(!0===a.done)break;yield a.value}t.removeEventListener("abort",o)}()}function Mw(e,t,n){return r=>e(Lw(r,t,n))}function Uw(e,t,n){return{sink:Mw(e.sink,t,{...n,onAbort:void 0}),source:Lw(e.source,t,n)}}function Fw(e){const t=new globalThis.AbortController;function n(){t.abort();for(const t of e)null!=(null===t||void 0===t?void 0:t.removeEventListener)&&t.removeEventListener("abort",n)}for(const i of e){if(!0===(null===i||void 0===i?void 0:i.aborted)){n();break}null!=(null===i||void 0===i?void 0:i.addEventListener)&&i.addEventListener("abort",n)}const r=t.signal;return r.clear=function(){for(const t of e)null!=(null===t||void 0===t?void 0:t.removeEventListener)&&t.removeEventListener("abort",n)},r}var jw,zw=__webpack_require__(7896);!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"}(jw||(jw={}));const Kw=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),qw=Object.freeze({NEW_STREAM:jw.NEW_STREAM,MESSAGE:jw.MESSAGE_INITIATOR,CLOSE:jw.CLOSE_INITIATOR,RESET:jw.RESET_INITIATOR}),Vw=Object.freeze({MESSAGE:jw.MESSAGE_RECEIVER,CLOSE:jw.CLOSE_RECEIVER,RESET:jw.RESET_RECEIVER}),Hw=1<<20;class Ww{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Hw,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4194304;Xa(this,"_buffer",void 0),Xa(this,"_headerInfo",void 0),Xa(this,"_maxMessageSize",void 0),Xa(this,"_maxUnprocessedMessageQueueSize",void 0),this._buffer=new gd,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(n){if("ERR_MSG_TOO_BIG"===n.code)throw n;break}const{id:e,type:r,length:i,offset:o}=this._headerInfo;if(this._buffer.length-o<i)break;const s={id:e,type:r};r!==jw.NEW_STREAM&&r!==jw.MESSAGE_INITIATOR&&r!==jw.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:n}=Yw(e),{value:r,offset:i}=Yw(e,n),o=7&t;if(null==Kw[o])throw new Error("Invalid type received: ".concat(o));if(r>this._maxMessageSize)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"});return{id:t>>3,type:o,offset:n+i,length:r}}}const Gw=128,$w=127;function Yw(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0,i=0,o=n;const s=e.length;do{if(o>=s||i>49)throw n=0,new RangeError("Could not decode varint");t=e.get(o++),r+=i<28?(t&$w)<<i:(t&$w)*Math.pow(2,i),i+=7}while(t>=Gw);return n=o-n,{value:r,offset:n}}const Qw=1048576,Xw=(e,t)=>{t.append(e)};const Jw=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(){var n,r,i;let o=new gd,s=!1,a=Ud(),c=Number(null!==(n=null===t||void 0===t?void 0:t.size)&&void 0!==n?n:Qw);if((isNaN(c)||0===c||c<0)&&(c=Qw),c!==Math.round(c))throw new Error("Batch size must be an integer");const l=null!==(r=null===t||void 0===t?void 0:t.yieldAfter)&&void 0!==r?r:0,u=null!==(i=null===t||void 0===t?void 0:t.serialize)&&void 0!==i?i:Xw;for(Promise.resolve().then((async()=>{try{let t;for await(const n of e)u(n,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=Ud(),o.byteLength>0){const e=o;o=new gd,yield e.subarray()}}():function*(){var n,r;const i=new gd;let o=Number(null!==(n=null===t||void 0===t?void 0:t.size)&&void 0!==n?n:Qw);if((isNaN(o)||0===o||o<0)&&(o=Qw),o!==Math.round(o))throw new Error("Batch size must be an integer");const s=null!==(r=null===t||void 0===t?void 0:t.serialize)&&void 0!==r?r:Xw;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())}()};function Zw(e){return new Uint8Array(e)}const eE=10240;const tE=new class{constructor(){Xa(this,"_pool",void 0),Xa(this,"_poolOffset",void 0),this._pool=Zw(eE),this._poolOffset=0}write(e,t){var n,r;const i=this._pool;let o=this._poolOffset;Jl.encode(e.id<<3|e.type,i,o),o+=null!==(n=Jl.encode.bytes)&&void 0!==n?n:0,e.type!==jw.NEW_STREAM&&e.type!==jw.MESSAGE_INITIATOR&&e.type!==jw.MESSAGE_RECEIVER||null==e.data?Jl.encode(0,i,o):Jl.encode(e.data.length,i,o),o+=null!==(r=Jl.encode.bytes)&&void 0!==r?r:0;const s=i.subarray(this._poolOffset,o);eE-o<100?(this._pool=Zw(eE),this._poolOffset=0):this._poolOffset=o,t.append(s),e.type!==jw.NEW_STREAM&&e.type!==jw.MESSAGE_INITIATOR&&e.type!==jw.MESSAGE_RECEIVER||null==e.data||t.append(e.data)}};const nE=Aw("libp2p:stream"),rE="ERR_STREAM_RESET";function iE(e){return null!=e&&"function"===typeof e.then}class oE{constructor(e){var t;Xa(this,"id",void 0),Xa(this,"stat",void 0),Xa(this,"metadata",void 0),Xa(this,"source",void 0),Xa(this,"abortController",void 0),Xa(this,"resetController",void 0),Xa(this,"closeController",void 0),Xa(this,"sourceEnded",void 0),Xa(this,"sinkEnded",void 0),Xa(this,"sinkSunk",void 0),Xa(this,"endErr",void 0),Xa(this,"streamSource",void 0),Xa(this,"onEnd",void 0),Xa(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=Kd({onEnd:()=>{if(null!==this.stat.timeline.reset){const e=this.sendCloseRead();iE(e)&&e.catch((e=>{nE.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,nE.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,nE.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(){nE.trace("%s stream %s close",this.stat.direction,this.id),this.closeRead(),this.closeWrite()}closeRead(){nE.trace("%s stream %s closeRead",this.stat.direction,this.id),this.sourceEnded||this.streamSource.end()}closeWrite(){if(nE.trace("%s stream %s closeWrite",this.stat.direction,this.id),!this.sinkEnded){this.closeController.abort();try{const e=this.sendCloseWrite();iE(e)&&e.catch((e=>{nE.error("error while sending close write",e)}))}catch(e){nE.trace("%s stream %s error sending close",this.stat.direction,this.id,e)}this.onSinkEnd()}}abort(e){nE.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 sc("stream reset",rE);this.resetController.abort(),this.streamSource.end(e),this.onSinkEnd(e)}async sink(e){if(this.sinkSunk)throw new sc("sink already called on stream","ERR_DOUBLE_SINK");if(this.sinkSunk=!0,this.sinkEnded)throw new sc("stream closed for writing","ERR_SINK_ENDED");const t=Fw([this.abortController.signal,this.resetController.signal,this.closeController.signal]);try{if(e=Lw(e,t),"outbound"===this.stat.direction){const e=this.sendNewStream();iE(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 gd(t):t);iE(e)&&await e;break}t=t instanceof Uint8Array?new gd(t):t;const e=this.sendData(t.sublist(0,this.maxDataSize));iE(e)&&await e,t.consume(this.maxDataSize)}}catch(n){if("aborted"===n.type&&"The operation was aborted"===n.message){if(this.closeController.signal.aborted)return;this.resetController.signal.aborted&&(n.message="stream reset",n.code=rE),this.abortController.signal.aborted&&(n.message="stream aborted",n.code="ERR_STREAM_ABORT")}if(n.code===rE)nE.trace("%s stream %s reset",this.stat.direction,this.id);else{nE.trace("%s stream %s error",this.stat.direction,this.id,n);try{const e=this.sendReset();iE(e)&&await e,this.stat.timeline.reset=Date.now()}catch(n){nE.trace("%s stream %s error sending reset",this.stat.direction,this.id,n)}}throw this.streamSource.end(n),this.onSinkEnd(n),n}finally{t.clear()}try{const e=this.sendCloseWrite();iE(e)&&await e}catch(n){nE.trace("%s stream %s error sending close",this.stat.direction,this.id,n)}this.onSinkEnd()}sourcePush(e){this.streamSource.push(e)}sourceReadableLength(){return this.streamSource.readableLength}}class sE extends oE{constructor(e){super(e),Xa(this,"name",void 0),Xa(this,"streamId",void 0),Xa(this,"send",void 0),Xa(this,"types",void 0),this.types="outbound"===e.direction?qw:Vw,this.send=e.send,this.name=e.name,this.streamId=e.streamId}sendNewStream(){this.send({id:this.streamId,type:qw.NEW_STREAM,data:new gd(ru(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 aE=Aw("libp2p:mplex");function cE(e){const t={...e,type:"".concat(Kw[e.type]," (").concat(e.type,")")};return e.type===jw.NEW_STREAM&&(t.data=Xl(e.data instanceof Uint8Array?e.data:e.data.subarray())),e.type!==jw.MESSAGE_INITIATOR&&e.type!==jw.MESSAGE_RECEIVER||(t.data=Xl(e.data instanceof Uint8Array?e.data:e.data.subarray(),"base16")),t}class lE{constructor(e){var t,n;Xa(this,"protocol","/mplex/6.7.0"),Xa(this,"sink",void 0),Xa(this,"source",void 0),Xa(this,"_streamId",void 0),Xa(this,"_streams",void 0),Xa(this,"_init",void 0),Xa(this,"_source",void 0),Xa(this,"closeController",void 0),Xa(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 r=this._createSource();this._source=r,this.source=r,this.closeController=new AbortController,this.rateLimiter=new zw.RateLimiterMemory({points:null!==(n=e.disconnectThreshold)&&void 0!==n?n: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 n=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:n})}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:n}=e,r=this._streams.receivers;return this._newStream({id:t,name:n,type:"receiver",registry:r})}_newStream(e){var t;const{id:n,name:r,type:i,registry:o}=e;if(aE("new %s stream %s",i,n),"initiator"===i&&this._streams.initiators.size===(null!==(t=this._init.maxOutboundStreams)&&void 0!==t?t:1024))throw new sc("Too many outbound streams open","ERR_TOO_MANY_OUTBOUND_STREAMS");if(o.has(n))throw new Error("".concat(i," stream ").concat(n," already exists!"));const s=function(e){const{id:t,name:n,send:r,onEnd:i,type:o="initiator",maxMsgSize:s=Hw}=e;return new sE({id:"initiator"===o?"i".concat(t):"r".concat(t),streamId:t,name:"".concat(null==n?t:n),direction:"initiator"===o?"outbound":"inbound",maxDataSize:s,onEnd:i,send:r})}({id:n,name:r,send:e=>{aE.enabled&&aE.trace("%s stream %s send",i,n,cE(e)),this._source.push(e)},type:i,onEnd:()=>{aE("%s stream with id %s and protocol %s ended",i,n,s.stat.protocol),o.delete(n),null!=this._init.onStreamEnd&&this._init.onStreamEnd(s)},maxMsgSize:this._init.maxMsgSize});return o.set(n,s),s}_createSink(){return async e=>{const t=Fw([this.closeController.signal,this._init.signal]);try{e=Lw(e,t);const n=new Ww(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(const t of e)for(const e of n.write(t))await this._handleIncoming(e);this._source.end()}catch(n){aE("error in sink",n),this._source.end(n)}finally{t.clear()}}}_createSource(){const e=function(){return qd((e=>{let t;const n=[];for(;!e.isEmpty()&&(t=e.shift(),null!=t);){if(null!=t.error)throw t.error;!1===t.done&&n.push(t.value)}return null==t?{done:!0}:{done:!0===t.done,value:n}}),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*Jw(e,{size:t,serialize:(e,t)=>{for(const n of e)tE.write(n,t)}});else for await(const t of e){const e=new gd;for(const n of t)tE.write(n,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:n,type:r}=e;if(aE.enabled&&aE.trace("incoming message",cE(e)),e.type===jw.NEW_STREAM){var i;if(this._streams.receivers.size===(null!==(i=this._init.maxInboundStreams)&&void 0!==i?i:1024)){aE("too many inbound streams open"),this._source.push({id:n,type:jw.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{return aE("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:n,name:Xl(e.data instanceof Uint8Array?e.data:e.data.subarray())});return void(null!=this._init.onIncomingStream&&this._init.onIncomingStream(t))}const o=(1===(1&r)?this._streams.initiators:this._streams.receivers).get(n);if(null==o)return void aE("missing stream %s for message type %s",n,Kw[r]);const s=null!==(t=this._init.maxStreamBufferSize)&&void 0!==t?t:4194304;switch(r){case jw.MESSAGE_INITIATOR:case jw.MESSAGE_RECEIVER:if(o.sourceReadableLength()>s){this._source.push({id:e.id,type:r===jw.MESSAGE_INITIATOR?jw.RESET_RECEIVER:jw.RESET_INITIATOR});const t=new sc("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 jw.CLOSE_INITIATOR:case jw.CLOSE_RECEIVER:o.closeRead();break;case jw.RESET_INITIATOR:case jw.RESET_RECEIVER:o.reset();break;default:aE("unknown message type %s",r)}}}class uE{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Xa(this,"protocol","/mplex/6.7.0"),Xa(this,"_init",void 0),this._init=e}createStreamMuxer(){return new lE({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},...this._init})}}function hE(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new uE(e)}const dE=Symbol.for("@libp2p/transport");var fE;!function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"}(fE||(fE={}));const pE=iu,gE=ou,yE=function(e){let t=0;if(e=e.toString().trim(),pE(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(gE(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;pE(n[r])&&(e=yE(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},mE=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},vE=-1,bE={},wE={};function EE(e){if("number"===typeof e){if(null!=wE[e])return wE[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=bE[e])return bE[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,vE,"ip6zone"],[43,8,"ipcidr"],[53,vE,"dns",!0],[54,vE,"dns4",!0],[55,vE,"dns6",!0],[56,vE,"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,vE,"unix",!1,!0],[421,vE,"ipfs"],[421,vE,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,vE,"garlic64"],[448,0,"tls"],[449,vE,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,vE,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,vE,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);wE[t.code]=t,bE[t.name]=t}));EE("ip4"),EE("ip6"),EE("ipcidr");function _E(e,t){switch(EE(e).code){case 4:case 41:return function(e){const t=mE(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 xE(t);case 6:case 273:case 33:case 132:return CE(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return PE(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function SE(e,t){switch(EE(e).code){case 4:case 41:return TE(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return RE(t);case 6:case 273:case 33:case 132:return IE(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?zc(vc.decode("z".concat(e))).bytes:tl.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=qc.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=IE(r);return Zl([n,i],n.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 n=qc.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=IE(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=kE.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const AE=Object.values(ql).map((e=>e.decoder)),kE=function(){let e=AE[0].or(AE[1]);return AE.slice(2).forEach((t=>e=e.or(t))),e}();function TE(e){if(!su(e))throw new Error("invalid ip address");return yE(e)}function IE(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function CE(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function RE(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}function xE(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function PE(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=CE(n);return"".concat(r,":").concat(i)}function DE(e){return e.map((e=>{const t=KE(e);return null!=e[1]?[t.code,_E(t.code,e[1])]:[t.code]}))}function NE(e){return UE(Zl(e.map((e=>{const t=KE(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function OE(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var n;return Jl.decode(t)+(null!==(n=Jl.decode.bytes)&&void 0!==n?n:0)}function BE(e){const t=[];let n=0;for(;n<e.length;){var r;const i=Jl.decode(e,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0,s=OE(EE(i),e.slice(n+o));if(0===s){t.push([i]),n+=o;continue}const a=e.slice(n+o,n+o+s);if(n+=s+o,n>e.length)throw zE("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([i,a])}return t}function LE(e){return function(e){const t=[];return e.map((e=>{const n=KE(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),jE(t.join("/"))}(DE(BE(e)))}function ME(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=EE(i);if(0!==o.size){if(r++,r>=n.length)throw zE("invalid address: "+e);if(!0===o.path){t.push([i,jE(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=jE(e));return NE(t.map((e=>{Array.isArray(e)||(e=[e]);const t=KE(e);return e.length>1?[t.code,SE(t.code,e[1])]:[t.code]})))}function UE(e){const t=FE(e);if(null!=t)throw t;return Uint8Array.from(e)}function FE(e){try{BE(e)}catch(t){return t}}function jE(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function zE(e){return new Error("Error parsing address: "+e)}function KE(e){return EE(e[0])}const qE=Symbol.for("nodejs.util.inspect.custom"),VE=[EE("dns").code,EE("dns4").code,EE("dns6").code,EE("dnsaddr").code],HE=new Map,WE=Symbol.for("@multiformats/js-multiaddr/multiaddr");function GE(e){return Boolean(null===e||void 0===e?void 0:e[WE])}var $E=new WeakMap,YE=new WeakMap,QE=new WeakMap,XE=new WeakMap;class JE{constructor(e){if(Xa(this,"bytes",void 0),tc(this,$E,{writable:!0,value:void 0}),tc(this,YE,{writable:!0,value:void 0}),tc(this,QE,{writable:!0,value:void 0}),tc(this,XE,{writable:!0,value:void 0}),Xa(this,WE,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=UE(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=ME(e)}else{if(!GE(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=UE(e.bytes)}}toString(){return null==ic(this,$E)&&rc(this,$E,LE(this.bytes)),ic(this,$E)}toJSON(){return this.toString()}toOptions(){let e,t,n,r,i="";const o=EE("tcp"),s=EE("udp"),a=EE("ip4"),c=EE("ip6"),l=EE("dns6"),u=EE("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),VE.includes(h)&&(t=o.name,r=443,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=EE(h).name,r=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=EE(h).name,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==n||null==r)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},EE(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){var r;const i=Jl.decode(t,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0;n+=OE(EE(i),t.slice(n+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==ic(this,YE)&&rc(this,YE,BE(this.bytes)),ic(this,YE)}stringTuples(){return null==ic(this,QE)&&rc(this,QE,DE(this.tuples())),ic(this,QE)}encapsulate(e){return e=new JE(e),new JE(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new JE(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new JE(NE(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===bE.ipfs.code)),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]?Xl(vc.decode("z".concat(e)),"base58btc"):Xl(tl.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===ic(this,XE))try{rc(this,XE,this.stringTuples().filter((e=>!0===EE(e[0]).path))[0][1]),null==ic(this,XE)&&rc(this,XE,null)}catch{rc(this,XE,null)}return ic(this,XE)}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=HE.get(t.name);if(null==n)throw new sc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new JE(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))}[qE](){return"Multiaddr(".concat(LE(this.bytes),")")}}function ZE(e){let t;try{t=EE("sni").code}catch(n){return null}for(const[r,i]of e)if(r===t&&void 0!==i)return i;return null}function e_(e){return e.some((e=>{let[t,n]=e;return t===EE("tls").code}))}function t_(e,t,n){const r=n_[EE(e).name];if(void 0===r)throw new Error("Can't interpret protocol ".concat(EE(e).name));const i=r(t,n);return e===EE("ip6").code?"[".concat(i,"]"):i}const n_={ip4:(e,t)=>e,ip6:(e,t)=>0===t.length?e:"[".concat(e,"]"),tcp:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return"tcp://".concat(t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t),":").concat(e)},udp:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return"udp://".concat(t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t),":").concat(e)},dnsaddr:(e,t)=>e,dns4:(e,t)=>e,dns6:(e,t)=>e,dns:(e,t)=>e,ipfs:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return"".concat(t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t),"/ipfs/").concat(e)},p2p:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return"".concat(t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t),"/p2p/").concat(e)},http:(e,t)=>{var n;const r=e_(t),i=ZE(t);if(r&&null!==i)return"https://".concat(i);const o=r?"https://":"http://",s=t.pop();if(void 0===s)throw new Error("Unexpected end of multiaddr");let a=t_(s[0],null!==(n=s[1])&&void 0!==n?n:"",t);return a=a.replace("tcp://",""),"".concat(o).concat(a)},tls:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t)},sni:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t)},https:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");let i=t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t);return i=i.replace("tcp://",""),"https://".concat(i)},ws:(e,t)=>{var n;const r=e_(t),i=ZE(t);if(r&&null!==i)return"wss://".concat(i);const o=r?"wss://":"ws://",s=t.pop();if(void 0===s)throw new Error("Unexpected end of multiaddr");let a=t_(s[0],null!==(n=s[1])&&void 0!==n?n:"",t);return a=a.replace("tcp://",""),"".concat(o).concat(a)},wss:(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");let i=t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t);return i=i.replace("tcp://",""),"wss://".concat(i)},"p2p-websocket-star":(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return"".concat(t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t),"/p2p-websocket-star")},"p2p-webrtc-star":(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return"".concat(t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t),"/p2p-webrtc-star")},"p2p-webrtc-direct":(e,t)=>{var n;const r=t.pop();if(void 0===r)throw new Error("Unexpected end of multiaddr");return"".concat(t_(r[0],null!==(n=r[1])&&void 0!==n?n:"",t),"/p2p-webrtc-direct")}};function r_(e,t){var n;const r=new JE(e).stringTuples(),i=r.pop();if(void 0===i)throw new Error("Unexpected end of multiaddr");const o=EE(i[0]),s=n_[o.name];if(null==s)throw new Error("No interpreter found for ".concat(o.name));let a=s(null!==(n=i[1])&&void 0!==n?n:"",r);return!1!==(null===t||void 0===t?void 0:t.assumeHttp)&&i[0]===EE("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}const i_=WebSocket;var o_=__webpack_require__(3634);function s_(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 a_=async e=>{if(e.readyState>=2)throw new Error("socket closed");1!==e.readyState&&await new Promise(((t,n)=>{function r(){e.removeEventListener("open",i),e.removeEventListener("error",o)}function i(){r(),t()}function o(t){var i;r(),n(null!==(i=t.error)&&void 0!==i?i:new Error("connect ECONNREFUSED ".concat(e.url)))}e.addEventListener("open",i),e.addEventListener("error",o)}))},c_=(e,t)=>{var n;(t=null!==(n=t)&&void 0!==n?n:{}).closeOnEnd=!1!==t.closeOnEnd;return async n=>{for await(const t of n){try{await a_(e)}catch(r){if("socket closed"===r.message)break;throw r}e.send(t)}null!=t.closeOnEnd&&e.readyState<=1&&await new Promise(((t,n)=>{e.addEventListener("close",(e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});n(t)}})),setTimeout((()=>{e.close()}))}))}},l_=(e,t)=>{var n;t=null!==(n=t)&&void 0!==n?n:{};const r=(e=>{e.binaryType="arraybuffer";const t=async()=>{await new Promise(((t,n)=>{if(i)return void t();if(null!=r)return void n(r);const o=t=>{e.removeEventListener("open",s),e.removeEventListener("error",a),t()},s=()=>{o(t)},a=t=>{o((()=>{var r;n(null!==(r=t.error)&&void 0!==r?r:new Error("connect ECONNREFUSED ".concat(e.url)))}))};e.addEventListener("open",s),e.addEventListener("error",a)}))},n=async function*(){const n=new o_.zN((t=>{let{push:n,stop:r,fail:i}=t;const o=e=>{let t=null;"string"===typeof e.data&&(t=ru(e.data)),s_(e.data)&&(t=new Uint8Array(e.data)),e.data instanceof Uint8Array&&(t=e.data),null!=t&&n(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",r),()=>{e.removeEventListener("message",o),e.removeEventListener("error",s),e.removeEventListener("close",r)}}),{highWaterMark:1/0});await t();for await(const e of n)yield s_(e)?new Uint8Array(e):e}();let r,i=1===e.readyState;return e.addEventListener("open",(()=>{i=!0,r=null})),e.addEventListener("close",(()=>{i=!1,r=null})),e.addEventListener("error",(t=>{var n;i||(r=null!==(n=t.error)&&void 0!==n?n:new Error("connect ECONNREFUSED ".concat(e.url)))})),Object.assign(n,{connected:t})})(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:c_(e,t),source:r,connected:async()=>{await r.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}};var u_=__webpack_require__(6791);const h_={http:"ws",https:"wss"},d_=(e,t)=>(0,u_.relative)(e,t,h_,"ws");var f_=__webpack_require__(2193);const p_="object"===typeof window&&"object"===typeof document&&9===document.nodeType,g_=f_(),y_=p_&&!g_,m_=g_&&!p_,v_=g_&&p_,b_="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.release&&"node"===globalThis.process.release.name&&!g_,w_="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,E_=("undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.env&&globalThis.process.env.NODE_ENV,"undefined"!==typeof navigator&&"ReactNative"===navigator.product),__=iu,S_=ou,A_=function(e){let t=0;if(e=e.toString().trim(),__(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(S_(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;__(n[r])&&(e=A_(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},k_=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},T_=-1,I_={},C_={};function R_(e){if("number"===typeof e){if(null!=C_[e])return C_[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=I_[e])return I_[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,T_,"ip6zone"],[43,8,"ipcidr"],[53,T_,"dns",!0],[54,T_,"dns4",!0],[55,T_,"dns6",!0],[56,T_,"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,T_,"unix",!1,!0],[421,T_,"ipfs"],[421,T_,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,T_,"garlic64"],[448,0,"tls"],[449,T_,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,T_,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,T_,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);C_[t.code]=t,I_[t.name]=t}));R_("ip4"),R_("ip6"),R_("ipcidr");function x_(e,t){switch(R_(e).code){case 4:case 41:return function(e){const t=k_(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 U_(t);case 6:case 273:case 33:case 132:return L_(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return F_(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function P_(e,t){switch(R_(e).code){case 4:case 41:return O_(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return M_(t);case 6:case 273:case 33:case 132:return B_(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?zc(vc.decode("z".concat(e))).bytes:tl.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=qc.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=B_(r);return Zl([n,i],n.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 n=qc.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=B_(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=N_.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const D_=Object.values(ql).map((e=>e.decoder)),N_=function(){let e=D_[0].or(D_[1]);return D_.slice(2).forEach((t=>e=e.or(t))),e}();function O_(e){if(!su(e))throw new Error("invalid ip address");return A_(e)}function B_(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function L_(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function M_(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}function U_(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function F_(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=L_(n);return"".concat(r,":").concat(i)}function j_(e){return e.map((e=>{const t=Q_(e);return null!=e[1]?[t.code,x_(t.code,e[1])]:[t.code]}))}function z_(e){return W_(Zl(e.map((e=>{const t=Q_(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function K_(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var n;return Jl.decode(t)+(null!==(n=Jl.decode.bytes)&&void 0!==n?n:0)}function q_(e){const t=[];let n=0;for(;n<e.length;){var r;const i=Jl.decode(e,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0,s=K_(R_(i),e.slice(n+o));if(0===s){t.push([i]),n+=o;continue}const a=e.slice(n+o,n+o+s);if(n+=s+o,n>e.length)throw Y_("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([i,a])}return t}function V_(e){return function(e){const t=[];return e.map((e=>{const n=Q_(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),$_(t.join("/"))}(j_(q_(e)))}function H_(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=R_(i);if(0!==o.size){if(r++,r>=n.length)throw Y_("invalid address: "+e);if(!0===o.path){t.push([i,$_(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=$_(e));return z_(t.map((e=>{Array.isArray(e)||(e=[e]);const t=Q_(e);return e.length>1?[t.code,P_(t.code,e[1])]:[t.code]})))}function W_(e){const t=G_(e);if(null!=t)throw t;return Uint8Array.from(e)}function G_(e){try{q_(e)}catch(t){return t}}function $_(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function Y_(e){return new Error("Error parsing address: "+e)}function Q_(e){return R_(e[0])}const X_=Symbol.for("nodejs.util.inspect.custom"),J_=[R_("dns").code,R_("dns4").code,R_("dns6").code,R_("dnsaddr").code],Z_=new Map,eS=Symbol.for("@multiformats/js-multiaddr/multiaddr");function tS(e){return Boolean(null===e||void 0===e?void 0:e[eS])}var nS=new WeakMap,rS=new WeakMap,iS=new WeakMap,oS=new WeakMap;class sS{constructor(e){if(Xa(this,"bytes",void 0),tc(this,nS,{writable:!0,value:void 0}),tc(this,rS,{writable:!0,value:void 0}),tc(this,iS,{writable:!0,value:void 0}),tc(this,oS,{writable:!0,value:void 0}),Xa(this,eS,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=W_(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=H_(e)}else{if(!tS(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=W_(e.bytes)}}toString(){return null==ic(this,nS)&&rc(this,nS,V_(this.bytes)),ic(this,nS)}toJSON(){return this.toString()}toOptions(){let e,t,n,r,i="";const o=R_("tcp"),s=R_("udp"),a=R_("ip4"),c=R_("ip6"),l=R_("dns6"),u=R_("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),J_.includes(h)&&(t=o.name,r=443,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=R_(h).name,r=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=R_(h).name,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==n||null==r)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},R_(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){var r;const i=Jl.decode(t,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0;n+=K_(R_(i),t.slice(n+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==ic(this,rS)&&rc(this,rS,q_(this.bytes)),ic(this,rS)}stringTuples(){return null==ic(this,iS)&&rc(this,iS,j_(this.tuples())),ic(this,iS)}encapsulate(e){return e=new sS(e),new sS(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new sS(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new sS(z_(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===I_.ipfs.code)),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]?Xl(vc.decode("z".concat(e)),"base58btc"):Xl(tl.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===ic(this,oS))try{rc(this,oS,this.stringTuples().filter((e=>!0===R_(e[0]).path))[0][1]),null==ic(this,oS)&&rc(this,oS,null)}catch{rc(this,oS,null)}return ic(this,oS)}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=Z_.get(t.name);if(null==n)throw new sc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new sS(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))}[X_](){return"Multiaddr(".concat(V_(this.bytes),")")}}function aS(e){return new sS(e)}const cS=US("dns4"),lS=US("dns6"),uS=US("dnsaddr"),hS=MS(US("dns"),uS,cS,lS),dS=MS(US("ip4"),US("ip6")),fS=MS(LS(dS,US("tcp")),LS(hS,US("tcp"))),pS=LS(dS,US("udp")),gS=LS(pS,US("utp")),yS=LS(pS,US("quic")),mS=LS(pS,US("quic-v1")),vS=MS(LS(fS,US("ws")),LS(hS,US("ws"))),bS=MS(LS(vS,US("p2p")),vS),wS=MS(LS(fS,US("wss")),LS(hS,US("wss")),LS(fS,US("tls"),US("ws")),LS(hS,US("tls"),US("ws"))),ES=MS(LS(wS,US("p2p")),wS),_S=MS(LS(fS,US("http")),LS(dS,US("http")),LS(hS,US("http"))),SS=MS(LS(fS,US("https")),LS(dS,US("https")),LS(hS,US("https"))),AS=LS(pS,US("webrtc-direct"),US("certhash")),kS=MS(LS(AS,US("p2p")),AS),TS=LS(mS,US("webtransport"),US("certhash"),US("certhash")),IS=MS(LS(TS,US("p2p")),TS),CS=MS(LS(bS,US("p2p-webrtc-star"),US("p2p")),LS(ES,US("p2p-webrtc-star"),US("p2p")),LS(bS,US("p2p-webrtc-star")),LS(ES,US("p2p-webrtc-star"))),RS=(MS(LS(bS,US("p2p-websocket-star"),US("p2p")),LS(ES,US("p2p-websocket-star"),US("p2p")),LS(bS,US("p2p-websocket-star")),LS(ES,US("p2p-websocket-star"))),MS(LS(_S,US("p2p-webrtc-direct"),US("p2p")),LS(SS,US("p2p-webrtc-direct"),US("p2p")),LS(_S,US("p2p-webrtc-direct")),LS(SS,US("p2p-webrtc-direct")))),xS=MS(vS,wS,_S,SS,CS,RS,fS,gS,yS,hS,kS,IS),PS=(MS(LS(xS,US("p2p-stardust"),US("p2p")),LS(xS,US("p2p-stardust"))),MS(LS(xS,US("p2p")),CS,RS,kS,IS,US("p2p"))),DS=MS(LS(PS,US("p2p-circuit"),PS),LS(PS,US("p2p-circuit")),LS(US("p2p-circuit"),PS),LS(xS,US("p2p-circuit")),LS(US("p2p-circuit"),xS),US("p2p-circuit")),NS=()=>MS(LS(DS,NS),DS),OS=NS();MS(LS(OS,PS,OS),LS(PS,OS),LS(OS,PS),OS,PS),MS(LS(OS,US("webrtc"),US("p2p")),LS(OS,US("webrtc")),LS(xS,US("webrtc"),US("p2p")),LS(xS,US("webrtc")),US("webrtc"));function BS(e){return function(t){let n;try{n=aS(t)}catch(i){return!1}const r=e(n.protoNames());return null!==r&&(!0===r||!1===r?r:0===r.length)}}function LS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];function r(e){if(e.length<t.length)return null;let n=e;return t.some((t=>(n="function"===typeof t?t().partialMatch(e):t.partialMatch(e),Array.isArray(n)&&(e=n),null===n))),n}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:BS(r),partialMatch:r}}function MS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];function r(e){let n=null;return t.some((t=>{const r="function"===typeof t?t().partialMatch(e):t.partialMatch(e);return null!=r&&(n=r,!0)})),n}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:BS(r),partialMatch:r}}function US(e){const t=e;return{toString:function(){return t},matches:function(e){let n;try{n=aS(e)}catch(i){return!1}const r=n.protoNames();return 1===r.length&&r[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}const FS=421,jS=290,zS=2e3;function KS(e){return e.filter((e=>{if(e.protoCodes().includes(jS))return!1;const t=e.decapsulateCode(FS);return bS.matches(t)||ES.matches(t)}))}class qS extends Error{constructor(e){super(e),this.name="TimeoutError"}}class VS extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const HS=e=>void 0===globalThis.DOMException?new VS(e):new DOMException(e),WS=e=>{const t=void 0===e.reason?HS("This operation was aborted."):e.reason;return t instanceof Error?t:HS(t)};function GS(e,t){const{milliseconds:n,fallback:r,message:i,customTimers:o={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let s;const a=new Promise(((a,c)=>{if("number"!==typeof n||1!==Math.sign(n))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(n,"`"));if(t.signal){const{signal:e}=t;e.aborted&&c(WS(e)),e.addEventListener("abort",(()=>{c(WS(e))}))}if(n===Number.POSITIVE_INFINITY)return void e.then(a,c);const l=new qS;s=o.setTimeout.call(void 0,(()=>{if(r)try{a(r())}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(n," milliseconds"),c(l))}),n),(async()=>{try{a(await e)}catch(t){c(t)}})()})),c=a.finally((()=>{c.clear()}));return c.clear=()=>{o.clearTimeout.call(void 0,s),s=void 0},c}const $S=Aw("libp2p:websockets:socket");let YS;const QS=Aw("libp2p:websockets");YS=Symbol.toStringTag;class XS{constructor(e){Xa(this,"init",void 0),Xa(this,YS,"@libp2p/websockets"),Xa(this,dE,!0),this.init=e}async dial(e,t){var n;QS("dialing %s",e),t=null!==(n=t)&&void 0!==n?n:{};const r=function(e,t,n){var r;const i={async sink(t){var r;null!=(null===(r=n)||void 0===r?void 0:r.signal)&&(t=Lw(t,n.signal));try{await e.sink(t)}catch(i){"aborted"!==i.type&&$S.error(i)}},source:null!=(n=null!==(r=n)&&void 0!==r?r:{}).signal?Lw(e.source,n.signal):e.source,remoteAddr:t,timeline:{open:Date.now()},async close(){const t=Date.now();try{await GS(e.close(),{milliseconds:zS})}catch(n){const{host:r,port:o}=i.remoteAddr.toOptions();$S("timeout closing stream to %s:%s after %dms, destroying it manually",r,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);QS("new outbound connection %s",r.remoteAddr);const i=await t.upgrader.upgradeOutbound(r);return QS("outbound connection %s upgraded",r.remoteAddr),i}async _connect(e,t){var n;if(!0===(null===t||void 0===t||null===(n=t.signal)||void 0===n?void 0:n.aborted))throw new oc;const r=e.toOptions();QS("dialing %s:%s",r.host,r.port);const i=Ud(),o=e=>{QS.error("connection error:",e),i.reject(e)},s=function(e,t){var n;const r="undefined"===typeof window?"":window.location;t=null!==(n=t)&&void 0!==n?n:{};const i=d_(e,r.toString()),o=new i_(i,t.websocket);return l_(o,t)}(r_(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]),QS("connected %s",e),s;let a;const c=new Promise(((e,n)=>{var r,i;a=()=>{n(new oc),s.close().catch((e=>{QS.error("error closing raw socket",e)}))},!0!==(null===t||void 0===t||null===(r=t.signal)||void 0===r?void 0:r.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 QS("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,n;return e=Array.isArray(e)?e:[e],null!=(null===(t=this.init)||void 0===t?void 0:t.filter)?null===(n=this.init)||void 0===n?void 0:n.filter(e):y_||w_?function(e){return e.filter((e=>{if(e.protoCodes().includes(jS))return!1;const t=e.decapsulateCode(FS);return ES.matches(t)}))}(e):KS(e)}}function JS(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new XS(e)}const ZS=Symbol.for("@libp2p/peer-discovery");var eA=__webpack_require__(7898);function tA(e){return new Uint8Array(eA.keccak256.arrayBuffer(e))}function nA(e,t,n){try{return mb(Mv.fromCompact(e.slice(0,64)),t,n)}catch{return!1}}const rA="Invalid record id",iA=2,oA=iu,sA=ou,aA=function(e){let t=0;if(e=e.toString().trim(),oA(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(sA(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;oA(n[r])&&(e=aA(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},cA=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},lA=-1,uA={},hA={};function dA(e){if("number"===typeof e){if(null!=hA[e])return hA[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=uA[e])return uA[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,lA,"ip6zone"],[43,8,"ipcidr"],[53,lA,"dns",!0],[54,lA,"dns4",!0],[55,lA,"dns6",!0],[56,lA,"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,lA,"unix",!1,!0],[421,lA,"ipfs"],[421,lA,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,lA,"garlic64"],[448,0,"tls"],[449,lA,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,lA,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,lA,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);hA[t.code]=t,uA[t.name]=t}));dA("ip4"),dA("ip6"),dA("ipcidr");function fA(e,t){switch(dA(e).code){case 4:case 41:return function(e){const t=cA(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 EA(t);case 6:case 273:case 33:case 132:return bA(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return _A(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function pA(e,t){switch(dA(e).code){case 4:case 41:return mA(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return wA(t);case 6:case 273:case 33:case 132:return vA(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?zc(vc.decode("z".concat(e))).bytes:tl.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=qc.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=vA(r);return Zl([n,i],n.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 n=qc.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=vA(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=yA.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const gA=Object.values(ql).map((e=>e.decoder)),yA=function(){let e=gA[0].or(gA[1]);return gA.slice(2).forEach((t=>e=e.or(t))),e}();function mA(e){if(!su(e))throw new Error("invalid ip address");return aA(e)}function vA(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function bA(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function wA(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}function EA(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function _A(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=bA(n);return"".concat(r,":").concat(i)}function SA(e){return e.map((e=>{const t=NA(e);return null!=e[1]?[t.code,fA(t.code,e[1])]:[t.code]}))}function AA(e){return RA(Zl(e.map((e=>{const t=NA(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function kA(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var n;return Jl.decode(t)+(null!==(n=Jl.decode.bytes)&&void 0!==n?n:0)}function TA(e){const t=[];let n=0;for(;n<e.length;){var r;const i=Jl.decode(e,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0,s=kA(dA(i),e.slice(n+o));if(0===s){t.push([i]),n+=o;continue}const a=e.slice(n+o,n+o+s);if(n+=s+o,n>e.length)throw DA("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([i,a])}return t}function IA(e){return function(e){const t=[];return e.map((e=>{const n=NA(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),PA(t.join("/"))}(SA(TA(e)))}function CA(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=dA(i);if(0!==o.size){if(r++,r>=n.length)throw DA("invalid address: "+e);if(!0===o.path){t.push([i,PA(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=PA(e));return AA(t.map((e=>{Array.isArray(e)||(e=[e]);const t=NA(e);return e.length>1?[t.code,pA(t.code,e[1])]:[t.code]})))}function RA(e){const t=xA(e);if(null!=t)throw t;return Uint8Array.from(e)}function xA(e){try{TA(e)}catch(t){return t}}function PA(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function DA(e){return new Error("Error parsing address: "+e)}function NA(e){return dA(e[0])}const OA=Symbol.for("nodejs.util.inspect.custom"),BA=[dA("dns").code,dA("dns4").code,dA("dns6").code,dA("dnsaddr").code],LA=new Map,MA=Symbol.for("@multiformats/js-multiaddr/multiaddr");function UA(e){return Boolean(null===e||void 0===e?void 0:e[MA])}var FA=new WeakMap,jA=new WeakMap,zA=new WeakMap,KA=new WeakMap;class qA{constructor(e){if(Xa(this,"bytes",void 0),tc(this,FA,{writable:!0,value:void 0}),tc(this,jA,{writable:!0,value:void 0}),tc(this,zA,{writable:!0,value:void 0}),tc(this,KA,{writable:!0,value:void 0}),Xa(this,MA,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=RA(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=CA(e)}else{if(!UA(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=RA(e.bytes)}}toString(){return null==ic(this,FA)&&rc(this,FA,IA(this.bytes)),ic(this,FA)}toJSON(){return this.toString()}toOptions(){let e,t,n,r,i="";const o=dA("tcp"),s=dA("udp"),a=dA("ip4"),c=dA("ip6"),l=dA("dns6"),u=dA("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),BA.includes(h)&&(t=o.name,r=443,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=dA(h).name,r=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=dA(h).name,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==n||null==r)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},dA(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){var r;const i=Jl.decode(t,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0;n+=kA(dA(i),t.slice(n+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==ic(this,jA)&&rc(this,jA,TA(this.bytes)),ic(this,jA)}stringTuples(){return null==ic(this,zA)&&rc(this,zA,SA(this.tuples())),ic(this,zA)}encapsulate(e){return e=new qA(e),new qA(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new qA(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new qA(AA(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===uA.ipfs.code)),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]?Xl(vc.decode("z".concat(e)),"base58btc"):Xl(tl.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===ic(this,KA))try{rc(this,KA,this.stringTuples().filter((e=>!0===dA(e[0]).path))[0][1]),null==ic(this,KA)&&rc(this,KA,null)}catch{rc(this,KA,null)}return ic(this,KA)}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=LA.get(t.name);if(null==n)throw new sc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new qA(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))}[OA](){return"Multiaddr(".concat(IA(this.bytes),")")}}function VA(e){return new qA(e)}function HA(e,t){switch(t){case"udp":return HA(e,"udp4")||HA(e,"udp6");case"tcp":return HA(e,"tcp4")||HA(e,"tcp6")}const n=t.endsWith("6"),r=e.get(n?"ip6":"ip");if(!r)return;const i=t.slice(0,3);let o;switch(i){case"udp":o=n?e.get("udp6"):e.get("udp");break;case"tcp":o=n?e.get("tcp6"):e.get("tcp");break;default:return}return o?function(e,t,n,r){let i=VA("/"+e+"/"+fA(e,n));return i=i.encapsulate(VA("/"+t+"/"+fA(t,r))),i}(n?"ip6":"ip4",i,r,o):void 0}let WA;const GA=Symbol.for("nodejs.util.inspect.custom"),$A=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),YA=114,QA=36,XA=37;WA=Symbol.toStringTag;class JA{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[WA](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(YA,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:$A,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new ek({multihash:t}):e.startsWith("16U")?new tk({multihash:t}):new ZA({multihash:t})}return function(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===QA)return new ek({multihash:t});if(t.digest.length===XA)return new tk({multihash:t})}if(t.code===Rl.code)return new ZA({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==YA)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new ZA({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===QA)return new ek({multihash:e.multihash});if(t.digest.length===XA)return new tk({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}($A.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[GA](){return"PeerId(".concat(this.toString(),")")}}class ZA extends JA{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class ek extends JA{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class tk extends JA{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function nk(e){return async function(e,t){return e.length===QA?new ek({multihash:jc(Dl.code,e),privateKey:t}):e.length===XA?new tk({multihash:jc(Dl.code,e),privateKey:t}):new ZA({multihash:await Rl.digest(e),publicKey:e,privateKey:t})}(new Fb.secp256k1.Secp256k1PublicKey(e).bytes,void 0)}function rk(e){const t=e.reduce(((e,t)=>e+iA+t.bytes.length),0),n=new Uint8Array(t),r=new DataView(n.buffer);let i=0;return e.forEach((e=>{if(e.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");r.setUint16(i,e.bytes.length),i+=iA,n.set(e.bytes,i),i+=e.bytes.length})),n}function ik(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 ok 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),n=arguments.length>2?arguments[2]:void 0;super(Object.entries(e)),Xa(this,"seq",void 0),Xa(this,"signature",void 0),this.seq=t,this.signature=n}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 $f(e)}get publicKey(){if("v4"===this.id)return this.get("secp256k1");throw new Error(rA)}get ip(){return sk(this,"ip","ip4")}set ip(e){ck(this,"ip","ip4",e)}get tcp(){return ak(this,"tcp","tcp")}set tcp(e){lk(this,"tcp","tcp",e)}get udp(){return ak(this,"udp","udp")}set udp(e){lk(this,"udp","udp",e)}get ip6(){return sk(this,"ip6","ip6")}set ip6(e){ck(this,"ip6","ip6",e)}get tcp6(){return ak(this,"tcp6","tcp")}set tcp6(e){lk(this,"tcp6","tcp",e)}get udp6(){return ak(this,"udp6","udp")}set udp6(e){lk(this,"udp6","udp",e)}get multiaddrs(){const e=this.get("multiaddrs");if(e)return function(e){const t=[];let n=0;for(;n<e.length;){const r=new DataView(e.buffer,n,iA).getUint16(0);n+=iA;const i=e.slice(n,n+r);n+=r,t.push(VA(i))}return t}(e)}set multiaddrs(e){uk(this,"multiaddrs",e,rk)}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){uk(this,"waku2",e,(e=>new Uint8Array([ik(e)])))}}function sk(e,t,n){const r=e.get(t);if(r)return fA(n,r)}function ak(e,t,n){const r=e.get(t);if(r)return Number(fA(n,r))}function ck(e,t,n,r){uk(e,t,r,pA.bind({},n))}function lk(e,t,n,r){ck(e,t,n,null===r||void 0===r?void 0:r.toString(10))}function uk(e,t,n,r){void 0!==n?e.set(t,r(n)):e.delete(t)}const hk=Ju("waku:enr");var dk,fk;!function(e){e.TCP="tcp",e.UDP="udp"}(dk||(dk={})),function(e){e.TCP4="tcp4",e.UDP4="udp4",e.TCP6="tcp6",e.UDP6="udp6"}(fk||(fk={}));class pk extends ok{constructor(){super(...arguments),Xa(this,"peerId",void 0),Xa(this,"getLocationMultiaddr",HA.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 n=new pk(e,t,arguments.length>2?arguments[2]:void 0);try{const e=n.publicKey;e&&(n.peerId=await nk(e))}catch(r){hk("Could not calculate peer id for ENR",r)}return n}get nodeId(){if("v4"===this.id)return this.publicKey?function(e){const t=Ov.fromHex(e).toRawBytes(!1);return Gf(tA(t.slice(1)))}(this.publicKey):void 0;throw new Error(rA)}setLocationMultiaddr(e){const t=e.protoNames();if(2!==t.length&&"udp"!==t[1]&&"tcp"!==t[1])throw new Error("Invalid multiaddr");const n=e.tuples();if(!n[0][1]||!n[1][1])throw new Error("Invalid multiaddr");4===n[0][0]?(this.set("ip",n[0][1]),this.set(t[1],n[1][1])):(this.set("ip6",n[0][1]),this.set(t[1]+"6",n[1][1]))}getAllLocationMultiaddrs(){var e;const t=[];for(const r of Object.values(fk)){const e=this.getLocationMultiaddr(r);e&&t.push(e)}const n=null!==(e=this.multiaddrs)&&void 0!==e?e:[];return t.concat(n)}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(rA);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return nA(t,tA(e),this.publicKey)}async sign(e,t){if("v4"!==this.id)throw new Error(rA);return this.signature=await async function(e,t){return gb(tA(t),e,{der:!1})}(t,e),this.signature}}Xa(pk,"RECORD_PREFIX","enr:");let gk=!1,yk=!1;const mk={debug:1,default:2,info:2,warning:3,error:4,off:5};let vk=mk.default,bk=null;const wk=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){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 Ek,_k;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Ek||(Ek={})),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"}(_k||(_k={}));const Sk="0123456789abcdef";class Ak{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==mk[n]&&this.throwArgumentError("invalid log level name","logLevel",e),vk>mk[n]||console.log.apply(console,t)}debug(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._log(Ak.levels.DEBUG,t)}info(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._log(Ak.levels.INFO,t)}warn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._log(Ak.levels.WARNING,t)}makeError(e,t,n){if(yk)return this.makeError("censored error",t,{});t||(t=Ak.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=Sk[t[e]>>4],n+=Sk[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(s){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push("code=".concat(t)),r.push("version=".concat(this.version));const i=e;let o="";switch(t){case _k.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 _k.CALL_EXCEPTION:case _k.INSUFFICIENT_FUNDS:case _k.MISSING_NEW:case _k.NONCE_EXPIRED:case _k.REPLACEMENT_UNDERPRICED:case _k.TRANSACTION_REPLACED:case _k.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const s=new Error(e);return s.reason=i,s.code=t,Object.keys(n).forEach((function(e){s[e]=n[e]})),s}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,Ak.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),wk&&this.throwError("platform missing String.prototype.normalize",Ak.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:wk})}checkSafeUint53(e,t){"number"===typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Ak.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Ak.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",e<t&&this.throwError("missing argument"+n,Ak.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,Ak.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",Ak.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",Ak.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",Ak.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return bk||(bk=new Ak("logger/5.7.0")),bk}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Ak.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),gk){if(!e)return;this.globalLogger().throwError("error censorship permanent",Ak.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}yk=!!e,gk=!!t}static setLogLevel(e){const t=mk[e.toLowerCase()];null!=t?vk=t:Ak.globalLogger().warn("invalid log level - "+e)}static from(e){return new Ak(e)}}Ak.errors=_k,Ak.levels=Ek;const kk=new Ak("bytes/5.7.0");function Tk(e){return!!e.toHexString}function Ik(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Ik(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Ck(e){return Dk(e)&&!(e.length%2)||xk(e)}function Rk(e){return"number"===typeof e&&e==e&&e%1===0}function xk(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!Rk(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!Rk(n)||n<0||n>=256)return!1}return!0}function Pk(e,t){if(t||(t={}),"number"===typeof e){kk.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),Ik(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Tk(e)&&(e=e.toHexString()),Dk(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":kk.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return Ik(new Uint8Array(r))}return xk(e)?Ik(new Uint8Array(e)):kk.throwArgumentError("invalid arrayify value","value",e)}function Dk(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Nk="0123456789abcdef";function Ok(e,t){if(t||(t={}),"number"===typeof e){kk.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Nk[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),Tk(e))return e.toHexString();if(Dk(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":kk.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(xk(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=Nk[(240&r)>>4]+Nk[15&r]}return t}return kk.throwArgumentError("invalid hexlify value","value",e)}const Bk=new Ak("rlp/5.7.0");function Lk(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Mk(e,t,n){let r=0;for(let i=0;i<n;i++)r=256*r+e[t+i];return r}function Uk(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(Uk(e))})),t.length<=55)return t.unshift(192+t.length),t;const n=Lk(t.length);return n.unshift(247+n.length),n.concat(t)}Ck(e)||Bk.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(Pk(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=Lk(t.length);return n.unshift(183+n.length),n.concat(t)}function Fk(e){return Ok(Uk(e))}function jk(e,t,n,r){const i=[];for(;n<t+1+r;){const o=zk(e,n);i.push(o.result),(n+=o.consumed)>t+1+r&&Bk.throwError("child data too short",Ak.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function zk(e,t){if(0===e.length&&Bk.throwError("data too short",Ak.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&Bk.throwError("data short segment too short",Ak.errors.BUFFER_OVERRUN,{});const r=Mk(e,t+1,n);return t+1+n+r>e.length&&Bk.throwError("data long segment too short",Ak.errors.BUFFER_OVERRUN,{}),jk(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&Bk.throwError("data array too short",Ak.errors.BUFFER_OVERRUN,{}),jk(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&Bk.throwError("data array too short",Ak.errors.BUFFER_OVERRUN,{});const r=Mk(e,t+1,n);t+1+n+r>e.length&&Bk.throwError("data array too short",Ak.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:Ok(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&Bk.throwError("data too short",Ak.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:Ok(e.slice(t+1,t+1+n))}}return{consumed:1,result:Ok(e[t])}}class Kk{static fromString(e){if(!e.startsWith(pk.RECORD_PREFIX))throw new Error("\"string encoded ENR must start with '".concat(pk.RECORD_PREFIX,"'"));return Kk.fromRLP(ru(e.slice(4),"base64url"))}static fromRLP(e){const t=function(e){const t=Pk(e),n=zk(t,0);return n.consumed!==t.length&&Bk.throwArgumentError("invalid rlp data","data",e),n.result}(e).map(Wf);return async function(e){const{signature:t,seq:n,kvs:r}=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,n,...r]=e;if(!t||Array.isArray(t))throw new Error("Decoded ENR invalid signature: must be a byte array");if(!n||Array.isArray(n))throw new Error("Decoded ENR invalid sequence number: must be a byte array");return{signature:t,seq:n,kvs:r}}(e),i={};for(let c=0;c<r.length;c+=2)try{i[$f(r[c])]=r[c+1]}catch(a){(0,Ju.log)("Failed to decode ENR key to UTF-8, skipping it",r[c],a)}const o=function(e){return e.length?BigInt("0x"+Gf(e)):BigInt(0)}(n),s=await pk.create(i,o,t);return function(e,t,n,r){const i=Wf(Fk([e,...t]));if(!n.verify(i,r))throw new Error("Unable to verify ENR signature")}(n,r,s,t),s}(t)}}const qk=/^(\d{1,3}\.){3,3}\d{1,3}$/,Vk=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,Hk={name:"v4",size:4,isFormat:e=>qk.test(e),encode(e,t,n){n=~~n,t=t||new Uint8Array(n+4);const r=e.length;let i=0;for(let o=0;o<r;){const r=e.charCodeAt(o++);46===r?(t[n++]=i,i=0):i=10*i+(r-48)}return t[n]=i,t},decode:(e,t)=>(t=~~t,"".concat(e[t++],".").concat(e[t++],".").concat(e[t++],".").concat(e[t]))},Wk={name:"v6",size:16,isFormat:e=>e.length>0&&Vk.test(e),encode(e,t,n){let r=(n=~~n)+16,i=-1,o=0,s=0,a=!0,c=!1;t=t||new Uint8Array(n+16);for(let l=0;l<e.length;l++){let u=e.charCodeAt(l);58===u?(a?-1!==i?(n<r&&(t[n]=0),n<r-1&&(t[n+1]=0),n+=2):n<r&&(i=n):(!0===c?(n<r&&(t[n]=s),n++):(n<r&&(t[n]=o>>8),n<r-1&&(t[n+1]=255&o),n+=2),o=0,s=0),a=!0,c=!1):46===u?(n<r&&(t[n]=s),n++,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?(n<r&&(t[n]=s),n++):(n<r&&(t[n]=o>>8),n<r-1&&(t[n+1]=255&o),n+=2);else if(0===i)n<r&&(t[n]=0),n<r-1&&(t[n+1]=0),n+=2;else if(-1!==i){n+=2;for(let e=Math.min(n-1,r-1);e>=i+2;e--)t[e]=t[e-2];t[i]=0,t[i+1]=0,i=n}if(i!==n&&-1!==i)for(n>r-2&&(n=r-2);r>i;)t[--r]=n<r&&n>i?t[--n]:0;else for(;n<r;)t[n++]=0;return t},decode(e,t){t=~~t;let n="";for(let r=0;r<16;r+=2)0!==r&&(n+=":"),n+=(e[t+r]<<8|e[t+r+1]).toString(16);return n.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};function Gk(e){if(Hk.isFormat(e))return Hk.size;if(Wk.isFormat(e))return Wk.size;throw Error("Invalid ip address: ".concat(e))}function $k(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 Yk(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 Qk(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 Xk(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 Jk(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 Zk(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 eT(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 tT=55296,nT=56320;function rT(e){let t=0;const n=e.length;for(let r=0;r<n;r+=1){const i=e.charCodeAt(r);if(i<=127)t+=1;else if(i<=2047)t+=2;else if((63488&i)!==tT)t+=3;else{const o=r+1;if(o===n||i>=nT)t+=3;else{(64512&e.charCodeAt(o))!==nT?t+=3:(r=o,t+=4)}}}return t}function iT(e,t,n){const r=e.length;void 0!==n&&null!==n||(n=0),void 0===t&&(t=new Uint8Array(rT(e)+n));let i=n;for(let o=0;o<r;o+=1){let n=e.charCodeAt(o);if(n<=127)t[i++]=n;else if(n<=2047)t[i++]=192|(1984&n)>>6,t[i++]=128|63&n;else if((63488&n)!==tT)t[i++]=224|(61440&n)>>12,t[i++]=128|(4032&n)>>6,t[i++]=128|63&n;else{const s=o+1;if(s===r||n>=nT)t[i++]=239,t[i++]=191,t[i++]=189;else{const r=e.charCodeAt(s);(64512&r)!==nT?(t[i++]=239,t[i++]=191,t[i++]=189):(o=s,n=65536|(1023&n)<<10|1023&r,t[i++]=240|(1835008&n)>>18,t[i++]=128|(258048&n)>>12,t[i++]=128|(4032&n)>>6,t[i++]=128|63&n)}}}return iT.bytes=i-n,t}function oT(e,t,n){let r="";void 0!==t&&null!==t||(t=0),void 0!==n&&null!==n||(n=e.length);for(let i=t;i<n;){const t=e[i++];let n;if(t<=128)n=t;else if(t>191&&t<224)n=(31&t)<<6|63&e[i++];else if(t>239&&t<365){n=((7&t)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536;const o=tT|n>>10&1023;r+=String.fromCharCode(o),n=nT|1023&n}else n=(15&t)<<12|(63&e[i++])<<6|63&e[i++];r+=String.fromCharCode(n)}return oT.bytes=n-t,r}iT.bytes=0,oT.bytes=0;const sT=e=>e instanceof Uint8Array;function aT(e){return"string"===typeof e?rT(e):e.byteLength}function cT(e){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):iT(e)}function lT(e,t,n){if("string"!==typeof t)throw new Error("unknown input type");return iT(t,e,n),iT.bytes}const uT=Math.pow(2,24),hT=Math.pow(2,16),dT=Math.pow(2,8),fT=(e,t)=>e[t]*uT+e[t+1]*hT+e[t+2]*dT+e[t+3],pT=(e,t)=>e[t]<<8|e[t+1],gT=(e,t,n)=>(t=+t,e[n+3]=t,t>>>=8,e[n+2]=t,t>>>=8,e[n+1]=t,t>>>=8,e[n]=t,n+4),yT=(e,t,n)=>(e[n]=t>>8,e[n+1]=255&t,n+2);function mT(e,t,n,r,i){return n<0&&(r-=n,n=0),r<0&&(r=0),i<0?new Uint8Array(0):n>=t.length||r>=i?0:function(e,t,n,r,i){i-r>t.length-n&&(i=r+t.length-n);let o=i-r;const s=e.length-r;o>s&&(o=s);(0!==r||i<e.length)&&(e=new Uint8Array(e.buffer,e.byteOffset+r,o));return t.set(e,n),o}(e,t,n,r,i)}const vT=32768;function bT(e){let{bytes:t=0,encode:n,decode:r,encodingLength:i}=e;return n.bytes=t,r.bytes=t,{encode:n,decode:r,encodingLength:i||(()=>t)}}const wT=bT({encode(e,t,n){t||(t=new Uint8Array(wT.encodingLength(e))),n||(n=0);const r=n,i=e.replace(/^\.|\.$/gm,"");if(i.length){const e=i.split(".");for(let r=0;r<e.length;r++){const i=lT(t,e[r],n+1);t[n]=i,n+=i+1}}return t[n++]=0,wT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n=[];let r=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)");n.push(oT(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 n=pT(e,t-1)-49152;if(n>=r)throw new Error("Cannot decode name (bad pointer)");t=n,r=n,o+=s?0:1,s=!0}}}return wT.decode.bytes=o,0===n.length?".":n.join(".")},encodingLength:e=>"."===e||".."===e?1:aT(e.replace(/^\.|\.$/gm,""))+2}),ET=bT({encode(e,t,n){t||(t=new Uint8Array(ET.encodingLength(e))),n||(n=0);const r=lT(t,e,n+1);return t[n]=r,ET.encode.bytes=r+1,t},decode(e,t){t||(t=0);const n=e[t],r=oT(e,t+1,t+1+n);return ET.decode.bytes=n+1,r},encodingLength:e=>aT(e)+1}),_T=bT({bytes:12,encode(e,t,n){t||(t=new Uint8Array(_T.encodingLength(e))),n||(n=0);const r=32767&(e.flags||0),i="response"===e.type?32768:0;return yT(t,e.id||0,n),yT(t,r|i,n+2),yT(t,e.questions.length,n+4),yT(t,e.answers.length,n+6),yT(t,e.authorities.length,n+8),yT(t,e.additionals.length,n+10),t},decode(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const n=pT(e,t+2);return{id:pT(e,t),type:32768&n?"response":"query",flags:32767&n,flag_qr:1===(n>>15&1),opcode:Xk(n>>11&15),flag_aa:1===(n>>10&1),flag_tc:1===(n>>9&1),flag_rd:1===(n>>8&1),flag_ra:1===(n>>7&1),flag_z:1===(n>>6&1),flag_ad:1===(n>>5&1),flag_cd:1===(n>>4&1),rcode:Qk(15&n),questions:new Array(pT(e,t+4)),answers:new Array(pT(e,t+6)),authorities:new Array(pT(e,t+8)),additionals:new Array(pT(e,t+10))}},encodingLength:()=>12}),ST=bT({encode(e,t,n){t||(t=new Uint8Array(ST.encodingLength(e))),n||(n=0);const r=e.length;return yT(t,r,n),mT(e,t,n+2,0,r),ST.encode.bytes=r+2,t},decode(e,t){t||(t=0);const n=pT(e,t),r=e.slice(t+2,t+2+n);return ST.decode.bytes=n+2,r},encodingLength:e=>e.length+2}),AT=bT({encode:(e,t,n)=>(t||(t=new Uint8Array(AT.encodingLength(e))),n||(n=0),wT.encode(e,t,n+2),yT(t,wT.encode.bytes,n),AT.encode.bytes=wT.encode.bytes+2,t),decode(e,t){t||(t=0);const n=pT(e,t),r=wT.decode(e,t+2);return AT.decode.bytes=n+2,r},encodingLength:e=>wT.encodingLength(e)+2}),kT=bT({encode(e,t,n){t||(t=new Uint8Array(kT.encodingLength(e))),n||(n=0);const r=n;return n+=2,wT.encode(e.mname,t,n),n+=wT.encode.bytes,wT.encode(e.rname,t,n),n+=wT.encode.bytes,gT(t,e.serial||0,n),n+=4,gT(t,e.refresh||0,n),n+=4,gT(t,e.retry||0,n),n+=4,gT(t,e.expire||0,n),n+=4,gT(t,e.minimum||0,n),yT(t,(n+=4)-r-2,r),kT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n=t,r={};return t+=2,r.mname=wT.decode(e,t),t+=wT.decode.bytes,r.rname=wT.decode(e,t),t+=wT.decode.bytes,r.serial=fT(e,t),t+=4,r.refresh=fT(e,t),t+=4,r.retry=fT(e,t),t+=4,r.expire=fT(e,t),t+=4,r.minimum=fT(e,t),t+=4,kT.decode.bytes=t-n,r},encodingLength:e=>22+wT.encodingLength(e.mname)+wT.encodingLength(e.rname)}),TT=bT({encode(e,t,n){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)if("string"===typeof e[i]&&(e[i]=cT(e[i])),!sT(e[i]))throw new Error("Must be a Buffer");t||(t=new Uint8Array(TT.encodingLength(e))),n||(n=0);const r=n;return n+=2,e.forEach((function(e){t[n++]=e.length,mT(e,t,n,0,e.length),n+=e.length})),yT(t,n-r-2,r),TT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n=t;let r=pT(e,t);t+=2;const i=[];for(;r>0;){const n=e[t++];if(--r,r<n)throw new Error("Buffer overflow");i.push(e.slice(t,t+n)),t+=n,r-=n}return TT.decode.bytes=t-n,i},encodingLength(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach((function(e){t+="string"===typeof e?aT(e)+1:e.length+1})),t}}),IT=bT({encode(e,t,n){t||(t=new Uint8Array(IT.encodingLength(e))),n||(n=0),"string"===typeof e&&(e=cT(e)),e||(e=new Uint8Array(0));const r=n;n+=2;const i=e.length;return mT(e,t,n,0,i),yT(t,(n+=i)-r-2,r),IT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n=t,r=pT(e,t);t+=2;const i=e.slice(t,t+r);return t+=r,IT.decode.bytes=t-n,i},encodingLength:e=>e?(sT(e)?e.length:aT(e))+2:2}),CT=bT({encode(e,t,n){t||(t=new Uint8Array(CT.encodingLength(e))),n||(n=0);const r=n;return n+=2,ET.encode(e.cpu,t,n),n+=ET.encode.bytes,ET.encode(e.os,t,n),n+=ET.encode.bytes,yT(t,n-r-2,r),CT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n=t,r={};return t+=2,r.cpu=ET.decode(e,t),t+=ET.decode.bytes,r.os=ET.decode(e,t),t+=ET.decode.bytes,CT.decode.bytes=t-n,r},encodingLength:e=>ET.encodingLength(e.cpu)+ET.encodingLength(e.os)+2}),RT=bT({encode:(e,t,n)=>(t||(t=new Uint8Array(RT.encodingLength(e))),n||(n=0),wT.encode(e,t,n+2),yT(t,wT.encode.bytes,n),RT.encode.bytes=wT.encode.bytes+2,t),decode(e,t){t||(t=0);const n=wT.decode(e,t+2);return RT.decode.bytes=wT.decode.bytes+2,n},encodingLength:e=>wT.encodingLength(e)+2}),xT=bT({encode(e,t,n){t||(t=new Uint8Array(xT.encodingLength(e))),n||(n=0),yT(t,e.priority||0,n+2),yT(t,e.weight||0,n+4),yT(t,e.port||0,n+6),wT.encode(e.target,t,n+8);const r=wT.encode.bytes+6;return yT(t,r,n),xT.encode.bytes=r+2,t},decode(e,t){t||(t=0);const n=pT(e,t),r={};return r.priority=pT(e,t+2),r.weight=pT(e,t+4),r.port=pT(e,t+6),r.target=wT.decode(e,t+8),xT.decode.bytes=n+2,r},encodingLength:e=>8+wT.encodingLength(e.target)}),PT=bT({encode(e,t,n){const r=PT.encodingLength(e);return t||(t=new Uint8Array(PT.encodingLength(e))),n||(n=0),e.issuerCritical&&(e.flags=PT.ISSUER_CRITICAL),yT(t,r-2,n),t[n+=2]=e.flags||0,n+=1,ET.encode(e.tag,t,n),n+=ET.encode.bytes,lT(t,e.value,n),n+=aT(e.value),PT.encode.bytes=r,t},decode(e,t){t||(t=0);const n=pT(e,t),r=t+=2,i={};return i.flags=e[t],t+=1,i.tag=ET.decode(e,t),t+=ET.decode.bytes,i.value=oT(e,t,r+n),i.issuerCritical=!!(i.flags&PT.ISSUER_CRITICAL),PT.decode.bytes=n+2,i},encodingLength:e=>ET.encodingLength(e.tag)+ET.encodingLength(e.value)+2});PT.ISSUER_CRITICAL=128;const DT=bT({encode(e,t,n){t||(t=new Uint8Array(DT.encodingLength(e))),n||(n=0);const r=n;return n+=2,yT(t,e.preference||0,n),n+=2,wT.encode(e.exchange,t,n),n+=wT.encode.bytes,yT(t,n-r-2,r),DT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n=t,r={};return t+=2,r.preference=pT(e,t),t+=2,r.exchange=wT.decode(e,t),t+=wT.decode.bytes,DT.decode.bytes=t-n,r},encodingLength:e=>4+wT.encodingLength(e.exchange)}),NT=bT({encode:(e,t,n)=>(t||(t=new Uint8Array(NT.encodingLength(e))),n||(n=0),yT(t,4,n),n+=2,Hk.encode(e,t,n),t),decode(e,t){t||(t=0),t+=2;return Hk.decode(e,t)},bytes:6}),OT=bT({encode:(e,t,n)=>(t||(t=new Uint8Array(OT.encodingLength(e))),n||(n=0),yT(t,16,n),n+=2,Wk.encode(e,t,n),OT.encode.bytes=18,t),decode(e,t){t||(t=0),t+=2;const n=Wk.decode(e,t);return OT.decode.bytes=18,n},bytes:18}),BT=e=>new Uint8Array(e),LT=bT({encode(e,t,n){t||(t=new Uint8Array(LT.encodingLength(e))),n||(n=0);const r=n,i=eT(e.code);if(yT(t,i,n),n+=2,e.data)yT(t,e.data.length,n),n+=2,mT(e.data,t,n),n+=e.data.length;else switch(i){case 8:{const r=e.sourcePrefixLength||0,i=e.family||function(e){return Gk(e)===Hk.size?1:2}(e.ip),o=function(e,t,n){n=~~n;const r=Gk(e);return"function"===typeof t&&(t=t(n+r)),r===Hk.size?Hk.encode(e,t,n):Wk.encode(e,t,n)}(e.ip,BT),s=Math.ceil(r/8);yT(t,s+4,n),yT(t,i,n+=2),n+=2,t[n++]=r,t[n++]=e.scopePrefixLength||0,mT(o,t,n,0,s),n+=s}break;case 11:e.timeout?(yT(t,2,n),n+=2,yT(t,e.timeout,n),n+=2):(yT(t,0,n),n+=2);break;case 12:{const r=e.length||0;yT(t,r,n),n+=2,t.fill(0,n,n+r),n+=r}break;case 14:{const r=2*e.tags.length;yT(t,r,n),n+=2;for(const i of e.tags)yT(t,i,n),n+=2}break;default:throw new Error("Unknown roption code: ".concat(e.code))}return LT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n={};n.code=pT(e,t),n.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)}(n.code);const r=pT(e,t+=2);switch(t+=2,n.data=e.slice(t,t+r),n.code){case 8:n.family=pT(e,t),t+=2,n.sourcePrefixLength=e[t++],n.scopePrefixLength=e[t++];{const i=new Uint8Array(1===n.family?4:16);mT(e,i,0,t,t+r-4),n.ip=function(e,t,n){if(t=~~t,(n=n||e.length-t)===Hk.size)return Hk.decode(e,t,n);if(n===Wk.size)return Wk.decode(e,t,n);throw Error("Invalid buffer size needs to be ".concat(Hk.size," for v4 or ").concat(Wk.size," for v6."))}(i)}break;case 11:r>0&&(n.timeout=pT(e,t),t+=2);break;case 14:n.tags=[];for(let i=0;i<r;i+=2)n.tags.push(pT(e,t)),t+=2}return LT.decode.bytes=r+4,n},encodingLength(e){if(e.data)return e.data.length+4;switch(eT(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))}}),MT=bT({encode(e,t,n){t||(t=new Uint8Array(MT.encodingLength(e))),n||(n=0);const r=n,i=nI(e,LT);return yT(t,i,n),n=rI(e,LT,t,n+2),MT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n=t,r=[];let i=pT(e,t);t+=2;let o=0;for(;i>0;)r[o++]=LT.decode(e,t),t+=LT.decode.bytes,i-=LT.decode.bytes;return MT.decode.bytes=t-n,r},encodingLength:e=>2+nI(e||[],LT)}),UT=bT({encode(e,t,n){t||(t=new Uint8Array(UT.encodingLength(e))),n||(n=0);const r=n,i=e.key;if(!sT(i))throw new Error("Key must be a Buffer");return n+=2,yT(t,e.flags,n),t[n+=2]=UT.PROTOCOL_DNSSEC,t[n+=1]=e.algorithm,mT(i,t,n+=1,0,i.length),n+=i.length,UT.encode.bytes=n-r,yT(t,UT.encode.bytes-2,r),t},decode(e,t){t||(t=0);const n=t,r={},i=pT(e,t);if(t+=2,r.flags=pT(e,t),e[t+=2]!==UT.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,r.algorithm=e[t],t+=1,r.key=e.slice(t,n+i+2),t+=r.key.length,UT.decode.bytes=t-n,r},encodingLength:e=>6+aT(e.key)});UT.PROTOCOL_DNSSEC=3,UT.ZONE_KEY=128,UT.SECURE_ENTRYPOINT=32768;const FT=bT({encode(e,t,n){t||(t=new Uint8Array(FT.encodingLength(e))),n||(n=0);const r=n,i=e.signature;if(!sT(i))throw new Error("Signature must be a Buffer");return n+=2,yT(t,Yk(e.typeCovered),n),t[n+=2]=e.algorithm,t[n+=1]=e.labels,n+=1,gT(t,e.originalTTL,n),n+=4,gT(t,e.expiration,n),n+=4,gT(t,e.inception,n),n+=4,yT(t,e.keyTag,n),n+=2,wT.encode(e.signersName,t,n),mT(i,t,n+=wT.encode.bytes,0,i.length),n+=i.length,FT.encode.bytes=n-r,yT(t,FT.encode.bytes-2,r),t},decode(e,t){t||(t=0);const n=t,r={},i=pT(e,t);return t+=2,r.typeCovered=$k(pT(e,t)),t+=2,r.algorithm=e[t],t+=1,r.labels=e[t],t+=1,r.originalTTL=fT(e,t),t+=4,r.expiration=fT(e,t),t+=4,r.inception=fT(e,t),t+=4,r.keyTag=pT(e,t),t+=2,r.signersName=wT.decode(e,t),t+=wT.decode.bytes,r.signature=e.slice(t,n+i+2),t+=r.signature.length,FT.decode.bytes=t-n,r},encodingLength:e=>20+wT.encodingLength(e.signersName)+aT(e.signature)}),jT=bT({encode(e,t,n){t||(t=new Uint8Array(jT.encodingLength(e))),n||(n=0);const r=n;return n+=2,wT.encode(e.mbox||".",t,n),n+=wT.encode.bytes,wT.encode(e.txt||".",t,n),n+=wT.encode.bytes,jT.encode.bytes=n-r,yT(t,jT.encode.bytes-2,r),t},decode(e,t){t||(t=0);const n=t,r={};return t+=2,r.mbox=wT.decode(e,t)||".",t+=wT.decode.bytes,r.txt=wT.decode(e,t)||".",t+=wT.decode.bytes,jT.decode.bytes=t-n,r},encodingLength:e=>2+wT.encodingLength(e.mbox||".")+wT.encodingLength(e.txt||".")}),zT=bT({encode(e,t,n){t||(t=new Uint8Array(zT.encodingLength(e))),n||(n=0);const r=n,i=[];for(let o=0;o<e.length;o++){const t=Yk(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=cT(i[o]);t[n]=o,t[n+=1]=e.length,mT(e,t,n+=1,0,e.length),n+=e.length}return zT.encode.bytes=n-r,t},decode(e,t,n){t||(t=0);const r=t,i=[];for(;t-r<n;){const n=e[t],r=e[t+=1];t+=1;for(let o=0;o<r;o++){const r=e[t+o];for(let e=0;e<8;e++)if(r&1<<7-e){const t=$k(n<<8|o<<3|e);i.push(t)}}t+=r}return zT.decode.bytes=t-r,i},encodingLength(e){const t=[];for(let r=0;r<e.length;r++){const n=Yk(e[r]);t[n>>8]=Math.max(t[n>>8]||0,255&n)}let n=0;for(let r=0;r<t.length;r++)void 0!==t[r]&&(n+=2+Math.ceil((t[r]+1)/8));return n}}),KT=bT({encode(e,t,n){t||(t=new Uint8Array(KT.encodingLength(e))),n||(n=0);const r=n;return n+=2,wT.encode(e.nextDomain,t,n),n+=wT.encode.bytes,zT.encode(e.rrtypes,t,n),n+=zT.encode.bytes,KT.encode.bytes=n-r,yT(t,KT.encode.bytes-2,r),t},decode(e,t){t||(t=0);const n=t,r={},i=pT(e,t);return t+=2,r.nextDomain=wT.decode(e,t),t+=wT.decode.bytes,r.rrtypes=zT.decode(e,t,i-(t-n)),t+=zT.decode.bytes,KT.decode.bytes=t-n,r},encodingLength:e=>2+wT.encodingLength(e.nextDomain)+zT.encodingLength(e.rrtypes)}),qT=bT({encode(e,t,n){t||(t=new Uint8Array(qT.encodingLength(e))),n||(n=0);const r=n,i=e.salt;if(!sT(i))throw new Error("salt must be a Buffer");const o=e.nextDomain;if(!sT(o))throw new Error("nextDomain must be a Buffer");return t[n+=2]=e.algorithm,t[n+=1]=e.flags,n+=1,yT(t,e.iterations,n),t[n+=2]=i.length,mT(i,t,n+=1,0,i.length),t[n+=i.length]=o.length,mT(o,t,n+=1,0,o.length),n+=o.length,zT.encode(e.rrtypes,t,n),n+=zT.encode.bytes,qT.encode.bytes=n-r,yT(t,qT.encode.bytes-2,r),t},decode(e,t){t||(t=0);const n=t,r={},i=pT(e,t);t+=2,r.algorithm=e[t],t+=1,r.flags=e[t],t+=1,r.iterations=pT(e,t);const o=e[t+=2];t+=1,r.salt=e.slice(t,t+o);const s=e[t+=o];return t+=1,r.nextDomain=e.slice(t,t+s),t+=s,r.rrtypes=zT.decode(e,t,i-(t-n)),t+=zT.decode.bytes,qT.decode.bytes=t-n,r},encodingLength:e=>8+e.salt.length+e.nextDomain.length+zT.encodingLength(e.rrtypes)}),VT=bT({encode(e,t,n){t||(t=new Uint8Array(VT.encodingLength(e))),n||(n=0);const r=n,i=e.digest;if(!sT(i))throw new Error("Digest must be a Buffer");return n+=2,yT(t,e.keyTag,n),t[n+=2]=e.algorithm,t[n+=1]=e.digestType,mT(i,t,n+=1,0,i.length),n+=i.length,VT.encode.bytes=n-r,yT(t,VT.encode.bytes-2,r),t},decode(e,t){t||(t=0);const n=t,r={},i=pT(e,t);return t+=2,r.keyTag=pT(e,t),t+=2,r.algorithm=e[t],t+=1,r.digestType=e[t],t+=1,r.digest=e.slice(t,n+i+2),t+=r.digest.length,VT.decode.bytes=t-n,r},encodingLength:e=>6+aT(e.digest)});function HT(e){switch(e.toUpperCase()){case"A":return NT;case"PTR":case"CNAME":case"DNAME":return RT;case"TXT":return TT;case"NULL":return IT;case"AAAA":return OT;case"SRV":return xT;case"HINFO":return CT;case"CAA":return PT;case"NS":return AT;case"SOA":return kT;case"MX":return DT;case"OPT":return MT;case"DNSKEY":return UT;case"RRSIG":return FT;case"RP":return jT;case"NSEC":return KT;case"NSEC3":return qT;case"DS":return VT}return ST}const WT=bT({encode(e,t,n){t||(t=new Uint8Array(WT.encodingLength(e))),n||(n=0);const r=n;if(wT.encode(e.name,t,n),n+=wT.encode.bytes,yT(t,Yk(e.type),n),"OPT"===e.type.toUpperCase()){if("."!==e.name)throw new Error("OPT name must be root.");yT(t,e.udpPayloadSize||4096,n+2),t[n+4]=e.extendedRcode||0,t[n+5]=e.ednsVersion||0,yT(t,e.flags||0,n+6),n+=8,MT.encode(e.options||[],t,n),n+=MT.encode.bytes}else{let r=Zk(void 0===e.class?"IN":e.class);e.flush&&(r|=vT),yT(t,r,n+2),gT(t,e.ttl||0,n+4),n+=8;const i=HT(e.type);i.encode(e.data,t,n),n+=i.encode.bytes}return WT.encode.bytes=n-r,t},decode(e,t){t||(t=0);const n={},r=t;if(n.name=wT.decode(e,t),t+=wT.decode.bytes,n.type=$k(pT(e,t)),"OPT"===n.type)n.udpPayloadSize=pT(e,t+2),n.extendedRcode=e[t+4],n.ednsVersion=e[t+5],n.flags=pT(e,t+6),n.flag_do=1===(n.flags>>15&1),n.options=MT.decode(e,t+8),t+=8+MT.decode.bytes;else{const r=pT(e,t+2);n.ttl=fT(e,t+4),n.class=Jk(-32769&r),n.flush=!!(r&vT);const i=HT(n.type);n.data=i.decode(e,t+8),t+=8+i.decode.bytes}return WT.decode.bytes=t-r,n},encodingLength(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return wT.encodingLength(e.name)+8+HT(e.type).encodingLength(t)}}),GT=bT({encode(e,t,n){t||(t=new Uint8Array(GT.encodingLength(e))),n||(n=0);const r=n;return wT.encode(e.name,t,n),n+=wT.encode.bytes,yT(t,Yk(e.type),n),n+=2,yT(t,Zk(void 0===e.class?"IN":e.class),n),n+=2,GT.encode.bytes=n-r,e},decode(e,t){t||(t=0);const n=t,r={};r.name=wT.decode(e,t),t+=wT.decode.bytes,r.type=$k(pT(e,t)),t+=2,r.class=Jk(pT(e,t)),t+=2;return!!(32768&r.class)&&(r.class&=-32769),GT.decode.bytes=t-n,r},encodingLength:e=>wT.encodingLength(e.name)+4}),$T=256,YT={encode:function(e,t,n){const r=!t;r&&(t=new Uint8Array(tI(e))),n||(n=0);const i=n;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),_T.encode(e,t,n),n+=_T.encode.bytes,n=rI(e.questions,GT,t,n),n=rI(e.answers,WT,t,n),n=rI(e.authorities,WT,t,n),n=rI(e.additionals,WT,t,n),YT.encode.bytes=n-i,r&&ZT.bytes!==t.length?t.slice(0,ZT.bytes):t},decode:function(e,t){t||(t=0);const n=t,r=_T.decode(e,t);return t+=_T.decode.bytes,t=iI(r.questions,GT,e,t),t=iI(r.answers,WT,e,t),t=iI(r.authorities,WT,e,t),t=iI(r.additionals,WT,e,t),YT.decode.bytes=t-n,r},encodingLength:function(e){return _T.encodingLength(e)+nI(e.questions||[],GT)+nI(e.answers||[],WT)+nI(e.authorities||[],WT)+nI(e.additionals||[],WT)}};function QT(e,t){if(e.questions)throw new Error("Only one .question object expected instead of a .questions array!");const n=Object.assign({type:t},e);return n.question&&(n.questions=[n.question],delete n.question),n}YT.encode.bytes=0,YT.decode.bytes=0;const XT={encode:function(e,t,n){return t=YT.encode(QT(e,"query"),t,n),XT.encode.bytes=YT.encode.bytes,t},decode:function(e,t){const n=YT.decode(e,t);return XT.decode.bytes=YT.decode.bytes,n.questions&&(n.question=n.questions[0],delete n.questions),n},encodingLength:function(e){return YT.encodingLength(QT(e,"query"))}};XT.encode.bytes=0,XT.decode.bytes=0;const JT={encode:function(e,t,n){return t=YT.encode(QT(e,"response"),t,n),JT.encode.bytes=YT.encode.bytes,t},decode:function(e,t){const n=YT.decode(e,t);return JT.decode.bytes=YT.decode.bytes,n.questions&&(n.question=n.questions[0],delete n.questions),n},encodingLength:function(e){return YT.encodingLength(QT(e,"response"))}};JT.encode.bytes=0,JT.decode.bytes=0;const ZT=YT.encode,eI=YT.decode,tI=YT.encodingLength;function nI(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t.encodingLength(e[r]);return n}function rI(e,t,n,r){for(let i=0;i<e.length;i++)t.encode(e[i],n,r),r+=t.encode.bytes;return r}function iI(e,t,n,r){for(let i=0;i<e.length;i++)e[i]=t.decode(n,r),r+=t.decode.bytes;return r}const oI=1;function sI(e,t,n,r){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=n.charCodeAt(0),a={name:e,encodingLength(e){const t=e.length,n=.75*t|0;return e.charCodeAt(t-1)===s?e.charCodeAt(t-2)===s?n-2:n-1:n},encode(e,t,n){null!==t&&void 0!==t||(t=new Uint8Array(a.encodingLength(e))),null!==n&&void 0!==n||(n=0);let r=e.length;e.charCodeAt(r-1)===s&&(e.charCodeAt(r-2)===s?r-=2:r-=1);const o=r%4,c=r-o;let l=n,u=0;for(;u<c;){const n=i[e.charCodeAt(u)]<<18|i[e.charCodeAt(u+1)]<<12|i[e.charCodeAt(u+2)]<<6|i[e.charCodeAt(u+3)];t[l++]=n>>16,t[l++]=n>>8,t[l++]=n,u+=4}if(3===o){const n=i[e.charCodeAt(u)]<<10|i[e.charCodeAt(u+1)]<<4|i[e.charCodeAt(u+2)]>>2;t[l++]=n>>8,t[l++]=n}else 2===o&&(t[l++]=i[e.charCodeAt(u)]<<2|i[e.charCodeAt(u+1)]>>4);return a.encode.bytes=l-n,t},decode(e,t,n){null!==t&&void 0!==t||(t=0),null!==n&&void 0!==n||(n=e.length);const i=n-t,c=i%3,l=t+i-c,u=[];for(let r=t;r<l;r+=3){const t=e[r]<<16|e[r+1]<<8|e[r+2];u.push(o[t>>18&63],o[t>>12&63],o[t>>6&63],o[63&t])}if(2===c){const t=(e[n-2]<<8)+e[n-1];u.push(o[t>>10],o[t>>4&63],o[t<<2&63]),r===oI&&u.push(s)}else if(1===c){const t=e[n-1];u.push(o[t>>2],o[t<<4&63]),r===oI&&u.push(s,s)}return a.decode.bytes=i,String.fromCharCode.apply(String,u)}};return a}sI("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",oI);const aI=sI("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",2);let cI="undefined"!==typeof global?global.AbortError:"undefined"!==typeof window?window.AbortError:null;cI||(cI=class extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Request aborted.")}}),cI.prototype.name="AbortError",cI.prototype.code="ABORT_ERR";const lI="undefined"!==typeof globalThis&&globalThis.URL||require("url").URL;class uI extends Error{constructor(e,t,n){super("status="+t+" while requesting "+e+" ["+n+"]"),this.uri=e,this.status=t,this.method=n}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}uI.prototype.name="HTTPStatusError",uI.prototype.code="HTTP_STATUS";class hI extends Error{constructor(e,t){super(e),this.cause=t}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:gI(this.cause)}}}hI.prototype.name="ResponseError",hI.prototype.code="RESPONSE_ERR";class dI extends Error{constructor(e){super("Timeout (t="+e+")."),this.timeout=e}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}dI.prototype.name="TimeoutError",dI.prototype.code="ETIMEOUT";const fI=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,pI=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function gI(e){if("string"===typeof e)return{message:e};try{const t=JSON.stringify(e);if("{}"!==t)return JSON.parse(t)}catch(n){}const t={message:String(e.message||e)};return void 0!==e.code&&(t.code=String(e.code)),t}const yI=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,mI=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/gi,vI=/\[(((pk|name)=([^\]]+)))\]/gi;function bI(e,t){t.lastIndex=0;const n={};for(;;){const r=t.exec(e);if(!r)break;r[2]?n[r[3].toLowerCase()]=r[4]:n[r[1].toLowerCase()]=!0}return n}class wI extends Error{constructor(e,t){super('Invalid Endpoint: unsupported protocol "'.concat(e,'" for endpoint: ').concat(t,", supported protocols: ").concat(EI.join(", "))),this.protocol=e,this.endpoint=t}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}wI.prototype.name="InvalidProtocolError",wI.prototype.code="EPROTOCOL";const EI=["http:","https:","udp4:","udp6:"];class _I{constructor(e,t){this.name=e.name||null,this.protocol=e.protocol;const n="string"===typeof e.port?e.port=parseInt(e.port,10):e.port;if(void 0===n||null===n)this.port=t?"https:"===this.protocol?443:80:e.pk?443:53;else{if("number"!==typeof n&&!isNaN(n))throw new Error('Invalid Endpoint: port "'.concat(e.port,'" needs to be a number: ').concat(JSON.stringify(e)));this.port=n}}toJSON(){return this.toString()}}class SI extends _I{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,"]"):"",n=this.name?" [name=".concat(this.name,"]"):"";return"udp://".concat(this.ipv4||"[".concat(this.ipv6,"]")).concat(e).concat(t).concat(n)}}class AI extends SI{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 kI extends SI{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 TI(e){return pI.test(e)&&!fI.test(e)?"[".concat(e,"]"):e}class II extends _I{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=pI.exec(this.host);e&&(this.ipv6=e[1])}this.ipv4||fI.test(this.host)&&(this.ipv4=this.host);const t="".concat(this.protocol,"//").concat(TI(this.host),":").concat(this.port).concat(this.path);try{this.url=new lI(t)}catch(n){throw new Error(n.message+" [".concat(t,"]"))}}toString(){const e="https:"===this.protocol?"":"http://",t=this.port!==("https:"===this.protocol?443:80)?":".concat(this.port):"",n="GET"!==this.method?" [post]":"",r="/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(TI(this.host)).concat(t).concat(r).concat(n).concat(o).concat(s).concat(i)}}function CI(e){let t;if("string"===typeof e)t=function(e){const t=yI.exec(e),n=t[2]||"https:",r=t[3],i=t[5],o=t[6],s=t[7];if("https:"===n||"http:"===n){const e=bI(s,mI);return{name:e.name,protocol:n,ipv4:e.ipv4,ipv6:e.ipv6,host:r,port:i,path:o,method:e.post?"POST":"GET"}}if("udp:"===n||"udp4:"===n||"udp6:"===n){const t=bI(s,vI),o=/^\[(.*)\]$/.exec(r);if(o&&"udp4:"===n)throw new Error("Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=".concat(e,")"));if(!o&&"udp6:"===n)throw new Error("Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=".concat(e,")"));return o?new kI({protocol:"udp6:",ipv6:o[1],port:i,pk:t.pk,name:t.name}):new AI({protocol:"udp4:",ipv4:r,port:i,pk:t.pk,name:t.name})}throw new wI(n,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 _I)return e;t=e}null!==t.protocol&&void 0!==t.protocol||(t.protocol="https:");const n=t.protocol;if("udp4:"===n)return new AI(t);if("udp6:"===n)return new kI(t);if("https:"===n||"http:"===n)return new II(t);throw new wI(n,JSON.stringify(t))}const RI="application/dns-message";function xI(){}function PI(e,t,n,r,i){return new Promise(((o,s)=>{const a=new lI(e);"GET"===t&&n&&(a.search="?dns="+aI.decode(n));const c=a.toString(),l=new XMLHttpRequest;l.open(t,c,!0),l.setRequestHeader("Accept",RI),"POST"===t&&l.setRequestHeader("Content-Type",RI),l.responseType="arraybuffer",l.timeout=r,l.ontimeout=function(){u(new dI(r));try{l.abort()}catch(e){}},l.onreadystatechange=function(){if(l.readyState>1&&200!==l.status&&0!==l.status){u(new uI(c,l.status,t));try{l.abort()}catch(e){}}},l.onerror=function(){u(200===l.status?new Error("Inexplicable XHR Error"):new uI(c,l.status,t))},l.onload=function(){if(200!==l.status)u(new uI(c,l.status,t));else{let e;if("string"===typeof l.response)e=iT(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(n):l.send(),i&&i.addEventListener("abort",h);let u=function(e,t){u=xI,i&&i.removeEventListener("abort",h),o(e?{error:e,response:l}:{data:t,response:l})};function h(){u(new cI);try{l.abort()}catch(e){}}}))}class DI extends Error{constructor(e,t){super("".concat(DNS_RCODE_MESSAGE[e]||"Undefined error."," (rcode=").concat(e).concat(DNS_RCODE_ERROR[e]?", error=".concat(DNS_RCODE_ERROR[e]):"",", question=").concat(JSON.stringify(t),")")),this.rcode=e,this.code="DNS_RCODE_".concat(e),this.error=DNS_RCODE_ERROR[e],this.question=t}toJSON(){return{code:this.code,error:this.error,question:this.question,endpoint:this.endpoint}}}function NI(e){const t=null===e.time||void 0===e.time?Date.now():e.time,n=function(e){return e.filter((e=>e.cors||e.endpoint.cors))}(e.data.map((e=>(e.endpoint=CI(Object.assign({name:e.name},e.endpoint)),e)))),r=n.map((e=>e.endpoint));return{data:{resolvers:n,resolverByName:n.reduce(((e,t)=>(e[t.name]=t,e)),{}),endpoints:r,endpointByName:r.reduce(((e,t)=>(e[t.name]=t,e)),{})},time:t}}const OI=NI({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 BI(e,t,n,r){return r&&r.aborted?Promise.reject(new cI):"udp4:"===e.protocol||"udp6:"===e.protocol?function(){throw new Error('Only "doh" endpoints are supported in the browser')}():function(e,t,n,r){return function(e,t,n,r,i){return PI(e,t,n,r,i)}(e.url,e.method,ZT(Object.assign({flags:$T},t)),n,r).then((function(e){const t=e.data,n=e.response;let r=e.error;if(void 0===r)if(0===t.length)r=new hI("Empty.");else try{const e=eI(t);return e.response=n,e}catch(i){r=new hI("Invalid packet (cause="+i.message+")",i)}throw Object.assign(r,{response:n})}))}(e,t,n,r)}const LI=new lI("https://martinheidegger.github.io/dns-query/resolvers.json");function MI(e){return/^@/.test(e)}const UI=new class{constructor(e){this.opts=Object.assign({timeout:5e3,update:!0,updateURL:LI,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,n,r){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 PI(e,"GET",null,n,r),s={time:Date.now(),data:JSON.parse(oT(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=>NI({data:e.data.resolvers,time:e.time}))).catch((()=>t||OI)):Promise.resolve(OI),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=zI),"dns"===e&&(e=KI),"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(MI))try{return Promise.resolve(e.map(CI))}catch(t){return Promise.reject(t)}return this.data().then((t=>e.map((e=>{if(MI(e)){const n=t.endpointByName[e.substring(1)];if(!n)throw new Error("Endpoint ".concat(e," is not known."));return n}return CI(e)}))))}};function FI(e,t){return t=Object.assign({retries:5,timeout:3e4},t),e.question?(n=t.endpoints,function(e){return null!==e&&"object"===typeof e&&"function"===typeof e.then}(n)?n:Promise.resolve(n)).then((n=>{if(!Array.isArray(n)||0===n.length)throw new Error("No endpoints defined to lookup dns records.");return jI(n.map(CI),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 n}function jI(e,t,n){const r=1===e.length?e[0]:e[Math.floor(Math.random()*e.length)%e.length];return BI(r,t,n.timeout,n.signal).then((e=>(e.endpoint=r.toString(),e)),(i=>{if("AbortError"===i.name||0===n.retries)throw i.endpoint=r.toString(),i;return n.retries>0&&(n.retries-=1),jI(e,t,n)}))}function zI(e){return"https:"===e.protocol||"http:"===e.protocol}function KI(e){return"udp4:"===e.protocol||"udp6:"===e.protocol}const qI=Ju("waku:dns-over-https");class VI{static async create(e,t){const n=null!==e&&void 0!==e?e:await UI.endpoints("doh");return new VI(n,t)}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;Xa(this,"endpoints",void 0),Xa(this,"retries",void 0),this.endpoints=e,this.retries=t}async resolveTXT(e){let t;try{t=(await FI({question:{type:"TXT",name:e}},{endpoints:this.endpoints,retries:this.retries})).answers}catch(i){throw qI("query failed: ",i),new Error("DNS query failed")}if(!t)throw new Error("Could not resolve ".concat(e));const n=t.map((e=>e.data)),r=[];return n.forEach((e=>{"string"===typeof e?r.push(e):Array.isArray(e)?e.forEach((e=>{"string"===typeof e?r.push(e):r.push($f(e))})):r.push($f(e))})),r}}var HI=__webpack_require__(9437);class WI{static parseAndVerifyRoot(e,t){if(!e.startsWith(this.ROOT_PREFIX))throw new Error("ENRTree root entry must start with '".concat(this.ROOT_PREFIX,"'"));const n=WI.parseRootValues(e),r=HI.decode.asBytes(t),i=e.split(" sig")[0],o=Yf(i);if(!nA(ru(n.signature,"base64url").slice(0,64),tA(o),new Uint8Array(r)))throw new Error("Unable to verify ENRTree root signature");return n.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[n,r,i,o]=t;if(!n)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!r)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:n,lRoot:r,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[n,r]=t;if(!n)throw new Error("Could not parse public key from ENRTree tree entry");if(!r)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:n,domain:r}}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(",")}}Xa(WI,"RECORD_PREFIX",pk.RECORD_PREFIX),Xa(WI,"TREE_PREFIX","enrtree:"),Xa(WI,"BRANCH_PREFIX","enrtree-branch:"),Xa(WI,"ROOT_PREFIX","enrtree-root:");const GI=Ju("waku:discovery:fetch_nodes");function $I(e,t){return t.relay>=e.relay&&t.store>=e.store&&t.filter>=e.filter&&t.lightPush>=e.lightPush}function YI(e,t){if(!e.nodeId)return!1;for(const n of t)if(e.nodeId===n.nodeId)return!1;return!0}function QI(e,t){e.relay&&(t.relay+=1),e.store&&(t.store+=1),e.filter&&(t.filter+=1),e.lightPush&&(t.lightPush+=1)}function XI(e,t,n){if($I(t,n))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const r=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,n);return r.relay&&e.relay||r.store&&e.store||r.filter&&e.filter||r.lightPush&&e.lightPush}const JI=Ju("waku:discovery:dns");class ZI{static async dnsOverHttp(e){return e||(e=await VI.create()),new ZI(e)}async getPeers(e,t){const n=Math.floor(Math.random()*e.length),{publicKey:r,domain:i}=WI.parseTree(e[n]),o={domain:i,publicKey:r,visits:{}},s=await async function(e,t,n){var r,i,o,s;const a={relay:null!==(r=e.relay)&&void 0!==r?r: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(;!$I(a,l)&&u<c+t;){const e=await n();e&&YI(e,h)&&(e.waku2&&XI(e.waku2,a,l)&&(QI(e.waku2,l),h.push(e)),GI("got new peer candidate from DNS address=".concat(e.nodeId,"@").concat(e.ip))),u++}return h}(t,this._errorTolerance,(()=>this._search(i,o)));return JI("retrieved peers: ",s.map((e=>{var t,n;return{id:null===(t=e.peerId)||void 0===t?void 0:t.toString(),multiaddrs:null===(n=e.multiaddrs)||void 0===n?void 0:n.map((e=>e.toString()))}}))),s}constructor(e){Xa(this,"dns",void 0),Xa(this,"_DNSTreeCache",void 0),Xa(this,"_errorTolerance",10),this._DNSTreeCache={},this.dns=e}async*getNextPeer(e,t){const n=Math.floor(Math.random()*e.length),{publicKey:r,domain:i}=WI.parseTree(e[n]),o={domain:i,publicKey:r,visits:{}};for await(const s of async function*(e,t,n){var r,i,o,s;const a={relay:null!==(r=e.relay)&&void 0!==r?r: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(;!$I(a,l)&&u<c+t;){const e=await n();e&&e.nodeId&&!h.has(e.nodeId)&&(h.add(e.nodeId),e.waku2&&XI(e.waku2,a,l)&&(QI(e.waku2,l),yield e),GI("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 r=await this._getTXTRecord(e,t);let i,o;t.visits[e]=!0;const s=function(e){return e.startsWith(WI.ROOT_PREFIX)?WI.ROOT_PREFIX:e.startsWith(WI.BRANCH_PREFIX)?WI.BRANCH_PREFIX:e.startsWith(WI.RECORD_PREFIX)?WI.RECORD_PREFIX:""}(r);try{switch(s){case WI.ROOT_PREFIX:return i=WI.parseAndVerifyRoot(r,t.publicKey),await this._search(i,t);case WI.BRANCH_PREFIX:return o=WI.parseBranch(r),i=function(e,t){const n={};for(const[i,o]of e.entries())t.visits[o]&&(n[i]=!0);if(Object.keys(n).length===e.length)throw new Error("Unresolvable circular path detected");let r;do{r=Math.floor(Math.random()*e.length)}while(n[r]);return e[r]}(o,t),await this._search(i,t);case WI.RECORD_PREFIX:return Kk.fromString(r);default:return null}}catch(n){return JI("Failed to search DNS tree ".concat(s," at subdomain ").concat(e,": ").concat(n)),null}}catch(n){return JI("Failed to retrieve TXT record at subdomain ".concat(e,": ").concat(n)),null}}async _getTXTRecord(e,t){if(this._DNSTreeCache[e])return this._DNSTreeCache[e];const n=e!==t.domain?"".concat(e,".").concat(t.domain):t.domain,r=await this.dns.resolveTXT(n);if(!r.length)throw new Error("Received empty result array while fetching TXT record");if(!r[0].length)throw new Error("Received empty TXT record");const i=r.join("");return this._DNSTreeCache[e]=i,i}}let eC;const tC=Ju("waku:peer-discovery-dns"),nC={TEST:"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im",PROD:"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"},rC="bootstrap";eC=Symbol.toStringTag;class iC extends eh{constructor(e,t){super(),Xa(this,"nextPeer",void 0),Xa(this,"_started",void 0),Xa(this,"_components",void 0),Xa(this,"_options",void 0),this._started=!1,this._components=e,this._options=t;const{enrUrls:n}=t;tC("Use following EIP-1459 ENR Tree URLs: ",n)}async start(){if(tC("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,n=await ZI.dnsOverHttp();this.nextPeer=n.getNextPeer.bind(n,e,t)}for await(const n of this.nextPeer()){var e,t;if(!this._started)return;const r=n.peerInfo;if(!r)continue;const i={tags:{[rC]:{value:null!==(e=this._options.tagValue)&&void 0!==e?e:50,ttl:null!==(t=this._options.tagTTL)&&void 0!==t?t:12e4}}};let o=!1;if(await this._components.peerStore.has(r.id)){(await this._components.peerStore.get(r.id)).tags.has(rC)||(o=!0,await this._components.peerStore.merge(r.id,i))}else o=!0,await this._components.peerStore.save(r.id,i);o&&this.dispatchEvent(new nh("peer",{detail:r}))}}stop(){this._started=!1}get[ZS](){return!0}get[eC](){return"@waku/bootstrap"}}function oC(e,t){return n=>new iC(n,{enrUrls:e,wantedNodeCapabilityCount:t})}let sC;const aC=Symbol.for("nodejs.util.inspect.custom"),cC=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),lC=114,uC=36,hC=37;sC=Symbol.toStringTag;class dC{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[sC](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(lC,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return yC(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[aC](){return"PeerId(".concat(this.toString(),")")}}class fC extends dC{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class pC extends dC{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class gC extends dC{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function yC(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:cC,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new pC({multihash:t}):e.startsWith("16U")?new gC({multihash:t}):new fC({multihash:t})}return mC(cC.decode(e))}function mC(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===uC)return new pC({multihash:t});if(t.digest.length===hC)return new gC({multihash:t})}if(t.code===Rl.code)return new fC({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==lC)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new fC({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===uC)return new pC({multihash:e.multihash});if(t.digest.length===hC)return new gC({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}const vC=Symbol.for("@libp2p/topology");let bC;const wC=()=>{};bC=Symbol.toStringTag;class EC{constructor(e){var t,n,r,i;Xa(this,"min",void 0),Xa(this,"max",void 0),Xa(this,"peers",void 0),Xa(this,"onConnect",void 0),Xa(this,"onDisconnect",void 0),Xa(this,"registrar",void 0),Xa(this,vC,!0),this.min=null!==(t=e.min)&&void 0!==t?t:0,this.max=null!==(n=e.max)&&void 0!==n?n:1/0,this.peers=new Set,this.onConnect=null!==(r=e.onConnect)&&void 0!==r?r:wC,this.onDisconnect=null!==(i=e.onDisconnect)&&void 0!==i?i:wC}get[bC](){return vC.toString()}async setRegistrar(e){this.registrar=e}disconnect(e){this.onDisconnect(e)}}class _C{constructor(e,t,n){this.gossip=e,this.msgs=new Map,this.history=[],this.notValidatedCount=0,this.msgIdToStrFn=n;for(let r=0;r<t;r++)this.history[r]=[]}get size(){return this.msgs.size}put(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{msgIdStr:r}=e;return!this.msgs.has(r)&&(this.msgs.set(r,{message:t,validated:n,originatingPeers:new Set,iwantCounts:new Map}),this.history[0].push({...e,topic:t.topic}),n||this.notValidatedCount++,!0)}observeDuplicate(e,t){const n=this.msgs.get(e);n&&!n.validated&&n.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 n;const r=this.msgs.get(e);if(!r)return null;const i=(null!==(n=r.iwantCounts.get(t))&&void 0!==n?n:0)+1;return r.iwantCounts.set(t,i),{msg:r.message,count:i}}getGossipIDs(e){const t=new Map;for(let n=0;n<this.gossip;n++)this.history[n].forEach((n=>{const r=this.msgs.get(n.msgIdStr);if(r&&r.validated&&e.has(n.topic)){let e=t.get(n.topic);e||(e=[],t.set(n.topic,e)),e.push(n.msgId)}}));return t}validate(e){const t=this.msgs.get(e);if(!t)return null;t.validated||this.notValidatedCount--;const{message:n,originatingPeers:r}=t;return t.validated=!0,t.originatingPeers=new Set,{message:n,originatingPeers:r}}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}}const SC=__webpack_require__.p+"static/media/rpc.3ba5ca7bdb004060d5e2.cjs",{RPC:AC}=SC,kC="/floodsub/1.0.0",TC="/meshsub/1.0.0",IC="/meshsub/1.1.0",CC=5e3;function RC(e){if(e.length<=1)return e;for(let t=0;t<e.length;t++){const n=Math.floor(Math.random()*Math.floor(e.length)),r=e[t];e[t]=e[n],e[n]=r}return e}function xC(e){return Xl(e,"base64")}const PC="StrictSign",DC="StrictNoSign";var NC,OC,BC,LC,MC,UC;function FC(e){switch(e){case NC.Ignore:return LC.Ignore;case NC.Reject:return LC.Reject}}!function(e){e.Accept="accept",e.Ignore="ignore",e.Reject="reject"}(NC||(NC={})),function(e){e.StrictSign="StrictSign",e.StrictNoSign="StrictNoSign"}(OC||(OC={})),function(e){e[e.Signing=0]="Signing",e[e.Anonymous=1]="Anonymous"}(BC||(BC={})),function(e){e.Error="error",e.Ignore="ignore",e.Reject="reject",e.Blacklisted="blacklisted"}(LC||(LC={})),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"}(MC||(MC={})),function(e){e.duplicate="duplicate",e.invalid="invalid",e.valid="valid"}(UC||(UC={}));const jC="ERR_INVALID_PEER_SCORE_PARAMS",zC={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},KC={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 qC(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...zC,...e,topics:e.topics?Object.entries(e.topics).reduce(((e,t)=>{let[n,r]=t;return e[n]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...KC,...e}}(r),e}),{}):{}}}function VC(e){if(e.topicWeight<0)throw new sc("invalid topic weight; must be >= 0",jC);if(0===e.timeInMeshQuantum)throw new sc("invalid TimeInMeshQuantum; must be non zero",jC);if(e.timeInMeshWeight<0)throw new sc("invalid TimeInMeshWeight; must be positive (or 0 to disable)",jC);if(0!==e.timeInMeshWeight&&e.timeInMeshQuantum<=0)throw new sc("invalid TimeInMeshQuantum; must be positive",jC);if(0!==e.timeInMeshWeight&&e.timeInMeshCap<=0)throw new sc("invalid TimeInMeshCap; must be positive",jC);if(e.firstMessageDeliveriesWeight<0)throw new sc("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)",jC);if(0!==e.firstMessageDeliveriesWeight&&(e.firstMessageDeliveriesDecay<=0||e.firstMessageDeliveriesDecay>=1))throw new sc("invalid FirstMessageDeliveriesDecay; must be between 0 and 1",jC);if(0!==e.firstMessageDeliveriesWeight&&e.firstMessageDeliveriesCap<=0)throw new sc("invalid FirstMessageDeliveriesCap; must be positive",jC);if(e.meshMessageDeliveriesWeight>0)throw new sc("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)",jC);if(0!==e.meshMessageDeliveriesWeight&&(e.meshMessageDeliveriesDecay<=0||e.meshMessageDeliveriesDecay>=1))throw new sc("invalid MeshMessageDeliveriesDecay; must be between 0 and 1",jC);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesCap<=0)throw new sc("invalid MeshMessageDeliveriesCap; must be positive",jC);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesThreshold<=0)throw new sc("invalid MeshMessageDeliveriesThreshold; must be positive",jC);if(e.meshMessageDeliveriesWindow<0)throw new sc("invalid MeshMessageDeliveriesWindow; must be non-negative",jC);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesActivation<1e3)throw new sc("invalid MeshMessageDeliveriesActivation; must be at least 1s",jC);if(e.meshFailurePenaltyWeight>0)throw new sc("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)",jC);if(0!==e.meshFailurePenaltyWeight&&(e.meshFailurePenaltyDecay<=0||e.meshFailurePenaltyDecay>=1))throw new sc("invalid MeshFailurePenaltyDecay; must be between 0 and 1",jC);if(e.invalidMessageDeliveriesWeight>0)throw new sc("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)",jC);if(e.invalidMessageDeliveriesDecay<=0||e.invalidMessageDeliveriesDecay>=1)throw new sc("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1",jC)}const HC={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function WC(){return{...HC,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}function GC(e,t,n,r){let i=0;Object.entries(t.topics).forEach((e=>{let[t,r]=e;const o=n.topics[t];if(void 0===o)return;let s=0;if(r.inMesh){let e=r.meshTime/o.timeInMeshQuantum;e>o.timeInMeshCap&&(e=o.timeInMeshCap),s+=e*o.timeInMeshWeight}let a=r.firstMessageDeliveries;if(a>o.firstMessageDeliveriesCap&&(a=o.firstMessageDeliveriesCap),s+=a*o.firstMessageDeliveriesWeight,r.meshMessageDeliveriesActive&&r.meshMessageDeliveries<o.meshMessageDeliveriesThreshold){const e=o.meshMessageDeliveriesThreshold-r.meshMessageDeliveries;s+=e*e*o.meshMessageDeliveriesWeight}s+=r.meshFailurePenalty*o.meshFailurePenaltyWeight;s+=r.invalidMessageDeliveries*r.invalidMessageDeliveries*o.invalidMessageDeliveriesWeight,i+=s*o.topicWeight})),n.topicScoreCap>0&&i>n.topicScoreCap&&(i=n.topicScoreCap);const o=n.appSpecificScore(e);if(i+=o*n.appSpecificWeight,t.knownIPs.forEach((e=>{if(n.IPColocationFactorWhitelist.has(e))return;const t=r.get(e),o=t?t.size:0;if(o>n.IPColocationFactorThreshold){const e=o-n.IPColocationFactorThreshold;i+=e*e*n.IPColocationFactorWeight}})),t.behaviourPenalty>n.behaviourPenaltyThreshold){const e=t.behaviourPenalty-n.behaviourPenaltyThreshold;i+=e*e*n.behaviourPenaltyWeight}return i}var $C,YC=__webpack_require__(8718);!function(e){e[e.unknown=0]="unknown",e[e.valid=1]="valid",e[e.invalid=2]="invalid",e[e.ignored=3]="ignored"}($C||($C={}));class QC{constructor(){this.records=new Map,this.queue=new YC}getRecord(e){return this.records.get(e)}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:$C.unknown,firstSeenTsMs:Date.now(),validated:0,peers:new Set},this.records.set(e,t);const n={msgId:e,expire:Date.now()+12e4};return this.queue.push(n),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 XC(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const r=new Set;if(t<=0)return r;for(const i of e){if(r.size>=t)break;n(i)&&(r.add(i),e.delete(i))}return r}class JC 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 ZC=Aw("libp2p:gossipsub:score");class eR{constructor(e,t,n){var r;this.params=e,this.metrics=t,this.peerStats=new Map,this.peerIPs=new JC((()=>new Set)),this.scoreCache=new Map,this.deliveryRecords=new QC,function(e){for(const[n,r]of Object.entries(e.topics))try{VC(r)}catch(t){throw new sc("invalid score parameters for topic ".concat(n,": ").concat(t.message),jC)}if(e.topicScoreCap<0)throw new sc("invalid topic score cap; must be positive (or 0 for no cap)",jC);if(null===e.appSpecificScore||void 0===e.appSpecificScore)throw new sc("missing application specific score function",jC);if(e.IPColocationFactorWeight>0)throw new sc("invalid IPColocationFactorWeight; must be negative (or 0 to disable)",jC);if(0!==e.IPColocationFactorWeight&&e.IPColocationFactorThreshold<1)throw new sc("invalid IPColocationFactorThreshold; must be at least 1",jC);if(e.behaviourPenaltyWeight>0)throw new sc("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)",jC);if(0!==e.behaviourPenaltyWeight&&(e.behaviourPenaltyDecay<=0||e.behaviourPenaltyDecay>=1))throw new sc("invalid BehaviourPenaltyDecay; must be between 0 and 1",jC);if(e.decayInterval<1e3)throw new sc("invalid DecayInterval; must be at least 1s",jC);if(e.decayToZero<=0||e.decayToZero>=1)throw new sc("invalid DecayToZero; must be between 0 and 1",jC)}(e),this.scoreCacheValidityMs=n.scoreCacheValidityMs,this.computeScore=null!==(r=n.computeScore)&&void 0!==r?r:GC}get size(){return this.peerStats.size}start(){this._backgroundInterval?ZC("Peer score already running"):(this._backgroundInterval=setInterval((()=>this.background()),this.params.decayInterval),ZC("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),ZC("stopped")):ZC("Peer score already stopped")}background(){this.refreshScores(),this.deliveryRecords.gc()}dumpPeerScoreStats(){return Object.fromEntries(Array.from(this.peerStats.entries()).map((e=>{let[t,n]=e;return[t,n]})))}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(((n,r)=>{n.connected?(Object.entries(n.topics).forEach((n=>{let[r,i]=n;const o=this.params.topics[r];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)))})),n.behaviourPenalty*=this.params.behaviourPenaltyDecay,n.behaviourPenalty<t&&(n.behaviourPenalty=0)):e>n.expire&&(this.removeIPsForPeer(r,n.knownIPs),this.peerStats.delete(r),this.scoreCache.delete(r))}))}score(e){var t,n;null===(t=this.metrics)||void 0===t||t.scoreFnCalls.inc();const r=this.peerStats.get(e);if(!r)return 0;const i=Date.now(),o=this.scoreCache.get(e);if(o&&o.cacheUntil>i)return o.score;null===(n=this.metrics)||void 0===n||n.scoreFnRuns.inc();const s=this.computeScore(e,r,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,n){const r=this.peerStats.get(e);var i;r&&(r.behaviourPenalty+=t,null===(i=this.metrics)||void 0===i||i.onScorePenalty(n))}addPeer(e){const t={connected:!0,expire:0,topics:{},knownIPs:new Set,behaviourPenalty:0};this.peerStats.set(e,t)}addIP(e,t){const n=this.peerStats.get(e);n&&n.knownIPs.add(t),this.peerIPs.getOrDefault(t).add(e)}removeIP(e,t){const n=this.peerStats.get(e);n&&n.knownIPs.delete(t);const r=this.peerIPs.get(t);r&&(r.delete(e),0===r.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,n]=e;n.firstMessageDeliveries=0;const r=this.params.topics[t].meshMessageDeliveriesThreshold;if(n.inMesh&&n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<r){const e=r-n.meshMessageDeliveries;n.meshFailurePenalty+=e*e}n.inMesh=!1,n.meshMessageDeliveriesActive=!1})),t.connected=!1,t.expire=Date.now()+this.params.retainScore}}graft(e,t){const n=this.peerStats.get(e);if(n){const e=this.getPtopicStats(n,t);e&&(e.inMesh=!0,e.graftTime=Date.now(),e.meshTime=0,e.meshMessageDeliveriesActive=!1)}}prune(e,t){const n=this.peerStats.get(e);if(n){const e=this.getPtopicStats(n,t);if(e){const n=this.params.topics[t].meshMessageDeliveriesThreshold;if(e.meshMessageDeliveriesActive&&e.meshMessageDeliveries<n){const t=n-e.meshMessageDeliveries;e.meshFailurePenalty+=t*t}e.meshMessageDeliveriesActive=!1,e.inMesh=!1}}}validateMessage(e){this.deliveryRecords.ensureRecord(e)}deliverMessage(e,t,n){this.markFirstMessageDelivery(e,n);const r=this.deliveryRecords.ensureRecord(t),i=Date.now();r.status===$C.unknown?(r.status=$C.valid,r.validated=i,r.peers.forEach((t=>{t!==e.toString()&&this.markDuplicateMessageDelivery(t,n)}))):ZC("unexpected delivery: message from %s was first seen %s ago and has delivery status %s",e,i-r.firstSeenTsMs,$C[r.status])}rejectInvalidMessage(e,t){this.markInvalidMessageDelivery(e,t)}rejectMessage(e,t,n,r){switch(r){case LC.Error:return void this.markInvalidMessageDelivery(e,n);case LC.Blacklisted:return}const i=this.deliveryRecords.ensureRecord(t);if(i.status===$C.unknown){if(r===LC.Ignore)return i.status=$C.ignored,void i.peers.clear();i.status=$C.invalid,this.markInvalidMessageDelivery(e,n),i.peers.forEach((e=>{this.markInvalidMessageDelivery(e,n)})),i.peers.clear()}else ZC("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",e,Date.now()-i.firstSeenTsMs,$C[i.status])}duplicateMessage(e,t,n){const r=this.deliveryRecords.ensureRecord(t);if(!r.peers.has(e))switch(r.status){case $C.unknown:r.peers.add(e);break;case $C.valid:r.peers.add(e),this.markDuplicateMessageDelivery(e,n,r.validated);break;case $C.invalid:this.markInvalidMessageDelivery(e,n);case $C.ignored:}}markInvalidMessageDelivery(e,t){const n=this.peerStats.get(e);if(n){const e=this.getPtopicStats(n,t);e&&(e.invalidMessageDeliveries+=1)}}markFirstMessageDelivery(e,t){const n=this.peerStats.get(e);if(n){const e=this.getPtopicStats(n,t);if(e){let n=this.params.topics[t].firstMessageDeliveriesCap;e.firstMessageDeliveries=Math.min(n,e.firstMessageDeliveries+1),e.inMesh&&(n=this.params.topics[t].meshMessageDeliveriesCap,e.meshMessageDeliveries=Math.min(n,e.meshMessageDeliveries+1))}}}markDuplicateMessageDelivery(e,t,n){const r=this.peerStats.get(e);if(r){const e=void 0!==n?Date.now():0,o=this.getPtopicStats(r,t);if(o&&o.inMesh){const r=this.params.topics[t];if(void 0!==n){var i;const o=e-n,s=o>r.meshMessageDeliveriesWindow;if(null===(i=this.metrics)||void 0===i||i.onDuplicateMsgDelivery(t,o,s),s)return}const s=r.meshMessageDeliveriesCap;o.meshMessageDeliveries=Math.min(s,o.meshMessageDeliveries+1)}}}removeIPsForPeer(e,t){for(const n of t){const t=this.peerIPs.get(n);t&&(t.delete(e),0===t.size&&this.peerIPs.delete(n))}}getPtopicStats(e,t){let n=e.topics[t];return void 0!==n?n:void 0!==this.params.topics[t]?(n={inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e.topics[t]=n,n):null}}class tR{constructor(e,t,n){this.gossipsubIWantFollowupMs=e,this.msgIdToStrFn=t,this.metrics=n,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 n=t[Math.floor(Math.random()*t.length)],r=this.msgIdToStrFn(n);let i=this.promises.get(r);i||(i=new Map,this.promises.set(r,i));const o=Date.now();i.has(e)||(i.set(e,o+this.gossipsubIWantFollowupMs),this.metrics&&(this.metrics.iwantPromiseStarted.inc(1),this.requestMsByMsg.has(r)||this.requestMsByMsg.set(r,o)))}getBrokenPromises(){var e;const t=Date.now(),n=new Map;let r=0;return this.promises.forEach(((e,i)=>{e.forEach(((i,o)=>{var s;i<t&&(n.set(o,(null!==(s=n.get(o))&&void 0!==s?s:0)+1),e.delete(o),r++)})),e.size||this.promises.delete(i)})),null===(e=this.metrics)||void 0===e||e.iwantPromiseBroken.inc(r),n}deliverMessage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.trackMessage(e);const n=this.promises.get(e);n&&(this.promises.delete(e),this.metrics&&(this.metrics.iwantPromiseResolved.inc(1),t&&this.metrics.iwantPromiseResolvedFromDuplicate.inc(1),this.metrics.iwantPromiseResolvedPeers.inc(n.size)))}rejectMessage(e,t){this.trackMessage(e),t!==LC.Error&&this.promises.delete(e)}clear(){this.promises.clear()}prune(){var e;const t=Date.now()-this.requestMsByMsgExpire;let n=0;for(const[r,i]of this.requestMsByMsg.entries()){if(!(i<t))break;this.requestMsByMsg.delete(r),n++}null===(e=this.metrics)||void 0===e||e.iwantMessagePruned.inc(n)}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 nR{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,n]of this.entries.entries()){if(!(n.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 rR,iR,oR,sR,aR,cR;!function(e){e.forward="forward",e.publish="publish"}(rR||(rR={})),function(e){e.Fanout="fanout",e.Random="random",e.Subscribed="subscribed",e.Outbound="outbound",e.NotEnough="not_enough",e.Opportunistic="opportunistic"}(iR||(iR={})),function(e){e.Dc="disconnected",e.BadScore="bad_score",e.Prune="prune",e.Excess="excess"}(oR||(oR={})),function(e){e.GraftBackoff="graft_backoff",e.BrokenPromise="broken_promise",e.MessageDeficit="message_deficit",e.IPColocation="IP_colocation"}(sR||(sR={})),function(e){e.LowScore="low_score",e.MaxIhave="max_ihave",e.MaxIasked="max_iasked"}(aR||(aR={})),function(e){e.graylist="graylist",e.publish="publish",e.gossip="gossip",e.mesh="mesh"}(cR||(cR={}));__webpack_require__(8605);var lR=__webpack_require__(6019);const uR={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function hR(e,t,n,r,i){if("sha1"!==i&&"sha2-256"!==i&&"sha2-512"!==i){const e=Object.keys(uR).join(" / ");throw new sc("Hash '".concat(i,"' is unknown or not supported. Must be ").concat(e),"ERR_UNSUPPORTED_HASH_TYPE")}const o=uR[i],s=lR(e,t,n,r,o);return cv.encode64(s,null)}const dR=ru("libp2p-pubsub:");let fR;Symbol.for("nodejs.util.inspect.custom"),Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder);fR=Symbol.toStringTag;const pR=(e,t)=>{const n=ru(t.toString(16).padStart(16,"0"),"base16"),r=new Uint8Array(e.length+n.length);return r.set(e,0),r.set(n,e.length),r};function gR(e){if("signed"!==e.type)throw new Error("expected signed message type");if(null==e.sequenceNumber)throw Error("missing seqno field");return pR(e.from.toBytes(),e.sequenceNumber)}async function yR(e){return await Rl.encode(e.data)}function mR(e,t,n,r,i){let o=0;const s=new Map;if(Object.entries(t.topics).forEach((e=>{var t;let[r,a]=e;const c=null!==(t=i.get(r))&&void 0!==t?t:"unknown",l=n.topics[r];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})),n.topicScoreCap>0&&o>n.topicScoreCap){o=n.topicScoreCap;const e=n.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+=n.appSpecificScore(e)*n.appSpecificWeight,t.knownIPs.forEach((e=>{if(n.IPColocationFactorWhitelist.has(e))return;const t=r.get(e),i=t?t.size:0;if(i>n.IPColocationFactorThreshold){const e=i-n.IPColocationFactorThreshold;c+=e*e*n.IPColocationFactorWeight}}));return l+=t.behaviourPenalty*t.behaviourPenalty*n.behaviourPenaltyWeight,o+=a+c+l,{byTopic:s,p5w:a,p6w:c,p7w:l,score:o}}class vR{constructor(e,t,n){var r;this.rawStream=e,this.pushable=Kd({objectMode:!1}),this.closeController=new AbortController,this.maxBufferSize=null!==(r=n.maxBufferSize)&&void 0!==r?r:1/0,Hd(Lw(this.pushable,this.closeController.signal,{returnOnAbort:!0}),(e=>Pd(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 bR{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.rawStream=e,this.closeController=new AbortController,this.source=Lw(Hd(this.rawStream,(e=>Md(e,t))),this.closeController.signal,{returnOnAbort:!0})}close(){this.closeController.abort(),this.rawStream.close()}}var wR=__webpack_require__(886);const ER={maxSubscriptions:1/0,maxMessages:1/0,maxIhaveMessageIDs:1/0,maxIwantMessageIDs:1/0,maxControlMessages:1/0,maxPeerInfos:1/0};function _R(e,t){t={...t};const n=wR.Reader.create(e),r=e.length,i=void 0===r?n.len:n.pos+r,o={};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.subscriptions&&o.subscriptions.length||(o.subscriptions=[]),o.subscriptions.length<t.maxSubscriptions?o.subscriptions.push(SR(n,n.uint32())):n.skipType(7&e);break;case 2:o.messages&&o.messages.length||(o.messages=[]),o.messages.length<t.maxMessages?o.messages.push(AR(n,n.uint32())):n.skipType(7&e);break;case 3:o.control=kR(n,n.uint32(),t);break;default:n.skipType(7&e)}}return o}function SR(e,t){const n=void 0===t?e.len:e.pos+t,r={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.subscribe=e.bool();break;case 2:r.topic=e.string();break;default:e.skipType(7&t)}}return r}function AR(e,t){const n=void 0===t?e.len:e.pos+t,r={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.from=e.bytes();break;case 2:r.data=e.bytes();break;case 3:r.seqno=e.bytes();break;case 4:r.topic=e.string();break;case 5:r.signature=e.bytes();break;case 6:r.key=e.bytes();break;default:e.skipType(7&t)}}if(!r.topic)throw Error("missing required 'topic'");return r}function kR(e,t,n){const r=void 0===t?e.len:e.pos+t,i={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:i.ihave&&i.ihave.length||(i.ihave=[]),i.ihave.length<n.maxControlMessages?i.ihave.push(TR(e,e.uint32(),n)):e.skipType(7&t);break;case 2:i.iwant&&i.iwant.length||(i.iwant=[]),i.iwant.length<n.maxControlMessages?i.iwant.push(IR(e,e.uint32(),n)):e.skipType(7&t);break;case 3:i.graft&&i.graft.length||(i.graft=[]),i.graft.length<n.maxControlMessages?i.graft.push(CR(e,e.uint32())):e.skipType(7&t);break;case 4:i.prune&&i.prune.length||(i.prune=[]),i.prune.length<n.maxControlMessages?i.prune.push(RR(e,e.uint32(),n)):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function TR(e,t,n){const r=void 0===t?e.len:e.pos+t,i={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),n.maxIhaveMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function IR(e,t,n){const r=void 0===t?e.len:e.pos+t,i={};for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),n.maxIwantMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);else e.skipType(7&t)}return i}function CR(e,t){const n=void 0===t?e.len:e.pos+t,r={};for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.topicID=e.string();else e.skipType(7&t)}return r}function RR(e,t,n){const r=void 0===t?e.len:e.pos+t,i={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.peers&&i.peers.length||(i.peers=[]),n.maxPeerInfos-- >0?i.peers.push(xR(e,e.uint32())):e.skipType(7&t);break;case 3:i.backoff=e.uint64();break;default:e.skipType(7&t)}}return i}function xR(e,t){const n=void 0===t?e.len:e.pos+t,r={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.peerID=e.bytes();break;case 2:r.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return r}const PR=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},DR=-1,NR={},OR={};function BR(e){if("number"===typeof e){if(null!=OR[e])return OR[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=NR[e])return NR[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,DR,"ip6zone"],[43,8,"ipcidr"],[53,DR,"dns",!0],[54,DR,"dns4",!0],[55,DR,"dns6",!0],[56,DR,"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,DR,"unix",!1,!0],[421,DR,"ipfs"],[421,DR,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,DR,"garlic64"],[448,0,"tls"],[449,DR,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,DR,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,DR,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);OR[t.code]=t,NR[t.name]=t}));BR("ip4"),BR("ip6"),BR("ipcidr");function LR(e,t){switch(BR(e).code){case 4:case 41:return function(e){const t=PR(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 FR(t);case 6:case 273:case 33:case 132:return UR(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return jR(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}const MR=Object.values(ql).map((e=>e.decoder));!function(){let e=MR[0].or(MR[1]);MR.slice(2).forEach((t=>e=e.or(t)))}();function UR(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function FR(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function jR(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=UR(n);return"".concat(r,":").concat(i)}var zR;!function(e){e[e.ip4=4]="ip4",e[e.ip6=41]="ip6"}(zR||(zR={}));var KR;!function(e){e[e.started=0]="started",e[e.stopped=1]="stopped"}(KR||(KR={}));class qR extends eh{constructor(e){var t,n,r,i;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.multicodecs=[IC,TC],this.peers=new Set,this.streamsInbound=new Map,this.streamsOutbound=new Map,this.outboundInflightQueue=Kd({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:KR.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===KR.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:qC(o.scoreParams),scoreThresholds:WC(o.scoreThresholds)};if(this.components=e,this.decodeRpcLimits=null!==(t=s.decodeRpcLimits)&&void 0!==t?t:ER,this.globalSignaturePolicy=null!==(n=s.globalSignaturePolicy)&&void 0!==n?n:PC,s.fallbackToFloodsub&&this.multicodecs.push(kC),this.log=Aw(null!==(r=s.debugName)&&void 0!==r?r:"libp2p:gossipsub"),this.opts=s,this.direct=new Set(s.directPeers.map((e=>e.id.toString()))),this.seenCache=new nR({validityMs:s.seenTTL}),this.publishedMessageIds=new nR({validityMs:s.seenTTL}),o.msgIdFn)this.msgIdFn=o.msgIdFn;else switch(this.globalSignaturePolicy){case PC:this.msgIdFn=gR;break;case DC:this.msgIdFn=yR}if(o.fastMsgIdFn&&(this.fastMsgIdFn=o.fastMsgIdFn,this.fastMsgIdCache=new nR({validityMs:s.seenTTL})),this.msgIdToStrFn=null!==(i=o.msgIdToStrFn)&&void 0!==i?i:xC,this.mcache=o.messageCache||new _C(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,n){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*n.maxMeshMessageDeliveriesWindowSec,.5*n.maxMeshMessageDeliveriesWindowSec,1*n.maxMeshMessageDeliveriesWindowSec,2*n.maxMeshMessageDeliveriesWindowSec,4*n.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*n.behaviourPenaltyThreshold,.5*n.behaviourPenaltyThreshold,1*n.behaviourPenaltyThreshold,2*n.behaviourPenaltyThreshold,4*n.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*n.gossipPromiseExpireSec,1*n.gossipPromiseExpireSec,2*n.gossipPromiseExpireSec,4*n.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,n){const r=this.toTopic(e);this.meshPeerInclusionEvents.inc({reason:t},n),this.meshPeerInclusionEventsByTopic.inc({topic:r},n)},onRemoveFromMesh(e,t,n){const r=this.toTopic(e);this.meshPeerChurnEvents.inc({reason:t},n),this.meshPeerChurnEventsByTopic.inc({topic:r},n)},onReportValidation(e,t,n){if(this.asyncValidationMcacheHit.inc({hit:null!=e?"hit":"miss"}),null!=e){const n=this.toTopic(e.message.topic);this.asyncValidationResult.inc({acceptance:t}),this.asyncValidationResultByTopic.inc({topic:n})}null!=n?this.asyncValidationDelayFromFirstSeenSec.observe((Date.now()-n)/1e3):this.asyncValidationUnknownFirstSeen.inc()},onScorePenalty(e){this.scoringPenalties.inc({penalty:e},1)},onIhaveRcv(e,t,n){const r=this.toTopic(e);this.ihaveRcvMsgids.inc({topic:r},t),this.ihaveRcvNotSeenMsgids.inc({topic:r},n)},onIwantRcv(e,t){for(const[n,r]of e){const e=this.toTopic(n);this.iwantRcvMsgids.inc({topic:e},r)}this.iwantRcvDonthaveMsgids.inc(t)},onForwardMsg(e,t){const n=this.toTopic(e);this.msgForwardCount.inc({topic:n},1),this.msgForwardPeers.inc({topic:n},t)},onPublishMsg(e,t,n,r){const i=this.toTopic(e);this.msgPublishCount.inc({topic:i},1),this.msgPublishBytes.inc({topic:i},n*r),this.msgPublishPeersByTopic.inc({topic:i},n),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 n=this.toTopic(e);this.msgReceivedTopic.inc({topic:n}),this.msgReceivedStatus.inc({status:t})},onMsgRecvInvalid(e,t){const n=this.toTopic(e),r=t.reason===LC.Error?t.error:t.reason;this.msgReceivedInvalid.inc({error:r},1),this.msgReceivedInvalidByTopic.inc({topic:n},1)},onDuplicateMsgDelivery(e,t,n){if(this.duplicateMsgDeliveryDelay.observe(t/1e3),n){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 n,r,i,o,s,a,c,l;const t=null!==(n=null===(r=e.control.ihave)||void 0===r?void 0:r.length)&&void 0!==n?n: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 n=0,r=0,i=0,o=0;for(const s of e)s>=t.graylistThreshold&&n++,s>=t.publishThreshold&&r++,s>=t.gossipThreshold&&i++,s>=0&&o++;this.peersByScoreThreshold.set({threshold:cR.graylist},n),this.peersByScoreThreshold.set({threshold:cR.publish},r),this.peersByScoreThreshold.set({threshold:cR.gossip},i),this.peersByScoreThreshold.set({threshold:cR.mesh},o),this.score.set(e)},registerScoreWeights(e){for(const[t,n]of e.byTopic)this.scoreWeights.set({topic:t,p:"p1"},n.p1w),this.scoreWeights.set({topic:t,p:"p2"},n.p2w),this.scoreWeights.set({topic:t,p:"p3"},n.p3w),this.scoreWeights.set({topic:t,p:"p3b"},n.p3bw),this.scoreWeights.set({topic:t,p:"p4"},n.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 n=new Map;e.forEach(((e,t)=>{var r;const i=null!==(r=this.topicStrToLabel.get(t))&&void 0!==r?r:"unknown";let o=n.get(i);o||(o=new Set,n.set(i,o)),e.forEach((e=>{var t;return null===(t=o)||void 0===t?void 0:t.add(e)}))}));for(const[r,i]of n){const e=[];i.forEach((n=>{var r;e.push(null!==(r=t.get(n))&&void 0!==r?r:0)})),this.scorePerMesh.set({topic:r},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 n of this.multicodecs)t.protocolsEnabled.set({protocol:n},1);this.metrics=t}else this.metrics=null;this.gossipTracer=new tR(this.opts.gossipsubIWantFollowupMs,this.msgIdToStrFn,this.metrics),this.score=new eR(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=>yC(e)))}isStarted(){return this.status.code===KR.started}async start(){if(this.isStarted())return;this.log("starting"),this.publishConfig=await async function(e,t){switch(e){case PC:{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 Hb(t.privateKey);return{type:BC.Signing,author:t,key:t.publicKey,privateKey:e}}case DC:return{type:BC.Anonymous};default:throw new Error('Unknown signature policy "'.concat(e,'"'))}}(this.globalSignaturePolicy,this.components.peerId),this.outboundInflightQueue=Kd({objectMode:!0}),Hd(this.outboundInflightQueue,(async e=>{for await(const{peerId:t,connection:n}of e)await this.createOutboundStream(t,n)})).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=(n={onConnect:this.onPeerConnected.bind(this),onDisconnect:this.onPeerDisconnected.bind(this)},new EC(n));var n;const r=await Promise.all(this.multicodecs.map((n=>e.register(n,t)))),i=setTimeout(this.runHeartbeat,100);this.status={code:KR.started,registrarTopologyIds:r,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!==KR.started)return;const{registrarTopologyIds:e}=this.status;this.status={code:KR.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 n of this.streamsOutbound.values())n.close();this.streamsOutbound.clear();for(const n of this.streamsInbound.values())n.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:n}=e;if(!this.isStarted())return;const r=n.remotePeer;this.addPeer(r,n.stat.direction,n.remoteAddr),this.createInboundStream(r,t),this.outboundInflightQueue.push({peerId:r,connection:n})}onPeerConnected(e,t){var n;null===(n=this.metrics)||void 0===n||n.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 n=e.toString();if(this.peers.has(n)&&!this.streamsOutbound.has(n))try{var r;const i=new vR(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(n,i);const o=i.protocol;o===kC&&this.floodsubPeers.add(n),null===(r=this.metrics)||void 0===r||r.peersPerProtocol.inc({protocol:o},1),this.subscriptions.size>0&&(this.log("send subscriptions to",n),this.sendSubscriptions(n,Array.from(this.subscriptions),!0))}catch(i){this.log.error("createOutboundStream error",i)}}async createInboundStream(e,t){if(!this.isStarted())return;const n=e.toString();if(!this.peers.has(n))return;const r=this.streamsInbound.get(n);void 0!==r&&(this.log("replacing existing inbound steam %s",n),r.close()),this.log("create inbound stream %s",n);const i=new bR(t,{maxDataLength:this.opts.maxInboundDataLength});this.streamsInbound.set(n,i),this.pipePeerReadStream(e,i.source).catch((e=>this.log(e)))}addPeer(e,t,n){const r=e.toString();if(!this.peers.has(r)){this.log("new peer %p",e),this.peers.add(r),this.score.addPeer(r);const i=function(e){for(const t of e.tuples())switch(t[0]){case zR.ip4:case zR.ip6:return LR(t[0],t[1])}return null}(n);null!==i?this.score.addIP(r,i):this.log("Added peer has no IP in current address %s %s",r,n.toString()),this.outbound.has(r)||this.outbound.set(r,"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 n=this.streamsOutbound.get(t),r=this.streamsInbound.get(t);var i;n&&(null===(i=this.metrics)||void 0===i||i.peersPerProtocol.inc({protocol:n.protocol},-1));null===n||void 0===n||n.close(),null===r||void 0===r||r.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,oR.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===KR.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=>yC(e)))}getTopics(){return Array.from(this.subscriptions)}async pipePeerReadStream(e,t){try{await Hd(t,(async t=>{for await(const a of t)try{var n;const t=a.subarray(),i=_R(t,this.decodeRpcLimits);if(null===(n=this.metrics)||void 0===n||n.onRpcRecv(i,t.length),this.opts.awaitRpcHandler)try{await this.handleReceivedRpc(e,i)}catch(o){var r;null===(r=this.metrics)||void 0===r||r.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(r){var n;null===(n=this.metrics)||void 0===n||n.onPeerReadStreamError(),this.handlePeerReadStreamError(r,e)}}handlePeerReadStreamError(e,t){this.log.error(e),this.onPeerDisconnected(t)}async handleReceivedRpc(e,t){var n;if(!this.acceptFrom(e.toString()))return this.log("received message from unacceptable peer %p",e),void(null===(n=this.metrics)||void 0===n||n.rpcRecvNotAccepted.inc());const r=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(r," messages ").concat(i," ihave ").concat(o," iwant ").concat(s," graft ").concat(a," prune ").concat(c)),t.subscriptions&&t.subscriptions.length>0){const n=[];t.subscriptions.forEach((t=>{const r=t.topic,i=!0===t.subscribe;if(null!=r){if(this.allowedTopics&&!this.allowedTopics.has(r))return;this.handleReceivedSubscription(e,r,i),n.push({topic:r,subscribe:i})}})),this.dispatchEvent(new nh("subscription-change",{detail:{peerId:e,subscriptions:n}}))}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,n){this.log("subscription update from %p topic %s",e,t);let r=this.topics.get(t);null==r&&(r=new Set,this.topics.set(t,r)),n?r.add(e.toString()):r.delete(e.toString())}async handleReceivedMessage(e,t){var n,r,i;null===(n=this.metrics)||void 0===n||n.onMsgRecvPreValidation(t.topic);const o=await this.validateReceivedMessage(e,t);switch(null===(r=this.metrics)||void 0===r||r.onMsgRecvResult(t.topic,o.code),o.code){case UC.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 UC.invalid:if(o.msgIdStr){const n=o.msgIdStr;this.score.rejectMessage(e.toString(),n,t.topic,o.reason),this.gossipTracer.rejectMessage(n,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 UC.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 nh("gossipsub:message",{detail:{propagationSource:e,msgId:o.messageId.msgIdStr,msg:o.msg}})),super.dispatchEvent(new nh("message",{detail:o.msg})))}this.opts.asyncValidation||this.forwardMessage(o.messageId.msgIdStr,t,e.toString())}}async validateReceivedMessage(e,t){var n,r;const i=null===(n=this.fastMsgIdFn)||void 0===n?void 0:n.call(this,t),o=void 0!==i?null===(r=this.fastMsgIdCache)||void 0===r?void 0:r.get(i):void 0;if(o)return{code:UC.duplicate,msgIdStr:o};const s=await async function(e,t){var n;switch(e){case DC:return null!=t.signature?{valid:!1,error:MC.SignaturePresent}:null!=t.seqno?{valid:!1,error:MC.SeqnoPresent}:null!=t.key?{valid:!1,error:MC.FromPresent}:{valid:!0,message:{type:"unsigned",topic:t.topic,data:null!==(n=t.data)&&void 0!==n?n:new Uint8Array(0)}};case PC:{var r,i;if(null==t.seqno)return{valid:!1,error:MC.InvalidSeqno};if(8!==t.seqno.length)return{valid:!1,error:MC.InvalidSeqno};if(null==t.signature)return{valid:!1,error:MC.InvalidSignature};if(null==t.from)return{valid:!1,error:MC.InvalidPeerId};let e,n;try{e=mC(t.from)}catch(o){return{valid:!1,error:MC.InvalidPeerId}}if(t.key){if(n=qb(t.key),void 0!==e.publicKey&&!ll(n.bytes,e.publicKey))return{valid:!1,error:MC.InvalidPeerId}}else{if(null==e.publicKey)return{valid:!1,error:MC.InvalidPeerId};n=qb(e.publicKey)}const s={from:t.from,data:t.data,seqno:t.seqno,topic:t.topic,signature:void 0,key:void 0},a=Zl([dR,AC.Message.encode(s).finish()]);return await n.verify(a,t.signature)?{valid:!0,message:{type:"signed",from:e,data:null!==(r=t.data)&&void 0!==r?r:new Uint8Array(0),sequenceNumber:BigInt("0x".concat(Xl(t.seqno,"base16"))),topic:t.topic,signature:t.signature,key:null!==(i=t.key)&&void 0!==i?i:Vb(n)}}:{valid:!1,error:MC.InvalidSignature}}}}(this.globalSignaturePolicy,t);if(!s.valid)return{code:UC.invalid,reason:LC.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:UC.invalid,reason:LC.Error,error:MC.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:UC.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=NC.Ignore),t="ERR_TOPIC_VALIDATOR_REJECT"===e?NC.Reject:NC.Ignore}if(t!==NC.Accept)return{code:UC.invalid,reason:FC(t),msgIdStr:l}}return{code:UC.valid,messageId:u,msg:a}}getScore(e){return this.score.score(e)}sendSubscriptions(e,t,n){this.sendRpc(e,{subscriptions:t.map((e=>({topic:e,subscribe:n})))})}async handleControlMessage(e,t){var n;if(void 0===t)return;const r=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),!r.length&&!i.length&&!o.length)return;const s=this.sendRpc(e,{messages:i,control:{iwant:r,prune:o}}),a=null===(n=r[0])||void 0===n?void 0:n.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(),n=this.acceptFromWhitelist.get(e);if(n&&n.messagesAccepted<128&&n.acceptUntil>=t)return n.messagesAccepted+=1,!0;const r=this.score.score(e);return r>=0?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+1e3}):this.acceptFromWhitelist.delete(e),r>=this.opts.scoreThresholds.graylistThreshold}handleIHave(e,t){var n,r;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:aR.LowScore}),[];const s=(null!==(n=this.peerhave.get(e))&&void 0!==n?n: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:aR.MaxIhave}),[];const c=null!==(r=this.iasked.get(e))&&void 0!==r?r:0;var l;if(c>=CC)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:aR.MaxIasked}),[];const u=new Map;if(t.forEach((e=>{var t;let{topicID:n,messageIDs:r}=e;if(!n||!r||!this.mesh.has(n))return;let i=0;r.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(n,r.length,i)})),!u.size)return[];let h=u.size;h+c>CC&&(h=CC-c),this.log("IHAVE: Asking for %d out of %d messages from %s",h,u.size,e);let d=Array.from(u.values());return RC(d),d=d.slice(0,h),this.iasked.set(e,c+h),[{messageIDs:d}]}handleIWant(e,t){var n;if(!t.length)return[];const r=this.score.score(e);if(r<this.opts.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,r),[];const i=new Map,o=new Map;let s=0;return t.forEach((t=>{let{messageIDs:n}=t;n&&n.forEach((t=>{var n;const r=this.msgIdToStrFn(t),a=this.mcache.getWithIWantCount(r,e);null!=a?(o.set(a.msg.topic,1+(null!==(n=o.get(a.msg.topic))&&void 0!==n?n:0)),a.count>3?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,t):i.set(r,a.msg)):s++}))})),null===(n=this.metrics)||void 0===n||n.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 n=[],r=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),n.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,sR.GraftBackoff),o=!1;const t=u+this.opts.graftFloodThreshold-this.opts.pruneBackoff;return i<t&&this.score.addPenalty(e,1,sR.GraftBackoff),this.addBackoff(e,c),void n.push(c)}return r<0?(this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,r,c),n.push(c),o=!1,void this.addBackoff(e,c)):l.size>=this.opts.Dhi&&!this.outbound.get(e)?(n.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,iR.Subscribed,1)))})),!n.length)return[];return await Promise.all(n.map((t=>this.makePrune(e,t,o,false))))}async handlePrune(e,t){const n=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 r;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===(r=this.metrics)||void 0===r||r.onRemoveFromMesh(i,oR.Prune,1);if("number"===typeof o&&o>0?this.doAddBackoff(e,i,1e3*o):this.addBackoff(e,i),s&&s.length){if(n<this.opts.scoreThresholds.acceptPXThreshold){this.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,n,i);continue}await this.pxConnect(s)}}}addBackoff(e,t){this.doAddBackoff(e,t,this.opts.pruneBackoff)}doAddBackoff(e,t,n){var r;let i=this.backoff.get(t);i||(i=new Map,this.backoff.set(t,i));const o=Date.now()+n;(null!==(r=i.get(e))&&void 0!==r?r: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,sR.BrokenPromise)}))}clearBackoff(){if(this.heartbeatTicks%15!==0)return;const e=Date.now();this.backoff.forEach(((t,n)=>{t.forEach(((n,r)=>{n+1*this.opts.heartbeatInterval<e&&t.delete(r)})),0===t.size&&this.backoff.delete(n)}))}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&&(RC(e),e=e.slice(0,this.opts.prunePeers));const t=[];await Promise.all(e.map((async e=>{if(!e.peerID)return;const n=mC(e.peerID),r=n.toString();if(!this.peers.has(r))if(e.signedPeerRecord)try{if(!await this.components.peerStore.consumePeerRecord(e.signedPeerRecord,n))return void this.log("bogus peer record obtained through px: could not add peer record to address book");t.push(r)}catch(i){this.log("bogus peer record obtained through px: invalid signature or not a peer record")}else t.push(r)}))),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=yC(e),n=await this.components.connectionManager.openConnection(t);for(const r of this.multicodecs)for(const e of this.components.registrar.getTopologies(r))e.onConnect(t,n)}subscribe(e){if(this.status.code!==KR.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!==KR.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 n of this.peers.keys())this.sendSubscriptions(n,[e],!1);this.leave(e)}join(e){var t;if(this.status.code!==KR.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 n=new Set,r=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)||r&&r.has(e)||n.add(e)})),null===(o=this.metrics)||void 0===o||o.onAddToMesh(e,iR.Fanout,n.size));if(n.size<this.opts.D){var s;const t=n.size;this.getRandomGossipPeers(e,this.opts.D,(e=>!n.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0&&(!r||!r.has(e)))).forEach((e=>{n.add(e)})),null===(s=this.metrics)||void 0===s||s.onAddToMesh(e,iR.Random,n.size-t)}this.mesh.set(e,n),n.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!==KR.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e),null===(t=this.metrics)||void 0===t||t.onLeave(e);const n=this.mesh.get(e);n&&(Promise.all(Array.from(n).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,n){const r=new Set,i=this.topics.get(e);i&&(this.direct.forEach((e=>{!i.has(e)||t===e||null!==n&&void 0!==n&&n.has(e)||r.add(e)})),this.floodsubPeers.forEach((e=>{i.has(e)&&t!==e&&(null===n||void 0===n||!n.has(e))&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&r.add(e)})));const o=this.mesh.get(e);return o&&o.size>0&&o.forEach((e=>{t===e||null!==n&&void 0!==n&&n.has(e)||r.add(e)})),r}selectPeersToPublish(e){const t=new Set,n={direct:0,floodsub:0,mesh:0,fanout:0},r=this.topics.get(e);if(r)if(this.opts.floodPublish)r.forEach((e=>{this.direct.has(e)?(t.add(e),n.direct++):this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),n.floodsub++)}));else{this.direct.forEach((e=>{r.has(e)&&(t.add(e),n.direct++)})),this.floodsubPeers.forEach((e=>{r.has(e)&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),n.floodsub++)}));const i=this.mesh.get(e);if(i&&i.size>0)i.forEach((e=>{t.add(e),n.mesh++}));else{const r=this.fanout.get(e);if(r&&r.size>0)r.forEach((e=>{t.add(e),n.fanout++}));else{const r=this.getRandomGossipPeers(e,this.opts.D,(e=>this.score.score(e)>=this.opts.scoreThresholds.publishThreshold));r.size>0&&(this.fanout.set(e,r),r.forEach((e=>{t.add(e),n.fanout++})))}this.fanoutLastpub.set(e,Date.now())}}return{tosend:t,tosendCount:n}}forwardMessage(e,t,n,r){var i;n&&this.score.deliverMessage(n,e,t.topic);const o=this.selectPeersToForward(t.topic,n,r);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,n){var r,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,n,r){switch(e.type){case BC.Signing:{const i={from:e.author.toBytes(),data:r,seqno:Eb(8),topic:t,signature:void 0,key:void 0},o=Zl([dR,AC.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:n,sequenceNumber:BigInt("0x".concat(Xl(i.seqno,"base16"))),topic:t,signature:i.signature,key:i.key}}}case BC.Anonymous:return{raw:{from:void 0,data:r,seqno:void 0,topic:t,signature:void 0,key:void 0},msg:{type:"unsigned",data:n,topic:t}}}}(this.publishConfig,e,t,s),l=await this.msgIdFn(c),u=this.msgIdToStrFn(l),h=null!==(r=null===n||void 0===n?void 0:n.ignoreDuplicatePublishError)&&void 0!==r?r: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===n||void 0===n?void 0:n.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 nh("gossipsub:message",{detail:{propagationSource:this.components.peerId,msgId:u,msg:c}})),super.dispatchEvent(new nh("message",{detail:c}))),{recipients:Array.from(f.values()).map((e=>yC(e)))}}reportMessageValidationResult(e,t,n){var r;let i;if(n===NC.Accept){if(i=this.mcache.validate(e),null!=i){const{message:n,originatingPeers:r}=i;this.score.deliverMessage(t,e,n.topic),this.forwardMessage(e,i.message,t,r)}}else if(i=this.mcache.remove(e),i){const r=FC(n),{message:o,originatingPeers:s}=i;this.score.rejectMessage(t,e,o.topic,r);for(const t of s)this.score.rejectMessage(t,e,o.topic,r)}const o=this.score.messageFirstSeenTimestampMs(e);null===(r=this.metrics)||void 0===r||r.onReportValidation(i,n,o)}sendGraft(e,t){const n=[{topicID:t}];this.sendRpc(e,{control:{graft:n}})}async sendPrune(e,t){const n=[await this.makePrune(e,t,this.opts.doPX,!0)];this.sendRpc(e,{control:{prune:n}})}sendRpc(e,t){var n;const r=this.streamsOutbound.get(e);if(!r)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=AC.encode(t).finish();try{r.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===(n=this.metrics)||void 0===n||n.onRpcSent(t,s.length),!0}piggybackControl(e,t,n){if(n.graft){t.control||(t.control={}),t.control.graft||(t.control.graft=[]);for(const i of n.graft){var r;i.topicID&&null!==(r=this.mesh.get(i.topicID))&&void 0!==r&&r.has(e)&&t.control.graft.push(i)}}if(n.prune){t.control||(t.control={}),t.control.prune||(t.control.prune=[]);for(const r of n.prune){var i;!r.topicID||null!==(i=this.mesh.get(r.topicID))&&void 0!==i&&i.has(e)||t.control.prune.push(r)}}}piggybackGossip(e,t,n){t.control||(t.control={}),t.control.ihave=n}async sendGraftPrune(e,t,n){const r=this.opts.doPX;for(const[i,o]of e){const e=o.map((e=>({topicID:e})));let s=[];const a=t.get(i);a&&(s=await Promise.all(a.map((async e=>{var t;return await this.makePrune(i,e,r&&!(null!==(t=n.get(i))&&void 0!==t&&t),false)}))),t.delete(i)),this.sendRpc(i,{control:{graft:e,prune:s}})}for(const[i,o]of t){const e=await Promise.all(o.map((async e=>{var t;return await this.makePrune(i,e,r&&!(null!==(t=n.get(i))&&void 0!==t&&t),false)})));this.sendRpc(i,{control:{prune:e}})}}emitGossip(e){const t=this.mcache.getGossipIDs(new Set(e.keys()));for(const[r,i]of e){var n;this.doEmitGossip(r,i,null!==(n=t.get(r))&&void 0!==n?n:[])}}doEmitGossip(e,t,n){if(!n.length)return;if(RC(n),n.length>CC&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",n.length),!t.size)return;let r=this.opts.Dlazy;const i=.25*t.size;let o=t;i>r&&(r=i),r>o.size?r=o.size:o=RC(Array.from(o)).slice(0,r),o.forEach((t=>{let r=n;n.length>CC&&(r=RC(r.slice()).slice(0,CC)),this.pushGossip(t,{topicID:e,messageIDs:r})}))}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 n=this.gossip.get(e)||[];this.gossip.set(e,n.concat(t))}async makePrune(e,t,n,r){if(this.score.prune(e,t),this.streamsOutbound.get(e).protocol===TC)return{topicID:t,peers:[]};const i=r?this.opts.unsubcribeBackoff:this.opts.pruneBackoff,o=i/1e3;if(this.doAddBackoff(e,t,i),!n)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 n=yC(e);let r;try{r=await this.components.peerStore.get(n)}catch(i){if("ERR_NOT_FOUND"!==i.code)throw i}return{peerID:n.toBytes(),signedPeerRecord:null===(t=r)||void 0===t?void 0:t.peerRecordEnvelope}})));return{topicID:t,peers:a,backoff:o}}async heartbeat(){var e,t;const{D:n,Dlo:r,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 n=RC(Array.from(a)),r=this.backoff.get(t);for(const t of n){const n=this.streamsOutbound.get(t);if(n&&this.multicodecs.includes(n.protocol)&&!e.has(t)&&!this.direct.has(t)){const e=l(t);r&&r.has(t)||!(e>=0)||c.add(t),e>=this.opts.scoreThresholds.gossipThreshold&&p.add(t)}}}const g=(n,r)=>{var i;this.log("HEARTBEAT: Remove mesh link to %s in %s",n,t),this.addBackoff(n,t),e.delete(n),l(n)>=this.opts.scoreThresholds.gossipThreshold&&p.add(n),null===(i=this.metrics)||void 0===i||i.onRemoveFromMesh(t,r,1);const o=h.get(n);o?o.push(t):h.set(n,[t])},y=(n,r)=>{var i;this.log("HEARTBEAT: Add mesh link to %s in %s",n,t),this.score.graft(n,t),e.add(n),p.delete(n),null===(i=this.metrics)||void 0===i||i.onAddToMesh(t,r,1);const o=u.get(n);o?o.push(t):u.set(n,[t])};if(e.forEach((e=>{const n=l(e);n<0&&(this.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,n,t),g(e,oR.BadScore),d.set(e,!0))})),e.size<r){const t=function(e,t){return XC(e,t,(()=>!0))}(c,n-e.size);t.forEach((e=>{y(e,iR.NotEnough)}))}if(e.size>i){let t=Array.from(e);t.sort(((e,t)=>l(t)-l(e))),t=t.slice(0,o).concat(RC(t.slice(o)));let r=0;if(t.slice(0,n).forEach((e=>{this.outbound.get(e)&&r++})),r<s){const e=e=>{const n=t[e];for(let r=e;r>0;r--)t[r]=t[r-1];t[0]=n};if(r>0){let i=r;for(let r=1;r<n&&i>0;r++)this.outbound.get(t[r])&&(e(r),i--)}let i=n-r;for(let r=n;r<t.length&&i>0;r++)this.outbound.get(t[r])&&(e(r),i--)}t.slice(n).forEach((e=>{g(e,oR.Excess)}))}if(e.size>=r){let t=0;if(e.forEach((e=>{this.outbound.get(e)&&t++})),t<s){XC(c,s-t,(e=>!0===this.outbound.get(e))).forEach((e=>{y(e,iR.Outbound)}))}}if(this.heartbeatTicks%this.opts.opportunisticGraftTicks===0&&e.size>1){const n=Array.from(e).sort(((e,t)=>l(e)-l(t))),r=Math.floor(e.size/2),i=l(n[r]);if(i<this.opts.scoreThresholds.opportunisticGraftThreshold){const e=XC(c,this.opts.opportunisticGraftPeers,(e=>l(e)>i));for(const n of e)this.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",n,t),y(n,iR.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 r=this.topics.get(t);e.forEach((t=>{(!r.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=RC(Array.from(i));for(const n of t){const t=this.streamsOutbound.get(n);if(t&&this.multicodecs.includes(t.protocol)&&!e.has(n)&&!this.direct.has(n)){const e=l(n);e>=this.opts.scoreThresholds.publishThreshold&&o.push(n),e>=this.opts.scoreThresholds.gossipThreshold&&s.add(n)}}}if(e.size<n){const t=n-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 nh("gossipsub:heartbeat"))}getRandomGossipPeers(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const r=this.topics.get(e);if(!r)return new Set;let i=[];return r.forEach((e=>{const t=this.streamsOutbound.get(e);t&&this.multicodecs.includes(t.protocol)&&n(e)&&i.push(e)})),i=RC(i),t>0&&i.length>t&&(i=i.slice(0,t)),new Set(i)}onScrapeMetrics(e){var t,n;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===(n=this.fastMsgIdCache)||void 0===n?void 0:n.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 r=0;const i=Date.now();e.connectedPeersBackoffSec.reset();for(const u of this.backoff.values()){r+=u.size;for(const[t,n]of u.entries())this.peers.has(t)&&e.connectedPeersBackoffSec.observe(Math.max(0,n-i)/1e3)}e.cacheSize.set({cache:"backoff"},r);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,n,r,i){const o={byTopic:new Map,p5w:[],p6w:[],p7w:[],score:[]};for(const s of e){const e=t.get(s);if(e){const t=mR(s,e,n,r,i);for(const[e,n]of t.byTopic){let t=o.byTopic.get(e);t||(t={p1w:[],p2w:[],p3w:[],p3bw:[],p4w:[]},o.byTopic.set(e,t)),t.p1w.push(n.p1w),t.p2w.push(n.p2w),t.p3w.push(n.p3w),t.p3bw.push(n.p3bw),t.p4w.push(n.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)}}qR.multicodec=IC;const VR=-1,HR={},WR={};function GR(e){if("number"===typeof e){if(null!=WR[e])return WR[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=HR[e])return HR[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,VR,"ip6zone"],[43,8,"ipcidr"],[53,VR,"dns",!0],[54,VR,"dns4",!0],[55,VR,"dns6",!0],[56,VR,"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,VR,"unix",!1,!0],[421,VR,"ipfs"],[421,VR,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,VR,"garlic64"],[448,0,"tls"],[449,VR,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,VR,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,VR,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);WR[t.code]=t,HR[t.name]=t}));GR("ip4"),GR("ip6"),GR("ipcidr");const $R=Object.values(ql).map((e=>e.decoder));!function(){let e=$R[0].or($R[1]);$R.slice(2).forEach((t=>e=e.or(t)))}();Symbol.for("nodejs.util.inspect.custom"),GR("dns").code,GR("dns4").code,GR("dns6").code,GR("dnsaddr").code,new Map,Symbol.for("@multiformats/js-multiaddr/multiaddr");const YR=Ju("waku:keep-alive");class QR{constructor(e,t){Xa(this,"pingKeepAliveTimers",void 0),Xa(this,"relayKeepAliveTimers",void 0),Xa(this,"options",void 0),Xa(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:n,relayKeepAlive:r}=this.options,i=e.toString();if(0!==n){const r=setInterval((()=>{t.ping(e).catch((e=>{YR("Ping failed (".concat(i,")"),e)}))}),1e3*n);this.pingKeepAliveTimers.set(i,r)}const o=this.relay;if(o&&0!==r){const t=function(e){let{contentTopic:t,ephemeral:n,metaSetter:r}=e;return new ex(t,n,r)}({contentTopic:"/relay-ping/1/ping/null",ephemeral:!0}),n=setInterval((()=>{YR("Sending Waku Relay ping message"),o.send(t,{payload:new Uint8Array([1])}).catch((e=>YR("Failed to send relay ping",e)))}),1e3*r);this.relayKeepAliveTimers.set(e,n)}}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 XR=Ju("waku:connection-manager");class JR extends eh{static create(e,t,n,r,i){let o=JR.instances.get(e);return o||(o=new JR(t,n,r,i),JR.instances.set(e,o)),o}async getPeersByDiscovery(){const e=await this.libp2p.peerStore.all(),t=this.libp2p.getConnections().map((e=>e.remotePeer)),n=[],r=[],i=[],o=[];for(const s of e){const e=await this.getTagNamesForPeer(s.id);e.includes(Vu.BOOTSTRAP)?n.push(s):e.includes(Vu.PEER_EXCHANGE)&&r.push(s)}for(const s of t){const e=await this.libp2p.peerStore.get(s),t=await this.getTagNamesForPeer(s);t.includes(Vu.BOOTSTRAP)?i.push(e):t.includes(Vu.PEER_EXCHANGE)&&o.push(e)}return{DISCOVERED:{[Vu.BOOTSTRAP]:n,[Vu.PEER_EXCHANGE]:r},CONNECTED:{[Vu.BOOTSTRAP]:i,[Vu.PEER_EXCHANGE]:o}}}constructor(e,t,n,r){super(),Xa(this,"keepAliveManager",void 0),Xa(this,"options",void 0),Xa(this,"libp2p",void 0),Xa(this,"dialAttemptsForPeer",new Map),Xa(this,"dialErrorsForPeer",new Map),Xa(this,"currentActiveDialCount",0),Xa(this,"pendingPeerDialQueue",[]),Xa(this,"onEventHandlers",{"peer:discovery":e=>{(async()=>{const{id:t}=e.detail;(await this.getTagNamesForPeer(t)).includes(Vu.BOOTSTRAP)?this.dispatchEvent(new nh(Hu.PEER_DISCOVERY_BOOTSTRAP,{detail:t})):this.dispatchEvent(new nh(Hu.PEER_DISCOVERY_PEER_EXCHANGE,{detail:t}));try{await this.attemptDial(t)}catch(n){XR("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(Vu.BOOTSTRAP)){this.libp2p.getConnections().filter((e=>e.tags.includes(Vu.BOOTSTRAP))).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(t):this.dispatchEvent(new nh(Hu.PEER_CONNECT_BOOTSTRAP,{detail:t}))}else this.dispatchEvent(new nh(Hu.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,...r},this.keepAliveManager=new QR(t,n),this.run().then((()=>XR("Connection Manager is now running"))).catch((e=>XR("Unexpected error while running service",e))),this.dialPeerStorePeers().catch((e=>XR("Unexpected error while dialing peer store peers",e)))}async dialPeerStorePeers(){const e=await this.libp2p.peerStore.all(),t=[];for(const r of e)this.libp2p.getConnections().find((e=>e.remotePeer===r.id))||t.push(this.attemptDial(r.id));try{await Promise.all(t)}catch(n){XR("Unexpected error while dialing peer store peers",n)}}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{XR("Dialing peer ".concat(e.toString())),await this.libp2p.dial(e);const t=await this.getTagNamesForPeer(e);return this.libp2p.getConnections(e).forEach((e=>e.tags=Array.from(new Set([...e.tags,...t])))),void this.dialAttemptsForPeer.delete(e.toString())}catch(r){var n;const i=r;this.dialErrorsForPeer.set(e.toString(),i),XR("Error dialing peer ".concat(e.toString()," - ").concat(i.errors)),t=null!==(n=this.dialAttemptsForPeer.get(e.toString()))&&void 0!==n?n:1,this.dialAttemptsForPeer.set(e.toString(),t+1),t<=this.options.maxDialAttemptsForPeer&&XR("Reattempting dial (".concat(t,")"))}try{return XR("Deleting undialable peer ".concat(e.toString()," from peer store. Error: ").concat(JSON.stringify(this.dialErrorsForPeer.get(e.toString()).errors[0]),"\n }")),this.dialErrorsForPeer.delete(e.toString()),await this.libp2p.peerStore.delete(e)}catch(i){throw"Error deleting undialable peer ".concat(e.toString()," from peer store - ").concat(i)}finally{this.currentActiveDialCount-=1,this.processDialQueue()}}async dropConnection(e){try{this.keepAliveManager.stop(e),await this.libp2p.hangUp(e),XR("Dropped connection with peer ".concat(e.toString()))}catch(t){XR("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=>{XR(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===Vu.BOOTSTRAP)))return!0;if(this.libp2p.getConnections().filter((e=>e.tags.find((e=>e===Vu.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 XR("Failed to get peer ".concat(e,", error: ").concat(t)),[]}}}Xa(JR,"instances",new Map);Ju("waku:waku");Ju("waku:message:version-0");const ZR=BigInt(1e6);class ex{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;if(Xa(this,"contentTopic",void 0),Xa(this,"ephemeral",void 0),Xa(this,"metaSetter",void 0),this.contentTopic=e,this.ephemeral=t,this.metaSetter=n,!e||""===e)throw new Error("Content topic must be specified")}async toWire(e){return _h.encode(await this.toProtoObj(e))}async toProtoObj(e){var t;const n=null!==(t=e.timestamp)&&void 0!==t?t:new Date,r={payload:e.payload,version:0,contentTopic:this.contentTopic,timestamp:BigInt(n.valueOf())*ZR,meta:void 0,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const e=this.metaSetter(r);return{...r,meta:e}}return r}}Ju("waku:filter:v2");Ju("waku:light-push");new Uint8Array;BigInt(1e6);var tx;!function(e){e.BACKWARD="backward",e.FORWARD="forward"}(tx||(tx={}));qh.HistoryError;Ju("waku:store");Ju("waku:wait-for-remote-peer");const nx=Ju("waku:relay");function rx(e,t){const n=performance.now();nx("validating message from ".concat(e," received on ").concat(t.topic));let r=NC.Accept;try{const e=_h.decode(t.data);e.contentTopic&&e.contentTopic.length&&e.payload&&e.payload.length||(r=NC.Reject)}catch(o){r=NC.Reject}const i=performance.now();return nx("Validation time (must be <100ms): ".concat(i-n,"ms")),r}const ix=Ju("waku:message:topic-only");class ox{constructor(e,t){Xa(this,"pubSubTopic",void 0),Xa(this,"proto",void 0),Xa(this,"payload",new Uint8Array),Xa(this,"rateLimitProof",void 0),Xa(this,"timestamp",void 0),Xa(this,"meta",void 0),Xa(this,"ephemeral",void 0),this.pubSubTopic=e,this.proto=t}get contentTopic(){return this.proto.contentTopic}}class sx{constructor(){Xa(this,"contentTopic","")}fromWireToProtoObj(e){const t=Ch.decode(e);return ix("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 ox(e,t)}}const ax=Ju("waku:relay");class cx{constructor(e,t){var n;if(Xa(this,"pubSubTopic",void 0),Xa(this,"defaultDecoder",void 0),Xa(this,"gossipSub",void 0),Xa(this,"observers",void 0),!this.isRelayPubSub(e.services.pubsub))throw Error("Failed to initialize Relay. libp2p.pubsub does not support ".concat(cx.multicodec));this.gossipSub=e.services.pubsub,this.pubSubTopic=null!==(n=null===t||void 0===t?void 0:t.pubSubTopic)&&void 0!==n?n:"/waku/2/default-waku/proto",this.gossipSub.isStarted()&&this.gossipSubSubscribe(this.pubSubTopic),this.observers=new Map,this.defaultDecoder=new sx}async start(){if(this.gossipSub.isStarted())throw Error("GossipSub already started.");await this.gossipSub.start(),this.gossipSubSubscribe(this.pubSubTopic)}async send(e,t){if(!bf(t.payload))return ax("Failed to send waku relay: message is bigger that 1MB"),{recipients:[],error:Ku.SIZE_TOO_BIG};const n=await e.toWire(t);return n?this.gossipSub.publish(this.pubSubTopic,n):(ax("Failed to encode message, aborting publish"),{recipients:[],error:Ku.ENCODE_FAILED})}subscribe(e,t){const n=Array.isArray(e)?lx(e,t):lx([e],t);for(const r of n.keys()){const e=this.observers.get(r)||new Set,t=n.get(r)||new Set;this.observers.set(r,ux(e,t))}return()=>{for(const e of n.keys()){const t=hx(this.observers.get(e)||new Set,n.get(e)||new Set);t.size?this.observers.set(e,t):this.observers.delete(e)}}}toSubscriptionIterator(e,t){return ld(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 n=await this.defaultDecoder.fromWireToProtoObj(t);if(!n||!n.contentTopic)return void ax("Message does not have a content topic, skipping");const r=this.observers.get(n.contentTopic);r&&await Promise.all(Array.from(r).map((r=>{let{decoder:i,callback:o}=r;return(async()=>{try{const r=await i.fromWireToProtoObj(t);if(!r)return void ax("Internal error: message previously decoded failed on 2nd pass.");const s=await i.fromProtoObj(e,r);s?await o(s):ax("Failed to decode messages on",n.contentTopic)}catch(r){ax("Error while decoding message:",r)}})()})))}gossipSubSubscribe(e){this.gossipSub.addEventListener("gossipsub:message",(t=>{t.detail.msg.topic===e&&(ax("Message received on ".concat(e)),this.processIncomingMessage(t.detail.msg.topic,t.detail.msg.data).catch((e=>ax("Failed to process incoming message",e))))})),this.gossipSub.topicValidators.set(e,rx),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(cx.multicodec))||!1}}function lx(e,t){const n=Array.from(ad(e).entries()).map((e=>{let[n,r]=e;return[n,new Set(r.map((e=>({decoder:e,callback:t}))))]}));return new Map(n)}function ux(e,t){for(const n of t.values())e.add(n);return e}function hx(e,t){for(const n of t.values())e.has(n)&&e.delete(n);return e}function dx(e,t){ec(e,t),t.add(e)}function fx(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}Xa(cx,"multicodec","/vac/waku/relay/2.0.0");var px=__webpack_require__(7465);const gx=Symbol.for("@libp2p/content-routing"),yx=Symbol.for("@libp2p/peer-discovery"),mx=Symbol.for("@libp2p/peer-routing");let vx;const bx=Symbol.for("nodejs.util.inspect.custom"),wx=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),Ex=114,_x=36,Sx=37;vx=Symbol.toStringTag;class Ax{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[vx](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(Ex,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:wx,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new Tx({multihash:t}):e.startsWith("16U")?new Ix({multihash:t}):new kx({multihash:t})}return function(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===_x)return new Tx({multihash:t});if(t.digest.length===Sx)return new Ix({multihash:t})}if(t.code===Rl.code)return new kx({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==Ex)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new kx({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===_x)return new Tx({multihash:e.multihash});if(t.digest.length===Sx)return new Ix({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(wx.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[bx](){return"PeerId(".concat(this.toString(),")")}}class kx extends Ax{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class Tx extends Ax{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class Ix extends Ax{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}let Cx,Rx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21;return crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"")};const xx="/",Px=(new TextEncoder).encode(xx),Dx=Px[0];Cx=Symbol.toStringTag;class Nx{constructor(e,t){if(Xa(this,"_buf",void 0),"string"===typeof e)this._buf=ru(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]!==Dx)throw new Error("Invalid key")}toString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"utf8";return Xl(this._buf,e)}uint8Array(){return this._buf}get[Cx](){return"Key(".concat(this.toString(),")")}static withNamespaces(e){return new Nx(e.join(xx))}static random(){return new Nx(Rx().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"===typeof e?new Nx(e):"function"===typeof e.uint8Array?new Nx(e.uint8Array()):null}clean(){if(null!=this._buf&&0!==this._buf.byteLength||(this._buf=Px),this._buf[0]!==Dx){const e=new Uint8Array(this._buf.byteLength+1);e.fill(Dx,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===Dx;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),n=e.list();for(let r=0;r<t.length;r++){if(n.length<r+1)return!1;const e=t[r],i=n[r];if(e<i)return!0;if(e>i)return!1}return t.length<n.length}reverse(){return Nx.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(xx).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 Nx(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(xx)||(e+=xx),e+=this.type(),new Nx(e)}parent(){const e=this.list();return 1===e.length?new Nx(xx):new Nx(e.slice(0,-1).join(xx))}child(e){return this.toString()===xx?e:e.toString()===xx?this:new Nx(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),n=0;n<e;n++)t[n]=arguments[n];return Nx.withNamespaces([...this.namespaces(),...(r=t.map((e=>e.namespaces())),[].concat(...r))]);var r}}const Ox=__webpack_require__(9842);var Bx,Lx=__webpack_require__(6327);!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"}(Bx||(Bx={}));const Mx=Aw("libp2p:keychain"),Ux="/pkcs8/",Fx="/info/",jx=new WeakMap,zx=14,Kx=16,qx=1e3,Vx={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function Hx(e){return null!=e&&("string"===typeof e&&(e===Lx(e.trim())&&e.length>0))}async function Wx(){const e=800*Math.random()+200;await new Promise((t=>setTimeout(t,e)))}function Gx(e){return new Nx(Ux+e)}function $x(e){return new Nx(Fx+e)}class Yx{constructor(e,t){var n,r,i,o,s,a,c,l,u,h;if(Xa(this,"components",void 0),Xa(this,"init",void 0),this.components=e,this.init=Ox(Vx,t),null!=this.init.pass&&(null===(n=this.init.pass)||void 0===n?void 0:n.length)<20)throw new Error("pass must be least 20 characters");if(null!=(null===(r=this.init.dek)||void 0===r?void 0:r.keyLength)&&this.init.dek.keyLength<zx)throw new Error("dek.keyLength must be least ".concat(zx," bytes"));if(null!=(null===(i=this.init.dek)||void 0===i||null===(o=i.salt)||void 0===o?void 0:o.length)&&this.init.dek.salt.length<Kx)throw new Error("dek.saltLength must be least ".concat(Kx," bytes"));if(null!=(null===(s=this.init.dek)||void 0===s?void 0:s.iterationCount)&&this.init.dek.iterationCount<qx)throw new Error("dek.iterationCount must be least ".concat(qx));const d=null!=this.init.pass&&null!=(null===(a=this.init.dek)||void 0===a?void 0:a.salt)?hR(this.init.pass,null===(c=this.init.dek)||void 0===c?void 0:c.salt,null===(l=this.init.dek)||void 0===l?void 0:l.iterationCount,null===(u=this.init.dek)||void 0===u?void 0:u.keyLength,null===(h=this.init.dek)||void 0===h?void 0:h.hash):"";jx.set(this,{dek:d})}static generateOptions(){const e=Object.assign({},Vx),t=3*Math.ceil(Kx/3);return e.dek.salt=Xl(Eb(t),"base64"),e}static get options(){return Vx}async createKey(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2048;if(!Hx(e)||"self"===e)throw await Wx(),new sc("Invalid key name",Bx.ERR_INVALID_KEY_NAME);if("string"!==typeof t)throw await Wx(),new sc("Invalid key type",Bx.ERR_INVALID_KEY_TYPE);const r=Gx(e);if(await this.components.datastore.has(r))throw await Wx(),new sc("Key name already exists",Bx.ERR_KEY_ALREADY_EXISTS);if("rsa"===t.toLowerCase())if(!Number.isSafeInteger(n)||n<2048)throw await Wx(),new sc("Invalid RSA key size",Bx.ERR_INVALID_KEY_SIZE);let i;try{const o=await Kb(t,n),s=await o.id(),a=jx.get(this);if(null==a)throw new sc("dek missing",Bx.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(r,ru(l)),u.put($x(e),ru(JSON.stringify(i))),await u.commit()}catch(o){throw await Wx(),o}return i}async listKeys(){const e={prefix:Fx},t=[];for await(const n of this.components.datastore.query(e))t.push(JSON.parse(Xl(n.value)));return t}async findKeyById(e){try{const t=(await this.listKeys()).find((t=>t.id===e));if(null==t)throw new sc("Key with id '".concat(e,"' does not exist."),Bx.ERR_KEY_NOT_FOUND);return t}catch(t){throw await Wx(),t}}async findKeyByName(e){if(!Hx(e))throw await Wx(),new sc("Invalid key name '".concat(e,"'"),Bx.ERR_INVALID_KEY_NAME);const t=$x(e);try{const e=await this.components.datastore.get(t);return JSON.parse(Xl(e))}catch(n){throw await Wx(),Mx.error(n),new sc("Key '".concat(e,"' does not exist."),Bx.ERR_KEY_NOT_FOUND)}}async removeKey(e){if(!Hx(e)||"self"===e)throw await Wx(),new sc("Invalid key name '".concat(e,"'"),Bx.ERR_INVALID_KEY_NAME);const t=Gx(e),n=await this.findKeyByName(e),r=this.components.datastore.batch();return r.delete(t),r.delete($x(e)),await r.commit(),n}async renameKey(e,t){if(!Hx(e)||"self"===e)throw await Wx(),new sc("Invalid old key name '".concat(e,"'"),Bx.ERR_OLD_KEY_NAME_INVALID);if(!Hx(t)||"self"===t)throw await Wx(),new sc("Invalid new key name '".concat(t,"'"),Bx.ERR_NEW_KEY_NAME_INVALID);const n=Gx(e),r=Gx(t),i=$x(e),o=$x(t);if(await this.components.datastore.has(r))throw await Wx(),new sc("Key '".concat(t,"' already exists"),Bx.ERR_KEY_ALREADY_EXISTS);try{const e=await this.components.datastore.get(n),s=await this.components.datastore.get(i),a=JSON.parse(Xl(s));a.name=t;const c=this.components.datastore.batch();return c.put(r,e),c.put(o,ru(JSON.stringify(a))),c.delete(n),c.delete(i),await c.commit(),a}catch(s){throw await Wx(),s}}async exportKey(e,t){if(!Hx(e))throw await Wx(),new sc("Invalid key name '".concat(e,"'"),Bx.ERR_INVALID_KEY_NAME);if(null==t)throw await Wx(),new sc("Password is required",Bx.ERR_PASSWORD_REQUIRED);const n=Gx(e);try{const e=Xl(await this.components.datastore.get(n)),r=jx.get(this);if(null==r)throw new sc("dek missing",Bx.ERR_INVALID_PARAMETERS);const i=r.dek,o=await Wb(e,i);return await o.export(t)}catch(r){throw await Wx(),r}}async exportPeerId(e){const t="temporary-password",n=await this.exportKey(e,t),r=await Wb(n,t);return async function(e,t){return e.length===_x?new Tx({multihash:jc(Dl.code,e),privateKey:t}):e.length===Sx?new Ix({multihash:jc(Dl.code,e),privateKey:t}):new kx({multihash:await Rl.digest(e),publicKey:e,privateKey:t})}(r.public.bytes,r.bytes)}async importKey(e,t,n){if(!Hx(e)||"self"===e)throw await Wx(),new sc("Invalid key name '".concat(e,"'"),Bx.ERR_INVALID_KEY_NAME);if(null==t)throw await Wx(),new sc("PEM encoded key is required",Bx.ERR_PEM_REQUIRED);const r=Gx(e);if(await this.components.datastore.has(r))throw await Wx(),new sc("Key '".concat(e,"' already exists"),Bx.ERR_KEY_ALREADY_EXISTS);let i,o;try{i=await Wb(t,n)}catch(c){throw await Wx(),new sc("Cannot read the key, most likely the password is wrong",Bx.ERR_CANNOT_READ_KEY)}try{o=await i.id();const e=jx.get(this);if(null==e)throw new sc("dek missing",Bx.ERR_INVALID_PARAMETERS);const n=e.dek;t=await i.export(n)}catch(c){throw await Wx(),c}const s={name:e,id:o},a=this.components.datastore.batch();return a.put(r,ru(t)),a.put($x(e),ru(JSON.stringify(s))),await a.commit(),s}async importPeer(e,t){try{if(!Hx(e))throw new sc("Invalid key name '".concat(e,"'"),Bx.ERR_INVALID_KEY_NAME);if(null==t)throw new sc("PeerId is required",Bx.ERR_MISSING_PRIVATE_KEY);if(null==t.privateKey)throw new sc("PeerId.privKey is required",Bx.ERR_MISSING_PRIVATE_KEY);const n=await Hb(t.privateKey),r=Gx(e);if(await this.components.datastore.has(r))throw await Wx(),new sc("Key '".concat(e,"' already exists"),Bx.ERR_KEY_ALREADY_EXISTS);const i=jx.get(this);if(null==i)throw new sc("dek missing",Bx.ERR_INVALID_PARAMETERS);const o=i.dek,s=await n.export(o),a={name:e,id:t.toString()},c=this.components.datastore.batch();return c.put(r,ru(s)),c.put($x(e),ru(JSON.stringify(a))),await c.commit(),a}catch(n){throw await Wx(),n}}async getPrivateKey(e){if(!Hx(e))throw await Wx(),new sc("Invalid key name '".concat(e,"'"),Bx.ERR_INVALID_KEY_NAME);try{const t=Gx(e);return Xl(await this.components.datastore.get(t))}catch(t){throw await Wx(),Mx.error(t),new sc("Key '".concat(e,"' does not exist."),Bx.ERR_KEY_NOT_FOUND)}}async rotateKeychainPass(e,t){var n,r,i,o;if("string"!==typeof e)throw await Wx(),new sc("Invalid old pass type '".concat(typeof e,"'"),Bx.ERR_INVALID_OLD_PASS_TYPE);if("string"!==typeof t)throw await Wx(),new sc("Invalid new pass type '".concat(typeof t,"'"),Bx.ERR_INVALID_NEW_PASS_TYPE);if(t.length<20)throw await Wx(),new sc("Invalid pass length ".concat(t.length),Bx.ERR_INVALID_PASS_LENGTH);Mx("recreating keychain");const s=jx.get(this);if(null==s)throw new sc("dek missing",Bx.ERR_INVALID_PARAMETERS);const a=s.dek;this.init.pass=t;const c=null!=t&&null!=(null===(n=this.init.dek)||void 0===n?void 0:n.salt)?hR(t,this.init.dek.salt,null===(r=this.init.dek)||void 0===r?void 0:r.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):"";jx.set(this,{dek:c});const l=await this.listKeys();for(const u of l){const e=Xl(await this.components.datastore.get(Gx(u.name))),t=await Wb(e,a),n=c.toString(),r=await t.export(n),i=this.components.datastore.batch(),o={name:u.name,id:u.id};i.put(Gx(u.name),ru(r)),i.put($x(u.name),ru(JSON.stringify(o))),await i.commit()}Mx("keychain reconstructed")}}let Qx;const Xx=Symbol.for("nodejs.util.inspect.custom"),Jx=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),Zx=114,eP=36,tP=37;Qx=Symbol.toStringTag;class nP{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Qx](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(Zx,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return sP(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Xx](){return"PeerId(".concat(this.toString(),")")}}class rP extends nP{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class iP extends nP{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class oP extends nP{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function sP(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:Jx,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new iP({multihash:t}):e.startsWith("16U")?new oP({multihash:t}):new rP({multihash:t})}return function(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===eP)return new iP({multihash:t});if(t.digest.length===tP)return new oP({multihash:t})}if(t.code===Rl.code)return new rP({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==Zx)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new rP({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===eP)return new iP({multihash:e.multihash});if(t.digest.length===tP)return new oP({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(Jx.decode(e))}function aP(e,t){const n={[Symbol.iterator]:()=>n,next:()=>{const n=e.next(),r=n.value;if(!0===n.done||null==r){return{done:!0,value:void 0}}return{done:!1,value:t(r)}}};return n}let cP,lP,uP,hP;cP=Symbol.iterator;class dP{constructor(e){if(Xa(this,"map",void 0),this.map=new Map,null!=e)for(const[t,n]of e.entries())this.map.set(t.toString(),n)}[cP](){return this.entries()}clear(){this.map.clear()}delete(e){this.map.delete(e.toString())}entries(){return aP(this.map.entries(),(e=>[sP(e[0]),e[1]]))}forEach(e){this.map.forEach(((t,n)=>{e(t,sP(n),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 aP(this.map.keys(),(e=>sP(e)))}values(){return this.map.values()}get size(){return this.map.size}}lP=Symbol.iterator;class fP{constructor(e){if(Xa(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}[lP](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return aP(this.set.entries(),(e=>{const t=sP(e[0]);return[t,t]}))}forEach(e){this.set.forEach((t=>{const n=sP(t);e(n,n,this)}))}has(e){return this.set.has(e.toString())}values(){return aP(this.set.values(),(e=>sP(e)))}intersection(e){const t=new fP;for(const n of e)this.has(n)&&t.add(n);return t}difference(e){const t=new fP;for(const n of this)e.has(n)||t.add(n);return t}union(e){const t=new fP;for(const n of e)t.add(n);for(const n of this)t.add(n);return t}}uP=Symbol.iterator;const pP=Symbol.for("nodejs.util.inspect.custom"),gP=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),yP=114,mP=36,vP=37;hP=Symbol.toStringTag;class bP{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[hP](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(yP,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return SP(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[pP](){return"PeerId(".concat(this.toString(),")")}}class wP extends bP{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class EP extends bP{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class _P extends bP{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function SP(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:gP,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new EP({multihash:t}):e.startsWith("16U")?new _P({multihash:t}):new wP({multihash:t})}return function(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===mP)return new EP({multihash:t});if(t.digest.length===vP)return new _P({multihash:t})}if(t.code===Rl.code)return new wP({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==yP)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new wP({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===mP)return new EP({multihash:e.multihash});if(t.digest.length===vP)return new _P({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(gP.decode(e))}let AP;const kP=Symbol.for("nodejs.util.inspect.custom"),TP=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),IP=114,CP=36,RP=37;AP=Symbol.toStringTag;class xP{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[AP](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(IP,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:TP,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new DP({multihash:t}):e.startsWith("16U")?new NP({multihash:t}):new PP({multihash:t})}return function(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===CP)return new DP({multihash:t});if(t.digest.length===RP)return new NP({multihash:t})}if(t.code===Rl.code)return new PP({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==IP)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new PP({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===CP)return new DP({multihash:e.multihash});if(t.digest.length===RP)return new NP({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(TP.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[kP](){return"PeerId(".concat(this.toString(),")")}}class PP extends xP{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class DP extends xP{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class NP extends xP{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}var OP=__webpack_require__(2171),BP=__webpack_require__(2552),LP=__webpack_require__(9460),MP=__webpack_require__(310),UP=__webpack_require__(2685);LP._configure(),OP._configure(BP),MP._configure(UP);const FP=["uint64","int64","sint64","fixed64","sfixed64"];function jP(e){return function(e){for(const t of FP){if(null==e[t])continue;const n=e[t];e[t]=function(){return BigInt(n.call(this).toString())}}return e}(new OP(e))}function zP(){return function(e){for(const t of FP){if(null==e[t])continue;const n=e[t];e[t]=function(e){return n.call(this,e.toString())}}return e}(MP.create())}var KP,qP;!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"}(KP||(KP={})),function(e){let t;e.codec=()=>(null==t&&(t=function(e,t){return function(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}("message",KP.LENGTH_DELIMITED,e,t)}((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.id=e.bytes();break;case 2:n.pubKey=e.bytes();break;case 3:n.privKey=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>function(e,t){const n=zP();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}(t,e.codec()),e.decode=t=>function(e,t){const n=jP(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}(t,e.codec())}(qP||(qP={}));const VP=async()=>{const e=await Kb("Ed25519"),t=await HP(e);if("Ed25519"===t.type)return t;throw new Error('Generated unexpected PeerId type "'.concat(t.type,'"'))};async function HP(e){return async function(e,t){return e.length===CP?new DP({multihash:jc(Dl.code,e),privateKey:t}):e.length===RP?new NP({multihash:jc(Dl.code,e),privateKey:t}):new PP({multihash:await Rl.digest(e),publicKey:e,privateKey:t})}(Vb(e.public),function(e,t){var n;return zb(t=(null!==(n=t)&&void 0!==n?n:"rsa").toLowerCase()),e.bytes}(e))}let WP;const GP=Symbol.for("nodejs.util.inspect.custom"),$P=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),YP=114,QP=36,XP=37;WP=Symbol.toStringTag;class JP{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[WP](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(YP,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:$P,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new eD({multihash:t}):e.startsWith("16U")?new tD({multihash:t}):new ZP({multihash:t})}return nD($P.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[GP](){return"PeerId(".concat(this.toString(),")")}}class ZP extends JP{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class eD extends JP{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class tD extends JP{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function nD(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===QP)return new eD({multihash:t});if(t.digest.length===XP)return new tD({multihash:t})}if(t.code===Rl.code)return new ZP({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==YP)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new ZP({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===QP)return new eD({multihash:e.multihash});if(t.digest.length===XP)return new tD({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}const rD="ERR_SIGNATURE_NOT_VALID";var iD=__webpack_require__(5538),oD=__webpack_require__(9462),sD=__webpack_require__(8858),aD=__webpack_require__(9114),cD=__webpack_require__(4934);sD._configure(),iD._configure(oD),aD._configure(cD);const lD=["uint64","int64","sint64","fixed64","sfixed64"];function uD(e){return function(e){for(const t of lD){if(null==e[t])continue;const n=e[t];e[t]=function(){return BigInt(n.call(this).toString())}}return e}(new iD(e))}function hD(){return function(e){for(const t of lD){if(null==e[t])continue;const n=e[t];e[t]=function(e){return n.call(this,e.toString())}}return e}(aD.create())}function dD(e,t){const n=uD(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}function fD(e,t){const n=hD();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}var pD,gD;function yD(e,t){return function(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}("message",pD.LENGTH_DELIMITED,e,t)}!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"}(pD||(pD={})),function(e){let t;e.codec=()=>(null==t&&(t=yD((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.publicKey=e.bytes();break;case 2:n.payloadType=e.bytes();break;case 3:n.payload=e.bytes();break;case 5:n.signature=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(gD||(gD={}));class mD{constructor(e){Xa(this,"peerId",void 0),Xa(this,"payloadType",void 0),Xa(this,"payload",void 0),Xa(this,"signature",void 0),Xa(this,"marshaled",void 0);const{peerId:t,payloadType:n,payload:r,signature:i}=e;this.peerId=t,this.payloadType=n,this.payload=r,this.signature=i}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=gD.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return ll(this.marshal(),e.marshal())}async validate(e){const t=vD(e,this.payloadType,this.payload);if(null==this.peerId.publicKey)throw new Error("Missing public key");return qb(this.peerId.publicKey).verify(t.subarray(),this.signature)}}Xa(mD,"createFromProtobuf",(async e=>{const t=gD.decode(e),n=await async function(e,t){return e.length===QP?new eD({multihash:jc(Dl.code,e),privateKey:t}):e.length===XP?new tD({multihash:jc(Dl.code,e),privateKey:t}):new ZP({multihash:await Rl.digest(e),publicKey:e,privateKey:t})}(t.publicKey);return new mD({peerId:n,payloadType:t.payloadType,payload:t.payload,signature:t.signature})})),Xa(mD,"seal",(async(e,t)=>{if(null==t.privateKey)throw new Error("Missing private key");const n=e.domain,r=e.codec,i=e.marshal(),o=vD(n,r,i),s=await Hb(t.privateKey),a=await s.sign(o.subarray());return new mD({peerId:t,payloadType:r,payload:i,signature:a})})),Xa(mD,"openAndCertify",(async(e,t)=>{const n=await mD.createFromProtobuf(e);if(!await n.validate(t))throw new sc("envelope signature is not valid for the given domain",rD);return n}));const vD=(e,t,n)=>{const r=ru(e),i=Cd.encode(r.byteLength),o=Cd.encode(t.length),s=Cd.encode(n.length);return new gd(i,r,o,t,s,n)};const bD=iu,wD=ou,ED=function(e){let t=0;if(e=e.toString().trim(),bD(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(wD(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;bD(n[r])&&(e=ED(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},_D=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},SD=-1,AD={},kD={};function TD(e){if("number"===typeof e){if(null!=kD[e])return kD[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=AD[e])return AD[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,SD,"ip6zone"],[43,8,"ipcidr"],[53,SD,"dns",!0],[54,SD,"dns4",!0],[55,SD,"dns6",!0],[56,SD,"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,SD,"unix",!1,!0],[421,SD,"ipfs"],[421,SD,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,SD,"garlic64"],[448,0,"tls"],[449,SD,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,SD,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,SD,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);kD[t.code]=t,AD[t.name]=t}));TD("ip4"),TD("ip6"),TD("ipcidr");function ID(e,t){switch(TD(e).code){case 4:case 41:return function(e){const t=_D(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 BD(t);case 6:case 273:case 33:case 132:return ND(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return LD(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function CD(e,t){switch(TD(e).code){case 4:case 41:return PD(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return OD(t);case 6:case 273:case 33:case 132:return DD(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?zc(vc.decode("z".concat(e))).bytes:tl.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=qc.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=DD(r);return Zl([n,i],n.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 n=qc.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=DD(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=xD.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const RD=Object.values(ql).map((e=>e.decoder)),xD=function(){let e=RD[0].or(RD[1]);return RD.slice(2).forEach((t=>e=e.or(t))),e}();function PD(e){if(!su(e))throw new Error("invalid ip address");return ED(e)}function DD(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function ND(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function OD(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}function BD(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function LD(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=ND(n);return"".concat(r,":").concat(i)}function MD(e){return e.map((e=>{const t=GD(e);return null!=e[1]?[t.code,ID(t.code,e[1])]:[t.code]}))}function UD(e){return qD(Zl(e.map((e=>{const t=GD(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function FD(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var n;return Jl.decode(t)+(null!==(n=Jl.decode.bytes)&&void 0!==n?n:0)}function jD(e){const t=[];let n=0;for(;n<e.length;){var r;const i=Jl.decode(e,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0,s=FD(TD(i),e.slice(n+o));if(0===s){t.push([i]),n+=o;continue}const a=e.slice(n+o,n+o+s);if(n+=s+o,n>e.length)throw WD("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([i,a])}return t}function zD(e){return function(e){const t=[];return e.map((e=>{const n=GD(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),HD(t.join("/"))}(MD(jD(e)))}function KD(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=TD(i);if(0!==o.size){if(r++,r>=n.length)throw WD("invalid address: "+e);if(!0===o.path){t.push([i,HD(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=HD(e));return UD(t.map((e=>{Array.isArray(e)||(e=[e]);const t=GD(e);return e.length>1?[t.code,CD(t.code,e[1])]:[t.code]})))}function qD(e){const t=VD(e);if(null!=t)throw t;return Uint8Array.from(e)}function VD(e){try{jD(e)}catch(t){return t}}function HD(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function WD(e){return new Error("Error parsing address: "+e)}function GD(e){return TD(e[0])}const $D=Symbol.for("nodejs.util.inspect.custom"),YD=[TD("dns").code,TD("dns4").code,TD("dns6").code,TD("dnsaddr").code],QD=new Map,XD=Symbol.for("@multiformats/js-multiaddr/multiaddr");function JD(e){return Boolean(null===e||void 0===e?void 0:e[XD])}var ZD=new WeakMap,eN=new WeakMap,tN=new WeakMap,nN=new WeakMap;class rN{constructor(e){if(Xa(this,"bytes",void 0),tc(this,ZD,{writable:!0,value:void 0}),tc(this,eN,{writable:!0,value:void 0}),tc(this,tN,{writable:!0,value:void 0}),tc(this,nN,{writable:!0,value:void 0}),Xa(this,XD,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=qD(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=KD(e)}else{if(!JD(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=qD(e.bytes)}}toString(){return null==ic(this,ZD)&&rc(this,ZD,zD(this.bytes)),ic(this,ZD)}toJSON(){return this.toString()}toOptions(){let e,t,n,r,i="";const o=TD("tcp"),s=TD("udp"),a=TD("ip4"),c=TD("ip6"),l=TD("dns6"),u=TD("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),YD.includes(h)&&(t=o.name,r=443,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=TD(h).name,r=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=TD(h).name,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==n||null==r)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},TD(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){var r;const i=Jl.decode(t,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0;n+=FD(TD(i),t.slice(n+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==ic(this,eN)&&rc(this,eN,jD(this.bytes)),ic(this,eN)}stringTuples(){return null==ic(this,tN)&&rc(this,tN,MD(this.tuples())),ic(this,tN)}encapsulate(e){return e=new rN(e),new rN(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new rN(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new rN(UD(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===AD.ipfs.code)),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]?Xl(vc.decode("z".concat(e)),"base58btc"):Xl(tl.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===ic(this,nN))try{rc(this,nN,this.stringTuples().filter((e=>!0===TD(e[0]).path))[0][1]),null==ic(this,nN)&&rc(this,nN,null)}catch{rc(this,nN,null)}return ic(this,nN)}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=QD.get(t.name);if(null==n)throw new sc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new rN(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))}[$D](){return"Multiaddr(".concat(zD(this.bytes),")")}}const iN=Uint8Array.from([3,1]);var oN;!function(e){let t,n;!function(e){let t;e.codec=()=>(null==t&&(t=yD((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.multiaddr&&e.multiaddr.byteLength>0&&(t.uint32(10),t.bytes(e.multiaddr)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={multiaddr:new Uint8Array(0)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.multiaddr=e.bytes();else e.skipType(7&t)}return n}))),t),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(t=e.AddressInfo||(e.AddressInfo={})),e.codec=()=>(null==n&&(n=yD((function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&n.fork(),null!=t.peerId&&t.peerId.byteLength>0&&(n.uint32(10),n.bytes(t.peerId)),null!=t.seq&&0n!==t.seq&&(n.uint32(16),n.uint64(t.seq)),null!=t.addresses)for(const i of t.addresses)n.uint32(26),e.AddressInfo.codec().encode(i,n);!1!==r.lengthDelimited&&n.ldelim()}),((t,n)=>{const r={peerId:new Uint8Array(0),seq:0n,addresses:[]},i=null==n?t.len:t.pos+n;for(;t.pos<i;){const n=t.uint32();switch(n>>>3){case 1:r.peerId=t.bytes();break;case 2:r.seq=t.uint64();break;case 3:r.addresses.push(e.AddressInfo.codec().decode(t,t.uint32()));break;default:t.skipType(7&n)}}return r}))),n),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(oN||(oN={}));class sN{constructor(e){Xa(this,"peerId",void 0),Xa(this,"multiaddrs",void 0),Xa(this,"seqNumber",void 0),Xa(this,"domain",sN.DOMAIN),Xa(this,"codec",sN.CODEC),Xa(this,"marshaled",void 0);const{peerId:t,multiaddrs:n,seqNumber:r}=e;this.peerId=t,this.multiaddrs=null!==n&&void 0!==n?n:[],this.seqNumber=null!==r&&void 0!==r?r:BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=oN.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))})),this.marshaled}equals(e){return e instanceof sN&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!function(e,t){const n=(e,t)=>e.toString().localeCompare(t.toString());return e.length===t.length&&(t.sort(n),e.sort(n).every(((e,n)=>t[n].equals(e))))}(this.multiaddrs,e.multiaddrs)))}}let aN;Xa(sN,"createFromProtobuf",(e=>{var t;const n=oN.decode(e),r=nD(n.peerId),i=(null!==(t=n.addresses)&&void 0!==t?t:[]).map((e=>{return t=e.multiaddr,new rN(t);var t})),o=n.seq;return new sN({peerId:r,multiaddrs:i,seqNumber:o})})),Xa(sN,"DOMAIN","libp2p-peer-record"),Xa(sN,"CODEC",iN);const cN=Symbol.for("nodejs.util.inspect.custom"),lN=Object.values(ql).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),ql.identity.decoder),uN=114,hN=36,dN=37;aN=Symbol.toStringTag;class fN{constructor(e){Xa(this,"type",void 0),Xa(this,"multihash",void 0),Xa(this,"privateKey",void 0),Xa(this,"publicKey",void 0),Xa(this,"string",void 0),Xa(this,Ja,!0),this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[aN](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=vc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return tl.createV1(uN,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return ll(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var n;if(t=null!==(n=t)&&void 0!==n?n:lN,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=zc(vc.decode("z".concat(e)));return e.startsWith("12D")?new gN({multihash:t}):e.startsWith("16U")?new yN({multihash:t}):new pN({multihash:t})}return mN(lN.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return ll(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[cN](){return"PeerId(".concat(this.toString(),")")}}class pN extends fN{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class gN extends fN{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class yN extends fN{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function mN(e){try{const t=zc(e);if(t.code===Dl.code){if(t.digest.length===hN)return new gN({multihash:t});if(t.digest.length===dN)return new yN({multihash:t})}if(t.code===Rl.code)return new pN({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==uN)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Rl.code)return new pN({multihash:e.multihash});if(t.code===Dl.code){if(t.digest.length===hN)return new gN({multihash:e.multihash});if(t.digest.length===dN)return new yN({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(tl.decode(e))}throw new Error("Supplied PeerID CID is invalid")}var vN=__webpack_require__(7143);class bN extends Error{constructor(e){super(e),this.name="TimeoutError"}}class wN extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const EN=e=>void 0===globalThis.DOMException?new wN(e):new DOMException(e),_N=e=>{const t=void 0===e.reason?EN("This operation was aborted."):e.reason;return t instanceof Error?t:EN(t)};var SN,AN=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class kN{constructor(){SN.set(this,[])}enqueue(e,t){const n={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&AN(this,SN,"f")[this.size-1].priority>=t.priority)return void AN(this,SN,"f").push(n);const r=function(e,t,n){let r=0,i=e.length;for(;i>0;){const o=Math.trunc(i/2);let s=r+o;n(e[s],t)<=0?(r=++s,i-=o+1):i=o}return r}(AN(this,SN,"f"),n,((e,t)=>t.priority-e.priority));AN(this,SN,"f").splice(r,0,n)}dequeue(){const e=AN(this,SN,"f").shift();return null===e||void 0===e?void 0:e.run}filter(e){return AN(this,SN,"f").filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return AN(this,SN,"f").length}}SN=new WeakMap;var TN,IN,CN,RN,xN,PN,DN,NN,ON,BN,LN,MN,UN,FN,jN,zN,KN,qN,VN,HN,WN,GN,$N,YN,QN,XN,JN=function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof 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"===r?i.call(e,n):i?i.value=n:t.set(e,n),n},ZN=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class eO extends Error{}class tO extends vN{constructor(e){var t,n,r,i;if(super(),TN.add(this),IN.set(this,void 0),CN.set(this,void 0),RN.set(this,0),xN.set(this,void 0),PN.set(this,void 0),DN.set(this,0),NN.set(this,void 0),ON.set(this,void 0),BN.set(this,void 0),LN.set(this,void 0),MN.set(this,0),UN.set(this,void 0),FN.set(this,void 0),jN.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:kN,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(n=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==n?n:"","` (").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===(r=e.interval)||void 0===r?void 0:r.toString())&&void 0!==i?i:"","` (").concat(typeof e.interval,")"));JN(this,IN,e.carryoverConcurrencyCount,"f"),JN(this,CN,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,"f"),JN(this,xN,e.intervalCap,"f"),JN(this,PN,e.interval,"f"),JN(this,BN,new e.queueClass,"f"),JN(this,LN,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,JN(this,jN,!0===e.throwOnTimeout,"f"),JN(this,FN,!1===e.autoStart,"f")}get concurrency(){return ZN(this,UN,"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,")"));JN(this,UN,e,"f"),ZN(this,TN,"m",YN).call(this)}async add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t={timeout:this.timeout,throwOnTimeout:ZN(this,jN,"f"),...t},new Promise(((n,r)=>{ZN(this,BN,"f").enqueue((async()=>{var i,o,s;JN(this,MN,(o=ZN(this,MN,"f"),++o),"f"),JN(this,RN,(s=ZN(this,RN,"f"),++s),"f");try{if(null===(i=t.signal)||void 0===i?void 0:i.aborted)throw new eO("The task was aborted.");let r=e({signal:t.signal});t.timeout&&(r=function(e,t,n,r){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((r={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...r}).signal){const{signal:e}=r;e.aborted&&s(_N(e)),e.addEventListener("abort",(()=>{s(_N(e))}))}i=r.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof n){try{o(n())}catch(a){s(a)}return}const r="string"===typeof n?n:"Promise timed out after ".concat(t," milliseconds"),i=n instanceof Error?n:new bN(r);"function"===typeof e.cancel&&e.cancel(),s(i)}),t),(async()=>{try{o(await e)}catch(t){s(t)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()}else o(e)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(Promise.resolve(r),t.timeout)),t.signal&&(r=Promise.race([r,ZN(this,TN,"m",QN).call(this,t.signal)]));const o=await r;n(o),this.emit("completed",o)}catch(a){if(a instanceof bN&&!t.throwOnTimeout)return void n();r(a),this.emit("error",a)}finally{ZN(this,TN,"m",qN).call(this)}}),t),this.emit("add"),ZN(this,TN,"m",WN).call(this)}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return ZN(this,FN,"f")?(JN(this,FN,!1,"f"),ZN(this,TN,"m",YN).call(this),this):this}pause(){JN(this,FN,!0,"f")}clear(){JN(this,BN,new(ZN(this,LN,"f")),"f")}async onEmpty(){0!==ZN(this,BN,"f").size&&await ZN(this,TN,"m",XN).call(this,"empty")}async onSizeLessThan(e){ZN(this,BN,"f").size<e||await ZN(this,TN,"m",XN).call(this,"next",(()=>ZN(this,BN,"f").size<e))}async onIdle(){0===ZN(this,MN,"f")&&0===ZN(this,BN,"f").size||await ZN(this,TN,"m",XN).call(this,"idle")}get size(){return ZN(this,BN,"f").size}sizeBy(e){return ZN(this,BN,"f").filter(e).length}get pending(){return ZN(this,MN,"f")}get isPaused(){return ZN(this,FN,"f")}}IN=new WeakMap,CN=new WeakMap,RN=new WeakMap,xN=new WeakMap,PN=new WeakMap,DN=new WeakMap,NN=new WeakMap,ON=new WeakMap,BN=new WeakMap,LN=new WeakMap,MN=new WeakMap,UN=new WeakMap,FN=new WeakMap,jN=new WeakMap,TN=new WeakSet,zN=function(){return ZN(this,CN,"f")||ZN(this,RN,"f")<ZN(this,xN,"f")},KN=function(){return ZN(this,MN,"f")<ZN(this,UN,"f")},qN=function(){var e;JN(this,MN,(e=ZN(this,MN,"f"),--e),"f"),ZN(this,TN,"m",WN).call(this),this.emit("next")},VN=function(){ZN(this,TN,"m",$N).call(this),ZN(this,TN,"m",GN).call(this),JN(this,ON,void 0,"f")},HN=function(){const e=Date.now();if(void 0===ZN(this,NN,"f")){const t=ZN(this,DN,"f")-e;if(!(t<0))return void 0===ZN(this,ON,"f")&&JN(this,ON,setTimeout((()=>{ZN(this,TN,"m",VN).call(this)}),t),"f"),!0;JN(this,RN,ZN(this,IN,"f")?ZN(this,MN,"f"):0,"f")}return!1},WN=function(){if(0===ZN(this,BN,"f").size)return ZN(this,NN,"f")&&clearInterval(ZN(this,NN,"f")),JN(this,NN,void 0,"f"),this.emit("empty"),0===ZN(this,MN,"f")&&this.emit("idle"),!1;if(!ZN(this,FN,"f")){const e=!ZN(this,TN,"a",HN);if(ZN(this,TN,"a",zN)&&ZN(this,TN,"a",KN)){const t=ZN(this,BN,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&ZN(this,TN,"m",GN).call(this),!0)}}return!1},GN=function(){ZN(this,CN,"f")||void 0!==ZN(this,NN,"f")||(JN(this,NN,setInterval((()=>{ZN(this,TN,"m",$N).call(this)}),ZN(this,PN,"f")),"f"),JN(this,DN,Date.now()+ZN(this,PN,"f"),"f"))},$N=function(){0===ZN(this,RN,"f")&&0===ZN(this,MN,"f")&&ZN(this,NN,"f")&&(clearInterval(ZN(this,NN,"f")),JN(this,NN,void 0,"f")),JN(this,RN,ZN(this,IN,"f")?ZN(this,MN,"f"):0,"f"),ZN(this,TN,"m",YN).call(this)},YN=function(){for(;ZN(this,TN,"m",WN).call(this););},QN=async function(e){return new Promise(((t,n)=>{e.addEventListener("abort",(()=>{n(new eO("The task was aborted."))}),{once:!0})}))},XN=async function(e,t){return new Promise((n=>{const r=()=>{t&&!t()||(this.off(e,r),n())};this.on(e,r)}))};const nO="lock:worker:request-read",rO="lock:worker:release-read",iO="lock:master:grant-read",oO="lock:worker:request-write",sO="lock:worker:release-write",aO="lock:master:grant-write",cO={},lO=e=>{e.addEventListener("message",(t=>{lO.dispatchEvent("message",e,t)})),null!=e.port&&e.port.addEventListener("message",(t=>{lO.dispatchEvent("message",e,t)}))};lO.addEventListener=(e,t)=>{null==cO[e]&&(cO[e]=[]),cO[e].push(t)},lO.removeEventListener=(e,t)=>{null!=cO[e]&&(cO[e]=cO[e].filter((e=>e===t)))},lO.dispatchEvent=function(e,t,n){null!=cO[e]&&cO[e].forEach((e=>e(t,n)))};const uO=lO,hO=(e,t,n,r,i)=>(o,s)=>{if(s.data.type!==n)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=n=>{if(null==n||null==n.data)return;const i=n.data.type,s=(n.data.name,n.data.identifier);i===r&&s===a.identifier&&(o.removeEventListener("message",t),e())};o.addEventListener("message",t)})))}}))},dO=(e,t,n,r)=>async()=>{const i=Rx();return globalThis.postMessage({type:t,identifier:i,name:e}),await new Promise((t=>{const o=s=>{if(null==s||null==s.data)return;const a=s.data.type,c=s.data.identifier;a===n&&c===i&&(globalThis.removeEventListener("message",o),t((()=>{globalThis.postMessage({type:r,identifier:i,name:e})})))};globalThis.addEventListener("message",o)}))},fO={singleProcess:!1},pO=e=>{e=Object.assign({},fO,e);if(Boolean(globalThis.document)||e.singleProcess){const e=new EventTarget;return uO.addEventListener("message",hO(e,"requestReadLock",nO,rO,iO)),uO.addEventListener("message",hO(e,"requestWriteLock",oO,sO,aO)),e}return{isWorker:!0,readLock:e=>dO(e,nO,iO,rO),writeLock:e=>dO(e,oO,aO,sO)}},gO={};let yO;async function mO(e,t){let n;const r=new Promise((e=>{n=e}));return e.add((async()=>await GS((async()=>await new Promise((e=>{n((()=>{e()}))})))(),{milliseconds:t.timeout}))),await r}const vO=(e,t)=>{if(!0===yO.isWorker)return{readLock:yO.readLock(e,t),writeLock:yO.writeLock(e,t)};const n=new tO({concurrency:1});let r;return{async readLock(){if(null!=r)return await mO(r,t);r=new tO({concurrency:t.concurrency,autoStart:!1});const e=r,i=mO(r,t);return n.add((async()=>(e.start(),await e.onIdle().then((()=>{r===e&&(r=null)}))))),await i},writeLock:async()=>(r=null,await mO(n,t))}},bO={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};const wO={ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS"};var EO=__webpack_require__(5124),_O=__webpack_require__(8389),SO=__webpack_require__(8765),AO=__webpack_require__(172),kO=__webpack_require__(2710);SO._configure(),EO._configure(_O),AO._configure(kO);const TO=["uint64","int64","sint64","fixed64","sfixed64"];function IO(e){return function(e){for(const t of TO){if(null==e[t])continue;const n=e[t];e[t]=function(){return BigInt(n.call(this).toString())}}return e}(new EO(e))}function CO(){return function(e){for(const t of TO){if(null==e[t])continue;const n=e[t];e[t]=function(e){return n.call(this,e.toString())}}return e}(AO.create())}function RO(e,t){const n=IO(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}function xO(e,t){const n=CO();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}var PO,DO,NO,OO;function BO(e,t){return function(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}("message",PO.LENGTH_DELIMITED,e,t)}!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"}(PO||(PO={})),function(e){let t,n,r;!function(e){let t;e.codec=()=>(null==t&&(t=BO((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={key:"",value:new Uint8Array(0)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.key=e.string();break;case 2:n.value=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>xO(t,e.codec()),e.decode=t=>RO(t,e.codec())}(t=e.Peer$metadataEntry||(e.Peer$metadataEntry={})),function(e){let t;e.codec=()=>(null==t&&(t=BO((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&t.fork(),null!=e.key&&""!==e.key&&(t.uint32(10),t.string(e.key)),null!=e.value&&(t.uint32(18),OO.codec().encode(e.value,t)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={key:""},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.key=e.string();break;case 2:n.value=OO.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>xO(t,e.codec()),e.decode=t=>RO(t,e.codec())}(n=e.Peer$tagsEntry||(e.Peer$tagsEntry={})),e.codec=()=>(null==r&&(r=BO((function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&n.fork(),null!=t.addresses)for(const e of t.addresses)n.uint32(10),NO.codec().encode(e,n);if(null!=t.protocols)for(const e of t.protocols)n.uint32(18),n.string(e);if(null!=t.publicKey&&(n.uint32(34),n.bytes(t.publicKey)),null!=t.peerRecordEnvelope&&(n.uint32(42),n.bytes(t.peerRecordEnvelope)),null!=t.metadata&&0!==t.metadata.size)for(const[i,o]of t.metadata.entries())n.uint32(50),e.Peer$metadataEntry.codec().encode({key:i,value:o},n);if(null!=t.tags&&0!==t.tags.size)for(const[i,o]of t.tags.entries())n.uint32(58),e.Peer$tagsEntry.codec().encode({key:i,value:o},n);!1!==r.lengthDelimited&&n.ldelim()}),((t,n)=>{const r={addresses:[],protocols:[],metadata:new Map,tags:new Map},i=null==n?t.len:t.pos+n;for(;t.pos<i;){const n=t.uint32();switch(n>>>3){case 1:r.addresses.push(NO.codec().decode(t,t.uint32()));break;case 2:r.protocols.push(t.string());break;case 4:r.publicKey=t.bytes();break;case 5:r.peerRecordEnvelope=t.bytes();break;case 6:{const n=e.Peer$metadataEntry.codec().decode(t,t.uint32());r.metadata.set(n.key,n.value);break}case 7:{const n=e.Peer$tagsEntry.codec().decode(t,t.uint32());r.tags.set(n.key,n.value);break}default:t.skipType(7&n)}}return r}))),r),e.encode=t=>xO(t,e.codec()),e.decode=t=>RO(t,e.codec())}(DO||(DO={})),function(e){let t;e.codec=()=>(null==t&&(t=BO((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={multiaddr:new Uint8Array(0)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.multiaddr=e.bytes();break;case 2:n.isCertified=e.bool();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>xO(t,e.codec()),e.decode=t=>RO(t,e.codec())}(NO||(NO={})),function(e){let t;e.codec=()=>(null==t&&(t=BO((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.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!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={value:0},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.value=e.uint32();break;case 2:n.expiry=e.uint64();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>xO(t,e.codec()),e.decode=t=>RO(t,e.codec())}(OO||(OO={}));const LO=iu,MO=ou,UO=function(e){let t=0;if(e=e.toString().trim(),LO(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(MO(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;LO(n[r])&&(e=UO(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},FO=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},jO=-1,zO={},KO={};function qO(e){if("number"===typeof e){if(null!=KO[e])return KO[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=zO[e])return zO[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,jO,"ip6zone"],[43,8,"ipcidr"],[53,jO,"dns",!0],[54,jO,"dns4",!0],[55,jO,"dns6",!0],[56,jO,"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,jO,"unix",!1,!0],[421,jO,"ipfs"],[421,jO,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,jO,"garlic64"],[448,0,"tls"],[449,jO,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,jO,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,jO,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);KO[t.code]=t,zO[t.name]=t}));qO("ip4"),qO("ip6"),qO("ipcidr");function VO(e,t){switch(qO(e).code){case 4:case 41:return function(e){const t=FO(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 JO(t);case 6:case 273:case 33:case 132:return QO(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return ZO(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function HO(e,t){switch(qO(e).code){case 4:case 41:return $O(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return XO(t);case 6:case 273:case 33:case 132:return YO(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?zc(vc.decode("z".concat(e))).bytes:tl.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=qc.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=YO(r);return Zl([n,i],n.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 n=qc.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=YO(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=GO.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const WO=Object.values(ql).map((e=>e.decoder)),GO=function(){let e=WO[0].or(WO[1]);return WO.slice(2).forEach((t=>e=e.or(t))),e}();function $O(e){if(!su(e))throw new Error("invalid ip address");return UO(e)}function YO(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function QO(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function XO(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}function JO(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function ZO(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=QO(n);return"".concat(r,":").concat(i)}function eB(e){return e.map((e=>{const t=uB(e);return null!=e[1]?[t.code,VO(t.code,e[1])]:[t.code]}))}function tB(e){return sB(Zl(e.map((e=>{const t=uB(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function nB(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var n;return Jl.decode(t)+(null!==(n=Jl.decode.bytes)&&void 0!==n?n:0)}function rB(e){const t=[];let n=0;for(;n<e.length;){var r;const i=Jl.decode(e,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0,s=nB(qO(i),e.slice(n+o));if(0===s){t.push([i]),n+=o;continue}const a=e.slice(n+o,n+o+s);if(n+=s+o,n>e.length)throw lB("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([i,a])}return t}function iB(e){return function(e){const t=[];return e.map((e=>{const n=uB(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),cB(t.join("/"))}(eB(rB(e)))}function oB(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=qO(i);if(0!==o.size){if(r++,r>=n.length)throw lB("invalid address: "+e);if(!0===o.path){t.push([i,cB(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=cB(e));return tB(t.map((e=>{Array.isArray(e)||(e=[e]);const t=uB(e);return e.length>1?[t.code,HO(t.code,e[1])]:[t.code]})))}function sB(e){const t=aB(e);if(null!=t)throw t;return Uint8Array.from(e)}function aB(e){try{rB(e)}catch(t){return t}}function cB(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function lB(e){return new Error("Error parsing address: "+e)}function uB(e){return qO(e[0])}const hB=Symbol.for("nodejs.util.inspect.custom"),dB=[qO("dns").code,qO("dns4").code,qO("dns6").code,qO("dnsaddr").code],fB=new Map,pB=Symbol.for("@multiformats/js-multiaddr/multiaddr");function gB(e){return Boolean(null===e||void 0===e?void 0:e[pB])}var yB=new WeakMap,mB=new WeakMap,vB=new WeakMap,bB=new WeakMap;class wB{constructor(e){if(Xa(this,"bytes",void 0),tc(this,yB,{writable:!0,value:void 0}),tc(this,mB,{writable:!0,value:void 0}),tc(this,vB,{writable:!0,value:void 0}),tc(this,bB,{writable:!0,value:void 0}),Xa(this,pB,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=sB(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=oB(e)}else{if(!gB(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=sB(e.bytes)}}toString(){return null==ic(this,yB)&&rc(this,yB,iB(this.bytes)),ic(this,yB)}toJSON(){return this.toString()}toOptions(){let e,t,n,r,i="";const o=qO("tcp"),s=qO("udp"),a=qO("ip4"),c=qO("ip6"),l=qO("dns6"),u=qO("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),dB.includes(h)&&(t=o.name,r=443,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=qO(h).name,r=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=qO(h).name,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==n||null==r)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},qO(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){var r;const i=Jl.decode(t,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0;n+=nB(qO(i),t.slice(n+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==ic(this,mB)&&rc(this,mB,rB(this.bytes)),ic(this,mB)}stringTuples(){return null==ic(this,vB)&&rc(this,vB,eB(this.tuples())),ic(this,vB)}encapsulate(e){return e=new wB(e),new wB(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new wB(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new wB(tB(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===zO.ipfs.code)),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]?Xl(vc.decode("z".concat(e)),"base58btc"):Xl(tl.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===ic(this,bB))try{rc(this,bB,this.stringTuples().filter((e=>!0===qO(e[0]).path))[0][1]),null==ic(this,bB)&&rc(this,bB,null)}catch{rc(this,bB,null)}return ic(this,bB)}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=fB.get(t.name);if(null==n)throw new sc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new wB(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))}[hB](){return"Multiaddr(".concat(iB(this.bytes),")")}}function EB(e){return new wB(e)}function _B(e,t){var n;const r=DO.decode(t);null!=r.publicKey&&null==e.publicKey&&(e=function(e){if("RSA"===e.type)return new pN(e);if("Ed25519"===e.type)return new gN(e);if("secp256k1"===e.type)return new yN(e);throw new sc("Not a PeerId","ERR_INVALID_PARAMETERS")}({...e,publicKey:e.publicKey}));const i=new Map,o=BigInt(Date.now());for(const[s,a]of r.tags.entries())null!=a.expiry&&a.expiry<o||i.set(s,a);return{...r,id:e,addresses:r.addresses.map((e=>{let{multiaddr:t,isCertified:n}=e;return{multiaddr:EB(t),isCertified:null!==n&&void 0!==n&&n}})),metadata:r.metadata,peerRecordEnvelope:null!==(n=r.peerRecordEnvelope)&&void 0!==n?n:void 0,tags:i}}const SB="/peers/";function AB(e){if(!Za(e)||null==e.type)throw new sc("Invalid PeerId",wO.ERR_INVALID_PARAMETERS);const t=e.toCID().toString();return new Nx("".concat(SB).concat(t))}async function kB(e,t,n){const r=new Map;for(const o of n){var i;if(null==o)continue;if(o.multiaddr instanceof Uint8Array&&(o.multiaddr=EB(o.multiaddr)),!gB(o.multiaddr))throw new sc("Multiaddr was invalid",wO.ERR_INVALID_PARAMETERS);if(!await t(e,o.multiaddr))continue;const n=null!==(i=o.isCertified)&&void 0!==i&&i,s=o.multiaddr.toString(),a=r.get(s);null!=a?o.isCertified=a.isCertified||n:r.set(s,{multiaddr:o.multiaddr,isCertified:n})}return[...r.values()].sort(((e,t)=>e.multiaddr.toString().localeCompare(t.multiaddr.toString()))).map((e=>{let{isCertified:t,multiaddr:n}=e;return{isCertified:t,multiaddr:n.bytes}}))}async function TB(e,t,n,r){var i,o,s,a,c,l,u;if(null==t)throw new sc("Invalid PeerData",wO.ERR_INVALID_PARAMETERS);if(null!=t.publicKey&&null!=e.publicKey&&!ll(t.publicKey,e.publicKey))throw new sc("publicKey bytes do not match peer id publicKey bytes",wO.ERR_INVALID_PARAMETERS);const h=r.existingPeer;if(null!=h&&!e.equals(h.id))throw new sc("peer id did not match existing peer id",wO.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"===n){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=IB(t.metadata instanceof Map?[...t.metadata.entries()]:Object.entries(t.metadata),{validate:CB})}if(null!=t.tags){g=IB(t.tags instanceof Map?[...t.tags.entries()]:Object.entries(t.tags),{validate:RB,map:xB})}null!=t.peerRecordEnvelope&&(y=t.peerRecordEnvelope)}if("merge"===n){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,n]of e)null==n?p.delete(t):p.set(t,n);p=IB([...p.entries()],{validate:CB})}if(null!=t.tags){const e=t.tags instanceof Map?[...t.tags.entries()]:Object.entries(t.tags),n=new Map(g);for(const[t,r]of e)null==r?n.delete(t):n.set(t,r);g=IB([...n.entries()],{validate:RB,map:xB})}null!=t.peerRecordEnvelope&&(y=t.peerRecordEnvelope)}const m={addresses:await kB(e,null!==(c=r.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 IB(e,t){const n=new Map;for(const[o,s]of e)null!=s&&t.validate(o,s);for(const[o,s]of e.sort(((e,t)=>{let[n]=e,[r]=t;return n.localeCompare(r)}))){var r,i;if(null!=s)n.set(o,null!==(r=null===(i=t.map)||void 0===i?void 0:i.call(t,o,s))&&void 0!==r?r:s)}return n}function CB(e,t){if("string"!==typeof e)throw new sc("Metadata key must be a string",wO.ERR_INVALID_PARAMETERS);if(!(t instanceof Uint8Array))throw new sc("Metadata value must be a Uint8Array",wO.ERR_INVALID_PARAMETERS)}function RB(e,t){if("string"!==typeof e)throw new sc("Tag name must be a string",wO.ERR_INVALID_PARAMETERS);if(null!=t.value){if(parseInt("".concat(t.value),10)!==t.value)throw new sc("Tag value must be an integer",wO.ERR_INVALID_PARAMETERS);if(t.value<0||t.value>100)throw new sc("Tag value must be between 0-100",wO.ERR_INVALID_PARAMETERS)}if(null!=t.ttl){if(parseInt("".concat(t.ttl),10)!==t.ttl)throw new sc("Tag ttl must be an integer",wO.ERR_INVALID_PARAMETERS);if(t.ttl<0)throw new sc("Tag ttl must be between greater than 0",wO.ERR_INVALID_PARAMETERS)}}function xB(e,t){var n;let r;return null!=t.expiry&&(r=t.expiry),null!=t.ttl&&(r=BigInt(Date.now()+Number(t.ttl))),{value:null!==(n=t.value)&&void 0!==n?n:0,expiry:r}}function PB(e,t,n){const r=e.toString().split("/")[2],i=mN(qc.decode(r)),o=n.get(i);if(null!=o)return o;const s=_B(i,t);return n.set(i,s),s}var DB=new WeakSet,NB=new WeakSet;class OB{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dx(this,NB),dx(this,DB),Xa(this,"peerId",void 0),Xa(this,"datastore",void 0),Xa(this,"lock",void 0),Xa(this,"addressFilter",void 0),this.peerId=e.peerId,this.datastore=e.datastore,this.addressFilter=t.addressFilter,this.lock=function(e){const t=Object.assign({},bO,e);return null==yO&&(yO=pO(t),!0!==yO.isWorker&&(yO.addEventListener("requestReadLock",(e=>{null!=gO[e.data.name]&&gO[e.data.name].readLock().then((async t=>await e.data.handler().finally((()=>t()))))})),yO.addEventListener("requestWriteLock",(async e=>{null!=gO[e.data.name]&&gO[e.data.name].writeLock().then((async t=>await e.data.handler().finally((()=>t()))))})))),null==gO[t.name]&&(gO[t.name]=vO(t.name,t)),gO[t.name]}({name:"peer-store",singleProcess:!0})}async has(e){return this.datastore.has(AB(e))}async delete(e){if(this.peerId.equals(e))throw new sc("Cannot delete self peer",wO.ERR_INVALID_PARAMETERS);await this.datastore.delete(AB(e))}async load(e){return _B(e,await this.datastore.get(AB(e)))}async save(e,t){const{existingBuf:n,existingPeer:r}=await fx(this,DB,BB).call(this,e),i=await TB(e,t,"patch",{addressFilter:this.addressFilter});return fx(this,NB,LB).call(this,e,i,n,r)}async patch(e,t){const{existingBuf:n,existingPeer:r}=await fx(this,DB,BB).call(this,e),i=await TB(e,t,"patch",{addressFilter:this.addressFilter,existingPeer:r});return fx(this,NB,LB).call(this,e,i,n,r)}async merge(e,t){const{existingBuf:n,existingPeer:r}=await fx(this,DB,BB).call(this,e),i=await TB(e,t,"merge",{addressFilter:this.addressFilter,existingPeer:r});return fx(this,NB,LB).call(this,e,i,n,r)}async*all(e){const t=new dP;for await(const{key:n,value:r}of this.datastore.query(function(e,t){var n,r;return null==e?{}:{prefix:SB,filters:(null!==(n=e.filters)&&void 0!==n?n:[]).map((e=>n=>{let{key:r,value:i}=n;return e(PB(r,i,t))})),orders:(null!==(r=e.orders)&&void 0!==r?r:[]).map((e=>(n,r)=>e(PB(n.key,n.value,t),PB(r.key,r.value,t))))}}(null!==e&&void 0!==e?e:{},t))){const e=PB(n,r,t);e.id.equals(this.peerId)||(yield e)}}}async function BB(e){try{const t=await this.datastore.get(AB(e));return{existingBuf:t,existingPeer:_B(e,t)}}catch(t){if("ERR_NOT_FOUND"!==t.code)throw t}return{}}async function LB(e,t,n,r){const i=DO.encode(t);return null!=n&&ll(i,n)?{peer:_B(e,i),previous:r,updated:!1}:(await this.datastore.put(AB(e),i),{peer:_B(e,i),previous:r,updated:!0})}const MB=Aw("libp2p:peer-store");var UB=new WeakSet;class FB{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dx(this,UB),Xa(this,"store",void 0),Xa(this,"events",void 0),Xa(this,"peerId",void 0),this.events=e.events,this.peerId=e.peerId,this.store=new OB(e,t)}async forEach(e,t){MB.trace("forEach await read lock");const n=await this.store.lock.readLock();MB.trace("forEach got read lock");try{for await(const n of this.store.all(t))e(n)}finally{MB.trace("forEach release read lock"),n()}}async all(e){MB.trace("all await read lock");const t=await this.store.lock.readLock();MB.trace("all got read lock");try{return await hd(this.store.all(e))}finally{MB.trace("all release read lock"),t()}}async delete(e){MB.trace("delete await write lock");const t=await this.store.lock.writeLock();MB.trace("delete got write lock");try{await this.store.delete(e)}finally{MB.trace("delete release write lock"),t()}}async has(e){MB.trace("has await read lock");const t=await this.store.lock.readLock();MB.trace("has got read lock");try{return await this.store.has(e)}finally{MB.trace("has release read lock"),t()}}async get(e){MB.trace("get await read lock");const t=await this.store.lock.readLock();MB.trace("get got read lock");try{return await this.store.load(e)}finally{MB.trace("get release read lock"),t()}}async save(e,t){MB.trace("save await write lock");const n=await this.store.lock.writeLock();MB.trace("save got write lock");try{const n=await this.store.save(e,t);return fx(this,UB,jB).call(this,e,n),n.peer}finally{MB.trace("save release write lock"),n()}}async patch(e,t){MB.trace("patch await write lock");const n=await this.store.lock.writeLock();MB.trace("patch got write lock");try{const n=await this.store.patch(e,t);return fx(this,UB,jB).call(this,e,n),n.peer}finally{MB.trace("patch release write lock"),n()}}async merge(e,t){MB.trace("merge await write lock");const n=await this.store.lock.writeLock();MB.trace("merge got write lock");try{const n=await this.store.merge(e,t);return fx(this,UB,jB).call(this,e,n),n.peer}finally{MB.trace("merge release write lock"),n()}}async consumePeerRecord(e,t){var n;const r=await mD.openAndCertify(e,sN.DOMAIN);if(!1===(null===t||void 0===t?void 0:t.equals(r.peerId)))return MB("envelope peer id was not the expected peer id - expected: %p received: %p",t,r.peerId),!1;const i=sN.createFromProtobuf(r.payload);let o;try{o=await this.get(r.peerId)}catch(s){if("ERR_NOT_FOUND"!==s.code)throw s}if(null!=(null===(n=o)||void 0===n?void 0:n.peerRecordEnvelope)){const e=await mD.createFromProtobuf(o.peerRecordEnvelope),t=sN.createFromProtobuf(e.payload);if(t.seqNumber>=i.seqNumber)return MB("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 jB(e,t){t.updated&&(this.peerId.equals(e)?this.events.safeDispatchEvent("self:peer:update",{detail:t}):this.events.safeDispatchEvent("peer:update",{detail:t}))}const zB=iu,KB=ou,qB=function(e){let t=0;if(e=e.toString().trim(),zB(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(KB(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;zB(n[r])&&(e=qB(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},VB=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},HB=-1,WB={},GB={};function $B(e){if("number"===typeof e){if(null!=GB[e])return GB[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=WB[e])return WB[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,HB,"ip6zone"],[43,8,"ipcidr"],[53,HB,"dns",!0],[54,HB,"dns4",!0],[55,HB,"dns6",!0],[56,HB,"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,HB,"unix",!1,!0],[421,HB,"ipfs"],[421,HB,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,HB,"garlic64"],[448,0,"tls"],[449,HB,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,HB,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,HB,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);GB[t.code]=t,WB[t.name]=t}));$B("ip4"),$B("ip6"),$B("ipcidr");function YB(e,t){switch($B(e).code){case 4:case 41:return function(e){const t=VB(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(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 rL(t);case 6:case 273:case 33:case 132:return tL(t).toString();case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return iL(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function QB(e,t){switch($B(e).code){case 4:case 41:return ZB(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return nL(t);case 6:case 273:case 33:case 132:return eL(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?zc(vc.decode("z".concat(e))).bytes:tl.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=qc.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=eL(r);return Zl([n,i],n.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 n=qc.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=eL(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=JB.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const XB=Object.values(ql).map((e=>e.decoder)),JB=function(){let e=XB[0].or(XB[1]);return XB.slice(2).forEach((t=>e=e.or(t))),e}();function ZB(e){if(!su(e))throw new Error("invalid ip address");return qB(e)}function eL(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function tL(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function nL(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}function rL(e){const t=Jl.decode(e);if((e=e.slice(Jl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return Xl(e)}function iL(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=tL(n);return"".concat(r,":").concat(i)}function oL(e){return e.map((e=>{const t=gL(e);return null!=e[1]?[t.code,YB(t.code,e[1])]:[t.code]}))}function sL(e){return hL(Zl(e.map((e=>{const t=gL(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function aL(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var n;return Jl.decode(t)+(null!==(n=Jl.decode.bytes)&&void 0!==n?n:0)}function cL(e){const t=[];let n=0;for(;n<e.length;){var r;const i=Jl.decode(e,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0,s=aL($B(i),e.slice(n+o));if(0===s){t.push([i]),n+=o;continue}const a=e.slice(n+o,n+o+s);if(n+=s+o,n>e.length)throw pL("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([i,a])}return t}function lL(e){return function(e){const t=[];return e.map((e=>{const n=gL(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),fL(t.join("/"))}(oL(cL(e)))}function uL(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=$B(i);if(0!==o.size){if(r++,r>=n.length)throw pL("invalid address: "+e);if(!0===o.path){t.push([i,fL(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=fL(e));return sL(t.map((e=>{Array.isArray(e)||(e=[e]);const t=gL(e);return e.length>1?[t.code,QB(t.code,e[1])]:[t.code]})))}function hL(e){const t=dL(e);if(null!=t)throw t;return Uint8Array.from(e)}function dL(e){try{cL(e)}catch(t){return t}}function fL(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function pL(e){return new Error("Error parsing address: "+e)}function gL(e){return $B(e[0])}const yL=Symbol.for("nodejs.util.inspect.custom"),mL=[$B("dns").code,$B("dns4").code,$B("dns6").code,$B("dnsaddr").code],vL=new Map,bL=Symbol.for("@multiformats/js-multiaddr/multiaddr");function wL(e){return Boolean(null===e||void 0===e?void 0:e[bL])}var EL=new WeakMap,_L=new WeakMap,SL=new WeakMap,AL=new WeakMap;class kL{constructor(e){if(Xa(this,"bytes",void 0),tc(this,EL,{writable:!0,value:void 0}),tc(this,_L,{writable:!0,value:void 0}),tc(this,SL,{writable:!0,value:void 0}),tc(this,AL,{writable:!0,value:void 0}),Xa(this,bL,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=hL(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=uL(e)}else{if(!wL(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=hL(e.bytes)}}toString(){return null==ic(this,EL)&&rc(this,EL,lL(this.bytes)),ic(this,EL)}toJSON(){return this.toString()}toOptions(){let e,t,n,r,i="";const o=$B("tcp"),s=$B("udp"),a=$B("ip4"),c=$B("ip6"),l=$B("dns6"),u=$B("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),mL.includes(h)&&(t=o.name,r=443,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=$B(h).name,r=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=$B(h).name,n="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==n||null==r)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},$B(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){var r;const i=Jl.decode(t,n),o=null!==(r=Jl.decode.bytes)&&void 0!==r?r:0;n+=aL($B(i),t.slice(n+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==ic(this,_L)&&rc(this,_L,cL(this.bytes)),ic(this,_L)}stringTuples(){return null==ic(this,SL)&&rc(this,SL,oL(this.tuples())),ic(this,SL)}encapsulate(e){return e=new kL(e),new kL(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new kL(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new kL(sL(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===WB.ipfs.code)),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]?Xl(vc.decode("z".concat(e)),"base58btc"):Xl(tl.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===ic(this,AL))try{rc(this,AL,this.stringTuples().filter((e=>!0===$B(e[0]).path))[0][1]),null==ic(this,AL)&&rc(this,AL,null)}catch{rc(this,AL,null)}return ic(this,AL)}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=vL.get(t.name);if(null==n)throw new sc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new kL(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))}[yL](){return"Multiaddr(".concat(lL(this.bytes),")")}}function TL(e){return new kL(e)}const IL=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{for await(const t of e);})();for(const t of e);};const CL=function(e){const[t,n]=null!=e[Symbol.asyncIterator]?[e[Symbol.asyncIterator](),Symbol.asyncIterator]:[e[Symbol.iterator](),Symbol.iterator],r=[];return{peek:()=>t.next(),push:e=>{r.push(e)},next:()=>r.length>0?{done:!1,value:r.shift()}:t.next(),[n](){return this}}};const RL=function(e,t){if(null!=e[Symbol.asyncIterator])return async function*(){for await(const n of e)await t(n)&&(yield n)}();const n=CL(e),{value:r,done:i}=n.next();if(!0===i)return function*(){}();const o=t(r);if("function"===typeof o.then)return async function*(){await o&&(yield r);for await(const e of n)await t(e)&&(yield e)}();const s=t;return function*(){!0===o&&(yield r);for(const e of n)s(e)&&(yield e)}()};const xL=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(){const n=await hd(e);yield*n.sort(t)}():function*(){const n=hd(e);yield*n.sort(t)}()};const PL=function(e,t){return null!=e[Symbol.asyncIterator]?async function*(){let n=0;if(!(t<1))for await(const r of e)if(yield r,n++,n===t)return}():function*(){let n=0;if(!(t<1))for(const r of e)if(yield r,n++,n===t)return}()};class DL{put(e,t,n){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 n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const{key:r,value:i}of e)await t.put(r,i,n),yield r}()}catch(n){return Promise.reject(n)}}getMany(e){try{var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const r of e)yield{key:r,value:await t.get(r,n)}}()}catch(n){return Promise.reject(n)}}deleteMany(e){try{var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const r of e)await t.delete(r,n),yield r}()}catch(n){return Promise.reject(n)}}batch(){let e=[],t=[];return{put(t,n){e.push({key:t,value:n})},delete(e){t.push(e)},commit:async n=>{await IL(this.putMany(e,n)),e=[],await IL(this.deleteMany(t,n)),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 n=this._all(e,t);if(null!=e.prefix){const t=e.prefix;n=RL(n,(e=>e.key.toString().startsWith(t)))}if(Array.isArray(e.filters)&&(n=e.filters.reduce(((e,t)=>RL(e,t)),n)),Array.isArray(e.orders)&&(n=e.orders.reduce(((e,t)=>xL(e,t)),n)),null!=e.offset){let t=0;const r=e.offset;n=RL(n,(()=>t++>=r))}return null!=e.limit&&(n=PL(n,e.limit)),n}queryKeys(e,t){let n=this._allKeys(e,t);if(null!=e.prefix){const t=e.prefix;n=RL(n,(e=>e.toString().startsWith(t)))}if(Array.isArray(e.filters)&&(n=e.filters.reduce(((e,t)=>RL(e,t)),n)),Array.isArray(e.orders)&&(n=e.orders.reduce(((e,t)=>xL(e,t)),n)),null!=e.offset){const t=e.offset;let r=0;n=RL(n,(()=>r++>=t))}return null!=e.limit&&(n=PL(n,e.limit)),n}}class NL extends DL{constructor(){super(),Xa(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"),Dd(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 Nx(e),value:t}}*_allKeys(){for(const e of this.data.keys())yield new Nx(e)}}const OL=Aw("libp2p:address-manager"),BL=e=>e;function LL(e,t){const n=e.getPeerId();if(null!=n){SP(n).equals(t)&&(e=e.decapsulate(TL("/p2p/".concat(t.toString()))))}return e}class ML{constructor(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Xa(this,"components",void 0),Xa(this,"listen",void 0),Xa(this,"announce",void 0),Xa(this,"observed",void 0),Xa(this,"announceFilter",void 0);const{listen:r=[],announce:i=[]}=n;this.components=e,this.listen=r.map((e=>e.toString())),this.announce=new Set(i.map((e=>e.toString()))),this.observed=new Map,this.announceFilter=null!==(t=n.announceFilter)&&void 0!==t?t:BL,this._updatePeerStoreAddresses=function(e,t){let n;return function(){clearTimeout(n),n=setTimeout((function(){n=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,n]=e;return n.confident})).map((e=>{let[t]=e;return TL(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=>{OL.error("error updating addresses",e)}))}getListenAddrs(){return Array.from(this.listen).map((e=>TL(e)))}getAnnounceAddrs(){return Array.from(this.announce).map((e=>TL(e)))}getObservedAddrs(){return Array.from(this.observed).map((e=>{let[t]=e;return TL(t)}))}addObservedAddr(e){const t=(e=LL(e,this.components.peerId)).toString();this.observed.has(t)||this.observed.set(t,{confident:!1})}confirmObservedAddr(e){var t;const n=(e=LL(e,this.components.peerId)).toString(),r=(null!==(t=this.observed.get(n))&&void 0!==t?t:{confident:!1}).confident;this.observed.set(n,{confident:!0}),r||this._updatePeerStoreAddresses()}removeObservedAddr(e){const t=(e=LL(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,n]=e;return n.confident})).map((e=>{let[t]=e;return t})));const t=new Set(e);return this.announceFilter(Array.from(t).map((e=>TL(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 UL(e){return null!=e&&"function"===typeof e.start&&"function"===typeof e.stop}class FL{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Xa(this,"components",{}),Xa(this,"_started",!1),this.components={};for(const[t,n]of Object.entries(e))this.components[t]=n}isStarted(){return this._started}async _invokeStartableMethod(e){await Promise.all(Object.values(this.components).filter((e=>UL(e))).map((async t=>{var n;await(null===(n=t[e])||void 0===n?void 0:n.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 jL=["metrics","connectionProtector"],zL=["components","isStarted","beforeStart","start","afterStart","beforeStop","stop","afterStop","then","_invokeStartableMethod"];var KL=__webpack_require__(7922);const qL="[a-fA-F\\d:]",VL=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(qL,")|(?<=").concat(qL,")(?=\\s|$))"):"",HL="(?: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}",WL="[a-fA-F\\d]{1,4}",GL="\n(?:\n(?:".concat(WL,":){7}(?:").concat(WL,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(WL,":){6}(?:").concat(HL,"|:").concat(WL,"|:)| // 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(WL,":){5}(?::").concat(HL,"|(?::").concat(WL,"){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(WL,":){4}(?:(?::").concat(WL,"){0,1}:").concat(HL,"|(?::").concat(WL,"){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(WL,":){3}(?:(?::").concat(WL,"){0,2}:").concat(HL,"|(?::").concat(WL,"){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(WL,":){2}(?:(?::").concat(WL,"){0,3}:").concat(HL,"|(?::").concat(WL,"){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(WL,":){1}(?:(?::").concat(WL,"){0,4}:").concat(HL,"|(?::").concat(WL,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(WL,"){0,5}:").concat(HL,"|(?::").concat(WL,"){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(),$L=new RegExp("(?:^".concat(HL,"$)|(?:^").concat(GL,"$)")),YL=new RegExp("^".concat(HL,"$")),QL=new RegExp("^".concat(GL,"$")),XL=e=>e&&e.exact?$L:new RegExp("(?:".concat(VL(e)).concat(HL).concat(VL(e),")|(?:").concat(VL(e)).concat(GL).concat(VL(e),")"),"g");XL.v4=e=>e&&e.exact?YL:new RegExp("".concat(VL(e)).concat(HL).concat(VL(e)),"g"),XL.v6=e=>e&&e.exact?QL:new RegExp("".concat(VL(e)).concat(GL).concat(VL(e)),"g");const JL=XL;var ZL=__webpack_require__(7201);const{isValid:eM,parse:tM}=ZL,nM=["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 KL.Netmask(e)));function rM(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 iM=e=>{if(eM(e)){const t=tM(e);if("ipv4"===t.kind())return function(e){for(let t of nM)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return rM(e)}else if(su(e)&&JL.v6().test(e))return rM(e)};function oM(){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async e=>{const t=e.stringTuples();return(4===t[0][0]||41===t[0][0])&&Boolean(iM("".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 sM(e){try{const{address:t}=e.nodeAddress();return Boolean(iM(t))}catch{return!0}}function aM(e,t){const n=sM(e.multiaddr),r=sM(t.multiaddr);return n&&!r?1:!n&&r||e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}var cM=__webpack_require__(449);const lM=globalThis.fetch,uM=globalThis.Headers;globalThis.Request,globalThis.Response;function hM(e,t,n){return"".concat(e,"?name=").concat(t,"&type=").concat(n)}async function dM(e,t){const n=await lM(e,{headers:new uM({accept:"application/dns-json"}),signal:t});return await n.json()}function fM(e,t){return"".concat(t,"_").concat(e)}const pM=Object.assign(Ju("dns-over-http-resolver"),{error:Ju("dns-over-http-resolver:error")});const gM=class{constructor(){var e,t,n;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._cache=new cM({max:null!==(e=null===r||void 0===r?void 0:r.maxCache)&&void 0!==e?e:100}),this._TXTcache=new cM({max:null!==(t=null===r||void 0===r?void 0:r.maxCache)&&void 0!==t?t:100}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"],this._request=null!==(n=r.request)&&void 0!==n?n:dM,this._abortControllers=[]}cancel(){this._abortControllers.forEach((e=>e.abort()))}getServers(){return this._servers}_getShuffledServers(){const e=[...this._servers];for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*t),r=e[t];e[t]=e[n],e[n]=r}return e}setServers(e){this._servers=e}async resolve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A";switch(t){case"A":return await this.resolve4(e);case"AAAA":return await this.resolve6(e);case"TXT":return await this.resolveTxt(e);default:throw new Error("".concat(t," is not supported"))}}async resolve4(e){const t="A",n=this._cache.get(fM(e,t));if(null!=n)return n;let r=!1;for(const o of this._getShuffledServers()){const n=new AbortController;this._abortControllers.push(n);try{const r=await this._request(hM(o,e,t),n.signal),i=r.Answer.map((e=>e.data)),s=Math.min(...r.Answer.map((e=>e.TTL)));return this._cache.set(fM(e,t),i,{ttl:s}),i}catch(i){n.signal.aborted&&(r=!0),pM.error("".concat(o," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==n))}}if(r)throw Object.assign(new Error("queryA ECANCELLED"),{code:"ECANCELLED"});throw new Error("Could not resolve ".concat(e," record ").concat(t))}async resolve6(e){const t="AAAA",n=this._cache.get(fM(e,t));if(null!=n)return n;let r=!1;for(const o of this._getShuffledServers()){const n=new AbortController;this._abortControllers.push(n);try{const r=await this._request(hM(o,e,t),n.signal),i=r.Answer.map((e=>e.data)),s=Math.min(...r.Answer.map((e=>e.TTL)));return this._cache.set(fM(e,t),i,{ttl:s}),i}catch(i){n.signal.aborted&&(r=!0),pM.error("".concat(o," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==n))}}if(r)throw Object.assign(new Error("queryAaaa ECANCELLED"),{code:"ECANCELLED"});throw new Error("Could not resolve ".concat(e," record ").concat(t))}async resolveTxt(e){const t="TXT",n=this._TXTcache.get(fM(e,t));if(null!=n)return n;let r=!1;for(const o of this._getShuffledServers()){const n=new AbortController;this._abortControllers.push(n);try{const r=await this._request(hM(o,e,t),n.signal),i=r.Answer.map((e=>[e.data.replace(/['"]+/g,"")])),s=Math.min(...r.Answer.map((e=>e.TTL)));return this._TXTcache.set(fM(e,t),i,{ttl:s}),i}catch(i){n.signal.aborted&&(r=!0),pM.error("".concat(o," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==n))}}if(r)throw Object.assign(new Error("queryTxt ECANCELLED"),{code:"ECANCELLED"});throw new Error("Could not resolve ".concat(e," record ").concat(t))}clearCache(){this._cache.clear(),this._TXTcache.clear()}},yM=gM,{code:mM}=$B("dnsaddr");async function vM(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=new yM;null!=n.signal&&n.signal.addEventListener("abort",(()=>{r.cancel()}));const i=e.getPeerId(),[,o]=null!==(t=e.stringTuples().find((e=>{let[t]=e;return t===mM})))&&void 0!==t?t:[];if(null==o)throw new Error("No hostname found in multiaddr");let s=(await r.resolveTxt("_dnsaddr.".concat(o))).flat().map((e=>e.split("=")[1])).filter(Boolean);return null!=i&&(s=s.filter((e=>e.includes(i)))),s}var bM,wM;!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"}(bM||(bM={})),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"}(wM||(wM={}));const EM={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{resolvers:{dnsaddr:vM},addressSorter:aM},transportManager:{faultTolerance:fE.FATAL_ALL}};const _M=Aw("libp2p:get-peer");function SM(e){if(Za(e))return{peerId:e,multiaddrs:[]};let t;if(Array.isArray(e)||(e=[e]),e.length>0){const n=e[0].getPeerId();t=null==n?void 0:SP(n),e.forEach((e=>{if(!wL(e))throw _M.error("multiaddr %s was invalid",e),new sc("Invalid Multiaddr",wM.ERR_INVALID_MULTIADDR);const n=e.getPeerId();if(null==n){if(null!=t)throw new sc("Multiaddrs must all have the same peer id or have no peer id",wM.ERR_INVALID_PARAMETERS)}else{const e=SP(n);if(null==t||!t.equals(e))throw new sc("Multiaddrs must all have the same peer id or have no peer id",wM.ERR_INVALID_PARAMETERS)}}))}return{peerId:t,multiaddrs:e}}var AM=new WeakMap;class kM{constructor(){tc(this,AM,{writable:!0,value:[]})}enqueue(e,t){var n;const r=null===t||void 0===t?void 0:t.peerId,i=null!==(n=null===t||void 0===t?void 0:t.priority)&&void 0!==n?n:0;if(null==r)throw new sc("missing peer id",wM.ERR_INVALID_PARAMETERS);const o={priority:i,peerId:r,run:e};if(this.size>0&&ic(this,AM)[this.size-1].priority>=i)return void ic(this,AM).push(o);const s=function(e,t,n){let r=0,i=e.length;for(;i>0;){const o=Math.trunc(i/2);let s=r+o;n(e[s],t)<=0?(r=++s,i-=o+1):i=o}return r}(ic(this,AM),o,((e,t)=>t.priority-e.priority));ic(this,AM).splice(s,0,o)}dequeue(){const e=ic(this,AM).shift();return null===e||void 0===e?void 0:e.run}filter(e){if(null!=e.peerId){const t=e.peerId;return ic(this,AM).filter((e=>t.equals(e.peerId))).map((e=>e.run))}return ic(this,AM).filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return ic(this,AM).length}}class TM extends tO{constructor(){super({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},queueClass:kM})}hasJob(e){return this.sizeBy({peerId:e})>0}}const IM=Aw("libp2p:connection-manager:auto-dial"),CM=50,RM=100,xM=25,PM=0,DM=5e3;class NM{constructor(e,t){var n,r,i,o,s;Xa(this,"connectionManager",void 0),Xa(this,"peerStore",void 0),Xa(this,"queue",void 0),Xa(this,"minConnections",void 0),Xa(this,"autoDialPriority",void 0),Xa(this,"autoDialIntervalMs",void 0),Xa(this,"autoDialMaxQueueLength",void 0),Xa(this,"autoDialInterval",void 0),Xa(this,"started",void 0),Xa(this,"running",void 0),this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.minConnections=null!==(n=t.minConnections)&&void 0!==n?n:CM,this.autoDialPriority=null!==(r=t.autoDialPriority)&&void 0!==r?r:PM,this.autoDialIntervalMs=null!==(i=t.autoDialInterval)&&void 0!==i?i:DM,this.autoDialMaxQueueLength=null!==(o=t.maxQueueLength)&&void 0!==o?o:RM,this.started=!1,this.running=!1,this.queue=new TM({concurrency:null!==(s=t.autoDialConcurrency)&&void 0!==s?s:xM}),this.queue.addListener("error",(e=>{IM.error("error during auto-dial",e)})),e.events.addEventListener("connection:close",(()=>{this.autoDial().catch((e=>{IM.error(e)}))}))}isStarted(){return this.started}start(){this.autoDialInterval=setTimeout((()=>{this.autoDial().catch((e=>{IM.error("error while autodialing",e)}))}),this.autoDialIntervalMs),this.started=!0}afterStart(){this.autoDial().catch((e=>{IM.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 IM.trace("have enough connections %d/%d",t,this.minConnections);if(this.queue.size>this.autoDialMaxQueueLength)return void IM("not enough connections %d/%d but auto dial queue is full",t,this.minConnections);if(this.running)return void IM("not enough connections %d/%d - but skipping autodial as it is already running",t,this.minConnections);this.running=!0,IM("not enough connections %d/%d - will dial peers to increase the number of connections",t,this.minConnections);const n=new fP(this.connectionManager.getDialQueue().map((e=>e.peerId)).filter(Boolean)),r=await this.peerStore.all({filters:[t=>0===t.addresses.length?(IM.trace("not autodialing %p because they have no addresses"),!1):e.has(t.id)?(IM.trace("not autodialing %p because they are already connected"),!1):n.has(t.id)?(IM.trace("not autodialing %p because they are already being dialed"),!1):!this.queue.hasJob(t.id)||(IM.trace("not autodialing %p because they are already being autodialed"),!1)]}),i=r.sort((()=>Math.random()>.5?1:-1)),o=new dP;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 n,r;const i=null!==(n=o.get(e.id))&&void 0!==n?n:0,s=null!==(r=o.get(t.id))&&void 0!==r?r:0;return i>s?-1:i<s?1:0}));IM("selected %d/%d peers to dial",s.length,r.length);for(const a of s)this.queue.add((async()=>{const e=this.connectionManager.getConnectionsMap().size;if(e>=this.minConnections)return IM("got enough connections now %d/%d",e,this.minConnections),void this.queue.clear();IM("connecting to a peerStore stored peer %p",a.id),await this.connectionManager.openConnection(a.id,{priority:this.autoDialPriority})}),{peerId:a.id}).catch((e=>{IM.error("could not connect to peerStore stored peer",e)}));this.running=!1,this.started&&(this.autoDialInterval=setTimeout((()=>{this.autoDial().catch((e=>{IM.error("error while autodialing",e)}))}),this.autoDialIntervalMs))}}const OM=Aw("libp2p:connection-manager:connection-pruner"),BM={maxConnections:300,allow:[]};class LM{constructor(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Xa(this,"maxConnections",void 0),Xa(this,"connectionManager",void 0),Xa(this,"peerStore",void 0),Xa(this,"allow",void 0),Xa(this,"events",void 0),this.maxConnections=null!==(t=r.maxConnections)&&void 0!==t?t:BM.maxConnections,this.allow=null!==(n=r.allow)&&void 0!==n?n:BM.allow,this.connectionManager=e.connectionManager,this.peerStore=e.peerStore,this.events=e.events,e.events.addEventListener("connection:open",(()=>{this.maybePruneConnections().catch((e=>{OM.error(e)}))}))}async maybePruneConnections(){const e=this.connectionManager.getConnections(),t=e.length,n=Math.max(t-this.maxConnections,0);if(OM("checking max connections limit %d/%d",t,this.maxConnections),t<=this.maxConnections)return;OM("max connections limit exceeded %d/%d, pruning %d connection(s)",t,this.maxConnections,n);const r=new dP;for(const a of e){const e=a.remotePeer;if(!r.has(e)){r.set(e,0);try{const t=await this.peerStore.get(e);r.set(e,[...t.tags.values()].reduce(((e,t)=>e+t.value),0))}catch(s){"ERR_NOT_FOUND"!==s.code&&OM.error("error loading peer tags",s)}}}const i=e.sort(((e,t)=>{var n,i;const o=null!==(n=r.get(e.remotePeer))&&void 0!==n?n:0,s=null!==(i=r.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){OM("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===n)break}await Promise.all(o.map((async e=>{try{await e.close()}catch(s){OM.error(s)}}))),this.events.safeDispatchEvent("connection:prune",{detail:o})}}const MM=Aw("libp2p:connection-manager:utils");async function UM(e,t){if(!e.protoNames().includes("dnsaddr"))return[e];const n=await async function(e,t){try{e=TL(e.toString());return await e.resolve(t)}catch(n){return MM.error("multiaddr ".concat(e.toString()," could not be resolved"),n),[]}}(e,t),r=(await Promise.all(n.map((async e=>UM(e,t))))).flat().reduce(((e,t)=>(null==e.find((e=>e.equals(t)))&&e.push(t),e)),[]);return MM("resolved %s to",e,r.map((e=>e.toString()))),r}const FM=Aw("libp2p:connection-manager:dial-queue"),jM={addressSorter:aM,maxParallelDials:100,maxPeerAddrsToDial:25,maxParallelDialsPerPeer:10,dialTimeout:3e4,resolvers:{dnsaddr:vM}};class zM{constructor(e){var t,n,r,i,o,s,a;let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Xa(this,"pendingDials",void 0),Xa(this,"queue",void 0),Xa(this,"peerId",void 0),Xa(this,"peerStore",void 0),Xa(this,"connectionGater",void 0),Xa(this,"transportManager",void 0),Xa(this,"addressSorter",void 0),Xa(this,"maxPeerAddrsToDial",void 0),Xa(this,"maxParallelDialsPerPeer",void 0),Xa(this,"dialTimeout",void 0),Xa(this,"inProgressDialCount",void 0),Xa(this,"pendingDialCount",void 0),Xa(this,"shutDownController",void 0),this.addressSorter=null!==(t=c.addressSorter)&&void 0!==t?t:jM.addressSorter,this.maxPeerAddrsToDial=null!==(n=c.maxPeerAddrsToDial)&&void 0!==n?n:jM.maxPeerAddrsToDial,this.maxParallelDialsPerPeer=null!==(r=c.maxParallelDialsPerPeer)&&void 0!==r?r:jM.maxParallelDialsPerPeer,this.dialTimeout=null!==(i=c.dialTimeout)&&void 0!==i?i:jM.dialTimeout,this.peerId=e.peerId,this.peerStore=e.peerStore,this.connectionGater=e.connectionGater,this.transportManager=e.transportManager,this.shutDownController=new AbortController;try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.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;vL.set(u,h)}this.queue=new tO({concurrency:null!==(a=c.maxParallelDials)&&void 0!==a?a:jM.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,n;FM.error("error in dial queue",e),null===(t=this.pendingDialCount)||void 0===t||t.update(this.queue.size),null===(n=this.inProgressDialCount)||void 0===n||n.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:n,multiaddrs:r}=SM(e),i=r.map((e=>({multiaddr:e,isCertified:!1}))),o=this.createDialAbortControllers(t.signal);let s;try{s=await this.calculateMultiaddrs(n,i,{...t,signal:o})}catch(l){throw o.clear(),l}const a=this.pendingDials.find((e=>!(null==e.peerId||null==n||!e.peerId.equals(n))||s.map((e=>{let{multiaddr:t}=e;return t.toString()})).join()===e.multiaddrs.map((e=>e.toString())).join()));if(null!=a)return FM("joining existing dial target for %p",n),o.clear(),a.promise;FM("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:n,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(FM.error("dial failed to %s",c.multiaddrs.map((e=>e.toString())).join(", "),e),o.aborted){throw new sc(e.message,wM.ERR_TIMEOUT)}throw e})),this.pendingDials.push(c),c.promise}createDialAbortControllers(e){const t=Fw([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,e]);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,t)}catch{}return t}async calculateMultiaddrs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!=e){var r,i;if(this.peerId.equals(e))throw new sc("Tried to dial self",wM.ERR_DIALED_SELF);if(!0===await(null===(r=(i=this.connectionGater).denyDialPeer)||void 0===r?void 0:r.call(i,e)))throw new sc("The dial request is blocked by gater.allowDialPeer",wM.ERR_PEER_DIAL_INTERCEPTED);if(0===t.length){FM("loading multiaddrs for %p",e);try{const n=await this.peerStore.get(e);t.push(...n.addresses),FM("loaded multiaddrs for %p",e,t.map((e=>{let{multiaddr:t}=e;return t.toString()})))}catch(h){if(h.code!==wM.ERR_NOT_FOUND)throw h}}}const o=(await Promise.all(t.map((async e=>{const t=await UM(e.multiaddr,n);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)&&(FM("addresses for %p before filtering",null!==e&&void 0!==e?e:"unknown peer",o.map((e=>{let{multiaddr:t}=e;return t.toString()}))),FM("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 sc("The dial request has no valid addresses",wM.ERR_NO_VALID_ADDRESSES);if(c.length>this.maxPeerAddrsToDial)throw new sc("dial with more addresses than allowed",wM.ERR_TOO_MANY_ADDRESSES);if(null!=e){const t="/p2p/".concat(e.toString());c=c.map((n=>{const r=n.multiaddr.getPeerId(),i=n.multiaddr.protos().pop();return!0===(null===i||void 0===i?void 0:i.path)?n:r!==e.toString()?{multiaddr:n.multiaddr.encapsulate(t),isCertified:n.isCertified}:n}))}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 sc("The connection gater denied all addresses in the dial request",wM.ERR_NO_VALID_ADDRESSES);return u}async performDial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e.multiaddrs.map((()=>new AbortController));try{const r=new tO({concurrency:this.maxParallelDialsPerPeer});r.on("error",(e=>{FM.error("error dialling",e)}));const i=await Promise.any(e.multiaddrs.map((async(i,o)=>{const s=n[o];if(null==s)throw new sc("dialAction did not come with an AbortController",wM.ERR_INVALID_PARAMETERS);const a=function(){const e=[];for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(const o of n)if(null!=o){try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,o)}catch{}e.push(o)}const i=Fw(e);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,i)}catch{}return i}(s.signal,t.signal);a.addEventListener("abort",(()=>{FM("dial to %s aborted",i)}));const c=Ud();return await r.add((async()=>{if(a.aborted)return FM("dial to %s was aborted before reaching the head of the peer dial queue",i),void c.reject(new oc);await this.queue.add((async()=>{try{if(a.aborted)return FM("dial to %s was aborted before reaching the head of the dial queue",i),void c.reject(new oc);e.status="active";const r=await this.transportManager.dial(i,{...t,signal:a});if(s.signal.aborted)return FM("multiple dials succeeded, closing superfluous connection"),r.close().catch((e=>{FM.error("error closing superfluous connection",e)})),void c.reject(new oc);n[o]=void 0,n.forEach((e=>{void 0!==e&&e.abort()})),FM("dial to %s succeeded",i),c.resolve(r)}catch(r){FM.error("error during dial of %s",i,r),c.reject(r)}}),{...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 sc("successful dial led to empty object returned from peer dial queue",wM.ERR_TRANSPORT_DIAL_FAILED);return e.status="success",i}catch(r){if(e.status="error",1===e.multiaddrs.length&&"AggregateError"===r.name)throw r.errors[0];throw r}}}const KM=Aw("libp2p:connection-manager"),qM=50,VM=300,HM=5,WM=10,GM=25,$M=0,YM=100;class QM{constructor(e){var t,n,r,i,o,s,a,c,l,u,h,d,f,p;let g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Xa(this,"started",void 0),Xa(this,"connections",void 0),Xa(this,"allow",void 0),Xa(this,"deny",void 0),Xa(this,"maxIncomingPendingConnections",void 0),Xa(this,"incomingPendingConnections",void 0),Xa(this,"maxConnections",void 0),Xa(this,"dialQueue",void 0),Xa(this,"autoDial",void 0),Xa(this,"connectionPruner",void 0),Xa(this,"inboundConnectionRateLimiter",void 0),Xa(this,"peerStore",void 0),Xa(this,"metrics",void 0),Xa(this,"events",void 0),this.maxConnections=null!==(t=g.maxConnections)&&void 0!==t?t:VM;const y=null!==(n=g.minConnections)&&void 0!==n?n:qM;if(this.maxConnections<y)throw new sc("Connection Manager maxConnections must be greater than minConnections",wM.ERR_INVALID_PARAMETERS);this.connections=new dP,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!==(r=g.allow)&&void 0!==r?r:[]).map((e=>TL(e))),this.deny=(null!==(i=g.deny)&&void 0!==i?i:[]).map((e=>TL(e))),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=null!==(o=g.maxIncomingPendingConnections)&&void 0!==o?o:WM,this.inboundConnectionRateLimiter=new zw.RateLimiterMemory({points:null!==(s=g.inboundConnectionThreshold)&&void 0!==s?s:HM,duration:1}),this.autoDial=new NM({connectionManager:this,peerStore:e.peerStore,events:e.events},{minConnections:y,autoDialConcurrency:null!==(a=g.autoDialConcurrency)&&void 0!==a?a:GM,autoDialPriority:null!==(c=g.autoDialPriority)&&void 0!==c?c:$M,maxQueueLength:null!==(l=g.autoDialMaxQueueLength)&&void 0!==l?l:YM}),this.connectionPruner=new LM({connectionManager:this,peerStore:e.peerStore,events:e.events},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new zM({peerId:e.peerId,metrics:e.metrics,peerStore:e.peerStore,transportManager:e.transportManager,connectionGater:e.connectionGater},{addressSorter:null!==(u=g.addressSorter)&&void 0!==u?u:aM,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:vM}})}isStarted(){return this.started}async start(){var e,t,n;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 n of t)"inbound"===n.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 r of this.connections.values())for(const i of r)for(const r of i.streams){var t,n;const i="".concat(r.stat.direction," ").concat(null!==(t=r.stat.protocol)&&void 0!==t?t:"unnegotiated");e[i]=(null!==(n=e[i])&&void 0!==n?n:0)+1}return e}}),null===(n=this.metrics)||void 0===n||n.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,n;const r="".concat(e.stat.direction," ").concat(null!==(t=e.stat.protocol)&&void 0!==t?t:"unnegotiated");o[r]=(null!==(n=o[r])&&void 0!==n?n:0)+1}for(const[t,n]of Object.entries(o)){var r;e[t]=null!==(r=e[t])&&void 0!==r?r:[],e[t].push(n)}}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,KM("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=>{KM.error(e)}))})))})).catch((e=>{KM.error(e)})),this.autoDial.afterStart()}async stop(){this.dialQueue.stop(),this.autoDial.stop();const e=[];for(const t of this.connections.values())for(const n of t)e.push((async()=>{try{await n.close()}catch(e){KM.error(e)}})());KM("closing %d connections",e.length),await Promise.all(e),this.connections.clear(),KM("stopped")}onConnect(e){this._onConnect(e).catch((e=>{KM.error(e)}))}async _onConnect(e){const{detail:t}=e;if(!this.started)return void await t.close();const n=t.remotePeer,r=this.connections.get(n);let i=!1;null!=r?r.push(t):(i=!0,this.connections.set(n,[t])),null!=n.publicKey&&"RSA"===n.type&&await this.peerStore.patch(n,{publicKey:n.publicKey}),i&&this.events.safeDispatchEvent("peer:connect",{detail:t.remotePeer})}onDisconnect(e){const{detail:t}=e;if(!this.started)return;const n=t.remotePeer;let r=this.connections.get(n);null!=r&&r.length>1?(r=r.filter((e=>e.id!==t.id)),this.connections.set(n,r)):null!=r&&(this.connections.delete(n),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 n=[];for(const r of this.connections.values())n=n.concat(r);return n}getConnectionsMap(){return this.connections}async openConnection(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isStarted())throw new sc("Not started",wM.ERR_NODE_NOT_STARTED);const{peerId:r}=SM(e);if(null!=r){KM("dial %p",r);const e=this.getConnections(r);if(e.length>0)return KM("had an existing connection to %p",r),e[0]}const i=await this.dialQueue.dial(e,{...n,priority:null!==(t=n.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 n=null!==(t=this.connections.get(e))&&void 0!==t?t:[];await Promise.all(n.map((async e=>{await e.close()})))}async acceptIncomingConnection(e){if(this.deny.some((t=>e.remoteAddr.toString().startsWith(t.toString()))))return KM("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 KM("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 KM("connection from %s refused - inboundConnectionThreshold exceeded by host %s",t,e.remoteAddr),!1}}return this.getConnections().length<this.maxConnections?(this.incomingPendingConnections++,!0):(KM("connection from %s refused - maxConnections exceeded",e.remoteAddr),!1)}afterUpgradeInbound(){this.incomingPendingConnections--}getDialQueue(){return this.dialQueue.pendingDials}}const XM=function(e,t){if(null!=e[Symbol.asyncIterator])return async function*(){for await(const n of e)yield t(n)}();const n=CL(e),{value:r,done:i}=n.next();if(!0===i)return function*(){}();const o=t(r);if("function"===typeof o.then)return async function*(){yield await o;for await(const e of n)yield t(e)}();const s=t;return function*(){yield o;for(const e of n)yield s(e)}()};async function*JM(e,t){yield*XM(e,(async e=>(await t.merge(e.id,{multiaddrs:e.multiaddrs}),e)))}function ZM(e){const t=new Set;return RL(e,(e=>!t.has(e.id.toString())&&(t.add(e.id.toString()),!0)))}function eU(e){try{let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return async function*(){let n=0;for await(const t of e)n++,yield t;if(n<t)throw new sc("more peers required, seen: ".concat(n," min: ").concat(t),"NOT_FOUND")}()}catch(t){return Promise.reject(t)}}class tU{constructor(e,t){var n;Xa(this,"routers",void 0),Xa(this,"started",void 0),Xa(this,"components",void 0),this.routers=null!==(n=t.routers)&&void 0!==n?n:[],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 n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){if(0===t.routers.length)throw new sc("No content routers available",wM.ERR_NO_ROUTERS_AVAILABLE);yield*Hd(Vd(...t.routers.map((t=>t.findProviders(e,n)))),(e=>JM(e,t.components.peerStore)),(e=>ZM(e)),(e=>eU(e)))}()}catch(n){return Promise.reject(n)}}async provide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===this.routers.length)throw new sc("No content routers available",wM.ERR_NO_ROUTERS_AVAILABLE);await Promise.all(this.routers.map((async n=>{await n.provide(e,t)})))}async put(e,t,n){if(!this.isStarted())throw new sc(bM.NOT_STARTED_YET,wM.DHT_NOT_STARTED);await Promise.all(this.routers.map((async r=>{await r.put(e,t,n)})))}async get(e,t){if(!this.isStarted())throw new sc(bM.NOT_STARTED_YET,wM.DHT_NOT_STARTED);return Promise.any(this.routers.map((async n=>n.get(e,t))))}}const nU=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{for await(const t of e)return t})();for(const t of e)return t},rU=Aw("libp2p:peer-routing");class iU{constructor(e,t){var n;Xa(this,"components",void 0),Xa(this,"routers",void 0),this.components=e,this.routers=null!==(n=t.routers)&&void 0!==n?n:[]}async findPeer(e,t){if(0===this.routers.length)throw new sc("No peer routers available",wM.ERR_NO_ROUTERS_AVAILABLE);if(e.toString()===this.components.peerId.toString())throw new sc("Should not try to find self",wM.ERR_FIND_SELF);const n=await Hd(Vd(...this.routers.map((n=>async function*(){try{yield await n.findPeer(e,t)}catch(r){rU.error(r)}}()))),(e=>RL(e,Boolean)),(e=>JM(e,this.components.peerStore)),(async e=>nU(e)));if(null!=n)return n;throw new sc(bM.NOT_FOUND,wM.ERR_NOT_FOUND)}async*getClosestPeers(e,t){if(0===this.routers.length)throw new sc("No peer routers available",wM.ERR_NO_ROUTERS_AVAILABLE);yield*Hd(Vd(...this.routers.map((n=>n.getClosestPeers(e,t)))),(e=>JM(e,this.components.peerStore)),(e=>ZM(e)),(e=>eU(e)))}}const oU=Aw("libp2p:registrar"),sU=32,aU=64;class cU{constructor(e){Xa(this,"topologies",void 0),Xa(this,"handlers",void 0),Xa(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 sc("No handler registered for protocol ".concat(e),wM.ERR_NO_HANDLER_FOR_PROTOCOL);return t}getTopologies(e){const t=this.topologies.get(e);return null==t?[]:[...t.values()]}async handle(e,t,n){if(this.handlers.has(e))throw new sc("Handler already registered for protocol ".concat(e),wM.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);const r=Ox.bind({ignoreUndefined:!0})({maxInboundStreams:sU,maxOutboundStreams:aU},n);this.handlers.set(e,{handler:t,options:r}),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==(n=t)||!Boolean(n[vC]))throw oU.error("topology must be an instance of interfaces/topology"),new sc("topology must be an instance of interfaces/topology",wM.ERR_INVALID_PARAMETERS);var n;const r="".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(r,t),await t.setRegistrar(this),r}unregister(e){for(const[t,n]of this.topologies.entries())n.has(e)&&(n.delete(e),0===n.size&&this.topologies.delete(t))}_onDisconnect(e){const t=e.detail;this.components.peerStore.get(t).then((e=>{for(const n of e.protocols){const e=this.topologies.get(n);if(null!=e)for(const n of e.values())n.onDisconnect(t)}})).catch((e=>{e.code!==wM.ERR_NOT_FOUND&&oU.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 n=this.components.connectionManager.getConnections(e.id)[0];if(null!=n)for(const r of e.protocols){const e=this.topologies.get(r);if(null!=e)for(const r of e.values())r.onConnect(t,n)}else oU("peer %p connected but the connection manager did not have a connection",e)})).catch((e=>{e.code!==wM.ERR_NOT_FOUND&&oU.error("could not inform topologies of connecting peer %p",t,e)}))}_onPeerUpdate(e){var t;const{peer:n,previous:r}=e.detail,i=(null!==(t=null===r||void 0===r?void 0:r.protocols)&&void 0!==t?t:[]).filter((e=>!n.protocols.includes(e))),o=n.protocols.filter((e=>{var t;return!(null!==(t=null===r||void 0===r?void 0:r.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(n.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(n.id)[0];null!=e&&t.onConnect(n.id,e)}}}}class lU extends Map{constructor(e){super(),Xa(this,"metric",void 0);const{name:t,metrics:n}=e;this.metric=n.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 uU=Aw("libp2p:transports");class hU{constructor(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Xa(this,"components",void 0),Xa(this,"transports",void 0),Xa(this,"listeners",void 0),Xa(this,"faultTolerance",void 0),Xa(this,"started",void 0),this.components=e,this.started=!1,this.transports=new Map,this.listeners=function(e){const{name:t,metrics:n}=e;let r;return r=null!=n?new lU({name:t,metrics:n}):new Map,r}({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=null!==(t=n.faultTolerance)&&void 0!==t?t:fE.FATAL_ALL}add(e){const t=e[Symbol.toStringTag];if(null==t)throw new sc("Transport must have a valid tag",wM.ERR_INVALID_KEY);if(this.transports.has(t))throw new sc("There is already a transport with the tag ".concat(t),wM.ERR_DUPLICATE_TRANSPORT);uU("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,n]of this.listeners)for(uU("closing listeners for %s",t);n.length>0;){const t=n.pop();null!=t&&e.push(t.close())}await Promise.all(e),uU("all listeners closed");for(const t of this.listeners.keys())this.listeners.set(t,[]);this.started=!1}async dial(e,t){const n=this.transportForMultiaddr(e);if(null==n)throw new sc("No transport available for address ".concat(String(e)),wM.ERR_TRANSPORT_UNAVAILABLE);try{return await n.dial(e,{...t,upgrader:this.components.upgrader})}catch(r){throw null==r.code&&(r.code=wM.ERR_TRANSPORT_DIAL_FAILED),r}}getAddrs(){let e=[];for(const t of this.listeners.values())for(const n of t)e=[...e,...n.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 uU("no addresses were provided for listening, this node is dial only");const t=[];for(const[r,i]of this.transports.entries()){const o=i.filter(e),s=[];for(const e of o){var n;uU("creating listener for %s on %s",r,e);const t=i.createListener({upgrader:this.components.upgrader});let o=null!==(n=this.listeners.get(r))&&void 0!==n?n:[];null==o&&(o=[],this.listeners.set(r,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(r);continue}const a=(await Promise.allSettled(s)).find((e=>"fulfilled"===e.status));if(null==a&&this.faultTolerance!==fE.NO_FATAL)throw new sc("Transport (".concat(r,") could not listen on any available address"),wM.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===fE.FATAL_ALL)throw new sc(e,wM.ERR_NO_VALID_ADDRESSES);uU("libp2p in dial mode only: ".concat(e))}}async remove(e){uU("removing %s",e);for(const n of null!==(t=this.listeners.get(e))&&void 0!==t?t:[]){var t;await n.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 dU="/multistream/1.0.0",fU=1024;function pU(e){const t=Kd(),n=function(e){const t=async function*(){let t=yield,n=new gd;for await(const r of e)if(null!=t)for(n.append(r);n.length>=t;){const e=n.sublist(0,t);if(n.consume(t),t=yield e,null==t){n.length>0&&(t=yield n,n=new gd);break}}else n.append(r),t=yield n,n=new gd;if(null!=t)throw Object.assign(new Error("stream ended before ".concat(t," bytes became available")),{code:"ERR_UNDER_READ",buffer:n})}();return t.next(),t}(e.source),r=Ud();let i;const o=e.sink(async function*(){yield*t;const e=await r.promise;yield*e}());o.catch((e=>{i=e}));return{reader:n,writer:t,stream:{sink:async e=>{null==i?(r.resolve(e),await o):await Promise.reject(i)},source:n},rest:()=>t.end(),write:t.push,read:async()=>{const e=await n.next();if(null!=e.value)return e.value}}}const gU=Aw("libp2p:mss"),yU=ru("\n");function mU(e){const t=new gd(e,yU);return Pd.single(t)}function vU(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=mU(t);!0===n.writeBytes?e.push(r.subarray()):e.push(r)}async function bU(e,t){const n=await async function(e,t){let n=1;const r={[Symbol.asyncIterator]:()=>r,next:async()=>e.next(n)};let i=r;null!=(null===t||void 0===t?void 0:t.signal)&&(i=Lw(r,t.signal));const o=e=>{n=e},s=await Hd(i,(e=>Md(e,{onLength:o,maxDataLength:fU})),(async e=>nU(e)));if(null==s||0===s.length)throw new sc("no buffer returned","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(s.get(s.byteLength-1)!==yU[0])throw gU.error("Invalid mss message - missing newline - %s",s.subarray()),new sc("missing newline","ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return s.sublist(0,-1)}(e,t);return Xl(n.subarray())}const wU=Aw("libp2p:mss:select");async function EU(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Array.isArray(t)?[...t]:[t];const{reader:r,writer:i,rest:o,stream:s}=pU(e),a=t.shift();if(null==a)throw new Error("At least one protocol must be specified");wU.trace('select: write ["%s", "%s"]',dU,a);!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new gd;for(const i of t)r.append(mU(i));!0===n.writeBytes?e.push(r.subarray()):e.push(r)}(i,[ru(dU),ru(a)],n);let c=await bU(r,n);if(wU.trace('select: read "%s"',c),c===dU&&(c=await bU(r,n),wU.trace('select: read "%s"',c)),c===a)return o(),{stream:s,protocol:a};for(const l of t){wU.trace('select: write "%s"',l),vU(i,ru(l),n);const e=await bU(r,n);if(wU.trace('select: read "%s" for "%s"',e,l),e===l)return o(),{stream:s,protocol:l}}throw o(),new sc("protocol selection failed","ERR_UNSUPPORTED_PROTOCOL")}const _U=Aw("libp2p:mss:handle");async function SU(e,t,n){t=Array.isArray(t)?t:[t];const{writer:r,reader:i,rest:o,stream:s}=pU(e);for(;;){const e=await bU(i,n);if(_U.trace('read "%s"',e),e!==dU){if(t.includes(e))return vU(r,ru(e),n),_U.trace('respond with "%s" for "%s"',e,e),o(),{stream:s,protocol:e};"ls"!==e?(vU(r,ru("na"),n),_U('respond with "na" for "%s"',e)):(vU(r,new gd(...t.map((e=>mU(ru(e))))),n),_U.trace('respond with "%s" for %s',t,e))}else _U.trace('respond with "%s" for "%s"',dU,e),vU(r,ru(dU),n)}}const AU=Symbol.for("@libp2p/connection");const kU="CLOSING",TU="CLOSED";let IU;const CU=Aw("libp2p:connection");IU=Symbol.toStringTag;class RU{constructor(e){Xa(this,"id",void 0),Xa(this,"remoteAddr",void 0),Xa(this,"remotePeer",void 0),Xa(this,"stat",void 0),Xa(this,"tags",void 0),Xa(this,"_newStream",void 0),Xa(this,"_close",void 0),Xa(this,"_getStreams",void 0),Xa(this,"_closing",void 0),Xa(this,IU,"Connection"),Xa(this,AU,!0);const{remoteAddr:t,remotePeer:n,newStream:r,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=n,this.stat={...s,status:"OPEN"},this._newStream=r,this._close=i,this._getStreams=o,this.tags=[],this._closing=!1}get streams(){return this._getStreams()}async newStream(e,t){if(this.stat.status===kU)throw new sc("the connection is being closed","ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===TU)throw new sc("the connection is closed","ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const n=await this._newStream(e,t);return n.stat.direction="outbound",n}addStream(e){e.stat.direction="inbound"}removeStream(e){}async close(){if(this.stat.status!==TU&&!this._closing){this.stat.status=kU;try{this.streams.forEach((e=>{e.close()}))}catch(e){CU.error(e)}this._closing=!0,await this._close(),this._closing=!1,this.stat.timeline.close=Date.now(),this.stat.status=TU}}}const xU=Aw("libp2p:upgrader");function PU(e,t,n){let r=0;return n.streams.forEach((n=>{n.stat.direction===t&&n.stat.protocol===e&&r++})),r}class DU{constructor(e,t){var n;Xa(this,"components",void 0),Xa(this,"connectionEncryption",void 0),Xa(this,"muxers",void 0),Xa(this,"inboundUpgradeTimeout",void 0),Xa(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!==(n=t.inboundUpgradeTimeout)&&void 0!==n?n:3e4,this.events=e.events}async shouldBlockConnection(e,t,n){const r=this.components.connectionGater[n];if(void 0!==r&&await r(e,t))throw new sc("The multiaddr connection is blocked by gater.".concat(n),wM.ERR_CONNECTION_INTERCEPTED)}async upgradeInbound(e,t){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw new sc("connection denied",wM.ERR_CONNECTION_DENIED);let n,r,i,o,s;const a=Fw([AbortSignal.timeout(this.inboundUpgradeTimeout)]);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,a)}catch{}try{var c,l,u;const d=Uw(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 sc("The multiaddr connection is blocked by gater.acceptConnection",wM.ERR_CONNECTION_INTERCEPTED);null===(u=this.components.metrics)||void 0===u||u.trackMultiaddrConnection(e),xU("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&&(xU("protecting the inbound connection"),f=await t.protect(e))}try{if(n=f,!0!==(null===t||void 0===t?void 0:t.skipEncryption)){({conn:n,remotePeer:r,protocol:s}=await this._encryptInbound(f));const e={...f,...n};await this.shouldBlockConnection(r,e,"denyInboundEncryptedConnection")}else{const t=e.remoteAddr.getPeerId();if(null==t)throw new sc("inbound connection that skipped encryption must have a peer id",wM.ERR_INVALID_MULTIADDR);const n=SP(t);s="native",r=n}if(i=n,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,...n},this.muxers);o=e.muxerFactory,i=e.stream}}catch(h){throw xU.error("Failed to upgrade inbound connection",h),h}return await this.shouldBlockConnection(r,e,"denyInboundUpgradedConnection"),xU("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:s,direction:"inbound",maConn:e,upgradedConn:i,muxerFactory:o,remotePeer:r})}finally{this.components.connectionManager.afterUpgradeInbound(),a.clear()}}async upgradeOutbound(e,t){var n;const r=e.remoteAddr.getPeerId();let i,o,s,a,c,l;null!=r&&(i=SP(r),await this.shouldBlockConnection(i,e,"denyOutboundConnection")),null===(n=this.components.metrics)||void 0===n||n.trackMultiaddrConnection(e),xU("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 sc("Encryption was skipped but no peer id was passed",wM.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 xU.error("Failed to upgrade outbound connection",h),await e.close(h),h}return await this.shouldBlockConnection(s,e,"denyOutboundUpgradedConnection"),xU("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:l,remotePeer:s})}_createConnection(e){var t,n,r=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 n=this.components.registrar.getProtocols(),{stream:r,protocol:i}=await SU(e,n);if(xU("%s: incoming stream opened on %s",o,i),null==d)return;const s=function(e,t){try{const{options:n}=t.getHandler(e);return n.maxInboundStreams}catch(n){if(n.code!==wM.ERR_NO_HANDLER_FOR_PROTOCOL)throw n}return sU}(i,this.components.registrar);if(PU(i,"inbound",d)===s){const t=new sc('Too many inbound protocol streams for protocol "'.concat(i,'" - limit ').concat(s),wM.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS);throw e.abort(t),t}e.source=r.source,e.sink=r.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=>{xU.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 sc("Stream is not multiplexed",wM.ERR_MUXER_UNAVAILABLE);xU("%s: starting new stream on %s",o,e);const n=await u.newStream();try{var i;if(null==t.signal){xU("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",e),t.signal=AbortSignal.timeout(3e4);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,t.signal)}catch{}}const{stream:o,protocol:s}=await EU(n,e,t),a=function(e,t){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{const{options:n}=t.getHandler(e);if(null!=n.maxOutboundStreams)return n.maxOutboundStreams}catch(i){if(i.code!==wM.ERR_NO_HANDLER_FOR_PROTOCOL)throw i}return null!==(n=r.maxOutboundStreams)&&void 0!==n?n:aU}(s,r.components.registrar,t);if(PU(s,"outbound",d)>=a){const e=new sc('Too many outbound protocol streams for protocol "'.concat(s,'" - limit ').concat(a),wM.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw n.abort(e),e}return await r.components.peerStore.merge(c,{protocols:[s]}),n.source=o.source,n.sink=o.sink,n.stat.protocol=s,null===(i=r.components.metrics)||void 0===i||i.trackProtocolStream(n,d),n}catch(s){if(xU.error("could not create new stream",s),null==n.stat.timeline.close&&n.close(),null!=s.code)throw s;throw new sc(String(s),wM.ERR_UNSUPPORTED_PROTOCOL)}},Promise.all([u.sink(a.source),a.sink(u.source)]).catch((e=>{xU.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){xU.error(e)}finally{r.events.safeDispatchEvent("connection:close",{detail:d})}})().catch((e=>{xU.error(e)})),Reflect.set(...arguments)}}),s.timeline.upgraded=Date.now();const p=()=>{throw new sc("connection is not multiplexed",wM.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!==(n=h)&&void 0!==n?n:p,getStreams:()=>null!=u?u.streams:p(),close:async()=>{await s.close(),null!=u&&u.close()}},d=new RU(g),this.events.safeDispatchEvent("connection:open",{detail:d}),d}_onStream(e){const{connection:t,stream:n,protocol:r}=e,{handler:i}=this.components.registrar.getHandler(r);i({connection:t,stream:n})}async _encryptInbound(e){const t=Array.from(this.connectionEncryption.keys());xU("handling inbound crypto protocol selection",t);try{const{stream:n,protocol:r}=await SU(e,t,{writeBytes:!0}),i=this.connectionEncryption.get(r);if(null==i)throw new Error("no crypto module found for ".concat(r));return xU("encrypting inbound connection..."),{...await i.secureInbound(this.components.peerId,n),protocol:r}}catch(n){throw new sc(String(n),wM.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t){const n=Array.from(this.connectionEncryption.keys());xU("selecting outbound crypto protocol",n);try{const{stream:r,protocol:i}=await EU(e,n,{writeBytes:!0}),o=this.connectionEncryption.get(i);if(null==o)throw new Error("no crypto module found for ".concat(i));return xU("encrypting outbound connection to %p",t),{...await o.secureOutbound(this.components.peerId,r,t),protocol:i}}catch(r){throw new sc(String(r),wM.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const n=Array.from(t.keys());xU("outbound selecting muxer %s",n);try{const{stream:r,protocol:i}=await EU(e,n,{writeBytes:!0});xU("%s selected as muxer protocol",i);return{stream:r,muxerFactory:t.get(i)}}catch(r){throw xU.error("error multiplexing outbound stream",r),new sc(String(r),wM.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const n=Array.from(t.keys());xU("inbound handling muxers %s",n);try{const{stream:r,protocol:i}=await SU(e,n,{writeBytes:!0});return{stream:r,muxerFactory:t.get(i)}}catch(r){throw xU.error("error multiplexing inbound stream",r),new sc(String(r),wM.ERR_MUXER_UNAVAILABLE)}}}const NU=Aw("libp2p");var OU=new WeakMap,BU=new WeakSet;class LU extends eh{constructor(e){var t,n,r,i,o,s;super(),dx(this,BU),Xa(this,"peerId",void 0),Xa(this,"peerStore",void 0),Xa(this,"contentRouting",void 0),Xa(this,"peerRouting",void 0),Xa(this,"keychain",void 0),Xa(this,"metrics",void 0),Xa(this,"services",void 0),Xa(this,"components",void 0),tc(this,OU,{writable:!0,value:void 0});const a=new eh,c=a.dispatchEvent.bind(a);a.dispatchEvent=e=>{const t=c(e),n=this.dispatchEvent(new nh(e.type,{detail:e.detail}));return t||n};try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,a)}catch{}rc(this,OU,!1),this.peerId=e.peerId,this.services={};const l=this.components=function(){const e=new FL(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return new Proxy(e,{get(t,n,r){if("string"===typeof n&&!zL.includes(n)){const t=e.components[n];if(null==t&&!jL.includes(n))throw new sc("".concat(n," not set"),"ERR_SERVICE_MISSING");return t}return Reflect.get(t,n,r)},set:(t,n,r)=>("string"===typeof n?e.components[n]=r:Reflect.set(t,n,r),!0)})}({peerId:e.peerId,events:a,datastore:null!==(t=e.datastore)&&void 0!==t?t:new NL,connectionGater:oM(e.connectionGater)});this.peerStore=this.configureComponent("peerStore",new FB(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 DU(this.components,{connectionEncryption:(null!==(n=e.connectionEncryption)&&void 0!==n?n:[]).map(((e,t)=>this.configureComponent("connection-encryption-".concat(t),e(this.components)))),muxers:(null!==(r=e.streamMuxers)&&void 0!==r?r:[]).map(((e,t)=>this.configureComponent("stream-muxers-".concat(t),e(this.components)))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.configureComponent("transportManager",new hU(this.components,e.transportManager)),this.configureComponent("connectionManager",new QM(this.components,e.connectionManager)),this.configureComponent("registrar",new cU(this.components)),this.configureComponent("addressManager",new ML(this.components,e.addresses));const u=Yx.generateOptions();this.keychain=this.configureComponent("keyChain",new Yx(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 iU(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 tU(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=>{fx(this,BU,MU).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[gx]&&(NU("registering service %s for content routing",f),d.push(t[gx])),null!=t[mx]&&(NU("registering service %s for peer routing",f),h.push(t[mx])),null!=t[yx]&&(NU("registering service %s for peer discovery",f),t[yx].addEventListener("peer",(e=>{fx(this,BU,MU).call(this,e)})))):NU.error("service factory %s returned null or undefined instance",f)}}configureComponent(e,t){return null==t&&NU.error("component %s was null or undefined",e),this.components[e]=t,t}async start(){if(ic(this,OU))return;rc(this,OU,!0),NU("libp2p is starting");null==(await this.keychain.listKeys()).find((e=>"self"===e.name))&&(NU("importing self key into keychain"),await this.keychain.importPeer("self",this.components.peerId));try{var e,t,n,r;await(null===(e=(t=this.components).beforeStart)||void 0===e?void 0:e.call(t)),await this.components.start(),await(null===(n=(r=this.components).afterStart)||void 0===n?void 0:n.call(r)),this.safeDispatchEvent("start",{detail:this}),NU("libp2p has started")}catch(i){throw NU.error("An error occurred starting libp2p",i),await this.stop(),i}}async stop(){var e,t,n,r;ic(this,OU)&&(NU("libp2p is stopping"),rc(this,OU,!1),await(null===(e=(t=this.components).beforeStop)||void 0===e?void 0:e.call(t)),await this.components.stop(),await(null===(n=(r=this.components).afterStop)||void 0===n?void 0:n.call(r)),this.safeDispatchEvent("stop",{detail:this}),NU("libp2p has stopped"))}isStarted(){return ic(this,OU)}getConnections(e){return this.components.connectionManager.getConnections(e)}getDialQueue(){return this.components.connectionManager.getDialQueue()}getPeers(){const e=new fP;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 n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==t)throw new sc("no protocols were provided to open a stream",wM.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(0===(t=Array.isArray(t)?t:[t]).length)throw new sc("no protocols were provided to open a stream",wM.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this.dial(e,n)).newStream(t,n)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(e){var t;wL(e)&&(e=SP(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(NU("getPublicKey %p",e),null!=e.publicKey)return e.publicKey;const n=await this.peerStore.get(e);if(null!=n.id.publicKey)return n.id.publicKey;const r=Zl([ru("/pk/"),e.multihash.digest]),i=await this.contentRouting.get(r,t);return qb(i),await this.peerStore.patch(e,{publicKey:i}),i}async handle(e,t,n){Array.isArray(e)||(e=[e]),await Promise.all(e.map((async e=>{await this.components.registrar.handle(e,t,n)})))}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 MU(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=>{NU.error(e)})):NU.error(new Error(wM.ERR_DISCOVERED_SELF))}async function UU(e){if(null==e.peerId){const n=e.datastore;if(null!=n)try{const t=new Yx({datastore:n},Ox(Yx.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 VP()),new LU(function(e){var t,n;const r=Ox(EM,e);if(null==r.transports||r.transports.length<1)throw new sc(bM.ERR_TRANSPORTS_REQUIRED,wM.ERR_TRANSPORTS_REQUIRED);if(null===r.connectionProtector&&null!=(null===(t=globalThis.process)||void 0===t||null===(n=t.env)||void 0===n?void 0:n.LIBP2P_FORCE_PNET))throw new sc(bM.ERR_PROTECTOR_REQUIRED,wM.ERR_PROTECTOR_REQUIRED);return r}(e))}const FU="js-libp2p/".concat("0.45.9");var jU=__webpack_require__(6296),zU=__webpack_require__(2546),KU=__webpack_require__(2751),qU=__webpack_require__(100),VU=__webpack_require__(6153);KU._configure(),jU._configure(zU),qU._configure(VU);const HU=["uint64","int64","sint64","fixed64","sfixed64"];function WU(e){return function(e){for(const t of HU){if(null==e[t])continue;const n=e[t];e[t]=function(){return BigInt(n.call(this).toString())}}return e}(new jU(e))}function GU(){return function(e){for(const t of HU){if(null==e[t])continue;const n=e[t];e[t]=function(e){return n.call(this,e.toString())}}return e}(qU.create())}var $U,YU;!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"}($U||($U={})),function(e){let t;e.codec=()=>(null==t&&(t=function(e,t){return function(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}("message",$U.LENGTH_DELIMITED,e,t)}((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.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 r of e.listenAddrs)t.uint32(18),t.bytes(r);if(null!=e.observedAddr&&(t.uint32(34),t.bytes(e.observedAddr)),null!=e.protocols)for(const r of e.protocols)t.uint32(26),t.string(r);null!=e.signedPeerRecord&&(t.uint32(66),t.bytes(e.signedPeerRecord)),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={listenAddrs:[],protocols:[]},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 5:n.protocolVersion=e.string();break;case 6:n.agentVersion=e.string();break;case 1:n.publicKey=e.bytes();break;case 2:n.listenAddrs.push(e.bytes());break;case 4:n.observedAddr=e.bytes();break;case 3:n.protocols.push(e.string());break;case 8:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return n}))),t),e.encode=t=>function(e,t){const n=GU();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}(t,e.codec()),e.decode=t=>function(e,t){const n=WU(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}(t,e.codec())}(YU||(YU={}));const QU=Aw("libp2p:identify"),XU={protocolPrefix:"ipfs",agentVersion:FU,timeout:6e4,maxInboundStreams:1,maxOutboundStreams:1,maxPushIncomingStreams:1,maxPushOutgoingStreams:1,maxObservedAddresses:10,maxIdentifyMessageSize:8192};var JU=new WeakSet;class ZU{constructor(e,t){var n,r,i,o,s,a,c,l,u,h,d;dx(this,JU),Xa(this,"identifyProtocolStr",void 0),Xa(this,"identifyPushProtocolStr",void 0),Xa(this,"host",void 0),Xa(this,"started",void 0),Xa(this,"timeout",void 0),Xa(this,"peerId",void 0),Xa(this,"peerStore",void 0),Xa(this,"registrar",void 0),Xa(this,"connectionManager",void 0),Xa(this,"addressManager",void 0),Xa(this,"maxInboundStreams",void 0),Xa(this,"maxOutboundStreams",void 0),Xa(this,"maxPushIncomingStreams",void 0),Xa(this,"maxPushOutgoingStreams",void 0),Xa(this,"maxIdentifyMessageSize",void 0),Xa(this,"maxObservedAddresses",void 0),Xa(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!==(n=t.protocolPrefix)&&void 0!==n?n:XU.protocolPrefix,"/").concat("id","/").concat("1.0.0"),this.identifyPushProtocolStr="/".concat(null!==(r=t.protocolPrefix)&&void 0!==r?r:XU.protocolPrefix,"/").concat("id/push","/").concat("1.0.0"),this.timeout=null!==(i=t.timeout)&&void 0!==i?i:XU.timeout,this.maxInboundStreams=null!==(o=t.maxInboundStreams)&&void 0!==o?o:XU.maxInboundStreams,this.maxOutboundStreams=null!==(s=t.maxOutboundStreams)&&void 0!==s?s:XU.maxOutboundStreams,this.maxPushIncomingStreams=null!==(a=t.maxPushIncomingStreams)&&void 0!==a?a:XU.maxPushIncomingStreams,this.maxPushOutgoingStreams=null!==(c=t.maxPushOutgoingStreams)&&void 0!==c?c:XU.maxPushOutgoingStreams,this.maxIdentifyMessageSize=null!==(l=t.maxIdentifyMessageSize)&&void 0!==l?l:XU.maxIdentifyMessageSize,this.maxObservedAddresses=null!==(u=t.maxObservedAddresses)&&void 0!==u?u:XU.maxObservedAddresses,this.host={protocolVersion:"".concat(null!==(h=t.protocolPrefix)&&void 0!==h?h:XU.protocolPrefix,"/").concat("0.1.0"),agentVersion:null!==(d=t.agentVersion)&&void 0!==d?d:XU.agentVersion},e.events.addEventListener("connection:open",(e=>{const t=e.detail;this.identify(t).catch((e=>{QU.error("error during identify trigged by connection:open",e)}))})),e.events.addEventListener("self:peer:update",(e=>{this.push().catch((e=>{QU.error(e)}))})),this.host.agentVersion===FU&&(b_||m_?this.host.agentVersion+=" UserAgent=".concat(globalThis.process.version):(y_||w_||v_||E_)&&(this.host.agentVersion+=" UserAgent=".concat(globalThis.navigator.userAgent)))}isStarted(){return this.started}async start(){this.started||(await this.peerStore.merge(this.peerId,{metadata:{AgentVersion:ru(this.host.agentVersion),ProtocolVersion:ru(this.host.protocolVersion)}}),await this.registrar.handle(this.identifyProtocolStr,(e=>{this._handleIdentify(e).catch((e=>{QU.error(e)}))}),{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}),await this.registrar.handle(this.identifyPushProtocolStr,(e=>{this._handlePush(e).catch((e=>{QU.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,n;const r=this.addressManager.getAddresses().map((e=>e.decapsulateCode($B("p2p").code))),i=new sN({peerId:this.peerId,multiaddrs:r}),o=await mD.seal(i,this.peerId),s=this.registrar.getProtocols(),a=await this.peerStore.get(this.peerId),c=Xl(null!==(t=a.metadata.get("AgentVersion"))&&void 0!==t?t:ru(this.host.agentVersion)),l=Xl(null!==(n=a.metadata.get("ProtocolVersion"))&&void 0!==n?n:ru(this.host.protocolVersion)),u=e.map((async e=>{let t;const n=AbortSignal.timeout(this.timeout);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,n)}catch{}try{t=await e.newStream([this.identifyPushProtocolStr],{signal:n});const i=Uw(t,n);await i.sink(Hd([YU.encode({listenAddrs:r.map((e=>e.bytes)),signedPeerRecord:o.marshal(),protocols:s,agentVersion:c,protocolVersion:l})],(e=>Pd(e))))}catch(i){QU.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(n){if(n.code!==wM.ERR_NOT_FOUND)throw n}}))),await this.pushToConnections(e)}async _identify(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Fw([AbortSignal.timeout(this.timeout),null===n||void 0===n?void 0:n.signal]);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,r)}catch{}try{t=await e.newStream([this.identifyProtocolStr],{signal:r});const n=Uw(t,r),o=await Hd([],n,(e=>{var t;return Md(e,{maxDataLength:null!==(t=this.maxIdentifyMessageSize)&&void 0!==t?t:8192})}),(async e=>nU(e)));if(null==o)throw new sc("No data could be retrieved",wM.ERR_CONNECTION_ENDED);try{return YU.decode(o)}catch(i){throw new sc(String(i),wM.ERR_INVALID_MESSAGE)}}finally{null!=t&&t.close(),r.clear()}}async identify(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=await this._identify(e,n),{publicKey:i,protocols:o,observedAddr:s}=r;if(null==i)throw new sc("public key was missing from identify message",wM.ERR_MISSING_PUBLIC_KEY);const a=await async function(e,t){return e.length===mP?new EP({multihash:jc(Dl.code,e),privateKey:t}):e.length===vP?new _P({multihash:jc(Dl.code,e),privateKey:t}):new wP({multihash:await Rl.digest(e),publicKey:e,privateKey:t})}(i);if(!e.remotePeer.equals(a))throw new sc("identified peer does not match the expected peer",wM.ERR_INVALID_PEER);if(this.peerId.equals(a))throw new sc("identified peer is our own peer id?",wM.ERR_INVALID_PEER);const c=function(e){if(null!=e&&e.length>0)try{return TL(e)}catch{}}(s);QU("identify completed for peer %p and protocols %o",a,o),QU("our observed address is %s",c),null!=c&&this.addressManager.getObservedAddrs().length<(null!==(t=this.maxObservedAddresses)&&void 0!==t?t:1/0)&&(QU("storing our observed address %s",null===c||void 0===c?void 0:c.toString()),this.addressManager.addObservedAddr(c));const l=await fx(this,JU,eF).call(this,e.remotePeer,r),u={peerId:a,protocolVersion:r.protocolVersion,agentVersion:r.agentVersion,publicKey:r.publicKey,listenAddrs:r.listenAddrs.map((e=>TL(e))),observedAddr:null==r.observedAddr?void 0:TL(r.observedAddr),protocols:r.protocols,signedPeerRecord:l};this.events.safeDispatchEvent("peer:identify",{detail:u})}async _handleIdentify(e){const{connection:t,stream:n}=e,r=AbortSignal.timeout(this.timeout);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,r)}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($B("p2p").code)));let a=o.peerRecordEnvelope;if(s.length>0&&null==a){const e=new sN({peerId:this.peerId,multiaddrs:s});a=(await mD.seal(e,this.peerId)).marshal().subarray()}const c=YU.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=Uw(n,r),u=Hd([c],(e=>Pd(e)));await l.sink(u)}catch(o){QU.error("could not respond to identify request",o)}finally{n.close()}}async _handlePush(e){const{connection:t,stream:n}=e;try{var r;if(this.peerId.equals(t.remotePeer))throw new Error("received push from ourselves?");const e=mp(Uw(n,AbortSignal.timeout(this.timeout)),{maxDataLength:null!==(r=this.maxIdentifyMessageSize)&&void 0!==r?r:8192}),i=await e.readPB(YU);await fx(this,JU,eF).call(this,t.remotePeer,i)}catch(i){return void QU.error("received invalid message",i)}finally{n.close()}QU("handled push from %p",t.remotePeer)}}async function eF(e,t){if(QU("received identify from %p",e),null==t)throw new Error("Message was null or undefined");const n={addresses:t.listenAddrs.map((e=>({isCertified:!1,multiaddr:TL(e)}))),protocols:t.protocols,metadata:new Map,peerRecordEnvelope:t.signedPeerRecord};let r;if(null!=t.signedPeerRecord){QU("received signedPeerRecord in push from %p",e);let o=t.signedPeerRecord;const s=await mD.openAndCertify(o,sN.DOMAIN);let a,c=sN.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&&(n.metadata=a.metadata,null!=a.peerRecordEnvelope)){const e=await mD.createFromProtobuf(a.peerRecordEnvelope),t=sN.createFromProtobuf(e.payload);t.seqNumber>=c.seqNumber&&(QU("sequence number was lower or equal to existing sequence number - stored: %d received: %d",t.seqNumber,c.seqNumber),c=t,o=a.peerRecordEnvelope)}n.peerRecordEnvelope=o,n.addresses=c.multiaddrs.map((e=>({isCertified:!0,multiaddr:e}))),r={seq:c.seqNumber,addresses:c.multiaddrs}}else QU("%p did not send a signed peer record",e);return null!=t.agentVersion&&n.metadata.set("AgentVersion",ru(t.agentVersion)),null!=t.protocolVersion&&n.metadata.set("ProtocolVersion",ru(t.protocolVersion)),await this.peerStore.patch(e,n),r}function tF(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new ZU(t,e)}const nF=Aw("libp2p:ping");class rF{constructor(e,t){var n,r,i,o;Xa(this,"protocol",void 0),Xa(this,"components",void 0),Xa(this,"started",void 0),Xa(this,"timeout",void 0),Xa(this,"maxInboundStreams",void 0),Xa(this,"maxOutboundStreams",void 0),this.components=e,this.started=!1,this.protocol="/".concat(null!==(n=t.protocolPrefix)&&void 0!==n?n:"ipfs","/").concat("ping","/").concat("1.0.0"),this.timeout=null!==(r=t.timeout)&&void 0!==r?r: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;Hd(t,t).catch((e=>{nF.error(e)}))}async ping(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};nF("dialing %s to %p",this.protocol,e);const n=Date.now(),r=Eb(32),i=await this.components.connectionManager.openConnection(e,t);let o;const s=Fw([AbortSignal.timeout(this.timeout),null===t||void 0===t?void 0:t.signal]);try{null===px.setMaxListeners||void 0===px.setMaxListeners||(0,px.setMaxListeners)(1/0,s)}catch{}try{o=await i.newStream([this.protocol],{signal:s});const e=Uw(o,s),t=await Hd([r],e,(async e=>nU(e))),a=Date.now();if(null==t||!ll(r,t.subarray()))throw new sc("Received wrong ping ack",wM.ERR_WRONG_PING_ACK);return a-n}finally{null!=o&&o.close(),s.clear()}}}function iF(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new rF(t,e)}const oF={lightPush:1,filter:1,store:1};async function sF(e){var t,n;const r=null!==(t=null===e||void 0===e?void 0:e.libp2p)&&void 0!==t?t:{},i=null!==(n=r.peerDiscovery)&&void 0!==n?n:[];null!==e&&void 0!==e&&e.defaultBootstrap&&(i.push(aF()),Object.assign(r,{peerDiscovery:i}));const o=await cF(void 0,r,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 rp(t,e)}(e),a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new _f(t,e)}(e),c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new vf(t,e)}(e);return new lh(null!==e&&void 0!==e?e:{},o,s,a,c)}function aF(){return oC([nC.PROD],oF)}async function cF(e,t,n){const r=e?{pubsub:e}:{};return async function(e){const t=await UU(e);return!1!==e.start&&await t.start(),t}({connectionManager:{minConnections:1},transports:[JS({filter:KS})],streamMuxers:[hE()],connectionEncryption:[Ow()],...t,services:{identify:tF({agentVersion:null!==n&&void 0!==n?n:ah}),ping:iF(),...r,...null===t||void 0===t?void 0:t.services}})}const lF=P.createContext({decoder:void 0,encoder:void 0}),uF=()=>P.useContext(lF),hF=e=>{const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,r]=P.useState(id({contentTopic:e,ephemeral:t})),[i,o]=P.useState(sd(e));return P.useEffect((()=>{r(id({contentTopic:e,ephemeral:t})),o(sd(e))}),[e,t]),{encoder:n,decoder:i}}(e.contentTopic,e.ephemeral);return P.createElement(lF.Provider,{value:t},e.children)},dF=e=>{const{factory:t,options:n,protocols:r=[]}=e,[i,o]=P.useState(void 0),[s,a]=P.useState(!0),[c,l]=P.useState(void 0);return P.useEffect((()=>{let e=!1;return a(!0),t(n).then((async t=>{e||(await t.start(),await dp(t,r),o(t),a(!1))})).catch((e=>{a(!1),l("Failed at creating node: ".concat((null===e||void 0===e?void 0:e.message)||"no message"))})),()=>{e=!0}}),[]),{node:i,error:c,isLoading:s}},fF=e=>{const{node:t,encoder:n}=e,r=P.useCallback((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return t.lightPush.send(n,e,r)}),[t,n]);return t||n?{push:r}:{}},pF=P.createContext({node:void 0,isLoading:!1,error:void 0}),gF=()=>P.useContext(pF),yF=e=>{const t=(n={options:e.options,protocols:e.protocols},dF({...n,factory:sF}));var n;return P.createElement(pF.Provider,{value:t},e.children)};class mF{constructor(e,t){Xa(this,"multicodec",void 0),Xa(this,"components",void 0),Xa(this,"addLibp2pEventListener",void 0),Xa(this,"removeLibp2pEventListener",void 0),this.multicodec=e,this.components=t,this.addLibp2pEventListener=t.events.addEventListener.bind(t.events),this.removeLibp2pEventListener=t.events.removeEventListener.bind(t.events)}get peerStore(){return this.components.peerStore}async peers(){return Jd(this.peerStore,[this.multicodec])}async getPeer(e){const{peer:t}=await Zd(this.peerStore,[this.multicodec],e);return t}async newStream(e){const t=ef(this.components.connectionManager.getConnections(e.id));if(!t)throw new Error("Failed to get a connection to the peer");return t.newStream(this.multicodec)}}class vF{constructor(e){Xa(this,"proto",void 0),this.proto=e}static createRequest(e){const{numPeers:t}=e;return new vF({query:{numPeers:t},response:void 0})}encode(){return Qh.encode(this.proto)}static decode(e){const t=Qh.decode(e);return new vF(t)}get query(){return this.proto.query}get response(){return this.proto.response}}const bF="/vac/waku/peer-exchange/2.0.0-alpha1",wF=Ju("waku:peer-exchange");class EF extends mF{constructor(e){super(bF,e),Xa(this,"multicodec",void 0),this.multicodec=bF}async query(e){const{numPeers:t}=e,n=vF.createRequest({numPeers:BigInt(t)}),r=await this.getPeer(e.peerId),i=await this.newStream(r),o=await Hd([n.encode()],Pd,i,Md,(async e=>await hd(e)));try{const e=new gd;o.forEach((t=>{e.append(t)}));const{response:t}=vF.decode(e);return t?Promise.all(t.peerInfos.map((e=>e.enr)).filter(Hf).map((async e=>({ENR:await Kk.fromRLP(e)})))):void wF("PeerExchangeRPC message did not contains a `response` field")}catch(s){return void wF("Failed to decode push reply",s)}}}const _F=Symbol.for("@libp2p/peer-discovery");let SF;const AF=Ju("waku:peer-exchange-discovery"),kF=1e4,TF=3,IF=Vu.PEER_EXCHANGE;SF=Symbol.toStringTag;class CF extends eh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),Xa(this,"components",void 0),Xa(this,"peerExchange",void 0),Xa(this,"options",void 0),Xa(this,"isStarted",void 0),Xa(this,"queryingPeers",new Set),Xa(this,"queryAttempts",new Map),Xa(this,"handleDiscoveredPeer",(e=>{const{peer:{protocols:t,id:n}}=e.detail;t.includes(bF)&&!this.queryingPeers.has(n.toString())&&(this.queryingPeers.add(n.toString()),this.startRecurringQueries(n).catch((e=>AF("Error querying peer ".concat(e)))))})),Xa(this,"startRecurringQueries",(async e=>{var t,n;const r=e.toString(),{queryInterval:i=kF,maxRetries:o=TF}=this.options;AF("Querying peer: ".concat(r," (attempt ").concat(null!==(t=this.queryAttempts.get(r))&&void 0!==t?t:1,")")),await this.query(e);const s=null!==(n=this.queryAttempts.get(r))&&void 0!==n?n:1;s>o?this.abortQueriesForPeer(r):setTimeout((()=>{this.queryAttempts.set(r,s+1),this.startRecurringQueries(e).catch((e=>{AF("Error in startRecurringQueries: ".concat(e))}))}),i*s)})),this.components=e,this.peerExchange=new EF(e),this.options=t,this.isStarted=!1}start(){this.isStarted||(AF("Starting peer exchange node discovery, discovering peers"),this.components.events.addEventListener("peer:update",this.handleDiscoveredPeer))}stop(){this.isStarted&&(AF("Stopping peer exchange node discovery"),this.isStarted=!1,this.queryingPeers.clear(),this.components.events.removeEventListener("peer:update",this.handleDiscoveredPeer))}get[_F](){return!0}get[SF](){return"@waku/peer-exchange"}async query(e){const t=await this.peerExchange.query({numPeers:10,peerId:e});if(t)for(const i of t){var n,r;const{ENR:e}=i;if(!e){AF("No ENR in peerInfo object, skipping");continue}const{peerId:t,peerInfo:o}=e;if(!t||!o)continue;await this.components.peerStore.has(t)||(await this.components.peerStore.save(t,{tags:{[IF]:{value:null!==(n=this.options.tagValue)&&void 0!==n?n:50,ttl:null!==(r=this.options.tagTTL)&&void 0!==r?r:12e4}}}),AF("Discovered peer: ".concat(t.toString())),this.dispatchEvent(new nh("peer",{detail:{id:t,protocols:[],multiaddrs:o.multiaddrs}})))}else AF("Peer exchange query failed, no peer info returned")}abortQueriesForPeer(e){AF("Aborting queries for peer: ".concat(e)),this.queryingPeers.delete(e),this.queryAttempts.delete(e)}}const RF=iu,xF=ou,PF=function(e){let t=0;if(e=e.toString().trim(),RF(e)){const n=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{n[t++]=255&parseInt(e,10)})),n}if(xF(e)){const n=e.split(":",8);let r;for(r=0;r<n.length;r++){let e;RF(n[r])&&(e=PF(n[r]),n[r]=Xl(e.slice(0,2),"base16")),null!=e&&++r<8&&n.splice(r,0,Xl(e.slice(2,4),"base16"))}if(""===n[0])for(;n.length<8;)n.unshift("0");else if(""===n[n.length-1])for(;n.length<8;)n.push("0");else if(n.length<8){for(r=0;r<n.length&&""!==n[r];r++);const e=[r,1];for(r=9-n.length;r>0;r--)e.push("0");n.splice.apply(n,e)}const i=new Uint8Array(t+16);for(r=0;r<n.length;r++){const e=parseInt(n[r],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},DF=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;n=~~n,r=null!==(t=r)&&void 0!==t?t:e.length-n;const i=new DataView(e.buffer);if(4===r){const t=[];for(let i=0;i<r;i++)t.push(e[n+i]);return t.join(".")}if(16===r){const e=[];for(let t=0;t<r;t+=2)e.push(i.getUint16(n+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},NF=-1,OF={},BF={};function LF(e){if("number"===typeof e){if(null!=BF[e])return BF[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=OF[e])return OF[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,NF,"ip6zone"],[53,NF,"dns",!0],[54,NF,"dns4",!0],[55,NF,"dns6",!0],[56,NF,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,NF,"unix",!1,!0],[421,NF,"ipfs"],[421,NF,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,NF,"garlic64"],[460,0,"quic"],[465,0,"webtransport"],[466,NF,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,NF,"memory"]].forEach((e=>{const t=function(e,t,n,r,i){return{code:e,size:t,name:n,resolvable:Boolean(r),path:Boolean(i)}}(...e);BF[t.code]=t,OF[t.name]=t}));var MF=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=jF;)n[r++]=255&t|UF,t/=128;for(;t&FF;)n[r++]=255&t|UF,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},UF=128,FF=-128,jF=Math.pow(2,31);var zF=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(r&qF)<<o:(r&qF)*Math.pow(2,o),o+=7}while(r>=KF);return e.bytes=s-n,i},KF=128,qF=127;var VF=Math.pow(2,7),HF=Math.pow(2,14),WF=Math.pow(2,21),GF=Math.pow(2,28),$F=Math.pow(2,35),YF=Math.pow(2,42),QF=Math.pow(2,49),XF=Math.pow(2,56),JF=Math.pow(2,63);const ZF={encode:MF,decode:zF,encodingLength:function(e){return e<VF?1:e<HF?2:e<WF?3:e<GF?4:e<$F?5:e<YF?6:e<QF?7:e<XF?8:e<JF?9:10}},ej=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return[ZF.decode(e,t),ZF.decode.bytes]},tj=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return ZF.encode(e,t,n),t},nj=e=>ZF.encodingLength(e),rj=(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")}),ij=(e,t)=>{const n=t.byteLength,r=nj(e),i=r+nj(n),o=new Uint8Array(i+n);return tj(e,o,0),tj(n,o,r),o.set(t,i),new sj(e,n,t,o)},oj=e=>{const t=rj(e),[n,r]=ej(t),[i,o]=ej(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new sj(n,i,s,t)};class sj{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}var aj=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[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 r=0,i=0;e[t]===c;)r++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=n[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(r+(o-f)),g=r;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 n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;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<r)&&-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");r=d,i++}for(var p=s-r;p!==s&&0===l[p];)p++;for(var g=c.repeat(n);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var n=h(e);if(n)return n;throw new Error("Non-".concat(t," character"))}}};const cj=aj;class lj{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class uj{constructor(e,t,n){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=n}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 dj(this,e)}}class hj{constructor(e){this.decoders=e}or(e){return dj(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.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 dj=(e,t)=>new hj({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class fj{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new lj(e,t,n),this.decoder=new uj(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pj=e=>{let{name:t,prefix:n,encode:r,decode:i}=e;return new fj(t,n,r,i)},gj=e=>{let{prefix:t,name:n,alphabet:r}=e;const{encode:i,decode:o}=cj(r,n);return pj({prefix:t,name:n,encode:i,decode:e=>rj(o(e))})},yj=e=>{let{name:t,prefix:n,bitsPerChar:r,alphabet:i}=e;return pj({prefix:n,name:t,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o})(e,i,r),decode:e=>((e,t,n,r)=>{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*n/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(r," character"));c=c<<n|t,a+=n,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,r,t)})},mj=gj({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vj=gj({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),bj=yj({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),wj=yj({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ej=yj({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),_j=yj({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Sj=yj({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Aj=yj({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kj=yj({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Tj=yj({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ij=yj({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Cj=new WeakMap,Rj=e=>{const t=Cj.get(e);if(null==t){const t=new Map;return Cj.set(e,t),t}return t};class xj{constructor(e,t,n,r){this.code=t,this.version=e,this.multihash=n,this.bytes=r,this["/"]=r}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!==Oj)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Bj)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return xj.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,n=ij(e,t);return xj.createV1(this.code,n)}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 xj.equals(this,e)}static equals(e,t){const n=t;return n&&e.code===n.code&&e.version===n.version&&((e,t)=>{if(e===t)return!0;{const n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0})(e.bytes,n.bytes)}})(e.multihash,n.multihash)}toString(e){return((e,t)=>{const{bytes:n,version:r}=e;return 0===r?Dj(n,Rj(e),t||mj.encoder):Nj(n,Rj(e),t||bj.encoder)})(this,e)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID(".concat(this.toString(),")")}static asCID(e){if(null==e)return null;const t=e;if(t instanceof xj)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:e,code:n,multihash:r,bytes:i}=t;return new xj(e,n,r,i||Lj(e,n,r.bytes))}if(!0===t[Mj]){const{version:e,multihash:n,code:r}=t,i=oj(n);return xj.create(e,r,i)}return null}static create(e,t,n){if("number"!==typeof t)throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:if(t!==Oj)throw new Error("Version 0 CID must use dag-pb (code: ".concat(Oj,") block encoding"));return new xj(e,t,n,n.bytes);case 1:{const r=Lj(e,t,n.bytes);return new xj(e,t,n,r)}default:throw new Error("Invalid version")}}static createV0(e){return xj.create(0,Oj,e)}static createV1(e,t){return xj.create(1,e,t)}static decode(e){const[t,n]=xj.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=xj.inspectBytes(e),n=t.size-t.multihashSize,r=rj(e.subarray(n,n+t.multihashSize));if(r.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=r.subarray(t.multihashSize-t.digestSize),o=new sj(t.multihashCode,t.digestSize,i,r);return[0===t.version?xj.createV0(o):xj.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const n=()=>{const[n,r]=ej(e.subarray(t));return t+=r,n};let r=n(),i=Oj;if(18===r?(r=0,t=0):i=n(),0!==r&&1!==r)throw new RangeError("Invalid CID version ".concat(r));const o=t,s=n(),a=n(),c=t+a;return{version:r,codec:i,multihashCode:s,digestSize:a,multihashSize:c-o,size:c}}static parse(e,t){const[n,r]=Pj(e,t),i=xj.decode(r);return Rj(i).set(n,e),i}}const Pj=(e,t)=>{switch(e[0]){case"Q":{const n=t||mj;return[mj.prefix,n.decode("".concat(mj.prefix).concat(e))]}case mj.prefix:{const n=t||mj;return[mj.prefix,n.decode(e)]}case bj.prefix:{const n=t||bj;return[bj.prefix,n.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)]}},Dj=(e,t,n)=>{const{prefix:r}=n;if(r!==mj.prefix)throw Error("Cannot string encode V0 in ".concat(n.name," encoding"));const i=t.get(r);if(null==i){const i=n.encode(e).slice(1);return t.set(r,i),i}return i},Nj=(e,t,n)=>{const{prefix:r}=n,i=t.get(r);if(null==i){const i=n.encode(e);return t.set(r,i),i}return i},Oj=112,Bj=18,Lj=(e,t,n)=>{const r=nj(e),i=r+nj(t),o=new Uint8Array(i+n.byteLength);return tj(e,o,0),tj(t,o,r),o.set(n,i),o},Mj=Symbol.for("@ipld/js-cid/CID"),Uj=pj({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),Fj=yj({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),jj=yj({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),zj=gj({prefix:"9",name:"base10",alphabet:"0123456789"}),Kj=yj({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qj=yj({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Vj=gj({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Hj=gj({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Wj=yj({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gj=yj({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),$j=yj({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Yj=yj({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Qj=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"),Xj=Qj.reduce(((e,t,n)=>(e[n]=t,e)),[]),Jj=Qj.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const Zj=pj({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=Xj[t]),"")},decode:function(e){const t=[];for(const n of e){const e=Jj[n.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(n));t.push(e)}return new Uint8Array(t)}}),ez=e=>{let{name:t,code:n,encode:r}=e;return new tz(t,n,r)};class tz{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?ij(this.code,t):t.then((e=>ij(this.code,e)))}throw Error("Unknown type, must be binary type")}}const nz=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),rz=ez({name:"sha2-256",code:18,encode:nz("SHA-256")}),iz=ez({name:"sha2-512",code:19,encode:nz("SHA-512")}),oz=rj,sz={code:0,name:"identity",encode:oz,digest:e=>ij(0,oz(e))},az="raw",cz=85,lz=e=>rj(e),uz=e=>rj(e),hz=new TextEncoder,dz=new TextDecoder,fz="json",pz=512,gz=e=>hz.encode(JSON.stringify(e)),yz=e=>JSON.parse(dz.decode(e)),mz={...b,...w,...E,..._,...S,...v,...A,...m,...k,...T};function vz(e,t){switch(LF(e).code){case 4:case 41:return function(e){const t=DF(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!su(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return Az(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=Jl.decode(e);if(e=e.slice(Jl.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return Xl(e)}(t);case 421:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return Xl(n,"base58btc")}(t);case 444:case 445:return kz(t);case 466:return function(e){const t=Jl.decode(e),n=e.slice(Jl.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return"u"+Xl(n,"base64url")}(t);default:return Xl(t,"base16")}}function bz(e,t){switch(LF(e).code){case 4:case 41:return _z(t);case 6:case 273:case 33:case 132:return Sz(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=ru(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?oj(mj.decode("z".concat(e))).bytes:xj.parse(e).multihash.bytes;const n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.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 n=bj.decode("b"+t[0]),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=Sz(r);return Zl([n,i],n.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 n=bj.decode("b".concat(t[0])),r=parseInt(t[1],10);if(r<1||r>65536)throw new Error("Port number is not in range(1, 65536)");const i=Sz(r);return Zl([n,i],n.length+i.length)}(t);case 466:return function(e){const t=Ez.decode(e),n=Uint8Array.from(Jl.encode(t.length));return Zl([n,t],n.length+t.length)}(t);default:return ru(t,"base16")}}const wz=Object.values(mz).map((e=>e.decoder)),Ez=function(){let e=wz[0].or(wz[1]);return wz.slice(2).forEach((t=>e=e.or(t))),e}();function _z(e){if(!su(e))throw new Error("invalid ip address");return PF(e)}function Sz(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function Az(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function kz(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2),r=Xl(t,"base32"),i=Az(n);return"".concat(r,":").concat(i)}function Tz(e){return e.map((e=>{const t=Lz(e);return null!=e[1]?[t.code,vz(t.code,e[1])]:[t.code]}))}function Iz(e){return Dz(Zl(e.map((e=>{const t=Lz(e);let n=Uint8Array.from(Jl.encode(t.code));return e.length>1&&null!=e[1]&&(n=Zl([n,e[1]])),n}))))}function Cz(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return Jl.decode(t)+Jl.decode.bytes}function Rz(e){const t=[];let n=0;for(;n<e.length;){const r=Jl.decode(e,n),i=Jl.decode.bytes,o=Cz(LF(r),e.slice(n+i));if(0===o){t.push([r]),n+=i;continue}const s=e.slice(n+i,n+i+o);if(n+=o+i,n>e.length)throw Bz("Invalid address Uint8Array: "+Xl(e,"base16"));t.push([r,s])}return t}function xz(e){return function(e){const t=[];return e.map((e=>{const n=Lz(e);return t.push(n.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),Oz(t.join("/"))}(Tz(Rz(e)))}function Pz(e){const t=function(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let r=0;r<n.length;r++){const i=n[r],o=LF(i);if(0!==o.size){if(r++,r>=n.length)throw Bz("invalid address: "+e);if(!0===o.path){t.push([i,Oz(n.slice(r).join("/"))]);break}t.push([i,n[r]])}else t.push([i])}return t}(e=Oz(e));return Iz(t.map((e=>{Array.isArray(e)||(e=[e]);const t=Lz(e);return e.length>1?[t.code,bz(t.code,e[1])]:[t.code]})))}function Dz(e){const t=Nz(e);if(null!=t)throw t;return Uint8Array.from(e)}function Nz(e){try{Rz(e)}catch(t){return t}}function Oz(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function Bz(e){return new Error("Error parsing address: "+e)}function Lz(e){return LF(e[0])}var Mz,Uz,Fz,jz,zz=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},Kz=function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof 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"===r?i.call(e,n):i?i.value=n:t.set(e,n),n};const qz=Symbol.for("nodejs.util.inspect.custom"),Vz=[LF("dns").code,LF("dns4").code,LF("dns6").code,LF("dnsaddr").code],Hz=[LF("p2p").code,LF("ipfs").code],Wz=new Map,Gz=Symbol.for("@multiformats/js-multiaddr/multiaddr");function $z(e){return Boolean(null===e||void 0===e?void 0:e[Gz])}class Yz{constructor(e){if(Mz.set(this,void 0),Uz.set(this,void 0),Fz.set(this,void 0),this[jz]=!0,null==e&&(e=""),e instanceof Uint8Array)this.bytes=Dz(e);else if("string"===typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error('multiaddr "'.concat(e,'" must start with a "/"'));this.bytes=Pz(e)}else{if(!$z(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=Dz(e.bytes)}}toString(){return null==zz(this,Mz,"f")&&Kz(this,Mz,xz(this.bytes),"f"),zz(this,Mz,"f")}toJSON(){return this.toString()}toOptions(){const e=this.protoCodes(),t=this.toString().split("/").slice(1);let n,r;if(t.length>2)Vz.includes(e[0])&&Hz.includes(e[1])?(n=LF("tcp").name,r=443):(n=LF(t[2]).name,r=parseInt(t[3]));else{if(!Vz.includes(e[0]))throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');n=LF("tcp").name,r=443}return{family:41===e[0]||55===e[0]?6:4,host:t[1],transport:n,port:r}}protos(){return this.protoCodes().map((e=>Object.assign({},LF(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){const r=Jl.decode(t,n),i=Jl.decode.bytes;n+=Cz(LF(r),t.slice(n+i))+i,e.push(r)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==zz(this,Uz,"f")&&Kz(this,Uz,Rz(this.bytes),"f"),zz(this,Uz,"f")}stringTuples(){return null==zz(this,Fz,"f")&&Kz(this,Fz,Tz(this.tuples()),"f"),zz(this,Fz,"f")}encapsulate(e){return e=new Yz(e),new Yz(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),r=n.lastIndexOf(t);if(r<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new Yz(n.slice(0,r))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new Yz(Iz(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===OF.ipfs.code)),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]?Xl(mj.decode("z".concat(e)),"base58btc"):Xl(xj.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!0===LF(e[0]).path))[0][1],null==e&&(e=null)}catch{e=null}return e}equals(e){return ll(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const n=Wz.get(t.name);if(null==n)throw Dd(new Error("no available resolver for ".concat(t.name)),"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map((e=>new Yz(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))}[(Mz=new WeakMap,Uz=new WeakMap,Fz=new WeakMap,jz=Gz,qz)](){return this.inspect()}inspect(){return"<Multiaddr "+Xl(this.bytes,"base16")+" - "+xz(this.bytes)+">"}}function Qz(e,t){if(!t)return["Waku node is starting"];if(!e)return["No peer provided"];try{const n=new Yz(e),r=n.getPeerId();return r?(t.dial(n).catch((e=>console.error("Failed to dial ".concat(n),e))),["".concat(r,": ").concat(n.toString()," added to address book, autodial in progress")]):["Peer Id needed to dial"]}catch(n){return["Invalid multiaddr: "+n]}}async function Xz(e,t,n){let r=[];const i=function(e){const t=e.trim().replaceAll(/\s\s+/g," ");return t.split(" ")}(e),o=i.shift();switch(o){case"/help":["/nick <nickname>: set a new nickname","/info: some information about the node","/connect <Multiaddr>: connect to the given peer","/help: Display this help"].map((e=>r.push(e)));break;case"/nick":(function(e,t){return e?(t(e),["New nick: ".concat(e)]):["No nick provided"]})(i.shift(),n).map((e=>r.push(e)));break;case"/info":(function(e){return e?["PeerId: ".concat(e.libp2p.peerId.toString())]:["Waku node is starting"]})(t).map((e=>r.push(e)));break;case"/connect":Qz(i.shift(),t).map((e=>r.push(e)));break;case"/peers":(await async function(e){if(!e)return["Waku node is starting"];let t=[];const n=await e.libp2p.peerStore.all();return Array.from(n).forEach((e=>{t.push(e.id.toString()+":");let n=" addresses: [";e.addresses.forEach((e=>{let{multiaddr:t}=e;n+=" "+t.toString()+","})),n=n.replace(/,$/,""),n+="]",t.push(n);let r=" protocols: [";r+=e.protocols,r+="]",t.push(r)})),0===t.length&&t.push("Not connected to any peer."),t}(t)).map((e=>r.push(e)));break;case"/connections":(function(e){if(!e)return["Waku node is starting"];let t=[],n=" connections: \n";return e.libp2p.getConnections().forEach((e=>{n+=e.remotePeer.toString()+", ",n+=JSON.stringify(e.stat),n+="; "+JSON.stringify(e.streams),n+="\n"})),t.push(n),0===t.length&&t.push("Not connected to any peer."),t})(t).map((e=>r.push(e)));break;default:r.push("Unknown Command '".concat(o,"'"))}return{command:o,response:r}}var Jz=__webpack_require__(184);function Zz(e){const t=e.messages.map((e=>{var t;return(0,Jz.jsx)(Vs,{authorName:e.nick,date:eK(e),children:(0,Jz.jsx)(Qs,{children:e.payloadAsUtf8})},e.nick+e.payloadAsUtf8+e.timestamp.valueOf()+(null===(t=e.sentTimestamp)||void 0===t?void 0:t.valueOf()))}));return(0,Jz.jsxs)(Bs,{active:!0,containScrollInSubtree:!0,children:[t,(0,Jz.jsx)(tK,{messages:e.messages})]})}function eK(e){return e.timestamp.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!1})}const tK=e=>{const t=(0,P.useRef)();return(0,P.useEffect)((()=>{t.current.scrollIntoView()}),[e.messages]),(0,Jz.jsx)("div",{ref:t})};function nK(e){const{hasLightPushPeers:t}=e,{node:n}=gF(),[r,i]=(0,P.useState)(""),[o,s]=(0,P.useState)(!1),a=async()=>{if(e.sendMessage&&r){try{await e.sendMessage(r)}catch(t){console.error("Failed to send message: ".concat(t))}i("")}};return(0,P.useEffect)((()=>{r.startsWith("/")||t?s(!0):n&&s(!1)}),[n,r,t]),(0,Jz.jsx)(Ca,{onKeyDown:async e=>{!o||"Enter"!==e.key||e.altKey||e.ctrlKey||e.shiftKey||await a()},onChange:e=>{e.preventDefault(),i(e.target.value)},active:o,onButtonClick:a,children:(0,Jz.jsxs)($o,{align:"center",children:[(0,Jz.jsx)(As,{children:(0,Jz.jsx)(La,{})}),(0,Jz.jsx)(Ts,{children:(0,Jz.jsx)(Ra,{})})]})})}var rK=__webpack_require__(7310);const iK=rK.Reader;["uint64","int64","sint64","fixed64","sfixed64"].forEach((e=>{const t=iK.prototype[e];iK.prototype[e]=function(){return BigInt(t.call(this).toString())}}));const oK=rK.Writer;var sK;let aK;["uint64","int64","sint64","fixed64","sfixed64"].forEach((e=>{const t=oK.prototype[e];oK.prototype[e]=function(e){return t.call(this,e.toString())}})),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"}(sK||(sK={})),function(e){let t;e.codec=()=>(null==t&&(t=function(e,t){return function(e,t,n,r){return{name:e,type:t,encode:n,decode:r}}("message",sK.LENGTH_DELIMITED,e,t)}((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&t.fork(),null==e.timestamp)throw new Error('Protocol error: required field "timestamp" was not found in object');if(t.uint32(8),t.uint64(e.timestamp),null==e.nick)throw new Error('Protocol error: required field "nick" was not found in object');if(t.uint32(18),t.string(e.nick),null==e.payload)throw new Error('Protocol error: required field "payload" was not found in object');t.uint32(26),t.bytes(e.payload),!1!==n.lengthDelimited&&t.ldelim()}),((e,t)=>{const n={timestamp:0n,nick:"",payload:new Uint8Array(0)},r=null==t?e.len:e.pos+t;for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.timestamp=e.uint64();break;case 2:n.nick=e.string();break;case 3:n.payload=e.bytes();break;default:e.skipType(7&t)}}if(null==n.timestamp)throw new Error('Protocol error: value for required field "timestamp" was not found in protobuf');if(null==n.nick)throw new Error('Protocol error: value for required field "nick" was not found in protobuf');if(null==n.payload)throw new Error('Protocol error: value for required field "payload" was not found in protobuf');return n}))),t),e.encode=e=>function(e,t){const n=oK.create();return t.encode(e,n,{lengthDelimited:!1}),n.finish()}(e,aK.codec()),e.decode=e=>function(e,t){const n=iK.create(e instanceof Uint8Array?e:e.subarray());return t.decode(n)}(e,aK.codec())}(aK||(aK={}));class cK{constructor(e){this.proto=e}static fromUtf8String(e,t,n){const r=BigInt(Math.floor(e.valueOf()/1e3)),i=Yf(n);return new cK({timestamp:r,nick:t,payload:i})}static decode(e){const t=aK.decode(e);return new cK(t)}encode(){return aK.encode(this.proto)}get timestamp(){return new Date(Number(BigInt(this.proto.timestamp)*BigInt(1e3)))}get nick(){return this.proto.nick}get payloadAsUtf8(){return this.proto.payload?$f(this.proto.payload):""}}var lK=__webpack_require__(8555);class uK{constructor(e,t){this.chatMessage=void 0,this.sentTimestamp=void 0,this.chatMessage=e,this.sentTimestamp=t}static fromWakuMessage(e){if(e.payload)try{const t=cK.decode(e.payload);if(t)return new uK(t,e.timestamp)}catch(t){console.error("Failed to decode chat message",t)}}static fromUtf8String(e,t){const n=new Date;return new uK(cK.fromUtf8String(n,e,t),n)}get nick(){return this.chatMessage.nick}get timestamp(){return this.chatMessage.timestamp}get payloadAsUtf8(){return this.chatMessage.payloadAsUtf8}}const hK=()=>{const[e,t]=(0,P.useState)((()=>{const e=window.localStorage.getItem("nick");return null!==e?e:(0,lK.R)()}));return(0,P.useEffect)((()=>{localStorage.setItem("nick",e)}),[e]),[e,t]},dK=e=>{const{messages:t}=(e=>{const{node:t,decoder:n}=e,[r,i]=P.useState(void 0),[o,s]=P.useState(!1),[a,c]=P.useState([]),l=P.useCallback((e=>{e&&c((t=>[...t,e]))}),[c]);return P.useEffect((()=>{if(!t||!n)return;let e=null;return s(!0),t.filter.subscribe([n],l).then((t=>{s(!1),e=t})).catch((e=>{s(!1),i("Failed to subscribe to filer: ".concat((null===e||void 0===e?void 0:e.message)||"no message"))})),()=>{null===e||void 0===e||e()}}),[t,n,l,i,s]),{error:r,messages:a,isLoading:o}})(e),{messages:n}=(e=>{const{node:t,decoder:n,options:r}=e,[i,o]=P.useState(void 0),[s,a]=P.useState(!1),[c,l]=P.useState([]),u=P.useCallback((e=>{e&&e.length&&l((t=>[...t,...e]))}),[l]);return P.useEffect((()=>{if(!t||!n)return;let e=!1;return a(!0),Promise.resolve().then((async()=>{for await(const i of t.store.queryGenerator([n],r)){if(e)return;const t=(await Promise.all(i)).filter((e=>!!e));u(t)}a(!1)})).catch((e=>{a(!1),o("Failed to query messages from store: ".concat((null===e||void 0===e?void 0:e.message)||"no message"))})),()=>{e=!0}}),[t,n,u,o,a]),{error:i,isLoading:s,messages:c}})(e),[r,i]=(0,P.useState)([]);return[P.useMemo((()=>[...n,...t].map(uK.fromWakuMessage).concat(r).filter((e=>!!e)).filter((e=>""!==e.payloadAsUtf8)).sort(((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()))),[n,t,r]),e=>{e&&e.length&&i((t=>[...t,...e]))}]},fK=e=>{const[t,n]=(0,P.useState)(new Set),[r,i]=(0,P.useState)(new Set);return(0,P.useEffect)((()=>{if(!e)return;const t=async t=>{const{peerId:r}=t.detail;Array.from((await e.libp2p.peerStore.get(r)).tags.keys()).includes("peer-exchange")?i((e=>new Set(e).add(r.toString()))):n((e=>new Set(e).add(r.toString())))};return e.libp2p.addEventListener("peer:identify",t),()=>{e.libp2p.removeEventListener("peer:identify",t)}}),[e]),(0,P.useEffect)((()=>{console.log("Bootstrap Peers:"),console.table(t),console.log("Peer Exchange Peers:"),console.table(r)}),[t,r]),{bootstrapPeers:t,peerExchangePeers:r}},pK=e=>{const{node:t}=e,[n,r]=P.useState({});return P.useEffect((()=>{if(!t)return;const e=async e=>{var n,i,o;const s=await Promise.all([gK(null===t||void 0===t||null===(n=t.store)||void 0===n?void 0:n.peers()),gK(null===t||void 0===t||null===(i=t.filter)||void 0===i?void 0:i.peers()),gK(null===t||void 0===t||null===(o=t.lightPush)||void 0===o?void 0:o.peers())]);r({storePeers:s[0],filterPeers:s[1],lightPushPeers:s[2]})};return e(),t.libp2p.addEventListener("peer:identify",e),()=>{t.libp2p.removeEventListener("peer:identify",e)}}),[t,r]),n};function gK(e){return e?e.catch((e=>{})):Promise.resolve(void 0)}function yK(e){const{node:t}=gF(),{encoder:n}=uF(),{push:r}=fF({node:t,encoder:n}),{bootstrapPeers:i,peerExchangePeers:o}=fK(t),{storePeers:s,filterPeers:a,lightPushPeers:c}=pK({node:t}),l=mK(null===c||void 0===c?void 0:c.length),u=mK(null===a||void 0===a?void 0:a.length),h=mK(null===s||void 0===s?void 0:s.length),d="Peers: ".concat(l," light push, ").concat(u," filter, ").concat(h," store."),f="Bootstrap (DNS Discovery): ".concat(i.size,", Peer exchange: ").concat(o.size,". ");return(0,Jz.jsxs)("div",{className:"chat-container",style:{height:"98vh",display:"flex",flexDirection:"column"},children:[(0,Jz.jsx)(Ea,{leftIcons:[d],rightIcons:[f,"View console for more details."],title:"Waku v2 chat app"}),(0,Jz.jsx)(Zz,{messages:e.messages}),(0,Jz.jsx)(nK,{hasLightPushPeers:!!c,sendMessage:async t=>{if(r&&t)if(t.startsWith("/"))e.commandHandler(t);else{const n=new Date,i=cK.fromUtf8String(n,e.nick,t).encode();await r({payload:i,timestamp:n})}}})]})}function mK(e){return e||0}const vK=new Date;vK.setTime(Date.now()-6048e5);const bK=new Date;function wK(){const{node:e}=gF(),{decoder:t}=uF(),[n,r]=dK({node:e,decoder:t,options:{pageSize:5,pageDirection:qu.FORWARD,timeFilter:{startTime:vK,endTime:bK}}}),[i,o]=hK();return(0,Jz.jsx)("div",{className:"chat-app",style:{height:"100vh",width:"100vw",overflow:"hidden"},children:(0,Jz.jsx)(yK,{nick:i,messages:n,commandHandler:t=>{Xz(t,e,o).then((e=>{let{command:t,response:n}=e;const i=n.map((e=>uK.fromUtf8String(t,e)));r(i)}))}})})}const EK=[zu.Filter,zu.Store,zu.LightPush],_K={libp2p:{peerDiscovery:[oC([nC.TEST],{store:1,filter:2,lightPush:2}),e=>new CF(e)]}};N.render((0,Jz.jsx)(P.StrictMode,{children:(0,Jz.jsx)(ua,{theme:{AuthorName:{css:{fontSize:"1.1em"}},Message:{css:{margin:"0em",padding:"0em",fontSize:"0.83em"}},MessageText:{css:{margin:"0em",padding:"0.1em",paddingLeft:"1em",fontSize:"1.1em"}},MessageGroup:{css:{margin:"0em",padding:"0.2em"}}},children:(0,Jz.jsx)(yF,{options:_K,protocols:EK,children:(0,Jz.jsx)(hF,{contentTopic:"/toy-chat/2/huilong/proto",children:(0,Jz.jsx)(wK,{})})})})}),document.getElementById("root"))})()})();
|
|
//# sourceMappingURL=main.b340864c.js.map |