mirror of
https://github.com/status-im/js-waku-examples.git
synced 2025-02-03 18:53:34 +00:00
3 lines
1.4 MiB
3 lines
1.4 MiB
/*! For license information please see main.6c2ed0a5.js.LICENSE.txt */
|
|
(()=>{var __webpack_modules__={3415:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},3419:(e,t,r)=>{"use strict";e.exports=o;var n=r(3415);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(6405);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},1272:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},6405:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(1272),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},2634:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(6405),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},7517:(e,t,r)=>{"use strict";e.exports=o;var n=r(2634);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(6405);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},2171:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},2552:(e,t,r)=>{"use strict";e.exports=o;var n=r(2171);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(9460);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},3750:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},9460:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(3750),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},310:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(9460),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},2685:(e,t,r)=>{"use strict";e.exports=o;var n=r(310);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(9460);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},5538:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},9462:(e,t,r)=>{"use strict";e.exports=o;var n=r(5538);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(8858);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},9867:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},8858:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(9867),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},9114:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(8858),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},4934:(e,t,r)=>{"use strict";e.exports=o;var n=r(9114);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(8858);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},5124:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},8389:(e,t,r)=>{"use strict";e.exports=o;var n=r(5124);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(8765);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},2465:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},8765:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(2465),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},172:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(8765),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},2710:(e,t,r)=>{"use strict";e.exports=o;var n=r(172);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(8765);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},4309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(2791),o=(s(i),s(r(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),n(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,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FrameContextConsumer=t.FrameContextProvider=t.useFrame=t.FrameContext=void 0;var n,i=r(2791),o=(n=i)&&n.__esModule?n:{default:n};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,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Frame=void 0;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(2791),s=h(o),a=h(r(4164)),c=h(r(2007)),l=r(3401),u=h(r(4309));function h(e){return e&&e.__esModule?e:{default:e}}var d=t.Frame=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=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,r));return n.setRef=function(e){n.nodeRef.current=e;var t=n.props.forwardedRef;"function"===typeof t?t(e):t&&(t.current=e)},n.handleLoad=function(){clearInterval(n.loadCheck),n.state.iframeLoaded||n.setState({iframeLoaded:!0})},n.loadCheck=function(){return setInterval((function(){n.handleLoad()}),500)},n._isMounted=!1,n.nodeRef=s.default.createRef(),n.state={iframeLoaded:!1},n}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,r=this.props.contentDidUpdate,n=e.defaultView||e.parentView,i=s.default.createElement(u.default,{contentDidMount:t,contentDidUpdate:r},s.default.createElement(l.FrameContextProvider,{value:{document:e,window:n}},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=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,delete e.forwardedRef,s.default.createElement("iframe",n({},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,n({},e,{forwardedRef:t}))}))},4014:(e,t,r)=>{"use strict";var n=r(4623);var i=r(3401)},7206:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,o=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,s){r[n]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(a){o&&(o=!1,s(a))}}))}},1:(e,t)=>{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var i,o=null,s=[],a=0,c=0;t<r;){var l=e[t++];switch(c){case 0:s[a++]=n[l>>2],i=(3&l)<<4,c=1;break;case 1:s[a++]=n[i|l>>4],i=(15&l)<<2,c=2;break;case 2:s[a++]=n[i|l>>6],s[a++]=n[63&l],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,o=r,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=i[l]))throw Error(s);switch(a){case 0:n=l,a=1;break;case 1:t[r++]=n<<2|(48&l)>>4,n=l,a=2;break;case 2:t[r++]=(15&n)<<4|(60&l)>>2,n=l,a=3;break;case 3:t[r++]=(3&n)<<6|l,a=0}}if(1===a)throw Error(s);return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},3297:e=>{"use strict";function t(e,r){"string"===typeof e&&(r=e,e=void 0);var n=[];function i(e){if("string"!==typeof e){var r=o();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var s=Object.keys(e),a=new Array(s.length+1),c=new Array(s.length),l=0;l<s.length;)a[l]=s[l],c[l]=e[s[l++]];return a[l]=r,Function.apply(null,a).apply(null,c)}return Function(r)()}for(var u=new Array(arguments.length-1),h=0;h<u.length;)u[h]=arguments[++h];if(h=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=u[h++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),h!==u.length)throw Error("parameter count mismatch");return n.push(e),i}function o(t){return"function "+(t||r||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return i.toString=o,i}e.exports=t,t.verbose=!1},7111:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},7635:(e,t,r)=>{"use strict";e.exports=o;var n=r(7206),i=r(7172)("fs");function o(e,t,r){return"function"===typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&i&&i.readFile?i.readFile(e,(function(n,i){return n&&"undefined"!==typeof XMLHttpRequest?o.xhr(e,t,r):n?r(n):r(null,t.binary?i:i.toString("utf8"))})):o.xhr(e,t,r):n(o,this,e,t)}o.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var i=0;i<n.responseText.length;++i)e.push(255&n.responseText.charCodeAt(i))}return r(null,"undefined"!==typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},802:e=>{"use strict";function t(e){return"undefined"!==typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,s=8388607&n;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,i,o){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}}function s(e,t,r,n,i){var o=e(n,i+t),s=e(n,i+r),a=2*(s>>31)+1,c=s>>>20&2047,l=4294967296*(1048575&s)+o;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},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 r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),i="";r&&(i=t.shift()+"/");for(var o=0;o<t.length;)".."===t[o]?o>0&&".."!==t[o-1]?t.splice(--o,2):r?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return i+t.join("/")};r.resolve=function(e,t,r){return r||(t=i(t)),n(t)?t:(r||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},8236:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(r){if(r<1||r>i)return e(r);s+r>n&&(o=e(n),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},3861:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296===(64512&r)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,o=[],s=0;t<r;)(n=e[t++])<128?o[s++]=n:n>191&&n<224?o[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(n>>10),o[s++]=56320+(1023&n)):o[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,r){for(var n,i,o=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}},6232:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5073);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function l(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function u(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),u(e/4294967296>>>0,t,r),u(e>>>0,t,r+4),t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),h(e>>>0,t,r),h(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=l,t.writeUint32BE=u,t.writeInt32BE=u,t.writeUint32LE=h,t.writeInt32LE=h,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=l(e,t);return 4294967296*l(e,t+4)+r},t.writeUint64BE=d,t.writeInt64BE=d,t.writeUint64LE=f,t.writeInt64LE=f,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o<r+e/8;o++)n+=t[o]*i,i*=256;return n},t.writeUintBE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var o=1,s=e/8+i-1;s>=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s<i+e/8;s++)r[s]=t/o&255,o*=256;return r},t.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},t.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},t.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},t.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},t.writeFloat32BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t},t.writeFloat32LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t},t.writeFloat64BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t},t.writeFloat64LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t}},8284:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6232),i=r(9116),o=20;function s(e,t,r){for(var i=1634760805,s=857760878,a=2036477234,c=1797285236,l=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],h=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],f=r[19]<<24|r[18]<<16|r[17]<<8|r[16],p=r[23]<<24|r[22]<<16|r[21]<<8|r[20],g=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],m=t[3]<<24|t[2]<<16|t[1]<<8|t[0],v=t[7]<<24|t[6]<<16|t[5]<<8|t[4],b=t[11]<<24|t[10]<<16|t[9]<<8|t[8],w=t[15]<<24|t[14]<<16|t[13]<<8|t[12],E=i,_=s,S=a,A=c,T=l,C=u,k=h,I=d,R=f,P=p,N=g,D=y,x=m,L=v,O=b,B=w,M=0;M<o;M+=2)T=(T^=R=R+(x=(x^=E=E+T|0)>>>16|x<<16)|0)>>>20|T<<12,C=(C^=P=P+(L=(L^=_=_+C|0)>>>16|L<<16)|0)>>>20|C<<12,k=(k^=N=N+(O=(O^=S=S+k|0)>>>16|O<<16)|0)>>>20|k<<12,I=(I^=D=D+(B=(B^=A=A+I|0)>>>16|B<<16)|0)>>>20|I<<12,k=(k^=N=N+(O=(O^=S=S+k|0)>>>24|O<<8)|0)>>>25|k<<7,I=(I^=D=D+(B=(B^=A=A+I|0)>>>24|B<<8)|0)>>>25|I<<7,C=(C^=P=P+(L=(L^=_=_+C|0)>>>24|L<<8)|0)>>>25|C<<7,T=(T^=R=R+(x=(x^=E=E+T|0)>>>24|x<<8)|0)>>>25|T<<7,C=(C^=N=N+(B=(B^=E=E+C|0)>>>16|B<<16)|0)>>>20|C<<12,k=(k^=D=D+(x=(x^=_=_+k|0)>>>16|x<<16)|0)>>>20|k<<12,I=(I^=R=R+(L=(L^=S=S+I|0)>>>16|L<<16)|0)>>>20|I<<12,T=(T^=P=P+(O=(O^=A=A+T|0)>>>16|O<<16)|0)>>>20|T<<12,I=(I^=R=R+(L=(L^=S=S+I|0)>>>24|L<<8)|0)>>>25|I<<7,T=(T^=P=P+(O=(O^=A=A+T|0)>>>24|O<<8)|0)>>>25|T<<7,k=(k^=D=D+(x=(x^=_=_+k|0)>>>24|x<<8)|0)>>>25|k<<7,C=(C^=N=N+(B=(B^=E=E+C|0)>>>24|B<<8)|0)>>>25|C<<7;n.writeUint32LE(E+i|0,e,0),n.writeUint32LE(_+s|0,e,4),n.writeUint32LE(S+a|0,e,8),n.writeUint32LE(A+c|0,e,12),n.writeUint32LE(T+l|0,e,16),n.writeUint32LE(C+u|0,e,20),n.writeUint32LE(k+h|0,e,24),n.writeUint32LE(I+d|0,e,28),n.writeUint32LE(R+f|0,e,32),n.writeUint32LE(P+p|0,e,36),n.writeUint32LE(N+g|0,e,40),n.writeUint32LE(D+y|0,e,44),n.writeUint32LE(x+m|0,e,48),n.writeUint32LE(L+v|0,e,52),n.writeUint32LE(O+b|0,e,56),n.writeUint32LE(B+w|0,e,60)}function a(e,t,r,n,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var a,l;if(0===o){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=(a=new Uint8Array(16)).length-t.length,a.set(t,l)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");a=t,l=o}for(var u=new Uint8Array(64),h=0;h<r.length;h+=64){s(u,a,e);for(var d=h;d<h+64&&d<r.length;d++)n[d]=r[d]^u[d-h];c(a,0,l)}return i.wipe(u),0===o&&i.wipe(a),n}function c(e,t,r){for(var n=1;r--;)n=n+(255&e[t])|0,e[t]=255&n,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=a,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),a(e,t,r,r,n)}},3642:(e,t,r)=>{"use strict";var n=r(8284),i=r(5629),o=r(9116),s=r(6232),a=r(8770);t.Cv=32,t.WH=12,t.pg=16;var c=new Uint8Array(16),l=function(){function e(e){if(this.nonceLength=t.WH,this.tagLength=t.pg,e.length!==t.Cv)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);n.stream(this._key,s,a,4);var c,l=t.length+this.tagLength;if(i){if(i.length!==l)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(l);return n.streamXOR(this._key,s,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),o.wipe(s),c},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var c=new Uint8Array(32);n.stream(this._key,s,c,4);var l=new Uint8Array(this.tagLength);if(this._authenticate(l,c,t.subarray(0,t.length-this.tagLength),r),!a.equal(l,t.subarray(t.length-this.tagLength,t.length)))return null;var u,h=t.length-this.tagLength;if(i){if(i.length!==h)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(h);return n.streamXOR(this._key,s,t.subarray(0,t.length-this.tagLength),u,4),o.wipe(s),u},e.prototype.clean=function(){return o.wipe(this._key),this},e.prototype._authenticate=function(e,t,r,n){var a=new i.Poly1305(t);n&&(a.update(n),n.length%16>0&&a.update(c.subarray(n.length%16))),a.update(r),r.length%16>0&&a.update(c.subarray(r.length%16));var l=new Uint8Array(8);n&&s.writeUint64LE(n.length,l),a.update(l),s.writeUint64LE(r.length,l),a.update(l);for(var u=a.digest(),h=0;h<u.length;h++)e[h]=u[h];a.clean(),o.wipe(u),o.wipe(l)},e}();t.OK=l},8770:(e,t)=>{"use strict";function r(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 1&r-1>>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,r){return~(e-1)&t|e-1&r},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=r,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==r(e,t)}},1412:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},2497:(e,t,r)=>{"use strict";var n=r(5499),i=r(9116),o=function(){function e(e,t,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r<t.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[r]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),i.wipe(this._buffer),i.wipe(this._counter),this._bufpos=0},e}();t.t=o},5499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1412),i=r(8770),o=r(9116),s=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var i=0;i<r.length;i++)r[i]^=54;this._inner.update(r);for(i=0;i<r.length;i++)r[i]^=106;this._outer.update(r),n.isSerializableHash(this._inner)&&n.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),o.wipe(r)}return e.prototype.reset=function(){if(!n.isSerializableHash(this._inner)||!n.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){n.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),n.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!n.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!n.isSerializableHash(this._inner)||!n.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!n.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();t.HMAC=s,t.hmac=function(e,t,r){var n=new s(e,t);n.update(r);var i=n.digest();return n.clean(),i},t.equal=i.equal},5073:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<<t|e>>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},5629:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(8770),i=r(9116);t.DIGEST_LENGTH=16;var o=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=8191&r;var n=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var l=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|l<<8),this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],c=this._h[4],l=this._h[5],u=this._h[6],h=this._h[7],d=this._h[8],f=this._h[9],p=this._r[0],g=this._r[1],y=this._r[2],m=this._r[3],v=this._r[4],b=this._r[5],w=this._r[6],E=this._r[7],_=this._r[8],S=this._r[9];r>=16;){var A=e[t+0]|e[t+1]<<8;i+=8191&A;var T=e[t+2]|e[t+3]<<8;o+=8191&(A>>>13|T<<3);var C=e[t+4]|e[t+5]<<8;s+=8191&(T>>>10|C<<6);var k=e[t+6]|e[t+7]<<8;a+=8191&(C>>>7|k<<9);var I=e[t+8]|e[t+9]<<8;c+=8191&(k>>>4|I<<12),l+=I>>>1&8191;var R=e[t+10]|e[t+11]<<8;u+=8191&(I>>>14|R<<2);var P=e[t+12]|e[t+13]<<8;h+=8191&(R>>>11|P<<5);var N=e[t+14]|e[t+15]<<8,D=0,x=D;x+=i*p,x+=o*(5*S),x+=s*(5*_),x+=a*(5*E),D=(x+=c*(5*w))>>>13,x&=8191,x+=l*(5*b),x+=u*(5*v),x+=h*(5*m),x+=(d+=8191&(P>>>8|N<<8))*(5*y);var L=D+=(x+=(f+=N>>>5|n)*(5*g))>>>13;L+=i*g,L+=o*p,L+=s*(5*S),L+=a*(5*_),D=(L+=c*(5*E))>>>13,L&=8191,L+=l*(5*w),L+=u*(5*b),L+=h*(5*v),L+=d*(5*m),D+=(L+=f*(5*y))>>>13,L&=8191;var O=D;O+=i*y,O+=o*g,O+=s*p,O+=a*(5*S),D=(O+=c*(5*_))>>>13,O&=8191,O+=l*(5*E),O+=u*(5*w),O+=h*(5*b),O+=d*(5*v);var B=D+=(O+=f*(5*m))>>>13;B+=i*m,B+=o*y,B+=s*g,B+=a*p,D=(B+=c*(5*S))>>>13,B&=8191,B+=l*(5*_),B+=u*(5*E),B+=h*(5*w),B+=d*(5*b);var M=D+=(B+=f*(5*v))>>>13;M+=i*v,M+=o*m,M+=s*y,M+=a*g,D=(M+=c*p)>>>13,M&=8191,M+=l*(5*S),M+=u*(5*_),M+=h*(5*E),M+=d*(5*w);var U=D+=(M+=f*(5*b))>>>13;U+=i*b,U+=o*v,U+=s*m,U+=a*y,D=(U+=c*g)>>>13,U&=8191,U+=l*p,U+=u*(5*S),U+=h*(5*_),U+=d*(5*E);var F=D+=(U+=f*(5*w))>>>13;F+=i*w,F+=o*b,F+=s*v,F+=a*m,D=(F+=c*y)>>>13,F&=8191,F+=l*g,F+=u*p,F+=h*(5*S),F+=d*(5*_);var j=D+=(F+=f*(5*E))>>>13;j+=i*E,j+=o*w,j+=s*b,j+=a*v,D=(j+=c*m)>>>13,j&=8191,j+=l*y,j+=u*g,j+=h*p,j+=d*(5*S);var z=D+=(j+=f*(5*_))>>>13;z+=i*_,z+=o*E,z+=s*w,z+=a*b,D=(z+=c*v)>>>13,z&=8191,z+=l*m,z+=u*y,z+=h*g,z+=d*p;var V=D+=(z+=f*(5*S))>>>13;V+=i*S,V+=o*_,V+=s*E,V+=a*w,D=(V+=c*b)>>>13,V&=8191,V+=l*v,V+=u*m,V+=h*y,V+=d*g,i=x=8191&(D=(D=((D+=(V+=f*p)>>>13)<<2)+D|0)+(x&=8191)|0),o=L+=D>>>=13,s=O&=8191,a=B&=8191,c=M&=8191,l=U&=8191,u=F&=8191,h=j&=8191,d=z&=8191,f=V&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=c,this._h[5]=l,this._h[6]=u,this._h[7]=h,this._h[8]=d,this._h[9]=f},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=r,r=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,s[0]=this._h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this._h[o]=this._h[o]&n|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i<t;i++)this._buffer[this._leftover+i]=e[r+i];if(n-=t,r+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i<n;i++)this._buffer[this._leftover+i]=e[r+i];this._leftover+=n}return this},e.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},e.prototype.clean=function(){return i.wipe(this._buffer),i.wipe(this._r),i.wipe(this._h),i.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},e}();t.Poly1305=o,t.oneTimeAuth=function(e,t){var r=new o(e);r.update(t);var n=r.digest();return r.clean(),n},t.equal=function(e,r){return e.length===t.DIGEST_LENGTH&&r.length===t.DIGEST_LENGTH&&n.equal(e,r)}},6271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const n=r(933),i=r(6232),o=r(9116);function s(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.defaultRandomSource).randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(){const e=s(4,arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.defaultRandomSource),r=(0,i.readUint32LE)(e);return(0,o.wipe)(e),r};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;if(r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");let i="";const c=r.length,l=256-256%c;for(;e>0;){const t=s(Math.ceil(256*e/l),n);for(let n=0;n<t.length&&e>0;n++){const o=t[n];o<l&&(i+=r.charAt(o%c),e--)}(0,o.wipe)(t)}return i}t.randomString=c,t.randomStringForEntropy=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.defaultRandomSource;return c(Math.ceil(e/(Math.log(r.length)/Math.LN2)),r,n)}},8136:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserRandomSource=void 0;t.BrowserRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e="undefined"!==typeof self?self.crypto||self.msCrypto:null;e&&void 0!==e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let r=0;r<t.length;r+=65536)this._crypto.getRandomValues(t.subarray(r,r+Math.min(t.length-r,65536)));return t}}},8188:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeRandomSource=void 0;const n=r(9116);t.NodeRandomSource=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;{const e=r(5883);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const r=new Uint8Array(e);for(let n=0;n<r.length;n++)r[n]=t[n];return(0,n.wipe)(t),r}}},933:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SystemRandomSource=void 0;const n=r(8136),i=r(8188);t.SystemRandomSource=class{constructor(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}},4888:(e,t,r)=>{"use strict";var n=r(6232),i=r(9116);t.k=32,t.cn=64;var o=function(){function e(){this.digestLength=t.k,this.blockSize=t.cn,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c<s-8;c++)this._buffer[c]=0;n.writeUint32BE(i,this._buffer,s-8),n.writeUint32BE(o,this._buffer,s-4),a(this._temp,this._state,this._buffer,0,s),this._finished=!0}for(c=0;c<this.digestLength/4;c++)n.writeUint32BE(this._state[c],e,4*c);return this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.mE=o;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,r,i,o){for(;o>=64;){for(var a=t[0],c=t[1],l=t[2],u=t[3],h=t[4],d=t[5],f=t[6],p=t[7],g=0;g<16;g++){var y=i+4*g;e[g]=n.readUint32BE(r,y)}for(g=16;g<64;g++){var m=e[g-2],v=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,b=((m=e[g-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;e[g]=(v+e[g-7]|0)+(b+e[g-16]|0)}for(g=0;g<64;g++){v=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&d^~h&f)|0)+(p+(s[g]+e[g]|0)|0)|0,b=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&l^c&l)|0;p=f,f=d,d=h,h=u+v|0,u=l,l=c,c=a,a=v+b|0}t[0]+=a,t[1]+=c,t[2]+=l,t[3]+=u,t[4]+=h,t[5]+=d,t[6]+=f,t[7]+=p,i+=64,o-=64}return i}t.vp=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e}},2029:(e,t,r)=>{"use strict";t.gi=t.Au=t._w=t.KS=t.kz=void 0;const n=r(6271),i=r(9116);function o(e){const t=new Float64Array(16);if(e)for(let r=0;r<e.length;r++)t[r]=e[r];return t}t.kz=32,t.KS=32;const s=new Uint8Array(32);s[0]=9;const a=o([56129,1]);function c(e){let t=1;for(let r=0;r<16;r++){let n=e[r]+t+65535;t=Math.floor(n/65536),e[r]=n-65536*t}e[0]+=t-1+37*(t-1)}function l(e,t,r){const n=~(r-1);for(let i=0;i<16;i++){const r=n&(e[i]^t[i]);e[i]^=r,t[i]^=r}}function u(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]+r[n]}function h(e,t,r){for(let n=0;n<16;n++)e[n]=t[n]-r[n]}function d(e,t,r){let n,i,o=0,s=0,a=0,c=0,l=0,u=0,h=0,d=0,f=0,p=0,g=0,y=0,m=0,v=0,b=0,w=0,E=0,_=0,S=0,A=0,T=0,C=0,k=0,I=0,R=0,P=0,N=0,D=0,x=0,L=0,O=0,B=r[0],M=r[1],U=r[2],F=r[3],j=r[4],z=r[5],V=r[6],K=r[7],q=r[8],H=r[9],G=r[10],W=r[11],Q=r[12],Y=r[13],$=r[14],X=r[15];n=t[0],o+=n*B,s+=n*M,a+=n*U,c+=n*F,l+=n*j,u+=n*z,h+=n*V,d+=n*K,f+=n*q,p+=n*H,g+=n*G,y+=n*W,m+=n*Q,v+=n*Y,b+=n*$,w+=n*X,n=t[1],s+=n*B,a+=n*M,c+=n*U,l+=n*F,u+=n*j,h+=n*z,d+=n*V,f+=n*K,p+=n*q,g+=n*H,y+=n*G,m+=n*W,v+=n*Q,b+=n*Y,w+=n*$,E+=n*X,n=t[2],a+=n*B,c+=n*M,l+=n*U,u+=n*F,h+=n*j,d+=n*z,f+=n*V,p+=n*K,g+=n*q,y+=n*H,m+=n*G,v+=n*W,b+=n*Q,w+=n*Y,E+=n*$,_+=n*X,n=t[3],c+=n*B,l+=n*M,u+=n*U,h+=n*F,d+=n*j,f+=n*z,p+=n*V,g+=n*K,y+=n*q,m+=n*H,v+=n*G,b+=n*W,w+=n*Q,E+=n*Y,_+=n*$,S+=n*X,n=t[4],l+=n*B,u+=n*M,h+=n*U,d+=n*F,f+=n*j,p+=n*z,g+=n*V,y+=n*K,m+=n*q,v+=n*H,b+=n*G,w+=n*W,E+=n*Q,_+=n*Y,S+=n*$,A+=n*X,n=t[5],u+=n*B,h+=n*M,d+=n*U,f+=n*F,p+=n*j,g+=n*z,y+=n*V,m+=n*K,v+=n*q,b+=n*H,w+=n*G,E+=n*W,_+=n*Q,S+=n*Y,A+=n*$,T+=n*X,n=t[6],h+=n*B,d+=n*M,f+=n*U,p+=n*F,g+=n*j,y+=n*z,m+=n*V,v+=n*K,b+=n*q,w+=n*H,E+=n*G,_+=n*W,S+=n*Q,A+=n*Y,T+=n*$,C+=n*X,n=t[7],d+=n*B,f+=n*M,p+=n*U,g+=n*F,y+=n*j,m+=n*z,v+=n*V,b+=n*K,w+=n*q,E+=n*H,_+=n*G,S+=n*W,A+=n*Q,T+=n*Y,C+=n*$,k+=n*X,n=t[8],f+=n*B,p+=n*M,g+=n*U,y+=n*F,m+=n*j,v+=n*z,b+=n*V,w+=n*K,E+=n*q,_+=n*H,S+=n*G,A+=n*W,T+=n*Q,C+=n*Y,k+=n*$,I+=n*X,n=t[9],p+=n*B,g+=n*M,y+=n*U,m+=n*F,v+=n*j,b+=n*z,w+=n*V,E+=n*K,_+=n*q,S+=n*H,A+=n*G,T+=n*W,C+=n*Q,k+=n*Y,I+=n*$,R+=n*X,n=t[10],g+=n*B,y+=n*M,m+=n*U,v+=n*F,b+=n*j,w+=n*z,E+=n*V,_+=n*K,S+=n*q,A+=n*H,T+=n*G,C+=n*W,k+=n*Q,I+=n*Y,R+=n*$,P+=n*X,n=t[11],y+=n*B,m+=n*M,v+=n*U,b+=n*F,w+=n*j,E+=n*z,_+=n*V,S+=n*K,A+=n*q,T+=n*H,C+=n*G,k+=n*W,I+=n*Q,R+=n*Y,P+=n*$,N+=n*X,n=t[12],m+=n*B,v+=n*M,b+=n*U,w+=n*F,E+=n*j,_+=n*z,S+=n*V,A+=n*K,T+=n*q,C+=n*H,k+=n*G,I+=n*W,R+=n*Q,P+=n*Y,N+=n*$,D+=n*X,n=t[13],v+=n*B,b+=n*M,w+=n*U,E+=n*F,_+=n*j,S+=n*z,A+=n*V,T+=n*K,C+=n*q,k+=n*H,I+=n*G,R+=n*W,P+=n*Q,N+=n*Y,D+=n*$,x+=n*X,n=t[14],b+=n*B,w+=n*M,E+=n*U,_+=n*F,S+=n*j,A+=n*z,T+=n*V,C+=n*K,k+=n*q,I+=n*H,R+=n*G,P+=n*W,N+=n*Q,D+=n*Y,x+=n*$,L+=n*X,n=t[15],w+=n*B,E+=n*M,_+=n*U,S+=n*F,A+=n*j,T+=n*z,C+=n*V,k+=n*K,I+=n*q,R+=n*H,P+=n*G,N+=n*W,D+=n*Q,x+=n*Y,L+=n*$,O+=n*X,o+=38*E,s+=38*_,a+=38*S,c+=38*A,l+=38*T,u+=38*C,h+=38*k,d+=38*I,f+=38*R,p+=38*P,g+=38*N,y+=38*D,m+=38*x,v+=38*L,b+=38*O,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=w+i+65535,i=Math.floor(n/65536),w=n-65536*i,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-65536*i,n=s+i+65535,i=Math.floor(n/65536),s=n-65536*i,n=a+i+65535,i=Math.floor(n/65536),a=n-65536*i,n=c+i+65535,i=Math.floor(n/65536),c=n-65536*i,n=l+i+65535,i=Math.floor(n/65536),l=n-65536*i,n=u+i+65535,i=Math.floor(n/65536),u=n-65536*i,n=h+i+65535,i=Math.floor(n/65536),h=n-65536*i,n=d+i+65535,i=Math.floor(n/65536),d=n-65536*i,n=f+i+65535,i=Math.floor(n/65536),f=n-65536*i,n=p+i+65535,i=Math.floor(n/65536),p=n-65536*i,n=g+i+65535,i=Math.floor(n/65536),g=n-65536*i,n=y+i+65535,i=Math.floor(n/65536),y=n-65536*i,n=m+i+65535,i=Math.floor(n/65536),m=n-65536*i,n=v+i+65535,i=Math.floor(n/65536),v=n-65536*i,n=b+i+65535,i=Math.floor(n/65536),b=n-65536*i,n=w+i+65535,i=Math.floor(n/65536),w=n-65536*i,o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=l,e[5]=u,e[6]=h,e[7]=d,e[8]=f,e[9]=p,e[10]=g,e[11]=y,e[12]=m,e[13]=v,e[14]=b,e[15]=w}function f(e,t){d(e,t,t)}function p(e,t){const r=new Uint8Array(32),n=new Float64Array(80),i=o(),s=o(),p=o(),g=o(),y=o(),m=o();for(let o=0;o<31;o++)r[o]=e[o];r[31]=127&e[31]|64,r[0]&=248,function(e,t){for(let r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(n,t);for(let o=0;o<16;o++)s[o]=n[o];i[0]=g[0]=1;for(let o=254;o>=0;--o){const e=r[o>>>3]>>>(7&o)&1;l(i,s,e),l(p,g,e),u(y,i,p),h(i,i,p),u(p,s,g),h(s,s,g),f(g,y),f(m,i),d(i,p,i),d(p,s,y),u(y,i,p),h(i,i,p),f(s,i),h(p,g,m),d(i,p,a),u(i,i,g),d(p,p,i),d(i,g,m),d(g,s,n),f(s,y),l(i,s,e),l(p,g,e)}for(let o=0;o<16;o++)n[o+16]=i[o],n[o+32]=p[o],n[o+48]=s[o],n[o+64]=g[o];const v=n.subarray(32),b=n.subarray(16);!function(e,t){const r=o();for(let n=0;n<16;n++)r[n]=t[n];for(let n=253;n>=0;n--)f(r,r),2!==n&&4!==n&&d(r,r,t);for(let n=0;n<16;n++)e[n]=r[n]}(v,v),d(b,b,v);const w=new Uint8Array(32);return function(e,t){const r=o(),n=o();for(let i=0;i<16;i++)n[i]=t[i];c(n),c(n),c(n);for(let i=0;i<2;i++){r[0]=n[0]-65517;for(let t=1;t<15;t++)r[t]=n[t]-65535-(r[t-1]>>16&1),r[t-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,l(n,r,1-e)}for(let i=0;i<16;i++)e[2*i]=255&n[i],e[2*i+1]=n[i]>>8}(w,b),w}function g(e){return p(e,s)}function y(e){if(e.length!==t.KS)throw new Error("x25519: seed must be ".concat(t.KS," bytes"));const r=new Uint8Array(e);return{publicKey:g(r),secretKey:r}}t._w=y,t.Au=function(e){const t=(0,n.randomBytes)(32,e),r=y(t);return(0,i.wipe)(t),r},t.gi=function(e,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.length!==t.kz)throw new Error("X25519: incorrect secret key length");if(r.length!==t.kz)throw new Error("X25519: incorrect public key length");const i=p(e,r);if(n){let e=0;for(let t=0;t<i.length;t++)e|=i[t];if(0===e)throw new Error("X25519: invalid shared key")}return i}},6276:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},6453:(e,t,r)=>{"use strict";e.exports=o;var n=r(6276);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(5934);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},7060:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},5934:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(7060),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},1928:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(5934),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},651:(e,t,r)=>{"use strict";e.exports=o;var n=r(1928);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(5934);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},6049:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(1595),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},u=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},227:(e,t,r)=>{"use strict";e.exports=o;var n=r(6049);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(1595);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},7031:(e,t,r)=>{"use strict";e.exports=i;var n=r(1595);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},1595:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(7031),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},2322:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(1595),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},9162:(e,t,r)=>{"use strict";e.exports=o;var n=r(2322);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(1595);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},6622:e=>{function t(e){const t=new globalThis.AbortController;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const n of e)if(n&&n.addEventListener){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}e.exports=t,e.exports.anySignal=t},2951:e=>{e.exports=e=>t=>(r,n)=>{0===r&&t(0,((t,r)=>{n(t,1===t?e(r):r)}))}},2042:e=>{e.exports=function(){let e=[];return(t,r)=>{if(0===t){const t=r;e.push(t),t(0,(r=>{if(2===r){const r=e.indexOf(t);r>-1&&e.splice(r,1)}}))}else{const n=e.slice(0);for(let i,o=0,s=n.length;o<s;o++)i=n[o],e.indexOf(i)>-1&&i(t,r)}}}},8392:(e,t,r)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(r){}!e&&"undefined"!==typeof process&&"env"in process&&(e={NODE_ENV:"production",PUBLIC_URL:"/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=r(8472)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},8472:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(!a.enabled)return;const o=a,s=Number(new Date),c=s-(r||s);o.diff=c,o.prev=r,o.curr=s,r=s,n[0]=t.coerce(n[0]),"string"!==typeof n[0]&&n.unshift("%O");let l=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,((e,r)=>{if("%%"===e)return"%";l++;const i=t.formatters[r];if("function"===typeof i){const t=n[l];e=i.call(o,t),n.splice(l,1),l--}return e})),t.formatArgs.call(o,n);(o.log||t.log).apply(o,n)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"===typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+("undefined"===typeof r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"===typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(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((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},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 r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},t.prototype.get=function(e){return this.peekAt(e)},t.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},t.prototype.peekFront=function(){return this.peek()},t.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(t.prototype,"length",{get:function(){return this.size()}}),t.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.unshift=function(e){if(void 0===e)return this.size();var t=this._list.length;return this._head=this._head-1+t&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},t.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var r=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),r}},t.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),n=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var i,o=this._list[t];if(e<r/2){for(i=e;i>0;i--)this._list[t]=this._list[t=t-1+n&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--)this._list[t]=this._list[t=t+1+n&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+n&this._capacityMask}return o}}},t.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var o=this.size(),s=this._list.length;if(!(n>=o||n<-o||t<1)){if(n<0&&(n+=o),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=o)return r=this.toArray(),this.clear(),r;var a;for(n+t>o&&(t=o-n),r=new Array(t),a=0;a<t;a++)r[a]=this._list[this._head+n+a&this._capacityMask];if(n=this._head+n&this._capacityMask,e+t===o){for(this._tail=this._tail-t+s&this._capacityMask,a=t;a>0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+s&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(n<o/2){for(this._head=this._head+e+t+s&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[n=n-1+s&this._capacityMask]);for(n=this._head-1+s&this._capacityMask;i>0;)this._list[n=n-1+s&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+s&this._capacityMask,a=o-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+s&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=s>>>2&&this._shrinkArray(),r}}},t.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(arguments.length>2){var i,o,s,a=arguments.length,c=this._list.length,l=2;if(!n||r<n/2){for(o=new Array(r),i=0;i<r;i++)o[i]=this._list[this._head+i&this._capacityMask];for(0===t?(s=[],r>0&&(this._head=this._head+r+c&this._capacityMask)):(s=this.remove(r,t),this._head=this._head+r+c&this._capacityMask);a>l;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(o[i-1])}else{var u=(o=new Array(n-(r+t))).length;for(i=0;i<u;i++)o[i]=this._list[this._head+r+t+i&this._capacityMask];for(0===t?(s=[],r!=n&&(this._tail=this._head+r+c&this._capacityMask)):(s=this.remove(r,t),this._tail=this._tail-u+c&this._capacityMask);l<a;)this.push(arguments[l++]);for(i=0;i<u;i++)this.push(o[i])}return s}return this.remove(r,t)}}},t.prototype.clear=function(){this._head=0,this._tail=0},t.prototype.isEmpty=function(){return this._head===this._tail},t.prototype.toArray=function(){return this._copyArray(!1)},t.prototype._fromArray=function(e){for(var t=0;t<e.length;t++)this.push(e[t])},t.prototype._copyArray=function(e){var t,r=[],n=this._list,i=n.length;if(e||this._head>this._tail){for(t=this._head;t<i;t++)r.push(n[t]);for(t=0;t<this._tail;t++)r.push(n[t])}else for(t=this._head;t<this._tail;t++)r.push(n[t]);return r},t.prototype._growArray=function(){this._head&&(this._list=this._copyArray(!0),this._head=0),this._tail=this._list.length,this._list.length<<=1,this._capacityMask=this._capacityMask<<1|1},t.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},e.exports=t},7963:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"===typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"===typeof r&&(n=r,r=""),r&&(n.code=r);try{return t(e,n)}catch(i){n.message=e.message,n.stack=e.stack;const r=function(){};r.prototype=Object.create(Object.getPrototypeOf(e));return t(new r,n)}}},3634:(e,t,r)=>{"use strict";const n=r(5413);t.zN=n.EventIterator,n.EventIterator},5413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn("EventIterator queue reached ".concat(this.pushQueue.length," items")))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e){let{highWaterMark:t=100,lowWaterMark:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},7143:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,s){if("function"!==typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var c,l,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,o),!0;case 6:return u.fn.call(u.context,t,n,i,o,s),!0}for(l=1,c=new Array(h-1);l<h;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var d,f=u.length;for(l=0;l<f;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),h){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,n);break;case 4:u[l].fn.call(u[l].context,t,n,i);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];u[l].fn.apply(u[l].context,c)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);else{for(var c=0,l=[],u=a.length;c<u;c++)(a[c].fn!==t||i&&!a[c].once||n&&a[c].context!==n)&&l.push(a[c]);l.length?this._events[o]=1===l.length?l[0]:l:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},7465:e=>{"use strict";var t,r="object"===typeof Reflect?Reflect:null,n=r&&"function"===typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"===typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!==e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&g(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,o,s,l;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"===typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"===typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"===typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!==typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!==typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!==typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"===typeof c)n(c,this,t);else{var l=c.length,u=p(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return l(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!==typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"===typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},1167:e=>{e.exports=class{constructor(e){if(!(e>0)||0!==(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},5125:(e,t,r)=>{const n=r(1167);e.exports=class{constructor(e){this.hwm=e||16,this.head=new n(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new n(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},9437:(e,t,r)=>{var n;!function(){"use strict";var t="object"===typeof window?window:{};!t.HI_BASE32_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node&&(t=r.g);var i=!t.HI_BASE32_NO_COMMON_JS&&e.exports,o=r.amdO,s="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),a={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},c=[0,0,0,0,0,0,0,0],l=function(e,t){t.length>10&&(t="..."+t.substr(-10));var r=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw r.position=e,r},u=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,r,n,i,o,s,c,l,u=[],h=0,d=(e=e.replace(/=/g,"")).length,f=0,p=d>>3<<3;f<p;)t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],o=a[e.charAt(f++)],s=a[e.charAt(f++)],c=a[e.charAt(f++)],l=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|c>>>3),u[h++]=255&(c<<5|l);var g=d-p;return 2===g?(t=a[e.charAt(f++)],r=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2)):4===g?(t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4)):5===g?(t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],o=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|o>>>1)):7===g&&(t=a[e.charAt(f++)],r=a[e.charAt(f++)],n=a[e.charAt(f++)],i=a[e.charAt(f++)],o=a[e.charAt(f++)],s=a[e.charAt(f++)],c=a[e.charAt(f++)],u[h++]=255&(t<<3|r>>>2),u[h++]=255&(r<<6|n<<1|i>>>4),u[h++]=255&(i<<4|o>>>1),u[h++]=255&(o<<7|s<<2|c>>>3)),u},h=function(e,t){if(!t)return function(e){for(var t,r,n="",i=e.length,o=0,s=0;o<i;)if((t=e[o++])<=127)n+=String.fromCharCode(t);else{t>191&&t<=223?(r=31&t,s=1):t<=239?(r=15&t,s=2):t<=247?(r=7&t,s=3):l(o,n);for(var a=0;a<s;++a)((t=e[o++])<128||t>191)&&l(o,n),r<<=6,r+=63&t;r>=55296&&r<=57343&&l(o,n),r>1114111&&l(o,n),r<=65535?n+=String.fromCharCode(r):(r-=65536,n+=String.fromCharCode(55296+(r>>10)),n+=String.fromCharCode(56320+(1023&r)))}return n}(u(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var r,n,i,o,s,c,h,d,f="",p=e.indexOf("=");-1===p&&(p=e.length);for(var g=0,y=p>>3<<3;g<y;)r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],s=a[e.charAt(g++)],c=a[e.charAt(g++)],h=a[e.charAt(g++)],d=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|c<<2|h>>>3))+String.fromCharCode(255&(h<<5|d));var m=p-y;return 2===m?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))):4===m?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))):5===m?(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],s=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===m&&(r=a[e.charAt(g++)],n=a[e.charAt(g++)],i=a[e.charAt(g++)],o=a[e.charAt(g++)],s=a[e.charAt(g++)],c=a[e.charAt(g++)],h=a[e.charAt(g++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|c<<2|h>>>3))),f},d={encode:function(e,t){var r="string"!==typeof e;return r&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),r?function(e){for(var t,r,n,i,o,a="",c=e.length,l=0,u=5*parseInt(c/5);l<u;)t=e[l++],r=e[l++],n=e[l++],i=e[l++],o=e[l++],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[31&(i<<3|o>>>5)]+s[31&o];var h=c-u;return 1===h?(t=e[l],a+=s[t>>>3]+s[t<<2&31]+"======"):2===h?(t=e[l++],r=e[l],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[r<<4&31]+"===="):3===h?(t=e[l++],r=e[l++],n=e[l],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[n<<1&31]+"==="):4===h&&(t=e[l++],r=e[l++],n=e[l++],i=e[l],a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"="),a}(e):t?function(e){for(var t,r,n,i,o,a="",c=e.length,l=0,u=5*parseInt(c/5);l<u;)t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),i=e.charCodeAt(l++),o=e.charCodeAt(l++),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[31&(i<<3|o>>>5)]+s[31&o];var h=c-u;return 1===h?(t=e.charCodeAt(l),a+=s[t>>>3]+s[t<<2&31]+"======"):2===h?(t=e.charCodeAt(l++),r=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[r<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[n<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),i=e.charCodeAt(l),a+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"="),a}(e):function(e){var t,r,n,i,o,a,l,u=!1,h="",d=0,f=0,p=e.length;if(""===e)return h;do{for(c[0]=c[5],c[1]=c[6],c[2]=c[7],l=f;d<p&&l<5;++d)(a=e.charCodeAt(d))<128?c[l++]=a:a<2048?(c[l++]=192|a>>6,c[l++]=128|63&a):a<55296||a>=57344?(c[l++]=224|a>>12,c[l++]=128|a>>6&63,c[l++]=128|63&a):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++d)),c[l++]=240|a>>18,c[l++]=128|a>>12&63,c[l++]=128|a>>6&63,c[l++]=128|63&a);f=l-5,d===p&&++d,d>p&&l<6&&(u=!0),t=c[0],l>4?(r=c[1],n=c[2],i=c[3],o=c[4],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[31&(i<<3|o>>>5)]+s[31&o]):1===l?h+=s[t>>>3]+s[t<<2&31]+"======":2===l?(r=c[1],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[r<<4&31]+"===="):3===l?(r=c[1],n=c[2],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[n<<1&31]+"==="):(r=c[1],n=c[2],i=c[3],h+=s[t>>>3]+s[31&(t<<2|r>>>6)]+s[r>>>1&31]+s[31&(r<<4|n>>>4)]+s[31&(n<<1|i>>>7)]+s[i>>>2&31]+s[i<<3&31]+"=")}while(!u);return h}(e)},decode:h};h.asBytes=u,i?e.exports=d:(t.base32=d,o&&(void 0===(n=function(){return d}.call(d,r,d,e))||(e.exports=n)))}()},2110:(e,t,r)=>{"use strict";var n=r(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 n.isMemo(e)?s:a[e.$$typeof]||i}a[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[n.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,r,n){if("string"!==typeof r){if(p){var i=f(r);i&&i!==p&&e(t,i,n)}var s=u(r);h&&(s=s.concat(h(r)));for(var a=c(t),g=c(r),y=0;y<s.length;++y){var m=s[y];if(!o[m]&&(!n||!n[m])&&(!g||!g[m])&&(!a||!a[m])){var v=d(r,m);try{l(t,m,v)}catch(b){}}}}return t}},7201:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),threeOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),twoOctet:new RegExp("^".concat(r,"\\.").concat(r,"$"),"i"),longValue:new RegExp("^".concat(r,"$"),"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(s,"i"),native:new RegExp("^(::)?(".concat(a,")?([0-9a-f]+)?(::)?(").concat(s,")?$"),"i"),deprecatedTransitional:new RegExp("^(?:::)(".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?$"),"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(e.match(c.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(o=e.indexOf(":",o+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),zoneId:s}}function u(e,t,r,n){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,o=0;for(;n>0;){if(i=r-n,i<0&&(i=0),e[o]>>i!==t[o]>>i)return!1;n-=r,o+=1}return!0}function h(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error("ipaddr: cannot parse ".concat(e," as octal"))}return parseInt(e,10)}function d(e,t){for(;e.length<t;)e="0".concat(e);return e}const f={};f.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,r;for(t=0;t<e.length;t++)if(r=e[t],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,i,o;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],t&&0!==o)return null;8!==o&&(t=!0),e+=o}return 32-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse("::ffff:".concat(this.toString()))},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),f.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(e){return null!==this.parser(e)},f.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(t){return!1}},f.IPv4.isValidFourPartDecimal=function(e){return!(!f.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},f.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(e){let t,r,i;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t<e.length;t++)r=e[t],n.push(h(r));return n}();if(t=e.match(n.longValue)){if(i=h(t[1]),i>4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),r=[];if(i=h(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),r=[];if(i=h(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(h(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},f.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.IPv6=function(){function e(e,t){let r,n;if(16===e.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(e[r]<<8|e[r+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(r=0;r<this.parts.length;r++)if(n=this.parts[r],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let n,i;for(let o=7;o>=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n<r.length;n++)e=r[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(d(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],r=e[1];return new f.IPv4([t>>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let r,n=0,i=-1;for(;r=e.exec(t);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?t:"".concat(t.substring(0,n),"::").concat(t.substring(n+i))},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),f.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(t,")"))}},f.IPv6.isIPv6=function(e){return null!==this.parser(e)},f.IPv6.isValid=function(e){if("string"===typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(t){return!1}},f.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(s,")"))}},f.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},f.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(e){let t,r,n,i,o,s;if(n=e.match(c.deprecatedTransitional))return this.parser("::ffff:".concat(n[1]));if(c.native.test(e))return l(e,8);if((n=e.match(c.transitional))&&(s=n[6]||"",t=l(n[1].slice(0,-1)+s,6),t.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<o.length;r++)if(i=o[r],!(0<=i&&i<=255))return null;return t.parts.push(o[0]<<8|o[1]),t.parts.push(o[2]<<8|o[3]),{parts:t.parts,zoneId:t.zoneId}}return null},f.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r<n;)t[r]=255,r++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.fromByteArray=function(e){const t=e.length;if(4===t)return new f.IPv4(e);if(16===t)return new f.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},f.isValid=function(e){return f.IPv6.isValid(e)||f.IPv4.isValid(e)},f.parse=function(e){if(f.IPv6.isValid(e))return f.IPv6.parse(e);if(f.IPv4.isValid(e))return f.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},f.parseCIDR=function(e){try{return f.IPv6.parseCIDR(e)}catch(t){try{return f.IPv4.parseCIDR(e)}catch(r){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},f.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},f.subnetMatch=function(e,t,r){let n,i,o,s;for(i in void 0!==r&&null!==r||(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,i))for(o=t[i],!o[0]||o[0]instanceof Array||(o=[o]),n=0;n<o.length;n++)if(s=o[n],e.kind()===s[0].kind()&&e.match.apply(e,s))return i;return r},e.exports?e.exports=f:t.ipaddr=f}(this)},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,r)=>{"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:o,defaultBase:s}=r(5732),a=r(9640);e.exports={URL:n,URLSearchParams:o,format:i,relative:a,defaultBase:s}},9640:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i}=r(5732);e.exports=function(e){let t,r=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=r.protocol?r.protocol.replace(":",""):"http";a=(o[a]||s||a)+":";try{t=new n(e)}catch(l){t={}}const c=Object.assign({},r,{protocol:a||t.protocol,host:r.host||t.host});return new n(e,i(c)).toString()}},5732:e=>{"use strict";const t="undefined"!==typeof navigator&&"ReactNative"===navigator.product;const r=self.URL,n=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]:n;this.super=new r(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 r.createObjectURL(e)}static revokeObjectURL(e){r.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:n,format:function(e){if("string"===typeof e){return new r(e).toString()}if(!(e instanceof r)){const t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=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||r).concat(o||s+n).concat(u).concat(c)}}}},7898:(e,t,r)=>{var n;!function(){"use strict";var i="input is invalid type",o="object"===typeof window,s=o?window:{};s.JS_SHA3_NO_WINDOW&&(o=!1);var a=!o&&"object"===typeof self;!s.JS_SHA3_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node?s=r.g:a&&(s=self);var c=!s.JS_SHA3_NO_COMMON_JS&&e.exports,l=r.amdO,u=!s.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,h="0123456789abcdef".split(""),d=[4,1024,262144,67108864],f=[0,8,16,24],p=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],y=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!s.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!u||!s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var b=function(e,t,r){return function(n){return new L(e,t,e).update(n)[r]()}},w=function(e,t,r){return function(n,i){return new L(e,t,i).update(n)[r]()}},E=function(e,t,r){return function(t,n,i,o){return C["cshake"+e].update(t,n,i,o)[r]()}},_=function(e,t,r){return function(t,n,i,o){return C["kmac"+e].update(t,n,i,o)[r]()}},S=function(e,t,r,n){for(var i=0;i<m.length;++i){var o=m[i];e[o]=t(r,n,o)}return e},A=function(e,t){var r=b(e,t,"hex");return r.create=function(){return new L(e,t,e)},r.update=function(e){return r.create().update(e)},S(r,b,e,t)},T=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:A},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:A},{name:"shake",padding:[31,7936,2031616,520093696],bits:y,createMethod:function(e,t){var r=w(e,t,"hex");return r.create=function(r){return new L(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},S(r,w,e,t)}},{name:"cshake",padding:d,bits:y,createMethod:function(e,t){var r=v[e],n=E(e,0,"hex");return n.create=function(n,i,o){return i||o?new L(e,t,n).bytepad([i,o],r):C["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},S(n,E,e,t)}},{name:"kmac",padding:d,bits:y,createMethod:function(e,t){var r=v[e],n=_(e,0,"hex");return n.create=function(n,i,o){return new O(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},S(n,_,e,t)}}],C={},k=[],I=0;I<T.length;++I)for(var R=T[I],P=R.bits,N=0;N<P.length;++N){var D=R.name+"_"+P[N];if(k.push(D),C[D]=R.createMethod(P[N],R.padding),"sha3"!==R.name){var x=R.name+P[N];k.push(x),C[x]=C[D]}}function L(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function O(e,t,r){L.call(this,e,t,r)}L.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}for(var n,o,s=this.blocks,a=this.byteCount,c=e.length,l=this.blockCount,h=0,d=this.s;h<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<l+1;++n)s[n]=0;if(t)for(n=this.start;h<c&&n<a;++h)s[n>>2]|=e[h]<<f[3&n++];else for(n=this.start;h<c&&n<a;++h)(o=e.charCodeAt(h))<128?s[n>>2]|=o<<f[3&n++]:o<2048?(s[n>>2]|=(192|o>>6)<<f[3&n++],s[n>>2]|=(128|63&o)<<f[3&n++]):o<55296||o>=57344?(s[n>>2]|=(224|o>>12)<<f[3&n++],s[n>>2]|=(128|o>>6&63)<<f[3&n++],s[n>>2]|=(128|63&o)<<f[3&n++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[n>>2]|=(240|o>>18)<<f[3&n++],s[n>>2]|=(128|o>>12&63)<<f[3&n++],s[n>>2]|=(128|o>>6&63)<<f[3&n++],s[n>>2]|=(128|63&o)<<f[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=s[l],n=0;n<l;++n)d[n]^=s[n];B(d),this.reset=!0}else this.start=n}return this},L.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},L.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}var n=0,o=e.length;if(t)n=o;else for(var s=0;s<e.length;++s){var a=e.charCodeAt(s);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(e),n},L.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,o=[];return o.length=i,this.update(o),this},L.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];B(n)}},L.prototype.toString=L.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<t&&s<n;++o,++s)e=r[o],a+=h[e>>4&15]+h[15&e]+h[e>>12&15]+h[e>>8&15]+h[e>>20&15]+h[e>>16&15]+h[e>>28&15]+h[e>>24&15];s%t===0&&(B(r),o=0)}return i&&(e=r[o],a+=h[e>>4&15]+h[15&e],i>1&&(a+=h[e>>12&15]+h[e>>8&15]),i>2&&(a+=h[e>>20&15]+h[e>>16&15])),a},L.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)c[s]=r[o];s%t===0&&B(r)}return i&&(c[o]=r[o],e=e.slice(0,a)),e},L.prototype.buffer=L.prototype.arrayBuffer,L.prototype.digest=L.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r===0&&B(n)}return o&&(e=a<<2,t=n[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},O.prototype=new L,O.prototype.finalize=function(){return this.encode(this.outputBits,!0),L.prototype.finalize.call(this)};var B=function(e){var t,r,n,i,o,s,a,c,l,u,h,d,f,g,y,m,v,b,w,E,_,S,A,T,C,k,I,R,P,N,D,x,L,O,B,M,U,F,j,z,V,K,q,H,G,W,Q,Y,$,X,J,Z,ee,te,re,ne,ie,oe,se,ae,ce,le,ue;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|l>>>31),r=o^(l<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(u<<1|h>>>31),r=a^(h<<1|u>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|f>>>31),r=l^(f<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=u^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,g=e[0],y=e[1],W=e[11]<<4|e[10]>>>28,Q=e[10]<<4|e[11]>>>28,R=e[20]<<3|e[21]>>>29,P=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,O=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,$=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,le=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,M=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,J=e[35]<<15|e[34]>>>17,x=e[45]<<29|e[44]>>>3,L=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,C=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,I=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,V=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]=T^~k&R,e[11]=C^~I&P,e[20]=O^~M&F,e[21]=B^~U&j,e[30]=H^~W&Y,e[31]=G^~Q&$,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=m^~b&E,e[3]=v^~w&_,e[12]=k^~R&N,e[13]=I^~P&D,e[22]=M^~F&z,e[23]=U^~j&V,e[32]=W^~Y&X,e[33]=Q^~$&J,e[42]=ne^~oe&ae,e[43]=ie^~se&ce,e[4]=b^~E&S,e[5]=w^~_&A,e[14]=R^~N&x,e[15]=P^~D&L,e[24]=F^~z&K,e[25]=j^~V&q,e[34]=Y^~X&Z,e[35]=$^~J&ee,e[44]=oe^~ae&le,e[45]=se^~ce&ue,e[6]=E^~S&g,e[7]=_^~A&y,e[16]=N^~x&T,e[17]=D^~L&C,e[26]=z^~K&O,e[27]=V^~q&B,e[36]=X^~Z&H,e[37]=J^~ee&G,e[46]=ae^~le&te,e[47]=ce^~ue&re,e[8]=S^~g&m,e[9]=A^~y&v,e[18]=x^~T&k,e[19]=L^~C&I,e[28]=K^~O&M,e[29]=q^~B&U,e[38]=Z^~H&W,e[39]=ee^~G&Q,e[48]=le^~te&ne,e[49]=ue^~re&ie,e[0]^=p[n],e[1]^=p[n+1]};if(c)e.exports=C;else{for(I=0;I<k.length;++I)s[k[I]]=C[k[I]];l&&(void 0===(n=function(){return C}.call(t,r,t,e))||(e.exports=n))}}()},6296:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},2546:(e,t,r)=>{"use strict";e.exports=o;var n=r(6296);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(2751);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},5664:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},2751:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(5664),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},100:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(2751),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},6153:(e,t,r)=>{"use strict";e.exports=o;var n=r(100);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(2751);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},9842:function(e,t,r){"use strict";const n=r(887),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:o}=Object,s=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},l=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)o.call(e,n)&&t.push(n)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return l(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):e}const h=(e,t,r,n)=>(r.forEach((r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,f(e[r],t[r],n)):s(e,r,u(t[r])))})),e),d=(e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r<t.length;r++)i.call(t,r)&&(a.push(String(r)),s(n,o++,t===e?t[r]:u(t[r])));n=h(n,t,l(t).filter((e=>!a.includes(e))),r)})),n};function f(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?d(e,t,r):n(t)&&n(e)?h(e,t,l(t),r):u(t)}e.exports=function(){const e=f(u(c),this!==a&&this||{},c);let t={_:{}};for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];for(const s of i)if(void 0!==s){if(!n(s))throw new TypeError("`"+s+"` is not an Option Object");t=f(t,{_:s},e)}return t._}},8193:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,s=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===l&&isFinite(e))return c.long?function(e){var o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},7922:function(e,t){(function(){var e,r,n,i,o,s,a,c;c=function(e){return[(e&255<<24)>>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,o,s,a;for(t=[],i=o=0;o<=3&&0!==e.length;i=++o){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}s=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(s)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),s=n("a"),o=n("A"),r=function(e){var t,r,a,c,l;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),l=a;a<e.length;){if("0"<=e[a]&&e[a]<=r)c=c*t+(n(e[a])-i)>>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+n(e[a])-s)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-o)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===l)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,n,i;if("string"!==typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"===typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(o){throw o,new Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(o){throw o,new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=c(this.netLong),this.mask=c(this.maskLong),this.hostmask=c(~this.maskLong),this.first=this.bitmask<=30?c(this.netLong+1):this.base,this.last=this.bitmask<=30?c(this.netLong+this.size-2):c(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"===typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(c(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(c(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=c,t.Netmask=e}).call(this)},8605:(e,t,r)=>{var n=r(392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(3397),r(4533),r(3877),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=g({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=g({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return g({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){u||d();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return p(r._w,e,t,!1)},decrypt:function(e,t){return p(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!==typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var s=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=f(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return u||d(),f(e,t)},n.aes._updateBlock=p,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var o,s,a,c,l,u=!1,h=4;function d(){u=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;o=new Array(256),s=new Array(256),c=new Array(4),l=new Array(4);for(t=0;t<4;++t)c[t]=new Array(256),l[t]=new Array(256);var r,n,i,h,d,f,p,g=0,y=0;for(t=0;t<256;++t){h=(h=y^y<<1^y<<2^y<<3^y<<4)>>8^255&h^99,o[g]=h,s[h]=g,f=(d=e[h])<<24^h<<16^h<<8^h^d,p=((r=e[g])^(n=e[r])^(i=e[n]))<<24^(g^i)<<16^(g^n^i)<<8^g^r^i;for(var m=0;m<4;++m)c[m][g]=f,l[m][h]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===g?g=y=1:(g=r^e[e[e[r^i]]],y^=e[e[y]])}}function f(e,t){for(var r,n=e.slice(0),i=1,s=n.length,c=h*(s+6+1),u=s;u<c;++u)r=n[u-1],u%s===0?(r=o[r>>>16&255]<<24^o[r>>>8&255]<<16^o[255&r]<<8^o[r>>>24]^a[i]<<24,i++):s>6&&u%s===4&&(r=o[r>>>24]<<24^o[r>>>16&255]<<16^o[r>>>8&255]<<8^o[255&r]),n[u]=n[u-s]^r;if(t){for(var d,f=l[0],p=l[1],g=l[2],y=l[3],m=n.slice(0),v=(u=0,(c=n.length)-h);u<c;u+=h,v-=h)if(0===u||u===c-h)m[u]=n[v],m[u+1]=n[v+3],m[u+2]=n[v+2],m[u+3]=n[v+1];else for(var b=0;b<h;++b)d=n[v+b],m[u+(3&-b)]=f[o[d>>>24]]^p[o[d>>>16&255]]^g[o[d>>>8&255]]^y[o[255&d]];n=m}return n}function p(e,t,r,n){var i,a,u,h,d,f,p,g,y,m,v,b,w=e.length/4-1;n?(i=l[0],a=l[1],u=l[2],h=l[3],d=s):(i=c[0],a=c[1],u=c[2],h=c[3],d=o),f=t[0]^e[0],p=t[n?3:1]^e[1],g=t[2]^e[2],y=t[n?1:3]^e[3];for(var E=3,_=1;_<w;++_)m=i[f>>>24]^a[p>>>16&255]^u[g>>>8&255]^h[255&y]^e[++E],v=i[p>>>24]^a[g>>>16&255]^u[y>>>8&255]^h[255&f]^e[++E],b=i[g>>>24]^a[y>>>16&255]^u[f>>>8&255]^h[255&p]^e[++E],y=i[y>>>24]^a[f>>>16&255]^u[p>>>8&255]^h[255&g]^e[++E],f=m,p=v,g=b;r[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[g>>>8&255]<<8^d[255&y]^e[++E],r[n?3:1]=d[p>>>24]<<24^d[g>>>16&255]<<16^d[y>>>8&255]<<8^d[255&f]^e[++E],r[2]=d[g>>>24]<<24^d[y>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],r[n?1:3]=d[y>>>24]<<24^d[f>>>16&255]<<16^d[p>>>8&255]<<8^d[255&g]^e[++E]}function g(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},5049:(e,t,r)=>{var n=r(392);r(3877),r(2886);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],c=0;c<o.length;++c)void 0!==o[c]&&a.push(o[c]);o=a}var l={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(o),value:o};return s&&"bitStringContents"in s&&(l.bitStringContents=s.bitStringContents,l.original=i.copy(l)),l},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var o=0;o<e.length;++o)r.push(i.copy(e[o],t));return r}return"string"===typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var o=0;o<e.length;++o)if(!i.equals(e[o],t[o]))return!1;return!0}if(typeof e!==typeof t)return!1;if("string"===typeof e)return e===t;var s=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(s=s&&e.bitStringContents===t.bitStringContents),s},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};var s=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;o(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}};function a(e,t,r,n){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(n.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,r+1,n)),t-=c-e.length()}else for(;p>0;)c=e.length(),d.push(a(e,p,r+1,n)),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&&n.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,r+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(n.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=n.util.createBuffer(e));var r=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=r,o.remaining=e.length(),o}return i},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,o=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:o.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&o.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(a=0;a<e.value.length;++a)o.putInt16(e.value.charCodeAt(a));else e.type===i.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0===(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128===(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var c=o.length(),l="";do{l+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|l.length);for(a=l.length-1;a>=0;--a)t.putByte(l.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,r,i,o,s=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c<s.length;++c){t=!0,r=[],i=parseInt(s[c],10);do{o=127&i,i>>>=7,t||(o|=128),r.push(o),t=!1}while(i>0);for(var l=r.length-1;l>=0;--l)a.putByte(r[l])}return a},i.derToOid=function(e){var t;"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var h=e.length-5,d=e.charAt(h);"+"!==d&&"-"!==d||(l=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),l*=6e4,"+"===d&&(l*=-1),u=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,c),t.setTime(+t+l)):(t.setFullYear(r,n,i),t.setHours(o,s,a,c)),t},i.dateToUtcTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.dateToGeneralizedTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"===typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,o){var s=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;s&&c<t.value.length;++c)s=t.value[c].optional||!1,e.value[a]&&((s=i.validate(e.value[a],t.value[c],r,o))?++a:t.value[c].optional&&(s=!0)),!s&&o&&o.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(s&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else o&&o.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return s};var c=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var o="";r=r||2,(t=t||0)>0&&(o+="\n");for(var s="",a=0;a<t*r;++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,r),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,n.pki&&n.pki.oids&&h in n.pki.oids&&(o+=" ("+n.pki.oids[h]+") ")}if(e.type===i.Type.INTEGER)try{o+=i.derToInteger(e.value)}catch(f){o+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?o+=" (1 unused bit shown)":d>1&&(o+=" ("+d+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)c.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{o+=n.util.decodeUtf8(e.value)}catch(p){if("URI malformed"!==p.message)throw p;o+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:c.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},5754:e=>{var t={};e.exports=t;var r={};t.encode=function(e,t,r){if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!==typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,o=t.length,s=t.charAt(0),a=[0];for(i=0;i<e.length;++i){for(var c=0,l=e[i];c<a.length;++c)l+=a[c]<<8,a[c]=l%o,l=l/o|0;for(;l>0;)a.push(l%o),l=l/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=s;for(i=a.length-1;i>=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var s=0,a=e.at(r);s<o.length;++s)a+=o[s]<<8,o[s]=a%n,a=a/n|0;for(;a>0;)o.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=o.length-1;r>=0;--r)c+=t[o[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},t.decode=function(e,t){if("string"!==typeof e)throw new TypeError('"input" must be a string.');if("string"!==typeof t)throw new TypeError('"alphabet" must be a string.');var n=r[t];if(!n){n=r[t]=[];for(var i=0;i<t.length;++i)n[t.charCodeAt(i)]=i}e=e.replace(/\s/g,"");var o=t.length,s=t.charAt(0),a=[0];for(i=0;i<e.length;i++){var c=n[e.charCodeAt(i)];if(void 0===c)return;for(var l=0,u=c;l<a.length;++l)u+=a[l]*o,a[l]=255&u,u>>=8;for(;u>0;)a.push(255&u),u>>=8}for(var h=0;e[h]===s&&h<e.length-1;++h)a.push(0);return"undefined"!==typeof Buffer?Buffer.from(a.reverse()):new Uint8Array(a.reverse())}},3397:(e,t,r)=>{var n=r(392);r(3877),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"===typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},4533:(e,t,r)=>{var n=r(392);r(3877),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e,t){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i<r.length;++i)e.putByte(r[i])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!n.util.isArray(e)){var o=[],s=t/4;for(i=0;i<s;++i)o.push(e.getInt32());e=o}return e}function s(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o<=0||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var o=[];this.cipher.encrypt(this._j0,o);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^o[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],c=(n-1-s%n)*t;a[s/n|0]=1<<t-1<<c,o[s]=this.generateSubHashTable(this.multiply(a,e),t)}return o},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],c=i[s];i[o+s]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var l=i[o^n];i[o]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return i}},1400:(e,t,r)=>{var n=r(392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(3397),r(4533),r(3877),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return f(r._keys,e,t,!1)},decrypt:function(e,t){return f(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w<y;w++){var E=e.getInt32(),_=e.getInt32();E^=(t=252645135&(E>>>4^_))<<4,E^=t=65535&((_^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(_^=t<<-16)))<<2,E^=t=65535&((_^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(_^=t<<-16)))<<1,E^=t=16711935&((_^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(_^=t<<8)))<<1)<<8|(_^=t)>>>20&240,E=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var S=0;S<v.length;++S){v[S]?(E=E<<2|E>>>26,_=_<<2|_>>>26):(E=E<<1|E>>>27,_=_<<1|_>>>27),_&=-15;var A=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|o[E>>>16&15]|s[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],T=l[_>>>28]|u[_>>>24&15]|h[_>>>20&15]|d[_>>>16&15]|f[_>>>12&15]|p[_>>>8&15]|g[_>>>4&15];t=65535&(T>>>16^A),m[b++]=A^t,m[b++]=T^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],h=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],d=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function f(e,t,r,n){var i,f,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=t[0],y=t[1];g^=(f=252645135&(g>>>4^y))<<4,g^=(f=65535&(g>>>16^(y^=f)))<<16,g^=f=858993459&((y^=f)>>>2^g),g^=f=16711935&((y^=f<<2)>>>8^g),g=(g^=(f=1431655765&(g>>>1^(y^=f<<8)))<<1)<<1|g>>>31,y=(y^=f)<<1|y>>>31;for(var m=0;m<p;m+=3){for(var v=i[m+1],b=i[m+2],w=i[m];w!=v;w+=b){var E=y^e[w],_=(y>>>4|y<<28)^e[w+1];f=g,g=y,y=f^(s[E>>>24&63]|c[E>>>16&63]|u[E>>>8&63]|d[63&E]|o[_>>>24&63]|a[_>>>16&63]|l[_>>>8&63]|h[63&_])}f=g,g=y,y=f}y=y>>>1|y<<31,y^=f=1431655765&((g=g>>>1|g<<31)>>>1^y),y^=(f=16711935&(y>>>8^(g^=f<<1)))<<8,y^=(f=858993459&(y>>>2^(g^=f)))<<2,y^=f=65535&((g^=f)>>>16^y),y^=f=252645135&((g^=f<<16)>>>4^y),g^=f<<4,r[0]=g,r[1]=y}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},392:e=>{e.exports={options:{usePureJavaScript:!1}}},878:(e,t,r)=>{var n=r(392);r(29),r(3877),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"===typeof o){if(!((o=o.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"===typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var c=0;c<a.length;++c)s.putByte(a[c])}var l=s.length();l>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),l=s.length();for(c=0;c<l;++c){a=s.at(c);r.putByte(54^a),i.putByte(92^a)}if(l<t.blockLength)for(a=t.blockLength-l,c=0;c<a;++c)r.putByte(54),i.putByte(92);e=s,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return o.digest=o.getMac,o}},3055:(e,t,r)=>{var n,i=r(392);e.exports=i.jsbn=i.jsbn||{};function o(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=a*c+l*s;i=((c=s*c+((16383&u)<<14)+r.data[n]+i)>>28)+(u>>14)+a*l,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=o,"undefined"===typeof navigator?(o.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=a*c+l*s;i=((c=s*c+((32767&u)<<15)+r.data[n]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(o.prototype.am=a,n=28),o.prototype.DB=n,o.prototype.DM=(1<<n)-1,o.prototype.DV=1<<n;o.prototype.FV=Math.pow(2,52),o.prototype.F1=52-n,o.prototype.F2=2*n-52;var c,l,u="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array;for(c="0".charCodeAt(0),l=0;l<=9;++l)h[c++]=l;for(c="a".charCodeAt(0),l=10;l<36;++l)h[c++]=l;for(c="A".charCodeAt(0),l=10;l<36;++l)h[c++]=l;function d(e){return u.charAt(e)}function f(e,t){var r=h[e.charCodeAt(t)];return null==r?-1:r}function p(e){var t=s();return t.fromInt(e),t}function g(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function m(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function v(e,t){return e&t}function b(e,t){return e|t}function w(e,t){return e^t}function E(e,t){return e&~t}function _(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function A(){}function T(e){return e}function C(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},m.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},m.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},m.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},m.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},m.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var a=8==r?255&e[n]:f(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this.data[this.t++]=a>>this.DB-s):this.data[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&o.ZERO.subTo(this,this)},o.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},o.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>i|a,a=(this.data[r]&o)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&o)<<i,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},o.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},o.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&o.ZERO.subTo(t,t)},o.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=s());var a=s(),c=this.s,l=e.s,u=this.DB-g(n.data[n.t-1]);u>0?(n.lShiftTo(u,a),i.lShiftTo(u,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,d=a.data[h-1];if(0!=d){var f=d*(1<<this.F1)+(h>1?a.data[h-2]>>this.F2:0),p=this.FV/f,y=(1<<this.F1)/f,m=1<<this.F2,v=r.t,b=v-h,w=null==t?s():t;for(a.dlShiftTo(b,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a.data[a.t++]=0;for(;--b>=0;){var E=r.data[--v]==d?this.DM:Math.floor(r.data[v]*p+(r.data[v-1]+m)*y);if((r.data[v]+=a.am(0,E,r,b,0,h))<E)for(a.dlShiftTo(b,w),r.subTo(w,r);r.data[v]<--E;)r.subTo(w,r)}null!=t&&(r.drShiftTo(h,t),c!=l&&o.ZERO.subTo(t,t)),r.t=h,r.clamp(),u>0&&r.rShiftTo(u,r),c<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=g(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this.data[s]>>a)>0&&(i=!0,o=d(r));s>=0;)a<t?(r=(this.data[s]&(1<<a)-1)<<t-a,r|=this.data[--s]>>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=d(r));return i?o:"0"},o.prototype.negate=function(){var e=s();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+g(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new m(t),this.exp(e,r)},o.ZERO=p(0),o.ONE=p(1),A.prototype.convert=T,A.prototype.revert=T,A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},A.prototype.sqrTo=function(e,t){e.squareTo(t)},C.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},C.prototype.revert=function(e){return e},C.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)},C.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var k=[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],I=(1<<26)/k[k.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=p(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,c=0;c<e.length;++c){var l=f(e,c);l<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(a=t*a+l,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),b,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},o.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},o.prototype.changeBit=function(e,t){var r=o.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},o.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},o.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},o.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},o.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new o(this.bitLength(),s)}while(n.compareTo(o.ONE)<=0||n.compareTo(t)>=0);var c=n.modPow(i,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(t)){for(var l=1;l++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(o.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},o.prototype.clone=function(){var e=s();return this.copyTo(e),e},o.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},o.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=s();return this.bitwiseTo(e,v,t),t},o.prototype.or=function(e){var t=s();return this.bitwiseTo(e,b,t),t},o.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,w,t),t},o.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},o.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},o.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},o.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},o.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+_(this.data[e]);return this.s<0?this.t*this.DB:-1},o.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e},o.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},o.prototype.setBit=function(e){return this.changeBit(e,b)},o.prototype.clearBit=function(e){return this.changeBit(e,E)},o.prototype.flipBit=function(e){return this.changeBit(e,w)},o.prototype.add=function(e){var t=s();return this.addTo(e,t),t},o.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t},o.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t},o.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t},o.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t},o.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)},o.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),o=p(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new C(t):new m(t);var a=new Array,c=3,l=r-1,u=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=s();for(n.sqrTo(a[1],h);c<=u;)a[c]=s(),n.mulTo(h,a[c-2],a[c]),c+=2}var d,f,v=e.t-1,b=!0,w=s();for(i=g(e.data[v])-1;v>=0;){for(i>=l?d=e.data[v]>>i-l&u:(d=(e.data[v]&(1<<i+1)-1)<<l-i,v>0&&(d|=e.data[v-1]>>this.DB+i-l)),c=r;0==(1&d);)d>>=1,--c;if((i-=c)<0&&(i+=this.DB,--v),b)a[d].copyTo(o),b=!1;else{for(;c>1;)n.sqrTo(o,w),n.sqrTo(w,o),c-=2;c>0?n.sqrTo(o,w):(f=o,o=w,w=f),n.mulTo(w,a[d],o)}for(;v>=0&&0==(e.data[v]&1<<i);)n.sqrTo(o,w),f=o,o=w,w=f,--i<0&&(i=this.DB-1,--v)}return n.revert(o)},o.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var r=e.clone(),n=this.clone(),i=p(1),s=p(0),a=p(0),c=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(c,s)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(s,c))}return 0!=n.compareTo(o.ONE)?o.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},o.prototype.pow=function(e){return this.exp(e,new A)},o.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},o.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=k[k.length-1]){for(t=0;t<k.length;++t)if(r.data[0]==k[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<k.length;){for(var n=k[t],i=t+1;i<k.length&&n<I;)n*=k[i++];for(n=r.modInt(n);t<i;)if(n%k[t++]==0)return!1}return r.millerRabin(e)}},29:(e,t,r)=>{var n=r(392);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},1746:(e,t,r)=>{var n=r(392);r(7263),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},7263:(e,t,r)=>{var n=r(392);r(3877),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s<o;s++){var a=new n.util.ByteBuffer;a.putInt32(s),e.start(),e.update(t+a.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}}}},2886:(e,t,r)=>{var n=r(392);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.3.101.112","EdDSA25519"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("1.3.14.3.2.29","sha1WithRSASignature"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("2.16.840.1.101.3.4.2.4","sha224"),o("2.16.840.1.101.3.4.2.5","sha512-224"),o("2.16.840.1.101.3.4.2.6","sha512-256"),o("1.2.840.113549.2.2","md2"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.4","surname"),o("2.5.4.5","serialNumber"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.9","streetAddress"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.5.4.12","title"),o("2.5.4.13","description"),o("2.5.4.15","businessCategory"),o("2.5.4.17","postalCode"),o("2.5.4.42","givenName"),o("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),o("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),o("2.16.840.1.113730.1.1","nsCertType"),o("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},9835:(e,t,r)=>{var n=r(392);if(r(8605),r(5049),r(1400),r(29),r(2886),r(6019),r(6193),r(3860),r(654),r(5493),r(3877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},u={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=s.oids[o.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return f(t)}function f(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,l,u=n.random.getBytesSync(r.saltSize),h=r.count,d=o.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,g,y;switch(r.algorithm){case"aes128":i=16,p=16,g=a["aes128-CBC"],y=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,g=a["aes192-CBC"],y=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,g=a["aes256-CBC"],y=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,g=a.desCBC,y=n.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(m),b=n.pkcs5.pbkdf2(t,u,h,i,v),w=n.random.getBytesSync(p);(S=y(b)).start(w),S.update(o.toDer(e)),S.finish(),l=S.output.getBytes();var E=function(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]));return a}(u,d,i,m);c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,w)])])])}else{var _;if("3des"!==r.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_;i=24;var S,A=new n.util.ByteBuffer(u);b=s.pbe.generatePkcs12Key(t,A,1,h,i),w=s.pbe.generatePkcs12Key(t,A,2,h,i);(S=n.des.createEncryptionCipher(b)).start(w),S.update(o.toDer(e)),S.finish(),l=S.output.getBytes(),c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,u),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,d.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[c,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,l)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,c,i,a)){var l=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw l.errors=a,l}var u=o.derToOid(i.encryptionOid),h=s.pbe.getCipher(u,i.encryptionParams,t),d=n.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(r=o.fromDer(h.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,c,l,u;switch(r.algorithm){case"aes128":a="AES-128-CBC",l=16,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",l=24,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",l=32,c=n.random.getBytesSync(16),u=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",l=24,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",l=8,c=n.random.getBytesSync(8),u=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var d=u(n.pbe.opensslDeriveBytes(t,c.substr(0,8),l));d.start(c),d.update(o.toDer(s.privateKeyToAsn1(e))),d.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(f)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(l=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=l,l;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var l;throw(l=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,l}var u=n.util.hexToBytes(i.dekInfo.parameters),h=c(n.pbe.opensslDeriveBytes(t,u.substr(0,8),a));if(h.start(u),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,c;if("undefined"===typeof s||null===s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var l=s.digestLength,u=s.blockLength,h=new n.util.ByteBuffer,d=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c<e.length;c++)d.putInt16(e.charCodeAt(c));d.putInt16(0)}var f=d.length(),p=t.length(),g=new n.util.ByteBuffer;g.fillWithByte(r,u);var y=u*Math.ceil(p/u),m=new n.util.ByteBuffer;for(c=0;c<y;c++)m.putByte(t.at(c%p));var v=u*Math.ceil(f/u),b=new n.util.ByteBuffer;for(c=0;c<v;c++)b.putByte(d.at(c%f));var w=m;w.putBuffer(b);for(var E=Math.ceil(o/l),_=1;_<=E;_++){var S=new n.util.ByteBuffer;S.putBytes(g.bytes()),S.putBytes(w.bytes());for(var A=0;A<i;A++)s.start(),s.update(S.getBytes()),S=s.digest();var T=new n.util.ByteBuffer;for(c=0;c<u;c++)T.putByte(S.at(c%l));var C=Math.ceil(p/u)+Math.ceil(f/u),k=new n.util.ByteBuffer;for(a=0;a<C;a++){var I=new n.util.ByteBuffer(w.getBytes(u)),R=511;for(c=T.length()-1;c>=0;c--)R>>=8,R+=T.at(c)+I.at(c),I.setAt(c,255&R);k.putBuffer(I)}w=k,h.putBuffer(S)}return h.truncate(h.length()-o),h},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!o.validate(t,l,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=o.derToOid(a.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(a.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var u,h,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":u=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,h=n.des.createDecryptionCipher;break;case"desCBC":u=8,h=n.des.createDecryptionCipher}var g=d(a.prfOid),y=n.pkcs5.pbkdf2(r,f,p,u,g),m=a.encIv,v=h(y);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,u,i,a))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,g;var c,l,h,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,l=8,h=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,l=8,h=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,g}var y=d(i.prfOid),m=s.pbe.generatePkcs12Key(r,f,1,p,c,y);return y.start(),h(m,s.pbe.generatePkcs12Key(r,f,2,p,l,y))},s.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var o=[h(i,e+t)],s=16,a=1;s<r;++a,s+=16)o.push(h(i,o[a-1]+e+t));return o.join("").substr(0,r)}},6019:(e,t,r)=>{var n=r(392);r(878),r(29),r(3877);var i,o=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(5819)),e.exports=n.pbkdf2=o.pbkdf2=function(e,t,r,o,s,a){if("function"===typeof s&&(a=s,s=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===s||"object"!==typeof s)&&(i.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!==typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===i.pbkdf2Sync.length?i.pbkdf2(e,t,r,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,r,o,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,r,o).toString("binary"):i.pbkdf2Sync(e,t,r,o,s).toString("binary");if("undefined"!==typeof s&&null!==s||(s="sha1"),"string"===typeof s){if(!(s in n.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=n.md[s].create()}var c=s.digestLength;if(o>4294967295*c){var l=new Error("Derived key is too long.");if(a)return a(l);throw l}var u=Math.ceil(o/c),h=o-(u-1)*c,d=n.hmac.create();d.start(s,e);var f,p,g,y="";if(!a){for(var m=1;m<=u;++m){d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=g=d.digest().getBytes();for(var v=2;v<=r;++v)d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),g=p;y+=m<u?f:f.substr(0,h)}return y}m=1;function b(){if(m>u)return a(null,y);d.start(null,null),d.update(t),d.update(n.util.int32ToBytes(m)),f=g=d.digest().getBytes(),v=2,w()}function w(){if(v<=r)return d.start(null,null),d.update(g),p=d.digest().getBytes(),f=n.util.xorBytes(f,p,c),g=p,++v,n.util.setImmediate(w);y+=m<u?f:f.substr(0,h),++m,b()}b()}},6193:(e,t,r)=>{var n=r(392);r(3877);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var o=0,s=-1;for(i=0;i<t.length;++i,++o)if(o>65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=o(r)),e.headers)for(var s=0;s<e.headers.length;++s)i+=o(e.headers[s]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,o=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var c=t[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var l={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(l),t[2]){for(var u=t[2].split(a),h=0;t&&h<u.length;){for(var d=u[h].replace(/\s+$/,""),f=h+1;f<u.length;++f){var p=u[f];if(!/\s/.test(p[0]))break;d+=p,h=f}if(t=d.match(o)){for(var g={name:t[1],values:[]},y=t[2].split(","),m=0;m<y.length;++m)g.values.push(s(y[m]));if(l.procType)if(l.contentDomain||"Content-Domain"!==g.name)if(l.dekInfo||"DEK-Info"!==g.name)l.headers.push(g);else{if(0===g.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');l.dekInfo={algorithm:y[0],parameters:y[1]||null}}else l.contentDomain=y[0]||"";else{if("Proc-Type"!==g.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==g.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');l.procType={version:y[0],type:y[1]}}}++h}if("ENCRYPTED"===l.procType&&!l.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},2627:(e,t,r)=>{var n=r(392);r(3877),r(3860),r(928);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s<o;++s){var a=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,s,a,c;"string"===typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var l=Math.ceil(e.n.bitLength()/8),u=l-2*a.digestLength-2;if(t.length>u)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=t.length,y.maxLength=u,y;i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",f=u-t.length,p=0;p<f;p++)d+="\0";var g=h.getBytes()+d+"\x01"+t;if(s){if(s.length!==a.digestLength){var y;throw(y=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,y.digestLength=a.digestLength,y}}else s=n.random.getBytes(a.digestLength);var m=o(s,l-a.digestLength-1,c),v=n.util.xorBytes(g,m,g.length),b=o(v,a.digestLength,c);return"\0"+n.util.xorBytes(s,b,s.length)+v},i.decode_rsa_oaep=function(e,t,r){var i,s,a;"string"===typeof r?(i=r,s=arguments[3]||void 0):r&&(i=r.label||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var c=Math.ceil(e.n.bitLength()/8);if(t.length!==c)throw(m=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,m.expectedLength=c,m;if(void 0===s?s=n.md.sha1.create():s.start(),a||(a=s),c<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var l=s.digest().getBytes(),u=t.charAt(0),h=t.substring(1,s.digestLength+1),d=t.substring(1+s.digestLength),f=o(d,s.digestLength,a),p=o(n.util.xorBytes(h,f,h.length),c-s.digestLength-1,a),g=n.util.xorBytes(d,p,d.length),y=g.substring(0,s.digestLength),m="\0"!==u,v=0;v<s.digestLength;++v)m|=l.charAt(v)!==y.charAt(v);for(var b=1,w=s.digestLength,E=s.digestLength;E<g.length;E++){var _=g.charCodeAt(E);m|=_&(b?65534:0),w+=b&=1&_^1}if(m||1!==g.charCodeAt(w))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(w+1)}},4660:(e,t,r)=>{var n=r(392);r(8605),r(5049),r(1400),r(2886),r(6193),r(4922),r(3860),r(3877),r(3391);var i=n.asn1,o=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function a(e){for(var t,r=[],o=0;o<e.length;++o)r.push((t=e[o],i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:t.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.encryptedContent.content)])));return r}function c(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.digestAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o<e.unauthenticatedAttributes.length;++o){var s=e.unauthenticatedAttributes[o];r.values.push(l(s))}t.value.push(r)}return t}function l(e){var t;if(e.type===n.pki.oids.contentType)t=i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.value).getBytes());else if(e.type===n.pki.oids.messageDigest)t=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===n.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),o=new Date("2050-01-01T00:00:00Z"),s=e.value;if("string"===typeof s){var a=Date.parse(s);s=isNaN(a)?13===s.length?i.utcTimeToDate(s):i.generalizedTimeToDate(s):new Date(a)}t=s>=r&&s<o?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(s)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(s))}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[t])])}function u(e,t,r){var o={};if(!i.validate(t,r,o,[])){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}if(i.derToOid(o.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var a="";if(n.util.isArray(o.encryptedContent))for(var c=0;c<o.encryptedContent.length;++c){if(o.encryptedContent[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=o.encryptedContent[c].value}else a=o.encryptedContent;e.encryptedContent={algorithm:i.derToOid(o.encAlgorithm),parameter:n.util.createBuffer(o.encParameter.value),content:n.util.createBuffer(a)}}if(o.content){a="";if(n.util.isArray(o.content))for(c=0;c<o.content.length;++c){if(o.content[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=o.content[c].value}else a=o.content;e.content=n.util.createBuffer(a)}return e.version=o.version.charCodeAt(0),e.rawCapture=o,o}function h(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case n.pki.oids["aes128-CBC"]:case n.pki.oids["aes192-CBC"]:case n.pki.oids["aes256-CBC"]:t=n.aes.createDecryptionCipher(e.encryptedContent.key);break;case n.pki.oids.desCBC:case n.pki.oids["des-EDE3-CBC"]:t=n.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}o.messageFromPem=function(e){var t=n.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return o.messageFromAsn1(s)},o.messageToPem=function(e,t){var r={type:"PKCS7",body:i.toDer(e.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:t})},o.messageFromAsn1=function(e){var t={},r=[];if(!i.validate(e,o.asn1.contentInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw s.errors=r,s}var a,c=i.derToOid(t.contentType);switch(c){case n.pki.oids.envelopedData:a=o.createEnvelopedData();break;case n.pki.oids.encryptedData:a=o.createEncryptedData();break;case n.pki.oids.signedData:a=o.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return a.fromAsn1(t.content.value[0]),a},o.createSignedData=function(){var e=null;return e={type:n.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(u(e,t,o.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,i=0;i<r.length;++i)e.certificates.push(n.pki.certificateFromAsn1(r[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(n.pki.certificateToAsn1(e.certificates[r]));var o=[],s=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"===typeof o&&(o=n.pki.certificateFromPem(o)),r=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof s&&(s=n.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var l=!1,u=!1,h=0;h<c.length;++h){var d=c[h];if(l||d.type!==n.pki.oids.contentType){if(u||d.type!==n.pki.oids.messageDigest);else if(u=!0,l)break}else if(l=!0,u)break}if(!l||!u)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:s,version:1,issuer:r,serialNumber:i,digestAlgorithm:a,signatureAlgorithm:n.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(t){var r;(t=t||{},"object"!==typeof e.content||null===e.contentInfo)&&(e.contentInfo=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof n.util.ByteBuffer?r=e.content.bytes():"string"===typeof e.content&&(r=n.util.encodeUtf8(e.content)),t.detached?e.detachedContent=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r):e.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)]))));0!==e.signers.length&&function(t){var r;r=e.detachedContent?e.detachedContent:(r=e.contentInfo.value[1]).value[0];if(!r)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var o=i.derToOid(e.contentInfo.value[0].value),s=i.toDer(r);for(var a in s.getByte(),i.getBerValueLength(s),s=s.getBytes(),t)t[a].start().update(s);for(var u=new Date,h=0;h<e.signers.length;++h){var d=e.signers[h];if(0===d.authenticatedAttributes.length){if(o!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),p=0;p<d.authenticatedAttributes.length;++p){var g=d.authenticatedAttributes[p];g.type===n.pki.oids.messageDigest?g.value=t[d.digestAlgorithm].digest():g.type===n.pki.oids.signingTime&&(g.value||(g.value=u)),f.value.push(l(g)),d.authenticatedAttributesAsn1.value.push(l(g))}s=i.toDer(f).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(c(e[r]));return t}(e.signers)}(function(){for(var t={},r=0;r<e.signers.length;++r){var o=e.signers[r];(s=o.digestAlgorithm)in t||(t[s]=n.md[n.pki.oids[s]].create()),0===o.authenticatedAttributes.length?o.md=t[s]:o.md=n.md[n.pki.oids[s]].create()}for(var s in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]));return t}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"===typeof t&&(t=n.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},o.createEncryptedData=function(){var e=null;return e={type:n.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){u(e,t,o.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),h(e)}}},o.createEnvelopedData=function(){var e=null;return e={type:n.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=u(e,t,o.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(s(e[r]));return t}(r.recipientInfos.value)},toAsn1:function(){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,a(e.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,(t=e.encryptedContent,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.algorithm).getBytes()),t.parameter?i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.parameter.getBytes()):void 0]),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.content.getBytes())])]))])])]);var t},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],o=i.issuer;if(i.serialNumber===t.serialNumber&&o.length===r.length){for(var s=!0,a=0;a<r.length;++a)if(o[a].type!==r[a].type||o[a].value!==r[a].value){s=!1;break}if(s)return i}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:case n.pki.oids.desCBC:var i=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=n.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}h(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:n.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var i,o,s;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,o=8,s=n.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=n.util.createBuffer(n.random.getBytes(i));else if(t.length()!=i)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=n.util.createBuffer(n.random.getBytes(o));var a=s(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var c=0;c<e.recipients.length;++c){var l=e.recipients[c];if(void 0===l.encryptedContent.content){if(l.encryptedContent.algorithm!==n.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+l.encryptedContent.algorithm);l.encryptedContent.content=l.encryptedContent.key.encrypt(e.encryptedContent.key.data)}}}}}},4922:(e,t,r)=>{var n=r(392);r(5049),r(3877);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=s;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},5132:(e,t,r)=>{var n=r(392);r(3877),r(3055),r(3860),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof o&&(o={name:o}),o.options=o.options||{};var s=t.prng||n.random,c={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===o.name)return function(e,t,i,o){if("workers"in i)return function(e,t,i,o){if("undefined"===typeof Worker)return a(e,t,i,o);var s=l(e,t),c=i.workers,u=i.workLoad||100,h=30*u/8,d=i.workerScript||"forge/prime.worker.js";if(-1===c)return n.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],i=0;i<c;++i)n[i]=new Worker(d);for(i=0;i<c;++i)n[i].addEventListener("message",f);var a=!1;function f(i){if(!a){0;var c=i.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return a=!0,o(null,new r(c.prime,16))}s.bitLength()>e&&(s=l(e,t));var f=s.toString(16);i.target.postMessage({hex:f,workLoad:u}),s.dAddOffset(h,0)}}}f()}(e,t,i,o);return a(e,t,i,o)}(e,c,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(e,t,r,n){var i=l(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),c(i,e,t,0,o,s,n)}function c(e,t,r,o,s,a,u){var h=+new Date;do{if(e.bitLength()>t&&(e=l(t,r)),e.isProbablePrime(s))return u(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-h<a);n.util.setImmediate((function(){c(e,t,r,o,s,a,u)}))}function l(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),s,n),n.dAddOffset(31-n.mod(o).byteValue(),0),n}}()},6140:(e,t,r)=>{var n=r(392);r(3877);var i=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(i=r(5819)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,o=new Array(32),s=0;s<32;++s)o[s]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r===0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function l(e){var t=null,r=n.util.globalScope,i=r.crypto||r.msCrypto;i&&i.getRandomValues&&(t=function(e){return i.getRandomValues(e)});var o=n.util.createBuffer();if(t)for(;o.length()<e;){var s=Math.max(1,Math.min(e-o.length(),65536)/4),a=new Uint32Array(Math.floor(s));try{t(a);for(var c=0;c<a.length;++c)o.putInt32(a[c])}catch(f){if(!("undefined"!==typeof QuotaExceededError&&f instanceof QuotaExceededError))throw f}}if(o.length()<e)for(var l,u,h,d=Math.floor(65536*Math.random());o.length()<e;){u=16807*(65535&d),u+=(32767&(l=16807*(d>>16)))<<16,d=4294967295&(u=(2147483647&(u+=l>>15))+(u>>31));for(c=0;c<3;++c)h=d>>>(c<<3),h^=Math.floor(256*Math.random()),o.putByte(255&h)}return o.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var i=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,a=t.plugin.formatSeed,l=n.util.createBuffer();t.key=null,function u(h){if(h)return r(h);if(l.length()>=e)return r(null,l.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(u)}));var d=i(t.key,t.seed);t.generated+=d.length,l.putBytes(d),t.key=s(i(t.key,o(t.seed))),t.seed=a(i(t.key,t.seed)),n.util.setImmediate(u)}()},t.generateSync=function(e){var r=t.plugin.cipher,i=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var l=r(t.key,t.seed);t.generated+=l.length,c.putBytes(l),t.key=o(r(t.key,i(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},i?(t.seedFile=function(e,t){i.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return i.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,l(e))}catch(r){t(r)}},t.seedFileSync=l),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},325:(e,t,r)=>{var n=r(392);r(3860),r(3877),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,o=r.digestLength,s=e.salt||null;if("string"===typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var l,u,h=c-1,d=Math.ceil(h/8),f=e.digest().getBytes();if(d<o+t+2)throw new Error("Message is too long to encrypt.");u=null===s?a.getBytesSync(t):s.bytes();var p=new n.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(u),r.start(),r.update(p.getBytes());var g=r.digest().getBytes(),y=new n.util.ByteBuffer;y.fillWithByte(0,d-t-o-2),y.putByte(1),y.putBytes(u);var m=y.getBytes(),v=d-o-1,b=i.generate(g,v),w="";for(l=0;l<v;l++)w+=String.fromCharCode(m.charCodeAt(l)^b.charCodeAt(l));var E=65280>>8*d-h&255;return(w=String.fromCharCode(w.charCodeAt(0)&~E)+w.substr(1))+g+String.fromCharCode(188)},verify:function(e,s,a){var c,l=a-1,u=Math.ceil(l/8);if(s=s.substr(-u),u<o+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==s.charCodeAt(u-1))throw new Error("Encoded message does not end in 0xBC.");var h=u-o-1,d=s.substr(0,h),f=s.substr(h,o),p=65280>>8*u-l&255;if(0!==(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var g=i.generate(f,h),y="";for(c=0;c<h;c++)y+=String.fromCharCode(d.charCodeAt(c)^g.charCodeAt(c));y=String.fromCharCode(y.charCodeAt(0)&~p)+y.substr(1);var m=u-o-t-2;for(c=0;c<m;c++)if(0!==y.charCodeAt(c))throw new Error("Leftmost octets not zero as expected");if(1!==y.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=y.substr(-t),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),r.start(),r.update(b.getBytes()),f===r.digest().getBytes()}};return c}},3860:(e,t,r)=>{var n=r(392);r(8605),r(7404),r(6140),r(3877),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),c=null,l=n.util.globalScope,u=l.crypto||l.msCrypto;if(u&&u.getRandomValues&&(c=function(e){return u.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"===typeof window||window.document,a.collectInt(+new Date,32),"undefined"!==typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(f){}a.collect(h),h=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},654:(e,t,r)=>{var n=r(392);r(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=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"===typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,o=e,s=e.length(),a=t,c=Math.ceil(a/8),l=255>>(7&a);for(r=s;r<128;r++)o.putByte(i[o.at(r-1)+o.at(r-s)&255]);for(o.setAt(128-c,i[o.at(128-c)&l]),r=127-c;r>=0;r--)o.setAt(r,i[o.at(r+1)^o.at(r+c)]);return o};var c=function(e,t,r){var i,c,l,u,h=!1,d=null,f=null,p=null,g=[];for(e=n.rc2.expandKey(e,t),l=0;l<64;l++)g.push(e.getInt16Le());r?(i=function(e){for(l=0;l<4;l++)e[l]+=g[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),e[l]=s(e[l],o[l]),u++},c=function(e){for(l=0;l<4;l++)e[l]+=g[63&e[(l+3)%4]]}):(i=function(e){for(l=3;l>=0;l--)e[l]=a(e[l],o[l]),e[l]-=g[u]+(e[(l+3)%4]&e[(l+2)%4])+(~e[(l+3)%4]&e[(l+1)%4]),u--},c=function(e){for(l=3;l>=0;l--)e[l]-=g[63&e[(l+3)%4]]});var y=function(e){var t=[];for(l=0;l<4;l++){var n=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}u=r?0:63;for(var i=0;i<e.length;i++)for(var o=0;o<e[i][0];o++)e[i][1](t);for(l=0;l<4;l++)null!==p&&(r?p.putInt16Le(t[l]):t[l]^=p.getInt16Le()),f.putInt16Le(t[l])},m=null;return m={start:function(e,t){e&&"string"===typeof e&&(e=n.util.createBuffer(e)),h=!1,d=n.util.createBuffer(),f=t||new n.util.createBuffer,p=e,m.output=f},update:function(e){for(h||d.putBuffer(e);d.length()>=8;)y([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===d.length()))if(e)t=e(8,f,!r);else{var i=f.length(),o=f.at(i-1);o>i?t=!1:f.truncate(o)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},5493:(e,t,r)=>{var n=r(392);if(r(5049),r(3055),r(2886),r(2627),r(5132),r(3860),r(3877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.util.isNodejs?r(5819):null,s=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,l=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},g=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),o=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);o.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),o.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var a=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),s.toDer(i).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=0||!o.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var c=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(o.modInverse(t.n)).mod(t.n)};function m(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a,c=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var l=0;l<c;++l)i.putByte(a)}else for(;c>0;){var u=0,h=n.random.getBytes(c);for(l=0;l<c;++l)0===(a=h.charCodeAt(l))?++u:i.putByte(a);c=u}return i.putByte(0),i.putBytes(e),i}function v(e,t,r,i){var o=Math.ceil(t.n.bitLength()/8),s=n.util.createBuffer(e),a=s.getByte(),c=s.getByte();if(0!==a||r&&0!==c&&1!==c||!r&&2!=c||r&&0===c&&"undefined"===typeof i)throw new Error("Encryption block is invalid.");var l=0;if(0===c){l=o-3-i;for(var u=0;u<l;++u)if(0!==s.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(l=0;s.length()>1;){if(255!==s.getByte()){--s.read;break}++l}else if(2===c)for(l=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++l}if(0!==s.getByte()||l!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function b(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0===(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128===(128&r.charCodeAt(1)))?r.substr(1):r}function w(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function E(e){return n.util.isNodejs&&"function"===typeof o[e]}function _(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.crypto&&"object"===typeof a.globalScope.crypto.subtle&&"function"===typeof a.globalScope.crypto.subtle[e]}function S(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.msCrypto&&"object"===typeof a.globalScope.msCrypto.subtle&&"function"===typeof a.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}c.rsa.encrypt=function(e,t,r){var o,s=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(s=2===r,o=m(e,t,r)):(o=n.util.createBuffer()).putBytes(e);for(var c=new i(o.toHex(),16),l=y(c,t,s).toString(16),u=n.util.createBuffer(),h=a-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),u.getBytes()},c.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var l=y(c,t,r).toString(16),u=n.util.createBuffer(),h=s-Math.ceil(l.length/2);h>0;)u.putByte(0),--h;return u.putBytes(n.util.hexToBytes(l)),!1!==o?v(u.getBytes(),t,r):u.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(o={algorithm:c,state:0,bits:e,rng:a,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,o=0,s=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||u<t);){if(0===e.state){var h=null===e.p?e.pBits:e.qBits,d=h-1;0===e.pqState?(e.num=new i(h,e.rng),e.num.testBit(d)||e.num.bitwiseTo(i.ONE.shiftLeft(d),s,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>h?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(l[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}u+=(n=+new Date)-a,a=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,l){if(1===arguments.length?"object"===typeof e?(r=e,e=void 0):"function"===typeof e&&(l=e,e=void 0):2===arguments.length?"number"===typeof e?"function"===typeof t?(l=t,t=void 0):"number"!==typeof t&&(r=t,t=void 0):(r=e,l=t,e=void 0,t=void 0):3===arguments.length&&("number"===typeof t?"function"===typeof r&&(l=r,r=void 0):(l=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(l){if(E("generateKeyPair"))return o.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return l(e);l(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(_("generateKey")&&_("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){l(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));l(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(S("generateKey")&&S("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));l(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){l(e)}},void(u.onerror=function(e){l(e)})}}else if(E("generateKeyPairSync")){var h=o.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(h.privateKey),publicKey:c.publicKeyFromPem(h.publicKey)}}var d=c.rsa.createKeyPairGenerationState(e,t,r);if(!l)return c.rsa.stepKeyPairGenerationState(d,0),d.keys;!function(e,t,r){"function"===typeof t&&(r=t,t={});t=t||{};var o={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(o.prng=t.prng);function s(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?l(t,e.q):void a(e.qBits,l))}))}function a(e,t){n.prime.generateProbablePrime(e,o,t)}function l(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,l);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,l);var u=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}s()}(d,r,l)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return m(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"===typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return c.rsa.encrypt(o,r,!0)},verify:function(e,t,i,o){"string"===typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===o&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=v(t,r,!0);var i=s.fromDer(t,{parseAllBytes:o._parseAllDigestBytes}),a={},c=[];if(!s.validate(i,p,a,c))throw(l=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=c,l;var l,u=s.derToOid(a.algorithmIdentifier);if(u!==n.oids.md2&&u!==n.oids.md5&&u!==n.oids.sha1&&u!==n.oids.sha224&&u!==n.oids.sha256&&u!==n.oids.sha384&&u!==n.oids.sha512&&u!==n.oids["sha512-224"]&&u!==n.oids["sha512-256"])throw(l=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,l;if((u===n.oids.md2||u===n.oids.md5)&&!("parameters"in a))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===a.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=v(t,r,!0))}});var a=c.rsa.decrypt(t,r,!0,!1);return i.verify(e,a,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,o,s,a,l){var u={n:e,e:t,d:r,p:i,q:o,dP:s,dQ:a,qInv:l,decrypt:function(e,t,r){"string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,u,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,u,!1)},sign:function(e,t){var r=!1;"string"===typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:g},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,u.n.bitLength());return c.rsa.encrypt(n,u,r)}};return u},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,o,a,l,d,f,p,g={},y=[];if(s.validate(e,u,g,y)&&(e=s.fromDer(n.util.createBuffer(g.privateKey))),g={},y=[],!s.validate(e,h,g,y)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=y,m}return t=n.util.createBuffer(g.privateKeyModulus).toHex(),r=n.util.createBuffer(g.privateKeyPublicExponent).toHex(),o=n.util.createBuffer(g.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(g.privateKeyPrime1).toHex(),l=n.util.createBuffer(g.privateKeyPrime2).toHex(),d=n.util.createBuffer(g.privateKeyExponent1).toHex(),f=n.util.createBuffer(g.privateKeyExponent2).toHex(),p=n.util.createBuffer(g.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(r,16),new i(o,16),new i(a,16),new i(l,16),new i(d,16),new i(f,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,f,t,r)){var o,a=s.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=a,o;e=t.rsaPublicKey}if(r=[],!s.validate(e,d,t,r))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,o;var l=n.util.createBuffer(t.publicKeyModulus).toHex(),u=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(l,16),new i(u,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,b(e.e))])}},928:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var c=o.length;i.messageLength+=c,c=[c/4294967296>>>0,c>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=c[1],c[1]=c[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(o),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var c,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)u+=(c=8*i.fullMessageLength[h+1])/4294967296>>>0,s.putInt32(u>>>0),u=c>>>0;s.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,s);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var o=null,s=!1;function a(e,t,r){for(var n,i,o,s,a,c,l,u=r.length();u>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o&s|a&(o^s))+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(i<<5|i>>>27)+(o^s^a)+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,u-=64}}},7404:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var a=o.length;i.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var l=i.fullMessageLength.length-1;l>=0;--l)i.fullMessageLength[l]+=a[1],a[1]=a[0]+(i.fullMessageLength[l]/4294967296>>>0),i.fullMessageLength[l]=i.fullMessageLength[l]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a,l=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-l));for(var u=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)u+=(a=8*i.fullMessageLength[h+1])/4294967296>>>0,s.putInt32(u>>>0),u=a>>>0;s.putInt32(u);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(d,r,s);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},i};var o=null,s=!1,a=null;function c(e,t,r){for(var n,i,o,s,c,l,u,h,d,f,p,g,y,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(l=e.h0,u=e.h1,h=e.h2,d=e.h3,f=e.h4,p=e.h5,g=e.h6,y=e.h7,c=0;c<64;++c)o=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&u|h&(l^u),n=y+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(g^f&(p^g))+a[c]+t[c],y=g,g=p,p=f,f=d+n>>>0,d=h,h=u,u=l,l=n+(i=o+s)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+h|0,e.h3=e.h3+d|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+g|0,e.h7=e.h7+y|0,m-=64}}},4770:(e,t,r)=>{var n=r(392);r(29),r(3877);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var o=n.sha384=n.sha512.sha384=n.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=o,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),c=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(l={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),"undefined"===typeof e&&(e="SHA-512"),!(e in l))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=l[e],r=null,i=n.util.createBuffer(),o=new Array(80),h=0;h<80;++h)o[h]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,o=0;o<e;++o)f.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(o=0;o<t.length;++o)r[o]=t[o].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var s=e.length;f.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=s[1],s[1]=s[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),u(r,o,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(s.substr(0,f.blockLength-c));for(var l=8*f.fullMessageLength[0],h=0;h<f.fullMessageLength.length-1;++h)l+=(a=8*f.fullMessageLength[h+1])/4294967296>>>0,t.putInt32(l>>>0),l=a>>>0;t.putInt32(l);var d=new Array(r.length);for(h=0;h<r.length;++h)d[h]=r[h].slice(0);u(d,o,t);var p,g=n.util.createBuffer();p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4;for(h=0;h<p;++h)g.putInt32(d[h][0]),h===p-1&&"SHA-512/224"===e||g.putInt32(d[h][1]);return g},f};var s=null,a=!1,c=null,l=null;function u(e,t,r){for(var n,i,o,s,a,l,u,h,d,f,p,g,y,m,v,b,w,E,_,S,A,T,C,k,I,R,P,N,D,x,L,O,B,M=r.length();M>=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)n=(((N=(x=t[P-2])[0])>>>19|(D=x[1])<<13)^(D>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|D>>>19)^(D<<3|N>>>29)^(N<<26|D>>>6))>>>0,o=(((N=(O=t[P-15])[0])>>>1|(D=O[1])<<31)^(N>>>8|D<<24)^N>>>7)>>>0,s=((N<<31|D>>>1)^(N<<24|D>>>8)^(N<<25|D>>>7))>>>0,L=t[P-7],B=t[P-16],D=i+L[1]+s+B[1],t[P][0]=n+L[0]+o+B[0]+(D/4294967296>>>0)>>>0,t[P][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],T=e[5][1],C=e[6][0],k=e[6][1],I=e[7][0],R=e[7][1],P=0;P<80;++P)u=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,h=(C^_&(A^C))>>>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)+((k^S&(T^k))>>>0)+c[P][1]+t[P][1],n=I+u+h+c[P][0]+t[P][0]+(D/4294967296>>>0)>>>0,i=D>>>0,o=a+d+((D=l+f)/4294967296>>>0)>>>0,s=D>>>0,I=C,R=k,C=A,k=T,A=_,T=S,_=w+n+((D=E+i)/4294967296>>>0)>>>0,S=D>>>0,w=v,E=b,v=y,b=m,y=p,m=g,p=n+o+((D=i+s)/4294967296>>>0)>>>0,g=D>>>0;D=e[0][1]+g,e[0][0]=e[0][0]+p+(D/4294967296>>>0)>>>0,e[0][1]=D>>>0,D=e[1][1]+m,e[1][0]=e[1][0]+y+(D/4294967296>>>0)>>>0,e[1][1]=D>>>0,D=e[2][1]+b,e[2][0]=e[2][0]+v+(D/4294967296>>>0)>>>0,e[2][1]=D>>>0,D=e[3][1]+E,e[3][0]=e[3][0]+w+(D/4294967296>>>0)>>>0,e[3][1]=D>>>0,D=e[4][1]+S,e[4][0]=e[4][0]+_+(D/4294967296>>>0)>>>0,e[4][1]=D>>>0,D=e[5][1]+T,e[5][0]=e[5][0]+A+(D/4294967296>>>0)>>>0,e[5][1]=D>>>0,D=e[6][1]+k,e[6][0]=e[6][0]+C+(D/4294967296>>>0)>>>0,e[6][1]=D>>>0,D=e[7][1]+R,e[7][0]=e[7][0]+I+(D/4294967296>>>0)>>>0,e[7][1]=D>>>0,M-=128}}},3877:(e,t,r)=>{var n=r(392),i=r(5754),o=e.exports=n.util=n.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function a(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(o.isArrayBuffer(e)||o.isArrayBufferView(e))if("undefined"!==typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof a||"object"===typeof e&&"string"===typeof e.data&&"number"===typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!==typeof process&&process.nextTick&&!process.browser)return o.nextTick=process.nextTick,void("function"===typeof setImmediate?o.setImmediate=setImmediate:o.setImmediate=o.nextTick);if("function"===typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(o.nextTick=function(e){return setImmediate(e)});if(o.setImmediate=function(e){setTimeout(e,0)},"undefined"!==typeof window&&"function"===typeof window.postMessage){var e="forge.setImmediate",t=[];o.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!==typeof MutationObserver){var r=Date.now(),n=!0,i=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(i,{attributes:!0});var s=o.setImmediate;o.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&i.setAttribute("a",n=!n))}}o.nextTick=o.setImmediate}(),o.isNodejs="undefined"!==typeof process&&process.versions&&process.versions.node,o.globalScope=o.isNodejs?r.g:"undefined"===typeof self?window:self,o.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},o.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},o.isArrayBufferView=function(e){return e&&o.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},o.ByteBuffer=a,o.ByteStringBuffer=a;o.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},o.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},o.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},o.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(o.encodeUtf8(e))},o.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},o.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},o.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},o.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},o.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},o.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},o.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},o.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},o.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},o.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},o.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},o.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},o.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},o.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},o.ByteStringBuffer.prototype.getInt=function(e){s(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},o.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},o.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},o.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},o.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},o.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},o.ByteStringBuffer.prototype.copy=function(){var e=o.createBuffer(this.data);return e.read=this.read,e},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},o.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},o.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},o.ByteStringBuffer.prototype.toString=function(){return o.decodeUtf8(this.bytes())},o.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=o.isArrayBuffer(e),n=o.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},o.DataBuffer.prototype.length=function(){return this.write-this.read},o.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},o.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},o.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},o.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},o.DataBuffer.prototype.putBytes=function(e,t){if(o.isArrayBufferView(e)){var r=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(o.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof o.DataBuffer||"object"===typeof e&&"number"===typeof e.read&&"number"===typeof e.write&&o.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof o.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"===typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=o.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=o.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},o.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},o.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},o.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},o.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},o.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},o.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},o.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},o.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},o.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},o.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},o.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},o.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},o.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},o.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},o.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},o.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},o.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},o.DataBuffer.prototype.getInt=function(e){s(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},o.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},o.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},o.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},o.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},o.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this)},o.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},o.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},o.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},o.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return o.binary.raw.encode(t);if("hex"===e)return o.binary.hex.encode(t);if("base64"===e)return o.binary.base64.encode(t);if("utf8"===e)return o.text.utf8.decode(t);if("utf16"===e)return o.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},o.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=o.encodeUtf8(e)),new o.ByteBuffer(e)},o.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},o.xorBytes=function(e,t,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o},o.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},o.bytesToHex=function(e){return o.createBuffer(e).toHex()},o.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(e,t){for(var r,n,i,o="",s="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),o+=c.charAt(r>>2),o+=c.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=c.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":c.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},o.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,o="",s=0;s<e.length;)t=l[e.charCodeAt(s++)-43],r=l[e.charCodeAt(s++)-43],n=l[e.charCodeAt(s++)-43],i=l[e.charCodeAt(s++)-43],o+=String.fromCharCode(t<<2|r>>4),64!==n&&(o+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(o+=String.fromCharCode((3&n)<<6|i)));return o},o.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},o.decodeUtf8=function(e){return decodeURIComponent(escape(e))},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:i.encode,decode:i.decode}},o.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},o.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);return t?i-r:n},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,o=r=r||0;for(1&e.length&&(i=1,n[o++]=parseInt(e[0],16));i<e.length;i+=2)n[o++]=parseInt(e.substr(i,2),16);return t?o-r:n},o.binary.base64.encode=function(e,t){for(var r,n,i,o="",s="",a=0;a<e.byteLength;)r=e[a++],n=e[a++],i=e[a++],o+=c.charAt(r>>2),o+=c.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=c.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":c.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},o.binary.base64.decode=function(e,t,r){var n,i,o,s,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)n=l[e.charCodeAt(c++)-43],i=l[e.charCodeAt(c++)-43],o=l[e.charCodeAt(c++)-43],s=l[e.charCodeAt(c++)-43],a[u++]=n<<2|i>>4,64!==o&&(a[u++]=(15&i)<<4|o>>2,64!==s&&(a[u++]=(3&o)<<6|s));return t?u-r:a.subarray(0,u)},o.binary.base58.encode=function(e,t){return o.binary.baseN.encode(e,u,t)},o.binary.base58.decode=function(e,t){return o.binary.baseN.decode(e,u,t)},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(e,t,r){e=o.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},o.text.utf8.decode=function(e){return o.decodeUtf8(String.fromCharCode.apply(null,e))},o.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),o=r=r||0,s=r,a=0;a<e.length;++a)i[s++]=e.charCodeAt(a),o+=2;return t?o-r:n},o.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},o.deflate=function(e,t,r){if(t=o.decode64(e.deflate(o.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},o.inflate=function(e,t,r){var n=e.inflate(o.encode64(t)).rval;return null===n?null:o.decode64(n)};var h=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=o.encode64(JSON.stringify(r)),n=e.setItem(t,r)),"undefined"!==typeof n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},d=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(o.decode64(r))),r},f=function(e,t,r,n){var i=d(e,t);null===i&&(i={}),i[r]=n,h(e,t,i)},p=function(e,t,r){var n=d(e,t);return null!==n&&(n=r in n?n[r]:null),n},g=function(e,t,r){var n=d(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),h(e,t,n)}},y=function(e,t){h(e,t,null)},m=function(e,t,r){var n,i=null;"undefined"===typeof r&&(r=["web","flash"]);var o=!1,s=null;for(var a in r){n=r[a];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),o="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),o=!0)}catch(c){s=c}if(o)break}if(!o)throw s;return i};o.setItem=function(e,t,r,n,i){m(f,arguments,i)},o.getItem=function(e,t,r,n){return m(p,arguments,n)},o.removeItem=function(e,t,r,n){m(g,arguments,n)},o.clearItems=function(e,t,r){m(y,arguments,r)},o.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},o.format=function(e){for(var t,r,n=/%./g,i=0,o=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&o.push(r),s=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[1+i++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},o.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+a:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-l).toFixed(o).slice(2):"")},o.formatSize=function(e){return e=e>=1073741824?o.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?o.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?o.formatNumber(e/1024,0)+" KiB":o.formatNumber(e,0)+" bytes"},o.bytesFromIP=function(e){return-1!==e.indexOf(".")?o.bytesFromIPv4(e):-1!==e.indexOf(":")?o.bytesFromIPv6(e):null},o.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=o.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},o.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),n=o.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var s=o.hexToBytes(e[i]);s.length<2&&n.putByte(0),n.putBytes(s)}else n.fillWithByte(0,r),r=0;return n.getBytes()},o.bytesToIP=function(e){return 4===e.length?o.bytesToIPv4(e):16===e.length?o.bytesToIPv6(e):null},o.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},o.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var s=o.bytesToHex(e[i]+e[i+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var a=r[r.length-1],c=t.length;a&&c===a.end+1?(a.end=c,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var l=r[n];l.end-l.start>0&&(t.splice(l.start,l.end-l.start+1,""),0===l.start&&t.unshift(""),7===l.end&&t.push(""))}return t.join(":")},o.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in o&&!e.update)return t(null,o.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,t(null,o.cores);if("undefined"===typeof Worker)return o.cores=1,t(null,o.cores);if("undefined"===typeof Blob)return o.cores=2,t(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(n,i,s){if(0===i){var a=Math.floor(n.reduce((function(e,t){return e+t}),0)/n.length);return o.cores=Math.max(1,a),URL.revokeObjectURL(r),t(null,o.cores)}!function(e,t){for(var n=[],i=[],o=0;o<e;++o){var s=new Worker(r);s.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var o=0;o<e;++o)n[o].terminate();t(null,i)}})),n.push(s)}for(o=0;o<e;++o)n[o].postMessage(o)}(s,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],o=r[n]=[],s=0;s<e;++s)if(n!==s){var a=t[s];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&o.push(s)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(n,i-1,s)}))}([],5,16)}},3391:(e,t,r)=>{var n=r(392);r(8605),r(5049),r(1400),r(29),r(1746),r(2886),r(6193),r(325),r(5493),r(3877);var i=n.asn1,o=e.exports=n.pki=n.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var c=n.pki.rsa.publicKeyValidator,l={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},u={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},h={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},d={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function f(e,t){"string"===typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}o.RDNAttributesAsArray=function(e,t){for(var r,n,o,c=[],l=0;l<e.value.length;++l){r=e.value[l];for(var u=0;u<r.value.length;++u)o={},n=r.value[u],o.type=i.derToOid(n.value[0].value),o.value=n.value[1].value,o.valueTagClass=n.value[1].type,o.type in s&&(o.name=s[o.type],o.name in a&&(o.shortName=a[o.name])),t&&(t.update(o.type),t.update(o.value)),c.push(o)}return c},o.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],c=i.derToOid(n.value[0].value),l=n.value[1].value,u=0;u<l.length;++u){var h={};if(h.type=c,h.value=l[u].value,h.valueTagClass=l[u].type,h.type in s&&(h.name=s[h.type],h.name in a&&(h.shortName=a[h.name])),h.type===s.extensionRequest){h.extensions=[];for(var d=0;d<h.value.length;++d)h.extensions.push(o.certificateExtensionFromAsn1(h.value[d]))}t.push(h)}return t};var p=function(e,t,r){var n={};if(e!==s["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:s.sha1},mgf:{algorithmOid:s.mgf1,hash:{algorithmOid:s.sha1}},saltLength:20});var o={},a=[];if(!i.validate(t,u,o,a)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=a,c}return void 0!==o.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(o.hashOid)),void 0!==o.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(o.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(o.maskGenHashOid)),void 0!==o.saltLength&&(n.saltLength=o.saltLength.charCodeAt(0)),n},g=function(e){switch(s[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return n.md.sha1.create();case"md5WithRSAEncryption":return n.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return n.md.sha256.create();case"sha384WithRSAEncryption":return n.md.sha384.create();case"sha512WithRSAEncryption":return n.md.sha512.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},y=function(e){var t,r=e.certificate;switch(r.signatureOid){case s.sha1WithRSAEncryption:case s.sha1WithRSASignature:break;case s["RSASSA-PSS"]:var i,o,a;if(void 0===(i=s[r.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[i])throw(a=new Error("Unsupported MGF hash function.")).oid=r.signatureParameters.mgf.hash.algorithmOid,a.name=i,a;if(void 0===(o=s[r.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[o])throw(a=new Error("Unsupported MGF function.")).oid=r.signatureParameters.mgf.algorithmOid,a.name=o,a;if(o=n.mgf[o].create(n.md[i].create()),void 0===(i=s[r.signatureParameters.hash.algorithmOid])||void 0===n.md[i])throw(a=new Error("Unsupported RSASSA-PSS hash function.")).oid=r.signatureParameters.hash.algorithmOid,a.name=i,a;t=n.pss.create(n.md[i].create(),o,r.signatureParameters.saltLength)}return r.publicKey.verify(e.md.digest().getBytes(),e.signature,t)};function m(e){for(var t,r,o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),s=e.attributes,a=0;a<s.length;++a){var c=(t=s[a]).value,l=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(l=t.valueTagClass)===i.Type.UTF8&&(c=n.util.encodeUtf8(c)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,l,!1,c)])]),o.value.push(r)}return o}function v(e){for(var t,r=0;r<e.length;++r){if("undefined"===typeof(t=e[r]).name&&(t.type&&t.type in o.oids?t.name=o.oids[t.type]:t.shortName&&t.shortName in a&&(t.name=o.oids[a[t.shortName]])),"undefined"===typeof t.type){if(!t.name||!(t.name in o.oids))throw(c=new Error("Attribute type not specified.")).attribute=t,c;t.type=o.oids[t.name]}if("undefined"===typeof t.shortName&&t.name&&t.name in a&&(t.shortName=a[t.name]),t.type===s.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(o.certificateExtensionToAsn1(b(t.extensions[n])))}var c;if("undefined"===typeof t.value)throw(c=new Error("Attribute value not specified.")).attribute=t,c}}function b(e,t){if(t=t||{},"undefined"===typeof e.name&&e.id&&e.id in o.oids&&(e.name=o.oids[e.id]),"undefined"===typeof e.id){if(!e.name||!(e.name in o.oids))throw(E=new Error("Extension ID not specified.")).extension=e,E;e.id=o.oids[e.name]}if("undefined"!==typeof e.value)return e;if("keyUsage"===e.name){var r=0,a=0,c=0;e.digitalSignature&&(a|=128,r=7),e.nonRepudiation&&(a|=64,r=6),e.keyEncipherment&&(a|=32,r=5),e.dataEncipherment&&(a|=16,r=4),e.keyAgreement&&(a|=8,r=3),e.keyCertSign&&(a|=4,r=2),e.cRLSign&&(a|=2,r=1),e.encipherOnly&&(a|=1,r=0),e.decipherOnly&&(c|=128,r=7);var l=String.fromCharCode(r);0!==c?l+=String.fromCharCode(a)+String.fromCharCode(c):0!==a&&(l+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,l)}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var u=e.value.value;for(var h in e)!0===e[h]&&(h in s?u.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s[h]).getBytes())):-1!==h.indexOf(".")&&u.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(h).getBytes())))}else if("nsCertType"===e.name){r=0,a=0;e.client&&(a|=128,r=7),e.server&&(a|=64,r=6),e.email&&(a|=32,r=5),e.objsign&&(a|=16,r=4),e.reserved&&(a|=8,r=3),e.sslCA&&(a|=4,r=2),e.emailCA&&(a|=2,r=1),e.objCA&&(a|=1,r=0);l=String.fromCharCode(r);0!==a&&(l+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,l)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){l=(v=e.altNames[d]).value;if(7===v.type&&v.ip){if(null===(l=n.util.bytesFromIP(v.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===v.type&&(l=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(l));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,l))}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,f.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var y=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);u=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<e.altNames.length;++d){l=(v=e.altNames[d]).value;if(7===v.type&&v.ip){if(null===(l=n.util.bytesFromIP(v.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===v.type&&(l=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(l));w.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,l))}b.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[w])),u.push(b)}var E;if("undefined"===typeof e.value)throw(E=new Error("Extension value not specified.")).extension=e,E;return e}function w(e,t){if(e===s["RSASSA-PSS"]){var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r)}return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}function E(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,o=0;o<r.length;++o){var s=r[o],a=s.value,c=i.Type.UTF8;"valueTagClass"in s&&(c=s.valueTagClass),c===i.Type.UTF8&&(a=n.util.encodeUtf8(a));var l=!1;"valueConstructed"in s&&(l=s.valueConstructed);var u=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,c,l,a)])]);t.value.push(u)}return t}o.certificateFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=s.type,a}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=i.fromDer(s.body,r);return o.certificateFromAsn1(c,t)},o.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(o.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var s=i.fromDer(t.body);return o.publicKeyFromAsn1(s)},o.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(o.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(o.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.getPublicKeyFingerprint=function(e,t){var r,s=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(o.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(o.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}s.start(),s.update(r);var a=s.digest();if("hex"===t.encoding){var c=a.toHex();return t.delimiter?c.match(/.{2}/g).join(t.delimiter):c}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a},o.certificationRequestFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==s.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=s.type,a}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var c=i.fromDer(s.body,r);return o.certificationRequestFromAsn1(c,t)},o.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(o.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return f(e.issuer,t)},e.issuer.addField=function(t){v([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t)},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){v(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){v(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)b(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"===typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=s[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=o.getTBSCertificate(e);var l=i.toDer(e.tbsCertificate);e.md.update(l.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,s=e.subject,a=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw a.expectedIssuer=s.attributes,a.actualIssuer=n.attributes,a}var c=t.md;if(null===c){c=g({signatureOid:t.signatureOid,type:"certificate"});var l=t.tbsCertificate||o.getTBSCertificate(t),u=i.toDer(l);c.update(u.getBytes())}return null!==c&&(r=y({certificate:e,md:c,signature:t.signature})),r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var o,s;r=!0;for(var a=0;r&&a<n.attributes.length;++a)o=n.attributes[a],s=i.attributes[a],o.type===s.type&&o.value===s.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return o.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=s.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var o=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===o}}return!1},e},o.certificateFromAsn1=function(e,t){var r={},s=[];if(!i.validate(e,l,r,s)){var a=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw a.errors=s,a}if(i.derToOid(r.publicKeyOid)!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=o.createCertificate();c.version=r.certVersion?r.certVersion.charCodeAt(0):0;var u=n.util.createBuffer(r.certSerialNumber);c.serialNumber=u.toHex(),c.signatureOid=n.asn1.derToOid(r.certSignatureOid),c.signatureParameters=p(c.signatureOid,r.certSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.certinfoSignatureParams,!1),c.signature=r.certSignature;var h=[];if(void 0!==r.certValidity1UTCTime&&h.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&h.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),h.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=h[0],c.validity.notAfter=h[1],c.tbsCertificate=r.tbsCertificate,t){c.md=g({signatureOid:c.signatureOid,type:"certificate"});var d=i.toDer(c.tbsCertificate);c.md.update(d.getBytes())}var y=n.md.sha1.create(),m=i.toDer(r.certIssuer);y.update(m.getBytes()),c.issuer.getField=function(e){return f(c.issuer,e)},c.issuer.addField=function(e){v([e]),c.issuer.attributes.push(e)},c.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=y.digest().toHex();var b=n.md.sha1.create(),w=i.toDer(r.certSubject);return b.update(w.getBytes()),c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=o.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=b.digest().toHex(),r.certExtensions?c.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},o.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(o.certificateExtensionFromAsn1(n.value[i]));return t},o.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in s)if(t.name=s[t.id],"keyUsage"===t.name){var r=0,o=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1),o=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128===(128&r),t.nonRepudiation=64===(64&r),t.keyEncipherment=32===(32&r),t.dataEncipherment=16===(16&r),t.keyAgreement=8===(8&r),t.keyCertSign=4===(4&r),t.cRLSign=2===(2&r),t.encipherOnly=1===(1&r),t.decipherOnly=128===(128&o)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),l=0;l<c.value.length;++l){var u=i.derToOid(c.value[l].value);u in s?t[s[u]]=!0:t[u]=!0}else if("nsCertType"===t.name){r=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1)),t.client=128===(128&r),t.server=64===(64&r),t.email=32===(32&r),t.objsign=16===(16&r),t.reserved=8===(8&r),t.sslCA=4===(4&r),t.emailCA=2===(2&r),t.objCA=1===(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var h;t.altNames=[];c=i.fromDer(t.value);for(var d=0;d<c.value.length;++d){var f={type:(h=c.value[d]).type,value:h.value};switch(t.altNames.push(f),h.type){case 1:case 2:case 6:break;case 7:f.ip=n.util.bytesToIP(h.value);break;case 8:f.oid=i.derToOid(h.value)}}}else if("subjectKeyIdentifier"===t.name){c=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(c.value)}return t},o.certificationRequestFromAsn1=function(e,t){var r={},s=[];if(!i.validate(e,d,r,s)){var a=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw a.errors=s,a}if(i.derToOid(r.publicKeyOid)!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=o.createCertificationRequest();if(c.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,c.signatureOid=n.asn1.derToOid(r.csrSignatureOid),c.signatureParameters=p(c.signatureOid,r.csrSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.csrSignatureParams,!1),c.signature=r.csrSignature,c.certificationRequestInfo=r.certificationRequestInfo,t){c.md=g({signatureOid:c.signatureOid,type:"certification request"});var l=i.toDer(c.certificationRequestInfo);c.md.update(l.getBytes())}var u=n.md.sha1.create();return c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=o.RDNAttributesAsArray(r.certificationRequestInfoSubject,u),c.subject.hash=u.digest().toHex(),c.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),c.getAttribute=function(e){return f(c,e)},c.addAttribute=function(e){v([e]),c.attributes.push(e)},c.attributes=o.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),c},o.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t)},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return f(e,t)},e.addAttribute=function(t){v([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){v(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){v(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=s[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=o.getCertificationRequestInfo(e);var l=i.toDer(e.certificationRequestInfo);e.md.update(l.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){r=g({signatureOid:e.signatureOid,type:"certification request"});var n=e.certificationRequestInfo||o.getCertificationRequestInfo(e),s=i.toDer(n);r.update(s.getBytes())}return null!==r&&(t=y({certificate:e,md:r,signature:e.signature})),t},e};var _=new Date("1950-01-01T00:00:00Z"),S=new Date("2050-01-01T00:00:00Z");function A(e){return e>=_&&e<S?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}o.getTBSCertificate=function(e){var t=A(e.validity.notBefore),r=A(e.validity.notAfter),s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),w(e.siginfo.algorithmOid,e.siginfo.parameters)]),m(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),m(e.subject),o.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&s.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&s.value.push(o.certificateExtensionsToAsn1(e.extensions)),s},o.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),o.publicKeyToAsn1(e.publicKey),E(e)])},o.distinguishedNameToAsn1=function(e){return m(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(o.certificateExtensionToAsn1(e[n]));return t},o.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!==typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t},o.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||o.getCertificationRequestInfo(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.createCaStore=function(e){var t={certs:{}};function r(e){return s(e),t.certs[e.hash]||null}function s(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=o.RDNAttributesAsArray(m(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){return r(e.issuer)},t.addCertificate=function(e){if("string"===typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"===typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var s=i.toDer(o.certificateToAsn1(e)).getBytes(),a=0;a<t.length;++a){if(s===i.toDer(o.certificateToAsn1(t[a])).getBytes())return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var o=0;o<i.length;++o)e.push(i[o]);else e.push(i)}return e},t.removeCertificate=function(e){var a;if("string"===typeof e&&(e=n.pki.certificateFromPem(e)),s(e.subject),!t.hasCertificate(e))return null;var c=r(e.subject);if(!n.util.isArray(c))return a=t.certs[e.subject.hash],delete t.certs[e.subject.hash],a;for(var l=i.toDer(o.certificateToAsn1(e)).getBytes(),u=0;u<c.length;++u){l===i.toDer(o.certificateToAsn1(c[u])).getBytes()&&(a=c[u],c.splice(u,1))}return 0===c.length&&delete t.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var c=e[a];t.addCertificate(c)}return t},o.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},o.verifyCertificateChain=function(e,t,r){"function"===typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),s=r.validityCheckDate;"undefined"===typeof s&&(s=new Date);var a=!0,c=null,l=0;do{var u=t.shift(),h=null,d=!1;if(s&&(s<u.validity.notBefore||s>u.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:s}),null===c){if(null===(h=t[0]||e.getIssuer(u))&&u.isIssuer(u)&&(d=!0,h=u),h){var f=h;n.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){h=f.shift();try{p=h.verify(u)}catch(_){}}p||(c={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==c||h&&!d||e.hasCertificate(u)||(c={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===c&&h&&!u.isIssuer(h)&&(c={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===c)for(var g={keyUsage:!0,basicConstraints:!0},y=0;null===c&&y<u.extensions.length;++y){var m=u.extensions[y];m.critical&&!(m.name in g)&&(c={message:"Certificate has an unsupported critical extension.",error:o.certificateError.unsupported_certificate})}if(null===c&&(!a||0===t.length&&(!h||d))){var v=u.getExtension("basicConstraints"),b=u.getExtension("keyUsage");if(null!==b&&(b.keyCertSign&&null!==v||(c={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:o.certificateError.bad_certificate})),null!==c||null===v||v.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:o.certificateError.bad_certificate}),null===c&&null!==b&&"pathLenConstraint"in v)l-1>v.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}var w=null===c||c.error,E=r.verify?r.verify(w,l,i):w;if(!0!==E)throw!0===w&&(c={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(E||0===E)&&("object"!==typeof E||n.util.isArray(E)?"string"===typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,a=!1,++l}while(t.length>0);return!0}},1725:e=>{"use strict";var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=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={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).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]))r.call(o,l)&&(a[l]=o[l]);if(t){s=t(o);for(var u=0;u<s.length;u++)n.call(o,s[u])&&(a[s[u]]=o[s[u]])}}return a}},9879:(e,t,r)=>{const n=r(5125),i=r(2673);e.exports=class{constructor(){this._buffer=new n,this._waitingConsumers=new n}push(e){const{promise:t,resolve:r}=i();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},2673:e=>{"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},888:(e,t,r)=>{"use strict";var n=r(9047);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,r,i,o,s){if(s!==n){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 r={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 r.PropTypes=r,r}},2007:(e,t,r)=>{e.exports=r(888)()},9047:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},886:(e,t,r)=>{"use strict";e.exports=r(4722)},4722:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(7063),n.BufferWriter=r(2815),n.Reader=r(6216),n.BufferReader=r(3557),n.util=r(3097),n.rpc=r(9994),n.roots=r(7907),n.configure=i,i()},6216:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},3557:(e,t,r)=>{"use strict";e.exports=o;var n=r(6216);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(3097);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},7907:e=>{"use strict";e.exports={}},9994:(e,t,r)=>{"use strict";t.Service=r(4281)},4281:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){s(c)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9351:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},3097:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(9351),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},7063:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(3097),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},2815:(e,t,r)=>{"use strict";e.exports=o;var n=r(7063);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(3097);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},7310:(e,t,r)=>{"use strict";e.exports=r(3641)},506:e=>{"use strict";e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},4176:(e,t,r)=>{"use strict";var n=t,i=r(9200),o=r(7159);function s(e,t,r,n){var o=!1;if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",n);for(var s=t.resolvedType.values,a=Object.keys(s),c=0;c<a.length;++c)s[a[c]]!==t.typeDefault||o||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),t.repeated||e("break"),o=!0),e("case%j:",a[c])("case %i:",s[a[c]])("m%s=%j",n,s[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,r,n);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,l)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,r,n,n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var o=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":o=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,o?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n<t.length;++n){var a=t[n].resolve(),c=o.safeProp(a.name);a.map?(r("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),s(r,a,n,c+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),s(r,a,n,c+"[i]")("}")("}")):(a.resolvedType instanceof i||r("if(d%s!=null){",c),s(r,a,n,c),a.resolvedType instanceof i||r("}"))}return r("return m")},n.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);if(!t.length)return o.codegen()("return {}");for(var r=o.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],s=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?n:t[l].map?s:c).push(t[l]);if(n.length){for(r("if(o.arrays||o.defaults){"),l=0;l<n.length;++l)r("d%s=[]",o.safeProp(n[l].name));r("}")}if(s.length){for(r("if(o.objects||o.defaults){"),l=0;l<s.length;++l)r("d%s={}",o.safeProp(s[l].name));r("}")}if(c.length){for(r("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],h=o.safeProp(u.name);if(u.resolvedType instanceof i)r("d%s=o.enums===String?%j:%j",h,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",h)("}else")("d%s=o.longs===String?%j:%i",h,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var d="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",h,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",h,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",h,h)("}")}else r("d%s=%j",h,u.typeDefault)}r("}")}var f=!1;for(l=0;l<t.length;++l){u=t[l];var p=e._fieldsArray.indexOf(u);h=o.safeProp(u.name);u.map?(f||(f=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(r,u,p,h+"[ks2[j]]")("}")):u.repeated?(r("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(r,u,p,h+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",h,u.name),a(r,u,p,h),u.partOf&&r("if(o.oneofs)")("d%s=%j",o.safeProp(u.partOf.name),u.name)),r("}")}return r("return d")}},2327:(e,t,r)=>{"use strict";e.exports=function(e){var t=o.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var a=e._fieldsArray[r].resolve(),c=a.resolvedType instanceof n?"int32":a.type,l="m"+o.safeProp(a.name);t("case %i: {",a.id),a.map?(t("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==i.defaults[a.keyType]?t("k=%j",i.defaults[a.keyType]):t("k=null"),void 0!==i.defaults[c]?t("value=%j",i.defaults[c]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===i.basic[c]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==i.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===i.basic[c]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,r):t("%s.push(r.%s())",l,c)):void 0===i.basic[c]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,r):t("%s=r.%s()",l,c),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var u=e._fieldsArray[r];u.required&&t("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",s(u))}return t("return m")};var n=r(9200),i=r(2688),o=r(7159);function s(e){return"missing required '"+e.name+"'"}},2067:(e,t,r)=>{"use strict";e.exports=function(e){for(var t,r=o.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(o.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),u=e._fieldsArray.indexOf(l),h=l.resolvedType instanceof n?"int32":l.type,d=i.basic[h];t="m"+o.safeProp(l.name),l.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|i.mapKey[l.keyType],l.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),r("}")("}")):l.repeated?(r("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==i.packed[h]?r("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?s(r,l,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,h,t)),r("}")):(l.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?s(r,l,u,t):r("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,h,t))}return r("return w")};var n=r(9200),i=r(2688),o=r(7159);function s(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},9200:(e,t,r)=>{"use strict";e.exports=s;var n=r(8871);((s.prototype=Object.create(n.prototype)).constructor=s).className="Enum";var i=r(4226),o=r(7159);function s(e,t,r,i,o,s){if(n.call(this,e,r),t&&"object"!==typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=o||{},this.valuesOptions=s,this.reserved=void 0,t)for(var a=Object.keys(t),c=0;c<a.length;++c)"number"===typeof t[a[c]]&&(this.valuesById[this.values[a[c]]=t[a[c]]]=a[c])}s.fromJSON=function(e,t){var r=new s(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},s.prototype.add=function(e,t,r,n){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return n&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=n||null),this.comments[e]=r||null,this},s.prototype.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},s.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},s.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},8771:(e,t,r)=>{"use strict";e.exports=l;var n=r(8871);((l.prototype=Object.create(n.prototype)).constructor=l).className="Field";var i,o=r(9200),s=r(2688),a=r(7159),c=/^required|optional|repeated$/;function l(e,t,r,i,o,l,u){if(a.isObject(i)?(u=o,l=i,i=o=void 0):a.isObject(o)&&(u=l,l=o,o=void 0),n.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==i&&!c.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==o&&!a.isString(o))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=r,this.id=t,this.extend=o||void 0,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==s.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=s.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&"string"===typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof o)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"===typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},l.d=function(e,t,r,n){return"function"===typeof t?t=a.decorateType(t).name:t&&"object"===typeof t&&(t=a.decorateEnum(t).name),function(i,o){a.decorateType(i.constructor).add(new l(o,e,t,r,{default:n}))}},l._configure=function(e){i=e}},1324:(e,t,r)=>{"use strict";var n=e.exports=r(5656);n.build="light",n.load=function(e,t,r){return"function"===typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(2067),n.decoder=r(2327),n.verifier=r(4196),n.converter=r(4176),n.ReflectionObject=r(8871),n.Namespace=r(4226),n.Root=r(5998),n.Enum=r(9200),n.Type=r(3936),n.Field=r(8771),n.OneOf=r(6604),n.MapField=r(4483),n.Service=r(9730),n.Method=r(5762),n.Message=r(4375),n.wrappers=r(8003),n.types=r(2688),n.util=r(7159),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},5656:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(1748),n.BufferWriter=r(4080),n.Reader=r(95),n.BufferReader=r(8418),n.util=r(7469),n.rpc=r(2328),n.roots=r(1858),n.configure=i,i()},3641:(e,t,r)=>{"use strict";var n=e.exports=r(1324);n.build="full",n.tokenize=r(4794),n.parse=r(3924),n.common=r(506),n.Root._configure(n.Type,n.parse,n.common)},4483:(e,t,r)=>{"use strict";e.exports=s;var n=r(8771);((s.prototype=Object.create(n.prototype)).constructor=s).className="MapField";var i=r(2688),o=r(7159);function s(e,t,r,i,s,a){if(n.call(this,e,t,i,void 0,void 0,s,a),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},s.d=function(e,t,r){return"function"===typeof r?r=o.decorateType(r).name:r&&"object"===typeof r&&(r=o.decorateEnum(r).name),function(n,i){o.decorateType(n.constructor).add(new s(i,e,t,r))}}},4375:(e,t,r)=>{"use strict";e.exports=i;var n=r(7469);function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)}},5762:(e,t,r)=>{"use strict";e.exports=o;var n=r(8871);((o.prototype=Object.create(n.prototype)).constructor=o).className="Method";var i=r(7159);function o(e,t,r,o,s,a,c,l,u){if(i.isObject(s)?(c=s,s=a=void 0):i.isObject(a)&&(c=a,a=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(r))throw TypeError("requestType must be a string");if(!i.isString(o))throw TypeError("responseType must be a string");n.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=o,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}o.fromJSON=function(e,t){return new o(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},o.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},4226:(e,t,r)=>{"use strict";e.exports=h;var n=r(8871);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var i,o,s,a=r(8771),c=r(7159),l=r(6604);function u(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function h(e,t){n.call(this,e,t),this.nested=void 0,this._nestedArray=null}function d(e){return e._nestedArray=null,e}h.fromJSON=function(e,t){return new h(e,t.options).addJSON(t.nested)},h.arrayToJSON=u,h.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!==typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=c.toArray(this.nested))}}),h.prototype.toJSON=function(e){return c.toObject(["options",this.options,"nested",u(this.nestedArray,e)])},h.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),n=0;n<r.length;++n)t=e[r[n]],this.add((void 0!==t.fields?i.fromJSON:void 0!==t.values?s.fromJSON:void 0!==t.methods?o.fromJSON:void 0!==t.id?a.fromJSON:h.fromJSON)(r[n],t));return this},h.prototype.get=function(e){return this.nested&&this.nested[e]||null},h.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof s)return this.nested[e].values;throw Error("no such enum: "+e)},h.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof i||e instanceof l||e instanceof s||e instanceof o||e instanceof h))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof h&&e instanceof h)||t instanceof i||t instanceof o)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,n=0;n<r.length;++n)e.add(r[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),d(this)},h.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},h.prototype.define=function(e,t){if(c.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else r.add(r=new h(n))}return t&&r.addJSON(t),r},h.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof h?e[t++].resolveAll():e[t++].resolve();return this.resolve()},h.prototype.lookup=function(e,t,r){if("boolean"===typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),c.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof h&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof h&&(n=this._nestedArray[i].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},h.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},h.prototype.lookupEnum=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},h.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,s]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},h.prototype.lookupService=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},h._configure=function(e,t,r){i=e,o=t,s=r}},8871:(e,t,r)=>{"use strict";e.exports=o,o.className="ReflectionObject";var n,i=r(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 n&&t._handleAdd(this)},o.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},o.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},o.prototype.getOption=function(e){if(this.options)return this.options[e]},o.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},o.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var o=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(o){var s=o[e];i.setProperty(s,r,t)}else(o={})[e]=i.setProperty({},r,t),n.push(o)}else{var a={};a[e]=t,n.push(a)}return this},o.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},o.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},o._configure=function(e){n=e}},6604:(e,t,r)=>{"use strict";e.exports=s;var n=r(8871);((s.prototype=Object.create(n.prototype)).constructor=s).className="OneOf";var i=r(8771),o=r(7159);function s(e,t,r,i){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}s.fromJSON=function(e,t){return new s(e,t.oneof,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},s.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},s.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}a(this)},s.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);n.prototype.onRemove.call(this,e)},s.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){o.decorateType(t.constructor).add(new s(r,e)),Object.defineProperty(t,r,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}}},3924:(e,t,r)=>{"use strict";e.exports=A,A.filename=null,A.defaults={keepCase:!1};var n=r(4794),i=r(5998),o=r(3936),s=r(8771),a=r(4483),c=r(6604),l=r(9200),u=r(9730),h=r(5762),d=r(2688),f=r(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,r){t instanceof i||(r=t,t=new i),r||(r=A.defaults);var T,C,k,I,R,P=r.preferTrailingComment||!1,N=n(e,r.alternateCommentMode||!1),D=N.next,x=N.push,L=N.peek,O=N.skip,B=N.cmnt,M=!0,U=!1,F=t,j=r.keepCase?function(e){return e}:f.camelCase;function z(e,t,r){var n=A.filename;return r||(A.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+N.line+")")}function V(){var e,t=[];do{if('"'!==(e=D())&&"'"!==e)throw z(e);t.push(D()),O(e),e=L()}while('"'===e||"'"===e);return t.join("")}function K(e){var t=D();switch(t){case"'":case'"':return x(t),V();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(e))return r*parseInt(e,10);if(y.test(e))return r*parseInt(e,16);if(v.test(e))return r*parseInt(e,8);if(w.test(e))return r*parseFloat(e);throw z(e,"number",t)}(t,!0)}catch(r){if(e&&_.test(t))return t;throw z(t,"value")}}function q(e,t){var r,n;do{!t||'"'!==(r=L())&&"'"!==r?e.push([n=H(D()),O("to",!0)?H(D()):n]):e.push(V())}while(O(",",!0));O(";")}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 G(){if(void 0!==T)throw z("package");if(T=D(),!_.test(T))throw z(T,"name");F=F.define(T),O(";")}function W(){var e,t=L();switch(t){case"weak":e=k||(k=[]),D();break;case"public":D();default:e=C||(C=[])}t=V(),O(";"),e.push(t)}function Q(){if(O("="),I=V(),!(U="proto3"===I)&&"proto2"!==I)throw z(I,"syntax");O(";")}function Y(e,t){switch(t){case"option":return ee(e,t),O(";"),!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 r=new u(t);$(r,(function(e){if(!Y(r,e)){if("rpc"!==e)throw z(e);!function(e,t){var r=B(),n=t;if(!E.test(t=D()))throw z(t,"name");var i,o,s,a,c=t;O("("),O("stream",!0)&&(o=!0);if(!_.test(t=D()))throw z(t);i=t,O(")"),O("returns"),O("("),O("stream",!0)&&(a=!0);if(!_.test(t=D()))throw z(t);s=t,O(")");var l=new h(c,n,i,s,o,a);l.comment=r,$(l,(function(e){if("option"!==e)throw z(e);ee(l,e),O(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!_.test(t=D()))throw z(t,"reference");var r=t;$(null,(function(t){switch(t){case"required":case"repeated":J(e,t,r);break;case"optional":J(e,U?"proto3_optional":"optional",r);break;default:if(!U||!_.test(t))throw z(t);x(t),J(e,"optional",r)}}))}(e,t),!0}return!1}function $(e,t,r){var n=N.line;if(e&&("string"!==typeof e.comment&&(e.comment=B()),e.filename=A.filename),O("{",!0)){for(var i;"}"!==(i=D());)t(i);O(";",!0)}else r&&r(),O(";"),e&&("string"!==typeof e.comment||P)&&(e.comment=B(n)||e.comment)}function X(e,t){if(!E.test(t=D()))throw z(t,"type name");var r=new o(t);$(r,(function(e){if(!Y(r,e))switch(e){case"map":!function(e){O("<");var t=D();if(void 0===d.mapKey[t])throw z(t,"type");O(",");var r=D();if(!_.test(r))throw z(r,"type");O(">");var n=D();if(!E.test(n))throw z(n,"name");O("=");var i=new a(j(n),H(D()),t,r);$(i,(function(e){if("option"!==e)throw z(e);ee(i,e),O(";")}),(function(){ne(i)})),e.add(i)}(r);break;case"required":case"repeated":J(r,e);break;case"optional":J(r,U?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!E.test(t=D()))throw z(t,"name");var r=new c(j(t));$(r,(function(e){"option"===e?(ee(r,e),O(";")):(x(e),J(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":q(r.extensions||(r.extensions=[]));break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:if(!U||!_.test(e))throw z(e);x(e),J(r,"optional")}})),e.add(r)}function J(e,t,r){var n=D();if("group"!==n){if(!_.test(n))throw z(n,"type");var i=D();if(!E.test(i))throw z(i,"name");i=j(i),O("=");var a=new s(i,H(D()),n,t,r);if($(a,(function(e){if("option"!==e)throw z(e);ee(a,e),O(";")}),(function(){ne(a)})),"proto3_optional"===t){var l=new c("_"+i);a.setOption("proto3_optional",!0),l.add(a),e.add(l)}else e.add(a);U||!a.repeated||void 0===d.packed[n]&&void 0!==d.basic[n]||a.setOption("packed",!1,!0)}else!function(e,t){var r=D();if(!E.test(r))throw z(r,"name");var n=f.lcFirst(r);r===n&&(r=f.ucFirst(r));O("=");var i=H(D()),a=new o(r);a.group=!0;var c=new s(n,i,r,t);c.filename=A.filename,$(a,(function(e){switch(e){case"option":ee(a,e),O(";");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 r=new l(t);$(r,(function(e){switch(e){case"option":ee(r,e),O(";");break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!E.test(t))throw z(t,"name");O("=");var r=H(D(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};$(n,(function(e){if("option"!==e)throw z(e);ee(n,e),O(";")}),(function(){ne(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function ee(e,t){var r=O("(",!0);if(!_.test(t=D()))throw z(t,"name");var n,i=t,o=i;r&&(O(")"),o=i="("+i+")",t=L(),S.test(t)&&(n=t.slice(1),i+=t,D())),O("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,o,te(e,i),n)}function te(e,t){if(O("{",!0)){for(var r={};!O("}",!0);){if(!E.test(R=D()))throw z(R,"name");var n,i=R;if(O(":",!0),"{"===L())n=te(e,t+"."+R);else if("["===L()){var o;if(n=[],O("[",!0)){do{o=K(!0),n.push(o)}while(O(",",!0));O("]"),"undefined"!==typeof o&&re(e,t+"."+R,o)}}else n=K(!0),re(e,t+"."+R,n);var s=r[i];s&&(n=[].concat(s).concat(n)),r[i]=n,O(",",!0),O(";",!0)}return r}var a=K(!0);return re(e,t,a),a}function re(e,t,r){e.setOption&&e.setOption(t,r)}function ne(e){if(O("[",!0)){do{ee(e,"option")}while(O(",",!0));O("]")}return e}for(;null!==(R=D());)switch(R){case"package":if(!M)throw z(R);G();break;case"import":if(!M)throw z(R);W();break;case"syntax":if(!M)throw z(R);Q();break;case"option":ee(F,R),O(";");break;default:if(Y(F,R)){M=!1;continue}throw z(R)}return A.filename=null,{package:T,imports:C,weakImports:k,syntax:I,root:t}}},95:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(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 n(e):l(e)})(e)}:l};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|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,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=u(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},8418:(e,t,r)=>{"use strict";e.exports=o;var n=r(95);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(7469);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},5998:(e,t,r)=>{"use strict";e.exports=h;var n=r(4226);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var i,o,s,a=r(8771),c=r(9200),l=r(6604),u=r(7159);function h(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},h.prototype.resolvePath=u.path.resolve,h.prototype.fetch=u.fetch,h.prototype.load=function e(t,r,n){"function"===typeof r&&(n=r,r=void 0);var i=this;if(!n)return u.asPromise(e,i,t,r);var a=n===d;function c(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in s)return r}return null}function h(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){o.filename=e;var n,s=o(t,i,r),h=0;if(s.imports)for(;h<s.imports.length;++h)(n=l(s.imports[h])||i.resolvePath(e,s.imports[h]))&&f(n);if(s.weakImports)for(h=0;h<s.weakImports.length;++h)(n=l(s.weakImports[h])||i.resolvePath(e,s.weakImports[h]))&&f(n,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(d){c(d)}a||p||c(null,i)}function f(e,t){if(e=l(e)||e,!(i.files.indexOf(e)>-1))if(i.files.push(e),e in s)a?h(e,s[e]):(++p,setTimeout((function(){--p,h(e,s[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(o){return void(t||c(o))}h(e,r)}else++p,i.fetch(e,(function(r,o){--p,n&&(r?t?p||c(null,i):c(r):h(e,o))}))}var p=0;u.isString(t)&&(t=[t]);for(var g,y=0;y<t.length;++y)(g=i.resolvePath("",t[y]))&&f(g);if(a)return i;p||c(null,i)},h.prototype.loadSync=function(e,t){if(!u.isNode)throw Error("not supported");return this.load(e,t,d)},h.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return r.get(n.name)||(n.declaringField=t,t.extensionField=n,r.add(n)),!0}return!1}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof c)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof l)){if(e instanceof i)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);f.test(e.name)&&(e.parent[e.name]=e)}},h.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);f.test(e.name)&&delete e.parent[e.name]}},h._configure=function(e,t,r){i=e,o=t,s=r}},1858:e=>{"use strict";e.exports={}},2328:(e,t,r)=>{"use strict";t.Service=r(8103)},8103:(e,t,r)=>{"use strict";e.exports=i;var n=r(7469);function i(e,t,r){if("function"!==typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){s(c)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9730:(e,t,r)=>{"use strict";e.exports=a;var n=r(4226);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var i=r(5762),o=r(7159),s=r(2328);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),o=0;o<n.length;++o)r.add(i.fromJSON(n[o],t.methods[n[o]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||void 0,"methods",n.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||n.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return n.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,c(this)):n.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,c(this)}return n.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var n,i=new s.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var c=o.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[c]=o.codegen(["r","c"],o.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return i}},4794:e=>{"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,o=/^\s*\*?\/*/,s=/\n/g,a=/\s/,c=/\\(.?)/g,l={0:"\0",r:"\r",n:"\n",t:"\t"};function u(e){return e.replace(c,(function(e,t){switch(t){case"\\":case"":return t;default:return l[t]||""}}))}function h(e,c){e=e.toString();var l=0,h=e.length,d=1,f=0,p={},g=[],y=null;function m(e){return Error("illegal "+e+" (line "+d+")")}function v(t){return e.charAt(t)}function b(t,r,n){var a,l={type:e.charAt(t++),lineEmpty:!1,leading:n},u=t-(c?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){l.lineEmpty=!0;break}}while(" "===a||"\t"===a);for(var h=e.substring(t,r).split(s),g=0;g<h.length;++g)h[g]=h[g].replace(c?o:i,"").trim();l.text=h.join("\n").trim(),p[d]=l,f=d}function w(t){var r=E(t),n=e.substring(t,r);return/^\s*\/{1,2}/.test(n)}function E(e){for(var t=e;t<h&&"\n"!==v(t);)t++;return t}function _(){if(g.length>0)return g.shift();if(y)return function(){var t="'"===y?n:r;t.lastIndex=l-1;var i=t.exec(e);if(!i)throw m("string");return l=t.lastIndex,S(y),y=null,u(i[1])}();var i,o,s,f,p,_=0===l;do{if(l===h)return null;for(i=!1;a.test(s=v(l));)if("\n"===s&&(_=!0,++d),++l===h)return null;if("/"===v(l)){if(++l===h)throw m("comment");if("/"===v(l))if(c){if(f=l,p=!1,w(l)){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 T=e.substring(l,l=A);return'"'!==T&&"'"!==T||(y=T),T}function S(e){g.push(e)}function A(){if(!g.length){var e=_();if(null===e)return null;S(e)}return g[0]}return Object.defineProperty({next:_,peek:A,push:S,skip:function(e,t){var r=A();if(r===e)return _(),!0;if(!t)throw m("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t,r=null;return void 0===e?(t=p[d-1],delete p[d-1],t&&(c||"*"===t.type||t.lineEmpty)&&(r=t.leading?t.text:null)):(f<e&&A(),t=p[e],delete p[e],!t||t.lineEmpty||!c&&"/"!==t.type||(r=t.leading?null:t.text)),r}},"line",{get:function(){return d}})}h.unescape=u},3936:(e,t,r)=>{"use strict";e.exports=v;var n=r(4226);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var i=r(9200),o=r(6604),s=r(8771),a=r(4483),c=r(9730),l=r(4375),u=r(95),h=r(1748),d=r(7159),f=r(2067),p=r(2327),g=r(4196),y=r(4176),m=r(8003);function v(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof l||((e.prototype=new l).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,l,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:d.oneOfGetter(this._oneofsArray[r].oneof),set:d.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),v.generateConstructor=function(e){for(var t,r=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",d.safeProp(t.name)):t.repeated&&r("this%s=[]",d.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var l=Object.keys(t.fields),u=0;u<l.length;++u)r.add(("undefined"!==typeof t.fields[l[u]].keyType?a.fromJSON:s.fromJSON)(l[u],t.fields[l[u]]));if(t.oneofs)for(l=Object.keys(t.oneofs),u=0;u<l.length;++u)r.add(o.fromJSON(l[u],t.oneofs[l[u]]));if(t.nested)for(l=Object.keys(t.nested),u=0;u<l.length;++u){var h=t.nested[l[u]];r.add((void 0!==h.id?s.fromJSON:void 0!==h.fields?v.fromJSON:void 0!==h.values?i.fromJSON:void 0!==h.methods?c.fromJSON:n.fromJSON)(l[u],h))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return d.toObject(["options",t&&t.options||void 0,"oneofs",n.arrayToJSON(this.oneofsArray,e),"fields",n.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return n.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof s&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof o?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):n.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof s&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof o){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return n.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=f(this)({Writer:h,types:t,util:d}),this.decode=p(this)({Reader:u,types:t,util:d}),this.verify=g(this)({types:t,util:d}),this.fromObject=y.fromObject(this)({types:t,util:d}),this.toObject=y.toObject(this)({types:t,util:d});var n=m[e];if(n){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(i),i.toObject=this.toObject,this.toObject=n.toObject.bind(i)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){d.decorateType(t,e)}}},2688:(e,t,r)=>{"use strict";var n=t,i=r(7159),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var r=0,n={};for(t|=0;r<e.length;)n[o[r+t]]=e[r++];return n}n.basic=s([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=s([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),n.long=s([0,0,0,1,1],7),n.mapKey=s([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=s([1,5,0,0,0,5,5,0,0,0,1,1,0])},7159:(e,t,r)=>{"use strict";var n,i,o=e.exports=r(7469),s=r(1858);o.codegen=r(3297),o.fetch=r(7635),o.path=r(7468),o.fs=o.inquire("fs"),o.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},o.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],i=e[r++];void 0!==i&&(t[n]=i)}return t};var a=/\\/g,c=/"/g;o.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},o.safeProp=function(e){return!/^[$\w_]+$/.test(e)||o.isReserved(e)?'["'+e.replace(a,"\\\\").replace(c,'\\"')+'"]':"."+e},o.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var l=/_([a-z])/g;o.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(l,(function(e,t){return t.toUpperCase()}))},o.compareFieldsById=function(e,t){return e.id-t.id},o.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(o.decorateRoot.remove(e.$type),e.$type.name=t,o.decorateRoot.add(e.$type)),e.$type;n||(n=r(3936));var i=new n(t||e.name);return o.decorateRoot.add(i),i.ctor=e,Object.defineProperty(e,"$type",{value:i,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:i,enumerable:!1}),i};var u=0;o.decorateEnum=function(e){if(e.$type)return e.$type;i||(i=r(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,r){if("object"!==typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var i=r.shift();if("__proto__"===i)return t;if(r.length>0)t[i]=e(t[i]||{},r,n);else{var o=t[i];o&&(n=[].concat(o).concat(n)),t[i]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(o,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(r(5998)))}})},1537:(e,t,r)=>{"use strict";e.exports=i;var n=r(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 r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},7469:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function o(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(7206),n.base64=r(1),n.EventEmitter=r(7111),n.float=r(802),n.inquire=r(7172),n.utf8=r(3861),n.pool=r(8236),n.LongBits=r(1537),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"===typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"===typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!==typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},4196:(e,t,r)=>{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,n={};r.length&&t("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),u="m"+i.safeProp(l.name);if(l.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map)t("if(!util.isObject(%s))",u)("return%j",o(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),a(t,l,"k[i]"),s(t,l,c,u+"[k[i]]")("}");else if(l.repeated)t("if(!Array.isArray(%s))",u)("return%j",o(l,"array"))("for(var i=0;i<%s.length;++i){",u),s(t,l,c,u+"[i]")("}");else{if(l.partOf){var h=i.safeProp(l.partOf.name);1===n[l.partOf.name]&&t("if(p%s===1)",h)("return%j",l.partOf.name+": multiple values"),n[l.partOf.name]=1,t("p%s=1",h)}s(t,l,c,u)}l.optional&&t("}")}return t("return null")};var n=r(9200),i=r(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,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(%s){",i)("default:")("return%j",o(t,"enum value"));for(var s=Object.keys(t.resolvedType.values),a=0;a<s.length;++a)e("case %i:",t.resolvedType.values[s[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",o(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",o(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",o(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",o(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",o(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",o(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",o(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",o(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",o(t,"boolean key"))}return e}},8003:(e,t,r)=>{"use strict";var n=t,i=r(4375);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var o=this.lookup(n);o&&(e=o.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var s=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=n,s}return this.toObject(e,t)}}},1748:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(7469),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function y(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},h.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},h.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(y,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=o.from(e);return this._push(y,4,t.lo)._push(y,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},h.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},h.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},h._configure=function(e){n=e,h.create=d(),n._configure()}},4080:(e,t,r)=>{"use strict";e.exports=o;var n=r(1748);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(7469);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},7896:(e,t,r)=>{const n=r(8139),i=r(5339),o=r(4052),s=r(3654),{RateLimiterClusterMaster:a,RateLimiterClusterMasterPM2:c,RateLimiterCluster:l}=r(5503),u=r(2408),h=r(8134),d=r(5e3),f=r(4066),p=r(3081),g=r(438),y=r(4819);e.exports={RateLimiterRedis:n,RateLimiterMongo:i,RateLimiterMySQL:o,RateLimiterPostgres:s,RateLimiterMemory:u,RateLimiterMemcache:h,RateLimiterClusterMaster:a,RateLimiterClusterMasterPM2:c,RateLimiterCluster:l,RLWrapperBlackAndWhite:d,RateLimiterUnion:f,RateLimiterQueue:p,BurstyRateLimiter:g,RateLimiterRes:y}},438:(e,t,r)=>{const n=r(4819);e.exports=class{constructor(e,t){this._rateLimiter=e,this._burstLimiter=t}_combineRes(e,t){return new n(e.remainingPoints,Math.min(e.msBeforeNext,t.msBeforeNext),e.consumedPoints,e.isFirstInDuration)}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._rateLimiter.consume(e,t,r).catch((i=>i instanceof n?this._burstLimiter.consume(e,t,r).then((e=>Promise.resolve(this._combineRes(i,e)))).catch((e=>e instanceof n?Promise.reject(this._combineRes(i,e)):Promise.reject(e))):Promise.reject(i)))}get(e){return Promise.all([this._rateLimiter.get(e),this._burstLimiter.get(e)]).then((e=>{let[t,r]=e;return this._combineRes(t,r)}))}get points(){return this._rateLimiter.points}}},5e3:(e,t,r)=>{const n=r(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 n(0,Number.MAX_SAFE_INTEGER,0,!1)}getWhiteRes(){return new n(Number.MAX_SAFE_INTEGER,0,0,!1)}rejectBlack(){return Promise.reject(this.getBlackRes())}resolveBlack(){return Promise.resolve(this.getBlackRes())}resolveWhite(){return Promise.resolve(this.getWhiteRes())}consume(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.isWhiteListedSomewhere(e)?t=this.resolveWhite():this.isBlackListedSomewhere(e)&&(t=this.rejectBlack()),"undefined"===typeof t?this.limiter.consume(e,r):(this.runActionAnyway&&this.limiter.consume(e,r).catch((()=>{})),t)}block(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.block(e,t):(this.runActionAnyway&&this.limiter.block(e,t).catch((()=>{})),r)}penalty(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.penalty(e,t):(this.runActionAnyway&&this.limiter.penalty(e,t).catch((()=>{})),r)}reward(e,t){let r;return this.isWhiteListedSomewhere(e)?r=this.resolveWhite():this.isBlackListedSomewhere(e)&&(r=this.resolveBlack()),"undefined"===typeof r?this.limiter.reward(e,t):(this.runActionAnyway&&this.limiter.reward(e,t).catch((()=>{})),r)}get(e){let t;return this.isWhiteListedSomewhere(e)?t=this.resolveWhite():this.isBlackListedSomewhere(e)&&(t=this.resolveBlack()),"undefined"===typeof t||this.runActionAnyway?this.limiter.get(e):t}delete(e){return this.limiter.delete(e)}}},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,r)=>{const n=r(1265),i=r(5539),o=r(8855),s=r(2408),a=r(4819),c="rate_limiter_flexible";let l=null;const u=function(e,t,r,n){let i;i=null===n||!0===n||!1===n?n:{remainingPoints:n.remainingPoints,msBeforeNext:n.msBeforeNext,consumedPoints:n.consumedPoints,isFirstInDuration:n.isFirstInDuration},e.send({channel:c,keyPrefix:t.keyPrefix,promiseId:t.promiseId,type:r,data:i})},h=function(e){setTimeout((()=>{this._initiated?process.send(e):"undefined"!==typeof this._promises[e.promiseId]&&h.call(this,e)}),30)},d=function(e,t,r,n,i){const o={channel:c,keyPrefix:this.keyPrefix,func:e,promiseId:t,data:{key:r,arg:n,opts:i}};this._initiated?process.send(o):h.call(this,o)},f=function(e,t){if(!t||t.channel!==c||"undefined"===typeof this._rateLimiters[t.keyPrefix])return!1;let r;switch(t.func){case"consume":r=this._rateLimiters[t.keyPrefix].consume(t.data.key,t.data.arg,t.data.opts);break;case"penalty":r=this._rateLimiters[t.keyPrefix].penalty(t.data.key,t.data.arg,t.data.opts);break;case"reward":r=this._rateLimiters[t.keyPrefix].reward(t.data.key,t.data.arg,t.data.opts);break;case"block":r=this._rateLimiters[t.keyPrefix].block(t.data.key,t.data.arg,t.data.opts);break;case"get":r=this._rateLimiters[t.keyPrefix].get(t.data.key,t.data.opts);break;case"delete":r=this._rateLimiters[t.keyPrefix].delete(t.data.key,t.data.opts);break;default:return!1}r&&r.then((r=>{u(e,t,"resolve",r)})).catch((r=>{u(e,t,"reject",r)}))},p=function(e){if(!e||e.channel!==c||e.keyPrefix!==this.keyPrefix)return!1;if(this._promises[e.promiseId]){let t;switch(clearTimeout(this._promises[e.promiseId].timeoutId),t=null===e.data||!0===e.data||!1===e.data?e.data:new a(e.data.remainingPoints,e.data.msBeforeNext,e.data.consumedPoints,e.data.isFirstInDuration),e.type){case"resolve":this._promises[e.promiseId].resolve(t);break;case"reject":this._promises[e.promiseId].reject(t);break;default:throw new Error("RateLimiterCluster: no such message type '".concat(e.type,"'"))}delete this._promises[e.promiseId]}},g=function(){return{points:this.points,duration:this.duration,blockDuration:this.blockDuration,execEvenly:this.execEvenly,execEvenlyMinDelayMs:this.execEvenlyMinDelayMs,keyPrefix:this.keyPrefix}},y=function(e,t){const r=process.hrtime();let n=r[0].toString()+r[1].toString();return"undefined"!==typeof this._promises[n]&&(n+=i.randomBytes(12).toString("base64")),this._promises[n]={resolve:e,reject:t,timeoutId:setTimeout((()=>{delete this._promises[n],t(new Error("RateLimiterCluster timeout: no answer from master in time"))}),this.timeoutMs)},n};e.exports={RateLimiterClusterMaster:class{constructor(){if(l)return l;this._rateLimiters={},n.setMaxListeners(0),n.on("message",((e,t)=>{t&&t.channel===c&&"init"===t.type?("undefined"===typeof this._rateLimiters[t.opts.keyPrefix]&&(this._rateLimiters[t.opts.keyPrefix]=new s(t.opts)),e.send({channel:c,type:"init",keyPrefix:t.opts.keyPrefix})):f.call(this,e,t)})),l=this}},RateLimiterClusterMasterPM2:class{constructor(e){if(l)return l;this._rateLimiters={},e.launchBus(((t,r)=>{r.on("process:msg",(t=>{const r=t.raw;if(r&&r.channel===c&&"init"===r.type)"undefined"===typeof this._rateLimiters[r.opts.keyPrefix]&&(this._rateLimiters[r.opts.keyPrefix]=new s(r.opts)),e.sendDataToProcessId(t.process.pm_id,{data:{},topic:c,channel:c,type:"init",keyPrefix:r.opts.keyPrefix},((e,t)=>{e&&console.log(e,t)}));else{f.call(this,{send:r=>{const n=r;n.topic=c,"undefined"===typeof n.data&&(n.data={}),e.sendDataToProcessId(t.process.pm_id,n,((e,t)=>{e&&console.log(e,t)}))}},r)}}))})),l=this}},RateLimiterCluster:class extends o{get timeoutMs(){return this._timeoutMs}set timeoutMs(e){this._timeoutMs="undefined"===typeof e?5e3:Math.abs(parseInt(e))}constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),process.setMaxListeners(0),this.timeoutMs=e.timeoutMs,this._initiated=!1,process.on("message",(e=>{e&&e.channel===c&&"init"===e.type&&e.keyPrefix===this.keyPrefix?this._initiated=!0:p.call(this,e)})),process.send({channel:c,type:"init",opts:g.call(this)}),this._promises={}}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"consume",o,e,t,r)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"penalty",o,e,t,r)}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"reward",o,e,t,r)}))}block(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=y.call(this,n,i);d.call(this,"block",o,e,t,r)}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{const i=y.call(this,r,n);d.call(this,"get",i,e,t)}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{const i=y.call(this,r,n);d.call(this,"delete",i,e,t)}))}}}},8134:(e,t,r)=>{const n=r(1434),i=r(4819);e.exports=class extends n{constructor(e){super(e),this.client=e.storeClient}_getRateLimiterRes(e,t,r){const n=new i;return n.consumedPoints=parseInt(r.consumedPoints),n.isFirstInDuration=r.consumedPoints===t,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=r.msBeforeNext,n}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return new Promise(((o,s)=>{const a=Date.now(),c=Math.floor(r/1e3);n?this.client.set(e,t,c,(r=>{r?s(r):this.client.set("".concat(e,"_expire"),c>0?a+1e3*c:-1,c,(()=>{o({consumedPoints:t,msBeforeNext:c>0?1e3*c:-1})}))})):this.client.incr(e,t,((l,u)=>{l||!1===u?this.client.add(e,t,c,((l,u)=>{if(l||!u)if("undefined"===typeof i.attemptNumber||i.attemptNumber<3){const a=Object.assign({},i);a.attemptNumber=a.attemptNumber?a.attemptNumber+1:1,this._upsert(e,t,r,n,a).then((e=>o(e))).catch((e=>s(e)))}else s(new Error("Can not add key"));else this.client.add("".concat(e,"_expire"),c>0?a+1e3*c:-1,c,(()=>{o({consumedPoints:t,msBeforeNext:c>0?1e3*c:-1})}))})):this.client.get("".concat(e,"_expire"),((e,t)=>{if(e)s(e);else{const e=!1===t?0:t,r={consumedPoints:u,msBeforeNext:e>=0?Math.max(e-a,0):-1};o(r)}}))}))}))}_get(e){return new Promise(((t,r)=>{const n=Date.now();this.client.get(e,((i,o)=>{o?this.client.get("".concat(e,"_expire"),((e,i)=>{if(e)r(e);else{const e=!1===i?0:i,r={consumedPoints:o,msBeforeNext:e>=0?Math.max(e-n,0):-1};t(r)}})):t(null)}))}))}_delete(e){return new Promise(((t,r)=>{this.client.del(e,((n,i)=>{n?r(n):!1===i?t(i):this.client.del("".concat(e,"_expire"),(e=>{e?r(e):t(i)}))}))}))}}},2408:(e,t,r)=>{const n=r(8855),i=r(4327),o=r(4819);e.exports=class extends n{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this._memoryStorage=new i}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const o=this.getKey(e),s=this._getKeySecDuration(r);let a=this._memoryStorage.incrby(o,t,s);if(a.remainingPoints=Math.max(this.points-a.consumedPoints,0),a.consumedPoints>this.points)this.blockDuration>0&&a.consumedPoints<=this.points+t&&(a=this._memoryStorage.set(o,a.consumedPoints,this.blockDuration)),i(a);else if(this.execEvenly&&a.msBeforeNext>0&&!a.isFirstInDuration){let e=Math.ceil(a.msBeforeNext/(a.remainingPoints+2));e<this.execEvenlyMinDelayMs&&(e=a.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(n,e,a)}else n(a)}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(r),o=this._memoryStorage.incrby(n,t,i);o.remainingPoints=Math.max(this.points-o.consumedPoints,0),e(o)}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise((e=>{const i=this._getKeySecDuration(r),o=this._memoryStorage.incrby(n,-t,i);o.remainingPoints=Math.max(this.points-o.consumedPoints,0),e(o)}))}block(e,t){const r=1e3*t,n=this.points+1;return this._memoryStorage.set(this.getKey(e),n,t),Promise.resolve(new o(0,0===r?-1:r,n))}set(e,t,r){const n=1e3*(r>=0?r:this.duration);return this._memoryStorage.set(this.getKey(e),t,r),Promise.resolve(new o(0,0===n?-1:n,t))}get(e){const t=this._memoryStorage.get(this.getKey(e));return null!==t&&(t.remainingPoints=Math.max(this.points-t.consumedPoints,0)),Promise.resolve(t)}delete(e){return Promise.resolve(this._memoryStorage.delete(this.getKey(e)))}}},5339:(e,t,r)=>{const n=r(1434),i=r(4819);function o(e){try{const t=e.client?e.client:e,{version:r}=t.topology.s.options.metadata.driver,n=r.split(".").map((e=>parseInt(e)));return{major:n[0],feature:n[1],patch:n[2]}}catch(t){return{major:0,feature:0,patch:0}}}class s extends n{constructor(e){super(e),this.dbName=e.dbName,this.tableName=e.tableName,this.indexKeyPrefix=e.indexKeyPrefix,e.mongo?this.client=e.mongo:this.client=e.storeClient,"function"===typeof this.client.then?this.client.then((e=>{this.client=e,this._initCollection(),this._driverVersion=o(this.client)})):(this._initCollection(),this._driverVersion=o(this.client))}get dbName(){return this._dbName}set dbName(e){this._dbName="undefined"===typeof e?s.getDbName():e}static getDbName(){return"node-rate-limiter-flexible"}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get client(){return this._client}set client(e){if("undefined"===typeof e)throw new Error("mongo is not set");this._client=e}get indexKeyPrefix(){return this._indexKeyPrefix}set indexKeyPrefix(e){this._indexKeyPrefix=e||{}}_initCollection(){const e=("function"===typeof this.client.db?this.client.db(this.dbName):this.client).collection(this.tableName);e.createIndex({expire:-1},{expireAfterSeconds:0}),e.createIndex(Object.assign({},this.indexKeyPrefix,{key:1}),{unique:!0}),this._collection=e}_getRateLimiterRes(e,t,r){const n=new i;let o;return o="undefined"===typeof r.value?r:r.value,n.isFirstInDuration=o.points===t,n.consumedPoints=o.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=null!==o.expire?Math.max(new Date(o.expire).getTime()-Date.now(),0):-1,n}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const o=i.attrs||{};let s,a;n?(s={key:e},s=Object.assign(s,o),a={$set:{key:e,points:t,expire:r>0?new Date(Date.now()+r):null}},a.$set=Object.assign(a.$set,o)):(s={$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}],key:e},s=Object.assign(s,o),a={$setOnInsert:{key:e,expire:r>0?new Date(Date.now()+r):null},$inc:{points:t}},a.$setOnInsert=Object.assign(a.$setOnInsert,o));const c={upsert:!0};return this._driverVersion.major>=4||3===this._driverVersion.major&&this._driverVersion.feature>=7||this._driverVersion.feature>=6&&this._driverVersion.patch>=7?c.returnDocument="after":c.returnOriginal=!1,new Promise(((i,l)=>{this._collection.findOneAndUpdate(s,a,c).then((e=>{i(e)})).catch((s=>{if(s&&11e3===s.code){const s=Object.assign({$or:[{expire:{$lte:new Date}},{expire:{$eq:null}}],key:e},o),a={$set:Object.assign({key:e,points:t,expire:r>0?new Date(Date.now()+r):null},o)};this._collection.findOneAndUpdate(s,a,c).then((e=>{i(e)})).catch((o=>{o&&11e3===o.code?this._upsert(e,t,r,n).then((e=>i(e))).catch((e=>l(e))):l(o)}))}else l(s)}))}))}_get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const r=t.attrs||{},n=Object.assign({key:e,$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}]},r);return this._collection.findOne(n)}_delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));const r=t.attrs||{},n=Object.assign({key:e},r);return this._collection.deleteOne(n).then((e=>e.deletedCount>0))}}e.exports=s},4052:(e,t,r)=>{const n=r(1434),i=r(4819);e.exports=class extends n{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e),this.client=e.storeClient,this.clientType=e.storeType,this.dbName=e.dbName,this.tableName=e.tableName,this.clearExpiredByTimeout=e.clearExpiredByTimeout,this.tableCreated=e.tableCreated,this.tableCreated?(this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()):this._createDbAndTable().then((()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()})).catch((e=>{if("function"!==typeof t)throw e;t(e)}))}clearExpired(e){return new Promise((t=>{this._getConnection().then((r=>{r.query("DELETE FROM ??.?? WHERE expire < ?",[this.dbName,this.tableName,e],(()=>{this._releaseConnection(r),t()}))})).catch((()=>{t()}))}))}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout((()=>{this.clearExpired(Date.now()-36e5).then((()=>{this._clearExpiredHourAgo()}))}),3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":return new Promise(((e,t)=>{this.client.getConnection(((r,n)=>{if(r)return t(r);e(n)}))}));case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();default:return Promise.resolve(this.client)}}_releaseConnection(e){switch(this.clientType){case"pool":return e.release();case"sequelize":return this.client.connectionManager.releaseConnection(e);case"knex":return this.client.client.releaseConnection(e);default:return!0}}_createDbAndTable(){return new Promise(((e,t)=>{this._getConnection().then((r=>{r.query("CREATE DATABASE IF NOT EXISTS `".concat(this.dbName,"`;"),(n=>{if(n)return this._releaseConnection(r),t(n);r.query(this._getCreateTableStmt(),(n=>{if(n)return this._releaseConnection(r),t(n);this._releaseConnection(r),e()}))}))})).catch((e=>{t(e)}))}))}_getCreateTableStmt(){return"CREATE TABLE IF NOT EXISTS `".concat(this.dbName,"`.`").concat(this.tableName,"` (")+"`key` VARCHAR(255) CHARACTER SET utf8 NOT NULL,`points` INT(9) NOT NULL default 0,`expire` BIGINT UNSIGNED,PRIMARY KEY (`key`)) ENGINE = INNODB;"}get clientType(){return this._clientType}set clientType(e){if("undefined"===typeof e)if("Connection"===this.client.constructor.name)e="connection";else if("Pool"===this.client.constructor.name)e="pool";else{if("Sequelize"!==this.client.constructor.name)throw new Error("storeType is not defined");e="sequelize"}this._clientType=e.toLowerCase()}get dbName(){return this._dbName}set dbName(e){this._dbName="undefined"===typeof e?"rtlmtrflx":e}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get tableCreated(){return this._tableCreated}set tableCreated(e){this._tableCreated="undefined"!==typeof e&&!!e}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(e){this._clearExpiredByTimeout="undefined"===typeof e||Boolean(e)}_getRateLimiterRes(e,t,r){const n=new i,[o]=r;return n.isFirstInDuration=t===o.points,n.consumedPoints=n.isFirstInDuration?t:o.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=o.expire?Math.max(o.expire-Date.now(),0):-1,n}_upsertTransaction(e,t,r,n,i){return new Promise(((o,s)=>{e.query("BEGIN",(a=>{if(a)return e.rollback(),s(a);const c=Date.now(),l=n>0?c+n:null;let u,h;i?(u="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = ?, \n expire = ?;",h=[this.dbName,this.tableName,t,r,l,r,l]):(u="INSERT INTO ??.?? VALUES (?, ?, ?)\n ON DUPLICATE KEY UPDATE \n points = IF(expire <= ?, ?, points + (?)), \n expire = IF(expire <= ?, ?, expire);",h=[this.dbName,this.tableName,t,r,l,c,r,r,c,l]),e.query(u,h,(r=>{if(r)return e.rollback(),s(r);e.query("SELECT points, expire FROM ??.?? WHERE `key` = ?;",[this.dbName,this.tableName,t],((t,r)=>{if(t)return e.rollback(),s(t);e.query("COMMIT",(t=>{if(t)return e.rollback(),s(t);o(r)}))}))}))}))}))}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.tableCreated?new Promise(((i,o)=>{this._getConnection().then((s=>{this._upsertTransaction(s,e,t,r,n).then((e=>{i(e),this._releaseConnection(s)})).catch((e=>{o(e),this._releaseConnection(s)}))})).catch((e=>{o(e)}))})):Promise.reject(Error("Table is not created yet"))}_get(e){return this.tableCreated?new Promise(((t,r)=>{this._getConnection().then((n=>{n.query("SELECT points, expire FROM ??.?? WHERE `key` = ? AND (`expire` > ? OR `expire` IS NULL)",[this.dbName,this.tableName,e,Date.now()],((e,i)=>{e?r(e):0===i.length?t(null):t(i),this._releaseConnection(n)}))})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}_delete(e){return this.tableCreated?new Promise(((t,r)=>{this._getConnection().then((n=>{n.query("DELETE FROM ??.?? WHERE `key` = ?",[this.dbName,this.tableName,e],((e,i)=>{e?r(e):t(i.affectedRows>0),this._releaseConnection(n)}))})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}}},3654:(e,t,r)=>{const n=r(1434),i=r(4819);e.exports=class extends n{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e),this.client=e.storeClient,this.clientType=e.storeType,this.tableName=e.tableName,this.clearExpiredByTimeout=e.clearExpiredByTimeout,this.tableCreated=e.tableCreated,this.tableCreated?"function"===typeof t&&t():this._createTable().then((()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),"function"===typeof t&&t()})).catch((e=>{if("function"!==typeof t)throw e;t(e)}))}clearExpired(e){return new Promise((t=>{const r={name:"rlflx-clear-expired",text:"DELETE FROM ".concat(this.tableName," WHERE expire < $1"),values:[e]};this._query(r).then((()=>{t()})).catch((()=>{t()}))}))}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout((()=>{this.clearExpired(Date.now()-36e5).then((()=>{this._clearExpiredHourAgo()}))}),3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":default:return Promise.resolve(this.client);case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();case"typeorm":return Promise.resolve(this.client.driver.master)}}_releaseConnection(e){switch(this.clientType){case"pool":case"typeorm":default:return!0;case"sequelize":return this.client.connectionManager.releaseConnection(e);case"knex":return this.client.client.releaseConnection(e)}}_createTable(){return new Promise(((e,t)=>{this._query({text:this._getCreateTableStmt()}).then((()=>{e()})).catch((r=>{"23505"===r.code?e():t(r)}))}))}_getCreateTableStmt(){return"CREATE TABLE IF NOT EXISTS ".concat(this.tableName," ( \n key varchar(255) PRIMARY KEY,\n points integer NOT NULL DEFAULT 0,\n expire bigint\n );")}get clientType(){return this._clientType}set clientType(e){const t=this.client.constructor.name;if("undefined"===typeof e)if("Client"===t)e="client";else if("Pool"===t||"BoundPool"===t)e="pool";else{if("Sequelize"!==t)throw new Error("storeType is not defined");e="sequelize"}this._clientType=e.toLowerCase()}get tableName(){return this._tableName}set tableName(e){this._tableName="undefined"===typeof e?this.keyPrefix:e}get tableCreated(){return this._tableCreated}set tableCreated(e){this._tableCreated="undefined"!==typeof e&&!!e}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(e){this._clearExpiredByTimeout="undefined"===typeof e||Boolean(e)}_getRateLimiterRes(e,t,r){const n=new i,o=r.rows[0];return n.isFirstInDuration=t===o.points,n.consumedPoints=n.isFirstInDuration?t:o.points,n.remainingPoints=Math.max(this.points-n.consumedPoints,0),n.msBeforeNext=o.expire?Math.max(o.expire-Date.now(),0):-1,n}_query(e){const t=this.tableName.toLowerCase(),r={name:"".concat(t,":").concat(e.name),text:e.text,values:e.values};return new Promise(((e,t)=>{this._getConnection().then((n=>{n.query(r).then((t=>{e(t),this._releaseConnection(n)})).catch((e=>{t(e),this._releaseConnection(n)}))})).catch((e=>{t(e)}))}))}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this.tableCreated)return Promise.reject(Error("Table is not created yet"));const i=r>0?Date.now()+r:null,o=n?" $3 ":" CASE\n WHEN ".concat(this.tableName,".expire <= $4 THEN $3\n ELSE ").concat(this.tableName,".expire\n END ");return this._query({name:n?"rlflx-upsert-force":"rlflx-upsert",text:"\n INSERT INTO ".concat(this.tableName," VALUES ($1, $2, $3)\n ON CONFLICT(key) DO UPDATE SET\n points = CASE\n WHEN (").concat(this.tableName,".expire <= $4 OR 1=").concat(n?1:0,") THEN $2\n ELSE ").concat(this.tableName,".points + ($2)\n END,\n expire = ").concat(o,"\n RETURNING points, expire;"),values:[e,t,i,Date.now()]})}_get(e){return this.tableCreated?new Promise(((t,r)=>{this._query({name:"rlflx-get",text:"\n SELECT points, expire FROM ".concat(this.tableName," WHERE key = $1 AND (expire > $2 OR expire IS NULL);"),values:[e,Date.now()]}).then((e=>{0===e.rowCount&&(e=null),t(e)})).catch((e=>{r(e)}))})):Promise.reject(Error("Table is not created yet"))}_delete(e){return this.tableCreated?this._query({name:"rlflx-delete",text:"DELETE FROM ".concat(this.tableName," WHERE key = $1"),values:[e]}).then((e=>e.rowCount>0)):Promise.reject(Error("Table is not created yet"))}}},3081:(e,t,r)=>{const n=r(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(((r,i)=>{e>t._limiterFlexible.points?i(new n("Requested tokens ".concat(e," exceeds maximum ").concat(t._limiterFlexible.points," tokens per interval"))):t._queue.length>0?t._queueRequest.call(t,r,i,e):t._limiterFlexible.consume(t._key,e).then((e=>{r(e.remainingPoints)})).catch((n=>{n instanceof Error?i(n):(t._queueRequest.call(t,r,i,e),null===t._waitTimeout&&(t._waitTimeout=setTimeout(t._processFIFO.bind(t),n.msBeforeNext)))}))}))}_queueRequest(e,t,r){const i=this;i._queue.length<i._maxQueueSize?i._queue.push({resolve:e,reject:t,tokens:r}):t(new n("Number of requests reached it's maximum ".concat(i._maxQueueSize)))}_processFIFO(){const e=this;if(null!==e._waitTimeout&&(clearTimeout(e._waitTimeout),e._waitTimeout=null),0===e._queue.length)return;const t=e._queue.shift();e._limiterFlexible.consume(e._key,t.tokens).then((r=>{t.resolve(r.remainingPoints),e._processFIFO.call(e)})).catch((r=>{r instanceof Error?(t.reject(r),e._processFIFO.call(e)):(e._queue.unshift(t),null===e._waitTimeout&&(e._waitTimeout=setTimeout(e._processFIFO.bind(e),r.msBeforeNext)))}))}}},8139:(e,t,r)=>{const n=r(1434),i=r(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 n{constructor(e){super(e),e.redis?this.client=e.redis:this.client=e.storeClient,this._rejectIfRedisNotReady=!!e.rejectIfRedisNotReady,"function"===typeof this.client.defineCommand&&this.client.defineCommand("rlflxIncr",{numberOfKeys:1,lua:o})}_isRedisReady(){return!this._rejectIfRedisNotReady||(!this.client.status||"ready"===this.client.status)&&!("function"===typeof this.client.isReady&&!this.client.isReady())}_getRateLimiterRes(e,t,r){let[n,o]=r;Array.isArray(n)&&([,n]=n,[,o]=o);const s=new i;return s.consumedPoints=parseInt(n),s.isFirstInDuration=s.consumedPoints===t,s.remainingPoints=Math.max(this.points-s.consumedPoints,0),s.msBeforeNext=o,s}_upsert(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return new Promise(((i,s)=>{if(!this._isRedisReady())return s(new Error("Redis connection is not ready"));const a=Math.floor(r/1e3),c=this.client.multi();if(n)a>0?c.set(e,t,"EX",a):c.set(e,t),c.pttl(e).exec(((e,t)=>e?s(e):i(t)));else if(a>0){const r=function(e,t){return e?s(e):i(t)};"function"===typeof this.client.rlflxIncr?this.client.rlflxIncr(e,t,a,r):this.client.eval(o,1,e,t,a,r)}else c.incrby(e,t).pttl(e).exec(((e,t)=>e?s(e):i(t)))}))}_get(e){return new Promise(((t,r)=>{if(!this._isRedisReady())return r(new Error("Redis connection is not ready"));this.client.multi().get(e).pttl(e).exec(((e,n)=>{if(e)r(e);else{const[e]=n;if(null===e)return t(null);t(n)}}))}))}_delete(e){return new Promise(((t,r)=>{this.client.del(e,((e,n)=>{e?r(e):t(n>0)}))}))}}},4819:e=>{e.exports=class{constructor(e,t,r,n){this.remainingPoints="undefined"===typeof e?0:e,this.msBeforeNext="undefined"===typeof t?0:t,this.consumedPoints="undefined"===typeof r?0:r,this.isFirstInDuration="undefined"!==typeof n&&n}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(e){return this._msBeforeNext=e,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(e){return this._remainingPoints=e,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(e){return this._consumedPoints=e,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(e){this._isFirstInDuration=Boolean(e)}_getDecoratedProperties(){return{remainingPoints:this.remainingPoints,msBeforeNext:this.msBeforeNext,consumedPoints:this.consumedPoints,isFirstInDuration:this.isFirstInDuration}}[Symbol.for("nodejs.util.inspect.custom")](){return this._getDecoratedProperties()}toString(){return JSON.stringify(this._getDecoratedProperties())}toJSON(){return this._getDecoratedProperties()}}},1434:(e,t,r)=>{const n=r(8855),i=r(6704),o=r(4819);e.exports=class extends n{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),this.inMemoryBlockOnConsumed=e.inMemoryBlockOnConsumed||e.inmemoryBlockOnConsumed,this.inMemoryBlockDuration=e.inMemoryBlockDuration||e.inmemoryBlockDuration,this.insuranceLimiter=e.insuranceLimiter,this._inMemoryBlockedKeys=new i}get client(){return this._client}set client(e){if("undefined"===typeof e)throw new Error("storeClient is not set");this._client=e}_afterConsume(e,t,r,n,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const s=this._getRateLimiterRes(r,n,i);if(this.inMemoryBlockOnConsumed>0&&!(this.inMemoryBlockDuration>0)&&s.consumedPoints>=this.inMemoryBlockOnConsumed)return this._inMemoryBlockedKeys.addMs(r,s.msBeforeNext),s.consumedPoints>this.points?t(s):e(s);if(s.consumedPoints>this.points){let e=Promise.resolve();this.blockDuration>0&&s.consumedPoints<=this.points+n&&(s.msBeforeNext=this.msBlockDuration,e=this._block(r,s.consumedPoints,this.msBlockDuration,o)),this.inMemoryBlockOnConsumed>0&&s.consumedPoints>=this.inMemoryBlockOnConsumed&&(this._inMemoryBlockedKeys.add(r,this.inMemoryBlockDuration),s.msBeforeNext=this.msInMemoryBlockDuration),e.then((()=>{t(s)})).catch((e=>{t(e)}))}else if(this.execEvenly&&s.msBeforeNext>0&&!s.isFirstInDuration){let t=Math.ceil(s.msBeforeNext/(s.remainingPoints+2));t<this.execEvenlyMinDelayMs&&(t=s.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(e,t,s)}else e(s)}_handleError(e,t,r,i,o){let s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{};this.insuranceLimiter instanceof n?this.insuranceLimiter[t](o,s,a).then((e=>{r(e)})).catch((e=>{i(e)})):i(e)}get _inmemoryBlockedKeys(){return this._inMemoryBlockedKeys}getInmemoryBlockMsBeforeExpire(e){return this.getInMemoryBlockMsBeforeExpire(e)}get inmemoryBlockOnConsumed(){return this.inMemoryBlockOnConsumed}set inmemoryBlockOnConsumed(e){this.inMemoryBlockOnConsumed=e}get inmemoryBlockDuration(){return this.inMemoryBlockDuration}set inmemoryBlockDuration(e){this.inMemoryBlockDuration=e}get msInmemoryBlockDuration(){return 1e3*this.inMemoryBlockDuration}getInMemoryBlockMsBeforeExpire(e){return this.inMemoryBlockOnConsumed>0?this._inMemoryBlockedKeys.msBeforeExpire(e):0}get inMemoryBlockOnConsumed(){return this._inMemoryBlockOnConsumed}set inMemoryBlockOnConsumed(e){if(this._inMemoryBlockOnConsumed=e?parseInt(e):0,this.inMemoryBlockOnConsumed>0&&this.points>this.inMemoryBlockOnConsumed)throw new Error('inMemoryBlockOnConsumed option must be greater or equal "points" option')}get inMemoryBlockDuration(){return this._inMemoryBlockDuration}set inMemoryBlockDuration(e){if(this._inMemoryBlockDuration=e?parseInt(e):0,this.inMemoryBlockDuration>0&&0===this.inMemoryBlockOnConsumed)throw new Error("inMemoryBlockOnConsumed option must be set up")}get msInMemoryBlockDuration(){return 1e3*this._inMemoryBlockDuration}get insuranceLimiter(){return this._insuranceLimiter}set insuranceLimiter(e){if("undefined"!==typeof e&&!(e instanceof n))throw new Error("insuranceLimiter must be instance of RateLimiterAbstract");this._insuranceLimiter=e,this._insuranceLimiter&&(this._insuranceLimiter.blockDuration=this.blockDuration,this._insuranceLimiter.execEvenly=this.execEvenly)}block(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=1e3*t;return this._block(this.getKey(e),this.points+1,n,r)}set(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=1e3*(r>=0?r:this.duration);return this._block(this.getKey(e),t,i,n)}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(((n,i)=>{const s=this.getKey(e),a=this.getInMemoryBlockMsBeforeExpire(s);if(a>0)return i(new o(0,a));this._upsert(s,t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{this._afterConsume(n,i,s,t,e)})).catch((o=>{this._handleError(o,"consume",n,i,e,t,r)}))}))}penalty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise(((i,o)=>{this._upsert(n,t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{i(this._getRateLimiterRes(n,t,e))})).catch((n=>{this._handleError(n,"penalty",i,o,e,t,r)}))}))}reward(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getKey(e);return new Promise(((i,o)=>{this._upsert(n,-t,1e3*this._getKeySecDuration(r),!1,r).then((e=>{i(this._getRateLimiterRes(n,-t,e))})).catch((n=>{this._handleError(n,"reward",i,o,e,t,r)}))}))}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.getKey(e);return new Promise(((n,i)=>{this._get(r,t).then((e=>{n(null===e||"undefined"===typeof e?null:this._getRateLimiterRes(r,0,e))})).catch((r=>{this._handleError(r,"get",n,i,e,t)}))}))}delete(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this.getKey(e);return new Promise(((n,i)=>{this._delete(r,t).then((e=>{this._inMemoryBlockedKeys.delete(r),n(e)})).catch((r=>{this._handleError(r,"delete",n,i,e,t)}))}))}deleteInMemoryBlockedAll(){this._inMemoryBlockedKeys.delete()}_getRateLimiterRes(e,t,r){throw new Error("You have to implement the method '_getRateLimiterRes'!")}_block(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return new Promise(((i,s)=>{this._upsert(e,t,r,!0,n).then((()=>{i(new o(0,r>0?r:-1,t))})).catch((t=>{this._handleError(t,"block",i,s,this.parseKey(e),r/1e3,n)}))}))}_get(e){throw new Error("You have to implement the method '_get'!")}_delete(e){throw new Error("You have to implement the method '_delete'!")}_upsert(e,t,r){throw new Error("You have to implement the method '_upsert'!")}}},4066:(e,t,r)=>{const n=r(8855);e.exports=class{constructor(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length<1)throw new Error("RateLimiterUnion: at least one limiter have to be passed");t.forEach((e=>{if(!(e instanceof n))throw new Error("RateLimiterUnion: all limiters have to be instance of RateLimiterAbstract")})),this._limiters=t}consume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise(((r,n)=>{const i=[];this._limiters.forEach((r=>{i.push(r.consume(e,t).catch((e=>({rejected:!0,rej:e}))))})),Promise.all(i).then((e=>{const t={};let i=!1;e.forEach((e=>{!0===e.rejected&&(i=!0)}));for(let r=0;r<e.length;r++)i&&!0===e[r].rejected?t[this._limiters[r].keyPrefix]=e[r].rej:i||(t[this._limiters[r].keyPrefix]=e[r]);i?n(t):r(t)}))}))}}},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,r)=>{const n=r(9682);e.exports=n},4327:(e,t,r)=>{const n=r(9359),i=r(4819);e.exports=class{constructor(){this._storage={}}incrby(e,t,r){if(this._storage[e]){const n=this._storage[e].expiresAt?this._storage[e].expiresAt.getTime()-(new Date).getTime():-1;return 0!==n?(this._storage[e].value=this._storage[e].value+t,new i(0,n,this._storage[e].value,!1)):this.set(e,t,r)}return this.set(e,t,r)}set(e,t,r){const o=1e3*r;return this._storage[e]&&this._storage[e].timeoutId&&clearTimeout(this._storage[e].timeoutId),this._storage[e]=new n(t,o>0?new Date(Date.now()+o):null),o>0&&(this._storage[e].timeoutId=setTimeout((()=>{delete this._storage[e]}),o),this._storage[e].timeoutId.unref&&this._storage[e].timeoutId.unref()),new i(0,0===o?-1:o,this._storage[e].value,!0)}get(e){if(this._storage[e]){const t=this._storage[e].expiresAt?this._storage[e].expiresAt.getTime()-(new Date).getTime():-1;return new i(0,t,this._storage[e].value,!1)}return null}delete(e){return!!this._storage[e]&&(this._storage[e].timeoutId&&clearTimeout(this._storage[e].timeoutId),delete this._storage[e],!0)}}},9359:e=>{e.exports=class{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.value=e,this.expiresAt=t,this.timeoutId=r}get value(){return this._value}set value(e){this._value=parseInt(e)}get expiresAt(){return this._expiresAt}set expiresAt(e){e instanceof Date||!Number.isInteger(e)||(e=new Date(e)),this._expiresAt=e}get timeoutId(){return this._timeoutId}set timeoutId(e){this._timeoutId=e}}},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,r)=>{"use strict";var n=r(2791),i=r(1725),o=r(5296);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!n)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,r,n,i,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var 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,r,n){var i=m.hasOwnProperty(t)?m[t]:null;(null!==i?0===i.type:!n&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,r,n){if(null===t||"undefined"===typeof t||function(e,t,r,n){if(null!==r&&0===r.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==r?!r.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,r,n))return!0;if(n)return!1;if(null!==r)switch(r.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,r,i,n)&&(r=null),n||null===i?function(e){return!!f.call(g,e)||!f.call(p,e)&&(d.test(e)?g[e]=!0:(p[e]=!0,!1))}(t)&&(null===r?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=null===r?3!==i.type&&"":r:(t=i.attributeName,n=i.attributeNamespace,null===r?e.removeAttribute(t):(r=3===(i=i.type)||4===i&&!0===r?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(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=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_=60103,S=60106,A=60107,T=60108,C=60114,k=60109,I=60110,R=60112,P=60113,N=60120,D=60115,x=60116,L=60121,O=60128,B=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"),T=F("react.strict_mode"),C=F("react.profiler"),k=F("react.provider"),I=F("react.context"),R=F("react.forward_ref"),P=F("react.suspense"),N=F("react.suspense_list"),D=F("react.memo"),x=F("react.lazy"),L=F("react.block"),F("react.scope"),O=F("react.opaque.id"),B=F("react.debug_trace_mode"),M=F("react.offscreen"),U=F("react.legacy_hidden")}var j,z="function"===typeof Symbol&&Symbol.iterator;function V(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=z&&e[z]||e["@@iterator"])?e:null}function K(e){if(void 0===j)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);j=t&&t[1]||""}return"\n"+j+e}var q=!1;function H(e,t){if(!e||q)return"";q=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var n=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){n=c}e.call(t.prototype)}else{try{throw Error()}catch(c){n=c}e()}}catch(c){if(c&&n&&"string"===typeof c.stack){for(var i=c.stack.split("\n"),o=n.stack.split("\n"),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||i[s]!==o[a])return"\n"+i[s].replace(" at new "," at ")}while(1<=s&&0<=a);break}}}finally{q=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?K(e):""}function G(e){switch(e.tag){case 5:return K(e.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("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 W(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 C:return"Profiler";case T:return"StrictMode";case P:return"Suspense";case N:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case I:return(e.displayName||"Context")+".Consumer";case k: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 W(e.type);case L:return W(e._render);case x:t=e._payload,e=e._init;try{return W(e(t))}catch(r){}}return null}function Q(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 $(e){e._valueTracker||(e._valueTracker=function(e){var t=Y(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof r&&"function"===typeof r.get&&"function"===typeof r.set){var i=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function X(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Y(e)?e.checked?"true":"false":e.value),(e=n)!==r&&(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 r=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=r?r:e._wrapperState.initialChecked})}function ee(e,t){var r=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;r=Q(null!=t.value?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&w(e,"checked",t,!1)}function re(e,t){te(e,t);var r=Q(t.value),n=t.type;if(null!=r)"number"===n?(0===r&&""===e.value||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if("submit"===n||"reset"===n)return void e.removeAttribute("value");t.hasOwnProperty("value")?ie(e,t.type,r):t.hasOwnProperty("defaultValue")&&ie(e,t.type,Q(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function ne(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!("submit"!==n&&"reset"!==n||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}""!==(r=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==r&&(e.name=r)}function ie(e,t,r){"number"===t&&J(e.ownerDocument)===e||(null==r?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}function oe(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return n.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function se(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+Q(r),t=null,i=0;i<e.length;i++){if(e[i].value===r)return e[i].selected=!0,void(n&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function 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 r=t.value;if(null==r){if(r=t.children,t=t.defaultValue,null!=r){if(null!=t)throw Error(s(92));if(Array.isArray(r)){if(!(1>=r.length))throw Error(s(93));r=r[0]}t=r}null==t&&(t=""),r=t}e._wrapperState={initialValue:Q(r)}}function le(e,t){var r=Q(t.value),n=Q(t.defaultValue);null!=r&&((r=""+r)!==e.value&&(e.value=r),null==t.defaultValue&&e.defaultValue!==r&&(e.defaultValue=r)),null!=n&&(e.defaultValue=""+n)}function 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,r,n){MSApp.execUnsafeLocalFunction((function(){return ge(e,t)}))}:ge);function me(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&3===r.nodeType)return void(r.nodeValue=t)}e.textContent=t}var 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,r){return null==t||"boolean"===typeof t||""===t?"":r||"number"!==typeof t||0===t||ve.hasOwnProperty(e)&&ve[e]?(""+t).trim():t+"px"}function Ee(e,t){for(var r in e=e.style,t)if(t.hasOwnProperty(r)){var n=0===r.indexOf("--"),i=we(r,t[r],n);"float"===r&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=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 Te(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ce=null,ke=null,Ie=null;function Re(e){if(e=ri(e)){if("function"!==typeof Ce)throw Error(s(280));var t=e.stateNode;t&&(t=ii(t),Ce(e.stateNode,e.type,t))}}function Pe(e){ke?Ie?Ie.push(e):Ie=[e]:ke=e}function Ne(){if(ke){var e=ke,t=Ie;if(Ie=ke=null,Re(e),t)for(e=0;e<t.length;e++)Re(t[e])}}function De(e,t){return e(t)}function xe(e,t,r,n,i){return e(t,r,n,i)}function Le(){}var Oe=De,Be=!1,Me=!1;function Ue(){null===ke&&null===Ie||(Le(),Ne())}function Fe(e,t){var r=e.stateNode;if(null===r)return null;var n=ii(r);if(null===n)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(r&&"function"!==typeof r)throw Error(s(231,t,typeof r));return r}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 Ve(e,t,r,n,i,o,s,a,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(r,l)}catch(u){this.onError(u)}}var Ke=!1,qe=null,He=!1,Ge=null,We={onError:function(e){Ke=!0,qe=e}};function Qe(e,t,r,n,i,o,s,a,c){Ke=!1,qe=null,Ve.apply(We,arguments)}function Ye(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(1026&(t=e).flags)&&(r=t.return),e=t.return}while(e)}return 3===t.tag?r:null}function $e(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 r=e,n=t;;){var i=r.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(n=i.return)){r=n;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===r)return Xe(i),e;if(o===n)return Xe(i),t;o=o.sibling}throw Error(s(188))}if(r.return!==n.return)r=i,n=o;else{for(var a=!1,c=i.child;c;){if(c===r){a=!0,r=i,n=o;break}if(c===n){a=!0,n=i,r=o;break}c=c.sibling}if(!a){for(c=o.child;c;){if(c===r){a=!0,r=o,n=i;break}if(c===n){a=!0,n=o,r=i;break}c=c.sibling}if(!a)throw Error(s(189))}}if(r.alternate!==n)throw Error(s(190))}if(3!==r.tag)throw Error(s(188));return r.stateNode.current===r?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 r=e.alternate;null!==t;){if(t===e||t===r)return!0;t=t.return}return!1}var et,tt,rt,nt,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,r,n,i){return{blockedOn:e,domEventName:t,eventSystemFlags:16|r,nativeEvent:i,targetContainers:[n]}}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,r,n,i,o){return null===e||e.nativeEvent!==o?(e=ft(t,r,n,i,o),null!==t&&(null!==(t=ri(t))&&tt(t)),e):(e.eventSystemFlags|=n,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 r=Ye(t);if(null!==r)if(13===(t=r.tag)){if(null!==(t=$e(r)))return e.blockedOn=t,void nt(e.lanePriority,(function(){o.unstable_runWithPriority(e.priority,(function(){rt(r)}))}))}else if(3===t&&r.stateNode.hydrate)return void(e.blockedOn=3===r.tag?r.stateNode.containerInfo:null)}e.blockedOn=null}function mt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var r=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==r)return null!==(t=ri(r))&&tt(t),e.blockedOn=r,!1;t.shift()}return!0}function vt(e,t,r){mt(e)&&r.delete(t)}function bt(){for(it=!1;0<ot.length;){var e=ot[0];if(null!==e.blockedOn){null!==(e=ri(e.blockedOn))&&et(e);break}for(var t=e.targetContainers;0<t.length;){var r=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==r){e.blockedOn=r;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 r=1;r<ot.length;r++){var n=ot[r];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==st&&wt(st,e),null!==at&&wt(at,e),null!==ct&&wt(ct,e),lt.forEach(t),ut.forEach(t),r=0;r<ht.length;r++)(n=ht[r]).blockedOn===e&&(n.blockedOn=null);for(;0<ht.length&&null===(r=ht[0]).blockedOn;)yt(r),null===r.blockedOn&&ht.shift()}function _t(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var St={animationend:_t("Animation","AnimationEnd"),animationiteration:_t("Animation","AnimationIteration"),animationstart:_t("Animation","AnimationStart"),transitionend:_t("Transition","TransitionEnd")},At={},Tt={};function Ct(e){if(At[e])return At[e];if(!St[e])return e;var t,r=St[e];for(t in r)if(r.hasOwnProperty(t)&&t in Tt)return At[e]=r[t];return e}h&&(Tt=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 kt=Ct("animationend"),It=Ct("animationiteration"),Rt=Ct("animationstart"),Pt=Ct("transitionend"),Nt=new Map,Dt=new Map,xt=["abort","abort",kt,"animationEnd",It,"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",Pt,"transitionEnd","waiting","waiting"];function Lt(e,t){for(var r=0;r<e.length;r+=2){var n=e[r],i=e[r+1];i="on"+(i[0].toUpperCase()+i.slice(1)),Dt.set(n,t),Nt.set(n,i),l(i,[n])}}(0,o.unstable_now)();var Ot=8;function Bt(e){if(0!==(1&e))return Ot=15,1;if(0!==(2&e))return Ot=14,2;if(0!==(4&e))return Ot=13,4;var t=24&e;return 0!==t?(Ot=12,t):0!==(32&e)?(Ot=11,32):0!==(t=192&e)?(Ot=10,t):0!==(256&e)?(Ot=9,256):0!==(t=3584&e)?(Ot=8,t):0!==(4096&e)?(Ot=7,4096):0!==(t=4186112&e)?(Ot=6,t):0!==(t=62914560&e)?(Ot=5,t):67108864&e?(Ot=4,67108864):0!==(134217728&e)?(Ot=3,134217728):0!==(t=805306368&e)?(Ot=2,t):0!==(1073741824&e)?(Ot=1,1073741824):(Ot=8,e)}function Mt(e,t){var r=e.pendingLanes;if(0===r)return Ot=0;var n=0,i=0,o=e.expiredLanes,s=e.suspendedLanes,a=e.pingedLanes;if(0!==o)n=o,i=Ot=15;else if(0!==(o=134217727&r)){var c=o&~s;0!==c?(n=Bt(c),i=Ot):0!==(a&=o)&&(n=Bt(a),i=Ot)}else 0!==(o=r&~s)?(n=Bt(o),i=Ot):0!==a&&(n=Bt(a),i=Ot);if(0===n)return 0;if(n=r&((0>(n=31-Kt(n))?0:1<<n)<<1)-1,0!==t&&t!==n&&0===(t&s)){if(Bt(t),i<=Ot)return t;Ot=i}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=n;0<t;)i=1<<(r=31-Kt(t)),n|=e[r],t&=~i;return n}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=[],r=0;31>r;r++)t.push(e);return t}function Vt(e,t,r){e.pendingLanes|=t;var n=t-1;e.suspendedLanes&=n,e.pingedLanes&=n,(e=e.eventTimes)[t=31-Kt(t)]=r}var Kt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(qt(e)/Ht|0)|0},qt=Math.log,Ht=Math.LN2;var Gt=o.unstable_UserBlockingPriority,Wt=o.unstable_runWithPriority,Qt=!0;function Yt(e,t,r,n){Be||Le();var i=Xt,o=Be;Be=!0;try{xe(i,e,t,r,n)}finally{(Be=o)||Ue()}}function $t(e,t,r,n){Wt(Gt,Xt.bind(null,e,t,r,n))}function Xt(e,t,r,n){var i;if(Qt)if((i=0===(4&t))&&0<ot.length&&-1<dt.indexOf(e))e=ft(null,e,t,r,n),ot.push(e);else{var o=Jt(e,t,r,n);if(null===o)i&&pt(e,n);else{if(i){if(-1<dt.indexOf(e))return e=ft(o,e,t,r,n),void ot.push(e);if(function(e,t,r,n,i){switch(t){case"focusin":return st=gt(st,e,t,r,n,i),!0;case"dragenter":return at=gt(at,e,t,r,n,i),!0;case"mouseover":return ct=gt(ct,e,t,r,n,i),!0;case"pointerover":var o=i.pointerId;return lt.set(o,gt(lt.get(o)||null,e,t,r,n,i)),!0;case"gotpointercapture":return o=i.pointerId,ut.set(o,gt(ut.get(o)||null,e,t,r,n,i)),!0}return!1}(o,e,t,r,n))return;pt(e,n)}Ln(e,t,n,null,r)}}}function Jt(e,t,r,n){var i=Te(n);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=$e(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 Ln(e,t,n,i,r),null}var Zt=null,er=null,tr=null;function rr(){if(tr)return tr;var e,t,r=er,n=r.length,i="value"in Zt?Zt.value:Zt.textContent,o=i.length;for(e=0;e<n&&r[e]===i[e];e++);var s=n-e;for(t=1;t<=s&&r[n-t]===i[o-t];t++);return tr=i.slice(e,1<t?1-t:void 0)}function nr(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 ir(){return!0}function or(){return!1}function sr(e){function t(t,r,n,i,o){for(var s in this._reactName=t,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(i):i[s]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?ir:or,this.isPropagationStopped=or,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=ir)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ir)},persist:function(){},isPersistent:ir}),t}var ar,cr,lr,ur={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hr=sr(ur),dr=i({},ur,{view:0,detail:0}),fr=sr(dr),pr=i({},dr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cr,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!==lr&&(lr&&"mousemove"===e.type?(ar=e.screenX-lr.screenX,cr=e.screenY-lr.screenY):cr=ar=0,lr=e),ar)},movementY:function(e){return"movementY"in e?e.movementY:cr}}),gr=sr(pr),yr=sr(i({},pr,{dataTransfer:0})),mr=sr(i({},dr,{relatedTarget:0})),vr=sr(i({},ur,{animationName:0,elapsedTime:0,pseudoElement:0})),br=i({},ur,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),wr=sr(br),Er=sr(i({},ur,{data:0})),_r={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sr={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"},Ar={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Tr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Ar[e])&&!!t[e]}function Cr(){return Tr}var kr=i({},dr,{key:function(e){if(e.key){var t=_r[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=nr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Sr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cr,charCode:function(e){return"keypress"===e.type?nr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?nr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Ir=sr(kr),Rr=sr(i({},pr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pr=sr(i({},dr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cr})),Nr=sr(i({},ur,{propertyName:0,elapsedTime:0,pseudoElement:0})),Dr=i({},pr,{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}),xr=sr(Dr),Lr=[9,13,27,32],Or=h&&"CompositionEvent"in window,Br=null;h&&"documentMode"in document&&(Br=document.documentMode);var Mr=h&&"TextEvent"in window&&!Br,Ur=h&&(!Or||Br&&8<Br&&11>=Br),Fr=String.fromCharCode(32),jr=!1;function zr(e,t){switch(e){case"keyup":return-1!==Lr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vr(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Kr=!1;var qr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!qr[e.type]:"textarea"===t}function Gr(e,t,r,n){Pe(n),0<(t=Bn(t,"onChange")).length&&(r=new hr("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Wr=null,Qr=null;function Yr(e){In(e,0)}function $r(e){if(X(ni(e)))return e}function Xr(e,t){if("change"===e)return t}var Jr=!1;if(h){var Zr;if(h){var en="oninput"in document;if(!en){var tn=document.createElement("div");tn.setAttribute("oninput","return;"),en="function"===typeof tn.oninput}Zr=en}else Zr=!1;Jr=Zr&&(!document.documentMode||9<document.documentMode)}function rn(){Wr&&(Wr.detachEvent("onpropertychange",nn),Qr=Wr=null)}function nn(e){if("value"===e.propertyName&&$r(Qr)){var t=[];if(Gr(t,Qr,e,Te(e)),e=Yr,Be)e(t);else{Be=!0;try{De(e,t)}finally{Be=!1,Ue()}}}}function on(e,t,r){"focusin"===e?(rn(),Qr=r,(Wr=t).attachEvent("onpropertychange",nn)):"focusout"===e&&rn()}function sn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return $r(Qr)}function an(e,t){if("click"===e)return $r(t)}function cn(e,t){if("input"===e||"change"===e)return $r(t)}var ln="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},un=Object.prototype.hasOwnProperty;function hn(e,t){if(ln(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++)if(!un.call(t,r[n])||!ln(e[r[n]],t[r[n]]))return!1;return!0}function dn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fn(e,t){var r,n=dn(e);for(e=0;n;){if(3===n.nodeType){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=dn(n)}}function pn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?pn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function gn(){for(var e=window,t=J();t instanceof e.HTMLIFrameElement;){try{var r="string"===typeof t.contentWindow.location.href}catch(n){r=!1}if(!r)break;t=J((e=t.contentWindow).document)}return t}function yn(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 mn=h&&"documentMode"in document&&11>=document.documentMode,vn=null,bn=null,wn=null,En=!1;function _n(e,t,r){var n=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;En||null==vn||vn!==J(n)||("selectionStart"in(n=vn)&&yn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},wn&&hn(wn,n)||(wn=n,0<(n=Bn(bn,"onSelect")).length&&(t=new hr("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=vn)))}Lt("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),Lt("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),Lt(xt,2);for(var Sn="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),An=0;An<Sn.length;An++)Dt.set(Sn[An],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 Tn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cn=new Set("cancel close invalid load scroll toggle".split(" ").concat(Tn));function kn(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,function(e,t,r,n,i,o,a,c,l){if(Qe.apply(this,arguments),Ke){if(!Ke)throw Error(s(198));var u=qe;Ke=!1,qe=null,He||(He=!0,Ge=u)}}(n,t,void 0,e),e.currentTarget=null}function In(e,t){t=0!==(4&t);for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var s=n.length-1;0<=s;s--){var a=n[s],c=a.instance,l=a.currentTarget;if(a=a.listener,c!==o&&i.isPropagationStopped())break e;kn(i,a,l),o=c}else for(s=0;s<n.length;s++){if(c=(a=n[s]).instance,l=a.currentTarget,a=a.listener,c!==o&&i.isPropagationStopped())break e;kn(i,a,l),o=c}}}if(He)throw e=Ge,He=!1,Ge=null,e}function Rn(e,t){var r=oi(t),n=e+"__bubble";r.has(n)||(xn(t,e,2,!1),r.add(n))}var Pn="_reactListening"+Math.random().toString(36).slice(2);function Nn(e){e[Pn]||(e[Pn]=!0,a.forEach((function(t){Cn.has(t)||Dn(t,!1,e,null),Dn(t,!0,e,null)})))}function Dn(e,t,r,n){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,o=r;if("selectionchange"===e&&9!==r.nodeType&&(o=r.ownerDocument),null!==n&&!t&&Cn.has(e)){if("scroll"!==e)return;i|=2,o=n}var s=oi(o),a=e+"__"+(t?"capture":"bubble");s.has(a)||(t&&(i|=4),xn(o,e,i,t),s.add(a))}function xn(e,t,r,n){var i=Dt.get(t);switch(void 0===i?2:i){case 0:i=Yt;break;case 1:i=$t;break;default:i=Xt}r=i.bind(null,t,r,e),i=void 0,!je||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),n?void 0!==i?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):void 0!==i?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function Ln(e,t,r,n,i){var o=n;if(0===(1&t)&&0===(2&t)&&null!==n)e:for(;;){if(null===n)return;var s=n.tag;if(3===s||4===s){var a=n.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===s)for(s=n.return;null!==s;){var c=s.tag;if((3===c||4===c)&&((c=s.stateNode.containerInfo)===i||8===c.nodeType&&c.parentNode===i))return;s=s.return}for(;null!==a;){if(null===(s=ti(a)))return;if(5===(c=s.tag)||6===c){n=o=s;continue e}a=a.parentNode}}n=n.return}!function(e,t,r){if(Me)return e(t,r);Me=!0;try{return Oe(e,t,r)}finally{Me=!1,Ue()}}((function(){var n=o,i=Te(r),s=[];e:{var a=Nt.get(e);if(void 0!==a){var c=hr,l=e;switch(e){case"keypress":if(0===nr(r))break e;case"keydown":case"keyup":c=Ir;break;case"focusin":l="focus",c=mr;break;case"focusout":l="blur",c=mr;break;case"beforeblur":case"afterblur":c=mr;break;case"click":if(2===r.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=gr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=yr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Pr;break;case kt:case It:case Rt:c=vr;break;case Pt:c=Nr;break;case"scroll":c=fr;break;case"wheel":c=xr;break;case"copy":case"cut":case"paste":c=wr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Rr}var u=0!==(4&t),h=!u&&"scroll"===e,d=u?null!==a?a+"Capture":null:a;u=[];for(var f,p=n;null!==p;){var g=(f=p).stateNode;if(5===f.tag&&null!==g&&(f=g,null!==d&&(null!=(g=Fe(p,d))&&u.push(On(p,g,f)))),h)break;p=p.return}0<u.length&&(a=new c(a,l,null,r,i),s.push({event:a,listeners:u}))}}if(0===(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||0!==(16&t)||!(l=r.relatedTarget||r.fromElement)||!ti(l)&&!l[Zn])&&(c||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,c?(c=n,null!==(l=(l=r.relatedTarget||r.toElement)?ti(l):null)&&(l!==(h=Ye(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=n),c!==l)){if(u=gr,g="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=Rr,g="onPointerLeave",d="onPointerEnter",p="pointer"),h=null==c?a:ni(c),f=null==l?a:ni(l),(a=new u(g,p+"leave",c,r,i)).target=h,a.relatedTarget=f,g=null,ti(i)===n&&((u=new u(d,p+"enter",l,r,i)).target=f,u.relatedTarget=h,g=u),h=g,c&&l)e:{for(d=l,p=0,f=u=c;f;f=Mn(f))p++;for(f=0,g=d;g;g=Mn(g))f++;for(;0<p-f;)u=Mn(u),p--;for(;0<f-p;)d=Mn(d),f--;for(;p--;){if(u===d||null!==d&&u===d.alternate)break e;u=Mn(u),d=Mn(d)}u=null}else u=null;null!==c&&Un(s,a,c,u,!1),null!==l&&null!==h&&Un(s,h,l,u,!0)}if("select"===(c=(a=n?ni(n):window).nodeName&&a.nodeName.toLowerCase())||"input"===c&&"file"===a.type)var y=Xr;else if(Hr(a))if(Jr)y=cn;else{y=sn;var m=on}else(c=a.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(y=an);switch(y&&(y=y(e,n))?Gr(s,y,r,i):(m&&m(e,a,n),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&ie(a,"number",a.value)),m=n?ni(n):window,e){case"focusin":(Hr(m)||"true"===m.contentEditable)&&(vn=m,bn=n,wn=null);break;case"focusout":wn=bn=vn=null;break;case"mousedown":En=!0;break;case"contextmenu":case"mouseup":case"dragend":En=!1,_n(s,r,i);break;case"selectionchange":if(mn)break;case"keydown":case"keyup":_n(s,r,i)}var v;if(Or)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 Kr?zr(e,r)&&(b="onCompositionEnd"):"keydown"===e&&229===r.keyCode&&(b="onCompositionStart");b&&(Ur&&"ko"!==r.locale&&(Kr||"onCompositionStart"!==b?"onCompositionEnd"===b&&Kr&&(v=rr()):(er="value"in(Zt=i)?Zt.value:Zt.textContent,Kr=!0)),0<(m=Bn(n,b)).length&&(b=new Er(b,e,null,r,i),s.push({event:b,listeners:m}),v?b.data=v:null!==(v=Vr(r))&&(b.data=v))),(v=Mr?function(e,t){switch(e){case"compositionend":return Vr(t);case"keypress":return 32!==t.which?null:(jr=!0,Fr);case"textInput":return(e=t.data)===Fr&&jr?null:e;default:return null}}(e,r):function(e,t){if(Kr)return"compositionend"===e||!Or&&zr(e,t)?(e=rr(),tr=er=Zt=null,Kr=!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 Ur&&"ko"!==t.locale?null:t.data}}(e,r))&&(0<(n=Bn(n,"onBeforeInput")).length&&(i=new Er("onBeforeInput","beforeinput",null,r,i),s.push({event:i,listeners:n}),i.data=v))}In(s,t)}))}function On(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Bn(e,t){for(var r=t+"Capture",n=[];null!==e;){var i=e,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=Fe(e,r))&&n.unshift(On(e,o,i)),null!=(o=Fe(e,t))&&n.push(On(e,o,i))),e=e.return}return n}function Mn(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Un(e,t,r,n,i){for(var o=t._reactName,s=[];null!==r&&r!==n;){var a=r,c=a.alternate,l=a.stateNode;if(null!==c&&c===n)break;5===a.tag&&null!==l&&(a=l,i?null!=(c=Fe(r,o))&&s.unshift(On(r,c,a)):i||null!=(c=Fe(r,o))&&s.push(On(r,c,a))),r=r.return}0!==s.length&&e.push({event:t,listeners:s})}function Fn(){}var jn=null,zn=null;function Vn(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Kn(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 qn="function"===typeof setTimeout?setTimeout:void 0,Hn="function"===typeof clearTimeout?clearTimeout:void 0;function Gn(e){1===e.nodeType?e.textContent="":9===e.nodeType&&(null!=(e=e.body)&&(e.textContent=""))}function Wn(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Qn(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var r=e.data;if("$"===r||"$!"===r||"$?"===r){if(0===t)return e;t--}else"/$"===r&&t++}e=e.previousSibling}return null}var Yn=0;var $n=Math.random().toString(36).slice(2),Xn="__reactFiber$"+$n,Jn="__reactProps$"+$n,Zn="__reactContainer$"+$n,ei="__reactEvents$"+$n;function ti(e){var t=e[Xn];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Zn]||r[Xn]){if(r=t.alternate,null!==t.child||null!==r&&null!==r.child)for(e=Qn(e);null!==e;){if(r=e[Xn])return r;e=Qn(e)}return t}r=(e=r).parentNode}return null}function ri(e){return!(e=e[Xn]||e[Zn])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function ni(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(s(33))}function ii(e){return e[Jn]||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 r=e.type.contextTypes;if(!r)return hi;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in r)o[i]=t[i];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function yi(e){return null!==(e=e.childContextTypes)&&void 0!==e}function mi(){li(fi),li(di)}function vi(e,t,r){if(di.current!==hi)throw Error(s(168));ui(di,t),ui(fi,r)}function bi(e,t,r){var n=e.stateNode;if(e=t.childContextTypes,"function"!==typeof n.getChildContext)return r;for(var o in n=n.getChildContext())if(!(o in e))throw Error(s(108,W(t)||"Unknown",o));return i({},r,n)}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,r){var n=e.stateNode;if(!n)throw Error(s(169));r?(e=bi(e,t,pi),n.__reactInternalMemoizedMergedChildContext=e,li(fi),li(di),ui(di,e)):li(fi),ui(fi,r)}var _i=null,Si=null,Ai=o.unstable_runWithPriority,Ti=o.unstable_scheduleCallback,Ci=o.unstable_cancelCallback,ki=o.unstable_shouldYield,Ii=o.unstable_requestPaint,Ri=o.unstable_now,Pi=o.unstable_getCurrentPriorityLevel,Ni=o.unstable_ImmediatePriority,Di=o.unstable_UserBlockingPriority,xi=o.unstable_NormalPriority,Li=o.unstable_LowPriority,Oi=o.unstable_IdlePriority,Bi={},Mi=void 0!==Ii?Ii:function(){},Ui=null,Fi=null,ji=!1,zi=Ri(),Vi=1e4>zi?Ri:function(){return Ri()-zi};function Ki(){switch(Pi()){case Ni:return 99;case Di:return 98;case xi:return 97;case Li:return 96;case Oi:return 95;default:throw Error(s(332))}}function qi(e){switch(e){case 99:return Ni;case 98:return Di;case 97:return xi;case 96:return Li;case 95:return Oi;default:throw Error(s(332))}}function Hi(e,t){return e=qi(e),Ai(e,t)}function Gi(e,t,r){return e=qi(e),Ti(e,t,r)}function Wi(){if(null!==Fi){var e=Fi;Fi=null,Ci(e)}Qi()}function Qi(){if(!ji&&null!==Ui){ji=!0;var e=0;try{var t=Ui;Hi(99,(function(){for(;e<t.length;e++){var r=t[e];do{r=r(!0)}while(null!==r)}})),Ui=null}catch(r){throw null!==Ui&&(Ui=Ui.slice(e+1)),Ti(Ni,Wi),r}finally{ji=!1}}}var Yi=E.ReactCurrentBatchConfig;function $i(e,t){if(e&&e.defaultProps){for(var r in t=i({},t),e=e.defaultProps)void 0===t[r]&&(t[r]=e[r]);return t}return t}var Xi=ci(null),Ji=null,Zi=null,eo=null;function to(){eo=Zi=Ji=null}function ro(e){var t=Xi.current;li(Xi),e.type._context._currentValue=t}function no(e,t){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)===t){if(null===r||(r.childLanes&t)===t)break;r.childLanes|=t}else e.childLanes|=t,null!==r&&(r.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)&&(Bs=!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 r=(e=e.shared).pending;null===r?t.next=t:(t.next=r.next,r.next=t),e.pending=t}}function ho(e,t){var r=e.updateQueue,n=e.alternate;if(null!==n&&r===(n=n.updateQueue)){var i=null,o=null;if(null!==(r=r.firstBaseUpdate)){do{var s={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};null===o?i=o=s:o=o.next=s,r=r.next}while(null!==r);null===o?i=o=t:o=o.next=t}else i=o=t;return r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:n.shared,effects:n.effects},void(e.updateQueue=r)}null===(e=r.lastBaseUpdate)?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function fo(e,t,r,n){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((n&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=r,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,r){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(null!==i){if(n.callback=null,n=r,"function"!==typeof i)throw Error(s(191,i));i.call(n)}}}var go=(new n.Component).refs;function yo(e,t,r,n){r=null===(r=r(n,t=e.memoizedState))||void 0===r?t:i({},t,r),e.memoizedState=r,0===e.lanes&&(e.updateQueue.baseState=r)}var mo={isMounted:function(e){return!!(e=e._reactInternals)&&Ye(e)===e},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=dc(),i=fc(e),o=lo(n,i);o.payload=t,void 0!==r&&null!==r&&(o.callback=r),uo(e,o),pc(e,i,n)},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=dc(),i=fc(e),o=lo(n,i);o.tag=1,o.payload=t,void 0!==r&&null!==r&&(o.callback=r),uo(e,o),pc(e,i,n)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=dc(),n=fc(e),i=lo(r,n);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),uo(e,i),pc(e,n,r)}};function vo(e,t,r,n,i,o,s){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!hn(r,n)||!hn(i,o))}function bo(e,t,r){var n=!1,i=hi,o=t.contextType;return"object"===typeof o&&null!==o?o=oo(o):(i=yi(t)?pi:di.current,o=(n=null!==(n=t.contextTypes)&&void 0!==n)?gi(e,i):hi),t=new t(r,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=mo,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function wo(e,t,r,n){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(r,n),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&mo.enqueueReplaceState(t,t.state,null)}function Eo(e,t,r,n){var i=e.stateNode;i.props=r,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,r,i,n),i.state=e.memoizedState,"function"===typeof(o=t.getDerivedStateFromProps)&&(yo(e,t,o,r),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&mo.enqueueReplaceState(i,i.state,null),fo(e,r,i,n),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4)}var _o=Array.isArray;function So(e,t,r){if(null!==(e=r.ref)&&"function"!==typeof e&&"object"!==typeof e){if(r._owner){if(r=r._owner){if(1!==r.tag)throw Error(s(309));var n=r.stateNode}if(!n)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=n.refs;t===go&&(t=n.refs={}),null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!==typeof e)throw Error(s(284));if(!r._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 To(e){function t(t,r){if(e){var n=t.lastEffect;null!==n?(n.nextEffect=r,t.lastEffect=r):t.firstEffect=t.lastEffect=r,r.nextEffect=null,r.flags=8}}function r(r,n){if(!e)return null;for(;null!==n;)t(r,n),n=n.sibling;return null}function n(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=Gc(e,t)).index=0,e.sibling=null,e}function o(t,r,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<r?(t.flags=2,r):n:(t.flags=2,r):r}function a(t){return e&&null===t.alternate&&(t.flags=2),t}function c(e,t,r,n){return null===t||6!==t.tag?((t=$c(r,e.mode,n)).return=e,t):((t=i(t,r)).return=e,t)}function l(e,t,r,n){return null!==t&&t.elementType===r.type?((n=i(t,r.props)).ref=So(e,t,r),n.return=e,n):((n=Wc(r.type,r.key,r.props,null,e.mode,n)).ref=So(e,t,r),n.return=e,n)}function u(e,t,r,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==r.containerInfo||t.stateNode.implementation!==r.implementation?((t=Xc(r,e.mode,n)).return=e,t):((t=i(t,r.children||[])).return=e,t)}function h(e,t,r,n,o){return null===t||7!==t.tag?((t=Qc(r,e.mode,n,o)).return=e,t):((t=i(t,r)).return=e,t)}function d(e,t,r){if("string"===typeof t||"number"===typeof t)return(t=$c(""+t,e.mode,r)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case _:return(r=Wc(t.type,t.key,t.props,null,e.mode,r)).ref=So(e,null,t),r.return=e,r;case S:return(t=Xc(t,e.mode,r)).return=e,t}if(_o(t)||V(t))return(t=Qc(t,e.mode,r,null)).return=e,t;Ao(e,t)}return null}function f(e,t,r,n){var i=null!==t?t.key:null;if("string"===typeof r||"number"===typeof r)return null!==i?null:c(e,t,""+r,n);if("object"===typeof r&&null!==r){switch(r.$$typeof){case _:return r.key===i?r.type===A?h(e,t,r.props.children,n,i):l(e,t,r,n):null;case S:return r.key===i?u(e,t,r,n):null}if(_o(r)||V(r))return null!==i?null:h(e,t,r,n,null);Ao(e,r)}return null}function p(e,t,r,n,i){if("string"===typeof n||"number"===typeof n)return c(t,e=e.get(r)||null,""+n,i);if("object"===typeof n&&null!==n){switch(n.$$typeof){case _:return e=e.get(null===n.key?r:n.key)||null,n.type===A?h(t,e,n.props.children,i,n.key):l(t,e,n,i);case S:return u(t,e=e.get(null===n.key?r:n.key)||null,n,i)}if(_o(n)||V(n))return h(t,e=e.get(r)||null,n,i,null);Ao(t,n)}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 r(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=n(i,h);g<a.length;g++)null!==(y=p(h,i,g,a[g],c))&&(e&&null!==y.alternate&&h.delete(null===y.key?g:y.key),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=V(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 r(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=n(i,g);!v.done;y++,v=c.next())null!==(v=p(g,i,y,v.value,l))&&(e&&null!==v.alternate&&g.delete(null===v.key?y:v.key),a=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,n,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=n;null!==l;){if(l.key===u){if(7===l.tag){if(o.type===A){r(e,l.sibling),(n=i(l,o.props.children)).return=e,e=n;break e}}else if(l.elementType===o.type){r(e,l.sibling),(n=i(l,o.props)).ref=So(e,l,o),n.return=e,e=n;break e}r(e,l);break}t(e,l),l=l.sibling}o.type===A?((n=Qc(o.props.children,e.mode,c,o.key)).return=e,e=n):((c=Wc(o.type,o.key,o.props,null,e.mode,c)).ref=So(e,n,o),c.return=e,e=c)}return a(e);case S:e:{for(l=o.key;null!==n;){if(n.key===l){if(4===n.tag&&n.stateNode.containerInfo===o.containerInfo&&n.stateNode.implementation===o.implementation){r(e,n.sibling),(n=i(n,o.children||[])).return=e,e=n;break e}r(e,n);break}t(e,n),n=n.sibling}(n=Xc(o,e.mode,c)).return=e,e=n}return a(e)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==n&&6===n.tag?(r(e,n.sibling),(n=i(n,o)).return=e,e=n):(r(e,n),(n=$c(o,e.mode,c)).return=e,e=n),a(e);if(_o(o))return g(e,n,o,c);if(V(o))return y(e,n,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,W(e.type)||"Component"))}return r(e,n)}}var Co=To(!0),ko=To(!1),Io={},Ro=ci(Io),Po=ci(Io),No=ci(Io);function Do(e){if(e===Io)throw Error(s(174));return e}function xo(e,t){switch(ui(No,t),ui(Po,e),ui(Ro,Io),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 Lo(){li(Ro),li(Po),li(No)}function Oo(e){Do(No.current);var t=Do(Ro.current),r=fe(t,e.type);t!==r&&(ui(Po,e),ui(Ro,r))}function Bo(e){Po.current===e&&(li(Ro),li(Po))}var Mo=ci(0);function Uo(e){for(var t=e;null!==t;){if(13===t.tag){var r=t.memoizedState;if(null!==r&&(null===(r=r.dehydrated)||"$?"===r.data||"$!"===r.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(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 Vo(e,t){var r=qc(5,null,null,0);r.elementType="DELETED",r.type="DELETED",r.stateNode=t,r.return=e,r.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=r,e.lastEffect=r):e.firstEffect=e.lastEffect=r}function Ko(e,t){switch(e.tag){case 5:var r=e.type;return null!==(t=1!==t.nodeType||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function qo(e){if(zo){var t=jo;if(t){var r=t;if(!Ko(e,t)){if(!(t=Wn(r.nextSibling))||!Ko(e,t))return e.flags=-1025&e.flags|2,zo=!1,void(Fo=e);Vo(Fo,r)}Fo=e,jo=Wn(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 Go(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&&!Kn(t,e.memoizedProps))for(t=jo;t;)Vo(e,t),t=Wn(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 r=e.data;if("/$"===r){if(0===t){jo=Wn(e.nextSibling);break e}t--}else"$"!==r&&"$!"!==r&&"$?"!==r||t++}e=e.nextSibling}jo=null}}else jo=Fo?Wn(e.stateNode.nextSibling):null;return!0}function Wo(){jo=Fo=null,zo=!1}var Qo=[];function Yo(){for(var e=0;e<Qo.length;e++)Qo[e]._workInProgressVersionPrimary=null;Qo.length=0}var $o=E.ReactCurrentDispatcher,Xo=E.ReactCurrentBatchConfig,Jo=0,Zo=null,es=null,ts=null,rs=!1,ns=!1;function is(){throw Error(s(321))}function os(e,t){if(null===t)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!ln(e[r],t[r]))return!1;return!0}function ss(e,t,r,n,i,o){if(Jo=o,Zo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,$o.current=null===e||null===e.memoizedState?Ds:xs,e=r(n,i),ns){o=0;do{if(ns=!1,!(25>o))throw Error(s(301));o+=1,ts=es=null,t.updateQueue=null,$o.current=Ls,e=r(n,i)}while(ns)}if($o.current=Ns,t=null!==es&&null!==es.next,Jo=0,ts=es=Zo=null,rs=!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(),r=t.queue;if(null===r)throw Error(s(311));r.lastRenderedReducer=e;var n=es,i=n.baseQueue,o=r.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}n.baseQueue=i=o,r.pending=null}if(null!==i){i=i.next,n=n.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}),n=l.eagerReducer===e?l.eagerState:e(n,l.action);else{var h={lane:u,action:l.action,eagerReducer:l.eagerReducer,eagerState:l.eagerState,next:null};null===c?(a=c=h,o=n):c=c.next=h,Zo.lanes|=u,za|=u}l=l.next}while(null!==l&&l!==i);null===c?o=n:c.next=a,ln(n,t.memoizedState)||(Bs=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=c,r.lastRenderedState=n}return[t.memoizedState,r.dispatch]}function hs(e){var t=cs(),r=t.queue;if(null===r)throw Error(s(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,o=t.memoizedState;if(null!==i){r.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);ln(o,t.memoizedState)||(Bs=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),r.lastRenderedState=o}return[o,n]}function ds(e,t,r){var n=t._getVersion;n=n(t._source);var i=t._workInProgressVersionPrimary;if(null!==i?e=i===n:(e=e.mutableReadLanes,(e=(Jo&e)===e)&&(t._workInProgressVersionPrimary=n,Qo.push(t))),e)return r(t._source);throw Qo.push(t),Error(s(350))}function fs(e,t,r,n){var i=xa;if(null===i)throw Error(s(349));var o=t._getVersion,a=o(t._source),c=$o.current,l=c.useState((function(){return ds(i,t,r)})),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:n},c.useEffect((function(){f.getSnapshot=r,f.setSnapshot=u;var e=o(t._source);if(!ln(a,e)){e=r(t._source),ln(h,e)||(u(e),e=fc(y),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var n=i.entanglements,s=e;0<s;){var c=31-Kt(s),l=1<<c;n[c]|=e,s&=~l}}}),[r,t,n]),c.useEffect((function(){return n(t._source,(function(){var e=f.getSnapshot,r=f.setSnapshot;try{r(e(t._source));var n=fc(y);i.mutableReadLanes|=n&i.pendingLanes}catch(o){r((function(){throw o}))}}))}),[t,n]),ln(p,r)&&ln(g,t)&&ln(d,n)||((e={pending:null,dispatch:null,lastRenderedReducer:ls,lastRenderedState:h}).dispatch=u=Ps.bind(null,Zo,e),l.queue=e,l.baseQueue=null,h=ds(i,t,r),l.memoizedState=l.baseState=h),h}function ps(e,t,r){return fs(cs(),e,t,r)}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=Ps.bind(null,Zo,e),[t.memoizedState,e]}function ys(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},null===(t=Zo.updateQueue)?(t={lastEffect:null},Zo.updateQueue=t,t.lastEffect=e.next=e):null===(r=t.lastEffect)?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e),e}function ms(e){return e={current:e},as().memoizedState=e}function vs(){return cs().memoizedState}function bs(e,t,r,n){var i=as();Zo.flags|=e,i.memoizedState=ys(1|t,r,void 0,void 0===n?null:n)}function ws(e,t,r,n){var i=cs();n=void 0===n?null:n;var o=void 0;if(null!==es){var s=es.memoizedState;if(o=s.destroy,null!==n&&os(n,s.deps))return void ys(t,r,o,n)}Zo.flags|=e,i.memoizedState=ys(1|t,r,o,n)}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 Ts(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,ws(4,2,As.bind(null,t,e),r)}function Cs(){}function ks(e,t){var r=cs();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&os(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Is(e,t){var r=cs();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&os(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Rs(e,t){var r=Ki();Hi(98>r?98:r,(function(){e(!0)})),Hi(97<r?97:r,(function(){var r=Xo.transition;Xo.transition=1;try{e(!1),t()}finally{Xo.transition=r}}))}function Ps(e,t,r){var n=dc(),i=fc(e),o={lane:i,action:r,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)ns=rs=!0;else{if(0===e.lanes&&(null===s||0===s.lanes)&&null!==(s=t.lastRenderedReducer))try{var a=t.lastRenderedState,c=s(a,r);if(o.eagerReducer=s,o.eagerState=c,ln(c,a))return}catch(l){}pc(e,i,n)}}var Ns={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,r){return r=null!==r&&void 0!==r?r.concat([e]):null,bs(4,2,As.bind(null,t,e),r)},useLayoutEffect:function(e,t){return bs(4,2,e,t)},useMemo:function(e,t){var r=as();return t=void 0===t?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=as();return t=void 0!==r?r(t):t,n.memoizedState=n.baseState=t,e=(e=n.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Ps.bind(null,Zo,e),[n.memoizedState,e]},useRef:ms,useState:gs,useDebugValue:Cs,useDeferredValue:function(e){var t=gs(e),r=t[0],n=t[1];return Es((function(){var t=Xo.transition;Xo.transition=1;try{n(e)}finally{Xo.transition=t}}),[e]),r},useTransition:function(){var e=gs(!1),t=e[0];return ms(e=Rs.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,r){var n=as();return n.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:r},fs(n,e,t,r)},useOpaqueIdentifier:function(){if(zo){var e=!1,t=function(e){return{$$typeof:O,toString:e,valueOf:e}}((function(){throw e||(e=!0,r("r:"+(Yn++).toString(36))),Error(s(355))})),r=gs(t)[1];return 0===(2&Zo.mode)&&(Zo.flags|=516,ys(5,(function(){r("r:"+(Yn++).toString(36))}),void 0,null)),t}return gs(t="r:"+(Yn++).toString(36)),t},unstable_isNewReconciler:!1},xs={readContext:oo,useCallback:ks,useContext:oo,useEffect:_s,useImperativeHandle:Ts,useLayoutEffect:Ss,useMemo:Is,useReducer:us,useRef:vs,useState:function(){return us(ls)},useDebugValue:Cs,useDeferredValue:function(e){var t=us(ls),r=t[0],n=t[1];return _s((function(){var t=Xo.transition;Xo.transition=1;try{n(e)}finally{Xo.transition=t}}),[e]),r},useTransition:function(){var e=us(ls)[0];return[vs().current,e]},useMutableSource:ps,useOpaqueIdentifier:function(){return us(ls)[0]},unstable_isNewReconciler:!1},Ls={readContext:oo,useCallback:ks,useContext:oo,useEffect:_s,useImperativeHandle:Ts,useLayoutEffect:Ss,useMemo:Is,useReducer:hs,useRef:vs,useState:function(){return hs(ls)},useDebugValue:Cs,useDeferredValue:function(e){var t=hs(ls),r=t[0],n=t[1];return _s((function(){var t=Xo.transition;Xo.transition=1;try{n(e)}finally{Xo.transition=t}}),[e]),r},useTransition:function(){var e=hs(ls)[0];return[vs().current,e]},useMutableSource:ps,useOpaqueIdentifier:function(){return hs(ls)[0]},unstable_isNewReconciler:!1},Os=E.ReactCurrentOwner,Bs=!1;function Ms(e,t,r,n){t.child=null===e?ko(t,null,r,n):Co(t,e.child,r,n)}function Us(e,t,r,n,i){r=r.render;var o=t.ref;return io(t,i),n=ss(e,t,r,n,o,i),null===e||Bs?(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 Fs(e,t,r,n,i,o){if(null===e){var s=r.type;return"function"!==typeof s||Hc(s)||void 0!==s.defaultProps||null!==r.compare||void 0!==r.defaultProps?((e=Wc(r.type,null,n,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=s,js(e,t,s,n,i,o))}return s=e.child,0===(i&o)&&(i=s.memoizedProps,(r=null!==(r=r.compare)?r:hn)(i,n)&&e.ref===t.ref)?oa(e,t,o):(t.flags|=1,(e=Gc(s,n)).ref=t.ref,e.return=t,t.child=e)}function js(e,t,r,n,i,o){if(null!==e&&hn(e.memoizedProps,n)&&e.ref===t.ref){if(Bs=!1,0===(o&i))return t.lanes=e.lanes,oa(e,t,o);0!==(16384&e.flags)&&(Bs=!0)}return Ks(e,t,r,n,o)}function zs(e,t,r){var n=t.pendingProps,i=n.children,o=null!==e?e.memoizedState:null;if("hidden"===n.mode||"unstable-defer-without-hiding"===n.mode)if(0===(4&t.mode))t.memoizedState={baseLanes:0},_c(t,r);else{if(0===(1073741824&r))return e=null!==o?o.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},_c(t,e),null;t.memoizedState={baseLanes:0},_c(t,null!==o?o.baseLanes:r)}else null!==o?(n=o.baseLanes|r,t.memoizedState=null):n=r,_c(t,n);return Ms(e,t,i,r),t.child}function Vs(e,t){var r=t.ref;(null===e&&null!==r||null!==e&&e.ref!==r)&&(t.flags|=128)}function Ks(e,t,r,n,i){var o=yi(r)?pi:di.current;return o=gi(t,o),io(t,i),r=ss(e,t,r,n,o,i),null===e||Bs?(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 qs(e,t,r,n,i){if(yi(r)){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,r,n),Eo(t,r,n,i),n=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var c=s.context,l=r.contextType;"object"===typeof l&&null!==l?l=oo(l):l=gi(t,l=yi(r)?pi:di.current);var u=r.getDerivedStateFromProps,h="function"===typeof u||"function"===typeof s.getSnapshotBeforeUpdate;h||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==n||c!==l)&&wo(t,s,n,l),so=!1;var d=t.memoizedState;s.state=d,fo(t,n,s,i),c=t.memoizedState,a!==n||d!==c||fi.current||so?("function"===typeof u&&(yo(t,r,u,n),c=t.memoizedState),(a=so||vo(t,r,a,n,d,c,l))?(h||"function"!==typeof s.UNSAFE_componentWillMount&&"function"!==typeof s.componentWillMount||("function"===typeof s.componentWillMount&&s.componentWillMount(),"function"===typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"===typeof s.componentDidMount&&(t.flags|=4)):("function"===typeof s.componentDidMount&&(t.flags|=4),t.memoizedProps=n,t.memoizedState=c),s.props=n,s.state=c,s.context=l,n=a):("function"===typeof s.componentDidMount&&(t.flags|=4),n=!1)}else{s=t.stateNode,co(e,t),a=t.memoizedProps,l=t.type===t.elementType?a:$i(t.type,a),s.props=l,h=t.pendingProps,d=s.context,"object"===typeof(c=r.contextType)&&null!==c?c=oo(c):c=gi(t,c=yi(r)?pi:di.current);var f=r.getDerivedStateFromProps;(u="function"===typeof f||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==h||d!==c)&&wo(t,s,n,c),so=!1,d=t.memoizedState,s.state=d,fo(t,n,s,i);var p=t.memoizedState;a!==h||d!==p||fi.current||so?("function"===typeof f&&(yo(t,r,f,n),p=t.memoizedState),(l=so||vo(t,r,l,n,d,p,c))?(u||"function"!==typeof s.UNSAFE_componentWillUpdate&&"function"!==typeof s.componentWillUpdate||("function"===typeof s.componentWillUpdate&&s.componentWillUpdate(n,p,c),"function"===typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(n,p,c)),"function"===typeof s.componentDidUpdate&&(t.flags|=4),"function"===typeof s.getSnapshotBeforeUpdate&&(t.flags|=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=n,t.memoizedState=p),s.props=n,s.state=p,s.context=c,n=l):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=256),n=!1)}return Hs(e,t,r,n,o,i)}function Hs(e,t,r,n,i,o){Vs(e,t);var s=0!==(64&t.flags);if(!n&&!s)return i&&Ei(t,r,!1),oa(e,t,o);n=t.stateNode,Os.current=t;var a=s&&"function"!==typeof r.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&s?(t.child=Co(t,e.child,null,o),t.child=Co(t,null,a,o)):Ms(e,t,a,o),t.memoizedState=n.state,i&&Ei(t,r,!0),t.child}function Gs(e){var t=e.stateNode;t.pendingContext?vi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&vi(0,t.context,!1),xo(e,t.containerInfo)}var Ws,Qs,Ys,$s,Xs={dehydrated:null,retryLane:0};function Js(e,t,r){var n,i=t.pendingProps,o=Mo.current,s=!1;return(n=0!==(64&t.flags))||(n=(null===e||null!==e.memoizedState)&&0!==(2&o)),n?(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&&qo(t),e=i.children,o=i.fallback,s?(e=Zs(t,e,o,r),t.child.memoizedState={baseLanes:r},t.memoizedState=Xs,e):"number"===typeof i.unstable_expectedLoadTime?(e=Zs(t,e,o,r),t.child.memoizedState={baseLanes:r},t.memoizedState=Xs,t.lanes=33554432,e):((r=Yc({mode:"visible",children:e},t.mode,r,null)).return=t,t.child=r)):(e.memoizedState,s?(i=ta(e,t,i.children,i.fallback,r),s=t.child,o=e.child.memoizedState,s.memoizedState=null===o?{baseLanes:r}:{baseLanes:o.baseLanes|r},s.childLanes=e.childLanes&~r,t.memoizedState=Xs,i):(r=ea(e,t,i.children,r),t.memoizedState=null,r))}function Zs(e,t,r,n){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),r=Qc(r,i,n,null),o.return=e,r.return=e,o.sibling=r,e.child=o,r}function ea(e,t,r,n){var i=e.child;return e=i.sibling,r=Gc(i,{mode:"visible",children:r}),0===(2&t.mode)&&(r.lanes=n),r.return=t,r.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=r}function ta(e,t,r,n,i){var o=t.mode,s=e.child;e=s.sibling;var a={mode:"hidden",children:r};return 0===(2&o)&&t.child!==s?((r=t.child).childLanes=0,r.pendingProps=a,null!==(s=r.lastEffect)?(t.firstEffect=r.firstEffect,t.lastEffect=s,s.nextEffect=null):t.firstEffect=t.lastEffect=null):r=Gc(s,a),null!==e?n=Gc(e,n):(n=Qc(n,o,i,null)).flags|=2,n.return=t,r.return=t,r.sibling=n,t.child=r,n}function ra(e,t){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),no(e.return,t)}function na(e,t,r,n,i,o){var s=e.memoizedState;null===s?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i,lastEffect:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i,s.lastEffect=o)}function ia(e,t,r){var n=t.pendingProps,i=n.revealOrder,o=n.tail;if(Ms(e,t,n.children,r),0!==(2&(n=Mo.current)))n=1&n|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&&ra(e,r);else if(19===e.tag)ra(e,r);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(ui(Mo,n),0===(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;null!==r;)null!==(e=r.alternate)&&null===Uo(e)&&(i=r),r=r.sibling;null===(r=i)?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),na(t,!1,i,r,o,t.lastEffect);break;case"backwards":for(r=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=r,r=i,i=e}na(t,!0,r,null,o,t.lastEffect);break;case"together":na(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function oa(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),za|=t.lanes,0!==(r&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(r=Gc(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=Gc(e,e.pendingProps)).return=t;r.sibling=null}return t.child}return null}function sa(e,t){if(!zo)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;null!==t;)null!==t.alternate&&(r=t),t=t.sibling;null===r?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;null!==r;)null!==r.alternate&&(n=r),r=r.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function aa(e,t,r){var n=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 Lo(),li(fi),li(di),Yo(),(n=t.stateNode).pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(Go(t)?t.flags|=4:n.hydrate||(t.flags|=256)),Qs(t),null;case 5:Bo(t);var o=Do(No.current);if(r=t.type,null!==e&&null!=t.stateNode)Ys(e,t,r,n,o),e.ref!==t.ref&&(t.flags|=128);else{if(!n){if(null===t.stateNode)throw Error(s(166));return null}if(e=Do(Ro.current),Go(t)){n=t.stateNode,r=t.type;var a=t.memoizedProps;switch(n[Xn]=t,n[Jn]=a,r){case"dialog":Rn("cancel",n),Rn("close",n);break;case"iframe":case"object":case"embed":Rn("load",n);break;case"video":case"audio":for(e=0;e<Tn.length;e++)Rn(Tn[e],n);break;case"source":Rn("error",n);break;case"img":case"image":case"link":Rn("error",n),Rn("load",n);break;case"details":Rn("toggle",n);break;case"input":ee(n,a),Rn("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!a.multiple},Rn("invalid",n);break;case"textarea":ce(n,a),Rn("invalid",n)}for(var l in Se(r,a),e=null,a)a.hasOwnProperty(l)&&(o=a[l],"children"===l?"string"===typeof o?n.textContent!==o&&(e=["children",o]):"number"===typeof o&&n.textContent!==""+o&&(e=["children",""+o]):c.hasOwnProperty(l)&&null!=o&&"onScroll"===l&&Rn("scroll",n));switch(r){case"input":$(n),ne(n,a,!0);break;case"textarea":$(n),ue(n);break;case"select":case"option":break;default:"function"===typeof a.onClick&&(n.onclick=Fn)}n=e,t.updateQueue=n,null!==n&&(t.flags|=4)}else{switch(l=9===o.nodeType?o:o.ownerDocument,e===he.html&&(e=de(r)),e===he.html?"script"===r?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof n.is?e=l.createElement(r,{is:n.is}):(e=l.createElement(r),"select"===r&&(l=e,n.multiple?l.multiple=!0:n.size&&(l.size=n.size))):e=l.createElementNS(e,r),e[Xn]=t,e[Jn]=n,Ws(e,t,!1,!1),t.stateNode=e,l=Ae(r,n),r){case"dialog":Rn("cancel",e),Rn("close",e),o=n;break;case"iframe":case"object":case"embed":Rn("load",e),o=n;break;case"video":case"audio":for(o=0;o<Tn.length;o++)Rn(Tn[o],e);o=n;break;case"source":Rn("error",e),o=n;break;case"img":case"image":case"link":Rn("error",e),Rn("load",e),o=n;break;case"details":Rn("toggle",e),o=n;break;case"input":ee(e,n),o=Z(e,n),Rn("invalid",e);break;case"option":o=oe(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},o=i({},n,{value:void 0}),Rn("invalid",e);break;case"textarea":ce(e,n),o=ae(e,n),Rn("invalid",e);break;default:o=n}Se(r,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"!==r||""!==h)&&me(e,h):"number"===typeof h&&me(e,""+h):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(c.hasOwnProperty(a)?null!=h&&"onScroll"===a&&Rn("scroll",e):null!=h&&w(e,a,h,l))}switch(r){case"input":$(e),ne(e,n,!1);break;case"textarea":$(e),ue(e);break;case"option":null!=n.value&&e.setAttribute("value",""+Q(n.value));break;case"select":e.multiple=!!n.multiple,null!=(a=n.value)?se(e,!!n.multiple,a,!1):null!=n.defaultValue&&se(e,!!n.multiple,n.defaultValue,!0);break;default:"function"===typeof o.onClick&&(e.onclick=Fn)}Vn(r,n)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)$s(e,t,e.memoizedProps,n);else{if("string"!==typeof n&&null===t.stateNode)throw Error(s(166));r=Do(No.current),Do(Ro.current),Go(t)?(n=t.stateNode,r=t.memoizedProps,n[Xn]=t,n.nodeValue!==r&&(t.flags|=4)):((n=(9===r.nodeType?r:r.ownerDocument).createTextNode(n))[Xn]=t,t.stateNode=n)}return null;case 13:return li(Mo),n=t.memoizedState,0!==(64&t.flags)?(t.lanes=r,t):(n=null!==n,r=!1,null===e?void 0!==t.memoizedProps.fallback&&Go(t):r=null!==e.memoizedState,n&&!r&&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===xa||0===(134217727&za)&&0===(134217727&Va)||vc(xa,Oa))),(n||r)&&(t.flags|=4),null);case 4:return Lo(),Qs(t),null===e&&Nn(t.stateNode.containerInfo),null;case 10:return ro(t),null;case 19:if(li(Mo),null===(n=t.memoizedState))return null;if(a=0!==(64&t.flags),null===(l=n.rendering))if(a)sa(n,!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(n,!1),null!==(a=l.updateQueue)&&(t.updateQueue=a,t.flags|=4),null===n.lastEffect&&(t.firstEffect=null),t.lastEffect=n.lastEffect,n=r,r=t.child;null!==r;)e=n,(a=r).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}),r=r.sibling;return ui(Mo,1&Mo.current|2),t.child}e=e.sibling}null!==n.tail&&Vi()>Ga&&(t.flags|=64,a=!0,sa(n,!1),t.lanes=33554432)}else{if(!a)if(null!==(e=Uo(l))){if(t.flags|=64,a=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),sa(n,!0),null===n.tail&&"hidden"===n.tailMode&&!l.alternate&&!zo)return null!==(t=t.lastEffect=n.lastEffect)&&(t.nextEffect=null),null}else 2*Vi()-n.renderingStartTime>Ga&&1073741824!==r&&(t.flags|=64,a=!0,sa(n,!1),t.lanes=33554432);n.isBackwards?(l.sibling=t.child,t.child=l):(null!==(r=n.last)?r.sibling=l:t.child=l,n.last=l)}return null!==n.tail?(r=n.tail,n.rendering=r,n.tail=r.sibling,n.lastEffect=t.lastEffect,n.renderingStartTime=Vi(),r.sibling=null,t=Mo.current,ui(Mo,a?1&t|2:1&t),r):null;case 23:case 24:return Sc(),null!==e&&null!==e.memoizedState!==(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==n.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(Lo(),li(fi),li(di),Yo(),0!==(64&(t=e.flags)))throw Error(s(285));return e.flags=-4097&t|64,e;case 5:return Bo(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 Lo(),null;case 10:return ro(e),null;case 23:case 24:return Sc(),null;default:return null}}function la(e,t){try{var r="",n=t;do{r+=G(n),n=n.return}while(n);var i=r}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i}}function ua(e,t){try{console.error(t.value)}catch(r){setTimeout((function(){throw r}))}}Ws=function(e,t){for(var r=t.child;null!==r;){if(5===r.tag||6===r.tag)e.appendChild(r.stateNode);else if(4!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},Qs=function(){},Ys=function(e,t,r,n){var o=e.memoizedProps;if(o!==n){e=t.stateNode,Do(Ro.current);var s,a=null;switch(r){case"input":o=Z(e,o),n=Z(e,n),a=[];break;case"option":o=oe(e,o),n=oe(e,n),a=[];break;case"select":o=i({},o,{value:void 0}),n=i({},n,{value:void 0}),a=[];break;case"textarea":o=ae(e,o),n=ae(e,n),a=[];break;default:"function"!==typeof o.onClick&&"function"===typeof n.onClick&&(e.onclick=Fn)}for(h in Se(r,n),r=null,o)if(!n.hasOwnProperty(h)&&o.hasOwnProperty(h)&&null!=o[h])if("style"===h){var l=o[h];for(s in l)l.hasOwnProperty(s)&&(r||(r={}),r[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 n){var u=n[h];if(l=null!=o?o[h]:void 0,n.hasOwnProperty(h)&&u!==l&&(null!=u||null!=l))if("style"===h)if(l){for(s in l)!l.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(r||(r={}),r[s]="");for(s in u)u.hasOwnProperty(s)&&l[s]!==u[s]&&(r||(r={}),r[s]=u[s])}else r||(a||(a=[]),a.push(h,r)),r=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&&Rn("scroll",e),a||l===u||(a=[])):"object"===typeof u&&null!==u&&u.$$typeof===O?u.toString():(a=a||[]).push(h,u))}r&&(a=a||[]).push("style",r);var h=a;(t.updateQueue=h)&&(t.flags|=4)}},$s=function(e,t,r,n){r!==n&&(t.flags|=4)};var ha="function"===typeof WeakMap?WeakMap:Map;function da(e,t,r){(r=lo(-1,r)).tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){$a||($a=!0,Xa=n),ua(0,t)},r}function fa(e,t,r){(r=lo(-1,r)).tag=3;var n=e.type.getDerivedStateFromError;if("function"===typeof n){var i=t.value;r.payload=function(){return ua(0,t),n(i)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(r.callback=function(){"function"!==typeof n&&(null===Ja?Ja=new Set([this]):Ja.add(this),ua(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),r}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(r){jc(e,r)}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 r=e.memoizedProps,n=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?r:$i(t.type,r),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Gn(t.stateNode.containerInfo))}throw Error(s(163))}function ma(e,t,r){switch(r.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=r.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3===(3&e.tag)){var n=e.create;e.destroy=n()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=r.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;n=i.next,0!==(4&(i=i.tag))&&0!==(1&i)&&(Mc(r,e),Bc(r,e)),e=n}while(e!==t)}return;case 1:return e=r.stateNode,4&r.flags&&(null===t?e.componentDidMount():(n=r.elementType===r.type?t.memoizedProps:$i(r.type,t.memoizedProps),e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=r.updateQueue)&&po(r,t,e));case 3:if(null!==(t=r.updateQueue)){if(e=null,null!==r.child)switch(r.child.tag){case 5:case 1:e=r.child.stateNode}po(r,t,e)}return;case 5:return e=r.stateNode,void(null===t&&4&r.flags&&Vn(r.type,r.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===r.memoizedState&&(r=r.alternate,null!==r&&(r=r.memoizedState,null!==r&&(r=r.dehydrated,null!==r&&Et(r)))))}throw Error(s(163))}function va(e,t){for(var r=e;;){if(5===r.tag){var n=r.stateNode;if(t)"function"===typeof(n=n.style).setProperty?n.setProperty("display","none","important"):n.display="none";else{n=r.stateNode;var i=r.memoizedProps.style;i=void 0!==i&&null!==i&&i.hasOwnProperty("display")?i.display:null,n.style.display=we("display",i)}}else if(6===r.tag)r.stateNode.nodeValue=t?"":r.memoizedProps;else if((23!==r.tag&&24!==r.tag||null===r.memoizedState||r===e)&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===e)break;for(;null===r.sibling;){if(null===r.return||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.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 r=e=e.next;do{var n=r,i=n.destroy;if(n=n.tag,void 0!==i)if(0!==(4&n))Mc(t,r);else{n=t;try{i()}catch(o){jc(n,o)}}r=r.next}while(r!==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:Ta(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 r=t;switch(t=r.stateNode,r.tag){case 5:var n=!1;break;case 3:case 4:t=t.containerInfo,n=!0;break;default:throw Error(s(161))}16&r.flags&&(me(t,""),r.flags&=-17);e:t:for(r=e;;){for(;null===r.sibling;){if(null===r.return||Ea(r.return)){r=null;break e}r=r.return}for(r.sibling.return=r.return,r=r.sibling;5!==r.tag&&6!==r.tag&&18!==r.tag;){if(2&r.flags)continue t;if(null===r.child||4===r.tag)continue t;r.child.return=r,r=r.child}if(!(2&r.flags)){r=r.stateNode;break e}}n?Sa(e,r,t):Aa(e,r,t)}function Sa(e,t,r){var n=e.tag,i=5===n||6===n;if(i)e=i?e.stateNode:e.stateNode.instance,t?8===r.nodeType?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(8===r.nodeType?(t=r.parentNode).insertBefore(e,r):(t=r).appendChild(e),null!==(r=r._reactRootContainer)&&void 0!==r||null!==t.onclick||(t.onclick=Fn));else if(4!==n&&null!==(e=e.child))for(Sa(e,t,r),e=e.sibling;null!==e;)Sa(e,t,r),e=e.sibling}function Aa(e,t,r){var n=e.tag,i=5===n||6===n;if(i)e=i?e.stateNode:e.stateNode.instance,t?r.insertBefore(e,t):r.appendChild(e);else if(4!==n&&null!==(e=e.child))for(Aa(e,t,r),e=e.sibling;null!==e;)Aa(e,t,r),e=e.sibling}function Ta(e,t){for(var r,n,i=t,o=!1;;){if(!o){o=i.return;e:for(;;){if(null===o)throw Error(s(160));switch(r=o.stateNode,o.tag){case 5:n=!1;break e;case 3:case 4:r=r.containerInfo,n=!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}n?(a=r,c=i.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):r.removeChild(i.stateNode)}else if(4===i.tag){if(null!==i.child){r=i.stateNode.containerInfo,n=!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 Ca(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var n=r=r.next;do{3===(3&n.tag)&&(e=n.destroy,n.destroy=void 0,void 0!==e&&e()),n=n.next}while(n!==r)}return;case 1:case 12:case 17:return;case 5:if(null!=(r=t.stateNode)){n=t.memoizedProps;var i=null!==e?e.memoizedProps:n;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(r[Jn]=n,"input"===e&&"radio"===n.type&&null!=n.name&&te(r,n),Ae(e,i),t=Ae(e,n),i=0;i<o.length;i+=2){var a=o[i],c=o[i+1];"style"===a?Ee(r,c):"dangerouslySetInnerHTML"===a?ye(r,c):"children"===a?me(r,c):w(r,a,c,t)}switch(e){case"input":re(r,n);break;case"textarea":le(r,n);break;case"select":e=r._wrapperState.wasMultiple,r._wrapperState.wasMultiple=!!n.multiple,null!=(o=n.value)?se(r,!!n.multiple,o,!1):e!==!!n.multiple&&(null!=n.defaultValue?se(r,!!n.multiple,n.defaultValue,!0):se(r,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(s(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((r=t.stateNode).hydrate&&(r.hydrate=!1,Et(r.containerInfo)));case 13:return null!==t.memoizedState&&(Ha=Vi(),va(t.child,!0)),void ka(t);case 19:return void ka(t);case 23:case 24:return void va(t,null!==t.memoizedState)}throw Error(s(163))}function ka(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var r=e.stateNode;null===r&&(r=e.stateNode=new pa),t.forEach((function(t){var n=Vc.bind(null,e,t);r.has(t)||(r.add(t),t.then(n,n))}))}}function Ia(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var Ra=Math.ceil,Pa=E.ReactCurrentDispatcher,Na=E.ReactCurrentOwner,Da=0,xa=null,La=null,Oa=0,Ba=0,Ma=ci(0),Ua=0,Fa=null,ja=0,za=0,Va=0,Ka=0,qa=null,Ha=0,Ga=1/0;function Wa(){Ga=Vi()+500}var Qa,Ya=null,$a=!1,Xa=null,Ja=null,Za=!1,ec=null,tc=90,rc=[],nc=[],ic=null,oc=0,sc=null,ac=-1,cc=0,lc=0,uc=null,hc=!1;function dc(){return 0!==(48&Da)?Vi():-1!==ac?ac:ac=Vi()}function fc(e){if(0===(2&(e=e.mode)))return 1;if(0===(4&e))return 99===Ki()?1:2;if(0===cc&&(cc=ja),0!==Yi.transition){0!==lc&&(lc=null!==qa?qa.pendingLanes:0),e=cc;var t=4186112&~lc;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Ki(),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,r){if(50<oc)throw oc=0,sc=null,Error(s(185));if(null===(e=gc(e,t)))return null;Vt(e,t,r),e===xa&&(Va|=t,4===Ua&&vc(e,Oa));var n=Ki();1===t?0!==(8&Da)&&0===(48&Da)?bc(e):(yc(e,r),0===Da&&(Wa(),Wi())):(0===(4&Da)||98!==n&&99!==n||(null===ic?ic=new Set([e]):ic.add(e)),yc(e,r)),qa=e}function gc(e,t){e.lanes|=t;var r=e.alternate;for(null!==r&&(r.lanes|=t),r=e,e=e.return;null!==e;)e.childLanes|=t,null!==(r=e.alternate)&&(r.childLanes|=t),r=e,e=e.return;return 3===r.tag?r.stateNode:null}function yc(e,t){for(var r=e.callbackNode,n=e.suspendedLanes,i=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var c=31-Kt(a),l=1<<c,u=o[c];if(-1===u){if(0===(l&n)||0!==(l&i)){u=t,Bt(l);var h=Ot;o[c]=10<=h?u+250:6<=h?u+5e3:-1}}else u<=t&&(e.expiredLanes|=l);a&=~l}if(n=Mt(e,e===xa?Oa:0),t=Ot,0===n)null!==r&&(r!==Bi&&Ci(r),e.callbackNode=null,e.callbackPriority=0);else{if(null!==r){if(e.callbackPriority===t)return;r!==Bi&&Ci(r)}15===t?(r=bc.bind(null,e),null===Ui?(Ui=[r],Fi=Ti(Ni,Qi)):Ui.push(r),r=Bi):14===t?r=Gi(99,bc.bind(null,e)):(r=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),r=Gi(r,mc.bind(null,e))),e.callbackPriority=t,e.callbackNode=r}}function mc(e){if(ac=-1,lc=cc=0,0!==(48&Da))throw Error(s(327));var t=e.callbackNode;if(Oc()&&e.callbackNode!==t)return null;var r=Mt(e,e===xa?Oa:0);if(0===r)return null;var n=r,i=Da;Da|=16;var o=Cc();for(xa===e&&Oa===n||(Wa(),Ac(e,n));;)try{Rc();break}catch(c){Tc(e,c)}if(to(),Pa.current=o,Da=i,null!==La?n=0:(xa=null,Oa=0,n=Ua),0!==(ja&Va))Ac(e,0);else if(0!==n){if(2===n&&(Da|=64,e.hydrate&&(e.hydrate=!1,Gn(e.containerInfo)),0!==(r=Ut(e))&&(n=kc(e,r))),1===n)throw t=Fa,Ac(e,0),vc(e,r),yc(e,Vi()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=r,n){case 0:case 1:throw Error(s(345));case 2:case 5:Dc(e);break;case 3:if(vc(e,r),(62914560&r)===r&&10<(n=Ha+500-Vi())){if(0!==Mt(e,0))break;if(((i=e.suspendedLanes)&r)!==r){dc(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=qn(Dc.bind(null,e),n);break}Dc(e);break;case 4:if(vc(e,r),(4186112&r)===r)break;for(n=e.eventTimes,i=-1;0<r;){var a=31-Kt(r);o=1<<a,(a=n[a])>i&&(i=a),r&=~o}if(r=i,10<(r=(120>(r=Vi()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ra(r/1960))-r)){e.timeoutHandle=qn(Dc.bind(null,e),r);break}Dc(e);break;default:throw Error(s(329))}}return yc(e,Vi()),e.callbackNode===t?mc.bind(null,e):null}function vc(e,t){for(t&=~Ka,t&=~Va,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Kt(t),n=1<<r;e[r]=-1,t&=~n}}function bc(e){if(0!==(48&Da))throw Error(s(327));if(Oc(),e===xa&&0!==(e.expiredLanes&Oa)){var t=Oa,r=kc(e,t);0!==(ja&Va)&&(r=kc(e,t=Mt(e,t)))}else r=kc(e,t=Mt(e,0));if(0!==e.tag&&2===r&&(Da|=64,e.hydrate&&(e.hydrate=!1,Gn(e.containerInfo)),0!==(t=Ut(e))&&(r=kc(e,t))),1===r)throw r=Fa,Ac(e,0),vc(e,t),yc(e,Vi()),r;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Dc(e),yc(e,Vi()),null}function wc(e,t){var r=Da;Da|=1;try{return e(t)}finally{0===(Da=r)&&(Wa(),Wi())}}function Ec(e,t){var r=Da;Da&=-2,Da|=8;try{return e(t)}finally{0===(Da=r)&&(Wa(),Wi())}}function _c(e,t){ui(Ma,Ba),Ba|=t,ja|=t}function Sc(){Ba=Ma.current,li(Ma)}function Ac(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(-1!==r&&(e.timeoutHandle=-1,Hn(r)),null!==La)for(r=La.return;null!==r;){var n=r;switch(n.tag){case 1:null!==(n=n.type.childContextTypes)&&void 0!==n&&mi();break;case 3:Lo(),li(fi),li(di),Yo();break;case 5:Bo(n);break;case 4:Lo();break;case 13:case 19:li(Mo);break;case 10:ro(n);break;case 23:case 24:Sc()}r=r.return}xa=e,La=Gc(e.current,null),Oa=Ba=ja=t,Ua=0,Fa=null,Ka=Va=za=0}function Tc(e,t){for(;;){var r=La;try{if(to(),$o.current=Ns,rs){for(var n=Zo.memoizedState;null!==n;){var i=n.queue;null!==i&&(i.pending=null),n=n.next}rs=!1}if(Jo=0,ts=es=Zo=null,ns=!1,Na.current=null,null===r||null===r.return){Ua=1,Fa=t,La=null;break}e:{var o=e,s=r.return,a=r,c=t;if(t=Oa,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((W(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)}Nc(r)}catch(S){t=S,La===r&&null!==r&&(La=r=r.return);continue}break}}function Cc(){var e=Pa.current;return Pa.current=Ns,null===e?Ns:e}function kc(e,t){var r=Da;Da|=16;var n=Cc();for(xa===e&&Oa===t||Ac(e,t);;)try{Ic();break}catch(i){Tc(e,i)}if(to(),Da=r,Pa.current=n,null!==La)throw Error(s(261));return xa=null,Oa=0,Ua}function Ic(){for(;null!==La;)Pc(La)}function Rc(){for(;null!==La&&!ki();)Pc(La)}function Pc(e){var t=Qa(e.alternate,e,Ba);e.memoizedProps=e.pendingProps,null===t?Nc(e):La=t,Na.current=null}function Nc(e){var t=e;do{var r=t.alternate;if(e=t.return,0===(2048&t.flags)){if(null!==(r=aa(r,t,Ba)))return void(La=r);if(24!==(r=t).tag&&23!==r.tag||null===r.memoizedState||0!==(1073741824&Ba)||0===(4&r.mode)){for(var n=0,i=r.child;null!==i;)n|=i.lanes|i.childLanes,i=i.sibling;r.childLanes=n}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!==(r=ca(t)))return r.flags&=2047,void(La=r);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(La=t);La=t=e}while(null!==t);0===Ua&&(Ua=5)}function Dc(e){var t=Ki();return Hi(99,xc.bind(null,e,t)),null}function xc(e,t){do{Oc()}while(null!==ec);if(0!==(48&Da))throw Error(s(327));var r=e.finishedWork;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(s(177));e.callbackNode=null;var n=r.lanes|r.childLanes,i=n,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-Kt(o),u=1<<l;i[l]=0,a[l]=-1,c[l]=-1,o&=~u}if(null!==ic&&0===(24&n)&&ic.has(e)&&ic.delete(e),e===xa&&(La=xa=null,Oa=0),1<r.flags?null!==r.lastEffect?(r.lastEffect.nextEffect=r,n=r.firstEffect):n=r:n=r.firstEffect,null!==n){if(i=Da,Da|=32,Na.current=null,jn=Qt,yn(a=gn())){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(C){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;zn={focusedElem:a,selectionRange:c},Qt=!1,uc=null,hc=!1,Ya=n;do{try{Lc()}catch(C){if(null===Ya)throw Error(s(330));jc(Ya,C),Ya=Ya.nextEffect}}while(null!==Ya);uc=null,Ya=n;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,Ca(Ya.alternate,Ya);break;case 1024:Ya.flags&=-1025;break;case 1028:Ya.flags&=-1025,Ca(Ya.alternate,Ya);break;case 4:Ca(Ya.alternate,Ya);break;case 8:Ta(a,c=Ya);var _=c.alternate;wa(c),null!==_&&wa(_)}Ya=Ya.nextEffect}}catch(C){if(null===Ya)throw Error(s(330));jc(Ya,C),Ya=Ya.nextEffect}}while(null!==Ya);if(E=zn,w=gn(),b=E.focusedElem,a=E.selectionRange,w!==b&&b&&b.ownerDocument&&pn(b.ownerDocument.documentElement,b)){null!==a&&yn(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=fn(b,_),o=fn(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}Qt=!!jn,zn=jn=null,e.current=r,Ya=n;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 T=Ya.stateNode;Ya.tag,w=T,"function"===typeof A?A(w):A.current=w}}Ya=Ya.nextEffect}}catch(C){if(null===Ya)throw Error(s(330));jc(Ya,C),Ya=Ya.nextEffect}}while(null!==Ya);Ya=null,Mi(),Da=i}else e.current=r;if(Za)Za=!1,ec=e,tc=t;else for(Ya=n;null!==Ya;)t=Ya.nextEffect,Ya.nextEffect=null,8&Ya.flags&&((S=Ya).sibling=null,S.stateNode=null),Ya=t;if(0===(n=e.pendingLanes)&&(Ja=null),1===n?e===sc?oc++:(oc=0,sc=e):oc=0,r=r.stateNode,Si&&"function"===typeof Si.onCommitFiberRoot)try{Si.onCommitFiberRoot(_i,r,void 0,64===(64&r.current.flags))}catch(C){}if(yc(e,Vi()),$a)throw $a=!1,e=Xa,Xa=null,e;return 0!==(8&Da)||Wi(),null}function Lc(){for(;null!==Ya;){var e=Ya.alternate;hc||null===uc||(0!==(8&Ya.flags)?Ze(Ya,uc)&&(hc=!0):13===Ya.tag&&Ia(e,Ya)&&Ze(Ya,uc)&&(hc=!0));var t=Ya.flags;0!==(256&t)&&ya(e,Ya),0===(512&t)||Za||(Za=!0,Gi(97,(function(){return Oc(),null}))),Ya=Ya.nextEffect}}function Oc(){if(90!==tc){var e=97<tc?97:tc;return tc=90,Hi(e,Uc)}return!1}function Bc(e,t){rc.push(t,e),Za||(Za=!0,Gi(97,(function(){return Oc(),null})))}function Mc(e,t){nc.push(t,e),Za||(Za=!0,Gi(97,(function(){return Oc(),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 r=nc;nc=[];for(var n=0;n<r.length;n+=2){var i=r[n],o=r[n+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(r=rc,rc=[],n=0;n<r.length;n+=2){i=r[n],o=r[n+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,Wi(),!0}function Fc(e,t,r){uo(e,t=da(0,t=la(r,t),1)),t=dc(),null!==(e=gc(e,1))&&(Vt(e,1,t),yc(e,t))}function jc(e,t){if(3===e.tag)Fc(e,e,t);else for(var r=e.return;null!==r;){if(3===r.tag){Fc(r,e,t);break}if(1===r.tag){var n=r.stateNode;if("function"===typeof r.type.getDerivedStateFromError||"function"===typeof n.componentDidCatch&&(null===Ja||!Ja.has(n))){var i=fa(r,e=la(t,e),1);if(uo(r,i),i=dc(),null!==(r=gc(r,1)))Vt(r,1,i),yc(r,i);else if("function"===typeof n.componentDidCatch&&(null===Ja||!Ja.has(n)))try{n.componentDidCatch(t,e)}catch(o){}break}}r=r.return}}function zc(e,t,r){var n=e.pingCache;null!==n&&n.delete(t),t=dc(),e.pingedLanes|=e.suspendedLanes&r,xa===e&&(Oa&r)===r&&(4===Ua||3===Ua&&(62914560&Oa)===Oa&&500>Vi()-Ha?Ac(e,0):Ka|=r),yc(e,t)}function Vc(e,t){var r=e.stateNode;null!==r&&r.delete(t),0===(t=0)&&(0===(2&(t=e.mode))?t=1:0===(4&t)?t=99===Ki()?1:2:(0===cc&&(cc=ja),0===(t=jt(62914560&~cc))&&(t=4194304))),r=dc(),null!==(e=gc(e,t))&&(Vt(e,t,r),yc(e,r))}function Kc(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function qc(e,t,r,n){return new Kc(e,t,r,n)}function Hc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Gc(e,t){var r=e.alternate;return null===r?((r=qc(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Wc(e,t,r,n,i,o){var a=2;if(n=e,"function"===typeof e)Hc(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case A:return Qc(r.children,i,o,t);case B:a=8,i|=16;break;case T:a=8,i|=1;break;case C:return(e=qc(12,r,t,8|i)).elementType=C,e.type=C,e.lanes=o,e;case P:return(e=qc(13,r,t,i)).type=P,e.elementType=P,e.lanes=o,e;case N:return(e=qc(19,r,t,i)).elementType=N,e.lanes=o,e;case M:return Yc(r,i,o,t);case U:return(e=qc(24,r,t,i)).elementType=U,e.lanes=o,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case k:a=10;break e;case I:a=9;break e;case R:a=11;break e;case D:a=14;break e;case x:a=16,n=null;break e;case L:a=22;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=qc(a,r,t,i)).elementType=e,t.type=n,t.lanes=o,t}function Qc(e,t,r,n){return(e=qc(7,e,n,t)).lanes=r,e}function Yc(e,t,r,n){return(e=qc(23,e,n,t)).elementType=M,e.lanes=r,e}function $c(e,t,r){return(e=qc(6,e,null,t)).lanes=r,e}function Xc(e,t,r){return(t=qc(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Jc(e,t,r){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=r,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,r,n){var i=t.current,o=dc(),a=fc(i);e:if(r){t:{if(Ye(r=r._reactInternals)!==r||1!==r.tag)throw Error(s(170));var c=r;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===r.tag){var l=r.type;if(yi(l)){r=bi(r,l,c);break e}}r=c}else r=hi;return null===t.context?t.context=r:t.pendingContext=r,(t=lo(o,a)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),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 r=e.retryLane;e.retryLane=0!==r&&r<t?r:t}}function rl(e,t){tl(e,t),(e=e.alternate)&&tl(e,t)}function nl(e,t,r){var n=null!=r&&null!=r.hydrationOptions&&r.hydrationOptions.mutableSources||null;if(r=new Jc(e,t,null!=r&&!0===r.hydrate),t=qc(3,null,null,2===t?7:1===t?3:0),r.current=t,t.stateNode=r,ao(t),e[Zn]=r.current,Nn(8===e.nodeType?e.parentNode:e),n)for(e=0;e<n.length;e++){var i=(t=n[e])._getVersion;i=i(t._source),null==r.mutableSourceEagerHydrationData?r.mutableSourceEagerHydrationData=[t,i]:r.mutableSourceEagerHydrationData.push(t,i)}this._internalRoot=r}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,r,n,i){var o=r._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=r._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 r;r=e.lastChild;)e.removeChild(r);return new nl(e,0,t?{hydrate:!0}:void 0)}(r,n),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 r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!il(t))throw Error(s(200));return function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:S,key:null==n?null:""+n,children:e,containerInfo:t,implementation:r}}(e,t,null,r)}Qa=function(e,t,r){var n=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||fi.current)Bs=!0;else{if(0===(r&n)){switch(Bs=!1,t.tag){case 3:Gs(t),Wo();break;case 5:Oo(t);break;case 1:yi(t.type)&&wi(t);break;case 4:xo(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value;var i=t.type._context;ui(Xi,i._currentValue),i._currentValue=n;break;case 13:if(null!==t.memoizedState)return 0!==(r&t.child.childLanes)?Js(e,t,r):(ui(Mo,1&Mo.current),null!==(t=oa(e,t,r))?t.sibling:null);ui(Mo,1&Mo.current);break;case 19:if(n=0!==(r&t.childLanes),0!==(64&e.flags)){if(n)return ia(e,t,r);t.flags|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),ui(Mo,Mo.current),n)break;return null;case 23:case 24:return t.lanes=0,zs(e,t,r)}return oa(e,t,r)}Bs=0!==(16384&e.flags)}else Bs=!1;switch(t.lanes=0,t.tag){case 2:if(n=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=gi(t,di.current),io(t,r),i=ss(null,t,n,e,i,r),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(n)){var o=!0;wi(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,ao(t);var a=n.getDerivedStateFromProps;"function"===typeof a&&yo(t,n,a,e),i.updater=mo,t.stateNode=i,i._reactInternals=t,Eo(t,n,e,r),t=Hs(null,t,n,!0,o,r)}else t.tag=0,Ms(null,t,i,r),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=$i(i,e),o){case 0:t=Ks(null,t,i,e,r);break e;case 1:t=qs(null,t,i,e,r);break e;case 11:t=Us(null,t,i,e,r);break e;case 14:t=Fs(null,t,i,$i(i.type,e),n,r);break e}throw Error(s(306,i,""))}return t;case 0:return n=t.type,i=t.pendingProps,Ks(e,t,n,i=t.elementType===n?i:$i(n,i),r);case 1:return n=t.type,i=t.pendingProps,qs(e,t,n,i=t.elementType===n?i:$i(n,i),r);case 3:if(Gs(t),n=t.updateQueue,null===e||null===n)throw Error(s(282));if(n=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,co(e,t),fo(t,n,null,r),(n=t.memoizedState.element)===i)Wo(),t=oa(e,t,r);else{if((o=(i=t.stateNode).hydrate)&&(jo=Wn(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],Qo.push(o);for(r=ko(t,null,n,r),t.child=r;r;)r.flags=-3&r.flags|1024,r=r.sibling}else Ms(e,t,n,r),Wo();t=t.child}return t;case 5:return Oo(t),null===e&&qo(t),n=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,Kn(n,i)?a=null:null!==o&&Kn(n,o)&&(t.flags|=16),Vs(e,t),Ms(e,t,a,r),t.child;case 6:return null===e&&qo(t),null;case 13:return Js(e,t,r);case 4:return xo(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=Co(t,null,n,r):Ms(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,Us(e,t,n,i=t.elementType===n?i:$i(n,i),r);case 7:return Ms(e,t,t.pendingProps,r),t.child;case 8:case 12:return Ms(e,t,t.pendingProps.children,r),t.child;case 10:e:{n=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=ln(c,o)?0:0|("function"===typeof n._calculateChangedBits?n._calculateChangedBits(c,o):1073741823))){if(a.children===i.children&&!fi.current){t=oa(e,t,r);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===n&&0!==(u.observedBits&o)){1===c.tag&&((u=lo(-1,r&-r)).tag=2,uo(c,u)),c.lanes|=r,null!==(u=c.alternate)&&(u.lanes|=r),no(c.return,r),l.lanes|=r;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,r),t=t.child}return t;case 9:return i=t.type,n=(o=t.pendingProps).children,io(t,r),n=n(i=oo(i,o.unstable_observedBits)),t.flags|=1,Ms(e,t,n,r),t.child;case 14:return o=$i(i=t.type,t.pendingProps),Fs(e,t,i,o=$i(i.type,o),n,r);case 15:return js(e,t,t.type,t.pendingProps,n,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:$i(n,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,yi(n)?(e=!0,wi(t)):e=!1,io(t,r),bo(t,n,i),Eo(t,n,i,r),Hs(null,t,n,!0,e,r);case 19:return ia(e,t,r);case 23:case 24:return zs(e,t,r)}throw Error(s(156,t.tag))},nl.prototype.render=function(e){Zc(e,this._internalRoot,null,null)},nl.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Zc(null,e,null,(function(){t[Zn]=null}))},et=function(e){13===e.tag&&(pc(e,4,dc()),rl(e,4))},tt=function(e){13===e.tag&&(pc(e,67108864,dc()),rl(e,67108864))},rt=function(e){if(13===e.tag){var t=dc(),r=fc(e);pc(e,r,t),rl(e,r)}},nt=function(e,t){return t()},Ce=function(e,t,r){switch(t){case"input":if(re(e,r),t=r.name,"radio"===r.type&&null!=t){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=ii(n);if(!i)throw Error(s(90));X(n),re(n,i)}}}break;case"textarea":le(e,r);break;case"select":null!=(t=r.value)&&se(e,!!r.multiple,t,!1)}},De=wc,xe=function(e,t,r,n,i){var o=Da;Da|=4;try{return Hi(98,e.bind(null,t,r,n,i))}finally{0===(Da=o)&&(Wa(),Wi())}},Le=function(){0===(49&Da)&&(function(){if(null!==ic){var e=ic;ic=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,yc(e,Vi())}))}Wi()}(),Oc())},Oe=function(e,t){var r=Da;Da|=2;try{return e(t)}finally{0===(Da=r)&&(Wa(),Wi())}};var al={Events:[ri,ni,ii,Pe,Ne,Oc,{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 r=Da;if(0!==(48&r))return e(t);Da|=1;try{if(e)return Hi(99,e.bind(null,t))}finally{Da=r,Wi()}},t.hydrate=function(e,t,r){if(!il(t))throw Error(s(200));return ol(null,e,t,!0,r)},t.render=function(e,t,r){if(!il(t))throw Error(s(200));return ol(null,e,t,!1,r)},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[Zn]=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,r,n){if(!il(r))throw Error(s(200));if(null==e||void 0===e._reactInternals)throw Error(s(38));return ol(e,t,r,!1,n)},t.version="17.0.2"},4164:(e,t,r)=>{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=r(4463)},1372:(e,t)=>{"use strict";var r="function"===typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,o=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,a=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,l=r?Symbol.for("react.context"):60110,u=r?Symbol.for("react.async_mode"):60111,h=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,f=r?Symbol.for("react.suspense"):60113,p=r?Symbol.for("react.suspense_list"):60120,g=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116,m=r?Symbol.for("react.block"):60121,v=r?Symbol.for("react.fundamental"):60117,b=r?Symbol.for("react.responder"):60118,w=r?Symbol.for("react.scope"):60119;function E(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case n: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=n,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===n},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,r)=>{"use strict";e.exports=r(1372)},6374:(e,t,r)=>{"use strict";r(1725);var n=r(2791),i=60103;if(60107,"function"===typeof Symbol&&Symbol.for){var o=Symbol.for;i=o("react.element"),o("react.fragment")}var s=n.__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,r){var n,o={},l=null,u=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,n)&&!c.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===o[n]&&(o[n]=t[n]);return{$$typeof:i,type:e,key:l,ref:u,props:o,_owner:s.current}}t.jsx=l,t.jsxs=l},9117:(e,t,r)=>{"use strict";var n=r(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,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g={};function y(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}function m(){}function v(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||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,n(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,r){var n,o={},s=null,a=null;if(null!=t)for(n in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(s=""+t.key),t)E.call(t,n)&&!_.hasOwnProperty(n)&&(o[n]=t[n]);var c=arguments.length-2;if(1===c)o.children=r;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(n in c=e.defaultProps)void 0===o[n]&&(o[n]=c[n]);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 T=/\/+/g;function C(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 k(e,t,r,n,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=""===n?"."+C(c,0):n,Array.isArray(s)?(r="",null!=e&&(r=e.replace(T,"$&/")+"/"),k(s,t,r,"",(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,r+(!s.key||c&&c.key===s.key?"":(""+s.key).replace(T,"$&/")+"/")+e)),t.push(s)),1;if(c=0,n=""===n?".":n+":",Array.isArray(e))for(var l=0;l<e.length;l++){var u=n+C(a=e[l],l);c+=k(a,t,r,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+=k(a=a.value,t,r,u=n+C(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 I(e,t,r){if(null==e)return e;var n=[],i=0;return k(e,n,"","",(function(e){return t.call(r,e,i++)})),n}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 P={current:null};function N(){var e=P.current;if(null===e)throw Error(f(321));return e}var D={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:w,IsSomeRendererActing:{current:!1},assign:n};t.Children={map:I,forEach:function(e,t,r){I(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return I(e,(function(){t++})),t},toArray:function(e){return I(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,r){if(null===e||void 0===e)throw Error(f(267,e));var o=n({},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=r;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 N().useCallback(e,t)},t.useContext=function(e,t){return N().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return N().useEffect(e,t)},t.useImperativeHandle=function(e,t,r){return N().useImperativeHandle(e,t,r)},t.useLayoutEffect=function(e,t){return N().useLayoutEffect(e,t)},t.useMemo=function(e,t){return N().useMemo(e,t)},t.useReducer=function(e,t,r){return N().useReducer(e,t,r)},t.useRef=function(e){return N().useRef(e)},t.useState=function(e){return N().useState(e)},t.version="17.0.2"},2791:(e,t,r)=>{"use strict";e.exports=r(9117)},184:(e,t,r)=>{"use strict";e.exports=r(6374)},449:(e,t,r)=>{"use strict";e.exports=s;var n=r(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,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=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,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.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 r=t||0,i=this._lookup[e];if(!i)return this;if("string"===typeof r&&(r=n(t)),"number"!==typeof r)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),r),i.expires=Number(new Date)+r,this},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),r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}},1779:(e,t,r)=>{"use strict";const n=r(6222);class i{constructor(e,t,r){const i=this;this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._triggered=!1,this._timerWrapper=()=>{i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._schedule(i._scheduled)):(i._triggered=!0,e.apply(null,i._args))},this._timer=setTimeout(this._timerWrapper,t)}reschedule(e){e||(e=this._scheduled);const t=n();t+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=t,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=n(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}}e.exports=function(){if("function"!==typeof arguments[0])throw new Error("callback needed");if("number"!==typeof arguments[1])throw new Error("timeout needed");let e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new i(arguments[0],arguments[1],e)}},6222:e=>{"use strict";e.exports=function(){return Date.now()}},6327:(e,t,r)=>{"use strict";var n=r(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 r=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(c,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=l(e,r);return""===r?n:l(n,"")}},6813:(e,t)=>{"use strict";var r,n,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(r){throw setTimeout(h,0),r}};r=function(e){null!==l?setTimeout(r,0,e):(l=e,setTimeout(h,0))},n=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(r){throw E.postMessage(null),r}}else g=!1},r=function(e){y=e,g||(g=!0,E.postMessage(null))},n=function(e,r){m=d((function(){e(t.unstable_now())}),r)},i=function(){f(m),m=-1}}function _(e,t){var r=e.length;e.push(t);e:for(;;){var n=r-1>>>1,i=e[n];if(!(void 0!==i&&0<T(i,t)))break e;e[n]=t,e[r]=i,r=n}}function S(e){return void 0===(e=e[0])?null:e}function A(e){var t=e[0];if(void 0!==t){var r=e.pop();if(r!==t){e[0]=r;e:for(var n=0,i=e.length;n<i;){var o=2*(n+1)-1,s=e[o],a=o+1,c=e[a];if(void 0!==s&&0>T(s,r))void 0!==c&&0>T(c,s)?(e[n]=c,e[a]=r,n=a):(e[n]=s,e[o]=r,n=o);else{if(!(void 0!==c&&0>T(c,r)))break e;e[n]=c,e[a]=r,n=a}}}return t}return null}function T(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}var C=[],k=[],I=1,R=null,P=3,N=!1,D=!1,x=!1;function L(e){for(var t=S(k);null!==t;){if(null===t.callback)A(k);else{if(!(t.startTime<=e))break;A(k),t.sortIndex=t.expirationTime,_(C,t)}t=S(k)}}function O(e){if(x=!1,L(e),!D)if(null!==S(C))D=!0,r(B);else{var t=S(k);null!==t&&n(O,t.startTime-e)}}function B(e,r){D=!1,x&&(x=!1,i()),N=!0;var o=P;try{for(L(r),R=S(C);null!==R&&(!(R.expirationTime>r)||e&&!t.unstable_shouldYield());){var s=R.callback;if("function"===typeof s){R.callback=null,P=R.priorityLevel;var a=s(R.expirationTime<=r);r=t.unstable_now(),"function"===typeof a?R.callback=a:R===S(C)&&A(C),L(r)}else A(C);R=S(C)}if(null!==R)var c=!0;else{var l=S(k);null!==l&&n(O,l.startTime-r),c=!1}return c}finally{R=null,P=o,N=!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||N||(D=!0,r(B))},t.unstable_getCurrentPriorityLevel=function(){return P},t.unstable_getFirstCallbackNode=function(){return S(C)},t.unstable_next=function(e){switch(P){case 1:case 2:case 3:var t=3;break;default:t=P}var r=P;P=t;try{return e()}finally{P=r}},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 r=P;P=e;try{return t()}finally{P=r}},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:I++,callback:o,priorityLevel:e,startTime:s,expirationTime:c=s+c,sortIndex:-1},s>a?(e.sortIndex=s,_(k,e),null===S(C)&&e===S(k)&&(x?i():x=!0,n(O,s-a))):(e.sortIndex=c,_(C,e),D||N||(D=!0,r(B))),e},t.unstable_wrapCallback=function(e){var t=P;return function(){var r=P;P=t;try{return e.apply(this,arguments)}finally{P=r}}}},5296:(e,t,r)=>{"use strict";e.exports=r(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,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2145);t.default=()=>n.Adjectives[Math.floor(Math.random()*n.Adjectives.length)]+" "+n.Nouns[Math.floor(Math.random()*n.Nouns.length)]},8555:(e,t,r)=>{"use strict";var n=r(2861);Object.defineProperty(t,"R",{enumerable:!0,get:function(){return n.default}})},8928:e=>{"use strict";const t=new Map,r=()=>"".concat(Date.now(),":").concat(Math.floor(1e6*Math.random()));e.exports={setDelayedInterval:function(e,n,i){i=i||n;const o=r(),s=setTimeout((()=>{!async function(e,r,n){for(;t.get(n);){try{await e()}catch(i){setTimeout((()=>{throw i}),1);break}if(!t.get(n))break;await new Promise((e=>{const i=setTimeout(e,r);t.set(n,i)}))}}(e,n,o)}),i);return t.set(o,s),o},clearDelayedInterval:function(e){const r=t.get(e);r&&(clearTimeout(r),t.delete(e))}}},7683:(e,t,r)=>{"use strict";const{AbortController:n}=globalThis,i=r(1779);class o extends n{constructor(e){super(),this._ms=e,this._timer=i((()=>this.abort()),e),Object.setPrototypeOf(this,o.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=i((()=>this.abort()),this._ms)}}e.exports={TimeoutController:o}},206:(e,t,r)=>{"use strict";var n=r(9022),i=r(4847);e.exports=n.bind(null,i)},9022:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e,n,i){if("string"!==typeof n)throw new Error("Input must be string");for(var o,s,a=n.length,c=0,l=0;l<a;l+=1){if(o=n.charCodeAt(l),s=n[l],t(o)&&r(n.charCodeAt(l+1))&&(s+=n[l+=1]),(c+=e(s))===i)return n.slice(0,l+1);if(c>i)return n.slice(0,l-s.length+1)}return n}},5942:(e,t,r)=>{"use strict";var n=r(7248)},3210:(e,t,r)=>{"use strict";r(5942)},1561:(e,t,r)=>{"use strict";var n=r(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=n.useState,s=n.useEffect,a=n.useLayoutEffect,c=n.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(n){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 r=t(),n=o({inst:{value:r,getSnapshot:t}}),i=n[0].inst,u=n[1];return a((function(){i.value=r,i.getSnapshot=t,l(i)&&u({inst:i})}),[e,r,t]),s((function(){return l(i)&&u({inst:i}),e((function(){l(i)&&u({inst:i})}))}),[e]),c(r),r};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:u},7248:(e,t,r)=>{"use strict";e.exports=r(1561)},4847:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!==typeof e)throw new Error("Input must be string");for(var n=e.length,i=0,o=null,s=null,a=0;a<n;a++)r(o=e.charCodeAt(a))?null!=s&&t(s)?i+=1:i+=3:o<=127?i+=1:o>=128&&o<=2047?i+=2:o>=2048&&o<=65535&&(i+=3),s=o;return i}},3522:e=>{e.exports=function e(n,i){var o,s=0,a=0,c=i=i||0,l=n.length;do{if(c>=l||a>49)throw e.bytes=0,new RangeError("Could not decode varint");o=n[c++],s+=a<28?(o&r)<<a:(o&r)*Math.pow(2,a),a+=7}while(o>=t);return e.bytes=c-i,s};var t=128,r=127},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>=n;)o[s++]=255&i|t,i/=128;for(;i&r;)o[s++]=255&i|t,i>>>=7;return o[s]=0|i,e.bytes=s-a+1,o};var t=128,r=-128,n=Math.pow(2,31)},4561:(e,t,r)=>{e.exports={encode:r(6993),decode:r(3522),encodingLength:r(2570)}},2570:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<i?4:e<o?5:e<s?6:e<a?7:e<c?8:e<l?9:10}},7420:()=>{},5856:()=>{},5883:()=>{},5819:()=>{},1265:()=>{},5539:()=>{}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.amdO={},__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;__webpack_require__.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"===typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"===typeof r.then)return r}var i=Object.create(null);__webpack_require__.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>o[e]=()=>r[e]));return o.default=()=>r,__webpack_require__.d(i,o),i}})(),__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.p="/web-chat/";var __webpack_exports__={};(()=>{"use strict";var e={};__webpack_require__.r(e),__webpack_require__.d(e,{base58btc:()=>mc,base58flickr:()=>vc});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{base32:()=>Vc,base32hex:()=>Gc,base32hexpad:()=>Qc,base32hexpadupper:()=>Yc,base32hexupper:()=>Wc,base32pad:()=>qc,base32padupper:()=>Hc,base32upper:()=>Kc,base32z:()=>$c});var r={};__webpack_require__.r(r),__webpack_require__.d(r,{identity:()=>ll});var n={};__webpack_require__.r(n),__webpack_require__.d(n,{base2:()=>ul});var i={};__webpack_require__.r(i),__webpack_require__.d(i,{base8:()=>hl});var o={};__webpack_require__.r(o),__webpack_require__.d(o,{base10:()=>dl});var s={};__webpack_require__.r(s),__webpack_require__.d(s,{base16:()=>fl,base16upper:()=>pl});var a={};__webpack_require__.r(a),__webpack_require__.d(a,{base36:()=>gl,base36upper:()=>yl});var c={};__webpack_require__.r(c),__webpack_require__.d(c,{base64:()=>ml,base64pad:()=>vl,base64url:()=>bl,base64urlpad:()=>wl});var l={};__webpack_require__.r(l),__webpack_require__.d(l,{base256emoji:()=>Al});var u={};__webpack_require__.r(u),__webpack_require__.d(u,{sha256:()=>Il,sha512:()=>Rl});var h={};__webpack_require__.r(h),__webpack_require__.d(h,{identity:()=>Nl});var d={};__webpack_require__.r(d),__webpack_require__.d(d,{code:()=>xl,decode:()=>Ol,encode:()=>Ll,name:()=>Dl});var f={};__webpack_require__.r(f),__webpack_require__.d(f,{code:()=>Fl,decode:()=>zl,encode:()=>jl,name:()=>Ul});var p={};__webpack_require__.r(p),__webpack_require__.d(p,{Ed25519PrivateKey:()=>vy,Ed25519PublicKey:()=>my,generateKeyPair:()=>Ey,generateKeyPairFromSeed:()=>_y,unmarshalEd25519PrivateKey:()=>by,unmarshalEd25519PublicKey:()=>wy});var g={};__webpack_require__.r(g),__webpack_require__.d(g,{RsaPrivateKey:()=>qm,RsaPublicKey:()=>Km,fromJwk:()=>Wm,generateKeyPair:()=>Qm,unmarshalRsaPrivateKey:()=>Hm,unmarshalRsaPublicKey:()=>Gm});var y={};__webpack_require__.r(y),__webpack_require__.d(y,{Secp256k1PrivateKey:()=>Xm,Secp256k1PublicKey:()=>$m,generateKeyPair:()=>ev,unmarshalSecp256k1PrivateKey:()=>Jm,unmarshalSecp256k1PublicKey:()=>Zm});var m={};__webpack_require__.r(m),__webpack_require__.d(m,{base58btc:()=>Tw,base58flickr:()=>Cw});var v={};__webpack_require__.r(v),__webpack_require__.d(v,{base32:()=>kw,base32hex:()=>Nw,base32hexpad:()=>xw,base32hexpadupper:()=>Lw,base32hexupper:()=>Dw,base32pad:()=>Rw,base32padupper:()=>Pw,base32upper:()=>Iw,base32z:()=>Ow});var b={};__webpack_require__.r(b),__webpack_require__.d(b,{identity:()=>Gw});var w={};__webpack_require__.r(w),__webpack_require__.d(w,{base2:()=>Ww});var E={};__webpack_require__.r(E),__webpack_require__.d(E,{base8:()=>Qw});var _={};__webpack_require__.r(_),__webpack_require__.d(_,{base10:()=>Yw});var S={};__webpack_require__.r(S),__webpack_require__.d(S,{base16:()=>$w,base16upper:()=>Xw});var A={};__webpack_require__.r(A),__webpack_require__.d(A,{base36:()=>Jw,base36upper:()=>Zw});var T={};__webpack_require__.r(T),__webpack_require__.d(T,{base64:()=>eE,base64pad:()=>tE,base64url:()=>rE,base64urlpad:()=>nE});var C={};__webpack_require__.r(C),__webpack_require__.d(C,{base256emoji:()=>aE});var k={};__webpack_require__.r(k),__webpack_require__.d(k,{sha256:()=>hE,sha512:()=>dE});var I={};__webpack_require__.r(I),__webpack_require__.d(I,{identity:()=>pE});var R={};__webpack_require__.r(R),__webpack_require__.d(R,{code:()=>yE,decode:()=>vE,encode:()=>mE,name:()=>gE});var P={};__webpack_require__.r(P),__webpack_require__.d(P,{code:()=>_E,decode:()=>AE,encode:()=>SE,name:()=>EE});var N=__webpack_require__(2791),D=__webpack_require__.t(N,2),x=__webpack_require__(4164);function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},L.apply(this,arguments)}const O=function(e){var t=Object.create(null);return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}};var B=/^((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=O((function(e){return B.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 r;r=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,r),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 r=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{r.insertRule(e,r.cssRules.length)}catch(n){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 V(e){return e.trim()}function K(e,t,r){return e.replace(t,r)}function q(e,t){return e.indexOf(t)}function H(e,t){return 0|e.charCodeAt(t)}function G(e,t,r){return e.slice(t,r)}function W(e){return e.length}function Q(e){return e.length}function Y(e,t){return t.push(e),e}var $=1,X=1,J=0,Z=0,ee=0,te="";function re(e,t,r,n,i,o,s){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:$,column:X,length:s,return:""}}function ne(e,t){return z(re("",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,$--),ee}function oe(){return ee=Z<J?H(te,Z++):0,X++,10===ee&&(X=1,$++),ee}function se(){return H(te,Z)}function ae(){return Z}function ce(e,t){return G(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 $=X=1,J=W(te=e),Z=0,[]}function he(e){return te="",e}function de(e){return V(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",Te="@keyframes";function Ce(e,t){for(var r="",n=Q(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function ke(e,t,r,n){switch(e.type){case Ae:case Se:return e.return=e.return||e.value;case Ee:return"";case Te:return e.return=e.value+"{"+Ce(e.children,n)+"}";case _e:e.value=e.props.join(",")}return W(r=Ce(e.children,n))?e.return=e.value+"{"+r+"}":""}function Ie(e){return he(Re("",null,null,null,[""],e=ue(e),0,[0],e))}function Re(e,t,r,n,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,_=n,S=b;y;)switch(p=v,v=oe()){case 40:if(108!=p&&58==H(S,h-1)){-1!=q(S+=K(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(Ne(ye(oe(),ae()),t,r),c);break;default:S+="/"}break;case 123*g:a[l++]=W(S)*m;case 125*g:case 59:case 0:switch(v){case 0:case 125:y=0;case 59+u:f>0&&W(S)-h&&Y(f>32?De(S+";",n,r,h-1):De(K(S," ","")+";",n,r,h-2),c);break;case 59:S+=";";default:if(Y(_=Pe(S,t,r,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,_,_,n&&Y(Pe(e,_,_,0,0,i,a,b,i,w=[],h),E),i,E,h,a,n?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+W(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++]=(W(S)-1)*m,m=1;break;case 64:45===se()&&(S+=de(oe())),d=se(),u=h=W(b=S+=me(ae())),v++;break;case 45:45===p&&2==W(S)&&(g=0)}}return o}function Pe(e,t,r,n,i,o,s,a,c,l,u){for(var h=i-1,d=0===i?o:[""],f=Q(d),p=0,g=0,y=0;p<n;++p)for(var m=0,v=G(e,h+1,h=F(g=s[p])),b=e;m<f;++m)(b=V(g>0?d[m]+" "+v:K(v,/&\f/g,d[m])))&&(c[y++]=b);return re(e,t,r,0===i?_e:a,c,l,u)}function Ne(e,t,r){return re(e,t,r,Ee,j(ee),G(e,2,-2),0)}function De(e,t,r,n){return re(e,t,r,Se,G(e,0,n),G(e,n+1,-1),n)}var xe=function(e,t,r){for(var n=0,i=0;n=i,i=se(),38===n&&12===i&&(t[r]=1),!le(i);)oe();return ce(e,Z)},Le=function(e,t){return he(function(e,t){var r=-1,n=44;do{switch(le(n)){case 0:38===n&&12===se()&&(t[r]=1),e[r]+=xe(Z-1,t,r);break;case 2:e[r]+=de(n);break;case 4:if(44===n){e[++r]=58===se()?"&\f":"",t[r]=e[r].length;break}default:e[r]+=j(n)}}while(n=oe());return e}(ue(e),t))},Oe=new WeakMap,Be=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;"rule"!==r.type;)if(!(r=r.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Oe.get(r))&&!n){Oe.set(e,!0);for(var i=[],o=Le(t,i),s=r.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+K(e,/(\w+).+(:[^]+)/,we+"box-$1$2"+ve+"flex-$1$2")+e;case 5443:return we+e+ve+"flex-item-"+K(e,/flex-|-self/,"")+e;case 4675:return we+e+ve+"flex-line-pack"+K(e,/align-content|flex-|-self/,"")+e;case 5548:return we+e+ve+K(e,"shrink","negative")+e;case 5292:return we+e+ve+K(e,"basis","preferred-size")+e;case 6060:return we+"box-"+K(e,"-grow","")+we+e+ve+K(e,"grow","positive")+e;case 4554:return we+K(e,/([^-])(transform)/g,"$1"+we+"$2")+e;case 6187:return K(K(K(e,/(zoom-|grab)/,we+"$1"),/(image-set)/,we+"$1"),e,"")+e;case 5495:case 3959:return K(e,/(image-set\([^]*)/,we+"$1$`$1");case 4968:return K(K(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 K(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(W(e)-1-t>6)switch(H(e,t+1)){case 109:if(45!==H(e,t+4))break;case 102:return K(e,/(.+:)(.+)-([^]+)/,"$1"+we+"$2-$3$1"+be+(108==H(e,t+3)?"$3":"$2-$3"))+e;case 115:return~q(e,"stretch")?Ue(K(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==H(e,t+1))break;case 6444:switch(H(e,W(e)-3-(~q(e,"!important")&&10))){case 107:return K(e,":",":"+we)+e;case 101:return K(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+K(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return we+e+ve+K(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return we+e+ve+K(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return we+e+ve+e+e}return e}var Fe=[function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Se:e.return=Ue(e.value,e.length);break;case Te:return Ce([ne(e,{value:K(e.value,"@","@"+we)})],n);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 Ce([ne(e,{props:[K(t,/:(read-\w+)/,":"+be+"$1")]})],n);case"::placeholder":return Ce([ne(e,{props:[K(t,/:(plac\w+)/,":"+we+"input-$1")]}),ne(e,{props:[K(t,/:(plac\w+)/,":"+be+"$1")]}),ne(e,{props:[K(t,/:(plac\w+)/,ve+"input-$1")]})],n)}return""}))}}];const je=function(e){var t=e.key;if("css"===t){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var n=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(" "),r=1;r<t.length;r++)s[t[r]]=!0;a.push(e)}));var c,l,u=[ke,(l=function(e){c.insert(e)},function(e){e.root||(e=e.return)&&l(e)})],h=function(e){var t=Q(e);return function(r,n,i,o){for(var s="",a=0;a<t;a++)s+=e[a](r,n,i,o)||"";return s}}([Be,Me].concat(n,u));o=function(e,t,r,n){c=r,Ce(Ie(e?e+"{"+t.styles+"}":t.styles),h),n&&(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(r){if(t.has(r))return t.get(r);var n=e(r);return t.set(r,n),n}};function Ve(e,t,r){var n="";return r.split(" ").forEach((function(r){void 0!==e[r]?t.push(e[r]+";"):n+=r+" "})),n}var Ke=function(e,t,r){var n=e.key+"-"+t.name;!1===r&&void 0===e.registered[n]&&(e.registered[n]=t.styles)},qe=function(e,t,r){Ke(e,t,r);var n=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var i=t;do{e.insert(t===i?"."+n:"",i,e.sheet,!0);i=i.next}while(void 0!==i)}};const He=function(e){for(var t,r=0,n=0,i=e.length;i>=4;++n,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(t>>>16)<<16),r=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(i){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)};const Ge={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 We=/[A-Z]|^ms/g,Qe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Ye=function(e){return 45===e.charCodeAt(1)},$e=function(e){return null!=e&&"boolean"!==typeof e},Xe=O((function(e){return Ye(e)?e:e.replace(We,"-$&").toLowerCase()})),Je=function(e,t){switch(e){case"animation":case"animationName":if("string"===typeof t)return t.replace(Qe,(function(e,t,r){return et={name:t,styles:r,next:et},t}))}return 1===Ge[e]||Ye(e)||"number"!==typeof t||0===t?t:t+"px"};function Ze(e,t,r){if(null==r)return"";if(void 0!==r.__emotion_styles)return r;switch(typeof r){case"boolean":return"";case"object":if(1===r.anim)return et={name:r.name,styles:r.styles,next:et},r.name;if(void 0!==r.styles){var n=r.next;if(void 0!==n)for(;void 0!==n;)et={name:n.name,styles:n.styles,next:et},n=n.next;return r.styles+";"}return function(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Ze(e,t,r[i])+";";else for(var o in r){var s=r[o];if("object"!==typeof s)null!=t&&void 0!==t[s]?n+=o+"{"+t[s]+"}":$e(s)&&(n+=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":n+=Xe(o)+":"+a+";";break;default:n+=o+"{"+a+"}"}}else for(var c=0;c<s.length;c++)$e(s[c])&&(n+=Xe(o)+":"+Je(o,s[c])+";")}return n}(e,t,r);case"function":if(void 0!==e){var i=et,o=r(e);return et=i,Ze(e,t,o)}}if(null==t)return r;var s=t[r];return void 0!==s?s:r}var et,tt=/label:\s*([^\s;\n{]+)\s*(;|$)/g;var rt=function(e,t,r){if(1===e.length&&"object"===typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n=!0,i="";et=void 0;var o=e[0];null==o||void 0===o.raw?(n=!1,i+=Ze(r,t,o)):i+=o[0];for(var s=1;s<e.length;s++)i+=Ze(r,t,e[s]),n&&(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}},nt=!!D.useInsertionEffect&&D.useInsertionEffect,it=nt||function(e){return e()},ot=(nt||N.useLayoutEffect,{}.hasOwnProperty),st=(0,N.createContext)("undefined"!==typeof HTMLElement?je({key:"css"}):null);st.Provider;var at=function(e){return(0,N.forwardRef)((function(t,r){var n=(0,N.useContext)(st);return e(t,n,r)}))},ct=(0,N.createContext)({});var lt=function(){return(0,N.useContext)(ct)},ut=ze((function(e){return ze((function(t){return function(e,t){return"function"===typeof t?t(e):L({},e,t)}(e,t)}))})),ht=function(e){var t=(0,N.useContext)(ct);return e.theme!==t&&(t=ut(t)(e.theme)),(0,N.createElement)(ct.Provider,{value:t},e.children)};var dt="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",ft=function(e,t){var r={};for(var n in t)ot.call(t,n)&&(r[n]=t[n]);return r[dt]=e,r},pt=function(e){var t=e.cache,r=e.serialized,n=e.isStringTag;Ke(t,r,n);it((function(){return qe(t,r,n)}));return null},gt=at((function(e,t,r){var n=e.css;"string"===typeof n&&void 0!==t.registered[n]&&(n=t.registered[n]);var i=e[dt],o=[n],s="";"string"===typeof e.className?s=Ve(t.registered,o,e.className):null!=e.className&&(s=e.className+" ");var a=rt(o,void 0,(0,N.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=r,c.className=s,(0,N.createElement)(N.Fragment,null,(0,N.createElement)(pt,{cache:t,serialized:a,isStringTag:"string"===typeof i}),(0,N.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,r){var n;if(t){var i=t.shouldForwardProp;n=e.__emotion_forwardProp&&i?function(t){return e.__emotion_forwardProp(t)&&i(t)}:i}return"function"!==typeof n&&r&&(n=e.__emotion_forwardProp),n},wt=function(e){var t=e.cache,r=e.serialized,n=e.isStringTag;Ke(t,r,n);it((function(){return qe(t,r,n)}));return null};const Et=function e(t,r){var n,i,o=t.__emotion_real===t,s=o&&t.__emotion_base||t;void 0!==r&&(n=r.label,i=r.target);var a=bt(t,r,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!==n&&h.push("label:"+n+";"),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,r){var n=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,N.useContext)(ct)}"string"===typeof e.className?o=Ve(t.registered,u,e.className):null!=e.className&&(o=e.className+" ");var p=rt(h.concat(u),t.registered,d);o+=t.key+"-"+p.name,void 0!==i&&(o+=" "+i);var g=l&&void 0===a?vt(n):c,y={};for(var m in e)l&&"as"===m||g(m)&&(y[m]=e[m]);return y.className=o,y.ref=r,(0,N.createElement)(N.Fragment,null,(0,N.createElement)(wt,{cache:t,serialized:p,isStringTag:"string"===typeof n}),(0,N.createElement)(n,y))}));return p.displayName=void 0!==n?n:"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,n){return e(t,L({},r,n,{shouldForwardProp:bt(p,n,!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 Tt(e,t){return At.call(t,e)}var Ct=Array.isArray;function kt(e){return"object"===typeof e&&null!==e&&!Ct(e)}function It(e,t){return Object.keys(t).reduce((function(r,n){return r[n]=e(t[n]),r}),{})}function Rt(e,t){for(var r=0;r<t.length;r++){var n=t[r];if(e(n))return n}}function Pt(e,t){for(var r=0;r<t.length;r++)if(e(t[r]))return r;return-1}function Nt(e){return e}function Dt(e,t){return Object.keys(t).forEach((function(r){e(t[r],r)}))}function xt(){return Math.random().toString(36).substring(2)}function Lt(e){return 0===(Ct(e)?e:Object.keys(e)).length}function Ot(e,t){return Object.keys(t).reduce((function(r,n){return r[e(n)]=t[n],r}),{})}function Bt(e,t){if(Lt(t))return e;var r={};return Dt((function(n,i){if(Tt(i,t))if(kt(e[i])&&kt(t[i]))r[i]=Bt(e[i],t[i]);else if(Ct(e[i])&&Ct(t[i])){var o=Math.max(e[i].length,t[i].length);r[i]=new Array(o);for(var s=0;s<o;s++)s in t[i]?r[i][s]=t[i][s]:s in e[i]&&(r[i][s]=e[i][s])}else r[i]=t[i];else r[i]=e[i]}),e),Dt((function(e,n){Tt(n,r)||(r[n]=t[n])}),t),r}function Mt(){}function Ut(e,t){return Object.keys(t).reduce((function(r,n){return e(t[n],n)||(r[n]=t[n]),r}),{})}function Ft(e){var t,r=!1;return function(){return r?t:(r=!0,t=e.apply(void 0,arguments))}}function jt(e,t){return Object.keys(t).reduce((function(r,n){return e(t[n],n)&&(r[n]=t[n]),r}),{})}var zt=/\s+$/;__webpack_require__(2110);var Vt=function(e,t){var r=arguments;if(null==t||!ot.call(t,"css"))return N.createElement.apply(void 0,r);var n=r.length,i=new Array(n);i[0]=gt,i[1]=ft(e,t);for(var o=2;o<n;o++)i[o]=r[o];return N.createElement.apply(null,i)};function Kt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return rt(t)}var qt=function e(t){for(var r=t.length,n=0,i="";n<r;n++){var o=t[n];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,r=e.serializedArr;it((function(){for(var e=0;e<r.length;e++)qe(t,r[e],!1)}));return null},Gt=at((function(e,t){var r=[],n=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var o=rt(n,t.registered);return r.push(o),Ke(t,o,!1),t.key+"-"+o.name},i={css:n,cx:function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return function(e,t,r){var n=[],i=Ve(e,n,r);return n.length<2?r:i+t(n)}(t.registered,n,qt(r))},theme:(0,N.useContext)(ct)},o=e.children(i);return!0,(0,N.createElement)(N.Fragment,null,(0,N.createElement)(Ht,{cache:t,serializedArr:r}),o)}));function Wt(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}var Qt=__webpack_require__(2007),Yt=__webpack_require__.n(Qt);function $t(e,t){return $t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$t(e,t)}function Xt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,$t(e,t)}const Jt=!1,Zt=N.createContext(null);var er=function(e){return e.scrollTop},tr="unmounted",rr="exited",nr="entering",ir="entered",or="exiting",sr=function(e){function t(t,r){var n;n=e.call(this,t,r)||this;var i,o=r&&!r.isMounting?t.enter:t.appear;return n.appearStatus=null,t.in?o?(i=rr,n.appearStatus=nr):i=ir:i=t.unmountOnExit||t.mountOnEnter?tr:rr,n.state={status:i},n.nextCallback=null,n}Xt(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===tr?{status:rr}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(e){var t=null;if(e!==this.props){var r=this.state.status;this.props.in?r!==nr&&r!==ir&&(t=nr):r!==nr&&r!==ir||(t=or)}this.updateStatus(!1,t)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var e,t,r,n=this.props.timeout;return e=t=r=n,null!=n&&"number"!==typeof n&&(e=n.exit,t=n.enter,r=void 0!==n.appear?n.appear:t),{exit:e,enter:t,appear:r}},r.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===nr){if(this.props.unmountOnExit||this.props.mountOnEnter){var r=this.props.nodeRef?this.props.nodeRef.current:x.findDOMNode(this);r&&er(r)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===rr&&this.setState({status:tr})},r.performEnter=function(e){var t=this,r=this.props.enter,n=this.context?this.context.isMounting:e,i=this.props.nodeRef?[n]:[x.findDOMNode(this),n],o=i[0],s=i[1],a=this.getTimeouts(),c=n?a.appear:a.enter;!e&&!r||Jt?this.safeSetState({status:ir},(function(){t.props.onEntered(o)})):(this.props.onEnter(o,s),this.safeSetState({status:nr},(function(){t.props.onEntering(o,s),t.onTransitionEnd(c,(function(){t.safeSetState({status:ir},(function(){t.props.onEntered(o,s)}))}))})))},r.performExit=function(){var e=this,t=this.props.exit,r=this.getTimeouts(),n=this.props.nodeRef?void 0:x.findDOMNode(this);t&&!Jt?(this.props.onExit(n),this.safeSetState({status:or},(function(){e.props.onExiting(n),e.onTransitionEnd(r.exit,(function(){e.safeSetState({status:rr},(function(){e.props.onExited(n)}))}))}))):this.safeSetState({status:rr},(function(){e.props.onExited(n)}))},r.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},r.setNextCallback=function(e){var t=this,r=!0;return this.nextCallback=function(n){r&&(r=!1,t.nextCallback=null,e(n))},this.nextCallback.cancel=function(){r=!1},this.nextCallback},r.onTransitionEnd=function(e,t){this.setNextCallback(t);var r=this.props.nodeRef?this.props.nodeRef.current:x.findDOMNode(this),n=null==e&&!this.props.addEndListener;if(r&&!n){if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[r,this.nextCallback],o=i[0],s=i[1];this.props.addEndListener(o,s)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},r.render=function(){var e=this.state.status;if(e===tr)return null;var t=this.props,r=t.children,n=(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,Wt(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return N.createElement(Zt.Provider,{value:null},"function"===typeof r?r(e,n):N.cloneElement(N.Children.only(r),n))},t}(N.Component);function ar(){}sr.contextType=Zt,sr.propTypes={},sr.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:ar,onEntering:ar,onEntered:ar,onExit:ar,onExiting:ar,onExited:ar},sr.UNMOUNTED=tr,sr.EXITED=rr,sr.ENTERING=nr,sr.ENTERED=ir,sr.EXITING=or;const cr=sr;function lr(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var ur=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return n=t,void((r=e).classList?r.classList.remove(n):"string"===typeof r.className?r.className=lr(r.className,n):r.setAttribute("class",lr(r.className&&r.className.baseVal||"",n)));var r,n}))},hr=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,r){var n=t.resolveArguments(e,r),i=n[0],o=n[1];t.removeClasses(i,"exit"),t.addClass(i,o?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,r)},t.onEntering=function(e,r){var n=t.resolveArguments(e,r),i=n[0],o=n[1]?"appear":"enter";t.addClass(i,o,"active"),t.props.onEntering&&t.props.onEntering(e,r)},t.onEntered=function(e,r){var n=t.resolveArguments(e,r),i=n[0],o=n[1]?"appear":"enter";t.removeClasses(i,o),t.addClass(i,o,"done"),t.props.onEntered&&t.props.onEntered(e,r)},t.onExit=function(e){var r=t.resolveArguments(e)[0];t.removeClasses(r,"appear"),t.removeClasses(r,"enter"),t.addClass(r,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var r=t.resolveArguments(e)[0];t.addClass(r,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var r=t.resolveArguments(e)[0];t.removeClasses(r,"exit"),t.addClass(r,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,r){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,r]},t.getClassNames=function(e){var r=t.props.classNames,n="string"===typeof r,i=n?""+(n&&r?r+"-":"")+e:r[e];return{baseClassName:i,activeClassName:n?i+"-active":r[e+"Active"],doneClassName:n?i+"-done":r[e+"Done"]}},t}Xt(t,e);var r=t.prototype;return r.addClass=function(e,t,r){var n=this.getClassNames(t)[r+"ClassName"],i=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===r&&i&&(n+=" "+i),"active"===r&&e&&er(e),n&&(this.appliedClasses[t][r]=n,function(e,t){e&&t&&t.split(" ").forEach((function(t){return n=t,void((r=e).classList?r.classList.add(n):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(r,n)||("string"===typeof r.className?r.className=r.className+" "+n:r.setAttribute("class",(r.className&&r.className.baseVal||"")+" "+n)));var r,n}))}(e,n))},r.removeClasses=function(e,t){var r=this.appliedClasses[t],n=r.base,i=r.active,o=r.done;this.appliedClasses[t]={},n&&ur(e,n),i&&ur(e,i),o&&ur(e,o)},r.render=function(){var e=this.props,t=(e.classNames,Wt(e,["classNames"]));return N.createElement(cr,L({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(N.Component);hr.defaultProps={classNames:""},hr.propTypes={};const dr=hr;function fr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pr(e,t){var r=Object.create(null);return e&&N.Children.map(e,(function(e){return e})).forEach((function(e){r[e.key]=function(e){return t&&(0,N.isValidElement)(e)?t(e):e}(e)})),r}function gr(e,t,r){return null!=r[t]?r[t]:e.props[t]}function yr(e,t,r){var n=pr(e.children),i=function(e,t){function r(r){return r in t?t[r]:e[r]}e=e||{},t=t||{};var n,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(n=0;n<i[c].length;n++){var l=i[c][n];a[i[c][n]]=r(l)}a[c]=r(c)}for(n=0;n<o.length;n++)a[o[n]]=r(o[n]);return a}(t,n);return Object.keys(i).forEach((function(o){var s=i[o];if((0,N.isValidElement)(s)){var a=o in t,c=o in n,l=t[o],u=(0,N.isValidElement)(l)&&!l.props.in;!c||a&&!u?c||!a||u?c&&a&&(0,N.isValidElement)(l)&&(i[o]=(0,N.cloneElement)(s,{onExited:r.bind(null,s),in:l.props.in,exit:gr(s,"exit",e),enter:gr(s,"enter",e)})):i[o]=(0,N.cloneElement)(s,{in:!1}):i[o]=(0,N.cloneElement)(s,{onExited:r.bind(null,s),in:!0,exit:gr(s,"exit",e),enter:gr(s,"enter",e)})}})),i}var mr=Object.values||function(e){return Object.keys(e).map((function(t){return e[t]}))},vr=function(e){function t(t,r){var n,i=(n=e.call(this,t,r)||this).handleExited.bind(fr(n));return n.state={contextValue:{isMounting:!0},handleExited:i,firstRender:!0},n}Xt(t,e);var r=t.prototype;return r.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},r.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(e,t){var r,n,i=t.children,o=t.handleExited;return{children:t.firstRender?(r=e,n=o,pr(r.children,(function(e){return(0,N.cloneElement)(e,{onExited:n.bind(null,e),in:!0,appear:gr(e,"appear",r),enter:gr(e,"enter",r),exit:gr(e,"exit",r)})}))):yr(e,i,o),firstRender:!1}},r.handleExited=function(e,t){var r=pr(this.props.children);e.key in r||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState((function(t){var r=L({},t.children);return delete r[e.key],{children:r}})))},r.render=function(){var e=this.props,t=e.component,r=e.childFactory,n=Wt(e,["component","childFactory"]),i=this.state.contextValue,o=mr(this.state.children).map(r);return delete n.appear,delete n.enter,delete n.exit,null===t?N.createElement(Zt.Provider,{value:i},o):N.createElement(Zt.Provider,{value:i},N.createElement(t,n,o))},t}(N.Component);vr.propTypes={},vr.defaultProps={component:"div",childFactory:function(e){return e}};const br=vr;function wr(e,t){return t||(t=e.slice(0)),e.raw=t,e}function Er(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Er(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}const _r=function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Er(e))&&(n&&(n+=" "),n+=t);return n},Sr="undefined"!==typeof window?N.useLayoutEffect:()=>{};let Ar=new Map;function Tr(e,t){if(e===t)return e;let r=Ar.get(e);if(r)return r(t),t;let n=Ar.get(t);return n?(n(e),e):t}function Cr(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(){for(let e of t)"function"===typeof e&&e(...arguments)}}function kr(){let e={...arguments.length<=0?void 0:arguments[0]};for(let t=1;t<arguments.length;t++){let r=t<0||arguments.length<=t?void 0:arguments[t];for(let t in r){let n=e[t],i=r[t];"function"===typeof n&&"function"===typeof i&&"o"===t[0]&&"n"===t[1]&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90?e[t]=Cr(n,i):"className"!==t&&"UNSAFE_className"!==t||"string"!==typeof n||"string"!==typeof i?"id"===t&&n&&i?e.id=Tr(n,i):e[t]=void 0!==i?i:n:e[t]=_r(n,i)}}return e}const Ir=new Set(["id"]),Rr=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),Pr=/^(data-.*)$/;function Nr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{labelable:r,propNames:n}=t,i={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Ir.has(o)||r&&Rr.has(o)||(null===n||void 0===n?void 0:n.has(o))||Pr.test(o))&&(i[o]=e[o]);return i}function Dr(e){if(function(){if(null==xr){xr=!1;try{document.createElement("div").focus({get preventScroll(){return xr=!0,!0}})}catch(e){}}return xr}())e.focus({preventScroll:!0});else{let t=function(e){var t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft});return r}(e);e.focus(),function(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}(t)}}let xr=null;let Lr=new Map,Or=new Set;function Br(){if("undefined"===typeof window)return;let e=t=>{let r=Lr.get(t.target);if(r&&(r.delete(t.propertyName),0===r.size&&(t.target.removeEventListener("transitioncancel",e),Lr.delete(t.target)),0===Lr.size)){for(let e of Or)e();Or.clear()}};document.body.addEventListener("transitionrun",(t=>{let r=Lr.get(t.target);r||(r=new Set,Lr.set(t.target,r),t.target.addEventListener("transitioncancel",e)),r.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function Mr(e){requestAnimationFrame((()=>{0===Lr.size?e():Or.add(e)}))}"undefined"!==typeof document&&("loading"!==document.readyState?Br():document.addEventListener("DOMContentLoaded",Br));function Ur(){let e=(0,N.useRef)(new Map),t=(0,N.useCallback)(((t,r,n,i)=>{let o=(null===i||void 0===i?void 0:i.once)?function(){e.current.delete(n),n(...arguments)}:n;e.current.set(n,{type:r,eventTarget:t,fn:o,options:i}),t.addEventListener(r,n,i)}),[]),r=(0,N.useCallback)(((t,r,n,i)=>{var o;let s=(null===(o=e.current.get(n))||void 0===o?void 0:o.fn)||n;t.removeEventListener(r,s,i),e.current.delete(n)}),[]),n=(0,N.useCallback)((()=>{e.current.forEach(((e,t)=>{r(e.eventTarget,e.type,t,e.options)}))}),[r]);return(0,N.useEffect)((()=>n),[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function Fr(e,t){Sr((()=>{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 jr(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 zr(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 Vr(){return zr(/^Mac/i)}function Kr(){return zr(/^iPhone/i)||zr(/^iPad/i)||Vr()&&navigator.maxTouchPoints>1}function qr(e){return!(0!==e.mozInputSource||!e.isTrusted)||(jr(/Android/i)&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}let Hr="default",Gr="",Wr=new WeakMap;function Qr(e){Kr()?("default"===Hr&&(Gr=document.documentElement.style.webkitUserSelect,document.documentElement.style.webkitUserSelect="none"),Hr="disabled"):(e instanceof HTMLElement||e instanceof SVGElement)&&(Wr.set(e,e.style.userSelect),e.style.userSelect="none")}function Yr(e){if(Kr()){if("disabled"!==Hr)return;Hr="restoring",setTimeout((()=>{Mr((()=>{"restoring"===Hr&&("none"===document.documentElement.style.webkitUserSelect&&(document.documentElement.style.webkitUserSelect=Gr||""),Gr="",Hr="default")}))}),300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Wr.has(e)){let t=Wr.get(e);"none"===e.style.userSelect&&(e.style.userSelect=t),""===e.getAttribute("style")&&e.removeAttribute("style"),Wr.delete(e)}}const $r=N.createContext(null);function Xr(e){let{onPress:t,onPressChange:r,onPressStart:n,onPressEnd:i,onPressUp:o,isDisabled:s,isPressed:a,preventFocusOnPress:c,shouldCancelOnPointerExit:l,allowTextSelectionOnPress:u,ref:h,...d}=function(e){let t=(0,N.useContext)($r);if(t){let{register:r,...n}=t;e=kr(n,e),r()}return Fr(t,e.ref),e}(e),f=(0,N.useRef)(null);f.current={onPress:t,onPressChange:r,onPressStart:n,onPressEnd:i,onPressUp:o,isDisabled:s,shouldCancelOnPointerExit:l};let[p,g]=(0,N.useState)(!1),y=(0,N.useRef)({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:m,removeAllGlobalListeners:v}=Ur(),b=(0,N.useMemo)((()=>{let e=y.current,t=(t,r)=>{let{onPressStart:n,onPressChange:i,isDisabled:o}=f.current;o||e.didFirePressStart||(n&&n({type:"pressstart",pointerType:r,target:t.currentTarget,shiftKey:t.shiftKey,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey}),i&&i(!0),e.didFirePressStart=!0,g(!0))},r=function(t,r){let n=!(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:r,target:t.currentTarget,shiftKey:t.shiftKey,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey}),o&&o(!1),g(!1),s&&n&&!a&&s({type:"press",pointerType:r,target:t.currentTarget,shiftKey:t.shiftKey,metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey}))},n=(e,t)=>{let{onPressUp:r,isDisabled:n}=f.current;n||r&&r({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&&r(tn(e.target,t),e.pointerType,!1),e.isPressed=!1,e.isOverTarget=!1,e.activePointerId=null,e.pointerType=null,v(),u||Yr(e.target))},o={onKeyDown(r){Zr(r.nativeEvent,r.currentTarget)&&r.currentTarget.contains(r.target)?(on(r.target,r.key)&&r.preventDefault(),r.stopPropagation(),e.isPressed||r.repeat||(e.target=r.currentTarget,e.isPressed=!0,t(r,"keyboard"),m(document,"keyup",a,!1))):"Enter"===r.key&&Jr(r.currentTarget)&&r.stopPropagation()},onKeyUp(t){Zr(t.nativeEvent,t.currentTarget)&&!t.repeat&&t.currentTarget.contains(t.target)&&n(tn(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&&!qr(i.nativeEvent)||(s||c||Dr(i.currentTarget),t(i,"virtual"),n(i,"virtual"),r(i,"virtual")),e.ignoreEmulatedMouseEvents=!1,e.ignoreClickAfterPress=!1)}},a=t=>{if(e.isPressed&&Zr(t,e.target)){on(t.target,t.key)&&t.preventDefault(),t.stopPropagation(),e.isPressed=!1;let n=t.target;r(tn(e.target,t),"keyboard",e.target.contains(n)),v(),e.target instanceof HTMLElement&&e.target.contains(n)&&(Jr(e.target)||"link"===e.target.getAttribute("role"))&&e.target.click()}};if("undefined"!==typeof PointerEvent){o.onPointerDown=r=>{var n;0===r.button&&r.currentTarget.contains(r.target)&&(0===(n=r.nativeEvent).width&&0===n.height||1===n.width&&1===n.height&&0===n.pressure&&0===n.detail&&"mouse"===n.pointerType?e.pointerType="virtual":(nn(r.currentTarget)&&r.preventDefault(),e.pointerType=r.pointerType,r.stopPropagation(),e.isPressed||(e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=r.pointerId,e.target=r.currentTarget,s||c||Dr(r.currentTarget),u||Qr(e.target),t(r,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&&(nn(e.currentTarget)&&e.preventDefault(),e.stopPropagation())},o.onPointerUp=t=>{t.currentTarget.contains(t.target)&&"virtual"!==e.pointerType&&0===t.button&&rn(t,t.currentTarget)&&n(t,e.pointerType||t.pointerType)};let a=n=>{n.pointerId===e.activePointerId&&(rn(n,e.target)?e.isOverTarget||(e.isOverTarget=!0,t(tn(e.target,n),e.pointerType)):e.isOverTarget&&(e.isOverTarget=!1,r(tn(e.target,n),e.pointerType,!1),f.current.shouldCancelOnPointerExit&&i(n)))},l=t=>{t.pointerId===e.activePointerId&&e.isPressed&&0===t.button&&(rn(t,e.target)?r(tn(e.target,t),e.pointerType):e.isOverTarget&&r(tn(e.target,t),e.pointerType,!1),e.isPressed=!1,e.isOverTarget=!1,e.activePointerId=null,e.pointerType=null,v(),u||Yr(e.target))},h=e=>{i(e)};o.onDragStart=e=>{e.currentTarget.contains(e.target)&&i(e)}}else{o.onMouseDown=r=>{0===r.button&&r.currentTarget.contains(r.target)&&(nn(r.currentTarget)&&r.preventDefault(),r.stopPropagation(),e.ignoreEmulatedMouseEvents||(e.isPressed=!0,e.isOverTarget=!0,e.target=r.currentTarget,e.pointerType=qr(r.nativeEvent)?"virtual":"mouse",s||c||Dr(r.currentTarget),t(r,e.pointerType),m(document,"mouseup",a,!1)))},o.onMouseEnter=r=>{r.currentTarget.contains(r.target)&&(r.stopPropagation(),e.isPressed&&!e.ignoreEmulatedMouseEvents&&(e.isOverTarget=!0,t(r,e.pointerType)))},o.onMouseLeave=t=>{t.currentTarget.contains(t.target)&&(t.stopPropagation(),e.isPressed&&!e.ignoreEmulatedMouseEvents&&(e.isOverTarget=!1,r(t,e.pointerType,!1),f.current.shouldCancelOnPointerExit&&i(t)))},o.onMouseUp=t=>{t.currentTarget.contains(t.target)&&(e.ignoreEmulatedMouseEvents||0!==t.button||n(t,e.pointerType))};let a=t=>{0===t.button&&(e.isPressed=!1,v(),e.ignoreEmulatedMouseEvents?e.ignoreEmulatedMouseEvents=!1:(rn(t,e.target)?r(tn(e.target,t),e.pointerType):e.isOverTarget&&r(tn(e.target,t),e.pointerType,!1),e.isOverTarget=!1))};o.onTouchStart=r=>{if(!r.currentTarget.contains(r.target))return;r.stopPropagation();let n=function(e){const{targetTouches:t}=e;return t.length>0?t[0]:null}(r.nativeEvent);n&&(e.activePointerId=n.identifier,e.ignoreEmulatedMouseEvents=!0,e.isOverTarget=!0,e.isPressed=!0,e.target=r.currentTarget,e.pointerType="touch",s||c||Dr(r.currentTarget),u||Qr(e.target),t(r,e.pointerType),m(window,"scroll",l,!0))},o.onTouchMove=n=>{if(!n.currentTarget.contains(n.target))return;if(n.stopPropagation(),!e.isPressed)return;let o=en(n.nativeEvent,e.activePointerId);o&&rn(o,n.currentTarget)?e.isOverTarget||(e.isOverTarget=!0,t(n,e.pointerType)):e.isOverTarget&&(e.isOverTarget=!1,r(n,e.pointerType,!1),f.current.shouldCancelOnPointerExit&&i(n))},o.onTouchEnd=t=>{if(!t.currentTarget.contains(t.target))return;if(t.stopPropagation(),!e.isPressed)return;let i=en(t.nativeEvent,e.activePointerId);i&&rn(i,t.currentTarget)?(n(t,e.pointerType),r(t,e.pointerType)):e.isOverTarget&&r(t,e.pointerType,!1),e.isPressed=!1,e.activePointerId=null,e.isOverTarget=!1,e.ignoreEmulatedMouseEvents=!0,u||Yr(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,N.useEffect)((()=>()=>{u||Yr(y.current.target)}),[u]),{isPressed:a||p,pressProps:kr(d,b)}}function Jr(e){return"A"===e.tagName&&e.hasAttribute("href")}function Zr(e,t){const{key:r,code:n}=e,i=t,o=i.getAttribute("role");return("Enter"===r||" "===r||"Spacebar"===r||"Space"===n)&&!(i instanceof HTMLInputElement&&!an(i,r)||i instanceof HTMLTextAreaElement||i.isContentEditable)&&(!Jr(i)||"button"===o&&"Enter"!==r)&&!("link"===o&&"Enter"!==r)}function en(e,t){const r=e.changedTouches;for(let n=0;n<r.length;n++){const e=r[n];if(e.identifier===t)return e}return null}function tn(e,t){return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey}}function rn(e,t){let r=t.getBoundingClientRect(),n=function(e){let t=e.width/2||e.radiusX||0,r=e.height/2||e.radiusY||0;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,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)}(r,n)}function nn(e){return!(e instanceof HTMLElement)||!e.draggable}function on(e,t){return e instanceof HTMLInputElement?!an(e,t):!(e instanceof HTMLButtonElement)||"submit"!==e.type}$r.displayName="PressResponderContext";const sn=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function an(e,t){return"checkbox"===e.type||"radio"===e.type?" "===t:sn.has(e.type)}class cn{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 ln(e){let t=(0,N.useRef)({isFocused:!1,onBlur:e,observer:null});return t.current.onBlur=e,Sr((()=>{const e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}}),[]),(0,N.useCallback)((e=>{if(e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=e.target,n=e=>{var n,i;t.current.isFocused=!1,r.disabled&&(null===(i=(n=t.current).onBlur)||void 0===i||i.call(n,new cn("blur",e))),t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};r.addEventListener("focusout",n,{once:!0}),t.current.observer=new MutationObserver((()=>{t.current.isFocused&&r.disabled&&(t.current.observer.disconnect(),r.dispatchEvent(new FocusEvent("blur")),r.dispatchEvent(new FocusEvent("focusout",{bubbles:!0})))})),t.current.observer.observe(r,{attributes:!0,attributeFilter:["disabled"]})}}),[])}function un(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:i}=e;const o=(0,N.useCallback)((e=>{if(e.target===e.currentTarget)return n&&n(e),i&&i(!1),!0}),[n,i]),s=ln(o),a=(0,N.useCallback)((e=>{e.target===e.currentTarget&&(r&&r(e),i&&i(!0),s(e))}),[i,r,s]);return{focusProps:{onFocus:!t&&(r||i||n)?a:void 0,onBlur:t||!n&&!i?void 0:o}}}let hn=null,dn=new Set,fn=!1,pn=!1,gn=!1;const yn={Tab:!0,Escape:!0};function mn(e,t){for(let r of dn)r(e,t)}function vn(e){pn=!0,function(e){return!(e.metaKey||!Vr()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(hn="keyboard",mn("keyboard",e))}function bn(e){hn="pointer","mousedown"!==e.type&&"pointerdown"!==e.type||(pn=!0,mn("pointer",e))}function wn(e){qr(e)&&(pn=!0,hn="virtual")}function En(e){e.target!==window&&e.target!==document&&(pn||gn||(hn="virtual",mn("virtual",e)),pn=!1,gn=!1)}function _n(){pn=!1,gn=!0}function Sn(){if("undefined"===typeof window||fn)return;let e=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(){pn=!0,e.apply(this,arguments)},document.addEventListener("keydown",vn,!0),document.addEventListener("keyup",vn,!0),document.addEventListener("click",wn,!0),window.addEventListener("focus",En,!0),window.addEventListener("blur",_n,!1),"undefined"!==typeof PointerEvent?(document.addEventListener("pointerdown",bn,!0),document.addEventListener("pointermove",bn,!0),document.addEventListener("pointerup",bn,!0)):(document.addEventListener("mousedown",bn,!0),document.addEventListener("mousemove",bn,!0),document.addEventListener("mouseup",bn,!0)),fn=!0}function An(){return"pointer"!==hn}function Tn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{isTextInput:t,autoFocus:r}=e,[n,i]=(0,N.useState)(r||An());var o,s,a;return o=e=>{i(e)},s=[t],a={isTextInput:t},Sn(),(0,N.useEffect)((()=>{let e=(e,t)=>{(function(e,t,r){return!(e&&"keyboard"===t&&r instanceof KeyboardEvent&&!yn[r.key])})(null===a||void 0===a?void 0:a.isTextInput,e,t)&&o(An())};return dn.add(e),()=>{dn.delete(e)}}),s),{isFocusVisible:n}}"undefined"!==typeof document&&("loading"!==document.readyState?Sn():document.addEventListener("DOMContentLoaded",Sn));function Cn(e){if(!e)return;let t=!0;return r=>{let n={...r,preventDefault(){r.preventDefault()},isDefaultPrevented:()=>r.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(n),t&&r.stopPropagation()}}function kn(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Cn(e.onKeyDown),onKeyUp:Cn(e.onKeyUp)}}}var In=function(e,t){"function"!==typeof e?e.current=t:e(t)};const Rn=function(e,t){var r=(0,N.useRef)();return(0,N.useCallback)((function(n){e.current=n,r.current&&In(r.current,null),r.current=t,t&&In(t,n)}),[t])};const Pn=N.useLayoutEffect;var Nn=function(e){var t=N.useRef(e);return Pn((function(){t.current=e})),t};document;var Dn=function(){return Dn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Dn.apply(this,arguments)};var xn=function(e,t){return function(r){return Math.max(Math.min(r,t),e)}},Ln=function(e){return e%1?Number(e.toFixed(5)):e},On=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i,Bn={test:function(e){return"number"===typeof e},parse:parseFloat,transform:function(e){return e}},Mn=Dn(Dn({},Bn),{transform:xn(0,1)}),Un=(Dn(Dn({},Bn),{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}}}),Fn=(Un("deg"),Un("%")),jn=(Un("px"),Un("vh"),Un("vw"),Dn(Dn({},Fn),{parse:function(e){return Fn.parse(e)/100},transform:function(e){return Fn.transform(100*e)}}),function(e){return e.substring(e.indexOf("(")+1,e.lastIndexOf(")"))}),zn=xn(0,255),Vn=function(e){return void 0!==e.red},Kn=function(e){return void 0!==e.hue};var qn=function(e){return function(t){if("string"!==typeof t)return t;for(var r={},n=jn(t).replace(/(,|\/)/g," ").split(/ \s*/),i=0;i<4;i++)r[e[i]]=void 0!==n[i]?parseFloat(n[i]):1;return r}},Hn=Dn(Dn({},Bn),{transform:function(e){return Math.round(zn(e))}});function Gn(e,t){return e.startsWith(t)&&On.test(e)}var Wn={test:function(e){return"string"===typeof e?Gn(e,"rgb"):Vn(e)},parse:qn(["red","green","blue","alpha"]),transform:function(e){var t=e.red,r=e.green,n=e.blue,i=e.alpha,o=void 0===i?1:i;return function(e){var t=e.red,r=e.green,n=e.blue,i=e.alpha;return"rgba("+t+", "+r+", "+n+", "+(void 0===i?1:i)+")"}({red:Hn.transform(t),green:Hn.transform(r),blue:Hn.transform(n),alpha:Ln(Mn.transform(o))})}};qn(["hue","saturation","lightness","alpha"]),Dn(Dn({},Wn),{test:function(e){return"string"===typeof e&&Gn(e,"#")},parse:function(e){var t="",r="",n="";return e.length>4?(t=e.substr(1,2),r=e.substr(3,2),n=e.substr(5,2)):(t=e.substr(1,1),r=e.substr(2,1),n=e.substr(3,1),t+=t,r+=r,n+=n),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:1}}});var Qn=0;"undefined"!==typeof window&&window.requestAnimationFrame;var Yn=function(e){return function(t,r,n){return void 0!==n?e(t,r,n):function(n){return e(t,r,n)}}},$n=Yn((function(e,t,r){return Math.min(Math.max(r,e),t)}));var Xn=function(e){return e},Jn=function(e){return void 0===e&&(e=Xn),Yn((function(t,r,n){var i=r-n,o=-(0-t+1)*(0-e(Math.abs(i)));return i<=0?r+o:r-o}))};Jn(),Jn(Math.sqrt),Yn((function(e,t,r){var n=t-e;return((r-e)%n+n)%n+e})),$n(0,1);__webpack_require__(2951);__webpack_require__(2042);__webpack_require__(3210);__webpack_require__(4014);var Zn,ei="undefined"!==typeof document;!function(){if(void 0!==Zn)return Zn;if(!ei)return Zn=!1,!1;var e=!1,t={get passive(){e=!0}},r=function(){};window.addEventListener("t",r,t),window.removeEventListener("t",r,t),Zn=e}();var ti=new Map,ri=(0,N.createContext)(ti);ri.Provider;function ni(e){return ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ni(e)}function ii(e,t,r){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,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&$t(i,r.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||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;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,n)}function n(){return ii(e,arguments,ni(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$t(n,e)},oi(e)}var si=function(e){function t(t){return fr(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,r){return ai(e)+","+ai(t)+","+ai(r)}function li(e,t,r,n){if(void 0===n&&(n=ci),0===t)return n(r,r,r);var i=(e%360+360)%360/60,o=(1-Math.abs(2*r-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=r-o/2;return n(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 r=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:r}}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 n=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:n}}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,r=e.red/255,n=e.green/255,i=e.blue/255,o=Math.max(r,n,i),s=Math.min(r,n,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 r:t=(n-i)/c+(n<i?6:0);break;case n:t=(i-r)/c+2;break;default:t=(r-n)/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,r){return Ei("#"+Si(e)+Si(t)+Si(r))}function Ti(e,t,r){return li(e,t,r,Ai)}function Ci(e,t,r){if("number"===typeof e&&"number"===typeof t&&"number"===typeof r)return Ti(e,t,r);if("object"===typeof e&&void 0===t&&void 0===r)return Ti(e.hue,e.saturation,e.lightness);throw new si(1)}function ki(e,t,r,n){if("number"===typeof e&&"number"===typeof t&&"number"===typeof r&&"number"===typeof n)return n>=1?Ti(e,t,r):"rgba("+li(e,t,r)+","+n+")";if("object"===typeof e&&void 0===t&&void 0===r&&void 0===n)return e.alpha>=1?Ti(e.hue,e.saturation,e.lightness):"rgba("+li(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new si(2)}function Ii(e,t,r){if("number"===typeof e&&"number"===typeof t&&"number"===typeof r)return Ei("#"+_i(e)+_i(t)+_i(r));if("object"===typeof e&&void 0===t&&void 0===r)return Ei("#"+_i(e.red)+_i(e.green)+_i(e.blue));throw new si(6)}function Ri(e,t,r,n){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 r&&"number"===typeof n)return n>=1?Ii(e,t,r):"rgba("+e+","+t+","+r+","+n+")";if("object"===typeof e&&void 0===t&&void 0===r&&void 0===n)return e.alpha>=1?Ii(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new si(7)}var Pi=function(e){return"number"===typeof e.red&&"number"===typeof e.green&&"number"===typeof e.blue&&("number"!==typeof e.alpha||"undefined"===typeof e.alpha)},Ni=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)},xi=function(e){return"number"===typeof e.hue&&"number"===typeof e.saturation&&"number"===typeof e.lightness&&"number"===typeof e.alpha};function Li(e){if("object"!==typeof e)throw new si(8);if(Ni(e))return Ri(e);if(Pi(e))return Ii(e);if(xi(e))return ki(e);if(Di(e))return Ci(e);throw new si(8)}function Oi(e,t,r){return function(){var n=r.concat(Array.prototype.slice.call(arguments));return n.length>=t?e.apply(this,n):Oi(e,t,n)}}function Bi(e){return Oi(e,e.length,[])}function Mi(e,t,r){return Math.max(e,Math.min(t,r))}function Ui(e,t){if("transparent"===t)return t;var r=wi(t);return Li(L({},r,{lightness:Mi(0,1,r.lightness-parseFloat(e))}))}var Fi=Bi(Ui);function ji(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zi(e){if("virtual"===hn){let t=document.activeElement;Mr((()=>{document.activeElement===t&&document.contains(e)&&Dr(e)}))}else Dr(e)}const Vi=["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]"];Vi.join(":not([hidden]),");Vi.push('[tabindex]:not([tabindex="-1"]):not([disabled])');Vi.join(':not([hidden]):not([tabindex="-1"]),');function Ki(e,t){return t.some((t=>t.contains(e)))}class qi{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,r){let n=this.fastMap.get(null!==t&&void 0!==t?t:null),i=new Hi({scopeRef:e});n.addChild(i),i.parent=n,this.fastMap.set(e,i),r&&(i.nodeToRestore=r)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(null===e)return;let t=this.fastMap.get(e),r=t.parent;for(let i of this.traverse())i!==t&&t.nodeToRestore&&i.nodeToRestore&&t.scopeRef.current&&Ki(i.nodeToRestore,t.scopeRef.current)&&(i.nodeToRestore=t.nodeToRestore);let n=t.children;r.removeChild(t),n.size>0&&n.forEach((e=>r.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 r of t.children)yield*e.traverse(r)}()}clone(){let e=new qi;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 qi;let Gi=N.createContext(null);function Wi(e,t){let{focusProps:r}=un(e),{keyboardProps:n}=kn(e),i=kr(r,n),o=function(e){let t=(0,N.useContext)(Gi)||{};Fr(t,e);let{ref:r,...n}=t;return n}(t),s=e.isDisabled?{}:o,a=(0,N.useRef)(e.autoFocus);return(0,N.useEffect)((()=>{a.current&&t.current&&zi(t.current),a.current=!1}),[t]),{focusableProps:kr({...i,tabIndex:e.excludeFromTabOrder&&!e.isDisabled?-1:void 0},s)}}function Qi(e,t){let r,{elementType:n="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;r="button"===n?{type:g,disabled:i}:{role:"button",tabIndex:i?void 0:0,href:"a"===n&&i?void 0:d,target:"a"===n?f:void 0,type:"input"===n?g:void 0,disabled:"input"===n?i:void 0,"aria-disabled":i&&"input"!==n?i:void 0,rel:"a"===n?p:void 0};let{pressProps:y,isPressed:m}=Xr({onPressStart:s,onPressEnd:a,onPressChange:c,onPress:o,isDisabled:i,preventFocusOnPress:l,ref:t}),{focusableProps:v}=Wi(e,t);u&&(v.tabIndex=i?-1:v.tabIndex);let b=kr(v,y,Nr(e,{labelable:!0}));return{isPressed:m,buttonProps:kr(r,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"},$i=function(e){Object.keys(Yi).forEach((function(t){e.style.setProperty(t,Yi[t],"important")}))},Xi=null,Ji=function(e,t){var r=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?r+t.borderSize:r-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,ro=function(e,t){var r=e.cacheMeasurements,n=e.maxRows,i=e.minRows,o=e.onChange,s=void 0===o?Zi:o,a=e.onHeightChange,c=void 0===a?Zi:a,l=Wt(e,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]);var u=void 0!==l.value,h=(0,N.useRef)(null),d=Rn(h,t),f=(0,N.useRef)(0),p=(0,N.useRef)(),g=function(){var e=h.current,t=r&&p.current?p.current:function(e){var t=window.getComputedStyle(e);if(null===t)return null;var r,n=(r=t,eo.reduce((function(e,t){return e[t]=r[t],e}),{})),i=n.boxSizing;return""===i?null:(to&&"border-box"===i&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px"),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})}(e);if(t){p.current=t;var o=function(e,t,r,n){void 0===r&&(r=1),void 0===n&&(n=1/0),Xi||((Xi=document.createElement("textarea")).setAttribute("tabindex","-1"),Xi.setAttribute("aria-hidden","true"),$i(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]})),$i(Xi),Xi.value=t;var c=Ji(Xi,e);Xi.value="x";var l=Xi.scrollHeight-i,u=l*r;"border-box"===a&&(u=u+i+o),c=Math.max(u,c);var h=l*n;return"border-box"===a&&(h=h+i+o),[c=Math.min(h,c),l]}(t,e.value||e.placeholder||"x",i,n),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,N.useLayoutEffect)(g),function(e){var t=Nn(e);(0,N.useLayoutEffect)((function(){var e=function(e){t.current(e)};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[])}(g),(0,N.createElement)("textarea",L({},l,{onChange:function(e){u||g(),s(e)},ref:d}))};const no=(0,N.forwardRef)(ro);var io=function(){if("undefined"!==typeof Map)return Map;function e(e,t){var r=-1;return e.some((function(e,n){return e[0]===t&&(r=n,!0)})),r}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 r=e(this.__entries__,t),n=this.__entries__[r];return n&&n[1]},t.prototype.set=function(t,r){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=r:this.__entries__.push([t,r])},t.prototype.delete=function(t){var r=this.__entries__,n=e(r,t);~n&&r.splice(n,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 r=0,n=this.__entries__;r<n.length;r++){var i=n[r];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 r=!1,n=!1,i=0;function o(){r&&(r=!1,e()),n&&a()}function s(){ao(o)}function a(){var e=Date.now();if(r){if(e-i<co)return;n=!0}else r=!0,n=!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_,r=t.indexOf(e);~r&&t.splice(r,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,r=void 0===t?"":t;uo.some((function(e){return!!~r.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 r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];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=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce((function(t,r){return t+mo(e["border-"+r+"-width"])}),0)}function bo(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return yo;var n=go(e).getComputedStyle(e),i=function(e){for(var t={},r=0,n=["top","right","bottom","left"];r<n.length;r++){var i=n[r],o=e["padding-"+i];t[i]=mo(o)}return t}(n),o=i.left+i.right,s=i.top+i.bottom,a=mo(n.width),c=mo(n.height);if("border-box"===n.boxSizing&&(Math.round(a+o)!==t&&(a-=vo(n,"left","right")+o),Math.round(c+s)!==r&&(c-=vo(n,"top","bottom")+s)),!function(e){return e===go(e).document.documentElement}(e)){var l=Math.round(a+o)-t,u=Math.round(c+s)-r;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,r,n){return{x:e,y:t,width:r,height:n}}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 r=function(e){var t=e.x,r=e.y,n=e.width,i=e.height,o="undefined"!==typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(o.prototype);return po(s,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),s}(t);po(this,{target:e,contentRect:r})},To=function(){function e(e,t,r){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_=r}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}(),Co="undefined"!==typeof WeakMap?new WeakMap:new io,ko=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 r=fo.getInstance(),n=new To(t,r,this);Co.set(this,n)};["observe","unobserve","disconnect"].forEach((function(e){ko.prototype[e]=function(){var t;return(t=Co.get(this))[e].apply(t,arguments)}}));"undefined"!==typeof so.ResizeObserver&&so.ResizeObserver;var Io=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 r="break-word";t.wordWrap=r,t.overflowWrap=r,t.wordBreak=r}return t},Ro=(0,N.createContext)(),Po=function(e){var t=e.value,r=e.children;return(0,N.createElement)(ht,{theme:t},(0,N.createElement)(Ro.Provider,{value:t},r))},No=function(e){return e.charAt(0)!==e.charAt(0).toLowerCase()},Do=function(e,t){return No(t)},xo=(Ut.bind(null,Do),jt.bind(null,Do)),Lo={},Oo=function(e){return t=function(t){return No(t)?"components":kt(e[t])?"propsDescriptions":"themeProps"},r=e,Object.keys(r).reduce((function(e,n){var i=t(n);return e[i]=e[i]||{},e[i][n]=r[n],e}),{});var t,r},Bo=function(e){if(!e)return Lo;var t=e.css,r=e.vars,n=Wt(e,["css","vars"]);return L({css:t,vars:r},Oo(n))},Mo=function(e){return function(t){return function(r){var n=r[e];if(!n)return r;var i=Bo(n),o=i.propsDescriptions,s=i.components;if(!o&&!s)return r;var a=function(e,t,r){void 0===r&&(r={});var n=jt((function(e,r){return t[r]}),r);return Object.keys(n).map((function(t){var r,i=n[t],o=Bo(i),s=o.themeProps,a=o.components;if(!s)return a;var c=((r={})[e]=s,r);return a?L({},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 Bt(e,t)}),t)}([r,s].concat(a).filter(Boolean))}}},Uo=function(e){var t=e.__ui_kit_name,r=Mo(t);return(0,N.forwardRef)((function(t,n){return(0,N.createElement)(Po,{value:r(t)},(0,N.createElement)(e,L({},t,{ref:n})))}))},Fo=function e(t,r){var n,i,o,s=(n=kt,i=r,Object.keys(i).reduce((function(e,t){return n(i[t])&&(e[t]=i[t]),e}),{}));return 0===Object.keys(s)?r:(o=function(e,t){return Object.keys(t).reduce((function(r,n){return r[n]=e(t[n],n),r}),{})}((function(r,n){return kt(r)?":"===n[0]?e(t,r):r[Rt((function(e){return t[e]}),Object.keys(r))]||r.default:r}),r),Ct(o)?o.filter((function(e){return null!==e&&void 0!==e&&!Number.isNaN(e)})):Object.keys(o).reduce((function(e,t){var r=o[t];return null===r||void 0===r||Number.isNaN(r)||(e[t]=r),e}),{}))},jo=function(e,t,r){var n=e.theme,i=e.style,o=Bo(n[t]),s=o.css,a=o.vars,c=o.themeProps;return[a?L({},n.vars,a):n.vars,"function"===typeof r&&void 0!==c&&r(c),s&&Fo(e,s),Io(e),"function"===typeof r&&r(L({},c,e)),i]},zo=function(e,t){void 0===t&&(t={});var r=t,n=r.displayName,i=r.displayType,o=r.mapPropsToStyles;var s=St(e,t);return function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];if(r.length>0&&void 0!==r[0].raw){var c=r;r=[c[0][0]];for(var l=1;l<c.length;l++)r.push(c[l],c[0][l])}var u=n||i||null,h=s.apply(void 0,r.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 Vo=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;}"}),Ko=function(e){var t=lt();return(0,N.createElement)(cr,{in:e.active,mountOnEnter:!0,timeout:t.FixedWrapperMaximized.animationDuration,unmountOnExit:!0},(function(t){return(0,N.createElement)(Vo,L({},e,{state:t}),N.Children.map(e.children,(function(t){return(0,N.cloneElement)(t,{minimize:e.minimize})})))}))};Ko.propTypes={active:Qt.bool,children:Qt.node.isRequired,minimize:Qt.func,style:(0,Qt.shape)()};var qo=zo("div",{displayName:"FixedWrapperMinimized",mapPropsToStyles:function(e){var t=e.state,r=e.theme,n={};return r&&(n.transition="all "+r.FixedWrapperMaximized.animationDuration+"ms ease-out",n.right="right"===r.FixedWrapperRoot.position?"0":"auto",n.left="left"===r.FixedWrapperRoot.position?"0":"auto"),t&&(n.transform="entered"===t?"none":"scale(0.8) translate(10%, 30%)",n.opacity="entered"===t?"1":"0"),n},target:"eq1nrcm0"})({name:"m2cnsn",styles:"width:60px;height:60px;position:absolute;bottom:1em"}),Ho=function(e){var t=lt();return(0,N.createElement)(cr,{in:e.active,mountOnEnter:!0,timeout:t.FixedWrapperMinimized.animationDuration,unmountOnExit:!0},(function(t){return(0,N.createElement)(qo,L({},e,{state:t}),N.Children.map(e.children,(function(t){return(0,N.cloneElement)(t,{maximize:e.maximize})})))}))};Ho.propTypes={active:Qt.bool,children:Qt.node.isRequired,maximize:Qt.func,style:(0,Qt.shape)()};var Go=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"}),Wo=function(e){var t=(0,N.useState)(e.maximizedOnInit),r=t[0],n=t[1];return(0,N.createElement)(Go,e,(0,N.createElement)("div",null,N.Children.map(e.children,(function(e){return e.type===Ko?(0,N.cloneElement)(e,{minimize:function(){return n(!1)},active:r}):e.type===Ho?(0,N.cloneElement)(e,{maximize:function(){return n(!0)},active:!r}):e}))))};Wo.defaultProps={maximizedOnInit:!1},Wo.propTypes={children:Qt.node.isRequired,maximizedOnInit:Qt.bool,style:(0,Qt.shape)()};var Qo=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"});Qt.bool,Qt.node.isRequired;Qt.node;var Yo,$o=function(e){var t=e.color;return t?{fill:t,"& *":{fill:t}}:null},Xo=(Yo=function(e){return zo(e,{displayType:"Icon",mapPropsToStyles:$o,shouldForwardProp:M,target:"e5ibypu0"})({name:"y0b0au",styles:"&{display:block;}&,& *{fill:currentColor;}"})},function(e,t){var r={};return function(){var n=e.apply(void 0,arguments);if(Tt(n,r))return r[n];var i=t.apply(void 0,arguments);return r[n]=i,i}}(Nt,Yo)),Jo=function(e){var t=e.children,r=Wt(e,["children"]),n=Xo(t.type);return(0,N.createElement)(n,r)};Jo.propTypes={children:Qt.node.isRequired};var Zo=function(e){return(0,N.createElement)("svg",L({viewBox:"0 0 58 58",style:{enableBackground:"new 0 0 58 58"}},e),(0,N.createElement)("rect",{style:{fillRule:"evenodd",clipRule:"evenodd",fill:"#F2F2F2"},width:"58",height:"58"}),(0,N.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,N.createElement)(Jo,e,(0,N.createElement)(Zo,null))},ts=function(e){return(0,N.createElement)("svg",L({height:"18px",viewBox:"0 0 21 18",width:"21px"},e),(0,N.createElement)("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},(0,N.createElement)("g",{fill:"#000000"},(0,N.createElement)("polygon",{points:"0.01 18 21 9 0.01 0 0 7 15 9 0 11"}))))},rs=function(e){return(0,N.createElement)(Jo,e,(0,N.createElement)(ts,null))};function ns(){var e=wr(["\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 ns=function(){return e},e}var is=function(){var e=Kt.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_"}}}(ns()),os=Kt("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 Vt(ss,e,Vt("svg",{viewBox:"0 0 32 32",css:os},Vt("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 Vt(ss,e,Vt("svg",{viewBox:"0 0 32 32"},Vt("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=wr(["\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,N.createElement)(Gt,null,(function(t){var r=t.css;return(0,N.createElement)(dr,L({},e,{classNames:us(r),timeout:200}))}))};function ds(){var e=wr(["\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:Qt.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,N.createElement)(Gt,null,(function(t){var r=t.css;return(0,N.createElement)(dr,L({},e,{classNames:ps(r),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,r=e.src,n=e.srcSet,i=(e.scaleImage,e.className),o=e.alt,s=void 0===o?"":o,a=Wt(e,["children","src","srcSet","scaleImage","className","alt"]),c=(0,N.useState)("pending"),l=c[0],u=c[1],h=(0,N.useState)(!1),d=h[0],f=h[1],p=(0,N.useRef)(0),g="loaded"===l,y=null;if(t)y=t({imageStatus:l,shouldAnimate:d});else switch(l){case"pending":y=(0,N.createElement)(as,a);break;case"failed":y=(0,N.createElement)(cs,a);break;default:y=null}return(0,N.useLayoutEffect)((function(){return u("pending"),f(!1),p.current=setTimeout((function(){return f(!0)}),300),function(){return clearTimeout(p.current)}}),[r,n]),(0,N.createElement)(N.Fragment,null,(0,N.createElement)(gs,{in:d&&g},(0,N.createElement)(ys,L({alt:s},a,{src:r,isLoaded:g,srcSet:n,className:i,onLoad:function(){u("loaded"),clearTimeout(p.current)},onError:function(){return u("failed")}}))),y)};ms.propTypes={children:Qt.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={},r={},n=e.size,i=e.radius,o=e.fontSize;return n&&(t.width=n,t.height=n,t.lineHeight=n),i&&(t.borderRadius=i,r.borderRadius=i),o&&(t.fontSize=o),L({},t,{"& img":r})},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,r=e.letter,n=null;return t||r?t?n=Vt(ms,{src:t,css:vs,alt:"avatar",draggable:!1},(function(e){var t=e.imageStatus,r=e.shouldAnimate;switch(t){case"pending":return Vt(es,{css:[vs,r&&os,""]});case"failed":return Vt(es,{css:vs});default:return null}})):r&&(n=Vt("span",null,r)):n=Vt("div",{css:vs},Vt(es,{css:vs})),Vt(bs,e,n)};ws.propTypes={imgUrl:Qt.string,letter:Qt.string,size:Qt.string,style:(0,Qt.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,r=e.ovalBorderRadius,n=e.sharpBorderRadius,i=e.radiusType,o={borderTopLeftRadius:"single"===i||"first"===i?r:n,borderTopRightRadius:r,borderBottomRightRadius:r,borderBottomLeftRadius:"single"===i||"last"===i?r:n};return t?function(e){var t=e.borderTopLeftRadius,r=e.borderTopRightRadius,n=e.borderBottomRightRadius;return{borderTopLeftRadius:r,borderTopRightRadius:t,borderBottomRightRadius:e.borderBottomLeftRadius,borderBottomLeftRadius:n}}(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:Qt.node,isOwn:Qt.bool,radiusType:(0,Qt.oneOf)(["single","first","last"])};var Ss=zo("div",{mapPropsToStyles:function(e){return{flexShrink:e.shrink?1:0}},target:"e1jdwequ0"})(""),As=function(e){return(0,N.createElement)(Ss,L({flexFill:!0},e))};As.defaultProps={shrink:!0},As.propTypes={shrink:Qt.bool};var Ts=zo("div",{mapPropsToStyles:function(e){return{flexShrink:e.shrink?1:0}},target:"e1yi1p4d0"})(""),Cs=function(e){return(0,N.createElement)(Ts,L({flexFit:!0},e))};Cs.defaultProps={shrink:!0},Cs.propTypes={shrink:Qt.bool};var ks=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;}"}),Is=(0,N.forwardRef)((function(e,t){var r=Tn(e);return(0,N.createElement)(ks,L({ref:t},r,e))}));Is.propTypes={active:Qt.bool,disabled:Qt.bool,children:Qt.node.isRequired,color:Qt.string,onClick:Qt.func};var Rs=function(e){return e.getBoundingClientRect().top+window.pageYOffset};var Ps=(0,N.createContext)({registerUnseenListItem:Mt,isScrollOnBottom:Mt,scrollToBottom:Mt}),Ns=Ps.Provider,Ds=Ps.Consumer,xs=function(e){void 0===e&&(e=0);var t=e;return function(){return t++}}(),Ls=zo("div",{displayName:"MessageList",target:"e1i3n9g60"})({name:"1qptc4e",styles:"padding:0.5em;overflow-y:auto;height:100%;outline-offset:-5px"}),Os=(0,N.forwardRef)((function(e,t){var r=e.active,n=void 0===r||r,i=e.onScroll,o=Wt(e,["active","onScroll"]),s=(0,N.useRef)(),a=Rn(s,t),c=function(){var e=(0,N.useRef)([]),t=(0,N.useCallback)((function(t){var r=xs(),n=e.current;return n.push(L({},t,{id:r})),function(){var e=Pt((function(e){return e.id===r}),n);-1!==e&&n.splice(e,1)}}),[]);return{getAll:function(){return e.current},registerItem:t}}(),l=c.getAll,u=c.registerItem,h=Nn(n),d=Nn(i),f=Tn(),p=(0,N.useCallback)((function(){l().forEach((function(e){var t,r;(t=s.current,r=e.ref,Rs(r)-Rs(t)+r.clientHeight<=t.clientHeight)&&e.onSeen()}))}),[l]),g=(0,N.useMemo)((function(){return function(e,t){var r,n=Date.now()-2*e,i=function(){n=Date.now(),t.apply(void 0,arguments)},o=function(){return clearTimeout(r)},s=function(){for(var t=Date.now(),s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];t-n>=e?i.apply(void 0,a):(o(),r=setTimeout.apply(void 0,[i,n-t+e].concat(a)))};return s.cancel=o,s}(300,(function(){h.current&&p()}))}),[h,p]),y=(0,N.useCallback)((function(e){g(),d.current&&d.current(e)}),[d,g]);(0,N.useEffect)((function(){n&&p()}),[n,p]);var m=(0,N.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,N.createElement)(Ns,{value:m},(0,N.createElement)(Ls,L({},f,o,{ref:a,onScroll:y,role:"grid","aria-live":"polite","aria-relevant":"additions"})))})),Bs=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this)._unregisterFromMessageList=Mt,t._registerInMessageList=function(e){var t,r,n=!1;return function(){return n&&(arguments.length<=0?void 0:arguments[0])===r?t:(n=!0,r=arguments.length<=0?void 0:arguments[0],t=e.apply(void 0,arguments))}}((function(e){return function(r){t._unregisterFromMessageList(),r&&(t._unregisterFromMessageList=e({ref:r,onSeen:t.props.onSeen}))}})),t}Xt(t,e);var r=t.prototype;return r.componentWillUnmount=function(){this._unregisterFromMessageList()},r.render=function(){var e=this;return(0,N.createElement)(Ds,null,(function(t){var r=t.registerUnseenListItem;return(0,N.createElement)("div",{ref:e.props.seen?null:e._registerInMessageList(r),role:"row"},N.Children.only(e.props.children))}))},t}(N.Component);Bs.propTypes={children:Qt.node.isRequired,onSeen:Qt.func},Bs.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"}),Vs=zo("div",{displayName:"Status",target:"e10ccb470"})({name:"5m4wg",styles:"text-align:right;font-size:0.8em"}),Ks={name:"oldbq4",styles:"user-select:none"},qs=(0,N.forwardRef)((function(e,t){var r=e.children,n=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=Wt(e,["children","authorName","deliveryStatus","isOwn","date","showMetaOnClick","onSeen","radiusType","seen","enforceDeliveryStatusDisplay","onClick","onKeyUp"]),m=Tn(),v=function(e){var t=(0,N.useState)(e),r=t[0],n=t[1];return[r,(0,N.useCallback)((function(){n((function(e){return!e}))}),[])]}(!1),b=v[0],w=v[1];return Vt(Bs,{onSeen:l,seen:u},Vt(Ms,L({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}),Vt(js,L({role:"gridcell"},m),Vt(br,null,(!c||b)&&Vt(hs,null,Vt(Fs,null,n&&Vt(Us,null,n," "),a&&Vt(zs,null,a)))),r,o?Vt(Vs,null,o):h?Vt(Vs,{css:Ks},"\xa0"):null)))}));qs.propTypes={authorName:(0,Qt.oneOfType)([Qt.string,Qt.node]),authorOpen:Qt.bool,children:Qt.node,date:Qt.string,deliveryStatus:Qt.string,enforceDeliveryStatusDisplay:Qt.bool,isOwn:Qt.bool,onClick:Qt.func,onSeen:Qt.func,showMetaOnClick:Qt.bool,style:(0,Qt.shape)(),toggleAuthor:Qt.func,radiusType:(0,Qt.oneOf)(["single","first","last"]),seen:Qt.bool},qs.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 Gs=zo("div",{displayName:"Title",target:"e9xf8br0"})({name:"mmvz9h",styles:"font-weight:400"});Gs.defaultProps={textWrap:!0};Ft(console.warn.bind(console));var Ws=zo("div",{displayName:"MessageTitle",target:"e1ykjxgu0"})({name:"1kj42yy",styles:"font-weight:600;padding:1em"}),Qs={name:"11rcwxl",styles:"margin-bottom:4px"},Ys=function(e){var t=e.children,r=e.title,n=e.subtitle,i=Wt(e,["children","title","subtitle"]);var o=t||[r&&Vt(Gs,{key:"title",preserveLines:!0,css:Qs},r),n&&Vt(Hs,{key:"subtitle",preserveLines:!0},n)];return Vt(Ws,i,o)};Ys.propTypes={children:(0,Qt.oneOfType)([(0,Qt.arrayOf)(Qt.node),Qt.node]),subtitle:Qt.string,title:Qt.string};var $s=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),ra=zo((0,N.forwardRef)((function(e,t){var r=e.href,n=Wt(e,["href"]);return r?(0,N.createElement)("a",L({href:r,rel:"nofollow noopener"},n,{ref:t})):(0,N.createElement)("button",L({},n,{ref:t}))})),{displayName:"Button",mapPropsToStyles:function(e){var t=e.primary?e.theme.vars["--primary-color"]:"black",r=ta(t);return{borderColor:t,color:t,"&:hover":{color:r,borderColor:r}}},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;}"}),na=function(e){var t=e.label,r=e.onPress,n=e.disabled,i=Wt(e,["label","onPress","disabled"]),o=Tn(),s=(0,N.useRef)(),a=Qi(L({onPress:r,isDisabled:n},i),s).buttonProps;return(0,N.createElement)(ra,kr(o,a,i,{ref:s}),t)};na.propTypes={label:(0,Qt.oneOfType)([Qt.string,Qt.node])};var ia=zo(na,{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,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).handleClick=function(e){e.stopPropagation(),t.props.onClick(e)},t}return Xt(t,e),t.prototype.render=function(){return(0,N.createElement)(ia,L({},this.props,{onClick:this.handleClick}))},t}(N.Component);oa.propTypes={className:Qt.string,label:Qt.string,onClick:Qt.func,primary:Qt.bool,value:(0,Qt.oneOfType)([Qt.string,Qt.number])},oa.defaultProps={onClick:Mt};var sa=function(e){return N.Children.toArray(e).filter(Boolean)};Qt.string,Qt.string,Qt.node,Qt.bool,Qt.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 r=xo(t);return 0===Object.keys(r).length?L({},t,{vars:Ot((function(e){return"--"+e}),t.vars||{})}):L({},t,It((function(t){return L({},e(t),{css:t.css||{}})}),r),{vars:Ot((function(e){return"--"+e}),t.vars||{})})},ua=function(e){var t=e.theme,r=void 0===t?{}:t,n=e.children,i=la(Bt(ca,r));return(0,N.createElement)(Po,{value:i},n)},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,r=e.onSelect,n=void 0===r?Mt:r,i=e.onClick,o=void 0===i?Mt:i,s=Wt(e,["value","onSelect","onClick"]),a=Tn(),c=(0,N.useCallback)((function(e){n(t),o(e)}),[o,n,t]);return(0,N.createElement)(ga,L({value:t},s,a,function(e){var t,r,n,i=++pa.value,o=L({},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 L({},o,((t={})[ha.id]=String(i),t),fa.has(i)&&((r={})[ha.focus]="true",r),((n={})[ha.event]=Object.keys(o).map((function(e){var t=e.replace(/^on/,"").toLowerCase(),r=xt();return"press"===t&&(t="click"),da.set(r,o[e]),t+":"+r})).join(";"),n))}({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,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this)._handleSelect=function(e){return t.props.onSelect(e)},t}return Xt(t,e),t.prototype.render=function(){var e=this,t=this.props,r=t.children,n=t.replies,i=(t.onSelect,Wt(t,["children","replies","onSelect"]));var o=r?sa(r):n.map((function(e,t){return(0,N.createElement)(ya,{key:t,value:e},e)}));return(0,N.createElement)(ma,L({},i,{role:"group"}),N.Children.map(o,(function(t){return(0,N.cloneElement)(t,{onSelect:e._handleSelect})})))},t}(N.Component);va.defaultProps={onSelect:Mt},va.propTypes={children:Qt.node,onSelect:Qt.func,replies:(0,Qt.arrayOf)(Qt.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,N.forwardRef)((function(e,t){var r=e.leftIcons,n=e.rightIcons,i=e.title,o=Wt(e,["leftIcons","rightIcons","title"]),s=r[0];return(0,N.createElement)(ba,L({},o,{ref:t}),r,(0,N.createElement)(wa,{ellipsis:!0,isIconProvided:s},i),n)}));Ea.displayName="TitleBar",Ea.propTypes={leftIcons:(0,Qt.arrayOf)(Qt.node),rightIcons:(0,Qt.arrayOf)(Qt.node),theme:(0,Qt.shape)(),title:Qt.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 Ta=(0,N.createContext)(),Ca=function(){return(0,N.useContext)(Ta)},ka=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)"}),Ia=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).state={value:t._getValue({value:t.props.defaultValue})},t._handleButtonClick=function(e){t.maybeSend()&&t.props.onButtonClick(e)},t._handleChange=function(e){var r=e.target.value;t._isControlled()||t.setState({value:r}),t.props.onValueChange(r),t.props.onChange(e)},t._handleInputRef=function(e){t._inputRef=e},t._handleKeyDown=function(e){var r=t.props.onKeyDown;Aa(e)&&e.preventDefault(),_a(e)&&!Sa(e)?(t.maybeSend(),r(e)):r(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 r=t.prototype;return r._getValue=function(e,t){return void 0===e&&(e=this.state),void 0===t&&(t=this.props),this._isControlled()?t.value:e.value},r._canSend=function(){return this.props.active&&""!==this._getValue().trim()},r._isControlled=function(){return"string"===typeof this.props.value},r._setCursorAtTheEnd=function(){var e=this._inputRef.value.length;this._inputRef.setSelectionRange(e,e)},r.componentDidMount=function(){this.props.defaultValue&&this._inputRef&&document.activeElement===this._inputRef&&this._setCursorAtTheEnd()},r.componentDidUpdate=function(e,t){var r=this._getValue();r!==this._getValue(t,e)&&""===r&&this._inputRef.focus()},r.render=function(){var e=this.props,t=(e.active,e.children),r=(e.defaultValue,e.onButtonClick,e.onChange,e.onKeyDown,e.onSend,e.onValueChange,e.value,Wt(e,["active","children","defaultValue","onButtonClick","onChange","onKeyDown","onSend","onValueChange","value"])),n={active:this._canSend(),inputRef:this._handleInputRef,value:this._getValue(),maybeSend:this.maybeSend,onButtonClick:this._handleButtonClick,onChange:this._handleChange,onKeyDown:this._handleKeyDown};return(0,N.createElement)(Ta.Provider,{value:n},(0,N.createElement)(ka,r,t))},t}(N.Component);function Ra(e){var t=e.icon,r=e.onClick,n=void 0===r?Mt:r,i=Wt(e,["icon","onClick"]),o=Ca(),s=o.active,a=o.onButtonClick;return(0,N.createElement)(Is,L({},i,{active:s,disabled:!s,onClick:function(e){s&&(a(e),n(e))}}),t?(0,N.createElement)(Jo,{"aria-hidden":!0},t):(0,N.createElement)(rs,null))}function Pa(e,t,r){return r={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)&&r.path)}},e(r,r.exports),r.exports}Ia.propTypes={active:Qt.bool,children:Qt.node,defaultValue:Qt.string,onButtonClick:Qt.func,onChange:Qt.func,onKeyDown:Qt.func,onSend:Qt.func,value:Qt.string},Ia.defaultProps={active:!0,defaultValue:"",onButtonClick:Mt,onChange:Mt,onKeyDown:Mt,onSend:Mt,onValueChange:Mt};var Na=Pa((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.FrameContextConsumer=t.FrameContextProvider=t.useFrame=t.FrameContext=void 0;var r,n=(r=N)&&r.__esModule?r:{default:r};var i=void 0,o=void 0;"undefined"!==typeof document&&(i=document),"undefined"!==typeof window&&(o=window);var s=t.FrameContext=n.default.createContext({document:i,window:o}),a=(t.useFrame=function(){return n.default.useContext(s)},s.Provider),c=s.Consumer;t.FrameContextProvider=a,t.FrameContextConsumer=c})),Da=Pa((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),n=(i(N),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),r(t,[{key:"componentDidMount",value:function(){this.props.contentDidMount()}},{key:"componentDidUpdate",value:function(){this.props.contentDidUpdate()}},{key:"render",value:function(){return N.Children.only(this.props.children)}}]),t}(N.Component);o.propTypes={children:n.default.element.isRequired,contentDidMount:n.default.func.isRequired,contentDidUpdate:n.default.func.isRequired},t.default=o})),xa=Pa((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=c(N),o=c(x),s=c(Yt()),a=c(Da);function c(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=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,r));return n.setRef=function(e){n.node=e},n.handleLoad=function(){n.setState({iframeLoaded:!0})},n._isMounted=!1,n.state={iframeLoaded:!1},n}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._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,r=this.props.contentDidUpdate,n=e.defaultView||e.parentView,s=i.default.createElement(a.default,{contentDidMount:t,contentDidUpdate:r},i.default.createElement(Na.FrameContextProvider,{value:{document:e,window:n}},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=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,i.default.createElement("iframe",r({},e,{ref:this.setRef,onLoad:this.handleLoad}),this.state.iframeLoaded&&this.renderFrameContents())}}]),t}(N.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})),La=Pa((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 Na.FrameContext}}),Object.defineProperty(t,"FrameContextConsumer",{enumerable:!0,get:function(){return Na.FrameContextConsumer}}),Object.defineProperty(t,"useFrame",{enumerable:!0,get:function(){return Na.useFrame}});var r,n=(r=xa)&&r.__esModule?r:{default:r};t.default=n.default}));var Oa=zo((0,N.forwardRef)((function(e,t){e.flexFill;var r=Wt(e,["flexFill"]);return(0,N.createElement)(no,L({ref:t},r))})),{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;}"}),Ba=(0,N.forwardRef)((function(e,t){var r=e.maxRows,n=void 0===r?3:r,i=e.placeholder,o=void 0===i?"Write a message...":i,s=Wt(e,["maxRows","placeholder"]),a=(0,N.useRef)(),c=Rn(a,t),l=Ca(),u=l.value,h=l.inputRef,d=l.onChange,f=l.onKeyDown,p=La.useFrame().document;return(0,N.createElement)(Oa,L({},s,{onChange:function(e){d(e),s.onChange&&s.onChange(e)},onKeyDown:function(e){f(e),s.onKeyDown&&s.onKeyDown(e)},value:u,maxRows:n,placeholder:o,ref:function(e){c(e),h(e)},document:p}))})),Ma=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(t=e.call.apply(e,[this].concat(n))||this).handleButtonClick=function(e){return function(r){t.props.onButtonClick(r,e)}},t}return Xt(t,e),t.prototype.render=function(){var e=this,t=null,r=Pt((function(e){return e.showMore}),this.props.buttons);if(-1!==r){var n=this.props.buttons[r],i=n.text,o=Wt(n,["text"]);t=(0,N.createElement)(oa,L({},o,{label:i,"data-variant":"show-more",onClick:this.handleButtonClick(r)}))}return(0,N.createElement)(N.Fragment,null,(0,N.createElement)(ea,null,this.props.buttons.map((function(t,n){var i=t.text,o=t.key,s=(t.showMore,Wt(t,["text","key","showMore"])),a=void 0!==o?o:n;return n!==r?(0,N.createElement)(oa,L({key:a,label:i.length>20?i.slice(0,20).trim()+"\u2026":i,onClick:e.handleButtonClick(a)},s)):null}))),t)},t}(N.Component);Ma.defaultProps={onButtonClick:Mt};var Ua=function(e){return e.stopPropagation()},Fa=function(e){return Vt("a",L({},e,{onClick:Ua,rel:"nofollow noopener",target:"_blank"}))},ja=function(e){return Kt("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;"),Va=function(e){var t=e.link,r=e.url,n=e.srcset,i=e.horizontalLayout,o=Wt(e,["link","url","srcset","horizontalLayout"]),s=Vt(Xs,o,Vt(za,{horizontalLayout:i},Vt(ms,L({alt:"",css:ja(i)},function(e,t){var r={src:e};return void 0!==t&&(r.srcSet=t),r}(r,n)))));return t?Vt(Fa,{href:t,style:o.style},s):s};Va.propTypes={link:Qt.string,url:Qt.string.isRequired,srcSet:Qt.string};var Ka={name:"oipjxo",styles:"width:230px"},qa={name:"ho1qnd",styles:"display:flex;flex-direction:row"},Ha={name:"1mb649y",styles:"max-width:110px"},Ga=zo("div",{target:"es7wtci0"})("width:230px;min-width:0px;max-width:",(function(e){return e.horizontalLayout?"66%":"100%"}),";"),Wa={borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit",borderBottomRightRadius:0,borderBottomLeftRadius:0},Qa={borderTopLeftRadius:"inherit",borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:"inherit"};N.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 $a(e){var t=function(e,t){if("object"!==Ya(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ya(n))return n;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,r){return(t=$a(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ja=Symbol.for("@libp2p/peer-id");function Za(e){return null!=e&&Boolean(e[Ja])}function ec(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function tc(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function rc(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,tc(e,t,"set"),r),r}function nc(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,tc(e,t,"get"))}class ic extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The operation was aborted"),this.code=ic.code,this.type=ic.type}static get code(){return"ABORT_ERR"}static get type(){return"aborted"}}class oc extends Error{constructor(e,t,r){var n;super(e),this.code=t,this.name=null!==(n=null===r||void 0===r?void 0:r.name)&&void 0!==n?n:"CodeError",this.props=null!==r&&void 0!==r?r:{}}}var sc=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const ac=sc,cc=(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 lc{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class uc{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return dc(this,e)}}class hc{constructor(e){this.decoders=e}or(e){return dc(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const dc=(e,t)=>new hc({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class fc{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new lc(e,t,r),this.decoder=new uc(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pc=e=>{let{name:t,prefix:r,encode:n,decode:i}=e;return new fc(t,r,n,i)},gc=e=>{let{prefix:t,name:r,alphabet:n}=e;const{encode:i,decode:o}=ac(n,r);return pc({prefix:t,name:r,encode:i,decode:e=>cc(o(e))})},yc=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return pc({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,n,t)})},mc=gc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vc=gc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var bc=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=_c;)r[n++]=255&t|wc,t/=128;for(;t&Ec;)r[n++]=255&t|wc,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},wc=128,Ec=-128,_c=Math.pow(2,31);var Sc=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&Tc)<<o:(n&Tc)*Math.pow(2,o),o+=7}while(n>=Ac);return e.bytes=s-r,i},Ac=128,Tc=127;var Cc=Math.pow(2,7),kc=Math.pow(2,14),Ic=Math.pow(2,21),Rc=Math.pow(2,28),Pc=Math.pow(2,35),Nc=Math.pow(2,42),Dc=Math.pow(2,49),xc=Math.pow(2,56),Lc=Math.pow(2,63);const Oc={encode:bc,decode:Sc,encodingLength:function(e){return e<Cc?1:e<kc?2:e<Ic?3:e<Rc?4:e<Pc?5:e<Nc?6:e<Dc?7:e<xc?8:e<Lc?9:10}},Bc=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return[Oc.decode(e,t),Oc.decode.bytes]},Mc=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Oc.encode(e,t,r),t},Uc=e=>Oc.encodingLength(e),Fc=(e,t)=>{const r=t.byteLength,n=Uc(e),i=n+Uc(r),o=new Uint8Array(i+r);return Mc(e,o,0),Mc(r,o,n),o.set(t,i),new zc(e,r,t,o)},jc=e=>{const t=cc(e),[r,n]=Bc(t),[i,o]=Bc(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new zc(r,i,s,t)};class zc{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const Vc=yc({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kc=yc({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),qc=yc({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Hc=yc({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gc=yc({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Wc=yc({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Qc=yc({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Yc=yc({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$c=yc({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Xc=(e,t)=>{const{bytes:r,version:n}=e;return 0===n?rl(r,Zc(e),t||mc.encoder):nl(r,Zc(e),t||Vc.encoder)},Jc=new WeakMap,Zc=e=>{const t=Jc.get(e);if(null==t){const t=new Map;return Jc.set(e,t),t}return t};class el{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:e,multihash:t}=this;if(e!==il)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==ol)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return el.createV0(t)}default:throw Error("Can not convert CID version ".concat(this.version," to version 0. This is a bug please report"))}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=Fc(e,t);return el.createV1(this.code,r)}case 1:return this;default:throw Error("Can not convert CID version ".concat(this.version," to version 1. This is a bug please report"))}}equals(e){return el.equals(this,e)}static equals(e,t){const r=t;return r&&e.code===r.code&&e.version===r.version&&((e,t)=>{if(e===t)return!0;{const r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0})(e.bytes,r.bytes)}})(e.multihash,r.multihash)}toString(e){return Xc(this,e)}toJSON(){return{"/":Xc(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 el)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:e,code:r,multihash:n,bytes:i}=t;return new el(e,r,n,i||sl(e,r,n.bytes))}if(!0===t[al]){const{version:e,multihash:r,code:n}=t,i=jc(r);return el.create(e,n,i)}return null}static create(e,t,r){if("number"!==typeof t)throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:if(t!==il)throw new Error("Version 0 CID must use dag-pb (code: ".concat(il,") block encoding"));return new el(e,t,r,r.bytes);case 1:{const n=sl(e,t,r.bytes);return new el(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return el.create(0,il,e)}static createV1(e,t){return el.create(1,e,t)}static decode(e){const[t,r]=el.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=el.inspectBytes(e),r=t.size-t.multihashSize,n=cc(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=n.subarray(t.multihashSize-t.digestSize),o=new zc(t.multihashCode,t.digestSize,i,n);return[0===t.version?el.createV0(o):el.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=Bc(e.subarray(t));return t+=n,r};let n=r(),i=il;if(18===n?(n=0,t=0):i=r(),0!==n&&1!==n)throw new RangeError("Invalid CID version ".concat(n));const o=t,s=r(),a=r(),c=t+a;return{version:n,codec:i,multihashCode:s,digestSize:a,multihashSize:c-o,size:c}}static parse(e,t){const[r,n]=tl(e,t),i=el.decode(n);if(0===i.version&&"Q"!==e[0])throw Error("Version 0 CID string must not include multibase prefix");return Zc(i).set(r,e),i}}const tl=(e,t)=>{switch(e[0]){case"Q":{const r=t||mc;return[mc.prefix,r.decode("".concat(mc.prefix).concat(e))]}case mc.prefix:{const r=t||mc;return[mc.prefix,r.decode(e)]}case Vc.prefix:{const r=t||Vc;return[Vc.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},rl=(e,t,r)=>{const{prefix:n}=r;if(n!==mc.prefix)throw Error("Cannot string encode V0 in ".concat(r.name," encoding"));const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i},nl=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},il=112,ol=18,sl=(e,t,r)=>{const n=Uc(e),i=n+Uc(t),o=new Uint8Array(i+r.byteLength);return Mc(e,o,0),Mc(t,o,n),o.set(r,i),o},al=Symbol.for("@ipld/js-cid/CID");function cl(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}const ll=pc({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),ul=yc({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),hl=yc({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),dl=gc({prefix:"9",name:"base10",alphabet:"0123456789"}),fl=yc({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),pl=yc({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),gl=gc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),yl=gc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),ml=yc({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),vl=yc({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),bl=yc({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wl=yc({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),El=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"),_l=El.reduce(((e,t,r)=>(e[r]=t,e)),[]),Sl=El.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const Al=pc({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=_l[t]),"")},decode:function(e){const t=[];for(const r of e){const e=Sl[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),Tl=e=>{let{name:t,code:r,encode:n}=e;return new Cl(t,r,n)};class Cl{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Fc(this.code,t):t.then((e=>Fc(this.code,e)))}throw Error("Unknown type, must be binary type")}}const kl=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Il=Tl({name:"sha2-256",code:18,encode:kl("SHA-256")}),Rl=Tl({name:"sha2-512",code:19,encode:kl("SHA-512")}),Pl=cc,Nl={code:0,name:"identity",encode:Pl,digest:e=>Fc(0,Pl(e))},Dl="raw",xl=85,Ll=e=>cc(e),Ol=e=>cc(e),Bl=new TextEncoder,Ml=new TextDecoder,Ul="json",Fl=512,jl=e=>Bl.encode(JSON.stringify(e)),zl=e=>JSON.parse(Ml.decode(e)),Vl={...r,...n,...i,...o,...s,...t,...a,...e,...c,...l};function Kl(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function ql(){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)?Kl(globalThis.Buffer.alloc(t)):new Uint8Array(t)}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.allocUnsafe)?Kl(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Gl(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const Wl=Gl("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Ql=Gl("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=Hl((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),Yl={utf8:Wl,"utf-8":Wl,hex:Vl.base16,latin1:Ql,ascii:Ql,binary:Ql,...Vl};function $l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=Yl[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}var Xl=__webpack_require__(4561);function Jl(e,t){null==t&&(t=e.reduce(((e,t)=>e+t.length),0));const r=Hl(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return Kl(r)}const Zl=45,eu=15,tu=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,r=e();return void 0===r&&(this.index=t),r}parseWith(e){const t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically((()=>{const t=this.readChar();if(t===e)return t}))}readSeparator(e,t,r){return this.readAtomically((()=>{if(!(t>0&&void 0===this.readGivenChar(e)))return r()}))}readNumber(e,t,r,n){return this.readAtomically((()=>{let i=0,o=0;const s=this.peekChar();if(void 0===s)return;const a="0"===s,c=2**(8*n)-1;for(;;){const r=this.readAtomically((()=>{const t=this.readChar();if(void 0===t)return;const r=Number.parseInt(t,e);return Number.isNaN(r)?void 0:r}));if(void 0===r)break;if(i*=e,i+=r,i>c)return;if(o+=1,void 0!==t&&o>t)return}return 0===o||!r&&a&&o>1?void 0:i}))}readIPv4Addr(){return this.readAtomically((()=>{const e=new Uint8Array(4);for(let t=0;t<e.length;t++){const r=this.readSeparator(".",t,(()=>this.readNumber(10,3,!1,1)));if(void 0===r)return;e[t]=r}return e}))}readIPv6Addr(){const e=e=>{for(let t=0;t<e.length/2;t++){const r=2*t;if(t<e.length-3){const n=this.readSeparator(":",t,(()=>this.readIPv4Addr()));if(void 0!==n)return e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3],[r+4,!0]}const n=this.readSeparator(":",t,(()=>this.readNumber(16,4,!0,2)));if(void 0===n)return[r,!1];e[r]=n>>8,e[r+1]=255&n}return[e.length,!1]};return this.readAtomically((()=>{const t=new Uint8Array(16),[r,n]=e(t);if(16===r)return t;if(n)return;if(void 0===this.readGivenChar(":"))return;if(void 0===this.readGivenChar(":"))return;const i=new Uint8Array(14),o=16-(r+2),[s]=e(i.subarray(0,o));return t.set(i.subarray(0,s),16-s),t}))}readIPAddr(){var e;return null!==(e=this.readIPv4Addr())&&void 0!==e?e:this.readIPv6Addr()}};parseInt("0xFFFF",16),new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function ru(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=Yl[t];if(null==r)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode("".concat(r.prefix).concat(e)):Kl(globalThis.Buffer.from(e,"utf-8"))}function nu(e){return Boolean(function(e){if(!(e.length>eu))return tu.new(e).parseWith((()=>tu.readIPv4Addr()))}(e))}function iu(e){return Boolean(function(e){if(!(e.length>Zl))return tu.new(e).parseWith((()=>tu.readIPv6Addr()))}(e))}function ou(e){return Boolean(function(e){if(!(e.length>Zl))return tu.new(e).parseWith((()=>tu.readIPAddr()))}(e))}const su=nu,au=iu,cu=function(e){let t=0;if(e=e.toString().trim(),su(e)){const r=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{r[t++]=255&parseInt(e,10)})),r}if(au(e)){const r=e.split(":",8);let n;for(n=0;n<r.length;n++){let e;su(r[n])&&(e=cu(r[n]),r[n]=$l(e.slice(0,2),"base16")),null!=e&&++n<8&&r.splice(n,0,$l(e.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&""!==r[n];n++);const e=[n,1];for(n=9-r.length;n>0;n--)e.push("0");r.splice.apply(r,e)}const i=new Uint8Array(t+16);for(n=0;n<r.length;n++){const e=parseInt(r[n],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},lu=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;r=~~r,n=null!==(t=n)&&void 0!==t?t:e.length-r;const i=new DataView(e.buffer);if(4===n){const t=[];for(let i=0;i<n;i++)t.push(e[r+i]);return t.join(".")}if(16===n){const e=[];for(let t=0;t<n;t+=2)e.push(i.getUint16(r+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},uu=-1,hu={},du={};function fu(e){if("number"===typeof e){if(null!=du[e])return du[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=hu[e])return hu[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,uu,"ip6zone"],[43,8,"ipcidr"],[53,uu,"dns",!0],[54,uu,"dns4",!0],[55,uu,"dns6",!0],[56,uu,"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,uu,"unix",!1,!0],[421,uu,"ipfs"],[421,uu,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,uu,"garlic64"],[448,0,"tls"],[449,uu,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,uu,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,uu,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);du[t.code]=t,hu[t.name]=t}));fu("ip4"),fu("ip6"),fu("ipcidr");function pu(e,t){switch(fu(e).code){case 4:case 41:return function(e){const t=lu(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!ou(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 wu(t).toString();case 421:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return $l(r,"base58btc")}(t);case 444:case 445:return Su(t);case 466:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+$l(r,"base64url")}(t);default:return $l(t,"base16")}}function gu(e,t){switch(fu(e).code){case 4:case 41:return vu(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Eu(t);case 6:case 273:case 33:case 132:return bu(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?jc(mc.decode("z".concat(e))).bytes:el.parse(e).multihash.bytes;const r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(16!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion address."));const r=Vc.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=bu(n);return Jl([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(56!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion3 address."));const r=Vc.decode("b".concat(t[0])),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=bu(n);return Jl([r,i],r.length+i.length)}(t);case 466:return function(e){const t=mu.decode(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);default:return ru(t,"base16")}}const yu=Object.values(Vl).map((e=>e.decoder)),mu=function(){let e=yu[0].or(yu[1]);return yu.slice(2).forEach((t=>e=e.or(t))),e}();function vu(e){if(!ou(e))throw new Error("invalid ip address");return cu(e)}function bu(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function wu(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function Eu(e){const t=ru(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}function _u(e){const t=Xl.decode(e);if((e=e.slice(Xl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return $l(e)}function Su(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=$l(t,"base32"),i=wu(r);return"".concat(n,":").concat(i)}function Au(e){return e.map((e=>{const t=Lu(e);return null!=e[1]?[t.code,pu(t.code,e[1])]:[t.code]}))}function Tu(e){return Pu(Jl(e.map((e=>{const t=Lu(e);let r=Uint8Array.from(Xl.encode(t.code));return e.length>1&&null!=e[1]&&(r=Jl([r,e[1]])),r}))))}function Cu(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var r;return Xl.decode(t)+(null!==(r=Xl.decode.bytes)&&void 0!==r?r:0)}function ku(e){const t=[];let r=0;for(;r<e.length;){var n;const i=Xl.decode(e,r),o=null!==(n=Xl.decode.bytes)&&void 0!==n?n:0,s=Cu(fu(i),e.slice(r+o));if(0===s){t.push([i]),r+=o;continue}const a=e.slice(r+o,r+o+s);if(r+=s+o,r>e.length)throw xu("Invalid address Uint8Array: "+$l(e,"base16"));t.push([i,a])}return t}function Iu(e){return function(e){const t=[];return e.map((e=>{const r=Lu(e);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),Du(t.join("/"))}(Au(ku(e)))}function Ru(e){const t=function(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=fu(i);if(0!==o.size){if(n++,n>=r.length)throw xu("invalid address: "+e);if(!0===o.path){t.push([i,Du(r.slice(n).join("/"))]);break}t.push([i,r[n]])}else t.push([i])}return t}(e=Du(e));return Tu(t.map((e=>{Array.isArray(e)||(e=[e]);const t=Lu(e);return e.length>1?[t.code,gu(t.code,e[1])]:[t.code]})))}function Pu(e){const t=Nu(e);if(null!=t)throw t;return Uint8Array.from(e)}function Nu(e){try{ku(e)}catch(t){return t}}function Du(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function xu(e){return new Error("Error parsing address: "+e)}function Lu(e){return fu(e[0])}const Ou=Symbol.for("nodejs.util.inspect.custom"),Bu=[fu("dns").code,fu("dns4").code,fu("dns6").code,fu("dnsaddr").code],Mu=new Map,Uu=Symbol.for("@multiformats/js-multiaddr/multiaddr");function Fu(e){return Boolean(null===e||void 0===e?void 0:e[Uu])}var ju,zu,Vu,Ku,qu=new WeakMap,Hu=new WeakMap,Gu=new WeakMap,Wu=new WeakMap;class Qu{constructor(e){if(Xa(this,"bytes",void 0),ec(this,qu,{writable:!0,value:void 0}),ec(this,Hu,{writable:!0,value:void 0}),ec(this,Gu,{writable:!0,value:void 0}),ec(this,Wu,{writable:!0,value:void 0}),Xa(this,Uu,!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=Ru(e)}else{if(!Fu(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=Pu(e.bytes)}}toString(){return null==nc(this,qu)&&rc(this,qu,Iu(this.bytes)),nc(this,qu)}toJSON(){return this.toString()}toOptions(){let e,t,r,n,i="";const o=fu("tcp"),s=fu("udp"),a=fu("ip4"),c=fu("ip6"),l=fu("dns6"),u=fu("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),Bu.includes(h)&&(t=o.name,n=443,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=fu(h).name,n=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=fu(h).name,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==r||null==n)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:r,transport:t,port:n}}protos(){return this.protoCodes().map((e=>Object.assign({},fu(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){var n;const i=Xl.decode(t,r),o=null!==(n=Xl.decode.bytes)&&void 0!==n?n:0;r+=Cu(fu(i),t.slice(r+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==nc(this,Hu)&&rc(this,Hu,ku(this.bytes)),nc(this,Hu)}stringTuples(){return null==nc(this,Gu)&&rc(this,Gu,Au(this.tuples())),nc(this,Gu)}encapsulate(e){return e=new Qu(e),new Qu(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new Qu(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new Qu(Tu(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===hu.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]?$l(mc.decode("z".concat(e)),"base58btc"):$l(el.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===nc(this,Wu))try{rc(this,Wu,this.stringTuples().filter((e=>!0===fu(e[0]).path))[0][1]),null==nc(this,Wu)&&rc(this,Wu,null)}catch{rc(this,Wu,null)}return nc(this,Wu)}equals(e){return cl(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const r=Mu.get(t.name);if(null==r)throw new oc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await r(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))}[Ou](){return"Multiaddr(".concat(Iu(this.bytes),")")}}!function(e){e.Relay="relay",e.Store="store",e.LightPush="lightpush",e.Filter="filter"}(ju||(ju={})),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"}(zu||(zu={})),function(e){e.BACKWARD="backward",e.FORWARD="forward"}(Vu||(Vu={})),function(e){e.BOOTSTRAP="bootstrap",e.PEER_EXCHANGE="peer-exchange"}(Ku||(Ku={}));var Yu=__webpack_require__(8392);const $u=Yu("waku:keep-alive");class Xu{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:r,relayKeepAlive:n}=this.options,i=e.toString();if(0!==r){const n=setInterval((()=>{t(e).catch((e=>{$u("Ping failed (".concat(i,")"),e)}))}),1e3*r);this.pingKeepAliveTimers.set(i,n)}const o=this.relay;if(o&&0!==n){const t=Xh({contentTopic:"/relay-ping/1/ping/null",ephemeral:!0}),r=setInterval((()=>{$u("Sending Waku Relay ping message"),o.send(t,{payload:new Uint8Array([1])}).catch((e=>$u("Failed to send relay ping",e)))}),1e3*n);this.relayKeepAliveTimers.set(e,r)}}stop(e){const t=e.toString();this.pingKeepAliveTimers.has(t)&&(clearInterval(this.pingKeepAliveTimers.get(t)),this.pingKeepAliveTimers.delete(t)),this.relayKeepAliveTimers.has(e)&&(clearInterval(this.relayKeepAliveTimers.get(e)),this.relayKeepAliveTimers.delete(e))}stopAll(){for(const e of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(e);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}}const Ju=Yu("waku:connection-manager");class Zu{static create(e,t,r,n,i){let o=Zu.instances.get(e);return o||(o=new Zu(t,r,n,i),Zu.instances.set(e,o)),o}constructor(e,t,r,n){Xa(this,"keepAliveManager",void 0),Xa(this,"options",void 0),Xa(this,"libp2pComponents",void 0),Xa(this,"dialAttemptsForPeer",new Map),Xa(this,"dialErrorsForPeer",new Map),Xa(this,"currentActiveDialCount",0),Xa(this,"pendingPeerDialQueue",[]),Xa(this,"onEventHandlers",{"peer:discovery":async e=>{const{id:t}=e.detail;this.attemptDial(t).catch((e=>Ju("Error dialing peer ".concat(t.toString()," : ").concat(e))))},"peer:connect":async e=>{const{remotePeer:t}=e.detail;this.keepAliveManager.start(t,this.libp2pComponents.ping.bind(this));if((await this.getTagNamesForPeer(t)).includes(Ku.BOOTSTRAP)){this.libp2pComponents.getConnections().filter((e=>e.tags.includes(Ku.BOOTSTRAP))).length>this.options.maxBootstrapPeersAllowed&&await this.dropConnection(t)}},"peer:disconnect":()=>e=>{this.keepAliveManager.stop(e.detail.remotePeer)}}),this.libp2pComponents=e,this.options={maxDialAttemptsForPeer:3,maxBootstrapPeersAllowed:1,maxParallelDials:3,...n},this.keepAliveManager=new Xu(t,r),this.run().then((()=>Ju("Connection Manager is now running"))).catch((e=>Ju("Unexpected error while running service",e))),this.dialPeerStorePeers()}async dialPeerStorePeers(){const e=await this.libp2pComponents.peerStore.all(),t=[];for(const n of e)this.libp2pComponents.getConnections().find((e=>e.remotePeer===n.id))||t.push(this.attemptDial(n.id));try{await Promise.all(t)}catch(r){Ju("Unexpected error while dialing peer store peers",r)}}async run(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener()}stop(){this.keepAliveManager.stopAll(),this.libp2pComponents.removeEventListener("peer:connect",this.onEventHandlers["peer:connect"]),this.libp2pComponents.removeEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"]),this.libp2pComponents.removeEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}async dialPeer(e){this.currentActiveDialCount+=1;let t=0;for(;t<=this.options.maxDialAttemptsForPeer;)try{Ju("Dialing peer ".concat(e.toString())),await this.libp2pComponents.dial(e);const t=await this.getTagNamesForPeer(e);return this.libp2pComponents.getConnections(e).forEach((e=>e.tags=Array.from(new Set([...e.tags,...t])))),void this.dialAttemptsForPeer.delete(e.toString())}catch(n){var r;const i=n;this.dialErrorsForPeer.set(e.toString(),i),Ju("Error dialing peer ".concat(e.toString()," - ").concat(i.errors)),t=null!==(r=this.dialAttemptsForPeer.get(e.toString()))&&void 0!==r?r:1,this.dialAttemptsForPeer.set(e.toString(),t+1),t<=this.options.maxDialAttemptsForPeer&&Ju("Reattempting dial (".concat(t,")"))}try{return Ju("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.libp2pComponents.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{await this.libp2pComponents.hangUp(e),Ju("Dropped connection with peer ".concat(e.toString()))}catch(t){Ju("Error dropping connection with peer ".concat(e.toString()," - ").concat(t))}}async processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveDialCount<this.options.maxParallelDials){const e=this.pendingPeerDialQueue.shift();if(!e)return;this.attemptDial(e).catch((e=>{Ju(e)}))}}startPeerDiscoveryListener(){this.libp2pComponents.peerStore.addEventListener("peer",this.onEventHandlers["peer:discovery"])}startPeerConnectionListener(){this.libp2pComponents.addEventListener("peer:connect",this.onEventHandlers["peer:connect"])}startPeerDisconnectionListener(){this.libp2pComponents.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.libp2pComponents.getConnections(e).length>0)return!1;if(!(await this.getTagNamesForPeer(e)).some((e=>e===Ku.BOOTSTRAP)))return!0;if(this.libp2pComponents.getConnections().filter((e=>{e.tags.find((e=>e===Ku.BOOTSTRAP))})).length<this.options.maxBootstrapPeersAllowed)return!0;return!1}async getTagNamesForPeer(e){return(await this.libp2pComponents.peerStore.getTags(e)).map((e=>e.name))}}Xa(Zu,"instances",new Map);const eh="js-waku",th=Yu("waku:waku");class rh{constructor(e,t,r,n,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,r&&(this.store=r(t)),i&&(this.filter=i(t)),n&&(this.lightPush=n(t)),o&&(this.relay=o(t));const s=e.pingKeepAlive||0,a=this.relay?e.relayKeepAlive||300:0,c=this.libp2p.peerId.toString();this.connectionManager=Zu.create(c,t,{pingKeepAlive:s,relayKeepAlive:a},this.relay),th("Waku node created",c,"relay: ".concat(!!this.relay,", store: ").concat(!!this.store,", light push: ").concat(!!this.lightPush,", filter: ").concat(!!this.filter))}async dial(e,t){const r=null!==t&&void 0!==t?t:[],n=function(e){return Za(e)?e:(t=e,new Qu(t));var t}(e);"undefined"===typeof t&&(this.relay&&r.push(ju.Relay),this.store&&r.push(ju.Store),this.filter&&r.push(ju.Filter),this.lightPush&&r.push(ju.LightPush));const i=[];return r.includes(ju.Relay)&&(this.relay?this.relay.gossipSub.multicodecs.forEach((e=>i.push(e))):th("Relay codec not included in dial codec: protocol not mounted locally")),r.includes(ju.Store)&&(this.store?i.push(this.store.multicodec):th("Store codec not included in dial codec: protocol not mounted locally")),r.includes(ju.LightPush)&&(this.lightPush?i.push(this.lightPush.multicodec):th("Light Push codec not included in dial codec: protocol not mounted locally")),r.includes(ju.Filter)&&(this.filter?i.push(this.filter.multicodec):th("Filter codec not included in dial codec: protocol not mounted locally")),th("Dialing to ".concat(n.toString()," with protocols ").concat(r)),this.libp2p.dialProtocol(n,i)}async start(){await this.libp2p.start()}async stop(){this.connectionManager.stop(),await this.libp2p.stop()}isStarted(){return this.libp2p.isStarted()}getLocalMultiaddrWithID(){const e=this.libp2p.getMultiaddrs().find((e=>e.toString().match(/127\.0\.0\.1/)));if(!e||""===e.toString())throw"Not listening on localhost";return e+"/p2p/"+this.libp2p.peerId.toString()}}var nh=__webpack_require__(6276),ih=__webpack_require__(6453),oh=__webpack_require__(5934),sh=__webpack_require__(1928),ah=__webpack_require__(651);oh._configure(),nh._configure(ih),sh._configure(ah);const ch=["uint64","int64","sint64","fixed64","sfixed64"];function lh(e){return function(e){for(const t of ch){if(null==e[t])continue;const r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new nh(e))}function uh(){return function(e){for(const t of ch){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(sh.create())}function hh(e,t){const r=lh(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function dh(e,t){const r=uh();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var fh,ph,gh,yh,mh,vh,bh,wh,Eh,_h,Sh,Ah,Th,Ch,kh,Ih,Rh,Ph,Nh,Dh,xh,Lh,Oh,Bh,Mh,Uh,Fh,jh,zh,Vh,Kh;function qh(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function Hh(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return qh("enum",fh.VARINT,(function(e,r){const n=t(e);r.int32(n)}),(function(e){return t(e.int32())}))}function Gh(e,t){return qh("message",fh.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"}(fh||(fh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(ph||(ph={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),ph.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=ph.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(gh||(gh={})),function(e){let t,r;!function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(t=e.ContentFilter||(e.ContentFilter={})),e.codec=()=>(null==r&&(r=Gh((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null!=t.subscribe&&!1!==t.subscribe&&(r.uint32(8),r.bool(t.subscribe)),null!=t.topic&&""!==t.topic&&(r.uint32(18),r.string(t.topic)),null!=t.contentFilters)for(const i of t.contentFilters)r.uint32(26),e.ContentFilter.codec().encode(i,r);!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={subscribe:!1,topic:"",contentFilters:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.subscribe=t.bool();break;case 2:n.topic=t.string();break;case 3:n.contentFilters.push(e.ContentFilter.codec().decode(t,t.uint32()));break;default:t.skipType(7&r)}}return n}))),r),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(yh||(yh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.messages)for(const n of e.messages)t.uint32(10),wh.codec().encode(n,t);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={messages:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.messages.push(wh.codec().decode(e,e.uint32()));else e.skipType(7&t)}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(mh||(mh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),yh.codec().encode(e.request,t)),null!=e.push&&(t.uint32(26),mh.codec().encode(e.push,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.request=yh.codec().decode(e,e.uint32());break;case 3:r.push=mh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(vh||(vh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(bh||(bh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),bh.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=bh.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(wh||(wh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===2)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Eh||(Eh={})),function(e){let t,r,n;!function(e){e.SUBSCRIBER_PING="SUBSCRIBER_PING",e.SUBSCRIBE="SUBSCRIBE",e.UNSUBSCRIBE="UNSUBSCRIBE",e.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"}(t=e.FilterSubscribeType||(e.FilterSubscribeType={})),function(e){e[e.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",e[e.SUBSCRIBE=1]="SUBSCRIBE",e[e.UNSUBSCRIBE=2]="UNSUBSCRIBE",e[e.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"}(r||(r={})),function(e){e.codec=()=>Hh(r)}(t=e.FilterSubscribeType||(e.FilterSubscribeType={})),e.codec=()=>(null==n&&(n=Gh((function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==i.lengthDelimited&&n.fork(),null!=t.requestId&&""!==t.requestId&&(n.uint32(10),n.string(t.requestId)),null!=t.filterSubscribeType&&0!==r[t.filterSubscribeType]&&(n.uint32(16),e.FilterSubscribeType.codec().encode(t.filterSubscribeType,n)),null!=t.pubsubTopic&&(n.uint32(82),n.string(t.pubsubTopic)),null!=t.contentTopics)for(const e of t.contentTopics)n.uint32(90),n.string(e);!1!==i.lengthDelimited&&n.ldelim()}),((r,n)=>{const i={requestId:"",filterSubscribeType:t.SUBSCRIBER_PING,contentTopics:[]},o=null==n?r.len:r.pos+n;for(;r.pos<o;){const t=r.uint32();switch(t>>>3){case 1:i.requestId=r.string();break;case 2:i.filterSubscribeType=e.FilterSubscribeType.codec().decode(r);break;case 10:i.pubsubTopic=r.string();break;case 11:i.contentTopics.push(r.string());break;default:r.skipType(7&t)}}return i}))),n),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(_h||(_h={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.statusCode&&0!==e.statusCode&&(t.uint32(80),t.uint32(e.statusCode)),null!=e.statusDesc&&(t.uint32(90),t.string(e.statusDesc)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:"",statusCode:0},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 10:r.statusCode=e.uint32();break;case 11:r.statusDesc=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Sh||(Sh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.wakuMessage&&(t.uint32(10),Ch.codec().encode(e.wakuMessage,t)),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.wakuMessage=Ch.codec().decode(e,e.uint32());break;case 2:r.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Ah||(Ah={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Th||(Th={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),Th.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=Th.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Ch||(Ch={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&""!==e.pubsubTopic&&(t.uint32(10),t.string(e.pubsubTopic)),null!=e.message&&(t.uint32(18),Nh.codec().encode(e.message,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={pubsubTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.pubsubTopic=e.string();break;case 2:r.message=Nh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(kh||(kh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.isSuccess&&!1!==e.isSuccess&&(t.uint32(8),t.bool(e.isSuccess)),null!=e.info&&(t.uint32(18),t.string(e.info)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={isSuccess:!1},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.isSuccess=e.bool();break;case 2:r.info=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Ih||(Ih={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.request&&(t.uint32(18),kh.codec().encode(e.request,t)),null!=e.response&&(t.uint32(26),Ih.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.request=kh.codec().decode(e,e.uint32());break;case 3:r.response=Ih.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Rh||(Rh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Ph||(Ph={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),Ph.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=Ph.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Nh||(Nh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.digest&&e.digest.byteLength>0&&(t.uint32(10),t.bytes(e.digest)),null!=e.receiverTime&&0n!==e.receiverTime&&(t.uint32(16),t.sint64(e.receiverTime)),null!=e.senderTime&&0n!==e.senderTime&&(t.uint32(24),t.sint64(e.senderTime)),null!=e.pubsubTopic&&""!==e.pubsubTopic&&(t.uint32(34),t.string(e.pubsubTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={digest:new Uint8Array(0),receiverTime:0n,senderTime:0n,pubsubTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.digest=e.bytes();break;case 2:r.receiverTime=e.sint64();break;case 3:r.senderTime=e.sint64();break;case 4:r.pubsubTopic=e.string();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Dh||(Dh={})),function(e){let t,r,n;!function(e){e.BACKWARD="BACKWARD",e.FORWARD="FORWARD"}(t=e.Direction||(e.Direction={})),function(e){e[e.BACKWARD=0]="BACKWARD",e[e.FORWARD=1]="FORWARD"}(r||(r={})),function(e){e.codec=()=>Hh(r)}(t=e.Direction||(e.Direction={})),e.codec=()=>(null==n&&(n=Gh((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&r.fork(),null!=t.pageSize&&(r.uint32(8),r.uint64(t.pageSize)),null!=t.cursor&&(r.uint32(18),Dh.codec().encode(t.cursor,r)),null!=t.direction&&(r.uint32(24),e.Direction.codec().encode(t.direction,r)),!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.pageSize=t.uint64();break;case 2:n.cursor=Dh.codec().decode(t,t.uint32());break;case 3:n.direction=e.Direction.codec().decode(t);break;default:t.skipType(7&r)}}return n}))),n),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(xh||(xh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(10),t.string(e.contentTopic)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.contentTopic=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Lh||(Lh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.pubsubTopic&&(t.uint32(18),t.string(e.pubsubTopic)),null!=e.contentFilters)for(const n of e.contentFilters)t.uint32(26),Lh.codec().encode(n,t);null!=e.pagingInfo&&(t.uint32(34),xh.codec().encode(e.pagingInfo,t)),null!=e.startTime&&(t.uint32(40),t.sint64(e.startTime)),null!=e.endTime&&(t.uint32(48),t.sint64(e.endTime)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={contentFilters:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 2:r.pubsubTopic=e.string();break;case 3:r.contentFilters.push(Lh.codec().decode(e,e.uint32()));break;case 4:r.pagingInfo=xh.codec().decode(e,e.uint32());break;case 5:r.startTime=e.sint64();break;case 6:r.endTime=e.sint64();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Oh||(Oh={})),function(e){let t,r,n;!function(e){e.NONE="NONE",e.INVALID_CURSOR="INVALID_CURSOR"}(t=e.HistoryError||(e.HistoryError={})),function(e){e[e.NONE=0]="NONE",e[e.INVALID_CURSOR=1]="INVALID_CURSOR"}(r||(r={})),function(e){e.codec=()=>Hh(r)}(t=e.HistoryError||(e.HistoryError={})),e.codec=()=>(null==n&&(n=Gh((function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==i.lengthDelimited&&n.fork(),null!=t.messages)for(const e of t.messages)n.uint32(18),Fh.codec().encode(e,n);null!=t.pagingInfo&&(n.uint32(26),xh.codec().encode(t.pagingInfo,n)),null!=t.error&&0!==r[t.error]&&(n.uint32(32),e.HistoryError.codec().encode(t.error,n)),!1!==i.lengthDelimited&&n.ldelim()}),((r,n)=>{const i={messages:[],error:t.NONE},o=null==n?r.len:r.pos+n;for(;r.pos<o;){const t=r.uint32();switch(t>>>3){case 2:i.messages.push(Fh.codec().decode(r,r.uint32()));break;case 3:i.pagingInfo=xh.codec().decode(r,r.uint32());break;case 4:i.error=e.HistoryError.codec().decode(r);break;default:r.skipType(7&t)}}return i}))),n),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Bh||(Bh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.requestId&&""!==e.requestId&&(t.uint32(10),t.string(e.requestId)),null!=e.query&&(t.uint32(18),Oh.codec().encode(e.query,t)),null!=e.response&&(t.uint32(26),Bh.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={requestId:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.requestId=e.string();break;case 2:r.query=Oh.codec().decode(e,e.uint32());break;case 3:r.response=Bh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Mh||(Mh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.proof&&e.proof.byteLength>0&&(t.uint32(10),t.bytes(e.proof)),null!=e.merkleRoot&&e.merkleRoot.byteLength>0&&(t.uint32(18),t.bytes(e.merkleRoot)),null!=e.epoch&&e.epoch.byteLength>0&&(t.uint32(26),t.bytes(e.epoch)),null!=e.shareX&&e.shareX.byteLength>0&&(t.uint32(34),t.bytes(e.shareX)),null!=e.shareY&&e.shareY.byteLength>0&&(t.uint32(42),t.bytes(e.shareY)),null!=e.nullifier&&e.nullifier.byteLength>0&&(t.uint32(50),t.bytes(e.nullifier)),null!=e.rlnIdentifier&&e.rlnIdentifier.byteLength>0&&(t.uint32(58),t.bytes(e.rlnIdentifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={proof:new Uint8Array(0),merkleRoot:new Uint8Array(0),epoch:new Uint8Array(0),shareX:new Uint8Array(0),shareY:new Uint8Array(0),nullifier:new Uint8Array(0),rlnIdentifier:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.proof=e.bytes();break;case 2:r.merkleRoot=e.bytes();break;case 3:r.epoch=e.bytes();break;case 4:r.shareX=e.bytes();break;case 5:r.shareY=e.bytes();break;case 6:r.nullifier=e.bytes();break;case 7:r.rlnIdentifier=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Uh||(Uh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(10),t.bytes(e.payload)),null!=e.contentTopic&&""!==e.contentTopic&&(t.uint32(18),t.string(e.contentTopic)),null!=e.version&&(t.uint32(24),t.uint32(e.version)),null!=e.timestamp&&(t.uint32(80),t.sint64(e.timestamp)),null!=e.meta&&(t.uint32(90),t.bytes(e.meta)),null!=e.rateLimitProof&&(t.uint32(170),Uh.codec().encode(e.rateLimitProof,t)),null!=e.ephemeral&&(t.uint32(248),t.bool(e.ephemeral)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={payload:new Uint8Array(0),contentTopic:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.payload=e.bytes();break;case 2:r.contentTopic=e.string();break;case 3:r.version=e.uint32();break;case 10:r.timestamp=e.sint64();break;case 11:r.meta=e.bytes();break;case 21:r.rateLimitProof=Uh.codec().decode(e,e.uint32());break;case 31:r.ephemeral=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Fh||(Fh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.enr&&(t.uint32(10),t.bytes(e.enr)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.enr=e.bytes();else e.skipType(7&t)}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(jh||(jh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.numPeers&&(t.uint32(8),t.uint64(e.numPeers)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.numPeers=e.uint64();else e.skipType(7&t)}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(zh||(zh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.peerInfos)for(const n of e.peerInfos)t.uint32(10),jh.codec().encode(n,t);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={peerInfos:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.peerInfos.push(jh.codec().decode(e,e.uint32()));else e.skipType(7&t)}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Vh||(Vh={})),function(e){let t;e.codec=()=>(null==t&&(t=Gh((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.query&&(t.uint32(10),zh.codec().encode(e.query,t)),null!=e.response&&(t.uint32(18),Vh.codec().encode(e.response,t)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.query=zh.codec().decode(e,e.uint32());break;case 2:r.response=Vh.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>dh(t,e.codec()),e.decode=t=>hh(t,e.codec())}(Kh||(Kh={}));const Wh=Yu("waku:message:version-0"),Qh=BigInt(1e6);class Yh{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/Qh;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 $h{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=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=r,!e||""===e)throw new Error("Content topic must be specified")}async toWire(e){return gh.encode(await this.toProtoObj(e))}async toProtoObj(e){var t;const r=null!==(t=e.timestamp)&&void 0!==t?t:new Date,n={payload:e.payload,version:0,contentTopic:this.contentTopic,timestamp:BigInt(r.valueOf())*Qh,meta:void 0,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const e=this.metaSetter(n);return{...n,meta:e}}return n}}function Xh(e){let{contentTopic:t,ephemeral:r,metaSetter:n}=e;return new $h(t,r,n)}class Jh{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,r,n,i,o;const s=gh.decode(e);return Wh("Message decoded",s),Promise.resolve({payload:s.payload,contentTopic:s.contentTopic,version:null!==(t=s.version)&&void 0!==t?t:void 0,timestamp:null!==(r=s.timestamp)&&void 0!==r?r:void 0,meta:null!==(n=s.meta)&&void 0!==n?n:void 0,rateLimitProof:null!==(i=s.rateLimitProof)&&void 0!==i?i:void 0,ephemeral:null!==(o=s.ephemeral)&&void 0!==o&&o})}async fromProtoObj(e,t){var r;return null!==(r=t.version)&&void 0!==r&&r?(Wh("Failed to decode due to incorrect version, expected:",0,", actual:",t.version),Promise.resolve(void 0)):new Yh(e,t)}}function Zh(e){return new Jh(e)}function ed(e){const t=new Map;return e.forEach((e=>{let r=t.get(e.contentTopic);r||(t.set(e.contentTopic,[]),r=t.get(e.contentTopic)),r.push(e)})),t}const td=60;async function rd(e,t,r,n){var i,o;const s=null!==(i=null===n||void 0===n?void 0:n.iteratorDelay)&&void 0!==i?i:td,a=[];let c;c=await e.subscribe(t,(e=>{a.push(e)}),r);const l=Number.isInteger(null===n||void 0===n?void 0:n.timeoutMs),u=null!==(o=null===n||void 0===n?void 0:n.timeoutMs)&&void 0!==o?o:0,h=Date.now();return{iterator:async function*(){for(;;){if(l&&Date.now()-h>=u)return;await nd(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 nd(e){return new Promise((t=>{setTimeout(t,e)}))}const id=function(e){if(null!=e[Symbol.asyncIterator])return(async()=>{const t=[];for await(const r of e)t.push(r);return t})();const t=[];for(const r of e)t.push(r);return t},od=Symbol.for("@achingbrain/uint8arraylist");function sd(e,t){if(null==t||t<0)throw new RangeError("index is out of bounds");let r=0;for(const n of e){const e=r+n.byteLength;if(t<e)return{buf:n,index:t-r};r=e}throw new RangeError("index is out of bounds")}function ad(e){return Boolean(null===e||void 0===e?void 0:e[od])}class cd{constructor(){Object.defineProperty(this,od,{value:!0}),this.bufs=[],this.length=0;for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.appendAll(t)}appendAll(e){let t=0;for(const r of e)if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.push(r);else{if(!ad(r))throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.push(...r.bufs)}this.length+=t}prepend(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.prependAll(t)}prependAll(e){let t=0;for(const r of e.reverse())if(r instanceof Uint8Array)t+=r.byteLength,this.bufs.unshift(r);else{if(!ad(r))throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");t+=r.byteLength,this.bufs.unshift(...r.bufs)}this.length+=t}get(e){const t=sd(this.bufs,e);return t.buf[t.index]}set(e,t){const r=sd(this.bufs,e);r.buf[r.index]=t}write(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e instanceof Uint8Array)for(let r=0;r<e.length;r++)this.set(t+r,e[r]);else{if(!ad(e))throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList");for(let r=0;r<e.length;r++)this.set(t+r,e.get(r))}}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength)return this.bufs=[],void(this.length=0);for(;this.bufs.length>0;){if(!(e>=this.bufs[0].byteLength)){this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift()}}}slice(e,t){const{bufs:r,length:n}=this._subList(e,t);return Jl(r,n)}subarray(e,t){const{bufs:r,length:n}=this._subList(e,t);return 1===r.length?r[0]:Jl(r,n)}sublist(e,t){const{bufs:r,length:n}=this._subList(e,t),i=new cd;return i.length=n,i.bufs=r,i}_subList(e,t){var r,n;if(e=null!==(r=e)&&void 0!==r?r:0,t=null!==(n=t)&&void 0!==n?n:this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(0===e&&t===this.length)return{bufs:[...this.bufs],length:this.length};const i=[];let o=0;for(let s=0;s<this.bufs.length;s++){const r=this.bufs[s],n=o,a=n+r.byteLength;if(o=a,e>=a)continue;const c=e>=n&&e<a,l=t>n&&t<=a;if(c&&l){if(e===n&&t===a){i.push(r);break}const o=e-n;i.push(r.subarray(o,o+(t-e)));break}if(c){if(0===e){i.push(r);continue}i.push(r.subarray(e-n))}else{if(l){if(t===a){i.push(r);break}i.push(r.subarray(0,t-n));break}i.push(r)}}return{bufs:i,length:t-e}}indexOf(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ad(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const n=e instanceof Uint8Array?e:e.subarray();if(r=Number(null!==(t=r)&&void 0!==t?t:0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),0===e.length)return r>this.length?this.length:r;const i=n.byteLength;if(0===i)throw new TypeError("search must be at least 1 byte long");const o=new Int32Array(256);for(let u=0;u<256;u++)o[u]=-1;for(let u=0;u<i;u++)o[n[u]]=u;const s=o,a=this.byteLength-n.byteLength,c=n.byteLength-1;let l;for(let u=r;u<=a;u+=l){l=0;for(let e=c;e>=0;e--){const t=this.get(u+e);if(n[e]!==t){l=Math.max(1,e-s[t]);break}}if(0===l)return u}return-1}getInt8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){const r=Hl(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,t),this.write(r,e)}getInt16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,t)}setInt16(e,t,r){const n=ql(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt16(0,t,r),this.write(n,e)}getInt32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,t)}setInt32(e,t,r){const n=ql(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt32(0,t,r),this.write(n,e)}getBigInt64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,t)}setBigInt64(e,t,r){const n=ql(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigInt64(0,t,r),this.write(n,e)}getUint8(e){const t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){const r=Hl(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,t),this.write(r,e)}getUint16(e,t){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,t)}setUint16(e,t,r){const n=ql(2);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint16(0,t,r),this.write(n,e)}getUint32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,t)}setUint32(e,t,r){const n=ql(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,t,r),this.write(n,e)}getBigUint64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,t)}setBigUint64(e,t,r){const n=ql(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setBigUint64(0,t,r),this.write(n,e)}getFloat32(e,t){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,t)}setFloat32(e,t,r){const n=ql(4);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat32(0,t,r),this.write(n,e)}getFloat64(e,t){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,t)}setFloat64(e,t,r){const n=ql(8);new DataView(n.buffer,n.byteOffset,n.byteLength).setFloat64(0,t,r),this.write(n,e)}equals(e){if(null==e)return!1;if(!(e instanceof cd))return!1;if(e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!cl(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){const r=new cd;return r.bufs=e,null==t&&(t=e.reduce(((e,t)=>e+t.byteLength),0)),r.length=t,r}}function ld(e){return e instanceof Uint8Array?{get:t=>e[t],set(t,r){e[t]=r}}:{get:t=>e.get(t),set(t,r){e.set(t,r)}}}const ud=4294967296;class hd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.hi=e,this.lo=t}toBigInt(e){if(!0===e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31!==0){const e=1+~this.lo>>>0;let t=~this.hi>>>0;return 0===e&&(t=t+1>>>0),-(BigInt(e)+(BigInt(t)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toNumber(e){return Number(this.toBigInt(e))}zzDecode(){const e=-(1&this.lo),t=((this.lo>>>1|this.hi<<31)^e)>>>0,r=(this.hi>>>1^e)>>>0;return new hd(r,t)}zzEncode(){const e=this.hi>>31,t=((this.hi<<1|this.lo>>>31)^e)>>>0,r=(this.lo<<1^e)>>>0;return new hd(t,r)}toBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=ld(e);for(;this.hi>0;)r.set(t++,127&this.lo|128),this.lo=(this.lo>>>7|this.hi<<25)>>>0,this.hi>>>=7;for(;this.lo>127;)r.set(t++,127&this.lo|128),this.lo=this.lo>>>7;r.set(t++,this.lo)}static fromBigInt(e){if(0n===e)return new hd;const t=e<0;t&&(e=-e);let r=0|Number(e>>32n),n=0|Number(e-(BigInt(r)<<32n));return t&&(r=~r>>>0,n=~n>>>0,++n>ud&&(n=0,++r>ud&&(r=0))),new hd(r,n)}static fromNumber(e){if(0===e)return new hd;const t=e<0;t&&(e=-e);let r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new hd(n,r)}static fromBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=ld(e),n=new hd;let i=0;if(e.length-t>4){for(;i<4;++i)if(n.lo=(n.lo|(127&r.get(t))<<7*i)>>>0,r.get(t++)<128)return n;if(n.lo=(n.lo|(127&r.get(t))<<28)>>>0,n.hi=(n.hi|(127&r.get(t))>>4)>>>0,r.get(t++)<128)return n;i=0}else for(;i<4;++i){if(t>=e.length)throw RangeError("index out of range: ".concat(t," > ").concat(e.length));if(n.lo=(n.lo|(127&r.get(t))<<7*i)>>>0,r.get(t++)<128)return n}if(e.length-t>4){for(;i<5;++i)if(n.hi=(n.hi|(127&r.get(t))<<7*i+3)>>>0,r.get(t++)<128)return n}else if(t<e.byteLength)for(;i<5;++i){if(t>=e.length)throw RangeError("index out of range: ".concat(t," > ").concat(e.length));if(n.hi=(n.hi|(127&r.get(t))<<7*i+3)>>>0,r.get(t++)<128)return n}throw RangeError("invalid varint encoding")}}const dd=Math.pow(2,7),fd=Math.pow(2,14),pd=Math.pow(2,21),gd=Math.pow(2,28),yd=Math.pow(2,35),md=Math.pow(2,42),vd=Math.pow(2,49),bd=Math.pow(2,56),wd=Math.pow(2,63),Ed={encodingLength:e=>e<dd?1:e<fd?2:e<pd?3:e<gd?4:e<yd?5:e<md?6:e<vd?7:e<bd?8:e<wd?9:10,encode(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null!=Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return null==t&&(t=Hl(Ed.encodingLength(e))),hd.fromNumber(e).toBytes(t,r),t},decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return hd.fromBytes(e,t).toNumber(!0)}};function _d(e){return null!=e[Symbol.asyncIterator]}const Sd=e=>{const t=Ed.encodingLength(e),r=Hl(t);return Ed.encode(e,r),Sd.bytes=t,r};function Ad(e,t){var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:Sd;function*o(e){const t=i(e.byteLength);t instanceof Uint8Array?yield t:yield*t,e instanceof Uint8Array?yield e:yield*e}return _d(e)?async function*(){for await(const t of e)yield*o(t)}():function*(){for(const t of e)yield*o(t)}()}Sd.bytes=0,Ad.single=(e,t)=>{var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:Sd;return new cd(i(e.byteLength),e)};var Td=__webpack_require__(7963);const Cd=8,kd=4194304;var Id;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(Id||(Id={}));const Rd=e=>{const t=Ed.decode(e);return Rd.bytes=Ed.encodingLength(t),t};function Pd(e,t){var r,n,i;const o=new cd;let s=Id.LENGTH,a=-1;const c=null!==(r=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==r?r:Rd,l=null!==(n=null===t||void 0===t?void 0:t.maxLengthLength)&&void 0!==n?n:Cd,u=null!==(i=null===t||void 0===t?void 0:t.maxDataLength)&&void 0!==i?i:kd;function*h(){for(;o.byteLength>0;){if(s===Id.LENGTH)try{if(a=c(o),a<0)throw Td(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw Td(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=Id.DATA}catch(e){if(e instanceof RangeError){if(o.byteLength>l)throw Td(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw e}if(s===Id.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=Id.LENGTH}}}return _d(e)?async function*(){for await(const t of e)o.append(t),yield*h();if(o.byteLength>0)throw Td(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 Td(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Rd.bytes=0,Pd.fromReader=(e,t)=>{let r=1;return Pd(async function*(){for(;;)try{const{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}(),{...null!==t&&void 0!==t?t:{},onLength:e=>{r=e}})};class Nd{constructor(e){if(!(e>0)||0!==(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return void 0===this.buffer[this.btm]}}class Dd{constructor(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.hwm=null!==(e=t.splitLimit)&&void 0!==e?e:16,this.head=new Nd(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 Nd(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()}}function xd(){return Ld((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 Ld(e,t){var r;let n,i,o,s=(t=null!==(r=t)&&void 0!==r?r:{}).onEnd,a=new Dd;const c=e=>null!=i?i(e):(a.push(e),n),l=e=>{var r;if(o)return n;if(!0!==(null===(r=t)||void 0===r?void 0:r.objectMode)&&null==(null===e||void 0===e?void 0:e.byteLength))throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:e})},u=e=>o?n:(o=!0,null!=e?(e=>(a=new Dd,null!=i?i({error:e}):(a.push({error:e}),n)))(e):c({done:!0}));if(n={[Symbol.asyncIterator](){return this},next:async()=>a.isEmpty()?o?{done:!0}:await new Promise(((t,r)=>{i=o=>{i=null,a.push(o);try{t(e(a))}catch(s){r(s)}return n}})):e(a),return:()=>(a=new Dd,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:l,end:u,get readableLength(){return a.size}},null==s)return n;const h=n;return n={[Symbol.asyncIterator](){return this},next:()=>h.next(),throw:e=>(h.throw(e),null!=s&&(s(e),s=void 0),{done:!0}),return:()=>(h.return(),null!=s&&(s(),s=void 0),{done:!0}),push:l,end:e=>(h.end(e),null!=s&&(s(e),s=void 0),n),get readableLength(){return h.readableLength}},n}const Od=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[];for(const i of t)null==i[Symbol.asyncIterator]&&n.push(i);return n.length===t.length?function*(){for(const e of n)yield*e}():async function*(){const e=xd({objectMode:!0});Promise.resolve().then((async()=>{try{await Promise.all(t.map((async t=>{for await(const r of t)e.push(r)}))),e.end()}catch(r){e.end(r)}})),yield*e}()};function Bd(e){if(null==e)throw new Error("Empty pipeline");if(jd(e)){const t=e;e=()=>t.source}else if(Fd(e)||Ud(e)){const t=e;e=()=>t}for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const i=[e,...r];if(i.length>1&&jd(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++)jd(i[o])&&(i[o]=zd(i[o]));return Md(...i)}const Md=function(){let e;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(;r.length>0;)e=r.shift()(e);return e},Ud=e=>null!=(null===e||void 0===e?void 0:e[Symbol.asyncIterator]),Fd=e=>null!=(null===e||void 0===e?void 0:e[Symbol.iterator]),jd=e=>null!=e&&(null!=e.sink&&null!=e.source),zd=e=>t=>{const r=e.sink(t);if(null!=(null===r||void 0===r?void 0:r.then)){const t=xd({objectMode:!0});let n;r.then((()=>{t.end()}),(e=>{t.end(e)}));const i=e.source;if(Ud(i))n=async function*(){yield*i,t.end()};else{if(!Fd(i))throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");n=function*(){yield*i,t.end()}}return Od(t,n())}return e.source},Vd=Yu("waku:libp2p-utils");async function Kd(e,t){const r=[];return await e.forEach((e=>{for(let n=0;n<t.length;n++)if(e.protocols.includes(t[n])){r.push(e);break}})),r}async function qd(e,t,r){let n,i;if(r){if(n=await e.get(r),!n)throw new Error("Failed to retrieve connection details for provided peer in peer store: ".concat(r.toString()))}else{if(n=function(e){if(0===e.length)return;return e[Math.round(Math.random()*(e.length-1))]}(await Kd(e,t)),!n)throw new Error("Failed to find known peer that registers protocols: ".concat(t))}for(const o of t)n.protocols.includes(o)&&(i=o);if(Vd("Using codec ".concat(i)),!i)throw new Error("Peer does not register required protocols (".concat(n.id.toString(),"): ").concat(t));return{peer:n,protocol:i}}function Hd(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 Gd{constructor(e,t,r){Xa(this,"multicodec",void 0),Xa(this,"peerStore",void 0),Xa(this,"getConnections",void 0),this.multicodec=e,this.peerStore=t,this.getConnections=r}async peers(){return Kd(this.peerStore,[this.multicodec])}async getPeer(e){const{peer:t}=await qd(this.peerStore,[this.multicodec],e);return t}async newStream(e){const t=Hd(this.getConnections(e.id));if(!t)throw new Error("Failed to get a connection to the peer");return t.newStream(this.multicodec)}}const Wd="/waku/2/default-waku/proto",Qd={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function Yd(e){return{...Qd,...e}}const $d={randomUUID:"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Xd;const Jd=new Uint8Array(16);function Zd(){if(!Xd&&(Xd="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Xd))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xd(Jd)}const ef=[];for(let _U=0;_U<256;++_U)ef.push((_U+256).toString(16).slice(1));function tf(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(ef[e[t+0]]+ef[e[t+1]]+ef[e[t+2]]+ef[e[t+3]]+"-"+ef[e[t+4]]+ef[e[t+5]]+"-"+ef[e[t+6]]+ef[e[t+7]]+"-"+ef[e[t+8]]+ef[e[t+9]]+"-"+ef[e[t+10]]+ef[e[t+11]]+ef[e[t+12]]+ef[e[t+13]]+ef[e[t+14]]+ef[e[t+15]]).toLowerCase()}const rf=function(e,t,r){if($d.randomUUID&&!t&&!e)return $d.randomUUID();const n=(e=e||{}).random||(e.rng||Zd)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return tf(n)};class nf{constructor(e){Xa(this,"proto",void 0),this.proto=e}static createRequest(e,t,r){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return new nf({requestId:r||rf(),request:{subscribe:n,topic:e,contentFilters:t},push:void 0})}static decode(e){const t=vh.decode(e);return new nf(t)}encode(){return vh.encode(this.proto)}get push(){return this.proto.push}get requestId(){return this.proto.requestId}}const of=Yu("waku:filter");class sf extends Gd{constructor(e,t){super("/vac/waku/filter/2.0.0-beta1",e.peerStore,e.getConnections.bind(e)),Xa(this,"libp2p",void 0),Xa(this,"options",void 0),Xa(this,"subscriptions",void 0),this.libp2p=e,this.options=null!==t&&void 0!==t?t:{},this.subscriptions=new Map,this.libp2p.handle(this.multicodec,this.onRequest.bind(this)).catch((e=>of("Failed to register filter protocol",e)))}async subscribe(e,t,r){const n=Array.isArray(e)?e:[e],{pubSubTopic:i=Wd}=this.options,o=Array.from(ed(n).keys()),s=o.map((e=>({contentTopic:e}))),a=nf.createRequest(i,s,void 0,!0),c=a.requestId,l=await this.getPeer(null===r||void 0===r?void 0:r.peerId),u=await this.newStream(l);try{const e=await Bd([a.encode()],Ad,u,Pd,(async e=>await id(e)));of("response",e)}catch(d){throw of("Error subscribing to peer ",l.id.toString(),"for content topics",o,": ",d),d}const h={callback:t,decoders:n,pubSubTopic:i};return this.subscriptions.set(c,h),async()=>{await this.unsubscribe(i,s,c,l),this.subscriptions.delete(c)}}toSubscriptionIterator(e,t){return rd(this,e,t)}getActiveSubscriptions(){const e=new Map,t=this.subscriptions;for(const r of t.values()){const t=e.get(r.pubSubTopic)||[],n=r.decoders.map((e=>e.contentTopic));e.set(r.pubSubTopic,[...t,...n])}return e}onRequest(e){of("Receiving message push");try{Bd(e.stream,Pd,(async e=>{for await(const n of e){var t,r;const e=nf.decode(n.slice());e.requestId&&null!==(t=e.push)&&void 0!==t&&null!==(r=t.messages)&&void 0!==r&&r.length&&await this.pushMessages(e.requestId,e.push.messages)}})).then((()=>{of("Receiving pipe closed.")}),(e=>{of("Error with receiving pipe",e)}))}catch(t){of("Error decoding message",t)}}async pushMessages(e,t){const r=this.subscriptions.get(e);if(!r)return void of("No subscription locally registered for request ID ".concat(e));const{decoders:n,callback:i,pubSubTopic:o}=r;if(n&&n.length)for(const s of t){if(!s.contentTopic)return void of("Message has no content topic, skipping");let e=!1;n.forEach((async t=>{if(e)return;const r=await t.fromProtoObj(o,Yd(s));r?(e=Boolean(r),await i(r)):of("Not able to decode message")}))}else of("No decoder registered for request ID ".concat(e))}async unsubscribe(e,t,r,n){const i=nf.createRequest(e,t,r,!1),o=await this.newStream(n);try{await Bd([i.encode()],Ad,o.sink)}catch(s){throw of("Error unsubscribing",s),s}}}class af{constructor(e){Xa(this,"proto",void 0),this.proto=e}static decode(e){const t=Ah.decode(e);return new af(t)}encode(){return Ah.encode(this.proto)}get wakuMessage(){return this.proto.wakuMessage}get pubsubTopic(){return this.proto.pubsubTopic}}class cf{constructor(e){Xa(this,"proto",void 0),this.proto=e}static createSubscribeRequest(e,t){return new cf({requestId:rf(),filterSubscribeType:_h.FilterSubscribeType.SUBSCRIBE,pubsubTopic:e,contentTopics:t})}static createUnsubscribeRequest(e,t){return new cf({requestId:rf(),filterSubscribeType:_h.FilterSubscribeType.UNSUBSCRIBE,pubsubTopic:e,contentTopics:t})}static createUnsubscribeAllRequest(e){return new cf({requestId:rf(),filterSubscribeType:_h.FilterSubscribeType.UNSUBSCRIBE_ALL,pubsubTopic:e,contentTopics:[]})}static createSubscriberPingRequest(){return new cf({requestId:rf(),filterSubscribeType:_h.FilterSubscribeType.SUBSCRIBER_PING,pubsubTopic:"",contentTopics:[]})}static decode(e){const t=_h.decode(e);return new cf(t)}encode(){return _h.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 lf{constructor(e){Xa(this,"proto",void 0),this.proto=e}static decode(e){const t=Sh.decode(e);return new lf(t)}encode(){return Sh.encode(this.proto)}get statusCode(){return this.proto.statusCode}get statusDesc(){return this.proto.statusDesc}get requestId(){return this.proto.requestId}}const uf=Yu("waku:filter:v2"),hf="/vac/waku/filter-subscribe/2.0.0-beta1",df="/vac/waku/filter-push/2.0.0-beta1";class ff{constructor(e,t,r){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=r,this.subscriptionCallbacks=new Map}async subscribe(e,t){const r=ed(Array.isArray(e)?e:[e]),n=Array.from(r.keys()),i=await this.newStream(this.peer),o=cf.createSubscribeRequest(this.pubSubTopic,n);try{const e=await Bd([o.encode()],Ad,i,Pd,(async e=>await id(e))),{statusCode:t,requestId:r,statusDesc:s}=lf.decode(e[0].slice());if(t<200||t>=300)throw new Error("Filter subscribe request ".concat(r," failed with status code ").concat(t,": ").concat(s));uf("Subscribed to peer ",this.peer.id.toString(),"for content topics",n)}catch(s){throw new Error("Error subscribing to peer: "+this.peer.id.toString()+" for content topics: "+n+": "+s)}r.forEach(((e,r)=>{const n={decoders:e,callback:t};this.subscriptionCallbacks.set(r,n)}))}async unsubscribe(e){const t=await this.newStream(this.peer),r=cf.createUnsubscribeRequest(this.pubSubTopic,e);try{await Bd([r.encode()],Ad,t.sink)}catch(n){throw new Error("Error subscribing: "+n)}e.forEach((e=>{this.subscriptionCallbacks.delete(e)}))}async ping(){const e=await this.newStream(this.peer),t=cf.createSubscriberPingRequest();try{const r=await Bd([t.encode()],Ad,e,Pd,(async e=>await id(e))),{statusCode:n,requestId:i,statusDesc:o}=lf.decode(r[0].slice());if(n<200||n>=300)throw new Error("Filter ping request ".concat(i," failed with status code ").concat(n,": ").concat(o));uf("Ping successful")}catch(r){throw uf("Error pinging: ",r),new Error("Error pinging: "+r)}}async unsubscribeAll(){const e=await this.newStream(this.peer),t=cf.createUnsubscribeAllRequest(this.pubSubTopic);try{const r=await Bd([t.encode()],Ad,e,Pd,(async e=>await id(e))),{statusCode:n,requestId:i,statusDesc:o}=lf.decode(r[0].slice());if(n<200||n>=300)throw new Error("Filter unsubscribe all request ".concat(i," failed with status code ").concat(n,": ").concat(o));this.subscriptionCallbacks.clear(),uf("Unsubscribed from all content topics")}catch(r){throw new Error("Error unsubscribing from all content topics: "+r)}}async processMessage(e){const t=e.contentTopic,r=this.subscriptionCallbacks.get(t);r?await async function(e,t,r){const{decoders:n,callback:i}=e,{contentTopic:o}=r;if(!o)return void uf("Message has no content topic, skipping");let s=!1;n.forEach((async e=>{if(s)return;const n=await e.fromProtoObj(t,r);n?(s=Boolean(n),await i(n)):uf("Not able to decode message")}))}(r,this.pubSubTopic,e):uf("No subscription callback available for ",t)}}class pf extends Gd{getActiveSubscription(e,t){return this.activeSubscriptions.get("".concat(e,"_").concat(t))}setActiveSubscription(e,t,r){return this.activeSubscriptions.set("".concat(e,"_").concat(t),r),r}constructor(e,t){super(hf,e.peerStore,e.getConnections.bind(e)),Xa(this,"libp2p",void 0),Xa(this,"options",void 0),Xa(this,"activeSubscriptions",new Map),this.libp2p=e,this.libp2p.handle(df,this.onRequest.bind(this)).catch((e=>{uf("Failed to register ",df,e)})),this.activeSubscriptions=new Map,this.options=null!==t&&void 0!==t?t:{}}async createSubscription(e,t){var r,n;const i=null!==(r=null!==e&&void 0!==e?e:this.options.pubSubTopic)&&void 0!==r?r:Wd,o=await this.getPeer(t);return null!==(n=this.getActiveSubscription(i,o.id.toString()))&&void 0!==n?n:this.setActiveSubscription(i,o.id.toString(),new ff(i,o,this.newStream.bind(this,o)))}toSubscriptionIterator(e,t){return rd(this,e,t)}async subscribe(e,t,r){const n=await this.createSubscription(void 0,null===r||void 0===r?void 0:r.peerId);n.subscribe(e,t);const i=Array.from(ed(Array.isArray(e)?e:[e]).keys());return async()=>{await n.unsubscribe(i)}}onRequest(e){uf("Receiving message push");try{Bd(e.stream,Pd,(async t=>{for await(const r of t){const t=af.decode(r.slice()),{pubsubTopic:n,wakuMessage:i}=t;if(!i)return void uf("Received empty message");if(!n)return void uf("PubSub topic missing from push message");const o=e.connection.remotePeer.toString(),s=this.getActiveSubscription(n,o);if(!s)return void uf("No subscription locally registered for topic ".concat(n));await s.processMessage(i)}})).then((()=>{uf("Receiving pipe closed.")}),(e=>{uf("Error with receiving pipe",e)}))}catch(t){uf("Error decoding message",t)}}}const gf=e=>!(e.length/1048576>1);class yf{constructor(e){Xa(this,"proto",void 0),this.proto=e}static createRequest(e,t){return new yf({requestId:rf(),request:{message:e,pubsubTopic:t},response:void 0})}static decode(e){const t=Rh.decode(e);return new yf(t)}encode(){return Rh.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}const mf=Yu("waku:light-push");class vf extends Gd{constructor(e,t){super("/vac/waku/lightpush/2.0.0-beta1",e.peerStore,e.getConnections.bind(e)),Xa(this,"libp2p",void 0),Xa(this,"options",void 0),this.libp2p=e,this.options=t||{}}async send(e,t,r){const{pubSubTopic:n=Wd}=this.options,i=await this.getPeer(null===r||void 0===r?void 0:r.peerId),o=await this.newStream(i),s=[];let a;try{if(!gf(t.payload))return mf("Failed to send waku light push: message is bigger that 1MB"),{recipients:s,error:zu.SIZE_TOO_BIG};const r=await e.toProtoObj(t);if(!r)return mf("Failed to encode to protoMessage, aborting push"),{recipients:s,error:zu.ENCODE_FAILED};const l=yf.createRequest(r,n),u=await Bd([l.encode()],Ad,o,Pd,(async e=>await id(e)));try{const e=new cd;u.forEach((t=>{e.append(t)}));const t=yf.decode(e).response;null!==t&&void 0!==t&&t.isSuccess?s.push(i.id):(mf("No response in PushRPC"),a=zu.NO_RPC_RESPONSE)}catch(c){mf("Failed to decode push reply",c),a=zu.DECODE_FAILED}}catch(c){mf("Failed to send waku light push request",c),a=zu.GENERIC_FAIL}return{error:a,recipients:s}}}function bf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Wrong positive integer: ".concat(e))}function wf(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r.length>0&&!r.includes(e.length))throw new Error("Expected Uint8Array of length ".concat(r,", not of length=").concat(e.length))}const Ef={number:bf,bool:function(e){if("boolean"!==typeof e)throw new Error("Expected boolean, not ".concat(e))},bytes:wf,hash:function(e){if("function"!==typeof e||"function"!==typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");bf(e.outputLen),bf(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){wf(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least ".concat(r))}},_f=Ef,Sf=("object"===typeof globalThis&&"crypto"in globalThis&&globalThis.crypto,e=>e instanceof Uint8Array),Af=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Tf=(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 Cf(e){if("string"===typeof e&&(e=function(e){if("string"!==typeof e)throw new Error("utf8ToBytes expected string, got ".concat(typeof e));return new Uint8Array((new TextEncoder).encode(e))}(e)),!Sf(e))throw new Error("expected Uint8Array, got ".concat(typeof e));return e}class kf{clone(){return this._cloneInto()}}function If(e){const t=t=>e().update(Cf(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class Rf extends kf{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Af(this.buffer)}update(e){_f.exists(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=Cf(e)).length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);if(s!==n)r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=Af(e);for(;n<=i-o;o+=n)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){_f.exists(this),_f.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let u=o;u<n;u++)t[u]=0;!function(e,t,r,n){if("function"===typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,l=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+l,a,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const s=Af(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}const Pf=(e,t,r)=>e&t^~e&r,Nf=(e,t,r)=>e&t^e&r^t&r,Df=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]),xf=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Lf=new Uint32Array(64);class Of extends Rf{constructor(){super(64,32,8,!1),this.A=0|xf[0],this.B=0|xf[1],this.C=0|xf[2],this.D=0|xf[3],this.E=0|xf[4],this.F=0|xf[5],this.G=0|xf[6],this.H=0|xf[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)Lf[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=Lf[u-15],t=Lf[u-2],r=Tf(e,7)^Tf(e,18)^e>>>3,n=Tf(t,17)^Tf(t,19)^t>>>10;Lf[u]=n+Lf[u-7]+r+Lf[u-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const e=l+(Tf(s,6)^Tf(s,11)^Tf(s,25))+Pf(s,a,c)+Df[u]+Lf[u]|0,t=(Tf(r,2)^Tf(r,13)^Tf(r,22))+Nf(r,n,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=n,n=r,r=e+t|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,o,s,a,c,l)}roundClean(){Lf.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class Bf extends Of{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}}If((()=>new Of)),If((()=>new Bf));function Mf(e){return Boolean(e)}function Uf(e){if("string"===typeof e){return ru(e.replace(/^0x/i,"").toLowerCase(),"base16")}return e}const Ff=e=>$l(e,"base16"),jf=e=>$l(e,"utf8"),zf=e=>ru(e,"utf8");const Vf=BigInt(1e6);var Kf;!function(e){e.BACKWARD="backward",e.FORWARD="forward"}(Kf||(Kf={}));class qf{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}))),r=function(e){switch(e){case Kf.BACKWARD:return xh.Direction.BACKWARD;case Kf.FORWARD:return xh.Direction.FORWARD;default:return xh.Direction.BACKWARD}}(e.pageDirection),n={pageSize:BigInt(e.pageSize),cursor:e.cursor,direction:r};let i,o;return e.startTime&&(i=BigInt(e.startTime.valueOf())*Vf),e.endTime&&(o=BigInt(e.endTime.valueOf())*Vf),new qf({requestId:rf(),query:{pubsubTopic:e.pubSubTopic,contentFilters:t,pagingInfo:n,startTime:i,endTime:o},response:void 0})}decode(e){const t=Mh.decode(e);return new qf(t)}encode(){return Mh.encode(this.proto)}}var Hf=Bh.HistoryError;const Gf=Yu("waku:store");class Wf extends Gd{constructor(e,t){super("/vac/waku/store/2.0.0-beta4",e.peerStore,e.getConnections.bind(e)),Xa(this,"libp2p",void 0),Xa(this,"options",void 0),this.libp2p=e,this.options=null!==t&&void 0!==t?t:{}}async queryOrderedCallback(e,t,r){let n=!1;for await(const i of this.queryGenerator(e,r)){if(n)break;let e=(await Promise.all(i)).filter(Mf);"undefined"!==typeof(null===r||void 0===r?void 0:r.pageDirection)&&(null===r||void 0===r?void 0:r.pageDirection)!==Kf.BACKWARD||(e=e.reverse()),await Promise.all(e.map((async e=>{e&&!n&&(n=Boolean(await t(e)))})))}}async queryCallbackOnPromise(e,t,r){let n=!1,i=[];for await(const o of this.queryGenerator(e,r)){const e=o.map((async e=>{n||(n=Boolean(await t(e)))}));i=i.concat(e)}await Promise.all(i)}async*queryGenerator(e,t){var r;const{pubSubTopic:n=Wd}=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:n,pageDirection:Kf.BACKWARD,pageSize:10},t,{contentTopics:a,startTime:i,endTime:o});Gf("Querying history with the following options",{...t,peerId:null===t||void 0===t||null===(r=t.peerId)||void 0===r?void 0:r.toString()});const l=await this.getPeer(null===t||void 0===t?void 0:t.peerId);for await(const u of async function*(e,t,r,n){if(t.contentTopics.toString()!==Array.from(r.keys()).toString())throw new Error("Internal error, the decoders should match the query's content topics");let i=n;for(;;){var o,s,a,c;t.cursor=i;const n=qf.createQuery(t);Gf("Querying store peer","for (".concat(t.pubSubTopic,")"),t.contentTopics);const l=await e(),u=await Bd([n.encode()],Ad,l,Pd,(async e=>await id(e))),h=new cd;u.forEach((e=>{h.append(e)}));const d=n.decode(h);if(!d.response){Gf("Stopping pagination due to store `response` field missing");break}const f=d.response;if(f.error&&f.error!==Hf.NONE)throw"History response contains an Error: "+f.error;if(!f.messages||!f.messages.length){Gf("Stopping pagination due to store `response.messages` field missing or empty");break}Gf("".concat(f.messages.length," messages retrieved from store")),yield f.messages.map((e=>{const n=e.contentTopic;if("undefined"!==typeof n){const i=r.get(n);if(i)return i.fromProtoObj(t.pubSubTopic,Yd(e))}return Promise.resolve(void 0)}));const p=null===(o=f.pagingInfo)||void 0===o?void 0:o.cursor;if("undefined"===typeof p){Gf("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=n.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 Qf extends Error{constructor(e){super(e),this.name="TimeoutError"}}class Yf extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const $f=e=>void 0===globalThis.DOMException?new Yf(e):new DOMException(e),Xf=e=>{const t=void 0===e.reason?$f("This operation was aborted."):e.reason;return t instanceof Error?t:$f(t)};const Jf=e=>{const t=e.on||e.addListener||e.addEventListener,r=e.off||e.removeListener||e.removeEventListener;if(!t||!r)throw new TypeError("Emitter is not compatible");return{addListener:t.bind(e),removeListener:r.bind(e)}};function Zf(e,t,r){let n;const i=new Promise(((i,o)=>{if(!((r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r}).count>=0)||r.count!==Number.POSITIVE_INFINITY&&!Number.isInteger(r.count))throw new TypeError("The `count` option should be at least 0 or more");const s=[t].flat(),a=[],{addListener:c,removeListener:l}=Jf(e),u=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];const s=r.multiArgs?t:t[0];r.filter&&!r.filter(s)||(a.push(s),r.count===a.length&&(n(),i(a)))},h=e=>{n(),o(e)};n=()=>{for(const e of s)l(e,u);for(const e of r.rejectionEvents)l(e,h)};for(const e of s)c(e,u);for(const e of r.rejectionEvents)c(e,h);r.resolveImmediately&&i(a)}));if(i.cancel=n,"number"===typeof r.timeout){const e=function(e,t,r,n){let i;const o=new Promise(((o,s)=>{if("number"!==typeof t||1!==Math.sign(t))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(t,"`"));if(t!==Number.POSITIVE_INFINITY){if((n={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...n}).signal){const{signal:e}=n;e.aborted&&s(Xf(e)),e.addEventListener("abort",(()=>{s(Xf(e))}))}i=n.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof r){try{o(r())}catch(a){s(a)}return}const n="string"===typeof r?r:"Promise timed out after ".concat(t," milliseconds"),i=r instanceof Error?r:new Qf(n);"function"===typeof e.cancel&&e.cancel(),s(i)}),t),(async()=>{try{o(await e)}catch(t){s(t)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()}else o(e)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(i,r.timeout);return e.cancel=n,e}return i}function ep(e,t,r){"function"===typeof r&&(r={filter:r});const n=Zf(e,t,r={...r,count:1,resolveImmediately:!1}),i=n.then((e=>e[0]));return i.cancel=n.cancel,i}const tp=Yu("waku:wait-for-remote-peer");async function rp(e,t,r){var n;if(t=null!==(n=t)&&void 0!==n?n:function(e){const t=[];e.relay&&t.push(ju.Relay);e.filter&&t.push(ju.Filter);e.store&&t.push(ju.Store);e.lightPush&&t.push(ju.LightPush);return t}(e),!e.isStarted())return Promise.reject("Waku node is not started");const i=[];if(t.includes(ju.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 ep(e.gossipSub,"gossipsub:heartbeat"),t=e.getMeshPeers()}(e.relay))}if(t.includes(ju.Store)){if(!e.store)throw new Error("Cannot wait for Store peer: protocol not mounted");i.push(np(e.store))}if(t.includes(ju.LightPush)){if(!e.lightPush)throw new Error("Cannot wait for LightPush peer: protocol not mounted");i.push(np(e.lightPush))}if(t.includes(ju.Filter)){if(!e.filter)throw new Error("Cannot wait for Filter peer: protocol not mounted");i.push(np(e.filter))}r?await async function(e,t,r){await Promise.race([e,ip(t,r)])}(Promise.all(i),r,"Timed out waiting for a remote peer."):await Promise.all(i)}async function np(e){const t=e.multicodec,r=await e.peers();r.length?tp("".concat(t," peer found: "),r[0].id.toString()):await new Promise((r=>{const n=i=>{i.detail.protocols.includes(t)&&(tp("Resolving for",t,i.detail.protocols),e.peerStore.removeEventListener("change:protocols",n),r())};e.peerStore.addEventListener("change:protocols",n)}))}const ip=(e,t)=>new Promise(((r,n)=>setTimeout((()=>n(t)),e)));function op(e){return null!=e[Symbol.asyncIterator]}const sp=e=>{const t=Ed.encodingLength(e),r=Hl(t);return Ed.encode(e,r),sp.bytes=t,r};function ap(e,t){var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:sp;function*o(e){const t=i(e.byteLength);t instanceof Uint8Array?yield t:yield*t,e instanceof Uint8Array?yield e:yield*e}return op(e)?async function*(){for await(const t of e)yield*o(t)}():function*(){for(const t of e)yield*o(t)}()}sp.bytes=0,ap.single=(e,t)=>{var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:sp;return new cd(i(e.byteLength),e)};const cp=8,lp=4194304;var up;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(up||(up={}));const hp=e=>{const t=Ed.decode(e);return hp.bytes=Ed.encodingLength(t),t};function dp(e,t){var r,n,i;const o=new cd;let s=up.LENGTH,a=-1;const c=null!==(r=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==r?r:hp,l=null!==(n=null===t||void 0===t?void 0:t.maxLengthLength)&&void 0!==n?n:cp,u=null!==(i=null===t||void 0===t?void 0:t.maxDataLength)&&void 0!==i?i:lp;function*h(){for(;o.byteLength>0;){if(s===up.LENGTH)try{if(a=c(o),a<0)throw Td(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw Td(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=up.DATA}catch(e){if(e instanceof RangeError){if(o.byteLength>l)throw Td(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw e}if(s===up.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=up.LENGTH}}}return op(e)?async function*(){for await(const t of e)o.append(t),yield*h();if(o.byteLength>0)throw Td(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 Td(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}hp.bytes=0,dp.fromReader=(e,t)=>{let r=1;return dp(async function*(){for(;;)try{const{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}(),{...null!==t&&void 0!==t?t:{},onLength:e=>{r=e}})};const fp=e=>Ed.decode(e);function pp(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=xd();e.sink(r).catch((e=>{r.end(e)})),e.sink=async e=>{for await(const t of e)r.push(t)};let n=e.source;null!=e.source[Symbol.iterator]?n=e.source[Symbol.iterator]():null!=e.source[Symbol.asyncIterator]&&(n=e.source[Symbol.asyncIterator]());const i=new cd,o={read:async e=>{if(null==e){const{done:e,value:t}=await n.next();return!0===e?new cd:t}for(;i.byteLength<e;){const{value:e,done:t}=await n.next();if(!0===t)throw Td(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF");i.append(e)}const t=i.sublist(0,e);return i.consume(e),t},readLP:async()=>{var e;let r=-1;const n=new cd,i=null!==(e=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==e?e:fp;for(;;){n.append(await o.read(1));try{r=i(n)}catch(s){if(s instanceof RangeError)continue;throw s}if(r>-1)break;if(null!=(null===t||void 0===t?void 0:t.maxLengthLength)&&n.byteLength>t.maxLengthLength)throw Td(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG")}if(null!=(null===t||void 0===t?void 0:t.maxDataLength)&&r>t.maxDataLength)throw Td(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");return await o.read(r)},readPB:async e=>{const t=await o.readLP();if(null==t)throw new Error("Value is null");const r=t instanceof Uint8Array?t:t.subarray();return e.decode(r)},write:e=>{e instanceof Uint8Array?r.push(e):r.push(e.subarray())},writeLP:e=>{o.write(ap.single(e,t))},writePB:(e,t)=>{o.writeLP(t.encode(e))},pb:e=>({read:async()=>await 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}function gp(){const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}function yp(){const e=gp();let t=!1;return{sink:async r=>{if(t)throw new Error("already piped");t=!0,e.resolve(r)},source:async function*(){const t=await e.promise;yield*t}()}}async function*mp(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=xd({objectMode:!0});Promise.resolve().then((async()=>{try{await Promise.all(t.map((async e=>{for await(const t of e)n.push(t)}))),n.end()}catch(e){n.end(e)}})),yield*n}fp.bytes=0;const vp=function(){let e;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(;r.length>0;)e=r.shift()(e);return e},bp=e=>null!=e&&("function"===typeof e[Symbol.asyncIterator]||"function"===typeof e[Symbol.iterator]||"function"===typeof e.next),wp=e=>null!=e&&"function"===typeof e.sink&&bp(e.source),Ep=e=>t=>{const r=e.sink(t);if(null!=r.then){const t=xd({objectMode:!0});r.then((()=>{t.end()}),(e=>{t.end(e)}));const n=async function*(){yield*e.source,t.end()};return mp(t,n())}return e.source};function _p(e){if(wp(e)){const t=e;e=()=>t.source}else if(bp(e)){const t=e;e=()=>t}for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const i=[e,...r];if(i.length>1&&wp(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++)wp(i[o])&&(i[o]=Ep(i[o]));return vp(...i)}const Sp=e=>{const t=Ed.encodingLength(e),r=function(e){var t;return null!=(null===globalThis||void 0===globalThis||null===(t=globalThis.Buffer)||void 0===t?void 0:t.allocUnsafe)?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}(t);return Ed.encode(e,r),Sp.bytes=t,r};function Ap(e){var t,r;const n=null!==(r=(e=null!==(t=e)&&void 0!==t?t:{}).lengthEncoder)&&void 0!==r?r:Sp;return async function*(e){for await(const t of e){const e=n(t.byteLength);e instanceof Uint8Array?yield e:yield*e,t instanceof Uint8Array?yield t:yield*t}}}Sp.bytes=0,Ap.single=(e,t)=>{var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:Sp;return new cd(i(e.byteLength),e)};const Tp=8,Cp=4194304;var kp;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(kp||(kp={}));const Ip=e=>{const t=Ed.decode(e);return Ip.bytes=Ed.encodingLength(t),t};function Rp(e){return async function*(t){var r,n,i;const o=new cd;let s=kp.LENGTH,a=-1;const c=null!==(r=null===e||void 0===e?void 0:e.lengthDecoder)&&void 0!==r?r:Ip,l=null!==(n=null===e||void 0===e?void 0:e.maxLengthLength)&&void 0!==n?n:Tp,u=null!==(i=null===e||void 0===e?void 0:e.maxDataLength)&&void 0!==i?i:Cp;for await(const d of t)for(o.append(d);o.byteLength>0;){if(s===kp.LENGTH)try{if(a=c(o),a<0)throw Td(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw Td(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");const t=c.bytes;o.consume(t),null!=(null===e||void 0===e?void 0:e.onLength)&&e.onLength(a),s=kp.DATA}catch(h){if(h instanceof RangeError){if(o.byteLength>l)throw Td(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw h}if(s===kp.DATA){if(o.byteLength<a)break;const t=o.sublist(0,a);o.consume(a),null!=(null===e||void 0===e?void 0:e.onData)&&e.onData(t),yield t,s=kp.LENGTH}}if(o.byteLength>0)throw Td(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}}var Pp,Np;Ip.bytes=0,Rp.fromReader=(e,t)=>{let r=1;const n=async function*(){for(;;)try{const{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}();return Rp({...null!==t&&void 0!==t?t:{},onLength:e=>{r=e}})(n)};const Dp=65535,xp=Dp-16,Lp=Boolean(null===(Pp=globalThis.process)||void 0===Pp||null===(Np=Pp.env)||void 0===Np?void 0:Np.DUMP_SESSION_KEYS);var Op=__webpack_require__(2497),Bp=__webpack_require__(2029),Mp=__webpack_require__(4888),Up=__webpack_require__(3642);const Fp={hashSHA256:e=>(0,Mp.vp)(e),getHKDF(e,t){const r=new Op.t(Mp.mE,t,e).expand(96);return[r.subarray(0,32),r.subarray(32,64),r.subarray(64,96)]},generateX25519KeyPair(){const e=Bp.Au();return{publicKey:e.publicKey,privateKey:e.secretKey}},generateX25519KeyPairFromSeed(e){const t=Bp._w(e);return{publicKey:t.publicKey,privateKey:t.secretKey}},generateX25519SharedKey:(e,t)=>Bp.gi(e,t),chaCha20Poly1305Encrypt:(e,t,r,n)=>new Up.OK(n).seal(t,e,r),chaCha20Poly1305Decrypt:(e,t,r,n,i)=>new Up.OK(n).open(t,e,r,i)},jp=e=>{const t=(r=2,globalThis.Buffer?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r));var r;return new DataView(t.buffer,t.byteOffset,t.byteLength).setUint16(0,e,!1),t};jp.bytes=2;const zp=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)};zp.bytes=2;class Vp extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected Peer"),this.code=Vp.code}static get code(){return"ERR_UNEXPECTED_PEER"}}class Kp extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto exchange"),this.code=Kp.code}static get code(){return"ERR_INVALID_CRYPTO_EXCHANGE"}}class qp extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Invalid crypto transmission"),this.code=qp.code}static get code(){return"ERR_INVALID_CRYPTO_TRANSMISSION"}}__webpack_require__(5049),__webpack_require__(9835);var Hp=__webpack_require__(392),Gp=__webpack_require__(7420),Wp=__webpack_require__.t(Gp,2);const Qp=BigInt(0),Yp=BigInt(1),$p=BigInt(2),Xp=BigInt(8),Jp=BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),Zp=Object.freeze({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l:Jp,n:Jp,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")}),eg=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),tg=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),rg=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),ng=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ig=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),og=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class sg{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof fg))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(fg.ZERO)?sg.ZERO:new sg(e.x,e.y,Yp,Tg(e.x*e.y))}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zp.P;const r=new Array(e.length),n=Cg(e.reduce(((e,n,i)=>n===Qp?e:(r[i]=e,Tg(e*n,t))),Yp),t);return e.reduceRight(((e,n,i)=>n===Qp?e:(r[i]=Tg(e*r[i],t),Tg(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){cg(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,a=Tg(t*s),c=Tg(i*n),l=Tg(r*s),u=Tg(o*n);return a===c&&l===u}negate(){return new sg(Tg(-this.x),this.y,this.z,Tg(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=Zp,i=Tg(e*e),o=Tg(t*t),s=Tg($p*Tg(r*r)),a=Tg(n*i),c=e+t,l=Tg(Tg(c*c)-i-o),u=a+o,h=u-s,d=a-o,f=Tg(l*h),p=Tg(u*d),g=Tg(l*d),y=Tg(h*u);return new sg(f,p,y,g)}add(e){cg(e);const{x:t,y:r,z:n,t:i}=this,{x:o,y:s,z:a,t:c}=e,l=Tg((r-t)*(s+o)),u=Tg((r+t)*(s-o)),h=Tg(u-l);if(h===Qp)return this.double();const d=Tg(n*$p*c),f=Tg(i*$p*a),p=f+d,g=u+l,y=f-d,m=Tg(p*h),v=Tg(g*y),b=Tg(p*y),w=Tg(h*g);return new sg(m,v,w,b)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(sg.BASE)&&(t=fg.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&dg.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=sg.normalizeZ(n),dg.set(t,n)));let i=sg.ZERO,o=sg.BASE;const s=1+256/r,a=2**(r-1),c=BigInt(2**r-1),l=2**r,u=BigInt(r);for(let h=0;h<s;h++){const t=h*a;let r=Number(e&c);e>>=u,r>a&&(r-=l,e+=Yp);const s=t,d=t+Math.abs(r)-1,f=h%2!==0,p=r<0;0===r?o=o.add(ag(f,n[s])):i=i.add(ag(p,n[d]))}return sg.normalizeZ([i,o])[0]}multiply(e,t){return this.wNAF(xg(e,Zp.l),t)}multiplyUnsafe(e){let t=xg(e,Zp.l,!1);const r=sg.BASE,n=sg.ZERO;if(t===Qp)return n;if(this.equals(n)||t===Yp)return this;if(this.equals(r))return this.wNAF(t);let i=n,o=this;for(;t>Qp;)t&Yp&&(i=i.add(o)),o=o.double(),t>>=Yp;return i}isSmallOrder(){return this.multiplyUnsafe(Zp.h).equals(sg.ZERO)}isTorsionFree(){let e=this.multiplyUnsafe(Zp.l/$p).double();return Zp.l%$p&&(e=e.add(this)),e.equals(sg.ZERO)}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(sg.ZERO);null==e&&(e=i?Xp:Cg(n));const o=Tg(t*e),s=Tg(r*e),a=Tg(n*e);if(i)return fg.ZERO;if(a!==Yp)throw new Error("invZ was invalid");return new fg(o,s)}fromRistrettoBytes(){ug()}toRistrettoBytes(){ug()}fromRistrettoHash(){ug()}}function ag(e,t){const r=t.negate();return e?r:t}function cg(e){if(!(e instanceof sg))throw new TypeError("ExtendedPoint expected")}function lg(e){if(!(e instanceof hg))throw new TypeError("RistrettoPoint expected")}function ug(){throw new Error("Legacy method: switch to RistrettoPoint")}sg.BASE=new sg(Zp.Gx,Zp.Gy,Yp,Tg(Zp.Gx*Zp.Gy)),sg.ZERO=new sg(Qp,Yp,Yp,Qp);class hg{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=Zp,r=Tg(tg*e*e),n=Tg((r+Yp)*ig);let i=BigInt(-1);const o=Tg((i-t*r)*Tg(r+t));let{isValid:s,value:a}=Rg(n,o),c=Tg(a*e);Eg(c)||(c=Tg(-c)),s||(a=c),s||(i=r);const l=Tg(i*(r-Yp)*og-o),u=a*a,h=Tg((a+a)*o),d=Tg(l*rg),f=Tg(Yp-u),p=Tg(Yp+u);return new sg(Tg(h*p),Tg(f*d),Tg(d*p),Tg(h*f))}static hashToCurve(e){const t=Ag((e=Dg(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=Ag(e.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new hg(r.add(i))}static fromHex(e){e=Dg(e,32);const{a:t,d:r}=Zp,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=Ag(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(wg(i),e)||Eg(i))throw new Error(n);const o=Tg(i*i),s=Tg(Yp+t*o),a=Tg(Yp-t*o),c=Tg(s*s),l=Tg(a*a),u=Tg(t*r*c-l),{isValid:h,value:d}=Pg(Tg(u*l)),f=Tg(d*a),p=Tg(d*f*u);let g=Tg((i+i)*f);Eg(g)&&(g=Tg(-g));const y=Tg(s*p),m=Tg(g*y);if(!h||Eg(m)||y===Qp)throw new Error(n);return new hg(new sg(g,y,Yp,m))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=Tg(Tg(r+t)*Tg(r-t)),o=Tg(e*t),s=Tg(o*o),{value:a}=Pg(Tg(i*s)),c=Tg(a*i),l=Tg(a*o),u=Tg(c*l*n);let h;if(Eg(n*u)){let r=Tg(t*tg),n=Tg(e*tg);e=r,t=n,h=Tg(c*ng)}else h=l;Eg(e*u)&&(t=Tg(-t));let d=Tg((r-t)*h);return Eg(d)&&(d=Tg(-d)),wg(d)}toHex(){return mg(this.toRawBytes())}toString(){return this.toHex()}equals(e){lg(e);const t=this.ep,r=e.ep,n=Tg(t.x*r.y)===Tg(t.y*r.x),i=Tg(t.y*r.y)===Tg(t.x*r.x);return n||i}add(e){return lg(e),new hg(this.ep.add(e.ep))}subtract(e){return lg(e),new hg(this.ep.subtract(e.ep))}multiply(e){return new hg(this.ep.multiply(e))}multiplyUnsafe(e){return new hg(this.ep.multiplyUnsafe(e))}}hg.BASE=new hg(sg.BASE),hg.ZERO=new hg(sg.ZERO);const dg=new WeakMap;class fg{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,dg.delete(this)}static fromHex(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{d:r,P:n}=Zp,i=(e=Dg(e,32)).slice();i[31]=-129&e[31];const o=_g(i);if(t&&o>=n)throw new Error("Expected 0 < hex < P");if(!t&&o>=eg)throw new Error("Expected 0 < hex < 2**256");const s=Tg(o*o),a=Tg(s-Yp),c=Tg(r*s+Yp);let{isValid:l,value:u}=Rg(a,c);if(!l)throw new Error("Point.fromHex: invalid y coordinate");const h=(u&Yp)===Yp;return 0!==(128&e[31])!==h&&(u=Tg(-u)),new fg(u,o)}static async fromPrivateKey(e){return(await Ug(e)).point}toRawBytes(){const e=wg(this.y);return e[31]|=this.x&Yp?128:0,e}toHex(){return mg(this.toRawBytes())}toX25519(){const{y:e}=this;return wg(Tg((Yp+e)*Cg(Yp-e)))}isTorsionFree(){return sg.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new fg(Tg(-this.x),this.y)}add(e){return sg.fromAffine(this).add(sg.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return sg.fromAffine(this).multiply(e,this).toAffine()}}fg.BASE=new fg(Zp.Gx,Zp.Gy),fg.ZERO=new fg(Qp,Yp);class pg{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=Dg(e,64),r=fg.fromHex(t.slice(0,32),!1),n=_g(t.slice(32,64));return new pg(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof fg))throw new Error("Expected Point instance");return xg(t,Zp.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(wg(this.s),32),e}toHex(){return mg(this.toRawBytes())}}function gg(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}const yg=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function mg(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=yg[e[r]];return t}function vg(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function bg(e){return vg(e.toString(16).padStart(64,"0"))}function wg(e){return bg(e).reverse()}function Eg(e){return(Tg(e)&Yp)===Yp}function _g(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+mg(Uint8Array.from(e).reverse()))}const Sg=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Ag(e){return Tg(_g(e)&Sg)}function Tg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zp.P;const r=e%t;return r>=Qp?r:t+r}function Cg(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zp.P;if(e===Qp||t<=Qp)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=Tg(e,t),n=t,i=Qp,o=Yp,s=Yp,a=Qp;for(;r!==Qp;){const e=n/r,t=n%r,c=i-s*e,l=o-a*e;n=r,r=t,i=s,o=a,s=c,a=l}if(n!==Yp)throw new Error("invert: does not exist");return Tg(i,t)}function kg(e,t){const{P:r}=Zp;let n=e;for(;t-- >Qp;)n*=n,n%=r;return n}function Ig(e){const{P:t}=Zp,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),s=BigInt(80),a=e*e%t*e%t,c=kg(a,$p)*a%t,l=kg(c,Yp)*e%t,u=kg(l,r)*l%t,h=kg(u,n)*u%t,d=kg(h,i)*h%t,f=kg(d,o)*d%t,p=kg(f,s)*f%t,g=kg(p,s)*f%t,y=kg(g,n)*u%t;return{pow_p_5_8:kg(y,$p)*e%t,b2:a}}function Rg(e,t){const r=Tg(t*t*t),n=Tg(r*r*t);let i=Tg(e*r*Ig(e*n).pow_p_5_8);const o=Tg(t*i*i),s=i,a=Tg(i*tg),c=o===e,l=o===Tg(-e),u=o===Tg(-e*tg);return c&&(i=s),(l||u)&&(i=a),Eg(i)&&(i=Tg(-i)),{isValid:c||l,value:i}}function Pg(e){return Rg(Yp,e)}function Ng(e){return Tg(_g(e),Zp.l)}function Dg(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):vg(e);if("number"===typeof t&&r.length!==t)throw new Error("Expected ".concat(t," bytes"));return r}function xg(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)throw new TypeError("Specify max value");if("number"===typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"===typeof e&&e<t)if(r){if(Qp<e)return e}else if(Qp<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function Lg(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function Og(e){if(32!==(e="bigint"===typeof e||"number"===typeof e?bg(xg(e,eg)):Dg(e)).length)throw new Error("Expected 32 bytes");return e}function Bg(e){const t=Lg(e.slice(0,32)),r=e.slice(32,64),n=Ng(t),i=fg.BASE.multiply(n),o=i.toRawBytes();return{head:t,prefix:r,scalar:n,point:i,pointBytes:o}}let Mg;async function Ug(e){return Bg(await Kg.sha512(Og(e)))}async function Fg(e){return(await Ug(e)).pointBytes}function jg(e,t,r){t=Dg(t),r instanceof fg||(r=fg.fromHex(r,!1));const{r:n,s:i}=e instanceof pg?e.assertValidity():pg.fromHex(e);return{r:n,s:i,SB:sg.BASE.multiplyUnsafe(i),pub:r,msg:t}}function zg(e,t,r,n){const i=Ng(n),o=sg.fromAffine(e).multiplyUnsafe(i);return sg.fromAffine(t).add(o).subtract(r).multiplyUnsafe(Zp.h).equals(sg.ZERO)}fg.BASE._setWindowSize(8);const Vg={node:Wp,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},Kg={bytesToHex:mg,hexToBytes:vg,concatBytes:gg,getExtendedPublicKey:Ug,mod:Tg,invert:Cg,TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],hashToPrivateScalar:e=>{if((e=Dg(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return Tg(_g(e),Zp.l-Yp)+Yp},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Vg.web)return Vg.web.getRandomValues(new Uint8Array(e));if(Vg.node){const{randomBytes:t}=Vg.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Kg.randomBytes(32),sha512:async function(){const e=gg(...arguments);if(Vg.web){const t=await Vg.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(Vg.node)return Uint8Array.from(Vg.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]:fg.BASE;const r=t.equals(fg.BASE)?t:new fg(t.x,t.y);return r._setWindowSize(e),r.multiply($p),r},sha512Sync:void 0};Object.defineProperties(Kg,{sha512Sync:{configurable:!1,get:()=>Mg,set(e){Mg||(Mg=e)}}});const qg=32,Hg=64,Gg=32;async function Wg(e,t){return async function(e,t){e=Dg(e);const{prefix:r,scalar:n,pointBytes:i}=await Ug(t),o=Ng(await Kg.sha512(r,e)),s=fg.BASE.multiply(o),a=Tg(o+Ng(await Kg.sha512(s.toRawBytes(),i,e))*n,Zp.l);return new pg(s,a).toRawBytes()}(t,e.subarray(0,Gg))}async function Qg(e,t,r){return async function(e,t,r){const{r:n,SB:i,msg:o,pub:s}=jg(e,t,r),a=await Kg.sha512(n.toRawBytes(),s.toRawBytes(),o);return zg(s,n,i,a)}(t,r,e)}function Yg(e,t){const r=new Uint8Array(Hg);for(let n=0;n<Gg;n++)r[n]=e[n],r[Gg+n]=t[n];return r}const $g={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}},Xg={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Jg(e){var t,r,n,i,o,s;const a=null!==(t=null===e||void 0===e?void 0:e.algorithm)&&void 0!==t?t:"AES-GCM";let c=null!==(r=null===e||void 0===e?void 0:e.keyLength)&&void 0!==r?r:16;const l=null!==(n=null===e||void 0===e?void 0:e.nonceLength)&&void 0!==n?n:12,u=null!==(i=null===e||void 0===e?void 0:e.digest)&&void 0!==i?i:"SHA-256",h=null!==(o=null===e||void 0===e?void 0:e.saltLength)&&void 0!==o?o:16,d=null!==(s=null===e||void 0===e?void 0:e.iterations)&&void 0!==s?s:32767,f=$g.get();c*=8;return{encrypt:async function(e,t){const r=f.getRandomValues(new Uint8Array(h)),n=f.getRandomValues(new Uint8Array(l)),i={name:a,iv:n};let o;if("string"===typeof t&&(t=ru(t)),0===t.length){o=await f.subtle.importKey("jwk",Xg,{name:"AES-GCM"},!0,["encrypt"]);try{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);o=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["encrypt"])}catch{o=await f.subtle.importKey("jwk",Xg,{name:"AES-GCM"},!0,["encrypt"])}}else{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);o=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["encrypt"])}const s=await f.subtle.encrypt(i,o,e);return Jl([r,i.iv,new Uint8Array(s)])},decrypt:async function(e,t){const r=e.subarray(0,h),n=e.subarray(h,h+l),i=e.subarray(h+l),o={name:a,iv:n};let s;if("string"===typeof t&&(t=ru(t)),0===t.length)try{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);s=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["decrypt"])}catch{s=await f.subtle.importKey("jwk",Xg,{name:"AES-GCM"},!0,["decrypt"])}else{const e={name:"PBKDF2",salt:r,iterations:d,hash:{name:u}},n=await f.subtle.importKey("raw",t,{name:"PBKDF2"},!1,["deriveKey"]);s=await f.subtle.deriveKey(e,n,{name:a,length:c},!0,["decrypt"])}const p=await f.subtle.decrypt(o,s,i);return new Uint8Array(p)}}}async function Zg(e,t){const r=Jg(),n=await r.encrypt(e,t);return ml.encode(n)}var ey=__webpack_require__(3415),ty=__webpack_require__(3419),ry=__webpack_require__(6405),ny=__webpack_require__(2634),iy=__webpack_require__(7517);ry._configure(),ey._configure(ty),ny._configure(iy);const oy=["uint64","int64","sint64","fixed64","sfixed64"];function sy(e){return function(e){for(const t of oy){if(null==e[t])continue;const r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new ey(e))}function ay(){return function(e){for(const t of oy){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(ny.create())}function cy(e,t){const r=sy(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function ly(e,t){const r=ay();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var uy,hy,dy,fy,py;function gy(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function yy(e,t){return gy("message",uy.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"}(uy||(uy={})),function(e){e.RSA="RSA",e.Ed25519="Ed25519",e.Secp256k1="Secp256k1"}(hy||(hy={})),function(e){e[e.RSA=0]="RSA",e[e.Ed25519=1]="Ed25519",e[e.Secp256k1=2]="Secp256k1"}(dy||(dy={})),function(e){e.codec=()=>function(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return gy("enum",uy.VARINT,(function(e,r){const n=t(e);r.int32(n)}),(function(e){return t(e.int32())}))}(dy)}(hy||(hy={})),function(e){let t;e.codec=()=>(null==t&&(t=yy((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),hy.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.Type=hy.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>ly(t,e.codec()),e.decode=t=>cy(t,e.codec())}(fy||(fy={})),function(e){let t;e.codec=()=>(null==t&&(t=yy((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.Type&&(t.uint32(8),hy.codec().encode(e.Type,t)),null!=e.Data&&(t.uint32(18),t.bytes(e.Data)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.Type=hy.codec().decode(e);break;case 2:r.Data=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>ly(t,e.codec()),e.decode=t=>cy(t,e.codec())}(py||(py={}));class my{constructor(e){Xa(this,"_key",void 0),this._key=Sy(e,qg)}async verify(e,t){return Qg(this._key,t,e)}marshal(){return this._key}get bytes(){return fy.encode({Type:hy.Ed25519,Data:this.marshal()}).subarray()}equals(e){return cl(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Il.digest(this.bytes);return e}}class vy{constructor(e,t){Xa(this,"_key",void 0),Xa(this,"_publicKey",void 0),this._key=Sy(e,Hg),this._publicKey=Sy(t,qg)}async sign(e){return Wg(this._key,e)}get public(){return new my(this._publicKey)}marshal(){return this._key}get bytes(){return py.encode({Type:hy.Ed25519,Data:this.marshal()}).subarray()}equals(e){return cl(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Il.digest(this.bytes);return e}async id(){const e=Nl.digest(this.public.bytes);return mc.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 Zg(this.bytes,e);throw new oc("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}function by(e){if(e.length>Hg){const t=(e=Sy(e,Hg+qg)).subarray(0,Hg),r=e.subarray(Hg,e.length);return new vy(t,r)}const t=(e=Sy(e,Hg)).subarray(0,Hg),r=e.subarray(qg);return new vy(t,r)}function wy(e){return e=Sy(e,qg),new my(e)}async function Ey(){const{privateKey:e,publicKey:t}=await async function(){const e=Kg.randomPrivateKey(),t=await Fg(e);return{privateKey:Yg(e,t),publicKey:t}}();return new vy(e,t)}async function _y(e){const{privateKey:t,publicKey:r}=await async function(e){if(e.length!==Gg)throw new TypeError('"seed" must be 32 bytes in length.');if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');const t=e,r=await Fg(t);return{privateKey:Yg(t,r),publicKey:r}}(e);return new vy(t,r)}function Sy(e,t){var r;if((e=Uint8Array.from(null!==(r=e)&&void 0!==r?r:[])).length!==t)throw new oc("Key must be a Uint8Array of length ".concat(t,", got ").concat(e.length),"ERR_INVALID_KEY_TYPE");return e}var Ay=__webpack_require__(3877);__webpack_require__(3055);function Ty(e,t){let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.subarray(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=Jl([new Uint8Array(t-r.length),r])}return $l(r,"base64url")}function Cy(e){const t=function(e,t){let r=ru(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=Jl([new Uint8Array(t-r.length),r])}return r}(e);return new Hp.jsbn.BigInteger($l(t,"base16"),16)}const ky={"P-256":256,"P-384":384,"P-521":521};Object.keys(ky).join(" / ");__webpack_require__(4770);var Iy=__webpack_require__(5856),Ry=__webpack_require__.t(Iy,2);const Py=BigInt(0),Ny=BigInt(1),Dy=BigInt(2),xy=BigInt(3),Ly=BigInt(8),Oy=Object.freeze({a:Py,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:Ny,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),By=(e,t)=>(e+t/Dy)/t,My={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(e){const{n:t}=Oy,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Ny*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=By(o*e,t),c=By(-n*e,t);let l=dm(e-a*r-c*i,t),u=dm(-a*n-c*o,t);const h=l>s,d=u>s;if(h&&(l=t-l),d&&(u=t-u),l>s||u>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:h,k1:l,k2neg:d,k2:u}}},Uy=32,Fy=32,jy=32,zy=Uy+1,Vy=2*Uy+1;function Ky(e){const{a:t,b:r}=Oy,n=dm(e*e),i=dm(n*e);return dm(i+t*e+r)}const qy=Oy.a===Py;class Hy extends Error{constructor(e){super(e)}}function Gy(e){if(!(e instanceof Wy))throw new TypeError("JacobianPoint expected")}class Wy{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof $y))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals($y.ZERO)?Wy.ZERO:new Wy(e.x,e.y,Ny)}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oy.P;const r=new Array(e.length),n=pm(e.reduce(((e,n,i)=>n===Py?e:(r[i]=e,dm(e*n,t))),Ny),t);return e.reduceRight(((e,n,i)=>n===Py?e:(r[i]=dm(e*r[i],t),dm(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return Wy.toAffineBatch(e).map(Wy.fromAffine)}equals(e){Gy(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,a=dm(n*n),c=dm(s*s),l=dm(t*c),u=dm(i*a),h=dm(dm(r*s)*c),d=dm(dm(o*n)*a);return l===u&&h===d}negate(){return new Wy(this.x,dm(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=dm(e*e),i=dm(t*t),o=dm(i*i),s=e+i,a=dm(Dy*(dm(s*s)-n-o)),c=dm(xy*n),l=dm(c*c),u=dm(l-Dy*a),h=dm(c*(a-u)-Ly*o),d=dm(Dy*t*r);return new Wy(u,h,d)}add(e){Gy(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e;if(i===Py||o===Py)return this;if(t===Py||r===Py)return e;const a=dm(n*n),c=dm(s*s),l=dm(t*c),u=dm(i*a),h=dm(dm(r*s)*c),d=dm(dm(o*n)*a),f=dm(u-l),p=dm(d-h);if(f===Py)return p===Py?this.double():Wy.ZERO;const g=dm(f*f),y=dm(f*g),m=dm(l*g),v=dm(p*p-y-Dy*m),b=dm(p*(m-v)-h*y),w=dm(n*s*f);return new Wy(v,b,w)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=Wy.ZERO;if("bigint"===typeof e&&e===Py)return t;let r=hm(e);if(r===Ny)return this;if(!qy){let e=t,n=this;for(;r>Py;)r&Ny&&(e=e.add(n)),n=n.double(),r>>=Ny;return e}let{k1neg:n,k1:i,k2neg:o,k2:s}=My.splitScalar(r),a=t,c=t,l=this;for(;i>Py||s>Py;)i&Ny&&(a=a.add(l)),s&Ny&&(c=c.add(l)),l=l.double(),i>>=Ny,s>>=Ny;return n&&(a=a.negate()),o&&(c=c.negate()),c=new Wy(dm(c.x*My.beta),c.y,c.z),a.add(c)}precomputeWindow(e){const t=qy?128/e+1:256/e+1,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(Wy.BASE)&&(t=$y.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&Yy.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=Wy.normalizeZ(n),Yy.set(t,n)));let i=Wy.ZERO,o=Wy.BASE;const s=1+(qy?128/r:256/r),a=2**(r-1),c=BigInt(2**r-1),l=2**r,u=BigInt(r);for(let h=0;h<s;h++){const t=h*a;let r=Number(e&c);e>>=u,r>a&&(r-=l,e+=Ny);const s=t,d=t+Math.abs(r)-1,f=h%2!==0,p=r<0;0===r?o=o.add(Qy(f,n[s])):i=i.add(Qy(p,n[d]))}return{p:i,f:o}}multiply(e,t){let r,n,i=hm(e);if(qy){const{k1neg:e,k1:o,k2neg:s,k2:a}=My.splitScalar(i);let{p:c,f:l}=this.wNAF(o,t),{p:u,f:h}=this.wNAF(a,t);c=Qy(e,c),u=Qy(s,u),u=new Wy(dm(u.x*My.beta),u.y,u.z),r=c.add(u),n=l.add(h)}else{const{p:e,f:o}=this.wNAF(i,t);r=e,n=o}return Wy.normalizeZ([r,n])[0]}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(Wy.ZERO);null==e&&(e=i?Ly:pm(n));const o=e,s=dm(o*o),a=dm(s*o),c=dm(t*s),l=dm(r*a),u=dm(n*o);if(i)return $y.ZERO;if(u!==Ny)throw new Error("invZ was invalid");return new $y(c,l)}}function Qy(e,t){const r=t.negate();return e?r:t}Wy.BASE=new Wy(Oy.Gx,Oy.Gy,Ny),Wy.ZERO=new Wy(Py,Ny,Py);const Yy=new WeakMap;class $y{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,Yy.delete(this)}hasEvenY(){return this.y%Dy===Py}static fromCompressedHex(e){const t=32===e.length,r=lm(t?e:e.subarray(1));if(!wm(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=Oy,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),a=BigInt(88),c=e*e*e%t,l=c*c*e%t,u=fm(l,xy)*l%t,h=fm(u,xy)*l%t,d=fm(h,Dy)*c%t,f=fm(d,n)*d%t,p=fm(f,i)*f%t,g=fm(p,s)*p%t,y=fm(g,a)*g%t,m=fm(y,s)*p%t,v=fm(m,xy)*l%t,b=fm(v,o)*f%t,w=fm(b,r)*c%t,E=fm(w,Dy);if(E*E%t!==e)throw new Error("Cannot find square root");return E}(Ky(r));const i=(n&Ny)===Ny;if(t)i&&(n=dm(-n));else{1===(1&e[0])!==i&&(n=dm(-n))}const o=new $y(r,n);return o.assertValidity(),o}static fromUncompressedHex(e){const t=lm(e.subarray(1,Uy+1)),r=lm(e.subarray(Uy+1,2*Uy+1)),n=new $y(t,r);return n.assertValidity(),n}static fromHex(e){const t=um(e),r=t.length,n=t[0];if(r===Uy)return this.fromCompressedHex(t);if(r===zy&&(2===n||3===n))return this.fromCompressedHex(t);if(r===Vy&&4===n)return this.fromUncompressedHex(t);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(zy," compressed bytes or ").concat(Vy," uncompressed bytes, not ").concat(r))}static fromPrivateKey(e){return $y.BASE.multiply(_m(e))}static fromSignature(e,t,r){const{r:n,s:i}=Am(t);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const o=gm(um(e)),{n:s}=Oy,a=2===r||3===r?n+s:n,c=pm(a,s),l=dm(-o*c,s),u=dm(i*c,s),h=1&r?"03":"02",d=$y.fromHex(h+im(a)),f=$y.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 cm(this.toHex(e))}toHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=im(this.x);if(e){const e=this.hasEvenY()?"02":"03";return"".concat(e).concat(t)}return"04".concat(t).concat(im(this.y))}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!wm(t)||!wm(r))throw new Error(e);const n=dm(r*r);if(dm(n-Ky(t))!==Py)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new $y(this.x,dm(-this.y))}double(){return Wy.fromAffine(this).double().toAffine()}add(e){return Wy.fromAffine(this).add(Wy.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return Wy.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const n=Wy.fromAffine(this),i=t===Py||t===Ny||this!==$y.BASE?n.multiplyUnsafe(t):n.multiply(t),o=Wy.fromAffine(e).multiplyUnsafe(r),s=i.add(o);return s.equals(Wy.ZERO)?void 0:s.toAffine()}}function Xy(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function Jy(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(rm(e)));const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:lm(r),left:e.subarray(t+2)}}$y.BASE=new $y(Oy.Gx,Oy.Gy),$y.ZERO=new $y(Py,Py);class Zy{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!==typeof e&&!t)throw new TypeError("".concat(r,": Expected string or Uint8Array"));const n=t?rm(e):e;if(128!==n.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new Zy(am(n.slice(0,64)),am(n.slice(64,128)))}static fromDER(e){const t=e instanceof Uint8Array;if("string"!==typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error("Invalid signature tag: ".concat(rm(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=Jy(e.subarray(2)),{data:n,left:i}=Jy(r);if(i.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(rm(i)));return{r:t,s:n}}(t?e:cm(e));return new Zy(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!bm(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!bm(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=Oy.n>>Ny;return this.s>e}normalizeS(){return this.hasHighS()?new Zy(this.r,dm(-this.s,Oy.n)):this}toDERRawBytes(){return cm(this.toDERHex())}toDERHex(){const e=Xy(sm(this.s)),t=Xy(sm(this.r)),r=e.length/2,n=t.length/2,i=sm(r),o=sm(n),s=sm(n+r+4);return"30".concat(s,"02").concat(o).concat(t,"02").concat(i).concat(e)}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return cm(this.toCompactHex())}toCompactHex(){return im(this.r)+im(this.s)}}function em(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}const tm=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function rm(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r<e.length;r++)t+=tm[e[r]];return t}const nm=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function im(e){if("bigint"!==typeof e)throw new Error("Expected bigint");if(!(Py<=e&&e<nm))throw new Error("Expected number 0 <= n < 2^256");return e.toString(16).padStart(64,"0")}function om(e){const t=cm(im(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function sm(e){const t=e.toString(16);return 1&t.length?"0".concat(t):t}function am(e){if("string"!==typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt("0x".concat(e))}function cm(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function lm(e){return am(rm(e))}function um(e){return e instanceof Uint8Array?Uint8Array.from(e):cm(e)}function hm(e){if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"===typeof e&&bm(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function dm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oy.P;const r=e%t;return r>=Py?r:t+r}function fm(e,t){const{P:r}=Oy;let n=e;for(;t-- >Py;)n*=n,n%=r;return n}function pm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oy.P;if(e===Py||t<=Py)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=dm(e,t),n=t,i=Py,o=Ny,s=Ny,a=Py;for(;r!==Py;){const e=n/r,t=n%r,c=i-s*e,l=o-a*e;n=r,r=t,i=s,o=a,s=c,a=l}if(n!==Ny)throw new Error("invert: does not exist");return dm(i,t)}function gm(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=function(e){const t=8*e.length-8*Fy,r=lm(e);return t>0?r>>BigInt(t):r}(e);if(t)return r;const{n:n}=Oy;return r>=n?r-n:r}let ym,mm;class vm{constructor(e,t){if(this.hashLen=e,this.qByteLen=t,"number"!==typeof e||e<2)throw new Error("hashLen must be a number");if("number"!==typeof t||t<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}hmac(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Bm.hmacSha256(this.k,...t)}hmacSync(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return mm(this.k,...t)}checkSync(){if("function"!==typeof mm)throw new Hy("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=await this.hmac(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return em(...t)}generateSync(){this.checkSync(),this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=this.hmacSync(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return em(...t)}}function bm(e){return Py<e&&e<Oy.n}function wm(e){return Py<e&&e<Oy.P}function Em(e,t,r){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const{n:i}=Oy,o=gm(e,!0);if(!bm(o))return;const s=pm(o,i),a=$y.BASE.multiply(o),c=dm(a.x,i);if(c===Py)return;const l=dm(s*dm(t+r*c,i),i);if(l===Py)return;let u=new Zy(c,l),h=(a.x===u.r?0:2)|Number(a.y&Ny);return n&&u.hasHighS()&&(u=u.normalizeS(),h^=1),{sig:u,recovery:h}}function _m(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*Fy)throw new Error("Expected 32 bytes of private key");t=am(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(e.length!==Fy)throw new Error("Expected 32 bytes of private key");t=lm(e)}if(!bm(t))throw new Error("Expected private key: 0 < key < n");return t}function Sm(e){return e instanceof $y?(e.assertValidity(),e):$y.fromHex(e)}function Am(e){if(e instanceof Zy)return e.assertValidity(),e;try{return Zy.fromDER(e)}catch(t){return Zy.fromCompact(e)}}function Tm(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return $y.fromPrivateKey(e).toRawBytes(t)}function Cm(e){return lm(e.length>Uy?e.slice(0,Uy):e)}function km(e){const t=Cm(e),r=dm(t,Oy.n);return Im(r<Py?t:r)}function Im(e){return om(e)}function Rm(e,t,r){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));const n=um(e),i=_m(t),o=[Im(i),km(n)];if(null!=r){!0===r&&(r=Bm.randomBytes(Uy));const e=um(r);if(e.length!==Uy)throw new Error("sign: Expected ".concat(Uy," bytes of extra data"));o.push(e)}return{seed:em(...o),m:Cm(n),d:i}}function Pm(e,t){const{sig:r,recovery:n}=e,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},t),s=i?r.toDERRawBytes():r.toCompactRawBytes();return o?[s,n]:s}async function Nm(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:o}=Rm(e,t,r.extraEntropy),s=new vm(jy,Fy);let a;for(await s.reseed(n);!(a=Em(await s.generate(),i,o,r.canonical));)await s.reseed();return Pm(a,r)}const Dm={strict:!0};function xm(e,t,r){let n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Dm;try{n=Am(e),t=um(t)}catch(p){return!1}const{r:o,s:s}=n;if(i.strict&&n.hasHighS())return!1;const a=gm(t);let c;try{c=Sm(r)}catch(p){return!1}const{n:l}=Oy,u=pm(s,l),h=dm(a*u,l),d=dm(o*u,l),f=$y.BASE.multiplyAndAddUnsafe(c,h,d);if(!f)return!1;return dm(f.x,l)===o}$y.BASE._setWindowSize(8);const Lm={node:Ry,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0},Om={},Bm={bytesToHex:rm,hexToBytes:cm,concatBytes:em,mod:dm,invert:pm,isValidPrivateKey(e){try{return _m(e),!0}catch(t){return!1}},_bigintTo32Bytes:om,_normalizePrivateKey:_m,hashToPrivateKey:e=>{e=um(e);const t=Fy+8;if(e.length<t||e.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return om(dm(lm(e),Oy.n-Ny)+Ny)},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Lm.web)return Lm.web.getRandomValues(new Uint8Array(e));if(Lm.node){const{randomBytes:t}=Lm.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>Bm.hashToPrivateKey(Bm.randomBytes(Fy+8)),precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$y.BASE;const r=t===$y.BASE?t:new $y(t.x,t.y);return r._setWindowSize(e),r.multiply(xy),r},sha256:async function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Lm.web){const e=await Lm.web.subtle.digest("SHA-256",em(...t));return new Uint8Array(e)}if(Lm.node){const{createHash:e}=Lm.node,r=e("sha256");return t.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(Lm.web){const t=await Lm.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=em(...r),i=await Lm.web.subtle.sign("HMAC",t,n);return new Uint8Array(i)}if(Lm.node){const{createHmac:t}=Lm.node,n=t("sha256",e);return r.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async function(e){let t=Om[e];if(void 0===t){const r=await Bm.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=em(r,r),Om[e]=t}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return Bm.sha256(t,...n)},taggedHashSync:function(e){if("function"!==typeof ym)throw new Hy("sha256Sync is undefined, you need to set it");let t=Om[e];if(void 0===t){const r=ym(Uint8Array.from(e,(e=>e.charCodeAt(0))));t=em(r,r),Om[e]=t}for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return ym(t,...n)},_JacobianPoint:Wy};function Mm(e){if(isNaN(e)||e<=0)throw new oc("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Bm.randomBytes(e)}Object.defineProperties(Bm,{sha256Sync:{configurable:!1,get:()=>ym,set(e){ym||(ym=e)}},hmacSha256Sync:{configurable:!1,get:()=>mm,set(e){mm||(mm=e)}}});__webpack_require__(5493);function Um(e,t){return t.map((t=>Cy(e[t])))}async function Fm(e){const t=[await $g.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await zm(e)],r=await jm({privateKey:t[0],publicKey:t[1]});return{privateKey:r[0],publicKey:r[1]}}async function jm(e){if(null==e.privateKey||null==e.publicKey)throw new oc("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([$g.get().subtle.exportKey("jwk",e.privateKey),$g.get().subtle.exportKey("jwk",e.publicKey)])}async function zm(e){return $g.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 Vm(e,t,r,n){const i=t?function(e){return Hp.pki.setRsaPublicKey(...Um(e,["n","e"]))}(e):function(e){return Hp.pki.setRsaPrivateKey(...Um(e,["n","e","d","p","q","dp","dq","qi"]))}(e);return ru(n($l(Uint8Array.from(r),"ascii"),i),"ascii")}class Km{constructor(e){Xa(this,"_key",void 0),this._key=e}async verify(e,t){return async function(e,t,r){const n=await $g.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return $g.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,t,r)}(this._key,t,e)}marshal(){return function(e){if(null==e.n||null==e.e)throw new oc("JWK was missing components","ERR_INVALID_PARAMETERS");const t=Hp.pki.publicKeyToAsn1({n:Cy(e.n),e:Cy(e.e)});return ru(Hp.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return fy.encode({Type:hy.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Vm(this._key,!0,e,((e,t)=>t.encrypt(e)))}equals(e){return cl(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Il.digest(this.bytes);return e}}class qm{constructor(e,t){Xa(this,"_key",void 0),Xa(this,"_publicKey",void 0),this._key=e,this._publicKey=t}genSecret(){return Mm(16)}async sign(e){return async function(e,t){const r=await $g.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await $g.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(n,0,n.byteLength)}(this._key,e)}get public(){if(null==this._publicKey)throw new oc("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new Km(this._publicKey)}decrypt(e){return Vm(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 oc("JWK was missing components","ERR_INVALID_PARAMETERS");const t=Hp.pki.privateKeyToAsn1({n:Cy(e.n),e:Cy(e.e),d:Cy(e.d),p:Cy(e.p),q:Cy(e.q),dP:Cy(e.dp),dQ:Cy(e.dq),qInv:Cy(e.qi)});return ru(Hp.asn1.toDer(t).getBytes(),"ascii")}(this._key)}get bytes(){return py.encode({Type:hy.RSA,Data:this.marshal()}).subarray()}equals(e){return cl(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Il.digest(this.bytes);return e}async id(){return $l(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 Hp.util.ByteBuffer(this.marshal()),r=Hp.asn1.fromDer(t),n=Hp.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return Hp.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return Zg(this.bytes,e);throw new oc("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}async function Hm(e){const t=function(e){const t=Hp.asn1.fromDer($l(e,"ascii")),r=Hp.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:Ty(r.n),e:Ty(r.e),d:Ty(r.d),p:Ty(r.p),q:Ty(r.q),dp:Ty(r.dP),dq:Ty(r.dQ),qi:Ty(r.qInv),alg:"RS256"}}(e),r=await Fm(t);return new qm(r.privateKey,r.publicKey)}function Gm(e){const t=function(e){const t=Hp.asn1.fromDer($l(e,"ascii")),r=Hp.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:Ty(r.n),e:Ty(r.e)}}(e);return new Km(t)}async function Wm(e){const t=await Fm(e);return new qm(t.privateKey,t.publicKey)}async function Qm(e){const t=await async function(e){const t=await $g.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await jm(t);return{privateKey:r[0],publicKey:r[1]}}(e);return new qm(t.privateKey,t.publicKey)}function Ym(e){try{$y.fromHex(e)}catch(t){throw new oc(String(t),"ERR_INVALID_PUBLIC_KEY")}}class $m{constructor(e){Xa(this,"_key",void 0),Ym(e),this._key=e}async verify(e,t){return async function(e,t,r){try{const{digest:n}=await Il.digest(r);return xm(t,n,e)}catch(n){throw new oc(String(n),"ERR_INVALID_INPUT")}}(this._key,t,e)}marshal(){return e=this._key,$y.fromHex(e).toRawBytes(!0);var e}get bytes(){return fy.encode({Type:hy.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return cl(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Il.digest(this.bytes);return e}}class Xm{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 Tm(e,!0)}catch(t){throw new oc(String(t),"ERR_INVALID_PRIVATE_KEY")}}(e),function(e){try{Tm(e,!0)}catch(t){throw new oc(String(t),"ERR_INVALID_PRIVATE_KEY")}}(this._key),Ym(this._publicKey)}async sign(e){return async function(e,t){const{digest:r}=await Il.digest(t);try{return await Nm(r,e)}catch(n){throw new oc(String(n),"ERR_INVALID_INPUT")}}(this._key,e)}get public(){return new $m(this._publicKey)}marshal(){return this._key}get bytes(){return py.encode({Type:hy.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return cl(this.bytes,e.bytes)}async hash(){const{bytes:e}=await Il.digest(this.bytes);return e}async id(){return $l(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 Zg(this.bytes,e);throw new oc("export format '".concat(t,"' is not supported"),"ERR_INVALID_EXPORT_FORMAT")}}function Jm(e){return new Xm(e)}function Zm(e){return new $m(e)}async function ev(){const e=Bm.randomPrivateKey();return new Xm(e)}const tv={rsa:g,ed25519:p,secp256k1:y};function rv(e){const t=Object.keys(tv).join(" / ");return new oc("invalid or unsupported key type ".concat(e,". Must be ").concat(t),"ERR_UNSUPPORTED_KEY_TYPE")}function nv(e){if("rsa"===(e=e.toLowerCase())||"ed25519"===e||"secp256k1"===e)return tv[e];throw rv(e)}async function iv(e,t){return nv(e).generateKeyPair(null!==t&&void 0!==t?t:2048)}function ov(e){var t,r;const n=fy.decode(e),i=null!==(t=n.Data)&&void 0!==t?t:new Uint8Array;switch(n.Type){case hy.RSA:return tv.rsa.unmarshalRsaPublicKey(i);case hy.Ed25519:return tv.ed25519.unmarshalEd25519PublicKey(i);case hy.Secp256k1:return tv.secp256k1.unmarshalSecp256k1PublicKey(i);default:throw rv(null!==(r=n.Type)&&void 0!==r?r:"RSA")}}function sv(e,t){var r;return nv(t=(null!==(r=t)&&void 0!==r?r:"rsa").toLowerCase()),e.bytes}async function av(e){var t,r;const n=py.decode(e),i=null!==(t=n.Data)&&void 0!==t?t:new Uint8Array;switch(n.Type){case hy.RSA:return tv.rsa.unmarshalRsaPrivateKey(i);case hy.Ed25519:return tv.ed25519.unmarshalEd25519PrivateKey(i);case hy.Secp256k1:return tv.secp256k1.unmarshalSecp256k1PrivateKey(i);default:throw rv(null!==(r=n.Type)&&void 0!==r?r:"RSA")}}async function cv(e,t){try{const r=await async function(e,t){const r=ml.decode(e);return Jg().decrypt(r,t)}(e,t);return await av(r)}catch(i){}const r=Hp.pki.decryptRsaPrivateKey(e,t);if(null===r)throw new oc("Cannot read the key, most likely the password is wrong or not a RSA key","ERR_CANNOT_DECRYPT_PEM");let n=Hp.asn1.toDer(Hp.pki.privateKeyToAsn1(r));return n=ru(n.getBytes(),"ascii"),tv.rsa.unmarshalRsaPrivateKey(n)}let lv;const uv=Symbol.for("nodejs.util.inspect.custom"),hv=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),dv=114,fv=36,pv=37;lv=Symbol.toStringTag;class gv{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[lv](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(dv,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:hv,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new mv({multihash:t}):e.startsWith("16U")?new vv({multihash:t}):new yv({multihash:t})}return function(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===fv)return new mv({multihash:t});if(t.digest.length===pv)return new vv({multihash:t})}if(t.code===Il.code)return new yv({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==dv)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new yv({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===fv)return new mv({multihash:e.multihash});if(t.digest.length===pv)return new vv({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(hv.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[uv](){return"PeerId(".concat(this.toString(),")")}}class yv extends gv{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class mv extends gv{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class vv extends gv{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}async function bv(e,t){return e.length===fv?new mv({multihash:Fc(Nl.code,e),privateKey:t}):e.length===pv?new vv({multihash:Fc(Nl.code,e),privateKey:t}):new yv({multihash:await Il.digest(e),publicKey:e,privateKey:t})}var wv=__webpack_require__(6049),Ev=__webpack_require__(227),_v=__webpack_require__(1595),Sv=__webpack_require__(2322),Av=__webpack_require__(9162);_v._configure(),wv._configure(Ev),Sv._configure(Av);const Tv=["uint64","int64","sint64","fixed64","sfixed64"];function Cv(e){return function(e){for(const t of Tv){if(null==e[t])continue;const r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new wv(e))}function kv(){return function(e){for(const t of Tv){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(Sv.create())}function Iv(e,t){const r=Cv(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function Rv(e,t){const r=kv();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var Pv,Nv,Dv;function xv(e,t){return function(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}("message",Pv.LENGTH_DELIMITED,e,t)}async function Lv(e,t,r){const n=await async function(e,t){if(null==e.privateKey)throw new Error("PrivateKey was missing from PeerId");const r=await av(e.privateKey);return await r.sign(t)}(e,Mv(t));if(null==e.publicKey)throw new Error("PublicKey was missing from local PeerId");return function(e,t,r){return Dv.encode({identityKey:e,identitySig:t,extensions:null!==r&&void 0!==r?r:{webtransportCerthashes:[]}}).subarray()}(e.publicKey,n,r)}async function Ov(e){return await bv(e.identityKey)}function Bv(e){return Dv.decode(e)}function Mv(e){const t=ru("noise-libp2p-static-key:");return Jl([t,e],t.length+e.length)}async function Uv(e,t,r){const n=await bv(t.identityKey);if(!n.equals(r))throw new Error("Payload identity key ".concat(n.toString()," does not match expected remote peer ").concat(r.toString()));const i=Mv(e);if(null==n.publicKey)throw new Error("PublicKey was missing from PeerId");if(null==t.identitySig)throw new Error("Signature was missing from message");const o=ov(n.publicKey);if(!await o.verify(i,t.identitySig))throw new Error("Static key doesn't match to peer that signed payload!");return n}function Fv(e){return e instanceof Uint8Array&&32===e.length}function jv(e){return Object.assign(Yu(e),{error:Yu("".concat(e,":error")),trace:Yu("".concat(e,":trace"))})}!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"}(Pv||(Pv={})),function(e){let t;e.codec=()=>(null==t&&(t=xv((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.webtransportCerthashes)for(const n of e.webtransportCerthashes)t.uint32(10),t.bytes(n);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={webtransportCerthashes:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.webtransportCerthashes.push(e.bytes());else e.skipType(7&t)}return r}))),t),e.encode=t=>Rv(t,e.codec()),e.decode=t=>Iv(t,e.codec())}(Nv||(Nv={})),function(e){let t;e.codec=()=>(null==t&&(t=xv((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var n,i;(!1!==r.lengthDelimited&&t.fork(),!0===r.writeDefaults||null!=e.identityKey&&e.identityKey.byteLength>0)&&(t.uint32(10),t.bytes(null!==(n=e.identityKey)&&void 0!==n?n:new Uint8Array(0)));(!0===r.writeDefaults||null!=e.identitySig&&e.identitySig.byteLength>0)&&(t.uint32(18),t.bytes(null!==(i=e.identitySig)&&void 0!==i?i:new Uint8Array(0)));null!=e.extensions&&(t.uint32(34),Nv.codec().encode(e.extensions,t,{writeDefaults:!1})),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={identityKey:new Uint8Array(0),identitySig:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.identityKey=e.bytes();break;case 2:r.identitySig=e.bytes();break;case 4:r.extensions=Nv.codec().decode(e,e.uint32());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>Rv(t,e.codec()),e.decode=t=>Iv(t,e.codec())}(Dv||(Dv={})),Yu.formatters.b=e=>null==e?"undefined":mc.baseEncode(e),Yu.formatters.t=e=>null==e?"undefined":Vc.baseEncode(e),Yu.formatters.m=e=>null==e?"undefined":ml.baseEncode(e),Yu.formatters.p=e=>null==e?"undefined":e.toString(),Yu.formatters.c=e=>null==e?"undefined":e.toString(),Yu.formatters.k=e=>null==e?"undefined":e.toString();const zv=jv("libp2p:noise");let Vv;function Kv(e){e?(Vv("LOCAL_PUBLIC_EPHEMERAL_KEY ".concat($l(e.publicKey,"hex"))),Vv("LOCAL_PRIVATE_EPHEMERAL_KEY ".concat($l(e.privateKey,"hex")))):Vv("Missing local ephemeral keys.")}function qv(e){Vv("REMOTE_EPHEMERAL_PUBLIC_KEY ".concat($l(e,"hex")))}Vv=Lp?zv:Object.assign((()=>{}),{enabled:!1,trace:()=>{},error:()=>{}});class Hv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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 Gv{constructor(e){this.crypto=e}encryptWithAd(e,t,r){const n=this.encrypt(e.k,e.n,t,r);return e.n.increment(),n}decryptWithAd(e,t,r,n){const{plaintext:i,valid:o}=this.decrypt(e.k,e.n,t,r,n);return o&&e.n.increment(),{plaintext:i,valid:o}}hasKey(e){return!this.isEmptyKey(e.k)}createEmptyKey(){return new Uint8Array(32)}isEmptyKey(e){return cl(this.createEmptyKey(),e)}encrypt(e,t,r,n){return t.assertValue(),this.crypto.chaCha20Poly1305Encrypt(n,t.getBytes(),r,e)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,n,i){t.assertValue();const o=this.crypto.chaCha20Poly1305Decrypt(n,t.getBytes(),r,e,i);return o?{plaintext:o,valid:!0}:{plaintext:new Uint8Array(0),valid:!1}}decryptAndHash(e,t){let r,n=!0;return this.hasKey(e.cs)?({plaintext:r,valid:n}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:n}}dh(e,t){try{const r=this.crypto.generateX25519SharedKey(e,t);return 32===r.length?r:r.subarray(0,32)}catch(r){const e=r;return zv.error(e),new Uint8Array(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return this.crypto.hashSHA256(Jl([e,t],e.length+t.length))}mixKey(e,t){const[r,n]=this.crypto.getHKDF(e.ck,t);e.cs=this.initializeKey(n),e.ck=r}initializeKey(e){return{k:e,n:new Hv}}initializeSymmetric(e){const t=ru(e,"utf-8"),r=this.hashProtocolName(t),n=r,i=this.createEmptyKey();return{cs:this.initializeKey(i),ck:n,h:r}}hashProtocolName(e){if(e.length<=32){const t=new Uint8Array(32);return t.set(e),t}return this.getHash(e,new Uint8Array(0))}split(e){const[t,r]=this.crypto.getHKDF(e.ck,new Uint8Array(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,new Uint8Array(0),t);return{ne:this.createEmptyKey(),ns:new Uint8Array(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,new Uint8Array(0),t.ciphertext)}}class Wv extends Gv{initializeInitiator(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}initializeResponder(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}writeMessageA(e,t,r){const n=new Uint8Array(0);e.e=void 0!==r?r:this.crypto.generateX25519KeyPair();const i=e.e.publicKey;this.mixHash(e.ss,i);return{ne:i,ns:n,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=this.crypto.generateX25519KeyPair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const n=e.s.publicKey,i=this.encryptAndHash(e.ss,n);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:r,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=e.s.publicKey,n=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const i=this.encryptAndHash(e.ss,t),o={ne:this.createEmptyKey(),ns:n,ciphertext:i},{cs1:s,cs2:a}=this.split(e.ss);return{h:e.ss.h,messageBuffer:o,cs1:s,cs2:a}}readMessageA(e,t){return Fv(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(Fv(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&Fv(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:i,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:i,valid:n&&o}}readMessageC(e,t){const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);if(n&&Fv(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:i,valid:o}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:s,cs2:a}=this.split(e.ss);return{h:e.ss.h,plaintext:i,valid:n&&o,cs1:s,cs2:a}}initSession(e,t,r){const n=this.createEmptyKey(),i=new Uint8Array(32);let o;return o=e?this.initializeInitiator(t,r,i,n):this.initializeResponder(t,r,i,n),{hs:o,i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:i,cs1:o,cs2:s}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=o,e.cs2=s}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}return e.mc++,n}recvMessage(e,t){let r=new Uint8Array(0),n=!1;if(0===e.mc)({plaintext:r,valid:n}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:n}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:i,plaintext:o,valid:s,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=o,n=s,e.h=i,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}}class Qv{constructor(e,t,r,n,i,o,s,a){this.remoteExtensions={webtransportCerthashes:[]},this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=i,this.connection=o,s&&(this.remotePeer=s),this.xx=null!==a&&void 0!==a?a:new Wv(n),this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair)}async propose(){var e;if(e=this.session.hs.s,Vv("LOCAL_STATIC_PUBLIC_KEY ".concat($l(e.publicKey,"hex"))),Vv("LOCAL_STATIC_PRIVATE_KEY ".concat($l(e.privateKey,"hex"))),this.isInitiator){zv.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 Jl([e.ne,e.ciphertext],e.ne.length+e.ciphertext.length)}(e)),zv.trace("Stage 0 - Initiator finished sending first message."),Kv(this.session.hs.e)}else{zv.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 Kp("xx handshake stage 0 validation fail");zv.trace("Stage 0 - Responder received first message."),qv(this.session.hs.re)}}async exchange(){if(this.isInitiator){zv.trace("Stage 1 - Initiator waiting to receive first message from responder...");const r=function(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.subarray(0,32),ns:e.subarray(32,80),ciphertext:e.subarray(80,e.length)}}((await this.connection.readLP()).subarray()),{plaintext:n,valid:i}=this.xx.recvMessage(this.session,r);if(!i)throw new Kp("xx handshake stage 1 validation fail");zv.trace("Stage 1 - Initiator received the message."),qv(this.session.hs.re),e=this.session.hs.rs,Vv("REMOTE_STATIC_PUBLIC_KEY ".concat($l(e,"hex"))),zv.trace("Initiator going to check remote's signature...");try{const e=Bv(n);this.remotePeer=this.remotePeer||await Ov(e),await Uv(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Vp("Error occurred while verifying signed payload: ".concat(t.message))}zv.trace("All good with the signature!")}else{zv.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 Jl([e.ne,e.ns,e.ciphertext],e.ne.length+e.ns.length+e.ciphertext.length)}(e)),zv.trace("Stage 1 - Responder sent the second handshake message with signed payload."),Kv(this.session.hs.e)}var e}async finish(){if(this.isInitiator){zv.trace("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(function(e){return Jl([e.ns,e.ciphertext],e.ns.length+e.ciphertext.length)}(e)),zv.trace("Stage 2 - Initiator sent message with signed payload.")}else{zv.trace("Stage 2 - Responder waiting for third handshake message...");const e=function(e){if(e.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:new Uint8Array(0),ns:e.subarray(0,48),ciphertext:e.subarray(48,e.length)}}((await this.connection.readLP()).subarray()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,e);if(!n)throw new Kp("xx handshake stage 2 validation fail");zv.trace("Stage 2 - Responder received the message, finished handshake.");try{const e=Bv(r);this.remotePeer=this.remotePeer||await Ov(e),await Uv(this.session.hs.rs,e,this.remotePeer),this.setRemoteNoiseExtension(e.extensions)}catch(t){throw new Vp("Error occurred while verifying signed payload: ".concat(t.message))}}var e;(e=this.session).cs1&&e.cs2?(Vv("CIPHER_STATE_1 ".concat(e.cs1.n.getUint64()," ").concat($l(e.cs1.k,"hex"))),Vv("CIPHER_STATE_2 ".concat(e.cs2.n.getUint64()," ").concat($l(e.cs2.k,"hex")))):Vv("Missing cipher state.")}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,new Uint8Array(0),e)}decrypt(e,t,r){const n=this.getCS(t,!1);return this.xx.decryptWithAd(n,new Uint8Array(0),e,r)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e.cs1||!e.cs2)throw new Kp("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 Yv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.protocol="/noise";const{staticNoiseKey:t,extensions:r,crypto:n,prologueBytes:i,metrics:o}=e;this.crypto=null!==n&&void 0!==n?n:Fp,this.extensions=r,this.metrics=o?function(e){return{xxHandshakeSuccesses:e.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:e.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:e.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:e.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:e.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}}(o):void 0,this.staticKeys=t?this.crypto.generateX25519KeyPairFromSeed(t):this.crypto.generateX25519KeyPair(),this.prologue=null!==i&&void 0!==i?i:new Uint8Array(0)}async secureOutbound(e,t,r){const n=pp(t,{lengthEncoder:jp,lengthDecoder:zp,maxDataLength:Dp}),i=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteExtensions:i.remoteExtensions,remotePeer:i.remotePeer}}async secureInbound(e,t,r){const n=pp(t,{lengthEncoder:jp,lengthDecoder:zp,maxDataLength:Dp}),i=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remotePeer:i.remotePeer,remoteExtensions:i.remoteExtensions}}async performHandshake(e){const t=await Lv(e.localPeer,this.staticKeys.publicKey,this.extensions);return await this.performXXHandshake(e,t)}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:n,connection:i}=e,o=new Qv(r,t,this.prologue,this.crypto,this.staticKeys,i,n);try{var s;await o.propose(),await o.exchange(),await o.finish(),null===(s=this.metrics)||void 0===s||s.xxHandshakeSuccesses.increment()}catch(c){var a;if(null===(a=this.metrics)||void 0===a||a.xxHandshakeErrors.increment(),c instanceof Error)throw c.message="Error occurred during XX handshake: ".concat(c.message),c}return o}async createSecureConnection(e,t){const[r,n]=function(){const e=yp(),t=yp();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}(),i=e.unwrap();return await _p(r,function(e,t){return async function*(r){for await(const n of r)for(let r=0;r<n.length;r+=xp){let i=r+xp;i>n.length&&(i=n.length);const o=e.encrypt(n.subarray(r,i),e.session);null===t||void 0===t||t.encryptedPackets.increment(),yield jp(o.byteLength),yield o}}}(t,this.metrics),i,Rp({lengthDecoder:zp}),function(e,t){return async function*(r){for await(const n of r)for(let r=0;r<n.length;r+=Dp){let i=r+Dp;if(i>n.length&&(i=n.length),i-Up.pg<r)throw new Error("Invalid chunk");const o=n.subarray(r,i),s=n.subarray(r,i-Up.pg),{plaintext:a,valid:c}=e.decrypt(o,e.session,s);if(!c)throw null===t||void 0===t||t.decryptErrors.increment(),new Error("Failed to validate decrypted chunk");null===t||void 0===t||t.decryptedPackets.increment(),yield a}}}(t,this.metrics),r),n}}function $v(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new Yv(e)}class Xv 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 Jv(e,t,r){const n=null!==r&&void 0!==r?r:{},i=function(e){if(null!=e){if("function"===typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"===typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"===typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}(e);return async function*(){let r;const o=()=>{null!=r&&r()};for(t.addEventListener("abort",o);;){let a;try{if(t.aborted){const{abortMessage:e,abortCode:t}=n;throw new Xv(e,t)}const e=new Promise(((e,t)=>{r=()=>{const{abortMessage:e,abortCode:r}=n;t(new Xv(e,r))}}));a=await Promise.race([e,i.next()]),r=null}catch(s){t.removeEventListener("abort",o);const r="aborted"===s.type&&t.aborted;if(r&&null!=n.onAbort&&await n.onAbort(e),"function"===typeof i.return)try{const e=i.return();e instanceof Promise&&e.catch((e=>{null!=n.onReturnError&&n.onReturnError(e)}))}catch(s){null!=n.onReturnError&&n.onReturnError(s)}if(r&&!0===n.returnOnAbort)return;throw s}if(!0===a.done)break;yield a.value}t.removeEventListener("abort",o)}()}function Zv(e,t,r){return n=>e(Jv(n,t,r))}function eb(e,t,r){return{sink:Zv(e.sink,t,{...r,onAbort:void 0}),source:Jv(e.source,t,r)}}function tb(e){return new Uint8Array(e)}var rb;!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"}(rb||(rb={}));const nb=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),ib=Object.freeze({NEW_STREAM:rb.NEW_STREAM,MESSAGE:rb.MESSAGE_INITIATOR,CLOSE:rb.CLOSE_INITIATOR,RESET:rb.RESET_INITIATOR}),ob=Object.freeze({MESSAGE:rb.MESSAGE_RECEIVER,CLOSE:rb.CLOSE_RECEIVER,RESET:rb.RESET_RECEIVER}),sb=1048576,ab=(e,t)=>t.append(e);const cb=function(e){try{let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){var r,n,i;let o=new cd,s=!1,a=gp(),c=Number(null!==(r=t.size)&&void 0!==r?r:sb);(isNaN(c)||0===c||c<0)&&(c=sb);const l=null!==(n=t.yieldAfter)&&void 0!==n?n:0,u=null!==(i=t.serialize)&&void 0!==i?i:ab;for(Promise.resolve().then((async()=>{try{let t;for await(const r of e)u(r,o),o.byteLength>=c?(clearTimeout(t),a.resolve()):t=setTimeout((()=>{a.resolve()}),l);clearTimeout(t),a.resolve()}catch(t){a.reject(t)}finally{s=!0}}));!s;)if(await a.promise,a=gp(),o.byteLength>0){const e=o;o=new cd,yield e.subarray()}}()}catch(t){return Promise.reject(t)}},lb=10240;const ub=new class{constructor(){this._pool=tb(lb),this._poolOffset=0}write(e,t){var r,n;const i=this._pool;let o=this._poolOffset;Xl.encode(e.id<<3|e.type,i,o),o+=null!==(r=Xl.encode.bytes)&&void 0!==r?r:0,e.type!==rb.NEW_STREAM&&e.type!==rb.MESSAGE_INITIATOR&&e.type!==rb.MESSAGE_RECEIVER||null==e.data?Xl.encode(0,i,o):Xl.encode(e.data.length,i,o),o+=null!==(n=Xl.encode.bytes)&&void 0!==n?n:0;const s=i.subarray(this._poolOffset,o);lb-o<100?(this._pool=tb(lb),this._poolOffset=0):this._poolOffset=o,t.append(s),e.type!==rb.NEW_STREAM&&e.type!==rb.MESSAGE_INITIATOR&&e.type!==rb.MESSAGE_RECEIVER||null==e.data||t.append(e.data)}};const hb=1<<20;class db{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hb,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4194304;this._buffer=new cd,this._headerInfo=null,this._maxMessageSize=e,this._maxUnprocessedMessageQueueSize=t}write(e){if(null==e||0===e.length)return[];if(this._buffer.append(e),this._buffer.byteLength>this._maxUnprocessedMessageQueueSize)throw Object.assign(new Error("unprocessed message queue size too large!"),{code:"ERR_MSG_QUEUE_TOO_BIG"});const t=[];for(;0!==this._buffer.length;){if(null==this._headerInfo)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(r){if("ERR_MSG_TOO_BIG"===r.code)throw r;break}const{id:e,type:n,length:i,offset:o}=this._headerInfo;if(this._buffer.length-o<i)break;const s={id:e,type:n};n!==rb.NEW_STREAM&&n!==rb.MESSAGE_INITIATOR&&n!==rb.MESSAGE_RECEIVER||(s.data=this._buffer.sublist(o,o+i)),t.push(s),this._buffer.consume(o+i),this._headerInfo=null}return t}_decodeHeader(e){const{value:t,offset:r}=gb(e),{value:n,offset:i}=gb(e,r),o=7&t;if(null==nb[o])throw new Error("Invalid type received: ".concat(o));if(n>this._maxMessageSize)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"});return{id:t>>3,type:o,offset:r+i,length:n}}}const fb=128,pb=127;function gb(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0,i=0,o=r;const s=e.length;do{if(o>=s||i>49)throw r=0,new RangeError("Could not decode varint");t=e.get(o++),n+=i<28?(t&pb)<<i:(t&pb)*Math.pow(2,i),i+=7}while(t>=fb);return r=o-r,{value:n,offset:r}}var yb=__webpack_require__(6622);const mb=jv("libp2p:mplex:stream"),vb="ERR_STREAM_RESET",bb="ERR_STREAM_ABORT",wb="ERR_SINK_ENDED",Eb="ERR_DOUBLE_SINK";var _b=__webpack_require__(7896);const Sb=jv("libp2p:mplex");function Ab(e){const t={...e,type:"".concat(nb[e.type]," (").concat(e.type,")")};return e.type===rb.NEW_STREAM&&(t.data=$l(e.data instanceof Uint8Array?e.data:e.data.subarray())),e.type!==rb.MESSAGE_INITIATOR&&e.type!==rb.MESSAGE_RECEIVER||(t.data=$l(e.data instanceof Uint8Array?e.data:e.data.subarray(),"base16")),t}class Tb{constructor(e){var t,r;this.protocol="/mplex/6.7.0",e=null!==(t=e)&&void 0!==t?t:{},this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=e,this.sink=this._createSink();const n=this._createSource();this._source=n,this.source=n,this.closeController=new AbortController,this.rateLimiter=new _b.RateLimiterMemory({points:null!==(r=e.disconnectThreshold)&&void 0!==r?r:5,duration:1})}get streams(){const e=[];for(const t of this._streams.initiators.values())e.push(t);for(const t of this._streams.receivers.values())e.push(t);return e}newStream(e){if(this.closeController.signal.aborted)throw new Error("Muxer already closed");const t=this._streamId++;e=null==e?t.toString():e.toString();const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}close(e){this.closeController.signal.aborted||(null!=e?this.streams.forEach((t=>t.abort(e))):this.streams.forEach((e=>e.close())),this.closeController.abort())}_newReceiverStream(e){const{id:t,name:r}=e,n=this._streams.receivers;return this._newStream({id:t,name:r,type:"receiver",registry:n})}_newStream(e){var t;const{id:r,name:n,type:i,registry:o}=e;if(Sb("new %s stream %s",i,r),"initiator"===i&&this._streams.initiators.size===(null!==(t=this._init.maxOutboundStreams)&&void 0!==t?t:1024))throw Td(new Error("Too many outbound streams open"),"ERR_TOO_MANY_OUTBOUND_STREAMS");if(o.has(r))throw new Error("".concat(i," stream ").concat(r," already exists!"));const s=function(e){const{id:t,name:r,send:n,onEnd:i,type:o="initiator",maxMsgSize:s=hb}=e,a=new AbortController,c=new AbortController,l=new AbortController,u="initiator"===o?ib:ob,h="initiator"===o?"i".concat(t):"r".concat(t),d="".concat(null==r?t:r);let f,p=!1,g=!1,y=!1;const m={open:Date.now()},v=e=>{g||(g=!0,mb.trace("%s stream %s sink end - err: %o",o,d,e),null!=e&&null==f&&(f=e),p&&(m.close=Date.now(),null!=i&&i(f)))},b=xd({onEnd:e=>{p||(p=!0,mb.trace("%s stream %s source end - err: %o",o,d,e),null!=e&&null==f&&(f=e),g&&(w.stat.timeline.close=Date.now(),null!=i&&i(f)))}}),w={close:()=>{mb.trace("%s stream %s close",o,d),w.closeRead(),w.closeWrite()},closeRead:()=>{mb.trace("%s stream %s closeRead",o,d),p||b.end()},closeWrite:()=>{if(mb.trace("%s stream %s closeWrite",o,d),!g){l.abort();try{n({id:t,type:u.CLOSE})}catch(e){mb.trace("%s stream %s error sending close",o,r,e)}v()}},abort:e=>{mb.trace("%s stream %s abort",o,d,e),b.end(e),a.abort(),v(e)},reset:()=>{const e=Td(new Error("stream reset"),vb);c.abort(),b.end(e),v(e)},sink:async e=>{if(y)throw Td(new Error("sink already called on stream"),Eb);if(y=!0,g)throw Td(new Error("stream closed for writing"),wb);e=Jv(e,(0,yb.anySignal)([a.signal,c.signal,l.signal]));try{"initiator"===o&&n({id:t,type:ib.NEW_STREAM,data:new cd(ru(d))});for await(let r of e)for(;r.length>0;){if(r.length<=s){n({id:t,type:u.MESSAGE,data:r instanceof Uint8Array?new cd(r):r});break}r=r instanceof Uint8Array?new cd(r):r,n({id:t,type:u.MESSAGE,data:r.sublist(0,s)}),r.consume(s)}}catch(i){if("aborted"===i.type&&"The operation was aborted"===i.message){if(l.signal.aborted)return;c.signal.aborted&&(i.message="stream reset",i.code=vb),a.signal.aborted&&(i.message="stream aborted",i.code=bb)}if(i.code===vb)mb.trace("%s stream %s reset",o,r);else{mb.trace("%s stream %s error",o,r,i);try{n({id:t,type:u.RESET})}catch(i){mb.trace("%s stream %s error sending reset",o,r,i)}}return b.end(i),void v(i)}try{n({id:t,type:u.CLOSE})}catch(i){mb.trace("%s stream %s error sending close",o,r,i)}v()},source:b,sourcePush:e=>{b.push(e)},sourceReadableLength:()=>b.readableLength,stat:{direction:"initiator"===o?"outbound":"inbound",timeline:m},metadata:{},id:h};return w}({id:r,name:n,send:e=>{Sb.enabled&&Sb.trace("%s stream %s send",i,r,Ab(e)),this._source.push(e)},type:i,onEnd:()=>{Sb("%s stream with id %s and protocol %s ended",i,r,s.stat.protocol),o.delete(r),null!=this._init.onStreamEnd&&this._init.onStreamEnd(s)},maxMsgSize:this._init.maxMsgSize});return o.set(r,s),s}_createSink(){return async e=>{const t=[this.closeController.signal];null!=this._init.signal&&t.push(this._init.signal),e=Jv(e,yb(t));try{const t=new db(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(const r of e)for(const e of t.write(r))await this._handleIncoming(e);this._source.end()}catch(r){Sb("error in sink",r),this._source.end(r)}}}_createSource(){const e=function(){return Ld((e=>{let t;const r=[];for(;!e.isEmpty()&&(t=e.shift(),null!=t);){if(null!=t.error)throw t.error;!1===t.done&&r.push(t.value)}return null==t?{done:!0}:{done:!0===t.done,value:r}}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}({objectMode:!0,onEnd:e=>{this.close(e)}});return Object.assign(function(e){try{let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return async function*(){if(null!=t&&0!==t)yield*cb(e,{size:t,serialize:(e,t)=>{for(const r of e)ub.write(r,t)}});else for await(const t of e){const e=new cd;for(const r of t)ub.write(r,e);yield e.subarray()}}()}catch(t){return Promise.reject(t)}}(e,this._init.minSendBytes),{push:e.push,end:e.end,return:e.return})}async _handleIncoming(e){var t;const{id:r,type:n}=e;if(Sb.enabled&&Sb.trace("incoming message",Ab(e)),e.type===rb.NEW_STREAM){var i;if(this._streams.receivers.size===(null!==(i=this._init.maxInboundStreams)&&void 0!==i?i:1024)){Sb("too many inbound streams open"),this._source.push({id:r,type:rb.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{return Sb("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),void this._source.end(new Error("Too many open streams"))}return}const t=this._newReceiverStream({id:r,name:$l(e.data instanceof Uint8Array?e.data:e.data.subarray())});return void(null!=this._init.onIncomingStream&&this._init.onIncomingStream(t))}const o=(1===(1&n)?this._streams.initiators:this._streams.receivers).get(r);if(null==o)return void Sb("missing stream %s for message type %s",r,nb[n]);const s=null!==(t=this._init.maxStreamBufferSize)&&void 0!==t?t:4194304;switch(n){case rb.MESSAGE_INITIATOR:case rb.MESSAGE_RECEIVER:if(o.sourceReadableLength()>s){this._source.push({id:e.id,type:n===rb.MESSAGE_INITIATOR?rb.RESET_RECEIVER:rb.RESET_INITIATOR});const t=Td(new Error("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 rb.CLOSE_INITIATOR:case rb.CLOSE_RECEIVER:o.closeRead();break;case rb.RESET_INITIATOR:case rb.RESET_RECEIVER:o.reset();break;default:Sb("unknown message type %s",n)}}}class Cb{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.protocol="/mplex/6.7.0",this._init=e}createStreamMuxer(){return new Tb({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},...this._init})}}function kb(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new Cb(e)}const Ib=WebSocket;var Rb=__webpack_require__(3634);function Pb(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 Nb=e=>{if(e.readyState>=2)throw new Error("socket closed");if(1!==e.readyState)return new Promise(((t,r)=>{function n(){e.removeEventListener("open",i),e.removeEventListener("error",o)}function i(){n(),t()}function o(t){var i;n(),r(null!==(i=t.error)&&void 0!==i?i:new Error("connect ECONNREFUSED ".concat(e.url)))}e.addEventListener("open",i),e.addEventListener("error",o)}))},Db=(e,t)=>{var r;(t=null!==(r=t)&&void 0!==r?r:{}).closeOnEnd=!1!==t.closeOnEnd;return async r=>{for await(const t of r){try{await Nb(e)}catch(n){if("socket closed"===n.message)break;throw n}e.send(t)}if(null!=t.closeOnEnd&&e.readyState<=1)return await new Promise(((t,r)=>{e.addEventListener("close",(e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});r(t)}})),setTimeout((()=>e.close()))}))}},xb=(e,t)=>{var r;t=null!==(r=t)&&void 0!==r?r:{};const n=(e=>{e.binaryType="arraybuffer";const t=async()=>await new Promise(((t,r)=>{if(i)return t();if(null!=n)return r(n);const o=t=>{e.removeEventListener("open",s),e.removeEventListener("error",a),t()},s=()=>o(t),a=t=>{o((()=>{var n;return r(null!==(n=t.error)&&void 0!==n?n:new Error("connect ECONNREFUSED ".concat(e.url)))}))};e.addEventListener("open",s),e.addEventListener("error",a)})),r=async function*(){const r=new Rb.zN((t=>{let{push:r,stop:n,fail:i}=t;const o=e=>{let t=null;"string"===typeof e.data&&(t=ru(e.data)),Pb(e.data)&&(t=new Uint8Array(e.data)),e.data instanceof Uint8Array&&(t=e.data),null!=t&&r(t)},s=e=>{var t;return i(null!==(t=e.error)&&void 0!==t?t:new Error("Socket error"))};return e.addEventListener("message",o),e.addEventListener("error",s),e.addEventListener("close",n),()=>{e.removeEventListener("message",o),e.removeEventListener("error",s),e.removeEventListener("close",n)}}),{highWaterMark:1/0});await t();for await(const e of r)yield Pb(e)?new Uint8Array(e):e}();let n,i=1===e.readyState;return e.addEventListener("open",(()=>{i=!0,n=null})),e.addEventListener("close",(()=>{i=!1,n=null})),e.addEventListener("error",(t=>{var r;i||(n=null!==(r=t.error)&&void 0!==r?r:new Error("connect ECONNREFUSED ".concat(e.url)))})),Object.assign(r,{connected:t})})(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:Db(e,t),source:n,connected:async()=>await n.connected(),close:async()=>{e.readyState!==e.CONNECTING&&e.readyState!==e.OPEN||await new Promise((t=>{e.addEventListener("close",(()=>{t()})),e.close()}))},destroy:()=>{null!=e.terminate?e.terminate():e.close()},remoteAddress:i,remotePort:o,socket:e}};var Lb=__webpack_require__(6791);const Ob={http:"ws",https:"wss"},Bb=(e,t)=>(0,Lb.relative)(e,t,Ob,"ws");const Mb=nu,Ub=iu,Fb=function(e){let t=0;if(e=e.toString().trim(),Mb(e)){const r=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{r[t++]=255&parseInt(e,10)})),r}if(Ub(e)){const r=e.split(":",8);let n;for(n=0;n<r.length;n++){let e;Mb(r[n])&&(e=Fb(r[n]),r[n]=$l(e.slice(0,2),"base16")),null!=e&&++n<8&&r.splice(n,0,$l(e.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&""!==r[n];n++);const e=[n,1];for(n=9-r.length;n>0;n--)e.push("0");r.splice.apply(r,e)}const i=new Uint8Array(t+16);for(n=0;n<r.length;n++){const e=parseInt(r[n],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},jb=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;r=~~r,n=null!==(t=n)&&void 0!==t?t:e.length-r;const i=new DataView(e.buffer);if(4===n){const t=[];for(let i=0;i<n;i++)t.push(e[r+i]);return t.join(".")}if(16===n){const e=[];for(let t=0;t<n;t+=2)e.push(i.getUint16(r+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},zb=-1,Vb={},Kb={};function qb(e){if("number"===typeof e){if(null!=Kb[e])return Kb[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=Vb[e])return Vb[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,zb,"ip6zone"],[53,zb,"dns",!0],[54,zb,"dns4",!0],[55,zb,"dns6",!0],[56,zb,"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,zb,"unix",!1,!0],[421,zb,"ipfs"],[421,zb,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,zb,"garlic64"],[460,0,"quic"],[465,0,"webtransport"],[466,zb,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,zb,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);Kb[t.code]=t,Vb[t.name]=t}));var Hb=function e(t,r,n){r=r||[];var i=n=n||0;for(;t>=Qb;)r[n++]=255&t|Gb,t/=128;for(;t&Wb;)r[n++]=255&t|Gb,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},Gb=128,Wb=-128,Qb=Math.pow(2,31);var Yb=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(n&Xb)<<o:(n&Xb)*Math.pow(2,o),o+=7}while(n>=$b);return e.bytes=s-r,i},$b=128,Xb=127;var Jb=Math.pow(2,7),Zb=Math.pow(2,14),ew=Math.pow(2,21),tw=Math.pow(2,28),rw=Math.pow(2,35),nw=Math.pow(2,42),iw=Math.pow(2,49),ow=Math.pow(2,56),sw=Math.pow(2,63);const aw={encode:Hb,decode:Yb,encodingLength:function(e){return e<Jb?1:e<Zb?2:e<ew?3:e<tw?4:e<rw?5:e<nw?6:e<iw?7:e<ow?8:e<sw?9:10}},cw=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return[aw.decode(e,t),aw.decode.bytes]},lw=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return aw.encode(e,t,r),t},uw=e=>aw.encodingLength(e),hw=(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")}),dw=(e,t)=>{const r=t.byteLength,n=uw(e),i=n+uw(r),o=new Uint8Array(i+r);return lw(e,o,0),lw(r,o,n),o.set(t,i),new pw(e,r,t,o)},fw=e=>{const t=hw(e),[r,n]=cw(t),[i,o]=cw(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new pw(r,i,s,t)};class pw{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}var gw=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=o-1;(0!==u||h<i)&&-1!==d;d--,h++)u+=a*s[d]>>>0,s[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),g=n;f!==o;)p[g++]=s[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var h=t[i],d=0,f=s-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=s-n;p!==s&&0===l[p];)p++;for(var g=c.repeat(r);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};const yw=gw;class mw{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class vw{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return ww(this,e)}}class bw{constructor(e){this.decoders=e}or(e){return ww(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const ww=(e,t)=>new bw({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Ew{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new mw(e,t,r),this.decoder=new vw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const _w=e=>{let{name:t,prefix:r,encode:n,decode:i}=e;return new Ew(t,r,n,i)},Sw=e=>{let{prefix:t,name:r,alphabet:n}=e;const{encode:i,decode:o}=yw(n,r);return _w({prefix:t,name:r,encode:i,decode:e=>hw(o(e))})},Aw=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return _w({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,n,t)})},Tw=Sw({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Cw=Sw({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),kw=Aw({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Iw=Aw({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Rw=Aw({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Pw=Aw({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Nw=Aw({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Dw=Aw({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xw=Aw({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Lw=Aw({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ow=Aw({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Bw=new WeakMap,Mw=e=>{const t=Bw.get(e);if(null==t){const t=new Map;return Bw.set(e,t),t}return t};class Uw{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this["/"]=n}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:e,multihash:t}=this;if(e!==Vw)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Kw)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Uw.createV0(t)}default:throw Error("Can not convert CID version ".concat(this.version," to version 0. This is a bug please report"))}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=dw(e,t);return Uw.createV1(this.code,r)}case 1:return this;default:throw Error("Can not convert CID version ".concat(this.version," to version 1. This is a bug please report"))}}equals(e){return Uw.equals(this,e)}static equals(e,t){const r=t;return r&&e.code===r.code&&e.version===r.version&&((e,t)=>{if(e===t)return!0;{const r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0})(e.bytes,r.bytes)}})(e.multihash,r.multihash)}toString(e){return((e,t)=>{const{bytes:r,version:n}=e;return 0===n?jw(r,Mw(e),t||Tw.encoder):zw(r,Mw(e),t||kw.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 Uw)return t;if(null!=t["/"]&&t["/"]===t.bytes||t.asCID===t){const{version:e,code:r,multihash:n,bytes:i}=t;return new Uw(e,r,n,i||qw(e,r,n.bytes))}if(!0===t[Hw]){const{version:e,multihash:r,code:n}=t,i=fw(r);return Uw.create(e,n,i)}return null}static create(e,t,r){if("number"!==typeof t)throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:if(t!==Vw)throw new Error("Version 0 CID must use dag-pb (code: ".concat(Vw,") block encoding"));return new Uw(e,t,r,r.bytes);case 1:{const n=qw(e,t,r.bytes);return new Uw(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return Uw.create(0,Vw,e)}static createV1(e,t){return Uw.create(1,e,t)}static decode(e){const[t,r]=Uw.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=Uw.inspectBytes(e),r=t.size-t.multihashSize,n=hw(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const i=n.subarray(t.multihashSize-t.digestSize),o=new pw(t.multihashCode,t.digestSize,i,n);return[0===t.version?Uw.createV0(o):Uw.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,n]=cw(e.subarray(t));return t+=n,r};let n=r(),i=Vw;if(18===n?(n=0,t=0):i=r(),0!==n&&1!==n)throw new RangeError("Invalid CID version ".concat(n));const o=t,s=r(),a=r(),c=t+a;return{version:n,codec:i,multihashCode:s,digestSize:a,multihashSize:c-o,size:c}}static parse(e,t){const[r,n]=Fw(e,t),i=Uw.decode(n);return Mw(i).set(r,e),i}}const Fw=(e,t)=>{switch(e[0]){case"Q":{const r=t||Tw;return[Tw.prefix,r.decode("".concat(Tw.prefix).concat(e))]}case Tw.prefix:{const r=t||Tw;return[Tw.prefix,r.decode(e)]}case kw.prefix:{const r=t||kw;return[kw.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},jw=(e,t,r)=>{const{prefix:n}=r;if(n!==Tw.prefix)throw Error("Cannot string encode V0 in ".concat(r.name," encoding"));const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i},zw=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},Vw=112,Kw=18,qw=(e,t,r)=>{const n=uw(e),i=n+uw(t),o=new Uint8Array(i+r.byteLength);return lw(e,o,0),lw(t,o,n),o.set(r,i),o},Hw=Symbol.for("@ipld/js-cid/CID"),Gw=_w({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),Ww=Aw({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Qw=Aw({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Yw=Sw({prefix:"9",name:"base10",alphabet:"0123456789"}),$w=Aw({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Xw=Aw({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Jw=Sw({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Zw=Sw({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),eE=Aw({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),tE=Aw({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),rE=Aw({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nE=Aw({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),iE=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"),oE=iE.reduce(((e,t,r)=>(e[r]=t,e)),[]),sE=iE.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);const aE=_w({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=oE[t]),"")},decode:function(e){const t=[];for(const r of e){const e=sE[r.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(r));t.push(e)}return new Uint8Array(t)}}),cE=e=>{let{name:t,code:r,encode:n}=e;return new lE(t,r,n)};class lE{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?dw(this.code,t):t.then((e=>dw(this.code,e)))}throw Error("Unknown type, must be binary type")}}const uE=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),hE=cE({name:"sha2-256",code:18,encode:uE("SHA-256")}),dE=cE({name:"sha2-512",code:19,encode:uE("SHA-512")}),fE=hw,pE={code:0,name:"identity",encode:fE,digest:e=>dw(0,fE(e))},gE="raw",yE=85,mE=e=>hw(e),vE=e=>hw(e),bE=new TextEncoder,wE=new TextDecoder,EE="json",_E=512,SE=e=>bE.encode(JSON.stringify(e)),AE=e=>JSON.parse(wE.decode(e)),TE={...b,...w,...E,..._,...S,...v,...A,...m,...T,...C};function CE(e,t){switch(qb(e).code){case 4:case 41:return function(e){const t=jb(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!ou(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return DE(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=Xl.decode(e);if(e=e.slice(Xl.decode.bytes),e.length!==t)throw new Error("inconsistent lengths");return $l(e)}(t);case 421:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return $l(r,"base58btc")}(t);case 444:case 445:return xE(t);case 466:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+$l(r,"base64url")}(t);default:return $l(t,"base16")}}function kE(e,t){switch(qb(e).code){case 4:case 41:return PE(t);case 6:case 273:case 33:case 132:return NE(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=ru(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?fw(Tw.decode("z".concat(e))).bytes:Uw.parse(e).multihash.bytes;const r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(16!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion address."));const r=kw.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=NE(n);return Jl([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(56!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion3 address."));const r=kw.decode("b".concat(t[0])),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=NE(n);return Jl([r,i],r.length+i.length)}(t);case 466:return function(e){const t=RE.decode(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);default:return ru(t,"base16")}}const IE=Object.values(TE).map((e=>e.decoder)),RE=function(){let e=IE[0].or(IE[1]);return IE.slice(2).forEach((t=>e=e.or(t))),e}();function PE(e){if(!ou(e))throw new Error("invalid ip address");return Fb(e)}function NE(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function DE(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function xE(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=$l(t,"base32"),i=DE(r);return"".concat(n,":").concat(i)}function LE(e){return e.map((e=>{const t=qE(e);return null!=e[1]?[t.code,CE(t.code,e[1])]:[t.code]}))}function OE(e){return jE(Jl(e.map((e=>{const t=qE(e);let r=Uint8Array.from(Xl.encode(t.code));return e.length>1&&null!=e[1]&&(r=Jl([r,e[1]])),r}))))}function BE(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return Xl.decode(t)+Xl.decode.bytes}function ME(e){const t=[];let r=0;for(;r<e.length;){const n=Xl.decode(e,r),i=Xl.decode.bytes,o=BE(qb(n),e.slice(r+i));if(0===o){t.push([n]),r+=i;continue}const s=e.slice(r+i,r+i+o);if(r+=o+i,r>e.length)throw KE("Invalid address Uint8Array: "+$l(e,"base16"));t.push([n,s])}return t}function UE(e){return function(e){const t=[];return e.map((e=>{const r=qE(e);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),VE(t.join("/"))}(LE(ME(e)))}function FE(e){const t=function(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=qb(i);if(0!==o.size){if(n++,n>=r.length)throw KE("invalid address: "+e);if(!0===o.path){t.push([i,VE(r.slice(n).join("/"))]);break}t.push([i,r[n]])}else t.push([i])}return t}(e=VE(e));return OE(t.map((e=>{Array.isArray(e)||(e=[e]);const t=qE(e);return e.length>1?[t.code,kE(t.code,e[1])]:[t.code]})))}function jE(e){const t=zE(e);if(null!=t)throw t;return Uint8Array.from(e)}function zE(e){try{ME(e)}catch(t){return t}}function VE(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function KE(e){return new Error("Error parsing address: "+e)}function qE(e){return qb(e[0])}var HE,GE,WE,QE,YE=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},$E=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};const XE=Symbol.for("nodejs.util.inspect.custom"),JE=[qb("dns").code,qb("dns4").code,qb("dns6").code,qb("dnsaddr").code],ZE=[qb("p2p").code,qb("ipfs").code],e_=new Map,t_=Symbol.for("@multiformats/js-multiaddr/multiaddr");function r_(e,t){if(null==e)throw new Error("requires node address object");if(null==t)throw new Error("requires transport protocol");let r;switch(e.family){case 4:r="ip4";break;case 6:r="ip6";break;default:throw Error("Invalid addr family, should be 4 or 6.")}return new i_("/"+[r,e.address,t,e.port].join("/"))}function n_(e){return Boolean(null===e||void 0===e?void 0:e[t_])}class i_{constructor(e){if(HE.set(this,void 0),GE.set(this,void 0),WE.set(this,void 0),this[QE]=!0,null==e&&(e=""),e instanceof Uint8Array)this.bytes=jE(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=FE(e)}else{if(!n_(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=jE(e.bytes)}}toString(){return null==YE(this,HE,"f")&&$E(this,HE,UE(this.bytes),"f"),YE(this,HE,"f")}toJSON(){return this.toString()}toOptions(){const e=this.protoCodes(),t=this.toString().split("/").slice(1);let r,n;if(t.length>2)JE.includes(e[0])&&ZE.includes(e[1])?(r=qb("tcp").name,n=443):(r=qb(t[2]).name,n=parseInt(t[3]));else{if(!JE.includes(e[0]))throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');r=qb("tcp").name,n=443}return{family:41===e[0]||55===e[0]?6:4,host:t[1],transport:r,port:n}}protos(){return this.protoCodes().map((e=>Object.assign({},qb(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){const n=Xl.decode(t,r),i=Xl.decode.bytes;r+=BE(qb(n),t.slice(r+i))+i,e.push(n)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==YE(this,GE,"f")&&$E(this,GE,ME(this.bytes),"f"),YE(this,GE,"f")}stringTuples(){return null==YE(this,WE,"f")&&$E(this,WE,LE(this.tuples()),"f"),YE(this,WE,"f")}encapsulate(e){return e=new i_(e),new i_(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new i_(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new i_(OE(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===Vb.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]?$l(Tw.decode("z".concat(e)),"base58btc"):$l(Uw.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!0===qb(e[0]).path))[0][1],null==e&&(e=null)}catch{e=null}return e}equals(e){return cl(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const r=e_.get(t.name);if(null==r)throw Td(new Error("no available resolver for ".concat(t.name)),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this,e)).map((e=>new i_(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))}[(HE=new WeakMap,GE=new WeakMap,WE=new WeakMap,QE=t_,XE)](){return this.inspect()}inspect(){return"<Multiaddr "+$l(this.bytes,"base16")+" - "+UE(this.bytes)+">"}}function o_(e){return new i_(e)}const s_=(e,t)=>t,a_={ip4:s_,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:"[".concat(t,"]"),tcp:(e,t,r,n,i)=>n.some((e=>["http","https","ws","wss"].includes(e.protocol)))?"".concat(e,":").concat(t):((e,t,r,n)=>{if(null!=n&&!1===n.assumeHttp)return"tcp://".concat(e,":").concat(t);let i="tcp",o=":".concat(t);return"tcp"===r[r.length-1].protocol&&(i="443"===t?"https":"http",o="443"===t||"80"===t?"":o),"".concat(i,"://").concat(e).concat(o)})(e,t,n,i),udp:(e,t)=>"udp://".concat(e,":").concat(t),dnsaddr:s_,dns4:s_,dns6:s_,ipfs:(e,t)=>"".concat(e,"/ipfs/").concat(t),p2p:(e,t)=>"".concat(e,"/p2p/").concat(t),http:e=>"http://".concat(e),https:e=>"https://".concat(e),ws:e=>"ws://".concat(e),wss:e=>"wss://".concat(e),"p2p-websocket-star":e=>"".concat(e,"/p2p-websocket-star"),"p2p-webrtc-star":e=>"".concat(e,"/p2p-webrtc-star"),"p2p-webrtc-direct":e=>"".concat(e,"/p2p-webrtc-direct")};var c_=__webpack_require__(2193);const l_="object"===typeof window&&"object"===typeof document&&9===document.nodeType,u_=c_(),h_=l_&&!u_,d_=u_&&!l_,f_=u_&&l_,p_="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.release&&"node"===globalThis.process.release.name&&!u_,g_="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,y_=("undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.env&&globalThis.process.env.NODE_ENV,"undefined"!==typeof navigator&&"ReactNative"===navigator.product);const m_=421,v_=290,b_=6,w_=478,E_=2e3;class __ extends Error{constructor(e){super(e),this.name="TimeoutError"}}class S_ extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const A_=e=>void 0===globalThis.DOMException?new S_(e):new DOMException(e),T_=e=>{const t=void 0===e.reason?A_("This operation was aborted."):e.reason;return t instanceof Error?t:A_(t)};function C_(e,t){const{milliseconds:r,fallback:n,message:i,customTimers:o={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t;let s;const a=new Promise(((a,c)=>{if("number"!==typeof r||1!==Math.sign(r))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(r,"`"));if(r===Number.POSITIVE_INFINITY)return void a(e);if(t.signal){const{signal:e}=t;e.aborted&&c(T_(e)),e.addEventListener("abort",(()=>{c(T_(e))}))}const l=new __;s=o.setTimeout.call(void 0,(()=>{if(n)try{a(n())}catch(t){c(t)}else"function"===typeof e.cancel&&e.cancel(),!1===i?a():i instanceof Error?c(i):(l.message=null!==i&&void 0!==i?i:"Promise timed out after ".concat(r," milliseconds"),c(l))}),r),(async()=>{try{a(await e)}catch(t){c(t)}finally{o.clearTimeout.call(void 0,s)}})()}));return a.clear=()=>{o.clearTimeout.call(void 0,s),s=void 0},a}const k_=jv("libp2p:websockets:socket");const I_=X_("dns4"),R_=X_("dns6"),P_=X_("dnsaddr"),N_=$_(X_("dns"),P_,I_,R_),D_=$_(X_("ip4"),X_("ip6")),x_=$_(Y_(D_,X_("tcp")),Y_(N_,X_("tcp"))),L_=Y_(D_,X_("udp")),O_=Y_(L_,X_("utp")),B_=Y_(L_,X_("quic")),M_=$_(Y_(x_,X_("ws")),Y_(N_,X_("ws"))),U_=$_(Y_(x_,X_("wss")),Y_(N_,X_("wss")),Y_(x_,X_("tls"),X_("ws")),Y_(N_,X_("tls"),X_("ws"))),F_=$_(Y_(x_,X_("http")),Y_(D_,X_("http")),Y_(N_,X_("http"))),j_=$_(Y_(x_,X_("https")),Y_(D_,X_("https")),Y_(N_,X_("https"))),z_=$_(Y_(M_,X_("p2p-webrtc-star"),X_("p2p")),Y_(U_,X_("p2p-webrtc-star"),X_("p2p")),Y_(M_,X_("p2p-webrtc-star")),Y_(U_,X_("p2p-webrtc-star"))),V_=($_(Y_(M_,X_("p2p-websocket-star"),X_("p2p")),Y_(U_,X_("p2p-websocket-star"),X_("p2p")),Y_(M_,X_("p2p-websocket-star")),Y_(U_,X_("p2p-websocket-star"))),$_(Y_(F_,X_("p2p-webrtc-direct"),X_("p2p")),Y_(j_,X_("p2p-webrtc-direct"),X_("p2p")),Y_(F_,X_("p2p-webrtc-direct")),Y_(j_,X_("p2p-webrtc-direct")))),K_=$_(M_,U_,F_,j_,z_,V_,x_,O_,B_,N_),q_=($_(Y_(K_,X_("p2p-stardust"),X_("p2p")),Y_(K_,X_("p2p-stardust"))),$_(Y_(K_,X_("p2p")),z_,V_,X_("p2p"))),H_=$_(Y_(q_,X_("p2p-circuit"),q_),Y_(q_,X_("p2p-circuit")),Y_(X_("p2p-circuit"),q_),Y_(K_,X_("p2p-circuit")),Y_(X_("p2p-circuit"),K_),X_("p2p-circuit")),G_=()=>$_(Y_(H_,G_),H_),W_=G_();$_(Y_(W_,q_,W_),Y_(q_,W_),Y_(W_,q_),W_,q_);function Q_(e){return function(t){let r;try{r=o_(t)}catch(i){return!1}const n=e(r.protoNames());return null!==n&&(!0===n||!1===n?n:0===n.length)}}function Y_(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){if(e.length<t.length)return null;let r=e;return t.some((t=>(r="function"===typeof t?t().partialMatch(e):t.partialMatch(e),Array.isArray(r)&&(e=r),null===r))),r}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:Q_(n),partialMatch:n}}function $_(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){let r=null;return t.some((t=>{const n="function"===typeof t?t().partialMatch(e):t.partialMatch(e);return null!=n&&(r=n,!0)})),r}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:Q_(n),partialMatch:n}}function X_(e){const t=e;return{toString:function(){return t},matches:function(e){let r;try{r=o_(e)}catch(i){return!1}const n=r.protoNames();return 1===n.length&&n[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}function J_(e){return e.filter((e=>{if(e.protoCodes().includes(v_))return!1;const t=e.decapsulateCode(m_);return M_.matches(t)||U_.matches(t)}))}const Z_=Symbol.for("@libp2p/transport");var eS;!function(e){e[e.FATAL_ALL=0]="FATAL_ALL",e[e.NO_FATAL=1]="NO_FATAL"}(eS||(eS={}));const tS=jv("libp2p:websockets");class rS{constructor(e){this.init=e}get[Symbol.toStringTag](){return"@libp2p/websockets"}get[Z_](){return!0}async dial(e,t){var r;tS("dialing %s",e),t=null!==(r=t)&&void 0!==r?r:{};const n=function(e,t,r){var n;const i={async sink(t){var n;null!=(null===(n=r)||void 0===n?void 0:n.signal)&&(t=Jv(t,r.signal));try{await e.sink(t)}catch(i){"aborted"!==i.type&&k_.error(i)}},source:null!=(r=null!==(n=r)&&void 0!==n?n:{}).signal?Jv(e.source,r.signal):e.source,remoteAddr:t,timeline:{open:Date.now()},async close(){const t=Date.now();try{await C_(e.close(),{milliseconds:E_})}catch(r){const{host:n,port:o}=i.remoteAddr.toOptions();k_("timeout closing stream to %s:%s after %dms, destroying it manually",n,o,Date.now()-t),e.destroy()}finally{i.timeline.close=Date.now()}}};return e.socket.addEventListener("close",(()=>{null==i.timeline.close&&(i.timeline.close=Date.now())}),{once:!0}),i}(await this._connect(e,t),e);tS("new outbound connection %s",n.remoteAddr);const i=await t.upgrader.upgradeOutbound(n);return tS("outbound connection %s upgraded",n.remoteAddr),i}async _connect(e,t){var r;if(!0===(null===t||void 0===t||null===(r=t.signal)||void 0===r?void 0:r.aborted))throw new ic;const n=e.toOptions();tS("dialing %s:%s",n.host,n.port);const i=gp(),o=e=>{tS.error("connection error:",e),i.reject(e)},s=function(e,t){var r;const n="undefined"===typeof window?"":window.location;t=null!==(r=t)&&void 0!==r?r:{};const i=Bb(e,n.toString()),o=new Ib(i,t.websocket);return xb(o,t)}(function(e,t){const r=o_(e),n=r.toString().split("/").slice(1);return r.tuples().map((e=>{var t,r;return{protocol:null!==(t=n.shift())&&void 0!==t?t:"",content:null!=e[1]&&null!==(r=n.shift())&&void 0!==r?r:""}})).reduce(((e,r,n,i)=>{const o=a_[r.protocol];if(null==o)throw new Error("Unsupported protocol ".concat(r.protocol));return o(e,r.content,n,i,t)}),"")}(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]),tS("connected %s",e),s;let a;const c=new Promise(((e,r)=>{var n,i;if(a=()=>{r(new ic),s.close().catch((e=>{tS.error("error closing raw socket",e)}))},!0===(null===t||void 0===t||null===(n=t.signal)||void 0===n?void 0:n.aborted))return a();null===t||void 0===t||null===(i=t.signal)||void 0===i||i.addEventListener("abort",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 tS("connected %s",e),s}createListener(e){return function(){throw new Error("WebSocket Servers can not be created in the browser!")}(this.init)}filter(e){var t,r;return e=Array.isArray(e)?e:[e],null!=(null===(t=this.init)||void 0===t?void 0:t.filter)?null===(r=this.init)||void 0===r?void 0:r.filter(e):h_||g_?function(e){return e.filter((e=>{if(e.protoCodes().includes(v_))return!1;const t=e.decapsulateCode(m_);return U_.matches(t)&&N_.matches(t.decapsulateCode(b_).decapsulateCode(w_))}))}(e):J_(e)}}function nS(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return()=>new rS(e)}const iS=Symbol.for("@libp2p/peer-discovery");var oS,sS,aS=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class cS extends EventTarget{constructor(){super(...arguments),sS.set(this,new Map)}listenerCount(e){const t=aS(this,sS,"f").get(e);return null==t?0:t.length}addEventListener(e,t,r){var n;super.addEventListener(e,t,r);let i=aS(this,sS,"f").get(e);null==i&&(i=[],aS(this,sS,"f").set(e,i)),i.push({callback:t,once:null!==(n=!0!==r&&!1!==r&&(null===r||void 0===r?void 0:r.once))&&void 0!==n&&n})}removeEventListener(e,t,r){super.removeEventListener(e.toString(),null!==t&&void 0!==t?t:null,r);let n=aS(this,sS,"f").get(e);null!=n&&(n=n.filter((e=>{let{callback:r}=e;return r!==t})),aS(this,sS,"f").set(e,n))}dispatchEvent(e){const t=super.dispatchEvent(e);let r=aS(this,sS,"f").get(e.type);return null==r||(r=r.filter((e=>{let{once:t}=e;return!t})),aS(this,sS,"f").set(e.type,r)),t}safeDispatchEvent(e,t){return this.dispatchEvent(new uS(e,t))}}sS=new WeakMap;class lS extends Event{constructor(e,t){super(e,t),this.detail=null===t||void 0===t?void 0:t.detail}}const uS=null!==(oS=globalThis.CustomEvent)&&void 0!==oS?oS:lS;var hS=__webpack_require__(7898);function dS(e){return new Uint8Array(hS.keccak256.arrayBuffer(e))}function fS(e,t,r){try{return xm(Zy.fromCompact(e.slice(0,64)),t,r)}catch{return!1}}const pS="Invalid record id",gS=2,yS=nu,mS=iu,vS=function(e){let t=0;if(e=e.toString().trim(),yS(e)){const r=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{r[t++]=255&parseInt(e,10)})),r}if(mS(e)){const r=e.split(":",8);let n;for(n=0;n<r.length;n++){let e;yS(r[n])&&(e=vS(r[n]),r[n]=$l(e.slice(0,2),"base16")),null!=e&&++n<8&&r.splice(n,0,$l(e.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&""!==r[n];n++);const e=[n,1];for(n=9-r.length;n>0;n--)e.push("0");r.splice.apply(r,e)}const i=new Uint8Array(t+16);for(n=0;n<r.length;n++){const e=parseInt(r[n],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},bS=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;r=~~r,n=null!==(t=n)&&void 0!==t?t:e.length-r;const i=new DataView(e.buffer);if(4===n){const t=[];for(let i=0;i<n;i++)t.push(e[r+i]);return t.join(".")}if(16===n){const e=[];for(let t=0;t<n;t+=2)e.push(i.getUint16(r+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},wS=-1,ES={},_S={};function SS(e){if("number"===typeof e){if(null!=_S[e])return _S[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=ES[e])return ES[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,wS,"ip6zone"],[43,8,"ipcidr"],[53,wS,"dns",!0],[54,wS,"dns4",!0],[55,wS,"dns6",!0],[56,wS,"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,wS,"unix",!1,!0],[421,wS,"ipfs"],[421,wS,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,wS,"garlic64"],[448,0,"tls"],[449,wS,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,wS,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,wS,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);_S[t.code]=t,ES[t.name]=t}));SS("ip4"),SS("ip6"),SS("ipcidr");function AS(e,t){switch(SS(e).code){case 4:case 41:return function(e){const t=bS(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!ou(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 DS(t);case 6:case 273:case 33:case 132:return PS(t).toString();case 421:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return $l(r,"base58btc")}(t);case 444:case 445:return xS(t);case 466:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+$l(r,"base64url")}(t);default:return $l(t,"base16")}}function TS(e,t){switch(SS(e).code){case 4:case 41:return IS(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return NS(t);case 6:case 273:case 33:case 132:return RS(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?jc(mc.decode("z".concat(e))).bytes:el.parse(e).multihash.bytes;const r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(16!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion address."));const r=Vc.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=RS(n);return Jl([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(56!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion3 address."));const r=Vc.decode("b".concat(t[0])),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=RS(n);return Jl([r,i],r.length+i.length)}(t);case 466:return function(e){const t=kS.decode(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);default:return ru(t,"base16")}}const CS=Object.values(Vl).map((e=>e.decoder)),kS=function(){let e=CS[0].or(CS[1]);return CS.slice(2).forEach((t=>e=e.or(t))),e}();function IS(e){if(!ou(e))throw new Error("invalid ip address");return vS(e)}function RS(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function PS(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function NS(e){const t=ru(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}function DS(e){const t=Xl.decode(e);if((e=e.slice(Xl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return $l(e)}function xS(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=$l(t,"base32"),i=PS(r);return"".concat(n,":").concat(i)}function LS(e){return e.map((e=>{const t=qS(e);return null!=e[1]?[t.code,AS(t.code,e[1])]:[t.code]}))}function OS(e){return jS(Jl(e.map((e=>{const t=qS(e);let r=Uint8Array.from(Xl.encode(t.code));return e.length>1&&null!=e[1]&&(r=Jl([r,e[1]])),r}))))}function BS(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var r;return Xl.decode(t)+(null!==(r=Xl.decode.bytes)&&void 0!==r?r:0)}function MS(e){const t=[];let r=0;for(;r<e.length;){var n;const i=Xl.decode(e,r),o=null!==(n=Xl.decode.bytes)&&void 0!==n?n:0,s=BS(SS(i),e.slice(r+o));if(0===s){t.push([i]),r+=o;continue}const a=e.slice(r+o,r+o+s);if(r+=s+o,r>e.length)throw KS("Invalid address Uint8Array: "+$l(e,"base16"));t.push([i,a])}return t}function US(e){return function(e){const t=[];return e.map((e=>{const r=qS(e);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),VS(t.join("/"))}(LS(MS(e)))}function FS(e){const t=function(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=SS(i);if(0!==o.size){if(n++,n>=r.length)throw KS("invalid address: "+e);if(!0===o.path){t.push([i,VS(r.slice(n).join("/"))]);break}t.push([i,r[n]])}else t.push([i])}return t}(e=VS(e));return OS(t.map((e=>{Array.isArray(e)||(e=[e]);const t=qS(e);return e.length>1?[t.code,TS(t.code,e[1])]:[t.code]})))}function jS(e){const t=zS(e);if(null!=t)throw t;return Uint8Array.from(e)}function zS(e){try{MS(e)}catch(t){return t}}function VS(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function KS(e){return new Error("Error parsing address: "+e)}function qS(e){return SS(e[0])}const HS=Symbol.for("nodejs.util.inspect.custom"),GS=[SS("dns").code,SS("dns4").code,SS("dns6").code,SS("dnsaddr").code],WS=new Map,QS=Symbol.for("@multiformats/js-multiaddr/multiaddr");function YS(e){return Boolean(null===e||void 0===e?void 0:e[QS])}var $S=new WeakMap,XS=new WeakMap,JS=new WeakMap,ZS=new WeakMap;class eA{constructor(e){if(Xa(this,"bytes",void 0),ec(this,$S,{writable:!0,value:void 0}),ec(this,XS,{writable:!0,value:void 0}),ec(this,JS,{writable:!0,value:void 0}),ec(this,ZS,{writable:!0,value:void 0}),Xa(this,QS,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=jS(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=FS(e)}else{if(!YS(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=jS(e.bytes)}}toString(){return null==nc(this,$S)&&rc(this,$S,US(this.bytes)),nc(this,$S)}toJSON(){return this.toString()}toOptions(){let e,t,r,n,i="";const o=SS("tcp"),s=SS("udp"),a=SS("ip4"),c=SS("ip6"),l=SS("dns6"),u=SS("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),GS.includes(h)&&(t=o.name,n=443,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=SS(h).name,n=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=SS(h).name,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==r||null==n)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:r,transport:t,port:n}}protos(){return this.protoCodes().map((e=>Object.assign({},SS(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){var n;const i=Xl.decode(t,r),o=null!==(n=Xl.decode.bytes)&&void 0!==n?n:0;r+=BS(SS(i),t.slice(r+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==nc(this,XS)&&rc(this,XS,MS(this.bytes)),nc(this,XS)}stringTuples(){return null==nc(this,JS)&&rc(this,JS,LS(this.tuples())),nc(this,JS)}encapsulate(e){return e=new eA(e),new eA(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new eA(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new eA(OS(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===ES.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]?$l(mc.decode("z".concat(e)),"base58btc"):$l(el.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===nc(this,ZS))try{rc(this,ZS,this.stringTuples().filter((e=>!0===SS(e[0]).path))[0][1]),null==nc(this,ZS)&&rc(this,ZS,null)}catch{rc(this,ZS,null)}return nc(this,ZS)}equals(e){return cl(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const r=WS.get(t.name);if(null==r)throw new oc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this,e)).map((e=>new eA(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))}[HS](){return"Multiaddr(".concat(US(this.bytes),")")}}function tA(e){return new eA(e)}function rA(e,t){switch(t){case"udp":return rA(e,"udp4")||rA(e,"udp6");case"tcp":return rA(e,"tcp4")||rA(e,"tcp6")}const r=t.endsWith("6"),n=e.get(r?"ip6":"ip");if(!n)return;const i=t.slice(0,3);let o;switch(i){case"udp":o=r?e.get("udp6"):e.get("udp");break;case"tcp":o=r?e.get("tcp6"):e.get("tcp");break;default:return}return o?function(e,t,r,n){let i=tA("/"+e+"/"+AS(e,r));return i=i.encapsulate(tA("/"+t+"/"+AS(t,n))),i}(r?"ip6":"ip4",i,n,o):void 0}let nA;const iA=Symbol.for("nodejs.util.inspect.custom"),oA=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),sA=114,aA=36,cA=37;nA=Symbol.toStringTag;class lA{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[nA](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(sA,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:oA,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new hA({multihash:t}):e.startsWith("16U")?new dA({multihash:t}):new uA({multihash:t})}return function(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===aA)return new hA({multihash:t});if(t.digest.length===cA)return new dA({multihash:t})}if(t.code===Il.code)return new uA({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==sA)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new uA({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===aA)return new hA({multihash:e.multihash});if(t.digest.length===cA)return new dA({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(oA.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[iA](){return"PeerId(".concat(this.toString(),")")}}class uA extends lA{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class hA extends lA{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class dA extends lA{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function fA(e){return async function(e,t){return e.length===aA?new hA({multihash:Fc(Nl.code,e),privateKey:t}):e.length===cA?new dA({multihash:Fc(Nl.code,e),privateKey:t}):new uA({multihash:await Il.digest(e),publicKey:e,privateKey:t})}(new tv.secp256k1.Secp256k1PublicKey(e).bytes,void 0)}function pA(e){const t=e.reduce(((e,t)=>e+gS+t.bytes.length),0),r=new Uint8Array(t),n=new DataView(r.buffer);let i=0;return e.forEach((e=>{if(e.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");n.setUint16(i,e.bytes.length),i+=gS,r.set(e.bytes,i),i+=e.bytes.length})),r}function gA(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 yA extends Map{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:BigInt(1),r=arguments.length>2?arguments[2]:void 0;super(Object.entries(e)),Xa(this,"seq",void 0),Xa(this,"signature",void 0),this.seq=t,this.signature=r}set(e,t){return this.signature=void 0,this.seq++,super.set(e,t)}get id(){const e=this.get("id");if(!e)throw new Error("id not found.");return jf(e)}get publicKey(){if("v4"===this.id)return this.get("secp256k1");throw new Error(pS)}get ip(){return mA(this,"ip","ip4")}set ip(e){bA(this,"ip","ip4",e)}get tcp(){return vA(this,"tcp","tcp")}set tcp(e){wA(this,"tcp","tcp",e)}get udp(){return vA(this,"udp","udp")}set udp(e){wA(this,"udp","udp",e)}get ip6(){return mA(this,"ip6","ip6")}set ip6(e){bA(this,"ip6","ip6",e)}get tcp6(){return vA(this,"tcp6","tcp")}set tcp6(e){wA(this,"tcp6","tcp",e)}get udp6(){return vA(this,"udp6","udp")}set udp6(e){wA(this,"udp6","udp",e)}get multiaddrs(){const e=this.get("multiaddrs");if(e)return function(e){const t=[];let r=0;for(;r<e.length;){const n=new DataView(e.buffer,r,gS).getUint16(0);r+=gS;const i=e.slice(r,r+n);r+=n,t.push(tA(i))}return t}(e)}set multiaddrs(e){EA(this,"multiaddrs",e,pA)}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){EA(this,"waku2",e,(e=>new Uint8Array([gA(e)])))}}function mA(e,t,r){const n=e.get(t);if(n)return AS(r,n)}function vA(e,t,r){const n=e.get(t);if(n)return Number(AS(r,n))}function bA(e,t,r,n){EA(e,t,n,TS.bind({},r))}function wA(e,t,r,n){bA(e,t,r,null===n||void 0===n?void 0:n.toString(10))}function EA(e,t,r,n){void 0!==r?e.set(t,n(r)):e.delete(t)}const _A=Yu("waku:enr");var SA,AA;!function(e){e.TCP="tcp",e.UDP="udp"}(SA||(SA={})),function(e){e.TCP4="tcp4",e.UDP4="udp4",e.TCP6="tcp6",e.UDP6="udp6"}(AA||(AA={}));class TA extends yA{constructor(){super(...arguments),Xa(this,"peerId",void 0),Xa(this,"getLocationMultiaddr",rA.bind({},this))}static async create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:BigInt(1);const r=new TA(e,t,arguments.length>2?arguments[2]:void 0);try{const e=r.publicKey;e&&(r.peerId=await fA(e))}catch(n){_A("Could not calculate peer id for ENR",n)}return r}get nodeId(){if("v4"===this.id)return this.publicKey?function(e){const t=$y.fromHex(e).toRawBytes(!1);return Ff(dS(t.slice(1)))}(this.publicKey):void 0;throw new Error(pS)}setLocationMultiaddr(e){const t=e.protoNames();if(2!==t.length&&"udp"!==t[1]&&"tcp"!==t[1])throw new Error("Invalid multiaddr");const r=e.tuples();if(!r[0][1]||!r[1][1])throw new Error("Invalid multiaddr");4===r[0][0]?(this.set("ip",r[0][1]),this.set(t[1],r[1][1])):(this.set("ip6",r[0][1]),this.set(t[1]+"6",r[1][1]))}getAllLocationMultiaddrs(){var e;const t=[];for(const n of Object.values(AA)){const e=this.getLocationMultiaddr(n);e&&t.push(e)}const r=null!==(e=this.multiaddrs)&&void 0!==e?e:[];return t.concat(r)}get peerInfo(){const e=this.peerId;if(e)return{id:e,multiaddrs:this.getAllLocationMultiaddrs(),protocols:[]}}getFullMultiaddr(e){if(this.peerId){const t=this.getLocationMultiaddr(e);if(t)return t.encapsulate("/p2p/".concat(this.peerId.toString()))}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){const e=this.peerId;return this.multiaddrs.map((t=>t.encapsulate("/p2p/".concat(e.toString()))))}return[]}verify(e,t){if(!this.get("id")||"v4"!==this.id)throw new Error(pS);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return fS(t,dS(e),this.publicKey)}async sign(e,t){if("v4"!==this.id)throw new Error(pS);return this.signature=await async function(e,t){return Nm(dS(t),e,{der:!1})}(t,e),this.signature}}Xa(TA,"RECORD_PREFIX","enr:");let CA=!1,kA=!1;const IA={debug:1,default:2,info:2,warning:3,error:4,off:5};let RA=IA.default,PA=null;const NA=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var DA,xA;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(DA||(DA={})),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"}(xA||(xA={}));const LA="0123456789abcdef";class OA{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==IA[r]&&this.throwArgumentError("invalid log level name","logLevel",e),RA>IA[r]||console.log.apply(console,t)}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(OA.levels.DEBUG,t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(OA.levels.INFO,t)}warn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(OA.levels.WARNING,t)}makeError(e,t,r){if(kA)return this.makeError("censored error",t,{});t||(t=OA.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=LA[t[e]>>4],r+=LA[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(s){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push("code=".concat(t)),n.push("version=".concat(this.version));const i=e;let o="";switch(t){case xA.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 xA.CALL_EXCEPTION:case xA.INSUFFICIENT_FUNDS:case xA.MISSING_NEW:case xA.NONCE_EXPIRED:case xA.REPLACEMENT_UNDERPRICED:case xA.TRANSACTION_REPLACED:case xA.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const s=new Error(e);return s.reason=i,s.code=t,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,OA.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),NA&&this.throwError("platform missing String.prototype.normalize",OA.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:NA})}checkSafeUint53(e,t){"number"===typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,OA.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,OA.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,OA.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,OA.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",OA.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",OA.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",OA.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return PA||(PA=new OA("logger/5.7.0")),PA}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",OA.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),CA){if(!e)return;this.globalLogger().throwError("error censorship permanent",OA.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}kA=!!e,CA=!!t}static setLogLevel(e){const t=IA[e.toLowerCase()];null!=t?RA=t:OA.globalLogger().warn("invalid log level - "+e)}static from(e){return new OA(e)}}OA.errors=xA,OA.levels=DA;const BA=new OA("bytes/5.7.0");function MA(e){return!!e.toHexString}function UA(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return UA(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function FA(e){return KA(e)&&!(e.length%2)||zA(e)}function jA(e){return"number"===typeof e&&e==e&&e%1===0}function zA(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!jA(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!jA(r)||r<0||r>=256)return!1}return!0}function VA(e,t){if(t||(t={}),"number"===typeof e){BA.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),UA(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),MA(e)&&(e=e.toHexString()),KA(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":BA.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return UA(new Uint8Array(n))}return zA(e)?UA(new Uint8Array(e)):BA.throwArgumentError("invalid arrayify value","value",e)}function KA(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const qA="0123456789abcdef";function HA(e,t){if(t||(t={}),"number"===typeof e){BA.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=qA[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),MA(e))return e.toHexString();if(KA(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":BA.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(zA(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=qA[(240&n)>>4]+qA[15&n]}return t}return BA.throwArgumentError("invalid hexlify value","value",e)}const GA=new OA("rlp/5.7.0");function WA(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function QA(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function YA(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(YA(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=WA(t.length);return r.unshift(247+r.length),r.concat(t)}FA(e)||GA.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(VA(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=WA(t.length);return r.unshift(183+r.length),r.concat(t)}function $A(e){return HA(YA(e))}function XA(e,t,r,n){const i=[];for(;r<t+1+n;){const o=JA(e,r);i.push(o.result),(r+=o.consumed)>t+1+n&&GA.throwError("child data too short",OA.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function JA(e,t){if(0===e.length&&GA.throwError("data too short",OA.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&GA.throwError("data short segment too short",OA.errors.BUFFER_OVERRUN,{});const n=QA(e,t+1,r);return t+1+r+n>e.length&&GA.throwError("data long segment too short",OA.errors.BUFFER_OVERRUN,{}),XA(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&GA.throwError("data array too short",OA.errors.BUFFER_OVERRUN,{}),XA(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&GA.throwError("data array too short",OA.errors.BUFFER_OVERRUN,{});const n=QA(e,t+1,r);t+1+r+n>e.length&&GA.throwError("data array too short",OA.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:HA(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&GA.throwError("data too short",OA.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:HA(e.slice(t+1,t+1+r))}}return{consumed:1,result:HA(e[t])}}class ZA{static fromString(e){if(!e.startsWith(TA.RECORD_PREFIX))throw new Error("\"string encoded ENR must start with '".concat(TA.RECORD_PREFIX,"'"));return ZA.fromRLP(ru(e.slice(4),"base64url"))}static fromRLP(e){const t=function(e){const t=VA(e),r=JA(t,0);return r.consumed!==t.length&&GA.throwArgumentError("invalid rlp data","data",e),r.result}(e).map(Uf);return async function(e){const{signature:t,seq:r,kvs:n}=function(e){if(!Array.isArray(e))throw new Error("Decoded ENR must be an array");if(e.length%2!==0)throw new Error("Decoded ENR must have an even number of elements");const[t,r,...n]=e;if(!t||Array.isArray(t))throw new Error("Decoded ENR invalid signature: must be a byte array");if(!r||Array.isArray(r))throw new Error("Decoded ENR invalid sequence number: must be a byte array");return{signature:t,seq:r,kvs:n}}(e),i={};for(let c=0;c<n.length;c+=2)try{i[jf(n[c])]=n[c+1]}catch(a){(0,Yu.log)("Failed to decode ENR key to UTF-8, skipping it",n[c],a)}const o=function(e){return e.length?BigInt("0x"+Ff(e)):BigInt(0)}(r),s=await TA.create(i,o,t);return function(e,t,r,n){const i=Uf($A([e,...t]));if(!r.verify(i,n))throw new Error("Unable to verify ENR signature")}(r,n,s,t),s}(t)}}const eT=/^(\d{1,3}\.){3,3}\d{1,3}$/,tT=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,rT={name:"v4",size:4,isFormat:e=>eT.test(e),encode(e,t,r){r=~~r,t=t||new Uint8Array(r+4);const n=e.length;let i=0;for(let o=0;o<n;){const n=e.charCodeAt(o++);46===n?(t[r++]=i,i=0):i=10*i+(n-48)}return t[r]=i,t},decode:(e,t)=>(t=~~t,"".concat(e[t++],".").concat(e[t++],".").concat(e[t++],".").concat(e[t]))},nT={name:"v6",size:16,isFormat:e=>e.length>0&&tT.test(e),encode(e,t,r){let n=(r=~~r)+16,i=-1,o=0,s=0,a=!0,c=!1;t=t||new Uint8Array(r+16);for(let l=0;l<e.length;l++){let u=e.charCodeAt(l);58===u?(a?-1!==i?(r<n&&(t[r]=0),r<n-1&&(t[r+1]=0),r+=2):r<n&&(i=r):(!0===c?(r<n&&(t[r]=s),r++):(r<n&&(t[r]=o>>8),r<n-1&&(t[r+1]=255&o),r+=2),o=0,s=0),a=!0,c=!1):46===u?(r<n&&(t[r]=s),r++,s=0,o=0,a=!1,c=!0):(a=!1,u>=97?u-=87:u>=65?u-=55:(u-=48,s=10*s+u),o=(o<<4)+u)}if(!1===a)!0===c?(r<n&&(t[r]=s),r++):(r<n&&(t[r]=o>>8),r<n-1&&(t[r+1]=255&o),r+=2);else if(0===i)r<n&&(t[r]=0),r<n-1&&(t[r+1]=0),r+=2;else if(-1!==i){r+=2;for(let e=Math.min(r-1,n-1);e>=i+2;e--)t[e]=t[e-2];t[i]=0,t[i+1]=0,i=r}if(i!==r&&-1!==i)for(r>n-2&&(r=n-2);n>i;)t[--n]=r<n&&r>i?t[--r]:0;else for(;r<n;)t[r++]=0;return t},decode(e,t){t=~~t;let r="";for(let n=0;n<16;n+=2)0!==n&&(r+=":"),r+=(e[t+n]<<8|e[t+n+1]).toString(16);return r.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};function iT(e){if(rT.isFormat(e))return rT.size;if(nT.isFormat(e))return nT.size;throw Error("Invalid ip address: ".concat(e))}function oT(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 sT(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 aT(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 cT(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 lT(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 uT(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 hT(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 dT=55296,fT=56320;function pT(e){let t=0;const r=e.length;for(let n=0;n<r;n+=1){const i=e.charCodeAt(n);if(i<=127)t+=1;else if(i<=2047)t+=2;else if((63488&i)!==dT)t+=3;else{const o=n+1;if(o===r||i>=fT)t+=3;else{(64512&e.charCodeAt(o))!==fT?t+=3:(n=o,t+=4)}}}return t}function gT(e,t,r){const n=e.length;void 0!==r&&null!==r||(r=0),void 0===t&&(t=new Uint8Array(pT(e)+r));let i=r;for(let o=0;o<n;o+=1){let r=e.charCodeAt(o);if(r<=127)t[i++]=r;else if(r<=2047)t[i++]=192|(1984&r)>>6,t[i++]=128|63&r;else if((63488&r)!==dT)t[i++]=224|(61440&r)>>12,t[i++]=128|(4032&r)>>6,t[i++]=128|63&r;else{const s=o+1;if(s===n||r>=fT)t[i++]=239,t[i++]=191,t[i++]=189;else{const n=e.charCodeAt(s);(64512&n)!==fT?(t[i++]=239,t[i++]=191,t[i++]=189):(o=s,r=65536|(1023&r)<<10|1023&n,t[i++]=240|(1835008&r)>>18,t[i++]=128|(258048&r)>>12,t[i++]=128|(4032&r)>>6,t[i++]=128|63&r)}}}return gT.bytes=i-r,t}function yT(e,t,r){let n="";void 0!==t&&null!==t||(t=0),void 0!==r&&null!==r||(r=e.length);for(let i=t;i<r;){const t=e[i++];let r;if(t<=128)r=t;else if(t>191&&t<224)r=(31&t)<<6|63&e[i++];else if(t>239&&t<365){r=((7&t)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536;const o=dT|r>>10&1023;n+=String.fromCharCode(o),r=fT|1023&r}else r=(15&t)<<12|(63&e[i++])<<6|63&e[i++];n+=String.fromCharCode(r)}return yT.bytes=r-t,n}gT.bytes=0,yT.bytes=0;const mT=e=>e instanceof Uint8Array;function vT(e){return"string"===typeof e?pT(e):e.byteLength}function bT(e){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):gT(e)}function wT(e,t,r){if("string"!==typeof t)throw new Error("unknown input type");return gT(t,e,r),gT.bytes}const ET=Math.pow(2,24),_T=Math.pow(2,16),ST=Math.pow(2,8),AT=(e,t)=>e[t]*ET+e[t+1]*_T+e[t+2]*ST+e[t+3],TT=(e,t)=>e[t]<<8|e[t+1],CT=(e,t,r)=>(t=+t,e[r+3]=t,t>>>=8,e[r+2]=t,t>>>=8,e[r+1]=t,t>>>=8,e[r]=t,r+4),kT=(e,t,r)=>(e[r]=t>>8,e[r+1]=255&t,r+2);function IT(e,t,r,n,i){return r<0&&(n-=r,r=0),n<0&&(n=0),i<0?new Uint8Array(0):r>=t.length||n>=i?0:function(e,t,r,n,i){i-n>t.length-r&&(i=n+t.length-r);let o=i-n;const s=e.length-n;o>s&&(o=s);(0!==n||i<e.length)&&(e=new Uint8Array(e.buffer,e.byteOffset+n,o));return t.set(e,r),o}(e,t,r,n,i)}const RT=32768;function PT(e){let{bytes:t=0,encode:r,decode:n,encodingLength:i}=e;return r.bytes=t,n.bytes=t,{encode:r,decode:n,encodingLength:i||(()=>t)}}const NT=PT({encode(e,t,r){t||(t=new Uint8Array(NT.encodingLength(e))),r||(r=0);const n=r,i=e.replace(/^\.|\.$/gm,"");if(i.length){const e=i.split(".");for(let n=0;n<e.length;n++){const i=wT(t,e[n],r+1);t[r]=i,r+=i+1}}return t[r++]=0,NT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=[];let n=t,i=0,o=0,s=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");const a=e[t++];if(o+=s?0:1,0===a)break;if(0===(192&a)){if(t+a>e.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=a+1,i>254)throw new Error("Cannot decode name (name too long)");r.push(yT(e,t,t+a)),t+=a,o+=s?0:a}else{if(192!==(192&a))throw new Error("Cannot decode name (bad label)");{if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");const r=TT(e,t-1)-49152;if(r>=n)throw new Error("Cannot decode name (bad pointer)");t=r,n=r,o+=s?0:1,s=!0}}}return NT.decode.bytes=o,0===r.length?".":r.join(".")},encodingLength:e=>"."===e||".."===e?1:vT(e.replace(/^\.|\.$/gm,""))+2}),DT=PT({encode(e,t,r){t||(t=new Uint8Array(DT.encodingLength(e))),r||(r=0);const n=wT(t,e,r+1);return t[r]=n,DT.encode.bytes=n+1,t},decode(e,t){t||(t=0);const r=e[t],n=yT(e,t+1,t+1+r);return DT.decode.bytes=r+1,n},encodingLength:e=>vT(e)+1}),xT=PT({bytes:12,encode(e,t,r){t||(t=new Uint8Array(xT.encodingLength(e))),r||(r=0);const n=32767&(e.flags||0),i="response"===e.type?32768:0;return kT(t,e.id||0,r),kT(t,n|i,r+2),kT(t,e.questions.length,r+4),kT(t,e.answers.length,r+6),kT(t,e.authorities.length,r+8),kT(t,e.additionals.length,r+10),t},decode(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const r=TT(e,t+2);return{id:TT(e,t),type:32768&r?"response":"query",flags:32767&r,flag_qr:1===(r>>15&1),opcode:cT(r>>11&15),flag_aa:1===(r>>10&1),flag_tc:1===(r>>9&1),flag_rd:1===(r>>8&1),flag_ra:1===(r>>7&1),flag_z:1===(r>>6&1),flag_ad:1===(r>>5&1),flag_cd:1===(r>>4&1),rcode:aT(15&r),questions:new Array(TT(e,t+4)),answers:new Array(TT(e,t+6)),authorities:new Array(TT(e,t+8)),additionals:new Array(TT(e,t+10))}},encodingLength:()=>12}),LT=PT({encode(e,t,r){t||(t=new Uint8Array(LT.encodingLength(e))),r||(r=0);const n=e.length;return kT(t,n,r),IT(e,t,r+2,0,n),LT.encode.bytes=n+2,t},decode(e,t){t||(t=0);const r=TT(e,t),n=e.slice(t+2,t+2+r);return LT.decode.bytes=r+2,n},encodingLength:e=>e.length+2}),OT=PT({encode:(e,t,r)=>(t||(t=new Uint8Array(OT.encodingLength(e))),r||(r=0),NT.encode(e,t,r+2),kT(t,NT.encode.bytes,r),OT.encode.bytes=NT.encode.bytes+2,t),decode(e,t){t||(t=0);const r=TT(e,t),n=NT.decode(e,t+2);return OT.decode.bytes=r+2,n},encodingLength:e=>NT.encodingLength(e)+2}),BT=PT({encode(e,t,r){t||(t=new Uint8Array(BT.encodingLength(e))),r||(r=0);const n=r;return r+=2,NT.encode(e.mname,t,r),r+=NT.encode.bytes,NT.encode(e.rname,t,r),r+=NT.encode.bytes,CT(t,e.serial||0,r),r+=4,CT(t,e.refresh||0,r),r+=4,CT(t,e.retry||0,r),r+=4,CT(t,e.expire||0,r),r+=4,CT(t,e.minimum||0,r),kT(t,(r+=4)-n-2,n),BT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.mname=NT.decode(e,t),t+=NT.decode.bytes,n.rname=NT.decode(e,t),t+=NT.decode.bytes,n.serial=AT(e,t),t+=4,n.refresh=AT(e,t),t+=4,n.retry=AT(e,t),t+=4,n.expire=AT(e,t),t+=4,n.minimum=AT(e,t),t+=4,BT.decode.bytes=t-r,n},encodingLength:e=>22+NT.encodingLength(e.mname)+NT.encodingLength(e.rname)}),MT=PT({encode(e,t,r){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)if("string"===typeof e[i]&&(e[i]=bT(e[i])),!mT(e[i]))throw new Error("Must be a Buffer");t||(t=new Uint8Array(MT.encodingLength(e))),r||(r=0);const n=r;return r+=2,e.forEach((function(e){t[r++]=e.length,IT(e,t,r,0,e.length),r+=e.length})),kT(t,r-n-2,n),MT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t;let n=TT(e,t);t+=2;const i=[];for(;n>0;){const r=e[t++];if(--n,n<r)throw new Error("Buffer overflow");i.push(e.slice(t,t+r)),t+=r,n-=r}return MT.decode.bytes=t-r,i},encodingLength(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach((function(e){t+="string"===typeof e?vT(e)+1:e.length+1})),t}}),UT=PT({encode(e,t,r){t||(t=new Uint8Array(UT.encodingLength(e))),r||(r=0),"string"===typeof e&&(e=bT(e)),e||(e=new Uint8Array(0));const n=r;r+=2;const i=e.length;return IT(e,t,r,0,i),kT(t,(r+=i)-n-2,n),UT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n=TT(e,t);t+=2;const i=e.slice(t,t+n);return t+=n,UT.decode.bytes=t-r,i},encodingLength:e=>e?(mT(e)?e.length:vT(e))+2:2}),FT=PT({encode(e,t,r){t||(t=new Uint8Array(FT.encodingLength(e))),r||(r=0);const n=r;return r+=2,DT.encode(e.cpu,t,r),r+=DT.encode.bytes,DT.encode(e.os,t,r),r+=DT.encode.bytes,kT(t,r-n-2,n),FT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.cpu=DT.decode(e,t),t+=DT.decode.bytes,n.os=DT.decode(e,t),t+=DT.decode.bytes,FT.decode.bytes=t-r,n},encodingLength:e=>DT.encodingLength(e.cpu)+DT.encodingLength(e.os)+2}),jT=PT({encode:(e,t,r)=>(t||(t=new Uint8Array(jT.encodingLength(e))),r||(r=0),NT.encode(e,t,r+2),kT(t,NT.encode.bytes,r),jT.encode.bytes=NT.encode.bytes+2,t),decode(e,t){t||(t=0);const r=NT.decode(e,t+2);return jT.decode.bytes=NT.decode.bytes+2,r},encodingLength:e=>NT.encodingLength(e)+2}),zT=PT({encode(e,t,r){t||(t=new Uint8Array(zT.encodingLength(e))),r||(r=0),kT(t,e.priority||0,r+2),kT(t,e.weight||0,r+4),kT(t,e.port||0,r+6),NT.encode(e.target,t,r+8);const n=NT.encode.bytes+6;return kT(t,n,r),zT.encode.bytes=n+2,t},decode(e,t){t||(t=0);const r=TT(e,t),n={};return n.priority=TT(e,t+2),n.weight=TT(e,t+4),n.port=TT(e,t+6),n.target=NT.decode(e,t+8),zT.decode.bytes=r+2,n},encodingLength:e=>8+NT.encodingLength(e.target)}),VT=PT({encode(e,t,r){const n=VT.encodingLength(e);return t||(t=new Uint8Array(VT.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=VT.ISSUER_CRITICAL),kT(t,n-2,r),t[r+=2]=e.flags||0,r+=1,DT.encode(e.tag,t,r),r+=DT.encode.bytes,wT(t,e.value,r),r+=vT(e.value),VT.encode.bytes=n,t},decode(e,t){t||(t=0);const r=TT(e,t),n=t+=2,i={};return i.flags=e[t],t+=1,i.tag=DT.decode(e,t),t+=DT.decode.bytes,i.value=yT(e,t,n+r),i.issuerCritical=!!(i.flags&VT.ISSUER_CRITICAL),VT.decode.bytes=r+2,i},encodingLength:e=>DT.encodingLength(e.tag)+DT.encodingLength(e.value)+2});VT.ISSUER_CRITICAL=128;const KT=PT({encode(e,t,r){t||(t=new Uint8Array(KT.encodingLength(e))),r||(r=0);const n=r;return r+=2,kT(t,e.preference||0,r),r+=2,NT.encode(e.exchange,t,r),r+=NT.encode.bytes,kT(t,r-n-2,n),KT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.preference=TT(e,t),t+=2,n.exchange=NT.decode(e,t),t+=NT.decode.bytes,KT.decode.bytes=t-r,n},encodingLength:e=>4+NT.encodingLength(e.exchange)}),qT=PT({encode:(e,t,r)=>(t||(t=new Uint8Array(qT.encodingLength(e))),r||(r=0),kT(t,4,r),r+=2,rT.encode(e,t,r),t),decode(e,t){t||(t=0),t+=2;return rT.decode(e,t)},bytes:6}),HT=PT({encode:(e,t,r)=>(t||(t=new Uint8Array(HT.encodingLength(e))),r||(r=0),kT(t,16,r),r+=2,nT.encode(e,t,r),HT.encode.bytes=18,t),decode(e,t){t||(t=0),t+=2;const r=nT.decode(e,t);return HT.decode.bytes=18,r},bytes:18}),GT=e=>new Uint8Array(e),WT=PT({encode(e,t,r){t||(t=new Uint8Array(WT.encodingLength(e))),r||(r=0);const n=r,i=hT(e.code);if(kT(t,i,r),r+=2,e.data)kT(t,e.data.length,r),r+=2,IT(e.data,t,r),r+=e.data.length;else switch(i){case 8:{const n=e.sourcePrefixLength||0,i=e.family||function(e){return iT(e)===rT.size?1:2}(e.ip),o=function(e,t,r){r=~~r;const n=iT(e);return"function"===typeof t&&(t=t(r+n)),n===rT.size?rT.encode(e,t,r):nT.encode(e,t,r)}(e.ip,GT),s=Math.ceil(n/8);kT(t,s+4,r),kT(t,i,r+=2),r+=2,t[r++]=n,t[r++]=e.scopePrefixLength||0,IT(o,t,r,0,s),r+=s}break;case 11:e.timeout?(kT(t,2,r),r+=2,kT(t,e.timeout,r),r+=2):(kT(t,0,r),r+=2);break;case 12:{const n=e.length||0;kT(t,n,r),r+=2,t.fill(0,r,r+n),r+=n}break;case 14:{const n=2*e.tags.length;kT(t,n,r),r+=2;for(const i of e.tags)kT(t,i,r),r+=2}break;default:throw new Error("Unknown roption code: ".concat(e.code))}return WT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r={};r.code=TT(e,t),r.type=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:"OPTION_".concat(e)}(r.code);const n=TT(e,t+=2);switch(t+=2,r.data=e.slice(t,t+n),r.code){case 8:r.family=TT(e,t),t+=2,r.sourcePrefixLength=e[t++],r.scopePrefixLength=e[t++];{const i=new Uint8Array(1===r.family?4:16);IT(e,i,0,t,t+n-4),r.ip=function(e,t,r){if(t=~~t,(r=r||e.length-t)===rT.size)return rT.decode(e,t,r);if(r===nT.size)return nT.decode(e,t,r);throw Error("Invalid buffer size needs to be ".concat(rT.size," for v4 or ").concat(nT.size," for v6."))}(i)}break;case 11:n>0&&(r.timeout=TT(e,t),t+=2);break;case 14:r.tags=[];for(let i=0;i<n;i+=2)r.tags.push(TT(e,t)),t+=2}return WT.decode.bytes=n+4,r},encodingLength(e){if(e.data)return e.data.length+4;switch(hT(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))}}),QT=PT({encode(e,t,r){t||(t=new Uint8Array(QT.encodingLength(e))),r||(r=0);const n=r,i=fC(e,WT);return kT(t,i,r),r=pC(e,WT,t,r+2),QT.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r=t,n=[];let i=TT(e,t);t+=2;let o=0;for(;i>0;)n[o++]=WT.decode(e,t),t+=WT.decode.bytes,i-=WT.decode.bytes;return QT.decode.bytes=t-r,n},encodingLength:e=>2+fC(e||[],WT)}),YT=PT({encode(e,t,r){t||(t=new Uint8Array(YT.encodingLength(e))),r||(r=0);const n=r,i=e.key;if(!mT(i))throw new Error("Key must be a Buffer");return r+=2,kT(t,e.flags,r),t[r+=2]=YT.PROTOCOL_DNSSEC,t[r+=1]=e.algorithm,IT(i,t,r+=1,0,i.length),r+=i.length,YT.encode.bytes=r-n,kT(t,YT.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=TT(e,t);if(t+=2,n.flags=TT(e,t),e[t+=2]!==YT.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e[t],t+=1,n.key=e.slice(t,r+i+2),t+=n.key.length,YT.decode.bytes=t-r,n},encodingLength:e=>6+vT(e.key)});YT.PROTOCOL_DNSSEC=3,YT.ZONE_KEY=128,YT.SECURE_ENTRYPOINT=32768;const $T=PT({encode(e,t,r){t||(t=new Uint8Array($T.encodingLength(e))),r||(r=0);const n=r,i=e.signature;if(!mT(i))throw new Error("Signature must be a Buffer");return r+=2,kT(t,sT(e.typeCovered),r),t[r+=2]=e.algorithm,t[r+=1]=e.labels,r+=1,CT(t,e.originalTTL,r),r+=4,CT(t,e.expiration,r),r+=4,CT(t,e.inception,r),r+=4,kT(t,e.keyTag,r),r+=2,NT.encode(e.signersName,t,r),IT(i,t,r+=NT.encode.bytes,0,i.length),r+=i.length,$T.encode.bytes=r-n,kT(t,$T.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=TT(e,t);return t+=2,n.typeCovered=oT(TT(e,t)),t+=2,n.algorithm=e[t],t+=1,n.labels=e[t],t+=1,n.originalTTL=AT(e,t),t+=4,n.expiration=AT(e,t),t+=4,n.inception=AT(e,t),t+=4,n.keyTag=TT(e,t),t+=2,n.signersName=NT.decode(e,t),t+=NT.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,$T.decode.bytes=t-r,n},encodingLength:e=>20+NT.encodingLength(e.signersName)+vT(e.signature)}),XT=PT({encode(e,t,r){t||(t=new Uint8Array(XT.encodingLength(e))),r||(r=0);const n=r;return r+=2,NT.encode(e.mbox||".",t,r),r+=NT.encode.bytes,NT.encode(e.txt||".",t,r),r+=NT.encode.bytes,XT.encode.bytes=r-n,kT(t,XT.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={};return t+=2,n.mbox=NT.decode(e,t)||".",t+=NT.decode.bytes,n.txt=NT.decode(e,t)||".",t+=NT.decode.bytes,XT.decode.bytes=t-r,n},encodingLength:e=>2+NT.encodingLength(e.mbox||".")+NT.encodingLength(e.txt||".")}),JT=PT({encode(e,t,r){t||(t=new Uint8Array(JT.encodingLength(e))),r||(r=0);const n=r,i=[];for(let o=0;o<e.length;o++){const t=sT(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=bT(i[o]);t[r]=o,t[r+=1]=e.length,IT(e,t,r+=1,0,e.length),r+=e.length}return JT.encode.bytes=r-n,t},decode(e,t,r){t||(t=0);const n=t,i=[];for(;t-n<r;){const r=e[t],n=e[t+=1];t+=1;for(let o=0;o<n;o++){const n=e[t+o];for(let e=0;e<8;e++)if(n&1<<7-e){const t=oT(r<<8|o<<3|e);i.push(t)}}t+=n}return JT.decode.bytes=t-n,i},encodingLength(e){const t=[];for(let n=0;n<e.length;n++){const r=sT(e[n]);t[r>>8]=Math.max(t[r>>8]||0,255&r)}let r=0;for(let n=0;n<t.length;n++)void 0!==t[n]&&(r+=2+Math.ceil((t[n]+1)/8));return r}}),ZT=PT({encode(e,t,r){t||(t=new Uint8Array(ZT.encodingLength(e))),r||(r=0);const n=r;return r+=2,NT.encode(e.nextDomain,t,r),r+=NT.encode.bytes,JT.encode(e.rrtypes,t,r),r+=JT.encode.bytes,ZT.encode.bytes=r-n,kT(t,ZT.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=TT(e,t);return t+=2,n.nextDomain=NT.decode(e,t),t+=NT.decode.bytes,n.rrtypes=JT.decode(e,t,i-(t-r)),t+=JT.decode.bytes,ZT.decode.bytes=t-r,n},encodingLength:e=>2+NT.encodingLength(e.nextDomain)+JT.encodingLength(e.rrtypes)}),eC=PT({encode(e,t,r){t||(t=new Uint8Array(eC.encodingLength(e))),r||(r=0);const n=r,i=e.salt;if(!mT(i))throw new Error("salt must be a Buffer");const o=e.nextDomain;if(!mT(o))throw new Error("nextDomain must be a Buffer");return t[r+=2]=e.algorithm,t[r+=1]=e.flags,r+=1,kT(t,e.iterations,r),t[r+=2]=i.length,IT(i,t,r+=1,0,i.length),t[r+=i.length]=o.length,IT(o,t,r+=1,0,o.length),r+=o.length,JT.encode(e.rrtypes,t,r),r+=JT.encode.bytes,eC.encode.bytes=r-n,kT(t,eC.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=TT(e,t);t+=2,n.algorithm=e[t],t+=1,n.flags=e[t],t+=1,n.iterations=TT(e,t);const o=e[t+=2];t+=1,n.salt=e.slice(t,t+o);const s=e[t+=o];return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=JT.decode(e,t,i-(t-r)),t+=JT.decode.bytes,eC.decode.bytes=t-r,n},encodingLength:e=>8+e.salt.length+e.nextDomain.length+JT.encodingLength(e.rrtypes)}),tC=PT({encode(e,t,r){t||(t=new Uint8Array(tC.encodingLength(e))),r||(r=0);const n=r,i=e.digest;if(!mT(i))throw new Error("Digest must be a Buffer");return r+=2,kT(t,e.keyTag,r),t[r+=2]=e.algorithm,t[r+=1]=e.digestType,IT(i,t,r+=1,0,i.length),r+=i.length,tC.encode.bytes=r-n,kT(t,tC.encode.bytes-2,n),t},decode(e,t){t||(t=0);const r=t,n={},i=TT(e,t);return t+=2,n.keyTag=TT(e,t),t+=2,n.algorithm=e[t],t+=1,n.digestType=e[t],t+=1,n.digest=e.slice(t,r+i+2),t+=n.digest.length,tC.decode.bytes=t-r,n},encodingLength:e=>6+vT(e.digest)});function rC(e){switch(e.toUpperCase()){case"A":return qT;case"PTR":case"CNAME":case"DNAME":return jT;case"TXT":return MT;case"NULL":return UT;case"AAAA":return HT;case"SRV":return zT;case"HINFO":return FT;case"CAA":return VT;case"NS":return OT;case"SOA":return BT;case"MX":return KT;case"OPT":return QT;case"DNSKEY":return YT;case"RRSIG":return $T;case"RP":return XT;case"NSEC":return ZT;case"NSEC3":return eC;case"DS":return tC}return LT}const nC=PT({encode(e,t,r){t||(t=new Uint8Array(nC.encodingLength(e))),r||(r=0);const n=r;if(NT.encode(e.name,t,r),r+=NT.encode.bytes,kT(t,sT(e.type),r),"OPT"===e.type.toUpperCase()){if("."!==e.name)throw new Error("OPT name must be root.");kT(t,e.udpPayloadSize||4096,r+2),t[r+4]=e.extendedRcode||0,t[r+5]=e.ednsVersion||0,kT(t,e.flags||0,r+6),r+=8,QT.encode(e.options||[],t,r),r+=QT.encode.bytes}else{let n=uT(void 0===e.class?"IN":e.class);e.flush&&(n|=RT),kT(t,n,r+2),CT(t,e.ttl||0,r+4),r+=8;const i=rC(e.type);i.encode(e.data,t,r),r+=i.encode.bytes}return nC.encode.bytes=r-n,t},decode(e,t){t||(t=0);const r={},n=t;if(r.name=NT.decode(e,t),t+=NT.decode.bytes,r.type=oT(TT(e,t)),"OPT"===r.type)r.udpPayloadSize=TT(e,t+2),r.extendedRcode=e[t+4],r.ednsVersion=e[t+5],r.flags=TT(e,t+6),r.flag_do=1===(r.flags>>15&1),r.options=QT.decode(e,t+8),t+=8+QT.decode.bytes;else{const n=TT(e,t+2);r.ttl=AT(e,t+4),r.class=lT(-32769&n),r.flush=!!(n&RT);const i=rC(r.type);r.data=i.decode(e,t+8),t+=8+i.decode.bytes}return nC.decode.bytes=t-n,r},encodingLength(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return NT.encodingLength(e.name)+8+rC(e.type).encodingLength(t)}}),iC=PT({encode(e,t,r){t||(t=new Uint8Array(iC.encodingLength(e))),r||(r=0);const n=r;return NT.encode(e.name,t,r),r+=NT.encode.bytes,kT(t,sT(e.type),r),r+=2,kT(t,uT(void 0===e.class?"IN":e.class),r),r+=2,iC.encode.bytes=r-n,e},decode(e,t){t||(t=0);const r=t,n={};n.name=NT.decode(e,t),t+=NT.decode.bytes,n.type=oT(TT(e,t)),t+=2,n.class=lT(TT(e,t)),t+=2;return!!(32768&n.class)&&(n.class&=-32769),iC.decode.bytes=t-r,n},encodingLength:e=>NT.encodingLength(e.name)+4}),oC=256,sC={encode:function(e,t,r){const n=!t;n&&(t=new Uint8Array(dC(e))),r||(r=0);const i=r;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),xT.encode(e,t,r),r+=xT.encode.bytes,r=pC(e.questions,iC,t,r),r=pC(e.answers,nC,t,r),r=pC(e.authorities,nC,t,r),r=pC(e.additionals,nC,t,r),sC.encode.bytes=r-i,n&&uC.bytes!==t.length?t.slice(0,uC.bytes):t},decode:function(e,t){t||(t=0);const r=t,n=xT.decode(e,t);return t+=xT.decode.bytes,t=gC(n.questions,iC,e,t),t=gC(n.answers,nC,e,t),t=gC(n.authorities,nC,e,t),t=gC(n.additionals,nC,e,t),sC.decode.bytes=t-r,n},encodingLength:function(e){return xT.encodingLength(e)+fC(e.questions||[],iC)+fC(e.answers||[],nC)+fC(e.authorities||[],nC)+fC(e.additionals||[],nC)}};function aC(e,t){if(e.questions)throw new Error("Only one .question object expected instead of a .questions array!");const r=Object.assign({type:t},e);return r.question&&(r.questions=[r.question],delete r.question),r}sC.encode.bytes=0,sC.decode.bytes=0;const cC={encode:function(e,t,r){return t=sC.encode(aC(e,"query"),t,r),cC.encode.bytes=sC.encode.bytes,t},decode:function(e,t){const r=sC.decode(e,t);return cC.decode.bytes=sC.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(e){return sC.encodingLength(aC(e,"query"))}};cC.encode.bytes=0,cC.decode.bytes=0;const lC={encode:function(e,t,r){return t=sC.encode(aC(e,"response"),t,r),lC.encode.bytes=sC.encode.bytes,t},decode:function(e,t){const r=sC.decode(e,t);return lC.decode.bytes=sC.decode.bytes,r.questions&&(r.question=r.questions[0],delete r.questions),r},encodingLength:function(e){return sC.encodingLength(aC(e,"response"))}};lC.encode.bytes=0,lC.decode.bytes=0;const uC=sC.encode,hC=sC.decode,dC=sC.encodingLength;function fC(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function pC(e,t,r,n){for(let i=0;i<e.length;i++)t.encode(e[i],r,n),n+=t.encode.bytes;return n}function gC(e,t,r,n){for(let i=0;i<e.length;i++)e[i]=t.decode(r,n),n+=t.decode.bytes;return n}const yC=1;function mC(e,t,r,n){if(64!==t.length)throw new Error("Charset needs to be 64 characters long! (".concat(t.length,")"));const i=new Uint8Array(256),o=new Uint8Array(64);for(let c=0;c<64;c+=1){const e=t.charCodeAt(c);if(e>255)throw new Error("Character #".concat(c," in charset [code=").concat(e,", char=").concat(t.charAt(c),"] is too high! (max=255)"));if(0!==i[e])throw new Error("Character [code=".concat(e,", char=").concat(t.charAt(c),"] is more than once in the charset!"));i[e]=c,o[c]=e}const s=r.charCodeAt(0),a={name:e,encodingLength(e){const t=e.length,r=.75*t|0;return e.charCodeAt(t-1)===s?e.charCodeAt(t-2)===s?r-2:r-1:r},encode(e,t,r){null!==t&&void 0!==t||(t=new Uint8Array(a.encodingLength(e))),null!==r&&void 0!==r||(r=0);let n=e.length;e.charCodeAt(n-1)===s&&(e.charCodeAt(n-2)===s?n-=2:n-=1);const o=n%4,c=n-o;let l=r,u=0;for(;u<c;){const r=i[e.charCodeAt(u)]<<18|i[e.charCodeAt(u+1)]<<12|i[e.charCodeAt(u+2)]<<6|i[e.charCodeAt(u+3)];t[l++]=r>>16,t[l++]=r>>8,t[l++]=r,u+=4}if(3===o){const r=i[e.charCodeAt(u)]<<10|i[e.charCodeAt(u+1)]<<4|i[e.charCodeAt(u+2)]>>2;t[l++]=r>>8,t[l++]=r}else 2===o&&(t[l++]=i[e.charCodeAt(u)]<<2|i[e.charCodeAt(u+1)]>>4);return a.encode.bytes=l-r,t},decode(e,t,r){null!==t&&void 0!==t||(t=0),null!==r&&void 0!==r||(r=e.length);const i=r-t,c=i%3,l=t+i-c,u=[];for(let n=t;n<l;n+=3){const t=e[n]<<16|e[n+1]<<8|e[n+2];u.push(o[t>>18&63],o[t>>12&63],o[t>>6&63],o[63&t])}if(2===c){const t=(e[r-2]<<8)+e[r-1];u.push(o[t>>10],o[t>>4&63],o[t<<2&63]),n===yC&&u.push(s)}else if(1===c){const t=e[r-1];u.push(o[t>>2],o[t<<4&63]),n===yC&&u.push(s,s)}return a.decode.bytes=i,String.fromCharCode.apply(String,u)}};return a}mC("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",yC);const vC=mC("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",2);let bC="undefined"!==typeof global?global.AbortError:"undefined"!==typeof window?window.AbortError:null;bC||(bC=class extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Request aborted.")}}),bC.prototype.name="AbortError",bC.prototype.code="ABORT_ERR";const wC="undefined"!==typeof globalThis&&globalThis.URL||require("url").URL;class EC extends Error{constructor(e,t,r){super("status="+t+" while requesting "+e+" ["+r+"]"),this.uri=e,this.status=t,this.method=r}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}EC.prototype.name="HTTPStatusError",EC.prototype.code="HTTP_STATUS";class _C extends Error{constructor(e,t){super(e),this.cause=t}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:CC(this.cause)}}}_C.prototype.name="ResponseError",_C.prototype.code="RESPONSE_ERR";class SC extends Error{constructor(e){super("Timeout (t="+e+")."),this.timeout=e}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}SC.prototype.name="TimeoutError",SC.prototype.code="ETIMEOUT";const AC=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,TC=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function CC(e){if("string"===typeof e)return{message:e};try{const t=JSON.stringify(e);if("{}"!==t)return JSON.parse(t)}catch(r){}const t={message:String(e.message||e)};return void 0!==e.code&&(t.code=String(e.code)),t}const kC=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,IC=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/gi,RC=/\[(((pk|name)=([^\]]+)))\]/gi;function PC(e,t){t.lastIndex=0;const r={};for(;;){const n=t.exec(e);if(!n)break;n[2]?r[n[3].toLowerCase()]=n[4]:r[n[1].toLowerCase()]=!0}return r}class NC extends Error{constructor(e,t){super('Invalid Endpoint: unsupported protocol "'.concat(e,'" for endpoint: ').concat(t,", supported protocols: ").concat(DC.join(", "))),this.protocol=e,this.endpoint=t}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}NC.prototype.name="InvalidProtocolError",NC.prototype.code="EPROTOCOL";const DC=["http:","https:","udp4:","udp6:"];class xC{constructor(e,t){this.name=e.name||null,this.protocol=e.protocol;const r="string"===typeof e.port?e.port=parseInt(e.port,10):e.port;if(void 0===r||null===r)this.port=t?"https:"===this.protocol?443:80:e.pk?443:53;else{if("number"!==typeof r&&!isNaN(r))throw new Error('Invalid Endpoint: port "'.concat(e.port,'" needs to be a number: ').concat(JSON.stringify(e)));this.port=r}}toJSON(){return this.toString()}}class LC extends xC{constructor(e){super(e,!1),this.pk=e.pk||null}toString(){const e=this.port!==(this.pk?443:53)?":".concat(this.port):"",t=this.pk?" [pk=".concat(this.pk,"]"):"",r=this.name?" [name=".concat(this.name,"]"):"";return"udp://".concat(this.ipv4||"[".concat(this.ipv6,"]")).concat(e).concat(t).concat(r)}}class OC extends LC{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 BC extends LC{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 MC(e){return TC.test(e)&&!AC.test(e)?"[".concat(e,"]"):e}class UC extends xC{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=TC.exec(this.host);e&&(this.ipv6=e[1])}this.ipv4||AC.test(this.host)&&(this.ipv4=this.host);const t="".concat(this.protocol,"//").concat(MC(this.host),":").concat(this.port).concat(this.path);try{this.url=new wC(t)}catch(r){throw new Error(r.message+" [".concat(t,"]"))}}toString(){const e="https:"===this.protocol?"":"http://",t=this.port!==("https:"===this.protocol?443:80)?":".concat(this.port):"",r="GET"!==this.method?" [post]":"",n="/dns-query"===this.path?"":this.path,i=this.name?" [name=".concat(this.name,"]"):"",o=this.ipv4&&this.ipv4!==this.host?" [ipv4=".concat(this.ipv4,"]"):"",s=this.ipv6&&this.ipv6!==this.host?" [ipv6=".concat(this.ipv6,"]"):"";return"".concat(e).concat(MC(this.host)).concat(t).concat(n).concat(r).concat(o).concat(s).concat(i)}}function FC(e){let t;if("string"===typeof e)t=function(e){const t=kC.exec(e),r=t[2]||"https:",n=t[3],i=t[5],o=t[6],s=t[7];if("https:"===r||"http:"===r){const e=PC(s,IC);return{name:e.name,protocol:r,ipv4:e.ipv4,ipv6:e.ipv6,host:n,port:i,path:o,method:e.post?"POST":"GET"}}if("udp:"===r||"udp4:"===r||"udp6:"===r){const t=PC(s,RC),o=/^\[(.*)\]$/.exec(n);if(o&&"udp4:"===r)throw new Error("Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=".concat(e,")"));if(!o&&"udp6:"===r)throw new Error("Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=".concat(e,")"));return o?new BC({protocol:"udp6:",ipv6:o[1],port:i,pk:t.pk,name:t.name}):new OC({protocol:"udp4:",ipv4:n,port:i,pk:t.pk,name:t.name})}throw new NC(r,e)}(e);else{if("object"!==typeof e||null===e||Array.isArray(e))throw new Error("Can not convert ".concat(e," to an endpoint"));if(e instanceof xC)return e;t=e}null!==t.protocol&&void 0!==t.protocol||(t.protocol="https:");const r=t.protocol;if("udp4:"===r)return new OC(t);if("udp6:"===r)return new BC(t);if("https:"===r||"http:"===r)return new UC(t);throw new NC(r,JSON.stringify(t))}const jC="application/dns-message";function zC(){}function VC(e,t,r,n,i){return new Promise(((o,s)=>{const a=new wC(e);"GET"===t&&r&&(a.search="?dns="+vC.decode(r));const c=a.toString(),l=new XMLHttpRequest;l.open(t,c,!0),l.setRequestHeader("Accept",jC),"POST"===t&&l.setRequestHeader("Content-Type",jC),l.responseType="arraybuffer",l.timeout=n,l.ontimeout=function(){u(new SC(n));try{l.abort()}catch(e){}},l.onreadystatechange=function(){if(l.readyState>1&&200!==l.status&&0!==l.status){u(new EC(c,l.status,t));try{l.abort()}catch(e){}}},l.onerror=function(){u(200===l.status?new Error("Inexplicable XHR Error"):new EC(c,l.status,t))},l.onload=function(){if(200!==l.status)u(new EC(c,l.status,t));else{let e;if("string"===typeof l.response)e=gT(l.response);else if(l.response instanceof Uint8Array)e=l.response;else{if(!(Array.isArray(l.response)||l.response instanceof ArrayBuffer))throw new Error("Unprocessable response "+l.response);e=new Uint8Array(l.response)}u(null,e)}},"POST"===t?l.send(r):l.send(),i&&i.addEventListener("abort",h);let u=function(e,t){u=zC,i&&i.removeEventListener("abort",h),o(e?{error:e,response:l}:{data:t,response:l})};function h(){u(new bC);try{l.abort()}catch(e){}}}))}class KC 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 qC(e){const t=null===e.time||void 0===e.time?Date.now():e.time,r=function(e){return e.filter((e=>e.cors||e.endpoint.cors))}(e.data.map((e=>(e.endpoint=FC(Object.assign({name:e.name},e.endpoint)),e)))),n=r.map((e=>e.endpoint));return{data:{resolvers:r,resolverByName:r.reduce(((e,t)=>(e[t.name]=t,e)),{}),endpoints:n,endpointByName:n.reduce(((e,t)=>(e[t.name]=t,e)),{})},time:t}}const HC=qC({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 GC(e,t,r,n){return n&&n.aborted?Promise.reject(new bC):"udp4:"===e.protocol||"udp6:"===e.protocol?function(){throw new Error('Only "doh" endpoints are supported in the browser')}():function(e,t,r,n){return function(e,t,r,n,i){return VC(e,t,r,n,i)}(e.url,e.method,uC(Object.assign({flags:oC},t)),r,n).then((function(e){const t=e.data,r=e.response;let n=e.error;if(void 0===n)if(0===t.length)n=new _C("Empty.");else try{const e=hC(t);return e.response=r,e}catch(i){n=new _C("Invalid packet (cause="+i.message+")",i)}throw Object.assign(n,{response:r})}))}(e,t,r,n)}const WC=new wC("https://martinheidegger.github.io/dns-query/resolvers.json");function QC(e){return/^@/.test(e)}const YC=new class{constructor(e){this.opts=Object.assign({timeout:5e3,update:!0,updateURL:WC,persist:!1,localStoragePrefix:"dnsquery_",maxAge:3e5},e),this._dataP=null}_data(e,t){return e||null===this._dataP?(this._dataP=this.opts.update?async function(e,t,r,n){const i=t?t.localStoragePrefix+t.name:null;if(i)try{const e=JSON.parse(localStorage.getItem(i));if(e&&e.time>t.maxTime)return e}catch(a){}const{data:o}=await VC(e,"GET",null,r,n),s={time:Date.now(),data:JSON.parse(yT(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=>qC({data:e.data.resolvers,time:e.time}))).catch((()=>t||HC)):Promise.resolve(HC),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=JC),"dns"===e&&(e=ZC),"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(QC))try{return Promise.resolve(e.map(FC))}catch(t){return Promise.reject(t)}return this.data().then((t=>e.map((e=>{if(QC(e)){const r=t.endpointByName[e.substring(1)];if(!r)throw new Error("Endpoint ".concat(e," is not known."));return r}return FC(e)}))))}};function $C(e,t){return t=Object.assign({retries:5,timeout:3e4},t),e.question?(r=t.endpoints,function(e){return null!==e&&"object"===typeof e&&"function"===typeof e.then}(r)?r:Promise.resolve(r)).then((r=>{if(!Array.isArray(r)||0===r.length)throw new Error("No endpoints defined to lookup dns records.");return XC(r.map(FC),function(e){const t=Object.assign({type:"query"},e);return delete t.question,t.questions=[],e.question&&t.questions.push(e.question),t}(e),t)})).then((e=>(e.question=e.questions[0],delete e.questions,e))):Promise.reject(new Error("To request data you need to specify a .question!"));var r}function XC(e,t,r){const n=1===e.length?e[0]:e[Math.floor(Math.random()*e.length)%e.length];return GC(n,t,r.timeout,r.signal).then((e=>(e.endpoint=n.toString(),e)),(i=>{if("AbortError"===i.name||0===r.retries)throw i.endpoint=n.toString(),i;return r.retries>0&&(r.retries-=1),XC(e,t,r)}))}function JC(e){return"https:"===e.protocol||"http:"===e.protocol}function ZC(e){return"udp4:"===e.protocol||"udp6:"===e.protocol}const ek=Yu("waku:dns-over-https");class tk{static async create(e,t){const r=null!==e&&void 0!==e?e:await YC.endpoints("doh");return new tk(r,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 $C({question:{type:"TXT",name:e}},{endpoints:this.endpoints,retries:this.retries})).answers}catch(i){throw ek("query failed: ",i),new Error("DNS query failed")}if(!t)throw new Error("Could not resolve ".concat(e));const r=t.map((e=>e.data)),n=[];return r.forEach((e=>{"string"===typeof e?n.push(e):Array.isArray(e)?e.forEach((e=>{"string"===typeof e?n.push(e):n.push(jf(e))})):n.push(jf(e))})),n}}var rk=__webpack_require__(9437);class nk{static parseAndVerifyRoot(e,t){if(!e.startsWith(this.ROOT_PREFIX))throw new Error("ENRTree root entry must start with '".concat(this.ROOT_PREFIX,"'"));const r=nk.parseRootValues(e),n=rk.decode.asBytes(t),i=e.split(" sig")[0],o=zf(i);if(!fS(ru(r.signature,"base64url").slice(0,64),dS(o),new Uint8Array(n)))throw new Error("Unable to verify ENRTree root signature");return r.eRoot}static parseRootValues(e){const t=e.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(t))throw new Error("Could not parse ENRTree root entry");t.shift();const[r,n,i,o]=t;if(!r)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!n)throw new Error("Could not parse 'l' value from ENRTree root entry");if(!i)throw new Error("Could not parse 'seq' value from ENRTree root entry");if(!o)throw new Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:r,lRoot:n,seq:Number(i),signature:o}}static parseTree(e){if(!e.startsWith(this.TREE_PREFIX))throw new Error("ENRTree tree entry must start with '".concat(this.TREE_PREFIX,"'"));const t=e.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(t))throw new Error("Could not parse ENRTree tree entry");t.shift();const[r,n]=t;if(!r)throw new Error("Could not parse public key from ENRTree tree entry");if(!n)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:r,domain:n}}static parseBranch(e){if(!e.startsWith(this.BRANCH_PREFIX))throw new Error("ENRTree branch entry must start with '".concat(this.BRANCH_PREFIX,"'"));return e.split(this.BRANCH_PREFIX)[1].split(",")}}Xa(nk,"RECORD_PREFIX",TA.RECORD_PREFIX),Xa(nk,"TREE_PREFIX","enrtree:"),Xa(nk,"BRANCH_PREFIX","enrtree-branch:"),Xa(nk,"ROOT_PREFIX","enrtree-root:");const ik=Yu("waku:discovery:fetch_nodes");function ok(e,t){return t.relay>=e.relay&&t.store>=e.store&&t.filter>=e.filter&&t.lightPush>=e.lightPush}function sk(e,t){if(!e.nodeId)return!1;for(const r of t)if(e.nodeId===r.nodeId)return!1;return!0}function ak(e,t){e.relay&&(t.relay+=1),e.store&&(t.store+=1),e.filter&&(t.filter+=1),e.lightPush&&(t.lightPush+=1)}function ck(e,t,r){if(ok(t,r))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const n=function(e,t){return{relay:t.relay<e.relay,store:t.store<e.store,filter:t.filter<e.filter,lightPush:t.lightPush<e.lightPush}}(t,r);return n.relay&&e.relay||n.store&&e.store||n.filter&&e.filter||n.lightPush&&e.lightPush}const lk=Yu("waku:discovery:dns");class uk{static async dnsOverHttp(e){return e||(e=await tk.create()),new uk(e)}async getPeers(e,t){const r=Math.floor(Math.random()*e.length),{publicKey:n,domain:i}=nk.parseTree(e[r]),o={domain:i,publicKey:n,visits:{}},s=await async function(e,t,r){var n,i,o,s;const a={relay:null!==(n=e.relay)&&void 0!==n?n:0,store:null!==(i=e.store)&&void 0!==i?i:0,filter:null!==(o=e.filter)&&void 0!==o?o:0,lightPush:null!==(s=e.lightPush)&&void 0!==s?s:0},c=a.relay+a.store+a.filter+a.lightPush,l={relay:0,store:0,filter:0,lightPush:0};let u=0;const h=[];for(;!ok(a,l)&&u<c+t;){const e=await r();e&&sk(e,h)&&(e.waku2&&ck(e.waku2,a,l)&&(ak(e.waku2,l),h.push(e)),ik("got new peer candidate from DNS address=".concat(e.nodeId,"@").concat(e.ip))),u++}return h}(t,this._errorTolerance,(()=>this._search(i,o)));return lk("retrieved peers: ",s.map((e=>{var t,r;return{id:null===(t=e.peerId)||void 0===t?void 0:t.toString(),multiaddrs:null===(r=e.multiaddrs)||void 0===r?void 0:r.map((e=>e.toString()))}}))),s}constructor(e){Xa(this,"dns",void 0),Xa(this,"_DNSTreeCache",void 0),Xa(this,"_errorTolerance",10),this._DNSTreeCache={},this.dns=e}async*getNextPeer(e,t){const r=Math.floor(Math.random()*e.length),{publicKey:n,domain:i}=nk.parseTree(e[r]),o={domain:i,publicKey:n,visits:{}};for await(const s of async function*(e,t,r){var n,i,o,s;const a={relay:null!==(n=e.relay)&&void 0!==n?n:0,store:null!==(i=e.store)&&void 0!==i?i:0,filter:null!==(o=e.filter)&&void 0!==o?o:0,lightPush:null!==(s=e.lightPush)&&void 0!==s?s:0},c=a.relay+a.store+a.filter+a.lightPush,l={relay:0,store:0,filter:0,lightPush:0};let u=0;const h=new Set;for(;!ok(a,l)&&u<c+t;){const e=await r();e&&e.nodeId&&!h.has(e.nodeId)&&(h.add(e.nodeId),e.waku2&&ck(e.waku2,a,l)&&(ak(e.waku2,l),yield e),ik("got new peer candidate from DNS address=".concat(e.nodeId,"@").concat(e.ip))),u++}}(t,this._errorTolerance,(()=>this._search(i,o))))yield s}async _search(e,t){try{const n=await this._getTXTRecord(e,t);let i,o;t.visits[e]=!0;const s=function(e){return e.startsWith(nk.ROOT_PREFIX)?nk.ROOT_PREFIX:e.startsWith(nk.BRANCH_PREFIX)?nk.BRANCH_PREFIX:e.startsWith(nk.RECORD_PREFIX)?nk.RECORD_PREFIX:""}(n);try{switch(s){case nk.ROOT_PREFIX:return i=nk.parseAndVerifyRoot(n,t.publicKey),await this._search(i,t);case nk.BRANCH_PREFIX:return o=nk.parseBranch(n),i=function(e,t){const r={};for(const[i,o]of e.entries())t.visits[o]&&(r[i]=!0);if(Object.keys(r).length===e.length)throw new Error("Unresolvable circular path detected");let n;do{n=Math.floor(Math.random()*e.length)}while(r[n]);return e[n]}(o,t),await this._search(i,t);case nk.RECORD_PREFIX:return ZA.fromString(n);default:return null}}catch(r){return lk("Failed to search DNS tree ".concat(s," at subdomain ").concat(e,": ").concat(r)),null}}catch(r){return lk("Failed to retrieve TXT record at subdomain ".concat(e,": ").concat(r)),null}}async _getTXTRecord(e,t){if(this._DNSTreeCache[e])return this._DNSTreeCache[e];const r=e!==t.domain?"".concat(e,".").concat(t.domain):t.domain,n=await this.dns.resolveTXT(r);if(!n.length)throw new Error("Received empty result array while fetching TXT record");if(!n[0].length)throw new Error("Received empty TXT record");const i=n.join("");return this._DNSTreeCache[e]=i,i}}let hk;const dk=Yu("waku:peer-discovery-dns"),fk={TEST:"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@test.waku.nodes.status.im",PROD:"enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im"},pk="bootstrap";hk=Symbol.toStringTag;class gk extends cS{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:r}=t;dk("Use following EIP-1459 ENR Tree URLs: ",r)}async start(){if(dk("Starting peer discovery via dns"),this._started=!0,void 0===this.nextPeer){let{enrUrls:e}=this._options;Array.isArray(e)||(e=[e]);const{wantedNodeCapabilityCount:t}=this._options,r=await uk.dnsOverHttp();this.nextPeer=r.getNextPeer.bind(r,e,t)}for await(const r of this.nextPeer()){var e,t;if(!this._started)return;const n=r.peerInfo;n&&((await this._components.peerStore.getTags(n.id)).find((e=>{let{name:t}=e;return t===pk}))||(await this._components.peerStore.tagPeer(n.id,pk,{value:null!==(e=this._options.tagValue)&&void 0!==e?e:50,ttl:null!==(t=this._options.tagTTL)&&void 0!==t?t:12e4}),this.dispatchEvent(new uS("peer",{detail:n}))))}}stop(){this._started=!1}get[iS](){return!0}get[hk](){return"@waku/bootstrap"}}function yk(e,t){return r=>new gk(r,{enrUrls:e,wantedNodeCapabilityCount:t})}let mk;const vk=Symbol.for("nodejs.util.inspect.custom"),bk=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),wk=114,Ek=36,_k=37;mk=Symbol.toStringTag;class Sk{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[mk](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(wk,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:bk,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new Tk({multihash:t}):e.startsWith("16U")?new Ck({multihash:t}):new Ak({multihash:t})}return kk(bk.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[vk](){return"PeerId(".concat(this.toString(),")")}}class Ak extends Sk{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class Tk extends Sk{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class Ck extends Sk{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function kk(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===Ek)return new Tk({multihash:t});if(t.digest.length===_k)return new Ck({multihash:t})}if(t.code===Il.code)return new Ak({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==wk)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new Ak({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===Ek)return new Tk({multihash:e.multihash});if(t.digest.length===_k)return new Ck({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}const Ik="ERR_SIGNATURE_NOT_VALID";var Rk=__webpack_require__(5538),Pk=__webpack_require__(9462),Nk=__webpack_require__(8858),Dk=__webpack_require__(9114),xk=__webpack_require__(4934);Nk._configure(),Rk._configure(Pk),Dk._configure(xk);const Lk=["uint64","int64","sint64","fixed64","sfixed64"];function Ok(e){return function(e){for(const t of Lk){if(null==e[t])continue;const r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new Rk(e))}function Bk(){return function(e){for(const t of Lk){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(Dk.create())}function Mk(e,t){const r=Ok(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function Uk(e,t){const r=Bk();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var Fk,jk;function zk(e,t){return function(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}("message",Fk.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"}(Fk||(Fk={})),function(e){let t;e.codec=()=>(null==t&&(t=zk((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.publicKey&&e.publicKey.byteLength>0&&(t.uint32(10),t.bytes(e.publicKey)),null!=e.payloadType&&e.payloadType.byteLength>0&&(t.uint32(18),t.bytes(e.payloadType)),null!=e.payload&&e.payload.byteLength>0&&(t.uint32(26),t.bytes(e.payload)),null!=e.signature&&e.signature.byteLength>0&&(t.uint32(42),t.bytes(e.signature)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={publicKey:new Uint8Array(0),payloadType:new Uint8Array(0),payload:new Uint8Array(0),signature:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.publicKey=e.bytes();break;case 2:r.payloadType=e.bytes();break;case 3:r.payload=e.bytes();break;case 5:r.signature=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>Uk(t,e.codec()),e.decode=t=>Mk(t,e.codec())}(jk||(jk={}));class Vk{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:r,payload:n,signature:i}=e;this.peerId=t,this.payloadType=r,this.payload=n,this.signature=i}marshal(){if(null==this.peerId.publicKey)throw new Error("Missing public key");return null==this.marshaled&&(this.marshaled=jk.encode({publicKey:this.peerId.publicKey,payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(e){return cl(this.marshal(),e.marshal())}async validate(e){const t=Kk(e,this.payloadType,this.payload);if(null==this.peerId.publicKey)throw new Error("Missing public key");return ov(this.peerId.publicKey).verify(t.subarray(),this.signature)}}Xa(Vk,"createFromProtobuf",(async e=>{const t=jk.decode(e),r=await async function(e,t){return e.length===Ek?new Tk({multihash:Fc(Nl.code,e),privateKey:t}):e.length===_k?new Ck({multihash:Fc(Nl.code,e),privateKey:t}):new Ak({multihash:await Il.digest(e),publicKey:e,privateKey:t})}(t.publicKey);return new Vk({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})})),Xa(Vk,"seal",(async(e,t)=>{if(null==t.privateKey)throw new Error("Missing private key");const r=e.domain,n=e.codec,i=e.marshal(),o=Kk(r,n,i),s=await av(t.privateKey),a=await s.sign(o.subarray());return new Vk({peerId:t,payloadType:n,payload:i,signature:a})})),Xa(Vk,"openAndCertify",(async(e,t)=>{const r=await Vk.createFromProtobuf(e);if(!await r.validate(t))throw new oc("envelope signature is not valid for the given domain",Ik);return r}));const Kk=(e,t,r)=>{const n=ru(e),i=Ed.encode(n.byteLength),o=Ed.encode(t.length),s=Ed.encode(r.length);return new cd(i,n,o,t,s,r)};const qk=nu,Hk=iu,Gk=function(e){let t=0;if(e=e.toString().trim(),qk(e)){const r=new Uint8Array(t+4);return e.split(/\./g).forEach((e=>{r[t++]=255&parseInt(e,10)})),r}if(Hk(e)){const r=e.split(":",8);let n;for(n=0;n<r.length;n++){let e;qk(r[n])&&(e=Gk(r[n]),r[n]=$l(e.slice(0,2),"base16")),null!=e&&++n<8&&r.splice(n,0,$l(e.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&""!==r[n];n++);const e=[n,1];for(n=9-r.length;n>0;n--)e.push("0");r.splice.apply(r,e)}const i=new Uint8Array(t+16);for(n=0;n<r.length;n++){const e=parseInt(r[n],16);i[t++]=e>>8&255,i[t++]=255&e}return i}throw new Error("invalid ip address")},Wk=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;r=~~r,n=null!==(t=n)&&void 0!==t?t:e.length-r;const i=new DataView(e.buffer);if(4===n){const t=[];for(let i=0;i<n;i++)t.push(e[r+i]);return t.join(".")}if(16===n){const e=[];for(let t=0;t<n;t+=2)e.push(i.getUint16(r+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},Qk=-1,Yk={},$k={};function Xk(e){if("number"===typeof e){if(null!=$k[e])return $k[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=Yk[e])return Yk[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,Qk,"ip6zone"],[43,8,"ipcidr"],[53,Qk,"dns",!0],[54,Qk,"dns4",!0],[55,Qk,"dns6",!0],[56,Qk,"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,Qk,"unix",!1,!0],[421,Qk,"ipfs"],[421,Qk,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,Qk,"garlic64"],[448,0,"tls"],[449,Qk,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,Qk,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,Qk,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);$k[t.code]=t,Yk[t.name]=t}));Xk("ip4"),Xk("ip6"),Xk("ipcidr");function Jk(e,t){switch(Xk(e).code){case 4:case 41:return function(e){const t=Wk(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!ou(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 sI(t);case 6:case 273:case 33:case 132:return iI(t).toString();case 421:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return $l(r,"base58btc")}(t);case 444:case 445:return aI(t);case 466:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+$l(r,"base64url")}(t);default:return $l(t,"base16")}}function Zk(e,t){switch(Xk(e).code){case 4:case 41:return rI(t);case 42:case 53:case 54:case 55:case 56:case 400:case 449:case 777:return oI(t);case 6:case 273:case 33:case 132:return nI(parseInt(t,10));case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?jc(mc.decode("z".concat(e))).bytes:el.parse(e).multihash.bytes;const r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(16!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion address."));const r=Vc.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=nI(n);return Jl([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: [\"'".concat(t.join('", "'),"'\"]' does not contain a port number"));if(56!==t[0].length)throw new Error("failed to parse onion addr: ".concat(t[0]," not a Tor onion3 address."));const r=Vc.decode("b".concat(t[0])),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=nI(n);return Jl([r,i],r.length+i.length)}(t);case 466:return function(e){const t=tI.decode(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}(t);default:return ru(t,"base16")}}const eI=Object.values(Vl).map((e=>e.decoder)),tI=function(){let e=eI[0].or(eI[1]);return eI.slice(2).forEach((t=>e=e.or(t))),e}();function rI(e){if(!ou(e))throw new Error("invalid ip address");return Gk(e)}function nI(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function iI(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function oI(e){const t=ru(e),r=Uint8Array.from(Xl.encode(t.length));return Jl([r,t],r.length+t.length)}function sI(e){const t=Xl.decode(e);if((e=e.slice(Xl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return $l(e)}function aI(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=$l(t,"base32"),i=iI(r);return"".concat(n,":").concat(i)}function cI(e){return e.map((e=>{const t=vI(e);return null!=e[1]?[t.code,Jk(t.code,e[1])]:[t.code]}))}function lI(e){return pI(Jl(e.map((e=>{const t=vI(e);let r=Uint8Array.from(Xl.encode(t.code));return e.length>1&&null!=e[1]&&(r=Jl([r,e[1]])),r}))))}function uI(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;var r;return Xl.decode(t)+(null!==(r=Xl.decode.bytes)&&void 0!==r?r:0)}function hI(e){const t=[];let r=0;for(;r<e.length;){var n;const i=Xl.decode(e,r),o=null!==(n=Xl.decode.bytes)&&void 0!==n?n:0,s=uI(Xk(i),e.slice(r+o));if(0===s){t.push([i]),r+=o;continue}const a=e.slice(r+o,r+o+s);if(r+=s+o,r>e.length)throw mI("Invalid address Uint8Array: "+$l(e,"base16"));t.push([i,a])}return t}function dI(e){return function(e){const t=[];return e.map((e=>{const r=vI(e);return t.push(r.name),e.length>1&&null!=e[1]&&t.push(e[1]),null})),yI(t.join("/"))}(cI(hI(e)))}function fI(e){const t=function(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const i=r[n],o=Xk(i);if(0!==o.size){if(n++,n>=r.length)throw mI("invalid address: "+e);if(!0===o.path){t.push([i,yI(r.slice(n).join("/"))]);break}t.push([i,r[n]])}else t.push([i])}return t}(e=yI(e));return lI(t.map((e=>{Array.isArray(e)||(e=[e]);const t=vI(e);return e.length>1?[t.code,Zk(t.code,e[1])]:[t.code]})))}function pI(e){const t=gI(e);if(null!=t)throw t;return Uint8Array.from(e)}function gI(e){try{hI(e)}catch(t){return t}}function yI(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function mI(e){return new Error("Error parsing address: "+e)}function vI(e){return Xk(e[0])}const bI=Symbol.for("nodejs.util.inspect.custom"),wI=[Xk("dns").code,Xk("dns4").code,Xk("dns6").code,Xk("dnsaddr").code],EI=new Map,_I=Symbol.for("@multiformats/js-multiaddr/multiaddr");function SI(e){return Boolean(null===e||void 0===e?void 0:e[_I])}var AI=new WeakMap,TI=new WeakMap,CI=new WeakMap,kI=new WeakMap;class II{constructor(e){if(Xa(this,"bytes",void 0),ec(this,AI,{writable:!0,value:void 0}),ec(this,TI,{writable:!0,value:void 0}),ec(this,CI,{writable:!0,value:void 0}),ec(this,kI,{writable:!0,value:void 0}),Xa(this,_I,!0),null==e&&(e=""),e instanceof Uint8Array)this.bytes=pI(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=fI(e)}else{if(!SI(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=pI(e.bytes)}}toString(){return null==nc(this,AI)&&rc(this,AI,dI(this.bytes)),nc(this,AI)}toJSON(){return this.toString()}toOptions(){let e,t,r,n,i="";const o=Xk("tcp"),s=Xk("udp"),a=Xk("ip4"),c=Xk("ip6"),l=Xk("dns6"),u=Xk("ip6zone");for(const[h,d]of this.stringTuples())h===u.code&&(i="%".concat(null!==d&&void 0!==d?d:"")),wI.includes(h)&&(t=o.name,n=443,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===l.code?6:4),h!==o.code&&h!==s.code||(t=Xk(h).name,n=parseInt(null!==d&&void 0!==d?d:"")),h!==a.code&&h!==c.code||(t=Xk(h).name,r="".concat(null!==d&&void 0!==d?d:"").concat(i),e=h===c.code?6:4);if(null==e||null==t||null==r||null==n)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:r,transport:t,port:n}}protos(){return this.protoCodes().map((e=>Object.assign({},Xk(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;r<t.length;){var n;const i=Xl.decode(t,r),o=null!==(n=Xl.decode.bytes)&&void 0!==n?n:0;r+=uI(Xk(i),t.slice(r+o))+o,e.push(i)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return null==nc(this,TI)&&rc(this,TI,hI(this.bytes)),nc(this,TI)}stringTuples(){return null==nc(this,CI)&&rc(this,CI,cI(this.tuples())),nc(this,CI)}encapsulate(e){return e=new II(e),new II(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address ".concat(this.toString()," does not contain subaddress: ").concat(e.toString()));return new II(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new II(lI(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===Yk.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]?$l(mc.decode("z".concat(e)),"base58btc"):$l(el.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){if(void 0===nc(this,kI))try{rc(this,kI,this.stringTuples().filter((e=>!0===Xk(e[0]).path))[0][1]),null==nc(this,kI)&&rc(this,kI,null)}catch{rc(this,kI,null)}return nc(this,kI)}equals(e){return cl(this.bytes,e.bytes)}async resolve(e){const t=this.protos().find((e=>e.resolvable));if(null==t)return[this];const r=EI.get(t.name);if(null==r)throw new oc("no available resolver for ".concat(t.name),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this,e)).map((e=>new II(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))}[bI](){return"Multiaddr(".concat(dI(this.bytes),")")}}const RI=Uint8Array.from([3,1]);var PI;!function(e){let t,r;!function(e){let t;e.codec=()=>(null==t&&(t=zk((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.multiaddr&&e.multiaddr.byteLength>0&&(t.uint32(10),t.bytes(e.multiaddr)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.multiaddr=e.bytes();else e.skipType(7&t)}return r}))),t),e.encode=t=>Uk(t,e.codec()),e.decode=t=>Mk(t,e.codec())}(t=e.AddressInfo||(e.AddressInfo={})),e.codec=()=>(null==r&&(r=zk((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==n.lengthDelimited&&r.fork(),null!=t.peerId&&t.peerId.byteLength>0&&(r.uint32(10),r.bytes(t.peerId)),null!=t.seq&&0n!==t.seq&&(r.uint32(16),r.uint64(t.seq)),null!=t.addresses)for(const i of t.addresses)r.uint32(26),e.AddressInfo.codec().encode(i,r);!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={peerId:new Uint8Array(0),seq:0n,addresses:[]},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.peerId=t.bytes();break;case 2:n.seq=t.uint64();break;case 3:n.addresses.push(e.AddressInfo.codec().decode(t,t.uint32()));break;default:t.skipType(7&r)}}return n}))),r),e.encode=t=>Uk(t,e.codec()),e.decode=t=>Mk(t,e.codec())}(PI||(PI={}));class NI{constructor(e){Xa(this,"peerId",void 0),Xa(this,"multiaddrs",void 0),Xa(this,"seqNumber",void 0),Xa(this,"domain",NI.DOMAIN),Xa(this,"codec",NI.CODEC),Xa(this,"marshaled",void 0);const{peerId:t,multiaddrs:r,seqNumber:n}=e;this.peerId=t,this.multiaddrs=null!==r&&void 0!==r?r:[],this.seqNumber=null!==n&&void 0!==n?n:BigInt(Date.now())}marshal(){return null==this.marshaled&&(this.marshaled=PI.encode({peerId:this.peerId.toBytes(),seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))})),this.marshaled}equals(e){return e instanceof NI&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!function(e,t){const r=(e,t)=>e.toString().localeCompare(t.toString());return e.length===t.length&&(t.sort(r),e.sort(r).every(((e,r)=>t[r].equals(e))))}(this.multiaddrs,e.multiaddrs)))}}let DI;Xa(NI,"createFromProtobuf",(e=>{var t;const r=PI.decode(e),n=kk(r.peerId),i=(null!==(t=r.addresses)&&void 0!==t?t:[]).map((e=>{return t=e.multiaddr,new II(t);var t})),o=r.seq;return new NI({peerId:n,multiaddrs:i,seqNumber:o})})),Xa(NI,"DOMAIN","libp2p-peer-record"),Xa(NI,"CODEC",RI);const xI=Symbol.for("nodejs.util.inspect.custom"),LI=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),OI=114,BI=36,MI=37;DI=Symbol.toStringTag;class UI{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[DI](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(OI,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return VI(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[xI](){return"PeerId(".concat(this.toString(),")")}}class FI extends UI{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class jI extends UI{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class zI extends UI{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function VI(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:LI,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new jI({multihash:t}):e.startsWith("16U")?new zI({multihash:t}):new FI({multihash:t})}return KI(LI.decode(e))}function KI(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===BI)return new jI({multihash:t});if(t.digest.length===MI)return new zI({multihash:t})}if(t.code===Il.code)return new FI({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==OI)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new FI({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===BI)return new jI({multihash:e.multihash});if(t.digest.length===MI)return new zI({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}const qI=Symbol.for("@libp2p/topology");let HI;const GI=()=>{};HI=Symbol.toStringTag;class WI{constructor(e){var t,r,n,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,qI,!0),this.min=null!==(t=e.min)&&void 0!==t?t:0,this.max=null!==(r=e.max)&&void 0!==r?r:1/0,this.peers=new Set,this.onConnect=null!==(n=e.onConnect)&&void 0!==n?n:GI,this.onDisconnect=null!==(i=e.onDisconnect)&&void 0!==i?i:GI}get[HI](){return qI.toString()}async setRegistrar(e){this.registrar=e}disconnect(e){this.onDisconnect(e)}}class QI{constructor(e,t,r){this.gossip=e,this.msgs=new Map,this.history=[],this.notValidatedCount=0,this.msgIdToStrFn=r;for(let n=0;n<t;n++)this.history[n]=[]}get size(){return this.msgs.size}put(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{msgIdStr:n}=e;return!this.msgs.has(n)&&(this.msgs.set(n,{message:t,validated:r,originatingPeers:new Set,iwantCounts:new Map}),this.history[0].push({...e,topic:t.topic}),r||this.notValidatedCount++,!0)}observeDuplicate(e,t){const r=this.msgs.get(e);r&&!r.validated&&r.originatingPeers.add(t)}get(e){var t;return null===(t=this.msgs.get(this.msgIdToStrFn(e)))||void 0===t?void 0:t.message}getWithIWantCount(e,t){var r;const n=this.msgs.get(e);if(!n)return null;const i=(null!==(r=n.iwantCounts.get(t))&&void 0!==r?r:0)+1;return n.iwantCounts.set(t,i),{msg:n.message,count:i}}getGossipIDs(e){const t=new Map;for(let r=0;r<this.gossip;r++)this.history[r].forEach((r=>{const n=this.msgs.get(r.msgIdStr);if(n&&n.validated&&e.has(r.topic)){let e=t.get(r.topic);e||(e=[],t.set(r.topic,e)),e.push(r.msgId)}}));return t}validate(e){const t=this.msgs.get(e);if(!t)return null;t.validated||this.notValidatedCount--;const{message:r,originatingPeers:n}=t;return t.validated=!0,t.originatingPeers=new Set,{message:r,originatingPeers:n}}shift(){this.history[this.history.length-1].forEach((e=>{const t=this.msgs.get(e.msgIdStr);t&&(this.msgs.delete(e.msgIdStr),t.validated||this.notValidatedCount--)})),this.history.pop(),this.history.unshift([])}remove(e){const t=this.msgs.get(e);return t?(this.msgs.delete(e),t):null}}const YI=__webpack_require__.p+"static/media/rpc.3ba5ca7bdb004060d5e2.cjs",{RPC:$I}=YI,XI="/floodsub/1.0.0",JI="/meshsub/1.0.0",ZI="/meshsub/1.1.0",eR=5e3;function tR(e){if(e.length<=1)return e;for(let t=0;t<e.length;t++){const r=Math.floor(Math.random()*Math.floor(e.length)),n=e[t];e[t]=e[r],e[r]=n}return e}function rR(e){return $l(e,"base64")}const nR="StrictSign",iR="StrictNoSign";var oR,sR,aR,cR,lR,uR;function hR(e){switch(e){case oR.Ignore:return cR.Ignore;case oR.Reject:return cR.Reject}}!function(e){e.Accept="accept",e.Ignore="ignore",e.Reject="reject"}(oR||(oR={})),function(e){e.StrictSign="StrictSign",e.StrictNoSign="StrictNoSign"}(sR||(sR={})),function(e){e[e.Signing=0]="Signing",e[e.Anonymous=1]="Anonymous"}(aR||(aR={})),function(e){e.Error="error",e.Ignore="ignore",e.Reject="reject",e.Blacklisted="blacklisted"}(cR||(cR={})),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"}(lR||(lR={})),function(e){e.duplicate="duplicate",e.invalid="invalid",e.valid="valid"}(uR||(uR={}));const dR="ERR_INVALID_PEER_SCORE_PARAMS",fR={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},pR={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 gR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...fR,...e,topics:e.topics?Object.entries(e.topics).reduce(((e,t)=>{let[r,n]=t;return e[r]=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{...pR,...e}}(n),e}),{}):{}}}function yR(e){if(e.topicWeight<0)throw new oc("invalid topic weight; must be >= 0",dR);if(0===e.timeInMeshQuantum)throw new oc("invalid TimeInMeshQuantum; must be non zero",dR);if(e.timeInMeshWeight<0)throw new oc("invalid TimeInMeshWeight; must be positive (or 0 to disable)",dR);if(0!==e.timeInMeshWeight&&e.timeInMeshQuantum<=0)throw new oc("invalid TimeInMeshQuantum; must be positive",dR);if(0!==e.timeInMeshWeight&&e.timeInMeshCap<=0)throw new oc("invalid TimeInMeshCap; must be positive",dR);if(e.firstMessageDeliveriesWeight<0)throw new oc("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)",dR);if(0!==e.firstMessageDeliveriesWeight&&(e.firstMessageDeliveriesDecay<=0||e.firstMessageDeliveriesDecay>=1))throw new oc("invalid FirstMessageDeliveriesDecay; must be between 0 and 1",dR);if(0!==e.firstMessageDeliveriesWeight&&e.firstMessageDeliveriesCap<=0)throw new oc("invalid FirstMessageDeliveriesCap; must be positive",dR);if(e.meshMessageDeliveriesWeight>0)throw new oc("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)",dR);if(0!==e.meshMessageDeliveriesWeight&&(e.meshMessageDeliveriesDecay<=0||e.meshMessageDeliveriesDecay>=1))throw new oc("invalid MeshMessageDeliveriesDecay; must be between 0 and 1",dR);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesCap<=0)throw new oc("invalid MeshMessageDeliveriesCap; must be positive",dR);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesThreshold<=0)throw new oc("invalid MeshMessageDeliveriesThreshold; must be positive",dR);if(e.meshMessageDeliveriesWindow<0)throw new oc("invalid MeshMessageDeliveriesWindow; must be non-negative",dR);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesActivation<1e3)throw new oc("invalid MeshMessageDeliveriesActivation; must be at least 1s",dR);if(e.meshFailurePenaltyWeight>0)throw new oc("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)",dR);if(0!==e.meshFailurePenaltyWeight&&(e.meshFailurePenaltyDecay<=0||e.meshFailurePenaltyDecay>=1))throw new oc("invalid MeshFailurePenaltyDecay; must be between 0 and 1",dR);if(e.invalidMessageDeliveriesWeight>0)throw new oc("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)",dR);if(e.invalidMessageDeliveriesDecay<=0||e.invalidMessageDeliveriesDecay>=1)throw new oc("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1",dR)}const mR={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20};function vR(){return{...mR,...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}}function bR(e,t,r,n){let i=0;Object.entries(t.topics).forEach((e=>{let[t,n]=e;const o=r.topics[t];if(void 0===o)return;let s=0;if(n.inMesh){let e=n.meshTime/o.timeInMeshQuantum;e>o.timeInMeshCap&&(e=o.timeInMeshCap),s+=e*o.timeInMeshWeight}let a=n.firstMessageDeliveries;if(a>o.firstMessageDeliveriesCap&&(a=o.firstMessageDeliveriesCap),s+=a*o.firstMessageDeliveriesWeight,n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<o.meshMessageDeliveriesThreshold){const e=o.meshMessageDeliveriesThreshold-n.meshMessageDeliveries;s+=e*e*o.meshMessageDeliveriesWeight}s+=n.meshFailurePenalty*o.meshFailurePenaltyWeight;s+=n.invalidMessageDeliveries*n.invalidMessageDeliveries*o.invalidMessageDeliveriesWeight,i+=s*o.topicWeight})),r.topicScoreCap>0&&i>r.topicScoreCap&&(i=r.topicScoreCap);const o=r.appSpecificScore(e);if(i+=o*r.appSpecificWeight,t.knownIPs.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),o=t?t.size:0;if(o>r.IPColocationFactorThreshold){const e=o-r.IPColocationFactorThreshold;i+=e*e*r.IPColocationFactorWeight}})),t.behaviourPenalty>r.behaviourPenaltyThreshold){const e=t.behaviourPenalty-r.behaviourPenaltyThreshold;i+=e*e*r.behaviourPenaltyWeight}return i}var wR,ER=__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"}(wR||(wR={}));class _R{constructor(){this.records=new Map,this.queue=new ER}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:wR.unknown,firstSeen:Date.now(),validated:0,peers:new Set},this.records.set(e,t);const r={msgId:e,expire:Date.now()+12e4};return this.queue.push(r),t}gc(){const e=Date.now();let t=this.queue.peekFront();for(;t&&t.expire<e;)this.records.delete(t.msgId),this.queue.shift(),t=this.queue.peekFront()}clear(){this.records.clear(),this.queue.clear()}}function SR(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=new Set;if(t<=0)return n;for(const i of e){if(n.size>=t)break;r(i)&&(n.add(i),e.delete(i))}return n}class AR 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 TR=jv("libp2p:gossipsub:score");class CR{constructor(e,t,r){var n;this.params=e,this.metrics=t,this.peerStats=new Map,this.peerIPs=new AR((()=>new Set)),this.scoreCache=new Map,this.deliveryRecords=new _R,function(e){for(const[r,n]of Object.entries(e.topics))try{yR(n)}catch(t){throw new oc("invalid score parameters for topic ".concat(r,": ").concat(t.message),dR)}if(e.topicScoreCap<0)throw new oc("invalid topic score cap; must be positive (or 0 for no cap)",dR);if(null===e.appSpecificScore||void 0===e.appSpecificScore)throw new oc("missing application specific score function",dR);if(e.IPColocationFactorWeight>0)throw new oc("invalid IPColocationFactorWeight; must be negative (or 0 to disable)",dR);if(0!==e.IPColocationFactorWeight&&e.IPColocationFactorThreshold<1)throw new oc("invalid IPColocationFactorThreshold; must be at least 1",dR);if(e.behaviourPenaltyWeight>0)throw new oc("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)",dR);if(0!==e.behaviourPenaltyWeight&&(e.behaviourPenaltyDecay<=0||e.behaviourPenaltyDecay>=1))throw new oc("invalid BehaviourPenaltyDecay; must be between 0 and 1",dR);if(e.decayInterval<1e3)throw new oc("invalid DecayInterval; must be at least 1s",dR);if(e.decayToZero<=0||e.decayToZero>=1)throw new oc("invalid DecayToZero; must be between 0 and 1",dR)}(e),this.scoreCacheValidityMs=r.scoreCacheValidityMs,this.computeScore=null!==(n=r.computeScore)&&void 0!==n?n:bR}get size(){return this.peerStats.size}start(){this._backgroundInterval?TR("Peer score already running"):(this._backgroundInterval=setInterval((()=>this.background()),this.params.decayInterval),TR("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),TR("stopped")):TR("Peer score already stopped")}background(){this.refreshScores(),this.deliveryRecords.gc()}dumpPeerScoreStats(){return Object.fromEntries(Array.from(this.peerStats.entries()).map((e=>{let[t,r]=e;return[t,r]})))}refreshScores(){const e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach(((r,n)=>{r.connected?(Object.entries(r.topics).forEach((r=>{let[n,i]=r;const o=this.params.topics[n];void 0!==o&&(i.firstMessageDeliveries*=o.firstMessageDeliveriesDecay,i.firstMessageDeliveries<t&&(i.firstMessageDeliveries=0),i.meshMessageDeliveries*=o.meshMessageDeliveriesDecay,i.meshMessageDeliveries<t&&(i.meshMessageDeliveries=0),i.meshFailurePenalty*=o.meshFailurePenaltyDecay,i.meshFailurePenalty<t&&(i.meshFailurePenalty=0),i.invalidMessageDeliveries*=o.invalidMessageDeliveriesDecay,i.invalidMessageDeliveries<t&&(i.invalidMessageDeliveries=0),i.inMesh&&(i.meshTime=e-i.graftTime,i.meshTime>o.meshMessageDeliveriesActivation&&(i.meshMessageDeliveriesActive=!0)))})),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenalty<t&&(r.behaviourPenalty=0)):e>r.expire&&(this.removeIPsForPeer(n,r.knownIPs),this.peerStats.delete(n),this.scoreCache.delete(n))}))}score(e){var t,r;null===(t=this.metrics)||void 0===t||t.scoreFnCalls.inc();const n=this.peerStats.get(e);if(!n)return 0;const i=Date.now(),o=this.scoreCache.get(e);if(o&&o.cacheUntil>i)return o.score;null===(r=this.metrics)||void 0===r||r.scoreFnRuns.inc();const s=this.computeScore(e,n,this.params,this.peerIPs),a=i+this.scoreCacheValidityMs;var c;o?(null===(c=this.metrics)||void 0===c||c.scoreCachedDelta.observe(Math.abs(s-o.score)),o.score=s,o.cacheUntil=a):this.scoreCache.set(e,{score:s,cacheUntil:a});return s}addPenalty(e,t,r){const n=this.peerStats.get(e);var i;n&&(n.behaviourPenalty+=t,null===(i=this.metrics)||void 0===i||i.onScorePenalty(r))}addPeer(e){const t={connected:!0,expire:0,topics:{},knownIPs:new Set,behaviourPenalty:0};this.peerStats.set(e,t)}addIP(e,t){const r=this.peerStats.get(e);r&&r.knownIPs.add(t),this.peerIPs.getOrDefault(t).add(e)}removeIP(e,t){const r=this.peerStats.get(e);r&&r.knownIPs.delete(t);const n=this.peerIPs.get(t);n&&(n.delete(e),0===n.size&&this.peerIPs.delete(t))}removePeer(e){const t=this.peerStats.get(e);if(t){if(this.score(e)>0)return this.removeIPsForPeer(e,t.knownIPs),void this.peerStats.delete(e);Object.entries(t.topics).forEach((e=>{let[t,r]=e;r.firstMessageDeliveries=0;const n=this.params.topics[t].meshMessageDeliveriesThreshold;if(r.inMesh&&r.meshMessageDeliveriesActive&&r.meshMessageDeliveries<n){const e=n-r.meshMessageDeliveries;r.meshFailurePenalty+=e*e}r.inMesh=!1,r.meshMessageDeliveriesActive=!1})),t.connected=!1,t.expire=Date.now()+this.params.retainScore}}graft(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);e&&(e.inMesh=!0,e.graftTime=Date.now(),e.meshTime=0,e.meshMessageDeliveriesActive=!1)}}prune(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);if(e){const r=this.params.topics[t].meshMessageDeliveriesThreshold;if(e.meshMessageDeliveriesActive&&e.meshMessageDeliveries<r){const t=r-e.meshMessageDeliveries;e.meshFailurePenalty+=t*t}e.meshMessageDeliveriesActive=!1,e.inMesh=!1}}}validateMessage(e){this.deliveryRecords.ensureRecord(e)}deliverMessage(e,t,r){this.markFirstMessageDelivery(e,r);const n=this.deliveryRecords.ensureRecord(t),i=Date.now();n.status===wR.unknown?(n.status=wR.valid,n.validated=i,n.peers.forEach((t=>{t!==e.toString()&&this.markDuplicateMessageDelivery(t,r)}))):TR("unexpected delivery: message from %s was first seen %s ago and has delivery status %s",e,i-n.firstSeen,wR[n.status])}rejectInvalidMessage(e,t){this.markInvalidMessageDelivery(e,t)}rejectMessage(e,t,r,n){switch(n){case cR.Error:return void this.markInvalidMessageDelivery(e,r);case cR.Blacklisted:return}const i=this.deliveryRecords.ensureRecord(t);if(i.status===wR.unknown){if(n===cR.Ignore)return i.status=wR.ignored,void i.peers.clear();i.status=wR.invalid,this.markInvalidMessageDelivery(e,r),i.peers.forEach((e=>{this.markInvalidMessageDelivery(e,r)})),i.peers.clear()}else TR("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",e,Date.now()-i.firstSeen,wR[i.status])}duplicateMessage(e,t,r){const n=this.deliveryRecords.ensureRecord(t);if(!n.peers.has(e))switch(n.status){case wR.unknown:n.peers.add(e);break;case wR.valid:n.peers.add(e),this.markDuplicateMessageDelivery(e,r,n.validated);break;case wR.invalid:this.markInvalidMessageDelivery(e,r);case wR.ignored:}}markInvalidMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);e&&(e.invalidMessageDeliveries+=1)}}markFirstMessageDelivery(e,t){const r=this.peerStats.get(e);if(r){const e=this.getPtopicStats(r,t);if(e){let r=this.params.topics[t].firstMessageDeliveriesCap;e.firstMessageDeliveries=Math.min(r,e.firstMessageDeliveries+1),e.inMesh&&(r=this.params.topics[t].meshMessageDeliveriesCap,e.meshMessageDeliveries=Math.min(r,e.meshMessageDeliveries+1))}}}markDuplicateMessageDelivery(e,t,r){const n=this.peerStats.get(e);if(n){const e=void 0!==r?Date.now():0,o=this.getPtopicStats(n,t);if(o&&o.inMesh){const n=this.params.topics[t];if(void 0!==r){var i;const o=e-r,s=o>n.meshMessageDeliveriesWindow;if(null===(i=this.metrics)||void 0===i||i.onDuplicateMsgDelivery(t,o,s),s)return}const s=n.meshMessageDeliveriesCap;o.meshMessageDeliveries=Math.min(s,o.meshMessageDeliveries+1)}}}removeIPsForPeer(e,t){for(const r of t){const t=this.peerIPs.get(r);t&&(t.delete(e),0===t.size&&this.peerIPs.delete(r))}}getPtopicStats(e,t){let r=e.topics[t];return void 0!==r?r:void 0!==this.params.topics[t]?(r={inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e.topics[t]=r,r):null}}class kR{constructor(e,t,r){this.gossipsubIWantFollowupMs=e,this.msgIdToStrFn=t,this.metrics=r,this.promises=new Map,this.requestMsByMsg=new Map,this.requestMsByMsgExpire=10*e}get size(){return this.promises.size}get requestMsByMsgSize(){return this.requestMsByMsg.size}addPromise(e,t){const r=t[Math.floor(Math.random()*t.length)],n=this.msgIdToStrFn(r);let i=this.promises.get(n);i||(i=new Map,this.promises.set(n,i));const o=Date.now();i.has(e)||(i.set(e,o+this.gossipsubIWantFollowupMs),this.metrics&&(this.metrics.iwantPromiseStarted.inc(1),this.requestMsByMsg.has(n)||this.requestMsByMsg.set(n,o)))}getBrokenPromises(){var e;const t=Date.now(),r=new Map;let n=0;return this.promises.forEach(((e,i)=>{e.forEach(((i,o)=>{var s;i<t&&(r.set(o,(null!==(s=r.get(o))&&void 0!==s?s:0)+1),e.delete(o),n++)})),e.size||this.promises.delete(i)})),null===(e=this.metrics)||void 0===e||e.iwantPromiseBroken.inc(n),r}deliverMessage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.trackMessage(e);const r=this.promises.get(e);r&&(this.promises.delete(e),this.metrics&&(this.metrics.iwantPromiseResolved.inc(1),t&&this.metrics.iwantPromiseResolvedFromDuplicate.inc(1),this.metrics.iwantPromiseResolvedPeers.inc(r.size)))}rejectMessage(e,t){this.trackMessage(e),t!==cR.Error&&this.promises.delete(e)}clear(){this.promises.clear()}prune(){var e;const t=Date.now()-this.requestMsByMsgExpire;let r=0;for(const[n,i]of this.requestMsByMsg.entries()){if(!(i<t))break;this.requestMsByMsg.delete(n),r++}null===(e=this.metrics)||void 0===e||e.iwantMessagePruned.inc(r)}trackMessage(e){if(this.metrics){const t=this.requestMsByMsg.get(e);void 0!==t&&(this.metrics.iwantPromiseDeliveryTime.observe((Date.now()-t)/1e3),this.requestMsByMsg.delete(e))}}}class IR{constructor(e){this.entries=new Map,this.validityMs=e.validityMs}get size(){return this.entries.size}put(e,t){return!!this.entries.has(e)||(this.entries.set(e,{value:t,validUntilMs:Date.now()+this.validityMs}),!1)}prune(){const e=Date.now();for(const[t,r]of this.entries.entries()){if(!(r.validUntilMs<e))break;this.entries.delete(t)}}has(e){return this.entries.has(e)}get(e){const t=this.entries.get(e);return t&&t.validUntilMs>=Date.now()?t.value:void 0}clear(){this.entries.clear()}}var RR,PR,NR,DR,xR,LR;!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"}(PR||(PR={})),function(e){e.Dc="disconnected",e.BadScore="bad_score",e.Prune="prune",e.Unsub="unsubscribed",e.Excess="excess"}(NR||(NR={})),function(e){e.GraftBackoff="graft_backoff",e.BrokenPromise="broken_promise",e.MessageDeficit="message_deficit",e.IPColocation="IP_colocation"}(DR||(DR={})),function(e){e.LowScore="low_score",e.MaxIhave="max_ihave",e.MaxIasked="max_iasked"}(xR||(xR={})),function(e){e.graylist="graylist",e.publish="publish",e.gossip="gossip",e.mesh="mesh"}(LR||(LR={}));__webpack_require__(8605);var OR=__webpack_require__(6019);const BR={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function MR(e,t,r,n,i){if("sha1"!==i&&"sha2-256"!==i&&"sha2-512"!==i){const e=Object.keys(BR).join(" / ");throw new oc("Hash '".concat(i,"' is unknown or not supported. Must be ").concat(e),"ERR_UNSUPPORTED_HASH_TYPE")}const o=BR[i],s=OR(e,t,r,n,o);return Ay.encode64(s,null)}const UR=ru("libp2p-pubsub:");const FR=(e,t)=>{const r=ru(t.toString(16).padStart(16,"0"),"base16"),n=new Uint8Array(e.length+r.length);return n.set(e,0),n.set(r,e.length),n};function jR(e){if("signed"!==e.type)throw new Error("expected signed message type");if(null==e.sequenceNumber)throw Error("missing seqno field");return FR(e.from.toBytes(),e.sequenceNumber)}async function zR(e){return await Il.encode(e.data)}function VR(e,t,r,n,i){let o=0;const s=new Map;if(Object.entries(t.topics).forEach((e=>{var t;let[n,a]=e;const c=null!==(t=i.get(n))&&void 0!==t?t:"unknown",l=r.topics[n];if(void 0===l)return;let u=s.get(c);u||(u={p1w:0,p2w:0,p3w:0,p3bw:0,p4w:0},s.set(c,u));let h=0,d=0,f=0,p=0,g=0;if(a.inMesh){h+=Math.max(a.meshTime/l.timeInMeshQuantum,l.timeInMeshCap)*l.timeInMeshWeight}let y=a.firstMessageDeliveries;if(y>l.firstMessageDeliveriesCap&&(y=l.firstMessageDeliveriesCap),d+=y*l.firstMessageDeliveriesWeight,a.meshMessageDeliveriesActive&&a.meshMessageDeliveries<l.meshMessageDeliveriesThreshold){const e=l.meshMessageDeliveriesThreshold-a.meshMessageDeliveries;f+=e*e*l.meshMessageDeliveriesWeight}p+=a.meshFailurePenalty*l.meshFailurePenaltyWeight;g+=a.invalidMessageDeliveries*a.invalidMessageDeliveries*l.invalidMessageDeliveriesWeight,o+=(h+d+f+p+g)*l.topicWeight,u.p1w+=h,u.p2w+=d,u.p3w+=f,u.p3bw+=p,u.p4w+=g})),r.topicScoreCap>0&&o>r.topicScoreCap){o=r.topicScoreCap;const e=r.topicScoreCap/o;for(const t of s.values())t.p1w*=e,t.p2w*=e,t.p3w*=e,t.p3bw*=e,t.p4w*=e}let a=0,c=0,l=0;a+=r.appSpecificScore(e)*r.appSpecificWeight,t.knownIPs.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),i=t?t.size:0;if(i>r.IPColocationFactorThreshold){const e=i-r.IPColocationFactorThreshold;c+=e*e*r.IPColocationFactorWeight}}));return l+=t.behaviourPenalty*t.behaviourPenalty*r.behaviourPenaltyWeight,o+=a+c+l,{byTopic:s,p5w:a,p6w:c,p7w:l,score:o}}class KR{constructor(e,t,r){var n;this.rawStream=e,this.pushable=xd({objectMode:!1}),this.closeController=new AbortController,this.maxBufferSize=null!==(n=r.maxBufferSize)&&void 0!==n?n:1/0,_p(Jv(this.pushable,this.closeController.signal,{returnOnAbort:!0}),Ap(),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 qR{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.rawStream=e,this.closeController=new AbortController,this.source=Jv(_p(this.rawStream,Rp(t)),this.closeController.signal,{returnOnAbort:!0})}close(){this.closeController.abort(),this.rawStream.close()}}var HR=__webpack_require__(886);const GR={maxSubscriptions:1/0,maxMessages:1/0,maxIhaveMessageIDs:1/0,maxIwantMessageIDs:1/0,maxControlMessages:1/0,maxPeerInfos:1/0};function WR(e,t){t={...t};const r=HR.Reader.create(e),n=e.length,i=void 0===n?r.len:r.pos+n,o={};for(;r.pos<i;){const e=r.uint32();switch(e>>>3){case 1:o.subscriptions&&o.subscriptions.length||(o.subscriptions=[]),o.subscriptions.length<t.maxSubscriptions?o.subscriptions.push(QR(r,r.uint32())):r.skipType(7&e);break;case 2:o.messages&&o.messages.length||(o.messages=[]),o.messages.length<t.maxMessages?o.messages.push(YR(r,r.uint32())):r.skipType(7&e);break;case 3:o.control=$R(r,r.uint32(),t);break;default:r.skipType(7&e)}}return o}function QR(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.subscribe=e.bool();break;case 2:n.topic=e.string();break;default:e.skipType(7&t)}}return n}function YR(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.from=e.bytes();break;case 2:n.data=e.bytes();break;case 3:n.seqno=e.bytes();break;case 4:n.topic=e.string();break;case 5:n.signature=e.bytes();break;case 6:n.key=e.bytes();break;default:e.skipType(7&t)}}if(!n.topic)throw Error("missing required 'topic'");return n}function $R(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.ihave&&i.ihave.length||(i.ihave=[]),i.ihave.length<r.maxControlMessages?i.ihave.push(XR(e,e.uint32(),r)):e.skipType(7&t);break;case 2:i.iwant&&i.iwant.length||(i.iwant=[]),i.iwant.length<r.maxControlMessages?i.iwant.push(JR(e,e.uint32(),r)):e.skipType(7&t);break;case 3:i.graft&&i.graft.length||(i.graft=[]),i.graft.length<r.maxControlMessages?i.graft.push(ZR(e,e.uint32())):e.skipType(7&t);break;case 4:i.prune&&i.prune.length||(i.prune=[]),i.prune.length<r.maxControlMessages?i.prune.push(eP(e,e.uint32(),r)):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function XR(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),r.maxIhaveMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);break;default:e.skipType(7&t)}}return i}function JR(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)i.messageIDs&&i.messageIDs.length||(i.messageIDs=[]),r.maxIwantMessageIDs-- >0?i.messageIDs.push(e.bytes()):e.skipType(7&t);else e.skipType(7&t)}return i}function ZR(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();if(t>>>3===1)n.topicID=e.string();else e.skipType(7&t)}return n}function eP(e,t,r){const n=void 0===t?e.len:e.pos+t,i={};for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:i.topicID=e.string();break;case 2:i.peers&&i.peers.length||(i.peers=[]),r.maxPeerInfos-- >0?i.peers.push(tP(e,e.uint32())):e.skipType(7&t);break;case 3:i.backoff=e.uint64();break;default:e.skipType(7&t)}}return i}function tP(e,t){const r=void 0===t?e.len:e.pos+t,n={};for(;e.pos<r;){const t=e.uint32();switch(t>>>3){case 1:n.peerID=e.bytes();break;case 2:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return n}const rP=function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;r=~~r,n=null!==(t=n)&&void 0!==t?t:e.length-r;const i=new DataView(e.buffer);if(4===n){const t=[];for(let i=0;i<n;i++)t.push(e[r+i]);return t.join(".")}if(16===n){const e=[];for(let t=0;t<n;t+=2)e.push(i.getUint16(r+t).toString(16));return e.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},nP=-1,iP={},oP={};function sP(e){if("number"===typeof e){if(null!=oP[e])return oP[e];throw new Error("no protocol with code: ".concat(e))}if("string"===typeof e){if(null!=iP[e])return iP[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,nP,"ip6zone"],[43,8,"ipcidr"],[53,nP,"dns",!0],[54,nP,"dns4",!0],[55,nP,"dns6",!0],[56,nP,"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,nP,"unix",!1,!0],[421,nP,"ipfs"],[421,nP,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,nP,"garlic64"],[448,0,"tls"],[449,nP,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,nP,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,nP,"memory"]].forEach((e=>{const t=function(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}(...e);oP[t.code]=t,iP[t.name]=t}));sP("ip4"),sP("ip6"),sP("ipcidr");function aP(e,t){switch(sP(e).code){case 4:case 41:return function(e){const t=rP(e,0,e.length);if(null==t)throw new Error("ipBuff is required");if(!ou(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 uP(t);case 6:case 273:case 33:case 132:return lP(t).toString();case 421:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return $l(r,"base58btc")}(t);case 444:case 445:return hP(t);case 466:return function(e){const t=Xl.decode(e),r=e.slice(Xl.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return"u"+$l(r,"base64url")}(t);default:return $l(t,"base16")}}const cP=Object.values(Vl).map((e=>e.decoder));!function(){let e=cP[0].or(cP[1]);cP.slice(2).forEach((t=>e=e.or(t)))}();function lP(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function uP(e){const t=Xl.decode(e);if((e=e.slice(Xl.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return $l(e)}function hP(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2),n=$l(t,"base32"),i=lP(r);return"".concat(n,":").concat(i)}var dP;!function(e){e[e.ip4=4]="ip4",e[e.ip6=41]="ip6"}(dP||(dP={}));var fP;!function(e){e[e.started=0]="started",e[e.stopped=1]="stopped"}(fP||(fP={}));class pP extends cS{constructor(e){var t,r,n,i;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.multicodecs=[ZI,JI],this.peers=new Set,this.streamsInbound=new Map,this.streamsOutbound=new Map,this.outboundInflightQueue=xd({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:fP.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===fP.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,graftFloodThreshold:1e4,opportunisticGraftPeers:2,opportunisticGraftTicks:60,directConnectTicks:300,...o,scoreParams:gR(o.scoreParams),scoreThresholds:vR(o.scoreThresholds)};if(this.components=e,this.decodeRpcLimits=null!==(t=s.decodeRpcLimits)&&void 0!==t?t:GR,this.globalSignaturePolicy=null!==(r=s.globalSignaturePolicy)&&void 0!==r?r:nR,s.fallbackToFloodsub&&this.multicodecs.push(XI),this.log=jv(null!==(n=s.debugName)&&void 0!==n?n:"libp2p:gossipsub"),this.opts=s,this.direct=new Set(s.directPeers.map((e=>e.id.toString()))),this.seenCache=new IR({validityMs:s.seenTTL}),this.publishedMessageIds=new IR({validityMs:s.seenTTL}),o.msgIdFn)this.msgIdFn=o.msgIdFn;else switch(this.globalSignaturePolicy){case nR:this.msgIdFn=jR;break;case iR:this.msgIdFn=zR}if(o.fastMsgIdFn&&(this.fastMsgIdFn=o.fastMsgIdFn,this.fastMsgIdCache=new IR({validityMs:s.seenTTL})),this.msgIdToStrFn=null!==(i=o.msgIdToStrFn)&&void 0!==i?i:rR,this.mcache=o.messageCache||new QI(s.mcacheGossip,s.mcacheLength,this.msgIdToStrFn),o.dataTransform&&(this.dataTransform=o.dataTransform),o.metricsRegister){if(!o.metricsTopicStrToLabel)throw Error("Must set metricsTopicStrToLabel with metrics");const e=Math.max(...Object.values(s.scoreParams.topics).map((e=>e.meshMessageDeliveriesWindow)),1e3),t=function(e,t,r){return{protocolsEnabled:e.gauge({name:"gossipsub_protocol",help:"Status of enabled protocols",labelNames:["protocol"]}),topicSubscriptionStatus:e.gauge({name:"gossipsub_topic_subscription_status",help:"Status of our subscription to this topic",labelNames:["topicStr"]}),topicPeersCount:e.gauge({name:"gossipsub_topic_peer_count",help:"Number of peers subscribed to each topic",labelNames:["topicStr"]}),meshPeerCounts:e.gauge({name:"gossipsub_mesh_peer_count",help:"Number of peers in our mesh",labelNames:["topicStr"]}),meshPeerInclusionEvents:e.gauge({name:"gossipsub_mesh_peer_inclusion_events_total",help:"Number of times we include peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),meshPeerChurnEvents:e.gauge({name:"gossipsub_peer_churn_events_total",help:"Number of times we remove peers in a topic mesh for different reasons",labelNames:["topic","reason"]}),peersPerProtocol: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 for each topic",labelNames:["topic","acceptance"]}),asyncValidationMcacheHit:e.gauge({name:"gossipsub_async_validation_mcache_hit_total",help:"Async validation result reported by the user layer",labelNames:["hit"]}),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"]}),msgPublishPeers: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:["topic","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:["topic","status"]}),msgReceivedInvalid:e.gauge({name:"gossipsub_msg_received_invalid_total",help:"Tracks specific reason of invalid",labelNames:["topic","error"]}),duplicateMsgDeliveryDelay:e.histogram({name:"gossisub_duplicate_msg_delivery_delay_seconds",help:"Time since the 1st duplicated message validated",labelNames:["topic"],buckets:[.25*r.maxMeshMessageDeliveriesWindowSec,.5*r.maxMeshMessageDeliveriesWindowSec,1*r.maxMeshMessageDeliveriesWindowSec,2*r.maxMeshMessageDeliveriesWindowSec,4*r.maxMeshMessageDeliveriesWindowSec]}),duplicateMsgLateDelivery:e.gauge({name:"gossisub_duplicate_msg_late_delivery_total",help:"Total count of late duplicate message delivery by topic, which triggers P3 penalty",labelNames:["topic"]}),duplicateMsgIgnored:e.gauge({name:"gossisub_ignored_published_duplicate_msgs_total",help:"Total count of published duplicate message ignored by topic",labelNames:["topic"]}),scoreFnCalls:e.gauge({name:"gossipsub_score_fn_calls_total",help:"Total times score() is called"}),scoreFnRuns:e.gauge({name:"gossipsub_score_fn_runs_total",help:"Total times score() call actually computed computeScore(), no cache"}),scoreCachedDelta:e.histogram({name:"gossipsub_score_cache_delta",help:"Delta of score between cached values that expired",buckets:[10,100,1e3]}),peersByScoreThreshold:e.gauge({name:"gossipsub_peers_by_score_threshold_count",help:"Current count of peers by score threshold",labelNames:["threshold"]}),score:e.avgMinMax({name:"gossipsub_score",help:"Avg min max of gossip scores",labelNames:["topic","p"]}),scoreWeights:e.avgMinMax({name:"gossipsub_score_weights",help:"Separate score weights",labelNames:["topic","p"]}),scorePerMesh:e.avgMinMax({name:"gossipsub_score_per_mesh",help:"Histogram of the scores for each mesh topic",labelNames:["topic"]}),scoringPenalties:e.gauge({name:"gossipsub_scoring_penalties_total",help:"A counter of the kind of penalties being applied to peers",labelNames:["penalty"]}),behaviourPenalty:e.histogram({name:"gossipsub_peer_stat_behaviour_penalty",help:"Current peer stat behaviour_penalty at each scrape",buckets:[.25*r.behaviourPenaltyThreshold,.5*r.behaviourPenaltyThreshold,1*r.behaviourPenaltyThreshold,2*r.behaviourPenaltyThreshold,4*r.behaviourPenaltyThreshold]}),ihaveRcvIgnored:e.gauge({name:"gossipsub_ihave_rcv_ignored_total",help:"Total received IHAVE messages that we ignore for some reason",labelNames:["reason"]}),ihaveRcvMsgids:e.gauge({name:"gossipsub_ihave_rcv_msgids_total",help:"Total received IHAVE messages by topic",labelNames:["topic"]}),ihaveRcvNotSeenMsgids:e.gauge({name:"gossipsub_ihave_rcv_not_seen_msgids_total",help:"Total messages per topic we do not have, not actual requests",labelNames:["topic"]}),iwantRcvMsgids:e.gauge({name:"gossipsub_iwant_rcv_msgids_total",help:"Total received IWANT messages by topic",labelNames:["topic"]}),iwantRcvDonthaveMsgids:e.gauge({name:"gossipsub_iwant_rcv_dont_have_msgids_total",help:"Total requested messageIDs that we do not have"}),iwantPromiseStarted:e.gauge({name:"gossipsub_iwant_promise_sent_total",help:"Total count of started IWANT promises"}),iwantPromiseResolved:e.gauge({name:"gossipsub_iwant_promise_resolved_total",help:"Total count of resolved IWANT promises"}),iwantPromiseResolvedFromDuplicate:e.gauge({name:"gossipsub_iwant_promise_resolved_from_duplicate_total",help:"Total count of resolved IWANT promises from duplicate messages"}),iwantPromiseResolvedPeers:e.gauge({name:"gossipsub_iwant_promise_resolved_peers",help:"Total count of peers we have asked IWANT promises that are resolved"}),iwantPromiseBroken:e.gauge({name:"gossipsub_iwant_promise_broken",help:"Total count of broken IWANT promises"}),iwantMessagePruned:e.gauge({name:"gossipsub_iwant_message_pruned",help:"Total count of pruned IWANT messages"}),iwantPromiseDeliveryTime:e.histogram({name:"gossipsub_iwant_promise_delivery_seconds",help:"Histogram of delivery time of resolved IWANT promises",buckets:[.5*r.gossipPromiseExpireSec,1*r.gossipPromiseExpireSec,2*r.gossipPromiseExpireSec,4*r.gossipPromiseExpireSec]}),iwantPromiseUntracked:e.gauge({name:"gossip_iwant_promise_untracked",help:"Total count of untracked IWANT promise"}),cacheSize:e.gauge({name:"gossipsub_cache_size",help:"Unbounded cache sizes",labelNames:["cache"]}),mcacheSize:e.gauge({name:"gossipsub_mcache_size",help:"Current mcache msg count"}),mcacheNotValidatedCount:e.gauge({name:"gossipsub_mcache_not_validated_count",help:"Current mcache msg count not validated"}),fastMsgIdCacheCollision:e.gauge({name:"gossipsub_fastmsgid_cache_collision_total",help:"Total count of key collisions on fastmsgid cache put"}),newConnectionCount:e.gauge({name:"gossipsub_new_connection_total",help:"Total new connection by status",labelNames:["status"]}),topicStrToLabel:t,toTopic(e){var t;return null!==(t=this.topicStrToLabel.get(e))&&void 0!==t?t:e},onJoin(e){this.topicSubscriptionStatus.set({topicStr:e},1),this.meshPeerCounts.set({topicStr:e},0)},onLeave(e){this.topicSubscriptionStatus.set({topicStr:e},0),this.meshPeerCounts.set({topicStr:e},0)},onAddToMesh(e,t,r){const n=this.toTopic(e);this.meshPeerInclusionEvents.inc({topic:n,reason:t},r)},onRemoveFromMesh(e,t,r){const n=this.toTopic(e);this.meshPeerChurnEvents.inc({topic:n,reason:t},r)},onReportValidationMcacheHit(e){this.asyncValidationMcacheHit.inc({hit:e?"hit":"miss"})},onReportValidation(e,t){const r=this.toTopic(e);this.asyncValidationResult.inc({topic:r,acceptance:t})},onScorePenalty(e){this.scoringPenalties.inc({penalty:e},1)},onIhaveRcv(e,t,r){const n=this.toTopic(e);this.ihaveRcvMsgids.inc({topic:n},t),this.ihaveRcvNotSeenMsgids.inc({topic:n},r)},onIwantRcv(e,t){for(const[r,n]of e){const e=this.toTopic(r);this.iwantRcvMsgids.inc({topic:e},n)}this.iwantRcvDonthaveMsgids.inc(t)},onForwardMsg(e,t){const r=this.toTopic(e);this.msgForwardCount.inc({topic:r},1),this.msgForwardPeers.inc({topic:r},t)},onPublishMsg(e,t,r,n){const i=this.toTopic(e);this.msgPublishCount.inc({topic:i},1),this.msgPublishBytes.inc({topic:i},r*n),this.msgPublishPeers.inc({topic:i},r),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"direct"},t.direct),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"floodsub"},t.floodsub),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"mesh"},t.mesh),this.msgPublishPeersByGroup.inc({topic:i,peerGroup:"fanout"},t.fanout)},onMsgRecvPreValidation(e){const t=this.toTopic(e);this.msgReceivedPreValidation.inc({topic:t},1)},onMsgRecvError(e){const t=this.toTopic(e);this.msgReceivedError.inc({topic:t},1)},onMsgRecvResult(e,t){const r=this.toTopic(e);this.msgReceivedStatus.inc({topic:r,status:t})},onMsgRecvInvalid(e,t){const r=this.toTopic(e),n=t.reason===cR.Error?t.error:t.reason;this.msgReceivedInvalid.inc({topic:r,error:n},1)},onDuplicateMsgDelivery(e,t,r){if(this.duplicateMsgDeliveryDelay.observe(t/1e3),r){const t=this.toTopic(e);this.duplicateMsgLateDelivery.inc({topic:t},1)}},onPublishDuplicateMsg(e){const t=this.toTopic(e);this.duplicateMsgIgnored.inc({topic:t},1)},onPeerReadStreamError(){this.peerReadStreamError.inc(1)},onRpcRecvError(){this.rpcRecvError.inc(1)},onRpcDataError(){this.rpcDataError.inc(1)},onRpcRecv(e,t){this.rpcRecvBytes.inc(t),this.rpcRecvCount.inc(1),e.subscriptions&&this.rpcRecvSubscription.inc(e.subscriptions.length),e.messages&&this.rpcRecvMessage.inc(e.messages.length),e.control&&(this.rpcRecvControl.inc(1),e.control.ihave&&this.rpcRecvIHave.inc(e.control.ihave.length),e.control.iwant&&this.rpcRecvIWant.inc(e.control.iwant.length),e.control.graft&&this.rpcRecvGraft.inc(e.control.graft.length),e.control.prune&&this.rpcRecvPrune.inc(e.control.prune.length))},onRpcSent(e,t){if(this.rpcSentBytes.inc(t),this.rpcSentCount.inc(1),e.subscriptions&&this.rpcSentSubscription.inc(e.subscriptions.length),e.messages&&this.rpcSentMessage.inc(e.messages.length),e.control){var r,n,i,o,s,a,c,l;const t=null!==(r=null===(n=e.control.ihave)||void 0===n?void 0:n.length)&&void 0!==r?r:0,u=null!==(i=null===(o=e.control.iwant)||void 0===o?void 0:o.length)&&void 0!==i?i:0,h=null!==(s=null===(a=e.control.graft)||void 0===a?void 0:a.length)&&void 0!==s?s:0,d=null!==(c=null===(l=e.control.prune)||void 0===l?void 0:l.length)&&void 0!==c?c:0;t>0&&this.rpcSentIHave.inc(t),u>0&&this.rpcSentIWant.inc(u),h>0&&this.rpcSentGraft.inc(h),d>0&&this.rpcSentPrune.inc(d),(t>0||u>0||h>0||d>0)&&this.rpcSentControl.inc(1)}},registerScores(e,t){let r=0,n=0,i=0,o=0;for(const s of e)s>=t.graylistThreshold&&r++,s>=t.publishThreshold&&n++,s>=t.gossipThreshold&&i++,s>=0&&o++;this.peersByScoreThreshold.set({threshold:LR.graylist},r),this.peersByScoreThreshold.set({threshold:LR.publish},n),this.peersByScoreThreshold.set({threshold:LR.gossip},i),this.peersByScoreThreshold.set({threshold:LR.mesh},o),this.score.set(e)},registerScoreWeights(e){for(const[t,r]of e.byTopic)this.scoreWeights.set({topic:t,p:"p1"},r.p1w),this.scoreWeights.set({topic:t,p:"p2"},r.p2w),this.scoreWeights.set({topic:t,p:"p3"},r.p3w),this.scoreWeights.set({topic:t,p:"p3b"},r.p3bw),this.scoreWeights.set({topic:t,p:"p4"},r.p4w);this.scoreWeights.set({p:"p5"},e.p5w),this.scoreWeights.set({p:"p6"},e.p6w),this.scoreWeights.set({p:"p7"},e.p7w)},registerScorePerMesh(e,t){const r=new Map;e.forEach(((e,t)=>{var n;const i=null!==(n=this.topicStrToLabel.get(t))&&void 0!==n?n:"unknown";let o=r.get(i);o||(o=new Set,r.set(i,o)),e.forEach((e=>{var t;return null===(t=o)||void 0===t?void 0:t.add(e)}))}));for(const[n,i]of r){const e=[];i.forEach((r=>{var n;e.push(null!==(n=t.get(r))&&void 0!==n?n:0)})),this.scorePerMesh.set({topic:n},e)}}}}(o.metricsRegister,o.metricsTopicStrToLabel,{gossipPromiseExpireSec:this.opts.gossipsubIWantFollowupMs/1e3,behaviourPenaltyThreshold:s.scoreParams.behaviourPenaltyThreshold,maxMeshMessageDeliveriesWindowSec:e/1e3});t.mcacheSize.addCollect((()=>this.onScrapeMetrics(t)));for(const r of this.multicodecs)t.protocolsEnabled.set({protocol:r},1);this.metrics=t}else this.metrics=null;this.gossipTracer=new kR(this.opts.gossipsubIWantFollowupMs,this.msgIdToStrFn,this.metrics),this.score=new CR(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=>VI(e)))}isStarted(){return this.status.code===fP.started}async start(){if(this.isStarted())return;this.log("starting"),this.publishConfig=await async function(e,t){switch(e){case nR:{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 av(t.privateKey);return{type:aR.Signing,author:t,key:t.publicKey,privateKey:e}}case iR:return{type:aR.Anonymous};default:throw new Error('Unknown signature policy "'.concat(e,'"'))}}(this.globalSignaturePolicy,this.components.peerId),this.outboundInflightQueue=xd({objectMode:!0}),_p(this.outboundInflightQueue,(async e=>{for await(const{peerId:t,connection:r}of e)await this.createOutboundStream(t,r)})).catch((e=>this.log.error("outbound inflight queue error",e))),await Promise.all(this.opts.directPeers.map((async e=>{await this.components.peerStore.addressBook.add(e.id,e.addrs)})));const e=this.components.registrar;await Promise.all(this.multicodecs.map((t=>e.handle(t,this.onIncomingStream.bind(this),{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}))));const t=(r={onConnect:this.onPeerConnected.bind(this),onDisconnect:this.onPeerDisconnected.bind(this)},new WI(r));var r;const n=await Promise.all(this.multicodecs.map((r=>e.register(r,t)))),i=setTimeout(this.runHeartbeat,100);this.status={code:fP.started,registrarTopologyIds:n,heartbeatTimeout:i,hearbeatStartMs:Date.now()+100},this.score.start(),this.directPeerInitial=setTimeout((()=>{Promise.resolve().then((async()=>{await Promise.all(Array.from(this.direct).map((async e=>await this.connect(e))))})).catch((e=>{this.log(e)}))}),1e3),this.log("started")}async stop(){if(this.log("stopping"),this.status.code!==fP.started)return;const{registrarTopologyIds:e}=this.status;this.status={code:fP.stopped};const t=this.components.registrar;e.forEach((e=>t.unregister(e))),this.outboundInflightQueue.end();for(const r of this.streamsOutbound.values())r.close();this.streamsOutbound.clear();for(const r of this.streamsInbound.values())r.close();this.streamsInbound.clear(),this.peers.clear(),this.subscriptions.clear(),this.heartbeatTimer&&(this.heartbeatTimer.cancel(),this.heartbeatTimer=null),this.score.stop(),this.mesh.clear(),this.fanout.clear(),this.fanoutLastpub.clear(),this.gossip.clear(),this.control.clear(),this.peerhave.clear(),this.iasked.clear(),this.backoff.clear(),this.outbound.clear(),this.gossipTracer.clear(),this.seenCache.clear(),this.fastMsgIdCache&&this.fastMsgIdCache.clear(),this.directPeerInitial&&clearTimeout(this.directPeerInitial),this.log("stopped")}dumpPeerScoreStats(){return this.score.dumpPeerScoreStats()}onIncomingStream(e){let{stream:t,connection:r}=e;if(!this.isStarted())return;const n=r.remotePeer;this.addPeer(n,r.stat.direction,r.remoteAddr),this.createInboundStream(n,t),this.outboundInflightQueue.push({peerId:n,connection:r})}onPeerConnected(e,t){var r;null===(r=this.metrics)||void 0===r||r.newConnectionCount.inc({status:t.stat.status}),this.isStarted()&&"OPEN"===t.stat.status&&(this.addPeer(e,t.stat.direction,t.remoteAddr),this.outboundInflightQueue.push({peerId:e,connection:t}))}onPeerDisconnected(e){this.log("connection ended %p",e),this.removePeer(e)}async createOutboundStream(e,t){if(!this.isStarted())return;const r=e.toString();if(this.peers.has(r)&&!this.streamsOutbound.has(r))try{var n;const i=new KR(await t.newStream(this.multicodecs),(e=>this.log.error("outbound pipe error",e)),{maxBufferSize:this.opts.maxOutboundBufferSize});this.log("create outbound stream %p",e),this.streamsOutbound.set(r,i);const o=i.protocol;o===XI&&this.floodsubPeers.add(r),null===(n=this.metrics)||void 0===n||n.peersPerProtocol.inc({protocol:o},1),this.subscriptions.size>0&&(this.log("send subscriptions to",r),this.sendSubscriptions(r,Array.from(this.subscriptions),!0))}catch(i){this.log.error("createOutboundStream error",i)}}async createInboundStream(e,t){if(!this.isStarted())return;const r=e.toString();if(!this.peers.has(r))return;const n=this.streamsInbound.get(r);void 0!==n&&(this.log("replacing existing inbound steam %s",r),n.close()),this.log("create inbound stream %s",r);const i=new qR(t,{maxDataLength:this.opts.maxInboundDataLength});this.streamsInbound.set(r,i),this.pipePeerReadStream(e,i.source).catch((e=>this.log(e)))}addPeer(e,t,r){const n=e.toString();if(!this.peers.has(n)){this.log("new peer %p",e),this.peers.add(n),this.score.addPeer(n);const i=function(e){for(const t of e.tuples())switch(t[0]){case dP.ip4:case dP.ip6:return aP(t[0],t[1])}return null}(r);null!==i?this.score.addIP(n,i):this.log("Added peer has no IP in current address %s %s",n,r.toString()),this.outbound.has(n)||this.outbound.set(n,"outbound"===t)}}removePeer(e){const t=e.toString();if(!this.peers.has(t))return;this.log("delete peer %p",e),this.peers.delete(t);const r=this.streamsOutbound.get(t),n=this.streamsInbound.get(t);var i;r&&(null===(i=this.metrics)||void 0===i||i.peersPerProtocol.inc({protocol:r.protocol},-1));null===r||void 0===r||r.close(),null===n||void 0===n||n.close(),this.streamsOutbound.delete(t),this.streamsInbound.delete(t);for(const s of this.topics.values())s.delete(t);for(const[s,a]of this.mesh){var o;if(!0===a.delete(t))null===(o=this.metrics)||void 0===o||o.onRemoveFromMesh(s,NR.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===fP.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=>VI(e)))}getTopics(){return Array.from(this.subscriptions)}async pipePeerReadStream(e,t){try{await _p(t,(async t=>{for await(const a of t)try{var r;const t=a.subarray(),i=WR(t,this.decodeRpcLimits);if(null===(r=this.metrics)||void 0===r||r.onRpcRecv(i,t.length),this.opts.awaitRpcHandler)try{await this.handleReceivedRpc(e,i)}catch(o){var n;null===(n=this.metrics)||void 0===n||n.onRpcRecvError(),this.log(o)}else this.handleReceivedRpc(e,i).catch((e=>{var t;null===(t=this.metrics)||void 0===t||t.onRpcRecvError(),this.log(e)}))}catch(s){var i;null===(i=this.metrics)||void 0===i||i.onRpcDataError(),this.log(s)}}))}catch(n){var r;null===(r=this.metrics)||void 0===r||r.onPeerReadStreamError(),this.handlePeerReadStreamError(n,e)}}handlePeerReadStreamError(e,t){this.log.error(e),this.onPeerDisconnected(t)}async handleReceivedRpc(e,t){var r;if(!this.acceptFrom(e.toString()))return this.log("received message from unacceptable peer %p",e),void(null===(r=this.metrics)||void 0===r||r.rpcRecvNotAccepted.inc());const n=t.subscriptions?t.subscriptions.length:0,i=t.messages?t.messages.length:0;let o=0,s=0,a=0,c=0;if(t.control&&(t.control.ihave&&(o=t.control.ihave.length),t.control.iwant&&(s=t.control.iwant.length),t.control.graft&&(a=t.control.graft.length),t.control.prune&&(c=t.control.prune.length)),this.log("rpc.from ".concat(e.toString()," subscriptions ").concat(n," messages ").concat(i," ihave ").concat(o," iwant ").concat(s," graft ").concat(a," prune ").concat(c)),t.subscriptions&&t.subscriptions.length>0){const r=[];t.subscriptions.forEach((t=>{const n=t.topic,i=!0===t.subscribe;if(null!=n){if(this.allowedTopics&&!this.allowedTopics.has(n))return;this.handleReceivedSubscription(e,n,i),r.push({topic:n,subscribe:i})}})),this.dispatchEvent(new uS("subscription-change",{detail:{peerId:e,subscriptions:r}}))}if(t.messages)for(const l of t.messages){if(this.allowedTopics&&!this.allowedTopics.has(l.topic))continue;const t=this.handleReceivedMessage(e,l).catch((e=>{var t;null===(t=this.metrics)||void 0===t||t.onMsgRecvError(l.topic),this.log(e)}));this.opts.awaitRpcMessageHandler&&await t}t.control&&await this.handleControlMessage(e.toString(),t.control)}handleReceivedSubscription(e,t,r){this.log("subscription update from %p topic %s",e,t);let n=this.topics.get(t);null==n&&(n=new Set,this.topics.set(t,n)),r?n.add(e.toString()):n.delete(e.toString())}async handleReceivedMessage(e,t){var r,n,i;null===(r=this.metrics)||void 0===r||r.onMsgRecvPreValidation(t.topic);const o=await this.validateReceivedMessage(e,t);switch(null===(n=this.metrics)||void 0===n||n.onMsgRecvResult(t.topic,o.code),o.code){case uR.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 uR.invalid:if(o.msgIdStr){const r=o.msgIdStr;this.score.rejectMessage(e.toString(),r,t.topic,o.reason),this.gossipTracer.rejectMessage(r,o.reason)}else this.score.rejectInvalidMessage(e.toString(),t.topic);return void(null===(i=this.metrics)||void 0===i||i.onMsgRecvInvalid(t.topic,o));case uR.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 uS("gossipsub:message",{detail:{propagationSource:e,msgId:o.messageId.msgIdStr,msg:o.msg}})),super.dispatchEvent(new uS("message",{detail:o.msg})))}this.opts.asyncValidation||this.forwardMessage(o.messageId.msgIdStr,t,e.toString())}}async validateReceivedMessage(e,t){var r,n;const i=null===(r=this.fastMsgIdFn)||void 0===r?void 0:r.call(this,t),o=void 0!==i?null===(n=this.fastMsgIdCache)||void 0===n?void 0:n.get(i):void 0;if(o)return{code:uR.duplicate,msgIdStr:o};const s=await async function(e,t){var r;switch(e){case iR:return null!=t.signature?{valid:!1,error:lR.SignaturePresent}:null!=t.seqno?{valid:!1,error:lR.SeqnoPresent}:null!=t.key?{valid:!1,error:lR.FromPresent}:{valid:!0,message:{type:"unsigned",topic:t.topic,data:null!==(r=t.data)&&void 0!==r?r:new Uint8Array(0)}};case nR:{var n,i;if(null==t.seqno)return{valid:!1,error:lR.InvalidSeqno};if(8!==t.seqno.length)return{valid:!1,error:lR.InvalidSeqno};if(null==t.signature)return{valid:!1,error:lR.InvalidSignature};if(null==t.from)return{valid:!1,error:lR.InvalidPeerId};let e,r;try{e=KI(t.from)}catch(o){return{valid:!1,error:lR.InvalidPeerId}}if(t.key){if(r=ov(t.key),void 0!==e.publicKey&&!cl(r.bytes,e.publicKey))return{valid:!1,error:lR.InvalidPeerId}}else{if(null==e.publicKey)return{valid:!1,error:lR.InvalidPeerId};r=ov(e.publicKey)}const s={from:t.from,data:t.data,seqno:t.seqno,topic:t.topic,signature:void 0,key:void 0},a=Jl([UR,$I.Message.encode(s).finish()]);return await r.verify(a,t.signature)?{valid:!0,message:{type:"signed",from:e,data:null!==(n=t.data)&&void 0!==n?n:new Uint8Array(0),sequenceNumber:BigInt("0x".concat($l(t.seqno,"base16"))),topic:t.topic,signature:t.signature,key:null!==(i=t.key)&&void 0!==i?i:sv(r)}}:{valid:!1,error:lR.InvalidSignature}}}}(this.globalSignaturePolicy,t);if(!s.valid)return{code:uR.invalid,reason:cR.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:uR.invalid,reason:cR.Error,error:lR.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:uR.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=oR.Ignore),t="ERR_TOPIC_VALIDATOR_REJECT"===e?oR.Reject:oR.Ignore}if(t!==oR.Accept)return{code:uR.invalid,reason:hR(t),msgIdStr:l}}return{code:uR.valid,messageId:u,msg:a}}getScore(e){return this.score.score(e)}sendSubscriptions(e,t,r){this.sendRpc(e,{subscriptions:t.map((e=>({topic:e,subscribe:r})))})}async handleControlMessage(e,t){var r;if(void 0===t)return;const n=t.ihave?this.handleIHave(e,t.ihave):[],i=t.iwant?this.handleIWant(e,t.iwant):[],o=t.graft?await this.handleGraft(e,t.graft):[];if(t.prune&&await this.handlePrune(e,t.prune),!n.length&&!i.length&&!o.length)return;const s=this.sendRpc(e,{messages:i,control:{iwant:n,prune:o}}),a=null===(r=n[0])||void 0===r?void 0:r.messageIDs;var c;a&&(s?this.gossipTracer.addPromise(e,a):null===(c=this.metrics)||void 0===c||c.iwantPromiseUntracked.inc(1))}acceptFrom(e){if(this.direct.has(e))return!0;const t=Date.now(),r=this.acceptFromWhitelist.get(e);if(r&&r.messagesAccepted<128&&r.acceptUntil>=t)return r.messagesAccepted+=1,!0;const n=this.score.score(e);return n>=0?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+1e3}):this.acceptFromWhitelist.delete(e),n>=this.opts.scoreThresholds.graylistThreshold}handleIHave(e,t){var r,n;if(!t.length)return[];const i=this.score.score(e);var o;if(i<this.opts.scoreThresholds.gossipThreshold)return this.log("IHAVE: ignoring peer %s with score below threshold [ score = %d ]",e,i),null===(o=this.metrics)||void 0===o||o.ihaveRcvIgnored.inc({reason:xR.LowScore}),[];const s=(null!==(r=this.peerhave.get(e))&&void 0!==r?r:0)+1;var a;if(this.peerhave.set(e,s),s>10)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,s),null===(a=this.metrics)||void 0===a||a.ihaveRcvIgnored.inc({reason:xR.MaxIhave}),[];const c=null!==(n=this.iasked.get(e))&&void 0!==n?n:0;var l;if(c>=eR)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:xR.MaxIasked}),[];const u=new Map;if(t.forEach((e=>{var t;let{topicID:r,messageIDs:n}=e;if(!r||!n||!this.mesh.has(r))return;let i=0;n.forEach((e=>{const t=this.msgIdToStrFn(e);this.seenCache.has(t)||(u.set(t,e),i++)})),null===(t=this.metrics)||void 0===t||t.onIhaveRcv(r,n.length,i)})),!u.size)return[];let h=u.size;h+c>eR&&(h=eR-c),this.log("IHAVE: Asking for %d out of %d messages from %s",h,u.size,e);let d=Array.from(u.values());return tR(d),d=d.slice(0,h),this.iasked.set(e,c+h),[{messageIDs:d}]}handleIWant(e,t){var r;if(!t.length)return[];const n=this.score.score(e);if(n<this.opts.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,n),[];const i=new Map,o=new Map;let s=0;return t.forEach((t=>{let{messageIDs:r}=t;r&&r.forEach((t=>{var r;const n=this.msgIdToStrFn(t),a=this.mcache.getWithIWantCount(n,e);null!=a?(o.set(a.msg.topic,1+(null!==(r=o.get(a.msg.topic))&&void 0!==r?r:0)),a.count>3?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,t):i.set(n,a.msg)):s++}))})),null===(r=this.metrics)||void 0===r||r.onIwantRcv(o,s),i.size?(this.log("IWANT: Sending %d messages to %s",i.size,e),Array.from(i.values())):(this.log("IWANT: Could not provide any wanted messages to %s",e),[])}async handleGraft(e,t){const r=[],n=this.score.score(e),i=Date.now();let o=this.opts.doPX;return t.forEach((t=>{var s,a;let{topicID:c}=t;if(!c)return;const l=this.mesh.get(c);if(!l)return void(o=!1);if(l.has(e))return;if(this.direct.has(e))return this.log("GRAFT: ignoring request from direct peer %s",e),r.push(c),void(o=!1);const u=null===(s=this.backoff.get(c))||void 0===s?void 0:s.get(e);if("number"===typeof u&&i<u){this.log("GRAFT: ignoring backed off peer %s",e),this.score.addPenalty(e,1,DR.GraftBackoff),o=!1;const t=u+this.opts.graftFloodThreshold-this.opts.pruneBackoff;return i<t&&this.score.addPenalty(e,1,DR.GraftBackoff),this.addBackoff(e,c),void r.push(c)}return n<0?(this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,n,c),r.push(c),o=!1,void this.addBackoff(e,c)):l.size>=this.opts.Dhi&&!this.outbound.get(e)?(r.push(c),void this.addBackoff(e,c)):(this.log("GRAFT: Add mesh link from %s in %s",e,c),this.score.graft(e,c),l.add(e),void(null===(a=this.metrics)||void 0===a||a.onAddToMesh(c,PR.Subscribed,1)))})),r.length?await Promise.all(r.map((t=>this.makePrune(e,t,o)))):[]}async handlePrune(e,t){const r=this.score.score(e);for(const{topicID:i,backoff:o,peers:s}of t){if(null==i)continue;const t=this.mesh.get(i);if(!t)return;var n;if(this.log("PRUNE: Remove mesh link to %s in %s",e,i),this.score.prune(e,i),t.has(e))t.delete(e),null===(n=this.metrics)||void 0===n||n.onRemoveFromMesh(i,NR.Unsub,1);if("number"===typeof o&&o>0?this.doAddBackoff(e,i,1e3*o):this.addBackoff(e,i),s&&s.length){if(r<this.opts.scoreThresholds.acceptPXThreshold){this.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,r,i);continue}await this.pxConnect(s)}}}addBackoff(e,t){this.doAddBackoff(e,t,this.opts.pruneBackoff)}doAddBackoff(e,t,r){var n;let i=this.backoff.get(t);i||(i=new Map,this.backoff.set(t,i));const o=Date.now()+r;(null!==(n=i.get(e))&&void 0!==n?n:0)<o&&i.set(e,o)}applyIwantPenalties(){this.gossipTracer.getBrokenPromises().forEach(((e,t)=>{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",t,e),this.score.addPenalty(t,e,DR.BrokenPromise)}))}clearBackoff(){if(this.heartbeatTicks%15!==0)return;const e=Date.now();this.backoff.forEach(((t,r)=>{t.forEach(((r,n)=>{r<e&&t.delete(n)})),0===t.size&&this.backoff.delete(r)}))}async directConnect(){const e=[];this.direct.forEach((t=>{this.streamsOutbound.has(t)||e.push(t)})),await Promise.all(e.map((async e=>await this.connect(e))))}async pxConnect(e){e.length>this.opts.prunePeers&&(tR(e),e=e.slice(0,this.opts.prunePeers));const t=[];await Promise.all(e.map((async e=>{if(!e.peerID)return;const r=KI(e.peerID).toString();if(!this.peers.has(r))if(e.signedPeerRecord)try{const n=await Vk.openAndCertify(e.signedPeerRecord,"libp2p-peer-record"),i=n.peerId;if(!n.peerId.equals(r))return void this.log("bogus peer record obtained through px: peer ID %p doesn't match expected peer %p",i,r);if(!await this.components.peerStore.addressBook.consumePeerRecord(n))return void this.log("bogus peer record obtained through px: could not add peer record to address book");t.push(r)}catch(n){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=VI(e),r=await this.components.connectionManager.openConnection(t);for(const n of this.multicodecs)for(const e of this.components.registrar.getTopologies(n))e.onConnect(t,r)}subscribe(e){if(this.status.code!==fP.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!==fP.started)throw new Error("Pubsub is not started");const t=this.subscriptions.delete(e);if(this.log("unsubscribe from %s - am subscribed %s",e,t),t)for(const r of this.peers.keys())this.sendSubscriptions(r,[e],!1);this.leave(e)}join(e){var t;if(this.status.code!==fP.started)throw new Error("Gossipsub has not started");if(this.mesh.has(e))return;this.log("JOIN %s",e),null===(t=this.metrics)||void 0===t||t.onJoin(e);const r=new Set,n=this.fanout.get(e);var i;n&&(this.fanout.delete(e),this.fanoutLastpub.delete(e),n.forEach((e=>{!this.direct.has(e)&&this.score.score(e)>=0&&r.add(e)})),null===(i=this.metrics)||void 0===i||i.onAddToMesh(e,PR.Fanout,r.size));if(r.size<this.opts.D){var o;const t=r.size;this.getRandomGossipPeers(e,this.opts.D,(e=>!r.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0)).forEach((e=>{r.add(e)})),null===(o=this.metrics)||void 0===o||o.onAddToMesh(e,PR.Random,r.size-t)}this.mesh.set(e,r),r.forEach((t=>{this.log("JOIN: Add mesh link to %s in %s",t,e),this.sendGraft(t,e)}))}leave(e){var t;if(this.status.code!==fP.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e),null===(t=this.metrics)||void 0===t||t.onLeave(e);const r=this.mesh.get(e);r&&(Promise.all(Array.from(r).map((async t=>(this.log("LEAVE: Remove mesh link to %s in %s",t,e),await this.sendPrune(t,e))))).catch((e=>{this.log("Error sending prunes to mesh peers",e)})),this.mesh.delete(e))}selectPeersToForward(e,t,r){const n=new Set,i=this.topics.get(e);i&&(this.direct.forEach((e=>{!i.has(e)||t===e||null!==r&&void 0!==r&&r.has(e)||n.add(e)})),this.floodsubPeers.forEach((e=>{i.has(e)&&t!==e&&(null===r||void 0===r||!r.has(e))&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&n.add(e)})));const o=this.mesh.get(e);return o&&o.size>0&&o.forEach((e=>{t===e||null!==r&&void 0!==r&&r.has(e)||n.add(e)})),n}selectPeersToPublish(e){const t=new Set,r={direct:0,floodsub:0,mesh:0,fanout:0},n=this.topics.get(e);if(n)if(this.opts.floodPublish)n.forEach((e=>{this.direct.has(e)?(t.add(e),r.direct++):this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)}));else{this.direct.forEach((e=>{n.has(e)&&(t.add(e),r.direct++)})),this.floodsubPeers.forEach((e=>{n.has(e)&&this.score.score(e)>=this.opts.scoreThresholds.publishThreshold&&(t.add(e),r.floodsub++)}));const i=this.mesh.get(e);if(i&&i.size>0)i.forEach((e=>{t.add(e),r.mesh++}));else{const n=this.fanout.get(e);if(n&&n.size>0)n.forEach((e=>{t.add(e),r.fanout++}));else{const n=this.getRandomGossipPeers(e,this.opts.D,(e=>this.score.score(e)>=this.opts.scoreThresholds.publishThreshold));n.size>0&&(this.fanout.set(e,n),n.forEach((e=>{t.add(e),r.fanout++})))}this.fanoutLastpub.set(e,Date.now())}}return{tosend:t,tosendCount:r}}forwardMessage(e,t,r,n){var i;r&&this.score.deliverMessage(r,e,t.topic);const o=this.selectPeersToForward(t.topic,r,n);o.forEach((e=>{this.sendRpc(e,{messages:[t]})})),null===(i=this.metrics)||void 0===i||i.onForwardMsg(t.topic,o.size)}async publish(e,t,r){var n,i,o;const s=this.dataTransform?this.dataTransform.outboundTransform(e,t):t;if(null==this.publishConfig)throw Error("PublishError.Uninitialized");const{raw:a,msg:c}=await async function(e,t,r,n){switch(e.type){case aR.Signing:{const i={from:e.author.toBytes(),data:n,seqno:Mm(8),topic:t,signature:void 0,key:void 0},o=Jl([UR,$I.Message.encode(i).finish()]);return i.signature=await e.privateKey.sign(o),i.key=e.key,{raw:i,msg:{type:"signed",from:e.author,data:r,sequenceNumber:BigInt("0x".concat($l(i.seqno,"base16"))),topic:t,signature:i.signature,key:i.key}}}case aR.Anonymous:return{raw:{from:void 0,data:n,seqno:void 0,topic:t,signature:void 0,key:void 0},msg:{type:"unsigned",data:r,topic:t}}}}(this.publishConfig,e,t,s),l=await this.msgIdFn(c),u=this.msgIdToStrFn(l),h=null!==(n=null===r||void 0===r?void 0:r.ignoreDuplicatePublishError)&&void 0!==n?n:this.opts.ignoreDuplicatePublishError;if(this.seenCache.has(u)){var d;if(h)return null===(d=this.metrics)||void 0===d||d.onPublishDuplicateMsg(e),{recipients:[]};throw Error("PublishError.Duplicate")}const{tosend:f,tosendCount:p}=this.selectPeersToPublish(e),g=!0===this.opts.emitSelf&&this.subscriptions.has(e),y=null!==(i=null===r||void 0===r?void 0:r.allowPublishToZeroPeers)&&void 0!==i?i:this.opts.allowPublishToZeroPeers;if(0===f.size&&!y&&!g)throw Error("PublishError.InsufficientPeers");this.seenCache.put(u),this.mcache.put({msgId:l,msgIdStr:u},a,!0),this.publishedMessageIds.put(u);for(const m of f){this.sendRpc(m,{messages:[a]})||f.delete(m)}return null===(o=this.metrics)||void 0===o||o.onPublishMsg(e,p,f.size,null!=a.data?a.data.length:0),g&&(f.add(this.components.peerId.toString()),super.dispatchEvent(new uS("gossipsub:message",{detail:{propagationSource:this.components.peerId,msgId:u,msg:c}})),super.dispatchEvent(new uS("message",{detail:c}))),{recipients:Array.from(f.values()).map((e=>VI(e)))}}reportMessageValidationResult(e,t,r){if(r===oR.Accept){var n;const o=this.mcache.validate(e);if(null===(n=this.metrics)||void 0===n||n.onReportValidationMcacheHit(null!==o),null!=o){var i;const{message:n,originatingPeers:s}=o;this.score.deliverMessage(t.toString(),e,n.topic),this.forwardMessage(e,o.message,t.toString(),s),null===(i=this.metrics)||void 0===i||i.onReportValidation(n.topic,r)}}else{var o;const n=this.mcache.remove(e);if(null===(o=this.metrics)||void 0===o||o.onReportValidationMcacheHit(null!==n),n){var s;const i=hR(r),{message:o,originatingPeers:a}=n;this.score.rejectMessage(t.toString(),e,o.topic,i);for(const t of a)this.score.rejectMessage(t,e,o.topic,i);null===(s=this.metrics)||void 0===s||s.onReportValidation(o.topic,r)}}}sendGraft(e,t){const r=[{topicID:t}];this.sendRpc(e,{control:{graft:r}})}async sendPrune(e,t){const r=[await this.makePrune(e,t,this.opts.doPX)];this.sendRpc(e,{control:{prune:r}})}sendRpc(e,t){var r;const n=this.streamsOutbound.get(e);if(!n)return this.log("Cannot send RPC to ".concat(e," as there is no open stream to it available")),!1;const i=this.control.get(e);i&&(this.piggybackControl(e,t,i),this.control.delete(e));const o=this.gossip.get(e);o&&(this.piggybackGossip(e,t,o),this.gossip.delete(e));const s=$I.encode(t).finish();try{n.push(s)}catch(a){return this.log.error("Cannot send rpc to ".concat(e),a),i&&this.control.set(e,i),o&&this.gossip.set(e,o),!1}return null===(r=this.metrics)||void 0===r||r.onRpcSent(t,s.length),!0}piggybackControl(e,t,r){if(r.graft){t.control||(t.control={}),t.control.graft||(t.control.graft=[]);for(const i of r.graft){var n;i.topicID&&null!==(n=this.mesh.get(i.topicID))&&void 0!==n&&n.has(e)&&t.control.graft.push(i)}}if(r.prune){t.control||(t.control={}),t.control.prune||(t.control.prune=[]);for(const n of r.prune){var i;!n.topicID||null!==(i=this.mesh.get(n.topicID))&&void 0!==i&&i.has(e)||t.control.prune.push(n)}}}piggybackGossip(e,t,r){t.control||(t.control={}),t.control.ihave=r}async sendGraftPrune(e,t,r){const n=this.opts.doPX;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,n&&!(null!==(t=r.get(i))&&void 0!==t&&t))}))),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,n&&!(null!==(t=r.get(i))&&void 0!==t&&t))})));this.sendRpc(i,{control:{prune:e}})}}emitGossip(e){const t=this.mcache.getGossipIDs(new Set(e.keys()));for(const[n,i]of e){var r;this.doEmitGossip(n,i,null!==(r=t.get(n))&&void 0!==r?r:[])}}doEmitGossip(e,t,r){if(!r.length)return;if(tR(r),r.length>eR&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length),!t.size)return;let n=this.opts.Dlazy;const i=.25*t.size;let o=t;i>n&&(n=i),n>o.size?n=o.size:o=tR(Array.from(o)).slice(0,n),o.forEach((t=>{let n=r;r.length>eR&&(n=tR(n.slice()).slice(0,eR)),this.pushGossip(t,{topicID:e,messageIDs:n})}))}flush(){for(const[e,t]of this.gossip.entries())this.gossip.delete(e),this.sendRpc(e,{control:{ihave:t}});for(const[e,t]of this.control.entries())this.control.delete(e),this.sendRpc(e,{control:{graft:t.graft,prune:t.prune}})}pushGossip(e,t){this.log("Add gossip to %s",e);const r=this.gossip.get(e)||[];this.gossip.set(e,r.concat(t))}async makePrune(e,t,r){if(this.score.prune(e,t),this.streamsOutbound.get(e).protocol===JI)return{topicID:t,peers:[]};const n=this.opts.pruneBackoff/1e3;if(!r)return{topicID:t,peers:[],backoff:n};const i=this.getRandomGossipPeers(t,this.opts.prunePeers,(t=>t!==e&&this.score.score(t)>=0)),o=await Promise.all(Array.from(i).map((async e=>{const t=VI(e);return{peerID:t.toBytes(),signedPeerRecord:await this.components.peerStore.addressBook.getRawEnvelope(t)}})));return{topicID:t,peers:o,backoff:n}}async heartbeat(){var e,t;const{D:r,Dlo:n,Dhi:i,Dscore:o,Dout:s,fanoutTTL:a}=this.opts;this.heartbeatTicks++;const c=new Map,l=e=>{let t=c.get(e);return void 0===t&&(t=this.score.score(e),c.set(e,t)),t},u=new Map,h=new Map,d=new Map;this.clearBackoff(),this.peerhave.clear(),null===(e=this.metrics)||void 0===e||e.cacheSize.set({cache:"iasked"},this.iasked.size),this.iasked.clear(),this.applyIwantPenalties(),this.heartbeatTicks%this.opts.directConnectTicks===0&&await this.directConnect(),null===(t=this.fastMsgIdCache)||void 0===t||t.prune(),this.seenCache.prune(),this.gossipTracer.prune(),this.publishedMessageIds.prune();const f=new Map;this.mesh.forEach(((e,t)=>{const a=this.topics.get(t),c=new Set,p=new Set;if(f.set(t,p),a){const r=tR(Array.from(a)),n=this.backoff.get(t);for(const t of r){const r=this.streamsOutbound.get(t);if(r&&this.multicodecs.includes(r.protocol)&&!e.has(t)&&!this.direct.has(t)){const e=l(t);n&&n.has(t)||!(e>=0)||c.add(t),e>=this.opts.scoreThresholds.gossipThreshold&&p.add(t)}}}const g=(r,n)=>{var i;this.log("HEARTBEAT: Remove mesh link to %s in %s",r,t),this.addBackoff(r,t),e.delete(r),l(r)>=this.opts.scoreThresholds.gossipThreshold&&p.add(r),null===(i=this.metrics)||void 0===i||i.onRemoveFromMesh(t,n,1);const o=h.get(r);o?o.push(t):h.set(r,[t])},y=(r,n)=>{var i;this.log("HEARTBEAT: Add mesh link to %s in %s",r,t),this.score.graft(r,t),e.add(r),p.delete(r),null===(i=this.metrics)||void 0===i||i.onAddToMesh(t,n,1);const o=u.get(r);o?o.push(t):u.set(r,[t])};if(e.forEach((e=>{const r=l(e);r<0&&(this.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,r,t),g(e,NR.BadScore),d.set(e,!0))})),e.size<n){const t=function(e,t){return SR(e,t,(()=>!0))}(c,r-e.size);t.forEach((e=>{y(e,PR.NotEnough)}))}if(e.size>i){let t=Array.from(e);t.sort(((e,t)=>l(t)-l(e))),t=t.slice(0,o).concat(tR(t.slice(o)));let n=0;if(t.slice(0,r).forEach((e=>{this.outbound.get(e)&&n++})),n<s){const e=e=>{const r=t[e];for(let n=e;n>0;n--)t[n]=t[n-1];t[0]=r};if(n>0){let i=n;for(let n=1;n<r&&i>0;n++)this.outbound.get(t[n])&&(e(n),i--)}let i=r-n;for(let n=r;n<t.length&&i>0;n++)this.outbound.get(t[n])&&(e(n),i--)}t.slice(r).forEach((e=>{g(e,NR.Excess)}))}if(e.size>=n){let t=0;if(e.forEach((e=>{this.outbound.get(e)&&t++})),t<s){SR(c,s-t,(e=>!0===this.outbound.get(e))).forEach((e=>{y(e,PR.Outbound)}))}}if(this.heartbeatTicks%this.opts.opportunisticGraftTicks===0&&e.size>1){const r=Array.from(e).sort(((e,t)=>l(e)-l(t))),n=Math.floor(e.size/2),i=l(r[n]);if(i<this.opts.scoreThresholds.opportunisticGraftThreshold){const e=SR(c,this.opts.opportunisticGraftPeers,(e=>l(e)>i));for(const r of e)this.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",r,t),y(r,PR.Opportunistic)}}}));const p=Date.now();this.fanoutLastpub.forEach(((e,t)=>{e+a<p&&(this.fanout.delete(t),this.fanoutLastpub.delete(t))})),this.fanout.forEach(((e,t)=>{const n=this.topics.get(t);e.forEach((t=>{(!n.has(t)||l(t)<this.opts.scoreThresholds.publishThreshold)&&e.delete(t)}));const i=this.topics.get(t),o=[],s=new Set;if(f.set(t,s),i){const t=tR(Array.from(i));for(const r of t){const t=this.streamsOutbound.get(r);if(t&&this.multicodecs.includes(t.protocol)&&!e.has(r)&&!this.direct.has(r)){const e=l(r);e>=this.opts.scoreThresholds.publishThreshold&&o.push(r),e>=this.opts.scoreThresholds.gossipThreshold&&s.add(r)}}}if(e.size<r){const t=r-e.size;o.slice(0,t).forEach((t=>{e.add(t),null===s||void 0===s||s.delete(t)}))}})),this.emitGossip(f),await this.sendGraftPrune(u,h,d),this.flush(),this.mcache.shift(),this.dispatchEvent(new uS("gossipsub:heartbeat"))}getRandomGossipPeers(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>!0;const n=this.topics.get(e);if(!n)return new Set;let i=[];return n.forEach((e=>{const t=this.streamsOutbound.get(e);t&&this.multicodecs.includes(t.protocol)&&r(e)&&i.push(e)})),i=tR(i),t>0&&i.length>t&&(i=i.slice(0,t)),new Set(i)}onScrapeMetrics(e){var t,r;e.mcacheSize.set(this.mcache.size),e.mcacheNotValidatedCount.set(this.mcache.notValidatedCount),e.cacheSize.set({cache:"direct"},this.direct.size),e.cacheSize.set({cache:"seenCache"},this.seenCache.size),e.cacheSize.set({cache:"fastMsgIdCache"},null!==(t=null===(r=this.fastMsgIdCache)||void 0===r?void 0:r.size)&&void 0!==t?t:0),e.cacheSize.set({cache:"publishedMessageIds"},this.publishedMessageIds.size),e.cacheSize.set({cache:"mcache"},this.mcache.size),e.cacheSize.set({cache:"score"},this.score.size),e.cacheSize.set({cache:"gossipTracer.promises"},this.gossipTracer.size),e.cacheSize.set({cache:"gossipTracer.requests"},this.gossipTracer.requestMsByMsgSize),e.cacheSize.set({cache:"topics"},this.topics.size),e.cacheSize.set({cache:"subscriptions"},this.subscriptions.size),e.cacheSize.set({cache:"mesh"},this.mesh.size),e.cacheSize.set({cache:"fanout"},this.fanout.size),e.cacheSize.set({cache:"peers"},this.peers.size),e.cacheSize.set({cache:"streamsOutbound"},this.streamsOutbound.size),e.cacheSize.set({cache:"streamsInbound"},this.streamsInbound.size),e.cacheSize.set({cache:"acceptFromWhitelist"},this.acceptFromWhitelist.size),e.cacheSize.set({cache:"gossip"},this.gossip.size),e.cacheSize.set({cache:"control"},this.control.size),e.cacheSize.set({cache:"peerhave"},this.peerhave.size),e.cacheSize.set({cache:"outbound"},this.outbound.size);let n=0;for(const l of this.backoff.values())n+=l.size;e.cacheSize.set({cache:"backoff"},n);for(const[l,u]of this.topics)e.topicPeersCount.set({topicStr:l},u.size);for(const[l,u]of this.mesh)e.meshPeerCounts.set({topicStr:l},u.size);const i=[],o=new Map;e.behaviourPenalty.reset();for(const l of this.peers.keys()){var s,a;const t=this.score.score(l);i.push(t),o.set(l,t),e.behaviourPenalty.observe(null!==(s=null===(a=this.score.peerStats.get(l))||void 0===a?void 0:a.behaviourPenalty)&&void 0!==s?s:0)}e.registerScores(i,this.opts.scoreThresholds),e.registerScorePerMesh(this.mesh,o);const c=function(e,t,r,n,i){const o={byTopic:new Map,p5w:[],p6w:[],p7w:[],score:[]};for(const s of e){const e=t.get(s);if(e){const t=VR(s,e,r,n,i);for(const[e,r]of t.byTopic){let t=o.byTopic.get(e);t||(t={p1w:[],p2w:[],p3w:[],p3bw:[],p4w:[]},o.byTopic.set(e,t)),t.p1w.push(r.p1w),t.p2w.push(r.p2w),t.p3w.push(r.p3w),t.p3bw.push(r.p3bw),t.p4w.push(r.p4w)}o.p5w.push(t.p5w),o.p6w.push(t.p6w),o.p7w.push(t.p7w),o.score.push(t.score)}else o.p5w.push(0),o.p6w.push(0),o.p7w.push(0),o.score.push(0)}return o}(this.peers.keys(),this.score.peerStats,this.score.params,this.score.peerIPs,e.topicStrToLabel);e.registerScoreWeights(c)}}pP.multicodec=ZI;Symbol.for("nodejs.util.inspect.custom"),sP("dns").code,sP("dns4").code,sP("dns6").code,sP("dnsaddr").code,new Map,Symbol.for("@multiformats/js-multiaddr/multiaddr");const gP=Yu("waku:keep-alive");class yP{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:r,relayKeepAlive:n}=this.options,i=e.toString();if(0!==r){const n=setInterval((()=>{t(e).catch((e=>{gP("Ping failed (".concat(i,")"),e)}))}),1e3*r);this.pingKeepAliveTimers.set(i,n)}const o=this.relay;if(o&&0!==n){const t=function(e){let{contentTopic:t,ephemeral:r,metaSetter:n}=e;return new wP(t,r,n)}({contentTopic:"/relay-ping/1/ping/null",ephemeral:!0}),r=setInterval((()=>{gP("Sending Waku Relay ping message"),o.send(t,{payload:new Uint8Array([1])}).catch((e=>gP("Failed to send relay ping",e)))}),1e3*n);this.relayKeepAliveTimers.set(e,r)}}stop(e){const t=e.toString();this.pingKeepAliveTimers.has(t)&&(clearInterval(this.pingKeepAliveTimers.get(t)),this.pingKeepAliveTimers.delete(t)),this.relayKeepAliveTimers.has(e)&&(clearInterval(this.relayKeepAliveTimers.get(e)),this.relayKeepAliveTimers.delete(e))}stopAll(){for(const e of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(e);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}}const mP=Yu("waku:connection-manager");class vP{static create(e,t,r,n,i){let o=vP.instances.get(e);return o||(o=new vP(t,r,n,i),vP.instances.set(e,o)),o}constructor(e,t,r,n){Xa(this,"keepAliveManager",void 0),Xa(this,"options",void 0),Xa(this,"libp2pComponents",void 0),Xa(this,"dialAttemptsForPeer",new Map),Xa(this,"dialErrorsForPeer",new Map),Xa(this,"currentActiveDialCount",0),Xa(this,"pendingPeerDialQueue",[]),Xa(this,"onEventHandlers",{"peer:discovery":async e=>{const{id:t}=e.detail;this.attemptDial(t).catch((e=>mP("Error dialing peer ".concat(t.toString()," : ").concat(e))))},"peer:connect":async e=>{const{remotePeer:t}=e.detail;this.keepAliveManager.start(t,this.libp2pComponents.ping.bind(this));if((await this.getTagNamesForPeer(t)).includes(Ku.BOOTSTRAP)){this.libp2pComponents.getConnections().filter((e=>e.tags.includes(Ku.BOOTSTRAP))).length>this.options.maxBootstrapPeersAllowed&&await this.dropConnection(t)}},"peer:disconnect":()=>e=>{this.keepAliveManager.stop(e.detail.remotePeer)}}),this.libp2pComponents=e,this.options={maxDialAttemptsForPeer:3,maxBootstrapPeersAllowed:1,maxParallelDials:3,...n},this.keepAliveManager=new yP(t,r),this.run().then((()=>mP("Connection Manager is now running"))).catch((e=>mP("Unexpected error while running service",e))),this.dialPeerStorePeers()}async dialPeerStorePeers(){const e=await this.libp2pComponents.peerStore.all(),t=[];for(const n of e)this.libp2pComponents.getConnections().find((e=>e.remotePeer===n.id))||t.push(this.attemptDial(n.id));try{await Promise.all(t)}catch(r){mP("Unexpected error while dialing peer store peers",r)}}async run(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener()}stop(){this.keepAliveManager.stopAll(),this.libp2pComponents.removeEventListener("peer:connect",this.onEventHandlers["peer:connect"]),this.libp2pComponents.removeEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"]),this.libp2pComponents.removeEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}async dialPeer(e){this.currentActiveDialCount+=1;let t=0;for(;t<=this.options.maxDialAttemptsForPeer;)try{mP("Dialing peer ".concat(e.toString())),await this.libp2pComponents.dial(e);const t=await this.getTagNamesForPeer(e);return this.libp2pComponents.getConnections(e).forEach((e=>e.tags=Array.from(new Set([...e.tags,...t])))),void this.dialAttemptsForPeer.delete(e.toString())}catch(n){var r;const i=n;this.dialErrorsForPeer.set(e.toString(),i),mP("Error dialing peer ".concat(e.toString()," - ").concat(i.errors)),t=null!==(r=this.dialAttemptsForPeer.get(e.toString()))&&void 0!==r?r:1,this.dialAttemptsForPeer.set(e.toString(),t+1),t<=this.options.maxDialAttemptsForPeer&&mP("Reattempting dial (".concat(t,")"))}try{return mP("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.libp2pComponents.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{await this.libp2pComponents.hangUp(e),mP("Dropped connection with peer ".concat(e.toString()))}catch(t){mP("Error dropping connection with peer ".concat(e.toString()," - ").concat(t))}}async processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveDialCount<this.options.maxParallelDials){const e=this.pendingPeerDialQueue.shift();if(!e)return;this.attemptDial(e).catch((e=>{mP(e)}))}}startPeerDiscoveryListener(){this.libp2pComponents.peerStore.addEventListener("peer",this.onEventHandlers["peer:discovery"])}startPeerConnectionListener(){this.libp2pComponents.addEventListener("peer:connect",this.onEventHandlers["peer:connect"])}startPeerDisconnectionListener(){this.libp2pComponents.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.libp2pComponents.getConnections(e).length>0)return!1;if(!(await this.getTagNamesForPeer(e)).some((e=>e===Ku.BOOTSTRAP)))return!0;if(this.libp2pComponents.getConnections().filter((e=>{e.tags.find((e=>e===Ku.BOOTSTRAP))})).length<this.options.maxBootstrapPeersAllowed)return!0;return!1}async getTagNamesForPeer(e){return(await this.libp2pComponents.peerStore.getTags(e)).map((e=>e.name))}}Xa(vP,"instances",new Map);Yu("waku:waku");Yu("waku:message:version-0");const bP=BigInt(1e6);class wP{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=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=r,!e||""===e)throw new Error("Content topic must be specified")}async toWire(e){return gh.encode(await this.toProtoObj(e))}async toProtoObj(e){var t;const r=null!==(t=e.timestamp)&&void 0!==t?t:new Date,n={payload:e.payload,version:0,contentTopic:this.contentTopic,timestamp:BigInt(r.valueOf())*bP,meta:void 0,rateLimitProof:e.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const e=this.metaSetter(n);return{...n,meta:e}}return n}}function EP(e){return null!=e[Symbol.asyncIterator]}const _P=e=>{const t=Ed.encodingLength(e),r=Hl(t);return Ed.encode(e,r),_P.bytes=t,r};_P.bytes=0;const SP=8,AP=4194304;var TP;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(TP||(TP={}));const CP=e=>{const t=Ed.decode(e);return CP.bytes=Ed.encodingLength(t),t};function kP(e,t){var r,n,i;const o=new cd;let s=TP.LENGTH,a=-1;const c=null!==(r=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==r?r:CP,l=null!==(n=null===t||void 0===t?void 0:t.maxLengthLength)&&void 0!==n?n:SP,u=null!==(i=null===t||void 0===t?void 0:t.maxDataLength)&&void 0!==i?i:AP;function*h(){for(;o.byteLength>0;){if(s===TP.LENGTH)try{if(a=c(o),a<0)throw Td(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw Td(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=TP.DATA}catch(e){if(e instanceof RangeError){if(o.byteLength>l)throw Td(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw e}if(s===TP.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=TP.LENGTH}}}return EP(e)?async function*(){for await(const t of e)o.append(t),yield*h();if(o.byteLength>0)throw Td(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 Td(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}CP.bytes=0,kP.fromReader=(e,t)=>{let r=1;return kP(async function*(){for(;;)try{const{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}(),{...null!==t&&void 0!==t?t:{},onLength:e=>{r=e}})};new Uint8Array;Yu("waku:filter");Yu("waku:filter:v2");Yu("waku:light-push");BigInt(1e6);var IP;!function(e){e.BACKWARD="backward",e.FORWARD="forward"}(IP||(IP={}));Bh.HistoryError;Yu("waku:store");Yu("waku:wait-for-remote-peer");const RP=Yu("waku:relay");function PP(e,t){const r=performance.now();RP("validating message from ".concat(e," received on ").concat(t.topic));let n=oR.Accept;try{const e=gh.decode(t.data);e.contentTopic&&e.contentTopic.length&&e.payload&&e.payload.length||(n=oR.Reject)}catch(o){n=oR.Reject}const i=performance.now();return RP("Validation time (must be <100ms): ".concat(i-r,"ms")),n}const NP=Yu("waku:message:topic-only");class DP{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 xP{constructor(){Xa(this,"contentTopic","")}fromWireToProtoObj(e){const t=Eh.decode(e);return NP("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 DP(e,t)}}const LP=Yu("waku:relay");class OP{constructor(e,t){var r;if(Xa(this,"pubSubTopic",void 0),Xa(this,"defaultDecoder",void 0),Xa(this,"gossipSub",void 0),Xa(this,"observers",void 0),!this.isRelayPubSub(e.pubsub))throw Error("Failed to initialize Relay. libp2p.pubsub does not support ".concat(OP.multicodec));this.gossipSub=e.pubsub,this.pubSubTopic=null!==(r=null===t||void 0===t?void 0:t.pubSubTopic)&&void 0!==r?r:"/waku/2/default-waku/proto",this.gossipSub.isStarted()&&this.gossipSubSubscribe(this.pubSubTopic),this.observers=new Map,this.defaultDecoder=new xP}async start(){if(this.gossipSub.isStarted())throw Error("GossipSub already started.");await this.gossipSub.start(),this.gossipSubSubscribe(this.pubSubTopic)}async send(e,t){if(!gf(t.payload))return LP("Failed to send waku relay: message is bigger that 1MB"),{recipients:[],error:zu.SIZE_TOO_BIG};const r=await e.toWire(t);return r?this.gossipSub.publish(this.pubSubTopic,r):(LP("Failed to encode message, aborting publish"),{recipients:[],error:zu.ENCODE_FAILED})}subscribe(e,t){const r=Array.isArray(e)?BP(e,t):BP([e],t);for(const n of r.keys()){const e=this.observers.get(n)||new Set,t=r.get(n)||new Set;this.observers.set(n,MP(e,t))}return()=>{for(const e of r.keys()){const t=UP(this.observers.get(e)||new Set,r.get(e)||new Set);t.size?this.observers.set(e,t):this.observers.delete(e)}}}toSubscriptionIterator(e,t){return rd(this,e,t)}getActiveSubscriptions(){const e=new Map;return e.set(this.pubSubTopic,this.observers.keys()),e}getMeshPeers(e){return this.gossipSub.getMeshPeers(null!==e&&void 0!==e?e:this.pubSubTopic)}async processIncomingMessage(e,t){const r=await this.defaultDecoder.fromWireToProtoObj(t);if(!r||!r.contentTopic)return void LP("Message does not have a content topic, skipping");const n=this.observers.get(r.contentTopic);n&&await Promise.all(Array.from(n).map((async n=>{let{decoder:i,callback:o}=n;const s=await i.fromWireToProtoObj(t);if(!s)return void LP("Internal error: message previously decoded failed on 2nd pass.");const a=await i.fromProtoObj(e,s);a?o(a):LP("Failed to decode messages on",r.contentTopic)})))}gossipSubSubscribe(e){this.gossipSub.addEventListener("gossipsub:message",(async t=>{t.detail.msg.topic===e&&(LP("Message received on ".concat(e)),this.processIncomingMessage(t.detail.msg.topic,t.detail.msg.data).catch((e=>LP("Failed to process incoming message",e))))})),this.gossipSub.topicValidators.set(e,PP),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(OP.multicodec))||!1}}function BP(e,t){const r=Array.from(ed(e).entries()).map((e=>{let[r,n]=e;return[r,new Set(n.map((e=>({decoder:e,callback:t}))))]}));return new Map(r)}function MP(e,t){for(const r of t.values())e.add(r);return e}function UP(e,t){for(const r of t.values())e.has(r)&&e.delete(r);return e}function FP(e){return null!=e&&"function"===typeof e.start&&"function"===typeof e.stop}Xa(OP,"multicodec","/vac/waku/relay/2.0.0");const jP=(e,t)=>async function*(){const r=await async function(e){const t=[];for await(const r of e)t.push(r);return t}(e);yield*r.sort(t)}();async function zP(e){for await(const t of e);}async function*VP(e,t){for await(const r of e)await t(r)&&(yield r)}async function*KP(e,t){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}class qP{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}putMany(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const{key:n,value:i}of e)await t.put(n,i,r),yield{key:n,value:i}}()}catch(r){return Promise.reject(r)}}getMany(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const n of e)yield t.get(n,r)}()}catch(r){return Promise.reject(r)}}deleteMany(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const n of e)await t.delete(n,r),yield n}()}catch(r){return Promise.reject(r)}}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await zP(this.putMany(e,r)),e=[],await zP(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}async*_allKeys(e,t){throw new Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=VP(r,(t=>t.key.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>VP(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>jP(e,t)),r)),null!=e.offset){let t=0;r=VP(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=KP(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=VP(r,(t=>t.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>VP(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>jP(e,t)),r)),null!=e.offset){let t=0;r=VP(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=KP(r,e.limit)),r}}let HP=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 GP="/",WP=(new TextEncoder).encode(GP),QP=WP[0];class YP{constructor(e,t){if("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]!==QP)throw new Error("Invalid key")}toString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"utf8";return $l(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return"Key(".concat(this.toString(),")")}static withNamespaces(e){return new YP(e.join(GP))}static random(){return new YP(HP().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"===typeof e?new YP(e):"function"===typeof e.uint8Array?new YP(e.uint8Array()):null}clean(){if(null!=this._buf&&0!==this._buf.byteLength||(this._buf=WP),this._buf[0]!==QP){const e=new Uint8Array(this._buf.byteLength+1);e.fill(QP,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===QP;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;n<t.length;n++){if(r.length<n+1)return!1;const e=t[n],i=r[n];if(e<i)return!0;if(e>i)return!1}return t.length<r.length}reverse(){return YP.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(GP).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 YP(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(GP)||(e+=GP),e+=this.type(),new YP(e)}parent(){const e=this.list();return 1===e.length?new YP(GP):new YP(e.slice(0,-1).join(GP))}child(e){return this.toString()===GP?e:e.toString()===GP?this:new YP(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()!==this.toString()&&e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()!==this.toString()&&this.toString().startsWith(e.toString())}isTopLevel(){return 1===this.list().length}concat(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return YP.withNamespaces([...this.namespaces(),...(n=t.map((e=>e.namespaces())),[].concat(...n))]);var n}}class $P extends qP{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(e,t){this.data[e.toString()]=t}async get(e){if(!await this.has(e))throw t=t||new Error("Not Found"),Td(t,"ERR_NOT_FOUND");var t;return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}async*_all(){yield*Object.entries(this.data).map((e=>{let[t,r]=e;return{key:new YP(t),value:r}}))}async*_allKeys(){yield*Object.entries(this.data).map((e=>{let[t]=e;return new YP(t)}))}}var XP,JP;async function*ZP(e,t){yield*async function*(e,t){for await(const r of e)yield t(r)}(e,(async e=>(await t.addressBook.add(e.id,e.multiaddrs),e)))}function eN(e){const t=new Set;return VP(e,(e=>!t.has(e.id.toString())&&(t.add(e.id.toString()),!0)))}function tN(e){try{let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return async function*(){let r=0;for await(const t of e)r++,yield t;if(r<t)throw Td(new Error("not found"),"NOT_FOUND")}()}catch(t){return Promise.reject(t)}}!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"}(XP||(XP={})),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"}(JP||(JP={}));var rN=__webpack_require__(7683);async function nN(e){for await(const t of e)return t}var iN=__webpack_require__(8928),oN=__webpack_require__(7465);const sN=jv("libp2p:peer-routing");class aN{constructor(e,t){var r,n;this.components=e,this.routers=null!==(r=t.routers)&&void 0!==r?r:[],this.refreshManagerInit=null!==(n=t.refreshManager)&&void 0!==n?n:{},this.started=!1,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}isStarted(){return this.started}async start(){this.started||0===this.routers.length||null!=this.timeoutId||!1===this.refreshManagerInit.enabled||(this.timeoutId=(0,iN.setDelayedInterval)(this._findClosestPeersTask,this.refreshManagerInit.interval,this.refreshManagerInit.bootDelay),this.started=!0)}async _findClosestPeersTask(){if(null==this.abortController)try{var e;this.abortController=new rN.TimeoutController(null!==(e=this.refreshManagerInit.timeout)&&void 0!==e?e:1e4);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,this.abortController.signal)}catch{}await zP(this.getClosestPeers(this.components.peerId.toBytes(),{signal:this.abortController.signal}))}catch(r){sN.error(r)}finally{var t;null===(t=this.abortController)||void 0===t||t.clear(),this.abortController=void 0}}async stop(){var e;(0,iN.clearDelayedInterval)(this.timeoutId),null===(e=this.abortController)||void 0===e||e.abort(),this.started=!1}async findPeer(e,t){if(0===this.routers.length)throw Td(new Error("No peer routers available"),JP.ERR_NO_ROUTERS_AVAILABLE);if(e.toString()===this.components.peerId.toString())throw Td(new Error("Should not try to find self"),JP.ERR_FIND_SELF);const r=await _p(mp(...this.routers.map((r=>async function*(){try{yield await r.findPeer(e,t)}catch(n){sN.error(n)}}()))),(e=>VP(e,Boolean)),(e=>ZP(e,this.components.peerStore)),(async e=>await nN(e)));if(null!=r)return r;throw Td(new Error(XP.NOT_FOUND),JP.ERR_NOT_FOUND)}async*getClosestPeers(e,t){if(0===this.routers.length)throw Td(new Error("No peer routers available"),JP.ERR_NO_ROUTERS_AVAILABLE);yield*_p(mp(...this.routers.map((r=>r.getClosestPeers(e,t)))),(e=>ZP(e,this.components.peerStore)),(e=>eN(e)),(e=>tN(e)))}}class cN{constructor(e,t){var r;this.routers=null!==(r=t.routers)&&void 0!==r?r:[],this.started=!1,this.components=e}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}findProviders(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){if(0===t.routers.length)throw Td(new Error("No content this.routers available"),JP.ERR_NO_ROUTERS_AVAILABLE);yield*_p(mp(...t.routers.map((t=>t.findProviders(e,r)))),(e=>ZP(e,t.components.peerStore)),(e=>eN(e)),(e=>tN(e)))}()}catch(r){return Promise.reject(r)}}async provide(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===this.routers.length)throw Td(new Error("No content routers available"),JP.ERR_NO_ROUTERS_AVAILABLE);await Promise.all(this.routers.map((async r=>await r.provide(e,t))))}async put(e,t,r){if(!this.isStarted())throw Td(new Error(XP.NOT_STARTED_YET),JP.DHT_NOT_STARTED);const n=this.components.dht;null!=n&&await zP(n.put(e,t,r))}async get(e,t){if(!this.isStarted())throw Td(new Error(XP.NOT_STARTED_YET),JP.DHT_NOT_STARTED);const r=this.components.dht;if(null!=r)for await(const n of r.get(e,t))if("VALUE"===n.name)return n.value;throw Td(new Error(XP.NOT_FOUND),JP.ERR_NOT_FOUND)}async*getMany(e,t,r){if(!this.isStarted())throw Td(new Error(XP.NOT_STARTED_YET),JP.DHT_NOT_STARTED);if(null==t||0===t)return;let n=0;const i=this.components.dht;if(null!=i)for await(const o of i.get(e,r))if("VALUE"===o.name&&(yield{from:o.from,val:o.value},n++,n===t))break;if(0===n)throw Td(new Error(XP.NOT_FOUND),JP.ERR_NOT_FOUND)}}let lN;const uN=Symbol.for("nodejs.util.inspect.custom"),hN=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),dN=114,fN=36,pN=37;lN=Symbol.toStringTag;class gN{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[lN](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(dN,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return bN(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[uN](){return"PeerId(".concat(this.toString(),")")}}class yN extends gN{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class mN extends gN{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class vN extends gN{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function bN(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:hN,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new mN({multihash:t}):e.startsWith("16U")?new vN({multihash:t}):new yN({multihash:t})}return wN(hN.decode(e))}function wN(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===fN)return new mN({multihash:t});if(t.digest.length===pN)return new vN({multihash:t})}if(t.code===Il.code)return new yN({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==dN)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new yN({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===fN)return new mN({multihash:e.multihash});if(t.digest.length===pN)return new vN({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}async function EN(e,t){return e.length===fN?new mN({multihash:Fc(Nl.code,e),privateKey:t}):e.length===pN?new vN({multihash:Fc(Nl.code,e),privateKey:t}):new yN({multihash:await Il.digest(e),publicKey:e,privateKey:t})}const _N=e=>e;class SN extends cS{constructor(e,t){var r;super();const{listen:n=[],announce:i=[]}=t;this.components=e,this.listen=n.map((e=>e.toString())),this.announce=new Set(i.map((e=>e.toString()))),this.observed=new Set,this.announceFilter=null!==(r=t.announceFilter)&&void 0!==r?r:_N}getListenAddrs(){return Array.from(this.listen).map((e=>o_(e)))}getAnnounceAddrs(){return Array.from(this.announce).map((e=>o_(e)))}getObservedAddrs(){return Array.from(this.observed).map((e=>o_(e)))}confirmObservedAddr(e){}removeObservedAddr(e){}addObservedAddr(e){let t=o_(e);const r=t.getPeerId();if(null!=r){bN(r).equals(this.components.peerId)&&(t=t.decapsulate(o_("/p2p/".concat(this.components.peerId.toString()))))}const n=t.toString();this.observed.has(n)||(this.observed.add(n),this.dispatchEvent(new uS("change:addresses")))}getAddresses(){let e=this.getAnnounceAddrs().map((e=>e.toString()));0===e.length&&(e=this.components.transportManager.getAddrs().map((e=>e.toString()))),e=e.concat(this.getObservedAddrs().map((e=>e.toString())));const t=new Set(e);return this.announceFilter(Array.from(t).map((e=>o_(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()))}))}}const AN=__webpack_require__(9842),TN=jv("libp2p:connection-manager:latency-monitor:visibility-change-emitter");class CN extends cS{constructor(){super(),this.hidden="hidden",this.visibilityChange="visibilityChange",null!=globalThis.document&&(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener())}_initializeVisibilityVarNames(){let e="hidden",t="visibilitychange";"undefined"!==typeof globalThis.document.hidden?(e="hidden",t="visibilitychange"):"undefined"!==typeof globalThis.document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):"undefined"!==typeof globalThis.document.msHidden?(e="msHidden",t="msvisibilitychange"):"undefined"!==typeof globalThis.document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this.hidden=e,this.visibilityChange=t}_addVisibilityChangeListener(){"undefined"===typeof globalThis.document.addEventListener||"undefined"===typeof document[this.hidden]?TN("Checking page visibility requires a browser that supports the Page Visibility API."):globalThis.document.addEventListener(this.visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this.hidden&&void 0!==document[this.hidden])return null==document[this.hidden]}_handleVisibilityChange(){const e=!1===globalThis.document[this.hidden];TN(e?"Page Visible":"Page Hidden"),this.dispatchEvent(new uS("visibilityChange",{detail:e}))}}const kN=jv("libp2p:connection-manager:latency-monitor");class IN extends cS{constructor(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();const{latencyCheckIntervalMs:n,dataEmitIntervalMs:i,asyncTestFn:o,latencyRandomPercentage:s}=r;this.latencyCheckIntervalMs=null!==n&&void 0!==n?n:500,this.latencyRandomPercentage=null!==s&&void 0!==s?s:10,this.latencyCheckMultiply=this.latencyRandomPercentage/100*2*this.latencyCheckIntervalMs,this.latencyCheckSubtract=this.latencyCheckMultiply/2,this.dataEmitIntervalMs=null===i||0===i?void 0:null!==i&&void 0!==i?i:5e3,kN("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",this.latencyCheckIntervalMs,this.dataEmitIntervalMs),null!=this.dataEmitIntervalMs?kN("Expecting ~%s events per summary",this.latencyCheckIntervalMs/this.dataEmitIntervalMs):kN("Not emitting summaries"),this.asyncTestFn=o,null!=(null===(e=globalThis.process)||void 0===e?void 0:e.hrtime)?(kN("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=e=>{const t=this.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!==typeof window&&null!=(null===(t=window.performance)||void 0===t?void 0:t.now)?(kN("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(kN("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=e=>this.now()-e),this.latencyData=this.initLatencyData()}start(){var e;"undefined"!==typeof globalThis.window&&(this.visibilityChangeEmitter=new CN,this.visibilityChangeEmitter.addEventListener("visibilityChange",(e=>{const{detail:t}=e;t?this._startTimers():(this._emitSummary(),this._stopTimers())}))),!0===(null===(e=this.visibilityChangeEmitter)||void 0===e?void 0:e.isVisible())&&this._startTimers()}stop(){this._stopTimers()}_startTimers(){null==this.checkLatencyID&&(this.checkLatency(),null!=this.dataEmitIntervalMs&&(this.emitIntervalID=setInterval((()=>this._emitSummary()),this.dataEmitIntervalMs),"function"===typeof this.emitIntervalID.unref&&this.emitIntervalID.unref()))}_stopTimers(){null!=this.checkLatencyID&&(clearTimeout(this.checkLatencyID),this.checkLatencyID=void 0),null!=this.emitIntervalID&&(clearInterval(this.emitIntervalID),this.emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.dispatchEvent(new uS("data",{detail:e}))}getSummary(){const e={events:this.latencyData.events,minMs:this.latencyData.minMs,maxMs:this.latencyData.maxMs,avgMs:this.latencyData.events>0?this.latencyData.totalMs/this.latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this.latencyData.startTime)};return this.latencyData=this.initLatencyData(),kN.trace("Summary: %O",e),e}checkLatency(){const e=Math.random()*this.latencyCheckMultiply-this.latencyCheckSubtract,t={deltaOffset:Math.ceil(this.latencyCheckIntervalMs+e),startTime:this.now()},r=()=>{if(null==this.checkLatencyID)return;const e=this.getDeltaMS(t.startTime)-t.deltaOffset;this.checkLatency(),this.latencyData.events++,this.latencyData.minMs=Math.min(this.latencyData.minMs,e),this.latencyData.maxMs=Math.max(this.latencyData.maxMs,e),this.latencyData.totalMs+=e,kN.trace("MS: %s Data: %O",e,this.latencyData)};kN.trace("localData: %O",t),this.checkLatencyID=setTimeout((()=>{null!=this.asyncTestFn?(t.deltaOffset=0,t.startTime=this.now(),this.asyncTestFn(r)):(t.deltaOffset-=1,r())}),t.deltaOffset),"function"===typeof this.checkLatencyID.unref&&this.checkLatencyID.unref()}initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}const RN="OPEN",PN="CLOSING",NN="CLOSED";let DN;const xN=Symbol.for("nodejs.util.inspect.custom"),LN=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),ON=114,BN=36,MN=37;DN=Symbol.toStringTag;class UN{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[DN](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(ON,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return VN(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[xN](){return"PeerId(".concat(this.toString(),")")}}class FN extends UN{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class jN extends UN{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class zN extends UN{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function VN(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:LN,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new jN({multihash:t}):e.startsWith("16U")?new zN({multihash:t}):new FN({multihash:t})}return function(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===BN)return new jN({multihash:t});if(t.digest.length===MN)return new zN({multihash:t})}if(t.code===Il.code)return new FN({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==ON)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new FN({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===BN)return new jN({multihash:e.multihash});if(t.digest.length===MN)return new zN({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(LN.decode(e))}function KN(e,t){const r={[Symbol.iterator]:()=>r,next:()=>{const r=e.next(),n=r.value;if(!0===r.done||null==n){return{done:!0,value:void 0}}return{done:!1,value:t(n)}}};return r}let qN,HN,GN;qN=Symbol.iterator;class WN{constructor(e){if(Xa(this,"map",void 0),this.map=new Map,null!=e)for(const[t,r]of e.entries())this.map.set(t.toString(),r)}[qN](){return this.entries()}clear(){this.map.clear()}delete(e){this.map.delete(e.toString())}entries(){return KN(this.map.entries(),(e=>[VN(e[0]),e[1]]))}forEach(e){this.map.forEach(((t,r)=>{e(t,VN(r),this)}))}get(e){return this.map.get(e.toString())}has(e){return this.map.has(e.toString())}set(e,t){this.map.set(e.toString(),t)}keys(){return KN(this.map.keys(),(e=>VN(e)))}values(){return this.map.values()}get size(){return this.map.size}}HN=Symbol.iterator;class QN{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}[HN](){return this.values()}add(e){this.set.add(e.toString())}clear(){this.set.clear()}delete(e){this.set.delete(e.toString())}entries(){return KN(this.set.entries(),(e=>{const t=VN(e[0]);return[t,t]}))}forEach(e){this.set.forEach((t=>{const r=VN(t);e(r,r,this)}))}has(e){return this.set.has(e.toString())}values(){return KN(this.set.values(),(e=>VN(e)))}intersection(e){const t=new QN;for(const r of e)this.has(r)&&t.add(r);return t}difference(e){const t=new QN;for(const r of this)e.has(r)||t.add(r);return t}union(e){const t=new QN;for(const r of e)t.add(r);for(const r of this)t.add(r);return t}}GN=Symbol.iterator;function YN(e){if(Za(e))return{peerId:e};if(n_(e)){const t=e.getPeerId();return{multiaddr:e,peerId:null==t?void 0:bN(t)}}throw Td(new Error("".concat(e," is not a PeerId or a Multiaddr")),JP.ERR_INVALID_MULTIADDR)}const $N=jv("libp2p:connection-manager"),XN={maxConnections:1/0,minConnections:0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,inboundConnectionThreshold:5,maxIncomingPendingConnections:10};class JN extends cS{constructor(e,t){var r,n,i,o;if(super(),this.opts=AN.call({ignoreUndefined:!0},XN,t),this.opts.maxConnections<this.opts.minConnections)throw Td(new Error("Connection Manager maxConnections must be greater than minConnections"),JP.ERR_INVALID_PARAMETERS);$N("options: %o",this.opts),this.components=e,this.connections=new Map,this.started=!1,null!=t.maxEventLoopDelay&&t.maxEventLoopDelay>0&&t.maxEventLoopDelay!==1/0&&(this.latencyMonitor=new IN({latencyCheckIntervalMs:t.pollInterval,dataEmitIntervalMs:t.pollInterval}));try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,this)}catch{}this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.startupReconnectTimeout=null!==(r=t.startupReconnectTimeout)&&void 0!==r?r:6e4,this.dialTimeout=null!==(n=t.dialTimeout)&&void 0!==n?n:3e4,this.allow=(null!==(i=t.allow)&&void 0!==i?i:[]).map((e=>o_(e))),this.deny=(null!==(o=t.deny)&&void 0!==o?o:[]).map((e=>o_(e))),this.inboundConnectionRateLimiter=new _b.RateLimiterMemory({points:this.opts.inboundConnectionThreshold,duration:1}),this.incomingPendingConnections=0}isStarted(){return this.started}async start(){var e,t,r,n,i;null===(e=this.components.metrics)||void 0===e||e.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{const e={inbound:0,outbound:0};for(const t of this.connections.values())for(const r of t)"inbound"===r.stat.direction?e.inbound++:e.outbound++;return e}}),null===(t=this.components.metrics)||void 0===t||t.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{const e={};for(const n of this.connections.values())for(const i of n)for(const n of i.streams){var t,r;const i="".concat(n.stat.direction," ").concat(null!==(t=n.stat.protocol)&&void 0!==t?t:"unnegotiated");e[i]=(null!==(r=e[i])&&void 0!==r?r:0)+1}return e}}),null===(r=this.components.metrics)||void 0===r||r.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{const e={};for(const o of this.connections.values())for(const i of o){const o={};for(const e of i.streams){var t,r;const n="".concat(e.stat.direction," ").concat(null!==(t=e.stat.protocol)&&void 0!==t?t:"unnegotiated");o[n]=(null!==(r=o[n])&&void 0!==r?r:0)+1}for(const[t,r]of Object.entries(o)){var n;e[t]=null!==(n=e[t])&&void 0!==n?n:[],e[t].push(r)}}const i={};for(let[o,s]of Object.entries(e)){s=s.sort(((e,t)=>e-t));const e=Math.floor(.9*s.length);i[o]=s[e]}return i}}),null===(n=this.latencyMonitor)||void 0===n||n.start(),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),null===(i=this.latencyMonitor)||void 0===i||i.addEventListener("data",this._onLatencyMeasure),this.started=!0,$N("started")}async afterStart(){this.components.upgrader.addEventListener("connection",this.onConnect),this.components.upgrader.addEventListener("connectionEnd",this.onDisconnect),Promise.resolve().then((async()=>{var e;const t=[];for(const r of await this.components.peerStore.all()){(await this.components.peerStore.getTags(r.id)).filter((e=>"keep-alive"===e.name)).length>0&&t.push(r.id)}null===(e=this.connectOnStartupController)||void 0===e||e.clear(),this.connectOnStartupController=new rN.TimeoutController(this.startupReconnectTimeout);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,this.connectOnStartupController.signal)}catch{}await Promise.all(t.map((async e=>{var t;await this.openConnection(e,{signal:null===(t=this.connectOnStartupController)||void 0===t?void 0:t.signal}).catch((e=>{$N.error(e)}))})))})).catch((e=>{$N.error(e)})).finally((()=>{var e;null===(e=this.connectOnStartupController)||void 0===e||e.clear()}))}async beforeStop(){var e;null===(e=this.connectOnStartupController)||void 0===e||e.abort(),this.components.upgrader.removeEventListener("connection",this.onConnect),this.components.upgrader.removeEventListener("connectionEnd",this.onDisconnect)}async stop(){var e,t;null===(e=this.latencyMonitor)||void 0===e||e.removeEventListener("data",this._onLatencyMeasure),null===(t=this.latencyMonitor)||void 0===t||t.stop(),this.started=!1,await this._close(),$N("stopped")}async _close(){const e=[];for(const t of this.connections.values())for(const r of t)e.push((async()=>{try{await r.close()}catch(e){$N.error(e)}})());$N("closing %d connections",e.length),await Promise.all(e),this.connections.clear()}onConnect(e){this._onConnect(e).catch((e=>{$N.error(e)}))}async _onConnect(e){const{detail:t}=e;if(!this.started)return void await t.close();const r=t.remotePeer,n=r.toString(),i=this.connections.get(n);null!=i?i.push(t):this.connections.set(n,[t]),null!=r.publicKey&&await this.components.peerStore.keyBook.set(r,r.publicKey);const o=this.getConnections().length,s=o-this.opts.maxConnections;await this._checkMaxLimit("maxConnections",o,s),this.dispatchEvent(new uS("peer:connect",{detail:t}))}onDisconnect(e){const{detail:t}=e;if(!this.started)return;const r=t.remotePeer.toString();let n=this.connections.get(r);null!=n&&n.length>1?(n=n.filter((e=>e.id!==t.id)),this.connections.set(r,n)):null!=n&&(this.connections.delete(r),this.dispatchEvent(new uS("peer:disconnect",{detail:t})))}getConnections(e){var t;if(null!=e)return null!==(t=this.connections.get(e.toString()))&&void 0!==t?t:[];let r=[];for(const n of this.connections.values())r=r.concat(n);return r}async openConnection(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{peerId:r,multiaddr:n}=YN(e);if(null==r&&null==n)throw Td(new TypeError("Can only open connections to PeerIds or Multiaddrs"),JP.ERR_INVALID_PARAMETERS);if(null!=r){$N("dial to",r);const e=this.getConnections(r);if(e.length>0)return $N("had an existing connection to %p",r),e[0]}let i;if(null==(null===t||void 0===t?void 0:t.signal)){i=new rN.TimeoutController(this.dialTimeout),t.signal=i.signal;try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,i.signal)}catch{}}try{const r=await this.components.dialer.dial(e,t);let n=this.connections.get(r.remotePeer.toString());null==n&&(n=[],this.connections.set(r.remotePeer.toString(),n));let i=!1;for(const e of n)e.id===r.id&&(i=!0);return i||n.push(r),r}finally{null!=i&&i.clear()}}async closeConnections(e){var t;const r=null!==(t=this.connections.get(e.toString()))&&void 0!==t?t:[];await Promise.all(r.map((async e=>await e.close())))}getAll(e){if(!Za(e))throw Td(new Error("peerId must be an instance of peer-id"),JP.ERR_INVALID_PARAMETERS);const t=e.toString(),r=this.connections.get(t);return null!=r?r.filter((e=>e.stat.status===RN)):[]}_onLatencyMeasure(e){const{detail:t}=e;this._checkMaxLimit("maxEventLoopDelay",t.avgMs,1).catch((e=>{$N.error(e)}))}async _checkMaxLimit(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const n=this.opts[e];null!=n?($N.trace("checking limit of %s. current value: %d of %d",e,t,n),t>n&&($N("%s: limit exceeded: %p, %d/%d, pruning %d connection(s)",this.components.peerId,e,t,n,r),await this._pruneConnections(r))):$N.trace("limit %s was not set so it cannot be applied",e)}async _pruneConnections(e){const t=this.getConnections(),r=new WN;for(const o of t){const e=o.remotePeer;if(r.has(e))continue;const t=await this.components.peerStore.getTags(e);r.set(e,t.reduce(((e,t)=>e+t.value),0))}const n=t.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})),i=[];for(const o of n)if($N("too many connections open - closing a connection to %p",o.remotePeer),i.push(o),i.length===e)break;await Promise.all(i.map((async e=>{try{await e.close()}catch(t){$N.error(t)}this.onDisconnect(new uS("connectionEnd",{detail:e}))})))}async acceptIncomingConnection(e){if(this.deny.some((t=>e.remoteAddr.toString().startsWith(t.toString()))))return $N("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.opts.maxIncomingPendingConnections)return $N("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 $N("connection from %s refused - inboundConnectionThreshold exceeded by host %s",t,e.remoteAddr),!1}}return this.getConnections().length<this.opts.maxConnections?(this.incomingPendingConnections++,!0):($N("connection from %s refused - maxConnections exceeded",e.remoteAddr),!1)}afterUpgradeInbound(){this.incomingPendingConnections--}}var ZN=__webpack_require__(1779);async function eD(e){const t=[];for await(const r of e)t.push(r);return t}async function*tD(e,t){const r=await async function(e){const t=[];for await(const r of e)t.push(r);return t}(e);yield*r.sort(t)}const rD=jv("libp2p:connection-manager:auto-dialler"),nD={enabled:!0,minConnections:0,autoDialInterval:1e4};class iD{constructor(e,t){this.components=e,this.options=AN.call({ignoreUndefined:!0},nD,t),this.running=!1,this._autoDial=this._autoDial.bind(this),rD("options: %j",this.options)}isStarted(){return this.running}async start(){this.options.enabled?(this.running=!0,this._autoDial().catch((e=>{rD.error("could start autodial",e)})),rD("started")):rD("not enabled")}async stop(){this.options.enabled?(this.running=!1,null!=this.autoDialTimeout&&this.autoDialTimeout.clear(),rD("stopped")):rD("not enabled")}async _autoDial(){null!=this.autoDialTimeout&&this.autoDialTimeout.clear();const e=this.options.minConnections;if(this.components.connectionManager.getConnections().length>=e)return void(this.autoDialTimeout=ZN(this._autoDial,this.options.autoDialInterval));const t=await this.components.peerStore.all(),r=await _p(t.sort((()=>Math.random()>.5?1:-1)),(e=>VP(e,(e=>!e.id.equals(this.components.peerId)))),(e=>tD(e,((e,t)=>t.protocols.length>e.protocols.length||null!=t.id.publicKey&&null==e.id.publicKey?1:-1))),(async e=>await eD(e)));for(let i=0;this.running&&i<r.length&&this.components.connectionManager.getConnections().length<e;i++){if(!this.running)return;const e=r[i];if(0===this.components.connectionManager.getConnections(e.id).length){rD("connecting to a peerStore stored peer %p",e.id);try{await this.components.connectionManager.openConnection(e.id)}catch(n){rD.error("could not connect to peerStore stored peer",n)}}}this.running&&(this.autoDialTimeout=ZN(this._autoDial,this.options.autoDialInterval))}}var oD=__webpack_require__(6296),sD=__webpack_require__(2546),aD=__webpack_require__(100),cD=__webpack_require__(6153);__webpack_require__(2751)._configure(),oD._configure(sD),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 r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new oD(e))}function hD(){return function(e){for(const t of lD){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(aD.create())}function dD(e,t){const r=uD(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function fD(e,t){const r=hD();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var pD,gD;function yD(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function mD(e){function t(t){if(null==e[t.toString()])throw new Error("Invalid enum value");return e[t]}return yD("enum",pD.VARINT,(function(e,r){const n=t(e);r.int32(n)}),(function(e){return t(e.int32())}))}function vD(e,t){return yD("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,r,n,i,o,s;!function(e){e.SUCCESS="SUCCESS",e.HOP_SRC_ADDR_TOO_LONG="HOP_SRC_ADDR_TOO_LONG",e.HOP_DST_ADDR_TOO_LONG="HOP_DST_ADDR_TOO_LONG",e.HOP_SRC_MULTIADDR_INVALID="HOP_SRC_MULTIADDR_INVALID",e.HOP_DST_MULTIADDR_INVALID="HOP_DST_MULTIADDR_INVALID",e.HOP_NO_CONN_TO_DST="HOP_NO_CONN_TO_DST",e.HOP_CANT_DIAL_DST="HOP_CANT_DIAL_DST",e.HOP_CANT_OPEN_DST_STREAM="HOP_CANT_OPEN_DST_STREAM",e.HOP_CANT_SPEAK_RELAY="HOP_CANT_SPEAK_RELAY",e.HOP_CANT_RELAY_TO_SELF="HOP_CANT_RELAY_TO_SELF",e.STOP_SRC_ADDR_TOO_LONG="STOP_SRC_ADDR_TOO_LONG",e.STOP_DST_ADDR_TOO_LONG="STOP_DST_ADDR_TOO_LONG",e.STOP_SRC_MULTIADDR_INVALID="STOP_SRC_MULTIADDR_INVALID",e.STOP_DST_MULTIADDR_INVALID="STOP_DST_MULTIADDR_INVALID",e.STOP_RELAY_REFUSED="STOP_RELAY_REFUSED",e.MALFORMED_MESSAGE="MALFORMED_MESSAGE"}(t=e.Status||(e.Status={})),function(e){e[e.SUCCESS=100]="SUCCESS",e[e.HOP_SRC_ADDR_TOO_LONG=220]="HOP_SRC_ADDR_TOO_LONG",e[e.HOP_DST_ADDR_TOO_LONG=221]="HOP_DST_ADDR_TOO_LONG",e[e.HOP_SRC_MULTIADDR_INVALID=250]="HOP_SRC_MULTIADDR_INVALID",e[e.HOP_DST_MULTIADDR_INVALID=251]="HOP_DST_MULTIADDR_INVALID",e[e.HOP_NO_CONN_TO_DST=260]="HOP_NO_CONN_TO_DST",e[e.HOP_CANT_DIAL_DST=261]="HOP_CANT_DIAL_DST",e[e.HOP_CANT_OPEN_DST_STREAM=262]="HOP_CANT_OPEN_DST_STREAM",e[e.HOP_CANT_SPEAK_RELAY=270]="HOP_CANT_SPEAK_RELAY",e[e.HOP_CANT_RELAY_TO_SELF=280]="HOP_CANT_RELAY_TO_SELF",e[e.STOP_SRC_ADDR_TOO_LONG=320]="STOP_SRC_ADDR_TOO_LONG",e[e.STOP_DST_ADDR_TOO_LONG=321]="STOP_DST_ADDR_TOO_LONG",e[e.STOP_SRC_MULTIADDR_INVALID=350]="STOP_SRC_MULTIADDR_INVALID",e[e.STOP_DST_MULTIADDR_INVALID=351]="STOP_DST_MULTIADDR_INVALID",e[e.STOP_RELAY_REFUSED=390]="STOP_RELAY_REFUSED",e[e.MALFORMED_MESSAGE=400]="MALFORMED_MESSAGE"}(r||(r={})),function(e){e.codec=()=>mD(r)}(t=e.Status||(e.Status={})),function(e){e.HOP="HOP",e.STOP="STOP",e.STATUS="STATUS",e.CAN_HOP="CAN_HOP"}(n=e.Type||(e.Type={})),function(e){e[e.HOP=1]="HOP",e[e.STOP=2]="STOP",e[e.STATUS=3]="STATUS",e[e.CAN_HOP=4]="CAN_HOP"}(i||(i={})),function(e){e.codec=()=>mD(i)}(n=e.Type||(e.Type={})),function(e){let t;e.codec=()=>(null==t&&(t=vD((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),(!0===r.writeDefaults||null!=e.id&&e.id.byteLength>0)&&(t.uint32(10),t.bytes(e.id)),null!=e.addrs)for(const n of e.addrs)t.uint32(18),t.bytes(n);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={id:new Uint8Array(0),addrs:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.id=e.bytes();break;case 2:r.addrs.push(e.bytes());break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(o=e.Peer||(e.Peer={})),e.codec=()=>(null==s&&(s=vD((function(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==n.lengthDelimited&&r.fork(),null!=t.type&&(r.uint32(8),e.Type.codec().encode(t.type,r)),null!=t.srcPeer&&(r.uint32(18),e.Peer.codec().encode(t.srcPeer,r,{writeDefaults:!1})),null!=t.dstPeer&&(r.uint32(26),e.Peer.codec().encode(t.dstPeer,r,{writeDefaults:!1})),null!=t.code&&(r.uint32(32),e.Status.codec().encode(t.code,r)),!1!==n.lengthDelimited&&r.ldelim()}),((t,r)=>{const n={},i=null==r?t.len:t.pos+r;for(;t.pos<i;){const r=t.uint32();switch(r>>>3){case 1:n.type=e.Type.codec().decode(t);break;case 2:n.srcPeer=e.Peer.codec().decode(t,t.uint32());break;case 3:n.dstPeer=e.Peer.codec().decode(t,t.uint32());break;case 4:n.code=e.Status.codec().decode(t);break;default:t.skipType(7&r)}}return n}))),s),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(gD||(gD={}));const bD=jv("libp2p:stream:converter");function wD(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{stream:r,remoteAddr:n}=e,{sink:i,source:o}=r,s=async function*(){for await(const e of o)yield*e}(),a={async sink(e){null!=t.signal&&(e=Jv(e,t.signal));try{await i(e),await c()}catch(r){"aborted"!==r.type&&bD(r)}},source:null!=t.signal?Jv(s,t.signal):s,remoteAddr:n,timeline:{open:Date.now(),close:void 0},async close(){await i(async function*(){yield new Uint8Array(0)}()),await c()}};async function c(){return null==a.timeline.close&&(a.timeline.close=Date.now()),await Promise.resolve()}return a}const ED="/libp2p/circuit/relay/0.1.0";function _D(e,t){e.write({type:gD.Type.STATUS,code:t})}function SD(e,t){try{var r;null!=(null===(r=e.dstPeer)||void 0===r?void 0:r.addrs)&&e.dstPeer.addrs.forEach((e=>o_(e)))}catch(i){throw _D(t,e.type===gD.Type.HOP?gD.Status.HOP_DST_MULTIADDR_INVALID:gD.Status.STOP_DST_MULTIADDR_INVALID),i}try{var n;null!=(null===(n=e.srcPeer)||void 0===n?void 0:n.addrs)&&e.srcPeer.addrs.forEach((e=>o_(e)))}catch(i){throw _D(t,e.type===gD.Type.HOP?gD.Status.HOP_SRC_MULTIADDR_INVALID:gD.Status.STOP_SRC_MULTIADDR_INVALID),i}}function AD(e){const t=xd(),r=function(e){const t=async function*(){let t=yield,r=new cd;for await(const n of e)if(null!=t)for(r.append(n);r.length>=t;){const e=r.sublist(0,t);if(r.consume(t),t=yield e,null==t){r.length>0&&(t=yield r,r=new cd);break}}else r.append(n),t=yield r,r=new cd;if(null!=t)throw Object.assign(new Error("stream ended before ".concat(t," bytes became available")),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}(e.source),n=gp();let i;const o=e.sink(async function*(){yield*t;const e=await n.promise;yield*e}());o.catch((e=>{i=e}));return{reader:r,writer:t,stream:{sink:async e=>null!=i?await Promise.reject(i):(n.resolve(e),await o),source:r},rest:()=>t.end(),write:t.push,read:async()=>{const e=await r.next();if(null!=e.value)return e.value}}}const TD=jv("libp2p:circuit:stream-handler");class CD{constructor(e){const{stream:t,maxLength:r=4096}=e;this.stream=t,this.shake=AD(this.stream),this.decoder=Rp.fromReader(this.shake.reader,{maxDataLength:r})}async read(){const e=await this.decoder.next();if(null!=e.value){const t=gD.decode(e.value);return TD("read message type",t.type),t}TD("read received no value, closing stream"),this.close()}write(e){TD("write message type %s",e.type),this.shake.write(Ap.single(gD.encode(e)))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){TD("closing the stream"),this.rest().sink([]).catch((e=>{TD.error(e)}))}}const kD=jv("libp2p:circuit:stop");const ID=jv("libp2p:circuit:hop");async function RD(e){const{connection:t,request:r,streamHandler:n,circuit:i,connectionManager:o}=e;if(!i.hopEnabled())return ID("HOP request received but we are not acting as a relay"),n.end({type:gD.Type.STATUS,code:gD.Status.HOP_CANT_SPEAK_RELAY});try{SD(r,n)}catch(h){return void ID.error("invalid hop request via peer %p %o",t.remotePeer,h)}if(null==r.dstPeer)return void ID("HOP request received but we do not receive a dstPeer");const s=wN(r.dstPeer.id),a=o.getConnections(s);if(0===a.length&&!i.hopActive())return ID("HOP request received but we are not connected to the destination peer"),n.end({type:gD.Type.STATUS,code:gD.Status.HOP_NO_CONN_TO_DST});if(0===a.length)return ID("did not have connection to remote peer"),n.end({type:gD.Type.STATUS,code:gD.Status.HOP_NO_CONN_TO_DST});const c={type:gD.Type.STOP,dstPeer:r.dstPeer,srcPeer:r.srcPeer};let l;try{ID("performing STOP request");const e=await async function(e){const{connection:t,request:r,signal:n}=e,i=await t.newStream(ED,{signal:n});kD("starting stop request to %p",t.remotePeer);const o=new CD({stream:i});o.write(r);const s=await o.read();if(null!=s){if(s.code===gD.Status.SUCCESS)return kD("stop request to %p was successful",t.remotePeer),o.rest();kD("stop request failed with code %d",s.code),o.close()}else o.close()}({connection:a[0],request:c});if(null==e)throw new Error("Could not stop");l=e}catch(h){return void ID.error(h)}ID("hop request from %p is valid",t.remotePeer),n.write({type:gD.Type.STATUS,code:gD.Status.SUCCESS});const u=n.rest();return ID("creating related connections"),await _p(u,l,u)}const PD=jv("libp2p:circuit");class ND{constructor(e,t){this._init=t,this.components=e,this._started=!1}isStarted(){return this._started}async start(){this._started||(this._started=!0,await this.components.registrar.handle(ED,(e=>{this._onProtocol(e).catch((e=>{PD.error(e)}))}),{...this._init}).catch((e=>{PD.error(e)})))}async stop(){await this.components.registrar.unhandle(ED)}hopEnabled(){return!0}hopActive(){return!0}get[Z_](){return!0}get[Symbol.toStringTag](){return"libp2p/circuit-relay-v1"}async _onProtocol(e){const{connection:t,stream:r}=e,n=new rN.TimeoutController(this._init.hop.timeout);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,n.signal)}catch{}try{const e=eb(r,n.signal),s=new CD({stream:{...r,...e}}),a=await s.read();if(null==a)return PD("request was invalid, could not read from stream"),s.write({type:gD.Type.STATUS,code:gD.Status.MALFORMED_MESSAGE}),void s.close();let c;switch(a.type){case gD.Type.CAN_HOP:PD("received CAN_HOP request from %p",t.remotePeer),await function(e){const{connection:t,streamHandler:r,circuit:n}=e,i=n.hopEnabled();ID("can hop (%s) request from %p",i,t.remotePeer),r.end({type:gD.Type.STATUS,code:i?gD.Status.SUCCESS:gD.Status.HOP_CANT_SPEAK_RELAY})}({circuit:this,connection:t,streamHandler:s});break;case gD.Type.HOP:PD("received HOP request from %p",t.remotePeer),await RD({connection:t,request:a,streamHandler:s,circuit:this,connectionManager:this.components.connectionManager});break;case gD.Type.STOP:PD("received STOP request from %p",t.remotePeer),c=await function(e){const{connection:t,request:r,streamHandler:n}=e;try{SD(r,n)}catch(i){return void kD.error("invalid stop request via peer %p %o",t.remotePeer,i)}return kD("stop request is valid"),n.write({type:gD.Type.STATUS,code:gD.Status.SUCCESS}),n.rest()}({connection:t,request:a,streamHandler:s});break;default:return PD("Request of type %s not supported",a.type),s.write({type:gD.Type.STATUS,code:gD.Status.MALFORMED_MESSAGE}),void s.close()}if(null!=c){var i,o;const e=t.remoteAddr.encapsulate("/p2p-circuit").encapsulate(o_(null===(i=a.dstPeer)||void 0===i?void 0:i.addrs[0])),r=wD({stream:c,remoteAddr:e,localAddr:o_(null===(o=a.srcPeer)||void 0===o?void 0:o.addrs[0])}),n=a.type===gD.Type.HOP?"relay":"inbound";PD("new %s connection %s",n,r.remoteAddr);const s=await this.components.upgrader.upgradeInbound(r);PD("%s connection %s upgraded",n,r.remoteAddr),null!=this.handler&&this.handler(s)}}finally{n.clear()}}async dial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=e.toString().split("/p2p-circuit"),n=o_(r[0]),i=o_(r[r.length-1]),o=n.getPeerId(),s=i.getPeerId();if(null==o||null==s){const e="Circuit relay dial failed as addresses did not have peer id";throw PD.error(e),Td(new Error(e),JP.ERR_RELAYED_DIAL)}const a=bN(o),c=bN(s);let l=!1;let u=this.components.connectionManager.getConnections(a)[0];null==u&&(await this.components.peerStore.addressBook.add(a,[n]),u=await this.components.connectionManager.openConnection(a,t),l=!0);try{const r=await async function(e){var t;const{connection:r,request:n,signal:i}=e,o=await r.newStream(ED,{signal:i}),s=new CD({stream:o});s.write(n);const a=await s.read();if(null==a)throw Td(new Error("HOP request had no response"),JP.ERR_HOP_REQUEST_FAILED);if(a.code===gD.Status.SUCCESS)return ID("hop request was successful"),s.rest();throw ID("hop request failed with code %d, closing stream",a.code),s.close(),Td(new Error('HOP request failed with code "'.concat(null!==(t=a.code)&&void 0!==t?t:"unknown",'"')),JP.ERR_HOP_REQUEST_FAILED)}({...t,connection:u,request:{type:gD.Type.HOP,srcPeer:{id:this.components.peerId.toBytes(),addrs:this.components.addressManager.getAddresses().map((e=>e.bytes))},dstPeer:{id:c.toBytes(),addrs:[o_(i).bytes]}}}),o=wD({stream:r,remoteAddr:e,localAddr:n.encapsulate("/p2p-circuit/p2p/".concat(this.components.peerId.toString()))});return PD("new outbound connection %s",o.remoteAddr),await this.components.upgrader.upgradeOutbound(o)}catch(h){throw PD.error("Circuit relay dial failed",h),l&&await u.close(),h}}createListener(e){return this.handler=e.handler,function(e){const t=new Map,r=Object.assign(new cS,{close:async()=>await Promise.resolve(),listen:async function(n){const i=n.toString().split("/p2p-circuit").find((e=>""!==e)),o=o_(i),s=o.getPeerId();if(null==s)throw new Error("Could not determine relay peer from multiaddr");const a=bN(s);await e.peerStore.addressBook.add(a,[o]);const c=await e.connectionManager.openConnection(a),l=c.remoteAddr.encapsulate("/p2p-circuit");t.set(c.remotePeer.toString(),l),r.dispatchEvent(new uS("listening"))},getAddrs:function(){const e=[];for(const r of t.values())e.push(r);return e}});return e.connectionManager.addEventListener("peer:disconnect",(e=>{const{detail:n}=e;t.delete(n.remotePeer.toString())&&r.dispatchEvent(new uS("close"))})),r}({connectionManager:this.components.connectionManager,peerStore:this.components.peerStore})}filter(e){return(e=Array.isArray(e)?e:[e]).filter((e=>W_.matches(e)))}}async function DD(e){const t=(new TextEncoder).encode(e),r=await Il.digest(t);return el.createV0(r)}const xD="hop_relay",LD="true",OD="/libp2p/relay";var BD=__webpack_require__(7922);const MD="[a-fA-F\\d:]",UD=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(MD,")|(?<=").concat(MD,")(?=\\s|$))"):"",FD="(?: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}",jD="[a-fA-F\\d]{1,4}",zD="\n(?:\n(?:".concat(jD,":){7}(?:").concat(jD,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(jD,":){6}(?:").concat(FD,"|:").concat(jD,"|:)| // 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(jD,":){5}(?::").concat(FD,"|(?::").concat(jD,"){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(jD,":){4}(?:(?::").concat(jD,"){0,1}:").concat(FD,"|(?::").concat(jD,"){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(jD,":){3}(?:(?::").concat(jD,"){0,2}:").concat(FD,"|(?::").concat(jD,"){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(jD,":){2}(?:(?::").concat(jD,"){0,3}:").concat(FD,"|(?::").concat(jD,"){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(jD,":){1}(?:(?::").concat(jD,"){0,4}:").concat(FD,"|(?::").concat(jD,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(jD,"){0,5}:").concat(FD,"|(?::").concat(jD,"){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(),VD=new RegExp("(?:^".concat(FD,"$)|(?:^").concat(zD,"$)")),KD=new RegExp("^".concat(FD,"$")),qD=new RegExp("^".concat(zD,"$")),HD=e=>e&&e.exact?VD:new RegExp("(?:".concat(UD(e)).concat(FD).concat(UD(e),")|(?:").concat(UD(e)).concat(zD).concat(UD(e),")"),"g");HD.v4=e=>e&&e.exact?KD:new RegExp("".concat(UD(e)).concat(FD).concat(UD(e)),"g"),HD.v6=e=>e&&e.exact?qD:new RegExp("".concat(UD(e)).concat(zD).concat(UD(e)),"g");const GD=HD;var WD=__webpack_require__(7201);const{isValid:QD,parse:YD}=WD,$D=["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 BD.Netmask(e)));function XD(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 JD=e=>{if(QD(e)){const t=YD(e);if("ipv4"===t.kind())return function(e){for(let t of $D)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return XD(e)}else if(ou(e)&&GD.v6().test(e))return XD(e)};function ZD(e){const{address:t}=e.nodeAddress();return Boolean(JD(t))}function ex(e,t){const r=ZD(e.multiaddr),n=ZD(t.multiaddr);return r&&!n?1:!r&&n||e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}const tx=jv("libp2p:auto-relay"),rx=()=>{};class nx{constructor(e,t){var r,n,i;this.components=e,this.addressSorter=null!==(r=t.addressSorter)&&void 0!==r?r:ex,this.maxListeners=null!==(n=t.maxListeners)&&void 0!==n?n:1,this.listenRelays=new Set,this.onError=null!==(i=t.onError)&&void 0!==i?i:rx,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this.components.peerStore.addEventListener("change:protocols",(e=>{this._onProtocolChange(e).catch((e=>{tx.error(e)}))})),this.components.connectionManager.addEventListener("peer:disconnect",this._onPeerDisconnected)}async _onProtocolChange(e){const{peerId:t,protocols:r}=e.detail,n=t.toString();if(null!=r.find((e=>e===ED))){if(!this.listenRelays.has(n))try{const e=this.components.connectionManager.getConnections(t);if(0===e.length)return;const r=e[0];if(r.remoteAddr.protoCodes().includes(290))return void tx("relayed connection to ".concat(n," will not be used to hop on"));const i=await async function(e){const{connection:t,signal:r}=e,n=await t.newStream(ED,{signal:r}),i=new CD({stream:n});i.write({type:gD.Type.CAN_HOP});const o=await i.read();return await i.close(),null!=o&&o.code===gD.Status.SUCCESS}({connection:r});i&&(await this.components.peerStore.metadataBook.setValue(t,xD,ru(LD)),await this._addListenRelay(r,n))}catch(i){this.onError(i)}}else this.listenRelays.has(n)&&await this._removeListenRelay(n)}_onPeerDisconnected(e){const t=e.detail.remotePeer.toString();this.listenRelays.has(t)&&this._removeListenRelay(t).catch((e=>{tx.error(e)}))}async _addListenRelay(e,t){try{if(this.listenRelays.size>=this.maxListeners)return;const r=await _p(await this.components.peerStore.addressBook.get(e.remotePeer),(e=>tD(e,this.addressSorter)),(async e=>await eD(e)));(await Promise.all(r.map((async t=>{try{let r=t.multiaddr;return null==r.getPeerId()&&(r=r.encapsulate("/p2p/".concat(e.remotePeer.toString()))),r=r.encapsulate("/p2p-circuit"),await this.components.transportManager.listen([r]),!0}catch(r){tx.error("error listening on circuit address",r),this.onError(r)}return!1})))).includes(!0)&&this.listenRelays.add(t)}catch(r){this.onError(r),this.listenRelays.delete(t)}}async _removeListenRelay(e){this.listenRelays.delete(e)&&await this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this.listenRelays.size>=this.maxListeners)return;const t=[],r=await this.components.peerStore.all();for(const{id:i,metadata:o}of r){const r=i.toString();if(this.listenRelays.has(r))continue;if(e.includes(r))continue;const n=o.get(xD);if(null==n||$l(n)!==LD)continue;const s=this.components.connectionManager.getConnections(i);if(0!==s.length){if(await this._addListenRelay(s[0],r),this.listenRelays.size>=this.maxListeners)return}else t.push(i)}for(const i of t)if(await this._tryToListenOnRelay(i),this.listenRelays.size>=this.maxListeners)return;try{const e=await DD(OD);for await(const t of this.components.contentRouting.findProviders(e)){if(0===t.multiaddrs.length)continue;const e=t.id;if(!e.equals(this.components.peerId)&&(await this.components.peerStore.addressBook.add(e,t.multiaddrs),await this._tryToListenOnRelay(e),this.listenRelays.size>=this.maxListeners))return}}catch(n){this.onError(n)}}async _tryToListenOnRelay(e){try{const t=await this.components.connectionManager.openConnection(e);await this._addListenRelay(t,e.toString())}catch(t){tx.error("Could not use %p as relay",e,t),this.onError(t,"could not connect and listen on known hop relay ".concat(e.toString()))}}}const ix=jv("libp2p:relay");class ox{constructor(e,t){var r;this.components=e,this.autoRelay=!1!==(null===(r=t.autoRelay)||void 0===r?void 0:r.enabled)?new nx(e,{addressSorter:t.addressSorter,...t.autoRelay}):void 0,this.started=!1,this.init=t,this._advertiseService=this._advertiseService.bind(this)}isStarted(){return this.started}async start(){!1!==this.init.hop.enabled&&!1!==this.init.advertise.enabled&&(this.timeout=(0,iN.setDelayedInterval)(this._advertiseService,this.init.advertise.ttl,this.init.advertise.bootDelay)),this.started=!0}async stop(){null!=this.timeout&&(0,iN.clearDelayedInterval)(this.timeout),this.started=!1}async _advertiseService(){try{const e=await DD(OD);await this.components.contentRouting.provide(e)}catch(e){e.code===JP.ERR_NO_ROUTERS_AVAILABLE?(ix.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e),await this.stop()):ix.error(e)}}}var sx=__webpack_require__(6327);__webpack_require__(4660),__webpack_require__(3391);const ax=Hp.pki;const cx=jv("libp2p:keychain:cms"),lx=new WeakMap;class ux{constructor(e,t){if(null==e)throw Td(new Error("keychain is required"),JP.ERR_KEYCHAIN_REQUIRED);this.keychain=e,lx.set(this,{dek:t})}async encrypt(e,t){if(!(t instanceof Uint8Array))throw Td(new Error("Plain data must be a Uint8Array"),JP.ERR_INVALID_PARAMETERS);const r=await this.keychain.findKeyByName(e),n=await this.keychain.getPrivateKey(e),i=lx.get(this);if(null==i)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const o=i.dek,s=Hp.pki.decryptRsaPrivateKey(n,o),a=await((e,t)=>{const r=ax.rsa.setPublicKey(t.n,t.e),n=ax.createCertificate();n.publicKey=r,n.serialNumber="01",n.validity.notBefore=new Date,n.validity.notAfter=new Date,n.validity.notAfter.setFullYear(n.validity.notBefore.getFullYear()+10);const i=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return n.setSubject(i),n.setIssuer(i),n.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),n.sign(t),n})(r,s),c=Hp.pkcs7.createEnvelopedData();c.addRecipient(a),c.content=Hp.util.createBuffer(t),c.encrypt();return ru(Hp.asn1.toDer(c.toAsn1()).getBytes(),"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw Td(new Error("CMS data is required"),JP.ERR_INVALID_PARAMETERS);let t;try{const r=Hp.util.createBuffer($l(e,"ascii")),n=Hp.asn1.fromDer(r);t=Hp.pkcs7.messageFromAsn1(n)}catch(l){throw cx.error(l),Td(new Error("Invalid CMS"),JP.ERR_INVALID_CMS)}const r=t.recipients.filter((e=>e.issuer.find((e=>"O"===e.shortName&&"ipfs"===e.value)))).filter((e=>e.issuer.find((e=>"CN"===e.shortName)))).map((e=>({recipient:e,keyId:e.issuer.find((e=>"CN"===e.shortName)).value}))),n=await async function(e,t){const r=e.map(t);return e[(await Promise.all(r)).findIndex((e=>e))]}(r,(async e=>{try{if(null!=await this.keychain.findKeyById(e.keyId))return!0}catch(l){return!1}return!1}));if(null==n){const e=r.map((e=>e.keyId));throw Td(new Error("Decryption needs one of the key(s): ".concat(e.join(", "))),JP.ERR_MISSING_KEYS,{missingKeys:e})}const i=await this.keychain.findKeyById(n.keyId);if(null==i)throw Td(new Error("No key available to decrypto"),JP.ERR_NO_KEY);const o=await this.keychain.getPrivateKey(i.name),s=lx.get(this);if(null==s)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const a=s.dek,c=Hp.pki.decryptRsaPrivateKey(o,a);return t.decrypt(n.recipient,c),ru(t.content.getBytes(),"ascii")}}const hx=jv("libp2p:keychain"),dx="/pkcs8/",fx="/info/",px=new WeakMap,gx=14,yx=16,mx=1e3,vx={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function bx(e){return null!=e&&("string"===typeof e&&(e===sx(e.trim())&&e.length>0))}async function wx(){const e=800*Math.random()+200;await new Promise((t=>setTimeout(t,e)))}function Ex(e){return new YP(dx+e)}function _x(e){return new YP(fx+e)}class Sx{constructor(e,t){var r,n,i,o,s,a,c,l,u,h;if(this.components=e,this.init=AN(vx,t),null!=this.init.pass&&(null===(r=this.init.pass)||void 0===r?void 0:r.length)<20)throw new Error("pass must be least 20 characters");if(null!=(null===(n=this.init.dek)||void 0===n?void 0:n.keyLength)&&this.init.dek.keyLength<gx)throw new Error("dek.keyLength must be least ".concat(gx," 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<yx)throw new Error("dek.saltLength must be least ".concat(yx," bytes"));if(null!=(null===(s=this.init.dek)||void 0===s?void 0:s.iterationCount)&&this.init.dek.iterationCount<mx)throw new Error("dek.iterationCount must be least ".concat(mx));const d=null!=this.init.pass&&null!=(null===(a=this.init.dek)||void 0===a?void 0:a.salt)?MR(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):"";px.set(this,{dek:d}),this.started=!1}isStarted(){return this.started}async start(){const e=_x("self");await this.components.datastore.has(e)||await this.importPeer("self",this.components.peerId),this.started=!0}stop(){this.started=!1}get cms(){const e=px.get(this);if(null==e)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const t=e.dek;return new ux(this,t)}static generateOptions(){const e=Object.assign({},vx),t=3*Math.ceil(yx/3);return e.dek.salt=$l(Mm(t),"base64"),e}static get options(){return vx}async createKey(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2048;if(!bx(e)||"self"===e)throw await wx(),Td(new Error("Invalid key name"),JP.ERR_INVALID_KEY_NAME);if("string"!==typeof t)throw await wx(),Td(new Error("Invalid key type"),JP.ERR_INVALID_KEY_TYPE);const n=Ex(e);if(await this.components.datastore.has(n))throw await wx(),Td(new Error("Key name already exists"),JP.ERR_KEY_ALREADY_EXISTS);if("rsa"===t.toLowerCase())if(!Number.isSafeInteger(r)||r<2048)throw await wx(),Td(new Error("Invalid RSA key size"),JP.ERR_INVALID_KEY_SIZE);let i;try{const o=await iv(t,r),s=await o.id(),a=px.get(this);if(null==a)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const c=a.dek,l=await o.export(c);i={name:e,id:s};const u=this.components.datastore.batch();u.put(n,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 r of this.components.datastore.query(e))t.push(JSON.parse($l(r.value)));return t}async findKeyById(e){try{return(await this.listKeys()).find((t=>t.id===e))}catch(t){throw await wx(),t}}async findKeyByName(e){if(!bx(e))throw await wx(),Td(new Error("Invalid key name '".concat(e,"'")),JP.ERR_INVALID_KEY_NAME);const t=_x(e);try{const e=await this.components.datastore.get(t);return JSON.parse($l(e))}catch(r){throw await wx(),hx.error(r),Td(new Error("Key '".concat(e,"' does not exist.")),JP.ERR_KEY_NOT_FOUND)}}async removeKey(e){if(!bx(e)||"self"===e)throw await wx(),Td(new Error("Invalid key name '".concat(e,"'")),JP.ERR_INVALID_KEY_NAME);const t=Ex(e),r=await this.findKeyByName(e),n=this.components.datastore.batch();return n.delete(t),n.delete(_x(e)),await n.commit(),r}async renameKey(e,t){if(!bx(e)||"self"===e)throw await wx(),Td(new Error("Invalid old key name '".concat(e,"'")),JP.ERR_OLD_KEY_NAME_INVALID);if(!bx(t)||"self"===t)throw await wx(),Td(new Error("Invalid new key name '".concat(t,"'")),JP.ERR_NEW_KEY_NAME_INVALID);const r=Ex(e),n=Ex(t),i=_x(e),o=_x(t);if(await this.components.datastore.has(n))throw await wx(),Td(new Error("Key '".concat(t,"' already exists")),JP.ERR_KEY_ALREADY_EXISTS);try{const e=await this.components.datastore.get(r),s=await this.components.datastore.get(i),a=JSON.parse($l(s));a.name=t;const c=this.components.datastore.batch();return c.put(n,e),c.put(o,ru(JSON.stringify(a))),c.delete(r),c.delete(i),await c.commit(),a}catch(s){throw await wx(),s}}async exportKey(e,t){if(!bx(e))throw await wx(),Td(new Error("Invalid key name '".concat(e,"'")),JP.ERR_INVALID_KEY_NAME);if(null==t)throw await wx(),Td(new Error("Password is required"),JP.ERR_PASSWORD_REQUIRED);const r=Ex(e);try{const e=$l(await this.components.datastore.get(r)),n=px.get(this);if(null==n)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const i=n.dek,o=await cv(e,i);return await o.export(t)}catch(n){throw await wx(),n}}async exportPeerId(e){const t="temporary-password",r=await this.exportKey(e,t),n=await cv(r,t);return await EN(n.public.bytes,n.bytes)}async importKey(e,t,r){if(!bx(e)||"self"===e)throw await wx(),Td(new Error("Invalid key name '".concat(e,"'")),JP.ERR_INVALID_KEY_NAME);if(null==t)throw await wx(),Td(new Error("PEM encoded key is required"),JP.ERR_PEM_REQUIRED);const n=Ex(e);if(await this.components.datastore.has(n))throw await wx(),Td(new Error("Key '".concat(e,"' already exists")),JP.ERR_KEY_ALREADY_EXISTS);let i,o;try{i=await cv(t,r)}catch(c){throw await wx(),Td(new Error("Cannot read the key, most likely the password is wrong"),JP.ERR_CANNOT_READ_KEY)}try{o=await i.id();const e=px.get(this);if(null==e)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const r=e.dek;t=await i.export(r)}catch(c){throw await wx(),c}const s={name:e,id:o},a=this.components.datastore.batch();return a.put(n,ru(t)),a.put(_x(e),ru(JSON.stringify(s))),await a.commit(),s}async importPeer(e,t){try{if(!bx(e))throw Td(new Error("Invalid key name '".concat(e,"'")),JP.ERR_INVALID_KEY_NAME);if(null==t)throw Td(new Error("PeerId is required"),JP.ERR_MISSING_PRIVATE_KEY);if(null==t.privateKey)throw Td(new Error("PeerId.privKey is required"),JP.ERR_MISSING_PRIVATE_KEY);const r=await av(t.privateKey),n=Ex(e);if(await this.components.datastore.has(n))throw await wx(),Td(new Error("Key '".concat(e,"' already exists")),JP.ERR_KEY_ALREADY_EXISTS);const i=px.get(this);if(null==i)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const o=i.dek,s=await r.export(o),a={name:e,id:t.toString()},c=this.components.datastore.batch();return c.put(n,ru(s)),c.put(_x(e),ru(JSON.stringify(a))),await c.commit(),a}catch(r){throw await wx(),r}}async getPrivateKey(e){if(!bx(e))throw await wx(),Td(new Error("Invalid key name '".concat(e,"'")),JP.ERR_INVALID_KEY_NAME);try{const t=Ex(e);return $l(await this.components.datastore.get(t))}catch(t){throw await wx(),hx.error(t),Td(new Error("Key '".concat(e,"' does not exist.")),JP.ERR_KEY_NOT_FOUND)}}async rotateKeychainPass(e,t){var r,n,i,o;if("string"!==typeof e)throw await wx(),Td(new Error("Invalid old pass type '".concat(typeof e,"'")),JP.ERR_INVALID_OLD_PASS_TYPE);if("string"!==typeof t)throw await wx(),Td(new Error("Invalid new pass type '".concat(typeof t,"'")),JP.ERR_INVALID_NEW_PASS_TYPE);if(t.length<20)throw await wx(),Td(new Error("Invalid pass length ".concat(t.length)),JP.ERR_INVALID_PASS_LENGTH);hx("recreating keychain");const s=px.get(this);if(null==s)throw Td(new Error("dek missing"),JP.ERR_INVALID_PARAMETERS);const a=s.dek;this.init.pass=t;const c=null!=t&&null!=(null===(r=this.init.dek)||void 0===r?void 0:r.salt)?MR(t,this.init.dek.salt,null===(n=this.init.dek)||void 0===n?void 0:n.iterationCount,null===(i=this.init.dek)||void 0===i?void 0:i.keyLength,null===(o=this.init.dek)||void 0===o?void 0:o.hash):"";px.set(this,{dek:c});const l=await this.listKeys();for(const u of l){const e=$l(await this.components.datastore.get(Ex(u.name))),t=await cv(e,a),r=c.toString(),n=await t.export(r),i=this.components.datastore.batch(),o={name:u.name,id:u.id};i.put(Ex(u.name),ru(n)),i.put(_x(u.name),ru(JSON.stringify(o))),await i.commit()}hx("keychain reconstructed")}}async function Ax(e){try{return{status:"fulfilled",value:await e,isFulfilled:!0,isRejected:!1}}catch(t){return{status:"rejected",reason:t,isFulfilled:!1,isRejected:!0}}}let Tx;class Cx{constructor(e){Xa(this,"value",void 0),Xa(this,"next",void 0),this.value=e}}var kx=new WeakMap,Ix=new WeakMap,Rx=new WeakMap;Tx=Symbol.iterator;class Px{constructor(){ec(this,kx,{writable:!0,value:void 0}),ec(this,Ix,{writable:!0,value:void 0}),ec(this,Rx,{writable:!0,value:void 0}),this.clear()}enqueue(e){var t;const r=new Cx(e);nc(this,kx)?(nc(this,Ix).next=r,rc(this,Ix,r)):(rc(this,kx,r),rc(this,Ix,r)),rc(this,Rx,(t=nc(this,Rx),t++,t))}dequeue(){var e;const t=nc(this,kx);if(t)return rc(this,kx,nc(this,kx).next),rc(this,Rx,(e=nc(this,Rx),e--,e)),t.value}clear(){rc(this,kx,void 0),rc(this,Ix,void 0),rc(this,Rx,0)}get size(){return nc(this,Rx)}*[Tx](){let e=nc(this,kx);for(;e;)yield e.value,e=e.next}}function Nx(e){if(!Number.isInteger(e)&&e!==Number.POSITIVE_INFINITY||!(e>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");const t=new Px;let r=0;const n=async(e,n,i)=>{r++;const o=(async()=>e(...i))();n(o);try{await o}catch{}r--,t.size>0&&t.dequeue()()},i=(i,o,s)=>{t.enqueue(n.bind(void 0,i,o,s)),(async()=>{await Promise.resolve(),r<e&&t.size>0&&t.dequeue()()})()},o=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new Promise((t=>{i(e,t,r)}))};return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>t.size},clearQueue:{value:()=>{t.clear()}}}),o}async function Dx(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{concurrency:r=Number.POSITIVE_INFINITY}=t,n=Nx(r);return Promise.all(e.map((e=>e&&"function"===typeof e.then?Ax(e):Ax("function"===typeof e?n((()=>e())):Promise.resolve(e)))))}class xx extends Map{constructor(e){super(),Xa(this,"metric",void 0);const{name:t,metrics:r}=e;this.metric=r.registerMetric(t),this.updateComponentMetric()}set(e,t){return super.set(e,t),this.updateComponentMetric(),this}delete(e){const t=super.delete(e);return this.updateComponentMetric(),t}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}}function Lx(e){const{name:t,metrics:r}=e;let n;return n=null!=r?new xx({name:t,metrics:r}):new Map,n}const Ox=jv("libp2p:transports");class Bx extends cS{constructor(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.components=e,this.started=!1,this.transports=new Map,this.listeners=Lx({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=null!==(t=r.faultTolerance)&&void 0!==t?t:eS.FATAL_ALL}add(e){const t=e[Symbol.toStringTag];if(null==t)throw Td(new Error("Transport must have a valid tag"),JP.ERR_INVALID_KEY);if(this.transports.has(t))throw Td(new Error("There is already a transport with this tag"),JP.ERR_DUPLICATE_TRANSPORT);Ox("adding transport %s",t),this.transports.set(t,e),this.listeners.has(t)||this.listeners.set(t,[])}isStarted(){return this.started}async start(){const e=this.components.addressManager.getListenAddrs();await this.listen(e),this.started=!0}async stop(){const e=[];for(const[t,r]of this.listeners)for(Ox("closing listeners for %s",t);r.length>0;){const t=r.pop();null!=t&&e.push(t.close())}await Promise.all(e),Ox("all listeners closed");for(const t of this.listeners.keys())this.listeners.set(t,[]);this.started=!1}async dial(e,t){const r=this.transportForMultiaddr(e);if(null==r)throw Td(new Error("No transport available for address ".concat(String(e))),JP.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,{...t,upgrader:this.components.upgrader})}catch(n){throw null==n.code&&(n.code=JP.ERR_TRANSPORT_DIAL_FAILED),n}}getAddrs(){let e=[];for(const t of this.listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return Array.of(...this.transports.values())}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 Ox("no addresses were provided for listening, this node is dial only");const t=[];for(const[r,n]of this.transports.entries()){const i=n.filter(e),o=[];for(const e of i){Ox("creating listener for %s on %s",r,e);const t=n.createListener({upgrader:this.components.upgrader});let i=this.listeners.get(r);null==i&&(i=[],this.listeners.set(r,i)),i.push(t),t.addEventListener("listening",(()=>{this.dispatchEvent(new uS("listener:listening",{detail:t}))})),t.addEventListener("close",(()=>{this.dispatchEvent(new uS("listener:close",{detail:t}))})),o.push(t.listen(e))}if(0===o.length){t.push(r);continue}const s=(await Dx(o)).find((e=>e.isFulfilled));if(null==s&&this.faultTolerance!==eS.NO_FATAL)throw Td(new Error("Transport (".concat(r,") could not listen on any available address")),JP.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===eS.FATAL_ALL)throw Td(new Error(e),JP.ERR_NO_VALID_ADDRESSES);Ox("libp2p in dial mode only: ".concat(e))}}async remove(e){Ox("removing %s",e);for(const r of null!==(t=this.listeners.get(e))&&void 0!==t?t:[]){var t;await r.close()}this.transports.delete(e),this.listeners.delete(e)}async removeAll(){const e=[];for(const t of this.transports.keys())e.push(this.remove(t));await Promise.all(e)}}const Mx="/multistream/1.0.0",Ux=1024,Fx=jv("libp2p:mss"),jx=ru("\n");function zx(e){const t=new cd(e,jx);return Ap.single(t)}function Vx(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=zx(t);!0===r.writeBytes?e.push(n.subarray()):e.push(n)}async function Kx(e,t){const r=await async function(e,t){let r=1;const n={[Symbol.asyncIterator]:()=>n,next:async()=>await e.next(r)};let i=n;null!=(null===t||void 0===t?void 0:t.signal)&&(i=Jv(n,t.signal));const o=await _p(i,Rp({onLength:e=>{r=e},maxDataLength:Ux}),(async e=>await nN(e)));if(null==o||0===o.length)throw Td(new Error("no buffer returned"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");if(o.get(o.byteLength-1)!==jx[0])throw Fx.error("Invalid mss message - missing newline - %s",o.subarray()),Td(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return o.sublist(0,-1)}(e,t);return $l(r.subarray())}const qx=jv("libp2p:mss:select");async function Hx(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Array.isArray(t)?[...t]:[t];const{reader:n,writer:i,rest:o,stream:s}=AD(e),a=t.shift();if(null==a)throw new Error("At least one protocol must be specified");qx('select: write ["%s", "%s"]',Mx,a);!function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=new cd;for(const i of t)n.append(zx(i));!0===r.writeBytes?e.push(n.subarray()):e.push(n)}(i,[ru(Mx),ru(a)],r);let c=await Kx(n,r);if(qx('select: read "%s"',c),c===Mx&&(c=await Kx(n,r),qx('select: read "%s"',c)),c===a)return o(),{stream:s,protocol:a};for(const l of t){qx('select: write "%s"',l),Vx(i,ru(l),r);const e=await Kx(n,r);if(qx('select: read "%s" for "%s"',e,l),e===l)return o(),{stream:s,protocol:l}}throw o(),Td(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}const Gx=jv("libp2p:mss:handle");async function Wx(e,t,r){t=Array.isArray(t)?t:[t];const{writer:n,reader:i,rest:o,stream:s}=AD(e);for(;;){const e=await Kx(i,r);if(Gx('read "%s"',e),e!==Mx){if(t.includes(e))return Vx(n,ru(e),r),Gx('respond with "%s" for "%s"',e,e),o(),{stream:s,protocol:e};"ls"!==e?(Vx(n,ru("na"),r),Gx('respond with "na" for "%s"',e)):(Vx(n,new cd(...t.map((e=>zx(ru(e))))),r),Gx('respond with "%s" for %s',t,e))}else Gx('respond with "%s" for "%s"',Mx,e),Vx(n,ru(Mx),r)}}const Qx=Symbol.for("@libp2p/connection");const Yx=jv("libp2p:connection");class $x{constructor(e){const{remoteAddr:t,remotePeer:r,newStream:n,close:i,getStreams:o,stat:s}=e;this.id="".concat(parseInt(String(1e9*Math.random())).toString(36)).concat(Date.now()),this.remoteAddr=t,this.remotePeer=r,this.stat={...s,status:RN},this._newStream=n,this._close=i,this._getStreams=o,this.tags=[],this._closing=!1}get[Symbol.toStringTag](){return"Connection"}get[Qx](){return!0}get streams(){return this._getStreams()}async newStream(e,t){if(this.stat.status===PN)throw Td(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===NN)throw Td(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const r=await this._newStream(e,t);return r.stat.direction="outbound",r}addStream(e){e.stat.direction="inbound"}removeStream(e){}async close(){if(this.stat.status!==NN&&!this._closing){this.stat.status=PN;try{this.streams.forEach((e=>e.close()))}catch(e){Yx.error(e)}this._closing=!0,await this._close(),this._closing=!1,this.stat.timeline.close=Date.now(),this.stat.status=NN}}}const Xx=jv("libp2p:registrar"),Jx=32,Zx=64;class eL{constructor(e){this.topologies=new Map,this.handlers=new Map,this.components=e,this._onDisconnect=this._onDisconnect.bind(this),this._onProtocolChange=this._onProtocolChange.bind(this),this._onConnect=this._onConnect.bind(this),this.components.connectionManager.addEventListener("peer:disconnect",this._onDisconnect),this.components.connectionManager.addEventListener("peer:connect",this._onConnect),this.components.peerStore.addEventListener("change:protocols",this._onProtocolChange)}getProtocols(){return Array.from(new Set([...this.topologies.keys(),...this.handlers.keys()])).sort()}getHandler(e){const t=this.handlers.get(e);if(null==t)throw Td(new Error("No handler registered for protocol ".concat(e)),JP.ERR_NO_HANDLER_FOR_PROTOCOL);return t}getTopologies(e){const t=this.topologies.get(e);return null==t?[]:[...t.values()]}async handle(e,t,r){if(this.handlers.has(e))throw Td(new Error("Handler already registered for protocol ".concat(e)),JP.ERR_PROTOCOL_HANDLER_ALREADY_REGISTERED);const n=AN.bind({ignoreUndefined:!0})({maxInboundStreams:Jx,maxOutboundStreams:Zx},r);this.handlers.set(e,{handler:t,options:n}),await this.components.peerStore.protoBook.add(this.components.peerId,[e])}async unhandle(e){const t=Array.isArray(e)?e:[e];t.forEach((e=>{this.handlers.delete(e)})),await this.components.peerStore.protoBook.remove(this.components.peerId,t)}async register(e,t){if(null==(r=t)||!Boolean(r[qI]))throw Xx.error("topology must be an instance of interfaces/topology"),Td(new Error("topology must be an instance of interfaces/topology"),JP.ERR_INVALID_PARAMETERS);var r;const n="".concat((1e9*Math.random()).toString(36)).concat(Date.now());let i=this.topologies.get(e);return null==i&&(i=new Map,this.topologies.set(e,i)),i.set(n,t),await t.setRegistrar(this),n}unregister(e){for(const[t,r]of this.topologies.entries())r.has(e)&&(r.delete(e),0===r.size&&this.topologies.delete(t))}_onDisconnect(e){const t=e.detail;this.components.peerStore.protoBook.get(t.remotePeer).then((e=>{for(const r of e){const e=this.topologies.get(r);if(null!=e)for(const r of e.values())r.onDisconnect(t.remotePeer)}})).catch((e=>{Xx.error(e)}))}_onConnect(e){const t=e.detail;this.components.peerStore.protoBook.get(t.remotePeer).then((e=>{for(const r of e){const e=this.topologies.get(r);if(null!=e)for(const r of e.values())r.onConnect(t.remotePeer,t)}})).catch((e=>{Xx.error(e)}))}_onProtocolChange(e){const{peerId:t,protocols:r,oldProtocols:n}=e.detail,i=n.filter((e=>!r.includes(e))),o=r.filter((e=>!n.includes(e)));for(const s of i){const e=this.topologies.get(s);if(null!=e)for(const r of e.values())r.onDisconnect(t)}for(const s of o){const e=this.topologies.get(s);if(null!=e)for(const r of e.values()){const e=this.components.connectionManager.getConnections(t)[0];null!=e&&r.onConnect(t,e)}}}}const tL=jv("libp2p:upgrader");function rL(e,t,r){let n=0;return r.streams.forEach((r=>{r.stat.direction===t&&r.stat.protocol===e&&n++})),n}class nL extends cS{constructor(e,t){super(),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=t.inboundUpgradeTimeout}async upgradeInbound(e,t){if(!await this.components.connectionManager.acceptIncomingConnection(e))throw Td(new Error("connection denied"),JP.ERR_CONNECTION_DENIED);let r,n,i,o,s;const a=new rN.TimeoutController(this.inboundUpgradeTimeout);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,a.signal)}catch{}try{var c;const u=eb(e,a.signal);if(e.source=u.source,e.sink=u.sink,await this.components.connectionGater.denyInboundConnection(e))throw Td(new Error("The multiaddr connection is blocked by gater.acceptConnection"),JP.ERR_CONNECTION_INTERCEPTED);null===(c=this.components.metrics)||void 0===c||c.trackMultiaddrConnection(e),tL("starting the inbound connection upgrade");let h=e;if(!0!==(null===t||void 0===t?void 0:t.skipProtection)){const t=this.components.connectionProtector;null!=t&&(tL("protecting the inbound connection"),h=await t.protect(e))}try{if(r=h,!0!==(null===t||void 0===t?void 0:t.skipEncryption)){if(({conn:r,remotePeer:n,protocol:s}=await this._encryptInbound(h)),await this.components.connectionGater.denyInboundEncryptedConnection(n,{...h,...r}))throw Td(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),JP.ERR_CONNECTION_INTERCEPTED)}else{const t=e.remoteAddr.getPeerId();if(null==t)throw Td(new Error("inbound connection that skipped encryption must have a peer id"),JP.ERR_INVALID_MULTIADDR);const r=bN(t);s="native",n=r}if(i=r,null!=(null===t||void 0===t?void 0:t.muxerFactory))o=t.muxerFactory;else if(this.muxers.size>0){const e=await this._multiplexInbound({...h,...r},this.muxers);o=e.muxerFactory,i=e.stream}}catch(l){throw tL.error("Failed to upgrade inbound connection",l),l}if(await this.components.connectionGater.denyInboundUpgradedConnection(n,{...h,...r}))throw Td(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),JP.ERR_CONNECTION_INTERCEPTED);return tL("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:s,direction:"inbound",maConn:e,upgradedConn:i,muxerFactory:o,remotePeer:n})}finally{this.components.connectionManager.afterUpgradeInbound(),a.clear()}}async upgradeOutbound(e,t){var r;const n=e.remoteAddr.getPeerId();let i,o,s,a,c,l;if(null!=n&&(i=bN(n),await this.components.connectionGater.denyOutboundConnection(i,e)))throw Td(new Error("The multiaddr connection is blocked by connectionGater.denyOutboundConnection"),JP.ERR_CONNECTION_INTERCEPTED);null===(r=this.components.metrics)||void 0===r||r.trackMultiaddrConnection(e),tL("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)){if(({conn:o,remotePeer:s,protocol:c}=await this._encryptOutbound(u,i)),await this.components.connectionGater.denyOutboundEncryptedConnection(s,{...u,...o}))throw Td(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),JP.ERR_CONNECTION_INTERCEPTED)}else{if(null==i)throw Td(new Error("Encryption was skipped but no peer id was passed"),JP.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 tL.error("Failed to upgrade outbound connection",h),await e.close(h),h}if(await this.components.connectionGater.denyOutboundUpgradedConnection(s,{...u,...o}))throw Td(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),JP.ERR_CONNECTION_INTERCEPTED);return tL("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:c,direction:"outbound",maConn:e,upgradedConn:a,muxerFactory:l,remotePeer:s})}_createConnection(e){var t,r,n=this;const{cryptoProtocol:i,direction:o,maConn:s,upgradedConn:a,remotePeer:c,muxerFactory:l}=e;let u,h,d;null!=l&&(u=l.createStreamMuxer({direction:o,onIncomingStream:e=>{null!=d&&Promise.resolve().then((async()=>{var t;const r=this.components.registrar.getProtocols(),{stream:n,protocol:i}=await Wx(e,r);if(tL("%s: incoming stream opened on %s",o,i),null==d)return;const s=function(e,t){try{const{options:r}=t.getHandler(e);return r.maxInboundStreams}catch(r){if(r.code!==JP.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Jx}(i,this.components.registrar);rL(i,"inbound",d)!==s?(e.source=n.source,e.sink=n.sink,e.stat.protocol=i,this.components.peerStore.protoBook.add(c,[i]).catch((e=>tL.error(e))),d.addStream(e),null===(t=this.components.metrics)||void 0===t||t.trackProtocolStream(e,d),this._onStream({connection:d,stream:e,protocol:i})):e.abort(Td(new Error('Too many inbound protocol streams for protocol "'.concat(i,'" - limit ').concat(s)),JP.ERR_TOO_MANY_INBOUND_PROTOCOL_STREAMS))})).catch((t=>{tL.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 Td(new Error("Stream is not multiplexed"),JP.ERR_MUXER_UNAVAILABLE);tL("%s: starting new stream on %s",o,e);const r=await u.newStream();let i;try{var s;if(null==t.signal){tL("No abort signal was passed while trying to negotiate protocols %s falling back to default timeout",e),i=new rN.TimeoutController(3e4),t.signal=i.signal;try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,i.signal)}catch{}}const{stream:o,protocol:a}=await Hx(r,e,t),l=function(e,t){try{const{options:r}=t.getHandler(e);return r.maxOutboundStreams}catch(r){if(r.code!==JP.ERR_NO_HANDLER_FOR_PROTOCOL)throw r}return Zx}(a,n.components.registrar);if(rL(a,"outbound",d)===l){const e=Td(new Error('Too many outbound protocol streams for protocol "'.concat(a,'" - limit ').concat(l)),JP.ERR_TOO_MANY_OUTBOUND_PROTOCOL_STREAMS);throw r.abort(e),e}return n.components.peerStore.protoBook.add(c,[a]).catch((e=>tL.error(e))),r.source=o.source,r.sink=o.sink,r.stat.protocol=a,null===(s=n.components.metrics)||void 0===s||s.trackProtocolStream(r,d),r}catch(a){if(tL.error("could not create new stream",a),null==r.stat.timeline.close&&r.close(),null!=a.code)throw a;throw Td(a,JP.ERR_UNSUPPORTED_PROTOCOL)}finally{null!=i&&i.clear()}},Promise.all([u.sink(a.source),a.sink(u.source)]).catch((e=>{tL.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){tL.error(e)}finally{n.dispatchEvent(new uS("connectionEnd",{detail:d}))}})().catch((e=>{tL.error(e)})),Reflect.set(...arguments)}}),s.timeline.upgraded=Date.now();const p=()=>{throw Td(new Error("connection is not multiplexed"),JP.ERR_CONNECTION_NOT_MULTIPLEXED)};var g;return g={remoteAddr:s.remoteAddr,remotePeer:c,stat:{status:"OPEN",direction:o,timeline:s.timeline,multiplexer:null===(t=u)||void 0===t?void 0:t.protocol,encryption:i},newStream:null!==(r=h)&&void 0!==r?r:p,getStreams:()=>null!=u?u.streams:p(),close:async()=>{await s.close(),null!=u&&u.close()}},d=new $x(g),this.dispatchEvent(new uS("connection",{detail:d})),d}_onStream(e){const{connection:t,stream:r,protocol:n}=e,{handler:i}=this.components.registrar.getHandler(n);i({connection:t,stream:r})}async _encryptInbound(e){const t=Array.from(this.connectionEncryption.keys());tL("handling inbound crypto protocol selection",t);try{const{stream:r,protocol:n}=await Wx(e,t,{writeBytes:!0}),i=this.connectionEncryption.get(n);if(null==i)throw new Error("no crypto module found for ".concat(n));return tL("encrypting inbound connection..."),{...await i.secureInbound(this.components.peerId,r),protocol:n}}catch(r){throw Td(r,JP.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t){const r=Array.from(this.connectionEncryption.keys());tL("selecting outbound crypto protocol",r);try{const{stream:n,protocol:i}=await Hx(e,r,{writeBytes:!0}),o=this.connectionEncryption.get(i);if(null==o)throw new Error("no crypto module found for ".concat(i));return tL("encrypting outbound connection to %p",t),{...await o.secureOutbound(this.components.peerId,n,t),protocol:i}}catch(n){throw Td(n,JP.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=Array.from(t.keys());tL("outbound selecting muxer %s",r);try{const{stream:n,protocol:i}=await Hx(e,r,{writeBytes:!0});tL("%s selected as muxer protocol",i);return{stream:n,muxerFactory:t.get(i)}}catch(n){throw tL.error("error multiplexing outbound stream",n),Td(n,JP.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=Array.from(t.keys());tL("inbound handling muxers %s",r);try{const{stream:n,protocol:i}=await Wx(e,r,{writeBytes:!0});return{stream:n,muxerFactory:t.get(i)}}catch(n){throw tL.error("error multiplexing inbound stream",n),Td(n,JP.ERR_MUXER_UNAVAILABLE)}}}var iL;!function(e){let t;e.codec=()=>(null==t&&(t=vD((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.protocolVersion&&(t.uint32(42),t.string(e.protocolVersion)),null!=e.agentVersion&&(t.uint32(50),t.string(e.agentVersion)),null!=e.publicKey&&(t.uint32(10),t.bytes(e.publicKey)),null!=e.listenAddrs)for(const n of e.listenAddrs)t.uint32(18),t.bytes(n);if(null!=e.observedAddr&&(t.uint32(34),t.bytes(e.observedAddr)),null!=e.protocols)for(const n of e.protocols)t.uint32(26),t.string(n);null!=e.signedPeerRecord&&(t.uint32(66),t.bytes(e.signedPeerRecord)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={listenAddrs:[],protocols:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 5:r.protocolVersion=e.string();break;case 6:r.agentVersion=e.string();break;case 1:r.publicKey=e.bytes();break;case 2:r.listenAddrs.push(e.bytes());break;case 4:r.observedAddr=e.bytes();break;case 3:r.protocols.push(e.string());break;case 8:r.signedPeerRecord=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(iL||(iL={}));const oL="0.0.0",sL="js-libp2p/".concat(oL),aL=jv("libp2p:identify");class cL{constructor(e,t){this.components=e,this.started=!1,this.init=t,this.identifyProtocolStr="/".concat(t.protocolPrefix,"/").concat("id","/").concat("1.0.0"),this.identifyPushProtocolStr="/".concat(t.protocolPrefix,"/").concat("id/push","/").concat("1.0.0"),this.host={protocolVersion:"".concat(t.protocolPrefix,"/").concat("0.1.0"),...t.host},this.components.connectionManager.addEventListener("peer:connect",(e=>{const t=e.detail;this.identify(t).catch(aL.error)})),this.components.peerStore.addEventListener("change:multiaddrs",(e=>{const{peerId:t}=e.detail;this.components.peerId.equals(t)&&this.pushToPeerStore().catch((e=>aL.error(e)))})),this.components.peerStore.addEventListener("change:protocols",(e=>{const{peerId:t}=e.detail;this.components.peerId.equals(t)&&this.pushToPeerStore().catch((e=>aL.error(e)))}))}isStarted(){return this.started}async start(){this.started||(await this.components.peerStore.metadataBook.setValue(this.components.peerId,"AgentVersion",ru(this.host.agentVersion)),await this.components.peerStore.metadataBook.setValue(this.components.peerId,"ProtocolVersion",ru(this.host.protocolVersion)),await this.components.registrar.handle(this.identifyProtocolStr,(e=>{this._handleIdentify(e).catch((e=>{aL.error(e)}))}),{maxInboundStreams:this.init.maxInboundStreams,maxOutboundStreams:this.init.maxOutboundStreams}),await this.components.registrar.handle(this.identifyPushProtocolStr,(e=>{this._handlePush(e).catch((e=>{aL.error(e)}))}),{maxInboundStreams:this.init.maxPushIncomingStreams,maxOutboundStreams:this.init.maxPushOutgoingStreams}),this.started=!0)}async stop(){await this.components.registrar.unhandle(this.identifyProtocolStr),await this.components.registrar.unhandle(this.identifyPushProtocolStr),this.started=!1}async push(e){const t=await this.components.peerStore.addressBook.getRawEnvelope(this.components.peerId),r=this.components.addressManager.getAddresses().map((e=>e.bytes)),n=await this.components.peerStore.protoBook.get(this.components.peerId),i=e.map((async e=>{let i;const o=new rN.TimeoutController(this.init.timeout);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,o.signal)}catch{}try{i=await e.newStream([this.identifyPushProtocolStr],{signal:o.signal});const s=eb(i,o.signal);await s.sink(_p([iL.encode({listenAddrs:r,signedPeerRecord:t,protocols:n})],Ap()))}catch(s){aL.error("could not push identify update to peer",s)}finally{null!=i&&i.close(),o.clear()}}));await Promise.all(i)}async pushToPeerStore(){if(!this.isStarted())return;const e=[];for(const t of this.components.connectionManager.getConnections()){const r=t.remotePeer;(await this.components.peerStore.get(r)).protocols.includes(this.identifyPushProtocolStr)&&e.push(t)}await this.push(e)}async _identify(e){let t,r,n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).signal;if(null==n){t=new rN.TimeoutController(this.init.timeout),n=t.signal;try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,t.signal)}catch{}}try{var i;r=await e.newStream([this.identifyProtocolStr],{signal:n});const t=eb(r,n),s=await _p([],t,Rp({maxDataLength:null!==(i=this.init.maxIdentifyMessageSize)&&void 0!==i?i:8192}),(async e=>await nN(e)));if(null==s)throw Td(new Error("No data could be retrieved"),JP.ERR_CONNECTION_ENDED);try{return iL.decode(s)}catch(o){throw Td(o,JP.ERR_INVALID_MESSAGE)}}finally{null!=t&&t.clear(),null!=r&&r.close()}}async identify(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=await this._identify(e,t),{publicKey:n,listenAddrs:i,protocols:o,observedAddr:s,signedPeerRecord:a,agentVersion:c,protocolVersion:l}=r;if(null==n)throw Td(new Error("public key was missing from identify message"),JP.ERR_MISSING_PUBLIC_KEY);const u=await EN(n);if(!e.remotePeer.equals(u))throw Td(new Error("identified peer does not match the expected peer"),JP.ERR_INVALID_PEER);if(this.components.peerId.equals(u))throw Td(new Error("identified peer is our own peer id?"),JP.ERR_INVALID_PEER);const h=cL.getCleanMultiaddr(s);if(null!=a){aL("received signed peer record from %p",u);try{const e=await Vk.openAndCertify(a,NI.DOMAIN);if(!e.peerId.equals(u))throw Td(new Error("identified peer does not match the expected peer"),JP.ERR_INVALID_PEER);if(await this.components.peerStore.addressBook.consumePeerRecord(e))return await this.components.peerStore.protoBook.set(u,o),null!=c&&await this.components.peerStore.metadataBook.setValue(u,"AgentVersion",ru(c)),null!=l&&await this.components.peerStore.metadataBook.setValue(u,"ProtocolVersion",ru(l)),void aL("identify completed for peer %p and protocols %o",u,o)}catch(d){aL("received invalid envelope, discard it and fallback to listenAddrs is available",d)}}else aL("no signed peer record received from %p",u);aL("falling back to legacy addresses from %p",u);try{await this.components.peerStore.addressBook.set(u,i.map((e=>o_(e))))}catch(d){aL.error("received invalid addrs",d)}await this.components.peerStore.protoBook.set(u,o),null!=c&&await this.components.peerStore.metadataBook.setValue(u,"AgentVersion",ru(c)),null!=l&&await this.components.peerStore.metadataBook.setValue(u,"ProtocolVersion",ru(l)),aL("identify completed for peer %p and protocols %o",u,o),aL("received observed address of %s",null===h||void 0===h?void 0:h.toString())}async _handleIdentify(e){const{connection:t,stream:r}=e,n=new rN.TimeoutController(this.init.timeout);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,n.signal)}catch{}try{var i;const e=null!==(i=this.components.peerId.publicKey)&&void 0!==i?i:new Uint8Array(0),o=await this.components.peerStore.get(this.components.peerId),s=this.components.addressManager.getAddresses().map((e=>e.decapsulateCode(qb("p2p").code)));let a=o.peerRecordEnvelope;if(s.length>0&&null==a){const e=new NI({peerId:this.components.peerId,multiaddrs:s}),t=await Vk.seal(e,this.components.peerId);await this.components.peerStore.addressBook.consumePeerRecord(t),a=t.marshal().subarray()}const c=iL.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=eb(r,n.signal),u=_p([c],Ap());await l.sink(u)}catch(o){aL.error("could not respond to identify request",o)}finally{r.close(),n.clear()}}async _handlePush(e){const{connection:t,stream:r}=e,n=new rN.TimeoutController(this.init.timeout);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,n.signal)}catch{}let i;try{var o;const e=eb(r,n.signal),t=await _p([],e,Rp({maxDataLength:null!==(o=this.init.maxIdentifyMessageSize)&&void 0!==o?o:8192}),(async e=>await nN(e)));null!=t&&(i=iL.decode(t))}catch(a){return aL.error("received invalid message",a)}finally{r.close(),n.clear()}if(null==i)return aL.error("received invalid message");const s=t.remotePeer;if(this.components.peerId.equals(s))aL("received push from ourselves?");else{if(aL("received push from %p",s),null!=i.signedPeerRecord){aL("received signedPeerRecord in push");try{const e=await Vk.openAndCertify(i.signedPeerRecord,NI.DOMAIN);if(await this.components.peerStore.addressBook.consumePeerRecord(e))return aL("consumed signedPeerRecord sent in push"),void await this.components.peerStore.protoBook.set(s,i.protocols);aL("failed to consume signedPeerRecord sent in push")}catch(a){aL("received invalid envelope, discard it and fallback to listenAddrs is available",a)}}else aL("did not receive signedPeerRecord in push");try{await this.components.peerStore.addressBook.set(s,i.listenAddrs.map((e=>o_(e))))}catch(a){aL.error("received invalid addrs",a)}try{await this.components.peerStore.protoBook.set(s,i.protocols)}catch(a){aL.error("received invalid protocols",a)}aL("handled push from %p",s)}}static getCleanMultiaddr(e){if(null!=e&&e.length>0)try{return o_(e)}catch{}}}var lL,uL;!function(e){let t;e.codec=()=>(null==t&&(t=vD((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),!0!==r.writeDefaults&&""===e.identifier||(t.uint32(10),t.string(e.identifier)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={identifier:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.identifier=e.string();else e.skipType(7&t)}return r}))),t),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(lL||(lL={})),function(e){let t,r,n;!function(e){e.OK="OK",e.NOT_FOUND="NOT_FOUND",e.ERROR="ERROR"}(t=e.StatusCode||(e.StatusCode={})),function(e){e[e.OK=0]="OK",e[e.NOT_FOUND=1]="NOT_FOUND",e[e.ERROR=2]="ERROR"}(r||(r={})),function(e){e.codec=()=>mD(r)}(t=e.StatusCode||(e.StatusCode={})),e.codec=()=>(null==n&&(n=vD((function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==i.lengthDelimited&&n.fork(),(!0===i.writeDefaults||null!=t.status&&0!==r[t.status])&&(n.uint32(8),e.StatusCode.codec().encode(t.status,n)),(!0===i.writeDefaults||null!=t.data&&t.data.byteLength>0)&&(n.uint32(18),n.bytes(t.data)),!1!==i.lengthDelimited&&n.ldelim()}),((r,n)=>{const i={status:t.OK,data:new Uint8Array(0)},o=null==n?r.len:r.pos+n;for(;r.pos<o;){const t=r.uint32();switch(t>>>3){case 1:i.status=e.StatusCode.codec().decode(r);break;case 2:i.data=r.bytes();break;default:r.skipType(7&t)}}return i}))),n),e.encode=t=>fD(t,e.codec()),e.decode=t=>dD(t,e.codec())}(uL||(uL={}));const hL=jv("libp2p:fetch");class dL{constructor(e,t){var r;this.started=!1,this.components=e,this.protocol="/".concat(null!==(r=t.protocolPrefix)&&void 0!==r?r:"libp2p","/").concat("fetch","/").concat("0.0.1"),this.lookupFunctions=new Map,this.handleMessage=this.handleMessage.bind(this),this.init=t}async start(){await this.components.registrar.handle(this.protocol,(e=>{this.handleMessage(e).catch((e=>{hL.error(e)})).finally((()=>{e.stream.close()}))}),{maxInboundStreams:this.init.maxInboundStreams,maxOutboundStreams:this.init.maxOutboundStreams}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}async fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};hL("dialing %s to %p",this.protocol,e);const n=await this.components.connectionManager.openConnection(e,r);let i,o,s=r.signal;if(null==s){hL("using default timeout of %d ms",this.init.timeout),i=new rN.TimeoutController(this.init.timeout),s=i.signal;try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,i.signal)}catch{}}try{o=await n.newStream(this.protocol,{signal:s});const e=eb(o,s);hL("fetch %s",t);const r=await _p([lL.encode({identifier:t})],Ap(),e,Rp(),(async function(e){const r=await nN(e);if(null==r)throw Td(new Error("No data received"),JP.ERR_INVALID_MESSAGE);const n=uL.decode(r);switch(n.status){case uL.StatusCode.OK:return hL("received status for %s ok",t),n.data;case uL.StatusCode.NOT_FOUND:return hL("received status for %s not found",t),null;case uL.StatusCode.ERROR:{hL("received status for %s error",t);const e=$l(n.data);throw Td(new Error("Error in fetch protocol response: "+e),JP.ERR_INVALID_PARAMETERS)}default:throw hL("received status for %s unknown",t),Td(new Error("Unknown response status"),JP.ERR_INVALID_MESSAGE)}}));return null!==r&&void 0!==r?r:null}finally{null!=i&&i.clear(),null!=o&&o.close()}}async handleMessage(e){const{stream:t}=e,r=this;await _p(t,Rp(),(async function*(e){const t=await nN(e);if(null==t)throw Td(new Error("No data received"),JP.ERR_INVALID_MESSAGE);const n=lL.decode(t);let i;const o=r._getLookupFunction(n.identifier);if(null!=o){hL("look up data with identifier %s",n.identifier);const e=await o(n.identifier);null!=e?(hL("sending status for %s ok",n.identifier),i={status:uL.StatusCode.OK,data:e}):(hL("sending status for %s not found",n.identifier),i={status:uL.StatusCode.NOT_FOUND,data:new Uint8Array(0)})}else{hL("sending status for %s error",n.identifier);const e=ru("No lookup function registered for key: ".concat(n.identifier));i={status:uL.StatusCode.ERROR,data:e}}yield uL.encode(i)}),Ap(),t)}_getLookupFunction(e){for(const t of this.lookupFunctions.keys())if(e.startsWith(t))return this.lookupFunctions.get(t)}registerLookupFunction(e,t){if(this.lookupFunctions.has(e))throw Td(new Error("Fetch protocol handler for key prefix '"+e+"' already registered"),JP.ERR_KEY_ALREADY_EXISTS);this.lookupFunctions.set(e,t)}unregisterLookupFunction(e,t){if(null!=t){if(this.lookupFunctions.get(e)!==t)return}this.lookupFunctions.delete(e)}}const fL=jv("libp2p:ping");class pL{constructor(e,t){this.components=e,this.started=!1,this.protocol="/".concat(t.protocolPrefix,"/").concat("ping","/").concat("1.0.0"),this.init=t}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.init.maxInboundStreams,maxOutboundStreams:this.init.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;_p(t,t).catch((e=>{fL.error(e)}))}async ping(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fL("dialing %s to %p",this.protocol,e);const r=Date.now(),n=Mm(32),i=await this.components.connectionManager.openConnection(e,t);let o,s,a=t.signal;if(null==a){o=new rN.TimeoutController(this.init.timeout),a=o.signal;try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,o.signal)}catch{}}try{s=await i.newStream([this.protocol],{signal:a});const e=eb(s,a),t=await _p([n],e,(async e=>await nN(e))),o=Date.now();if(null==t||!cl(n,t.subarray()))throw Td(new Error("Received wrong ping ack"),JP.ERR_WRONG_PING_ACK);return o-r}finally{null!=o&&o.clear(),null!=s&&s.close()}}}function gL(e){const{address:t}=e.nodeAddress();return function(e){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^::1$/.test(e)}(t)}const yL=jv("libp2p:nat"),mL=7200;function vL(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:65535;return Math.floor(Math.random()*(t-e+1)+e)}class bL{constructor(e,t){var r,n,i;if(this.components=e,this.started=!1,this.enabled=t.enabled,this.externalAddress=t.externalAddress,this.localAddress=t.localAddress,this.description=null!==(r=t.description)&&void 0!==r?r:"".concat("libp2p","@").concat(oL," ").concat(this.components.peerId.toString()),this.ttl=null!==(n=t.ttl)&&void 0!==n?n:mL,this.keepAlive=null===(i=t.keepAlive)||void 0===i||i,this.gateway=t.gateway,this.ttl<mL)throw Td(new Error("NatManager ttl should be at least ".concat(mL," seconds")),JP.ERR_INVALID_PARAMETERS)}isStarted(){return this.started}start(){}afterStart(){h_||!this.enabled||this.started||(this.started=!0,this._start().catch((e=>{yL.error(e)})))}async _start(){const e=this.components.transportManager.getAddrs();for(const r of e){var t;const{family:e,host:n,port:i,transport:o}=r.toOptions();if(!r.isThinWaistAddress()||"tcp"!==o)continue;if(gL(r))continue;if(4!==e)continue;const s=await this._getClient(),a=null!==(t=this.externalAddress)&&void 0!==t?t:await s.externalIp(),c=JD(a);if(!0===c)throw new Error("".concat(a," is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT"));if(null==c)throw new Error("".concat(a," is not an IP address"));const l=vL();yL("opening uPnP connection from ".concat(a,":").concat(l," to ").concat(n,":").concat(i)),await s.map({publicPort:l,localPort:i,localAddress:this.localAddress,protocol:"TCP"===o.toUpperCase()?"TCP":"UDP"}),this.components.addressManager.addObservedAddr(r_({family:4,address:a,port:l},o))}}async _getClient(){return null!=this.client||(this.client=await async function(){throw new Error("Not supported in browsers")}((this.description,this.ttl,this.keepAlive,this.gateway))),this.client}async stop(){if(!h_&&null!=this.client)try{await this.client.close(),this.client=void 0}catch(e){yL.error(e)}}}const wL=jv("libp2p:peer-record-updater");class EL{constructor(e){this.components=e,this.started=!1,this.update=this.update.bind(this)}isStarted(){return this.started}async start(){this.started=!0,this.components.transportManager.addEventListener("listener:listening",this.update),this.components.transportManager.addEventListener("listener:close",this.update),this.components.addressManager.addEventListener("change:addresses",this.update)}async stop(){this.started=!1,this.components.transportManager.removeEventListener("listener:listening",this.update),this.components.transportManager.removeEventListener("listener:close",this.update),this.components.addressManager.removeEventListener("change:addresses",this.update)}update(){Promise.resolve().then((async()=>{const e=new NI({peerId:this.components.peerId,multiaddrs:this.components.addressManager.getAddresses().map((e=>e.decapsulateCode(qb("p2p").code)))}),t=await Vk.seal(e,this.components.peerId);await this.components.peerStore.addressBook.consumePeerRecord(t)})).catch((e=>{wL.error("Could not update self peer record: %o",e)}))}}class _L{constructor(e){this.dht=e}async findPeer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of this.dht.findPeer(e,t))if("FINAL_PEER"===r.name)return r.peer;throw Td(new Error(XP.NOT_FOUND),JP.ERR_NOT_FOUND)}getClosestPeers(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const n of t.dht.getClosestPeers(e,r))"FINAL_PEER"===n.name&&(yield n.peer)}()}catch(r){return Promise.reject(r)}}}const SL={ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_NOT_FOUND:"ERR_NOT_FOUND"};let AL;const TL=Symbol.for("nodejs.util.inspect.custom"),CL=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),kL=114,IL=36,RL=37;AL=Symbol.toStringTag;class PL{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[AL](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(kL,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:CL,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new DL({multihash:t}):e.startsWith("16U")?new xL({multihash:t}):new NL({multihash:t})}return OL(CL.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[TL](){return"PeerId(".concat(this.toString(),")")}}class NL extends PL{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class DL extends PL{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class xL extends PL{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}function LL(e){if("RSA"===e.type)return new NL(e);if("Ed25519"===e.type)return new DL(e);if("secp256k1"===e.type)return new xL(e);throw new oc("Not a PeerId","ERR_INVALID_PARAMETERS")}function OL(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===IL)return new DL({multihash:t});if(t.digest.length===RL)return new xL({multihash:t})}if(t.code===Il.code)return new NL({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==kL)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new NL({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===IL)return new DL({multihash:e.multihash});if(t.digest.length===RL)return new xL({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}const BL=jv("libp2p:peer-store:address-book"),ML="change:multiaddrs";async function UL(){return!0}class FL{constructor(e,t,r){this.dispatchEvent=e,this.store=t,this.addressFilter=null!==r&&void 0!==r?r:UL}async consumePeerRecord(e){BL.trace("consumePeerRecord await write lock");const t=await this.store.lock.writeLock();let r,n,i;BL.trace("consumePeerRecord got write lock");try{let t;try{t=NI.createFromProtobuf(e.payload)}catch(o){return BL.error("invalid peer record received"),!1}r=t.peerId;const s=t.multiaddrs;if(!r.equals(e.peerId))return BL("signing key does not match PeerId in the PeerRecord"),!1;if(null==s||0===s.length)return!1;if(await this.store.has(r)&&(n=await this.store.load(r),null!=n.peerRecordEnvelope)){const e=await Vk.createFromProtobuf(n.peerRecordEnvelope),r=NI.createFromProtobuf(e.payload);if(r.seqNumber>=t.seqNumber)return BL("sequence number was lower or equal to existing sequence number - stored: %d received: %d",r.seqNumber,t.seqNumber),!1}const a=await jL(r,s,this.addressFilter,!0);i=await this.store.patchOrCreate(r,{addresses:a,peerRecordEnvelope:e.marshal().subarray()}),BL("stored provided peer record for %p",t.peerId)}finally{BL.trace("consumePeerRecord release write lock"),t()}return this.dispatchEvent(new uS(ML,{detail:{peerId:r,multiaddrs:i.addresses.map((e=>{let{multiaddr:t}=e;return t})),oldMultiaddrs:null==n?[]:n.addresses.map((e=>{let{multiaddr:t}=e;return t}))}})),!0}async getRawEnvelope(e){BL.trace("getRawEnvelope await read lock");const t=await this.store.lock.readLock();BL.trace("getRawEnvelope got read lock");try{return(await this.store.load(e)).peerRecordEnvelope}catch(r){if(r.code!==SL.ERR_NOT_FOUND)throw r}finally{BL.trace("getRawEnvelope release read lock"),t()}}async getPeerRecord(e){const t=await this.getRawEnvelope(e);if(null!=t)return await Vk.createFromProtobuf(t)}async get(e){e=LL(e),BL.trace("get wait for read lock");const t=await this.store.lock.readLock();BL.trace("get got read lock");try{return(await this.store.load(e)).addresses}catch(r){if(r.code!==SL.ERR_NOT_FOUND)throw r}finally{BL.trace("get release read lock"),t()}return[]}async set(e,t){if(e=LL(e),!Array.isArray(t))throw BL.error("multiaddrs must be an array of Multiaddrs"),new oc("multiaddrs must be an array of Multiaddrs",SL.ERR_INVALID_PARAMETERS);BL.trace("set await write lock");const r=await this.store.lock.writeLock();BL.trace("set got write lock");let n,i,o=!1;try{const r=await jL(e,t,this.addressFilter);if(0===r.length)return;try{if(n=await this.store.load(e),o=!0,new Set([...r.map((e=>{let{multiaddr:t}=e;return t.toString()})),...n.addresses.map((e=>{let{multiaddr:t}=e;return t.toString()}))]).size===n.addresses.length&&r.length===n.addresses.length)return}catch(s){if(s.code!==SL.ERR_NOT_FOUND)throw s}i=await this.store.patchOrCreate(e,{addresses:r}),BL("set multiaddrs for %p",e)}finally{BL.trace("set multiaddrs for %p",e),BL("set release write lock"),r()}this.dispatchEvent(new uS(ML,{detail:{peerId:e,multiaddrs:i.addresses.map((e=>e.multiaddr)),oldMultiaddrs:null==n?[]:n.addresses.map((e=>{let{multiaddr:t}=e;return t}))}})),o||this.dispatchEvent(new uS("peer",{detail:{id:e,multiaddrs:i.addresses.map((e=>e.multiaddr)),protocols:i.protocols}}))}async add(e,t){if(e=LL(e),!Array.isArray(t))throw BL.error("multiaddrs must be an array of Multiaddrs"),new oc("multiaddrs must be an array of Multiaddrs",SL.ERR_INVALID_PARAMETERS);BL.trace("add await write lock");const r=await this.store.lock.writeLock();let n,i,o;BL.trace("add got write lock");try{const r=await jL(e,t,this.addressFilter);if(0===r.length)return;try{if(i=await this.store.load(e),n=!0,new Set([...r.map((e=>{let{multiaddr:t}=e;return t.toString()})),...i.addresses.map((e=>{let{multiaddr:t}=e;return t.toString()}))]).size===i.addresses.length)return}catch(s){if(s.code!==SL.ERR_NOT_FOUND)throw s}o=await this.store.mergeOrCreate(e,{addresses:r}),BL("added multiaddrs for %p",e)}finally{BL.trace("set release write lock"),r()}this.dispatchEvent(new uS(ML,{detail:{peerId:e,multiaddrs:o.addresses.map((e=>e.multiaddr)),oldMultiaddrs:null==i?[]:i.addresses.map((e=>{let{multiaddr:t}=e;return t}))}})),!0===n&&this.dispatchEvent(new uS("peer",{detail:{id:e,multiaddrs:o.addresses.map((e=>e.multiaddr)),protocols:o.protocols}}))}async delete(e){e=LL(e),BL.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;BL.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n}await this.store.patchOrCreate(e,{addresses:[]})}finally{BL.trace("delete release write lock"),t()}null!=r&&this.dispatchEvent(new uS(ML,{detail:{peerId:e,multiaddrs:[],oldMultiaddrs:null==r?[]:r.addresses.map((e=>{let{multiaddr:t}=e;return t}))}}))}}async function jL(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=[];return await Promise.all(t.map((async t=>{if(!n_(t))throw BL.error("multiaddr must be an instance of Multiaddr"),new oc("multiaddr must be an instance of Multiaddr",SL.ERR_INVALID_PARAMETERS);await r(e,t)&&i.push({multiaddr:t,isCertified:n})}))),i}const zL=jv("libp2p:peer-store:key-book"),VL="change:pubkey";class KL{constructor(e,t){this.dispatchEvent=e,this.store=t}async set(e,t){if(e=LL(e),!(t instanceof Uint8Array))throw zL.error("publicKey must be an instance of Uint8Array to store data"),new oc("publicKey must be an instance of PublicKey",SL.ERR_INVALID_PARAMETERS);zL.trace("set await write lock");const r=await this.store.lock.writeLock();zL.trace("set got write lock");let n,i=!1;try{try{if(n=await this.store.load(e),null!=n.pubKey&&cl(n.pubKey,t))return}catch(o){if(o.code!==SL.ERR_NOT_FOUND)throw o}await this.store.patchOrCreate(e,{pubKey:t}),i=!0}finally{zL.trace("set release write lock"),r()}i&&this.dispatchEvent(new uS(VL,{detail:{peerId:e,publicKey:t,oldPublicKey:null==n?void 0:n.pubKey}}))}async get(e){e=LL(e),zL.trace("get await write lock");const t=await this.store.lock.readLock();zL.trace("get got write lock");try{return(await this.store.load(e)).pubKey}catch(r){if(r.code!==SL.ERR_NOT_FOUND)throw r}finally{zL("get release write lock"),t()}}async delete(e){e=LL(e),zL.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;zL.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n}await this.store.patchOrCreate(e,{pubKey:void 0})}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n}finally{zL.trace("delete release write lock"),t()}this.dispatchEvent(new uS(VL,{detail:{peerId:e,publicKey:void 0,oldPublicKey:null==r?void 0:r.pubKey}}))}}const qL=jv("libp2p:peer-store:metadata-book"),HL="change:metadata";class GL{constructor(e,t){this.dispatchEvent=e,this.store=t}async get(e){e=LL(e),qL.trace("get await read lock");const t=await this.store.lock.readLock();qL.trace("get got read lock");try{return(await this.store.load(e)).metadata}catch(r){if(r.code!==SL.ERR_NOT_FOUND)throw r}finally{qL.trace("get release read lock"),t()}return new Map}async getValue(e,t){e=LL(e),qL.trace("getValue await read lock");const r=await this.store.lock.readLock();qL.trace("getValue got read lock");try{return(await this.store.load(e)).metadata.get(t)}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n}finally{qL.trace("getValue release write lock"),r()}}async set(e,t){if(e=LL(e),!(t instanceof Map))throw qL.error("valid metadata must be provided to store data"),new oc("valid metadata must be provided",SL.ERR_INVALID_PARAMETERS);qL.trace("set await write lock");const r=await this.store.lock.writeLock();let n;qL.trace("set got write lock");try{try{n=await this.store.load(e)}catch(i){if(i.code!==SL.ERR_NOT_FOUND)throw i}await this.store.mergeOrCreate(e,{metadata:t})}finally{qL.trace("set release write lock"),r()}this.dispatchEvent(new uS(HL,{detail:{peerId:e,metadata:t,oldMetadata:null==n?new Map:n.metadata}}))}async setValue(e,t,r){if(e=LL(e),"string"!==typeof t||!(r instanceof Uint8Array))throw qL.error("valid key and value must be provided to store data"),new oc("valid key and value must be provided",SL.ERR_INVALID_PARAMETERS);qL.trace("setValue await write lock");const n=await this.store.lock.writeLock();let i,o;qL.trace("setValue got write lock");try{try{i=await this.store.load(e);const n=i.metadata.get(t);if(null!=n&&cl(r,n))return}catch(s){if(s.code!==SL.ERR_NOT_FOUND)throw s}o=await this.store.mergeOrCreate(e,{metadata:new Map([[t,r]])})}finally{qL.trace("setValue release write lock"),n()}this.dispatchEvent(new uS(HL,{detail:{peerId:e,metadata:o.metadata,oldMetadata:null==i?new Map:i.metadata}}))}async delete(e){e=LL(e),qL.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;qL.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n}null!=r&&await this.store.patch(e,{metadata:new Map})}finally{qL.trace("delete release write lock"),t()}null!=r&&this.dispatchEvent(new uS(HL,{detail:{peerId:e,metadata:new Map,oldMetadata:r.metadata}}))}async deleteValue(e,t){e=LL(e),qL.trace("deleteValue await write lock");const r=await this.store.lock.writeLock();let n,i;qL.trace("deleteValue got write lock");try{i=await this.store.load(e),n=i.metadata,n.delete(t),await this.store.patch(e,{metadata:n})}catch(o){if(o.code!==SL.ERR_NOT_FOUND)throw o}finally{qL.trace("deleteValue release write lock"),r()}null!=n&&this.dispatchEvent(new uS(HL,{detail:{peerId:e,metadata:n,oldMetadata:null==i?new Map:i.metadata}}))}}const WL=jv("libp2p:peer-store:proto-book"),QL="change:protocols";class YL{constructor(e,t){this.dispatchEvent=e,this.store=t}async get(e){WL.trace("get wait for read lock");const t=await this.store.lock.readLock();WL.trace("get got read lock");try{return(await this.store.load(e)).protocols}catch(r){if(r.code!==SL.ERR_NOT_FOUND)throw r}finally{WL.trace("get release read lock"),t()}return[]}async set(e,t){if(e=LL(e),!Array.isArray(t))throw WL.error("protocols must be provided to store data"),new oc("protocols must be provided",SL.ERR_INVALID_PARAMETERS);WL.trace("set await write lock");const r=await this.store.lock.writeLock();let n,i;WL.trace("set got write lock");try{try{if(n=await this.store.load(e),new Set([...t]).size===n.protocols.length)return}catch(o){if(o.code!==SL.ERR_NOT_FOUND)throw o}i=await this.store.patchOrCreate(e,{protocols:t}),WL("stored provided protocols for %p",e)}finally{WL.trace("set release write lock"),r()}this.dispatchEvent(new uS(QL,{detail:{peerId:e,protocols:i.protocols,oldProtocols:null==n?[]:n.protocols}}))}async add(e,t){if(e=LL(e),!Array.isArray(t))throw WL.error("protocols must be provided to store data"),new oc("protocols must be provided",SL.ERR_INVALID_PARAMETERS);WL.trace("add await write lock");const r=await this.store.lock.writeLock();let n,i;WL.trace("add got write lock");try{try{if(n=await this.store.load(e),new Set([...n.protocols,...t]).size===n.protocols.length)return}catch(o){if(o.code!==SL.ERR_NOT_FOUND)throw o}i=await this.store.mergeOrCreate(e,{protocols:t}),WL("added provided protocols for %p",e)}finally{WL.trace("add release write lock"),r()}this.dispatchEvent(new uS(QL,{detail:{peerId:e,protocols:i.protocols,oldProtocols:null==n?[]:n.protocols}}))}async remove(e,t){if(e=LL(e),!Array.isArray(t))throw WL.error("protocols must be provided to store data"),new oc("protocols must be provided",SL.ERR_INVALID_PARAMETERS);WL.trace("remove await write lock");const r=await this.store.lock.writeLock();let n,i;WL.trace("remove got write lock");try{try{n=await this.store.load(e);const r=new Set(n.protocols);for(const e of t)r.delete(e);if(n.protocols.length===r.size)return;t=Array.from(r)}catch(o){if(o.code!==SL.ERR_NOT_FOUND)throw o}i=await this.store.patchOrCreate(e,{protocols:t})}finally{WL.trace("remove release write lock"),r()}this.dispatchEvent(new uS(QL,{detail:{peerId:e,protocols:i.protocols,oldProtocols:null==n?[]:n.protocols}}))}async delete(e){e=LL(e),WL.trace("delete await write lock");const t=await this.store.lock.writeLock();let r;WL.trace("delete got write lock");try{try{r=await this.store.load(e)}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n}await this.store.patchOrCreate(e,{protocols:[]})}finally{WL.trace("delete release write lock"),t()}null!=r&&this.dispatchEvent(new uS(QL,{detail:{peerId:e,protocols:[],oldProtocols:r.protocols}}))}}var $L=__webpack_require__(5124),XL=__webpack_require__(8389),JL=__webpack_require__(8765),ZL=__webpack_require__(172),eO=__webpack_require__(2710);JL._configure(),$L._configure(XL),ZL._configure(eO);const tO=["uint64","int64","sint64","fixed64","sfixed64"];function rO(e){return function(e){for(const t of tO){if(null==e[t])continue;const r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new $L(e))}function nO(){return function(e){for(const t of tO){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(ZL.create())}function iO(e,t){const r=rO(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function oO(e,t){const r=nO();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var sO,aO,cO,lO;function uO(e,t){return function(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}("message",sO.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"}(sO||(sO={})),function(e){let t;e.codec=()=>(null==t&&(t=uO((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.addresses)for(const n of e.addresses)t.uint32(10),cO.codec().encode(n,t);if(null!=e.protocols)for(const n of e.protocols)t.uint32(18),t.string(n);if(null!=e.metadata)for(const n of e.metadata)t.uint32(26),lO.codec().encode(n,t);null!=e.pubKey&&(t.uint32(34),t.bytes(e.pubKey)),null!=e.peerRecordEnvelope&&(t.uint32(42),t.bytes(e.peerRecordEnvelope)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={addresses:[],protocols:[],metadata:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.addresses.push(cO.codec().decode(e,e.uint32()));break;case 2:r.protocols.push(e.string());break;case 3:r.metadata.push(lO.codec().decode(e,e.uint32()));break;case 4:r.pubKey=e.bytes();break;case 5:r.peerRecordEnvelope=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>oO(t,e.codec()),e.decode=t=>iO(t,e.codec())}(aO||(aO={})),function(e){let t;e.codec=()=>(null==t&&(t=uO((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.multiaddr&&e.multiaddr.byteLength>0&&(t.uint32(10),t.bytes(e.multiaddr)),null!=e.isCertified&&(t.uint32(16),t.bool(e.isCertified)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={multiaddr:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.multiaddr=e.bytes();break;case 2:r.isCertified=e.bool();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>oO(t,e.codec()),e.decode=t=>iO(t,e.codec())}(cO||(cO={})),function(e){let t;e.codec=()=>(null==t&&(t=uO((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.key&&""!==e.key&&(t.uint32(10),t.string(e.key)),null!=e.value&&e.value.byteLength>0&&(t.uint32(18),t.bytes(e.value)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={key:"",value:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.key=e.string();break;case 2:r.value=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>oO(t,e.codec()),e.decode=t=>iO(t,e.codec())}(lO||(lO={}));var hO=__webpack_require__(7143);class dO extends Error{constructor(e){super(e),this.name="TimeoutError"}}class fO extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const pO=e=>void 0===globalThis.DOMException?new fO(e):new DOMException(e),gO=e=>{const t=void 0===e.reason?pO("This operation was aborted."):e.reason;return t instanceof Error?t:pO(t)};var yO,mO=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class vO{constructor(){yO.set(this,[])}enqueue(e,t){const r={priority:(t={priority:0,...t}).priority,run:e};if(this.size&&mO(this,yO,"f")[this.size-1].priority>=t.priority)return void mO(this,yO,"f").push(r);const n=function(e,t,r){let n=0,i=e.length;for(;i>0;){const o=Math.trunc(i/2);let s=n+o;r(e[s],t)<=0?(n=++s,i-=o+1):i=o}return n}(mO(this,yO,"f"),r,((e,t)=>t.priority-e.priority));mO(this,yO,"f").splice(n,0,r)}dequeue(){const e=mO(this,yO,"f").shift();return null===e||void 0===e?void 0:e.run}filter(e){return mO(this,yO,"f").filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return mO(this,yO,"f").length}}yO=new WeakMap;var bO,wO,EO,_O,SO,AO,TO,CO,kO,IO,RO,PO,NO,DO,xO,LO,OO,BO,MO,UO,FO,jO,zO,VO,KO,qO,HO=function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},GO=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class WO extends Error{}class QO extends hO{constructor(e){var t,r,n,i;if(super(),bO.add(this),wO.set(this,void 0),EO.set(this,void 0),_O.set(this,0),SO.set(this,void 0),AO.set(this,void 0),TO.set(this,0),CO.set(this,void 0),kO.set(this,void 0),IO.set(this,void 0),RO.set(this,void 0),PO.set(this,0),NO.set(this,void 0),DO.set(this,void 0),xO.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:vO,...e}).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:"","` (").concat(typeof e.intervalCap,")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(i=null===(n=e.interval)||void 0===n?void 0:n.toString())&&void 0!==i?i:"","` (").concat(typeof e.interval,")"));HO(this,wO,e.carryoverConcurrencyCount,"f"),HO(this,EO,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,"f"),HO(this,SO,e.intervalCap,"f"),HO(this,AO,e.interval,"f"),HO(this,IO,new e.queueClass,"f"),HO(this,RO,e.queueClass,"f"),this.concurrency=e.concurrency,this.timeout=e.timeout,HO(this,xO,!0===e.throwOnTimeout,"f"),HO(this,DO,!1===e.autoStart,"f")}get concurrency(){return GO(this,NO,"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,")"));HO(this,NO,e,"f"),GO(this,bO,"m",VO).call(this)}async add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t={timeout:this.timeout,throwOnTimeout:GO(this,xO,"f"),...t},new Promise(((r,n)=>{GO(this,IO,"f").enqueue((async()=>{var i,o,s;HO(this,PO,(o=GO(this,PO,"f"),++o),"f"),HO(this,_O,(s=GO(this,_O,"f"),++s),"f");try{if(null===(i=t.signal)||void 0===i?void 0:i.aborted)throw new WO("The task was aborted.");let n=e({signal:t.signal});t.timeout&&(n=function(e,t,r,n){let i;const o=new Promise(((o,s)=>{if("number"!==typeof t||1!==Math.sign(t))throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(t,"`"));if(t!==Number.POSITIVE_INFINITY){if((n={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...n}).signal){const{signal:e}=n;e.aborted&&s(gO(e)),e.addEventListener("abort",(()=>{s(gO(e))}))}i=n.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof r){try{o(r())}catch(a){s(a)}return}const n="string"===typeof r?r:"Promise timed out after ".concat(t," milliseconds"),i=r instanceof Error?r:new dO(n);"function"===typeof e.cancel&&e.cancel(),s(i)}),t),(async()=>{try{o(await e)}catch(t){s(t)}finally{n.customTimers.clearTimeout.call(void 0,i)}})()}else o(e)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(Promise.resolve(n),t.timeout)),t.signal&&(n=Promise.race([n,GO(this,bO,"m",KO).call(this,t.signal)]));const o=await n;r(o),this.emit("completed",o)}catch(a){if(a instanceof dO&&!t.throwOnTimeout)return void r();n(a),this.emit("error",a)}finally{GO(this,bO,"m",BO).call(this)}}),t),this.emit("add"),GO(this,bO,"m",FO).call(this)}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return GO(this,DO,"f")?(HO(this,DO,!1,"f"),GO(this,bO,"m",VO).call(this),this):this}pause(){HO(this,DO,!0,"f")}clear(){HO(this,IO,new(GO(this,RO,"f")),"f")}async onEmpty(){0!==GO(this,IO,"f").size&&await GO(this,bO,"m",qO).call(this,"empty")}async onSizeLessThan(e){GO(this,IO,"f").size<e||await GO(this,bO,"m",qO).call(this,"next",(()=>GO(this,IO,"f").size<e))}async onIdle(){0===GO(this,PO,"f")&&0===GO(this,IO,"f").size||await GO(this,bO,"m",qO).call(this,"idle")}get size(){return GO(this,IO,"f").size}sizeBy(e){return GO(this,IO,"f").filter(e).length}get pending(){return GO(this,PO,"f")}get isPaused(){return GO(this,DO,"f")}}wO=new WeakMap,EO=new WeakMap,_O=new WeakMap,SO=new WeakMap,AO=new WeakMap,TO=new WeakMap,CO=new WeakMap,kO=new WeakMap,IO=new WeakMap,RO=new WeakMap,PO=new WeakMap,NO=new WeakMap,DO=new WeakMap,xO=new WeakMap,bO=new WeakSet,LO=function(){return GO(this,EO,"f")||GO(this,_O,"f")<GO(this,SO,"f")},OO=function(){return GO(this,PO,"f")<GO(this,NO,"f")},BO=function(){var e;HO(this,PO,(e=GO(this,PO,"f"),--e),"f"),GO(this,bO,"m",FO).call(this),this.emit("next")},MO=function(){GO(this,bO,"m",zO).call(this),GO(this,bO,"m",jO).call(this),HO(this,kO,void 0,"f")},UO=function(){const e=Date.now();if(void 0===GO(this,CO,"f")){const t=GO(this,TO,"f")-e;if(!(t<0))return void 0===GO(this,kO,"f")&&HO(this,kO,setTimeout((()=>{GO(this,bO,"m",MO).call(this)}),t),"f"),!0;HO(this,_O,GO(this,wO,"f")?GO(this,PO,"f"):0,"f")}return!1},FO=function(){if(0===GO(this,IO,"f").size)return GO(this,CO,"f")&&clearInterval(GO(this,CO,"f")),HO(this,CO,void 0,"f"),this.emit("empty"),0===GO(this,PO,"f")&&this.emit("idle"),!1;if(!GO(this,DO,"f")){const e=!GO(this,bO,"a",UO);if(GO(this,bO,"a",LO)&&GO(this,bO,"a",OO)){const t=GO(this,IO,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&GO(this,bO,"m",jO).call(this),!0)}}return!1},jO=function(){GO(this,EO,"f")||void 0!==GO(this,CO,"f")||(HO(this,CO,setInterval((()=>{GO(this,bO,"m",zO).call(this)}),GO(this,AO,"f")),"f"),HO(this,TO,Date.now()+GO(this,AO,"f"),"f"))},zO=function(){0===GO(this,_O,"f")&&0===GO(this,PO,"f")&&GO(this,CO,"f")&&(clearInterval(GO(this,CO,"f")),HO(this,CO,void 0,"f")),HO(this,_O,GO(this,wO,"f")?GO(this,PO,"f"):0,"f"),GO(this,bO,"m",VO).call(this)},VO=function(){for(;GO(this,bO,"m",FO).call(this););},KO=async function(e){return new Promise(((t,r)=>{e.addEventListener("abort",(()=>{r(new WO("The task was aborted."))}),{once:!0})}))},qO=async function(e,t){return new Promise((r=>{const n=()=>{t&&!t()||(this.off(e,n),r())};this.on(e,n)}))};const YO="lock:worker:request-read",$O="lock:worker:release-read",XO="lock:master:grant-read",JO="lock:worker:request-write",ZO="lock:worker:release-write",eB="lock:master:grant-write",tB={},rB=e=>{e.addEventListener("message",(t=>{rB.dispatchEvent("message",e,t)})),null!=e.port&&e.port.addEventListener("message",(t=>{rB.dispatchEvent("message",e,t)}))};rB.addEventListener=(e,t)=>{null==tB[e]&&(tB[e]=[]),tB[e].push(t)},rB.removeEventListener=(e,t)=>{null!=tB[e]&&(tB[e]=tB[e].filter((e=>e===t)))},rB.dispatchEvent=function(e,t,r){null!=tB[e]&&tB[e].forEach((e=>e(t,r)))};const nB=rB,iB=(e,t,r,n,i)=>(o,s)=>{if(s.data.type!==r)return;const a={type:s.data.type,name:s.data.name,identifier:s.data.identifier};e.dispatchEvent(new MessageEvent(t,{data:{name:a.name,handler:async()=>(o.postMessage({type:i,name:a.name,identifier:a.identifier}),await new Promise((e=>{const t=r=>{if(null==r||null==r.data)return;const i=r.data.type,s=(r.data.name,r.data.identifier);i===n&&s===a.identifier&&(o.removeEventListener("message",t),e())};o.addEventListener("message",t)})))}}))},oB=(e,t,r,n)=>async()=>{const i=HP();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===r&&c===i&&(globalThis.removeEventListener("message",o),t((()=>{globalThis.postMessage({type:n,identifier:i,name:e})})))};globalThis.addEventListener("message",o)}))},sB={singleProcess:!1},aB=e=>{e=Object.assign({},sB,e);if(Boolean(globalThis.document)||e.singleProcess){const e=new EventTarget;return nB.addEventListener("message",iB(e,"requestReadLock",YO,$O,XO)),nB.addEventListener("message",iB(e,"requestWriteLock",JO,ZO,eB)),e}return{isWorker:!0,readLock:e=>oB(e,YO,XO,$O),writeLock:e=>oB(e,JO,eB,ZO)}},cB={};let lB;async function uB(e,t){let r;const n=new Promise((e=>{r=e}));return e.add((async()=>await C_((async()=>await new Promise((e=>{r((()=>{e()}))})))(),{milliseconds:t.timeout}))),await n}const hB=(e,t)=>{if(!0===lB.isWorker)return{readLock:lB.readLock(e,t),writeLock:lB.writeLock(e,t)};const r=new QO({concurrency:1});let n;return{async readLock(){if(null!=n)return await uB(n,t);n=new QO({concurrency:t.concurrency,autoStart:!1});const e=n,i=uB(n,t);return r.add((async()=>(e.start(),await e.onIdle().then((()=>{n===e&&(n=null)}))))),await i},writeLock:async()=>(n=null,await uB(r,t))}},dB={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};const fB=jv("libp2p:peer-store:store"),pB="/peers/";class gB{constructor(e){this.components=e,this.lock=function(e){const t=Object.assign({},dB,e);return null==lB&&(lB=aB(t),!0!==lB.isWorker&&(lB.addEventListener("requestReadLock",(e=>{null!=cB[e.data.name]&&cB[e.data.name].readLock().then((async t=>await e.data.handler().finally((()=>t()))))})),lB.addEventListener("requestWriteLock",(async e=>{null!=cB[e.data.name]&&cB[e.data.name].writeLock().then((async t=>await e.data.handler().finally((()=>t()))))})))),null==cB[t.name]&&(cB[t.name]=hB(t.name,t)),cB[t.name]}({name:"peer-store",singleProcess:!0})}_peerIdToDatastoreKey(e){if(null==e.type)throw fB.error("peerId must be an instance of peer-id to store data"),new oc("peerId must be an instance of peer-id",SL.ERR_INVALID_PARAMETERS);const t=e.toCID().toString();return new YP("".concat(pB).concat(t))}async has(e){return await this.components.datastore.has(this._peerIdToDatastoreKey(e))}async delete(e){await this.components.datastore.delete(this._peerIdToDatastoreKey(e))}async load(e){var t,r;const n=await this.components.datastore.get(this._peerIdToDatastoreKey(e)),i=aO.decode(n),o=new Map;for(const s of i.metadata)o.set(s.key,s.value);return{...i,id:e,addresses:i.addresses.map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:o_(t),isCertified:null!==r&&void 0!==r&&r}})),metadata:o,pubKey:null!==(t=i.pubKey)&&void 0!==t?t:void 0,peerRecordEnvelope:null!==(r=i.peerRecordEnvelope)&&void 0!==r?r:void 0}}async save(e){if(null!=e.pubKey&&null!=e.id.publicKey&&!cl(e.pubKey,e.id.publicKey))throw fB.error("peer publicKey bytes do not match peer id publicKey bytes"),new oc("publicKey bytes do not match peer id publicKey bytes",SL.ERR_INVALID_PARAMETERS);const t=new Set,r=e.addresses.filter((e=>!t.has(e.multiaddr.toString())&&(t.add(e.multiaddr.toString()),!0))).sort(((e,t)=>e.multiaddr.toString().localeCompare(t.multiaddr.toString()))).map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:t.bytes,isCertified:r}})),n=[];[...e.metadata.keys()].sort().forEach((t=>{const r=e.metadata.get(t);null!=r&&n.push({key:t,value:r})}));const i=aO.encode({addresses:r,protocols:e.protocols.sort(),pubKey:e.pubKey,metadata:n,peerRecordEnvelope:e.peerRecordEnvelope});return await this.components.datastore.put(this._peerIdToDatastoreKey(e.id),i.subarray()),await this.load(e.id)}async patch(e,t){const r=await this.load(e);return await this._patch(e,t,r)}async patchOrCreate(e,t){let r;try{r=await this.load(e)}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n;r={id:e,addresses:[],protocols:[],metadata:new Map}}return await this._patch(e,t,r)}async _patch(e,t,r){return await this.save({...r,...t,id:e})}async merge(e,t){const r=await this.load(e);return await this._merge(e,t,r)}async mergeOrCreate(e,t){let r;try{r=await this.load(e)}catch(n){if(n.code!==SL.ERR_NOT_FOUND)throw n;r={id:e,addresses:[],protocols:[],metadata:new Map}}return await this._merge(e,t,r)}async _merge(e,t,r){var n,i,o,s,a,c,l,u,h;const d=new Map;return r.addresses.forEach((e=>{d.set(e.multiaddr.toString(),e.isCertified)})),(null!==(n=t.addresses)&&void 0!==n?n:[]).forEach((e=>{const t=e.multiaddr.toString(),r=Boolean(d.get(t))||e.isCertified;d.set(t,r)})),await this.save({id:e,addresses:Array.from(d.entries()).map((e=>{let[t,r]=e;return{multiaddr:o_(t),isCertified:r}})),protocols:Array.from(new Set([...null!==(i=r.protocols)&&void 0!==i?i:[],...null!==(o=t.protocols)&&void 0!==o?o:[]])),metadata:new Map([...null!==(s=null===(a=r.metadata)||void 0===a?void 0:a.entries())&&void 0!==s?s:[],...null!==(c=null===(l=t.metadata)||void 0===l?void 0:l.entries())&&void 0!==c?c:[]]),pubKey:null!==(u=t.pubKey)&&void 0!==u?u:null!=r?r.pubKey:void 0,peerRecordEnvelope:null!==(h=t.peerRecordEnvelope)&&void 0!==h?h:null!=r?r.peerRecordEnvelope:void 0})}async*all(){for await(const e of this.components.datastore.queryKeys({prefix:pB})){const t=e.toString().split("/")[2],r=Vc.decode(t);yield this.load(OL(r))}}}var yB,mB;!function(e){let t;e.codec=()=>(null==t&&(t=uO((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.lengthDelimited&&t.fork(),null!=e.tags)for(const n of e.tags)t.uint32(10),mB.codec().encode(n,t);!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={tags:[]},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();if(t>>>3===1)r.tags.push(mB.codec().decode(e,e.uint32()));else e.skipType(7&t)}return r}))),t),e.encode=t=>oO(t,e.codec()),e.decode=t=>iO(t,e.codec())}(yB||(yB={})),function(e){let t;e.codec=()=>(null==t&&(t=uO((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.name&&""!==e.name&&(t.uint32(10),t.string(e.name)),null!=e.value&&(t.uint32(16),t.uint32(e.value)),null!=e.expiry&&(t.uint32(24),t.uint64(e.expiry)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={name:""},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.name=e.string();break;case 2:r.value=e.uint32();break;case 3:r.expiry=e.uint64();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>oO(t,e.codec()),e.decode=t=>iO(t,e.codec())}(mB||(mB={}));const vB=jv("libp2p:peer-store");class bB extends cS{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.components=e,this.store=new gB(e),this.addressBook=new FL(this.dispatchEvent.bind(this),this.store,t.addressFilter),this.keyBook=new KL(this.dispatchEvent.bind(this),this.store),this.metadataBook=new GL(this.dispatchEvent.bind(this),this.store),this.protoBook=new YL(this.dispatchEvent.bind(this),this.store)}async forEach(e){vB.trace("getPeers await read lock");const t=await this.store.lock.readLock();vB.trace("getPeers got read lock");try{for await(const t of this.store.all())t.id.equals(this.components.peerId)||e(t)}finally{vB.trace("getPeers release read lock"),t()}}async all(){const e=[];return await this.forEach((t=>{e.push(t)})),e}async delete(e){vB.trace("delete await write lock");const t=await this.store.lock.writeLock();vB.trace("delete got write lock");try{await this.store.delete(e)}finally{vB.trace("delete release write lock"),t()}}async get(e){vB.trace("get await read lock");const t=await this.store.lock.readLock();vB.trace("get got read lock");try{return await this.store.load(e)}finally{vB.trace("get release read lock"),t()}}async has(e){vB.trace("has await read lock");const t=await this.store.lock.readLock();vB.trace("has got read lock");try{return await this.store.has(e)}finally{vB.trace("has release read lock"),t()}}async tagPeer(e,t){var r,n;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=null!==(r=i.value)&&void 0!==r?r:0,s=Math.round(o),a=null!==(n=i.ttl)&&void 0!==n?n:void 0;if(s!==o||s<0||s>100)throw new oc("Tag value must be between 0-100","ERR_TAG_VALUE_OUT_OF_BOUNDS");const c=await this.metadataBook.getValue(e,"tags");let l=[];null!=c&&(l=yB.decode(c).tags),l=l.filter((e=>e.name!==t)),l.push({name:t,value:s,expiry:null==a?void 0:BigInt(Date.now()+a)}),await this.metadataBook.setValue(e,"tags",yB.encode({tags:l}).subarray())}async unTagPeer(e,t){const r=await this.metadataBook.getValue(e,"tags");let n=[];null!=r&&(n=yB.decode(r).tags),n=n.filter((e=>e.name!==t)),await this.metadataBook.setValue(e,"tags",yB.encode({tags:n}).subarray())}async getTags(e){const t=await this.metadataBook.getValue(e,"tags");let r=[];null!=t&&(r=yB.decode(t).tags);const n=BigInt(Date.now()),i=r.filter((e=>null==e.expiry||e.expiry>n));return i.length!==r.length&&await this.metadataBook.setValue(e,"tags",yB.encode({tags:i}).subarray()),i.map((e=>{var t;return{name:e.name,value:null!==(t=e.value)&&void 0!==t?t:0}}))}}class wB{constructor(e){this.dht=e}async provide(e){await zP(this.dht.provide(e))}findProviders(e){try{var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return async function*(){for await(const n of t.dht.findProviders(e,r))"PROVIDER"===n.name&&(yield*n.providers)}()}catch(r){return Promise.reject(r)}}async put(e,t,r){await zP(this.dht.put(e,t,r))}async get(e,t){for await(const r of this.dht.get(e,t))if("VALUE"===r.name)return r.value;throw Td(new Error("Not found"),"ERR_NOT_FOUND")}}class EB{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._started=!1,this._peerId=e.peerId,this._addressManager=e.addressManager,this._peerStore=e.peerStore,this._upgrader=e.upgrader,this._metrics=e.metrics,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._connectionGater=e.connectionGater,this._contentRouting=e.contentRouting,this._peerRouting=e.peerRouting,this._datastore=e.datastore,this._connectionProtector=e.connectionProtector,this._dht=e.dht,this._pubsub=e.pubsub,this._dialer=e.dialer}isStarted(){return this._started}async beforeStart(){await Promise.all(Object.values(this).filter((e=>FP(e))).map((async e=>{null!=e.beforeStart&&await e.beforeStart()})))}async start(){await Promise.all(Object.values(this).filter((e=>FP(e))).map((async e=>{await e.start()}))),this._started=!0}async afterStart(){await Promise.all(Object.values(this).filter((e=>FP(e))).map((async e=>{null!=e.afterStart&&await e.afterStart()})))}async beforeStop(){await Promise.all(Object.values(this).filter((e=>FP(e))).map((async e=>{null!=e.beforeStop&&await e.beforeStop()})))}async stop(){await Promise.all(Object.values(this).filter((e=>FP(e))).map((async e=>{await e.stop()}))),this._started=!1}async afterStop(){await Promise.all(Object.values(this).filter((e=>FP(e))).map((async e=>{null!=e.afterStop&&await e.afterStop()})))}get peerId(){if(null==this._peerId)throw Td(new Error("peerId not set"),"ERR_SERVICE_MISSING");return this._peerId}set peerId(e){this._peerId=e}get addressManager(){if(null==this._addressManager)throw Td(new Error("addressManager not set"),"ERR_SERVICE_MISSING");return this._addressManager}set addressManager(e){this._addressManager=e}get peerStore(){if(null==this._peerStore)throw Td(new Error("peerStore not set"),"ERR_SERVICE_MISSING");return this._peerStore}set peerStore(e){this._peerStore=e}get upgrader(){if(null==this._upgrader)throw Td(new Error("upgrader not set"),"ERR_SERVICE_MISSING");return this._upgrader}set upgrader(e){this._upgrader=e}get registrar(){if(null==this._registrar)throw Td(new Error("registrar not set"),"ERR_SERVICE_MISSING");return this._registrar}set registrar(e){this._registrar=e}get connectionManager(){if(null==this._connectionManager)throw Td(new Error("connectionManager not set"),"ERR_SERVICE_MISSING");return this._connectionManager}set connectionManager(e){this._connectionManager=e}get transportManager(){if(null==this._transportManager)throw Td(new Error("transportManager not set"),"ERR_SERVICE_MISSING");return this._transportManager}set transportManager(e){this._transportManager=e}get connectionGater(){if(null==this._connectionGater)throw Td(new Error("connectionGater not set"),"ERR_SERVICE_MISSING");return this._connectionGater}set connectionGater(e){this._connectionGater=e}get contentRouting(){if(null==this._contentRouting)throw Td(new Error("contentRouting not set"),"ERR_SERVICE_MISSING");return this._contentRouting}set contentRouting(e){this._contentRouting=e}get peerRouting(){if(null==this._peerRouting)throw Td(new Error("peerRouting not set"),"ERR_SERVICE_MISSING");return this._peerRouting}set peerRouting(e){this._peerRouting=e}get datastore(){if(null==this._datastore)throw Td(new Error("datastore not set"),"ERR_SERVICE_MISSING");return this._datastore}set datastore(e){this._datastore=e}get connectionProtector(){return this._connectionProtector}set connectionProtector(e){this._connectionProtector=e}get dialer(){if(null==this._dialer)throw Td(new Error("dialer not set"),"ERR_SERVICE_MISSING");return this._dialer}set dialer(e){this._dialer=e}get metrics(){return this._metrics}set metrics(e){this._metrics=e}get dht(){return this._dht}set dht(e){this._dht=e}get pubsub(){return this._pubsub}set pubsub(e){this._pubsub=e}}var _B=__webpack_require__(449);const SB=globalThis.fetch,AB=globalThis.Headers;globalThis.Request,globalThis.Response;function TB(e,t,r){return"".concat(e,"?name=").concat(t,"&type=").concat(r)}async function CB(e,t){const r=await SB(e,{headers:new AB({accept:"application/dns-json"}),signal:t});return await r.json()}function kB(e,t){return"".concat(t,"_").concat(e)}const IB=Object.assign(Yu("dns-over-http-resolver"),{error:Yu("dns-over-http-resolver:error")});const RB=class{constructor(){var e,t,r;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._cache=new _B({max:null!==(e=null===n||void 0===n?void 0:n.maxCache)&&void 0!==e?e:100}),this._TXTcache=new _B({max:null!==(t=null===n||void 0===n?void 0:n.maxCache)&&void 0!==t?t:100}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"],this._request=null!==(r=n.request)&&void 0!==r?r:CB,this._abortControllers=[]}cancel(){this._abortControllers.forEach((e=>e.abort()))}getServers(){return this._servers}_getShuffledServers(){const e=[...this._servers];for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),n=e[t];e[t]=e[r],e[r]=n}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",r=this._cache.get(kB(e,t));if(null!=r)return r;let n=!1;for(const o of this._getShuffledServers()){const r=new AbortController;this._abortControllers.push(r);try{const n=await this._request(TB(o,e,t),r.signal),i=n.Answer.map((e=>e.data)),s=Math.min(...n.Answer.map((e=>e.TTL)));return this._cache.set(kB(e,t),i,{ttl:s}),i}catch(i){r.signal.aborted&&(n=!0),IB.error("".concat(o," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==r))}}if(n)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",r=this._cache.get(kB(e,t));if(null!=r)return r;let n=!1;for(const o of this._getShuffledServers()){const r=new AbortController;this._abortControllers.push(r);try{const n=await this._request(TB(o,e,t),r.signal),i=n.Answer.map((e=>e.data)),s=Math.min(...n.Answer.map((e=>e.TTL)));return this._cache.set(kB(e,t),i,{ttl:s}),i}catch(i){r.signal.aborted&&(n=!0),IB.error("".concat(o," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==r))}}if(n)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",r=this._TXTcache.get(kB(e,t));if(null!=r)return r;let n=!1;for(const o of this._getShuffledServers()){const r=new AbortController;this._abortControllers.push(r);try{const n=await this._request(TB(o,e,t),r.signal),i=n.Answer.map((e=>[e.data.replace(/['"]+/g,"")])),s=Math.min(...n.Answer.map((e=>e.TTL)));return this._TXTcache.set(kB(e,t),i,{ttl:s}),i}catch(i){r.signal.aborted&&(n=!0),IB.error("".concat(o," could not resolve ").concat(e," record ").concat(t))}finally{this._abortControllers=this._abortControllers.filter((e=>e!==r))}}if(n)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()}},PB=RB,{code:NB}=qb("dnsaddr");const DB={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{maxConnections:300,minConnections:50,autoDial:!0,autoDialInterval:1e4,maxParallelDials:100,maxDialsPerPeer:4,dialTimeout:3e4,inboundUpgradeTimeout:3e4,resolvers:{dnsaddr:async function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new PB;null!=r.signal&&r.signal.addEventListener("abort",(()=>{n.cancel()}));const i=e.getPeerId(),[,o]=null!==(t=e.stringTuples().find((e=>{let[t]=e;return t===NB})))&&void 0!==t?t:[];if(null==o)throw new Error("No hostname found in multiaddr");let s=(await n.resolveTxt("_dnsaddr.".concat(o))).flat().map((e=>e.split("=")[1]));return null!=i&&(s=s.filter((e=>e.includes(i)))),s}},addressSorter:ex},connectionGater:{},transportManager:{faultTolerance:eS.FATAL_ALL},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0},relay:{enabled:!0,advertise:{bootDelay:9e5,enabled:!1,ttl:18e5},hop:{enabled:!1,active:!1,timeout:3e4},autoRelay:{enabled:!1,maxListeners:2}},identify:{protocolPrefix:"ipfs",host:{agentVersion:sL},timeout:6e4,maxInboundStreams:1,maxOutboundStreams:1,maxPushIncomingStreams:1,maxPushOutgoingStreams:1},ping:{protocolPrefix:"ipfs",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4},fetch:{protocolPrefix:"libp2p",maxInboundStreams:1,maxOutboundStreams:1,timeout:1e4}};let xB;const LB=Symbol.for("nodejs.util.inspect.custom"),OB=Object.values(Vl).map((e=>e.decoder)).reduce(((e,t)=>e.or(t)),Vl.identity.decoder),BB=114,MB=36,UB=37;xB=Symbol.toStringTag;class FB{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[xB](){return"PeerId(".concat(this.toString(),")")}toString(){return null==this.string&&(this.string=mc.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return el.createV1(BB,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){var t;if(e instanceof Uint8Array)return cl(this.multihash.bytes,e);if("string"===typeof e)return function(e,t){var r;if(t=null!==(r=t)&&void 0!==r?r:OB,"1"===e.charAt(0)||"Q"===e.charAt(0)){const t=jc(mc.decode("z".concat(e)));return e.startsWith("12D")?new zB({multihash:t}):e.startsWith("16U")?new VB({multihash:t}):new jB({multihash:t})}return function(e){try{const t=jc(e);if(t.code===Nl.code){if(t.digest.length===MB)return new zB({multihash:t});if(t.digest.length===UB)return new VB({multihash:t})}if(t.code===Il.code)return new jB({multihash:t})}catch{return function(e){if(null==e||null==e.multihash||null==e.version||1===e.version&&e.code!==BB)throw new Error("Supplied PeerID CID is invalid");const t=e.multihash;if(t.code===Il.code)return new jB({multihash:e.multihash});if(t.code===Nl.code){if(t.digest.length===MB)return new zB({multihash:e.multihash});if(t.digest.length===UB)return new VB({multihash:e.multihash})}throw new Error("Supplied PeerID CID is invalid")}(el.decode(e))}throw new Error("Supplied PeerID CID is invalid")}(OB.decode(e))}(e).equals(this);if(null!=(null===e||void 0===e||null===(t=e.multihash)||void 0===t?void 0:t.bytes))return cl(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[LB](){return"PeerId(".concat(this.toString(),")")}}class jB extends FB{constructor(e){super({...e,type:"RSA"}),Xa(this,"type","RSA"),Xa(this,"publicKey",void 0),this.publicKey=e.publicKey}}class zB extends FB{constructor(e){super({...e,type:"Ed25519"}),Xa(this,"type","Ed25519"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}class VB extends FB{constructor(e){super({...e,type:"secp256k1"}),Xa(this,"type","secp256k1"),Xa(this,"publicKey",void 0),this.publicKey=e.multihash.digest}}var KB=__webpack_require__(2171),qB=__webpack_require__(2552),HB=__webpack_require__(9460),GB=__webpack_require__(310),WB=__webpack_require__(2685);HB._configure(),KB._configure(qB),GB._configure(WB);const QB=["uint64","int64","sint64","fixed64","sfixed64"];function YB(e){return function(e){for(const t of QB){if(null==e[t])continue;const r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}(new KB(e))}function $B(){return function(e){for(const t of QB){if(null==e[t])continue;const r=e[t];e[t]=function(e){return r.call(this,e.toString())}}return e}(GB.create())}var XB,JB;!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"}(XB||(XB={})),function(e){let t;e.codec=()=>(null==t&&(t=function(e,t){return function(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}("message",XB.LENGTH_DELIMITED,e,t)}((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!1!==r.lengthDelimited&&t.fork(),null!=e.id&&(t.uint32(10),t.bytes(e.id)),null!=e.pubKey&&(t.uint32(18),t.bytes(e.pubKey)),null!=e.privKey&&(t.uint32(26),t.bytes(e.privKey)),!1!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.id=e.bytes();break;case 2:r.pubKey=e.bytes();break;case 3:r.privKey=e.bytes();break;default:e.skipType(7&t)}}return r}))),t),e.encode=t=>function(e,t){const r=$B();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}(t,e.codec()),e.decode=t=>function(e,t){const r=YB(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}(t,e.codec())}(JB||(JB={}));const ZB=async()=>{const e=await iv("Ed25519"),t=await eM(e);if("Ed25519"===t.type)return t;throw new Error('Generated unexpected PeerId type "'.concat(t.type,'"'))};async function eM(e){return async function(e,t){return e.length===MB?new zB({multihash:Fc(Nl.code,e),privateKey:t}):e.length===UB?new VB({multihash:Fc(Nl.code,e),privateKey:t}):new jB({multihash:await Il.digest(e),publicKey:e,privateKey:t})}(sv(e.public),function(e,t){var r;return nv(t=(null!==(r=t)&&void 0!==r?r:"rsa").toLowerCase()),e.bytes}(e))}class tM extends cS{get[iS](){return!0}get[Symbol.toStringTag](){return"@libp2p/dummy-dht"}get wan(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}get lan(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}get(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}findProviders(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}findPeer(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}getClosestPeers(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}provide(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}put(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}async getMode(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}async setMode(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}async refreshRoutingTable(){throw Td(new Error(XP.DHT_DISABLED),JP.DHT_DISABLED)}}class rM extends cS{constructor(){super(...arguments),this.topicValidators=new Map}isStarted(){return!1}start(){}stop(){}get globalSignaturePolicy(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}get multicodecs(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}getPeers(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}getTopics(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}subscribe(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}unsubscribe(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}getSubscribers(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}async publish(){throw Td(new Error(XP.PUBSUB_DISABLED),JP.ERR_PUBSUB_DISABLED)}}var nM=__webpack_require__(9879);const iM=jv("libp2p:dialer:dial-request");class oM{constructor(e){const{addrs:t,dialAction:r,dialer:n}=e;this.addrs=t,this.dialer=n,this.dialAction=r}async run(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.dialer.getTokens(this.addrs.length);if(t.length<1)throw Td(new Error("No dial tokens available"),JP.ERR_NO_DIAL_TOKENS);const r=new nM;for(const s of t)r.push(s).catch((e=>{iM.error(e)}));const n=this.addrs.map((()=>{const e=new AbortController;try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,e.signal)}catch{}return e}));if(null!=e.signal)try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,e.signal)}catch{}let i=0,o=!1;try{return await Promise.any(this.addrs.map((async(s,a)=>{const c=await r.shift();if(o)throw this.dialer.releaseToken(t.splice(t.indexOf(c),1)[0]),Td(new Error("dialAction already succeeded"),JP.ERR_ALREADY_SUCCEEDED);const l=n[a];if(null==l)throw Td(new Error("dialAction did not come with an AbortController"),JP.ERR_INVALID_PARAMETERS);let u;try{const t=l.signal;u=await this.dialAction(s,{...e,signal:null!=e.signal?(0,yb.anySignal)([t,e.signal]):t}),n[a]=void 0}finally{i++,this.addrs.length-i>=t.length?r.push(c).catch((e=>{iM.error(e)})):this.dialer.releaseToken(t.splice(t.indexOf(c),1)[0])}if(null==u)throw Td(new Error("dialAction led to empty object"),JP.ERR_TRANSPORT_DIAL_FAILED);return o=!0,u})))}finally{n.forEach((e=>{void 0!==e&&e.abort()})),t.forEach((e=>this.dialer.releaseToken(e)))}}}const sM=jv("libp2p:dialer");class aM{constructor(e){var t,r,n,i,o;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.started=!1,this.addressSorter=null!==(t=s.addressSorter)&&void 0!==t?t:ex,this.maxAddrsToDial=null!==(r=s.maxAddrsToDial)&&void 0!==r?r:25,this.timeout=null!==(n=s.dialTimeout)&&void 0!==n?n:3e4,this.maxDialsPerPeer=null!==(i=s.maxDialsPerPeer)&&void 0!==i?i:4,this.tokens=[...new Array(null!==(o=s.maxParallelDials)&&void 0!==o?o:100)].map(((e,t)=>t)),this.components=e,this.pendingDials=Lx({name:"libp2p_dialler_pending_dials",metrics:e.metrics}),this.pendingDialTargets=Lx({name:"libp2p_dialler_pending_dial_targets",metrics:e.metrics});for(const[c,l]of Object.entries(null!==(a=s.resolvers)&&void 0!==a?a:{})){var a;e_.set(c,l)}}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1;for(const t of this.pendingDials.values())try{t.controller.abort()}catch(e){sM.error(e)}this.pendingDials.clear();for(const t of this.pendingDialTargets.values())t.abort();this.pendingDialTargets.clear()}async dial(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{peerId:n,multiaddr:i}=YN(e);if(null!=n){if(this.components.peerId.equals(n))throw Td(new Error("Tried to dial self"),JP.ERR_DIALED_SELF);if(null!=i&&(sM("storing multiaddrs %p",n,i),await this.components.peerStore.addressBook.add(n,[i])),await this.components.connectionGater.denyDialPeer(n))throw Td(new Error("The dial request is blocked by gater.allowDialPeer"),JP.ERR_PEER_DIAL_INTERCEPTED)}sM("creating dial target for %p",n);const o=new AbortController,s=lM();this.pendingDialTargets.set(s,o);let a,c=o.signal;null!=r.signal&&(c=(0,yb.anySignal)([c,r.signal]));try{a=await this._createDialTarget({peerId:n,multiaddr:i},{...r,signal:c})}finally{this.pendingDialTargets.delete(s)}if(0===a.addrs.length)throw Td(new Error("The dial request has no valid addresses"),JP.ERR_NO_VALID_ADDRESSES);const l=null!==(t=this.pendingDials.get(a.id))&&void 0!==t?t:this._createPendingDial(a,r);try{const e=await l.promise;return sM("dial succeeded to %s",a.id),e}catch(u){throw sM("dial failed to %s",a.id,u),l.controller.signal.aborted&&(u.code=JP.ERR_TIMEOUT),sM.error(u),u}finally{l.destroy()}}async _createDialTarget(e,t){let r=[];if(n_(e.multiaddr)&&r.push(e.multiaddr),!n_(e.multiaddr)&&Za(e.peerId)&&r.push(...await this._loadAddresses(e.peerId)),r=(await Promise.all(r.map((async e=>await this._resolve(e,t))))).flat().filter((e=>Boolean(this.components.transportManager.transportForMultiaddr(e)))),r=[...new Set(r.map((e=>e.toString())))].map((e=>o_(e))),r.length>this.maxAddrsToDial)throw Td(new Error("dial with more addresses than allowed"),JP.ERR_TOO_MANY_ADDRESSES);const n=Za(e.peerId)?e.peerId:void 0;if(null!=n){const e="/p2p/".concat(n.toString());r=r.map((t=>{const r=t.getPeerId();return null!=r&&n.equals(r)?t:t.encapsulate(e)}))}return{id:null==n?lM():n.toString(),addrs:r}}async _loadAddresses(e){const t=await this.components.peerStore.addressBook.get(e);return(await Promise.all(t.map((async t=>!await this.components.connectionGater.denyDialMultiaddr(e,t.multiaddr)&&t)))).filter(cM).sort(this.addressSorter).map((e=>e.multiaddr))}_createPendingDial(e){var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new oM({addrs:e.addrs,dialAction:async function(e){var r;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!0===(null===(r=n.signal)||void 0===r?void 0:r.aborted))throw Td(new Error("already aborted"),JP.ERR_ALREADY_ABORTED);return await t.components.transportManager.dial(e,n).catch((t=>{throw sM.error("dial to %s failed",e,t),t}))},dialer:this}),i=new rN.TimeoutController(this.timeout),o=[i.signal];null!=r.signal&&o.push(r.signal);const s=(0,yb.anySignal)(o);try{null===oN.setMaxListeners||void 0===oN.setMaxListeners||(0,oN.setMaxListeners)(1/0,s)}catch{}const a={dialRequest:n,controller:i,promise:n.run({...r,signal:s}),destroy:()=>{i.clear(),this.pendingDials.delete(e.id)}};return this.pendingDials.set(e.id,a),a}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return sM("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.includes(e)||(sM("token %d released",e),this.tokens.push(e))}async _resolve(e,t){if(!e.protoNames().includes("dnsaddr"))return[e];const r=await this._resolveRecord(e,t);return(await Promise.all(r.map((async e=>await this._resolve(e,t))))).flat().reduce(((e,t)=>(null==e.find((e=>e.equals(t)))&&e.push(t),e)),[])}async _resolveRecord(e,t){try{e=o_(e.toString());return await e.resolve(t)}catch(r){return sM.error("multiaddr ".concat(e.toString()," could not be resolved"),r),[]}}}function cM(e){return Boolean(e)}function lM(){return"".concat(parseInt(String(1e9*Math.random()),10).toString()).concat(Date.now())}const uM=jv("libp2p");class hM extends cS{constructor(e){var t,r,n,i,o;super(),this.started=!1,this.peerId=e.peerId;const s=this.components=new EB({peerId:e.peerId,datastore:null!==(t=e.datastore)&&void 0!==t?t:new $P,connectionGater:{denyDialPeer:async()=>await Promise.resolve(!1),denyDialMultiaddr:async()=>await Promise.resolve(!1),denyInboundConnection:async()=>await Promise.resolve(!1),denyOutboundConnection:async()=>await Promise.resolve(!1),denyInboundEncryptedConnection:async()=>await Promise.resolve(!1),denyOutboundEncryptedConnection:async()=>await Promise.resolve(!1),denyInboundUpgradedConnection:async()=>await Promise.resolve(!1),denyOutboundUpgradedConnection:async()=>await Promise.resolve(!1),filterMultiaddrForPeer:async()=>await Promise.resolve(!0),...e.connectionGater}});s.peerStore=new bB(s,{addressFilter:this.components.connectionGater.filterMultiaddrForPeer,...e.peerStore}),this.services=[s],null!=e.metrics&&(this.metrics=this.components.metrics=this.configureComponent(e.metrics(this.components))),this.peerStore=this.components.peerStore,this.peerStore.addEventListener("peer",(e=>{const{detail:t}=e;this.dispatchEvent(new uS("peer:discovery",{detail:t}))})),null!=e.connectionProtector&&(this.components.connectionProtector=e.connectionProtector(s)),this.components.upgrader=new nL(this.components,{connectionEncryption:(null!==(r=e.connectionEncryption)&&void 0!==r?r:[]).map((e=>this.configureComponent(e(this.components)))),muxers:(null!==(n=e.streamMuxers)&&void 0!==n?n:[]).map((e=>this.configureComponent(e(this.components)))),inboundUpgradeTimeout:e.connectionManager.inboundUpgradeTimeout}),this.components.dialer=new aM(this.components,e.connectionManager),this.connectionManager=this.components.connectionManager=new JN(this.components,e.connectionManager),this.components.connectionManager.addEventListener("peer:disconnect",(e=>{this.dispatchEvent(new uS("peer:disconnect",{detail:e.detail}))})),this.components.connectionManager.addEventListener("peer:connect",(e=>{this.dispatchEvent(new uS("peer:connect",{detail:e.detail}))})),this.registrar=this.components.registrar=new eL(this.components),this.components.transportManager=new Bx(this.components,e.transportManager),this.components.addressManager=new SN(this.components,e.addresses),this.configureComponent(new EL(this.components)),this.configureComponent(new iD(this.components,{enabled:e.connectionManager.autoDial,minConnections:e.connectionManager.minConnections,autoDialInterval:e.connectionManager.autoDialInterval}));const a=Sx.generateOptions();this.keychain=this.configureComponent(new Sx(this.components,{...a,...e.keychain})),this.services.push(new bL(this.components,e.nat)),e.transports.forEach((e=>{this.components.transportManager.add(this.configureComponent(e(this.components)))})),this.identifyService=new cL(this.components,{...e.identify}),this.configureComponent(this.identifyService),null!=e.dht?this.dht=this.components.dht=e.dht(this.components):this.dht=new tM,null!=e.pubsub?this.pubsub=this.components.pubsub=e.pubsub(this.components):this.pubsub=new rM;const c=(null!==(i=e.peerRouters)&&void 0!==i?i:[]).map((e=>this.configureComponent(e(this.components))));null!=e.dht&&(c.push(this.configureComponent(new _L(this.dht))),this.dht.addEventListener("peer",(e=>{this.onDiscoveryPeer(e)}))),this.peerRouting=this.components.peerRouting=this.configureComponent(new aN(this.components,{...e.peerRouting,routers:c}));const l=(null!==(o=e.contentRouters)&&void 0!==o?o:[]).map((e=>this.configureComponent(e(this.components))));null!=e.dht&&l.push(this.configureComponent(new wB(this.dht))),this.contentRouting=this.components.contentRouting=this.configureComponent(new cN(this.components,{routers:l})),e.relay.enabled&&(this.components.transportManager.add(this.configureComponent(new ND(this.components,e.relay))),this.configureComponent(new ox(this.components,{addressSorter:e.connectionManager.addressSorter,...e.relay}))),this.fetchService=this.configureComponent(new dL(this.components,{...e.fetch})),this.pingService=this.configureComponent(new pL(this.components,{...e.ping}));for(const h of null!==(u=e.peerDiscovery)&&void 0!==u?u:[]){var u;this.configureComponent(h(this.components)).addEventListener("peer",(e=>{this.onDiscoveryPeer(e)}))}}configureComponent(e){return FP(e)&&this.services.push(e),e}async start(){if(!this.started){this.started=!0,uM("libp2p is starting");try{await Promise.all(this.services.map((async e=>{null!=e.beforeStart&&await e.beforeStart()}))),await Promise.all(this.services.map((e=>e.start()))),await Promise.all(this.services.map((async e=>{null!=e.afterStart&&await e.afterStart()}))),uM("libp2p has started")}catch(e){throw uM.error("An error occurred starting libp2p",e),await this.stop(),e}}}async stop(){this.started&&(uM("libp2p is stopping"),this.started=!1,await Promise.all(this.services.map((async e=>{null!=e.beforeStop&&await e.beforeStop()}))),await Promise.all(this.services.map((e=>e.stop()))),await Promise.all(this.services.map((async e=>{null!=e.afterStop&&await e.afterStop()}))),uM("libp2p has stopped"))}isStarted(){return this.started}getConnections(e){return this.components.connectionManager.getConnections(e)}getPeers(){const e=new QN;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 await this.components.connectionManager.openConnection(e,t)}async dialProtocol(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==t)throw Td(new Error("no protocols were provided to open a stream"),JP.ERR_INVALID_PROTOCOLS_FOR_STREAM);if(0===(t=Array.isArray(t)?t:[t]).length)throw Td(new Error("no protocols were provided to open a stream"),JP.ERR_INVALID_PROTOCOLS_FOR_STREAM);const n=await this.dial(e,r);return await n.newStream(t,r)}getMultiaddrs(){return this.components.addressManager.getAddresses()}getProtocols(){return this.components.registrar.getProtocols()}async hangUp(e){var t;n_(e)&&(e=bN(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(uM("getPublicKey %p",e),null!=e.publicKey)return e.publicKey;const r=await this.peerStore.get(e);if(null!=r.pubKey)return r.pubKey;if(null==this.dht)throw Td(new Error("Public key was not in the peer store and the DHT is not enabled"),JP.ERR_NO_ROUTERS_AVAILABLE);const n=Jl([ru("/pk/"),e.multihash.digest]);for await(const i of this.dht.get(n,t))if("VALUE"===i.name){const t=ov(i.value);return await this.peerStore.keyBook.set(e,i.value),t.bytes}throw Td(new Error("Node not responding with its public key: ".concat(e.toString())),JP.ERR_INVALID_RECORD)}async fetch(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(n_(e)){var n;const t=bN(null!==(n=e.getPeerId())&&void 0!==n?n:"");await this.components.peerStore.addressBook.add(t,[e]),e=t}return await this.fetchService.fetch(e,t,r)}async ping(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n_(e)){var r;const t=bN(null!==(r=e.getPeerId())&&void 0!==r?r:"");await this.components.peerStore.addressBook.add(t,[e]),e=t}return await this.pingService.ping(e,t)}async handle(e,t,r){Array.isArray(e)||(e=[e]),await Promise.all(e.map((async e=>{await this.components.registrar.handle(e,t,r)})))}async unhandle(e){Array.isArray(e)||(e=[e]),await Promise.all(e.map((async e=>{await this.components.registrar.unhandle(e)})))}async register(e,t){return await this.registrar.register(e,t)}unregister(e){this.registrar.unregister(e)}onDiscoveryPeer(e){const{detail:t}=e;t.id.toString()!==this.peerId.toString()?(t.multiaddrs.length>0&&this.components.peerStore.addressBook.add(t.id,t.multiaddrs).catch((e=>uM.error(e))),t.protocols.length>0&&this.components.peerStore.protoBook.set(t.id,t.protocols).catch((e=>uM.error(e))),this.dispatchEvent(new uS("peer:discovery",{detail:t}))):uM.error(new Error(JP.ERR_DISCOVERED_SELF))}}async function dM(e){if(null==e.peerId){const n=e.datastore;if(null!=n)try{var t;const r=new Sx({datastore:n},{...Sx.generateOptions(),...null!==(t=e.keychain)&&void 0!==t?t:{}});e.peerId=await r.exportPeerId("self")}catch(r){if("ERR_NOT_FOUND"!==r.code)throw r}}return null==e.peerId&&(e.peerId=await ZB()),new hM(function(e){var t,r;const n=AN(DB,e);if(null==n.transports||n.transports.length<1)throw Td(new Error(XP.ERR_TRANSPORTS_REQUIRED),JP.ERR_TRANSPORTS_REQUIRED);if(null==n.connectionEncryption||0===n.connectionEncryption.length)throw Td(new Error(XP.CONN_ENCRYPTION_REQUIRED),JP.CONN_ENCRYPTION_REQUIRED);if(null===n.connectionProtector&&null!=(null===(t=globalThis.process)||void 0===t||null===(r=t.env)||void 0===r?void 0:r.LIBP2P_FORCE_PNET))throw Td(new Error(XP.ERR_PROTECTOR_REQUIRED),JP.ERR_PROTECTOR_REQUIRED);return n.identify.host.agentVersion===sL&&(p_||d_?n.identify.host.agentVersion+=" UserAgent=".concat(globalThis.process.version):(h_||g_||f_||y_)&&(n.identify.host.agentVersion+=" UserAgent=".concat(globalThis.navigator.userAgent))),n}(e))}const fM={lightPush:1,filter:1,store:1};async function pM(e){var t,r;const n=null!==(t=null===e||void 0===e?void 0:e.libp2p)&&void 0!==t?t:{},i=null!==(r=n.peerDiscovery)&&void 0!==r?r:[];null!==e&&void 0!==e&&e.defaultBootstrap&&(i.push(gM()),Object.assign(n,{peerDiscovery:i}));const o=await yM(void 0,n,null===e||void 0===e?void 0:e.userAgent),s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new Wf(t,e)}(e),a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new vf(t,e)}(e);let c;return c=null!==e&&void 0!==e&&e.useFilterV1?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new sf(t,e)}(e):function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>new pf(t,e)}(),new rh(null!==e&&void 0!==e?e:{},o,s,a,c)}function gM(){return yk([fk.PROD],fM)}async function yM(e,t,r){return async function(e){const t=await dM(e);return!1!==e.start&&await t.start(),t}(Object.assign({transports:[nS({filter:J_})],streamMuxers:[kb()],connectionEncryption:[$v()],identify:{host:{agentVersion:null!==r&&void 0!==r?r:eh}}},e?{pubsub:e}:{},null!==t&&void 0!==t?t:{}))}const mM=N.createContext({decoder:void 0,encoder:void 0}),vM=()=>N.useContext(mM),bM=e=>{const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[r,n]=N.useState(Xh({contentTopic:e,ephemeral:t})),[i,o]=N.useState(Zh(e));return N.useEffect((()=>{n(Xh({contentTopic:e,ephemeral:t})),o(Zh(e))}),[e,t]),{encoder:r,decoder:i}}(e.contentTopic,e.ephemeral);return N.createElement(mM.Provider,{value:t},e.children)},wM=e=>{const{factory:t,options:r,protocols:n=[]}=e,[i,o]=N.useState(void 0),[s,a]=N.useState(!0),[c,l]=N.useState(void 0);return N.useEffect((()=>{let e=!1;return a(!0),t(r).then((async t=>{e||(await t.start(),await rp(t,n),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}},EM=e=>{const{node:t,encoder:r}=e,n=N.useCallback((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return t.lightPush.send(r,e,n)}),[t,r]);return t||r?{push:n}:{}},_M=N.createContext({node:void 0,isLoading:!1,error:void 0}),SM=()=>N.useContext(_M),AM=e=>{const t=(r={options:e.options,protocols:e.protocols},wM({...r,factory:pM}));var r;return N.createElement(_M.Provider,{value:t},e.children)};class TM{constructor(e,t,r){Xa(this,"multicodec",void 0),Xa(this,"peerStore",void 0),Xa(this,"getConnections",void 0),this.multicodec=e,this.peerStore=t,this.getConnections=r}async peers(){return Kd(this.peerStore,[this.multicodec])}async getPeer(e){const{peer:t}=await qd(this.peerStore,[this.multicodec],e);return t}async newStream(e){const t=Hd(this.getConnections(e.id));if(!t)throw new Error("Failed to get a connection to the peer");return t.newStream(this.multicodec)}}function CM(e){return null!=e[Symbol.asyncIterator]}const kM=e=>{const t=Ed.encodingLength(e),r=Hl(t);return Ed.encode(e,r),kM.bytes=t,r};function IM(e,t){var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:kM;function*o(e){const t=i(e.byteLength);t instanceof Uint8Array?yield t:yield*t,e instanceof Uint8Array?yield e:yield*e}return CM(e)?async function*(){for await(const t of e)yield*o(t)}():function*(){for(const t of e)yield*o(t)}()}kM.bytes=0,IM.single=(e,t)=>{var r,n;const i=null!==(n=(t=null!==(r=t)&&void 0!==r?r:{}).lengthEncoder)&&void 0!==n?n:kM;return new cd(i(e.byteLength),e)};const RM=8,PM=4194304;var NM;!function(e){e[e.LENGTH=0]="LENGTH",e[e.DATA=1]="DATA"}(NM||(NM={}));const DM=e=>{const t=Ed.decode(e);return DM.bytes=Ed.encodingLength(t),t};function xM(e,t){var r,n,i;const o=new cd;let s=NM.LENGTH,a=-1;const c=null!==(r=null===t||void 0===t?void 0:t.lengthDecoder)&&void 0!==r?r:DM,l=null!==(n=null===t||void 0===t?void 0:t.maxLengthLength)&&void 0!==n?n:RM,u=null!==(i=null===t||void 0===t?void 0:t.maxDataLength)&&void 0!==i?i:PM;function*h(){for(;o.byteLength>0;){if(s===NM.LENGTH)try{if(a=c(o),a<0)throw Td(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(a>u)throw Td(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=NM.DATA}catch(e){if(e instanceof RangeError){if(o.byteLength>l)throw Td(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw e}if(s===NM.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=NM.LENGTH}}}return CM(e)?async function*(){for await(const t of e)o.append(t),yield*h();if(o.byteLength>0)throw Td(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 Td(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}DM.bytes=0,xM.fromReader=(e,t)=>{let r=1;return xM(async function*(){for(;;)try{const{done:t,value:n}=await e.next(r);if(!0===t)return;null!=n&&(yield n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}(),{...null!==t&&void 0!==t?t:{},onLength:e=>{r=e}})};const LM=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[];for(const i of t)null==i[Symbol.asyncIterator]&&n.push(i);return n.length===t.length?function*(){for(const e of n)yield*e}():async function*(){const e=xd({objectMode:!0});Promise.resolve().then((async()=>{try{await Promise.all(t.map((async t=>{for await(const r of t)e.push(r)}))),e.end()}catch(r){e.end(r)}})),yield*e}()};const OM=function(){let e;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(;r.length>0;)e=r.shift()(e);return e},BM=e=>null!=(null===e||void 0===e?void 0:e[Symbol.asyncIterator]),MM=e=>null!=(null===e||void 0===e?void 0:e[Symbol.iterator]),UM=e=>null!=e&&(null!=e.sink&&null!=e.source),FM=e=>t=>{const r=e.sink(t);if(null!=(null===r||void 0===r?void 0:r.then)){const t=xd({objectMode:!0});let n;r.then((()=>{t.end()}),(e=>{t.end(e)}));const i=e.source;if(BM(i))n=async function*(){yield*i,t.end()};else{if(!MM(i))throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");n=function*(){yield*i,t.end()}}return LM(t,n())}return e.source};class jM{constructor(e){Xa(this,"proto",void 0),this.proto=e}static createRequest(e){const{numPeers:t}=e;return new jM({query:{numPeers:t},response:void 0})}encode(){return Kh.encode(this.proto)}static decode(e){const t=Kh.decode(e);return new jM(t)}get query(){return this.proto.query}get response(){return this.proto.response}}const zM="/vac/waku/peer-exchange/2.0.0-alpha1",VM=Yu("waku:peer-exchange");class KM extends TM{constructor(e){super(zM,e.peerStore,e.connectionManager.getConnections.bind(e.connectionManager)),Xa(this,"components",void 0),Xa(this,"multicodec",void 0),this.components=e,this.multicodec=zM}async query(e){const{numPeers:t}=e,r=jM.createRequest({numPeers:BigInt(t)}),n=await this.getPeer(e.peerId),i=await this.newStream(n),o=await function(e){if(null==e)throw new Error("Empty pipeline");if(UM(e)){const t=e;e=()=>t.source}else if(MM(e)||BM(e)){const t=e;e=()=>t}for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const i=[e,...r];if(i.length>1&&UM(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++)UM(i[o])&&(i[o]=FM(i[o]));return OM(...i)}([r.encode()],IM,i,xM,(async e=>await id(e)));try{const e=new cd;o.forEach((t=>{e.append(t)}));const{response:t}=jM.decode(e);return t?Promise.all(t.peerInfos.map((e=>e.enr)).filter(Mf).map((async e=>({ENR:await ZA.fromRLP(e)})))):void VM("PeerExchangeRPC message did not contains a `response` field")}catch(s){return void VM("Failed to decode push reply",s)}}}let qM;const HM=Yu("waku:peer-exchange-discovery"),GM=1e4,WM=3,QM="peer-exchange";qM=Symbol.toStringTag;class YM extends cS{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,"eventHandler",(async e=>{const{protocols:t,peerId:r}=e.detail;t.includes(zM)&&!this.queryingPeers.has(r.toString())&&(this.queryingPeers.add(r.toString()),this.startRecurringQueries(r).catch((e=>HM("Error querying peer ".concat(e)))))})),Xa(this,"startRecurringQueries",(async e=>{var t;const r=e.toString(),{queryInterval:n=GM,maxRetries:i=WM}=this.options;await this.query(e);const o=null!==(t=this.queryAttempts.get(r))&&void 0!==t?t:1;o>i?this.abortQueriesForPeer(r):setTimeout((async()=>{this.queryAttempts.set(r,o+1),await this.startRecurringQueries(e)}),n*o)})),this.components=e,this.peerExchange=new KM(e),this.options=t,this.isStarted=!1}start(){this.isStarted||(HM("Starting peer exchange node discovery, discovering peers"),this.components.peerStore.addEventListener("change:protocols",this.eventHandler))}stop(){this.isStarted&&(HM("Stopping peer exchange node discovery"),this.isStarted=!1,this.queryingPeers.clear(),this.components.peerStore.removeEventListener("change:protocols",this.eventHandler))}get[iS](){return!0}get[qM](){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 r,n;const{ENR:e}=i;if(!e){HM("No ENR in peerInfo object, skipping");continue}const{peerId:t,peerInfo:o}=e;if(!t||!o)continue;const{multiaddrs:s}=o;(await this.components.peerStore.getTags(t)).find((e=>{let{name:t}=e;return t===QM}))||(await this.components.peerStore.tagPeer(t,QM,{value:null!==(r=this.options.tagValue)&&void 0!==r?r:50,ttl:null!==(n=this.options.tagTTL)&&void 0!==n?n:12e4}),this.dispatchEvent(new uS("peer",{detail:{id:t,multiaddrs:s,protocols:[]}})))}else HM("Peer exchange query failed, no peer info returned")}abortQueriesForPeer(e){HM("Aborting queries for peer: ".concat(e)),this.queryingPeers.delete(e),this.queryAttempts.delete(e)}}async function $M(e,t,r){let n=[];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=>n.push(e)));break;case"/nick":(function(e,t){return e?(t(e),["New nick: ".concat(e)]):["No nick provided"]})(i.shift(),r).map((e=>n.push(e)));break;case"/info":(function(e){return e?["PeerId: ".concat(e.libp2p.peerId.toString())]:["Waku node is starting"]})(t).map((e=>n.push(e)));break;case"/connect":(function(e,t){if(!t)return["Waku node is starting"];if(!e)return["No peer provided"];try{const r=o_(e),n=r.getPeerId();return n?(t.dial(r).catch((e=>console.error("Failed to dial ".concat(r),e))),["".concat(n,": ").concat(r.toString()," added to address book, autodial in progress")]):["Peer Id needed to dial"]}catch(r){return["Invalid multiaddr: "+r]}})(i.shift(),t).map((e=>n.push(e)));break;case"/peers":(await async function(e){if(!e)return["Waku node is starting"];let t=[];const r=await e.libp2p.peerStore.all();return Array.from(r).forEach((e=>{t.push(e.id.toString()+":");let r=" addresses: [";e.addresses.forEach((e=>{let{multiaddr:t}=e;r+=" "+t.toString()+","})),r=r.replace(/,$/,""),r+="]",t.push(r);let n=" protocols: [";n+=e.protocols,n+="]",t.push(n)})),0===t.length&&t.push("Not connected to any peer."),t}(t)).map((e=>n.push(e)));break;case"/connections":(function(e){if(!e)return["Waku node is starting"];let t=[],r=" connections: \n";return e.libp2p.getConnections().forEach((e=>{r+=e.remotePeer.toString()+", ",r+=JSON.stringify(e.stat),r+="; "+JSON.stringify(e.streams),r+="\n"})),t.push(r),0===t.length&&t.push("Not connected to any peer."),t})(t).map((e=>n.push(e)));break;default:n.push("Unknown Command '".concat(o,"'"))}return{command:o,response:n}}var XM=__webpack_require__(184);function JM(e){const t=e.messages.map((e=>{var t;return(0,XM.jsx)(qs,{authorName:e.nick,date:ZM(e),children:(0,XM.jsx)($s,{children:e.payloadAsUtf8})},e.nick+e.payloadAsUtf8+e.timestamp.valueOf()+(null===(t=e.sentTimestamp)||void 0===t?void 0:t.valueOf()))}));return(0,XM.jsxs)(Os,{active:!0,containScrollInSubtree:!0,children:[t,(0,XM.jsx)(eU,{messages:e.messages})]})}function ZM(e){return e.timestamp.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",hour12:!1})}const eU=e=>{const t=(0,N.useRef)();return(0,N.useEffect)((()=>{t.current.scrollIntoView()}),[e.messages]),(0,XM.jsx)("div",{ref:t})};function tU(e){const{hasLightPushPeers:t}=e,{node:r}=SM(),[n,i]=(0,N.useState)(""),[o,s]=(0,N.useState)(!1),a=async()=>{if(e.sendMessage&&n){try{await e.sendMessage(n)}catch(t){console.error("Failed to send message: ".concat(t))}i("")}};return(0,N.useEffect)((()=>{n.startsWith("/")||t?s(!0):r&&s(!1)}),[r,n,t]),(0,XM.jsx)(Ia,{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,XM.jsxs)(Qo,{align:"center",children:[(0,XM.jsx)(As,{children:(0,XM.jsx)(Ba,{})}),(0,XM.jsx)(Cs,{children:(0,XM.jsx)(Ra,{})})]})})}var rU=__webpack_require__(7310);const nU=rU.Reader;["uint64","int64","sint64","fixed64","sfixed64"].forEach((e=>{const t=nU.prototype[e];nU.prototype[e]=function(){return BigInt(t.call(this).toString())}}));const iU=rU.Writer;var oU;let sU;["uint64","int64","sint64","fixed64","sfixed64"].forEach((e=>{const t=iU.prototype[e];iU.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"}(oU||(oU={})),function(e){let t;e.codec=()=>(null==t&&(t=function(e,t){return function(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}("message",oU.LENGTH_DELIMITED,e,t)}((function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!1!==r.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!==r.lengthDelimited&&t.ldelim()}),((e,t)=>{const r={timestamp:0n,nick:"",payload:new Uint8Array(0)},n=null==t?e.len:e.pos+t;for(;e.pos<n;){const t=e.uint32();switch(t>>>3){case 1:r.timestamp=e.uint64();break;case 2:r.nick=e.string();break;case 3:r.payload=e.bytes();break;default:e.skipType(7&t)}}if(null==r.timestamp)throw new Error('Protocol error: value for required field "timestamp" was not found in protobuf');if(null==r.nick)throw new Error('Protocol error: value for required field "nick" was not found in protobuf');if(null==r.payload)throw new Error('Protocol error: value for required field "payload" was not found in protobuf');return r}))),t),e.encode=e=>function(e,t){const r=iU.create();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}(e,sU.codec()),e.decode=e=>function(e,t){const r=nU.create(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}(e,sU.codec())}(sU||(sU={}));class aU{constructor(e){this.proto=e}static fromUtf8String(e,t,r){const n=BigInt(Math.floor(e.valueOf()/1e3)),i=zf(r);return new aU({timestamp:n,nick:t,payload:i})}static decode(e){const t=sU.decode(e);return new aU(t)}encode(){return sU.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?jf(this.proto.payload):""}}var cU=__webpack_require__(8555);class lU{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=aU.decode(e.payload);if(t)return new lU(t,e.timestamp)}catch(t){console.error("Failed to decode chat message",t)}}static fromUtf8String(e,t){const r=new Date;return new lU(aU.fromUtf8String(r,e,t),r)}get nick(){return this.chatMessage.nick}get timestamp(){return this.chatMessage.timestamp}get payloadAsUtf8(){return this.chatMessage.payloadAsUtf8}}const uU=()=>{const[e,t]=(0,N.useState)((()=>{const e=window.localStorage.getItem("nick");return null!==e?e:(0,cU.R)()}));return(0,N.useEffect)((()=>{localStorage.setItem("nick",e)}),[e]),[e,t]},hU=e=>{const{messages:t}=(e=>{const{node:t,decoder:r}=e,[n,i]=N.useState(void 0),[o,s]=N.useState(!1),[a,c]=N.useState([]),l=N.useCallback((e=>{e&&c((t=>[...t,e]))}),[c]);return N.useEffect((()=>{if(!t||!r)return;let e=null;return s(!0),t.filter.subscribe([r],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,r,l,i,s]),{error:n,messages:a,isLoading:o}})(e),{messages:r}=(e=>{const{node:t,decoder:r,options:n}=e,[i,o]=N.useState(void 0),[s,a]=N.useState(!1),[c,l]=N.useState([]),u=N.useCallback((e=>{e&&e.length&&l((t=>[...t,...e]))}),[l]);return N.useEffect((()=>{if(!t||!r)return;let e=!1;return a(!0),Promise.resolve().then((async()=>{for await(const i of t.store.queryGenerator([r],n)){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,r,u,o,a]),{error:i,isLoading:s,messages:c}})(e),[n,i]=(0,N.useState)([]);return[N.useMemo((()=>[...r,...t].map(lU.fromWakuMessage).concat(n).filter((e=>!!e)).filter((e=>""!==e.payloadAsUtf8)).sort(((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()))),[r,t,n]),e=>{e&&e.length&&i((t=>[...t,...e]))}]},dU=e=>{const[t,r]=(0,N.useState)(new Set),[n,i]=(0,N.useState)(new Set);return(0,N.useEffect)((()=>{if(!e)return;const t=async t=>{const{peerId:n}=t.detail;(await e.libp2p.peerStore.getTags(n)).map((e=>e.name)).includes("peer-exchange")?i((e=>new Set(e).add(n.toString()))):r((e=>new Set(e).add(n.toString())))};return e.libp2p.peerStore.addEventListener("change:protocols",t),()=>{e.libp2p.peerStore.removeEventListener("change:protocols",t)}}),[e]),(0,N.useEffect)((()=>{console.log("Bootstrap Peers:"),console.table(t),console.log("Peer Exchange Peers:"),console.table(n)}),[t,n]),{bootstrapPeers:t,peerExchangePeers:n}},fU=e=>{const{node:t}=e,[r,n]=N.useState({});return N.useEffect((()=>{if(!t)return;const e=async e=>{var r,i,o;const s=await Promise.all([pU(null===t||void 0===t||null===(r=t.store)||void 0===r?void 0:r.peers()),pU(null===t||void 0===t||null===(i=t.filter)||void 0===i?void 0:i.peers()),pU(null===t||void 0===t||null===(o=t.lightPush)||void 0===o?void 0:o.peers())]);n({storePeers:s[0],filterPeers:s[1],lightPushPeers:s[2]})};return e(),t.libp2p.peerStore.addEventListener("change:protocols",e),()=>{t.libp2p.peerStore.removeEventListener("change:protocols",e)}}),[t,n]),r};function pU(e){return e?e.catch((e=>{})):Promise.resolve(void 0)}function gU(e){const{node:t}=SM(),{encoder:r}=vM(),{push:n}=EM({node:t,encoder:r}),{bootstrapPeers:i,peerExchangePeers:o}=dU(t),{storePeers:s,filterPeers:a,lightPushPeers:c}=fU({node:t}),l=yU(null===c||void 0===c?void 0:c.length),u=yU(null===a||void 0===a?void 0:a.length),h=yU(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,XM.jsxs)("div",{className:"chat-container",style:{height:"98vh",display:"flex",flexDirection:"column"},children:[(0,XM.jsx)(Ea,{leftIcons:[d],rightIcons:[f,"View console for more details."],title:"Waku v2 chat app"}),(0,XM.jsx)(JM,{messages:e.messages}),(0,XM.jsx)(tU,{hasLightPushPeers:!!c,sendMessage:async t=>{if(n&&t)if(t.startsWith("/"))e.commandHandler(t);else{const r=new Date,i=aU.fromUtf8String(r,e.nick,t).encode();await n({payload:i,timestamp:r})}}})]})}function yU(e){return e||0}const mU=new Date;mU.setTime(Date.now()-6048e5);const vU=new Date;function bU(){const{node:e}=SM(),{decoder:t}=vM(),[r,n]=hU({node:e,decoder:t,options:{pageSize:5,pageDirection:Vu.FORWARD,timeFilter:{startTime:mU,endTime:vU}}}),[i,o]=uU();return(0,XM.jsx)("div",{className:"chat-app",style:{height:"100vh",width:"100vw",overflow:"hidden"},children:(0,XM.jsx)(gU,{nick:i,messages:r,commandHandler:t=>{$M(t,e,o).then((e=>{let{command:t,response:r}=e;const i=r.map((e=>lU.fromUtf8String(t,e)));n(i)}))}})})}const wU=[ju.Filter,ju.Store,ju.LightPush],EU={libp2p:{peerDiscovery:[yk([fk.TEST],{store:1,filter:2,lightPush:2}),e=>new YM(e)]}};x.render((0,XM.jsx)(N.StrictMode,{children:(0,XM.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,XM.jsx)(AM,{options:EU,protocols:wU,children:(0,XM.jsx)(bM,{contentTopic:"/toy-chat/2/huilong/proto",children:(0,XM.jsx)(bU,{})})})})}),document.getElementById("root"))})()})();
|
|
//# sourceMappingURL=main.6c2ed0a5.js.map |